@wcardinal/wcardinal-ui 0.154.0 → 0.155.0

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 (213) hide show
  1. package/dist/types/wcardinal/ui/d-application-layer-options.d.ts +3 -4
  2. package/dist/types/wcardinal/ui/d-base-background.d.ts +2 -4
  3. package/dist/types/wcardinal/ui/d-base-border.d.ts +2 -4
  4. package/dist/types/wcardinal/ui/d-base-corner.d.ts +1 -3
  5. package/dist/types/wcardinal/ui/d-base-outline.d.ts +2 -4
  6. package/dist/types/wcardinal/ui/d-base-padding.d.ts +2 -4
  7. package/dist/types/wcardinal/ui/d-chart-series-base-coordinate-container.d.ts +1 -2
  8. package/dist/types/wcardinal/ui/d-color-gradient-point-observable.d.ts +2 -4
  9. package/dist/types/wcardinal/ui/d-diagram-canvas-data-map.d.ts +1 -3
  10. package/dist/types/wcardinal/ui/d-diagram-canvas-id-map.d.ts +1 -3
  11. package/dist/types/wcardinal/ui/d-dynamic-text-geometry.d.ts +2 -3
  12. package/dist/types/wcardinal/ui/d-dynamic-text-measure.d.ts +2 -3
  13. package/dist/types/wcardinal/ui/d-dynamic-text.d.ts +8 -8
  14. package/dist/types/wcardinal/ui/d-input-and-label.d.ts +4 -5
  15. package/dist/types/wcardinal/ui/d-on-options.d.ts +1 -3
  16. package/dist/types/wcardinal/ui/d-pagination-button-last.d.ts +8 -0
  17. package/dist/types/wcardinal/ui/d-pagination-button-next.d.ts +8 -0
  18. package/dist/types/wcardinal/ui/d-pagination-button-page.d.ts +8 -0
  19. package/dist/types/wcardinal/ui/d-pagination-button-previous.d.ts +8 -0
  20. package/dist/types/wcardinal/ui/d-pagination-button-top.d.ts +8 -0
  21. package/dist/types/wcardinal/ui/d-pagination-dots.d.ts +8 -0
  22. package/dist/types/wcardinal/ui/d-pagination-page.d.ts +8 -0
  23. package/dist/types/wcardinal/ui/d-pagination.d.ts +137 -44
  24. package/dist/types/wcardinal/ui/d-picker-color-gradient-view.d.ts +4 -5
  25. package/dist/types/wcardinal/ui/d-scalar-expression.d.ts +68 -66
  26. package/dist/types/wcardinal/ui/d-table-data-list-filter.d.ts +1 -2
  27. package/dist/types/wcardinal/ui/d-table-data-list-selection.d.ts +1 -3
  28. package/dist/types/wcardinal/ui/d-table-data-selection.d.ts +1 -3
  29. package/dist/types/wcardinal/ui/d-table-data-tree-filter.d.ts +1 -2
  30. package/dist/types/wcardinal/ui/d-table-data-tree-selection-impl.d.ts +1 -3
  31. package/dist/types/wcardinal/ui/index.d.ts +11 -3
  32. package/dist/types/wcardinal/ui/shape/action/e-shape-action-runtimes.d.ts +4 -5
  33. package/dist/types/wcardinal/ui/shape/action/e-shape-action-value-change-color.d.ts +5 -6
  34. package/dist/types/wcardinal/ui/shape/e-shape-capabilities.d.ts +1 -3
  35. package/dist/types/wcardinal/ui/shape/e-shape-connector-edge-acceptor-impl.d.ts +1 -2
  36. package/dist/types/wcardinal/ui/shape/e-shape-deserializers.d.ts +2 -6
  37. package/dist/types/wcardinal/ui/shape/e-shape-runtimes.d.ts +2 -3
  38. package/dist/types/wcardinal/ui/shape/e-shape-text.d.ts +1 -3
  39. package/dist/types/wcardinal/ui/shape/e-shape-uploadeds.d.ts +1 -3
  40. package/dist/types/wcardinal/ui/shape/variant/create-line-of-any-uploaded.d.ts +1 -2
  41. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-last.d.ts +8 -0
  42. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-next.d.ts +8 -0
  43. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-page.d.ts +9 -0
  44. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-previous.d.ts +8 -0
  45. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-top.d.ts +8 -0
  46. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots.d.ts +10 -0
  47. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-page.d.ts +13 -0
  48. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination.d.ts +2 -1
  49. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark.d.ts +2 -9
  50. package/dist/types/wcardinal/ui/theme/dark/index.d.ts +7 -3
  51. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-button-last.d.ts +8 -0
  52. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-button-next.d.ts +8 -0
  53. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-button-page.d.ts +9 -0
  54. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-button-previous.d.ts +8 -0
  55. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-button-top.d.ts +8 -0
  56. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-dots.d.ts +10 -0
  57. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-page.d.ts +13 -0
  58. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination.d.ts +2 -1
  59. package/dist/types/wcardinal/ui/theme/white/d-theme-white.d.ts +2 -9
  60. package/dist/types/wcardinal/ui/theme/white/index.d.ts +7 -3
  61. package/dist/types/wcardinal/ui/util/dynamic-atlas.d.ts +2 -6
  62. package/dist/types/wcardinal/ui/util/dynamic-font-atlas-characters.d.ts +1 -3
  63. package/dist/types/wcardinal/ui/util/dynamic-sdf-font-atlases.d.ts +1 -3
  64. package/dist/types/wcardinal/ui/util/format-node/{format-noder-d.d.ts → format-node-rd.d.ts} +0 -0
  65. package/dist/types/wcardinal/ui/util/format-node/index.d.ts +31 -0
  66. package/dist/types/wcardinal/ui/util/index.d.ts +5 -0
  67. package/dist/types/wcardinal/ui/util/util-name.d.ts +1 -3
  68. package/dist/types/wcardinal/ui/util/util-svg-atlas-builder.d.ts +4 -12
  69. package/dist/wcardinal/ui/d-application-layer-options.js.map +1 -1
  70. package/dist/wcardinal/ui/d-base-background.js.map +1 -1
  71. package/dist/wcardinal/ui/d-base-border.js.map +1 -1
  72. package/dist/wcardinal/ui/d-base-corner.js.map +1 -1
  73. package/dist/wcardinal/ui/d-base-outline.js.map +1 -1
  74. package/dist/wcardinal/ui/d-base-padding.js.map +1 -1
  75. package/dist/wcardinal/ui/d-chart-series-base-coordinate-container.js.map +1 -1
  76. package/dist/wcardinal/ui/d-color-gradient-point-observable.js.map +1 -1
  77. package/dist/wcardinal/ui/d-diagram-canvas-data-map.js.map +1 -1
  78. package/dist/wcardinal/ui/d-diagram-canvas-id-map.js.map +1 -1
  79. package/dist/wcardinal/ui/d-diagram.js.map +1 -1
  80. package/dist/wcardinal/ui/d-dynamic-text-geometry.js.map +1 -1
  81. package/dist/wcardinal/ui/d-dynamic-text-measure.js.map +1 -1
  82. package/dist/wcardinal/ui/d-dynamic-text.js.map +1 -1
  83. package/dist/wcardinal/ui/d-input-and-label.js.map +1 -1
  84. package/dist/wcardinal/ui/d-on-options.js.map +1 -1
  85. package/dist/wcardinal/ui/d-pagination-button-last.js +18 -0
  86. package/dist/wcardinal/ui/d-pagination-button-last.js.map +1 -0
  87. package/dist/wcardinal/ui/d-pagination-button-next.js +18 -0
  88. package/dist/wcardinal/ui/d-pagination-button-next.js.map +1 -0
  89. package/dist/wcardinal/ui/d-pagination-button-page.js +18 -0
  90. package/dist/wcardinal/ui/d-pagination-button-page.js.map +1 -0
  91. package/dist/wcardinal/ui/d-pagination-button-previous.js +18 -0
  92. package/dist/wcardinal/ui/d-pagination-button-previous.js.map +1 -0
  93. package/dist/wcardinal/ui/d-pagination-button-top.js +18 -0
  94. package/dist/wcardinal/ui/d-pagination-button-top.js.map +1 -0
  95. package/dist/wcardinal/ui/d-pagination-dots.js +18 -0
  96. package/dist/wcardinal/ui/d-pagination-dots.js.map +1 -0
  97. package/dist/wcardinal/ui/d-pagination-page.js +18 -0
  98. package/dist/wcardinal/ui/d-pagination-page.js.map +1 -0
  99. package/dist/wcardinal/ui/d-pagination.js +455 -212
  100. package/dist/wcardinal/ui/d-pagination.js.map +1 -1
  101. package/dist/wcardinal/ui/d-picker-color-gradient-view.js.map +1 -1
  102. package/dist/wcardinal/ui/d-scalar-expression.js +107 -79
  103. package/dist/wcardinal/ui/d-scalar-expression.js.map +1 -1
  104. package/dist/wcardinal/ui/d-table-data-list-filter.js.map +1 -1
  105. package/dist/wcardinal/ui/d-table-data-list-selection.js.map +1 -1
  106. package/dist/wcardinal/ui/d-table-data-selection.js.map +1 -1
  107. package/dist/wcardinal/ui/d-table-data-tree-filter.js.map +1 -1
  108. package/dist/wcardinal/ui/d-table-data-tree-selection-impl.js.map +1 -1
  109. package/dist/wcardinal/ui/index.js +11 -3
  110. package/dist/wcardinal/ui/index.js.map +1 -1
  111. package/dist/wcardinal/ui/shape/action/e-shape-action-runtimes.js.map +1 -1
  112. package/dist/wcardinal/ui/shape/action/e-shape-action-value-change-color.js.map +1 -1
  113. package/dist/wcardinal/ui/shape/e-shape-capabilities.js.map +1 -1
  114. package/dist/wcardinal/ui/shape/e-shape-connector-edge-acceptor-impl.js.map +1 -1
  115. package/dist/wcardinal/ui/shape/e-shape-deserializers.js.map +1 -1
  116. package/dist/wcardinal/ui/shape/e-shape-runtimes.js.map +1 -1
  117. package/dist/wcardinal/ui/shape/e-shape-text.js.map +1 -1
  118. package/dist/wcardinal/ui/shape/e-shape-uploadeds.js.map +1 -1
  119. package/dist/wcardinal/ui/shape/variant/create-line-of-any-uploaded.js.map +1 -1
  120. package/dist/wcardinal/ui/shape/variant/to-image-element.js.map +1 -1
  121. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-last.js +28 -0
  122. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-last.js.map +1 -0
  123. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-next.js +27 -0
  124. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-next.js.map +1 -0
  125. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-page.js +24 -0
  126. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-page.js.map +1 -0
  127. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-previous.js +27 -0
  128. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-previous.js.map +1 -0
  129. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-top.js +28 -0
  130. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-button-top.js.map +1 -0
  131. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots.js +36 -0
  132. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots.js.map +1 -0
  133. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-page.js +35 -0
  134. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-page.js.map +1 -0
  135. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination.js +5 -2
  136. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination.js.map +1 -1
  137. package/dist/wcardinal/ui/theme/dark/d-theme-dark.js.map +1 -1
  138. package/dist/wcardinal/ui/theme/dark/index.js +7 -3
  139. package/dist/wcardinal/ui/theme/dark/index.js.map +1 -1
  140. package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-pagination.js +14 -6
  141. package/dist/wcardinal/ui/theme/dark/load/load-theme-dark-pagination.js.map +1 -1
  142. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-last.js +28 -0
  143. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-last.js.map +1 -0
  144. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-next.js +27 -0
  145. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-next.js.map +1 -0
  146. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-page.js +24 -0
  147. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-page.js.map +1 -0
  148. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-previous.js +27 -0
  149. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-previous.js.map +1 -0
  150. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-top.js +28 -0
  151. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-button-top.js.map +1 -0
  152. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dots.js +36 -0
  153. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dots.js.map +1 -0
  154. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-page.js +35 -0
  155. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-page.js.map +1 -0
  156. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination.js +5 -2
  157. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination.js.map +1 -1
  158. package/dist/wcardinal/ui/theme/white/d-theme-white.js.map +1 -1
  159. package/dist/wcardinal/ui/theme/white/index.js +7 -3
  160. package/dist/wcardinal/ui/theme/white/index.js.map +1 -1
  161. package/dist/wcardinal/ui/theme/white/load/load-theme-white-pagination.js +14 -6
  162. package/dist/wcardinal/ui/theme/white/load/load-theme-white-pagination.js.map +1 -1
  163. package/dist/wcardinal/ui/util/dynamic-atlas.js.map +1 -1
  164. package/dist/wcardinal/ui/util/dynamic-font-atlas-characters.js.map +1 -1
  165. package/dist/wcardinal/ui/util/dynamic-sdf-font-atlases.js.map +1 -1
  166. package/dist/wcardinal/ui/util/format-node/{format-noder-d.js → format-node-rd.js} +1 -1
  167. package/dist/wcardinal/ui/util/format-node/{format-noder-d.js.map → format-node-rd.js.map} +1 -1
  168. package/dist/wcardinal/ui/util/format-node/index.js +36 -0
  169. package/dist/wcardinal/ui/util/format-node/index.js.map +1 -0
  170. package/dist/wcardinal/ui/util/index.js +5 -0
  171. package/dist/wcardinal/ui/util/index.js.map +1 -1
  172. package/dist/wcardinal/ui/util/number-formatter-impl.js +1 -1
  173. package/dist/wcardinal/ui/util/number-formatter-impl.js.map +1 -1
  174. package/dist/wcardinal/ui/util/util-name.js.map +1 -1
  175. package/dist/wcardinal/ui/util/util-svg-atlas-builder.js.map +1 -1
  176. package/dist/wcardinal-ui-theme-dark.js +163 -39
  177. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  178. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  179. package/dist/wcardinal-ui-theme-white.js +163 -39
  180. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  181. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  182. package/dist/wcardinal-ui.cjs.js +999 -446
  183. package/dist/wcardinal-ui.js +675 -370
  184. package/dist/wcardinal-ui.min.js +2 -2
  185. package/dist/wcardinal-ui.min.js.map +1 -1
  186. package/package.json +3 -3
  187. package/dist/types/wcardinal/ui/d-pagination-dots-button.d.ts +0 -8
  188. package/dist/types/wcardinal/ui/d-pagination-dynamic-buttons.d.ts +0 -21
  189. package/dist/types/wcardinal/ui/d-pagination-navigation-button.d.ts +0 -8
  190. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots-button.d.ts +0 -9
  191. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-dynamic-buttons.d.ts +0 -6
  192. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-pagination-navigation-button.d.ts +0 -4
  193. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-dots-button.d.ts +0 -9
  194. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-dynamic-buttons.d.ts +0 -6
  195. package/dist/types/wcardinal/ui/theme/white/d-theme-white-pagination-navigation-button.d.ts +0 -4
  196. package/dist/wcardinal/ui/d-pagination-dots-button.js +0 -18
  197. package/dist/wcardinal/ui/d-pagination-dots-button.js.map +0 -1
  198. package/dist/wcardinal/ui/d-pagination-dynamic-buttons.js +0 -81
  199. package/dist/wcardinal/ui/d-pagination-dynamic-buttons.js.map +0 -1
  200. package/dist/wcardinal/ui/d-pagination-navigation-button.js +0 -18
  201. package/dist/wcardinal/ui/d-pagination-navigation-button.js.map +0 -1
  202. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots-button.js +0 -24
  203. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dots-button.js.map +0 -1
  204. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dynamic-buttons.js +0 -18
  205. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-dynamic-buttons.js.map +0 -1
  206. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-navigation-button.js +0 -32
  207. package/dist/wcardinal/ui/theme/dark/d-theme-dark-pagination-navigation-button.js.map +0 -1
  208. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dots-button.js +0 -24
  209. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dots-button.js.map +0 -1
  210. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dynamic-buttons.js +0 -18
  211. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-dynamic-buttons.js.map +0 -1
  212. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-navigation-button.js +0 -32
  213. package/dist/wcardinal/ui/theme/white/d-theme-white-pagination-navigation-button.js.map +0 -1
@@ -3,269 +3,512 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { __extends } from "tslib";
6
- import { DButton } from "./d-button";
7
6
  import { DLayoutHorizontal } from "./d-layout-horizontal";
8
- import { DPaginationDynamicButtons } from "./d-pagination-dynamic-buttons";
9
- import { DPaginationNavigationButton } from "./d-pagination-navigation-button";
10
- import { DThemes } from "./theme/d-themes";
7
+ import { DPaginationDots } from "./d-pagination-dots";
8
+ import { DPaginationButtonLast } from "./d-pagination-button-last";
9
+ import { DPaginationButtonNext } from "./d-pagination-button-next";
10
+ import { DPaginationButtonPage } from "./d-pagination-button-page";
11
+ import { DPaginationButtonPrevious } from "./d-pagination-button-previous";
12
+ import { DPaginationButtonTop } from "./d-pagination-button-top";
13
+ import { isNumber } from "./util/is-number";
14
+ import { DPaginationPage } from "./d-pagination-page";
15
+ import { DLayoutSpace } from "./d-layout-space";
11
16
  var DPagination = /** @class */ (function (_super) {
12
17
  __extends(DPagination, _super);
13
- function DPagination() {
14
- return _super !== null && _super.apply(this, arguments) || this;
18
+ function DPagination(options) {
19
+ var _a, _b, _c, _d;
20
+ var _this = _super.call(this, options) || this;
21
+ if (options != null) {
22
+ _this._size = (_b = (_a = options.size) !== null && _a !== void 0 ? _a : options.total) !== null && _b !== void 0 ? _b : 10;
23
+ _this._value = (_d = (_c = options.value) !== null && _c !== void 0 ? _c : options.selected) !== null && _d !== void 0 ? _d : 0;
24
+ }
25
+ else {
26
+ _this._size = 10;
27
+ _this._value = 0;
28
+ }
29
+ var buttonTop = _this.buttonTop;
30
+ var buttonPrevious = _this.buttonPrevious;
31
+ if (buttonTop != null) {
32
+ _this.addChild(buttonTop);
33
+ }
34
+ if (buttonPrevious != null) {
35
+ _this.addChild(buttonPrevious);
36
+ }
37
+ if (buttonTop != null || buttonPrevious != null) {
38
+ _this.addChild(_this.newSpace());
39
+ }
40
+ var buttonPages0 = _this.buttonPages0;
41
+ var buttonPages0Length = buttonPages0.length;
42
+ _this.addChild(buttonPages0[buttonPages0Length - 1]);
43
+ _this.addChild(_this.dots0);
44
+ for (var i = buttonPages0Length - 2; 0 <= i; --i) {
45
+ _this.addChild(buttonPages0[i]);
46
+ }
47
+ _this.addChild(_this.page);
48
+ var buttonPages1 = _this.buttonPages1;
49
+ var buttonPages1Length = buttonPages1.length;
50
+ for (var i = 0, imax = buttonPages1Length - 1; i < imax; ++i) {
51
+ _this.addChild(buttonPages1[i]);
52
+ }
53
+ _this.addChild(_this.dots1);
54
+ _this.addChild(buttonPages1[buttonPages1Length - 1]);
55
+ var buttonNext = _this.buttonNext;
56
+ var buttonLast = _this.buttonLast;
57
+ if (buttonNext != null || buttonLast != null) {
58
+ _this.addChild(_this.newSpace());
59
+ }
60
+ if (buttonNext != null) {
61
+ _this.addChild(buttonNext);
62
+ }
63
+ if (buttonLast != null) {
64
+ _this.addChild(buttonLast);
65
+ }
66
+ _this.update();
67
+ return _this;
15
68
  }
16
- DPagination.prototype.init = function (options) {
17
- var _this = this;
18
- var _a;
19
- _super.prototype.init.call(this, options);
20
- this.DEFAULT_SELECTED = 0; // set default selected index page is page 0
21
- // get total pages
22
- this._total = options.total;
23
- // get selected page
24
- this._selected = (_a = options.selected) !== null && _a !== void 0 ? _a : this.DEFAULT_SELECTED;
25
- // get button options
26
- var button = options.button;
27
- this._buttonOptions = {
28
- first: !!(button === null || button === void 0 ? void 0 : button.first),
29
- last: !!(button === null || button === void 0 ? void 0 : button.last),
30
- width: button === null || button === void 0 ? void 0 : button.width
31
- };
32
- this.initButtons(this.getButtonWidth());
33
- this.listenButtonClicked();
34
- this.on("resize", function () {
35
- _this._numberPageButtonVisible = _this.toNumberVisible();
36
- _this.update();
69
+ DPagination.prototype.newSpace = function () {
70
+ var _a, _b, _c;
71
+ return new DLayoutSpace({
72
+ width: (_c = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.space) !== null && _c !== void 0 ? _c : this.theme.getButtonSpace()
37
73
  });
38
74
  };
75
+ Object.defineProperty(DPagination.prototype, "value", {
76
+ /**
77
+ * Returns a value that is an index of a current page.
78
+ *
79
+ * @returns a value that is an index of a selected page.
80
+ */
81
+ get: function () {
82
+ return this._value;
83
+ },
84
+ /**
85
+ * Sets a value that is an index of a current page.
86
+ *
87
+ * @param value a value that is an index of a page
88
+ */
89
+ set: function (value) {
90
+ if (0 <= value && value < this._size && this._value !== value) {
91
+ this._value = value;
92
+ this.update();
93
+ }
94
+ },
95
+ enumerable: false,
96
+ configurable: true
97
+ });
39
98
  Object.defineProperty(DPagination.prototype, "selected", {
40
99
  /**
41
- * Get selected page.
100
+ * Returns an index of the selected page.
42
101
  *
43
- * @returns index of selected page.
102
+ * @returns an index of the selected page.
103
+ * @deprecated in favor of {@link value}.
44
104
  */
45
105
  get: function () {
46
- return this._selected;
106
+ return this.value;
47
107
  },
48
108
  /**
49
- * Set selected page.
109
+ * Selects a page.
50
110
  *
51
- * @param selected page's index want to select.
111
+ * @param index an index of a page
112
+ * @deprecated in favor of {@link #value}.
52
113
  */
53
- set: function (selected) {
54
- if (selected < 0 || selected >= this._total || !Number.isInteger(selected)) {
55
- selected = this.DEFAULT_SELECTED;
114
+ set: function (index) {
115
+ this.value = index;
116
+ },
117
+ enumerable: false,
118
+ configurable: true
119
+ });
120
+ Object.defineProperty(DPagination.prototype, "size", {
121
+ /**
122
+ * Returns a number of total pages.
123
+ *
124
+ * @returns a number of total pages.
125
+ */
126
+ get: function () {
127
+ return this._size;
128
+ },
129
+ /**
130
+ * Sets a number of total pages.
131
+ *
132
+ * @param size a number of pages
133
+ */
134
+ set: function (size) {
135
+ if (0 <= size && this._size !== size) {
136
+ this._size = size;
137
+ if (size === 0) {
138
+ this._value = -1;
139
+ }
140
+ else {
141
+ this._value = Math.max(0, Math.min(this._size - 1, this._value));
142
+ }
143
+ this.update();
56
144
  }
57
- this._selected = selected;
58
- this.update();
59
145
  },
60
146
  enumerable: false,
61
147
  configurable: true
62
148
  });
63
149
  Object.defineProperty(DPagination.prototype, "total", {
64
150
  /**
65
- * Get total pages.
151
+ * Returns a number of total pages.
66
152
  *
67
- * @returns number of total pages.
153
+ * @returns a number of total pages.
154
+ * @deprecated in favor of {@link size}
68
155
  */
69
156
  get: function () {
70
- return this._total;
157
+ return this.size;
71
158
  },
72
159
  /**
73
- * Set total page.
160
+ * Sets a number of total pages.
74
161
  *
75
- * @param total number of page want to present in pagination.
162
+ * @param total a number of pages
163
+ * @deprecated in favor of {@link size}
76
164
  */
77
165
  set: function (total) {
78
- if (total >= 0 && Number.isInteger(total)) {
79
- this._total = total;
80
- this._numberPageButtonVisible = this.toNumberVisible();
81
- this.selected = this._selected;
82
- this._lastPageBtn.text = this._total;
83
- this.update();
166
+ this.size = total;
167
+ },
168
+ enumerable: false,
169
+ configurable: true
170
+ });
171
+ Object.defineProperty(DPagination.prototype, "dots0", {
172
+ get: function () {
173
+ var result = this._dots0;
174
+ if (result == null) {
175
+ result = this.newDots();
176
+ this._dots0 = result;
84
177
  }
178
+ return result;
85
179
  },
86
180
  enumerable: false,
87
181
  configurable: true
88
182
  });
89
- DPagination.prototype.initButtons = function (width) {
90
- this._previousBtn = new DPaginationNavigationButton({
91
- width: width,
92
- image: {
93
- source: DThemes.getInstance().getAtlas().mappings
94
- .pagination_navigation_button_previous
183
+ Object.defineProperty(DPagination.prototype, "dots1", {
184
+ get: function () {
185
+ var result = this._dots1;
186
+ if (result == null) {
187
+ result = this.newDots();
188
+ this._dots1 = result;
95
189
  }
96
- });
97
- this._nextBtn = new DPaginationNavigationButton({
98
- width: width,
99
- image: {
100
- source: DThemes.getInstance().getAtlas().mappings.pagination_navigation_button_next
190
+ return result;
191
+ },
192
+ enumerable: false,
193
+ configurable: true
194
+ });
195
+ DPagination.prototype.newDots = function () {
196
+ return new DPaginationDots();
197
+ };
198
+ Object.defineProperty(DPagination.prototype, "buttonLast", {
199
+ get: function () {
200
+ var result = this._buttonLast;
201
+ if (result === undefined) {
202
+ result = this.newButtonLast();
203
+ this._buttonLast = result;
101
204
  }
102
- });
103
- this._goFirstBtn = new DPaginationNavigationButton({
104
- width: width,
105
- image: {
106
- source: DThemes.getInstance().getAtlas().mappings
107
- .pagination_navigation_button_go_first
108
- },
109
- visible: this._buttonOptions.first
110
- });
111
- this._goLastBtn = new DPaginationNavigationButton({
112
- width: width,
113
- image: {
114
- source: DThemes.getInstance().getAtlas().mappings
115
- .pagination_navigation_button_go_last
116
- },
117
- visible: this._buttonOptions.last
118
- });
119
- this._dynamicPageBtns = new DPaginationDynamicButtons({
120
- button: {
121
- width: width
205
+ return result;
206
+ },
207
+ enumerable: false,
208
+ configurable: true
209
+ });
210
+ DPagination.prototype.newButtonLast = function () {
211
+ var _this = this;
212
+ var _a, _b;
213
+ var last = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.last;
214
+ if (last !== null && last !== false && last !== undefined) {
215
+ var result = new DPaginationButtonLast(last !== true ? last : undefined);
216
+ result.on("active", function () {
217
+ _this.onButtonLastActive();
218
+ });
219
+ return result;
220
+ }
221
+ return null;
222
+ };
223
+ DPagination.prototype.onButtonLastActive = function () {
224
+ this.moveTo(this._size - 1);
225
+ };
226
+ DPagination.prototype.moveTo = function (index) {
227
+ if (0 <= index && index < this._size && this._value !== index) {
228
+ var oldIndex = this._value;
229
+ this._value = index;
230
+ this.emit("change", index, oldIndex, this);
231
+ this.update();
232
+ }
233
+ };
234
+ Object.defineProperty(DPagination.prototype, "buttonNext", {
235
+ get: function () {
236
+ var result = this._buttonNext;
237
+ if (result === undefined) {
238
+ result = this.newButtonNext();
239
+ this._buttonNext = result;
122
240
  }
123
- });
124
- this._firstPageBtn = new DButton({
125
- width: width,
126
- text: {
127
- value: 1
241
+ return result;
242
+ },
243
+ enumerable: false,
244
+ configurable: true
245
+ });
246
+ DPagination.prototype.newButtonNext = function () {
247
+ var _this = this;
248
+ var _a, _b;
249
+ var next = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.next;
250
+ if (next !== null && next !== false) {
251
+ var result = new DPaginationButtonNext(next !== true ? next : undefined);
252
+ result.on("active", function () {
253
+ _this.onButtonNextActive();
254
+ });
255
+ return result;
256
+ }
257
+ return null;
258
+ };
259
+ DPagination.prototype.onButtonNextActive = function () {
260
+ this.moveTo(this._value + 1);
261
+ };
262
+ Object.defineProperty(DPagination.prototype, "buttonPrevious", {
263
+ get: function () {
264
+ var result = this._buttonPrevious;
265
+ if (result === undefined) {
266
+ result = this.newButtonPrevious();
267
+ this._buttonPrevious = result;
128
268
  }
129
- });
130
- this._lastPageBtn = new DButton({
131
- width: width,
132
- text: {
133
- value: this._total
269
+ return result;
270
+ },
271
+ enumerable: false,
272
+ configurable: true
273
+ });
274
+ DPagination.prototype.newButtonPrevious = function () {
275
+ var _this = this;
276
+ var _a, _b;
277
+ var previous = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.previous;
278
+ if (previous !== null && previous !== false) {
279
+ var result = new DPaginationButtonPrevious(previous !== true ? previous : undefined);
280
+ result.on("active", function () {
281
+ _this.onButtonPreviousActive();
282
+ });
283
+ return result;
284
+ }
285
+ return null;
286
+ };
287
+ DPagination.prototype.onButtonPreviousActive = function () {
288
+ this.moveTo(this._value - 1);
289
+ };
290
+ Object.defineProperty(DPagination.prototype, "buttonTop", {
291
+ get: function () {
292
+ var result = this._buttonTop;
293
+ if (result === undefined) {
294
+ result = this.newButtonTop();
295
+ this._buttonTop = result;
134
296
  }
135
- });
136
- this.addChild(this._goFirstBtn);
137
- this.addChild(this._previousBtn);
138
- this.addChild(this._firstPageBtn);
139
- this.addChild(this._dynamicPageBtns);
140
- this.addChild(this._lastPageBtn);
141
- this.addChild(this._nextBtn);
142
- this.addChild(this._goLastBtn);
297
+ return result;
298
+ },
299
+ enumerable: false,
300
+ configurable: true
301
+ });
302
+ DPagination.prototype.newButtonTop = function () {
303
+ var _this = this;
304
+ var _a, _b;
305
+ var top = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.top;
306
+ if (top !== null && top !== false && top !== undefined) {
307
+ var result = new DPaginationButtonTop(top !== true ? top : undefined);
308
+ result.on("active", function () {
309
+ _this.onButtonTopActive();
310
+ });
311
+ return result;
312
+ }
313
+ return null;
143
314
  };
144
- DPagination.prototype.listenButtonClicked = function () {
315
+ DPagination.prototype.onButtonTopActive = function () {
316
+ this.moveTo(0);
317
+ };
318
+ DPagination.prototype.newButtonPage = function () {
145
319
  var _this = this;
146
- this._firstPageBtn.on("active", function (btn) {
147
- _this.onClickPageButton(btn);
148
- });
149
- this._lastPageBtn.on("active", function (btn) {
150
- _this.onClickPageButton(btn);
320
+ var _a, _b;
321
+ var result = new DPaginationButtonPage((_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.button) === null || _b === void 0 ? void 0 : _b.page);
322
+ result.on("active", function () {
323
+ _this.onButtonPageActive(result);
151
324
  });
152
- this._dynamicPageBtns.on("active", function (btn) {
153
- _this.onClickPageButton(btn);
154
- });
155
- this._goFirstBtn.on("active", function (btn) {
156
- _this.selected = _this.DEFAULT_SELECTED;
157
- });
158
- this._goLastBtn.on("active", function (btn) {
159
- _this.selected = _this._total - 1;
160
- });
161
- this._nextBtn.on("active", function (btn) {
162
- if (_this.selected !== _this._total + 1) {
163
- _this.selected = _this._selected + 1;
325
+ return result;
326
+ };
327
+ Object.defineProperty(DPagination.prototype, "buttonPages0", {
328
+ get: function () {
329
+ var result = this._buttonPages0;
330
+ if (result == null) {
331
+ result = this.newButtonPages0();
332
+ this._buttonPages0 = result;
164
333
  }
165
- });
166
- this._previousBtn.on("active", function (btn) {
167
- if (_this._selected !== 0) {
168
- _this.selected = _this._selected - 1;
334
+ return result;
335
+ },
336
+ enumerable: false,
337
+ configurable: true
338
+ });
339
+ DPagination.prototype.newButtonPages0 = function () {
340
+ return [
341
+ this.newButtonPage(),
342
+ this.newButtonPage(),
343
+ this.newButtonPage(),
344
+ this.newButtonPage()
345
+ ];
346
+ };
347
+ Object.defineProperty(DPagination.prototype, "buttonPages1", {
348
+ get: function () {
349
+ var result = this._buttonPages1;
350
+ if (result == null) {
351
+ result = this.newButtonPages1();
352
+ this._buttonPages1 = result;
169
353
  }
170
- });
354
+ return result;
355
+ },
356
+ enumerable: false,
357
+ configurable: true
358
+ });
359
+ DPagination.prototype.newButtonPages1 = function () {
360
+ return [
361
+ this.newButtonPage(),
362
+ this.newButtonPage(),
363
+ this.newButtonPage(),
364
+ this.newButtonPage()
365
+ ];
171
366
  };
172
- DPagination.prototype.update = function () {
173
- var startDynamic;
174
- var endDynamic;
175
- var dotsLeft;
176
- var dotsRight;
177
- var numberButtonsInLeft = 0;
178
- var numberButtonsInRight = 0;
179
- this.updateStaticButtons();
180
- // Number displayed buttons from first button to selected button when select center button of all buttons.
181
- // Not including selected button.
182
- var numberButtonsFirstToCenter = Math.ceil((this._numberPageButtonVisible - 1) * 0.5);
183
- var numberButtonsCenterToEnd = Math.floor((this._numberPageButtonVisible - 1) * 0.5);
184
- if (this._selected < numberButtonsFirstToCenter) {
185
- numberButtonsInLeft = this._selected;
186
- numberButtonsInRight = this._numberPageButtonVisible - numberButtonsInLeft - 1;
187
- }
188
- else if (this._selected + numberButtonsCenterToEnd > this._total - 1) {
189
- numberButtonsInRight = this._total - 1 - this.selected;
190
- numberButtonsInLeft = this._numberPageButtonVisible - numberButtonsInRight - 1;
191
- }
192
- else {
193
- numberButtonsInLeft = numberButtonsFirstToCenter;
194
- numberButtonsInRight = numberButtonsCenterToEnd;
195
- }
196
- if (this._selected <= numberButtonsInLeft) {
197
- startDynamic = 1;
198
- dotsLeft = false;
199
- }
200
- else {
201
- startDynamic = this._selected - numberButtonsInLeft + 2;
202
- dotsLeft = true;
203
- }
204
- if (this._selected + numberButtonsInRight >= this._total - 1) {
205
- endDynamic = this._total - 2;
206
- dotsRight = false;
207
- }
208
- else {
209
- endDynamic = this._selected + numberButtonsInRight - 2;
210
- dotsRight = true;
211
- }
212
- this._dynamicPageBtns.update({
213
- start: startDynamic,
214
- end: endDynamic,
215
- selected: this._selected,
216
- button: {
217
- width: this.getButtonWidth(),
218
- dotsLeft: dotsLeft,
219
- dotsRight: dotsRight
367
+ Object.defineProperty(DPagination.prototype, "page", {
368
+ get: function () {
369
+ var result = this._page;
370
+ if (result == null) {
371
+ result = this.newPage();
372
+ this._page = result;
220
373
  }
221
- });
374
+ return result;
375
+ },
376
+ enumerable: false,
377
+ configurable: true
378
+ });
379
+ DPagination.prototype.newPage = function () {
380
+ var _a;
381
+ return new DPaginationPage((_a = this._options) === null || _a === void 0 ? void 0 : _a.page);
222
382
  };
223
- DPagination.prototype.updateStaticButtons = function () {
224
- if (this._total > 0) {
225
- this._firstPageBtn.show();
226
- }
227
- else {
228
- this._firstPageBtn.hide();
229
- }
230
- if (this._total > 1) {
231
- this._lastPageBtn.show();
232
- }
233
- else {
234
- this._lastPageBtn.hide();
383
+ DPagination.prototype.onButtonPageActive = function (button) {
384
+ var text = button.text;
385
+ if (isNumber(text)) {
386
+ this.moveTo(text - 1);
387
+ if (button.state.isFocused) {
388
+ button.state.isHovered = false;
389
+ this.page.focus();
390
+ }
235
391
  }
236
- var isFirst = this._selected === this.DEFAULT_SELECTED;
237
- var isLast = this._selected === this._total - 1 || this._total === 0;
238
- this._firstPageBtn.state.isActive = isFirst;
239
- this._lastPageBtn.state.isActive = isLast;
240
- this._goFirstBtn.state.isDisabled = isFirst;
241
- this._previousBtn.state.isDisabled = isFirst;
242
- this._nextBtn.state.isDisabled = isLast;
243
- this._goLastBtn.state.isDisabled = isLast;
244
- };
245
- DPagination.prototype.getButtonWidth = function () {
246
- return this._buttonOptions.width ? this._buttonOptions.width : this.theme.getButtonWidth();
247
392
  };
248
- DPagination.prototype.toNumberVisible = function () {
249
- var numberNavigationBtn = 2; // 2 buttons always displayed are "next" and "previous" button
250
- if (this._buttonOptions.first) {
251
- numberNavigationBtn++;
252
- }
253
- if (this._buttonOptions.last) {
254
- numberNavigationBtn++;
393
+ DPagination.prototype.update = function () {
394
+ var size = this._size;
395
+ var value = this._value;
396
+ if (size <= 0) {
397
+ var buttonTop = this.buttonTop;
398
+ if (buttonTop != null) {
399
+ buttonTop.state.isEnabled = false;
400
+ }
401
+ var buttonPrevious = this.buttonPrevious;
402
+ if (buttonPrevious != null) {
403
+ buttonPrevious.state.isEnabled = false;
404
+ }
405
+ this.dots0.hide();
406
+ var buttonPages0 = this.buttonPages0;
407
+ for (var i = 0, imax = buttonPages0.length; i < imax; ++i) {
408
+ buttonPages0[i].hide();
409
+ }
410
+ this.page.hide();
411
+ var buttonPages1 = this.buttonPages1;
412
+ for (var i = 0, imax = buttonPages1.length; i < imax; ++i) {
413
+ buttonPages1[i].hide();
414
+ }
415
+ this.dots1.hide();
416
+ var buttonNext = this.buttonNext;
417
+ if (buttonNext != null) {
418
+ buttonNext.state.isEnabled = false;
419
+ }
420
+ var buttonLast = this.buttonLast;
421
+ if (buttonLast) {
422
+ buttonLast.state.isEnabled = false;
423
+ }
255
424
  }
256
- var widthOfNavigationBtns = numberNavigationBtn * (this.getButtonWidth() + this._margin.horizontal * 2);
257
- var widthOfPageBtns = this.width - widthOfNavigationBtns;
258
- var numberVisible = Math.floor(widthOfPageBtns / (this.getButtonWidth() + this._margin.horizontal * 2));
259
- /* set numberVisible is 5, if it less than 5
260
- If total pages less than numberVisible, set numberVisible equal total pages
261
- **/
262
- return Math.min(this._total, Math.max(numberVisible, 5));
263
- };
264
- DPagination.prototype.onClickPageButton = function (btn) {
265
- var btnIndex = Number(btn.text) - 1;
266
- if (this._selected !== btnIndex) {
267
- this._selected = btnIndex;
268
- this.update();
425
+ else {
426
+ var from = value - 2;
427
+ var to = value + 2;
428
+ if (from < 0) {
429
+ to = to - from;
430
+ from = 0;
431
+ }
432
+ else if (size <= to) {
433
+ var delta = to - size + 1;
434
+ to -= delta;
435
+ from -= delta;
436
+ }
437
+ var top_1 = false;
438
+ if (0 < from) {
439
+ top_1 = true;
440
+ from = Math.min(from + 1, value);
441
+ }
442
+ var last = false;
443
+ if (to < size - 1) {
444
+ last = true;
445
+ to = Math.max(to - 1, value);
446
+ }
447
+ var buttonTop = this.buttonTop;
448
+ if (buttonTop != null) {
449
+ buttonTop.state.isEnabled = 0 < value;
450
+ }
451
+ var buttonPrevious = this.buttonPrevious;
452
+ if (buttonPrevious != null) {
453
+ buttonPrevious.state.isEnabled = 0 < value;
454
+ }
455
+ if (top_1) {
456
+ this.dots0.show();
457
+ }
458
+ else {
459
+ this.dots0.hide();
460
+ }
461
+ var buttonPages0 = this.buttonPages0;
462
+ for (var i = 0, imax = buttonPages0.length; i < imax; ++i) {
463
+ var index = value - i - 1;
464
+ var buttonPage = buttonPages0[i];
465
+ if (from <= index && index <= to) {
466
+ buttonPage.text = index + 1;
467
+ buttonPage.show();
468
+ }
469
+ else {
470
+ if (top_1 && i === imax - 1) {
471
+ buttonPage.text = 1;
472
+ buttonPage.show();
473
+ }
474
+ else {
475
+ buttonPage.hide();
476
+ }
477
+ }
478
+ }
479
+ this.page.text = value + 1;
480
+ var buttonPages1 = this.buttonPages1;
481
+ for (var i = 0, imax = buttonPages1.length; i < imax; ++i) {
482
+ var index = value + i + 1;
483
+ var buttonPage = buttonPages1[i];
484
+ if (from <= index && index <= to) {
485
+ buttonPage.text = index + 1;
486
+ buttonPage.show();
487
+ }
488
+ else {
489
+ if (last && i === imax - 1) {
490
+ buttonPage.text = size;
491
+ buttonPage.show();
492
+ }
493
+ else {
494
+ buttonPage.hide();
495
+ }
496
+ }
497
+ }
498
+ if (last) {
499
+ this.dots1.show();
500
+ }
501
+ else {
502
+ this.dots1.hide();
503
+ }
504
+ var buttonNext = this.buttonNext;
505
+ if (buttonNext != null) {
506
+ buttonNext.state.isEnabled = value < size - 1;
507
+ }
508
+ var buttonLast = this.buttonLast;
509
+ if (buttonLast != null) {
510
+ buttonLast.state.isEnabled = value < size - 1;
511
+ }
269
512
  }
270
513
  };
271
514
  DPagination.prototype.getType = function () {