cmat 0.0.111 → 0.0.112

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 (256) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +531 -536
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +521 -356
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +150 -42
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +1120 -629
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +861 -441
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +580 -335
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +197 -105
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-color-picker.mjs +1762 -825
  16. package/fesm2022/cmat-components-color-picker.mjs.map +1 -1
  17. package/fesm2022/cmat-components-custom-formly.mjs +5196 -2531
  18. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  19. package/fesm2022/cmat-components-data-picker.mjs +1901 -1073
  20. package/fesm2022/cmat-components-data-picker.mjs.map +1 -1
  21. package/fesm2022/cmat-components-date-range.mjs +701 -456
  22. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  23. package/fesm2022/cmat-components-date-time-display.mjs +137 -30
  24. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  25. package/fesm2022/cmat-components-drawer.mjs +410 -258
  26. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  27. package/fesm2022/cmat-components-empty-state.mjs +201 -41
  28. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  29. package/fesm2022/cmat-components-file-preview.mjs +198 -35
  30. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  31. package/fesm2022/cmat-components-filter-toolbar.mjs +320 -72
  32. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  33. package/fesm2022/cmat-components-form-actions.mjs +102 -26
  34. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  35. package/fesm2022/cmat-components-fullscreen.mjs +167 -47
  36. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  37. package/fesm2022/cmat-components-highlight.mjs +203 -112
  38. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  39. package/fesm2022/cmat-components-image-viewer.mjs +489 -215
  40. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  41. package/fesm2022/cmat-components-inline-loading.mjs +117 -27
  42. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  43. package/fesm2022/cmat-components-json-editor.mjs +276 -230
  44. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  45. package/fesm2022/cmat-components-knob-input.mjs +615 -420
  46. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  47. package/fesm2022/cmat-components-loading-overlay.mjs +53 -25
  48. package/fesm2022/cmat-components-loading-overlay.mjs.map +1 -1
  49. package/fesm2022/cmat-components-masonry.mjs +120 -40
  50. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  51. package/fesm2022/cmat-components-material-color-picker.mjs +332 -155
  52. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  53. package/fesm2022/cmat-components-material-datetimepicker.mjs +4283 -2504
  54. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  55. package/fesm2022/cmat-components-navigation.mjs +3080 -1404
  56. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  57. package/fesm2022/cmat-components-opt-input.mjs +540 -466
  58. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  59. package/fesm2022/cmat-components-org-chart.mjs +528 -125
  60. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  61. package/fesm2022/cmat-components-page-header.mjs +141 -32
  62. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  63. package/fesm2022/cmat-components-pagination.mjs +866 -534
  64. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  65. package/fesm2022/cmat-components-password-strength.mjs +873 -434
  66. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  67. package/fesm2022/cmat-components-popover.mjs +1012 -731
  68. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  69. package/fesm2022/cmat-components-progress-bar.mjs +98 -35
  70. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  71. package/fesm2022/cmat-components-qrcode.mjs +463 -287
  72. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  73. package/fesm2022/cmat-components-rating.mjs +377 -203
  74. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  75. package/fesm2022/cmat-components-rich-text-editor.mjs +153 -39
  76. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  77. package/fesm2022/cmat-components-select-search.mjs +926 -496
  78. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  79. package/fesm2022/cmat-components-select-table.mjs +1280 -842
  80. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  81. package/fesm2022/cmat-components-select-tree.mjs +998 -690
  82. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  83. package/fesm2022/cmat-components-skeleton.mjs +143 -57
  84. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  85. package/fesm2022/cmat-components-speed-dial.mjs +457 -303
  86. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  87. package/fesm2022/cmat-components-status-tag.mjs +136 -44
  88. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  89. package/fesm2022/cmat-components-table-toolbar.mjs +120 -28
  90. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  91. package/fesm2022/cmat-components-timeline.mjs +464 -168
  92. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  93. package/fesm2022/cmat-components-toast.mjs +346 -262
  94. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  95. package/fesm2022/cmat-components-transfer-picker.mjs +1427 -593
  96. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  97. package/fesm2022/cmat-components-treetable.mjs +372 -112
  98. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  99. package/fesm2022/cmat-components-upload.mjs +904 -410
  100. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  101. package/fesm2022/cmat-components-x6-angular-shape.mjs +153 -170
  102. package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
  103. package/fesm2022/cmat-directives-animate-on-scroll.mjs +220 -138
  104. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  105. package/fesm2022/cmat-directives-arrow-cursor.mjs +246 -193
  106. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  107. package/fesm2022/cmat-directives-autofocus.mjs +43 -25
  108. package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
  109. package/fesm2022/cmat-directives-data-exporter.mjs +537 -338
  110. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  111. package/fesm2022/cmat-directives-debounce.mjs +162 -76
  112. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  113. package/fesm2022/cmat-directives-digit-only.mjs +457 -356
  114. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  115. package/fesm2022/cmat-directives-equal-validator.mjs +70 -53
  116. package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
  117. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +180 -132
  118. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  119. package/fesm2022/cmat-lib-mock-api.mjs +207 -195
  120. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-bytes.mjs +50 -30
  122. package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
  123. package/fesm2022/cmat-pipes-date-format.mjs +41 -25
  124. package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
  125. package/fesm2022/cmat-pipes-find-by-key.mjs +44 -26
  126. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  127. package/fesm2022/cmat-pipes-group-by.mjs +50 -38
  128. package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
  129. package/fesm2022/cmat-pipes-keys.mjs +44 -31
  130. package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
  131. package/fesm2022/cmat-pipes-secure.mjs +60 -49
  132. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  133. package/fesm2022/cmat-pipes-uppercase.mjs +39 -22
  134. package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
  135. package/fesm2022/cmat-reports.mjs +2751 -0
  136. package/fesm2022/cmat-reports.mjs.map +1 -0
  137. package/fesm2022/cmat-services-alert.mjs +249 -277
  138. package/fesm2022/cmat-services-alert.mjs.map +1 -1
  139. package/fesm2022/cmat-services-config.mjs +110 -81
  140. package/fesm2022/cmat-services-config.mjs.map +1 -1
  141. package/fesm2022/cmat-services-confirmation.mjs +184 -73
  142. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  143. package/fesm2022/cmat-services-data.mjs +136 -125
  144. package/fesm2022/cmat-services-data.mjs.map +1 -1
  145. package/fesm2022/cmat-services-export-as.mjs +165 -183
  146. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  147. package/fesm2022/cmat-services-loading.mjs +116 -95
  148. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  149. package/fesm2022/cmat-services-local-storage.mjs +75 -66
  150. package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
  151. package/fesm2022/cmat-services-media-watcher.mjs +69 -64
  152. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  153. package/fesm2022/cmat-services-platform.mjs +48 -45
  154. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  155. package/fesm2022/cmat-services-print.mjs +984 -1109
  156. package/fesm2022/cmat-services-print.mjs.map +1 -1
  157. package/fesm2022/cmat-services-splash-screen.mjs +53 -38
  158. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  159. package/fesm2022/cmat-services-title.mjs +57 -47
  160. package/fesm2022/cmat-services-title.mjs.map +1 -1
  161. package/fesm2022/cmat-services-translation.mjs +79 -68
  162. package/fesm2022/cmat-services-translation.mjs.map +1 -1
  163. package/fesm2022/cmat-services-utils.mjs +424 -517
  164. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  165. package/fesm2022/cmat-validators.mjs +23 -33
  166. package/fesm2022/cmat-validators.mjs.map +1 -1
  167. package/fesm2022/cmat-version.mjs +12 -16
  168. package/fesm2022/cmat-version.mjs.map +1 -1
  169. package/fesm2022/cmat.mjs +39805 -22511
  170. package/fesm2022/cmat.mjs.map +1 -1
  171. package/package.json +5 -1
  172. package/types/cmat-components-adapter.d.ts +145 -156
  173. package/types/cmat-components-breadcrumb.d.ts +108 -86
  174. package/types/cmat-components-card.d.ts +34 -18
  175. package/types/cmat-components-carousel.d.ts +251 -134
  176. package/types/cmat-components-cascade.d.ts +158 -117
  177. package/types/cmat-components-chip-input.d.ts +105 -71
  178. package/types/cmat-components-code-editor.d.ts +59 -34
  179. package/types/cmat-components-color-picker.d.ts +378 -236
  180. package/types/cmat-components-custom-formly.d.ts +776 -814
  181. package/types/cmat-components-data-picker.d.ts +502 -360
  182. package/types/cmat-components-date-range.d.ts +106 -77
  183. package/types/cmat-components-date-time-display.d.ts +36 -13
  184. package/types/cmat-components-drawer.d.ts +91 -61
  185. package/types/cmat-components-empty-state.d.ts +47 -17
  186. package/types/cmat-components-file-preview.d.ts +42 -14
  187. package/types/cmat-components-filter-toolbar.d.ts +57 -25
  188. package/types/cmat-components-form-actions.d.ts +18 -10
  189. package/types/cmat-components-fullscreen.d.ts +21 -13
  190. package/types/cmat-components-highlight.d.ts +33 -26
  191. package/types/cmat-components-image-viewer.d.ts +119 -58
  192. package/types/cmat-components-inline-loading.d.ts +24 -11
  193. package/types/cmat-components-json-editor.d.ts +39 -28
  194. package/types/cmat-components-knob-input.d.ts +172 -101
  195. package/types/cmat-components-loading-overlay.d.ts +8 -11
  196. package/types/cmat-components-masonry.d.ts +27 -14
  197. package/types/cmat-components-material-color-picker.d.ts +56 -42
  198. package/types/cmat-components-material-datetimepicker.d.ts +817 -454
  199. package/types/cmat-components-navigation.d.ts +295 -221
  200. package/types/cmat-components-opt-input.d.ts +111 -90
  201. package/types/cmat-components-org-chart.d.ts +53 -35
  202. package/types/cmat-components-page-header.d.ts +37 -14
  203. package/types/cmat-components-pagination.d.ts +144 -107
  204. package/types/cmat-components-password-strength.d.ts +197 -86
  205. package/types/cmat-components-popover.d.ts +264 -166
  206. package/types/cmat-components-progress-bar.d.ts +17 -14
  207. package/types/cmat-components-qrcode.d.ts +111 -42
  208. package/types/cmat-components-rating.d.ts +105 -59
  209. package/types/cmat-components-rich-text-editor.d.ts +39 -16
  210. package/types/cmat-components-select-search.d.ts +195 -99
  211. package/types/cmat-components-select-table.d.ts +241 -142
  212. package/types/cmat-components-select-tree.d.ts +185 -118
  213. package/types/cmat-components-skeleton.d.ts +55 -32
  214. package/types/cmat-components-speed-dial.d.ts +86 -61
  215. package/types/cmat-components-status-tag.d.ts +42 -24
  216. package/types/cmat-components-table-toolbar.d.ts +30 -12
  217. package/types/cmat-components-timeline.d.ts +83 -51
  218. package/types/cmat-components-toast.d.ts +84 -85
  219. package/types/cmat-components-transfer-picker.d.ts +228 -181
  220. package/types/cmat-components-treetable.d.ts +63 -39
  221. package/types/cmat-components-upload.d.ts +205 -106
  222. package/types/cmat-components-x6-angular-shape.d.ts +29 -37
  223. package/types/cmat-directives-animate-on-scroll.d.ts +48 -30
  224. package/types/cmat-directives-arrow-cursor.d.ts +55 -35
  225. package/types/cmat-directives-autofocus.d.ts +8 -11
  226. package/types/cmat-directives-data-exporter.d.ts +71 -40
  227. package/types/cmat-directives-debounce.d.ts +31 -28
  228. package/types/cmat-directives-digit-only.d.ts +90 -53
  229. package/types/cmat-directives-equal-validator.d.ts +11 -14
  230. package/types/cmat-directives-seamless-auto-scroll.d.ts +42 -29
  231. package/types/cmat-lib-mock-api.d.ts +46 -55
  232. package/types/cmat-pipes-bytes.d.ts +7 -10
  233. package/types/cmat-pipes-date-format.d.ts +7 -10
  234. package/types/cmat-pipes-find-by-key.d.ts +8 -12
  235. package/types/cmat-pipes-group-by.d.ts +11 -15
  236. package/types/cmat-pipes-keys.d.ts +10 -13
  237. package/types/cmat-pipes-secure.d.ts +14 -17
  238. package/types/cmat-pipes-uppercase.d.ts +7 -10
  239. package/types/cmat-reports.d.ts +1131 -0
  240. package/types/cmat-services-alert.d.ts +80 -87
  241. package/types/cmat-services-config.d.ts +37 -43
  242. package/types/cmat-services-confirmation.d.ts +31 -37
  243. package/types/cmat-services-data.d.ts +18 -21
  244. package/types/cmat-services-export-as.d.ts +28 -33
  245. package/types/cmat-services-loading.d.ts +27 -31
  246. package/types/cmat-services-local-storage.d.ts +17 -21
  247. package/types/cmat-services-media-watcher.d.ts +14 -18
  248. package/types/cmat-services-platform.d.ts +8 -11
  249. package/types/cmat-services-print.d.ts +97 -102
  250. package/types/cmat-services-splash-screen.d.ts +11 -14
  251. package/types/cmat-services-title.d.ts +9 -12
  252. package/types/cmat-services-translation.d.ts +19 -22
  253. package/types/cmat-services-utils.d.ts +76 -80
  254. package/types/cmat-validators.d.ts +5 -8
  255. package/types/cmat-version.d.ts +8 -10
  256. package/types/cmat.d.ts +7551 -5204
@@ -1,536 +1,868 @@
1
- import { NgClass, NgStyle, DecimalPipe } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { signal, untracked, Injectable, input, output, inject, Injector, effect, afterNextRender, Directive, ElementRef, DestroyRef, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, Pipe } from '@angular/core';
4
- import * as i5 from '@angular/material/button';
5
- import { MatButtonModule } from '@angular/material/button';
6
- import * as i2 from '@angular/material/form-field';
7
- import { MatFormFieldModule } from '@angular/material/form-field';
8
- import * as i1 from '@angular/material/icon';
9
- import { MatIconModule } from '@angular/material/icon';
10
- import * as i3 from '@angular/material/input';
11
- import { MatInputModule } from '@angular/material/input';
12
- import * as i4 from '@angular/material/select';
13
- import { MatSelectModule } from '@angular/material/select';
14
- import { CmatDigitOnlyDirective } from 'cmat/directives/digit-only';
15
-
16
- class CmatPaginationService {
17
- constructor() {
18
- this._instances = signal({}, /* @ts-ignore */
19
- ...(ngDevMode ? [{ debugName: "_instances" }] : /* istanbul ignore next */ []));
20
- // eslint-disable-next-line @typescript-eslint/member-ordering
21
- this.instances = this._instances.asReadonly();
22
- this._defaultPaginationId = 'DEFAULT_PAGINATION_ID';
23
- }
24
- defaultId() { return this._defaultPaginationId; }
25
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
- notifyChange(_id) {
27
- // 使用 requestAnimationFrame 延迟 Signal 更新,避免在模板渲染周期中写入
28
- requestAnimationFrame(() => {
29
- this._instances.update(current => ({ ...current }));
30
- });
31
- }
32
- register(instance, fromPipe = false) {
33
- const normalizedInstance = {
34
- ...structuredClone(instance),
35
- id: instance.id ?? this._defaultPaginationId
36
- };
37
- const id = normalizedInstance.id;
38
- let changed = false;
39
- const currentInstances = untracked(() => this._instances());
40
- if (!currentInstances[id]) {
41
- changed = true;
42
- }
43
- else {
44
- const needsUpdate = this._needsUpdate(currentInstances[id], normalizedInstance);
45
- if (needsUpdate) {
46
- changed = true;
47
- }
48
- }
49
- if (changed) {
50
- if (fromPipe) {
51
- requestAnimationFrame(() => {
52
- this._instances.update((current) => {
53
- if (!current[id]) {
54
- return { ...current, [id]: normalizedInstance };
55
- }
56
- else {
57
- this._updateInstance(current[id], normalizedInstance);
58
- return { ...current };
59
- }
60
- });
61
- });
62
- }
63
- else {
64
- this._instances.update((current) => {
65
- if (!current[id]) {
66
- return { ...current, [id]: normalizedInstance };
67
- }
68
- else {
69
- this._updateInstance(current[id], normalizedInstance);
70
- return { ...current };
71
- }
72
- });
73
- }
74
- }
75
- return changed;
76
- }
77
- getCurrentPage(id) {
78
- return this._instances()[id]?.currentPage;
79
- }
80
- getItemsPerPage(id) {
81
- return this._instances()[id]?.itemsPerPage;
82
- }
83
- setCurrentPage(id, page) {
84
- this._instances.update((current) => {
85
- const instance = current[id];
86
- if (instance) {
87
- const maxPage = Math.ceil(instance.totalItems / instance.itemsPerPage);
88
- if (page <= maxPage && 1 <= page) {
89
- // 创建新引用以确保 Signal 检测到变化
90
- current[id] = { ...instance, currentPage: page };
91
- return { ...current };
92
- }
93
- }
94
- return current;
95
- });
96
- // 通知分页器更新显示
97
- this.notifyChange(id);
98
- }
99
- setTotalItems(id, totalItems) {
100
- this._instances.update((current) => {
101
- const instance = current[id];
102
- if (instance && 0 <= totalItems) {
103
- current[id] = { ...instance, totalItems };
104
- return { ...current };
105
- }
106
- return current;
107
- });
108
- // 通知分页器更新显示
109
- this.notifyChange(id);
110
- }
111
- setItemsPerPage(id, itemsPerPage) {
112
- this._instances.update((current) => {
113
- const instance = current[id];
114
- if (instance) {
115
- current[id] = { ...instance, itemsPerPage };
116
- return { ...current };
117
- }
118
- return current;
119
- });
120
- // 通知分页器更新显示
121
- this.notifyChange(id);
122
- }
123
- getInstance(id = this._defaultPaginationId) {
124
- const instance = this._instances()[id];
125
- if (instance) {
126
- return this._clone(instance);
127
- }
128
- return undefined;
129
- }
130
- _updateInstance(current, incoming) {
131
- let changed = false;
132
- if (incoming.id) {
133
- const keys = new Set([...Object.keys(current), ...Object.keys(incoming)]);
134
- for (const prop of keys) {
135
- const key = prop;
136
- if (incoming[key] !== current[key]) {
137
- current[key] = incoming[key];
138
- changed = true;
139
- }
140
- }
141
- }
142
- return changed;
143
- }
144
- _needsUpdate(current, incoming) {
145
- // 检查是否有任何属性发生变化
146
- const keys = new Set([...Object.keys(current), ...Object.keys(incoming)]);
147
- for (const prop of keys) {
148
- const key = prop;
149
- if (incoming[key] !== current[key]) {
150
- return true;
151
- }
152
- }
153
- return false;
154
- }
155
- _clone(obj) {
156
- return structuredClone(obj);
157
- }
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
159
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationService, providedIn: 'root' }); }
160
- }
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationService, decorators: [{
162
- type: Injectable,
163
- args: [{
164
- providedIn: 'root'
165
- }]
166
- }] });
167
-
168
- class CmatPaginationDirective {
169
- constructor() {
170
- this.id = input(/* @ts-ignore */
171
- ...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
172
- this.maxSize = input(7, /* @ts-ignore */
173
- ...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
174
- this.pageChange = output();
175
- this.pageBoundsCorrection = output();
176
- this.perPageCountChange = output();
177
- this.pages = signal([], /* @ts-ignore */
178
- ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
179
- this.service = inject(CmatPaginationService);
180
- this._injector = inject(Injector);
181
- this._pageLinksUpdateQueued = false;
182
- effect(() => {
183
- const instances = this.service.instances();
184
- if (this._getId() === instances[this._getId()]?.id) {
185
- untracked(() => {
186
- this._schedulePageLinksUpdate();
187
- });
188
- }
189
- });
190
- this._schedulePageLinksUpdate();
191
- }
192
- previous() {
193
- if (!this.isFirstPage()) {
194
- this._checkValidId();
195
- const current = this.getCurrent();
196
- if (current)
197
- this.setCurrent(current - 1);
198
- }
199
- }
200
- next() {
201
- if (!this.isLastPage()) {
202
- this._checkValidId();
203
- const current = this.getCurrent();
204
- if (current)
205
- this.setCurrent(current + 1);
206
- }
207
- }
208
- goFirstPage() {
209
- if (!this.isFirstPage()) {
210
- this._checkValidId();
211
- this.setCurrent(1);
212
- }
213
- }
214
- goLastPage() {
215
- if (!this.isLastPage()) {
216
- this._checkValidId();
217
- const lastPage = this.getLastPage();
218
- if (lastPage)
219
- this.setCurrent(lastPage);
220
- }
221
- }
222
- isFirstPage() {
223
- return this.getCurrent() === 1;
224
- }
225
- isLastPage() {
226
- return this.getLastPage() === this.getCurrent();
227
- }
228
- setCurrent(page) {
229
- const nextPage = Number(page);
230
- if (!Number.isNaN(nextPage)) {
231
- this.pageChange.emit(nextPage);
232
- }
233
- }
234
- getCurrent() {
235
- return this.service.getCurrentPage(this._getId());
236
- }
237
- getLastPage() {
238
- const inst = this.service.getInstance(this._getId());
239
- if (!inst) {
240
- return;
241
- }
242
- if (inst.totalItems < 1) {
243
- return 1;
244
- }
245
- return Math.ceil(inst.totalItems / inst.itemsPerPage);
246
- }
247
- getTotalItems() {
248
- return this.service.getInstance(this._getId())?.totalItems;
249
- }
250
- setItemsPerPage(count) {
251
- const id = this._getId();
252
- this.service.setItemsPerPage(id, count);
253
- this.perPageCountChange.emit(count);
254
- const inst = this.service.getInstance(id);
255
- if (!inst) {
256
- return;
257
- }
258
- this.setCurrent(this._outOfBoundCorrection(inst));
259
- }
260
- _getId() {
261
- return this.id() ?? this.service.defaultId();
262
- }
263
- _checkValidId() {
264
- const id = this._getId();
265
- if (this.service.getInstance(id)?.id == null) {
266
- console.warn(`PaginationControlsDirective: the specified id "${id}" does not match any registered PaginationInstance`);
267
- }
268
- }
269
- _updatePageLinks() {
270
- const inst = this.service.getInstance(this._getId());
271
- if (!inst) {
272
- this.pages.set([]);
273
- return;
274
- }
275
- const correctedCurrentPage = this._outOfBoundCorrection(inst);
276
- const pageForRender = correctedCurrentPage !== inst.currentPage
277
- ? correctedCurrentPage
278
- : inst.currentPage;
279
- this.pageBoundsCorrection.emit(correctedCurrentPage);
280
- this.pages.set(this._createPageArray(pageForRender, inst.itemsPerPage, inst.totalItems, this.maxSize()));
281
- }
282
- _schedulePageLinksUpdate() {
283
- if (this._pageLinksUpdateQueued) {
284
- return;
285
- }
286
- this._pageLinksUpdateQueued = true;
287
- afterNextRender(() => {
288
- this._pageLinksUpdateQueued = false;
289
- this._updatePageLinks();
290
- }, { injector: this._injector });
291
- }
292
- _outOfBoundCorrection(instance) {
293
- const totalPages = Math.ceil(instance.totalItems / instance.itemsPerPage);
294
- if (totalPages < instance.currentPage && 0 < totalPages) {
295
- return totalPages;
296
- }
297
- else if (instance.currentPage < 1) {
298
- return 1;
299
- }
300
- return instance.currentPage;
301
- }
302
- _createPageArray(currentPage, itemsPerPage, totalItems, paginationRange) {
303
- paginationRange = +paginationRange;
304
- const pages = [];
305
- const totalPages = Math.max(Math.ceil(totalItems / itemsPerPage), 1);
306
- const halfWay = Math.ceil(paginationRange / 2);
307
- const isStart = currentPage <= halfWay;
308
- const isEnd = totalPages - halfWay < currentPage;
309
- const isMiddle = !isStart && !isEnd;
310
- const ellipsesNeeded = paginationRange < totalPages;
311
- let i = 1;
312
- while (i <= totalPages && i <= paginationRange) {
313
- let label;
314
- const pageNumber = this._calculatePageNumber(i, currentPage, paginationRange, totalPages);
315
- const openingEllipsesNeeded = i === 2 && (isMiddle || isEnd);
316
- const closingEllipsesNeeded = i === paginationRange - 1 && (isMiddle || isStart);
317
- if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
318
- label = '...';
319
- }
320
- else {
321
- label = pageNumber;
322
- }
323
- pages.push({
324
- label: label,
325
- value: pageNumber,
326
- });
327
- i++;
328
- }
329
- return pages;
330
- }
331
- _calculatePageNumber(i, currentPage, paginationRange, totalPages) {
332
- const halfWay = Math.ceil(paginationRange / 2);
333
- if (i === paginationRange) {
334
- return totalPages;
335
- }
336
- else if (i === 1) {
337
- return i;
338
- }
339
- else if (paginationRange < totalPages) {
340
- if (totalPages - halfWay < currentPage) {
341
- return totalPages - paginationRange + i;
342
- }
343
- else if (halfWay < currentPage) {
344
- return currentPage - halfWay + i;
345
- }
346
- else {
347
- return i;
348
- }
349
- }
350
- else {
351
- return i;
352
- }
353
- }
354
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
355
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: CmatPaginationDirective, isStandalone: true, selector: "pagination-template,[pagination-template]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange", pageBoundsCorrection: "pageBoundsCorrection", perPageCountChange: "perPageCountChange" }, exportAs: ["paginationApi"], ngImport: i0 }); }
356
- }
357
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationDirective, decorators: [{
358
- type: Directive,
359
- args: [{
360
- // eslint-disable-next-line @angular-eslint/directive-selector
361
- selector: 'pagination-template,[pagination-template]',
362
- exportAs: 'paginationApi',
363
- }]
364
- }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageBoundsCorrection: [{ type: i0.Output, args: ["pageBoundsCorrection"] }], perPageCountChange: [{ type: i0.Output, args: ["perPageCountChange"] }] } });
365
-
366
- class CmatPaginationComponent {
367
- constructor() {
368
- this.id = input(/* @ts-ignore */
369
- ...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
370
- this.maxSize = input(7, /* @ts-ignore */
371
- ...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
372
- this.itemsPerPages = input([10, 20, 30], /* @ts-ignore */
373
- ...(ngDevMode ? [{ debugName: "itemsPerPages" }] : /* istanbul ignore next */ []));
374
- this.initPerPage = input(10, /* @ts-ignore */
375
- ...(ngDevMode ? [{ debugName: "initPerPage" }] : /* istanbul ignore next */ []));
376
- this.autoHide = input(false, /* @ts-ignore */
377
- ...(ngDevMode ? [{ debugName: "autoHide" }] : /* istanbul ignore next */ []));
378
- this.pageChange = output();
379
- this.pageBoundsCorrection = output();
380
- this.perPageCountChange = output();
381
- this._elementRef = inject(ElementRef);
382
- this._destroyRef = inject(DestroyRef);
383
- // 组件宽度信号,初始化为一个合理默认值
384
- this._componentWidth = signal(1024, /* @ts-ignore */
385
- ...(ngDevMode ? [{ debugName: "_componentWidth" }] : /* istanbul ignore next */ []));
386
- // 根据组件自身宽度判断是否使用移动端样式(阈值:768px)
387
- // eslint-disable-next-line @typescript-eslint/member-ordering
388
- this.isScreenSmall = computed(() => {
389
- return this._componentWidth() < 768;
390
- }, /* @ts-ignore */
391
- ...(ngDevMode ? [{ debugName: "isScreenSmall" }] : /* istanbul ignore next */ []));
392
- // 使用 ResizeObserver 监听组件自身宽度变化
393
- afterNextRender(() => {
394
- const element = this._elementRef.nativeElement;
395
- // 确保元素是块级或行内块级,可以正确测量宽度
396
- if (getComputedStyle(element).display === 'inline') {
397
- element.style.display = 'inline-block';
398
- element.style.width = '100%';
399
- }
400
- // 立即获取一次初始宽度
401
- const initialWidth = element.getBoundingClientRect().width;
402
- if (initialWidth > 0) {
403
- this._componentWidth.set(initialWidth);
404
- }
405
- // 创建 ResizeObserver
406
- const resizeObserver = new ResizeObserver((entries) => {
407
- for (const entry of entries) {
408
- const width = entry.contentRect.width;
409
- // 只有当宽度大于0时才更新,避免无效值
410
- if (width > 0) {
411
- this._componentWidth.set(width);
412
- }
413
- }
414
- });
415
- // 开始观察
416
- resizeObserver.observe(element);
417
- // 组件销毁时清理观察者
418
- this._destroyRef.onDestroy(() => {
419
- resizeObserver.disconnect();
420
- });
421
- });
422
- }
423
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
424
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: CmatPaginationComponent, isStandalone: true, selector: "cmat-pagination", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, itemsPerPages: { classPropertyName: "itemsPerPages", publicName: "itemsPerPages", isSignal: true, isRequired: false, transformFunction: null }, initPerPage: { classPropertyName: "initPerPage", publicName: "initPerPage", isSignal: true, isRequired: false, transformFunction: null }, autoHide: { classPropertyName: "autoHide", publicName: "autoHide", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange", pageBoundsCorrection: "pageBoundsCorrection", perPageCountChange: "perPageCountChange" }, exportAs: ["cmatPagination"], ngImport: i0, template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex items-center\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\"\r\n (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n @if (!(autoHide() && p.pages().length <= 1)) {\r\n <!-- \u5DE6\uFF1A\u603B\u8BA1 -->\r\n <div class=\"flex-auto\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <span class=\"text-sm text-secondary whitespace-nowrap\">\u5171 {{ p.getTotalItems() }} \u6761</span>\r\n </div>\r\n\r\n <!-- \u53F3\uFF1A\u5BFC\u822A -->\r\n <nav role=\"navigation\" class=\"flex\" [ngClass]=\"{'w-full':isScreenSmall()}\">\r\n <ul class=\"flex items-center\"\r\n [ngClass]=\"{'justify-center w-full gap-0':isScreenSmall(),'flex-row gap-0.5':!isScreenSmall()}\">\r\n\r\n <!-- \u9996\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.goFirstPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u4E0A\u4E00\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.previous()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-left\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u9875\u7801 -->\r\n <li class=\"mx-1\">\r\n <div class=\"flex items-center gap-0.5\">\r\n @for (page of p.pages(); track $index) {\r\n @if (page.label === \"...\") {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary\">...</span>\r\n } @else if (p.getCurrent() === page.value) {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full bg-primary-500 text-white text-sm font-medium\">\r\n {{ page.label | number: \"\" }}\r\n </span>\r\n } @else {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary cursor-pointer hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n {{ page.label | number: \"\" }}\r\n </a>\r\n }\r\n }\r\n </div>\r\n </li>\r\n\r\n <!-- \u4E0B\u4E00\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.next()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-right\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u672B\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.goLastPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u9875\u7801\u8DF3\u8F6C\uFF08\u684C\u9762\u7AEF\uFF09 -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"outline\" [ngStyle]=\"{\r\n width: (p.getLastPage()?.toString()?.length || 0) * 8 + 64 + 'px',\r\n }\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\" [value]=\"p.getCurrent()\"\r\n [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage() || 0\" (keyup.enter)=\"p.setCurrent(current.value)\" />\r\n <span matSuffix>/\r\n <div class=\"px-2\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n\r\n <!-- \u6BCF\u9875\u6761\u6570\uFF08\u684C\u9762\u7AEF\uFF09 -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field class=\"w-20\" appearance=\"outline\">\r\n <mat-select #pageCount [value]=\"initPerPage()\" (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">{{ perPage }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n </nav>\r\n }\r\n</pagination-template>\r\n\r\n<style>\r\n @media (hover: none) and (pointer: coarse) {\r\n cmat-pagination button[matIconButton] {\r\n transition: transform 150ms ease;\r\n }\r\n cmat-pagination button[matIconButton]:active:not([disabled]) {\r\n transform: scale(0.88);\r\n }\r\n }\r\n</style>\r\n", styles: ["@media(hover:none)and (pointer:coarse){cmat-pagination button[matIconButton]{transition:transform .15s ease}cmat-pagination button[matIconButton]:active:not([disabled]){transform:scale(.88)}}\n"], dependencies: [{ kind: "directive", type: CmatPaginationDirective, selector: "pagination-template,[pagination-template]", inputs: ["id", "maxSize"], outputs: ["pageChange", "pageBoundsCorrection", "perPageCountChange"], exportAs: ["paginationApi"] }, { kind: "directive", type: CmatDigitOnlyDirective, selector: "[cmatDigitOnly]", inputs: ["decimal", "decimalSeparator", "allowNegatives", "allowPaste", "negativeSign", "min", "max", "pattern"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i4.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: DecimalPipe, name: "number" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
425
- }
426
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginationComponent, decorators: [{
427
- type: Component,
428
- args: [{ selector: 'cmat-pagination', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cmatPagination', imports: [
429
- CmatPaginationDirective,
430
- CmatDigitOnlyDirective,
431
- MatIconModule,
432
- MatFormFieldModule,
433
- MatInputModule,
434
- MatSelectModule,
435
- DecimalPipe,
436
- MatButtonModule,
437
- NgClass,
438
- NgStyle,
439
- ], template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex items-center\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\"\r\n (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n @if (!(autoHide() && p.pages().length <= 1)) {\r\n <!-- \u5DE6\uFF1A\u603B\u8BA1 -->\r\n <div class=\"flex-auto\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <span class=\"text-sm text-secondary whitespace-nowrap\">\u5171 {{ p.getTotalItems() }} \u6761</span>\r\n </div>\r\n\r\n <!-- \u53F3\uFF1A\u5BFC\u822A -->\r\n <nav role=\"navigation\" class=\"flex\" [ngClass]=\"{'w-full':isScreenSmall()}\">\r\n <ul class=\"flex items-center\"\r\n [ngClass]=\"{'justify-center w-full gap-0':isScreenSmall(),'flex-row gap-0.5':!isScreenSmall()}\">\r\n\r\n <!-- \u9996\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.goFirstPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u4E0A\u4E00\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.previous()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-left\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u9875\u7801 -->\r\n <li class=\"mx-1\">\r\n <div class=\"flex items-center gap-0.5\">\r\n @for (page of p.pages(); track $index) {\r\n @if (page.label === \"...\") {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary\">...</span>\r\n } @else if (p.getCurrent() === page.value) {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full bg-primary-500 text-white text-sm font-medium\">\r\n {{ page.label | number: \"\" }}\r\n </span>\r\n } @else {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary cursor-pointer hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n {{ page.label | number: \"\" }}\r\n </a>\r\n }\r\n }\r\n </div>\r\n </li>\r\n\r\n <!-- \u4E0B\u4E00\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.next()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-right\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u672B\u9875 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.goLastPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- \u9875\u7801\u8DF3\u8F6C\uFF08\u684C\u9762\u7AEF\uFF09 -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"outline\" [ngStyle]=\"{\r\n width: (p.getLastPage()?.toString()?.length || 0) * 8 + 64 + 'px',\r\n }\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\" [value]=\"p.getCurrent()\"\r\n [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage() || 0\" (keyup.enter)=\"p.setCurrent(current.value)\" />\r\n <span matSuffix>/\r\n <div class=\"px-2\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n\r\n <!-- \u6BCF\u9875\u6761\u6570\uFF08\u684C\u9762\u7AEF\uFF09 -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field class=\"w-20\" appearance=\"outline\">\r\n <mat-select #pageCount [value]=\"initPerPage()\" (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">{{ perPage }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n </nav>\r\n }\r\n</pagination-template>\r\n\r\n<style>\r\n @media (hover: none) and (pointer: coarse) {\r\n cmat-pagination button[matIconButton] {\r\n transition: transform 150ms ease;\r\n }\r\n cmat-pagination button[matIconButton]:active:not([disabled]) {\r\n transform: scale(0.88);\r\n }\r\n }\r\n</style>\r\n" }]
440
- }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], itemsPerPages: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemsPerPages", required: false }] }], initPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "initPerPage", required: false }] }], autoHide: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoHide", required: false }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageBoundsCorrection: [{ type: i0.Output, args: ["pageBoundsCorrection"] }], perPageCountChange: [{ type: i0.Output, args: ["perPageCountChange"] }] } });
441
-
1
+ import { DecimalPipe, NgClass, NgStyle } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, Injectable, Injector, Pipe, ViewEncapsulation, afterNextRender, computed, effect, inject, input, output, signal, untracked } from "@angular/core";
4
+ import * as i5 from "@angular/material/button";
5
+ import { MatButtonModule } from "@angular/material/button";
6
+ import * as i2 from "@angular/material/form-field";
7
+ import { MatFormFieldModule } from "@angular/material/form-field";
8
+ import * as i1 from "@angular/material/icon";
9
+ import { MatIconModule } from "@angular/material/icon";
10
+ import * as i3 from "@angular/material/input";
11
+ import { MatInputModule } from "@angular/material/input";
12
+ import * as i4 from "@angular/material/select";
13
+ import { MatSelectModule } from "@angular/material/select";
14
+ import { CmatDigitOnlyDirective } from "cmat/directives/digit-only";
15
+ var CmatPaginationService = class CmatPaginationService {
16
+ constructor() {
17
+ this._instances = signal({}, ...ngDevMode ? [{ debugName: "_instances" }] : /* istanbul ignore next */ []);
18
+ this.instances = this._instances.asReadonly();
19
+ this._defaultPaginationId = "DEFAULT_PAGINATION_ID";
20
+ }
21
+ defaultId() {
22
+ return this._defaultPaginationId;
23
+ }
24
+ notifyChange(_id) {
25
+ requestAnimationFrame(() => {
26
+ this._instances.update((current) => ({ ...current }));
27
+ });
28
+ }
29
+ register(instance, fromPipe = false) {
30
+ const normalizedInstance = {
31
+ ...structuredClone(instance),
32
+ id: instance.id ?? this._defaultPaginationId
33
+ };
34
+ const id = normalizedInstance.id;
35
+ let changed = false;
36
+ const currentInstances = untracked(() => this._instances());
37
+ if (!currentInstances[id]) changed = true;
38
+ else if (this._needsUpdate(currentInstances[id], normalizedInstance)) changed = true;
39
+ if (changed) {
40
+ if (fromPipe) requestAnimationFrame(() => {
41
+ this._instances.update((current) => {
42
+ if (!current[id]) return {
43
+ ...current,
44
+ [id]: normalizedInstance
45
+ };
46
+ else {
47
+ this._updateInstance(current[id], normalizedInstance);
48
+ return { ...current };
49
+ }
50
+ });
51
+ });
52
+ else this._instances.update((current) => {
53
+ if (!current[id]) return {
54
+ ...current,
55
+ [id]: normalizedInstance
56
+ };
57
+ else {
58
+ this._updateInstance(current[id], normalizedInstance);
59
+ return { ...current };
60
+ }
61
+ });
62
+ }
63
+ return changed;
64
+ }
65
+ getCurrentPage(id) {
66
+ return this._instances()[id]?.currentPage;
67
+ }
68
+ getItemsPerPage(id) {
69
+ return this._instances()[id]?.itemsPerPage;
70
+ }
71
+ setCurrentPage(id, page) {
72
+ this._instances.update((current) => {
73
+ const instance = current[id];
74
+ if (instance) {
75
+ if (page <= Math.ceil(instance.totalItems / instance.itemsPerPage) && 1 <= page) {
76
+ current[id] = {
77
+ ...instance,
78
+ currentPage: page
79
+ };
80
+ return { ...current };
81
+ }
82
+ }
83
+ return current;
84
+ });
85
+ this.notifyChange(id);
86
+ }
87
+ setTotalItems(id, totalItems) {
88
+ this._instances.update((current) => {
89
+ const instance = current[id];
90
+ if (instance && 0 <= totalItems) {
91
+ current[id] = {
92
+ ...instance,
93
+ totalItems
94
+ };
95
+ return { ...current };
96
+ }
97
+ return current;
98
+ });
99
+ this.notifyChange(id);
100
+ }
101
+ setItemsPerPage(id, itemsPerPage) {
102
+ this._instances.update((current) => {
103
+ const instance = current[id];
104
+ if (instance) {
105
+ current[id] = {
106
+ ...instance,
107
+ itemsPerPage
108
+ };
109
+ return { ...current };
110
+ }
111
+ return current;
112
+ });
113
+ this.notifyChange(id);
114
+ }
115
+ getInstance(id = this._defaultPaginationId) {
116
+ const instance = this._instances()[id];
117
+ if (instance) return this._clone(instance);
118
+ }
119
+ _updateInstance(current, incoming) {
120
+ let changed = false;
121
+ if (incoming.id) {
122
+ const keys = /* @__PURE__ */ new Set([...Object.keys(current), ...Object.keys(incoming)]);
123
+ for (const prop of keys) {
124
+ const key = prop;
125
+ if (incoming[key] !== current[key]) {
126
+ current[key] = incoming[key];
127
+ changed = true;
128
+ }
129
+ }
130
+ }
131
+ return changed;
132
+ }
133
+ _needsUpdate(current, incoming) {
134
+ const keys = /* @__PURE__ */ new Set([...Object.keys(current), ...Object.keys(incoming)]);
135
+ for (const prop of keys) {
136
+ const key = prop;
137
+ if (incoming[key] !== current[key]) return true;
138
+ }
139
+ return false;
140
+ }
141
+ _clone(obj) {
142
+ return structuredClone(obj);
143
+ }
144
+ static {
145
+ this.ɵfac = i0.ɵɵngDeclareFactory({
146
+ minVersion: "12.0.0",
147
+ version: "22.2.3",
148
+ ngImport: i0,
149
+ type: CmatPaginationService,
150
+ deps: [],
151
+ target: i0.ɵɵFactoryTarget.Injectable
152
+ });
153
+ }
154
+ static {
155
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
156
+ minVersion: "12.0.0",
157
+ version: "22.2.3",
158
+ ngImport: i0,
159
+ type: CmatPaginationService,
160
+ providedIn: "root"
161
+ });
162
+ }
163
+ };
164
+ i0.ɵɵngDeclareClassMetadata({
165
+ minVersion: "12.0.0",
166
+ version: "22.2.3",
167
+ ngImport: i0,
168
+ type: CmatPaginationService,
169
+ decorators: [{
170
+ type: Injectable,
171
+ args: [{ providedIn: "root" }]
172
+ }]
173
+ });
174
+ var CmatPaginationDirective = class CmatPaginationDirective {
175
+ constructor() {
176
+ this.id = input(...ngDevMode ? [void 0, { debugName: "id" }] : /* istanbul ignore next */ []);
177
+ this.maxSize = input(7, ...ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []);
178
+ this.pageChange = output();
179
+ this.pageBoundsCorrection = output();
180
+ this.perPageCountChange = output();
181
+ this.pages = signal([], ...ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []);
182
+ this.service = inject(CmatPaginationService);
183
+ this._injector = inject(Injector);
184
+ this._pageLinksUpdateQueued = false;
185
+ effect(() => {
186
+ const instances = this.service.instances();
187
+ if (this._getId() === instances[this._getId()]?.id) untracked(() => {
188
+ this._schedulePageLinksUpdate();
189
+ });
190
+ });
191
+ this._schedulePageLinksUpdate();
192
+ }
193
+ previous() {
194
+ if (!this.isFirstPage()) {
195
+ this._checkValidId();
196
+ const current = this.getCurrent();
197
+ if (current) this.setCurrent(current - 1);
198
+ }
199
+ }
200
+ next() {
201
+ if (!this.isLastPage()) {
202
+ this._checkValidId();
203
+ const current = this.getCurrent();
204
+ if (current) this.setCurrent(current + 1);
205
+ }
206
+ }
207
+ goFirstPage() {
208
+ if (!this.isFirstPage()) {
209
+ this._checkValidId();
210
+ this.setCurrent(1);
211
+ }
212
+ }
213
+ goLastPage() {
214
+ if (!this.isLastPage()) {
215
+ this._checkValidId();
216
+ const lastPage = this.getLastPage();
217
+ if (lastPage) this.setCurrent(lastPage);
218
+ }
219
+ }
220
+ isFirstPage() {
221
+ return this.getCurrent() === 1;
222
+ }
223
+ isLastPage() {
224
+ return this.getLastPage() === this.getCurrent();
225
+ }
226
+ setCurrent(page) {
227
+ const nextPage = Number(page);
228
+ if (!Number.isNaN(nextPage)) this.pageChange.emit(nextPage);
229
+ }
230
+ getCurrent() {
231
+ return this.service.getCurrentPage(this._getId());
232
+ }
233
+ getLastPage() {
234
+ const inst = this.service.getInstance(this._getId());
235
+ if (!inst) return;
236
+ if (inst.totalItems < 1) return 1;
237
+ return Math.ceil(inst.totalItems / inst.itemsPerPage);
238
+ }
239
+ getTotalItems() {
240
+ return this.service.getInstance(this._getId())?.totalItems;
241
+ }
242
+ setItemsPerPage(count) {
243
+ const id = this._getId();
244
+ this.service.setItemsPerPage(id, count);
245
+ this.perPageCountChange.emit(count);
246
+ const inst = this.service.getInstance(id);
247
+ if (!inst) return;
248
+ this.setCurrent(this._outOfBoundCorrection(inst));
249
+ }
250
+ _getId() {
251
+ return this.id() ?? this.service.defaultId();
252
+ }
253
+ _checkValidId() {
254
+ const id = this._getId();
255
+ if (this.service.getInstance(id)?.id == null) console.warn(`PaginationControlsDirective: the specified id "${id}" does not match any registered PaginationInstance`);
256
+ }
257
+ _updatePageLinks() {
258
+ const inst = this.service.getInstance(this._getId());
259
+ if (!inst) {
260
+ this.pages.set([]);
261
+ return;
262
+ }
263
+ const correctedCurrentPage = this._outOfBoundCorrection(inst);
264
+ const pageForRender = correctedCurrentPage !== inst.currentPage ? correctedCurrentPage : inst.currentPage;
265
+ this.pageBoundsCorrection.emit(correctedCurrentPage);
266
+ this.pages.set(this._createPageArray(pageForRender, inst.itemsPerPage, inst.totalItems, this.maxSize()));
267
+ }
268
+ _schedulePageLinksUpdate() {
269
+ if (this._pageLinksUpdateQueued) return;
270
+ this._pageLinksUpdateQueued = true;
271
+ afterNextRender(() => {
272
+ this._pageLinksUpdateQueued = false;
273
+ this._updatePageLinks();
274
+ }, { injector: this._injector });
275
+ }
276
+ _outOfBoundCorrection(instance) {
277
+ const totalPages = Math.ceil(instance.totalItems / instance.itemsPerPage);
278
+ if (totalPages < instance.currentPage && 0 < totalPages) return totalPages;
279
+ else if (instance.currentPage < 1) return 1;
280
+ return instance.currentPage;
281
+ }
282
+ _createPageArray(currentPage, itemsPerPage, totalItems, paginationRange) {
283
+ paginationRange = +paginationRange;
284
+ const pages = [];
285
+ const totalPages = Math.max(Math.ceil(totalItems / itemsPerPage), 1);
286
+ const halfWay = Math.ceil(paginationRange / 2);
287
+ const isStart = currentPage <= halfWay;
288
+ const isEnd = totalPages - halfWay < currentPage;
289
+ const isMiddle = !isStart && !isEnd;
290
+ const ellipsesNeeded = paginationRange < totalPages;
291
+ let i = 1;
292
+ while (i <= totalPages && i <= paginationRange) {
293
+ let label;
294
+ const pageNumber = this._calculatePageNumber(i, currentPage, paginationRange, totalPages);
295
+ const openingEllipsesNeeded = i === 2 && (isMiddle || isEnd);
296
+ const closingEllipsesNeeded = i === paginationRange - 1 && (isMiddle || isStart);
297
+ if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) label = "...";
298
+ else label = pageNumber;
299
+ pages.push({
300
+ label,
301
+ value: pageNumber
302
+ });
303
+ i++;
304
+ }
305
+ return pages;
306
+ }
307
+ _calculatePageNumber(i, currentPage, paginationRange, totalPages) {
308
+ const halfWay = Math.ceil(paginationRange / 2);
309
+ if (i === paginationRange) return totalPages;
310
+ else if (i === 1) return i;
311
+ else if (paginationRange < totalPages) {
312
+ if (totalPages - halfWay < currentPage) return totalPages - paginationRange + i;
313
+ else if (halfWay < currentPage) return currentPage - halfWay + i;
314
+ else return i;
315
+ } else return i;
316
+ }
317
+ static {
318
+ this.ɵfac = i0.ɵɵngDeclareFactory({
319
+ minVersion: "12.0.0",
320
+ version: "22.2.3",
321
+ ngImport: i0,
322
+ type: CmatPaginationDirective,
323
+ deps: [],
324
+ target: i0.ɵɵFactoryTarget.Directive
325
+ });
326
+ }
327
+ static {
328
+ this.ɵdir = i0.ɵɵngDeclareDirective({
329
+ minVersion: "17.1.0",
330
+ version: "22.2.3",
331
+ type: CmatPaginationDirective,
332
+ isStandalone: true,
333
+ selector: "pagination-template,[pagination-template]",
334
+ inputs: {
335
+ id: {
336
+ classPropertyName: "id",
337
+ publicName: "id",
338
+ isSignal: true,
339
+ isRequired: false,
340
+ transformFunction: null
341
+ },
342
+ maxSize: {
343
+ classPropertyName: "maxSize",
344
+ publicName: "maxSize",
345
+ isSignal: true,
346
+ isRequired: false,
347
+ transformFunction: null
348
+ }
349
+ },
350
+ outputs: {
351
+ pageChange: "pageChange",
352
+ pageBoundsCorrection: "pageBoundsCorrection",
353
+ perPageCountChange: "perPageCountChange"
354
+ },
355
+ exportAs: ["paginationApi"],
356
+ ngImport: i0
357
+ });
358
+ }
359
+ };
360
+ i0.ɵɵngDeclareClassMetadata({
361
+ minVersion: "12.0.0",
362
+ version: "22.2.3",
363
+ ngImport: i0,
364
+ type: CmatPaginationDirective,
365
+ decorators: [{
366
+ type: Directive,
367
+ args: [{
368
+ selector: "pagination-template,[pagination-template]",
369
+ exportAs: "paginationApi"
370
+ }]
371
+ }],
372
+ ctorParameters: () => [],
373
+ propDecorators: {
374
+ id: [{
375
+ type: i0.Input,
376
+ args: [{
377
+ isSignal: true,
378
+ alias: "id",
379
+ required: false
380
+ }]
381
+ }],
382
+ maxSize: [{
383
+ type: i0.Input,
384
+ args: [{
385
+ isSignal: true,
386
+ alias: "maxSize",
387
+ required: false
388
+ }]
389
+ }],
390
+ pageChange: [{
391
+ type: i0.Output,
392
+ args: ["pageChange"]
393
+ }],
394
+ pageBoundsCorrection: [{
395
+ type: i0.Output,
396
+ args: ["pageBoundsCorrection"]
397
+ }],
398
+ perPageCountChange: [{
399
+ type: i0.Output,
400
+ args: ["perPageCountChange"]
401
+ }]
402
+ }
403
+ });
404
+ var CmatPaginationComponent = class CmatPaginationComponent {
405
+ constructor() {
406
+ this.id = input(...ngDevMode ? [void 0, { debugName: "id" }] : /* istanbul ignore next */ []);
407
+ this.maxSize = input(7, ...ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []);
408
+ this.itemsPerPages = input([
409
+ 10,
410
+ 20,
411
+ 30
412
+ ], ...ngDevMode ? [{ debugName: "itemsPerPages" }] : /* istanbul ignore next */ []);
413
+ this.initPerPage = input(10, ...ngDevMode ? [{ debugName: "initPerPage" }] : /* istanbul ignore next */ []);
414
+ this.autoHide = input(false, ...ngDevMode ? [{ debugName: "autoHide" }] : /* istanbul ignore next */ []);
415
+ this.pageChange = output();
416
+ this.pageBoundsCorrection = output();
417
+ this.perPageCountChange = output();
418
+ this._elementRef = inject(ElementRef);
419
+ this._destroyRef = inject(DestroyRef);
420
+ this._componentWidth = signal(1024, ...ngDevMode ? [{ debugName: "_componentWidth" }] : /* istanbul ignore next */ []);
421
+ this.isScreenSmall = computed(() => {
422
+ return this._componentWidth() < 768;
423
+ }, ...ngDevMode ? [{ debugName: "isScreenSmall" }] : /* istanbul ignore next */ []);
424
+ afterNextRender(() => {
425
+ const element = this._elementRef.nativeElement;
426
+ if (getComputedStyle(element).display === "inline") {
427
+ element.style.display = "inline-block";
428
+ element.style.width = "100%";
429
+ }
430
+ const initialWidth = element.getBoundingClientRect().width;
431
+ if (initialWidth > 0) this._componentWidth.set(initialWidth);
432
+ const resizeObserver = new ResizeObserver((entries) => {
433
+ for (const entry of entries) {
434
+ const width = entry.contentRect.width;
435
+ if (width > 0) this._componentWidth.set(width);
436
+ }
437
+ });
438
+ resizeObserver.observe(element);
439
+ this._destroyRef.onDestroy(() => {
440
+ resizeObserver.disconnect();
441
+ });
442
+ });
443
+ }
444
+ static {
445
+ this.ɵfac = i0.ɵɵngDeclareFactory({
446
+ minVersion: "12.0.0",
447
+ version: "22.2.3",
448
+ ngImport: i0,
449
+ type: CmatPaginationComponent,
450
+ deps: [],
451
+ target: i0.ɵɵFactoryTarget.Component
452
+ });
453
+ }
454
+ static {
455
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
456
+ minVersion: "17.0.0",
457
+ version: "22.2.3",
458
+ type: CmatPaginationComponent,
459
+ isStandalone: true,
460
+ selector: "cmat-pagination",
461
+ inputs: {
462
+ id: {
463
+ classPropertyName: "id",
464
+ publicName: "id",
465
+ isSignal: true,
466
+ isRequired: false,
467
+ transformFunction: null
468
+ },
469
+ maxSize: {
470
+ classPropertyName: "maxSize",
471
+ publicName: "maxSize",
472
+ isSignal: true,
473
+ isRequired: false,
474
+ transformFunction: null
475
+ },
476
+ itemsPerPages: {
477
+ classPropertyName: "itemsPerPages",
478
+ publicName: "itemsPerPages",
479
+ isSignal: true,
480
+ isRequired: false,
481
+ transformFunction: null
482
+ },
483
+ initPerPage: {
484
+ classPropertyName: "initPerPage",
485
+ publicName: "initPerPage",
486
+ isSignal: true,
487
+ isRequired: false,
488
+ transformFunction: null
489
+ },
490
+ autoHide: {
491
+ classPropertyName: "autoHide",
492
+ publicName: "autoHide",
493
+ isSignal: true,
494
+ isRequired: false,
495
+ transformFunction: null
496
+ }
497
+ },
498
+ outputs: {
499
+ pageChange: "pageChange",
500
+ pageBoundsCorrection: "pageBoundsCorrection",
501
+ perPageCountChange: "perPageCountChange"
502
+ },
503
+ exportAs: ["cmatPagination"],
504
+ ngImport: i0,
505
+ template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex items-center\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\"\r\n (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n @if (!(autoHide() && p.pages().length <= 1)) {\r\n <!-- 左:总计 -->\r\n <div class=\"flex-auto\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <span class=\"text-sm text-secondary whitespace-nowrap\">共 {{ p.getTotalItems() }} 条</span>\r\n </div>\r\n\r\n <!-- 右:导航 -->\r\n <nav role=\"navigation\" class=\"flex\" [ngClass]=\"{'w-full':isScreenSmall()}\">\r\n <ul class=\"flex items-center\"\r\n [ngClass]=\"{'justify-center w-full gap-0':isScreenSmall(),'flex-row gap-0.5':!isScreenSmall()}\">\r\n\r\n <!-- 首页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.goFirstPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 上一页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.previous()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-left\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 页码 -->\r\n <li class=\"mx-1\">\r\n <div class=\"flex items-center gap-0.5\">\r\n @for (page of p.pages(); track $index) {\r\n @if (page.label === \"...\") {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary\">...</span>\r\n } @else if (p.getCurrent() === page.value) {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full bg-primary-500 text-white text-sm font-medium\">\r\n {{ page.label | number: \"\" }}\r\n </span>\r\n } @else {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary cursor-pointer hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n {{ page.label | number: \"\" }}\r\n </a>\r\n }\r\n }\r\n </div>\r\n </li>\r\n\r\n <!-- 下一页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.next()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-right\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 末页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.goLastPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 页码跳转(桌面端) -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"outline\" [ngStyle]=\"{\r\n width: (p.getLastPage()?.toString()?.length || 0) * 8 + 64 + 'px',\r\n }\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\" [value]=\"p.getCurrent()\"\r\n [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage() || 0\" (keyup.enter)=\"p.setCurrent(current.value)\" />\r\n <span matSuffix>/\r\n <div class=\"px-2\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n\r\n <!-- 每页条数(桌面端) -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field class=\"w-20\" appearance=\"outline\">\r\n <mat-select #pageCount [value]=\"initPerPage()\" (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">{{ perPage }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n </nav>\r\n }\r\n</pagination-template>\r\n\r\n<style>\r\n @media (hover: none) and (pointer: coarse) {\r\n cmat-pagination button[matIconButton] {\r\n transition: transform 150ms ease;\r\n }\r\n cmat-pagination button[matIconButton]:active:not([disabled]) {\r\n transform: scale(0.88);\r\n }\r\n }\r\n</style>\r\n",
506
+ styles: ["@media(hover:none)and (pointer:coarse){cmat-pagination button[matIconButton]{transition:transform .15s ease}cmat-pagination button[matIconButton]:active:not([disabled]){transform:scale(.88)}}\n"],
507
+ dependencies: [
508
+ {
509
+ kind: "directive",
510
+ type: CmatPaginationDirective,
511
+ selector: "pagination-template,[pagination-template]",
512
+ inputs: ["id", "maxSize"],
513
+ outputs: [
514
+ "pageChange",
515
+ "pageBoundsCorrection",
516
+ "perPageCountChange"
517
+ ],
518
+ exportAs: ["paginationApi"]
519
+ },
520
+ {
521
+ kind: "directive",
522
+ type: CmatDigitOnlyDirective,
523
+ selector: "[cmatDigitOnly]",
524
+ inputs: [
525
+ "decimal",
526
+ "decimalSeparator",
527
+ "allowNegatives",
528
+ "allowPaste",
529
+ "negativeSign",
530
+ "min",
531
+ "max",
532
+ "pattern"
533
+ ]
534
+ },
535
+ {
536
+ kind: "ngmodule",
537
+ type: MatIconModule
538
+ },
539
+ {
540
+ kind: "component",
541
+ type: i1.MatIcon,
542
+ selector: "mat-icon",
543
+ inputs: [
544
+ "color",
545
+ "inline",
546
+ "svgIcon",
547
+ "fontSet",
548
+ "fontIcon"
549
+ ],
550
+ exportAs: ["matIcon"]
551
+ },
552
+ {
553
+ kind: "ngmodule",
554
+ type: MatFormFieldModule
555
+ },
556
+ {
557
+ kind: "component",
558
+ type: i2.MatFormField,
559
+ selector: "mat-form-field",
560
+ inputs: [
561
+ "hideRequiredMarker",
562
+ "color",
563
+ "floatLabel",
564
+ "appearance",
565
+ "subscriptSizing",
566
+ "hintLabel"
567
+ ],
568
+ exportAs: ["matFormField"]
569
+ },
570
+ {
571
+ kind: "directive",
572
+ type: i2.MatSuffix,
573
+ selector: "[matSuffix], [matIconSuffix], [matTextSuffix]",
574
+ inputs: ["matTextSuffix"]
575
+ },
576
+ {
577
+ kind: "ngmodule",
578
+ type: MatInputModule
579
+ },
580
+ {
581
+ kind: "directive",
582
+ type: i3.MatInput,
583
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
584
+ inputs: [
585
+ "disabled",
586
+ "id",
587
+ "placeholder",
588
+ "name",
589
+ "required",
590
+ "type",
591
+ "errorStateMatcher",
592
+ "aria-describedby",
593
+ "value",
594
+ "readonly",
595
+ "disabledInteractive"
596
+ ],
597
+ exportAs: ["matInput"]
598
+ },
599
+ {
600
+ kind: "ngmodule",
601
+ type: MatSelectModule
602
+ },
603
+ {
604
+ kind: "component",
605
+ type: i4.MatSelect,
606
+ selector: "mat-select",
607
+ inputs: [
608
+ "aria-describedby",
609
+ "panelClass",
610
+ "disabled",
611
+ "disableRipple",
612
+ "tabIndex",
613
+ "hideSingleSelectionIndicator",
614
+ "placeholder",
615
+ "required",
616
+ "multiple",
617
+ "disableOptionCentering",
618
+ "compareWith",
619
+ "value",
620
+ "aria-label",
621
+ "aria-labelledby",
622
+ "errorStateMatcher",
623
+ "typeaheadDebounceInterval",
624
+ "sortComparator",
625
+ "id",
626
+ "panelWidth",
627
+ "canSelectNullableOptions"
628
+ ],
629
+ outputs: [
630
+ "openedChange",
631
+ "opened",
632
+ "closed",
633
+ "selectionChange",
634
+ "valueChange"
635
+ ],
636
+ exportAs: ["matSelect"]
637
+ },
638
+ {
639
+ kind: "component",
640
+ type: i4.MatOption,
641
+ selector: "mat-option",
642
+ inputs: [
643
+ "value",
644
+ "id",
645
+ "disabled"
646
+ ],
647
+ outputs: ["onSelectionChange"],
648
+ exportAs: ["matOption"]
649
+ },
650
+ {
651
+ kind: "ngmodule",
652
+ type: MatButtonModule
653
+ },
654
+ {
655
+ kind: "component",
656
+ type: i5.MatIconButton,
657
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
658
+ exportAs: ["matButton", "matAnchor"]
659
+ },
660
+ {
661
+ kind: "directive",
662
+ type: NgClass,
663
+ selector: "[ngClass]",
664
+ inputs: ["class", "ngClass"]
665
+ },
666
+ {
667
+ kind: "directive",
668
+ type: NgStyle,
669
+ selector: "[ngStyle]",
670
+ inputs: ["ngStyle"]
671
+ },
672
+ {
673
+ kind: "pipe",
674
+ type: DecimalPipe,
675
+ name: "number"
676
+ }
677
+ ],
678
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
679
+ encapsulation: i0.ViewEncapsulation.None
680
+ });
681
+ }
682
+ };
683
+ i0.ɵɵngDeclareClassMetadata({
684
+ minVersion: "12.0.0",
685
+ version: "22.2.3",
686
+ ngImport: i0,
687
+ type: CmatPaginationComponent,
688
+ decorators: [{
689
+ type: Component,
690
+ args: [{
691
+ selector: "cmat-pagination",
692
+ changeDetection: ChangeDetectionStrategy.OnPush,
693
+ encapsulation: ViewEncapsulation.None,
694
+ exportAs: "cmatPagination",
695
+ imports: [
696
+ CmatPaginationDirective,
697
+ CmatDigitOnlyDirective,
698
+ MatIconModule,
699
+ MatFormFieldModule,
700
+ MatInputModule,
701
+ MatSelectModule,
702
+ DecimalPipe,
703
+ MatButtonModule,
704
+ NgClass,
705
+ NgStyle
706
+ ],
707
+ template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex items-center\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\"\r\n (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n @if (!(autoHide() && p.pages().length <= 1)) {\r\n <!-- 左:总计 -->\r\n <div class=\"flex-auto\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <span class=\"text-sm text-secondary whitespace-nowrap\">共 {{ p.getTotalItems() }} 条</span>\r\n </div>\r\n\r\n <!-- 右:导航 -->\r\n <nav role=\"navigation\" class=\"flex\" [ngClass]=\"{'w-full':isScreenSmall()}\">\r\n <ul class=\"flex items-center\"\r\n [ngClass]=\"{'justify-center w-full gap-0':isScreenSmall(),'flex-row gap-0.5':!isScreenSmall()}\">\r\n\r\n <!-- 首页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.goFirstPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 上一页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === 1\" (click)=\"p.previous()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-left\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 页码 -->\r\n <li class=\"mx-1\">\r\n <div class=\"flex items-center gap-0.5\">\r\n @for (page of p.pages(); track $index) {\r\n @if (page.label === \"...\") {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary\">...</span>\r\n } @else if (p.getCurrent() === page.value) {\r\n <span class=\"flex items-center justify-center w-8 h-8 rounded-full bg-primary-500 text-white text-sm font-medium\">\r\n {{ page.label | number: \"\" }}\r\n </span>\r\n } @else {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"flex items-center justify-center w-8 h-8 rounded-full text-sm text-secondary cursor-pointer hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n {{ page.label | number: \"\" }}\r\n </a>\r\n }\r\n }\r\n </div>\r\n </li>\r\n\r\n <!-- 下一页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.next()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"heroicons_outline:chevron-right\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 末页 -->\r\n <li>\r\n <button type=\"button\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\" (click)=\"p.goLastPage()\">\r\n <mat-icon class=\"icon-size-5\" svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n\r\n <!-- 页码跳转(桌面端) -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"outline\" [ngStyle]=\"{\r\n width: (p.getLastPage()?.toString()?.length || 0) * 8 + 64 + 'px',\r\n }\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\" [value]=\"p.getCurrent()\"\r\n [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage() || 0\" (keyup.enter)=\"p.setCurrent(current.value)\" />\r\n <span matSuffix>/\r\n <div class=\"px-2\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n\r\n <!-- 每页条数(桌面端) -->\r\n <li class=\"px-1\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field class=\"w-20\" appearance=\"outline\">\r\n <mat-select #pageCount [value]=\"initPerPage()\" (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">{{ perPage }}</mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n </nav>\r\n }\r\n</pagination-template>\r\n\r\n<style>\r\n @media (hover: none) and (pointer: coarse) {\r\n cmat-pagination button[matIconButton] {\r\n transition: transform 150ms ease;\r\n }\r\n cmat-pagination button[matIconButton]:active:not([disabled]) {\r\n transform: scale(0.88);\r\n }\r\n }\r\n</style>\r\n"
708
+ }]
709
+ }],
710
+ ctorParameters: () => [],
711
+ propDecorators: {
712
+ id: [{
713
+ type: i0.Input,
714
+ args: [{
715
+ isSignal: true,
716
+ alias: "id",
717
+ required: false
718
+ }]
719
+ }],
720
+ maxSize: [{
721
+ type: i0.Input,
722
+ args: [{
723
+ isSignal: true,
724
+ alias: "maxSize",
725
+ required: false
726
+ }]
727
+ }],
728
+ itemsPerPages: [{
729
+ type: i0.Input,
730
+ args: [{
731
+ isSignal: true,
732
+ alias: "itemsPerPages",
733
+ required: false
734
+ }]
735
+ }],
736
+ initPerPage: [{
737
+ type: i0.Input,
738
+ args: [{
739
+ isSignal: true,
740
+ alias: "initPerPage",
741
+ required: false
742
+ }]
743
+ }],
744
+ autoHide: [{
745
+ type: i0.Input,
746
+ args: [{
747
+ isSignal: true,
748
+ alias: "autoHide",
749
+ required: false
750
+ }]
751
+ }],
752
+ pageChange: [{
753
+ type: i0.Output,
754
+ args: ["pageChange"]
755
+ }],
756
+ pageBoundsCorrection: [{
757
+ type: i0.Output,
758
+ args: ["pageBoundsCorrection"]
759
+ }],
760
+ perPageCountChange: [{
761
+ type: i0.Output,
762
+ args: ["perPageCountChange"]
763
+ }]
764
+ }
765
+ });
442
766
  const LARGE_NUMBER = Number.MAX_SAFE_INTEGER;
443
- class CmatPaginatePipe {
444
- constructor() {
445
- this.service = inject(CmatPaginationService);
446
- this.state = {};
447
- }
448
- transform(collection, args) {
449
- if (!Array.isArray(collection)) {
450
- const _id = args.id ?? this.service.defaultId();
451
- const cachedSlice = this.state[_id]?.slice;
452
- return cachedSlice ?? collection;
453
- }
454
- const totalItems = this._toNumber(args.totalItems) || collection.length;
455
- const serverSideMode = totalItems !== collection.length;
456
- const instance = this.createInstance(collection, { ...args, totalItems });
457
- const id = instance.id ?? this.service.defaultId();
458
- let start;
459
- let end;
460
- const perPage = this._toNumber(args.itemsPerPage);
461
- const emitChange = this.service.register(instance, true);
462
- if (!serverSideMode) {
463
- const pageSize = perPage || LARGE_NUMBER;
464
- start = (instance.currentPage - 1) * pageSize;
465
- end = start + pageSize;
466
- const isIdentical = this._stateIsIdentical(id, collection, start, end);
467
- if (isIdentical) {
468
- return this.state[id].slice;
469
- }
470
- const slice = collection.slice(start, end);
471
- this._saveState(id, collection, slice, start, end);
472
- this.service.notifyChange(id);
473
- return slice;
474
- }
475
- if (emitChange) {
476
- this.service.notifyChange(id);
477
- }
478
- this._saveState(id, collection, collection, start, end);
479
- return collection;
480
- }
481
- createInstance(collection, config) {
482
- this.checkConfig(config);
483
- return {
484
- id: config.id ?? this.service.defaultId(),
485
- itemsPerPage: this._toNumber(config.itemsPerPage) || 10,
486
- currentPage: this._toNumber(config.currentPage) || 1,
487
- totalItems: this._toNumber(config.totalItems) || collection.length
488
- };
489
- }
490
- checkConfig(config) {
491
- const missing = ['itemsPerPage', 'currentPage'].filter(prop => !(prop in config));
492
- if (missing.length > 0) {
493
- throw new Error(`PaginatePipe: Argument is missing the following required properties: ${missing.join(', ')}`);
494
- }
495
- }
496
- _saveState(id, collection, slice, start, end) {
497
- this.state[id] = {
498
- size: collection.length,
499
- slice,
500
- start,
501
- end
502
- };
503
- }
504
- _stateIsIdentical(id, collection, start, end) {
505
- const state = this.state[id];
506
- if (!state) {
507
- return false;
508
- }
509
- const isMetaDataIdentical = state.size === collection.length &&
510
- state.start === start &&
511
- state.end === end;
512
- if (!isMetaDataIdentical) {
513
- return false;
514
- }
515
- return state.slice.every((element, index) => element === collection[start + index]);
516
- }
517
- _toNumber(value) {
518
- return Number(value);
519
- }
520
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
521
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginatePipe, isStandalone: true, name: "paginate" }); }
522
- }
523
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: CmatPaginatePipe, decorators: [{
524
- type: Pipe,
525
- args: [{
526
- name: 'paginate',
527
- pure: true
528
- }]
529
- }] });
530
-
531
- /**
532
- * Generated bundle index. Do not edit.
533
- */
534
-
767
+ var CmatPaginatePipe = class CmatPaginatePipe {
768
+ constructor() {
769
+ this.service = inject(CmatPaginationService);
770
+ this.state = {};
771
+ }
772
+ transform(collection, args) {
773
+ if (!Array.isArray(collection)) {
774
+ const _id = args.id ?? this.service.defaultId();
775
+ return this.state[_id]?.slice ?? collection;
776
+ }
777
+ const totalItems = this._toNumber(args.totalItems) || collection.length;
778
+ const serverSideMode = totalItems !== collection.length;
779
+ const instance = this.createInstance(collection, {
780
+ ...args,
781
+ totalItems
782
+ });
783
+ const id = instance.id ?? this.service.defaultId();
784
+ let start;
785
+ let end;
786
+ const perPage = this._toNumber(args.itemsPerPage);
787
+ const emitChange = this.service.register(instance, true);
788
+ if (!serverSideMode) {
789
+ const pageSize = perPage || LARGE_NUMBER;
790
+ start = (instance.currentPage - 1) * pageSize;
791
+ end = start + pageSize;
792
+ if (this._stateIsIdentical(id, collection, start, end)) return this.state[id].slice;
793
+ const slice = collection.slice(start, end);
794
+ this._saveState(id, collection, slice, start, end);
795
+ this.service.notifyChange(id);
796
+ return slice;
797
+ }
798
+ if (emitChange) this.service.notifyChange(id);
799
+ this._saveState(id, collection, collection, start, end);
800
+ return collection;
801
+ }
802
+ createInstance(collection, config) {
803
+ this.checkConfig(config);
804
+ return {
805
+ id: config.id ?? this.service.defaultId(),
806
+ itemsPerPage: this._toNumber(config.itemsPerPage) || 10,
807
+ currentPage: this._toNumber(config.currentPage) || 1,
808
+ totalItems: this._toNumber(config.totalItems) || collection.length
809
+ };
810
+ }
811
+ checkConfig(config) {
812
+ const missing = ["itemsPerPage", "currentPage"].filter((prop) => !(prop in config));
813
+ if (missing.length > 0) throw new Error(`PaginatePipe: Argument is missing the following required properties: ${missing.join(", ")}`);
814
+ }
815
+ _saveState(id, collection, slice, start, end) {
816
+ this.state[id] = {
817
+ size: collection.length,
818
+ slice,
819
+ start,
820
+ end
821
+ };
822
+ }
823
+ _stateIsIdentical(id, collection, start, end) {
824
+ const state = this.state[id];
825
+ if (!state) return false;
826
+ if (!(state.size === collection.length && state.start === start && state.end === end)) return false;
827
+ return state.slice.every((element, index) => element === collection[start + index]);
828
+ }
829
+ _toNumber(value) {
830
+ return Number(value);
831
+ }
832
+ static {
833
+ this.ɵfac = i0.ɵɵngDeclareFactory({
834
+ minVersion: "12.0.0",
835
+ version: "22.2.3",
836
+ ngImport: i0,
837
+ type: CmatPaginatePipe,
838
+ deps: [],
839
+ target: i0.ɵɵFactoryTarget.Pipe
840
+ });
841
+ }
842
+ static {
843
+ this.ɵpipe = i0.ɵɵngDeclarePipe({
844
+ minVersion: "14.0.0",
845
+ version: "22.2.3",
846
+ ngImport: i0,
847
+ type: CmatPaginatePipe,
848
+ isStandalone: true,
849
+ name: "paginate"
850
+ });
851
+ }
852
+ };
853
+ i0.ɵɵngDeclareClassMetadata({
854
+ minVersion: "12.0.0",
855
+ version: "22.2.3",
856
+ ngImport: i0,
857
+ type: CmatPaginatePipe,
858
+ decorators: [{
859
+ type: Pipe,
860
+ args: [{
861
+ name: "paginate",
862
+ pure: true
863
+ }]
864
+ }]
865
+ });
535
866
  export { CmatPaginatePipe, CmatPaginationComponent, CmatPaginationDirective, CmatPaginationService };
536
- //# sourceMappingURL=cmat-components-pagination.mjs.map
867
+
868
+ //# sourceMappingURL=cmat-components-pagination.mjs.map