@type-dom/ui 0.0.7 → 0.0.9

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 (225) hide show
  1. package/package.json +1 -2
  2. package/src/aria.d.ts +0 -17
  3. package/src/aria.js +0 -18
  4. package/src/components/basic/td-button/td-button.abstract.d.ts +2 -3
  5. package/src/components/basic/td-button/td-button.abstract.js +30 -26
  6. package/src/components/basic/td-button/td-button.interface.d.ts +0 -1
  7. package/src/components/basic/td-button-group/td-button-group.class.d.ts +2 -3
  8. package/src/components/basic/td-button-group/td-button-group.class.js +14 -16
  9. package/src/components/basic/td-container/td-aside/td-aside.class.js +2 -2
  10. package/src/components/basic/td-container/td-container.class.js +5 -5
  11. package/src/components/basic/td-container/td-container.js +1 -1
  12. package/src/components/basic/td-container/td-footer/td-footer.class.js +2 -2
  13. package/src/components/basic/td-container/td-header/td-header.class.js +3 -4
  14. package/src/components/basic/td-container/td-main/td-main.class.js +2 -2
  15. package/src/components/basic/td-icon/td-icon.class.js +9 -9
  16. package/src/components/basic/td-layout/td-col/td-col.class.d.ts +5 -2
  17. package/src/components/basic/td-layout/td-col/td-col.class.js +80 -80
  18. package/src/components/basic/td-layout/td-row/td-row.class.js +13 -13
  19. package/src/components/basic/td-link/td-link.class.d.ts +0 -1
  20. package/src/components/basic/td-link/td-link.class.js +17 -19
  21. package/src/components/basic/td-scrollbar/bar/bar.class.js +3 -3
  22. package/src/components/basic/td-scrollbar/td-scrollbar.class.js +5 -5
  23. package/src/components/basic/td-scrollbar/thumb/thumb.class.js +3 -3
  24. package/src/components/basic/td-space/td-space.class.js +10 -10
  25. package/src/components/basic/td-text/td-text.class.js +12 -9
  26. package/src/components/data/td-avatar/td-avatar.class.js +12 -13
  27. package/src/components/data/td-badge/td-badge.class.d.ts +1 -0
  28. package/src/components/data/td-badge/td-badge.class.js +15 -11
  29. package/src/components/data/td-card/td-card.class.js +7 -7
  30. package/src/components/data/td-check-tag/td-check-tag.class.d.ts +0 -1
  31. package/src/components/data/td-check-tag/td-check-tag.class.js +9 -11
  32. package/src/components/data/td-collapse/td-collapse.class.js +2 -3
  33. package/src/components/data/td-collapse/td-collapse.interface.d.ts +1 -0
  34. package/src/components/data/td-collapse-item/td-collapse-item.class.js +8 -8
  35. package/src/components/data/td-collapse-transition/td-collapse-transition.util.js +14 -14
  36. package/src/components/data/td-count-down/td-count-down.class.js +1 -1
  37. package/src/components/data/td-descriptions/td-descriptions-row.js +2 -2
  38. package/src/components/data/td-descriptions/td-descriptions.class.js +8 -8
  39. package/src/components/data/td-descriptions/td-descritions-cell.js +14 -14
  40. package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +1 -1
  41. package/src/components/data/td-empty/img-empty.class.js +3 -3
  42. package/src/components/data/td-empty/td-empty.class.js +4 -4
  43. package/src/components/data/td-image/td-image.class.js +6 -6
  44. package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +2 -1
  45. package/src/components/data/td-image-viewer/td-image-viewer.class.js +14 -10
  46. package/src/components/data/td-result/td-result.class.js +3 -3
  47. package/src/components/data/td-segmented/td-segmented.class.js +26 -30
  48. package/src/components/data/td-statistic/td-statistic.abstract.js +2 -2
  49. package/src/components/data/td-tag/td-tag.class.js +10 -10
  50. package/src/components/feedback/index.d.ts +0 -2
  51. package/src/components/feedback/index.js +3 -5
  52. package/src/components/feedback/td-alert/td-alert.class.js +9 -9
  53. package/src/components/feedback/td-dialog/td-dialog.class.js +4 -4
  54. package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +4 -4
  55. package/src/components/feedback/td-drawer/td-drawer.class.js +1 -1
  56. package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +19 -1
  57. package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +223 -48
  58. package/src/components/feedback/td-focus-trap/tokens.d.ts +2 -1
  59. package/src/components/feedback/td-focus-trap/utils.d.ts +1 -1
  60. package/src/components/feedback/td-focus-trap/utils.js +9 -11
  61. package/src/components/feedback/td-loading/td-loading.class.js +1 -1
  62. package/src/components/feedback/td-message/td-message.class.d.ts +4 -2
  63. package/src/components/feedback/td-message/td-message.class.js +34 -27
  64. package/src/components/feedback/td-message/td-message.style.js +2 -1
  65. package/src/components/feedback/td-message-box/td-message-box.class.d.ts +3 -1
  66. package/src/components/feedback/td-message-box/td-message-box.class.js +79 -75
  67. package/src/components/feedback/td-message-box/td-message-box.interface.d.ts +2 -1
  68. package/src/components/feedback/td-notification/td-notification.class.d.ts +3 -2
  69. package/src/components/feedback/td-notification/td-notification.class.js +29 -29
  70. package/src/components/feedback/td-only-child/td-only-child.class.d.ts +7 -0
  71. package/src/components/feedback/td-only-child/td-only-child.class.js +74 -0
  72. package/src/components/feedback/td-overlay/td-overlay.class.d.ts +1 -1
  73. package/src/components/feedback/td-overlay/td-overlay.class.js +5 -5
  74. package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +6 -0
  75. package/src/components/feedback/td-popper/arrow/arrow.class.js +22 -3
  76. package/src/components/feedback/td-popper/composable/use-focus-trap.d.ts +0 -0
  77. package/src/components/feedback/td-popper/composable/use-focus-trap.js +1 -0
  78. package/src/components/feedback/td-popper/content/content.class.d.ts +1 -0
  79. package/src/components/feedback/td-popper/content/content.class.js +25 -4
  80. package/src/components/feedback/td-popper/content/content.const.d.ts +3 -0
  81. package/src/components/feedback/td-popper/content/content.const.js +29 -0
  82. package/src/components/feedback/td-popper/content/content.interface.d.ts +9 -0
  83. package/src/components/feedback/td-popper/td-popper.class.d.ts +1 -1
  84. package/src/components/feedback/td-popper/td-popper.class.js +35 -2
  85. package/src/components/feedback/td-popper/td-popper.const.d.ts +21 -0
  86. package/src/components/feedback/td-popper/td-popper.const.js +5 -0
  87. package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +11 -0
  88. package/src/components/feedback/td-popper/trigger/trigger.class.js +96 -1
  89. package/src/components/feedback/td-popper/trigger/trigger.const.d.ts +1 -0
  90. package/src/components/feedback/td-popper/trigger/trigger.const.js +12 -0
  91. package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +1 -0
  92. package/src/components/feedback/td-tooltip/content/content.class.js +1 -1
  93. package/src/components/feedback/td-tooltip/td-tooltip.class.js +1 -1
  94. package/src/components/feedback/td-tooltip/trigger/trigger.class.js +1 -1
  95. package/src/components/form/checkbox-group/checkbox-group.class.js +6 -7
  96. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.d.ts +1 -1
  97. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +21 -20
  98. package/src/components/form/field-item/cascade/field-cascade.abstract.d.ts +1 -1
  99. package/src/components/form/field-item/cascade/field-cascade.abstract.js +48 -43
  100. package/src/components/form/field-item/field-item.abstract.js +3 -3
  101. package/src/components/form/field-item/input/field-input.abstract.d.ts +1 -1
  102. package/src/components/form/field-item/input/field-input.abstract.js +15 -14
  103. package/src/components/form/field-item/options/field-options.abstract.d.ts +1 -3
  104. package/src/components/form/field-item/options/field-options.abstract.js +49 -46
  105. package/src/components/form/field-item/radio/field-radio.abstract.d.ts +1 -1
  106. package/src/components/form/field-item/radio/field-radio.abstract.js +32 -36
  107. package/src/components/form/field-item/select/field-select.abstract.d.ts +1 -1
  108. package/src/components/form/field-item/select/field-select.abstract.js +19 -19
  109. package/src/components/form/field-item/span/field-span.abstract.js +5 -5
  110. package/src/components/form/field-item/textarea/field-textarea.abstract.js +5 -5
  111. package/src/components/form/field-select/field-select.class.d.ts +1 -1
  112. package/src/components/form/field-select/field-select.class.js +23 -24
  113. package/src/components/form/field-select/option/option.class.js +1 -3
  114. package/src/components/form/radio-group/radio-group.class.js +6 -7
  115. package/src/components/form/radio-group/radio-option/radio-option.class.d.ts +0 -1
  116. package/src/components/form/radio-group/radio-option/radio-option.class.js +14 -15
  117. package/src/components/form/select/select.class.d.ts +1 -1
  118. package/src/components/form/select/select.class.js +19 -18
  119. package/src/components/form/td-checkbox/td-checkbox.class.js +3 -3
  120. package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +3 -3
  121. package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +3 -3
  122. package/src/components/form/td-form/td-form.class.js +5 -3
  123. package/src/components/form/td-form-item/td-form-item.class.js +16 -16
  124. package/src/components/form/td-input/td-input-field.class.js +8 -8
  125. package/src/components/form/td-input/td-input.class.d.ts +0 -1
  126. package/src/components/form/td-input/td-input.class.js +9 -11
  127. package/src/components/form/td-input/widget/prefix.js +1 -1
  128. package/src/components/form/td-input/widget/suffix.js +3 -3
  129. package/src/components/form/td-input/widget/td-input-wrapper.class.js +12 -11
  130. package/src/components/form/td-input/widget/td-textarea-wrapper.js +3 -3
  131. package/src/components/form/td-option/td-option.class.js +3 -3
  132. package/src/components/form/td-option-group/td-option-group.class.js +3 -3
  133. package/src/components/form/td-radio/td-radio.class.d.ts +0 -1
  134. package/src/components/form/td-radio/td-radio.class.js +50 -54
  135. package/src/components/form/td-radio-button/td-radio-button.class.d.ts +0 -1
  136. package/src/components/form/td-radio-button/td-radio-button.class.js +46 -50
  137. package/src/components/form/td-radio-group/td-radio-group.class.js +3 -4
  138. package/src/components/form/td-select/dropdown/dropdown.class.js +2 -2
  139. package/src/components/form/td-select/td-select.class.js +2 -2
  140. package/src/components/form/td-switch/td-switch.class.d.ts +1 -1
  141. package/src/components/form/td-switch/td-switch.class.js +27 -28
  142. package/src/components/form/td-switch/widget/td-switch-core.js +6 -6
  143. package/src/components/form/td-switch/widget/td-switch-left.js +3 -3
  144. package/src/components/form/td-switch/widget/td-switch-right.js +2 -2
  145. package/src/components/navigation/td-affix/td-affix.class.d.ts +3 -0
  146. package/src/components/navigation/td-affix/td-affix.class.js +22 -20
  147. package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +1 -1
  148. package/src/components/navigation/td-anchor/td-anchor.class.js +10 -10
  149. package/src/components/navigation/td-backtop/td-backtop.class.d.ts +5 -3
  150. package/src/components/navigation/td-backtop/td-backtop.class.js +42 -34
  151. package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +3 -0
  152. package/src/components/navigation/td-backtop/use-backtop.d.ts +7 -0
  153. package/src/components/navigation/td-backtop/use-backtop.js +44 -0
  154. package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +4 -4
  155. package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +3 -3
  156. package/src/components/navigation/td-menu/td-menu.class.js +5 -5
  157. package/src/components/navigation/td-menu/td-menu.interface.d.ts +2 -1
  158. package/src/components/navigation/td-tabs/td-tab-bar.class.js +5 -5
  159. package/src/components/navigation/td-tabs/td-tab-nav.class.js +14 -14
  160. package/src/components/navigation/td-tabs/td-tab-pane.class.js +3 -3
  161. package/src/components/navigation/td-tabs/td-tabs.class.js +22 -25
  162. package/src/components/others/collapsible-box/collapsible-box.js +2 -2
  163. package/src/components/others/collapsible-box/contents/contents.js +2 -2
  164. package/src/components/others/collapsible-box/heading/expand-heading.d.ts +1 -1
  165. package/src/components/others/collapsible-box/heading/expand-heading.js +27 -26
  166. package/src/components/others/custom-block/custom-block.d.ts +11 -0
  167. package/src/components/others/custom-block/custom-block.js +58 -0
  168. package/src/components/others/example/example-float-control.d.ts +8 -0
  169. package/src/components/others/example/example-float-control.js +63 -0
  170. package/src/components/others/example/example-showcase.d.ts +7 -0
  171. package/src/components/others/example/example-showcase.js +20 -0
  172. package/src/components/others/example/example-source-wrapper.d.ts +9 -0
  173. package/src/components/others/example/example-source-wrapper.js +30 -0
  174. package/src/components/others/example/example.d.ts +14 -0
  175. package/src/components/others/example/example.js +77 -0
  176. package/src/components/others/example/index.d.ts +5 -0
  177. package/src/components/others/example/index.js +13 -0
  178. package/src/components/others/example/op-btns.d.ts +7 -0
  179. package/src/components/others/example/op-btns.js +95 -0
  180. package/src/components/others/index.d.ts +4 -0
  181. package/src/components/others/index.js +9 -1
  182. package/src/components/others/menus/menu.d.ts +21 -0
  183. package/src/components/others/menus/menu.js +125 -0
  184. package/src/components/others/menus/menus.d.ts +15 -0
  185. package/src/components/others/menus/menus.js +101 -0
  186. package/src/components/others/td-divider/td-divider.class.js +8 -8
  187. package/src/hooks/index.d.ts +3 -0
  188. package/src/hooks/index.js +6 -0
  189. package/src/hooks/use-cursor.d.ts +1 -0
  190. package/src/hooks/use-cursor.js +56 -0
  191. package/src/hooks/use-escape-keydown.d.ts +4 -0
  192. package/src/hooks/use-escape-keydown.js +31 -0
  193. package/src/hooks/use-forward-ref.d.ts +13 -0
  194. package/src/hooks/use-forward-ref.js +27 -0
  195. package/src/index.d.ts +1 -0
  196. package/src/index.js +1 -0
  197. package/src/ui/ui.abstract.d.ts +1 -1
  198. package/src/ui/ui.abstract.js +3 -3
  199. package/src/ui/ui.interface.d.ts +3 -3
  200. package/src/components/feedback/dialog/dialog.class.d.ts +0 -7
  201. package/src/components/feedback/dialog/dialog.class.js +0 -21
  202. package/src/components/feedback/dialog/dialog.interface.d.ts +0 -4
  203. package/src/components/feedback/dialog/dialog.interface.js +0 -2
  204. package/src/components/feedback/message-box/message-box.d.ts +0 -9
  205. package/src/components/feedback/message-box/message-box.interface.d.ts +0 -4
  206. package/src/components/feedback/message-box/message-box.interface.js +0 -2
  207. package/src/components/feedback/message-box/message-box.js +0 -33
  208. package/src/components/feedback/overlay/container/body/body.d.ts +0 -7
  209. package/src/components/feedback/overlay/container/body/body.js +0 -17
  210. package/src/components/feedback/overlay/container/container.d.ts +0 -15
  211. package/src/components/feedback/overlay/container/container.js +0 -37
  212. package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.d.ts +0 -8
  213. package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +0 -31
  214. package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.d.ts +0 -9
  215. package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +0 -31
  216. package/src/components/feedback/overlay/container/footer/footer.d.ts +0 -10
  217. package/src/components/feedback/overlay/container/footer/footer.js +0 -47
  218. package/src/components/feedback/overlay/container/header/close-button/close-button.d.ts +0 -11
  219. package/src/components/feedback/overlay/container/header/close-button/close-button.js +0 -33
  220. package/src/components/feedback/overlay/container/header/header.d.ts +0 -12
  221. package/src/components/feedback/overlay/container/header/header.js +0 -25
  222. package/src/components/feedback/overlay/container/header/title/title.d.ts +0 -9
  223. package/src/components/feedback/overlay/container/header/title/title.js +0 -19
  224. package/src/components/feedback/overlay/overlay.abstract.d.ts +0 -13
  225. package/src/components/feedback/overlay/overlay.abstract.js +0 -59
@@ -1,15 +1,82 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TdCol = void 0;
4
- const rxjs_1 = require("rxjs");
5
4
  const utils_1 = require("@type-dom/utils");
6
5
  const ui_abstract_1 = require("../../../../ui/ui.abstract");
7
6
  class TdCol extends ui_abstract_1.UI {
8
7
  constructor(params = {}) {
9
8
  super(params);
9
+ // 使用防抖函数包装处理函数
10
+ this.debounceResize = () => (0, utils_1.debounce)(this.resize, 250)();
11
+ this.resize = () => {
12
+ console.log('this.screenWidth is ', this.screenWidth);
13
+ const props = this.props;
14
+ if (props === null || props === void 0 ? void 0 : props.xs) {
15
+ if (this.screenWidth < 768) {
16
+ // 超小屏幕(xs)
17
+ // 当前屏幕尺寸小于768px,执行xs断点下的操作
18
+ const proportion = (0, utils_1.formatFloat)(props.xs / 24) * 100 + '%';
19
+ this.style.setObj({
20
+ maxWidth: proportion,
21
+ flex: '0 0 ' + proportion
22
+ });
23
+ }
24
+ }
25
+ if (props === null || props === void 0 ? void 0 : props.sm) {
26
+ if (this.screenWidth >= 768) {
27
+ // && this.screenWidth < 992
28
+ // 小屏幕(sm)
29
+ // 当前屏幕尺寸在768px至991px之间,执行md断点下的操作
30
+ // 设置你的值或执行相应JS代码
31
+ const proportion = (0, utils_1.formatFloat)(props.sm / 24) * 100 + '%';
32
+ this.style.setObj({
33
+ maxWidth: proportion,
34
+ flex: '0 0 ' + proportion
35
+ });
36
+ }
37
+ }
38
+ if (props === null || props === void 0 ? void 0 : props.md) {
39
+ if (this.screenWidth >= 992) {
40
+ // && this.screenWidth < 1200
41
+ // 中屏幕(md)
42
+ // 当前屏幕尺寸在992px至1199px之间,执行lg断点下的操作
43
+ // 设置你的值或执行相应JS代码
44
+ const proportion = (0, utils_1.formatFloat)(props.md / 24) * 100 + '%';
45
+ this.style.setObj({
46
+ maxWidth: proportion,
47
+ flex: '0 0 ' + proportion
48
+ });
49
+ }
50
+ }
51
+ if (props === null || props === void 0 ? void 0 : props.lg) {
52
+ if (this.screenWidth >= 1200) {
53
+ // && this.screenWidth < 1920
54
+ // 大屏幕(lg)
55
+ // 当前屏幕尺寸在1200px至1920px之间,执行lg断点下的操作
56
+ // 设置你的值或执行相应JS代码
57
+ const proportion = (0, utils_1.formatFloat)(props.lg / 24) * 100 + '%';
58
+ this.style.setObj({
59
+ maxWidth: proportion,
60
+ flex: '0 0 ' + proportion
61
+ });
62
+ }
63
+ }
64
+ if (props === null || props === void 0 ? void 0 : props.xl) {
65
+ if (this.screenWidth >= 1920) {
66
+ // 超大屏幕(xl及以上)
67
+ // 当前屏幕尺寸等于或大于1920px,执行xl断点下的操作
68
+ // 设置你的值或执行相应JS代码
69
+ const proportion = (0, utils_1.formatFloat)(props.xl / 24) * 100 + '%';
70
+ this.style.setObj({
71
+ maxWidth: proportion,
72
+ flex: '0 0 ' + proportion
73
+ });
74
+ }
75
+ }
76
+ };
10
77
  this.className = 'TdCol';
11
78
  this.addChild(this.getSlotNode());
12
- this.props = this.setParams(params);
79
+ this.props = this.useParams(params);
13
80
  }
14
81
  get screenWidth() {
15
82
  return window.innerWidth || document.documentElement.clientWidth;
@@ -18,13 +85,13 @@ class TdCol extends ui_abstract_1.UI {
18
85
  const props = this.props;
19
86
  if (props === null || props === void 0 ? void 0 : props.span) {
20
87
  if (props.span === 0) {
21
- this.ctrl.addStyleObj({
88
+ this.style.addObj({
22
89
  display: 'none'
23
90
  });
24
91
  }
25
92
  else {
26
93
  const proportion = (0, utils_1.formatFloat)(props.span / 24) * 100 + '%';
27
- this.ctrl.addStyleObj({
94
+ this.style.addObj({
28
95
  maxWidth: proportion,
29
96
  flex: '0 0 ' + proportion
30
97
  });
@@ -32,100 +99,33 @@ class TdCol extends ui_abstract_1.UI {
32
99
  }
33
100
  if (props === null || props === void 0 ? void 0 : props.offset) {
34
101
  const proportion = (0, utils_1.formatFloat)(props.offset / 24) * 100 + '%';
35
- this.ctrl.addStyleObj({
102
+ this.style.addObj({
36
103
  marginLeft: proportion
37
104
  });
38
105
  }
39
106
  if (props === null || props === void 0 ? void 0 : props.pull) {
40
107
  const proportion = (0, utils_1.formatFloat)(props.pull / 24) * 100 + '%';
41
- this.ctrl.addStyleObj({
108
+ this.style.addObj({
42
109
  position: 'relative',
43
110
  right: proportion
44
111
  });
45
112
  }
46
113
  if (props === null || props === void 0 ? void 0 : props.push) {
47
114
  const proportion = (0, utils_1.formatFloat)(props.push / 24) * 100 + '%';
48
- this.ctrl.addStyleObj({
115
+ this.style.addObj({
49
116
  position: 'relative',
50
117
  left: proportion
51
118
  });
52
119
  }
53
120
  this.resize();
54
121
  }
55
- resize() {
56
- console.log('this.screenWidth is ', this.screenWidth);
57
- const props = this.props;
58
- if (props === null || props === void 0 ? void 0 : props.xs) {
59
- if (this.screenWidth < 768) {
60
- // 超小屏幕(xs)
61
- // 当前屏幕尺寸小于768px,执行xs断点下的操作
62
- const proportion = (0, utils_1.formatFloat)(props.xs / 24) * 100 + '%';
63
- this.ctrl.setStyleObj({
64
- maxWidth: proportion,
65
- flex: '0 0 ' + proportion
66
- });
67
- }
68
- }
69
- if (props === null || props === void 0 ? void 0 : props.sm) {
70
- if (this.screenWidth >= 768) {
71
- // && this.screenWidth < 992
72
- // 小屏幕(sm)
73
- // 当前屏幕尺寸在768px至991px之间,执行md断点下的操作
74
- // 设置你的值或执行相应JS代码
75
- const proportion = (0, utils_1.formatFloat)(props.sm / 24) * 100 + '%';
76
- this.ctrl.setStyleObj({
77
- maxWidth: proportion,
78
- flex: '0 0 ' + proportion
79
- });
80
- }
81
- }
82
- if (props === null || props === void 0 ? void 0 : props.md) {
83
- if (this.screenWidth >= 992) {
84
- // && this.screenWidth < 1200
85
- // 中屏幕(md)
86
- // 当前屏幕尺寸在992px至1199px之间,执行lg断点下的操作
87
- // 设置你的值或执行相应JS代码
88
- const proportion = (0, utils_1.formatFloat)(props.md / 24) * 100 + '%';
89
- this.ctrl.setStyleObj({
90
- maxWidth: proportion,
91
- flex: '0 0 ' + proportion
92
- });
93
- }
94
- }
95
- if (props === null || props === void 0 ? void 0 : props.lg) {
96
- if (this.screenWidth >= 1200) {
97
- // && this.screenWidth < 1920
98
- // 大屏幕(lg)
99
- // 当前屏幕尺寸在1200px至1920px之间,执行lg断点下的操作
100
- // 设置你的值或执行相应JS代码
101
- const proportion = (0, utils_1.formatFloat)(props.lg / 24) * 100 + '%';
102
- this.ctrl.setStyleObj({
103
- maxWidth: proportion,
104
- flex: '0 0 ' + proportion
105
- });
106
- }
107
- }
108
- if (props === null || props === void 0 ? void 0 : props.xl) {
109
- if (this.screenWidth >= 1920) {
110
- // 超大屏幕(xl及以上)
111
- // 当前屏幕尺寸等于或大于1920px,执行xl断点下的操作
112
- // 设置你的值或执行相应JS代码
113
- const proportion = (0, utils_1.formatFloat)(props.xl / 24) * 100 + '%';
114
- this.ctrl.setStyleObj({
115
- maxWidth: proportion,
116
- flex: '0 0 ' + proportion
117
- });
118
- }
119
- }
122
+ mounted() {
123
+ // 监听窗口大小改变事件
124
+ window.addEventListener('resize', this.debounceResize);
120
125
  }
121
- initEvents() {
122
- this.subscriptions.push((0, rxjs_1.fromEvent)(window, 'resize')
123
- .pipe((0, rxjs_1.debounceTime)(250) // 防抖延时
124
- // distinctUntilChanged() // 可选,仅在窗口尺寸发生实际变化时才触发
125
- )
126
- .subscribe((event) => {
127
- this.resize();
128
- }));
126
+ destroy(root) {
127
+ window.removeEventListener('resize', this.debounceResize);
128
+ super.destroy(root);
129
129
  }
130
130
  }
131
131
  exports.TdCol = TdCol;
@@ -10,7 +10,7 @@ class TdRow extends ui_abstract_1.UI {
10
10
  constructor(params = {}) {
11
11
  super(params);
12
12
  this.className = 'TdRow';
13
- this.ctrl.addStyleObj({
13
+ this.style.addObj({
14
14
  display: 'flex',
15
15
  flexWrap: 'wrap',
16
16
  position: 'relative',
@@ -18,20 +18,20 @@ class TdRow extends ui_abstract_1.UI {
18
18
  });
19
19
  this.childNodes = [];
20
20
  this.addChild(this.getSlotNode());
21
- this.props = this.setParams(params);
21
+ this.props = this.useParams(params);
22
22
  }
23
23
  setup() {
24
24
  const props = this.props;
25
25
  if (props === null || props === void 0 ? void 0 : props.gutter) {
26
26
  this.gutter = props.gutter;
27
- this.ctrl.addStyleObj({
27
+ this.style.addObj({
28
28
  marginLeft: `-${props.gutter / 2}px`,
29
29
  marginRight: `-${props.gutter / 2}px`
30
30
  });
31
31
  this.children.forEach((child) => {
32
32
  if (child instanceof td_col_class_1.TdCol) {
33
33
  if (props.gutter) {
34
- child.ctrl.addStyleObj({
34
+ child.style.addObj({
35
35
  boxSizing: 'border-box',
36
36
  paddingLeft: `${props.gutter / 2}px`,
37
37
  paddingRight: `${props.gutter / 2}px`
@@ -44,27 +44,27 @@ class TdRow extends ui_abstract_1.UI {
44
44
  // this.setJustify(props.justify);
45
45
  switch (props.justify) {
46
46
  case 'center':
47
- this.ctrl.addStyleObj({
47
+ this.style.addObj({
48
48
  justifyContent: 'center'
49
49
  });
50
50
  break;
51
51
  case 'end':
52
- this.ctrl.addStyleObj({
52
+ this.style.addObj({
53
53
  justifyContent: 'flex-end'
54
54
  });
55
55
  break;
56
56
  case 'space-between':
57
- this.ctrl.addStyleObj({
57
+ this.style.addObj({
58
58
  justifyContent: 'space-between'
59
59
  });
60
60
  break;
61
61
  case 'space-around':
62
- this.ctrl.addStyleObj({
62
+ this.style.addObj({
63
63
  justifyContent: 'space-around'
64
64
  });
65
65
  break;
66
66
  case 'space-evenly':
67
- this.ctrl.addStyleObj({
67
+ this.style.addObj({
68
68
  justifyContent: 'space-evenly'
69
69
  });
70
70
  break;
@@ -76,22 +76,22 @@ class TdRow extends ui_abstract_1.UI {
76
76
  // this.setAlign(props.align);
77
77
  switch (props.align) {
78
78
  case 'top':
79
- this.ctrl.addStyleObj({
79
+ this.style.addObj({
80
80
  alignItems: 'flex-start'
81
81
  });
82
82
  break;
83
83
  case 'middle':
84
- this.ctrl.addStyleObj({
84
+ this.style.addObj({
85
85
  alignItems: 'center'
86
86
  });
87
87
  break;
88
88
  case 'bottom':
89
- this.ctrl.addStyleObj({
89
+ this.style.addObj({
90
90
  alignItems: 'flex-end'
91
91
  });
92
92
  break;
93
93
  case 'stretch':
94
- this.ctrl.addStyleObj({
94
+ this.style.addObj({
95
95
  alignItems: 'stretch'
96
96
  });
97
97
  break;
@@ -6,6 +6,5 @@ export declare class TdLink extends UI implements ITdLink {
6
6
  private inner?;
7
7
  constructor(params: ITdLinkConfig);
8
8
  setup(): void;
9
- initEvents(): void;
10
9
  handleClick(event: MouseEvent): void;
11
10
  }
@@ -9,29 +9,29 @@ class TdLink extends ui_abstract_1.UI {
9
9
  super(params, 'a');
10
10
  this.className = 'TdLink';
11
11
  (0, td_link_style_1.useType)(params);
12
- this.ctrl.addStyleObj(td_link_style_1.$linkStyle);
13
- this.props = this.setParams(params);
12
+ this.style.addObj(td_link_style_1.$linkStyle);
13
+ this.props = this.useParams(params);
14
14
  }
15
15
  // override beforeCreate() {
16
- // this.ctrl.addStyleObj($linkStyle);
16
+ // this.style.addObj($linkStyle);
17
17
  // }
18
18
  setup() {
19
19
  const props = this.props;
20
- this.ctrl.addAttrObj({
20
+ this.attr.addObj({
21
21
  href: props === null || props === void 0 ? void 0 : props.href,
22
22
  target: props === null || props === void 0 ? void 0 : props.target,
23
23
  disabled: props === null || props === void 0 ? void 0 : props.disabled
24
24
  });
25
25
  if (props === null || props === void 0 ? void 0 : props.type) {
26
26
  if (props === null || props === void 0 ? void 0 : props.disabled) {
27
- this.ctrl.addStyleObj(td_link_style_1.$linkStateColors[props.type].disabled);
27
+ this.style.addObj(td_link_style_1.$linkStateColors[props.type].disabled);
28
28
  }
29
29
  else {
30
- this.ctrl.addStyleObj(td_link_style_1.$linkStateColors[props.type].default);
30
+ this.style.addObj(td_link_style_1.$linkStateColors[props.type].default);
31
31
  }
32
32
  }
33
33
  else {
34
- this.ctrl.addStyleObj(td_link_style_1.$linkStateColors.default.default);
34
+ this.style.addObj(td_link_style_1.$linkStateColors.default.default);
35
35
  }
36
36
  if (props === null || props === void 0 ? void 0 : props.icon) {
37
37
  this.unshiftChild(props.icon);
@@ -42,8 +42,6 @@ class TdLink extends ui_abstract_1.UI {
42
42
  });
43
43
  this.inner.addChild(this.getSlotNode());
44
44
  this.addChild(this.inner);
45
- }
46
- initEvents() {
47
45
  this.addEvents({
48
46
  click: (evt) => {
49
47
  this.handleClick(evt);
@@ -51,47 +49,47 @@ class TdLink extends ui_abstract_1.UI {
51
49
  mouseenter: () => {
52
50
  if (this.props.type) {
53
51
  if (this.props.disabled) {
54
- this.ctrl.setStyleObj({
52
+ this.style.setObj({
55
53
  cursor: 'notAllowed'
56
54
  });
57
55
  }
58
56
  else {
59
- this.ctrl.setStyleObj(td_link_style_1.$linkStateColors[this.props.type].hover);
57
+ this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].hover);
60
58
  }
61
59
  }
62
60
  else {
63
- this.ctrl.setStyleObj(td_link_style_1.$linkStateColors.default.hover);
61
+ this.style.setObj(td_link_style_1.$linkStateColors.default.hover);
64
62
  }
65
63
  if (this.props.underline === false) {
66
64
  // 设置 false 的情况下,不显示下划线
67
- this.ctrl.setStyleObj({
65
+ this.style.setObj({
68
66
  textDecoration: 'none'
69
67
  });
70
68
  }
71
69
  else {
72
70
  // 1. 默认显示下划线
73
71
  // 2. 默认显示下划线,如果设置了 underline 为 true,则显示下划线
74
- this.ctrl.setStyleObj({
72
+ this.style.setObj({
75
73
  textDecoration: 'underline'
76
74
  });
77
75
  }
78
76
  },
79
77
  mouseleave: (evt) => {
80
- this.ctrl.setStyleObj({
78
+ this.style.setObj({
81
79
  textDecoration: 'none'
82
80
  });
83
81
  if (this.props.type) {
84
- this.ctrl.removeStyleObj(td_link_style_1.$linkStateColors[this.props.type].hover);
82
+ this.style.removeObj(td_link_style_1.$linkStateColors[this.props.type].hover);
85
83
  if (this.props.disabled) {
86
84
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
87
- this.ctrl.setStyleObj(td_link_style_1.$linkStateColors[this.props.type].disabled);
85
+ this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].disabled);
88
86
  }
89
87
  else {
90
- this.ctrl.setStyleObj(td_link_style_1.$linkStateColors[this.props.type].default);
88
+ this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].default);
91
89
  }
92
90
  }
93
91
  else {
94
- this.ctrl.removeStyleObj(td_link_style_1.$linkStateColors.default.hover);
92
+ this.style.removeObj(td_link_style_1.$linkStateColors.default.hover);
95
93
  }
96
94
  }
97
95
  });
@@ -7,8 +7,8 @@ class TdScrollbarBar extends ui_abstract_1.UI {
7
7
  constructor(params = {}) {
8
8
  super(params);
9
9
  this.className = 'TdScrollbarBar';
10
- this.ctrl.addAttrName('td-scrollbar-bar');
11
- this.ctrl.addStyleObj({
10
+ this.attr.addName('td-scrollbar-bar');
11
+ this.style.addObj({
12
12
  position: 'absolute',
13
13
  right: '2px',
14
14
  bottom: '2px',
@@ -26,7 +26,7 @@ class TdScrollbarBar extends ui_abstract_1.UI {
26
26
  ratio: 1
27
27
  })
28
28
  ];
29
- this.props = this.setParams(params);
29
+ this.props = this.useParams(params);
30
30
  }
31
31
  }
32
32
  exports.TdScrollbarBar = TdScrollbarBar;
@@ -8,8 +8,8 @@ class TdScrollbar extends ui_abstract_1.UI {
8
8
  constructor(params = {}) {
9
9
  super(params, params === null || params === void 0 ? void 0 : params.tag);
10
10
  this.className = 'TdScrollbar';
11
- this.ctrl.addAttrName('td-scrollbar');
12
- this.ctrl.addStyleObj({
11
+ this.attr.addName('td-scrollbar');
12
+ this.style.addObj({
13
13
  overflow: 'hidden',
14
14
  position: 'relative',
15
15
  height: '100%'
@@ -26,11 +26,11 @@ class TdScrollbar extends ui_abstract_1.UI {
26
26
  name: 'td-scrollbar-view'
27
27
  });
28
28
  if (params === null || params === void 0 ? void 0 : params.viewStyle) {
29
- this.view.ctrl.addStyleObj(params.viewStyle);
29
+ this.view.style.addObj(params.viewStyle);
30
30
  }
31
31
  this.wrap.addChild(this.view);
32
32
  if (params === null || params === void 0 ? void 0 : params.wrapStyle) {
33
- this.wrap.ctrl.addStyleObj(params.wrapStyle);
33
+ this.wrap.style.addObj(params.wrapStyle);
34
34
  }
35
35
  this.addChild(this.wrap);
36
36
  if (!(params === null || params === void 0 ? void 0 : params.native)) {
@@ -43,7 +43,7 @@ class TdScrollbar extends ui_abstract_1.UI {
43
43
  if (params === null || params === void 0 ? void 0 : params.contents) {
44
44
  this.view.addChildren(...params.contents);
45
45
  }
46
- this.props = this.setParams(params);
46
+ this.props = this.useParams(params);
47
47
  }
48
48
  }
49
49
  exports.TdScrollbar = TdScrollbar;
@@ -8,8 +8,8 @@ class TdScrollbarThumb extends ui_abstract_1.UI {
8
8
  constructor(params = {}) {
9
9
  super(params);
10
10
  this.className = 'TdScrollbarThumb';
11
- this.ctrl.addAttrName('td-scrollbar-thumb');
12
- this.ctrl.addStyleObj({
11
+ this.attr.addName('td-scrollbar-thumb');
12
+ this.style.addObj({
13
13
  position: 'absolute',
14
14
  right: '2px',
15
15
  bottom: '2px',
@@ -39,7 +39,7 @@ class TdScrollbarThumb extends ui_abstract_1.UI {
39
39
  }
40
40
  });
41
41
  this.addChild(this.thumb);
42
- this.props = this.setParams(params);
42
+ this.props = this.useParams(params);
43
43
  }
44
44
  }
45
45
  exports.TdScrollbarThumb = TdScrollbarThumb;
@@ -9,17 +9,17 @@ class TdSpace extends ui_abstract_1.UI {
9
9
  constructor(params = {}) {
10
10
  super(params);
11
11
  this.className = 'TdSpace';
12
- this.ctrl.addStyleObj({
12
+ this.style.addObj({
13
13
  display: 'inline-flex',
14
14
  verticalAlign: 'top'
15
15
  });
16
16
  this.addChild(this.getSlotNode());
17
- this.props = this.setParams(params);
17
+ this.props = this.useParams(params);
18
18
  }
19
19
  setup() {
20
20
  this.children.forEach((item) => {
21
21
  if (item instanceof framework_1.TypeElement) {
22
- item.ctrl.addStyleObj({
22
+ item.style.addObj({
23
23
  display: 'flex',
24
24
  flexWrap: 'wrap'
25
25
  });
@@ -28,23 +28,23 @@ class TdSpace extends ui_abstract_1.UI {
28
28
  const props = this.props;
29
29
  this.useSize(props === null || props === void 0 ? void 0 : props.size);
30
30
  if (props === null || props === void 0 ? void 0 : props.wrap) {
31
- this.ctrl.addStyle('flexWrap', 'wrap');
31
+ this.style.add('flexWrap', 'wrap');
32
32
  }
33
33
  if (props === null || props === void 0 ? void 0 : props.fill) {
34
- this.ctrl.addStyleObj({
34
+ this.style.addObj({
35
35
  flexWrap: 'wrap',
36
36
  flexGrow: 1,
37
37
  minWidth: `${(props === null || props === void 0 ? void 0 : props.fillRatio) || 100}%`
38
38
  });
39
39
  }
40
40
  if ((props === null || props === void 0 ? void 0 : props.direction) === 'horizontal') {
41
- this.ctrl.addStyle('flexDirection', 'row');
41
+ this.style.add('flexDirection', 'row');
42
42
  }
43
43
  if ((props === null || props === void 0 ? void 0 : props.direction) === 'vertical') {
44
- this.ctrl.addStyle('flexDirection', 'column');
44
+ this.style.add('flexDirection', 'column');
45
45
  }
46
46
  if (props === null || props === void 0 ? void 0 : props.alignment) {
47
- this.ctrl.addStyle('alignItems', props.alignment);
47
+ this.style.add('alignItems', props.alignment);
48
48
  }
49
49
  }
50
50
  useSize(size) {
@@ -77,7 +77,7 @@ class TdSpace extends ui_abstract_1.UI {
77
77
  }
78
78
  }
79
79
  }
80
- this.ctrl.addStyleObj({
80
+ this.style.addObj({
81
81
  rowGap: this.verticalSize + 'px',
82
82
  columnGap: this.horizontalSize + 'px'
83
83
  });
@@ -85,7 +85,7 @@ class TdSpace extends ui_abstract_1.UI {
85
85
  setSize(size) {
86
86
  console.log('setSize size is ', size);
87
87
  this.useSize(size);
88
- this.ctrl.setStyleObj({
88
+ this.style.setObj({
89
89
  rowGap: this.verticalSize + 'px',
90
90
  columnGap: this.horizontalSize + 'px'
91
91
  });
@@ -7,26 +7,29 @@ class TdText extends ui_abstract_1.UI {
7
7
  constructor(params = {}) {
8
8
  super(params, (params === null || params === void 0 ? void 0 : params.tag) || 'span');
9
9
  this.className = 'TdText';
10
- this.ctrl.addStyleObj(td_text_style_1.$baseText);
11
- this.addChild(this.getSlotNode());
12
- this.props = this.setParams(params);
10
+ this.style.addObj(td_text_style_1.$baseText);
11
+ this.props = this.useParams(params);
12
+ // this.addChild(this.getSlotNode());
13
+ if (params.slot) {
14
+ this.slotChild(params.slot);
15
+ }
13
16
  }
14
17
  setup() {
15
18
  const props = this.props;
16
19
  if (props === null || props === void 0 ? void 0 : props.type) {
17
- this.ctrl.addStyleObj(td_text_style_1.$textStateColors[props.type].default);
20
+ this.style.addObj(td_text_style_1.$textStateColors[props.type].default);
18
21
  }
19
22
  else {
20
- this.ctrl.addStyleObj(td_text_style_1.$textStateColors.default.default);
23
+ this.style.addObj(td_text_style_1.$textStateColors.default.default);
21
24
  }
22
25
  if (props === null || props === void 0 ? void 0 : props.size) {
23
- this.ctrl.addStyleObj(td_text_style_1.sizeOpts[props === null || props === void 0 ? void 0 : props.size]);
26
+ this.style.addObj(td_text_style_1.sizeOpts[props === null || props === void 0 ? void 0 : props.size]);
24
27
  }
25
28
  else {
26
- this.ctrl.addStyleObj(td_text_style_1.sizeOpts.default);
29
+ this.style.addObj(td_text_style_1.sizeOpts.default);
27
30
  }
28
31
  if ((props === null || props === void 0 ? void 0 : props.truncated) && (props === null || props === void 0 ? void 0 : props.width)) {
29
- this.ctrl.addStyleObj({
32
+ this.style.addObj({
30
33
  display: 'inline-block',
31
34
  maxWidth: '100%',
32
35
  textOverflow: 'ellipsis',
@@ -36,7 +39,7 @@ class TdText extends ui_abstract_1.UI {
36
39
  });
37
40
  }
38
41
  if (props === null || props === void 0 ? void 0 : props.lineClamp) {
39
- this.ctrl.addStyleObj({
42
+ this.style.addObj({
40
43
  // '-webkit-line-clamp': props?.lineClamp,
41
44
  WebkitLineClamp: props === null || props === void 0 ? void 0 : props.lineClamp,
42
45
  display: '-webkit-inline-box',