@type-dom/ui 0.0.8 → 0.0.10

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 (222) hide show
  1. package/README.md +44 -44
  2. package/package.json +2 -8
  3. package/src/aria.d.ts +0 -17
  4. package/src/aria.js +0 -18
  5. package/src/components/basic/td-button/td-button.abstract.d.ts +2 -3
  6. package/src/components/basic/td-button/td-button.abstract.js +30 -26
  7. package/src/components/basic/td-button/td-button.interface.d.ts +0 -1
  8. package/src/components/basic/td-button-group/td-button-group.class.d.ts +2 -3
  9. package/src/components/basic/td-button-group/td-button-group.class.js +14 -16
  10. package/src/components/basic/td-container/td-aside/td-aside.class.js +2 -2
  11. package/src/components/basic/td-container/td-container.class.js +5 -5
  12. package/src/components/basic/td-container/td-container.js +1 -1
  13. package/src/components/basic/td-container/td-footer/td-footer.class.js +2 -2
  14. package/src/components/basic/td-container/td-header/td-header.class.js +3 -3
  15. package/src/components/basic/td-container/td-main/td-main.class.js +2 -2
  16. package/src/components/basic/td-icon/td-icon.class.js +20 -20
  17. package/src/components/basic/td-layout/td-col/td-col.class.d.ts +5 -2
  18. package/src/components/basic/td-layout/td-col/td-col.class.js +80 -80
  19. package/src/components/basic/td-layout/td-row/td-row.class.js +13 -13
  20. package/src/components/basic/td-link/td-link.class.d.ts +0 -1
  21. package/src/components/basic/td-link/td-link.class.js +17 -19
  22. package/src/components/basic/td-scrollbar/bar/bar.class.js +3 -3
  23. package/src/components/basic/td-scrollbar/td-scrollbar.class.js +5 -5
  24. package/src/components/basic/td-scrollbar/thumb/thumb.class.js +3 -3
  25. package/src/components/basic/td-space/td-space.class.js +10 -10
  26. package/src/components/basic/td-text/td-text.class.js +12 -9
  27. package/src/components/data/td-avatar/td-avatar.class.js +12 -13
  28. package/src/components/data/td-badge/td-badge.class.js +9 -8
  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 -2
  33. package/src/components/data/td-collapse-item/td-collapse-item.class.js +15 -16
  34. package/src/components/data/td-collapse-transition/td-collapse-transition.util.js +14 -14
  35. package/src/components/data/td-count-down/td-count-down.class.js +1 -1
  36. package/src/components/data/td-descriptions/td-descriptions-row.js +2 -2
  37. package/src/components/data/td-descriptions/td-descriptions.class.js +8 -8
  38. package/src/components/data/td-descriptions/td-descritions-cell.js +14 -14
  39. package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +1 -1
  40. package/src/components/data/td-empty/img-empty.class.js +3 -3
  41. package/src/components/data/td-empty/td-empty.class.js +4 -4
  42. package/src/components/data/td-image/td-image.class.js +6 -6
  43. package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +2 -1
  44. package/src/components/data/td-image-viewer/td-image-viewer.class.js +13 -10
  45. package/src/components/data/td-result/td-result.class.js +3 -3
  46. package/src/components/data/td-segmented/td-segmented.class.js +14 -17
  47. package/src/components/data/td-statistic/td-statistic.abstract.js +2 -2
  48. package/src/components/data/td-tag/td-tag.class.js +9 -9
  49. package/src/components/feedback/index.d.ts +2 -2
  50. package/src/components/feedback/index.js +5 -6
  51. package/src/components/feedback/td-alert/td-alert.class.js +9 -9
  52. package/src/components/feedback/td-dialog/td-dialog.class.js +5 -5
  53. package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +4 -4
  54. package/src/components/feedback/td-drawer/td-drawer.class.js +10 -12
  55. package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +19 -1
  56. package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +223 -48
  57. package/src/components/feedback/td-focus-trap/tokens.d.ts +2 -1
  58. package/src/components/feedback/td-focus-trap/utils.d.ts +1 -1
  59. package/src/components/feedback/td-focus-trap/utils.js +9 -11
  60. package/src/components/feedback/td-loading/td-loading.class.d.ts +2 -0
  61. package/src/components/feedback/td-loading/td-loading.class.js +7 -1
  62. package/src/components/feedback/td-message/td-message.class.d.ts +3 -2
  63. package/src/components/feedback/td-message/td-message.class.js +18 -18
  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 +5 -3
  66. package/src/components/feedback/td-message-box/td-message-box.class.js +79 -74
  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 +26 -26
  70. package/src/components/feedback/td-notification/td-notification.style.js +6 -6
  71. package/src/components/feedback/td-only-child/td-only-child.class.d.ts +7 -0
  72. package/src/components/feedback/td-only-child/td-only-child.class.js +74 -0
  73. package/src/components/feedback/td-overlay/td-overlay.class.d.ts +1 -1
  74. package/src/components/feedback/td-overlay/td-overlay.class.js +5 -5
  75. package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +6 -0
  76. package/src/components/feedback/td-popper/arrow/arrow.class.js +22 -3
  77. package/src/components/feedback/td-popper/composable/use-focus-trap.d.ts +0 -0
  78. package/src/components/feedback/td-popper/composable/use-focus-trap.js +1 -0
  79. package/src/components/feedback/td-popper/content/content.class.d.ts +1 -0
  80. package/src/components/feedback/td-popper/content/content.class.js +25 -4
  81. package/src/components/feedback/td-popper/content/content.const.d.ts +3 -0
  82. package/src/components/feedback/td-popper/content/content.const.js +29 -0
  83. package/src/components/feedback/td-popper/content/content.interface.d.ts +9 -0
  84. package/src/components/feedback/td-popper/td-popper.class.d.ts +1 -1
  85. package/src/components/feedback/td-popper/td-popper.class.js +35 -2
  86. package/src/components/feedback/td-popper/td-popper.const.d.ts +21 -0
  87. package/src/components/feedback/td-popper/td-popper.const.js +5 -0
  88. package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +11 -0
  89. package/src/components/feedback/td-popper/trigger/trigger.class.js +96 -1
  90. package/src/components/feedback/td-popper/trigger/trigger.const.d.ts +1 -0
  91. package/src/components/feedback/td-popper/trigger/trigger.const.js +12 -0
  92. package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +1 -0
  93. package/src/components/feedback/td-tooltip/content/content.class.js +1 -1
  94. package/src/components/feedback/td-tooltip/td-tooltip.class.js +1 -1
  95. package/src/components/feedback/td-tooltip/trigger/trigger.class.js +1 -1
  96. package/src/components/form/checkbox-group/checkbox-group.class.js +6 -7
  97. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.d.ts +1 -1
  98. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +4 -4
  99. package/src/components/form/field-item/cascade/field-cascade.abstract.d.ts +1 -1
  100. package/src/components/form/field-item/cascade/field-cascade.abstract.js +8 -8
  101. package/src/components/form/field-item/field-item.abstract.js +3 -3
  102. package/src/components/form/field-item/input/field-input.abstract.d.ts +1 -1
  103. package/src/components/form/field-item/input/field-input.abstract.js +8 -8
  104. package/src/components/form/field-item/options/field-options.abstract.d.ts +1 -3
  105. package/src/components/form/field-item/options/field-options.abstract.js +32 -30
  106. package/src/components/form/field-item/radio/field-radio.abstract.d.ts +1 -1
  107. package/src/components/form/field-item/radio/field-radio.abstract.js +32 -35
  108. package/src/components/form/field-item/select/field-select.abstract.d.ts +1 -1
  109. package/src/components/form/field-item/select/field-select.abstract.js +5 -5
  110. package/src/components/form/field-item/span/field-span.abstract.js +5 -5
  111. package/src/components/form/field-item/textarea/field-textarea.abstract.js +5 -5
  112. package/src/components/form/field-select/field-select.class.d.ts +1 -1
  113. package/src/components/form/field-select/field-select.class.js +7 -8
  114. package/src/components/form/field-select/option/option.class.js +1 -3
  115. package/src/components/form/radio-group/radio-group.class.js +6 -7
  116. package/src/components/form/radio-group/radio-option/radio-option.class.d.ts +0 -1
  117. package/src/components/form/radio-group/radio-option/radio-option.class.js +6 -8
  118. package/src/components/form/select/select.class.d.ts +1 -1
  119. package/src/components/form/select/select.class.js +4 -4
  120. package/src/components/form/td-checkbox/td-checkbox.class.js +3 -3
  121. package/src/components/form/td-checkbox/td-checkbox.style.js +2 -2
  122. package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +3 -3
  123. package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +3 -3
  124. package/src/components/form/td-form/td-form.class.js +5 -3
  125. package/src/components/form/td-form-item/td-form-item.class.js +16 -16
  126. package/src/components/form/td-input/td-input-field.class.js +8 -8
  127. package/src/components/form/td-input/td-input.class.d.ts +0 -1
  128. package/src/components/form/td-input/td-input.class.js +9 -11
  129. package/src/components/form/td-input/widget/prefix.js +1 -1
  130. package/src/components/form/td-input/widget/suffix.js +3 -3
  131. package/src/components/form/td-input/widget/td-input-wrapper.class.js +12 -11
  132. package/src/components/form/td-input/widget/td-textarea-wrapper.js +3 -3
  133. package/src/components/form/td-input/widget/utils.js +8 -8
  134. package/src/components/form/td-option/td-option.class.js +3 -3
  135. package/src/components/form/td-option-group/td-option-group.class.js +3 -3
  136. package/src/components/form/td-radio/td-radio.class.d.ts +0 -1
  137. package/src/components/form/td-radio/td-radio.class.js +50 -53
  138. package/src/components/form/td-radio-button/td-radio-button.class.d.ts +0 -1
  139. package/src/components/form/td-radio-button/td-radio-button.class.js +46 -49
  140. package/src/components/form/td-radio-group/td-radio-group.class.js +3 -4
  141. package/src/components/form/td-select/dropdown/dropdown.class.js +2 -2
  142. package/src/components/form/td-select/td-select.class.js +2 -2
  143. package/src/components/form/td-switch/td-switch.class.d.ts +1 -1
  144. package/src/components/form/td-switch/td-switch.class.js +21 -21
  145. package/src/components/form/td-switch/widget/td-switch-core.js +10 -10
  146. package/src/components/form/td-switch/widget/td-switch-left.js +3 -3
  147. package/src/components/form/td-switch/widget/td-switch-right.js +2 -2
  148. package/src/components/navigation/td-affix/td-affix.class.d.ts +3 -0
  149. package/src/components/navigation/td-affix/td-affix.class.js +22 -20
  150. package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +1 -1
  151. package/src/components/navigation/td-anchor/td-anchor.class.js +10 -10
  152. package/src/components/navigation/td-backtop/td-backtop.class.d.ts +5 -3
  153. package/src/components/navigation/td-backtop/td-backtop.class.js +41 -32
  154. package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +3 -0
  155. package/src/components/navigation/td-backtop/use-backtop.d.ts +7 -0
  156. package/src/components/navigation/td-backtop/use-backtop.js +44 -0
  157. package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +4 -4
  158. package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +3 -3
  159. package/src/components/navigation/td-menu/td-menu.class.js +5 -5
  160. package/src/components/navigation/td-menu/td-menu.interface.d.ts +2 -1
  161. package/src/components/navigation/td-tabs/td-tab-bar.class.js +5 -5
  162. package/src/components/navigation/td-tabs/td-tab-nav.class.js +14 -14
  163. package/src/components/navigation/td-tabs/td-tab-pane.class.js +3 -3
  164. package/src/components/navigation/td-tabs/td-tabs.class.js +4 -4
  165. package/src/components/others/collapsible-box/collapsible-box.js +2 -2
  166. package/src/components/others/collapsible-box/contents/contents.js +2 -2
  167. package/src/components/others/collapsible-box/heading/expand-heading.d.ts +1 -1
  168. package/src/components/others/collapsible-box/heading/expand-heading.js +11 -11
  169. package/src/components/others/custom-block/custom-block.js +2 -2
  170. package/src/components/others/example/example-float-control.d.ts +1 -1
  171. package/src/components/others/example/example-float-control.js +8 -8
  172. package/src/components/others/example/example-showcase.js +3 -3
  173. package/src/components/others/example/example-source-wrapper.d.ts +6 -2
  174. package/src/components/others/example/example-source-wrapper.js +3 -3
  175. package/src/components/others/example/example.d.ts +1 -2
  176. package/src/components/others/example/example.js +4 -4
  177. package/src/components/others/example/op-btns.js +9 -10
  178. package/src/components/others/menus/menu.d.ts +10 -5
  179. package/src/components/others/menus/menu.js +35 -33
  180. package/src/components/others/menus/menus.d.ts +6 -1
  181. package/src/components/others/menus/menus.js +46 -24
  182. package/src/components/others/td-divider/td-divider.class.js +8 -8
  183. package/src/hooks/index.d.ts +3 -0
  184. package/src/hooks/index.js +6 -0
  185. package/src/hooks/use-cursor.d.ts +1 -0
  186. package/src/hooks/use-cursor.js +56 -0
  187. package/src/hooks/use-escape-keydown.d.ts +4 -0
  188. package/src/hooks/use-escape-keydown.js +31 -0
  189. package/src/hooks/use-forward-ref.d.ts +13 -0
  190. package/src/hooks/use-forward-ref.js +27 -0
  191. package/src/index.d.ts +1 -0
  192. package/src/index.js +1 -0
  193. package/src/styles/var.d.ts +1 -1
  194. package/src/styles/var.js +2 -2
  195. package/src/ui/ui.abstract.d.ts +1 -1
  196. package/src/ui/ui.abstract.js +2 -2
  197. package/src/components/feedback/dialog/dialog.class.d.ts +0 -7
  198. package/src/components/feedback/dialog/dialog.class.js +0 -21
  199. package/src/components/feedback/dialog/dialog.interface.d.ts +0 -4
  200. package/src/components/feedback/dialog/dialog.interface.js +0 -2
  201. package/src/components/feedback/message-box/message-box.d.ts +0 -9
  202. package/src/components/feedback/message-box/message-box.interface.d.ts +0 -4
  203. package/src/components/feedback/message-box/message-box.interface.js +0 -2
  204. package/src/components/feedback/message-box/message-box.js +0 -33
  205. package/src/components/feedback/overlay/container/body/body.d.ts +0 -7
  206. package/src/components/feedback/overlay/container/body/body.js +0 -17
  207. package/src/components/feedback/overlay/container/container.d.ts +0 -15
  208. package/src/components/feedback/overlay/container/container.js +0 -38
  209. package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.d.ts +0 -8
  210. package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +0 -32
  211. package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.d.ts +0 -9
  212. package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +0 -32
  213. package/src/components/feedback/overlay/container/footer/footer.d.ts +0 -10
  214. package/src/components/feedback/overlay/container/footer/footer.js +0 -47
  215. package/src/components/feedback/overlay/container/header/close-button/close-button.d.ts +0 -11
  216. package/src/components/feedback/overlay/container/header/close-button/close-button.js +0 -34
  217. package/src/components/feedback/overlay/container/header/header.d.ts +0 -12
  218. package/src/components/feedback/overlay/container/header/header.js +0 -25
  219. package/src/components/feedback/overlay/container/header/title/title.d.ts +0 -9
  220. package/src/components/feedback/overlay/container/header/title/title.js +0 -19
  221. package/src/components/feedback/overlay/overlay.abstract.d.ts +0 -13
  222. package/src/components/feedback/overlay/overlay.abstract.js +0 -60
@@ -12,7 +12,7 @@ class TdDescriptionsItem extends ui_abstract_1.UI {
12
12
  // this.label = new TextNode(config.label);
13
13
  // }
14
14
  this.addChild(this.getSlotNode());
15
- this.props = this.setProps(params);
15
+ this.props = this.useParams(params);
16
16
  }
17
17
  }
18
18
  exports.TdDescriptionsItem = TdDescriptionsItem;
@@ -7,11 +7,11 @@ class ImgEmpty extends framework_1.TypeSvgSvg {
7
7
  constructor(params = {}) {
8
8
  super();
9
9
  this.className = 'ImgEmpty';
10
- this.ctrl.addAttrObj({
10
+ this.attr.addObj({
11
11
  name: 'image-empty',
12
12
  viewBox: '0 0 79 86'
13
13
  });
14
- (params === null || params === void 0 ? void 0 : params.styleObj) && this.ctrl.addStyleObj(params.styleObj);
14
+ (params === null || params === void 0 ? void 0 : params.styleObj) && this.style.addObj(params.styleObj);
15
15
  const id = 111;
16
16
  this.addChild(new framework_1.SvgDefs({
17
17
  childNodes: [
@@ -198,7 +198,7 @@ class ImgEmpty extends framework_1.TypeSvgSvg {
198
198
  })
199
199
  ]
200
200
  }));
201
- // this.setProps(params);
201
+ // this.useParams(params);
202
202
  }
203
203
  }
204
204
  exports.ImgEmpty = ImgEmpty;
@@ -11,14 +11,14 @@ class TdEmpty extends ui_abstract_1.UI {
11
11
  var _a, _b;
12
12
  super(params);
13
13
  this.className = 'TdEmpty';
14
- this.ctrl.addAttrName('td-empty');
15
- this.ctrl.addStyleObj(td_empty_style_1.$emptyStyle);
14
+ this.attr.addName('td-empty');
15
+ this.style.addObj(td_empty_style_1.$emptyStyle);
16
16
  this.image = new framework_1.Div({
17
17
  name: 'image',
18
18
  styleObj: td_empty_style_1.$emptyImageStyle
19
19
  });
20
20
  if (params === null || params === void 0 ? void 0 : params.imageSize) {
21
- this.image.ctrl.addStyleObj(this.imageStyle);
21
+ this.image.style.addObj(this.imageStyle);
22
22
  }
23
23
  this.addChild(this.image);
24
24
  if (params === null || params === void 0 ? void 0 : params.image) {
@@ -65,7 +65,7 @@ class TdEmpty extends ui_abstract_1.UI {
65
65
  this.addChild(this.bottom);
66
66
  this.bottom.slotChild(params.slot);
67
67
  }
68
- this.props = this.setProps(params);
68
+ this.props = this.useParams(params);
69
69
  }
70
70
  get emptyDescription() {
71
71
  return this.props.description || 'No Data'; // || t('el.table.emptyText')
@@ -8,11 +8,11 @@ class TdImage extends ui_abstract_1.UI {
8
8
  constructor(params = {}) {
9
9
  super(params);
10
10
  this.className = 'TdImage';
11
- this.ctrl.addAttrName('td-image');
12
- this.ctrl.addAttrObj({
11
+ this.attr.addName('td-image');
12
+ this.attr.addObj({
13
13
  ref: 'container'
14
14
  });
15
- this.ctrl.addStyleObj({
15
+ this.style.addObj({
16
16
  display: 'inline-flex',
17
17
  justifyContent: 'center',
18
18
  alignItems: 'center',
@@ -32,7 +32,7 @@ class TdImage extends ui_abstract_1.UI {
32
32
  });
33
33
  this.hasLoadError = false;
34
34
  // todo preview
35
- this.props = this.setProps(params);
35
+ this.props = this.useParams(params);
36
36
  }
37
37
  setup() {
38
38
  var _a, _b;
@@ -73,10 +73,10 @@ class TdImage extends ui_abstract_1.UI {
73
73
  }
74
74
  }
75
75
  const fit = (props === null || props === void 0 ? void 0 : props.fit) || 'cover';
76
- (_b = this.img) === null || _b === void 0 ? void 0 : _b.ctrl.addStyleObj({
76
+ (_b = this.img) === null || _b === void 0 ? void 0 : _b.style.addObj({
77
77
  objectFit: fit
78
78
  });
79
- super.setProps(props);
79
+ this.useParams(props);
80
80
  }
81
81
  // todo 监听 src 改变
82
82
  setSrc(src) {
@@ -12,8 +12,9 @@ export declare class TdImageViewer extends UI<undefined> implements ITdImageView
12
12
  loading: boolean;
13
13
  private transition;
14
14
  private teleport;
15
+ private wrapper;
15
16
  constructor(params?: ITdImageViewerConfig);
16
- get imgStyle(): IStyle<0 | (string & {}), string & {}>;
17
+ get imgStyle(): IStyle<string | 0, string>;
17
18
  toggleMode(): void;
18
19
  reset(): void;
19
20
  handleActions(action: TdImageViewerAction, options?: {}): void;
@@ -36,15 +36,18 @@ class TdImageViewer extends ui_abstract_1.UI {
36
36
  }
37
37
  };
38
38
  this.mode = this.modes.CONTAIN;
39
- this.transition = new framework_1.Transition();
39
+ this.wrapper = new framework_1.Div();
40
+ this.transition = new framework_1.Transition({
41
+ slot: this.wrapper,
42
+ });
40
43
  this.teleport = new framework_1.Teleport({
41
44
  to: document.body,
42
45
  });
43
46
  this.teleport.addChild(this.transition);
44
47
  // this.mount(document.body);
45
- // this.ctrl.addAttrName('wrapper');
48
+ // this.attr.addName('wrapper');
46
49
  // todo transition 如何设置样式 ??? developing ......
47
- this.transition.ctrl.addStyleObj({
50
+ this.wrapper.style.addObj({
48
51
  position: 'fixed',
49
52
  top: 0,
50
53
  right: 0,
@@ -52,12 +55,12 @@ class TdImageViewer extends ui_abstract_1.UI {
52
55
  left: 0,
53
56
  zIndex: 2000
54
57
  });
55
- this.transition.addChildren(new framework_1.Div({
58
+ this.wrapper.addChildren(new framework_1.Div({
56
59
  name: 'mask',
57
60
  events: {
58
61
  click: (evt, element) => {
59
62
  //
60
- element === null || element === void 0 ? void 0 : element.ctrl.hide();
63
+ element === null || element === void 0 ? void 0 : element.style.hide();
61
64
  }
62
65
  }
63
66
  }),
@@ -69,7 +72,7 @@ class TdImageViewer extends ui_abstract_1.UI {
69
72
  top: '40px', right: '40px', width: '40px', height: '40px', fontSize: '40px' }),
70
73
  events: {
71
74
  click: (evt, element) => {
72
- element === null || element === void 0 ? void 0 : element.ctrl.hide();
75
+ element === null || element === void 0 ? void 0 : element.style.hide();
73
76
  }
74
77
  },
75
78
  childNodes: [
@@ -86,7 +89,7 @@ class TdImageViewer extends ui_abstract_1.UI {
86
89
  this.isSingle = urlList.length <= 1;
87
90
  // <!-- ARROW -->
88
91
  if (!this.isSingle) {
89
- this.transition.addChildren(new framework_1.Span({
92
+ this.wrapper.addChildren(new framework_1.Span({
90
93
  styleObj: Object.assign(Object.assign({}, td_image_viewer_style_1.$btn), td_image_viewer_style_1.$prev),
91
94
  events: {
92
95
  click: () => {
@@ -113,7 +116,7 @@ class TdImageViewer extends ui_abstract_1.UI {
113
116
  }));
114
117
  }
115
118
  // <!-- ACTIONS -->
116
- this.transition.addChild(new framework_1.Div({
119
+ this.wrapper.addChild(new framework_1.Div({
117
120
  styleObj: Object.assign(Object.assign({}, td_image_viewer_style_1.$btn), td_image_viewer_style_1.$actions),
118
121
  childNodes: [
119
122
  new framework_1.Div({
@@ -177,10 +180,10 @@ class TdImageViewer extends ui_abstract_1.UI {
177
180
  styleObj: Object.assign({ display: index === this.activeIndex ? 'block' : 'none' }, this.imgStyle)
178
181
  }));
179
182
  });
180
- this.transition.addChild(new framework_1.Div({
183
+ this.wrapper.addChild(new framework_1.Div({
181
184
  childNodes: imgList
182
185
  }));
183
- this.props = this.setProps(params);
186
+ this.props = this.useParams(params);
184
187
  }
185
188
  get imgStyle() {
186
189
  const { scale, deg, offsetX, offsetY, enableTransition } = this.transform;
@@ -12,8 +12,8 @@ class TdResult extends ui_abstract_1.UI {
12
12
  var _a, _b, _c, _d, _e, _f;
13
13
  super(params);
14
14
  this.className = 'TdResult';
15
- this.ctrl.addAttrName('td-result');
16
- this.ctrl.addStyleObj({
15
+ this.attr.addName('td-result');
16
+ this.style.addObj({
17
17
  display: 'flex',
18
18
  justifyContent: 'center',
19
19
  alignItems: 'center',
@@ -72,7 +72,7 @@ class TdResult extends ui_abstract_1.UI {
72
72
  }));
73
73
  // this.getSlotNode('extra').addSlot(params.slots.extra);
74
74
  }
75
- this.props = this.setProps(params);
75
+ this.props = this.useParams(params);
76
76
  }
77
77
  resultIcon(params) {
78
78
  const icon = params === null || params === void 0 ? void 0 : params.icon;
@@ -10,9 +10,9 @@ class TdSegmented extends ui_abstract_1.UI {
10
10
  super(params);
11
11
  this.className = 'TdSegmented';
12
12
  (0, td_segmented_style_1.useStyle)(params);
13
- this.ctrl.addAttrName('td-segmented');
14
- this.ctrl.addStyleObj(td_segmented_style_1.$segmentedStyle);
15
- this.ctrl.addAttrObj({
13
+ this.attr.addName('td-segmented');
14
+ this.style.addObj(td_segmented_style_1.$segmentedStyle);
15
+ this.attr.addObj({
16
16
  role: 'radiogroup',
17
17
  ariaLabel: 'Segmented',
18
18
  ariaLabelledby: 'Segmented'
@@ -62,7 +62,7 @@ class TdSegmented extends ui_abstract_1.UI {
62
62
  });
63
63
  if (typeof option === 'object' && option.slot) {
64
64
  label.addChild(option.slot);
65
- option.slot.ctrl.addStyleObj({
65
+ option.slot.style.addObj({
66
66
  zIndex: 1 // todo ????? 否则显示不出来
67
67
  });
68
68
  }
@@ -74,7 +74,7 @@ class TdSegmented extends ui_abstract_1.UI {
74
74
  }));
75
75
  }
76
76
  if (this.getDisabled(option)) {
77
- label.ctrl.addStyleObj({
77
+ label.style.addObj({
78
78
  color: td_segmented_style_1.$segmented.itemDisabledColor,
79
79
  cursor: 'not-allowed'
80
80
  });
@@ -82,7 +82,7 @@ class TdSegmented extends ui_abstract_1.UI {
82
82
  labels.push(label);
83
83
  });
84
84
  this.group.addChildren(...labels);
85
- this.props = this.setProps(params);
85
+ this.props = this.useParams(params);
86
86
  }
87
87
  mounted() {
88
88
  console.log('TdSegmented created');
@@ -104,17 +104,16 @@ class TdSegmented extends ui_abstract_1.UI {
104
104
  }
105
105
  getOption(value) {
106
106
  var _a;
107
- return (_a = this.props.options) === null || _a === void 0 ? void 0 : _a.find((item) => this.getValue(item) === value);
107
+ return this.props.options && ((_a = this.props.options) === null || _a === void 0 ? void 0 : _a.find((item) => this.getValue(item) === value));
108
108
  }
109
109
  updateSelect() {
110
110
  console.log('updateSelect');
111
111
  const labels = this.group.findChildNodes('Label');
112
112
  labels.forEach((label, index) => {
113
- var _a, _b, _c;
114
113
  const input = label.findChildNode('Input');
115
- if (((_a = input === null || input === void 0 ? void 0 : input.props.attrObj) === null || _a === void 0 ? void 0 : _a.value) === this.modelValue) {
114
+ if ((input === null || input === void 0 ? void 0 : input.attr.get('value')) === this.modelValue) {
116
115
  const rect = label.dom.getBoundingClientRect();
117
- label.ctrl.setStyleObj({
116
+ label.style.setObj({
118
117
  color: td_segmented_style_1.$segmented.itemSelectedColor
119
118
  });
120
119
  this.state.isInit = true;
@@ -123,18 +122,17 @@ class TdSegmented extends ui_abstract_1.UI {
123
122
  this.state.disabled = this.getDisabled(this.getOption(this.modelValue));
124
123
  }
125
124
  else {
126
- (_b = input === null || input === void 0 ? void 0 : input.props.attrObj) === null || _b === void 0 ? true : delete _b.checked;
127
- (_c = input === null || input === void 0 ? void 0 : input.props.attrObj) === null || _c === void 0 ? true : delete _c.checked;
125
+ input === null || input === void 0 ? void 0 : input.attr.remove('checked');
128
126
  const options = this.props.options || [];
129
127
  if (options[index]) {
130
128
  const disabled = this.getDisabled(options[index]);
131
129
  if (disabled) {
132
- label.ctrl.setStyleObj({
130
+ label.style.setObj({
133
131
  color: td_segmented_style_1.$segmented.itemDisabledColor,
134
132
  });
135
133
  }
136
134
  else {
137
- label.ctrl.setStyleObj({
135
+ label.style.setObj({
138
136
  color: undefined // remove color
139
137
  });
140
138
  }
@@ -146,7 +144,7 @@ class TdSegmented extends ui_abstract_1.UI {
146
144
  transform: `translateX(${this.state.translateX}px)`,
147
145
  display: this.state.isInit ? 'block' : 'none'
148
146
  };
149
- this.selectedDiv.ctrl.setStyleObj(this.selectedStyle);
147
+ this.selectedDiv.style.setObj(this.selectedStyle);
150
148
  }
151
149
  handleChange(item, element) {
152
150
  const value = this.getValue(item);
@@ -154,8 +152,7 @@ class TdSegmented extends ui_abstract_1.UI {
154
152
  this.emit(event_1.CHANGE_EVENT, value);
155
153
  console.log('handleChange ', item);
156
154
  this.modelValue = this.getValue(item);
157
- // element.attrObj?.checked = true;
158
- element.ctrl.addAttribute('checked', true);
155
+ element.attr.add('checked', true);
159
156
  this.updateSelect();
160
157
  // const value = this.getValue(item);
161
158
  // const update = this.props.emits?.[UPDATE_MODEL_EVENT];
@@ -43,7 +43,7 @@ class TdStatisticAbstract extends ui_abstract_1.UI {
43
43
  }
44
44
  });
45
45
  if (params === null || params === void 0 ? void 0 : params.valueStyle) {
46
- this.content.ctrl.addStyleObj(params.valueStyle);
46
+ this.content.style.addObj(params.valueStyle);
47
47
  }
48
48
  this.addChild(this.content);
49
49
  if (params === null || params === void 0 ? void 0 : params.prefix) {
@@ -91,7 +91,7 @@ class TdStatisticAbstract extends ui_abstract_1.UI {
91
91
  this.suffix = params.slots.suffix;
92
92
  this.content.addChild(params.slots.suffix);
93
93
  }
94
- this.props = this.setProps(params);
94
+ this.props = this.useParams(params);
95
95
  }
96
96
  formatValue(value) {
97
97
  const { formatter, precision, decimalSeparator, groupSeparator } = this.props;
@@ -11,7 +11,7 @@ class TdTag extends ui_abstract_1.UI {
11
11
  constructor(params = {}) {
12
12
  super(params, 'span');
13
13
  this.className = 'TdTag';
14
- this.ctrl.addAttrName('td-tag');
14
+ this.attr.addName('td-tag');
15
15
  (0, td_tag_style_1.useType)();
16
16
  const type = (params === null || params === void 0 ? void 0 : params.type) || 'primary';
17
17
  const effect = (params === null || params === void 0 ? void 0 : params.effect) || 'light'; // 默认;
@@ -29,7 +29,7 @@ class TdTag extends ui_abstract_1.UI {
29
29
  console.log('genThem . then $tag is ', td_tag_style_1.$tag);
30
30
  console.log('$tagTypes is ', td_tag_style_1.$tagTypes);
31
31
  }
32
- this.ctrl.addStyleObj({
32
+ this.style.addObj({
33
33
  // background-color: getCssVar('tag-bg-color'),
34
34
  backgroundColor: td_tag_style_1.$tagTypes[type].bgColor,
35
35
  // border-color: getCssVar('tag-border-color'),
@@ -69,25 +69,25 @@ class TdTag extends ui_abstract_1.UI {
69
69
  }
70
70
  // style样式应该在 style类中处理, useConfig useType useSize ....
71
71
  if (params === null || params === void 0 ? void 0 : params.hit) {
72
- this.ctrl.addStyleObj({
72
+ this.style.addObj({
73
73
  borderColor: var_1.$colorPrimary
74
74
  });
75
75
  }
76
76
  if (params === null || params === void 0 ? void 0 : params.round) {
77
- this.ctrl.addStyleObj({
77
+ this.style.addObj({
78
78
  borderRadius: td_tag_style_1.$tag.borderRadiusRounded
79
79
  });
80
80
  }
81
81
  const size = (params === null || params === void 0 ? void 0 : params.size) || 'default';
82
- this.ctrl.addStyleObj(td_tag_style_1.$tagSizes[size]);
82
+ this.style.addObj(td_tag_style_1.$tagSizes[size]);
83
83
  // if (!params?.disableTransitions) { // TODO: 添加过渡
84
84
  // params?.parent?.addChild(new Transition({
85
85
  // childNodes: [this],
86
86
  // }))
87
87
  // }
88
- this.props = this.setProps(params);
88
+ this.props = this.useParams(params);
89
89
  if (params === null || params === void 0 ? void 0 : params.closable) {
90
- this.ctrl.addStyleObj({
90
+ this.style.addObj({
91
91
  paddingRight: parseFloat(td_tag_style_1.$tagIconSpanGap.default) - parseFloat(var_1.$borderWidth) + 'px'
92
92
  });
93
93
  this.closeIcon = new td_icon_class_1.TdIcon({
@@ -110,7 +110,7 @@ class TdTag extends ui_abstract_1.UI {
110
110
  mouseenter: (evt, element) => {
111
111
  // console.log('mouseenter . ');
112
112
  evt === null || evt === void 0 ? void 0 : evt.stopPropagation();
113
- element === null || element === void 0 ? void 0 : element.ctrl.setStyleObj({
113
+ element === null || element === void 0 ? void 0 : element.style.setObj({
114
114
  backgroundColor: td_tag_style_1.$tagTypes[type].hoverColor,
115
115
  color: var_1.$colorWhite
116
116
  });
@@ -118,7 +118,7 @@ class TdTag extends ui_abstract_1.UI {
118
118
  mouseleave: (evt, element) => {
119
119
  // console.log('mouseleave . ');
120
120
  evt === null || evt === void 0 ? void 0 : evt.stopPropagation();
121
- element === null || element === void 0 ? void 0 : element.ctrl.setStyleObj({
121
+ element === null || element === void 0 ? void 0 : element.style.setObj({
122
122
  backgroundColor: td_tag_style_1.$tagTypes[type].bgColor,
123
123
  color: td_tag_style_1.$tagTypes[type].textColor
124
124
  });
@@ -1,5 +1,3 @@
1
- export { Dialog } from './dialog/dialog.class';
2
- export { MessageBox } from './message-box/message-box';
3
1
  export { TdAlert } from './td-alert/td-alert.class';
4
2
  export type * from './td-alert/td-alert.interface';
5
3
  export { TdDialog } from './td-dialog/td-dialog.class';
@@ -11,3 +9,5 @@ export { TdMessageBox } from './td-message-box/td-message-box.class';
11
9
  export type * from './td-message-box/td-message-box.interface';
12
10
  export { TdNotification } from './td-notification/td-notification.class';
13
11
  export type * from './td-notification/td-notification.interface';
12
+ export { TdLoading } from './td-loading/td-loading.class';
13
+ export type * from './td-loading/td-loading.interface';
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
+ // export { Dialog } from './dialog/dialog.class';
3
+ // export { MessageBox } from './message-box/message-box';
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TdNotification = exports.TdMessageBox = exports.TdMessage = exports.TdDialog = exports.TdAlert = exports.MessageBox = exports.Dialog = void 0;
5
+ exports.TdLoading = exports.TdNotification = exports.TdMessageBox = exports.TdMessage = exports.TdDialog = exports.TdAlert = void 0;
4
6
  const tslib_1 = require("tslib");
5
- var dialog_class_1 = require("./dialog/dialog.class");
6
- Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return dialog_class_1.Dialog; } });
7
- var message_box_1 = require("./message-box/message-box");
8
- Object.defineProperty(exports, "MessageBox", { enumerable: true, get: function () { return message_box_1.MessageBox; } });
9
7
  var td_alert_class_1 = require("./td-alert/td-alert.class");
10
8
  Object.defineProperty(exports, "TdAlert", { enumerable: true, get: function () { return td_alert_class_1.TdAlert; } });
11
9
  var td_dialog_class_1 = require("./td-dialog/td-dialog.class");
@@ -18,4 +16,5 @@ Object.defineProperty(exports, "TdMessageBox", { enumerable: true, get: function
18
16
  // export * from './td-message/td-message.style';
19
17
  var td_notification_class_1 = require("./td-notification/td-notification.class");
20
18
  Object.defineProperty(exports, "TdNotification", { enumerable: true, get: function () { return td_notification_class_1.TdNotification; } });
21
- // export { TdMessageBox } from './td-message-box/td-message-box';
19
+ var td_loading_class_1 = require("./td-loading/td-loading.class");
20
+ Object.defineProperty(exports, "TdLoading", { enumerable: true, get: function () { return td_loading_class_1.TdLoading; } });
@@ -10,10 +10,6 @@ class TdAlert extends ui_abstract_1.UI {
10
10
  constructor(params = {}) {
11
11
  super(params, 'fragment');
12
12
  this.className = 'TdAlert';
13
- this.transition = new framework_1.Transition({
14
- name: 'td-alert-fade'
15
- });
16
- this.addChild(this.transition);
17
13
  (0, td_alert_style_1.useStyle)(params);
18
14
  this.alertDiv = new framework_1.Div({
19
15
  attrObj: {
@@ -22,9 +18,13 @@ class TdAlert extends ui_abstract_1.UI {
22
18
  styleObj: td_alert_style_1.$alertStyle,
23
19
  });
24
20
  if (params === null || params === void 0 ? void 0 : params.styleObj) {
25
- this.alertDiv.ctrl.addStyleObj(params.styleObj);
21
+ this.alertDiv.style.addObj(params.styleObj);
26
22
  }
27
- this.transition.addChild(this.alertDiv);
23
+ this.transition = new framework_1.Transition({
24
+ name: 'td-alert-fade',
25
+ slot: this.alertDiv,
26
+ });
27
+ this.addChild(this.transition);
28
28
  const IconComponent = svgs_1.TypeComponentsMap[(params === null || params === void 0 ? void 0 : params.type) || 'info'];
29
29
  if ((params === null || params === void 0 ? void 0 : params.showIcon) && IconComponent) {
30
30
  this.alertDiv.addChild(new td_icon_class_1.TdIcon({
@@ -39,7 +39,7 @@ class TdAlert extends ui_abstract_1.UI {
39
39
  this.addTitle(params);
40
40
  this.addDescription(params);
41
41
  this.addCloseElement(params);
42
- this.props = this.setProps(params);
42
+ this.props = this.useParams(params);
43
43
  }
44
44
  addTitle(params) {
45
45
  var _a, _b;
@@ -85,7 +85,7 @@ class TdAlert extends ui_abstract_1.UI {
85
85
  if ((_a = params.emits) === null || _a === void 0 ? void 0 : _a.close) {
86
86
  params.emits.close();
87
87
  }
88
- this.alertDiv.ctrl.hide();
88
+ this.alertDiv.style.hide();
89
89
  }
90
90
  }
91
91
  }));
@@ -100,7 +100,7 @@ class TdAlert extends ui_abstract_1.UI {
100
100
  if ((_a = params === null || params === void 0 ? void 0 : params.emits) === null || _a === void 0 ? void 0 : _a.close) {
101
101
  params.emits.close();
102
102
  }
103
- this.alertDiv.ctrl.hide();
103
+ this.alertDiv.style.hide();
104
104
  }
105
105
  }
106
106
  }));
@@ -21,7 +21,7 @@ class TdDialog extends ui_abstract_1.UI {
21
21
  slot: this.dialogContent,
22
22
  });
23
23
  if (params === null || params === void 0 ? void 0 : params.appendToBody) {
24
- this.overlay.ctrl.addStyleObj({
24
+ this.overlay.style.addObj({
25
25
  zIndex: td_overlay_class_1.overlayZIndex + 1000,
26
26
  });
27
27
  }
@@ -45,19 +45,19 @@ class TdDialog extends ui_abstract_1.UI {
45
45
  this.beforeLeave();
46
46
  }
47
47
  },
48
- childNodes: [this.overlay],
48
+ slot: this.overlay,
49
49
  }),
50
50
  ]
51
51
  });
52
52
  this.addChild(this.teleport);
53
- this.props = this.setProps(params);
53
+ this.props = this.useParams(params);
54
54
  }
55
55
  show() {
56
56
  console.log('TdDialog . show . ');
57
- this.overlay.ctrl.show();
57
+ this.overlay.style.show();
58
58
  }
59
59
  handleClose() {
60
- this.overlay.ctrl.hide();
60
+ this.overlay.style.hide();
61
61
  // function hide(shouldCancel?: boolean) {
62
62
  // if (shouldCancel) return
63
63
  // // closed.value = true
@@ -11,13 +11,13 @@ class TdDialogContent extends ui_abstract_1.UI {
11
11
  var _a, _b, _c;
12
12
  super(params);
13
13
  this.className = 'TdDialogContent';
14
- this.ctrl.addStyleObj(td_dialog_style_1.$dialogStyle);
14
+ this.style.addObj(td_dialog_style_1.$dialogStyle);
15
15
  this.header = new framework_1.Header({
16
16
  className: 'td-dialog-content',
17
17
  styleObj: td_dialog_style_1.$dialogHeaderStyle,
18
18
  });
19
19
  if (params === null || params === void 0 ? void 0 : params.width) {
20
- this.ctrl.addStyleObj({
20
+ this.style.addObj({
21
21
  width: params.width,
22
22
  });
23
23
  }
@@ -40,7 +40,7 @@ class TdDialogContent extends ui_abstract_1.UI {
40
40
  svgObj: new svgs_1.ElCloseSvg(),
41
41
  });
42
42
  if (showClose) {
43
- this.header.ctrl.addStyleObj(td_dialog_style_1.$dialogHeaderCloseStyle);
43
+ this.header.style.addObj(td_dialog_style_1.$dialogHeaderCloseStyle);
44
44
  this.header.addChild(new framework_1.Button({
45
45
  className: 'td-dialog-close',
46
46
  attrObj: {
@@ -73,7 +73,7 @@ class TdDialogContent extends ui_abstract_1.UI {
73
73
  this.footer.addChild(this.getSlotNode('footer'));
74
74
  this.addChild(this.footer);
75
75
  }
76
- this.props = this.setProps(params);
76
+ this.props = this.useParams(params);
77
77
  }
78
78
  }
79
79
  exports.TdDialogContent = TdDialogContent;
@@ -21,21 +21,19 @@ class TdDrawer extends ui_abstract_1.UI {
21
21
  console.log('beforeEnter');
22
22
  },
23
23
  },
24
- childNodes: [
25
- new td_overlay_class_1.TdOverlay({
26
- mask: params === null || params === void 0 ? void 0 : params.modal,
27
- zIndex: 1000, // todo zIndex
28
- events: {
29
- click: () => {
30
- //
31
- console.log('click . ');
32
- }
24
+ slot: new td_overlay_class_1.TdOverlay({
25
+ mask: params === null || params === void 0 ? void 0 : params.modal,
26
+ zIndex: 1000, // todo zIndex
27
+ events: {
28
+ click: () => {
29
+ //
30
+ console.log('click . ');
33
31
  }
34
- })
35
- ]
32
+ }
33
+ })
36
34
  });
37
35
  this.addChild(this.transition);
38
- this.props = this.setProps(params);
36
+ this.props = this.useParams(params);
39
37
  }
40
38
  }
41
39
  exports.TdDrawer = TdDrawer;
@@ -4,6 +4,24 @@ export declare class TdFocusTrap extends UI<undefined> implements ITdFocusTrap {
4
4
  className: 'TdFocusTrap';
5
5
  props: ITdFocusTrapConfig;
6
6
  inheritAttrs: boolean;
7
+ forwardRef?: HTMLElement;
8
+ lastFocusBeforeTrapped?: HTMLElement;
9
+ lastFocusAfterTrapped?: HTMLElement;
10
+ handelKeydown?: (e: KeyboardEvent) => void;
11
+ private escapeKeydown?;
12
+ private focusLayer?;
13
+ private focusReason?;
7
14
  constructor(params?: ITdFocusTrapConfig);
8
- initEvents(): void;
15
+ setup(): void;
16
+ mounted(): void;
17
+ beforeDestroy(): void;
18
+ onKeydown(e: KeyboardEvent): void;
19
+ setFocusTrapEl(el: HTMLElement): void;
20
+ setForwardRef(newEl: HTMLElement, oldEl: HTMLElement): void;
21
+ trapOnFocus(e: Event): void;
22
+ releaseOnFocus(e: Event): void;
23
+ onFocusIn(e: FocusEvent): void;
24
+ onFocusOut(e: Event): void;
25
+ startTrap(): Promise<void>;
26
+ stopTrap(): void;
9
27
  }