@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
|
@@ -1,15 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdCol = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
4
|
const utils_1 = require("@type-dom/utils");
|
|
6
5
|
const ui_abstract_1 = require("../../../../ui/ui.abstract");
|
|
7
6
|
class TdCol extends ui_abstract_1.UI {
|
|
8
7
|
constructor(params = {}) {
|
|
9
8
|
super(params);
|
|
9
|
+
// 使用防抖函数包装处理函数
|
|
10
|
+
this.debounceResize = () => (0, utils_1.debounce)(this.resize, 250)();
|
|
11
|
+
this.resize = () => {
|
|
12
|
+
console.log('this.screenWidth is ', this.screenWidth);
|
|
13
|
+
const props = this.props;
|
|
14
|
+
if (props === null || props === void 0 ? void 0 : props.xs) {
|
|
15
|
+
if (this.screenWidth < 768) {
|
|
16
|
+
// 超小屏幕(xs)
|
|
17
|
+
// 当前屏幕尺寸小于768px,执行xs断点下的操作
|
|
18
|
+
const proportion = (0, utils_1.formatFloat)(props.xs / 24) * 100 + '%';
|
|
19
|
+
this.style.setObj({
|
|
20
|
+
maxWidth: proportion,
|
|
21
|
+
flex: '0 0 ' + proportion
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (props === null || props === void 0 ? void 0 : props.sm) {
|
|
26
|
+
if (this.screenWidth >= 768) {
|
|
27
|
+
// && this.screenWidth < 992
|
|
28
|
+
// 小屏幕(sm)
|
|
29
|
+
// 当前屏幕尺寸在768px至991px之间,执行md断点下的操作
|
|
30
|
+
// 设置你的值或执行相应JS代码
|
|
31
|
+
const proportion = (0, utils_1.formatFloat)(props.sm / 24) * 100 + '%';
|
|
32
|
+
this.style.setObj({
|
|
33
|
+
maxWidth: proportion,
|
|
34
|
+
flex: '0 0 ' + proportion
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (props === null || props === void 0 ? void 0 : props.md) {
|
|
39
|
+
if (this.screenWidth >= 992) {
|
|
40
|
+
// && this.screenWidth < 1200
|
|
41
|
+
// 中屏幕(md)
|
|
42
|
+
// 当前屏幕尺寸在992px至1199px之间,执行lg断点下的操作
|
|
43
|
+
// 设置你的值或执行相应JS代码
|
|
44
|
+
const proportion = (0, utils_1.formatFloat)(props.md / 24) * 100 + '%';
|
|
45
|
+
this.style.setObj({
|
|
46
|
+
maxWidth: proportion,
|
|
47
|
+
flex: '0 0 ' + proportion
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (props === null || props === void 0 ? void 0 : props.lg) {
|
|
52
|
+
if (this.screenWidth >= 1200) {
|
|
53
|
+
// && this.screenWidth < 1920
|
|
54
|
+
// 大屏幕(lg)
|
|
55
|
+
// 当前屏幕尺寸在1200px至1920px之间,执行lg断点下的操作
|
|
56
|
+
// 设置你的值或执行相应JS代码
|
|
57
|
+
const proportion = (0, utils_1.formatFloat)(props.lg / 24) * 100 + '%';
|
|
58
|
+
this.style.setObj({
|
|
59
|
+
maxWidth: proportion,
|
|
60
|
+
flex: '0 0 ' + proportion
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (props === null || props === void 0 ? void 0 : props.xl) {
|
|
65
|
+
if (this.screenWidth >= 1920) {
|
|
66
|
+
// 超大屏幕(xl及以上)
|
|
67
|
+
// 当前屏幕尺寸等于或大于1920px,执行xl断点下的操作
|
|
68
|
+
// 设置你的值或执行相应JS代码
|
|
69
|
+
const proportion = (0, utils_1.formatFloat)(props.xl / 24) * 100 + '%';
|
|
70
|
+
this.style.setObj({
|
|
71
|
+
maxWidth: proportion,
|
|
72
|
+
flex: '0 0 ' + proportion
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
10
77
|
this.className = 'TdCol';
|
|
11
78
|
this.addChild(this.getSlotNode());
|
|
12
|
-
this.props = this.
|
|
79
|
+
this.props = this.useParams(params);
|
|
13
80
|
}
|
|
14
81
|
get screenWidth() {
|
|
15
82
|
return window.innerWidth || document.documentElement.clientWidth;
|
|
@@ -18,13 +85,13 @@ class TdCol extends ui_abstract_1.UI {
|
|
|
18
85
|
const props = this.props;
|
|
19
86
|
if (props === null || props === void 0 ? void 0 : props.span) {
|
|
20
87
|
if (props.span === 0) {
|
|
21
|
-
this.
|
|
88
|
+
this.style.addObj({
|
|
22
89
|
display: 'none'
|
|
23
90
|
});
|
|
24
91
|
}
|
|
25
92
|
else {
|
|
26
93
|
const proportion = (0, utils_1.formatFloat)(props.span / 24) * 100 + '%';
|
|
27
|
-
this.
|
|
94
|
+
this.style.addObj({
|
|
28
95
|
maxWidth: proportion,
|
|
29
96
|
flex: '0 0 ' + proportion
|
|
30
97
|
});
|
|
@@ -32,100 +99,33 @@ class TdCol extends ui_abstract_1.UI {
|
|
|
32
99
|
}
|
|
33
100
|
if (props === null || props === void 0 ? void 0 : props.offset) {
|
|
34
101
|
const proportion = (0, utils_1.formatFloat)(props.offset / 24) * 100 + '%';
|
|
35
|
-
this.
|
|
102
|
+
this.style.addObj({
|
|
36
103
|
marginLeft: proportion
|
|
37
104
|
});
|
|
38
105
|
}
|
|
39
106
|
if (props === null || props === void 0 ? void 0 : props.pull) {
|
|
40
107
|
const proportion = (0, utils_1.formatFloat)(props.pull / 24) * 100 + '%';
|
|
41
|
-
this.
|
|
108
|
+
this.style.addObj({
|
|
42
109
|
position: 'relative',
|
|
43
110
|
right: proportion
|
|
44
111
|
});
|
|
45
112
|
}
|
|
46
113
|
if (props === null || props === void 0 ? void 0 : props.push) {
|
|
47
114
|
const proportion = (0, utils_1.formatFloat)(props.push / 24) * 100 + '%';
|
|
48
|
-
this.
|
|
115
|
+
this.style.addObj({
|
|
49
116
|
position: 'relative',
|
|
50
117
|
left: proportion
|
|
51
118
|
});
|
|
52
119
|
}
|
|
53
120
|
this.resize();
|
|
54
121
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (props === null || props === void 0 ? void 0 : props.xs) {
|
|
59
|
-
if (this.screenWidth < 768) {
|
|
60
|
-
// 超小屏幕(xs)
|
|
61
|
-
// 当前屏幕尺寸小于768px,执行xs断点下的操作
|
|
62
|
-
const proportion = (0, utils_1.formatFloat)(props.xs / 24) * 100 + '%';
|
|
63
|
-
this.ctrl.setStyleObj({
|
|
64
|
-
maxWidth: proportion,
|
|
65
|
-
flex: '0 0 ' + proportion
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (props === null || props === void 0 ? void 0 : props.sm) {
|
|
70
|
-
if (this.screenWidth >= 768) {
|
|
71
|
-
// && this.screenWidth < 992
|
|
72
|
-
// 小屏幕(sm)
|
|
73
|
-
// 当前屏幕尺寸在768px至991px之间,执行md断点下的操作
|
|
74
|
-
// 设置你的值或执行相应JS代码
|
|
75
|
-
const proportion = (0, utils_1.formatFloat)(props.sm / 24) * 100 + '%';
|
|
76
|
-
this.ctrl.setStyleObj({
|
|
77
|
-
maxWidth: proportion,
|
|
78
|
-
flex: '0 0 ' + proportion
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (props === null || props === void 0 ? void 0 : props.md) {
|
|
83
|
-
if (this.screenWidth >= 992) {
|
|
84
|
-
// && this.screenWidth < 1200
|
|
85
|
-
// 中屏幕(md)
|
|
86
|
-
// 当前屏幕尺寸在992px至1199px之间,执行lg断点下的操作
|
|
87
|
-
// 设置你的值或执行相应JS代码
|
|
88
|
-
const proportion = (0, utils_1.formatFloat)(props.md / 24) * 100 + '%';
|
|
89
|
-
this.ctrl.setStyleObj({
|
|
90
|
-
maxWidth: proportion,
|
|
91
|
-
flex: '0 0 ' + proportion
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (props === null || props === void 0 ? void 0 : props.lg) {
|
|
96
|
-
if (this.screenWidth >= 1200) {
|
|
97
|
-
// && this.screenWidth < 1920
|
|
98
|
-
// 大屏幕(lg)
|
|
99
|
-
// 当前屏幕尺寸在1200px至1920px之间,执行lg断点下的操作
|
|
100
|
-
// 设置你的值或执行相应JS代码
|
|
101
|
-
const proportion = (0, utils_1.formatFloat)(props.lg / 24) * 100 + '%';
|
|
102
|
-
this.ctrl.setStyleObj({
|
|
103
|
-
maxWidth: proportion,
|
|
104
|
-
flex: '0 0 ' + proportion
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (props === null || props === void 0 ? void 0 : props.xl) {
|
|
109
|
-
if (this.screenWidth >= 1920) {
|
|
110
|
-
// 超大屏幕(xl及以上)
|
|
111
|
-
// 当前屏幕尺寸等于或大于1920px,执行xl断点下的操作
|
|
112
|
-
// 设置你的值或执行相应JS代码
|
|
113
|
-
const proportion = (0, utils_1.formatFloat)(props.xl / 24) * 100 + '%';
|
|
114
|
-
this.ctrl.setStyleObj({
|
|
115
|
-
maxWidth: proportion,
|
|
116
|
-
flex: '0 0 ' + proportion
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
122
|
+
mounted() {
|
|
123
|
+
// 监听窗口大小改变事件
|
|
124
|
+
window.addEventListener('resize', this.debounceResize);
|
|
120
125
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// distinctUntilChanged() // 可选,仅在窗口尺寸发生实际变化时才触发
|
|
125
|
-
)
|
|
126
|
-
.subscribe((event) => {
|
|
127
|
-
this.resize();
|
|
128
|
-
});
|
|
126
|
+
destroy(root) {
|
|
127
|
+
window.removeEventListener('resize', this.debounceResize);
|
|
128
|
+
super.destroy(root);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
exports.TdCol = TdCol;
|
|
@@ -10,7 +10,7 @@ class TdRow extends ui_abstract_1.UI {
|
|
|
10
10
|
constructor(params = {}) {
|
|
11
11
|
super(params);
|
|
12
12
|
this.className = 'TdRow';
|
|
13
|
-
this.
|
|
13
|
+
this.style.addObj({
|
|
14
14
|
display: 'flex',
|
|
15
15
|
flexWrap: 'wrap',
|
|
16
16
|
position: 'relative',
|
|
@@ -18,20 +18,20 @@ class TdRow extends ui_abstract_1.UI {
|
|
|
18
18
|
});
|
|
19
19
|
this.childNodes = [];
|
|
20
20
|
this.addChild(this.getSlotNode());
|
|
21
|
-
this.props = this.
|
|
21
|
+
this.props = this.useParams(params);
|
|
22
22
|
}
|
|
23
23
|
setup() {
|
|
24
24
|
const props = this.props;
|
|
25
25
|
if (props === null || props === void 0 ? void 0 : props.gutter) {
|
|
26
26
|
this.gutter = props.gutter;
|
|
27
|
-
this.
|
|
27
|
+
this.style.addObj({
|
|
28
28
|
marginLeft: `-${props.gutter / 2}px`,
|
|
29
29
|
marginRight: `-${props.gutter / 2}px`
|
|
30
30
|
});
|
|
31
31
|
this.children.forEach((child) => {
|
|
32
32
|
if (child instanceof td_col_class_1.TdCol) {
|
|
33
33
|
if (props.gutter) {
|
|
34
|
-
child.
|
|
34
|
+
child.style.addObj({
|
|
35
35
|
boxSizing: 'border-box',
|
|
36
36
|
paddingLeft: `${props.gutter / 2}px`,
|
|
37
37
|
paddingRight: `${props.gutter / 2}px`
|
|
@@ -44,27 +44,27 @@ class TdRow extends ui_abstract_1.UI {
|
|
|
44
44
|
// this.setJustify(props.justify);
|
|
45
45
|
switch (props.justify) {
|
|
46
46
|
case 'center':
|
|
47
|
-
this.
|
|
47
|
+
this.style.addObj({
|
|
48
48
|
justifyContent: 'center'
|
|
49
49
|
});
|
|
50
50
|
break;
|
|
51
51
|
case 'end':
|
|
52
|
-
this.
|
|
52
|
+
this.style.addObj({
|
|
53
53
|
justifyContent: 'flex-end'
|
|
54
54
|
});
|
|
55
55
|
break;
|
|
56
56
|
case 'space-between':
|
|
57
|
-
this.
|
|
57
|
+
this.style.addObj({
|
|
58
58
|
justifyContent: 'space-between'
|
|
59
59
|
});
|
|
60
60
|
break;
|
|
61
61
|
case 'space-around':
|
|
62
|
-
this.
|
|
62
|
+
this.style.addObj({
|
|
63
63
|
justifyContent: 'space-around'
|
|
64
64
|
});
|
|
65
65
|
break;
|
|
66
66
|
case 'space-evenly':
|
|
67
|
-
this.
|
|
67
|
+
this.style.addObj({
|
|
68
68
|
justifyContent: 'space-evenly'
|
|
69
69
|
});
|
|
70
70
|
break;
|
|
@@ -76,22 +76,22 @@ class TdRow extends ui_abstract_1.UI {
|
|
|
76
76
|
// this.setAlign(props.align);
|
|
77
77
|
switch (props.align) {
|
|
78
78
|
case 'top':
|
|
79
|
-
this.
|
|
79
|
+
this.style.addObj({
|
|
80
80
|
alignItems: 'flex-start'
|
|
81
81
|
});
|
|
82
82
|
break;
|
|
83
83
|
case 'middle':
|
|
84
|
-
this.
|
|
84
|
+
this.style.addObj({
|
|
85
85
|
alignItems: 'center'
|
|
86
86
|
});
|
|
87
87
|
break;
|
|
88
88
|
case 'bottom':
|
|
89
|
-
this.
|
|
89
|
+
this.style.addObj({
|
|
90
90
|
alignItems: 'flex-end'
|
|
91
91
|
});
|
|
92
92
|
break;
|
|
93
93
|
case 'stretch':
|
|
94
|
-
this.
|
|
94
|
+
this.style.addObj({
|
|
95
95
|
alignItems: 'stretch'
|
|
96
96
|
});
|
|
97
97
|
break;
|
|
@@ -9,29 +9,29 @@ class TdLink extends ui_abstract_1.UI {
|
|
|
9
9
|
super(params, 'a');
|
|
10
10
|
this.className = 'TdLink';
|
|
11
11
|
(0, td_link_style_1.useType)(params);
|
|
12
|
-
this.
|
|
13
|
-
this.props = this.
|
|
12
|
+
this.style.addObj(td_link_style_1.$linkStyle);
|
|
13
|
+
this.props = this.useParams(params);
|
|
14
14
|
}
|
|
15
15
|
// override beforeCreate() {
|
|
16
|
-
// this.
|
|
16
|
+
// this.style.addObj($linkStyle);
|
|
17
17
|
// }
|
|
18
18
|
setup() {
|
|
19
19
|
const props = this.props;
|
|
20
|
-
this.
|
|
20
|
+
this.attr.addObj({
|
|
21
21
|
href: props === null || props === void 0 ? void 0 : props.href,
|
|
22
22
|
target: props === null || props === void 0 ? void 0 : props.target,
|
|
23
23
|
disabled: props === null || props === void 0 ? void 0 : props.disabled
|
|
24
24
|
});
|
|
25
25
|
if (props === null || props === void 0 ? void 0 : props.type) {
|
|
26
26
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
27
|
-
this.
|
|
27
|
+
this.style.addObj(td_link_style_1.$linkStateColors[props.type].disabled);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
this.
|
|
30
|
+
this.style.addObj(td_link_style_1.$linkStateColors[props.type].default);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
this.
|
|
34
|
+
this.style.addObj(td_link_style_1.$linkStateColors.default.default);
|
|
35
35
|
}
|
|
36
36
|
if (props === null || props === void 0 ? void 0 : props.icon) {
|
|
37
37
|
this.unshiftChild(props.icon);
|
|
@@ -42,8 +42,6 @@ class TdLink extends ui_abstract_1.UI {
|
|
|
42
42
|
});
|
|
43
43
|
this.inner.addChild(this.getSlotNode());
|
|
44
44
|
this.addChild(this.inner);
|
|
45
|
-
}
|
|
46
|
-
initEvents() {
|
|
47
45
|
this.addEvents({
|
|
48
46
|
click: (evt) => {
|
|
49
47
|
this.handleClick(evt);
|
|
@@ -51,47 +49,47 @@ class TdLink extends ui_abstract_1.UI {
|
|
|
51
49
|
mouseenter: () => {
|
|
52
50
|
if (this.props.type) {
|
|
53
51
|
if (this.props.disabled) {
|
|
54
|
-
this.
|
|
52
|
+
this.style.setObj({
|
|
55
53
|
cursor: 'notAllowed'
|
|
56
54
|
});
|
|
57
55
|
}
|
|
58
56
|
else {
|
|
59
|
-
this.
|
|
57
|
+
this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].hover);
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
else {
|
|
63
|
-
this.
|
|
61
|
+
this.style.setObj(td_link_style_1.$linkStateColors.default.hover);
|
|
64
62
|
}
|
|
65
63
|
if (this.props.underline === false) {
|
|
66
64
|
// 设置 false 的情况下,不显示下划线
|
|
67
|
-
this.
|
|
65
|
+
this.style.setObj({
|
|
68
66
|
textDecoration: 'none'
|
|
69
67
|
});
|
|
70
68
|
}
|
|
71
69
|
else {
|
|
72
70
|
// 1. 默认显示下划线
|
|
73
71
|
// 2. 默认显示下划线,如果设置了 underline 为 true,则显示下划线
|
|
74
|
-
this.
|
|
72
|
+
this.style.setObj({
|
|
75
73
|
textDecoration: 'underline'
|
|
76
74
|
});
|
|
77
75
|
}
|
|
78
76
|
},
|
|
79
77
|
mouseleave: (evt) => {
|
|
80
|
-
this.
|
|
78
|
+
this.style.setObj({
|
|
81
79
|
textDecoration: 'none'
|
|
82
80
|
});
|
|
83
81
|
if (this.props.type) {
|
|
84
|
-
this.
|
|
82
|
+
this.style.removeObj(td_link_style_1.$linkStateColors[this.props.type].hover);
|
|
85
83
|
if (this.props.disabled) {
|
|
86
84
|
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
87
|
-
this.
|
|
85
|
+
this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].disabled);
|
|
88
86
|
}
|
|
89
87
|
else {
|
|
90
|
-
this.
|
|
88
|
+
this.style.setObj(td_link_style_1.$linkStateColors[this.props.type].default);
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
else {
|
|
94
|
-
this.
|
|
92
|
+
this.style.removeObj(td_link_style_1.$linkStateColors.default.hover);
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
});
|
|
@@ -7,8 +7,8 @@ class TdScrollbarBar extends ui_abstract_1.UI {
|
|
|
7
7
|
constructor(params = {}) {
|
|
8
8
|
super(params);
|
|
9
9
|
this.className = 'TdScrollbarBar';
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
10
|
+
this.attr.addName('td-scrollbar-bar');
|
|
11
|
+
this.style.addObj({
|
|
12
12
|
position: 'absolute',
|
|
13
13
|
right: '2px',
|
|
14
14
|
bottom: '2px',
|
|
@@ -26,7 +26,7 @@ class TdScrollbarBar extends ui_abstract_1.UI {
|
|
|
26
26
|
ratio: 1
|
|
27
27
|
})
|
|
28
28
|
];
|
|
29
|
-
this.props = this.
|
|
29
|
+
this.props = this.useParams(params);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.TdScrollbarBar = TdScrollbarBar;
|
|
@@ -8,8 +8,8 @@ class TdScrollbar extends ui_abstract_1.UI {
|
|
|
8
8
|
constructor(params = {}) {
|
|
9
9
|
super(params, params === null || params === void 0 ? void 0 : params.tag);
|
|
10
10
|
this.className = 'TdScrollbar';
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
11
|
+
this.attr.addName('td-scrollbar');
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
overflow: 'hidden',
|
|
14
14
|
position: 'relative',
|
|
15
15
|
height: '100%'
|
|
@@ -26,11 +26,11 @@ class TdScrollbar extends ui_abstract_1.UI {
|
|
|
26
26
|
name: 'td-scrollbar-view'
|
|
27
27
|
});
|
|
28
28
|
if (params === null || params === void 0 ? void 0 : params.viewStyle) {
|
|
29
|
-
this.view.
|
|
29
|
+
this.view.style.addObj(params.viewStyle);
|
|
30
30
|
}
|
|
31
31
|
this.wrap.addChild(this.view);
|
|
32
32
|
if (params === null || params === void 0 ? void 0 : params.wrapStyle) {
|
|
33
|
-
this.wrap.
|
|
33
|
+
this.wrap.style.addObj(params.wrapStyle);
|
|
34
34
|
}
|
|
35
35
|
this.addChild(this.wrap);
|
|
36
36
|
if (!(params === null || params === void 0 ? void 0 : params.native)) {
|
|
@@ -43,7 +43,7 @@ class TdScrollbar extends ui_abstract_1.UI {
|
|
|
43
43
|
if (params === null || params === void 0 ? void 0 : params.contents) {
|
|
44
44
|
this.view.addChildren(...params.contents);
|
|
45
45
|
}
|
|
46
|
-
this.props = this.
|
|
46
|
+
this.props = this.useParams(params);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
exports.TdScrollbar = TdScrollbar;
|
|
@@ -8,8 +8,8 @@ class TdScrollbarThumb extends ui_abstract_1.UI {
|
|
|
8
8
|
constructor(params = {}) {
|
|
9
9
|
super(params);
|
|
10
10
|
this.className = 'TdScrollbarThumb';
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
11
|
+
this.attr.addName('td-scrollbar-thumb');
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
position: 'absolute',
|
|
14
14
|
right: '2px',
|
|
15
15
|
bottom: '2px',
|
|
@@ -39,7 +39,7 @@ class TdScrollbarThumb extends ui_abstract_1.UI {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
this.addChild(this.thumb);
|
|
42
|
-
this.props = this.
|
|
42
|
+
this.props = this.useParams(params);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.TdScrollbarThumb = TdScrollbarThumb;
|
|
@@ -9,17 +9,17 @@ class TdSpace extends ui_abstract_1.UI {
|
|
|
9
9
|
constructor(params = {}) {
|
|
10
10
|
super(params);
|
|
11
11
|
this.className = 'TdSpace';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
display: 'inline-flex',
|
|
14
14
|
verticalAlign: 'top'
|
|
15
15
|
});
|
|
16
16
|
this.addChild(this.getSlotNode());
|
|
17
|
-
this.props = this.
|
|
17
|
+
this.props = this.useParams(params);
|
|
18
18
|
}
|
|
19
19
|
setup() {
|
|
20
20
|
this.children.forEach((item) => {
|
|
21
21
|
if (item instanceof framework_1.TypeElement) {
|
|
22
|
-
item.
|
|
22
|
+
item.style.addObj({
|
|
23
23
|
display: 'flex',
|
|
24
24
|
flexWrap: 'wrap'
|
|
25
25
|
});
|
|
@@ -28,23 +28,23 @@ class TdSpace extends ui_abstract_1.UI {
|
|
|
28
28
|
const props = this.props;
|
|
29
29
|
this.useSize(props === null || props === void 0 ? void 0 : props.size);
|
|
30
30
|
if (props === null || props === void 0 ? void 0 : props.wrap) {
|
|
31
|
-
this.
|
|
31
|
+
this.style.add('flexWrap', 'wrap');
|
|
32
32
|
}
|
|
33
33
|
if (props === null || props === void 0 ? void 0 : props.fill) {
|
|
34
|
-
this.
|
|
34
|
+
this.style.addObj({
|
|
35
35
|
flexWrap: 'wrap',
|
|
36
36
|
flexGrow: 1,
|
|
37
37
|
minWidth: `${(props === null || props === void 0 ? void 0 : props.fillRatio) || 100}%`
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
if ((props === null || props === void 0 ? void 0 : props.direction) === 'horizontal') {
|
|
41
|
-
this.
|
|
41
|
+
this.style.add('flexDirection', 'row');
|
|
42
42
|
}
|
|
43
43
|
if ((props === null || props === void 0 ? void 0 : props.direction) === 'vertical') {
|
|
44
|
-
this.
|
|
44
|
+
this.style.add('flexDirection', 'column');
|
|
45
45
|
}
|
|
46
46
|
if (props === null || props === void 0 ? void 0 : props.alignment) {
|
|
47
|
-
this.
|
|
47
|
+
this.style.add('alignItems', props.alignment);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
useSize(size) {
|
|
@@ -77,7 +77,7 @@ class TdSpace extends ui_abstract_1.UI {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
this.
|
|
80
|
+
this.style.addObj({
|
|
81
81
|
rowGap: this.verticalSize + 'px',
|
|
82
82
|
columnGap: this.horizontalSize + 'px'
|
|
83
83
|
});
|
|
@@ -85,7 +85,7 @@ class TdSpace extends ui_abstract_1.UI {
|
|
|
85
85
|
setSize(size) {
|
|
86
86
|
console.log('setSize size is ', size);
|
|
87
87
|
this.useSize(size);
|
|
88
|
-
this.
|
|
88
|
+
this.style.setObj({
|
|
89
89
|
rowGap: this.verticalSize + 'px',
|
|
90
90
|
columnGap: this.horizontalSize + 'px'
|
|
91
91
|
});
|
|
@@ -7,26 +7,29 @@ class TdText extends ui_abstract_1.UI {
|
|
|
7
7
|
constructor(params = {}) {
|
|
8
8
|
super(params, (params === null || params === void 0 ? void 0 : params.tag) || 'span');
|
|
9
9
|
this.className = 'TdText';
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
10
|
+
this.style.addObj(td_text_style_1.$baseText);
|
|
11
|
+
this.props = this.useParams(params);
|
|
12
|
+
// this.addChild(this.getSlotNode());
|
|
13
|
+
if (params.slot) {
|
|
14
|
+
this.slotChild(params.slot);
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
setup() {
|
|
15
18
|
const props = this.props;
|
|
16
19
|
if (props === null || props === void 0 ? void 0 : props.type) {
|
|
17
|
-
this.
|
|
20
|
+
this.style.addObj(td_text_style_1.$textStateColors[props.type].default);
|
|
18
21
|
}
|
|
19
22
|
else {
|
|
20
|
-
this.
|
|
23
|
+
this.style.addObj(td_text_style_1.$textStateColors.default.default);
|
|
21
24
|
}
|
|
22
25
|
if (props === null || props === void 0 ? void 0 : props.size) {
|
|
23
|
-
this.
|
|
26
|
+
this.style.addObj(td_text_style_1.sizeOpts[props === null || props === void 0 ? void 0 : props.size]);
|
|
24
27
|
}
|
|
25
28
|
else {
|
|
26
|
-
this.
|
|
29
|
+
this.style.addObj(td_text_style_1.sizeOpts.default);
|
|
27
30
|
}
|
|
28
31
|
if ((props === null || props === void 0 ? void 0 : props.truncated) && (props === null || props === void 0 ? void 0 : props.width)) {
|
|
29
|
-
this.
|
|
32
|
+
this.style.addObj({
|
|
30
33
|
display: 'inline-block',
|
|
31
34
|
maxWidth: '100%',
|
|
32
35
|
textOverflow: 'ellipsis',
|
|
@@ -36,7 +39,7 @@ class TdText extends ui_abstract_1.UI {
|
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
if (props === null || props === void 0 ? void 0 : props.lineClamp) {
|
|
39
|
-
this.
|
|
42
|
+
this.style.addObj({
|
|
40
43
|
// '-webkit-line-clamp': props?.lineClamp,
|
|
41
44
|
WebkitLineClamp: props === null || props === void 0 ? void 0 : props.lineClamp,
|
|
42
45
|
display: '-webkit-inline-box',
|