@rtsee/utilities-ui 0.0.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 (89) hide show
  1. package/dist/utilities-ui/src/cropper/index.d.ts +3 -0
  2. package/dist/utilities-ui/src/cropper/index.d.ts.map +1 -0
  3. package/dist/utilities-ui/src/cropper/index.js +3 -0
  4. package/dist/utilities-ui/src/cropper/index.js.map +1 -0
  5. package/dist/utilities-ui/src/cropper/interfaces/CropperImageInterface.d.ts +5 -0
  6. package/dist/utilities-ui/src/cropper/interfaces/CropperImageInterface.d.ts.map +1 -0
  7. package/dist/utilities-ui/src/cropper/interfaces/CropperImageInterface.js +1 -0
  8. package/dist/utilities-ui/src/cropper/interfaces/CropperImageInterface.js.map +1 -0
  9. package/dist/utilities-ui/src/cropper/interfaces/index.d.ts +2 -0
  10. package/dist/utilities-ui/src/cropper/interfaces/index.d.ts.map +1 -0
  11. package/dist/utilities-ui/src/cropper/interfaces/index.js +2 -0
  12. package/dist/utilities-ui/src/cropper/interfaces/index.js.map +1 -0
  13. package/dist/utilities-ui/src/cropper/models/Cropper.d.ts +33 -0
  14. package/dist/utilities-ui/src/cropper/models/Cropper.d.ts.map +1 -0
  15. package/dist/utilities-ui/src/cropper/models/Cropper.js +63 -0
  16. package/dist/utilities-ui/src/cropper/models/Cropper.js.map +1 -0
  17. package/dist/utilities-ui/src/cropper/models/Image.d.ts +12 -0
  18. package/dist/utilities-ui/src/cropper/models/Image.d.ts.map +1 -0
  19. package/dist/utilities-ui/src/cropper/models/Image.js +24 -0
  20. package/dist/utilities-ui/src/cropper/models/Image.js.map +1 -0
  21. package/dist/utilities-ui/src/cropper/models/index.d.ts +3 -0
  22. package/dist/utilities-ui/src/cropper/models/index.d.ts.map +1 -0
  23. package/dist/utilities-ui/src/cropper/models/index.js +3 -0
  24. package/dist/utilities-ui/src/cropper/models/index.js.map +1 -0
  25. package/dist/utilities-ui/src/forms/fields/autocomplete/index.d.ts +3 -0
  26. package/dist/utilities-ui/src/forms/fields/autocomplete/index.d.ts.map +1 -0
  27. package/dist/utilities-ui/src/forms/fields/autocomplete/index.js +3 -0
  28. package/dist/utilities-ui/src/forms/fields/autocomplete/index.js.map +1 -0
  29. package/dist/utilities-ui/src/forms/fields/autocomplete/interfaces/AutocompleteOptions.d.ts +13 -0
  30. package/dist/utilities-ui/src/forms/fields/autocomplete/interfaces/AutocompleteOptions.d.ts.map +1 -0
  31. package/dist/utilities-ui/src/forms/fields/autocomplete/interfaces/AutocompleteOptions.js +1 -0
  32. package/dist/utilities-ui/src/forms/fields/autocomplete/interfaces/AutocompleteOptions.js.map +1 -0
  33. package/dist/utilities-ui/src/forms/fields/autocomplete/models/Autocomplete.d.ts +24 -0
  34. package/dist/utilities-ui/src/forms/fields/autocomplete/models/Autocomplete.d.ts.map +1 -0
  35. package/dist/utilities-ui/src/forms/fields/autocomplete/models/Autocomplete.js +71 -0
  36. package/dist/utilities-ui/src/forms/fields/autocomplete/models/Autocomplete.js.map +1 -0
  37. package/dist/utilities-ui/src/forms/index.d.ts +2 -0
  38. package/dist/utilities-ui/src/forms/index.d.ts.map +1 -0
  39. package/dist/utilities-ui/src/forms/index.js +2 -0
  40. package/dist/utilities-ui/src/forms/index.js.map +1 -0
  41. package/dist/utilities-ui/src/image-uploader/index.d.ts +3 -0
  42. package/dist/utilities-ui/src/image-uploader/index.d.ts.map +1 -0
  43. package/dist/utilities-ui/src/image-uploader/index.js +3 -0
  44. package/dist/utilities-ui/src/image-uploader/index.js.map +1 -0
  45. package/dist/utilities-ui/src/image-uploader/interfaces/ImageUploaderOptions.d.ts +12 -0
  46. package/dist/utilities-ui/src/image-uploader/interfaces/ImageUploaderOptions.d.ts.map +1 -0
  47. package/dist/utilities-ui/src/image-uploader/interfaces/ImageUploaderOptions.js +1 -0
  48. package/dist/utilities-ui/src/image-uploader/interfaces/ImageUploaderOptions.js.map +1 -0
  49. package/dist/utilities-ui/src/image-uploader/interfaces/index.d.ts +2 -0
  50. package/dist/utilities-ui/src/image-uploader/interfaces/index.d.ts.map +1 -0
  51. package/dist/utilities-ui/src/image-uploader/interfaces/index.js +2 -0
  52. package/dist/utilities-ui/src/image-uploader/interfaces/index.js.map +1 -0
  53. package/dist/utilities-ui/src/image-uploader/models/ImageUploader.d.ts +32 -0
  54. package/dist/utilities-ui/src/image-uploader/models/ImageUploader.d.ts.map +1 -0
  55. package/dist/utilities-ui/src/image-uploader/models/ImageUploader.js +109 -0
  56. package/dist/utilities-ui/src/image-uploader/models/ImageUploader.js.map +1 -0
  57. package/dist/utilities-ui/src/image-uploader/models/index.d.ts +2 -0
  58. package/dist/utilities-ui/src/image-uploader/models/index.d.ts.map +1 -0
  59. package/dist/utilities-ui/src/image-uploader/models/index.js +2 -0
  60. package/dist/utilities-ui/src/image-uploader/models/index.js.map +1 -0
  61. package/dist/utilities-ui/src/index.d.ts +5 -0
  62. package/dist/utilities-ui/src/index.d.ts.map +1 -0
  63. package/dist/utilities-ui/src/index.js +5 -0
  64. package/dist/utilities-ui/src/index.js.map +1 -0
  65. package/dist/utilities-ui/src/uploader/index.d.ts +3 -0
  66. package/dist/utilities-ui/src/uploader/index.d.ts.map +1 -0
  67. package/dist/utilities-ui/src/uploader/index.js +3 -0
  68. package/dist/utilities-ui/src/uploader/index.js.map +1 -0
  69. package/dist/utilities-ui/src/uploader/interfaces/UploadResult.d.ts +17 -0
  70. package/dist/utilities-ui/src/uploader/interfaces/UploadResult.d.ts.map +1 -0
  71. package/dist/utilities-ui/src/uploader/interfaces/UploadResult.js +1 -0
  72. package/dist/utilities-ui/src/uploader/interfaces/UploadResult.js.map +1 -0
  73. package/dist/utilities-ui/src/uploader/interfaces/UploaderOptions.d.ts +12 -0
  74. package/dist/utilities-ui/src/uploader/interfaces/UploaderOptions.d.ts.map +1 -0
  75. package/dist/utilities-ui/src/uploader/interfaces/UploaderOptions.js +1 -0
  76. package/dist/utilities-ui/src/uploader/interfaces/UploaderOptions.js.map +1 -0
  77. package/dist/utilities-ui/src/uploader/interfaces/index.d.ts +3 -0
  78. package/dist/utilities-ui/src/uploader/interfaces/index.d.ts.map +1 -0
  79. package/dist/utilities-ui/src/uploader/interfaces/index.js +3 -0
  80. package/dist/utilities-ui/src/uploader/interfaces/index.js.map +1 -0
  81. package/dist/utilities-ui/src/uploader/models/Uploader.d.ts +38 -0
  82. package/dist/utilities-ui/src/uploader/models/Uploader.d.ts.map +1 -0
  83. package/dist/utilities-ui/src/uploader/models/Uploader.js +126 -0
  84. package/dist/utilities-ui/src/uploader/models/Uploader.js.map +1 -0
  85. package/dist/utilities-ui/src/uploader/models/index.d.ts +2 -0
  86. package/dist/utilities-ui/src/uploader/models/index.d.ts.map +1 -0
  87. package/dist/utilities-ui/src/uploader/models/index.js +2 -0
  88. package/dist/utilities-ui/src/uploader/models/index.js.map +1 -0
  89. package/package.json +44 -0
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cropper/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cropper/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { IRTSeeImage } from "@rtsee/common";
2
+ export interface IRTSeeCropperImage extends IRTSeeImage {
3
+ file: File;
4
+ }
5
+ //# sourceMappingURL=CropperImageInterface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CropperImageInterface.d.ts","sourceRoot":"","sources":["../../../../../src/cropper/interfaces/CropperImageInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,IAAI,EAAE,IAAI,CAAC;CACZ"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=CropperImageInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CropperImageInterface.js","sourceRoot":"","sources":["../../../../../src/cropper/interfaces/CropperImageInterface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './CropperImageInterface';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cropper/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './CropperImageInterface';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cropper/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { EventEmitter } from 'events';
2
+ import { RTSeeCropperImage } from '@rtsee/utilities-ui';
3
+ import { ImageCroppedEvent } from 'ngx-image-cropper';
4
+ export interface CropperOptionsInterface {
5
+ aspectRatio: number;
6
+ resizeToWidth?: number;
7
+ aspectRatioConfigurable?: boolean;
8
+ }
9
+ export interface IRTSeeImageCropper {
10
+ crop(options: 'blob'): Promise<ImageCroppedEvent> | null;
11
+ }
12
+ export declare class RTSeeImageCropper extends EventEmitter {
13
+ aspectRatio: number;
14
+ images: RTSeeCropperImage[];
15
+ activeImage: RTSeeCropperImage;
16
+ cropperElement: IRTSeeImageCropper;
17
+ resizeToWidth: number;
18
+ aspectRatioConfigurable: boolean;
19
+ constructor(options?: CropperOptionsInterface);
20
+ init(options: CropperOptionsInterface): void;
21
+ addImage(options: {
22
+ file: File;
23
+ }): void;
24
+ start(): void;
25
+ setAspectRatio(value: number): void;
26
+ onNextButtonClicked(): void;
27
+ isNextImageAvailable(): boolean;
28
+ nextImage(): boolean;
29
+ setCropperElem(elem: IRTSeeImageCropper): void;
30
+ onCropped(file: Blob): void;
31
+ crop(): void;
32
+ }
33
+ //# sourceMappingURL=Cropper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cropper.d.ts","sourceRoot":"","sources":["../../../../../src/cropper/models/Cropper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,iBAAiB,EAAE,CAAM;IACjC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,OAAO,CAAC;gBAErB,OAAO,CAAC,EAAE,uBAAuB;IAK7C,IAAI,CAAC,OAAO,EAAE,uBAAuB;IAMrC,QAAQ,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,IAAI,CAAA;KAAC;IAM9B,KAAK;IAIL,cAAc,CAAC,KAAK,EAAE,MAAM;IAI5B,mBAAmB,IAAI,IAAI;IAI3B,oBAAoB,IAAI,OAAO;IAK/B,SAAS;IAUT,cAAc,CAAC,IAAI,EAAE,kBAAkB;IAIvC,SAAS,CAAC,IAAI,EAAE,IAAI;IAWpB,IAAI;CAIL"}
@@ -0,0 +1,63 @@
1
+ import { EventEmitter } from 'events';
2
+ import { RTSeeCropperImage } from '@rtsee/utilities-ui';
3
+ export class RTSeeImageCropper extends EventEmitter {
4
+ aspectRatio;
5
+ images = [];
6
+ activeImage;
7
+ cropperElement;
8
+ resizeToWidth;
9
+ aspectRatioConfigurable;
10
+ constructor(options) {
11
+ super();
12
+ if (options) {
13
+ this.init(options);
14
+ }
15
+ }
16
+ init(options) {
17
+ this.aspectRatio = options.aspectRatio || 1;
18
+ this.resizeToWidth = options.resizeToWidth || null;
19
+ this.aspectRatioConfigurable = options.aspectRatioConfigurable;
20
+ }
21
+ addImage(options) {
22
+ this.images.push(new RTSeeCropperImage({
23
+ file: options.file
24
+ }));
25
+ }
26
+ start() {
27
+ this.activeImage = this.images[0];
28
+ }
29
+ setAspectRatio(value) {
30
+ this.aspectRatio = value;
31
+ }
32
+ onNextButtonClicked() {
33
+ this.crop();
34
+ }
35
+ isNextImageAvailable() {
36
+ const currIndex = this.images.indexOf(this.activeImage);
37
+ return !!(currIndex !== -1 && this.images[currIndex + 1]);
38
+ }
39
+ nextImage() {
40
+ const currIndex = this.images.indexOf(this.activeImage);
41
+ if (!this.isNextImageAvailable()) {
42
+ return false;
43
+ }
44
+ this.activeImage = this.images[currIndex + 1];
45
+ }
46
+ setCropperElem(elem) {
47
+ this.cropperElement = elem;
48
+ }
49
+ onCropped(file) {
50
+ this.activeImage.setCroppedFile(file);
51
+ if (this.isNextImageAvailable()) {
52
+ this.nextImage();
53
+ }
54
+ else {
55
+ this.activeImage = null;
56
+ this.emit('done');
57
+ }
58
+ }
59
+ crop() {
60
+ void this.cropperElement.crop('blob');
61
+ }
62
+ }
63
+ //# sourceMappingURL=Cropper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cropper.js","sourceRoot":"","sources":["../../../../../src/cropper/models/Cropper.ts"],"names":[],"mappings":"AAAA,OAAO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C,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,SAAS;QACP,MAAM,SAAS,GAAW,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhE,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,cAAc,CAAC,IAAwB;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,IAAU;QAClB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;YAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI;QACF,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CAEF"}
@@ -0,0 +1,12 @@
1
+ import { IRTSeeCropperImage } from "@rtsee/utilities-ui";
2
+ export declare class RTSeeCropperImage implements IRTSeeCropperImage {
3
+ file: File;
4
+ croppedFile: Blob;
5
+ url: string;
6
+ width: number;
7
+ height: number;
8
+ aspectRatio: number;
9
+ constructor(options: Partial<IRTSeeCropperImage>);
10
+ setCroppedFile(file: Blob): void;
11
+ }
12
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../../src/cropper/models/Image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,iBAAkB,YAAW,kBAAkB;IAC1D,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;gBAER,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAQhD,cAAc,CAAC,IAAI,EAAE,IAAI;CAG1B"}
@@ -0,0 +1,24 @@
1
+ export class RTSeeCropperImage {
2
+ file;
3
+ croppedFile;
4
+ url;
5
+ width;
6
+ height;
7
+ aspectRatio;
8
+ constructor(options) {
9
+ this.file = options.file;
10
+ if (options.url) {
11
+ this.url = options.url;
12
+ }
13
+ if (options.width) {
14
+ this.width = options.width;
15
+ }
16
+ if (options.height) {
17
+ this.height = options.height;
18
+ }
19
+ }
20
+ setCroppedFile(file) {
21
+ this.croppedFile = file;
22
+ }
23
+ }
24
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../../../src/cropper/models/Image.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAC5B,IAAI,CAAO;IACX,WAAW,CAAO;IAClB,GAAG,CAAS;IACZ,KAAK,CAAS;IACd,MAAM,CAAS;IACf,WAAW,CAAS;IAEpB,YAAY,OAAoC;QAC9C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAEzB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAAC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAAC,CAAC;QAClD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAAC,CAAC;IACvD,CAAC;IAED,cAAc,CAAC,IAAU;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export * from './Image';
2
+ export * from './Cropper';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cropper/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './Image';
2
+ export * from './Cropper';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cropper/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models/Autocomplete';
2
+ export * from './interfaces/AutocompleteOptions';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/forms/fields/autocomplete/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './models/Autocomplete';
2
+ export * from './interfaces/AutocompleteOptions';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/forms/fields/autocomplete/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAA"}
@@ -0,0 +1,13 @@
1
+ export interface IRTSeeAutocompleteOptions<S, P> {
2
+ inputId: string;
3
+ inputName: string;
4
+ suggestionLabel: string;
5
+ suggestionId: string;
6
+ suggestions?: S[];
7
+ preselected?: P[];
8
+ loadOnce: boolean;
9
+ allowMultipleSelections?: boolean;
10
+ fluid?: boolean;
11
+ getSuggestions(query: string): Promise<S[]>;
12
+ }
13
+ //# sourceMappingURL=AutocompleteOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutocompleteOptions.d.ts","sourceRoot":"","sources":["../../../../../../../src/forms/fields/autocomplete/interfaces/AutocompleteOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB,CAAC,CAAC,EAAE,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CAC7C"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=AutocompleteOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutocompleteOptions.js","sourceRoot":"","sources":["../../../../../../../src/forms/fields/autocomplete/interfaces/AutocompleteOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { IRTSeeAutocompleteOptions } from "@rtsee/utilities-ui";
2
+ export declare class RTSeeFormAutocomplete<S = any, P = any> {
3
+ inputId: string;
4
+ inputName: string;
5
+ suggestions: S[];
6
+ visibleSuggestions: S[];
7
+ selectedSuggestions: S[];
8
+ suggestionLabel: string;
9
+ suggestionId: string;
10
+ allowMultipleSelections?: boolean;
11
+ fluid?: boolean;
12
+ loadOnce: boolean;
13
+ preselected: P[];
14
+ getSuggestions: (query: string) => Promise<S[]>;
15
+ constructor(options: IRTSeeAutocompleteOptions<S, P>);
16
+ init(): Promise<void>;
17
+ onQueryChanged(event: {
18
+ query: string;
19
+ }): Promise<void>;
20
+ getSelectionIds(): P[];
21
+ private filterVisibleSuggestions;
22
+ private applyPreselectedSuggestions;
23
+ }
24
+ //# sourceMappingURL=Autocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../src/forms/fields/autocomplete/models/Autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,qBAAa,qBAAqB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,EAAE,CAAM;IACtB,kBAAkB,EAAE,CAAC,EAAE,CAAM;IAC7B,mBAAmB,EAAE,CAAC,EAAE,CAAM;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,CAAC,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;gBAG9C,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC;IAgB7B,IAAI;IAQJ,cAAc,CAAC,KAAK,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3D,eAAe,IAAI,CAAC,EAAE;IAK7B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,2BAA2B;CAUpC"}
@@ -0,0 +1,71 @@
1
+ export class RTSeeFormAutocomplete {
2
+ inputId;
3
+ inputName;
4
+ suggestions = [];
5
+ visibleSuggestions = [];
6
+ selectedSuggestions = [];
7
+ suggestionLabel;
8
+ suggestionId;
9
+ allowMultipleSelections;
10
+ fluid;
11
+ loadOnce;
12
+ preselected;
13
+ getSuggestions;
14
+ constructor(options) {
15
+ this.inputId = options.inputId;
16
+ this.inputName = options.inputName;
17
+ this.suggestions = options.suggestions ? options.suggestions : [];
18
+ this.visibleSuggestions = this.suggestions;
19
+ this.suggestionLabel = options.suggestionLabel;
20
+ this.suggestionId = options.suggestionId;
21
+ this.allowMultipleSelections = options.allowMultipleSelections || false;
22
+ this.fluid = options.fluid || false;
23
+ this.loadOnce = options.loadOnce || false;
24
+ this.preselected = options.preselected || [];
25
+ this.getSuggestions = options.getSuggestions;
26
+ void this.init();
27
+ }
28
+ async init() {
29
+ if (this.loadOnce) {
30
+ this.suggestions = await this.getSuggestions('');
31
+ this.visibleSuggestions = this.filterVisibleSuggestions('');
32
+ this.applyPreselectedSuggestions();
33
+ }
34
+ }
35
+ async onQueryChanged(event) {
36
+ if (this.loadOnce) {
37
+ this.visibleSuggestions = this.filterVisibleSuggestions(event.query);
38
+ }
39
+ else {
40
+ this.suggestions = await this.getSuggestions(event.query);
41
+ this.visibleSuggestions = this.filterVisibleSuggestions(event.query);
42
+ }
43
+ }
44
+ getSelectionIds() {
45
+ return this.selectedSuggestions
46
+ .map(suggestion => suggestion[this.suggestionId]);
47
+ }
48
+ filterVisibleSuggestions(query) {
49
+ if (!this.suggestions) {
50
+ return [];
51
+ }
52
+ if (!query) {
53
+ return this.suggestions;
54
+ }
55
+ return this.suggestions
56
+ .filter((s) => {
57
+ const labelValue = s[this.suggestionLabel];
58
+ return labelValue.toLowerCase().includes(query.toLowerCase());
59
+ });
60
+ }
61
+ applyPreselectedSuggestions() {
62
+ const preselections = [];
63
+ this.preselected.forEach((ps) => {
64
+ const match = this
65
+ .suggestions.find(s => s[this.suggestionId] === ps) || null;
66
+ preselections.push(match);
67
+ });
68
+ this.selectedSuggestions = preselections;
69
+ }
70
+ }
71
+ //# sourceMappingURL=Autocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autocomplete.js","sourceRoot":"","sources":["../../../../../../../src/forms/fields/autocomplete/models/Autocomplete.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAChC,OAAO,CAAS;IAChB,SAAS,CAAS;IAClB,WAAW,GAAQ,EAAE,CAAC;IACtB,kBAAkB,GAAQ,EAAE,CAAC;IAC7B,mBAAmB,GAAQ,EAAE,CAAC;IAC9B,eAAe,CAAS;IACxB,YAAY,CAAS;IACrB,uBAAuB,CAAW;IAClC,KAAK,CAAW;IAChB,QAAQ,CAAU;IAClB,WAAW,CAAM;IACjB,cAAc,CAAkC;IAEhD,YACE,OAAwC;QAExC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,IAAI,KAAK,CAAC;QACxE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB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,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,2BAA2B;QACjC,MAAM,aAAa,GAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAK,EAAE,EAAE;YACjC,MAAM,KAAK,GAAa,IAAI;iBACzB,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAuB,CAAC,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC;YACzE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC;IAC3C,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from './fields/autocomplete';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './fields/autocomplete';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image-uploader/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/image-uploader/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { IPeer } from "@rtsee/core";
2
+ export interface IRTSeeImageUploaderOptions {
3
+ aspectRatio: number;
4
+ companionUrl: string;
5
+ peer: IPeer;
6
+ maxNumberOfFiles?: number;
7
+ minNumberOfFiles?: number;
8
+ resizeTo?: number;
9
+ aspectRatioConfigurable?: boolean;
10
+ uploadedPhotoPreview?: string;
11
+ }
12
+ //# sourceMappingURL=ImageUploaderOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploaderOptions.d.ts","sourceRoot":"","sources":["../../../../../src/image-uploader/interfaces/ImageUploaderOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ImageUploaderOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploaderOptions.js","sourceRoot":"","sources":["../../../../../src/image-uploader/interfaces/ImageUploaderOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './ImageUploaderOptions';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/image-uploader/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './ImageUploaderOptions';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/image-uploader/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { EventEmitter } from 'events';
2
+ import { IRTSeeImageUploaderOptions, IUploadedFile, RTSeeFileUploader, RTSeeImageCropper } from "@rtsee/utilities-ui";
3
+ import { IPeer } from "@rtsee/core";
4
+ export declare class RTSeeImageUploader extends EventEmitter {
5
+ aspectRatio: number;
6
+ resizeTo: number;
7
+ cropper: RTSeeImageCropper;
8
+ uploader: RTSeeFileUploader;
9
+ maxNumberOfFiles: number;
10
+ minNumberOfFiles: number;
11
+ croppingFinished: boolean;
12
+ aspectRatioConfigurable: boolean;
13
+ companionUrl: string;
14
+ peer: IPeer;
15
+ awaitsUploadOrCrop: boolean;
16
+ uploadedPhotos: IUploadedFile[];
17
+ uploadedPhotoPreview: string | null;
18
+ constructor(options: IRTSeeImageUploaderOptions);
19
+ init(): void;
20
+ initializeCropper(): void;
21
+ initializeUploader(): void;
22
+ attachCropperEventListeners(): void;
23
+ attachUploaderEventListeners(): void;
24
+ onNextClicked(): void;
25
+ onFileAdded(file: {
26
+ data: File;
27
+ }): void;
28
+ onCroppingFinished(): void;
29
+ onUploadCompleted(response: IUploadedFile[]): void;
30
+ uploadAllImages(): void;
31
+ }
32
+ //# sourceMappingURL=ImageUploader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploader.d.ts","sourceRoot":"","sources":["../../../../../src/image-uploader/models/ImageUploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,OAAO,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IAGZ,kBAAkB,EAAE,OAAO,CAAS;IACpC,cAAc,EAAE,aAAa,EAAE,CAAM;IACrC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;gBAExB,OAAO,EAAE,0BAA0B;IAuB/C,IAAI;IAOJ,iBAAiB;IASjB,kBAAkB;IAalB,2BAA2B;IAI3B,4BAA4B;IAM5B,aAAa;IAQb,WAAW,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IAQhC,kBAAkB;IAKlB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE;IAW3C,eAAe;CAehB"}
@@ -0,0 +1,109 @@
1
+ import { EventEmitter } from 'events';
2
+ import { RTSeeFileUploader, RTSeeImageCropper } from "@rtsee/utilities-ui";
3
+ export class RTSeeImageUploader extends EventEmitter {
4
+ aspectRatio;
5
+ resizeTo;
6
+ cropper;
7
+ uploader;
8
+ maxNumberOfFiles;
9
+ minNumberOfFiles;
10
+ croppingFinished;
11
+ aspectRatioConfigurable;
12
+ companionUrl;
13
+ peer;
14
+ //ui props
15
+ awaitsUploadOrCrop = false;
16
+ uploadedPhotos = [];
17
+ uploadedPhotoPreview;
18
+ constructor(options) {
19
+ super();
20
+ this.peer = options.peer;
21
+ this.maxNumberOfFiles = options.maxNumberOfFiles || 1;
22
+ this.minNumberOfFiles = options.minNumberOfFiles || 1;
23
+ this.companionUrl = options.companionUrl;
24
+ this.aspectRatio = options.aspectRatio;
25
+ this.uploadedPhotoPreview = options.uploadedPhotoPreview;
26
+ if (!options.aspectRatio) {
27
+ throw new Error('Aspect Ratio not provided!');
28
+ }
29
+ if (options.aspectRatioConfigurable) {
30
+ this.aspectRatioConfigurable = options.aspectRatioConfigurable;
31
+ }
32
+ if (options.resizeTo) {
33
+ this.resizeTo = options.resizeTo;
34
+ }
35
+ }
36
+ init() {
37
+ this.awaitsUploadOrCrop = true;
38
+ this.croppingFinished = false;
39
+ this.initializeCropper();
40
+ this.initializeUploader();
41
+ }
42
+ initializeCropper() {
43
+ this.cropper = new RTSeeImageCropper({
44
+ aspectRatio: this.aspectRatio,
45
+ aspectRatioConfigurable: this.aspectRatioConfigurable,
46
+ resizeToWidth: this.resizeTo || null
47
+ });
48
+ this.attachCropperEventListeners();
49
+ }
50
+ initializeUploader() {
51
+ this.uploader = new RTSeeFileUploader({
52
+ isModalWindow: false,
53
+ dragZoneSelector: '#rtsee-drag-drop-area',
54
+ maxNumberOfFiles: this.maxNumberOfFiles,
55
+ minNumberOfFiles: this.minNumberOfFiles,
56
+ allowedFileTypes: ['.jpg', '.jpeg', '.png'],
57
+ companionUrl: this.companionUrl,
58
+ peer: this.peer
59
+ });
60
+ this.attachUploaderEventListeners();
61
+ }
62
+ attachCropperEventListeners() {
63
+ this.cropper.on('done', this.onCroppingFinished.bind(this));
64
+ }
65
+ attachUploaderEventListeners() {
66
+ this.uploader.on('file-added', this.onFileAdded.bind(this));
67
+ this.uploader.on('complete', this.onUploadCompleted.bind(this));
68
+ }
69
+ // should rename and rewrite
70
+ onNextClicked() {
71
+ if (!this.cropper.activeImage) {
72
+ this.cropper.start();
73
+ }
74
+ else {
75
+ this.cropper.crop();
76
+ }
77
+ }
78
+ onFileAdded(file) {
79
+ this.cropper.addImage({ file: file.data });
80
+ if (!this.croppingFinished) {
81
+ this.onNextClicked();
82
+ }
83
+ }
84
+ onCroppingFinished() {
85
+ this.croppingFinished = true;
86
+ setTimeout(() => this.uploadAllImages());
87
+ }
88
+ onUploadCompleted(response) {
89
+ this.uploadedPhotos = response;
90
+ if (this.uploadedPhotos.length) {
91
+ this.uploadedPhotoPreview = this.uploadedPhotos[0].url;
92
+ }
93
+ this.awaitsUploadOrCrop = false;
94
+ this.emit('completed', response);
95
+ }
96
+ uploadAllImages() {
97
+ this.uploader.reset();
98
+ this.cropper.images.forEach((elem) => {
99
+ console.log(`${elem.file.name} - ${elem.file.size}`);
100
+ this.uploader.addFile({
101
+ name: elem.file.name,
102
+ type: elem.croppedFile.type,
103
+ data: elem.croppedFile
104
+ });
105
+ });
106
+ this.uploader.upload();
107
+ }
108
+ }
109
+ //# sourceMappingURL=ImageUploader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageUploader.js","sourceRoot":"","sources":["../../../../../src/image-uploader/models/ImageUploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAIL,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAClD,WAAW,CAAS;IACpB,QAAQ,CAAS;IACjB,OAAO,CAAoB;IAC3B,QAAQ,CAAoB;IAC5B,gBAAgB,CAAS;IACzB,gBAAgB,CAAS;IACzB,gBAAgB,CAAU;IAC1B,uBAAuB,CAAU;IACjC,YAAY,CAAS;IACrB,IAAI,CAAQ;IAEZ,UAAU;IACV,kBAAkB,GAAY,KAAK,CAAC;IACpC,cAAc,GAAoB,EAAE,CAAC;IACrC,oBAAoB,CAAgB;IAEpC,YAAY,OAAmC;QAC7C,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC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IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAuB,EAAE,EAAE;YACtD,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACpB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;gBACpB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;gBAC3B,IAAI,EAAE,IAAI,CAAC,WAAW;aACvB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CAEF"}
@@ -0,0 +1,2 @@
1
+ export * from "./ImageUploader";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/image-uploader/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./ImageUploader";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/image-uploader/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './cropper';
2
+ export * from './uploader';
3
+ export * from './image-uploader';
4
+ export * from './forms';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './cropper';
2
+ export * from './uploader';
3
+ export * from './image-uploader';
4
+ export * from './forms';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/uploader/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './interfaces';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/uploader/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface IRTSeeFileUploadSuccess {
2
+ name: string;
3
+ data: Blob;
4
+ extension: string;
5
+ uploadURL: string;
6
+ }
7
+ interface IRTSeeFileUploadResultFailure {
8
+ name: string;
9
+ extension: string;
10
+ uploadURL: string;
11
+ }
12
+ export interface IRTSeeUploadResult {
13
+ successful: IRTSeeFileUploadSuccess[];
14
+ failed: IRTSeeFileUploadResultFailure[];
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=UploadResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadResult.d.ts","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/UploadResult.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,6BAA6B;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC,MAAM,EAAE,6BAA6B,EAAE,CAAC;CACzC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=UploadResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadResult.js","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/UploadResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { IPeer } from "@rtsee/core";
2
+ export interface IRTSeeUploaderOptions {
3
+ dragZoneSelector: string;
4
+ isModalWindow?: boolean;
5
+ maxFileSize?: number;
6
+ allowedFileTypes?: string[];
7
+ maxNumberOfFiles?: number;
8
+ minNumberOfFiles?: number;
9
+ companionUrl: string;
10
+ peer: IPeer;
11
+ }
12
+ //# sourceMappingURL=UploaderOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploaderOptions.d.ts","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/UploaderOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;CACb"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=UploaderOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploaderOptions.js","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/UploaderOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './UploaderOptions';
2
+ export * from './UploadResult';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './UploaderOptions';
2
+ export * from './UploadResult';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/uploader/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { EventEmitter } from 'events';
2
+ import { Meta, UploadResult, Uppy } from '@uppy/core';
3
+ import { IRTSeeUploaderOptions } from '@rtsee/utilities-ui';
4
+ import { IPeer } from '@rtsee/core';
5
+ import { IRTSeeFileMetadata, IRTSeeFileS3UploadResponseBody } from "@rtsee/common";
6
+ interface FileInterface {
7
+ name: string;
8
+ type: string;
9
+ data: Blob;
10
+ }
11
+ export interface IUploadedFile {
12
+ url: string;
13
+ file: Blob;
14
+ }
15
+ export declare class RTSeeFileUploader extends EventEmitter {
16
+ uppyInstance: Uppy;
17
+ dragZoneSelector: string;
18
+ isModalWindow: boolean;
19
+ maxFileSize: number;
20
+ allowedFileTypes: string[];
21
+ maxNumberOfFiles: number;
22
+ minNumberOfFiles: number;
23
+ companionUrl: string;
24
+ peer: IPeer;
25
+ constructor(options?: IRTSeeUploaderOptions);
26
+ init(options: IRTSeeUploaderOptions): void;
27
+ initializeUppy(): Uppy;
28
+ initializeDashboard(): void;
29
+ upload(): Promise<UploadResult<Meta, Record<string, never>>>;
30
+ attachEventListeners(): void;
31
+ show(): void;
32
+ areFilesAvailable(): boolean;
33
+ reset(): void;
34
+ addFile(file: FileInterface): void;
35
+ parseUploaderImages(result: UploadResult<IRTSeeFileMetadata, IRTSeeFileS3UploadResponseBody>): IUploadedFile[];
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=Uploader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Uploader.d.ts","sourceRoot":"","sources":["../../../../../src/uploader/models/Uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,kBAAkB,EAAE,8BAA8B,EAAC,MAAM,eAAe,CAAC;AAEjF,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,YAAY,EAAE,IAAI,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;gBAEA,OAAO,CAAC,EAAE,qBAAqB;IAK3C,IAAI,CAAC,OAAO,EAAE,qBAAqB;IAmBnC,cAAc,IAAI,IAAI;IAuBtB,mBAAmB,IAAI,IAAI;IAc3B,MAAM;IAIN,oBAAoB;IAapB,IAAI;IAMJ,iBAAiB,IAAI,OAAO;IAO5B,KAAK;IAOL,OAAO,CAAC,IAAI,EAAE,aAAa;IAW3B,mBAAmB,CACjB,MAAM,EAAE,YAAY,CAAC,kBAAkB,EAAE,8BAA8B,CAAC,GACvE,aAAa,EAAE;CAOnB"}
@@ -0,0 +1,126 @@
1
+ import { EventEmitter } from 'events';
2
+ import { Uppy } from '@uppy/core';
3
+ import Url from '@uppy/url';
4
+ import AwsS3 from '@uppy/aws-s3';
5
+ import Dashboard from '@uppy/dashboard';
6
+ export class RTSeeFileUploader extends EventEmitter {
7
+ uppyInstance;
8
+ dragZoneSelector;
9
+ isModalWindow;
10
+ maxFileSize;
11
+ allowedFileTypes;
12
+ maxNumberOfFiles;
13
+ minNumberOfFiles;
14
+ companionUrl;
15
+ peer;
16
+ constructor(options) {
17
+ super();
18
+ this.init(options);
19
+ }
20
+ init(options) {
21
+ this.companionUrl = options.companionUrl;
22
+ if (options.isModalWindow) {
23
+ this.isModalWindow = options.isModalWindow || false;
24
+ }
25
+ if (options.maxFileSize) {
26
+ this.maxFileSize = options.maxFileSize;
27
+ }
28
+ if (options.allowedFileTypes) {
29
+ this.allowedFileTypes = options.allowedFileTypes;
30
+ }
31
+ if (options.maxNumberOfFiles) {
32
+ this.maxNumberOfFiles = options.maxNumberOfFiles;
33
+ }
34
+ if (options.minNumberOfFiles) {
35
+ this.minNumberOfFiles = options.minNumberOfFiles;
36
+ }
37
+ if (options.dragZoneSelector) {
38
+ this.dragZoneSelector = options.dragZoneSelector;
39
+ }
40
+ this.peer = options.peer;
41
+ if (!this.peer) {
42
+ throw new Error('RTSeeFileUploader: No peer defined');
43
+ }
44
+ this.uppyInstance = this.initializeUppy();
45
+ }
46
+ initializeUppy() {
47
+ this.uppyInstance = new Uppy({
48
+ allowMultipleUploadBatches: false,
49
+ debug: false,
50
+ restrictions: {
51
+ maxFileSize: this.maxFileSize || null,
52
+ maxNumberOfFiles: this.maxNumberOfFiles || null,
53
+ minNumberOfFiles: this.minNumberOfFiles || null,
54
+ allowedFileTypes: this.allowedFileTypes || null
55
+ }
56
+ });
57
+ this.uppyInstance
58
+ .use(AwsS3, {
59
+ endpoint: this.companionUrl
60
+ })
61
+ .use(Url, {
62
+ companionUrl: this.companionUrl
63
+ });
64
+ return this.uppyInstance;
65
+ }
66
+ initializeDashboard() {
67
+ if (this.dragZoneSelector) {
68
+ this.uppyInstance.use(Dashboard, {
69
+ target: this.dragZoneSelector,
70
+ inline: true,
71
+ proudlyDisplayPoweredByUppy: false,
72
+ hideUploadButton: true,
73
+ hideCancelButton: true,
74
+ width: 750,
75
+ height: 450
76
+ });
77
+ }
78
+ }
79
+ upload() {
80
+ return this.uppyInstance.upload();
81
+ }
82
+ attachEventListeners() {
83
+ this.uppyInstance.on('file-added', (file) => {
84
+ this.emit('file-added', file);
85
+ });
86
+ this.uppyInstance.on('complete', (result) => {
87
+ this.emit('complete', this.parseUploaderImages(result));
88
+ });
89
+ }
90
+ show() {
91
+ this.initializeDashboard();
92
+ this.attachEventListeners();
93
+ this.emit('showed');
94
+ }
95
+ areFilesAvailable() {
96
+ if (!this.uppyInstance) {
97
+ return false;
98
+ }
99
+ const uploadedFiles = this.uppyInstance.getFiles();
100
+ console.log('uploadedFiles', uploadedFiles);
101
+ return !!(uploadedFiles && uploadedFiles.length);
102
+ }
103
+ reset() {
104
+ this.uppyInstance.destroy();
105
+ this.initializeUppy();
106
+ this.initializeDashboard();
107
+ this.attachEventListeners();
108
+ }
109
+ addFile(file) {
110
+ this.uppyInstance.addFile({
111
+ ...file,
112
+ meta: {
113
+ type: file.type,
114
+ name: file.name,
115
+ peerId: this.peer.clientId // replace with token later
116
+ }
117
+ });
118
+ }
119
+ parseUploaderImages(result) {
120
+ return result.successful
121
+ .map((s) => {
122
+ return { url: s.uploadURL, file: s.data };
123
+ });
124
+ }
125
+ }
126
+ //# sourceMappingURL=Uploader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Uploader.js","sourceRoot":"","sources":["../../../../../src/uploader/models/Uploader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAqB,IAAI,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,KAAK,MAAM,cAAc,CAAA;AAEhC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD,YAAY,CAAO;IACnB,gBAAgB,CAAS;IACzB,aAAa,CAAU;IACvB,WAAW,CAAS;IACpB,gBAAgB,CAAW;IAC3B,gBAAgB,CAAS;IACzB,gBAAgB,CAAS;IACzB,YAAY,CAAS;IACrB,IAAI,CAAQ;IAEZ,YAAY,OAA+B;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAA8B;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QAEzC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAAC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC;QAAC,CAAC;QACnF,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAAC,CAAC;QACpE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AAa,CAAC,CAAC;QAC5C,OAAO,CAAC,CAAC,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,KAAK;QACH,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,IAAmB;QACzB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;YACxB,GAAG,IAAI;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,2BAA2B;aACvD;SACF,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,CACjB,MAAwE;QAExE,OAAO,MAAM,CAAC,UAAU;aACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,IAAY,EAAE,CAAA;QACnD,CAAC,CAAC,CAAC;IACP,CAAC;CAEF"}
@@ -0,0 +1,2 @@
1
+ export * from './Uploader';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/uploader/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './Uploader';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/uploader/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@rtsee/utilities-ui",
3
+ "version": "0.0.2",
4
+ "license": "ISC",
5
+ "private": false,
6
+ "main": "dist/utilities-ui/src/index",
7
+ "types": "dist/utilities-ui/src/index",
8
+ "files": [
9
+ "dist/utilities-ui/src"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git@github.com:thewerf/rtsee.git",
14
+ "directory": "packages/@rtsee/utilities-ui"
15
+ },
16
+ "scripts": {
17
+ "prepublishOnly": "yarn build",
18
+ "clean": "rm -rf ./dist",
19
+ "build": "yarn clean && yarn compile",
20
+ "compile": "tsc -p tsconfig.json",
21
+ "watch": "tsc -p tsconfig.json --watch",
22
+ "lint-file:eslint": "yarn eslint",
23
+ "lint-file:prettier": "yarn prettier --check",
24
+ "lint:eslint": "yarn lint-file:eslint 'src/**/*.ts'",
25
+ "lint:prettier": "yarn lint-file:prettier './**/*.{ts,js,json,css,md}' --ignore-path ../../.prettierignore"
26
+ },
27
+ "dependencies": {
28
+ "@types/events": "^3.0.0",
29
+ "@uppy/aws-s3": "^5.0.2",
30
+ "@uppy/core": "^5.1.1",
31
+ "@uppy/dashboard": "^5.0.3",
32
+ "@uppy/status-bar": "^5.0.2",
33
+ "@uppy/url": "^5.0.2",
34
+ "@uppy/utils": "^7.1.1",
35
+ "@uppy/xhr-upload": "^5.0.2",
36
+ "events": "^3.3.0",
37
+ "ngx-image-cropper": "^9.1.5",
38
+ "webrtc-adapter": "^8.1.2"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "gitHead": "c0b08f7968545a4aad3fceef3ff1727c4058865d"
44
+ }