cmat 0.0.78 → 0.0.80

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 (211) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +9 -46
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +4 -8
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +21 -21
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +18 -24
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +21 -21
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +4 -22
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-custom-formly.mjs +181 -245
  16. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  17. package/fesm2022/cmat-components-date-range.mjs +12 -184
  18. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  19. package/fesm2022/cmat-components-date-time-display.mjs +3 -15
  20. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  21. package/fesm2022/cmat-components-drawer.mjs +10 -100
  22. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  23. package/fesm2022/cmat-components-empty-state.mjs +4 -25
  24. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  25. package/fesm2022/cmat-components-file-preview.mjs +3 -21
  26. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  27. package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
  28. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  29. package/fesm2022/cmat-components-form-actions.mjs +3 -9
  30. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  31. package/fesm2022/cmat-components-fullscreen.mjs +4 -4
  32. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  33. package/fesm2022/cmat-components-highlight.mjs +6 -32
  34. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  35. package/fesm2022/cmat-components-image-viewer.mjs +12 -24
  36. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  37. package/fesm2022/cmat-components-inline-loading.mjs +3 -12
  38. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  39. package/fesm2022/cmat-components-json-editor.mjs +11 -16
  40. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  41. package/fesm2022/cmat-components-knob-input.mjs +24 -18
  42. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  43. package/fesm2022/cmat-components-masonry.mjs +8 -17
  44. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  45. package/fesm2022/cmat-components-material-color-picker.mjs +13 -34
  46. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  47. package/fesm2022/cmat-components-material-datetimepicker.mjs +80 -436
  48. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  49. package/fesm2022/cmat-components-navigation.mjs +266 -816
  50. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  51. package/fesm2022/cmat-components-opt-input.mjs +7 -10
  52. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  53. package/fesm2022/cmat-components-org-chart.mjs +11 -11
  54. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  55. package/fesm2022/cmat-components-page-header.mjs +8 -19
  56. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  57. package/fesm2022/cmat-components-pagination.mjs +113 -108
  58. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  59. package/fesm2022/cmat-components-password-strength.mjs +13 -16
  60. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  61. package/fesm2022/cmat-components-popover.mjs +15 -151
  62. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  63. package/fesm2022/cmat-components-progress-bar.mjs +16 -26
  64. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  65. package/fesm2022/cmat-components-qrcode.mjs +5 -11
  66. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  67. package/fesm2022/cmat-components-rating.mjs +14 -14
  68. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  69. package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
  70. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  71. package/fesm2022/cmat-components-select-search.mjs +51 -79
  72. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  73. package/fesm2022/cmat-components-select-table.mjs +204 -162
  74. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  75. package/fesm2022/cmat-components-select-tree.mjs +142 -97
  76. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  77. package/fesm2022/cmat-components-skeleton.mjs +4 -22
  78. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  79. package/fesm2022/cmat-components-speed-dial.mjs +14 -19
  80. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  81. package/fesm2022/cmat-components-status-tag.mjs +3 -18
  82. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  83. package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
  84. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  85. package/fesm2022/cmat-components-timeline.mjs +18 -21
  86. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  87. package/fesm2022/cmat-components-toast.mjs +20 -20
  88. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  89. package/fesm2022/cmat-components-transfer-picker.mjs +159 -123
  90. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  91. package/fesm2022/cmat-components-treetable.mjs +17 -19
  92. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  93. package/fesm2022/cmat-components-upload.mjs +35 -57
  94. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  95. package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -4
  96. package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
  97. package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
  98. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  99. package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
  100. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  101. package/fesm2022/cmat-directives-autofocus.mjs +3 -3
  102. package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
  103. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  104. package/fesm2022/cmat-directives-debounce.mjs +14 -17
  105. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  106. package/fesm2022/cmat-directives-digit-only.mjs +6 -23
  107. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  108. package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
  109. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
  110. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  111. package/fesm2022/cmat-lib-mock-api.mjs +6 -43
  112. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  113. package/fesm2022/cmat-pipes-bytes.mjs +3 -3
  114. package/fesm2022/cmat-pipes-date-format.mjs +3 -3
  115. package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
  116. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  117. package/fesm2022/cmat-pipes-group-by.mjs +3 -3
  118. package/fesm2022/cmat-pipes-keys.mjs +3 -3
  119. package/fesm2022/cmat-pipes-secure.mjs +8 -12
  120. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
  122. package/fesm2022/cmat-services-alert.mjs +3 -3
  123. package/fesm2022/cmat-services-config.mjs +50 -26
  124. package/fesm2022/cmat-services-config.mjs.map +1 -1
  125. package/fesm2022/cmat-services-confirmation.mjs +9 -11
  126. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  127. package/fesm2022/cmat-services-data.mjs +56 -101
  128. package/fesm2022/cmat-services-data.mjs.map +1 -1
  129. package/fesm2022/cmat-services-export-as.mjs +4 -32
  130. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  131. package/fesm2022/cmat-services-loading.mjs +49 -40
  132. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  133. package/fesm2022/cmat-services-local-storage.mjs +3 -3
  134. package/fesm2022/cmat-services-media-watcher.mjs +19 -25
  135. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  136. package/fesm2022/cmat-services-platform.mjs +3 -10
  137. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  138. package/fesm2022/cmat-services-splash-screen.mjs +8 -13
  139. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  140. package/fesm2022/cmat-services-title.mjs +8 -12
  141. package/fesm2022/cmat-services-title.mjs.map +1 -1
  142. package/fesm2022/cmat-services-translation.mjs +3 -3
  143. package/fesm2022/cmat-services-utils.mjs +5 -27
  144. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  145. package/fesm2022/cmat-validators.mjs +0 -8
  146. package/fesm2022/cmat-validators.mjs.map +1 -1
  147. package/fesm2022/cmat.mjs +3477 -3795
  148. package/fesm2022/cmat.mjs.map +1 -1
  149. package/package.json +1 -1
  150. package/tailwind/plugins/helpers.js +1 -10
  151. package/tailwind/plugins/scrollbar/index.js +0 -1
  152. package/tailwind/plugins/scrollbar/typedefs.js +1 -7
  153. package/tailwind/plugins/scrollbar/utilities.js +9 -58
  154. package/tailwind/plugins/scrollbar/variants.js +2 -17
  155. package/tailwind/plugins/theming.js +1 -57
  156. package/tailwind/utils/generate-contrasts.js +1 -12
  157. package/tailwind/utils/generate-palette.js +1 -32
  158. package/types/cmat-components-adapter.d.ts +0 -25
  159. package/types/cmat-components-breadcrumb.d.ts +25 -175
  160. package/types/cmat-components-carousel.d.ts +2 -20
  161. package/types/cmat-components-cascade.d.ts +4 -4
  162. package/types/cmat-components-chip-input.d.ts +4 -3
  163. package/types/cmat-components-code-editor.d.ts +0 -18
  164. package/types/cmat-components-custom-formly.d.ts +30 -37
  165. package/types/cmat-components-date-range.d.ts +1 -72
  166. package/types/cmat-components-date-time-display.d.ts +0 -15
  167. package/types/cmat-components-drawer.d.ts +2 -44
  168. package/types/cmat-components-empty-state.d.ts +0 -21
  169. package/types/cmat-components-file-preview.d.ts +0 -18
  170. package/types/cmat-components-filter-toolbar.d.ts +3 -43
  171. package/types/cmat-components-form-actions.d.ts +0 -6
  172. package/types/cmat-components-image-viewer.d.ts +5 -18
  173. package/types/cmat-components-inline-loading.d.ts +0 -9
  174. package/types/cmat-components-json-editor.d.ts +0 -1
  175. package/types/cmat-components-knob-input.d.ts +3 -3
  176. package/types/cmat-components-masonry.d.ts +1 -2
  177. package/types/cmat-components-material-color-picker.d.ts +1 -2
  178. package/types/cmat-components-material-datetimepicker.d.ts +6 -272
  179. package/types/cmat-components-navigation.d.ts +34 -171
  180. package/types/cmat-components-opt-input.d.ts +1 -1
  181. package/types/cmat-components-page-header.d.ts +2 -16
  182. package/types/cmat-components-pagination.d.ts +26 -27
  183. package/types/cmat-components-password-strength.d.ts +1 -2
  184. package/types/cmat-components-popover.d.ts +1 -110
  185. package/types/cmat-components-progress-bar.d.ts +9 -11
  186. package/types/cmat-components-rating.d.ts +6 -7
  187. package/types/cmat-components-rich-text-editor.d.ts +0 -21
  188. package/types/cmat-components-select-search.d.ts +4 -20
  189. package/types/cmat-components-select-table.d.ts +24 -12
  190. package/types/cmat-components-select-tree.d.ts +29 -29
  191. package/types/cmat-components-skeleton.d.ts +0 -18
  192. package/types/cmat-components-speed-dial.d.ts +1 -2
  193. package/types/cmat-components-status-tag.d.ts +0 -15
  194. package/types/cmat-components-table-toolbar.d.ts +0 -12
  195. package/types/cmat-components-timeline.d.ts +3 -4
  196. package/types/cmat-components-toast.d.ts +2 -2
  197. package/types/cmat-components-transfer-picker.d.ts +42 -36
  198. package/types/cmat-components-treetable.d.ts +3 -4
  199. package/types/cmat-components-upload.d.ts +12 -17
  200. package/types/cmat-components-x6-angular-shape.d.ts +0 -1
  201. package/types/cmat-directives-arrow-cursor.d.ts +1 -1
  202. package/types/cmat-directives-debounce.d.ts +3 -4
  203. package/types/cmat-pipes-secure.d.ts +3 -4
  204. package/types/cmat-services-config.d.ts +35 -13
  205. package/types/cmat-services-data.d.ts +13 -12
  206. package/types/cmat-services-export-as.d.ts +0 -22
  207. package/types/cmat-services-loading.d.ts +15 -10
  208. package/types/cmat-services-media-watcher.d.ts +10 -13
  209. package/types/cmat-services-splash-screen.d.ts +2 -4
  210. package/types/cmat-services-title.d.ts +3 -5
  211. package/types/cmat.d.ts +733 -1391
@@ -6,42 +6,32 @@ import hljs from 'highlight.js';
6
6
 
7
7
  class CmatHighlightService {
8
8
  highlight(code, language) {
9
- // Format the code
10
9
  code = this._format(code);
11
- // Highlight and return the code
12
10
  return hljs.highlight(code, { language }).value;
13
11
  }
14
12
  _format(code) {
15
13
  let indentation = 0;
16
- // Split the code into lines and store the lines
17
14
  const lines = code.split('\n');
18
- // Trim the empty lines around the code block
19
15
  while (lines.length && lines[0].trim() === '') {
20
16
  lines.shift();
21
17
  }
22
18
  while (lines.length && lines[lines.length - 1].trim() === '') {
23
19
  lines.pop();
24
20
  }
25
- // Iterate through the lines
26
21
  lines.filter(line => line.length)
27
22
  .forEach((line, index) => {
28
- // Always get the indentation of the first line so we can
29
- // have something to compare with
30
23
  if (index === 0) {
31
24
  indentation = line.search(/\S|$/);
32
25
  return;
33
26
  }
34
- // Look at all the remaining lines to figure out the smallest indentation.
35
27
  indentation = Math.min(line.search(/\S|$/), indentation);
36
28
  });
37
- // Iterate through the lines one more time, remove the extra
38
- // indentation, join them together and return it
39
29
  return lines.map(line => line.substring(indentation)).join('\n');
40
30
  }
41
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatHighlightService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
42
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatHighlightService, providedIn: 'root' }); }
31
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatHighlightService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
32
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatHighlightService, providedIn: 'root' }); }
43
33
  }
44
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatHighlightService, decorators: [{
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatHighlightService, decorators: [{
45
35
  type: Injectable,
46
36
  args: [{
47
37
  providedIn: 'root'
@@ -56,62 +46,46 @@ class CmatHighlightComponent {
56
46
  this._viewContainerRef = inject(ViewContainerRef);
57
47
  }
58
48
  ngOnChanges(changes) {
59
- // Code & Lang
60
49
  if ('code' in changes || 'lang' in changes) {
61
- // Return if the viewContainerRef is not available
62
50
  if (!this._viewContainerRef.length) {
63
51
  return;
64
52
  }
65
- // Highlight and insert the code
66
53
  this._highlightAndInsert();
67
54
  }
68
55
  }
69
56
  ngAfterViewInit() {
70
- // Return if there is no language set
71
57
  if (!this.lang) {
72
58
  return;
73
59
  }
74
- // If there is no code input, get the code from
75
- // the textarea
76
60
  if (!this.code) {
77
- // Get the code
78
61
  this.code = this._elementRef.nativeElement.value;
79
62
  }
80
- // Highlight and insert
81
63
  this._highlightAndInsert();
82
64
  }
83
65
  _highlightAndInsert() {
84
- // Return if the template reference is not available
85
66
  if (!this.templateRef) {
86
67
  return;
87
68
  }
88
- // Return if the code or language is not defined
89
69
  if (!this.code || !this.lang) {
90
70
  return;
91
71
  }
92
- // Destroy the component if there is already one
93
72
  if (this._viewRef) {
94
73
  this._viewRef.destroy();
95
74
  this._viewRef = null;
96
75
  }
97
- // Highlight and sanitize the code just in case
98
76
  this.highlightedCode = this._domSanitizer.sanitize(SecurityContext.HTML, this._cmatHighlightService.highlight(this.code, this.lang));
99
- // Return if the highlighted code is null
100
77
  if (this.highlightedCode === null) {
101
78
  return;
102
79
  }
103
- // Render and insert the template
104
80
  this._viewRef = this._viewContainerRef.createEmbeddedView(this.templateRef, {
105
81
  highlightedCode: this.highlightedCode,
106
82
  lang: this.lang
107
83
  });
108
- // Detect the changes
109
- this._viewRef.detectChanges();
110
84
  }
111
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
112
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: CmatHighlightComponent, isStandalone: true, selector: "textarea[cmat-highlight]", inputs: { code: "code", lang: "lang" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], exportAs: ["cmatHighlight"], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<ng-template let-highlightedCode=\"highlightedCode\" let-lang=\"lang\">\r\n <div class=\"cmat-highlight cmat-highlight-code-container\">\r\n <pre [ngClass]=\"'language-' + lang\"><code [ngClass]=\"'language-' + lang\" [innerHTML]=\"highlightedCode\"></code>\r\n </pre>\r\n </div>\r\n</ng-template>", styles: ["textarea[cmat-highlight]{display:none}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
85
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
86
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: CmatHighlightComponent, isStandalone: true, selector: "textarea[cmat-highlight]", inputs: { code: "code", lang: "lang" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], exportAs: ["cmatHighlight"], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\r\n\r\n<ng-template let-highlightedCode=\"highlightedCode\" let-lang=\"lang\">\r\n <div class=\"cmat-highlight cmat-highlight-code-container\">\r\n <pre [ngClass]=\"'language-' + lang\"><code [ngClass]=\"'language-' + lang\" [innerHTML]=\"highlightedCode\"></code>\r\n </pre>\r\n </div>\r\n</ng-template>", styles: ["textarea[cmat-highlight]{display:none}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
113
87
  }
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatHighlightComponent, decorators: [{
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatHighlightComponent, decorators: [{
115
89
  type: Component,
116
90
  args: [{ selector: 'textarea[cmat-highlight]', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatHighlight', imports: [NgClass], template: "<ng-content></ng-content>\r\n\r\n<ng-template let-highlightedCode=\"highlightedCode\" let-lang=\"lang\">\r\n <div class=\"cmat-highlight cmat-highlight-code-container\">\r\n <pre [ngClass]=\"'language-' + lang\"><code [ngClass]=\"'language-' + lang\" [innerHTML]=\"highlightedCode\"></code>\r\n </pre>\r\n </div>\r\n</ng-template>", styles: ["textarea[cmat-highlight]{display:none}\n"] }]
117
91
  }], propDecorators: { code: [{
@@ -1 +1 @@
1
- {"version":3,"file":"cmat-components-highlight.mjs","sources":["../../../projects/cmat/components/highlight/highlight.service.ts","../../../projects/cmat/components/highlight/highlight.component.ts","../../../projects/cmat/components/highlight/highlight.component.html","../../../projects/cmat/components/highlight/cmat-components-highlight.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport hljs from 'highlight.js';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatHighlightService {\r\n highlight(code: string, language: string): string {\r\n // Format the code\r\n code = this._format(code);\r\n\r\n // Highlight and return the code\r\n return hljs.highlight(code, { language }).value;\r\n }\r\n\r\n private _format(code: string): string {\r\n let indentation = 0;\r\n\r\n // Split the code into lines and store the lines\r\n const lines = code.split('\\n');\r\n\r\n // Trim the empty lines around the code block\r\n while (lines.length && lines[0].trim() === '') {\r\n lines.shift();\r\n }\r\n\r\n while (lines.length && lines[lines.length - 1].trim() === '') {\r\n lines.pop();\r\n }\r\n\r\n // Iterate through the lines\r\n lines.filter(line => line.length)\r\n .forEach((line, index) => {\r\n\r\n // Always get the indentation of the first line so we can\r\n // have something to compare with\r\n if (index === 0) {\r\n indentation = line.search(/\\S|$/);\r\n return;\r\n }\r\n\r\n // Look at all the remaining lines to figure out the smallest indentation.\r\n indentation = Math.min(line.search(/\\S|$/), indentation);\r\n });\r\n\r\n // Iterate through the lines one more time, remove the extra\r\n // indentation, join them together and return it\r\n return lines.map(line => line.substring(indentation)).join('\\n');\r\n }\r\n}\r\n","import { NgClass } from '@angular/common';\r\nimport { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EmbeddedViewRef, Input, OnChanges, SecurityContext, SimpleChanges, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation, inject } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { CmatHighlightService } from './highlight.service';\r\n\r\n@Component({\r\n selector: 'textarea[cmat-highlight]',\r\n templateUrl: './highlight.component.html',\r\n styleUrls: ['./highlight.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n exportAs: 'cmatHighlight',\r\n imports: [NgClass]\r\n})\r\nexport class CmatHighlightComponent implements OnChanges, AfterViewInit {\r\n\r\n\r\n @Input() code: string;\r\n @Input() lang: string;\r\n @ViewChild(TemplateRef) templateRef: TemplateRef<any>;\r\n\r\n highlightedCode: string | null;\r\n private _viewRef: EmbeddedViewRef<any> | null;\r\n private _domSanitizer = inject(DomSanitizer);\r\n private _elementRef = inject(ElementRef);\r\n private _cmatHighlightService = inject(CmatHighlightService);\r\n private _viewContainerRef = inject(ViewContainerRef);\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n // Code & Lang\r\n if ('code' in changes || 'lang' in changes) {\r\n // Return if the viewContainerRef is not available\r\n if (!this._viewContainerRef.length) {\r\n return;\r\n }\r\n\r\n // Highlight and insert the code\r\n this._highlightAndInsert();\r\n }\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n // Return if there is no language set\r\n if (!this.lang) {\r\n return;\r\n }\r\n\r\n // If there is no code input, get the code from\r\n // the textarea\r\n if (!this.code) {\r\n // Get the code\r\n this.code = this._elementRef.nativeElement.value;\r\n }\r\n\r\n // Highlight and insert\r\n this._highlightAndInsert();\r\n }\r\n\r\n private _highlightAndInsert(): void {\r\n // Return if the template reference is not available\r\n if (!this.templateRef) {\r\n return;\r\n }\r\n\r\n // Return if the code or language is not defined\r\n if (!this.code || !this.lang) {\r\n return;\r\n }\r\n\r\n // Destroy the component if there is already one\r\n if (this._viewRef) {\r\n this._viewRef.destroy();\r\n this._viewRef = null;\r\n }\r\n\r\n // Highlight and sanitize the code just in case\r\n this.highlightedCode = this._domSanitizer.sanitize(SecurityContext.HTML, this._cmatHighlightService.highlight(this.code, this.lang));\r\n\r\n // Return if the highlighted code is null\r\n if (this.highlightedCode === null) {\r\n return;\r\n }\r\n\r\n // Render and insert the template\r\n this._viewRef = this._viewContainerRef.createEmbeddedView(this.templateRef, {\r\n highlightedCode: this.highlightedCode,\r\n lang: this.lang\r\n });\r\n\r\n // Detect the changes\r\n this._viewRef.detectChanges();\r\n }\r\n}\r\n","<ng-content></ng-content>\r\n\r\n<ng-template let-highlightedCode=\"highlightedCode\" let-lang=\"lang\">\r\n <div class=\"cmat-highlight cmat-highlight-code-container\">\r\n <pre [ngClass]=\"'language-' + lang\"><code [ngClass]=\"'language-' + lang\" [innerHTML]=\"highlightedCode\"></code>\r\n </pre>\r\n </div>\r\n</ng-template>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAMa,oBAAoB,CAAA;IAC7B,SAAS,CAAC,IAAY,EAAE,QAAgB,EAAA;;AAEpC,QAAA,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;;AAGzB,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK;IACnD;AAEQ,IAAA,OAAO,CAAC,IAAY,EAAA;QACxB,IAAI,WAAW,GAAG,CAAC;;QAGnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;;AAG9B,QAAA,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC3C,KAAK,CAAC,KAAK,EAAE;QACjB;AAEA,QAAA,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC1D,KAAK,CAAC,GAAG,EAAE;QACf;;QAGA,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM;AAC3B,aAAA,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;;;AAIrB,YAAA,IAAI,KAAK,KAAK,CAAC,EAAE;AACb,gBAAA,WAAW,GAAG,IAAI,CAAC,MA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AA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0BAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,aAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAKpB,WAAW,EAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,eAAA,CAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnB1B,gWAOc,kGDKA,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAER,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBATlC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,aAAA,EAGrB,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,eAAe,EAAA,OAAA,EAChB,CAAC,OAAO,CAAC,EAAA,QAAA,EAAA,gWAAA,EAAA,MAAA,EAAA,CAAA,0CAAA,CAAA,EAAA;;sBAKjB;;sBACA;;sBACA,SAAS;uBAAC,WAAW;;;AEnB1B;;AAEG;;;;"}
1
+ {"version":3,"file":"cmat-components-highlight.mjs","sources":["../../../projects/cmat/components/highlight/highlight.service.ts","../../../projects/cmat/components/highlight/highlight.component.ts","../../../projects/cmat/components/highlight/highlight.component.html","../../../projects/cmat/components/highlight/cmat-components-highlight.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport hljs from 'highlight.js';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CmatHighlightService {\r\n highlight(code: string, language: string): string {\r\n code = this._format(code);\r\n return hljs.highlight(code, { language }).value;\r\n }\r\n\r\n private _format(code: string): string {\r\n let indentation = 0;\r\n const lines = code.split('\\n');\r\n while (lines.length && lines[0].trim() === '') {\r\n lines.shift();\r\n }\r\n\r\n while (lines.length && lines[lines.length - 1].trim() === '') {\r\n lines.pop();\r\n }\r\n lines.filter(line => line.length)\r\n .forEach((line, index) => {\r\n if (index === 0) {\r\n indentation = line.search(/\\S|$/);\r\n return;\r\n }\r\n indentation = Math.min(line.search(/\\S|$/), indentation);\r\n });\r\n return lines.map(line => line.substring(indentation)).join('\\n');\r\n }\r\n}\r\n","import { NgClass } from '@angular/common';\r\nimport { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EmbeddedViewRef, Input, OnChanges, SecurityContext, SimpleChanges, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation, inject } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { CmatHighlightService } from './highlight.service';\r\n\r\n@Component({\r\n selector: 'textarea[cmat-highlight]',\r\n templateUrl: './highlight.component.html',\r\n styleUrls: ['./highlight.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n exportAs: 'cmatHighlight',\r\n imports: [NgClass]\r\n})\r\nexport class CmatHighlightComponent implements OnChanges, AfterViewInit {\r\n\r\n\r\n @Input() code: string;\r\n @Input() lang: string;\r\n @ViewChild(TemplateRef) templateRef: TemplateRef<any>;\r\n\r\n highlightedCode: string | null;\r\n private _viewRef: EmbeddedViewRef<any> | null;\r\n private _domSanitizer = inject(DomSanitizer);\r\n private _elementRef = inject(ElementRef);\r\n private _cmatHighlightService = inject(CmatHighlightService);\r\n private _viewContainerRef = inject(ViewContainerRef);\r\n\r\n ngOnChanges(changes: SimpleChanges): void {\r\n if ('code' in changes || 'lang' in changes) {\r\n if (!this._viewContainerRef.length) {\r\n return;\r\n }\r\n this._highlightAndInsert();\r\n }\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n if (!this.lang) {\r\n return;\r\n }\r\n if (!this.code) {\r\n this.code = this._elementRef.nativeElement.value;\r\n }\r\n this._highlightAndInsert();\r\n }\r\n\r\n private _highlightAndInsert(): void {\r\n if (!this.templateRef) {\r\n return;\r\n }\r\n if (!this.code || !this.lang) {\r\n return;\r\n }\r\n if (this._viewRef) {\r\n this._viewRef.destroy();\r\n this._viewRef = null;\r\n }\r\n this.highlightedCode = this._domSanitizer.sanitize(SecurityContext.HTML, this._cmatHighlightService.highlight(this.code, this.lang));\r\n if (this.highlightedCode === null) {\r\n return;\r\n }\r\n this._viewRef = this._viewContainerRef.createEmbeddedView(this.templateRef, {\r\n highlightedCode: this.highlightedCode,\r\n lang: this.lang\r\n });\r\n }\r\n}\r\n","<ng-content></ng-content>\r\n\r\n<ng-template let-highlightedCode=\"highlightedCode\" let-lang=\"lang\">\r\n <div class=\"cmat-highlight cmat-highlight-code-container\">\r\n <pre [ngClass]=\"'language-' + lang\"><code [ngClass]=\"'language-' + lang\" [innerHTML]=\"highlightedCode\"></code>\r\n </pre>\r\n </div>\r\n</ng-template>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAMa,oBAAoB,CAAA;IAC7B,SAAS,CAAC,IAAY,EAAE,QAAgB,EAAA;AACpC,QAAA,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AACzB,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK;IACnD;AAEQ,IAAA,OAAO,CAAC,IAAY,EAAA;QACxB,IAAI,WAAW,GAAG,CAAC;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC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,EAGrB,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,eAAe,EAAA,OAAA,EAChB,CAAC,OAAO,CAAC,EAAA,QAAA,EAAA,gWAAA,EAAA,MAAA,EAAA,CAAA,0CAAA,CAAA,EAAA;;sBAKjB;;sBACA;;sBACA,SAAS;uBAAC,WAAW;;;AEnB1B;;AAEG;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, inject, ElementRef, DOCUMENT, ChangeDetectorRef, booleanAttribute, HostListener, ViewChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { EventEmitter, inject, ElementRef, signal, DOCUMENT, booleanAttribute, HostListener, ViewChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
5
5
  import * as i2 from '@angular/material/button';
6
6
  import { MatButtonModule } from '@angular/material/button';
7
7
  import * as i3 from '@angular/material/icon';
@@ -9,27 +9,17 @@ import { MatIconModule } from '@angular/material/icon';
9
9
 
10
10
  class CmatImageComponent {
11
11
  constructor() {
12
- /**
13
- * 启动预览功能。
14
- */
15
12
  this.preview = false;
16
- /**
17
- * 监听预览显示/隐藏.
18
- */
19
13
  this.previewShowChange = new EventEmitter();
20
- /**
21
- * 如果加载图像文件时发生错误,则会触发此事件.
22
- */
23
14
  this.imageErrorEvent = new EventEmitter();
24
15
  this.el = inject(ElementRef);
25
- this.maskVisible = false;
26
- this.previewVisible = false;
16
+ this.maskVisible = signal(false, ...(ngDevMode ? [{ debugName: "maskVisible" }] : /* istanbul ignore next */ []));
17
+ this.previewVisible = signal(false, ...(ngDevMode ? [{ debugName: "previewVisible" }] : /* istanbul ignore next */ []));
27
18
  this.rotate = 0;
28
19
  this.scale = 1;
29
20
  this._loadingPreview = false;
30
21
  this._closePreviewByEscape = false;
31
22
  this._document = inject(DOCUMENT);
32
- this._changeDetectorRef = inject(ChangeDetectorRef);
33
23
  this._originalOverflow = null;
34
24
  this._zoomSettings = {
35
25
  default: 1,
@@ -74,7 +64,7 @@ class CmatImageComponent {
74
64
  }
75
65
  ;
76
66
  onKeydownHandler() {
77
- if (this.previewVisible) {
67
+ if (this.previewVisible()) {
78
68
  this._enableBackgroundScroll();
79
69
  this.closePreview();
80
70
  }
@@ -82,10 +72,9 @@ class CmatImageComponent {
82
72
  onImageClick() {
83
73
  if (this.preview) {
84
74
  this._disableBackgroundScroll();
85
- this.maskVisible = true;
86
- this.previewVisible = true;
75
+ this.maskVisible.set(true);
76
+ this.previewVisible.set(true);
87
77
  this._loadingPreview = true;
88
- this._changeDetectorRef.markForCheck();
89
78
  this.previewShowChange.emit(true);
90
79
  }
91
80
  }
@@ -135,12 +124,11 @@ class CmatImageComponent {
135
124
  }
136
125
  closePreview() {
137
126
  this._enableBackgroundScroll();
138
- this.previewVisible = false;
127
+ this.previewVisible.set(false);
139
128
  this.rotate = 0;
140
129
  this.scale = this._zoomSettings.default;
141
130
  setTimeout(() => {
142
- this.maskVisible = false;
143
- this._changeDetectorRef.markForCheck();
131
+ this.maskVisible.set(false);
144
132
  this.previewShowChange.emit(false);
145
133
  }, 25);
146
134
  }
@@ -156,12 +144,12 @@ class CmatImageComponent {
156
144
  const body = this._document.body;
157
145
  body.style.overflow = this._originalOverflow ?? '';
158
146
  }
159
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
160
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatImageComponent, isStandalone: true, selector: "cmat-image", inputs: { imageClass: "imageClass", imageStyle: "imageStyle", src: "src", srcSet: "srcSet", previewImageSrc: "previewImageSrc", previewImageSrcSet: "previewImageSrcSet", alt: "alt", width: "width", height: "height", loading: "loading", appendTo: "appendTo", preview: ["preview", "preview", booleanAttribute] }, outputs: { previewShowChange: "previewShowChange", imageErrorEvent: "imageErrorEvent" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "mask", first: true, predicate: ["mask"], descendants: true }, { propertyName: "previewButton", first: true, predicate: ["previewButton"], descendants: true }, { propertyName: "closeButton", first: true, predicate: ["closeButton"], descendants: true }], ngImport: i0, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
147
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
148
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatImageComponent, isStandalone: true, selector: "cmat-image", inputs: { imageClass: "imageClass", imageStyle: "imageStyle", src: "src", srcSet: "srcSet", previewImageSrc: "previewImageSrc", previewImageSrcSet: "previewImageSrcSet", alt: "alt", width: "width", height: "height", loading: "loading", appendTo: "appendTo", preview: ["preview", "preview", booleanAttribute] }, outputs: { previewShowChange: "previewShowChange", imageErrorEvent: "imageErrorEvent" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, viewQueries: [{ propertyName: "mask", first: true, predicate: ["mask"], descendants: true }, { propertyName: "previewButton", first: true, predicate: ["previewButton"], descendants: true }, { propertyName: "closeButton", first: true, predicate: ["closeButton"], descendants: true }], ngImport: i0, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible()){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible()\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible()){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>\r\n", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
161
149
  }
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatImageComponent, decorators: [{
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatImageComponent, decorators: [{
163
151
  type: Component,
164
- args: [{ selector: 'cmat-image', imports: [CommonModule, MatButtonModule, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"] }]
152
+ args: [{ selector: 'cmat-image', imports: [CommonModule, MatButtonModule, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible()){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible()\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible()){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>\r\n", styles: [".cmat-image-mask{display:flex;align-items:center;justify-content:center}.cmat-image-preview-container{position:relative;display:inline-block;line-height:0}.cmat-image-preview-indicator{position:absolute;left:0;top:0;width:100%;height:100%;outline:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .3s}.cmat-image-preview-container:hover>.cmat-image-preview-indicator{opacity:1;cursor:pointer;background-color:#00000080}.cmat-image-preview-container>img{cursor:pointer}.cmat-image-toolbar{position:absolute;top:0;right:0;display:flex;z-index:1;padding:.5rem}.cmat-image-preview{transition:transform .15s;max-width:100vw;max-height:100vh}.cmat-image-preview-enter{animation:preview-enter-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-preview-leave{animation:preview-leave-animation .15s cubic-bezier(0,0,.2,1)}.cmat-image-overlay{background-color:#0006;transition-duration:.2s;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99}.cmat-image-overlay-enter{animation:image-overlay-enter-animation .15s}.cmat-image-overlay-leave{z-index:0;animation:image-overlay-leave-animation .15s}@keyframes preview-enter-animation{0%{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}@keyframes preview-leave-animation{0%{transform:scale(1);opacity:1}to{transform:scale(.7);opacity:0}}@keyframes image-overlay-enter-animation{0%{background-color:transparent}to{background-color:#000000e6}}@keyframes image-overlay-leave-animation{0%{background-color:#000000e6}to{background-color:transparent}}\n"] }]
165
153
  }], propDecorators: { imageClass: [{
166
154
  type: Input
167
155
  }], imageStyle: [{
@@ -1 +1 @@
1
- {"version":3,"file":"cmat-components-image-viewer.mjs","sources":["../../../projects/cmat/components/image-viewer/image-viewer.component.ts","../../../projects/cmat/components/image-viewer/image-viewer.component.html","../../../projects/cmat/components/image-viewer/cmat-components-image-viewer.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n ChangeDetectorRef,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n Output,\r\n TemplateRef,\r\n ViewChild,\r\n ViewEncapsulation,\r\n booleanAttribute,\r\n DOCUMENT,\r\n inject,\r\n HostListener,\r\n} from '@angular/core';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SafeUrl } from '@angular/platform-browser';\r\n\r\n@Component({\r\n selector: 'cmat-image',\r\n templateUrl: './image-viewer.component.html',\r\n styleUrls: ['./image-viewer.component.scss'],\r\n imports: [CommonModule, MatButtonModule, MatIconModule],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.None\r\n})\r\nexport class CmatImageComponent {\r\n\r\n @Input() imageClass: string | undefined;\r\n\r\n @Input() imageStyle: Record<string, any> | null | undefined;\r\n\r\n @Input() src: SafeUrl | undefined;\r\n\r\n @Input() srcSet: SafeUrl | undefined;\r\n\r\n @Input() previewImageSrc: SafeUrl | undefined;\r\n\r\n @Input() previewImageSrcSet: SafeUrl | undefined;\r\n\r\n @Input() alt: string | undefined;\r\n\r\n @Input() width: number | undefined;\r\n\r\n @Input() height: number | undefined;\r\n\r\n @Input() loading: 'lazy' | 'eager' | undefined;\r\n /**\r\n * 要附加对话框的目标元素,有效值是“body”或另一个元素的本地ng模板变量(注意:使用带括号的绑定来绑定模板变量,例如[appedTo]=“mydiv”用于变量名为#mydiv的div元素)。\r\n */\r\n @Input() appendTo: HTMLElement | ElementRef | TemplateRef<any> | string | null | undefined;\r\n /**\r\n * 启动预览功能。\r\n */\r\n @Input({ transform: booleanAttribute }) preview: boolean = false;\r\n /**\r\n * 监听预览显示/隐藏.\r\n */\r\n @Output() previewShowChange: EventEmitter<boolean> = new EventEmitter<boolean>();\r\n /**\r\n * 如果加载图像文件时发生错误,则会触发此事件.\r\n */\r\n @Output() imageErrorEvent: EventEmitter<Event> = new EventEmitter<Event>();\r\n\r\n el = inject(ElementRef);\r\n\r\n maskVisible: boolean = false;\r\n\r\n previewVisible: boolean = false;\r\n\r\n rotate: number = 0;\r\n\r\n scale: number = 1;\r\n\r\n private _loadingPreview: boolean = false;\r\n private _closePreviewByEscape: boolean = false;\r\n private _document = inject<Document>(DOCUMENT);\r\n private _changeDetectorRef = inject(ChangeDetectorRef);\r\n private _originalOverflow: string | null = null;\r\n\r\n private _zoomSettings = {\r\n default: 1,\r\n step: 0.1,\r\n max: 1.5,\r\n min: 0.5\r\n };\r\n\r\n get isZoomOutDisabled(): boolean {\r\n return this.scale - this._zoomSettings.step <= this._zoomSettings.min;\r\n }\r\n\r\n get isZoomInDisabled(): boolean {\r\n return this.scale + this._zoomSettings.step >= this._zoomSettings.max;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _mask?: HTMLDivElement | undefined;\r\n @ViewChild('mask', { static: false })\r\n set mask(value: ElementRef<HTMLDivElement> | undefined) {\r\n if (value) {\r\n this._mask = value.nativeElement;\r\n\r\n if (this._mask && this._loadingPreview) {\r\n this.appendContainer();\r\n }\r\n }\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _previewButton?: HTMLButtonElement | undefined;\r\n @ViewChild('previewButton', { static: false })\r\n set previewButton(value: ElementRef<HTMLButtonElement> | undefined) {\r\n if (value) {\r\n this._previewButton = value.nativeElement;\r\n\r\n if (this._previewButton && this._closePreviewByEscape) {\r\n this._previewButton.focus();\r\n this._closePreviewByEscape = false;\r\n }\r\n }\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _closeButton?: HTMLButtonElement | undefined;\r\n @ViewChild('closeButton', { static: false })\r\n set closeButton(value: ElementRef<HTMLButtonElement> | undefined) {\r\n if (value) {\r\n this._closeButton = value.nativeElement;\r\n\r\n if (this._closeButton && this._loadingPreview) {\r\n this._closeButton.focus();\r\n this._loadingPreview = false;\r\n }\r\n }\r\n };\r\n\r\n @HostListener('document:keydown.escape', ['$event'])\r\n onKeydownHandler(): void {\r\n if (this.previewVisible) {\r\n this._enableBackgroundScroll();\r\n this.closePreview();\r\n }\r\n }\r\n\r\n onImageClick(): void {\r\n if (this.preview) {\r\n this._disableBackgroundScroll();\r\n this.maskVisible = true;\r\n this.previewVisible = true;\r\n\r\n this._loadingPreview = true;\r\n this._changeDetectorRef.markForCheck();\r\n\r\n this.previewShowChange.emit(true);\r\n }\r\n }\r\n\r\n onMaskKeydown(event: KeyboardEvent): void {\r\n switch (event.code) {\r\n case 'Escape':\r\n this.closePreview();\r\n this._closePreviewByEscape = true;\r\n event.preventDefault();\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n onPreviewImageClick(event: MouseEvent): void {\r\n event.stopPropagation();\r\n }\r\n\r\n rotateRight(): void {\r\n this.rotate += 90;\r\n }\r\n\r\n rotateLeft(): void {\r\n this.rotate -= 90;\r\n }\r\n\r\n zoomIn(): void {\r\n this.scale = this.scale + this._zoomSettings.step;\r\n }\r\n\r\n zoomOut(): void {\r\n this.scale = this.scale - this._zoomSettings.step;\r\n }\r\n\r\n handleToolbarClick(event: MouseEvent): void {\r\n event.stopPropagation();\r\n }\r\n\r\n appendContainer(): void {\r\n if (this.appendTo) {\r\n if (this.appendTo === 'body') this._document.body.appendChild(this._mask as HTMLElement);\r\n else {\r\n if (typeof HTMLElement === 'object' ? this.appendTo instanceof HTMLElement : this.appendTo && typeof this.appendTo === 'object' && this.appendTo !== null)\r\n (this.appendTo as any).appendChild(this._mask);\r\n else if ((this.appendTo as any)?.el?.nativeElement)\r\n (this.appendTo as any).el.nativeElement.appendChild(this.mask?.nativeElement);\r\n }\r\n\r\n }\r\n }\r\n\r\n imagePreviewStyle(): { transform: string; } {\r\n return { transform: 'rotate(' + this.rotate + 'deg) scale(' + this.scale + ')' };\r\n }\r\n\r\n closePreview(): void {\r\n this._enableBackgroundScroll();\r\n this.previewVisible = false;\r\n this.rotate = 0;\r\n this.scale = this._zoomSettings.default;\r\n\r\n setTimeout(() => {\r\n this.maskVisible = false;\r\n\r\n this._changeDetectorRef.markForCheck();\r\n this.previewShowChange.emit(false);\r\n }, 25);\r\n }\r\n\r\n imageError(event: Event): void {\r\n this.imageErrorEvent.emit(event);\r\n }\r\n\r\n private _disableBackgroundScroll(): void {\r\n const body = this._document.body;\r\n this._originalOverflow = body.style.overflow;\r\n body.style.overflow = 'hidden';\r\n }\r\n\r\n private _enableBackgroundScroll(): void {\r\n const body = this._document.body;\r\n body.style.overflow = this._originalOverflow ?? '';\r\n }\r\n}\r\n","<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;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CA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;sBAanC,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;sBAc5C,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,aAAa,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;sBAY1C,YAAY;uBAAC,yBAAyB,EAAE,CAAC,QAAQ,CAAC;;;AE3IvD;;AAEG;;;;"}
1
+ {"version":3,"file":"cmat-components-image-viewer.mjs","sources":["../../../projects/cmat/components/image-viewer/image-viewer.component.ts","../../../projects/cmat/components/image-viewer/image-viewer.component.html","../../../projects/cmat/components/image-viewer/cmat-components-image-viewer.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n EventEmitter,\r\n Input,\r\n Output,\r\n TemplateRef,\r\n ViewChild,\r\n ViewEncapsulation,\r\n booleanAttribute,\r\n DOCUMENT,\r\n inject,\r\n HostListener,\r\n signal,\r\n} from '@angular/core';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { SafeUrl } from '@angular/platform-browser';\r\n\r\n@Component({\r\n selector: 'cmat-image',\r\n templateUrl: './image-viewer.component.html',\r\n styleUrls: ['./image-viewer.component.scss'],\r\n imports: [CommonModule, MatButtonModule, MatIconModule],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n encapsulation: ViewEncapsulation.None\r\n})\r\nexport class CmatImageComponent {\r\n\r\n @Input() imageClass: string | undefined;\r\n\r\n @Input() imageStyle: Record<string, any> | null | undefined;\r\n\r\n @Input() src: SafeUrl | undefined;\r\n\r\n @Input() srcSet: SafeUrl | undefined;\r\n\r\n @Input() previewImageSrc: SafeUrl | undefined;\r\n\r\n @Input() previewImageSrcSet: SafeUrl | undefined;\r\n\r\n @Input() alt: string | undefined;\r\n\r\n @Input() width: number | undefined;\r\n\r\n @Input() height: number | undefined;\r\n\r\n @Input() loading: 'lazy' | 'eager' | undefined;\r\n \r\n @Input() appendTo: HTMLElement | ElementRef | TemplateRef<any> | string | null | undefined;\r\n \r\n @Input({ transform: booleanAttribute }) preview: boolean = false;\r\n \r\n @Output() previewShowChange: EventEmitter<boolean> = new EventEmitter<boolean>();\r\n \r\n @Output() imageErrorEvent: EventEmitter<Event> = new EventEmitter<Event>();\r\n\r\n el = inject(ElementRef);\r\n\r\n readonly maskVisible = signal(false);\r\n\r\n readonly previewVisible = signal(false);\r\n\r\n rotate: number = 0;\r\n\r\n scale: number = 1;\r\n\r\n private _loadingPreview: boolean = false;\r\n private _closePreviewByEscape: boolean = false;\r\n private _document = inject<Document>(DOCUMENT);\r\n private _originalOverflow: string | null = null;\r\n\r\n private _zoomSettings = {\r\n default: 1,\r\n step: 0.1,\r\n max: 1.5,\r\n min: 0.5\r\n };\r\n\r\n get isZoomOutDisabled(): boolean {\r\n return this.scale - this._zoomSettings.step <= this._zoomSettings.min;\r\n }\r\n\r\n get isZoomInDisabled(): boolean {\r\n return this.scale + this._zoomSettings.step >= this._zoomSettings.max;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _mask?: HTMLDivElement | undefined;\r\n @ViewChild('mask', { static: false })\r\n set mask(value: ElementRef<HTMLDivElement> | undefined) {\r\n if (value) {\r\n this._mask = value.nativeElement;\r\n\r\n if (this._mask && this._loadingPreview) {\r\n this.appendContainer();\r\n }\r\n }\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _previewButton?: HTMLButtonElement | undefined;\r\n @ViewChild('previewButton', { static: false })\r\n set previewButton(value: ElementRef<HTMLButtonElement> | undefined) {\r\n if (value) {\r\n this._previewButton = value.nativeElement;\r\n\r\n if (this._previewButton && this._closePreviewByEscape) {\r\n this._previewButton.focus();\r\n this._closePreviewByEscape = false;\r\n }\r\n }\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n private _closeButton?: HTMLButtonElement | undefined;\r\n @ViewChild('closeButton', { static: false })\r\n set closeButton(value: ElementRef<HTMLButtonElement> | undefined) {\r\n if (value) {\r\n this._closeButton = value.nativeElement;\r\n\r\n if (this._closeButton && this._loadingPreview) {\r\n this._closeButton.focus();\r\n this._loadingPreview = false;\r\n }\r\n }\r\n };\r\n\r\n @HostListener('document:keydown.escape', ['$event'])\r\n onKeydownHandler(): void {\r\n if (this.previewVisible()) {\r\n this._enableBackgroundScroll();\r\n this.closePreview();\r\n }\r\n }\r\n\r\n onImageClick(): void {\r\n if (this.preview) {\r\n this._disableBackgroundScroll();\r\n this.maskVisible.set(true);\r\n this.previewVisible.set(true);\r\n\r\n this._loadingPreview = true;\r\n\r\n this.previewShowChange.emit(true);\r\n }\r\n }\r\n\r\n onMaskKeydown(event: KeyboardEvent): void {\r\n switch (event.code) {\r\n case 'Escape':\r\n this.closePreview();\r\n this._closePreviewByEscape = true;\r\n event.preventDefault();\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n onPreviewImageClick(event: MouseEvent): void {\r\n event.stopPropagation();\r\n }\r\n\r\n rotateRight(): void {\r\n this.rotate += 90;\r\n }\r\n\r\n rotateLeft(): void {\r\n this.rotate -= 90;\r\n }\r\n\r\n zoomIn(): void {\r\n this.scale = this.scale + this._zoomSettings.step;\r\n }\r\n\r\n zoomOut(): void {\r\n this.scale = this.scale - this._zoomSettings.step;\r\n }\r\n\r\n handleToolbarClick(event: MouseEvent): void {\r\n event.stopPropagation();\r\n }\r\n\r\n appendContainer(): void {\r\n if (this.appendTo) {\r\n if (this.appendTo === 'body') this._document.body.appendChild(this._mask as HTMLElement);\r\n else {\r\n if (typeof HTMLElement === 'object' ? this.appendTo instanceof HTMLElement : this.appendTo && typeof this.appendTo === 'object' && this.appendTo !== null)\r\n (this.appendTo as any).appendChild(this._mask);\r\n else if ((this.appendTo as any)?.el?.nativeElement)\r\n (this.appendTo as any).el.nativeElement.appendChild(this.mask?.nativeElement);\r\n }\r\n\r\n }\r\n }\r\n\r\n imagePreviewStyle(): { transform: string; } {\r\n return { transform: 'rotate(' + this.rotate + 'deg) scale(' + this.scale + ')' };\r\n }\r\n\r\n closePreview(): void {\r\n this._enableBackgroundScroll();\r\n this.previewVisible.set(false);\r\n this.rotate = 0;\r\n this.scale = this._zoomSettings.default;\r\n\r\n setTimeout(() => {\r\n this.maskVisible.set(false);\r\n this.previewShowChange.emit(false);\r\n }, 25);\r\n }\r\n\r\n imageError(event: Event): void {\r\n this.imageErrorEvent.emit(event);\r\n }\r\n\r\n private _disableBackgroundScroll(): void {\r\n const body = this._document.body;\r\n this._originalOverflow = body.style.overflow;\r\n body.style.overflow = 'hidden';\r\n }\r\n\r\n private _enableBackgroundScroll(): void {\r\n const body = this._document.body;\r\n body.style.overflow = this._originalOverflow ?? '';\r\n }\r\n}\r\n","<span [ngClass]=\"{ 'cmat-image-preview-container ': preview }\">\r\n <img [attr.src]=\"src\" [attr.srcset]=\"srcSet\" [attr.alt]=\"alt\" [attr.width]=\"width\" [attr.height]=\"height\"\r\n [attr.loading]=\"loading\" [ngStyle]=\"imageStyle\" [class]=\"imageClass\" (error)=\"imageError($event)\" />\r\n @if(preview){\r\n <div class=\"cmat-image-preview-indicator\" role=\"presentation\" (click)=\"onImageClick()\">\r\n <button #previewButton matIconButton>\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'heroicons_solid:eye'\"></mat-icon>\r\n </button>\r\n </div>\r\n }\r\n\r\n @if(maskVisible()){\r\n <div #mask class=\"cmat-image-mask cmat-image-overlay cmat-image-overlay-enter\" animate.leave=\"cmat-image-overlay-leave\"\r\n role=\"dialog\" [attr.aria-modal]=\"maskVisible()\" (click)=\"closePreview()\" (keydown)=\"onMaskKeydown($event)\">\r\n <div class=\"cmat-image-toolbar\" role=\"presentation\" (click)=\"handleToolbarClick($event)\">\r\n <button matIconButton (click)=\"rotateRight()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_right'\"></mat-icon>\r\n </button>\r\n <button matIconButton (click)=\"rotateLeft()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:rotate_left'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomOutDisabled\" (click)=\"zoomOut()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_out'\"></mat-icon>\r\n </button>\r\n <button matIconButton [disabled]=\"isZoomInDisabled\" (click)=\"zoomIn()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:zoom_in'\"></mat-icon>\r\n </button>\r\n <button #closeButton matIconButton (click)=\"closePreview()\">\r\n <mat-icon class=\"text-white\" [svgIcon]=\"'mat_solid:close'\"></mat-icon>\r\n </button>\r\n </div>\r\n @if(previewVisible()){\r\n <div role=\"presentation\" class=\"cmat-image-preview-enter\" animate.leave=\"cmat-image-preview-leave\"\r\n (click)=\"onPreviewImageClick($event)\">\r\n <img class=\"cmat-image-preview\" alt=\"image\" [attr.src]=\"previewImageSrc ? previewImageSrc : src\"\r\n [attr.srcset]=\"previewImageSrcSet\" [ngStyle]=\"imagePreviewStyle()\" />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n</span>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MA6Ba,kBAAkB,CAAA;AAR/B,IAAA,WAAA,GAAA;QAgC4C,IAAA,CAAA,OAAO,GAAY,KAAK;AAEtD,QAAA,IAAA,CAAA,iBAAiB,GAA0B,IAAI,YAAY,EAAW;AAEtE,QAAA,IAAA,CAAA,eAAe,GAAwB,IAAI,YAAY,EAAS;AAE1E,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;AAEd,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,KAAK,kFAAC;AAE3B,QAAA,IAAA,CAAA,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
  constructor() {
8
- /**
9
- * 说明文字。
10
- */
11
8
  this.message = '加载中...';
12
- /**
13
- * 圆环大小。
14
- */
15
9
  this.diameter = 20;
16
- /**
17
- * 是否显示文字。
18
- */
19
10
  this.showText = true;
20
11
  }
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatInlineLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
22
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatInlineLoadingComponent, isStandalone: true, selector: "cmat-inline-loading", inputs: { message: "message", diameter: "diameter", showText: "showText" }, ngImport: i0, template: "<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n", styles: [":host{display:inline-flex}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
12
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatInlineLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
13
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatInlineLoadingComponent, isStandalone: true, selector: "cmat-inline-loading", inputs: { message: "message", diameter: "diameter", showText: "showText" }, ngImport: i0, template: "<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n", styles: [":host{display:inline-flex}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
23
14
  }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatInlineLoadingComponent, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatInlineLoadingComponent, decorators: [{
25
16
  type: Component,
26
17
  args: [{ selector: 'cmat-inline-loading', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatProgressSpinnerModule], template: "<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n", styles: [":host{display:inline-flex}\n"] }]
27
18
  }], propDecorators: { message: [{
@@ -1 +1 @@
1
- {"version":3,"file":"cmat-components-inline-loading.mjs","sources":["../../../projects/cmat/components/inline-loading/inline-loading.component.ts","../../../projects/cmat/components/inline-loading/inline-loading.component.html","../../../projects/cmat/components/inline-loading/cmat-components-inline-loading.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\n\r\n@Component({\r\n selector: 'cmat-inline-loading',\r\n templateUrl: './inline-loading.component.html',\r\n styleUrls: ['./inline-loading.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [MatProgressSpinnerModule]\r\n})\r\nexport class CmatInlineLoadingComponent {\r\n /**\r\n * 说明文字。\r\n */\r\n @Input() message = '加载中...';\r\n\r\n /**\r\n * 圆环大小。\r\n */\r\n @Input() diameter = 20;\r\n\r\n /**\r\n * 是否显示文字。\r\n */\r\n @Input() showText = true;\r\n}\r\n","<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,0BAA0B,CAAA;AAPvC,IAAA,WAAA,GAAA;AAQI;;AAEG;QACM,IAAA,CAAA,OAAO,GAAG,QAAQ;AAE3B;;AAEG;QACM,IAAA,CAAA,QAAQ,GAAG,EAAE;AAEtB;;AAEG;QACM,IAAA,CAAA,QAAQ,GAAG,IAAI;AAC3B,IAAA;8GAfY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECVvC,sUAMA,EAAA,MAAA,EAAA,CAAA,8BAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDEc,wBAAwB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,QAAA,EAAA,mCAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,UAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAEzB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAPtC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,qBAAqB,mBAGd,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,wBAAwB,CAAC,EAAA,QAAA,EAAA,sUAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,CAAA,EAAA;;sBAMlC;;sBAKA;;sBAKA;;;AExBL;;AAEG;;;;"}
1
+ {"version":3,"file":"cmat-components-inline-loading.mjs","sources":["../../../projects/cmat/components/inline-loading/inline-loading.component.ts","../../../projects/cmat/components/inline-loading/inline-loading.component.html","../../../projects/cmat/components/inline-loading/cmat-components-inline-loading.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\n\r\n@Component({\r\n selector: 'cmat-inline-loading',\r\n templateUrl: './inline-loading.component.html',\r\n styleUrls: ['./inline-loading.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [MatProgressSpinnerModule]\r\n})\r\nexport class CmatInlineLoadingComponent {\r\n \r\n @Input() message = '加载中...';\r\n\r\n \r\n @Input() diameter = 20;\r\n\r\n \r\n @Input() showText = true;\r\n}\r\n","<div class=\"inline-flex items-center gap-2 rounded-full bg-hover px-3 py-1 text-sm text-secondary\">\r\n <mat-progress-spinner mode=\"indeterminate\" color=\"primary\" [diameter]=\"diameter\" [strokeWidth]=\"2\"></mat-progress-spinner>\r\n @if (showText) {\r\n <span>{{ message }}</span>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";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UMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, inject, ChangeDetectorRef, ViewChild, HostBinding, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { EventEmitter, inject, ViewChild, HostBinding, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
4
  import { createAjvValidator, parseJSONPath, createMultiSelection, isJSONContent, isKeySelection, stringifyJSONPath, isMultiSelection, createJSONEditor } from 'vanilla-jsoneditor';
5
5
 
6
6
  class CmatJsonEditorComponent {
@@ -14,7 +14,6 @@ class CmatJsonEditorComponent {
14
14
  };
15
15
  this._destroyed = false;
16
16
  this._document = inject(DOCUMENT);
17
- this._changeDetectorRef = inject(ChangeDetectorRef);
18
17
  }
19
18
  get darkTheme() {
20
19
  return this._isDarkTheme;
@@ -38,7 +37,6 @@ class CmatJsonEditorComponent {
38
37
  if (this._editor) {
39
38
  void this._editor.update(this.content);
40
39
  }
41
- this._changeDetectorRef.markForCheck();
42
40
  }
43
41
  if (changes.options) {
44
42
  if (this._editor) {
@@ -88,12 +86,10 @@ class CmatJsonEditorComponent {
88
86
  }
89
87
  _onSelect(selection) {
90
88
  if (isKeySelection(selection)) {
91
- const st = stringifyJSONPath(selection.path);
92
- this.pathChanged.emit(st);
89
+ this.pathChanged.emit(stringifyJSONPath(selection.path));
93
90
  }
94
91
  else if (isMultiSelection(selection)) {
95
- const st = stringifyJSONPath(selection.anchorPath);
96
- this.pathChanged.emit(st);
92
+ this.pathChanged.emit(stringifyJSONPath(selection.anchorPath));
97
93
  }
98
94
  }
99
95
  _initializeEditor() {
@@ -119,7 +115,6 @@ class CmatJsonEditorComponent {
119
115
  onRenderMenu(items,
120
116
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
121
117
  context) {
122
- // remove buttons for table-mode, transform, sort
123
118
  items.splice(items.findIndex(i => i['text'] === 'table'), 1);
124
119
  items.splice(items.findIndex(i => i['className'] === 'jse-sort'), 1);
125
120
  items.splice(items.findIndex(i => i['className'] === 'jse-transform'), 1);
@@ -143,19 +138,19 @@ class CmatJsonEditorComponent {
143
138
  button.title = '切换到树模式(当前模式:树)';
144
139
  break;
145
140
  case 'Format JSON: add proper indentation and new lines (Ctrl+I)':
146
- button.title = 'JSON格式化: 添加适当的缩进和新行 (Ctrl+I)';
141
+ button.title = 'JSON格式化:添加适当的缩进和换行 (Ctrl+I)';
147
142
  break;
148
143
  case 'Compact JSON: remove all white spacing and new lines (Ctrl+Shift+I)':
149
- button.title = '压缩JSON: 删除所有白色间距和新行 (Ctrl+Shift+I)';
144
+ button.title = '压缩 JSON:删除所有空白间距和换行 (Ctrl+Shift+I)';
150
145
  break;
151
146
  case 'Search (Ctrl+F)':
152
147
  button.title = '搜索 (Ctrl+F)';
153
148
  break;
154
149
  case 'Undo (Ctrl+Z)':
155
- button.title = '撤回 (Ctrl+Z)';
150
+ button.title = '撤销 (Ctrl+Z)';
156
151
  break;
157
152
  case 'Redo (Ctrl+Shift+Z)':
158
- button.title = '重试 (Ctrl+Shift+Z)';
153
+ button.title = '重做 (Ctrl+Shift+Z)';
159
154
  break;
160
155
  case 'Expand all':
161
156
  button.title = '全部展开';
@@ -164,7 +159,7 @@ class CmatJsonEditorComponent {
164
159
  button.title = '全部折叠';
165
160
  break;
166
161
  case 'Open context menu (Click here, right click on the selection, or use the context menu button or Ctrl+Q)':
167
- button.title = '打开内容菜单 (单击此处,右键单击所选内容,或使用内容菜单按钮或 Ctrl+Q)';
162
+ button.title = '打开上下文菜单(单击此处、右键选择,或使用上下文菜单按钮,或 Ctrl+Q';
168
163
  break;
169
164
  }
170
165
  });
@@ -173,10 +168,10 @@ class CmatJsonEditorComponent {
173
168
  },
174
169
  });
175
170
  }
176
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatJsonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
177
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.7", type: CmatJsonEditorComponent, isStandalone: true, selector: "cmat-json-editor", inputs: { options: "options", data: "data" }, outputs: { contentChanged: "contentChanged", pathChanged: "pathChanged" }, host: { properties: { "class.jse-theme-dark": "this.darkTheme" } }, viewQueries: [{ propertyName: "jsonEditorContainer", first: true, predicate: ["jsonEditorContainer"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON \u7F16\u8F91\u5668\u52A0\u8F7D\u4E2D...\r\n </div>\r\n}\r\n", styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatJsonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
172
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CmatJsonEditorComponent, isStandalone: true, selector: "cmat-json-editor", inputs: { options: "options", data: "data" }, outputs: { contentChanged: "contentChanged", pathChanged: "pathChanged" }, host: { properties: { "class.jse-theme-dark": "this.darkTheme" } }, viewQueries: [{ propertyName: "jsonEditorContainer", first: true, predicate: ["jsonEditorContainer"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON \u7F16\u8F91\u5668\u52A0\u8F7D\u4E2D...\r\n </div>\r\n}\r\n", styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
178
173
  }
179
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: CmatJsonEditorComponent, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CmatJsonEditorComponent, decorators: [{
180
175
  type: Component,
181
176
  args: [{ selector: 'cmat-json-editor', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [], template: "@defer (on viewport) {\r\n <div #jsonEditorContainer class=\"cmat-jsoneditor\" [id]=\"id\"></div>\r\n} @placeholder {\r\n <div class=\"flex min-h-64 items-center justify-center rounded-2xl border border-dashed border-default bg-card px-4 py-6 text-sm text-secondary shadow-sm\">\r\n JSON \u7F16\u8F91\u5668\u52A0\u8F7D\u4E2D...\r\n </div>\r\n}\r\n", styles: [".cmat-jsoneditor .jse-main.svelte-sxaskb{min-height:24rem}\n"] }]
182
177
  }], propDecorators: { options: [{