@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
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TdTabNav = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const utils_1 = require("@type-dom/utils");
5
6
  const framework_1 = require("@type-dom/framework");
6
7
  const svgs_1 = require("@type-dom/svgs");
7
- const utils_1 = require("@type-dom/utils");
8
8
  const ui_abstract_1 = require("../../../ui/ui.abstract");
9
9
  const var_1 = require("../../../styles/var");
10
- const aria_1 = require("../../../aria");
11
10
  const td_tabs_style_1 = require("./td-tabs.style");
12
11
  const td_tab_bar_class_1 = require("./td-tab-bar.class");
13
12
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
@@ -17,8 +16,8 @@ class TdTabNav extends ui_abstract_1.UI {
17
16
  super(params);
18
17
  this.tabs = [];
19
18
  this.className = 'TdTabNav';
20
- this.ctrl.addAttrName('td-tab-nav-wrap');
21
- this.ctrl.addStyleObj(td_tabs_style_1.$tabsNavWrapStyle);
19
+ this.attr.addName('td-tab-nav-wrap');
20
+ this.style.addObj(td_tabs_style_1.$tabsNavWrapStyle);
22
21
  this.addChild(new framework_1.U({
23
22
  name: 'underline',
24
23
  styleObj: td_tabs_style_1.$tabsNavWrapAfterStyle,
@@ -134,6 +133,8 @@ class TdTabNav extends ui_abstract_1.UI {
134
133
  this.removeFocus();
135
134
  // this.rootTabs.currentName = tabName;
136
135
  (_b = (_a = params.emits) === null || _a === void 0 ? void 0 : _a.tabClick) === null || _b === void 0 ? void 0 : _b.call(_a, pane, tabName, evt);
136
+ // tabClick是上级 tabs 的事件监听器,不是tabNav的;
137
+ // this.emit('tabClick', pane, tabName, evt);
137
138
  (0, framework_1.nextTick)(() => {
138
139
  this.selectTab(ele);
139
140
  });
@@ -141,21 +142,20 @@ class TdTabNav extends ui_abstract_1.UI {
141
142
  keydown: (ev) => {
142
143
  var _a, _b;
143
144
  if (closable &&
144
- (ev.code === aria_1.EVENT_CODE.delete ||
145
- ev.code === aria_1.EVENT_CODE.backspace)) {
146
- // emit('tabRemove', pane, ev)
145
+ ((ev === null || ev === void 0 ? void 0 : ev.code) === utils_1.EVENT_CODE.delete || (ev === null || ev === void 0 ? void 0 : ev.code) === utils_1.EVENT_CODE.backspace)) {
146
+ // emit('tabRemove', pane, ev);
147
147
  (_b = (_a = params.emits) === null || _a === void 0 ? void 0 : _a.tabRemove) === null || _b === void 0 ? void 0 : _b.call(_a, pane, ev);
148
148
  }
149
149
  },
150
150
  },
151
151
  });
152
152
  if (tabName === ((_d = this.rootTabs) === null || _d === void 0 ? void 0 : _d.currentName)) {
153
- item.ctrl.addStyleObj({
153
+ item.style.addObj({
154
154
  color: var_1.$colors.primary.base,
155
155
  });
156
156
  }
157
157
  else {
158
- item.ctrl.addStyleObj({
158
+ item.style.addObj({
159
159
  color: var_1.$textColor.regular,
160
160
  });
161
161
  }
@@ -187,8 +187,8 @@ class TdTabNav extends ui_abstract_1.UI {
187
187
  })) || [];
188
188
  console.log('this.tabs is ', this.tabs);
189
189
  this.nav.addChildren(...this.tabs);
190
- this.nav.ctrl.addStyleObj(this.navStyle);
191
- this.props = this.setProps(params);
190
+ this.nav.style.addObj(this.navStyle);
191
+ this.props = this.useParams(params);
192
192
  }
193
193
  mounted() {
194
194
  setTimeout(() => this.scrollToActiveTab(), 0);
@@ -300,12 +300,12 @@ class TdTabNav extends ui_abstract_1.UI {
300
300
  (_a = this.tabBar) === null || _a === void 0 ? void 0 : _a.change();
301
301
  this.tabs.forEach((tab) => {
302
302
  if (item === tab) {
303
- tab.ctrl.setStyleObj({
303
+ tab.style.setObj({
304
304
  color: var_1.$colors.primary.base,
305
305
  });
306
306
  }
307
307
  else {
308
- tab.ctrl.setStyleObj({
308
+ tab.style.setObj({
309
309
  color: var_1.$textColor.regular,
310
310
  });
311
311
  }
@@ -313,7 +313,7 @@ class TdTabNav extends ui_abstract_1.UI {
313
313
  }
314
314
  changeTab(e) {
315
315
  const code = e.code;
316
- const { up, down, left, right } = aria_1.EVENT_CODE;
316
+ const { up, down, left, right } = utils_1.EVENT_CODE;
317
317
  if (![up, down, left, right].includes(code))
318
318
  return;
319
319
  // 左右上下键更换tab
@@ -26,15 +26,15 @@ class TdTabPane extends ui_abstract_1.UI {
26
26
  }
27
27
  this.addChild(this.panel);
28
28
  }
29
- this.props = this.setProps(params);
29
+ this.props = this.useParams(params);
30
30
  }
31
31
  setActive(active) {
32
32
  var _a, _b;
33
33
  if (active) {
34
- (_a = this.panel) === null || _a === void 0 ? void 0 : _a.ctrl.show();
34
+ (_a = this.panel) === null || _a === void 0 ? void 0 : _a.style.show();
35
35
  }
36
36
  else {
37
- (_b = this.panel) === null || _b === void 0 ? void 0 : _b.ctrl.hide();
37
+ (_b = this.panel) === null || _b === void 0 ? void 0 : _b.style.hide();
38
38
  }
39
39
  }
40
40
  }
@@ -16,8 +16,8 @@ class TdTabs extends ui_abstract_1.UI {
16
16
  var _a, _b;
17
17
  super(params);
18
18
  this.className = 'TdTabs';
19
- this.ctrl.addAttrName('td-tabs');
20
- // this.ctrl.addStyleObj($tabsStyle);
19
+ this.attr.addName('td-tabs');
20
+ // this.style.addObj($tabsStyle);
21
21
  this.currentName = (params === null || params === void 0 ? void 0 : params.modelValue) || '';
22
22
  this.header = new framework_1.Div({
23
23
  className: 'header',
@@ -28,7 +28,7 @@ class TdTabs extends ui_abstract_1.UI {
28
28
  const tabPosition = (params === null || params === void 0 ? void 0 : params.tabPosition) || 'top';
29
29
  const isVertical = ['left', 'right'].includes(tabPosition);
30
30
  if (isVertical) {
31
- this.header.ctrl.addStyleObj(td_tabs_style_1.$tabsHeaderVerticalStyle);
31
+ this.header.style.addObj(td_tabs_style_1.$tabsHeaderVerticalStyle);
32
32
  }
33
33
  if ((params === null || params === void 0 ? void 0 : params.editable) || (params === null || params === void 0 ? void 0 : params.addable)) {
34
34
  this.newBtn = new framework_1.Span({
@@ -92,7 +92,7 @@ class TdTabs extends ui_abstract_1.UI {
92
92
  else {
93
93
  this.childNodes = [this.panel, this.header];
94
94
  }
95
- this.props = this.setProps(params);
95
+ this.props = this.useParams(params);
96
96
  }
97
97
  setCurrentName(value_1) {
98
98
  return tslib_1.__awaiter(this, arguments, void 0, function* (value, trigger = false) {
@@ -11,14 +11,14 @@ class CollapsibleBox extends framework_1.TypeDiv {
11
11
  constructor() {
12
12
  super();
13
13
  this.className = 'CollapsibleBox';
14
- this.ctrl.addStyleObj({
14
+ this.style.addObj({
15
15
  // borderTop: '1px solid #dddddd',
16
16
  // borderBottom: '1px solid #dddddd',
17
17
  listStyle: 'none',
18
18
  padding: '3px',
19
19
  marginBottom: '5px'
20
20
  });
21
- this.ctrl.addAttrName('collapsible-box');
21
+ this.attr.addName('collapsible-box');
22
22
  this.heading = new expand_heading_1.ExpandHeading('标题');
23
23
  this.heading.parent = this;
24
24
  this.contents = new contents_1.CollapsibleBoxContents();
@@ -7,14 +7,14 @@ class CollapsibleBoxContents extends framework_1.TypeDiv {
7
7
  constructor() {
8
8
  super();
9
9
  this.className = 'CollapsibleBoxContents';
10
- this.ctrl.addStyleObj({
10
+ this.style.addObj({
11
11
  display: 'flex',
12
12
  flexWrap: 'wrap',
13
13
  justifyContent: 'flex-start',
14
14
  // width: '194px',
15
15
  border: '1px solid #a0a0a0'
16
16
  });
17
- this.ctrl.addAttrName('collapsible-box-contents');
17
+ this.attr.addName('collapsible-box-contents');
18
18
  this.childNodes = [];
19
19
  }
20
20
  }
@@ -7,5 +7,5 @@ export declare class ExpandHeading extends TypeDiv {
7
7
  title: TextNode;
8
8
  constructor(title: string);
9
9
  setTitle(title: string): void;
10
- initEvents(): void;
10
+ setup(): void;
11
11
  }
@@ -7,7 +7,7 @@ class ExpandHeading extends framework_1.TypeDiv {
7
7
  constructor(title) {
8
8
  super();
9
9
  this.className = 'ExpandHeading';
10
- this.ctrl.addStyleObj({
10
+ this.style.addObj({
11
11
  margin: '0',
12
12
  paddingLeft: '10px',
13
13
  boxSizing: 'border-box',
@@ -20,7 +20,7 @@ class ExpandHeading extends framework_1.TypeDiv {
20
20
  alignItems: 'center',
21
21
  height: '36px'
22
22
  });
23
- this.ctrl.addAttrName('expand-heading');
23
+ this.attr.addName('expand-heading');
24
24
  this.svg = new svgs_1.ElCaretBottomSvg({
25
25
  attrObj: {
26
26
  fill: '#FFF'
@@ -37,31 +37,31 @@ class ExpandHeading extends framework_1.TypeDiv {
37
37
  setTitle(title) {
38
38
  this.title.setText(title);
39
39
  }
40
- initEvents() {
40
+ setup() {
41
41
  this.svg.addEvents({
42
42
  click: (e) => {
43
- var _a, _b, _c;
43
+ var _a, _b;
44
44
  console.log('expand-heading svg.dom clicked');
45
45
  e === null || e === void 0 ? void 0 : e.stopPropagation();
46
46
  // const style = getComputedStyle(this.svg.dom);
47
47
  // console.log('style.transform is ', style.transform);
48
- if (((_a = this.svg.props.styleObj) === null || _a === void 0 ? void 0 : _a.transform) === 'rotate(-90deg)') {
49
- this.svg.ctrl.setStyleObj({
48
+ if (this.svg.style.get('transform') === 'rotate(-90deg)') {
49
+ this.svg.style.setObj({
50
50
  transform: 'rotate(0deg)',
51
51
  transition: 'transform 0.3s'
52
52
  });
53
53
  // console.log('style.transform is ', style.transform);
54
- if (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.lastChild) instanceof framework_1.TypeHtml) {
55
- this.parent.lastChild.ctrl.setStyle('display', 'flex'); // flex
54
+ if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.lastChild) instanceof framework_1.TypeHtml) {
55
+ this.parent.lastChild.style.set('display', 'flex'); // flex
56
56
  }
57
57
  }
58
58
  else {
59
- this.svg.ctrl.setStyleObj({
59
+ this.svg.style.setObj({
60
60
  transform: 'rotate(-90deg)',
61
61
  transition: 'transform 0.3s'
62
62
  });
63
- if (((_c = this.parent) === null || _c === void 0 ? void 0 : _c.lastChild) instanceof framework_1.TypeHtml) {
64
- this.parent.lastChild.ctrl.setStyle('display', 'none');
63
+ if (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.lastChild) instanceof framework_1.TypeHtml) {
64
+ this.parent.lastChild.style.set('display', 'none');
65
65
  }
66
66
  }
67
67
  }
@@ -7,10 +7,10 @@ class CustomBlock extends framework_1.TypeDiv {
7
7
  constructor(params) {
8
8
  super();
9
9
  this.className = 'CustomBlock';
10
- this.ctrl.addAttrName('tip');
10
+ this.attr.addName('tip');
11
11
  const bgColor = params.type === 'warning' ? var_1.$colorDangerRgb : var_1.$colorPrimaryRgb;
12
12
  const borderLeftColor = params.type === 'warning' ? var_1.$colors.danger.base : var_1.$colors.primary.base;
13
- this.ctrl.addStyleObj({
13
+ this.style.addObj({
14
14
  padding: '8px 16px',
15
15
  // background-color: var(--block-tip-bg-color),
16
16
  backgroundColor: 'rgba(' + bgColor + ', 0.1)',
@@ -4,5 +4,5 @@ export declare class ExampleFloatControl extends TypeDiv {
4
4
  className: 'ExampleFloatControl';
5
5
  parent: Example;
6
6
  constructor(params: ITypeConfig);
7
- initEvents(): void;
7
+ setup(): void;
8
8
  }
@@ -2,19 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExampleFloatControl = void 0;
4
4
  const framework_1 = require("@type-dom/framework");
5
- const var_1 = require("../../../styles/var");
6
5
  const svgs_1 = require("@type-dom/svgs");
6
+ const var_1 = require("../../../styles/var");
7
7
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
8
8
  class ExampleFloatControl extends framework_1.TypeDiv {
9
9
  constructor(params) {
10
10
  super();
11
11
  this.className = 'ExampleFloatControl';
12
- this.ctrl.addAttrName('example-float-control');
13
- this.ctrl.addAttrObj({
12
+ this.attr.addName('example-float-control');
13
+ this.attr.addObj({
14
14
  role: 'button',
15
15
  tabIndex: 0
16
16
  });
17
- this.ctrl.addStyleObj({
17
+ this.style.addObj({
18
18
  display: 'flex',
19
19
  alignItems: 'center',
20
20
  justifyContent: 'center',
@@ -48,14 +48,14 @@ class ExampleFloatControl extends framework_1.TypeDiv {
48
48
  marginLeft: '10px'
49
49
  }
50
50
  }));
51
- this.setProps(params);
51
+ this.useParams(params);
52
52
  }
53
- initEvents() {
53
+ setup() {
54
54
  this.addEvents({
55
55
  click: () => {
56
56
  // 隐藏 代码
57
- this.ctrl.hide();
58
- this.parent.sourceWrapper.ctrl.hide();
57
+ this.style.hide();
58
+ this.parent.sourceWrapper.style.hide();
59
59
  }
60
60
  });
61
61
  }
@@ -7,14 +7,14 @@ class ExampleShowcase extends framework_1.TypeDiv {
7
7
  constructor(params) {
8
8
  super();
9
9
  this.className = 'ExampleShowcase';
10
- this.ctrl.addAttrName('example-showcase');
11
- this.ctrl.addStyleObj({
10
+ this.attr.addName('example-showcase');
11
+ this.style.addObj({
12
12
  padding: '1.5rem',
13
13
  margin: '.5px',
14
14
  // background-color: var(--bg-color),
15
15
  backgroundColor: var_1.$bgColor.default
16
16
  });
17
- this.setProps(params);
17
+ this.useParams(params);
18
18
  }
19
19
  }
20
20
  exports.ExampleShowcase = ExampleShowcase;
@@ -1,5 +1,9 @@
1
- import { ITypeConfig, TypeDiv } from '@type-dom/framework';
1
+ import { IJsonData, ITypeConfig, TypeDiv, XProxy } from '@type-dom/framework';
2
+ export interface IExampleSourceWrapperConfig extends ITypeConfig {
3
+ sourceWrapper: string | XProxy<IJsonData>;
4
+ }
2
5
  export declare class ExampleSourceWrapper extends TypeDiv {
3
6
  className: 'ExampleSourceWrapper';
4
- constructor(params: ITypeConfig);
7
+ props: IExampleSourceWrapperConfig;
8
+ constructor(params: IExampleSourceWrapperConfig);
5
9
  }
@@ -8,8 +8,8 @@ class ExampleSourceWrapper extends framework_1.TypeDiv {
8
8
  var _a;
9
9
  super();
10
10
  this.className = 'ExampleSourceWrapper';
11
- this.ctrl.addAttrName('example-source-wrapper');
12
- this.ctrl.addStyleObj({
11
+ this.attr.addName('example-source-wrapper');
12
+ this.style.addObj({
13
13
  // background-color: var(--code-bg-color),
14
14
  backgroundColor: styles_1.$fillColor.light,
15
15
  overflowX: 'auto'
@@ -24,7 +24,7 @@ class ExampleSourceWrapper extends framework_1.TypeDiv {
24
24
  // if (params?.slot) {
25
25
  // this.slotChild(params.slot);
26
26
  // }
27
- this.setProps(params);
27
+ this.props = this.useParams(params);
28
28
  }
29
29
  }
30
30
  exports.ExampleSourceWrapper = ExampleSourceWrapper;
@@ -1,7 +1,7 @@
1
1
  import { IJsonData, ITypeConfig, TypeDiv, TypeElement, XProxy } from '@type-dom/framework';
2
2
  import { ExampleSourceWrapper } from './example-source-wrapper';
3
3
  import { ExampleFloatControl } from './example-float-control';
4
- interface IExampleConfig extends ITypeConfig {
4
+ export interface IExampleConfig extends ITypeConfig {
5
5
  showcase: TypeElement[];
6
6
  sourceWrapper: string | XProxy<IJsonData>;
7
7
  }
@@ -12,4 +12,3 @@ export declare class Example extends TypeDiv {
12
12
  props: IExampleConfig;
13
13
  constructor(params: IExampleConfig);
14
14
  }
15
- export {};
@@ -3,18 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Example = void 0;
4
4
  const framework_1 = require("@type-dom/framework");
5
5
  const var_1 = require("../../../styles/var");
6
+ const td_divider_class_1 = require("../td-divider/td-divider.class");
6
7
  const example_showcase_1 = require("./example-showcase");
7
8
  const example_source_wrapper_1 = require("./example-source-wrapper");
8
9
  const op_btns_1 = require("./op-btns");
9
10
  const example_float_control_1 = require("./example-float-control");
10
- const td_divider_class_1 = require("../td-divider/td-divider.class");
11
11
  // todo slots 改造
12
12
  class Example extends framework_1.TypeDiv {
13
13
  constructor(params) {
14
14
  super();
15
15
  this.className = 'Example';
16
- this.ctrl.addAttrName('example');
17
- this.ctrl.addStyleObj({
16
+ this.attr.addName('example');
17
+ this.style.addObj({
18
18
  // border: '1px solid 'var(--border-color),
19
19
  border: '1px solid ' + var_1.$borderColor.base,
20
20
  // border-radius: var(--el-border-radius-base);
@@ -71,7 +71,7 @@ class Example extends framework_1.TypeDiv {
71
71
  }
72
72
  });
73
73
  this.addChild(this.floatControl);
74
- this.props = this.setProps(params);
74
+ this.props = this.useParams(params);
75
75
  }
76
76
  }
77
77
  exports.Example = Example;
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpBtns = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const framework_1 = require("@type-dom/framework");
6
+ const svgs_1 = require("@type-dom/svgs");
6
7
  const var_1 = require("../../../styles/var");
7
8
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
8
- const svgs_1 = require("@type-dom/svgs");
9
9
  class OpBtns extends framework_1.TypeDiv {
10
10
  constructor(params) {
11
11
  super();
12
12
  this.className = 'OpBtns';
13
13
  this.parent = params.parent;
14
- this.ctrl.addAttrName('op-btns');
15
- this.ctrl.addStyleObj({
14
+ this.attr.addName('op-btns');
15
+ this.style.addObj({
16
16
  padding: '.5rem',
17
17
  display: 'flex',
18
18
  alignItems: 'center',
@@ -78,19 +78,18 @@ class OpBtns extends framework_1.TypeDiv {
78
78
  svgObj: new svgs_1.TdViewCodeSvg(),
79
79
  events: {
80
80
  click: () => {
81
- var _a;
82
- if (((_a = this.parent.sourceWrapper.props.styleObj) === null || _a === void 0 ? void 0 : _a.display) === 'none') {
83
- this.parent.sourceWrapper.ctrl.show();
84
- this.parent.floatControl.ctrl.show('flex');
81
+ if (this.parent.sourceWrapper.style.get('display') === 'none') {
82
+ this.parent.sourceWrapper.style.show();
83
+ this.parent.floatControl.style.show('flex');
85
84
  }
86
85
  else {
87
- this.parent.sourceWrapper.ctrl.hide();
88
- this.parent.floatControl.ctrl.hide();
86
+ this.parent.sourceWrapper.style.hide();
87
+ this.parent.floatControl.style.hide();
89
88
  }
90
89
  }
91
90
  }
92
91
  }));
93
- this.setProps(params);
92
+ this.useParams(params);
94
93
  }
95
94
  }
96
95
  exports.OpBtns = OpBtns;
@@ -1,16 +1,21 @@
1
- import { Div, TypeMenu, type IRoute, Router } from '@type-dom/framework';
1
+ import { Div, TypeMenu, type IRoute, Router, ITypeConfig } from '@type-dom/framework';
2
2
  import { TdIcon } from '../../basic/td-icon/td-icon.class';
3
3
  import { Menus } from './menus';
4
+ export interface IMenuConfig extends ITypeConfig {
5
+ route: IRoute;
6
+ router?: Router;
7
+ width?: string;
8
+ }
4
9
  export declare class Menu extends TypeMenu {
5
10
  className: 'Menu';
6
- route: IRoute;
7
- router: Router;
11
+ route?: IRoute;
12
+ router?: Router;
8
13
  parent?: Menu | Menus;
9
14
  contentItem: Div;
10
15
  menuItems: Menu[];
11
16
  collapsed?: boolean;
12
17
  caret?: TdIcon;
13
- constructor(route: IRoute, router: Router);
18
+ constructor(params: IMenuConfig);
14
19
  get menuRoot(): Menus | undefined;
15
- initEvents(): void;
20
+ setup(): void;
16
21
  }
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Menu = void 0;
4
- const rxjs_1 = require("rxjs");
5
4
  const framework_1 = require("@type-dom/framework");
6
5
  const svgs_1 = require("@type-dom/svgs");
7
6
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
8
7
  class Menu extends framework_1.TypeMenu {
9
- constructor(route, router) {
8
+ constructor(params) {
9
+ var _a;
10
+ console.log('Menu constructor . ');
10
11
  super();
11
12
  this.className = 'Menu';
12
- this.route = route;
13
- this.router = router;
14
- this.ctrl.addStyleObj({
13
+ this.route = params.route;
14
+ this.router = params.router;
15
+ this.style.addObj({
15
16
  paddingInlineStart: '20px'
16
17
  // display: 'flex',
17
18
  // flexDirection: 'column',
@@ -23,27 +24,27 @@ class Menu extends framework_1.TypeMenu {
23
24
  alignItems: 'center'
24
25
  }
25
26
  });
26
- if (route.svgObj) {
27
+ if (this.route.svgObj) {
27
28
  div.addChild(new td_icon_class_1.TdIcon({
28
- svgObj: route.svgObj,
29
+ svgObj: this.route.svgObj,
29
30
  styleObj: {
30
31
  paddingRight: '5px'
31
32
  }
32
33
  }));
33
34
  }
34
35
  div.addChild(new framework_1.Div({
35
- text: route.name,
36
+ text: this.route.name,
36
37
  attrObj: {
37
38
  name: 'route-name'
38
39
  },
39
40
  styleObj: {
40
- width: '160px'
41
+ width: (_a = params.width) !== null && _a !== void 0 ? _a : '160px'
41
42
  }
42
43
  }));
43
- if (route.children) {
44
+ if (this.route.children) {
44
45
  const caret = new td_icon_class_1.TdIcon({
45
46
  svgObj: new svgs_1.ElCaretBottomSvg(),
46
- size: '30px'
47
+ // size: '30px'
47
48
  });
48
49
  caret.appendParent(div);
49
50
  this.caret = caret;
@@ -51,29 +52,29 @@ class Menu extends framework_1.TypeMenu {
51
52
  div.appendParent(this);
52
53
  this.contentItem = div;
53
54
  this.menuItems = [];
55
+ this.useParams(params);
54
56
  }
55
57
  get menuRoot() {
56
58
  var _a;
57
59
  return (_a = this.parent) === null || _a === void 0 ? void 0 : _a.menuRoot;
58
60
  }
59
- initEvents() {
60
- if (this.route.redirect === undefined) {
61
+ setup() {
62
+ var _a;
63
+ if (((_a = this.route) === null || _a === void 0 ? void 0 : _a.redirect) === undefined) {
61
64
  // todo addEvent 如何pipe ??
62
- (0, rxjs_1.fromEvent)(this.contentItem.dom, 'click')
63
- .pipe((0, rxjs_1.filter)(() => {
64
- var _a;
65
- return ((_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.selectedMenu) !== this;
66
- }))
67
- .subscribe((event) => {
68
- var _a;
69
- // if (this.menuRoot.selectedMenu === this) {
70
- // return;
71
- // }
72
- this.router.push(this.route.path);
73
- (_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.setSelectedMenu(this);
74
- document.title = 'UI - ' + this.route.name;
75
- event.stopPropagation(); // 防止冒泡
76
- event.preventDefault();
65
+ this.contentItem.addEvents({
66
+ click: (event) => {
67
+ var _a, _b, _c, _d;
68
+ console.log('click . ');
69
+ if (((_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.selectedMenu) === this) {
70
+ return;
71
+ }
72
+ (_b = this.router) === null || _b === void 0 ? void 0 : _b.push(this.route.path);
73
+ (_c = this.menuRoot) === null || _c === void 0 ? void 0 : _c.setSelectedMenu(this);
74
+ document.title = 'UI - ' + ((_d = this.route) === null || _d === void 0 ? void 0 : _d.name);
75
+ event === null || event === void 0 ? void 0 : event.stopPropagation(); // 防止冒泡
76
+ event === null || event === void 0 ? void 0 : event.preventDefault();
77
+ }
77
78
  });
78
79
  }
79
80
  else {
@@ -81,25 +82,26 @@ class Menu extends framework_1.TypeMenu {
81
82
  const leftSvg = new svgs_1.ElCaretLeftSvg();
82
83
  // console.log(' leftSvg.resetSize ');
83
84
  // leftSvg.resetSize('1.5em', '1.5em');
84
- // leftSvg.ctrl.setStyleObj({
85
+ // leftSvg.style.setObj({
85
86
  // width: '1.5em',
86
87
  // height: '1.5em'
87
88
  // })
88
89
  const bottomSvg = new svgs_1.ElCaretBottomSvg();
89
- // bottomSvg.ctrl.setStyleObj({
90
+ // bottomSvg.style.setObj({
90
91
  // width: '1.5em',
91
92
  // height: '1.5em'
92
93
  // })
93
94
  // bottomSvg.resetSize('1.5em', '1.5em');
94
- this.addEvent('click', this.contentItem.dom, (event) => {
95
+ this.contentItem.addEvent('click', (event) => {
95
96
  var _a, _b, _c;
97
+ console.log('click .');
96
98
  if (((_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.selectedMenu) === this) {
97
99
  return;
98
100
  }
99
101
  if (this.collapsed === undefined || this.collapsed === false) {
100
102
  this.collapsed = true;
101
103
  this.menuItems.forEach((menu) => {
102
- menu.ctrl.setStyleObj({
104
+ menu.style.setObj({
103
105
  display: 'none'
104
106
  });
105
107
  });
@@ -108,7 +110,7 @@ class Menu extends framework_1.TypeMenu {
108
110
  else {
109
111
  this.collapsed = false;
110
112
  this.menuItems.forEach((menu) => {
111
- menu.ctrl.setStyleObj({
113
+ menu.style.setObj({
112
114
  display: 'block'
113
115
  });
114
116
  });
@@ -1,10 +1,15 @@
1
1
  import { IRoute, ITypeConfig, Router, TypeDiv } from '@type-dom/framework';
2
2
  import { Menu } from './menu';
3
+ export interface IMenusConfig extends ITypeConfig {
4
+ router?: Router;
5
+ }
3
6
  export declare class Menus extends TypeDiv {
4
7
  className: 'Menus';
5
8
  selectedMenu?: Menu;
6
- constructor(params?: ITypeConfig);
9
+ private router?;
10
+ constructor(params?: IMenusConfig);
7
11
  get menuRoot(): Menus;
12
+ mounted(): void;
8
13
  createMenus(parent: Menus | Menu, routes: IRoute[], router: Router): void;
9
14
  setSelectedMenu(menu: Menu): void;
10
15
  }