cmat 0.0.87 → 0.0.88

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 (228) hide show
  1. package/fesm2022/cmat-components-adapter.mjs +9 -9
  2. package/fesm2022/cmat-components-adapter.mjs.map +1 -1
  3. package/fesm2022/cmat-components-breadcrumb.mjs +98 -80
  4. package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
  5. package/fesm2022/cmat-components-card.mjs +26 -34
  6. package/fesm2022/cmat-components-card.mjs.map +1 -1
  7. package/fesm2022/cmat-components-carousel.mjs +467 -556
  8. package/fesm2022/cmat-components-carousel.mjs.map +1 -1
  9. package/fesm2022/cmat-components-cascade.mjs +270 -259
  10. package/fesm2022/cmat-components-cascade.mjs.map +1 -1
  11. package/fesm2022/cmat-components-chip-input.mjs +200 -116
  12. package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
  13. package/fesm2022/cmat-components-code-editor.mjs +85 -38
  14. package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
  15. package/fesm2022/cmat-components-color-picker.mjs +841 -0
  16. package/fesm2022/cmat-components-color-picker.mjs.map +1 -0
  17. package/fesm2022/cmat-components-custom-formly.mjs +1395 -838
  18. package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
  19. package/fesm2022/cmat-components-data-picker.mjs +996 -0
  20. package/fesm2022/cmat-components-data-picker.mjs.map +1 -0
  21. package/fesm2022/cmat-components-date-range.mjs +310 -264
  22. package/fesm2022/cmat-components-date-range.mjs.map +1 -1
  23. package/fesm2022/cmat-components-date-time-display.mjs +16 -20
  24. package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
  25. package/fesm2022/cmat-components-drawer.mjs +120 -137
  26. package/fesm2022/cmat-components-drawer.mjs.map +1 -1
  27. package/fesm2022/cmat-components-empty-state.mjs +17 -24
  28. package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
  29. package/fesm2022/cmat-components-file-preview.mjs +18 -24
  30. package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
  31. package/fesm2022/cmat-components-filter-toolbar.mjs +30 -39
  32. package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
  33. package/fesm2022/cmat-components-form-actions.mjs +12 -12
  34. package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
  35. package/fesm2022/cmat-components-fullscreen.mjs +10 -10
  36. package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
  37. package/fesm2022/cmat-components-highlight.mjs +48 -41
  38. package/fesm2022/cmat-components-highlight.mjs.map +1 -1
  39. package/fesm2022/cmat-components-image-viewer.mjs +104 -107
  40. package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
  41. package/fesm2022/cmat-components-inline-loading.mjs +12 -15
  42. package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
  43. package/fesm2022/cmat-components-json-editor.mjs +118 -75
  44. package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
  45. package/fesm2022/cmat-components-knob-input.mjs +196 -178
  46. package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
  47. package/fesm2022/cmat-components-masonry.mjs +26 -41
  48. package/fesm2022/cmat-components-masonry.mjs.map +1 -1
  49. package/fesm2022/cmat-components-material-color-picker.mjs +81 -80
  50. package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
  51. package/fesm2022/cmat-components-material-datetimepicker.mjs +1212 -1287
  52. package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
  53. package/fesm2022/cmat-components-navigation.mjs +467 -450
  54. package/fesm2022/cmat-components-navigation.mjs.map +1 -1
  55. package/fesm2022/cmat-components-opt-input.mjs +143 -132
  56. package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
  57. package/fesm2022/cmat-components-org-chart.mjs +68 -83
  58. package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
  59. package/fesm2022/cmat-components-page-header.mjs +18 -24
  60. package/fesm2022/cmat-components-page-header.mjs.map +1 -1
  61. package/fesm2022/cmat-components-pagination.mjs +220 -136
  62. package/fesm2022/cmat-components-pagination.mjs.map +1 -1
  63. package/fesm2022/cmat-components-password-strength.mjs +262 -215
  64. package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
  65. package/fesm2022/cmat-components-popover.mjs +227 -195
  66. package/fesm2022/cmat-components-popover.mjs.map +1 -1
  67. package/fesm2022/cmat-components-progress-bar.mjs +15 -34
  68. package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
  69. package/fesm2022/cmat-components-qrcode.mjs +95 -88
  70. package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
  71. package/fesm2022/cmat-components-rating.mjs +70 -67
  72. package/fesm2022/cmat-components-rating.mjs.map +1 -1
  73. package/fesm2022/cmat-components-rich-text-editor.mjs +23 -26
  74. package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
  75. package/fesm2022/cmat-components-select-search.mjs +190 -159
  76. package/fesm2022/cmat-components-select-search.mjs.map +1 -1
  77. package/fesm2022/cmat-components-select-table.mjs +276 -213
  78. package/fesm2022/cmat-components-select-table.mjs.map +1 -1
  79. package/fesm2022/cmat-components-select-tree.mjs +178 -128
  80. package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
  81. package/fesm2022/cmat-components-skeleton.mjs +44 -28
  82. package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
  83. package/fesm2022/cmat-components-speed-dial.mjs +107 -163
  84. package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
  85. package/fesm2022/cmat-components-status-tag.mjs +29 -36
  86. package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
  87. package/fesm2022/cmat-components-table-toolbar.mjs +14 -18
  88. package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
  89. package/fesm2022/cmat-components-timeline.mjs +111 -118
  90. package/fesm2022/cmat-components-timeline.mjs.map +1 -1
  91. package/fesm2022/cmat-components-toast.mjs +65 -66
  92. package/fesm2022/cmat-components-toast.mjs.map +1 -1
  93. package/fesm2022/cmat-components-transfer-picker.mjs +130 -160
  94. package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
  95. package/fesm2022/cmat-components-treetable.mjs +32 -39
  96. package/fesm2022/cmat-components-treetable.mjs.map +1 -1
  97. package/fesm2022/cmat-components-upload.mjs +186 -176
  98. package/fesm2022/cmat-components-upload.mjs.map +1 -1
  99. package/fesm2022/cmat-directives-animate-on-scroll.mjs +25 -28
  100. package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
  101. package/fesm2022/cmat-directives-arrow-cursor.mjs +85 -92
  102. package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
  103. package/fesm2022/cmat-directives-autofocus.mjs +3 -3
  104. package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
  105. package/fesm2022/cmat-directives-data-exporter.mjs +49 -50
  106. package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
  107. package/fesm2022/cmat-directives-debounce.mjs +16 -19
  108. package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
  109. package/fesm2022/cmat-directives-digit-only.mjs +60 -69
  110. package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
  111. package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
  112. package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
  113. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +31 -30
  114. package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
  115. package/fesm2022/cmat-lib-mock-api.mjs +6 -6
  116. package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
  117. package/fesm2022/cmat-pipes-bytes.mjs +3 -3
  118. package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
  119. package/fesm2022/cmat-pipes-date-format.mjs +3 -3
  120. package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
  121. package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
  122. package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
  123. package/fesm2022/cmat-pipes-group-by.mjs +3 -3
  124. package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
  125. package/fesm2022/cmat-pipes-keys.mjs +3 -3
  126. package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
  127. package/fesm2022/cmat-pipes-secure.mjs +7 -13
  128. package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
  129. package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
  130. package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
  131. package/fesm2022/cmat-services-alert.mjs +26 -27
  132. package/fesm2022/cmat-services-alert.mjs.map +1 -1
  133. package/fesm2022/cmat-services-config.mjs +14 -23
  134. package/fesm2022/cmat-services-config.mjs.map +1 -1
  135. package/fesm2022/cmat-services-confirmation.mjs +8 -8
  136. package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
  137. package/fesm2022/cmat-services-data.mjs +6 -10
  138. package/fesm2022/cmat-services-data.mjs.map +1 -1
  139. package/fesm2022/cmat-services-export-as.mjs +3 -3
  140. package/fesm2022/cmat-services-export-as.mjs.map +1 -1
  141. package/fesm2022/cmat-services-loading.mjs +30 -47
  142. package/fesm2022/cmat-services-loading.mjs.map +1 -1
  143. package/fesm2022/cmat-services-local-storage.mjs +3 -3
  144. package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
  145. package/fesm2022/cmat-services-media-watcher.mjs +43 -34
  146. package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
  147. package/fesm2022/cmat-services-platform.mjs +3 -3
  148. package/fesm2022/cmat-services-platform.mjs.map +1 -1
  149. package/fesm2022/cmat-services-splash-screen.mjs +3 -3
  150. package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
  151. package/fesm2022/cmat-services-title.mjs +3 -3
  152. package/fesm2022/cmat-services-title.mjs.map +1 -1
  153. package/fesm2022/cmat-services-translation.mjs +11 -11
  154. package/fesm2022/cmat-services-translation.mjs.map +1 -1
  155. package/fesm2022/cmat-services-utils.mjs +3 -3
  156. package/fesm2022/cmat-services-utils.mjs.map +1 -1
  157. package/fesm2022/cmat.mjs +9228 -7507
  158. package/fesm2022/cmat.mjs.map +1 -1
  159. package/icons/material-icons/heroicons-outline.svg +3 -0
  160. package/icons/material-icons/heroicons-solid.svg +3 -0
  161. package/package.json +10 -1
  162. package/styles/components/bundle.scss +21 -0
  163. package/styles/overrides/angular-material.scss +22 -1
  164. package/tailwind/plugins/theming.js +183 -183
  165. package/types/cmat-components-breadcrumb.d.ts +40 -37
  166. package/types/cmat-components-card.d.ts +11 -13
  167. package/types/cmat-components-carousel.d.ts +87 -113
  168. package/types/cmat-components-cascade.d.ts +84 -65
  169. package/types/cmat-components-chip-input.d.ts +29 -24
  170. package/types/cmat-components-code-editor.d.ts +28 -12
  171. package/types/cmat-components-color-picker.d.ts +236 -0
  172. package/types/cmat-components-custom-formly.d.ts +316 -184
  173. package/types/cmat-components-data-picker.d.ts +372 -0
  174. package/types/cmat-components-date-range.d.ts +31 -36
  175. package/types/cmat-components-date-time-display.d.ts +8 -8
  176. package/types/cmat-components-drawer.d.ts +30 -32
  177. package/types/cmat-components-empty-state.d.ts +9 -10
  178. package/types/cmat-components-file-preview.d.ts +9 -9
  179. package/types/cmat-components-filter-toolbar.d.ts +15 -15
  180. package/types/cmat-components-form-actions.d.ts +5 -5
  181. package/types/cmat-components-fullscreen.d.ts +5 -5
  182. package/types/cmat-components-highlight.d.ts +13 -14
  183. package/types/cmat-components-image-viewer.d.ts +29 -33
  184. package/types/cmat-components-inline-loading.d.ts +6 -6
  185. package/types/cmat-components-json-editor.d.ts +15 -17
  186. package/types/cmat-components-knob-input.d.ts +58 -55
  187. package/types/cmat-components-masonry.d.ts +9 -12
  188. package/types/cmat-components-material-color-picker.d.ts +16 -21
  189. package/types/cmat-components-material-datetimepicker.d.ts +174 -216
  190. package/types/cmat-components-navigation.d.ts +34 -39
  191. package/types/cmat-components-opt-input.d.ts +35 -33
  192. package/types/cmat-components-org-chart.d.ts +8 -9
  193. package/types/cmat-components-page-header.d.ts +9 -9
  194. package/types/cmat-components-pagination.d.ts +36 -40
  195. package/types/cmat-components-password-strength.d.ts +58 -64
  196. package/types/cmat-components-popover.d.ts +22 -32
  197. package/types/cmat-components-progress-bar.d.ts +7 -10
  198. package/types/cmat-components-qrcode.d.ts +22 -22
  199. package/types/cmat-components-rating.d.ts +17 -19
  200. package/types/cmat-components-rich-text-editor.d.ts +11 -12
  201. package/types/cmat-components-select-search.d.ts +48 -36
  202. package/types/cmat-components-select-table.d.ts +38 -34
  203. package/types/cmat-components-select-tree.d.ts +17 -15
  204. package/types/cmat-components-skeleton.d.ts +27 -10
  205. package/types/cmat-components-speed-dial.d.ts +24 -33
  206. package/types/cmat-components-status-tag.d.ts +19 -9
  207. package/types/cmat-components-table-toolbar.d.ts +7 -7
  208. package/types/cmat-components-timeline.d.ts +33 -34
  209. package/types/cmat-components-toast.d.ts +26 -30
  210. package/types/cmat-components-transfer-picker.d.ts +51 -56
  211. package/types/cmat-components-treetable.d.ts +12 -13
  212. package/types/cmat-components-upload.d.ts +33 -38
  213. package/types/cmat-components-x6-angular-shape.d.ts +1 -1
  214. package/types/cmat-directives-animate-on-scroll.d.ts +7 -7
  215. package/types/cmat-directives-arrow-cursor.d.ts +18 -20
  216. package/types/cmat-directives-data-exporter.d.ts +10 -10
  217. package/types/cmat-directives-debounce.d.ts +5 -5
  218. package/types/cmat-directives-digit-only.d.ts +13 -13
  219. package/types/cmat-directives-seamless-auto-scroll.d.ts +7 -7
  220. package/types/cmat-pipes-secure.d.ts +1 -3
  221. package/types/cmat-services-alert.d.ts +11 -12
  222. package/types/cmat-services-config.d.ts +2 -7
  223. package/types/cmat-services-confirmation.d.ts +2 -2
  224. package/types/cmat-services-data.d.ts +0 -1
  225. package/types/cmat-services-loading.d.ts +14 -22
  226. package/types/cmat-services-media-watcher.d.ts +5 -5
  227. package/types/cmat-services-translation.d.ts +4 -5
  228. package/types/cmat.d.ts +2167 -1746
@@ -1,7 +1,6 @@
1
- import { NgStyle, DecimalPipe } from '@angular/common';
1
+ import { NgStyle, NgClass, DecimalPipe } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, EventEmitter, signal, inject, Injector, DestroyRef, afterNextRender, Output, Input, Directive, ViewEncapsulation, ChangeDetectionStrategy, Component, Pipe } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
+ import { signal, untracked, Injectable, input, output, inject, Injector, effect, afterNextRender, Directive, ElementRef, DestroyRef, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, Pipe } from '@angular/core';
5
4
  import * as i5 from '@angular/material/button';
6
5
  import { MatButtonModule } from '@angular/material/button';
7
6
  import * as i2 from '@angular/material/form-field';
@@ -13,90 +12,153 @@ import { MatInputModule } from '@angular/material/input';
13
12
  import * as i4 from '@angular/material/select';
14
13
  import { MatSelectModule } from '@angular/material/select';
15
14
  import { CmatDigitOnlyDirective } from 'cmat/directives/digit-only';
16
- import { CmatMediaWatcherService } from 'cmat/services/media-watcher';
17
- import { Subject } from 'rxjs';
18
15
 
19
16
  class CmatPaginationService {
20
17
  constructor() {
21
- this._change = new Subject();
22
- this._instances = {};
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();
23
22
  this._defaultPaginationId = 'DEFAULT_PAGINATION_ID';
24
23
  }
25
- get change$() {
26
- return this._change.asObservable();
27
- }
28
24
  defaultId() { return this._defaultPaginationId; }
29
- notifyChange(id) {
30
- this._change.next(id);
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
31
  }
32
- register(instance) {
32
+ register(instance, fromPipe = false) {
33
33
  const normalizedInstance = {
34
34
  ...structuredClone(instance),
35
35
  id: instance.id ?? this._defaultPaginationId
36
36
  };
37
37
  const id = normalizedInstance.id;
38
- if (!this._instances[id]) {
39
- this._instances[id] = normalizedInstance;
40
- return true;
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
+ }
41
74
  }
42
- return this._updateInstance(normalizedInstance);
75
+ return changed;
43
76
  }
44
77
  getCurrentPage(id) {
45
- return this._instances[id]?.currentPage;
78
+ return this._instances()[id]?.currentPage;
46
79
  }
47
80
  getItemsPerPage(id) {
48
- return this._instances[id]?.itemsPerPage;
81
+ return this._instances()[id]?.itemsPerPage;
49
82
  }
50
83
  setCurrentPage(id, page) {
51
- if (this._instances[id]) {
52
- const instance = this._instances[id];
53
- const maxPage = Math.ceil(instance.totalItems / instance.itemsPerPage);
54
- if (page <= maxPage && 1 <= page) {
55
- this._instances[id].currentPage = page;
56
- this.notifyChange(id);
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
+ }
57
93
  }
58
- }
94
+ return current;
95
+ });
96
+ // 通知分页器更新显示
97
+ this.notifyChange(id);
59
98
  }
60
99
  setTotalItems(id, totalItems) {
61
- if (this._instances[id] && 0 <= totalItems) {
62
- this._instances[id].totalItems = totalItems;
63
- this.notifyChange(id);
64
- }
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);
65
110
  }
66
111
  setItemsPerPage(id, itemsPerPage) {
67
- if (this._instances[id]) {
68
- this._instances[id].itemsPerPage = itemsPerPage;
69
- this.notifyChange(id);
70
- }
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);
71
122
  }
72
123
  getInstance(id = this._defaultPaginationId) {
73
- if (this._instances[id]) {
74
- return this._clone(this._instances[id]);
124
+ const instance = this._instances()[id];
125
+ if (instance) {
126
+ return this._clone(instance);
75
127
  }
76
128
  return undefined;
77
129
  }
78
- _updateInstance(instance) {
130
+ _updateInstance(current, incoming) {
79
131
  let changed = false;
80
- if (instance.id) {
81
- const currentInstance = this._instances[instance.id];
82
- const keys = new Set([...Object.keys(currentInstance), ...Object.keys(instance)]);
132
+ if (incoming.id) {
133
+ const keys = new Set([...Object.keys(current), ...Object.keys(incoming)]);
83
134
  for (const prop of keys) {
84
135
  const key = prop;
85
- if (instance[key] !== currentInstance[key]) {
86
- currentInstance[key] = instance[key];
136
+ if (incoming[key] !== current[key]) {
137
+ current[key] = incoming[key];
87
138
  changed = true;
88
139
  }
89
140
  }
90
141
  }
91
142
  return changed;
92
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
+ }
93
155
  _clone(obj) {
94
156
  return structuredClone(obj);
95
157
  }
96
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
97
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationService, providedIn: 'root' }); }
158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
159
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationService, providedIn: 'root' }); }
98
160
  }
99
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationService, decorators: [{
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationService, decorators: [{
100
162
  type: Injectable,
101
163
  args: [{
102
164
  providedIn: 'root'
@@ -105,27 +167,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
105
167
 
106
168
  class CmatPaginationDirective {
107
169
  constructor() {
108
- this.maxSize = 7;
109
- this.pageChange = new EventEmitter();
110
- this.pageBoundsCorrection = new EventEmitter();
111
- this.perPageCountChange = new EventEmitter();
112
- this.pages$ = signal([], ...(ngDevMode ? [{ debugName: "pages$" }] : /* istanbul ignore next */ []));
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 */ []));
113
179
  this.service = inject(CmatPaginationService);
114
180
  this._injector = inject(Injector);
115
- this._destroyRef = inject(DestroyRef);
116
181
  this._pageLinksUpdateQueued = false;
117
- this.service.change$.pipe(takeUntilDestroyed(this._destroyRef))
118
- .subscribe((id) => {
119
- if (this.id === id) {
120
- this._schedulePageLinksUpdate();
182
+ effect(() => {
183
+ const instances = this.service.instances();
184
+ if (this._getId() === instances[this._getId()]?.id) {
185
+ untracked(() => {
186
+ this._schedulePageLinksUpdate();
187
+ });
121
188
  }
122
189
  });
123
- }
124
- ngOnInit() {
125
- this.id ??= this.service.defaultId();
126
- this._schedulePageLinksUpdate();
127
- }
128
- ngOnChanges() {
129
190
  this._schedulePageLinksUpdate();
130
191
  }
131
192
  previous() {
@@ -171,10 +232,10 @@ class CmatPaginationDirective {
171
232
  }
172
233
  }
173
234
  getCurrent() {
174
- return this.service.getCurrentPage(this.id);
235
+ return this.service.getCurrentPage(this._getId());
175
236
  }
176
237
  getLastPage() {
177
- const inst = this.service.getInstance(this.id);
238
+ const inst = this.service.getInstance(this._getId());
178
239
  if (!inst) {
179
240
  return;
180
241
  }
@@ -184,32 +245,39 @@ class CmatPaginationDirective {
184
245
  return Math.ceil(inst.totalItems / inst.itemsPerPage);
185
246
  }
186
247
  getTotalItems() {
187
- return this.service.getInstance(this.id)?.totalItems;
248
+ return this.service.getInstance(this._getId())?.totalItems;
188
249
  }
189
250
  setItemsPerPage(count) {
190
- this.service.setItemsPerPage(this.id, count);
251
+ const id = this._getId();
252
+ this.service.setItemsPerPage(id, count);
191
253
  this.perPageCountChange.emit(count);
192
- const inst = this.service.getInstance(this.id);
254
+ const inst = this.service.getInstance(id);
193
255
  if (!inst) {
194
256
  return;
195
257
  }
196
258
  this.setCurrent(this._outOfBoundCorrection(inst));
197
259
  }
260
+ _getId() {
261
+ return this.id() ?? this.service.defaultId();
262
+ }
198
263
  _checkValidId() {
199
- if (this.service.getInstance(this.id)?.id == null) {
200
- console.warn(`PaginationControlsDirective: the specified id "${this.id}" does not match any registered PaginationInstance`);
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`);
201
267
  }
202
268
  }
203
269
  _updatePageLinks() {
204
- const inst = this.service.getInstance(this.id);
270
+ const inst = this.service.getInstance(this._getId());
205
271
  if (!inst) {
206
- this.pages$.set([]);
272
+ this.pages.set([]);
207
273
  return;
208
274
  }
209
275
  const correctedCurrentPage = this._outOfBoundCorrection(inst);
210
- const pageForRender = correctedCurrentPage !== inst.currentPage ? correctedCurrentPage : inst.currentPage;
276
+ const pageForRender = correctedCurrentPage !== inst.currentPage
277
+ ? correctedCurrentPage
278
+ : inst.currentPage;
211
279
  this.pageBoundsCorrection.emit(correctedCurrentPage);
212
- this.pages$.set(this._createPageArray(pageForRender, inst.itemsPerPage, inst.totalItems, this.maxSize));
280
+ this.pages.set(this._createPageArray(pageForRender, inst.itemsPerPage, inst.totalItems, this.maxSize()));
213
281
  }
214
282
  _schedulePageLinksUpdate() {
215
283
  if (this._pageLinksUpdateQueued) {
@@ -244,8 +312,8 @@ class CmatPaginationDirective {
244
312
  while (i <= totalPages && i <= paginationRange) {
245
313
  let label;
246
314
  const pageNumber = this._calculatePageNumber(i, currentPage, paginationRange, totalPages);
247
- const openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
248
- const closingEllipsesNeeded = (i === paginationRange - 1 && (isMiddle || isStart));
315
+ const openingEllipsesNeeded = i === 2 && (isMiddle || isEnd);
316
+ const closingEllipsesNeeded = i === paginationRange - 1 && (isMiddle || isStart);
249
317
  if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
250
318
  label = '...';
251
319
  }
@@ -254,7 +322,7 @@ class CmatPaginationDirective {
254
322
  }
255
323
  pages.push({
256
324
  label: label,
257
- value: pageNumber
325
+ value: pageNumber,
258
326
  });
259
327
  i++;
260
328
  }
@@ -283,77 +351,93 @@ class CmatPaginationDirective {
283
351
  return i;
284
352
  }
285
353
  }
286
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
287
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.11", type: CmatPaginationDirective, isStandalone: true, selector: "pagination-template,[pagination-template]", inputs: { id: "id", maxSize: "maxSize" }, outputs: { pageChange: "pageChange", pageBoundsCorrection: "pageBoundsCorrection", perPageCountChange: "perPageCountChange" }, exportAs: ["paginationApi"], usesOnChanges: true, ngImport: i0 }); }
354
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
355
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", 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 }); }
288
356
  }
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationDirective, decorators: [{
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationDirective, decorators: [{
290
358
  type: Directive,
291
359
  args: [{
292
360
  // eslint-disable-next-line @angular-eslint/directive-selector
293
361
  selector: 'pagination-template,[pagination-template]',
294
- exportAs: 'paginationApi'
362
+ exportAs: 'paginationApi',
295
363
  }]
296
- }], ctorParameters: () => [], propDecorators: { id: [{
297
- type: Input
298
- }], maxSize: [{
299
- type: Input
300
- }], pageChange: [{
301
- type: Output
302
- }], pageBoundsCorrection: [{
303
- type: Output
304
- }], perPageCountChange: [{
305
- type: Output
306
- }] } });
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"] }] } });
307
365
 
308
366
  class CmatPaginationComponent {
309
367
  constructor() {
310
- this.pageChange = new EventEmitter();
311
- this.pageBoundsCorrection = new EventEmitter();
312
- this.perPageCountChange = new EventEmitter();
313
- this.maxSize = 7;
314
- this.itemsPerPages = [10, 20, 30];
315
- this.initPerPage = 10;
316
- this.isScreenSmall = signal(false, ...(ngDevMode ? [{ debugName: "isScreenSmall" }] : /* istanbul ignore next */ []));
317
- this._cmatMediaWatcherService = inject(CmatMediaWatcherService);
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);
318
382
  this._destroyRef = inject(DestroyRef);
319
- this._autoHide = false;
320
- }
321
- get autoHide() {
322
- return this._autoHide;
323
- }
324
- set autoHide(value) {
325
- this._autoHide = !!value;
326
- }
327
- ngOnInit() {
328
- this._cmatMediaWatcherService.onMediaChange$
329
- .pipe(takeUntilDestroyed(this._destroyRef))
330
- .subscribe(({ matchingAliases }) => {
331
- this.isScreenSmall.set(!matchingAliases.includes('md'));
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
+ });
332
421
  });
333
422
  }
334
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
335
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: CmatPaginationComponent, isStandalone: true, selector: "cmat-pagination", inputs: { id: "id", maxSize: "maxSize", itemsPerPages: "itemsPerPages", initPerPage: "initPerPage", autoHide: "autoHide" }, outputs: { pageChange: "pageChange", pageBoundsCorrection: "pageBoundsCorrection", perPageCountChange: "perPageCountChange" }, exportAs: ["cmatPagination"], ngImport: i0, template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex\" [id]=\"id\"\r\n [maxSize]=\"isScreenSmall()&&maxSize>5?5:maxSize\" (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n <div class=\"hidden md:flex flex-auto items-center\">\r\n <span>\u603B\u8BA1:{{p.getTotalItems()}}</span>\r\n </div>\r\n <nav role=\"navigation\" class=\"flex min-h-12 w-full md:w-0\">\r\n @if (!(autoHide && p.pages$().length <= 1)) {\r\n <ul\r\n class=\"flex flex-row items-center justify-center md:justify-end w-full\">\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===1\"\r\n (click)=\"p.goFirstPage()\">\r\n <mat-icon svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"pr-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===1\"\r\n (click)=\"p.previous()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_before\"></mat-icon>\r\n </button>\r\n </li>\r\n <div class=\"flex flex-row gap-4\">\r\n @for (page of p.pages$(); track $index) {\r\n <li class=\"flex text-xl lg:text-2xl\">\r\n @if (p.getCurrent() !== page.value) {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"cursor-pointer text-gray-400 hover:text-current\" (click)=\"p.setCurrent(page.value)\">\r\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\r\n </a>\r\n }\r\n @if (p.getCurrent() === page.value) {\r\n <span class=\"text-current\">\r\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\r\n </span>\r\n }\r\n </li>\r\n }\r\n </div> \r\n <li class=\"pl-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===p.getLastPage()\"\r\n (click)=\"p.next()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_next\"></mat-icon>\r\n </button>\r\n </li>\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===p.getLastPage()\"\r\n (click)=\"p.goLastPage()\">\r\n <mat-icon svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"hidden md:block px-2\">\r\n <mat-form-field [ngStyle]=\"{'width':((p.getLastPage()?.toString()?.length||0)*8+64)+'px'}\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\"\r\n [value]=\"p.getCurrent()\" [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage()||0\"\r\n (keyup.enter)=\"p.setCurrent(current.value)\">\r\n <span matSuffix>/<div class=\"pl-1\">{{p.getLastPage()}}</div></span>\r\n </mat-form-field>\r\n </li>\r\n <li class=\"hidden md:block\">\r\n <mat-form-field class=\"w-24\">\r\n <mat-select #pageCount name=\"pageCount\" [value]=\"initPerPage\"\r\n (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages; track perPage) {\r\n <mat-option [value]=\"perPage\">\r\n {{perPage}}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n }\r\n </nav>\r\n </pagination-template>\r\n", dependencies: [{ kind: "directive", type: CmatPaginationDirective, selector: "pagination-template,[pagination-template]", inputs: ["id", "maxSize"], outputs: ["pageChange", "pageBoundsCorrection", "perPageCountChange"], exportAs: ["paginationApi"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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: "directive", type: CmatDigitOnlyDirective, selector: "[cmatDigitOnly]", inputs: ["decimal", "decimalSeparator", "allowNegatives", "allowPaste", "negativeSign", "min", "max", "pattern"] }, { 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: "pipe", type: DecimalPipe, name: "number" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
423
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
424
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", 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\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\" (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n <div class=\"flex-auto items-center\" [ngClass]=\"{'hidden':isScreenSmall(),'flex':!isScreenSmall()}\">\r\n <span>\u603B\u8BA1:{{ p.getTotalItems() }}</span>\r\n </div>\r\n <nav role=\"navigation\" class=\"flex min-h-12\" [ngClass]=\"{'w-full':isScreenSmall(),'w-0':!isScreenSmall()}\">\r\n @if (!(autoHide() && p.pages().length <= 1)) { \r\n <ul class=\"flex flex-row items-center w-full\"\r\n [ngClass]=\"{'justify-center':isScreenSmall(),'justify-end':!isScreenSmall()}\">\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === 1\"\r\n (click)=\"p.goFirstPage()\">\r\n <mat-icon svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"pr-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === 1\"\r\n (click)=\"p.previous()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_before\"></mat-icon>\r\n </button>\r\n </li>\r\n <div class=\"flex flex-row gap-4\">\r\n @for (page of p.pages(); track $index) {\r\n <li class=\"flex text-xl lg:text-2xl\">\r\n @if (p.getCurrent() !== page.value) {\r\n <a tabindex=\"0\" role=\"presentation\" class=\"cursor-pointer text-gray-400 hover:text-current\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n <span>{{\r\n page.label === \"...\"\r\n ? page.label\r\n : (page.label | number: \"\")\r\n }}</span>\r\n </a>\r\n }\r\n @if (p.getCurrent() === page.value) {\r\n <span class=\"text-current\">\r\n <span>{{\r\n page.label === \"...\"\r\n ? page.label\r\n : (page.label | number: \"\")\r\n }}</span>\r\n </span>\r\n }\r\n </li>\r\n }\r\n </div>\r\n <li class=\"pl-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\"\r\n (click)=\"p.next()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_next\"></mat-icon>\r\n </button>\r\n </li>\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\"\r\n (click)=\"p.goLastPage()\">\r\n <mat-icon svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"px-2\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"fill\" [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=\"pl-1\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n <li [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\" >\r\n <mat-form-field class=\"w-24\" appearance=\"fill\">\r\n <mat-select #pageCount name=\"pageCount\" [value]=\"initPerPage()\"\r\n (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">\r\n {{ perPage }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n }\r\n </nav>\r\n</pagination-template>", dependencies: [{ kind: "directive", type: CmatPaginationDirective, selector: "pagination-template,[pagination-template]", inputs: ["id", "maxSize"], outputs: ["pageChange", "pageBoundsCorrection", "perPageCountChange"], exportAs: ["paginationApi"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { 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: "directive", type: CmatDigitOnlyDirective, selector: "[cmatDigitOnly]", inputs: ["decimal", "decimalSeparator", "allowNegatives", "allowPaste", "negativeSign", "min", "max", "pattern"] }, { 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: "pipe", type: DecimalPipe, name: "number" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
336
425
  }
337
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginationComponent, decorators: [{
426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginationComponent, decorators: [{
338
427
  type: Component,
339
- args: [{ selector: 'cmat-pagination', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cmatPagination', imports: [CmatPaginationDirective, MatIconModule, NgStyle, MatFormFieldModule, MatInputModule, CmatDigitOnlyDirective, MatSelectModule, DecimalPipe, MatButtonModule], template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex\" [id]=\"id\"\r\n [maxSize]=\"isScreenSmall()&&maxSize>5?5:maxSize\" (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n <div class=\"hidden md:flex flex-auto items-center\">\r\n <span>\u603B\u8BA1:{{p.getTotalItems()}}</span>\r\n </div>\r\n <nav role=\"navigation\" class=\"flex min-h-12 w-full md:w-0\">\r\n @if (!(autoHide && p.pages$().length <= 1)) {\r\n <ul\r\n class=\"flex flex-row items-center justify-center md:justify-end w-full\">\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===1\"\r\n (click)=\"p.goFirstPage()\">\r\n <mat-icon svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"pr-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===1\"\r\n (click)=\"p.previous()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_before\"></mat-icon>\r\n </button>\r\n </li>\r\n <div class=\"flex flex-row gap-4\">\r\n @for (page of p.pages$(); track $index) {\r\n <li class=\"flex text-xl lg:text-2xl\">\r\n @if (p.getCurrent() !== page.value) {\r\n <a tabindex=\"0\" role=\"presentation\"\r\n class=\"cursor-pointer text-gray-400 hover:text-current\" (click)=\"p.setCurrent(page.value)\">\r\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\r\n </a>\r\n }\r\n @if (p.getCurrent() === page.value) {\r\n <span class=\"text-current\">\r\n <span>{{ (page.label === '...') ? page.label : (page.label | number:'') }}</span>\r\n </span>\r\n }\r\n </li>\r\n }\r\n </div> \r\n <li class=\"pl-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===p.getLastPage()\"\r\n (click)=\"p.next()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_next\"></mat-icon>\r\n </button>\r\n </li>\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent()===p.getLastPage()\"\r\n (click)=\"p.goLastPage()\">\r\n <mat-icon svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"hidden md:block px-2\">\r\n <mat-form-field [ngStyle]=\"{'width':((p.getLastPage()?.toString()?.length||0)*8+64)+'px'}\">\r\n <input #current matInput type=\"text\" cmatDigitOnly class=\"text-end\"\r\n [value]=\"p.getCurrent()\" [autocomplete]=\"'off'\" [min]=\"0\" [max]=\"p.getLastPage()||0\"\r\n (keyup.enter)=\"p.setCurrent(current.value)\">\r\n <span matSuffix>/<div class=\"pl-1\">{{p.getLastPage()}}</div></span>\r\n </mat-form-field>\r\n </li>\r\n <li class=\"hidden md:block\">\r\n <mat-form-field class=\"w-24\">\r\n <mat-select #pageCount name=\"pageCount\" [value]=\"initPerPage\"\r\n (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages; track perPage) {\r\n <mat-option [value]=\"perPage\">\r\n {{perPage}}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n }\r\n </nav>\r\n </pagination-template>\r\n" }]
340
- }], propDecorators: { pageChange: [{
341
- type: Output
342
- }], pageBoundsCorrection: [{
343
- type: Output
344
- }], perPageCountChange: [{
345
- type: Output
346
- }], id: [{
347
- type: Input
348
- }], maxSize: [{
349
- type: Input
350
- }], itemsPerPages: [{
351
- type: Input
352
- }], initPerPage: [{
353
- type: Input
354
- }], autoHide: [{
355
- type: Input
356
- }] } });
428
+ args: [{ selector: 'cmat-pagination', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cmatPagination', imports: [
429
+ CmatPaginationDirective,
430
+ MatIconModule,
431
+ NgStyle,
432
+ MatFormFieldModule,
433
+ MatInputModule,
434
+ CmatDigitOnlyDirective,
435
+ MatSelectModule,
436
+ DecimalPipe,
437
+ MatButtonModule,
438
+ NgClass
439
+ ], template: "<pagination-template #p=\"paginationApi\" class=\"w-full px-4 py-2 flex\" [id]=\"id()\"\r\n [maxSize]=\"isScreenSmall() && maxSize() > 5 ? 5 : maxSize()\" (pageChange)=\"pageChange.emit($event)\"\r\n (pageBoundsCorrection)=\"pageBoundsCorrection.emit($event)\" (perPageCountChange)=\"perPageCountChange.emit($event)\">\r\n <div class=\"flex-auto items-center\" [ngClass]=\"{'hidden':isScreenSmall(),'flex':!isScreenSmall()}\">\r\n <span>\u603B\u8BA1:{{ p.getTotalItems() }}</span>\r\n </div>\r\n <nav role=\"navigation\" class=\"flex min-h-12\" [ngClass]=\"{'w-full':isScreenSmall(),'w-0':!isScreenSmall()}\">\r\n @if (!(autoHide() && p.pages().length <= 1)) { \r\n <ul class=\"flex flex-row items-center w-full\"\r\n [ngClass]=\"{'justify-center':isScreenSmall(),'justify-end':!isScreenSmall()}\">\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === 1\"\r\n (click)=\"p.goFirstPage()\">\r\n <mat-icon svgIcon=\"mat_outline:first_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"pr-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === 1\"\r\n (click)=\"p.previous()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_before\"></mat-icon>\r\n </button>\r\n </li>\r\n <div class=\"flex flex-row gap-4\">\r\n @for (page of p.pages(); track $index) {\r\n <li class=\"flex text-xl lg:text-2xl\">\r\n @if (p.getCurrent() !== page.value) {\r\n <a tabindex=\"0\" role=\"presentation\" class=\"cursor-pointer text-gray-400 hover:text-current\"\r\n (click)=\"p.setCurrent(page.value)\">\r\n <span>{{\r\n page.label === \"...\"\r\n ? page.label\r\n : (page.label | number: \"\")\r\n }}</span>\r\n </a>\r\n }\r\n @if (p.getCurrent() === page.value) {\r\n <span class=\"text-current\">\r\n <span>{{\r\n page.label === \"...\"\r\n ? page.label\r\n : (page.label | number: \"\")\r\n }}</span>\r\n </span>\r\n }\r\n </li>\r\n }\r\n </div>\r\n <li class=\"pl-4\">\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\"\r\n (click)=\"p.next()\">\r\n <mat-icon svgIcon=\"mat_outline:navigate_next\"></mat-icon>\r\n </button>\r\n </li>\r\n <li>\r\n <button type=\"button\" class=\"flex items-center\" matIconButton [disabled]=\"p.getCurrent() === p.getLastPage()\"\r\n (click)=\"p.goLastPage()\">\r\n <mat-icon svgIcon=\"mat_outline:last_page\"></mat-icon>\r\n </button>\r\n </li>\r\n <li class=\"px-2\" [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\">\r\n <mat-form-field appearance=\"fill\" [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=\"pl-1\">{{ p.getLastPage() }}</div>\r\n </span>\r\n </mat-form-field>\r\n </li>\r\n <li [ngClass]=\"{'hidden':isScreenSmall(),'block':!isScreenSmall()}\" >\r\n <mat-form-field class=\"w-24\" appearance=\"fill\">\r\n <mat-select #pageCount name=\"pageCount\" [value]=\"initPerPage()\"\r\n (selectionChange)=\"p.setItemsPerPage(pageCount.value)\">\r\n @for (perPage of itemsPerPages(); track perPage) {\r\n <mat-option [value]=\"perPage\">\r\n {{ perPage }}\r\n </mat-option>\r\n }\r\n </mat-select>\r\n </mat-form-field>\r\n </li>\r\n </ul>\r\n }\r\n </nav>\r\n</pagination-template>" }]
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"] }] } });
357
441
 
358
442
  const LARGE_NUMBER = Number.MAX_SAFE_INTEGER;
359
443
  class CmatPaginatePipe {
@@ -374,7 +458,7 @@ class CmatPaginatePipe {
374
458
  let start;
375
459
  let end;
376
460
  const perPage = this._toNumber(args.itemsPerPage);
377
- const emitChange = this.service.register(instance);
461
+ const emitChange = this.service.register(instance, true);
378
462
  if (!serverSideMode) {
379
463
  const pageSize = perPage || LARGE_NUMBER;
380
464
  start = (instance.currentPage - 1) * pageSize;
@@ -433,10 +517,10 @@ class CmatPaginatePipe {
433
517
  _toNumber(value) {
434
518
  return Number(value);
435
519
  }
436
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
437
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginatePipe, isStandalone: true, name: "paginate" }); }
520
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
521
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginatePipe, isStandalone: true, name: "paginate" }); }
438
522
  }
439
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: CmatPaginatePipe, decorators: [{
523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatPaginatePipe, decorators: [{
440
524
  type: Pipe,
441
525
  args: [{
442
526
  name: 'paginate',