@type-dom/ui 0.0.6 → 0.0.8

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 (149) hide show
  1. package/README.md +44 -44
  2. package/package.json +1 -1
  3. package/src/components/basic/td-button/td-button.abstract.js +3 -3
  4. package/src/components/basic/td-button/td-button.class.js +1 -1
  5. package/src/components/basic/td-button-group/td-button-group.class.js +1 -1
  6. package/src/components/basic/td-container/td-aside/td-aside.class.js +2 -2
  7. package/src/components/basic/td-container/td-container.class.js +2 -2
  8. package/src/components/basic/td-container/td-footer/td-footer.class.js +3 -3
  9. package/src/components/basic/td-container/td-header/td-header.class.js +6 -6
  10. package/src/components/basic/td-container/td-main/td-main.class.js +2 -2
  11. package/src/components/basic/td-icon/td-icon.class.js +13 -13
  12. package/src/components/basic/td-layout/td-col/td-col.class.js +4 -4
  13. package/src/components/basic/td-layout/td-row/td-row.class.js +2 -2
  14. package/src/components/basic/td-link/td-link.class.js +1 -1
  15. package/src/components/basic/td-scrollbar/bar/bar.class.js +2 -2
  16. package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +1 -1
  17. package/src/components/basic/td-scrollbar/td-scrollbar.class.js +2 -2
  18. package/src/components/basic/td-scrollbar/thumb/thumb.class.js +2 -2
  19. package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +1 -1
  20. package/src/components/basic/td-space/td-space.class.js +2 -2
  21. package/src/components/basic/td-text/td-text.class.js +2 -2
  22. package/src/components/data/td-avatar/td-avatar.class.js +3 -3
  23. package/src/components/data/td-badge/td-badge.class.d.ts +1 -0
  24. package/src/components/data/td-badge/td-badge.class.js +10 -7
  25. package/src/components/data/td-card/td-card.class.js +2 -2
  26. package/src/components/data/td-check-tag/td-check-tag.class.js +2 -2
  27. package/src/components/data/td-collapse/td-collapse.class.js +2 -5
  28. package/src/components/data/td-collapse/td-collapse.interface.d.ts +1 -0
  29. package/src/components/data/td-collapse-item/td-collapse-item.class.js +3 -3
  30. package/src/components/data/td-collapse-transition/td-collapse-transition.class.js +1 -1
  31. package/src/components/data/td-count-down/td-count-down.class.js +2 -4
  32. package/src/components/data/td-descriptions/td-descriptions-row.d.ts +1 -1
  33. package/src/components/data/td-descriptions/td-descriptions-row.js +3 -3
  34. package/src/components/data/td-descriptions/td-descriptions.class.js +2 -2
  35. package/src/components/data/td-descriptions/td-descritions-cell.js +2 -2
  36. package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +3 -5
  37. package/src/components/data/td-empty/img-empty.class.js +2 -2
  38. package/src/components/data/td-empty/td-empty.class.js +2 -2
  39. package/src/components/data/td-image/td-image.class.js +3 -3
  40. package/src/components/data/td-image-viewer/td-image-viewer.class.js +3 -2
  41. package/src/components/data/td-result/td-result.class.js +5 -9
  42. package/src/components/data/td-segmented/td-segmented.class.js +14 -15
  43. package/src/components/data/td-statistic/td-statistic.abstract.d.ts +1 -1
  44. package/src/components/data/td-statistic/td-statistic.abstract.js +2 -2
  45. package/src/components/data/td-tag/td-tag.class.js +3 -3
  46. package/src/components/feedback/dialog/dialog.class.js +2 -2
  47. package/src/components/feedback/message-box/message-box.js +2 -2
  48. package/src/components/feedback/overlay/container/container.js +5 -4
  49. package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +6 -5
  50. package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +6 -5
  51. package/src/components/feedback/overlay/container/header/close-button/close-button.js +6 -5
  52. package/src/components/feedback/overlay/overlay.abstract.js +5 -4
  53. package/src/components/feedback/td-alert/td-alert.class.js +2 -2
  54. package/src/components/feedback/td-dialog/td-dialog.class.d.ts +3 -0
  55. package/src/components/feedback/td-dialog/td-dialog.class.js +20 -3
  56. package/src/components/feedback/td-dialog/td-dialog.interface.d.ts +19 -0
  57. package/src/components/feedback/td-dialog/td-dialog.interface.js +12 -0
  58. package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +2 -2
  59. package/src/components/feedback/td-drawer/td-drawer.class.js +13 -11
  60. package/src/components/feedback/td-drawer/td-drawer.interface.d.ts +5 -5
  61. package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +2 -2
  62. package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +5 -5
  63. package/src/components/feedback/td-focus-trap/utils.d.ts +1 -1
  64. package/src/components/feedback/td-loading/td-loading.class.js +2 -2
  65. package/src/components/feedback/td-message/td-message.class.d.ts +1 -0
  66. package/src/components/feedback/td-message/td-message.class.js +19 -12
  67. package/src/components/feedback/td-message-box/td-message-box.class.js +3 -4
  68. package/src/components/feedback/td-notification/td-notification.class.js +4 -4
  69. package/src/components/feedback/td-overlay/td-overlay.class.js +2 -2
  70. package/src/components/feedback/td-popper/arrow/arrow.class.js +2 -2
  71. package/src/components/feedback/td-popper/content/content.class.js +2 -2
  72. package/src/components/feedback/td-popper/td-popper.class.js +2 -2
  73. package/src/components/feedback/td-popper/trigger/trigger.class.js +2 -2
  74. package/src/components/feedback/td-tooltip/content/content.class.js +2 -2
  75. package/src/components/feedback/td-tooltip/td-tooltip.class.js +2 -2
  76. package/src/components/feedback/td-tooltip/trigger/trigger.class.js +2 -2
  77. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +19 -18
  78. package/src/components/form/field-item/cascade/field-cascade.abstract.js +40 -35
  79. package/src/components/form/field-item/input/field-input.abstract.js +7 -6
  80. package/src/components/form/field-item/options/field-options.abstract.js +19 -18
  81. package/src/components/form/field-item/radio/field-radio.abstract.js +2 -3
  82. package/src/components/form/field-item/select/field-select.abstract.js +14 -14
  83. package/src/components/form/field-select/field-select.class.js +16 -16
  84. package/src/components/form/radio-group/radio-group.class.js +2 -2
  85. package/src/components/form/radio-group/radio-group.interface.d.ts +2 -2
  86. package/src/components/form/radio-group/radio-option/radio-option.class.js +10 -9
  87. package/src/components/form/select/select.class.js +17 -16
  88. package/src/components/form/td-checkbox/td-checkbox.class.js +2 -2
  89. package/src/components/form/td-checkbox/td-checkbox.style.js +2 -2
  90. package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +2 -2
  91. package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +2 -2
  92. package/src/components/form/td-form/td-form.class.js +2 -2
  93. package/src/components/form/td-form-item/td-form-item.class.js +2 -2
  94. package/src/components/form/td-input/td-input.class.js +2 -2
  95. package/src/components/form/td-input/widget/td-input-wrapper.class.js +2 -2
  96. package/src/components/form/td-input/widget/td-textarea-wrapper.js +2 -2
  97. package/src/components/form/td-input/widget/utils.js +8 -8
  98. package/src/components/form/td-option/td-option.class.js +2 -2
  99. package/src/components/form/td-option/td-option.interface.d.ts +1 -1
  100. package/src/components/form/td-option-group/td-option-group.class.js +2 -2
  101. package/src/components/form/td-radio/td-radio.class.js +2 -3
  102. package/src/components/form/td-radio-button/td-radio-button.class.js +2 -3
  103. package/src/components/form/td-radio-group/td-radio-group.class.js +2 -2
  104. package/src/components/form/td-select/dropdown/dropdown.class.js +2 -2
  105. package/src/components/form/td-select/td-select.class.js +2 -2
  106. package/src/components/form/td-switch/td-switch.class.js +8 -9
  107. package/src/components/form/td-switch/widget/td-switch-core.js +2 -2
  108. package/src/components/form/td-switch/widget/td-switch-left.js +2 -2
  109. package/src/components/form/td-switch/widget/td-switch-right.js +2 -2
  110. package/src/components/navigation/td-affix/td-affix.class.js +2 -2
  111. package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +2 -2
  112. package/src/components/navigation/td-anchor/td-anchor.class.d.ts +1 -1
  113. package/src/components/navigation/td-anchor/td-anchor.class.js +2 -2
  114. package/src/components/navigation/td-backtop/td-backtop.class.js +5 -6
  115. package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +3 -5
  116. package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +2 -2
  117. package/src/components/navigation/td-menu/td-menu.class.js +2 -2
  118. package/src/components/navigation/td-tabs/td-tab-bar.class.d.ts +1 -1
  119. package/src/components/navigation/td-tabs/td-tab-bar.class.js +7 -7
  120. package/src/components/navigation/td-tabs/td-tab-bar.interface.d.ts +2 -2
  121. package/src/components/navigation/td-tabs/td-tab-nav.class.d.ts +2 -2
  122. package/src/components/navigation/td-tabs/td-tab-nav.class.js +13 -13
  123. package/src/components/navigation/td-tabs/td-tab-nav.interface.d.ts +1 -1
  124. package/src/components/navigation/td-tabs/td-tab-pane.class.js +2 -2
  125. package/src/components/navigation/td-tabs/td-tabs.class.js +20 -23
  126. package/src/components/others/collapsible-box/heading/expand-heading.js +24 -23
  127. package/src/components/others/custom-block/custom-block.d.ts +11 -0
  128. package/src/components/others/custom-block/custom-block.js +58 -0
  129. package/src/components/others/example/example-float-control.d.ts +8 -0
  130. package/src/components/others/example/example-float-control.js +63 -0
  131. package/src/components/others/example/example-showcase.d.ts +7 -0
  132. package/src/components/others/example/example-showcase.js +20 -0
  133. package/src/components/others/example/example-source-wrapper.d.ts +5 -0
  134. package/src/components/others/example/example-source-wrapper.js +30 -0
  135. package/src/components/others/example/example.d.ts +15 -0
  136. package/src/components/others/example/example.js +77 -0
  137. package/src/components/others/example/index.d.ts +5 -0
  138. package/src/components/others/example/index.js +13 -0
  139. package/src/components/others/example/op-btns.d.ts +7 -0
  140. package/src/components/others/example/op-btns.js +96 -0
  141. package/src/components/others/index.d.ts +4 -0
  142. package/src/components/others/index.js +9 -1
  143. package/src/components/others/menus/menu.d.ts +16 -0
  144. package/src/components/others/menus/menu.js +123 -0
  145. package/src/components/others/menus/menus.d.ts +10 -0
  146. package/src/components/others/menus/menus.js +79 -0
  147. package/src/components/others/td-divider/td-divider.class.js +2 -2
  148. package/src/ui/ui.abstract.js +1 -1
  149. package/src/ui/ui.interface.d.ts +3 -3
@@ -11,7 +11,7 @@ const td_switch_left_1 = require("./widget/td-switch-left");
11
11
  const td_switch_right_1 = require("./widget/td-switch-right");
12
12
  const td_switch_style_1 = require("./td-switch.style");
13
13
  class TdSwitch extends ui_abstract_1.UI {
14
- constructor(params) {
14
+ constructor(params = {}) {
15
15
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16
16
  super(params);
17
17
  this.className = 'TdSwitch';
@@ -62,7 +62,7 @@ class TdSwitch extends ui_abstract_1.UI {
62
62
  this.right = new td_switch_right_1.TdSwitchRight(params);
63
63
  this.addChild(this.right);
64
64
  }
65
- this.props = this.setParams(params);
65
+ this.props = this.setProps(params);
66
66
  }
67
67
  get actualValue() {
68
68
  return this.isControlled ? this.props.modelValue : false;
@@ -90,19 +90,18 @@ class TdSwitch extends ui_abstract_1.UI {
90
90
  });
91
91
  }
92
92
  handleChange() {
93
- var _a, _b, _c, _d, _e, _f;
94
93
  console.log('handleChange . ');
95
94
  const props = this.props;
96
95
  const checked = this.modelValue === this.activeValue;
97
96
  // this.modelValue = !this.modelValue;
98
97
  this.modelValue = checked ? this.inactiveValue : this.activeValue;
99
98
  const val = checked ? this.inactiveValue : this.activeValue;
100
- // emit(UPDATE_MODEL_EVENT, val)
101
- (_b = (_a = this.props.emits) === null || _a === void 0 ? void 0 : _a[event_1.UPDATE_MODEL_EVENT]) === null || _b === void 0 ? void 0 : _b.call(_a, val);
102
- // emit(CHANGE_EVENT, val)
103
- (_d = (_c = this.props.emits) === null || _c === void 0 ? void 0 : _c[event_1.CHANGE_EVENT]) === null || _d === void 0 ? void 0 : _d.call(_c, val);
104
- // emit(INPUT_EVENT, val)
105
- (_f = (_e = this.props.emits) === null || _e === void 0 ? void 0 : _e[event_1.INPUT_EVENT]) === null || _f === void 0 ? void 0 : _f.call(_e, val);
99
+ this.emit(event_1.UPDATE_MODEL_EVENT, val);
100
+ // this.props.emits?.[UPDATE_MODEL_EVENT]?.(val);
101
+ this.emit(event_1.CHANGE_EVENT, val);
102
+ // this.props.emits?.[CHANGE_EVENT]?.(val);
103
+ this.emit(event_1.INPUT_EVENT, val);
104
+ // this.props.emits?.[INPUT_EVENT]?.(val);
106
105
  (0, framework_1.nextTick)(() => {
107
106
  this.input.dom.checked = !checked;
108
107
  console.log('handleChange . this.input.dom.checked is ', checked);
@@ -7,7 +7,7 @@ const var_1 = require("../../../../styles/var");
7
7
  const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
8
8
  const td_switch_style_1 = require("../td-switch.style");
9
9
  class TdSwitchCore extends framework_1.TypeSpan {
10
- constructor(params) {
10
+ constructor(params = {}) {
11
11
  super();
12
12
  this.className = 'TdSwitchCore';
13
13
  this.ctrl.addAttrObj({
@@ -166,7 +166,7 @@ class TdSwitchCore extends framework_1.TypeSpan {
166
166
  }
167
167
  }
168
168
  this.addChild(this.action);
169
- this.props = this.setParams(params);
169
+ this.props = this.setProps(params);
170
170
  }
171
171
  setInnerChecked(checked) {
172
172
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -5,7 +5,7 @@ const framework_1 = require("@type-dom/framework");
5
5
  const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
6
6
  const td_switch_style_1 = require("../td-switch.style");
7
7
  class TdSwitchLeft extends framework_1.TypeSpan {
8
- constructor(params) {
8
+ constructor(params = {}) {
9
9
  super();
10
10
  this.className = 'TdSwitchLeft';
11
11
  this.ctrl.addAttrName('switch-label');
@@ -20,7 +20,7 @@ class TdSwitchLeft extends framework_1.TypeSpan {
20
20
  text: params.inactiveText
21
21
  }));
22
22
  }
23
- this.props = this.setParams(params);
23
+ this.props = this.setProps(params);
24
24
  }
25
25
  }
26
26
  exports.TdSwitchLeft = TdSwitchLeft;
@@ -5,7 +5,7 @@ const framework_1 = require("@type-dom/framework");
5
5
  const td_switch_style_1 = require("../td-switch.style");
6
6
  const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
7
7
  class TdSwitchRight extends framework_1.TypeSpan {
8
- constructor(params) {
8
+ constructor(params = {}) {
9
9
  super();
10
10
  this.className = 'TdSwitchRight';
11
11
  this.ctrl.addStyleObj(Object.assign(Object.assign({}, td_switch_style_1.$switchLabel), { marginLeft: '10px' }));
@@ -19,7 +19,7 @@ class TdSwitchRight extends framework_1.TypeSpan {
19
19
  text: params.activeText
20
20
  }));
21
21
  }
22
- this.props = this.setParams(params);
22
+ this.props = this.setProps(params);
23
23
  }
24
24
  }
25
25
  exports.TdSwitchRight = TdSwitchRight;
@@ -6,7 +6,7 @@ const utils_1 = require("@type-dom/utils");
6
6
  const framework_1 = require("@type-dom/framework");
7
7
  const ui_abstract_1 = require("../../../ui/ui.abstract");
8
8
  class TdAffix extends ui_abstract_1.UI {
9
- constructor(params) {
9
+ constructor(params = {}) {
10
10
  super(params);
11
11
  console.log('TdAffix constructor . ');
12
12
  this.className = 'TdAffix';
@@ -38,7 +38,7 @@ class TdAffix extends ui_abstract_1.UI {
38
38
  this.affix.slotChild(params.slot);
39
39
  }
40
40
  this.addChild(this.affix);
41
- this.props = this.setParams(params);
41
+ this.props = this.setProps(params);
42
42
  }
43
43
  get rootStyle() {
44
44
  return {
@@ -4,7 +4,7 @@ exports.TdAnchorLink = void 0;
4
4
  const framework_1 = require("@type-dom/framework");
5
5
  const ui_abstract_1 = require("../../../../ui/ui.abstract");
6
6
  class TdAnchorLink extends ui_abstract_1.UI {
7
- constructor(params) {
7
+ constructor(params = {}) {
8
8
  super(params);
9
9
  this.className = 'TdAnchorLink';
10
10
  this.href = new framework_1.A({
@@ -24,7 +24,7 @@ class TdAnchorLink extends ui_abstract_1.UI {
24
24
  this.list.addChildren(...params.contents);
25
25
  this.addChild(this.list);
26
26
  }
27
- this.setParams(params);
27
+ this.setProps(params);
28
28
  }
29
29
  }
30
30
  exports.TdAnchorLink = TdAnchorLink;
@@ -5,6 +5,6 @@ export declare class TdAnchor extends UI implements ITdAnchor {
5
5
  props: ITdAnchorConfig;
6
6
  private marker?;
7
7
  private list?;
8
- constructor(params: ITdAnchorConfig);
8
+ constructor(params?: ITdAnchorConfig);
9
9
  handleClick(e: MouseEvent, href?: string): void;
10
10
  }
@@ -6,7 +6,7 @@ const ui_abstract_1 = require("../../../ui/ui.abstract");
6
6
  const td_anchor_style_1 = require("./td-anchor.style");
7
7
  const td_anchor_function_1 = require("./td-anchor.function");
8
8
  class TdAnchor extends ui_abstract_1.UI {
9
- constructor(params) {
9
+ constructor(params = {}) {
10
10
  var _a, _b, _c, _d;
11
11
  super(params);
12
12
  this.className = 'TdAnchor';
@@ -108,7 +108,7 @@ class TdAnchor extends ui_abstract_1.UI {
108
108
  });
109
109
  }
110
110
  }
111
- this.props = this.setParams(params);
111
+ this.props = this.setProps(params);
112
112
  }
113
113
  handleClick(e, href) {
114
114
  // emit('click', e, href)
@@ -10,7 +10,7 @@ const var_1 = require("../../../styles/var");
10
10
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
11
11
  const td_backtop_style_1 = require("./td-backtop.style");
12
12
  class TdBackTop extends ui_abstract_1.UI {
13
- constructor(params) {
13
+ constructor(params = {}) {
14
14
  super(params, 'fragment');
15
15
  this.visible = false;
16
16
  this.className = 'TdBackTop';
@@ -51,7 +51,7 @@ class TdBackTop extends ui_abstract_1.UI {
51
51
  });
52
52
  this.transition = new framework_1.Transition({
53
53
  name: 'fade',
54
- slot: this.division
54
+ childNodes: [this.division]
55
55
  });
56
56
  this.addChild(this.transition);
57
57
  // this.ctrl.addAttrName('td-back-top');
@@ -93,7 +93,7 @@ class TdBackTop extends ui_abstract_1.UI {
93
93
  }
94
94
  this.container = document;
95
95
  this.el = document.documentElement; // todo 监听不生效 ????
96
- this.props = this.setParams(params);
96
+ this.props = this.setProps(params);
97
97
  }
98
98
  mounted() {
99
99
  var _a;
@@ -113,13 +113,12 @@ class TdBackTop extends ui_abstract_1.UI {
113
113
  console.log('TdBackTop initEvents');
114
114
  // nextTick(() => {
115
115
  console.log('TdBackTop initEvents 2');
116
- this.subscriptions.push((0, rxjs_1.fromEvent)(this.container, 'scroll')
116
+ (0, rxjs_1.fromEvent)(this.container, 'scroll')
117
117
  .pipe((0, rxjs_1.throttleTime)(300))
118
118
  .subscribe((event) => {
119
119
  // console.error('handleScroll . 1');
120
120
  this.handleScroll(event);
121
- }));
122
- // });
121
+ });
123
122
  }
124
123
  handleScroll(event) {
125
124
  var _a;
@@ -4,7 +4,7 @@ exports.TdBreadcrumb = void 0;
4
4
  const ui_abstract_1 = require("../../../ui/ui.abstract");
5
5
  // todo link 样式没有添加
6
6
  class TdBreadcrumb extends ui_abstract_1.UI {
7
- constructor(params) {
7
+ constructor(params = {}) {
8
8
  super(params);
9
9
  this.className = 'TdBreadcrumb';
10
10
  this.ctrl.addAttrName('td-breadcrumb');
@@ -13,10 +13,8 @@ class TdBreadcrumb extends ui_abstract_1.UI {
13
13
  lineHeight: 1
14
14
  });
15
15
  this.childNodes = [];
16
- if (params === null || params === void 0 ? void 0 : params.slot) {
17
- this.slotChild(params === null || params === void 0 ? void 0 : params.slot);
18
- }
19
- this.props = this.setParams(params);
16
+ this.addChild(this.getSlotNode());
17
+ this.props = this.setProps(params);
20
18
  }
21
19
  created() {
22
20
  console.log('TdBreadcrumb created . ');
@@ -6,7 +6,7 @@ const ui_abstract_1 = require("../../../ui/ui.abstract");
6
6
  const var_1 = require("../../../styles/var");
7
7
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
8
8
  class TdBreadcrumbItem extends ui_abstract_1.UI {
9
- constructor(params) {
9
+ constructor(params = {}) {
10
10
  super(params, 'span');
11
11
  this.className = 'TdBreadcrumbItem';
12
12
  this.ctrl.addStyleObj({
@@ -39,7 +39,7 @@ class TdBreadcrumbItem extends ui_abstract_1.UI {
39
39
  if (params === null || params === void 0 ? void 0 : params.slot) {
40
40
  this.slotChild(params === null || params === void 0 ? void 0 : params.slot);
41
41
  }
42
- this.setParams(params);
42
+ this.setProps(params);
43
43
  }
44
44
  addSeparator(breadcrumbConfig) {
45
45
  if (breadcrumbConfig === null || breadcrumbConfig === void 0 ? void 0 : breadcrumbConfig.separatorIcon) {
@@ -4,7 +4,7 @@ exports.TdMenu = void 0;
4
4
  const ui_abstract_1 = require("../../../ui/ui.abstract");
5
5
  const var_1 = require("../../../styles/var");
6
6
  class TdMenu extends ui_abstract_1.UI {
7
- constructor(params) {
7
+ constructor(params = {}) {
8
8
  super(params, 'ul');
9
9
  this.className = 'TdMenu';
10
10
  this.ctrl.addAttrObj({
@@ -22,7 +22,7 @@ class TdMenu extends ui_abstract_1.UI {
22
22
  backgroundColor: var_1.$borderColor.base,
23
23
  boxSizing: 'border-box'
24
24
  });
25
- this.props = this.setParams(params);
25
+ this.props = this.setProps(params);
26
26
  }
27
27
  setup() {
28
28
  const props = this.props;
@@ -5,7 +5,7 @@ export declare class TdTabBar extends UI implements ITdTabBar {
5
5
  className: 'TdTabBar';
6
6
  props: ITdTabBarConfig;
7
7
  barStyle?: IStyle;
8
- private rootTabs;
8
+ private rootTabs?;
9
9
  constructor(params: ITdTabBarConfig);
10
10
  getBarStyle(): IStyle;
11
11
  change(): void;
@@ -10,8 +10,8 @@ class TdTabBar extends ui_abstract_1.UI {
10
10
  this.className = 'TdTabBar';
11
11
  this.ctrl.addAttrName('td-tab-bar');
12
12
  this.ctrl.addStyleObj(td_tabs_style_1.$tabsActiveBarStyle);
13
- this.rootTabs = params.rootTabs;
14
- this.props = this.setParams(params);
13
+ this.rootTabs = params === null || params === void 0 ? void 0 : params.rootTabs;
14
+ this.props = this.setProps(params);
15
15
  }
16
16
  getBarStyle() {
17
17
  var _a;
@@ -23,15 +23,15 @@ class TdTabBar extends ui_abstract_1.UI {
23
23
  : 'height';
24
24
  const sizeDir = sizeName === 'width' ? 'x' : 'y';
25
25
  const position = sizeDir === 'x' ? 'left' : 'top';
26
- this.props.tabs.every((tab, index) => {
27
- var _a, _b;
26
+ this.props.tabs && this.props.tabs.every((tab, index) => {
27
+ var _a, _b, _c, _d, _e;
28
28
  // const $el = instance.parent?.refs?.[`tab-${tab.uid}`] as HTMLElement
29
- const $el = (_a = this.rootTabs.tabNav.tabs.find((node) => { var _a, _b; return ((_a = node.props.attrObj) === null || _a === void 0 ? void 0 : _a.tabName) === ((_b = tab.name) !== null && _b !== void 0 ? _b : (index + 1)); })) === null || _a === void 0 ? void 0 : _a.dom;
29
+ const $el = ((_a = this.rootTabs) === null || _a === void 0 ? void 0 : _a.tabNav.tabs) && ((_c = (_b = this.rootTabs) === null || _b === void 0 ? void 0 : _b.tabNav.tabs.find((node) => { var _a, _b; return ((_a = node.props.attrObj) === null || _a === void 0 ? void 0 : _a.tabName) === ((_b = tab.name) !== null && _b !== void 0 ? _b : (index + 1)); })) === null || _c === void 0 ? void 0 : _c.dom);
30
30
  console.log('$el is ', $el);
31
31
  if (!$el)
32
32
  return false;
33
- const tabName = (_b = tab.name) !== null && _b !== void 0 ? _b : (index + 1);
34
- if (tabName !== this.rootTabs.currentName) {
33
+ const tabName = (_d = tab.name) !== null && _d !== void 0 ? _d : (index + 1);
34
+ if (tabName !== ((_e = this.rootTabs) === null || _e === void 0 ? void 0 : _e.currentName)) {
35
35
  return true;
36
36
  }
37
37
  offset =
@@ -5,6 +5,6 @@ export interface ITdTabBar extends IUI {
5
5
  className: 'TdTabBar';
6
6
  }
7
7
  export interface ITdTabBarConfig extends IUIConfig {
8
- tabs: ITdTabPaneConfig[];
9
- rootTabs: TdTabs;
8
+ tabs?: ITdTabPaneConfig[];
9
+ rootTabs?: TdTabs;
10
10
  }
@@ -10,12 +10,12 @@ export declare class TdTabNav extends UI implements ITdTabNav {
10
10
  private navScroll?;
11
11
  private navOffset?;
12
12
  private sizeName;
13
- private rootTabs;
13
+ private rootTabs?;
14
14
  private focusable?;
15
15
  private isFocus;
16
16
  private tabBar?;
17
17
  tabs: Div[];
18
- constructor(params: ITdTabNavConfig);
18
+ constructor(params?: ITdTabNavConfig);
19
19
  mounted(): void;
20
20
  get navStyle(): {
21
21
  transform: string;
@@ -12,8 +12,8 @@ const td_tabs_style_1 = require("./td-tabs.style");
12
12
  const td_tab_bar_class_1 = require("./td-tab-bar.class");
13
13
  const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
14
14
  class TdTabNav extends ui_abstract_1.UI {
15
- constructor(params) {
16
- var _a;
15
+ constructor(params = {}) {
16
+ var _a, _b;
17
17
  super(params);
18
18
  this.tabs = [];
19
19
  this.className = 'TdTabNav';
@@ -27,8 +27,8 @@ class TdTabNav extends ui_abstract_1.UI {
27
27
  this.navOffset = 0;
28
28
  this.isFocus = false;
29
29
  this.focusable = true;
30
- this.rootTabs = params.rootTabs;
31
- this.sizeName = ['top', 'bottom'].includes(this.rootTabs.props.tabPosition || 'top')
30
+ this.rootTabs = params === null || params === void 0 ? void 0 : params.rootTabs;
31
+ this.sizeName = ['top', 'bottom'].includes(((_a = this.rootTabs) === null || _a === void 0 ? void 0 : _a.props.tabPosition) || 'top')
32
32
  ? 'width'
33
33
  : 'height';
34
34
  if (this.scrollable) {
@@ -92,19 +92,19 @@ class TdTabNav extends ui_abstract_1.UI {
92
92
  this.navScroll.addChild(this.nav);
93
93
  if (!params.type) {
94
94
  this.tabBar = new td_tab_bar_class_1.TdTabBar({
95
- rootTabs: params.rootTabs,
95
+ rootTabs: params === null || params === void 0 ? void 0 : params.rootTabs,
96
96
  tabs: (params === null || params === void 0 ? void 0 : params.panes) || [],
97
97
  });
98
98
  this.nav.addChild(this.tabBar);
99
99
  }
100
100
  this.tabs =
101
- ((_a = params.panes) === null || _a === void 0 ? void 0 : _a.map((pane, index) => {
101
+ ((_b = params.panes) === null || _b === void 0 ? void 0 : _b.map((pane, index) => {
102
102
  var _a, _b, _c, _d, _e, _f;
103
103
  // const uid = pane.uid
104
104
  const disabled = pane.disabled;
105
- const active = this.rootTabs.currentName === ((_a = pane.name) !== null && _a !== void 0 ? _a : index);
105
+ const active = ((_a = this.rootTabs) === null || _a === void 0 ? void 0 : _a.currentName) === ((_b = pane.name) !== null && _b !== void 0 ? _b : index);
106
106
  const tabindex = !disabled && active ? 0 : -1;
107
- const tabName = (_b = pane.name) !== null && _b !== void 0 ? _b : (index + 1);
107
+ const tabName = (_c = pane.name) !== null && _c !== void 0 ? _c : (index + 1);
108
108
  console.log('tabName is ', tabName);
109
109
  const item = new framework_1.Div({
110
110
  name: 'tab-nav-item',
@@ -149,7 +149,7 @@ class TdTabNav extends ui_abstract_1.UI {
149
149
  },
150
150
  },
151
151
  });
152
- if (tabName === ((_c = this.rootTabs) === null || _c === void 0 ? void 0 : _c.currentName)) {
152
+ if (tabName === ((_d = this.rootTabs) === null || _d === void 0 ? void 0 : _d.currentName)) {
153
153
  item.ctrl.addStyleObj({
154
154
  color: var_1.$colors.primary.base,
155
155
  });
@@ -160,8 +160,8 @@ class TdTabNav extends ui_abstract_1.UI {
160
160
  });
161
161
  }
162
162
  // const tabLabelContent = pane.slots?.label || pane?.label;
163
- if ((_d = pane.slots) === null || _d === void 0 ? void 0 : _d.label) {
164
- item.slotChild((_e = pane.slots) === null || _e === void 0 ? void 0 : _e.label);
163
+ if ((_e = pane.slots) === null || _e === void 0 ? void 0 : _e.label) {
164
+ item.slotChild(pane.slots.label);
165
165
  }
166
166
  else if (pane.label) {
167
167
  item.addChild(new framework_1.TextNode(pane.label));
@@ -188,7 +188,7 @@ class TdTabNav extends ui_abstract_1.UI {
188
188
  console.log('this.tabs is ', this.tabs);
189
189
  this.nav.addChildren(...this.tabs);
190
190
  this.nav.ctrl.addStyleObj(this.navStyle);
191
- this.props = this.setParams(params);
191
+ this.props = this.setProps(params);
192
192
  }
193
193
  mounted() {
194
194
  setTimeout(() => this.scrollToActiveTab(), 0);
@@ -241,7 +241,7 @@ class TdTabNav extends ui_abstract_1.UI {
241
241
  const navScroll = (_b = this.navScroll) === null || _b === void 0 ? void 0 : _b.dom;
242
242
  const isHorizontal = ['top', 'bottom'].includes(((_c = this.rootTabs) === null || _c === void 0 ? void 0 : _c.props.tabPosition) || 'top');
243
243
  const activeTabBounding = activeTab.getBoundingClientRect();
244
- const navScrollBounding = navScroll.getBoundingClientRect();
244
+ const navScrollBounding = navScroll === null || navScroll === void 0 ? void 0 : navScroll.getBoundingClientRect();
245
245
  const maxOffset = isHorizontal
246
246
  ? nav.offsetWidth - navScrollBounding.width
247
247
  : nav.offsetHeight - navScrollBounding.height;
@@ -6,7 +6,7 @@ export interface ITdTabNav extends IUI {
6
6
  className: 'TdTabNav';
7
7
  }
8
8
  export interface ITdTabNavConfig extends IUIConfig {
9
- rootTabs: TdTabs;
9
+ rootTabs?: TdTabs;
10
10
  panes?: ITdTabPaneConfig[];
11
11
  currentName?: string | number;
12
12
  editable?: boolean;
@@ -4,7 +4,7 @@ exports.TdTabPane = void 0;
4
4
  const framework_1 = require("@type-dom/framework");
5
5
  const ui_abstract_1 = require("../../../ui/ui.abstract");
6
6
  class TdTabPane extends ui_abstract_1.UI {
7
- constructor(params) {
7
+ constructor(params = {}) {
8
8
  super(params, 'fragment');
9
9
  this.className = 'TdTabPane';
10
10
  this.isClosable = params === null || params === void 0 ? void 0 : params.closable;
@@ -26,7 +26,7 @@ class TdTabPane extends ui_abstract_1.UI {
26
26
  }
27
27
  this.addChild(this.panel);
28
28
  }
29
- this.props = this.setParams(params);
29
+ this.props = this.setProps(params);
30
30
  }
31
31
  setActive(active) {
32
32
  var _a, _b;
@@ -12,7 +12,7 @@ const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
12
12
  const td_tab_nav_class_1 = require("./td-tab-nav.class");
13
13
  const td_tabs_style_1 = require("./td-tabs.style");
14
14
  class TdTabs extends ui_abstract_1.UI {
15
- constructor(params) {
15
+ constructor(params = {}) {
16
16
  var _a, _b;
17
17
  super(params);
18
18
  this.className = 'TdTabs';
@@ -92,11 +92,11 @@ class TdTabs extends ui_abstract_1.UI {
92
92
  else {
93
93
  this.childNodes = [this.panel, this.header];
94
94
  }
95
- this.props = this.setParams(params);
95
+ this.props = this.setProps(params);
96
96
  }
97
97
  setCurrentName(value_1) {
98
98
  return tslib_1.__awaiter(this, arguments, void 0, function* (value, trigger = false) {
99
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
99
+ var _a, _b, _c, _d, _e;
100
100
  console.log('setCurrentName .');
101
101
  // should do nothing.
102
102
  if (this.currentName === value || (0, utils_1.isUndefined)(value))
@@ -106,12 +106,12 @@ class TdTabs extends ui_abstract_1.UI {
106
106
  if (canLeave !== false) {
107
107
  this.currentName = value;
108
108
  if (trigger) {
109
- // emit(UPDATE_MODEL_EVENT, value)
110
- (_d = (_c = this.props.emits) === null || _c === void 0 ? void 0 : _c[event_1.UPDATE_MODEL_EVENT]) === null || _d === void 0 ? void 0 : _d.call(_c, value);
111
- // emit('tabChange', value)
112
- (_f = (_e = this.props.emits) === null || _e === void 0 ? void 0 : _e.tabChange) === null || _f === void 0 ? void 0 : _f.call(_e, value);
109
+ this.emit(event_1.UPDATE_MODEL_EVENT, value);
110
+ // this.props.emits?.[UPDATE_MODEL_EVENT]?.(value);
111
+ this.emit('tabChange', value);
112
+ // this.props.emits?.tabChange?.(value);
113
113
  }
114
- (_g = this.props.slot) === null || _g === void 0 ? void 0 : _g.forEach((pane, index) => {
114
+ (_c = this.props.slot) === null || _c === void 0 ? void 0 : _c.forEach((pane, index) => {
115
115
  var _a;
116
116
  const tabName = (_a = pane.props.name) !== null && _a !== void 0 ? _a : (index + 1);
117
117
  if (tabName === this.currentName) {
@@ -121,39 +121,36 @@ class TdTabs extends ui_abstract_1.UI {
121
121
  pane.setActive(false);
122
122
  }
123
123
  });
124
- (_j = (_h = this.tabNav) === null || _h === void 0 ? void 0 : _h.removeFocus) === null || _j === void 0 ? void 0 : _j.call(_h);
124
+ (_e = (_d = this.tabNav) === null || _d === void 0 ? void 0 : _d.removeFocus) === null || _e === void 0 ? void 0 : _e.call(_d);
125
125
  }
126
126
  }
127
- catch (_k) {
127
+ catch (_f) {
128
128
  console.error('tab change error');
129
129
  }
130
130
  });
131
131
  }
132
132
  handleTabClick(tab, tabName, event) {
133
- var _a, _b;
134
133
  console.log('handleTabClick . ');
135
134
  if (tab.disabled)
136
135
  return;
137
136
  this.setCurrentName(tabName, true);
138
- // emit('tabClick', tab, event)
139
- (_b = (_a = this.props.emits) === null || _a === void 0 ? void 0 : _a.tabClick) === null || _b === void 0 ? void 0 : _b.call(_a, tab, event);
137
+ this.emit('tabClick', tab, event);
138
+ // this.props.emits?.tabClick?.(tab, event);
140
139
  }
141
140
  handleTabRemove(pane, ev) {
142
- var _a, _b, _c, _d;
143
141
  if (pane.disabled || (0, utils_1.isUndefined)(pane.name))
144
142
  return;
145
143
  ev.stopPropagation();
146
- // emit('edit', pane.props.name, 'remove')
147
- (_b = (_a = this.props.emits) === null || _a === void 0 ? void 0 : _a.edit) === null || _b === void 0 ? void 0 : _b.call(_a, pane.name, 'remove');
148
- // emit('tabRemove', pane.props.name)
149
- (_d = (_c = this.props.emits) === null || _c === void 0 ? void 0 : _c.tabRemove) === null || _d === void 0 ? void 0 : _d.call(_c, pane.name);
144
+ this.emit('edit', pane.name, 'remove');
145
+ // this.props.emits?.edit?.(pane.name, 'remove');
146
+ this.emit('tabRemove', pane.name);
147
+ // this.props.emits?.tabRemove?.(pane.name);
150
148
  }
151
149
  handleTabAdd() {
152
- var _a, _b, _c, _d;
153
- // emit('edit', undefined, 'add')
154
- (_b = (_a = this.props.emits) === null || _a === void 0 ? void 0 : _a.edit) === null || _b === void 0 ? void 0 : _b.call(_a, undefined, 'add');
155
- // emit('tabAdd')
156
- (_d = (_c = this.props.emits) === null || _c === void 0 ? void 0 : _c.tabAdd) === null || _d === void 0 ? void 0 : _d.call(_c);
150
+ this.emit('edit', undefined, 'add');
151
+ // this.props.emits?.edit?.(undefined, 'add');
152
+ this.emit('tabAdd');
153
+ // this.props.emits?.tabAdd?.();
157
154
  }
158
155
  }
159
156
  exports.TdTabs = TdTabs;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpandHeading = 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
  class ExpandHeading extends framework_1.TypeDiv {
@@ -39,32 +38,34 @@ class ExpandHeading extends framework_1.TypeDiv {
39
38
  this.title.setText(title);
40
39
  }
41
40
  initEvents() {
42
- this.subscriptions.push((0, rxjs_1.fromEvent)(this.svg.dom, 'click').subscribe((e) => {
43
- var _a, _b, _c;
44
- console.log('expand-heading svg.dom clicked');
45
- e.stopPropagation();
46
- // const style = getComputedStyle(this.svg.dom);
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({
50
- transform: 'rotate(0deg)',
51
- transition: 'transform 0.3s'
52
- });
41
+ this.svg.addEvents({
42
+ click: (e) => {
43
+ var _a, _b, _c;
44
+ console.log('expand-heading svg.dom clicked');
45
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
46
+ // const style = getComputedStyle(this.svg.dom);
53
47
  // 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
48
+ if (((_a = this.svg.props.styleObj) === null || _a === void 0 ? void 0 : _a.transform) === 'rotate(-90deg)') {
49
+ this.svg.ctrl.setStyleObj({
50
+ transform: 'rotate(0deg)',
51
+ transition: 'transform 0.3s'
52
+ });
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
56
+ }
56
57
  }
57
- }
58
- else {
59
- this.svg.ctrl.setStyleObj({
60
- transform: 'rotate(-90deg)',
61
- transition: 'transform 0.3s'
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');
58
+ else {
59
+ this.svg.ctrl.setStyleObj({
60
+ transform: 'rotate(-90deg)',
61
+ transition: 'transform 0.3s'
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');
65
+ }
65
66
  }
66
67
  }
67
- }));
68
+ });
68
69
  }
69
70
  }
70
71
  exports.ExpandHeading = ExpandHeading;
@@ -0,0 +1,11 @@
1
+ import { ITypeConfig, TextNode, TypeDiv, TypeElement } from '@type-dom/framework';
2
+ export interface ICustomBlockConfig extends ITypeConfig {
3
+ type?: 'tip' | 'warning';
4
+ title: string;
5
+ paragraphs: (TypeElement | TextNode)[];
6
+ blockquote?: TypeElement | TextNode;
7
+ }
8
+ export declare class CustomBlock extends TypeDiv {
9
+ className: 'CustomBlock';
10
+ constructor(params: ICustomBlockConfig);
11
+ }