@type-dom/ui 0.0.8 → 0.0.9
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/package.json +1 -2
- 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 +9 -9
- 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 +7 -7
- 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 +0 -2
- package/src/components/feedback/index.js +3 -5
- 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.js +1 -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 +3 -1
- 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-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-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-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 +6 -6
- 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/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
|
@@ -7,14 +7,14 @@ class TdCheckboxGroup extends ui_abstract_1.UI {
|
|
|
7
7
|
constructor(params = {}) {
|
|
8
8
|
super(params);
|
|
9
9
|
this.className = 'TdCheckboxGroup';
|
|
10
|
-
this.
|
|
10
|
+
this.attr.addObj({
|
|
11
11
|
role: 'group',
|
|
12
12
|
// ariaLabel: !config.isLabeledByFormItem ? config?.ariaLabel || 'checkbox-group' : undefined,
|
|
13
13
|
// aria-labelledby="isLabeledByFormItem ? formItem?.labelId : undefined"
|
|
14
14
|
});
|
|
15
|
-
this.
|
|
15
|
+
this.style.addObj(td_checkbox_style_1.$checkboxGroupStyle);
|
|
16
16
|
this.addChild(this.getSlotNode());
|
|
17
|
-
this.props = this.
|
|
17
|
+
this.props = this.useParams(params);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.TdCheckboxGroup = TdCheckboxGroup;
|
|
@@ -16,13 +16,15 @@ class TdForm extends ui_abstract_1.UI {
|
|
|
16
16
|
constructor(params = {}) {
|
|
17
17
|
super(params, 'form');
|
|
18
18
|
this.className = 'TdForm';
|
|
19
|
-
this.
|
|
19
|
+
this.attr.addName('td-form');
|
|
20
20
|
this.provide(td_form_const_1.formContextKey, params); // 要在form-item 中 inject
|
|
21
|
-
|
|
21
|
+
if (params.slot) {
|
|
22
|
+
this.slotChild(params.slot);
|
|
23
|
+
}
|
|
22
24
|
if (params === null || params === void 0 ? void 0 : params.model) {
|
|
23
25
|
this.model = params.model;
|
|
24
26
|
}
|
|
25
|
-
this.props = this.
|
|
27
|
+
this.props = this.useParams(params);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
exports.TdForm = TdForm;
|
|
@@ -13,8 +13,8 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
13
13
|
constructor(params = {}) {
|
|
14
14
|
super(params);
|
|
15
15
|
this.className = 'TdFormItem';
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
16
|
+
this.attr.addName('td-form-item');
|
|
17
|
+
this.style.addObj({
|
|
18
18
|
display: 'flex',
|
|
19
19
|
// --font-size: 14px,
|
|
20
20
|
fontSize: var_1.$fontSizes[(params === null || params === void 0 ? void 0 : params.size) || 'base'],
|
|
@@ -64,7 +64,7 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
64
64
|
// this.content.addChild(this.error);
|
|
65
65
|
this.addChild(this.content);
|
|
66
66
|
this.content.addChild(this.getSlotNode());
|
|
67
|
-
this.props = this.
|
|
67
|
+
this.props = this.useParams(params);
|
|
68
68
|
}
|
|
69
69
|
created() {
|
|
70
70
|
// inject 要在 created 之中,否则无法确定 parent .
|
|
@@ -75,7 +75,7 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
75
75
|
// 下面的方法要调用到 this.parent 才能获取到。需要 form的setConfig 方法调用后
|
|
76
76
|
}
|
|
77
77
|
setup() {
|
|
78
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
79
79
|
const props = this.props;
|
|
80
80
|
if (props === null || props === void 0 ? void 0 : props.label) {
|
|
81
81
|
this.label = new framework_1.Label({
|
|
@@ -102,7 +102,7 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
102
102
|
else {
|
|
103
103
|
const labelWidth = (0, utils_1.addUnit)(props.labelWidth || ((_b = this.parent) === null || _b === void 0 ? void 0 : _b.props.labelWidth) || '120px');
|
|
104
104
|
if (labelWidth) {
|
|
105
|
-
this.label.
|
|
105
|
+
this.label.style.addObj({
|
|
106
106
|
width: labelWidth,
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -117,17 +117,17 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
117
117
|
}));
|
|
118
118
|
}
|
|
119
119
|
(_d = this.labelWrap) === null || _d === void 0 ? void 0 : _d.addChild(this.label);
|
|
120
|
-
this.
|
|
120
|
+
this.style.addObj({
|
|
121
121
|
display: ((_e = this.parent) === null || _e === void 0 ? void 0 : _e.props.inline) ? 'inline-flex' : 'flex',
|
|
122
122
|
verticalAlign: 'middle',
|
|
123
123
|
marginRight: ((_f = this.parent) === null || _f === void 0 ? void 0 : _f.props.inline)
|
|
124
124
|
? '32px'
|
|
125
|
-
:
|
|
125
|
+
: this.style.get('marginRight'),
|
|
126
126
|
// justifyContent: justifyContent,
|
|
127
127
|
});
|
|
128
|
-
this.setLabelPosition((
|
|
129
|
-
this.setSize((
|
|
130
|
-
this.setLabelWidth((
|
|
128
|
+
this.setLabelPosition((_g = this.parent) === null || _g === void 0 ? void 0 : _g.props.labelPosition);
|
|
129
|
+
this.setSize((_h = this.parent) === null || _h === void 0 ? void 0 : _h.props.size);
|
|
130
|
+
this.setLabelWidth((_j = this.parent) === null || _j === void 0 ? void 0 : _j.props.labelWidth);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
// 待实现:设置子元素的labelWidth
|
|
@@ -136,31 +136,31 @@ class TdFormItem extends ui_abstract_1.UI {
|
|
|
136
136
|
if (width === undefined) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
(_a = this.label) === null || _a === void 0 ? void 0 : _a.
|
|
139
|
+
(_a = this.label) === null || _a === void 0 ? void 0 : _a.style.addObj({
|
|
140
140
|
width: (0, utils_1.addUnit)(width),
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
setLabelPosition(position) {
|
|
144
144
|
var _a;
|
|
145
145
|
// todo top 怎么处理 ?
|
|
146
|
-
(_a = this.label) === null || _a === void 0 ? void 0 : _a.
|
|
146
|
+
(_a = this.label) === null || _a === void 0 ? void 0 : _a.style.addObj({
|
|
147
147
|
justifyContent: position === 'left' ? 'flex-start' : 'flex-end',
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
setSize(size = 'default') {
|
|
151
151
|
var _a, _b;
|
|
152
|
-
this.
|
|
152
|
+
this.style.addObj({
|
|
153
153
|
fontSize: var_1.$fontSizes[size],
|
|
154
154
|
marginBottom: td_form_item_style_1.$formItemMarginBottom[size],
|
|
155
155
|
});
|
|
156
|
-
(_a = this.label) === null || _a === void 0 ? void 0 : _a.
|
|
156
|
+
(_a = this.label) === null || _a === void 0 ? void 0 : _a.style.addObj({
|
|
157
157
|
height: td_form_item_style_1.$formItemLineHeight[size],
|
|
158
158
|
lineHeight: td_form_item_style_1.$formItemLineHeight[size],
|
|
159
159
|
});
|
|
160
|
-
this.content.
|
|
160
|
+
this.content.style.addObj({
|
|
161
161
|
lineHeight: td_form_item_style_1.$formItemLineHeight[size],
|
|
162
162
|
});
|
|
163
|
-
(_b = this.error) === null || _b === void 0 ? void 0 : _b.
|
|
163
|
+
(_b = this.error) === null || _b === void 0 ? void 0 : _b.style.addObj({
|
|
164
164
|
paddingTop: td_form_item_style_1.$formItemErrorPaddingTop[size],
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -8,27 +8,27 @@ class TdInputField extends field_input_abstract_1.FieldInput {
|
|
|
8
8
|
super(params.labelTitle, params.placeholder);
|
|
9
9
|
console.log('InputItem constructor . ');
|
|
10
10
|
this.className = 'TdInputField';
|
|
11
|
-
this.
|
|
11
|
+
this.style.addObj({
|
|
12
12
|
padding: '2px 10px 2px 0'
|
|
13
13
|
});
|
|
14
|
-
this.
|
|
15
|
-
this.label.
|
|
14
|
+
this.attr.addName('input-item');
|
|
15
|
+
this.label.style.addObj({
|
|
16
16
|
fontSize: '16px',
|
|
17
17
|
width: params.labelWidth || '150px'
|
|
18
18
|
});
|
|
19
|
-
this.content.
|
|
19
|
+
this.content.attr.addObj({
|
|
20
20
|
type: (params === null || params === void 0 ? void 0 : params.type) || 'text'
|
|
21
21
|
});
|
|
22
22
|
// todo 有后缀时才需要这样
|
|
23
|
-
// this.content.
|
|
23
|
+
// this.content.style.addObj({
|
|
24
24
|
// borderRadius: '4px 0 0 4px',
|
|
25
25
|
// });
|
|
26
26
|
if (params.readonly) {
|
|
27
|
-
this.content.
|
|
27
|
+
this.content.attr.addObj({
|
|
28
28
|
disabled: true
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
// this.button.
|
|
31
|
+
// this.button.style.setObj({
|
|
32
32
|
// display: 'inline-block',
|
|
33
33
|
// padding: '4px 3px',
|
|
34
34
|
// fontSize: '14px',
|
|
@@ -44,7 +44,7 @@ class TdInputField extends field_input_abstract_1.FieldInput {
|
|
|
44
44
|
// OfdEditor.selectedControl?.resetLabelText(this.content.dom.value);
|
|
45
45
|
// return;
|
|
46
46
|
// }
|
|
47
|
-
// if (this.
|
|
47
|
+
// if (this.style.get('display') === 'none') this.setStyle('display', 'block');
|
|
48
48
|
// if (OfdEditor.selectedControl?.formItem.labelText?.text) {
|
|
49
49
|
// this.resetInputValue(OfdEditor.selectedControl.formItem.labelText.text);
|
|
50
50
|
// } else {
|
|
@@ -14,7 +14,6 @@ export declare class TdInput extends UI implements ITdInput {
|
|
|
14
14
|
constructor(params?: ITdInputConfig);
|
|
15
15
|
get value(): string;
|
|
16
16
|
setup(): void;
|
|
17
|
-
initEvents(): void;
|
|
18
17
|
setModelValue(value: IJsonDataProp): void;
|
|
19
18
|
setHovering(hovering: boolean): void;
|
|
20
19
|
setFocus(isFocused: boolean): void;
|
|
@@ -13,11 +13,11 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
13
13
|
super(params);
|
|
14
14
|
console.log('TdInput constructor . ');
|
|
15
15
|
this.className = 'TdInput';
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
16
|
+
this.attr.addName('td-input');
|
|
17
|
+
this.attr.addObj({
|
|
18
18
|
tabIndex: 0
|
|
19
19
|
});
|
|
20
|
-
this.
|
|
20
|
+
this.style.addObj({
|
|
21
21
|
position: 'relative',
|
|
22
22
|
display: 'inline-flex',
|
|
23
23
|
width: '100%',
|
|
@@ -33,7 +33,7 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
33
33
|
if (params === null || params === void 0 ? void 0 : params.modelValue) {
|
|
34
34
|
this.modelValue = params.modelValue;
|
|
35
35
|
}
|
|
36
|
-
this.props = this.
|
|
36
|
+
this.props = this.useParams(params);
|
|
37
37
|
}
|
|
38
38
|
get value() {
|
|
39
39
|
return this.panel.inner.value;
|
|
@@ -41,7 +41,7 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
41
41
|
setup() {
|
|
42
42
|
const props = this.props;
|
|
43
43
|
if (props === null || props === void 0 ? void 0 : props.width) {
|
|
44
|
-
this.
|
|
44
|
+
this.style.addWidth(props.width);
|
|
45
45
|
}
|
|
46
46
|
// todo
|
|
47
47
|
if ((props === null || props === void 0 ? void 0 : props.type) === 'textarea') {
|
|
@@ -60,8 +60,6 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
60
60
|
if (!(props === null || props === void 0 ? void 0 : props.formatter) && (props === null || props === void 0 ? void 0 : props.parser)) {
|
|
61
61
|
throw new Error('If you set the parser, you also need to set the formatter');
|
|
62
62
|
}
|
|
63
|
-
}
|
|
64
|
-
initEvents() {
|
|
65
63
|
if (this.props.disabled) {
|
|
66
64
|
return;
|
|
67
65
|
}
|
|
@@ -172,14 +170,14 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
172
170
|
this.hovering = hovering;
|
|
173
171
|
if (hovering) {
|
|
174
172
|
if (!this.isFocused) {
|
|
175
|
-
(_a = this.panel) === null || _a === void 0 ? void 0 : _a.
|
|
173
|
+
(_a = this.panel) === null || _a === void 0 ? void 0 : _a.style.setObj({
|
|
176
174
|
boxShadow: '0 0 0 1px ' + td_input_style_1.$input.hoverBorderColor + ' inset'
|
|
177
175
|
});
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
else {
|
|
181
179
|
if (!this.isFocused) {
|
|
182
|
-
(_b = this.panel) === null || _b === void 0 ? void 0 : _b.
|
|
180
|
+
(_b = this.panel) === null || _b === void 0 ? void 0 : _b.style.setObj({
|
|
183
181
|
boxShadow: '0 0 0 1px ' + td_input_style_1.$input.borderColor + ' inset'
|
|
184
182
|
});
|
|
185
183
|
}
|
|
@@ -189,12 +187,12 @@ class TdInput extends ui_abstract_1.UI {
|
|
|
189
187
|
var _a, _b;
|
|
190
188
|
this.isFocused = isFocused;
|
|
191
189
|
if (isFocused) {
|
|
192
|
-
(_a = this.panel) === null || _a === void 0 ? void 0 : _a.
|
|
190
|
+
(_a = this.panel) === null || _a === void 0 ? void 0 : _a.style.setObj({
|
|
193
191
|
boxShadow: '0 0 0 1px ' + td_input_style_1.$input.focusBorderColor + ' inset'
|
|
194
192
|
});
|
|
195
193
|
}
|
|
196
194
|
else {
|
|
197
|
-
(_b = this.panel) === null || _b === void 0 ? void 0 : _b.
|
|
195
|
+
(_b = this.panel) === null || _b === void 0 ? void 0 : _b.style.setObj({
|
|
198
196
|
boxShadow: '0 0 0 1px ' + td_input_style_1.$input.borderColor + ' inset'
|
|
199
197
|
});
|
|
200
198
|
}
|
|
@@ -9,7 +9,7 @@ class TdInputPrefix extends framework_1.TypeSpan {
|
|
|
9
9
|
super();
|
|
10
10
|
this.parent = parent;
|
|
11
11
|
this.className = 'TdInputPrefix';
|
|
12
|
-
this.
|
|
12
|
+
this.style.addObj({
|
|
13
13
|
display: (config === null || config === void 0 ? void 0 : config.prefixIcon) ? 'inline-flex' : 'none',
|
|
14
14
|
whiteSpace: 'nowrap',
|
|
15
15
|
flexShrink: 0,
|
|
@@ -10,7 +10,7 @@ class TdInputSuffix extends framework_1.TypeSpan {
|
|
|
10
10
|
super();
|
|
11
11
|
this.parent = parent;
|
|
12
12
|
this.className = 'TdInputSuffix';
|
|
13
|
-
this.
|
|
13
|
+
this.style.addObj({
|
|
14
14
|
display: this.parent.suffixVisible ? 'inline-flex' : 'none',
|
|
15
15
|
whiteSpace: 'nowrap',
|
|
16
16
|
flexShrink: 0,
|
|
@@ -80,12 +80,12 @@ class TdInputSuffix extends framework_1.TypeSpan {
|
|
|
80
80
|
this.parent.passwordVisible = !this.parent.passwordVisible;
|
|
81
81
|
(_a = this.passwordIcon) === null || _a === void 0 ? void 0 : _a.replaceSvg(this.parent.passwordVisible ? new svgs_1.ElViewSvg() : new svgs_1.ElHideSvg());
|
|
82
82
|
if (this.parent.passwordVisible) {
|
|
83
|
-
this.parent.inner.
|
|
83
|
+
this.parent.inner.attr.setObj({
|
|
84
84
|
type: 'text'
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
|
-
this.parent.inner.
|
|
88
|
+
this.parent.inner.attr.setObj({
|
|
89
89
|
type: 'password'
|
|
90
90
|
});
|
|
91
91
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdInputWrapper = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const use_cursor_1 = require("../../../../hooks/use-cursor");
|
|
5
6
|
const var_1 = require("../../../../styles/var");
|
|
6
7
|
const td_input_style_1 = require("../td-input.style");
|
|
7
8
|
const suffix_1 = require("./suffix");
|
|
@@ -11,7 +12,7 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
11
12
|
super();
|
|
12
13
|
this.className = 'TdInputWrapper';
|
|
13
14
|
this.parent = params === null || params === void 0 ? void 0 : params.parent;
|
|
14
|
-
this.
|
|
15
|
+
this.style.addObj({
|
|
15
16
|
display: 'inline-flex',
|
|
16
17
|
flexGrow: 1,
|
|
17
18
|
alignItems: 'center',
|
|
@@ -118,7 +119,7 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
118
119
|
this.addChild(this.inner);
|
|
119
120
|
this.suffix = new suffix_1.TdInputSuffix(this, params);
|
|
120
121
|
this.addChild(this.suffix);
|
|
121
|
-
this.props = this.
|
|
122
|
+
this.props = this.useParams(params);
|
|
122
123
|
}
|
|
123
124
|
setup() {
|
|
124
125
|
const props = this.props;
|
|
@@ -126,7 +127,7 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
126
127
|
// todo
|
|
127
128
|
}
|
|
128
129
|
if (props === null || props === void 0 ? void 0 : props.size) {
|
|
129
|
-
this.
|
|
130
|
+
this.style.addObj({
|
|
130
131
|
padding: td_input_style_1.$wrapperPadding[props.size || 'default'],
|
|
131
132
|
fontSize: td_input_style_1.$inputFontSize[props.size || 'default'],
|
|
132
133
|
height: td_input_style_1.$inputHeight[props.size || 'default']
|
|
@@ -175,8 +176,8 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
175
176
|
}
|
|
176
177
|
setDisabled(disabled) {
|
|
177
178
|
if (disabled) {
|
|
178
|
-
this.inner.
|
|
179
|
-
this.inner.
|
|
179
|
+
this.inner.attr.setObj({ disabled: 'disabled' });
|
|
180
|
+
this.inner.style.setObj({
|
|
180
181
|
// color: var(--el-disabled-text-color),
|
|
181
182
|
color: var_1.$textColor.disabled,
|
|
182
183
|
// -webkit-text-fill-color: var(--el-disabled-text-color),
|
|
@@ -185,8 +186,8 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
else {
|
|
188
|
-
this.inner.
|
|
189
|
-
this.inner.
|
|
189
|
+
this.inner.attr.remove('disabled');
|
|
190
|
+
this.inner.style.setObj({
|
|
190
191
|
// color: var(--el-text-color),
|
|
191
192
|
color: var_1.$textColor.regular,
|
|
192
193
|
// -webkit-text-fill-color: var(--el-text-color),
|
|
@@ -227,12 +228,12 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
227
228
|
setShowClear(showClear) {
|
|
228
229
|
var _a;
|
|
229
230
|
console.log('setShowClear . showClear is ', showClear);
|
|
230
|
-
this.suffix.
|
|
231
|
-
(_a = this.suffix.clearIcon) === null || _a === void 0 ? void 0 : _a.
|
|
231
|
+
this.suffix.style.show(this.suffixVisible ? 'inline-flex' : 'none');
|
|
232
|
+
(_a = this.suffix.clearIcon) === null || _a === void 0 ? void 0 : _a.style.show(showClear ? 'inline-flex' : 'none');
|
|
232
233
|
}
|
|
233
234
|
setShowPassword(showPassword) {
|
|
234
235
|
var _a;
|
|
235
|
-
(_a = this.suffix.passwordIcon) === null || _a === void 0 ? void 0 : _a.
|
|
236
|
+
(_a = this.suffix.passwordIcon) === null || _a === void 0 ? void 0 : _a.style.show(showPassword ? 'inline-flex' : 'none');
|
|
236
237
|
}
|
|
237
238
|
setNativeInputValue() {
|
|
238
239
|
console.log('setNativeInputValue . ');
|
|
@@ -246,7 +247,7 @@ class TdInputWrapper extends framework_1.TypeDiv {
|
|
|
246
247
|
}
|
|
247
248
|
handleInput(event, element) {
|
|
248
249
|
console.log('input . this is ', this);
|
|
249
|
-
const [recordCursor, setCursor] = (0,
|
|
250
|
+
const [recordCursor, setCursor] = (0, use_cursor_1.useCursor)(element === null || element === void 0 ? void 0 : element.dom);
|
|
250
251
|
recordCursor();
|
|
251
252
|
let { value } = event === null || event === void 0 ? void 0 : event.target;
|
|
252
253
|
if (this.props.formatter) {
|
|
@@ -8,7 +8,7 @@ class TdTextareaWrapper extends framework_1.TypeDiv {
|
|
|
8
8
|
constructor(params = {}) {
|
|
9
9
|
super();
|
|
10
10
|
this.className = 'TextareaWrapper';
|
|
11
|
-
this.
|
|
11
|
+
this.style.addObj({
|
|
12
12
|
position: 'relative',
|
|
13
13
|
display: 'inline-block',
|
|
14
14
|
width: '100%',
|
|
@@ -100,7 +100,7 @@ class TdTextareaWrapper extends framework_1.TypeDiv {
|
|
|
100
100
|
});
|
|
101
101
|
this.addChildren(this.inner, this.countSpan);
|
|
102
102
|
// this.childNodes = [this.inner, this.countSpan];
|
|
103
|
-
this.props = this.
|
|
103
|
+
this.props = this.useParams(params);
|
|
104
104
|
}
|
|
105
105
|
// todo
|
|
106
106
|
handleInput(event, element) {
|
|
@@ -110,7 +110,7 @@ class TdTextareaWrapper extends framework_1.TypeDiv {
|
|
|
110
110
|
if (this.isComposing)
|
|
111
111
|
return;
|
|
112
112
|
if (this.props.autosize) {
|
|
113
|
-
this.inner.
|
|
113
|
+
this.inner.style.setObj({
|
|
114
114
|
// height: 'auto',
|
|
115
115
|
height: this.inner.dom.scrollHeight + 'px'
|
|
116
116
|
});
|
|
@@ -7,11 +7,11 @@ class TdOption extends ui_abstract_1.UI {
|
|
|
7
7
|
constructor(params = {}) {
|
|
8
8
|
super(params, 'li');
|
|
9
9
|
this.className = 'TdOption';
|
|
10
|
-
this.
|
|
10
|
+
this.attr.addObj({
|
|
11
11
|
name: 'td-option',
|
|
12
12
|
role: 'option'
|
|
13
13
|
});
|
|
14
|
-
this.
|
|
14
|
+
this.style.addObj({
|
|
15
15
|
// font-size: map.get($select, 'font-size'),
|
|
16
16
|
fontSize: td_select_style_1.$select.fontSize, // $fontSizes.base,
|
|
17
17
|
// 20 as the padding of option item, 12 as the size of ✓ icon size
|
|
@@ -29,7 +29,7 @@ class TdOption extends ui_abstract_1.UI {
|
|
|
29
29
|
boxSizing: 'border-box',
|
|
30
30
|
cursor: 'pointer'
|
|
31
31
|
});
|
|
32
|
-
this.props = this.
|
|
32
|
+
this.props = this.useParams(params);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.TdOption = TdOption;
|
|
@@ -8,10 +8,10 @@ class TdOptionGroup extends ui_abstract_1.UI {
|
|
|
8
8
|
constructor(params = {}) {
|
|
9
9
|
super(params, 'ul');
|
|
10
10
|
this.className = 'TdOptionGroup';
|
|
11
|
-
this.
|
|
11
|
+
this.attr.addObj({
|
|
12
12
|
name: 'option-group-wrap'
|
|
13
13
|
});
|
|
14
|
-
this.
|
|
14
|
+
this.style.addObj({
|
|
15
15
|
margin: '0',
|
|
16
16
|
padding: '0',
|
|
17
17
|
position: 'relative',
|
|
@@ -44,7 +44,7 @@ class TdOptionGroup extends ui_abstract_1.UI {
|
|
|
44
44
|
})
|
|
45
45
|
]
|
|
46
46
|
}));
|
|
47
|
-
this.props = this.
|
|
47
|
+
this.props = this.useParams(params);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.TdOptionGroup = TdOptionGroup;
|