@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.
- package/README.md +44 -44
- package/package.json +2 -8
- package/src/aria.d.ts +0 -17
- package/src/aria.js +0 -18
- package/src/components/basic/td-button/td-button.abstract.d.ts +2 -3
- package/src/components/basic/td-button/td-button.abstract.js +30 -26
- package/src/components/basic/td-button/td-button.interface.d.ts +0 -1
- package/src/components/basic/td-button-group/td-button-group.class.d.ts +2 -3
- package/src/components/basic/td-button-group/td-button-group.class.js +14 -16
- package/src/components/basic/td-container/td-aside/td-aside.class.js +2 -2
- package/src/components/basic/td-container/td-container.class.js +5 -5
- package/src/components/basic/td-container/td-container.js +1 -1
- package/src/components/basic/td-container/td-footer/td-footer.class.js +2 -2
- package/src/components/basic/td-container/td-header/td-header.class.js +3 -3
- package/src/components/basic/td-container/td-main/td-main.class.js +2 -2
- package/src/components/basic/td-icon/td-icon.class.js +20 -20
- package/src/components/basic/td-layout/td-col/td-col.class.d.ts +5 -2
- package/src/components/basic/td-layout/td-col/td-col.class.js +80 -80
- package/src/components/basic/td-layout/td-row/td-row.class.js +13 -13
- package/src/components/basic/td-link/td-link.class.d.ts +0 -1
- package/src/components/basic/td-link/td-link.class.js +17 -19
- package/src/components/basic/td-scrollbar/bar/bar.class.js +3 -3
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +5 -5
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +3 -3
- package/src/components/basic/td-space/td-space.class.js +10 -10
- package/src/components/basic/td-text/td-text.class.js +12 -9
- package/src/components/data/td-avatar/td-avatar.class.js +12 -13
- package/src/components/data/td-badge/td-badge.class.js +9 -8
- package/src/components/data/td-card/td-card.class.js +7 -7
- package/src/components/data/td-check-tag/td-check-tag.class.d.ts +0 -1
- package/src/components/data/td-check-tag/td-check-tag.class.js +9 -11
- package/src/components/data/td-collapse/td-collapse.class.js +2 -2
- package/src/components/data/td-collapse-item/td-collapse-item.class.js +15 -16
- package/src/components/data/td-collapse-transition/td-collapse-transition.util.js +14 -14
- package/src/components/data/td-count-down/td-count-down.class.js +1 -1
- package/src/components/data/td-descriptions/td-descriptions-row.js +2 -2
- package/src/components/data/td-descriptions/td-descriptions.class.js +8 -8
- package/src/components/data/td-descriptions/td-descritions-cell.js +14 -14
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +1 -1
- package/src/components/data/td-empty/img-empty.class.js +3 -3
- package/src/components/data/td-empty/td-empty.class.js +4 -4
- package/src/components/data/td-image/td-image.class.js +6 -6
- package/src/components/data/td-image-viewer/td-image-viewer.class.d.ts +2 -1
- package/src/components/data/td-image-viewer/td-image-viewer.class.js +13 -10
- package/src/components/data/td-result/td-result.class.js +3 -3
- package/src/components/data/td-segmented/td-segmented.class.js +14 -17
- package/src/components/data/td-statistic/td-statistic.abstract.js +2 -2
- package/src/components/data/td-tag/td-tag.class.js +9 -9
- package/src/components/feedback/index.d.ts +2 -2
- package/src/components/feedback/index.js +5 -6
- package/src/components/feedback/td-alert/td-alert.class.js +9 -9
- package/src/components/feedback/td-dialog/td-dialog.class.js +5 -5
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +4 -4
- package/src/components/feedback/td-drawer/td-drawer.class.js +10 -12
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +19 -1
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +223 -48
- package/src/components/feedback/td-focus-trap/tokens.d.ts +2 -1
- package/src/components/feedback/td-focus-trap/utils.d.ts +1 -1
- package/src/components/feedback/td-focus-trap/utils.js +9 -11
- package/src/components/feedback/td-loading/td-loading.class.d.ts +2 -0
- package/src/components/feedback/td-loading/td-loading.class.js +7 -1
- package/src/components/feedback/td-message/td-message.class.d.ts +3 -2
- package/src/components/feedback/td-message/td-message.class.js +18 -18
- package/src/components/feedback/td-message/td-message.style.js +2 -1
- package/src/components/feedback/td-message-box/td-message-box.class.d.ts +5 -3
- package/src/components/feedback/td-message-box/td-message-box.class.js +79 -74
- package/src/components/feedback/td-message-box/td-message-box.interface.d.ts +2 -1
- package/src/components/feedback/td-notification/td-notification.class.d.ts +3 -2
- package/src/components/feedback/td-notification/td-notification.class.js +26 -26
- package/src/components/feedback/td-notification/td-notification.style.js +6 -6
- package/src/components/feedback/td-only-child/td-only-child.class.d.ts +7 -0
- package/src/components/feedback/td-only-child/td-only-child.class.js +74 -0
- package/src/components/feedback/td-overlay/td-overlay.class.d.ts +1 -1
- package/src/components/feedback/td-overlay/td-overlay.class.js +5 -5
- package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +6 -0
- package/src/components/feedback/td-popper/arrow/arrow.class.js +22 -3
- package/src/components/feedback/td-popper/composable/use-focus-trap.d.ts +0 -0
- package/src/components/feedback/td-popper/composable/use-focus-trap.js +1 -0
- package/src/components/feedback/td-popper/content/content.class.d.ts +1 -0
- package/src/components/feedback/td-popper/content/content.class.js +25 -4
- package/src/components/feedback/td-popper/content/content.const.d.ts +3 -0
- package/src/components/feedback/td-popper/content/content.const.js +29 -0
- package/src/components/feedback/td-popper/content/content.interface.d.ts +9 -0
- package/src/components/feedback/td-popper/td-popper.class.d.ts +1 -1
- package/src/components/feedback/td-popper/td-popper.class.js +35 -2
- package/src/components/feedback/td-popper/td-popper.const.d.ts +21 -0
- package/src/components/feedback/td-popper/td-popper.const.js +5 -0
- package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +11 -0
- package/src/components/feedback/td-popper/trigger/trigger.class.js +96 -1
- package/src/components/feedback/td-popper/trigger/trigger.const.d.ts +1 -0
- package/src/components/feedback/td-popper/trigger/trigger.const.js +12 -0
- package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +1 -0
- package/src/components/feedback/td-tooltip/content/content.class.js +1 -1
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +1 -1
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +1 -1
- package/src/components/form/checkbox-group/checkbox-group.class.js +6 -7
- package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.d.ts +1 -1
- package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +4 -4
- package/src/components/form/field-item/cascade/field-cascade.abstract.d.ts +1 -1
- package/src/components/form/field-item/cascade/field-cascade.abstract.js +8 -8
- package/src/components/form/field-item/field-item.abstract.js +3 -3
- package/src/components/form/field-item/input/field-input.abstract.d.ts +1 -1
- package/src/components/form/field-item/input/field-input.abstract.js +8 -8
- package/src/components/form/field-item/options/field-options.abstract.d.ts +1 -3
- package/src/components/form/field-item/options/field-options.abstract.js +32 -30
- package/src/components/form/field-item/radio/field-radio.abstract.d.ts +1 -1
- package/src/components/form/field-item/radio/field-radio.abstract.js +32 -35
- package/src/components/form/field-item/select/field-select.abstract.d.ts +1 -1
- package/src/components/form/field-item/select/field-select.abstract.js +5 -5
- package/src/components/form/field-item/span/field-span.abstract.js +5 -5
- package/src/components/form/field-item/textarea/field-textarea.abstract.js +5 -5
- package/src/components/form/field-select/field-select.class.d.ts +1 -1
- package/src/components/form/field-select/field-select.class.js +7 -8
- package/src/components/form/field-select/option/option.class.js +1 -3
- package/src/components/form/radio-group/radio-group.class.js +6 -7
- package/src/components/form/radio-group/radio-option/radio-option.class.d.ts +0 -1
- package/src/components/form/radio-group/radio-option/radio-option.class.js +6 -8
- package/src/components/form/select/select.class.d.ts +1 -1
- package/src/components/form/select/select.class.js +4 -4
- package/src/components/form/td-checkbox/td-checkbox.class.js +3 -3
- package/src/components/form/td-checkbox/td-checkbox.style.js +2 -2
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +3 -3
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +3 -3
- package/src/components/form/td-form/td-form.class.js +5 -3
- package/src/components/form/td-form-item/td-form-item.class.js +16 -16
- package/src/components/form/td-input/td-input-field.class.js +8 -8
- package/src/components/form/td-input/td-input.class.d.ts +0 -1
- package/src/components/form/td-input/td-input.class.js +9 -11
- package/src/components/form/td-input/widget/prefix.js +1 -1
- package/src/components/form/td-input/widget/suffix.js +3 -3
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +12 -11
- package/src/components/form/td-input/widget/td-textarea-wrapper.js +3 -3
- package/src/components/form/td-input/widget/utils.js +8 -8
- package/src/components/form/td-option/td-option.class.js +3 -3
- package/src/components/form/td-option-group/td-option-group.class.js +3 -3
- package/src/components/form/td-radio/td-radio.class.d.ts +0 -1
- package/src/components/form/td-radio/td-radio.class.js +50 -53
- package/src/components/form/td-radio-button/td-radio-button.class.d.ts +0 -1
- package/src/components/form/td-radio-button/td-radio-button.class.js +46 -49
- package/src/components/form/td-radio-group/td-radio-group.class.js +3 -4
- package/src/components/form/td-select/dropdown/dropdown.class.js +2 -2
- package/src/components/form/td-select/td-select.class.js +2 -2
- package/src/components/form/td-switch/td-switch.class.d.ts +1 -1
- package/src/components/form/td-switch/td-switch.class.js +21 -21
- package/src/components/form/td-switch/widget/td-switch-core.js +10 -10
- package/src/components/form/td-switch/widget/td-switch-left.js +3 -3
- package/src/components/form/td-switch/widget/td-switch-right.js +2 -2
- package/src/components/navigation/td-affix/td-affix.class.d.ts +3 -0
- package/src/components/navigation/td-affix/td-affix.class.js +22 -20
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +1 -1
- package/src/components/navigation/td-anchor/td-anchor.class.js +10 -10
- package/src/components/navigation/td-backtop/td-backtop.class.d.ts +5 -3
- package/src/components/navigation/td-backtop/td-backtop.class.js +41 -32
- package/src/components/navigation/td-backtop/td-backtop.interface.d.ts +3 -0
- package/src/components/navigation/td-backtop/use-backtop.d.ts +7 -0
- package/src/components/navigation/td-backtop/use-backtop.js +44 -0
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +4 -4
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +3 -3
- package/src/components/navigation/td-menu/td-menu.class.js +5 -5
- package/src/components/navigation/td-menu/td-menu.interface.d.ts +2 -1
- package/src/components/navigation/td-tabs/td-tab-bar.class.js +5 -5
- package/src/components/navigation/td-tabs/td-tab-nav.class.js +14 -14
- package/src/components/navigation/td-tabs/td-tab-pane.class.js +3 -3
- package/src/components/navigation/td-tabs/td-tabs.class.js +4 -4
- package/src/components/others/collapsible-box/collapsible-box.js +2 -2
- package/src/components/others/collapsible-box/contents/contents.js +2 -2
- package/src/components/others/collapsible-box/heading/expand-heading.d.ts +1 -1
- package/src/components/others/collapsible-box/heading/expand-heading.js +11 -11
- package/src/components/others/custom-block/custom-block.js +2 -2
- package/src/components/others/example/example-float-control.d.ts +1 -1
- package/src/components/others/example/example-float-control.js +8 -8
- package/src/components/others/example/example-showcase.js +3 -3
- package/src/components/others/example/example-source-wrapper.d.ts +6 -2
- package/src/components/others/example/example-source-wrapper.js +3 -3
- package/src/components/others/example/example.d.ts +1 -2
- package/src/components/others/example/example.js +4 -4
- package/src/components/others/example/op-btns.js +9 -10
- package/src/components/others/menus/menu.d.ts +10 -5
- package/src/components/others/menus/menu.js +35 -33
- package/src/components/others/menus/menus.d.ts +6 -1
- package/src/components/others/menus/menus.js +46 -24
- package/src/components/others/td-divider/td-divider.class.js +8 -8
- package/src/hooks/index.d.ts +3 -0
- package/src/hooks/index.js +6 -0
- package/src/hooks/use-cursor.d.ts +1 -0
- package/src/hooks/use-cursor.js +56 -0
- package/src/hooks/use-escape-keydown.d.ts +4 -0
- package/src/hooks/use-escape-keydown.js +31 -0
- package/src/hooks/use-forward-ref.d.ts +13 -0
- package/src/hooks/use-forward-ref.js +27 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/styles/var.d.ts +1 -1
- package/src/styles/var.js +2 -2
- package/src/ui/ui.abstract.d.ts +1 -1
- package/src/ui/ui.abstract.js +2 -2
- package/src/components/feedback/dialog/dialog.class.d.ts +0 -7
- package/src/components/feedback/dialog/dialog.class.js +0 -21
- package/src/components/feedback/dialog/dialog.interface.d.ts +0 -4
- package/src/components/feedback/dialog/dialog.interface.js +0 -2
- package/src/components/feedback/message-box/message-box.d.ts +0 -9
- package/src/components/feedback/message-box/message-box.interface.d.ts +0 -4
- package/src/components/feedback/message-box/message-box.interface.js +0 -2
- package/src/components/feedback/message-box/message-box.js +0 -33
- package/src/components/feedback/overlay/container/body/body.d.ts +0 -7
- package/src/components/feedback/overlay/container/body/body.js +0 -17
- package/src/components/feedback/overlay/container/container.d.ts +0 -15
- package/src/components/feedback/overlay/container/container.js +0 -38
- package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.d.ts +0 -8
- package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +0 -32
- package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.d.ts +0 -9
- package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +0 -32
- package/src/components/feedback/overlay/container/footer/footer.d.ts +0 -10
- package/src/components/feedback/overlay/container/footer/footer.js +0 -47
- package/src/components/feedback/overlay/container/header/close-button/close-button.d.ts +0 -11
- package/src/components/feedback/overlay/container/header/close-button/close-button.js +0 -34
- package/src/components/feedback/overlay/container/header/header.d.ts +0 -12
- package/src/components/feedback/overlay/container/header/header.js +0 -25
- package/src/components/feedback/overlay/container/header/title/title.d.ts +0 -9
- package/src/components/feedback/overlay/container/header/title/title.js +0 -19
- package/src/components/feedback/overlay/overlay.abstract.d.ts +0 -13
- package/src/components/feedback/overlay/overlay.abstract.js +0 -60
|
@@ -68,24 +68,21 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
68
68
|
};
|
|
69
69
|
// Object.assign(this.state, params); // todo this.state params 关系???
|
|
70
70
|
this.to = this.getAppendToElement(params);
|
|
71
|
-
this.
|
|
72
|
-
name: '
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
this.messageBox = new framework_1.Div({
|
|
72
|
+
name: 'message-box',
|
|
73
|
+
attrObj: {
|
|
74
|
+
tabindex: '-1',
|
|
75
|
+
},
|
|
76
|
+
styleObj: td_message_box_style_1.$messageBoxStyle,
|
|
77
|
+
events: {
|
|
78
|
+
click: (evt) => {
|
|
79
|
+
evt === null || evt === void 0 ? void 0 : evt.stopPropagation();
|
|
77
80
|
},
|
|
78
81
|
},
|
|
79
82
|
});
|
|
80
|
-
this.addChild(this.transition);
|
|
81
|
-
this.overlay = new td_overlay_class_1.TdOverlay({
|
|
82
|
-
name: 'overlay',
|
|
83
|
-
// styleObj: $messageBoxStyle,
|
|
84
|
-
});
|
|
85
|
-
this.overlayEvent = (0, framework_1.useSameTarget)(this.handleWrapperClick);
|
|
86
|
-
this.transition.addChild(this.overlay);
|
|
87
83
|
this.dialog = new framework_1.Div({
|
|
88
84
|
name: 'message-box-overlay',
|
|
85
|
+
childNodes: [this.messageBox], // 有问题, Div 不能直接用slot
|
|
89
86
|
attrObj: {
|
|
90
87
|
role: 'dialog',
|
|
91
88
|
'aria-modal': 'true',
|
|
@@ -96,26 +93,28 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
96
93
|
styleObj: Object.assign(Object.assign({}, td_message_box_style_1.$messageBoxOverlayStyle), { display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }),
|
|
97
94
|
events: {
|
|
98
95
|
click: (evt) => this.overlayEvent.onClick(evt),
|
|
99
|
-
|
|
100
|
-
mouseup: (evt) =>
|
|
101
|
-
this.overlayEvent.onMouseup(evt);
|
|
102
|
-
},
|
|
96
|
+
mousedown: (evt) => this.overlayEvent.onMousedown(evt),
|
|
97
|
+
mouseup: (evt) => this.overlayEvent.onMouseup(evt),
|
|
103
98
|
},
|
|
104
99
|
});
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
107
|
-
name: '
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
// this.dialog.addChild(this.messageBox);
|
|
101
|
+
this.overlay = new td_overlay_class_1.TdOverlay({
|
|
102
|
+
name: 'overlay',
|
|
103
|
+
// styleObj: $messageBoxStyle,
|
|
104
|
+
slot: this.dialog,
|
|
105
|
+
});
|
|
106
|
+
this.overlayEvent = (0, framework_1.useSameTarget)(this.handleWrapperClick);
|
|
107
|
+
this.transition = new framework_1.Transition({
|
|
108
|
+
name: 'fade-in-linear',
|
|
109
|
+
emits: {
|
|
110
|
+
afterLeave: () => {
|
|
111
|
+
// params?.emits?.vanish?.();
|
|
112
|
+
this.emit('vanish');
|
|
115
113
|
},
|
|
116
114
|
},
|
|
115
|
+
slot: this.overlay,
|
|
117
116
|
});
|
|
118
|
-
this.
|
|
117
|
+
this.addChild(this.transition);
|
|
119
118
|
let iconComponent;
|
|
120
119
|
if (params === null || params === void 0 ? void 0 : params.icon) {
|
|
121
120
|
iconComponent = params.icon;
|
|
@@ -194,6 +193,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
194
193
|
this.container.addChild(this.msgDiv);
|
|
195
194
|
this.msgDiv.addChild(this.getSlotNode());
|
|
196
195
|
if (params === null || params === void 0 ? void 0 : params.slot) {
|
|
196
|
+
//
|
|
197
197
|
}
|
|
198
198
|
else {
|
|
199
199
|
if (!(params === null || params === void 0 ? void 0 : params.dangerouslyUseHTMLString)) {
|
|
@@ -298,16 +298,16 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
298
298
|
round: params.roundButton,
|
|
299
299
|
// styleObj: $messageBoxCancelBtnStyle,
|
|
300
300
|
events: {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
click: () => {
|
|
302
|
+
console.log('this.cancelBtn click . ');
|
|
303
|
+
this.handleAction('cancel');
|
|
304
|
+
},
|
|
305
|
+
keydown: (evt) => {
|
|
306
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
307
|
+
if (evt.key === 'Enter') {
|
|
308
|
+
this.handleAction('cancel');
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
311
|
},
|
|
312
312
|
});
|
|
313
313
|
this.btns.addChild(this.cancelBtn);
|
|
@@ -336,7 +336,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
336
336
|
},
|
|
337
337
|
});
|
|
338
338
|
this.btns.addChild(this.confirmBtn);
|
|
339
|
-
this.props = this.
|
|
339
|
+
this.props = this.useParams(params);
|
|
340
340
|
const draggable = params === null || params === void 0 ? void 0 : params.draggable;
|
|
341
341
|
const overflow = params === null || params === void 0 ? void 0 : params.overflow;
|
|
342
342
|
const { onDraggable, offDraggable } = (0, framework_1.useDraggable)(this.messageBox.dom, (_b = this.header) === null || _b === void 0 ? void 0 : _b.dom, draggable, overflow);
|
|
@@ -369,47 +369,52 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
369
369
|
// onBeforeUnmount(() => {
|
|
370
370
|
// offDraggable()
|
|
371
371
|
// })
|
|
372
|
+
// 普通显示
|
|
373
|
+
static show(params) {
|
|
374
|
+
console.log('TdMessageBox show params is ', params);
|
|
375
|
+
const msgBox = new TdMessageBox(params);
|
|
376
|
+
return msgBox.promise();
|
|
377
|
+
}
|
|
372
378
|
// 用 callback
|
|
373
379
|
static alert(message, title, params) {
|
|
374
380
|
new TdMessageBox(Object.assign({ boxType: 'alert', message,
|
|
375
381
|
title }, params));
|
|
376
382
|
}
|
|
377
383
|
static confirm(message, title, params) {
|
|
378
|
-
|
|
379
|
-
title, showCancelButton: true }, params))
|
|
384
|
+
const msgBox = new TdMessageBox(Object.assign({ boxType: 'confirm', message,
|
|
385
|
+
title, showCancelButton: true }, params));
|
|
386
|
+
return msgBox.promise();
|
|
380
387
|
}
|
|
388
|
+
// todo 多次提交时,不触发返回操作。
|
|
381
389
|
static prompt(message, title, params) {
|
|
382
|
-
|
|
383
|
-
const msg = new TdMessageBox(Object.assign({ boxType: 'prompt', message,
|
|
390
|
+
const msgBox = new TdMessageBox(Object.assign({ boxType: 'prompt', message,
|
|
384
391
|
title, showCancelButton: true, showInput: true }, params));
|
|
385
|
-
const
|
|
386
|
-
return
|
|
392
|
+
const input = msgBox.input;
|
|
393
|
+
return msgBox.promise(input);
|
|
387
394
|
}
|
|
388
|
-
promise(
|
|
395
|
+
promise(input) {
|
|
389
396
|
return new Promise((resolve, reject) => {
|
|
390
397
|
var _a;
|
|
391
|
-
this.confirmBtn.
|
|
392
|
-
console.log('confirm . then resolve . ');
|
|
393
|
-
resolve({ action: 'confirm',
|
|
398
|
+
this.confirmBtn.setEvent('click', () => {
|
|
399
|
+
console.log('confirm click . then resolve . ');
|
|
400
|
+
resolve({ action: 'confirm', input });
|
|
401
|
+
});
|
|
402
|
+
// this.cancelBtn.removeEvent('click', this.cancelBtn.dom);
|
|
403
|
+
(_a = this.cancelBtn) === null || _a === void 0 ? void 0 : _a.setEvents({
|
|
404
|
+
click: () => {
|
|
405
|
+
// todo
|
|
406
|
+
console.log('this.cancelBtn click . ');
|
|
407
|
+
// this.handleAction('cancel');
|
|
408
|
+
resolve({ action: 'cancel' }); // todo why must add catch(...) .otherwise it will not be resolved
|
|
409
|
+
},
|
|
410
|
+
keydown: (evt) => {
|
|
411
|
+
// evt?.preventDefault();
|
|
412
|
+
if ((evt === null || evt === void 0 ? void 0 : evt.key) === 'Enter') {
|
|
413
|
+
// this.handleAction('cancel');
|
|
414
|
+
resolve({ action: 'cancel' });
|
|
415
|
+
}
|
|
416
|
+
},
|
|
394
417
|
});
|
|
395
|
-
if ((_a = this.cancelBtn) === null || _a === void 0 ? void 0 : _a.dom) {
|
|
396
|
-
// this.cancelBtn.removeEvent('click', this.cancelBtn.dom);
|
|
397
|
-
this.cancelBtn.addEvents({
|
|
398
|
-
click: () => {
|
|
399
|
-
// todo
|
|
400
|
-
console.log('this.cancelBtn click . ');
|
|
401
|
-
this.handleAction('cancel');
|
|
402
|
-
resolve({ action: 'cancel' }); // todo why must add catch(...) .otherwise it will not be resolved
|
|
403
|
-
},
|
|
404
|
-
keydown: (evt) => {
|
|
405
|
-
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
406
|
-
if (evt.key === 'Enter') {
|
|
407
|
-
this.handleAction('cancel');
|
|
408
|
-
resolve({ action: 'cancel' });
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
418
|
});
|
|
414
419
|
}
|
|
415
420
|
doClose() {
|
|
@@ -417,7 +422,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
417
422
|
if (!this.visible)
|
|
418
423
|
return;
|
|
419
424
|
this.visible = false;
|
|
420
|
-
this.messageBox.
|
|
425
|
+
this.messageBox.style.hide();
|
|
421
426
|
(0, framework_1.nextTick)(() => {
|
|
422
427
|
if (this.state.action) {
|
|
423
428
|
this.emit('action', this.state.action);
|
|
@@ -432,17 +437,17 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
432
437
|
}
|
|
433
438
|
}
|
|
434
439
|
handleAction(action) {
|
|
435
|
-
var _a, _b, _c
|
|
440
|
+
var _a, _b, _c;
|
|
436
441
|
console.log('handleAction', action);
|
|
437
442
|
if (this.props.boxType === 'prompt' &&
|
|
438
443
|
action === 'confirm' &&
|
|
439
444
|
!this.validate()) {
|
|
440
445
|
return;
|
|
441
446
|
}
|
|
442
|
-
(
|
|
447
|
+
((_a = this.props) === null || _a === void 0 ? void 0 : _a.callback) && this.props.callback(action);
|
|
443
448
|
this.state.action = action;
|
|
444
449
|
if (this.state.beforeClose) {
|
|
445
|
-
(
|
|
450
|
+
(_c = (_b = this.state).beforeClose) === null || _c === void 0 ? void 0 : _c.call(_b, action, this.state, this.doClose);
|
|
446
451
|
}
|
|
447
452
|
else {
|
|
448
453
|
this.doClose();
|
|
@@ -456,7 +461,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
456
461
|
if (inputPattern && !inputPattern.test(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) || '')) {
|
|
457
462
|
this.state.editorErrorMessage = this.props.inputErrorMessage; // || t('el.messagebox.error') todo t 是国际化翻译的全局方法
|
|
458
463
|
this.state.validateError = true;
|
|
459
|
-
(_b = this.errorMsg) === null || _b === void 0 ? void 0 : _b.
|
|
464
|
+
(_b = this.errorMsg) === null || _b === void 0 ? void 0 : _b.style.setObj({
|
|
460
465
|
visibility: this.state.editorErrorMessage ? 'visible' : 'hidden',
|
|
461
466
|
});
|
|
462
467
|
(_d = (_c = this.errorMsg) === null || _c === void 0 ? void 0 : _c.textNode) === null || _d === void 0 ? void 0 : _d.setText(this.state.editorErrorMessage || '');
|
|
@@ -468,7 +473,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
468
473
|
if (validateResult === false) {
|
|
469
474
|
this.state.editorErrorMessage = this.props.inputErrorMessage; // || t('el.messagebox.error')
|
|
470
475
|
this.state.validateError = true;
|
|
471
|
-
(_f = this.errorMsg) === null || _f === void 0 ? void 0 : _f.
|
|
476
|
+
(_f = this.errorMsg) === null || _f === void 0 ? void 0 : _f.style.setObj({
|
|
472
477
|
visibility: this.state.editorErrorMessage ? 'visible' : 'hidden',
|
|
473
478
|
});
|
|
474
479
|
(_h = (_g = this.errorMsg) === null || _g === void 0 ? void 0 : _g.textNode) === null || _h === void 0 ? void 0 : _h.setText(this.state.editorErrorMessage || '');
|
|
@@ -477,7 +482,7 @@ class TdMessageBox extends ui_abstract_1.UI {
|
|
|
477
482
|
if (typeof validateResult === 'string') {
|
|
478
483
|
this.state.editorErrorMessage = validateResult;
|
|
479
484
|
this.state.validateError = true;
|
|
480
|
-
(_j = this.errorMsg) === null || _j === void 0 ? void 0 : _j.
|
|
485
|
+
(_j = this.errorMsg) === null || _j === void 0 ? void 0 : _j.style.setObj({
|
|
481
486
|
visibility: this.state.editorErrorMessage ? 'visible' : 'hidden',
|
|
482
487
|
});
|
|
483
488
|
(_l = (_k = this.errorMsg) === null || _k === void 0 ? void 0 : _k.textNode) === null || _l === void 0 ? void 0 : _l.setText(this.state.editorErrorMessage || '');
|
|
@@ -2,6 +2,7 @@ import { InputEnum, TypeElement, TypeSvgSvg } from '@type-dom/framework';
|
|
|
2
2
|
import { IStyle } from '@type-dom/css-type';
|
|
3
3
|
import { IUI, IUIConfig } from '../../../ui/ui.interface';
|
|
4
4
|
import { ISize } from '../../../styles/size';
|
|
5
|
+
import { TdInput } from '../../form';
|
|
5
6
|
export interface ITdMessageBox extends IUI {
|
|
6
7
|
className: 'TdMessageBox';
|
|
7
8
|
}
|
|
@@ -10,7 +11,7 @@ export type IMessageBoxType = '' | 'prompt' | 'alert' | 'confirm';
|
|
|
10
11
|
export type MessageBoxData = IMessageBoxInputData & IAction;
|
|
11
12
|
export type IAction = 'confirm' | 'close' | 'cancel';
|
|
12
13
|
export interface IMessageBoxInputData {
|
|
13
|
-
|
|
14
|
+
input?: TdInput;
|
|
14
15
|
action?: IAction;
|
|
15
16
|
}
|
|
16
17
|
export interface MessageBoxInputValidator {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypeNode } from '@type-dom/framework';
|
|
1
2
|
import { UI } from '../../../ui/ui.abstract';
|
|
2
3
|
import { INotificationPosition, ITdNotification, ITdNotificationConfig } from './td-notification.interface';
|
|
3
4
|
export declare class TdNotification extends UI<undefined> implements ITdNotification {
|
|
@@ -18,7 +19,7 @@ export declare class TdNotification extends UI<undefined> implements ITdNotifica
|
|
|
18
19
|
private verticalProperty;
|
|
19
20
|
constructor(option?: string | ITdNotificationConfig);
|
|
20
21
|
mounted(): void;
|
|
21
|
-
|
|
22
|
+
destroy(root?: TypeNode): void;
|
|
22
23
|
static success(params?: ITdNotificationConfig): void;
|
|
23
24
|
static warning(params?: ITdNotificationConfig): void;
|
|
24
25
|
static error(params?: ITdNotificationConfig): void;
|
|
@@ -26,5 +27,5 @@ export declare class TdNotification extends UI<undefined> implements ITdNotifica
|
|
|
26
27
|
startTimer(): void;
|
|
27
28
|
clearTimer(): void;
|
|
28
29
|
close(): void;
|
|
29
|
-
onKeydown({ code }: KeyboardEvent)
|
|
30
|
+
onKeydown: ({ code }: KeyboardEvent) => void;
|
|
30
31
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdNotification = void 0;
|
|
4
|
+
const utils_1 = require("@type-dom/utils");
|
|
4
5
|
const framework_1 = require("@type-dom/framework");
|
|
5
6
|
const svgs_1 = require("@type-dom/svgs");
|
|
6
7
|
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
7
|
-
const aria_1 = require("../../../aria");
|
|
8
|
-
const td_notification_style_1 = require("./td-notification.style");
|
|
9
8
|
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
9
|
+
const td_notification_style_1 = require("./td-notification.style");
|
|
10
10
|
class TdNotification extends ui_abstract_1.UI {
|
|
11
11
|
constructor(option) {
|
|
12
12
|
let params;
|
|
@@ -22,6 +22,21 @@ class TdNotification extends ui_abstract_1.UI {
|
|
|
22
22
|
this.GAP_SIZE = 16;
|
|
23
23
|
this.seed = 1;
|
|
24
24
|
this.timer = undefined;
|
|
25
|
+
this.onKeydown = ({ code }) => {
|
|
26
|
+
console.log('onKeydown ', code);
|
|
27
|
+
if (code === utils_1.EVENT_CODE.delete || code === utils_1.EVENT_CODE.backspace) {
|
|
28
|
+
this.clearTimer(); // press delete/backspace clear timer
|
|
29
|
+
}
|
|
30
|
+
else if (code === utils_1.EVENT_CODE.esc) {
|
|
31
|
+
// press esc to close the notification
|
|
32
|
+
if (this.visible) {
|
|
33
|
+
this.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.startTimer(); // resume timer
|
|
38
|
+
}
|
|
39
|
+
};
|
|
25
40
|
this.className = 'TdNotification';
|
|
26
41
|
(0, td_notification_style_1.useStyle)(params);
|
|
27
42
|
this.to = document.body;
|
|
@@ -135,7 +150,7 @@ class TdNotification extends ui_abstract_1.UI {
|
|
|
135
150
|
this.notification.addChild(this.group);
|
|
136
151
|
const position = (params === null || params === void 0 ? void 0 : params.position) || 'top-right';
|
|
137
152
|
const horizontal = position.endsWith('right') ? 'right' : 'left';
|
|
138
|
-
this.notification.
|
|
153
|
+
this.notification.style.addObj({ [horizontal]: '16px' });
|
|
139
154
|
this.verticalProperty = position.startsWith('top') ? 'top' : 'bottom';
|
|
140
155
|
let verticalOffset = (params === null || params === void 0 ? void 0 : params.offset) || 0;
|
|
141
156
|
console.log('verticalOffset is ', verticalOffset);
|
|
@@ -147,21 +162,21 @@ class TdNotification extends ui_abstract_1.UI {
|
|
|
147
162
|
[this.verticalProperty]: `${verticalOffset}px`,
|
|
148
163
|
zIndex: 9999, // params?.zIndex ?? currentZIndex,
|
|
149
164
|
};
|
|
150
|
-
this.notification.
|
|
165
|
+
this.notification.style.addObj(positionStyle);
|
|
151
166
|
TdNotification.notifyId = TdNotification.notifyId + 1;
|
|
152
167
|
TdNotification.notifications[position].push(this);
|
|
153
|
-
this.props = this.
|
|
168
|
+
this.props = this.useParams(params);
|
|
154
169
|
this.mount(this.to);
|
|
155
170
|
}
|
|
156
171
|
mounted() {
|
|
157
172
|
this.startTimer();
|
|
158
173
|
// nextZIndex()
|
|
159
174
|
this.visible = true;
|
|
175
|
+
document.addEventListener('keydown', this.onKeydown);
|
|
160
176
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
177
|
+
destroy(root) {
|
|
178
|
+
document.removeEventListener('keydown', this.onKeydown);
|
|
179
|
+
super.destroy(root);
|
|
165
180
|
}
|
|
166
181
|
static success(params) {
|
|
167
182
|
new TdNotification(Object.assign({ type: 'success' }, params));
|
|
@@ -192,7 +207,7 @@ class TdNotification extends ui_abstract_1.UI {
|
|
|
192
207
|
}
|
|
193
208
|
close() {
|
|
194
209
|
this.visible = false;
|
|
195
|
-
this.notification.
|
|
210
|
+
this.notification.style.hide();
|
|
196
211
|
const position = this.props.position || 'top-right';
|
|
197
212
|
TdNotification.notifications[position] = TdNotification.notifications[position].filter((notification) => notification !== this);
|
|
198
213
|
TdNotification.notifyId = TdNotification.notifyId - 1;
|
|
@@ -200,28 +215,13 @@ class TdNotification extends ui_abstract_1.UI {
|
|
|
200
215
|
console.log('height is ', verticalOffset);
|
|
201
216
|
TdNotification.notifications[position].forEach((item, index) => {
|
|
202
217
|
verticalOffset = verticalOffset + this.GAP_SIZE;
|
|
203
|
-
item.notification.
|
|
218
|
+
item.notification.style.setObj({
|
|
204
219
|
[this.verticalProperty]: `${verticalOffset}px`,
|
|
205
220
|
});
|
|
206
221
|
verticalOffset += item.notification.dom.offsetHeight; // + this.GAP_SIZE;
|
|
207
222
|
});
|
|
208
223
|
this.destroy(); // todo 应该是 Transition 的 afterLeave 触发 destroy; 会删除props
|
|
209
224
|
}
|
|
210
|
-
onKeydown({ code }) {
|
|
211
|
-
console.log('onKeydown ', code);
|
|
212
|
-
if (code === aria_1.EVENT_CODE.delete || code === aria_1.EVENT_CODE.backspace) {
|
|
213
|
-
this.clearTimer(); // press delete/backspace clear timer
|
|
214
|
-
}
|
|
215
|
-
else if (code === aria_1.EVENT_CODE.esc) {
|
|
216
|
-
// press esc to close the notification
|
|
217
|
-
if (this.visible) {
|
|
218
|
-
this.close();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
this.startTimer(); // resume timer
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
225
|
}
|
|
226
226
|
exports.TdNotification = TdNotification;
|
|
227
227
|
TdNotification.notifyId = 0;
|
|
@@ -52,27 +52,27 @@ exports.$notificationStyle = {
|
|
|
52
52
|
boxShadow: exports.$notification.shadow,
|
|
53
53
|
// transition: opacity getCssVar('transition-duration'),
|
|
54
54
|
transition: 'opacity ' +
|
|
55
|
-
var_1.$
|
|
55
|
+
var_1.$transitionDurationDefault +
|
|
56
56
|
', ' +
|
|
57
57
|
// transform getCssVar('transition-duration'),
|
|
58
58
|
'transform ' +
|
|
59
|
-
var_1.$
|
|
59
|
+
var_1.$transitionDurationDefault +
|
|
60
60
|
', ' +
|
|
61
61
|
// top getCssVar('transition-duration'),
|
|
62
62
|
'top ' +
|
|
63
|
-
var_1.$
|
|
63
|
+
var_1.$transitionDurationDefault +
|
|
64
64
|
', ' +
|
|
65
65
|
// left getCssVar('transition-duration'),
|
|
66
66
|
'left ' +
|
|
67
|
-
var_1.$
|
|
67
|
+
var_1.$transitionDurationDefault +
|
|
68
68
|
', ' +
|
|
69
69
|
// right getCssVar('transition-duration'), top 0.4s,
|
|
70
70
|
'right ' +
|
|
71
|
-
var_1.$
|
|
71
|
+
var_1.$transitionDurationDefault +
|
|
72
72
|
', ' +
|
|
73
73
|
// bottom getCssVar('transition-duration'),
|
|
74
74
|
'bottom ' +
|
|
75
|
-
var_1.$
|
|
75
|
+
var_1.$transitionDurationDefault +
|
|
76
76
|
', ',
|
|
77
77
|
overflowWrap: 'break-word',
|
|
78
78
|
overflow: 'hidden',
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TdOnlyChild = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const utils_1 = require("@type-dom/utils");
|
|
6
|
+
const use_forward_ref_1 = require("../../../hooks/use-forward-ref");
|
|
7
|
+
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
8
|
+
class TdOnlyChild extends ui_abstract_1.UI {
|
|
9
|
+
constructor(params = {}) {
|
|
10
|
+
super(params);
|
|
11
|
+
this.className = 'TdOnlyChild';
|
|
12
|
+
this.props = this.useParams(params);
|
|
13
|
+
}
|
|
14
|
+
setup() {
|
|
15
|
+
var _a;
|
|
16
|
+
const forwardRefInjection = this.inject(use_forward_ref_1.FORWARD_REF_INJECTION_KEY);
|
|
17
|
+
const forwardRefDirective = (0, use_forward_ref_1.useForwardRefDirective)((_a = forwardRefInjection === null || forwardRefInjection === void 0 ? void 0 : forwardRefInjection.setForwardRef) !== null && _a !== void 0 ? _a : utils_1.NOOP);
|
|
18
|
+
const defaultSlot = this.slotNodes['default'];
|
|
19
|
+
if (!defaultSlot)
|
|
20
|
+
return null;
|
|
21
|
+
// if (defaultSlot.length > 1) {
|
|
22
|
+
// // debugWarn('TdOnlyChild', 'requires exact only one valid child.')
|
|
23
|
+
// return null
|
|
24
|
+
// }
|
|
25
|
+
// const firstLegitNode = findFirstLegitChild(defaultSlot!)
|
|
26
|
+
// if (!firstLegitNode) {
|
|
27
|
+
// // debugWarn(NAME, 'no valid child node found')
|
|
28
|
+
// return null
|
|
29
|
+
// }
|
|
30
|
+
// return withDirectives(cloneVNode(firstLegitNode!, attrs), [
|
|
31
|
+
// [forwardRefDirective],
|
|
32
|
+
// ])
|
|
33
|
+
return null; // add by me todo
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.TdOnlyChild = TdOnlyChild;
|
|
37
|
+
function findFirstLegitChild(node) {
|
|
38
|
+
if (!node)
|
|
39
|
+
return null;
|
|
40
|
+
const children = node;
|
|
41
|
+
for (const child of children) {
|
|
42
|
+
/**
|
|
43
|
+
* when user uses h(Fragment, [text]) to render plain string,
|
|
44
|
+
* this switch case just cannot handle, when the value is primitives
|
|
45
|
+
* we should just return the wrapped string
|
|
46
|
+
*/
|
|
47
|
+
if ((0, utils_1.isObject)(child)) {
|
|
48
|
+
// switch (child.dom) { // todo
|
|
49
|
+
// case Comment:
|
|
50
|
+
// continue
|
|
51
|
+
// case Text:
|
|
52
|
+
// case SVGElement:
|
|
53
|
+
// return wrapTextContent(child)
|
|
54
|
+
// case undefined:
|
|
55
|
+
// return findFirstLegitChild(child.children as TypeNode[])
|
|
56
|
+
// default:
|
|
57
|
+
// return child
|
|
58
|
+
// }
|
|
59
|
+
}
|
|
60
|
+
return wrapTextContent(child);
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function wrapTextContent(slot) {
|
|
65
|
+
// const ns = 'only-child';
|
|
66
|
+
// return `<span class=${ns + '-content'}>${s}</span>`;
|
|
67
|
+
return new framework_1.Span({
|
|
68
|
+
// text: s,
|
|
69
|
+
attrObj: {
|
|
70
|
+
class: 'only-child-content',
|
|
71
|
+
},
|
|
72
|
+
childNodes: typeof slot === 'string' ? [new framework_1.TextNode(slot)] : [slot],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { TypeElement } from '@type-dom/framework';
|
|
1
2
|
import { UI } from '../../../ui/ui.abstract';
|
|
2
3
|
import { ITdOverlay, ITdOverlayConfig } from './td-overlay.interface';
|
|
3
|
-
import { TypeElement } from '@type-dom/framework';
|
|
4
4
|
export declare let overlayZIndex: number;
|
|
5
5
|
export declare class TdOverlay extends UI implements ITdOverlay {
|
|
6
6
|
className: 'TdOverlay';
|
|
@@ -9,14 +9,14 @@ class TdOverlay extends ui_abstract_1.UI {
|
|
|
9
9
|
super(params);
|
|
10
10
|
exports.overlayZIndex = exports.overlayZIndex + 1;
|
|
11
11
|
this.className = 'TdOverlay';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj(td_overlay_style_1.$tdOverlayStyle);
|
|
13
13
|
if (params === null || params === void 0 ? void 0 : params.mask) {
|
|
14
|
-
this.
|
|
14
|
+
this.style.addObj({
|
|
15
15
|
zIndex: (params === null || params === void 0 ? void 0 : params.zIndex) || exports.overlayZIndex,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
this.
|
|
19
|
+
this.style.addObj({
|
|
20
20
|
zIndex: (params === null || params === void 0 ? void 0 : params.zIndex) || exports.overlayZIndex,
|
|
21
21
|
position: 'fixed',
|
|
22
22
|
top: '0px',
|
|
@@ -26,10 +26,10 @@ class TdOverlay extends ui_abstract_1.UI {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
this.addChild(this.getSlotNode());
|
|
29
|
-
this.props = this.
|
|
29
|
+
this.props = this.useParams(params);
|
|
30
30
|
}
|
|
31
31
|
addSlot(slot) {
|
|
32
|
-
this.getSlotNode(
|
|
32
|
+
this.getSlotNode().resetSlot(slot);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.TdOverlay = TdOverlay;
|
|
@@ -3,5 +3,11 @@ import { ITdPopperArrow, ITdPopperArrowConfig } from './arrow.interface';
|
|
|
3
3
|
export declare class TdPopperArrow extends UI implements ITdPopperArrow {
|
|
4
4
|
className: 'TdPopperArrow';
|
|
5
5
|
props: ITdPopperArrowConfig;
|
|
6
|
+
private arrowOffset?;
|
|
7
|
+
arrowRef?: HTMLElement;
|
|
8
|
+
private arrowStyle?;
|
|
6
9
|
constructor(params?: ITdPopperArrowConfig);
|
|
10
|
+
setup(): void;
|
|
11
|
+
beforeDestroy(): void;
|
|
12
|
+
setArrowOffset(offset: number): void;
|
|
7
13
|
}
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TdPopperArrow = void 0;
|
|
4
4
|
const var_1 = require("../../../../styles/var");
|
|
5
5
|
const ui_abstract_1 = require("../../../../ui/ui.abstract");
|
|
6
|
+
const td_popper_const_1 = require("../td-popper.const");
|
|
6
7
|
class TdPopperArrow extends ui_abstract_1.UI {
|
|
7
8
|
constructor(params = {}) {
|
|
8
9
|
super(params, 'span');
|
|
9
10
|
this.className = 'TdPopperArrow';
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
11
|
+
this.attr.addName('td-popper-arrow');
|
|
12
|
+
this.style.addObj({
|
|
12
13
|
position: 'absolute',
|
|
13
14
|
width: '10px',
|
|
14
15
|
height: '10px',
|
|
@@ -26,7 +27,25 @@ class TdPopperArrow extends ui_abstract_1.UI {
|
|
|
26
27
|
boxSizing: 'border-box'
|
|
27
28
|
// }
|
|
28
29
|
});
|
|
29
|
-
this.
|
|
30
|
+
this.buildProps({
|
|
31
|
+
arrowOffset: 5,
|
|
32
|
+
});
|
|
33
|
+
this.props = this.useParams(params);
|
|
34
|
+
}
|
|
35
|
+
setup() {
|
|
36
|
+
const { arrowOffset, arrowRef, arrowStyle } = this.inject(td_popper_const_1.POPPER_CONTENT_INJECTION_KEY, undefined);
|
|
37
|
+
this.arrowOffset = arrowOffset;
|
|
38
|
+
this.arrowRef = arrowRef;
|
|
39
|
+
this.arrowStyle = arrowStyle;
|
|
40
|
+
}
|
|
41
|
+
beforeDestroy() {
|
|
42
|
+
this.arrowRef = undefined;
|
|
43
|
+
}
|
|
44
|
+
setArrowOffset(offset) {
|
|
45
|
+
this.setProp('arrowOffset', offset);
|
|
46
|
+
if (offset) {
|
|
47
|
+
this.arrowOffset = offset;
|
|
48
|
+
}
|
|
30
49
|
}
|
|
31
50
|
}
|
|
32
51
|
exports.TdPopperArrow = TdPopperArrow;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|