@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
|
@@ -9,7 +9,7 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
9
9
|
constructor(params = {}) {
|
|
10
10
|
super(params, 'label');
|
|
11
11
|
this.className = 'TdRadio';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
color: var_1.$textColor.regular,
|
|
14
14
|
fontWeight: var_1.$fontWeightPrimary,
|
|
15
15
|
position: 'relative',
|
|
@@ -87,36 +87,61 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
this.addChildren(this.radioInput, this.radioLabel);
|
|
90
|
-
this.props = this.
|
|
90
|
+
this.props = this.useParams(params);
|
|
91
|
+
// 点击事件 todo 会触发两次,先不管。
|
|
92
|
+
this.addEvents({
|
|
93
|
+
click: (evt) => {
|
|
94
|
+
var _a;
|
|
95
|
+
console.log('this.inputOriginal.dom click . ');
|
|
96
|
+
console.log('this.inputOriginal.dom.value is ', this.inputOriginal.dom.value);
|
|
97
|
+
if (this.disabled) {
|
|
98
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// this.inputOriginal.dom.click();
|
|
102
|
+
if (this.parent instanceof td_radio_group_class_1.TdRadioGroup) {
|
|
103
|
+
this.parent.setModelValue(this.inputOriginal.value); // 触发父级的事件,重置整个组。
|
|
104
|
+
}
|
|
105
|
+
this.setChecked(true);
|
|
106
|
+
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.childNodes.forEach((node) => {
|
|
107
|
+
if (node instanceof TdRadio &&
|
|
108
|
+
node.inputOriginal.attr.get('name') ===
|
|
109
|
+
this.inputOriginal.attr.get('name') &&
|
|
110
|
+
node !== this) {
|
|
111
|
+
node.setChecked(false);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
91
116
|
}
|
|
92
117
|
setup() {
|
|
93
118
|
var _a;
|
|
94
119
|
const props = this.props;
|
|
95
120
|
if (props === null || props === void 0 ? void 0 : props.name) {
|
|
96
121
|
console.log('setConfig props?.name', props === null || props === void 0 ? void 0 : props.name);
|
|
97
|
-
this.inputOriginal.
|
|
122
|
+
this.inputOriginal.attr.addName(props.name);
|
|
98
123
|
}
|
|
99
124
|
if (props === null || props === void 0 ? void 0 : props.value) {
|
|
100
|
-
this.inputOriginal.
|
|
125
|
+
this.inputOriginal.attr.addObj({ value: props.value });
|
|
101
126
|
}
|
|
102
127
|
if (props === null || props === void 0 ? void 0 : props.checked) {
|
|
103
|
-
this.inputOriginal.
|
|
128
|
+
this.inputOriginal.attr.addObj({ checked: props.checked || false });
|
|
104
129
|
}
|
|
105
130
|
if (props === null || props === void 0 ? void 0 : props.label) {
|
|
106
131
|
(_a = this.radioLabel.textNode) === null || _a === void 0 ? void 0 : _a.setText(props.label);
|
|
107
132
|
}
|
|
108
133
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
109
|
-
this.inputOriginal.
|
|
134
|
+
this.inputOriginal.attr.addObj({ disabled: props.disabled });
|
|
110
135
|
// todo 样式
|
|
111
136
|
}
|
|
112
137
|
if (props === null || props === void 0 ? void 0 : props.size) {
|
|
113
|
-
this.
|
|
138
|
+
this.style.addObj({
|
|
114
139
|
height: var_1.$commonComponentSize[props.size],
|
|
115
140
|
fontSize: var_1.$fontSizes[props.size]
|
|
116
141
|
});
|
|
117
142
|
}
|
|
118
143
|
if (props === null || props === void 0 ? void 0 : props.border) {
|
|
119
|
-
this.
|
|
144
|
+
this.style.addObj({
|
|
120
145
|
borderWidth: var_1.$borderWidth,
|
|
121
146
|
borderStyle: var_1.$borderStyle,
|
|
122
147
|
borderColor: var_1.$borderColor.base,
|
|
@@ -125,26 +150,26 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
125
150
|
});
|
|
126
151
|
}
|
|
127
152
|
if (props === null || props === void 0 ? void 0 : props.checked) {
|
|
128
|
-
this.setChecked(props
|
|
153
|
+
this.setChecked(props.checked);
|
|
129
154
|
}
|
|
130
155
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
131
|
-
this.setDisabled(props
|
|
156
|
+
this.setDisabled(props.disabled);
|
|
132
157
|
}
|
|
133
158
|
}
|
|
134
159
|
setDisabled(disabled) {
|
|
135
160
|
this.disabled = disabled;
|
|
136
161
|
if (disabled) {
|
|
137
|
-
this.
|
|
162
|
+
this.style.setObj({
|
|
138
163
|
cursor: 'notAllowed',
|
|
139
164
|
opacity: 0.5
|
|
140
165
|
// 禁用事件
|
|
141
166
|
// pointerEvents: 'none',
|
|
142
167
|
});
|
|
143
|
-
this.radioLabel.
|
|
168
|
+
this.radioLabel.style.setObj({
|
|
144
169
|
color: var_1.$colors.default.base
|
|
145
170
|
});
|
|
146
|
-
this.inputOriginal.
|
|
147
|
-
this.inputInner.
|
|
171
|
+
this.inputOriginal.attr.setObj({ disabled: true });
|
|
172
|
+
this.inputInner.style.setObj({
|
|
148
173
|
cursor: 'notAllowed',
|
|
149
174
|
// color: $colors.default.base,
|
|
150
175
|
// borderWidth: '1px',
|
|
@@ -155,30 +180,30 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
155
180
|
});
|
|
156
181
|
}
|
|
157
182
|
else {
|
|
158
|
-
this.
|
|
183
|
+
this.style.setObj({
|
|
159
184
|
cursor: 'pointer',
|
|
160
185
|
opacity: 1,
|
|
161
186
|
pointerEvents: 'auto'
|
|
162
187
|
});
|
|
163
|
-
this.inputOriginal.
|
|
164
|
-
this.inputInner.
|
|
188
|
+
this.inputOriginal.attr.remove('disabled');
|
|
189
|
+
this.inputInner.style.setObj({
|
|
165
190
|
cursor: 'auto'
|
|
166
191
|
});
|
|
167
192
|
}
|
|
168
193
|
}
|
|
169
194
|
setChecked(checked) {
|
|
170
195
|
if (checked) {
|
|
171
|
-
this.
|
|
196
|
+
this.style.setObj({
|
|
172
197
|
borderColor: var_1.$colors.primary.base
|
|
173
198
|
});
|
|
174
|
-
this.inputOriginal.
|
|
199
|
+
this.inputOriginal.attr.setObj({
|
|
175
200
|
checked: true
|
|
176
201
|
});
|
|
177
202
|
// 设置选中样式
|
|
178
|
-
this.radioLabel.
|
|
203
|
+
this.radioLabel.style.setObj({
|
|
179
204
|
color: var_1.$colors.primary.base
|
|
180
205
|
});
|
|
181
|
-
this.inputInner.
|
|
206
|
+
this.inputInner.style.setObj({
|
|
182
207
|
color: var_1.$colors.primary.base,
|
|
183
208
|
borderWidth: '5px',
|
|
184
209
|
borderStyle: 'solid',
|
|
@@ -187,14 +212,14 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
187
212
|
}
|
|
188
213
|
else {
|
|
189
214
|
// 设置非选中样式
|
|
190
|
-
this.
|
|
215
|
+
this.style.setObj({
|
|
191
216
|
borderColor: var_1.$borderColor.base
|
|
192
217
|
});
|
|
193
|
-
this.inputOriginal.
|
|
194
|
-
this.radioLabel.
|
|
218
|
+
this.inputOriginal.attr.remove('checked');
|
|
219
|
+
this.radioLabel.style.setObj({
|
|
195
220
|
color: var_1.$colors.default.base
|
|
196
221
|
});
|
|
197
|
-
this.inputInner.
|
|
222
|
+
this.inputInner.style.setObj({
|
|
198
223
|
borderWidth: '1px',
|
|
199
224
|
borderStyle: 'solid',
|
|
200
225
|
borderColor: var_1.$borderColor.base,
|
|
@@ -202,33 +227,5 @@ class TdRadio extends ui_abstract_1.UI {
|
|
|
202
227
|
});
|
|
203
228
|
}
|
|
204
229
|
}
|
|
205
|
-
initEvents() {
|
|
206
|
-
// 点击事件 todo 会触发两次,先不管。
|
|
207
|
-
this.addEvents({
|
|
208
|
-
click: (evt) => {
|
|
209
|
-
var _a;
|
|
210
|
-
console.log('this.inputOriginal.dom click . ');
|
|
211
|
-
console.log('this.inputOriginal.dom.value is ', this.inputOriginal.dom.value);
|
|
212
|
-
if (this.disabled) {
|
|
213
|
-
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
// this.inputOriginal.dom.click();
|
|
217
|
-
if (this.parent instanceof td_radio_group_class_1.TdRadioGroup) {
|
|
218
|
-
this.parent.setModelValue(this.inputOriginal.value); // 触发父级的事件,重置整个组。
|
|
219
|
-
}
|
|
220
|
-
this.setChecked(true);
|
|
221
|
-
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.childNodes.forEach((node) => {
|
|
222
|
-
var _a, _b;
|
|
223
|
-
if (node instanceof TdRadio &&
|
|
224
|
-
((_a = node.inputOriginal.props.attrObj) === null || _a === void 0 ? void 0 : _a.name) ===
|
|
225
|
-
((_b = this.inputOriginal.props.attrObj) === null || _b === void 0 ? void 0 : _b.name) &&
|
|
226
|
-
node !== this) {
|
|
227
|
-
node.setChecked(false);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
230
|
}
|
|
234
231
|
exports.TdRadio = TdRadio;
|
|
@@ -9,8 +9,8 @@ class TdRadioButton extends ui_abstract_1.UI {
|
|
|
9
9
|
constructor(params = {}) {
|
|
10
10
|
super(params, 'label');
|
|
11
11
|
this.className = 'TdRadioButton';
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
12
|
+
this.attr.addName('radio-button');
|
|
13
|
+
this.style.addObj({
|
|
14
14
|
position: 'relative',
|
|
15
15
|
display: 'inline-block',
|
|
16
16
|
outline: 'none'
|
|
@@ -65,51 +65,51 @@ class TdRadioButton extends ui_abstract_1.UI {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
this.addChildren(this.inputOriginal, this.radioLabel);
|
|
68
|
-
this.props = this.
|
|
68
|
+
this.props = this.useParams(params);
|
|
69
69
|
}
|
|
70
70
|
setup() {
|
|
71
71
|
var _a;
|
|
72
72
|
const props = this.props;
|
|
73
73
|
if (props.name) {
|
|
74
74
|
console.log('setConfig props.name', props.name);
|
|
75
|
-
this.inputOriginal.
|
|
75
|
+
this.inputOriginal.attr.addName(props.name);
|
|
76
76
|
}
|
|
77
77
|
if (props.value) {
|
|
78
|
-
this.inputOriginal.
|
|
78
|
+
this.inputOriginal.attr.addObj({ value: props.value });
|
|
79
79
|
}
|
|
80
80
|
if (props.checked) {
|
|
81
|
-
this.inputOriginal.
|
|
81
|
+
this.inputOriginal.attr.addObj({ checked: props.checked || false });
|
|
82
82
|
}
|
|
83
83
|
if (props === null || props === void 0 ? void 0 : props.label) {
|
|
84
84
|
(_a = this.radioLabel.textNode) === null || _a === void 0 ? void 0 : _a.setText(props.label);
|
|
85
85
|
}
|
|
86
86
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
87
|
-
this.inputOriginal.
|
|
87
|
+
this.inputOriginal.attr.addObj({ disabled: props.disabled });
|
|
88
88
|
// todo 样式
|
|
89
89
|
}
|
|
90
90
|
// size 默认值是 default
|
|
91
91
|
const size = (props === null || props === void 0 ? void 0 : props.size) || 'default';
|
|
92
|
-
this.
|
|
92
|
+
this.style.addObj({
|
|
93
93
|
height: var_1.$commonComponentSize[size]
|
|
94
94
|
});
|
|
95
|
-
this.radioLabel.
|
|
95
|
+
this.radioLabel.style.addObj({
|
|
96
96
|
padding: var_1.$paddingVerticalMap[size] + ' ' + var_1.$paddingHorizontalMap[size],
|
|
97
97
|
fontSize: var_1.$fontSizes[size]
|
|
98
98
|
});
|
|
99
99
|
if (props === null || props === void 0 ? void 0 : props.isFirst) {
|
|
100
100
|
const radius = var_1.$borderRadiusMap[size];
|
|
101
|
-
this.radioLabel.
|
|
101
|
+
this.radioLabel.style.addObj({
|
|
102
102
|
borderRadius: radius + ' 0 0 ' + radius
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
this.radioLabel.
|
|
106
|
+
this.radioLabel.style.addObj({
|
|
107
107
|
borderLeft: '0'
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
if (props === null || props === void 0 ? void 0 : props.isLast) {
|
|
111
111
|
const radius = var_1.$borderRadiusMap[size];
|
|
112
|
-
this.radioLabel.
|
|
112
|
+
this.radioLabel.style.addObj({
|
|
113
113
|
borderRadius: '0 ' + radius + ' ' + radius + ' 0'
|
|
114
114
|
});
|
|
115
115
|
}
|
|
@@ -119,78 +119,75 @@ class TdRadioButton extends ui_abstract_1.UI {
|
|
|
119
119
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
120
120
|
this.setDisabled(props === null || props === void 0 ? void 0 : props.disabled);
|
|
121
121
|
}
|
|
122
|
+
this.addEvents({
|
|
123
|
+
// 点击事件 todo 会触发两次,先不管。
|
|
124
|
+
click: (evt) => {
|
|
125
|
+
var _a;
|
|
126
|
+
console.log('radio-button this.inputOriginal.dom click . ');
|
|
127
|
+
console.log('radio-button this.inputOriginal.dom.value is ', this.inputOriginal.dom.value);
|
|
128
|
+
if (this.disabled) {
|
|
129
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// this.inputOriginal.dom.click();
|
|
133
|
+
if (this.parent instanceof td_radio_group_class_1.TdRadioGroup) {
|
|
134
|
+
this.parent.setModelValue(this.inputOriginal.value); // 触发父级的事件,重置整个组。
|
|
135
|
+
}
|
|
136
|
+
this.setChecked(true);
|
|
137
|
+
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.childNodes.forEach((node) => {
|
|
138
|
+
if (node instanceof TdRadioButton &&
|
|
139
|
+
node.inputOriginal.attr.get('name') ===
|
|
140
|
+
this.inputOriginal.attr.get('name') &&
|
|
141
|
+
node !== this) {
|
|
142
|
+
node.setChecked(false);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
122
147
|
}
|
|
123
148
|
setDisabled(disabled) {
|
|
124
149
|
this.disabled = disabled;
|
|
125
150
|
if (disabled) {
|
|
126
|
-
this.
|
|
151
|
+
this.style.setObj({
|
|
127
152
|
cursor: 'notAllowed',
|
|
128
153
|
opacity: 0.5
|
|
129
154
|
// 禁用事件
|
|
130
155
|
// pointerEvents: 'none',
|
|
131
156
|
});
|
|
132
|
-
this.radioLabel.
|
|
157
|
+
this.radioLabel.style.setObj({
|
|
133
158
|
color: var_1.$colors.default.base
|
|
134
159
|
});
|
|
135
|
-
this.inputOriginal.
|
|
160
|
+
this.inputOriginal.attr.setObj({ disabled: true });
|
|
136
161
|
}
|
|
137
162
|
else {
|
|
138
|
-
this.
|
|
163
|
+
this.style.setObj({
|
|
139
164
|
cursor: 'pointer',
|
|
140
165
|
opacity: 1,
|
|
141
166
|
pointerEvents: 'auto'
|
|
142
167
|
});
|
|
143
|
-
this.inputOriginal.
|
|
168
|
+
this.inputOriginal.attr.remove('disabled');
|
|
144
169
|
}
|
|
145
170
|
}
|
|
146
171
|
setChecked(checked) {
|
|
147
172
|
if (checked) {
|
|
148
|
-
this.inputOriginal.
|
|
173
|
+
this.inputOriginal.attr.setObj({
|
|
149
174
|
checked: true
|
|
150
175
|
});
|
|
151
176
|
// 设置选中样式
|
|
152
|
-
this.radioLabel.
|
|
177
|
+
this.radioLabel.style.setObj({
|
|
153
178
|
color: var_1.$colorWhite,
|
|
154
179
|
backgroundColor: var_1.$colors.primary.base
|
|
155
180
|
});
|
|
156
181
|
}
|
|
157
182
|
else {
|
|
158
|
-
this.inputOriginal.
|
|
183
|
+
this.inputOriginal.attr.remove('checked');
|
|
159
184
|
// 设置非选中样式
|
|
160
|
-
this.radioLabel.
|
|
185
|
+
this.radioLabel.style.setObj({
|
|
161
186
|
borderColor: var_1.$borderColor.base,
|
|
162
187
|
background: var_1.$fillColor.blank,
|
|
163
188
|
color: var_1.$colors.default.base
|
|
164
189
|
});
|
|
165
190
|
}
|
|
166
191
|
}
|
|
167
|
-
initEvents() {
|
|
168
|
-
this.addEvents({
|
|
169
|
-
// 点击事件 todo 会触发两次,先不管。
|
|
170
|
-
click: (evt) => {
|
|
171
|
-
var _a;
|
|
172
|
-
console.log('radio-button this.inputOriginal.dom click . ');
|
|
173
|
-
console.log('radio-button this.inputOriginal.dom.value is ', this.inputOriginal.dom.value);
|
|
174
|
-
if (this.disabled) {
|
|
175
|
-
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
// this.inputOriginal.dom.click();
|
|
179
|
-
if (this.parent instanceof td_radio_group_class_1.TdRadioGroup) {
|
|
180
|
-
this.parent.setModelValue(this.inputOriginal.value); // 触发父级的事件,重置整个组。
|
|
181
|
-
}
|
|
182
|
-
this.setChecked(true);
|
|
183
|
-
(_a = this.parent) === null || _a === void 0 ? void 0 : _a.childNodes.forEach((node) => {
|
|
184
|
-
var _a, _b;
|
|
185
|
-
if (node instanceof TdRadioButton &&
|
|
186
|
-
((_a = node.inputOriginal.props.attrObj) === null || _a === void 0 ? void 0 : _a.name) ===
|
|
187
|
-
((_b = this.inputOriginal.props.attrObj) === null || _b === void 0 ? void 0 : _b.name) &&
|
|
188
|
-
node !== this) {
|
|
189
|
-
node.setChecked(false);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
192
|
}
|
|
196
193
|
exports.TdRadioButton = TdRadioButton;
|
|
@@ -9,7 +9,7 @@ class TdRadioGroup extends ui_abstract_1.UI {
|
|
|
9
9
|
constructor(params = {}) {
|
|
10
10
|
super(params);
|
|
11
11
|
this.className = 'TdRadioGroup';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
display: 'inline-flex',
|
|
14
14
|
alignItems: 'center',
|
|
15
15
|
flexWrap: 'wrap',
|
|
@@ -17,7 +17,7 @@ class TdRadioGroup extends ui_abstract_1.UI {
|
|
|
17
17
|
marginRight: '12px',
|
|
18
18
|
});
|
|
19
19
|
this.childNodes = [];
|
|
20
|
-
this.props = this.
|
|
20
|
+
this.props = this.useParams(params);
|
|
21
21
|
}
|
|
22
22
|
get resultValue() {
|
|
23
23
|
if (this.modelValue instanceof framework_1.XProxy) {
|
|
@@ -92,8 +92,7 @@ class TdRadioGroup extends ui_abstract_1.UI {
|
|
|
92
92
|
}
|
|
93
93
|
// console.error('value is ', value);
|
|
94
94
|
this.childNodes.forEach((opt) => {
|
|
95
|
-
|
|
96
|
-
if (String((_a = opt.inputOriginal.props.attrObj) === null || _a === void 0 ? void 0 : _a.value) === String(value)) {
|
|
95
|
+
if (String(opt.inputOriginal.attr.get('value')) === String(value)) {
|
|
97
96
|
// 设置选中样式
|
|
98
97
|
opt.setChecked(true);
|
|
99
98
|
}
|
|
@@ -9,13 +9,13 @@ class TdSelectDropDown extends ui_abstract_1.UI {
|
|
|
9
9
|
constructor(params = {}) {
|
|
10
10
|
super(params);
|
|
11
11
|
this.className = 'TdSelectDropdown';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
// z-index: calc(#{getCssVar('index-top')} + 1);
|
|
14
14
|
// border-radius: getCssVar('border-radius-base');
|
|
15
15
|
borderRadius: var_1.$borderRadius.base,
|
|
16
16
|
boxSizing: 'border-box'
|
|
17
17
|
});
|
|
18
|
-
this.props = this.
|
|
18
|
+
this.props = this.useParams(params);
|
|
19
19
|
}
|
|
20
20
|
setup() {
|
|
21
21
|
const props = this.props;
|
|
@@ -10,7 +10,7 @@ class TdSelect extends ui_abstract_1.UI {
|
|
|
10
10
|
constructor(params = {}) {
|
|
11
11
|
super(params);
|
|
12
12
|
this.className = 'TdSelect';
|
|
13
|
-
this.
|
|
13
|
+
this.style.addObj(td_select_style_1.$select);
|
|
14
14
|
this.addChild(new td_tooltip_class_1.TdTooltip({
|
|
15
15
|
slot: [
|
|
16
16
|
new framework_1.Div({
|
|
@@ -26,7 +26,7 @@ class TdSelect extends ui_abstract_1.UI {
|
|
|
26
26
|
})
|
|
27
27
|
]
|
|
28
28
|
}));
|
|
29
|
-
this.props = this.
|
|
29
|
+
this.props = this.useParams(params);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.TdSelect = TdSelect;
|
|
@@ -15,7 +15,7 @@ export declare class TdSwitch extends UI implements ITdSwitch {
|
|
|
15
15
|
get actualValue(): string | number | boolean | undefined;
|
|
16
16
|
get checked(): boolean;
|
|
17
17
|
mounted(): void;
|
|
18
|
-
|
|
18
|
+
setup(): void;
|
|
19
19
|
handleChange(): void;
|
|
20
20
|
setDisabled(disabled: boolean): void;
|
|
21
21
|
setChecked(checked: boolean): void;
|
|
@@ -15,7 +15,7 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
15
15
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16
16
|
super(params);
|
|
17
17
|
this.className = 'TdSwitch';
|
|
18
|
-
this.
|
|
18
|
+
this.style.addObj({
|
|
19
19
|
display: 'inline-flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
position: 'relative',
|
|
@@ -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.
|
|
65
|
+
this.props = this.useParams(params);
|
|
66
66
|
}
|
|
67
67
|
get actualValue() {
|
|
68
68
|
return this.isControlled ? this.props.modelValue : false;
|
|
@@ -74,13 +74,13 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
74
74
|
const props = this.props;
|
|
75
75
|
this.setChecked(this.modelValue === this.activeValue);
|
|
76
76
|
if (props === null || props === void 0 ? void 0 : props.disabled) {
|
|
77
|
-
this.setDisabled(props
|
|
77
|
+
this.setDisabled(props.disabled);
|
|
78
78
|
}
|
|
79
79
|
if (props.loading) {
|
|
80
|
-
this.setLoading(props
|
|
80
|
+
this.setLoading(props.loading);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
setup() {
|
|
84
84
|
this.addEvents({
|
|
85
85
|
click: (evt) => {
|
|
86
86
|
// changeValue
|
|
@@ -112,32 +112,32 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
112
112
|
setDisabled(disabled) {
|
|
113
113
|
var _a, _b;
|
|
114
114
|
if (disabled) {
|
|
115
|
-
this.
|
|
115
|
+
this.style.setObj({
|
|
116
116
|
opacity: 0.6
|
|
117
117
|
});
|
|
118
|
-
this.input.
|
|
118
|
+
this.input.attr.setObj({
|
|
119
119
|
disabled: true,
|
|
120
120
|
ariaDisabled: true
|
|
121
121
|
});
|
|
122
|
-
(_a = this.left) === null || _a === void 0 ? void 0 : _a.
|
|
122
|
+
(_a = this.left) === null || _a === void 0 ? void 0 : _a.style.setObj({
|
|
123
123
|
cursor: 'not-allowed'
|
|
124
124
|
});
|
|
125
|
-
this.core.
|
|
125
|
+
this.core.style.setObj({
|
|
126
126
|
cursor: 'not-allowed'
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
|
-
this.
|
|
130
|
+
this.style.setObj({
|
|
131
131
|
opacity: 1
|
|
132
132
|
});
|
|
133
|
-
this.input.
|
|
133
|
+
this.input.attr.setObj({
|
|
134
134
|
disabled: false,
|
|
135
135
|
ariaDisabled: false
|
|
136
136
|
});
|
|
137
|
-
(_b = this.left) === null || _b === void 0 ? void 0 : _b.
|
|
137
|
+
(_b = this.left) === null || _b === void 0 ? void 0 : _b.style.setObj({
|
|
138
138
|
cursor: 'auto'
|
|
139
139
|
});
|
|
140
|
-
this.core.
|
|
140
|
+
this.core.style.setObj({
|
|
141
141
|
cursor: 'auto'
|
|
142
142
|
});
|
|
143
143
|
}
|
|
@@ -146,10 +146,10 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
146
146
|
setChecked(checked) {
|
|
147
147
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
148
148
|
if (checked) {
|
|
149
|
-
this.core.
|
|
149
|
+
this.core.style.setObj({
|
|
150
150
|
backgroundColor: (_a = this.props.switchOnColor) !== null && _a !== void 0 ? _a : td_switch_style_1.$switchOnColor
|
|
151
151
|
});
|
|
152
|
-
this.core.action.
|
|
152
|
+
this.core.action.style.setObj({
|
|
153
153
|
color: td_switch_style_1.$switchOnColor,
|
|
154
154
|
// left: calc(100% - #{map.get($switch-button-size, 'default') + 1px});
|
|
155
155
|
left: 'calc(100% - ' +
|
|
@@ -157,12 +157,12 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
157
157
|
' - 1px)'
|
|
158
158
|
});
|
|
159
159
|
if (this.right) {
|
|
160
|
-
this.right.
|
|
160
|
+
this.right.style.setObj({
|
|
161
161
|
color: var_1.$colors.primary.base
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
if (this.left) {
|
|
165
|
-
this.left.
|
|
165
|
+
this.left.style.setObj({
|
|
166
166
|
color: var_1.$colors.default.base
|
|
167
167
|
});
|
|
168
168
|
}
|
|
@@ -177,20 +177,20 @@ class TdSwitch extends ui_abstract_1.UI {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
|
-
this.core.
|
|
180
|
+
this.core.style.setObj({
|
|
181
181
|
backgroundColor: (_e = this.props.switchOffColor) !== null && _e !== void 0 ? _e : td_switch_style_1.$switchOffColor
|
|
182
182
|
});
|
|
183
|
-
this.core.action.
|
|
183
|
+
this.core.action.style.setObj({
|
|
184
184
|
left: '1px',
|
|
185
185
|
color: td_switch_style_1.$switchOffColor
|
|
186
186
|
});
|
|
187
187
|
if (this.left) {
|
|
188
|
-
this.left.
|
|
188
|
+
this.left.style.setObj({
|
|
189
189
|
color: var_1.$colors.primary.base
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
if (this.right) {
|
|
193
|
-
this.right.
|
|
193
|
+
this.right.style.setObj({
|
|
194
194
|
color: var_1.$colors.default.base
|
|
195
195
|
});
|
|
196
196
|
}
|