@type-dom/ui 0.0.1 → 0.0.2
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 +11 -11
- package/package.json +1 -1
- package/src/basic/td-button/td-button.class.d.ts +1 -2
- package/src/basic/td-button/td-button.class.js +24 -15
- package/src/basic/td-button/td-button.interface.d.ts +3 -2
- package/src/basic/td-button/td-button.style.js +6 -6
- package/src/basic/td-container/td-aside/td-aside.class.d.ts +1 -1
- package/src/basic/td-container/td-aside/td-aside.class.js +13 -1
- package/src/basic/td-container/td-aside/td-aside.interface.d.ts +3 -2
- package/src/basic/td-container/td-container.class.d.ts +6 -3
- package/src/basic/td-container/td-container.class.js +3 -2
- package/src/basic/td-container/td-container.interface.d.ts +8 -2
- package/src/basic/td-container/td-footer/td-footer.class.d.ts +1 -1
- package/src/basic/td-container/td-footer/td-footer.class.js +12 -0
- package/src/basic/td-container/td-footer/td-footer.interface.d.ts +5 -1
- package/src/basic/td-container/td-header/td-header.class.d.ts +3 -2
- package/src/basic/td-container/td-header/td-header.class.js +5 -0
- package/src/basic/td-container/td-header/td-header.interface.d.ts +4 -1
- package/src/basic/td-container/td-main/td-main.class.d.ts +2 -2
- package/src/basic/td-container/td-main/td-main.class.js +5 -1
- package/src/basic/td-container/td-main/td-main.interface.d.ts +3 -2
- package/src/basic/td-icon/td-icon.class.d.ts +1 -1
- package/src/basic/td-icon/td-icon.class.js +10 -5
- package/src/basic/td-icon/td-icon.interface.d.ts +3 -2
- package/src/basic/td-icon/td-icon.style.js +1 -1
- package/src/basic/td-select/td-select.class.js +1 -2
- package/src/feedback/overlay/overlay.abstract.js +11 -9
- package/src/form/checkbox-group/checkbox-group.class.js +1 -2
- package/src/form/checkbox-group/checkbox-option/checkbox-option.class.js +1 -1
- package/src/form/field-item/field-item.abstract.js +2 -2
- package/src/form/field-item/input/field-input.abstract.js +1 -1
- package/src/form/field-item/options/field-options.abstract.js +3 -5
- package/src/form/field-item/radio/field-radio.abstract.js +1 -1
- package/src/form/field-item/span/field-span.abstract.js +1 -1
- package/src/form/field-item/textarea/field-textarea.abstract.js +2 -2
- package/src/form/radio-group/radio-group.class.js +1 -2
- package/src/form/radio-group/radio-option/radio-option.class.js +1 -1
- package/src/form/select/select.class.js +2 -3
- package/src/others/collapsible-box/heading/expand-heading.js +1 -1
- package/src/styles/var.js +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# ui
|
|
2
|
-
|
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
|
4
|
-
|
|
5
|
-
## Building
|
|
6
|
-
|
|
7
|
-
Run `nx build ui` to build the library.
|
|
8
|
-
|
|
9
|
-
## Running unit tests
|
|
10
|
-
|
|
11
|
-
Run `nx test ui` to execute the unit tests via [Jest](https://jestjs.io).
|
|
1
|
+
# ui
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build ui` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `nx test ui` to execute the unit tests via [Jest](https://jestjs.io).
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { TypeButton, TextNode, Span
|
|
1
|
+
import { TypeButton, TextNode, Span } from '@type-dom/framework';
|
|
2
2
|
import { TdIcon } from '../td-icon/td-icon.class';
|
|
3
3
|
import { ITdButton, ITdButtonConfig } from './td-button.interface';
|
|
4
4
|
export declare class TdButton extends TypeButton implements ITdButton {
|
|
5
5
|
className: 'TdButton';
|
|
6
|
-
parent?: TypeHtml | XElement;
|
|
7
6
|
childNodes: (Span | TdIcon)[];
|
|
8
7
|
span: Span;
|
|
9
8
|
textNode: TextNode;
|
|
@@ -13,39 +13,48 @@ class TdButton extends framework_1.TypeButton {
|
|
|
13
13
|
super();
|
|
14
14
|
this.className = 'TdButton';
|
|
15
15
|
// this.template = new Template(this);
|
|
16
|
-
this.span = new framework_1.Span(this);
|
|
17
|
-
this.span.addStyleObj({
|
|
18
|
-
display: 'inline-flex',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
});
|
|
21
16
|
this.textNode = new framework_1.TextNode();
|
|
22
|
-
this.span.
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
this.span = new framework_1.Span({
|
|
18
|
+
parent: this,
|
|
19
|
+
styleObj: {
|
|
20
|
+
display: 'inline-flex',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
},
|
|
23
|
+
childNodes: [
|
|
24
|
+
this.textNode,
|
|
25
|
+
new framework_1.Slot(),
|
|
26
|
+
]
|
|
27
|
+
});
|
|
25
28
|
this.childNodes = [this.span];
|
|
26
29
|
this.setConfig(config);
|
|
27
30
|
}
|
|
28
31
|
setConfig(config) {
|
|
29
32
|
this.addStyleObj(td_button_style_1.tdButtonBase);
|
|
33
|
+
super.setConfig(config);
|
|
30
34
|
if (config === null || config === void 0 ? void 0 : config.title) {
|
|
31
35
|
this.textNode.setText(config.title);
|
|
32
36
|
}
|
|
33
|
-
|
|
37
|
+
else {
|
|
38
|
+
this.clearChildren();
|
|
39
|
+
}
|
|
40
|
+
if (config === null || config === void 0 ? void 0 : config.svgObj) {
|
|
34
41
|
const icon = new td_icon_class_1.TdIcon({
|
|
35
|
-
|
|
42
|
+
childNodes: [
|
|
43
|
+
config.svgObj,
|
|
44
|
+
]
|
|
36
45
|
});
|
|
37
46
|
if (config.iconPosition === 'right') {
|
|
38
47
|
icon.addStyleObj(td_icon_style_1.$iconRight);
|
|
39
48
|
this.addChild(icon);
|
|
40
49
|
}
|
|
41
50
|
else {
|
|
42
|
-
if (config.title) {
|
|
43
|
-
|
|
44
|
-
}
|
|
51
|
+
// if (config.title) {
|
|
52
|
+
// icon.addStyleObj($iconLeft);
|
|
53
|
+
// }
|
|
45
54
|
// else {
|
|
46
55
|
// icon.addStyleObj()
|
|
47
56
|
// }
|
|
48
|
-
this.unshiftChild(icon);
|
|
57
|
+
this.unshiftChild(icon); // 前面插入
|
|
49
58
|
}
|
|
50
59
|
if (config.loading) {
|
|
51
60
|
icon.addStyleObj(td_icon_style_1.$iconLoading);
|
|
@@ -106,7 +115,7 @@ class TdButton extends framework_1.TypeButton {
|
|
|
106
115
|
else {
|
|
107
116
|
this.setStyleObj({
|
|
108
117
|
color: var_1.$button.hover.textColor,
|
|
109
|
-
backgroundColor: var_1.$button.hover.borderColor,
|
|
118
|
+
backgroundColor: var_1.$button.hover.borderColor, // $colors['primary']['light-3'],
|
|
110
119
|
borderColor: var_1.$button.hover.borderColor,
|
|
111
120
|
});
|
|
112
121
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITypeButton, ISpan } from '@type-dom/framework';
|
|
1
|
+
import { ITypeButton, ISpan, ITypeConfig, TypeSvgSvg } from '@type-dom/framework';
|
|
2
2
|
import { ITdIcon } from '../td-icon/td-icon.interface';
|
|
3
3
|
export interface ITdButton extends ITypeButton {
|
|
4
4
|
className: 'TdButton';
|
|
@@ -20,12 +20,13 @@ export type IButtonNativeType = 'button' | 'submit' | 'reset';
|
|
|
20
20
|
* color 自定义按钮的颜色。
|
|
21
21
|
* disabled 按钮是否为禁用状态
|
|
22
22
|
*/
|
|
23
|
-
export interface ITdButtonConfig {
|
|
23
|
+
export interface ITdButtonConfig extends ITypeConfig {
|
|
24
24
|
size: IButtonSize;
|
|
25
25
|
disabled: boolean;
|
|
26
26
|
title: string;
|
|
27
27
|
type: IButtonType;
|
|
28
28
|
SvgClass: any;
|
|
29
|
+
svgObj: TypeSvgSvg;
|
|
29
30
|
iconPosition: 'left' | 'right';
|
|
30
31
|
icon: string;
|
|
31
32
|
nativeType: IButtonNativeType;
|
|
@@ -48,16 +48,16 @@ exports.tdButtonBase = {
|
|
|
48
48
|
boxSizing: 'border-box',
|
|
49
49
|
outline: 'none',
|
|
50
50
|
transition: '.1s',
|
|
51
|
-
fontWeight: var_1.$button.fontWeight,
|
|
51
|
+
fontWeight: var_1.$button.fontWeight, // getCssVar('button', 'font-weight');
|
|
52
52
|
userSelect: 'none',
|
|
53
53
|
verticalAlign: 'middle',
|
|
54
54
|
appearance: 'none',
|
|
55
55
|
// '-webkit-appearance': 'none',
|
|
56
|
-
backgroundColor: var_1.$button.bgColor,
|
|
56
|
+
backgroundColor: var_1.$button.bgColor, // getCssVar('button', 'bg-color');
|
|
57
57
|
// border: $border, // getCssVar('border'),
|
|
58
58
|
borderWidth: var_1.$borderWidth,
|
|
59
59
|
borderStyle: var_1.$borderStyle,
|
|
60
|
-
borderColor: var_1.$button.borderColor,
|
|
60
|
+
borderColor: var_1.$button.borderColor, // getCssVar('button', 'border-color');
|
|
61
61
|
padding: '8px 15px',
|
|
62
62
|
};
|
|
63
63
|
exports.$buttonStateColors = {};
|
|
@@ -74,16 +74,16 @@ function buttonVariant($type) {
|
|
|
74
74
|
hover: {
|
|
75
75
|
color: var_1.$colorWhite,
|
|
76
76
|
// 'link-text-color': $colors[$type]['light-5'],
|
|
77
|
-
backgroundColor: var_1.$colors[$type]['light-3'],
|
|
77
|
+
backgroundColor: var_1.$colors[$type]['light-3'], // ['color', $type, 'light-3'],
|
|
78
78
|
borderColor: var_1.$colors[$type]['light-3'], // ['color', $type, 'light-3'],
|
|
79
79
|
},
|
|
80
80
|
active: {
|
|
81
|
-
backgroundColor: var_1.$colors[$type]['dark-2'],
|
|
81
|
+
backgroundColor: var_1.$colors[$type]['dark-2'], // ['color', $type, 'dark-2'],
|
|
82
82
|
borderColor: var_1.$colors[$type]['dark-2'] // ['color', $type, 'dark-2'],
|
|
83
83
|
},
|
|
84
84
|
disabled: {
|
|
85
85
|
color: var_1.$colorWhite,
|
|
86
|
-
backgroundColor: var_1.$colors[$type]['light-5'],
|
|
86
|
+
backgroundColor: var_1.$colors[$type]['light-5'], // ['color', $type, 'light-5'],
|
|
87
87
|
borderColor: var_1.$colors[$type]['light-5'], // ['color', $type, 'light-5'],
|
|
88
88
|
},
|
|
89
89
|
};
|
|
@@ -2,5 +2,5 @@ import { TypeAside } from '@type-dom/framework';
|
|
|
2
2
|
import { ITdAsideConfig } from './td-aside.interface';
|
|
3
3
|
export declare class TdAside extends TypeAside {
|
|
4
4
|
className: 'TdAside';
|
|
5
|
-
constructor(config?: ITdAsideConfig);
|
|
5
|
+
constructor(config?: Partial<ITdAsideConfig>);
|
|
6
6
|
}
|
|
@@ -10,8 +10,20 @@ class TdAside extends framework_1.TypeAside {
|
|
|
10
10
|
overflow: 'auto',
|
|
11
11
|
boxSizing: 'border-box',
|
|
12
12
|
flexShrink: 0,
|
|
13
|
-
width:
|
|
13
|
+
width: '300px'
|
|
14
14
|
});
|
|
15
|
+
if (config === null || config === void 0 ? void 0 : config.width) {
|
|
16
|
+
if (typeof config.width !== 'number') {
|
|
17
|
+
console.warn('TdAside: width should be a number');
|
|
18
|
+
this.addStyleObj({
|
|
19
|
+
width: config.width,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
this.addStyleObj({
|
|
23
|
+
width: config.width + 'px',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
this.setConfig(config);
|
|
15
27
|
}
|
|
16
28
|
}
|
|
17
29
|
exports.TdAside = TdAside;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ITypeAside } from '@type-dom/framework';
|
|
1
|
+
import { ITypeAside, ITypeConfig } from '@type-dom/framework';
|
|
2
2
|
export interface ITdAside extends ITypeAside {
|
|
3
3
|
className: 'td-aside';
|
|
4
4
|
}
|
|
5
|
-
export interface ITdAsideConfig {
|
|
5
|
+
export interface ITdAsideConfig extends ITypeConfig {
|
|
6
|
+
name: string;
|
|
6
7
|
width: string | number;
|
|
7
8
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeElement, TypeSection } from '@type-dom/framework';
|
|
2
2
|
import { ITdContainerConfig } from './td-container.interface';
|
|
3
|
+
import { TdAside } from './td-aside/td-aside.class';
|
|
4
|
+
import { TdHeader } from './td-header/td-header.class';
|
|
5
|
+
import { TdMain } from './td-main/td-main.class';
|
|
3
6
|
export declare class TdContainer extends TypeSection {
|
|
4
7
|
className: 'TdContainer';
|
|
5
|
-
|
|
6
|
-
constructor(config?: ITdContainerConfig);
|
|
8
|
+
childNodes: (TdAside | TdHeader | TdMain | TdContainer | TypeElement)[];
|
|
9
|
+
constructor(config?: Partial<ITdContainerConfig>);
|
|
7
10
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdContainer = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
|
-
// import '../../style/scss/index.scss';
|
|
6
5
|
class TdContainer extends framework_1.TypeSection {
|
|
7
6
|
constructor(config) {
|
|
8
7
|
super();
|
|
@@ -11,17 +10,19 @@ class TdContainer extends framework_1.TypeSection {
|
|
|
11
10
|
this.addAttrClass('td-container');
|
|
12
11
|
this.addStyleObj({
|
|
13
12
|
display: 'flex',
|
|
14
|
-
flexDirection: 'row',
|
|
13
|
+
flexDirection: 'row', // vertical ===> column
|
|
15
14
|
flex: 1,
|
|
16
15
|
flexBasis: 'auto',
|
|
17
16
|
boxSizing: 'border-box',
|
|
18
17
|
minWidth: 0,
|
|
19
18
|
});
|
|
19
|
+
this.childNodes = [];
|
|
20
20
|
if (config === null || config === void 0 ? void 0 : config.vertical) {
|
|
21
21
|
this.addStyleObj({
|
|
22
22
|
flexDirection: 'column'
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
this.setConfig(config);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
exports.TdContainer = TdContainer;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { ITypeSection } from '@type-dom/framework';
|
|
1
|
+
import { ITypeConfig, ITypeSection, TextNode, TypeElement } from '@type-dom/framework';
|
|
2
|
+
import { TdAside } from './td-aside/td-aside.class';
|
|
3
|
+
import { TdHeader } from './td-header/td-header.class';
|
|
4
|
+
import { TdMain } from './td-main/td-main.class';
|
|
5
|
+
import { TdContainer } from './td-container.class';
|
|
2
6
|
export interface ITdContainer extends ITypeSection {
|
|
3
7
|
className: 'TdContainer';
|
|
4
8
|
}
|
|
5
|
-
export interface ITdContainerConfig {
|
|
9
|
+
export interface ITdContainerConfig extends ITypeConfig {
|
|
10
|
+
name: string;
|
|
6
11
|
vertical: boolean;
|
|
7
12
|
direction: 'vertical' | 'horizontal';
|
|
13
|
+
childNodes: (TdAside | TdHeader | TdMain | TdContainer | TypeElement | TextNode)[];
|
|
8
14
|
}
|
|
@@ -2,5 +2,5 @@ import { TypeFooter } from '@type-dom/framework';
|
|
|
2
2
|
import type { ITdFooter, ITdFooterConfig } from './td-footer.interface';
|
|
3
3
|
export declare class TdFooter extends TypeFooter implements ITdFooter {
|
|
4
4
|
className: 'TdFooter';
|
|
5
|
-
constructor(config?: ITdFooterConfig);
|
|
5
|
+
constructor(config?: Partial<ITdFooterConfig>);
|
|
6
6
|
}
|
|
@@ -13,6 +13,18 @@ class TdFooter extends framework_1.TypeFooter {
|
|
|
13
13
|
flexShrink: 0,
|
|
14
14
|
backgroundColor: '#a0cfff',
|
|
15
15
|
});
|
|
16
|
+
if (config === null || config === void 0 ? void 0 : config.styleObj) {
|
|
17
|
+
this.addStyleObj(config.styleObj);
|
|
18
|
+
}
|
|
19
|
+
if (config === null || config === void 0 ? void 0 : config.name) {
|
|
20
|
+
this.addAttrName(config.name);
|
|
21
|
+
}
|
|
22
|
+
if (config === null || config === void 0 ? void 0 : config.childNodes) {
|
|
23
|
+
this.childNodes = config.childNodes;
|
|
24
|
+
}
|
|
25
|
+
if (config === null || config === void 0 ? void 0 : config.text) {
|
|
26
|
+
this.childNodes = [new framework_1.TextNode(config.text)];
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
}
|
|
18
30
|
exports.TdFooter = TdFooter;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ITypeFooter } from '@type-dom/framework';
|
|
1
|
+
import { IStyle, ITypeFooter, TextNode, TypeElement } from '@type-dom/framework';
|
|
2
2
|
export interface ITdFooter extends ITypeFooter {
|
|
3
3
|
className: 'TdFooter';
|
|
4
4
|
}
|
|
5
5
|
export interface ITdFooterConfig {
|
|
6
6
|
height: string;
|
|
7
|
+
name: string;
|
|
8
|
+
text: string;
|
|
9
|
+
styleObj: Partial<IStyle>;
|
|
10
|
+
childNodes: (TypeElement | TextNode)[];
|
|
7
11
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { TypeHeader } from '@type-dom/framework';
|
|
1
|
+
import { TextNode, TypeElement, TypeHeader } from '@type-dom/framework';
|
|
2
2
|
import type { ITdHeader, ITdHeaderConfig } from './td-header.interface';
|
|
3
3
|
import { TdContainer } from '../td-container.class';
|
|
4
4
|
export declare class TdHeader extends TypeHeader implements ITdHeader {
|
|
5
5
|
className: 'TdHeader';
|
|
6
6
|
parent?: TdContainer;
|
|
7
|
-
|
|
7
|
+
childNodes: (TypeElement | TextNode)[];
|
|
8
|
+
constructor(config?: Partial<ITdHeaderConfig>);
|
|
8
9
|
}
|
|
@@ -13,6 +13,11 @@ class TdHeader extends framework_1.TypeHeader {
|
|
|
13
13
|
flexShrink: 0,
|
|
14
14
|
backgroundColor: '#a0cfff',
|
|
15
15
|
});
|
|
16
|
+
this.childNodes = [];
|
|
17
|
+
if (config === null || config === void 0 ? void 0 : config.text) {
|
|
18
|
+
const text = new framework_1.TextNode(config === null || config === void 0 ? void 0 : config.text);
|
|
19
|
+
this.childNodes = [text];
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
exports.TdHeader = TdHeader;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ITypeHeader } from '@type-dom/framework';
|
|
1
|
+
import { ITypeHeader, TextNode, TypeElement } from '@type-dom/framework';
|
|
2
2
|
export interface ITdHeader extends ITypeHeader {
|
|
3
3
|
className: 'TdHeader';
|
|
4
4
|
}
|
|
5
5
|
export interface ITdHeaderConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
text: string;
|
|
6
8
|
height: string;
|
|
9
|
+
childNodes: (TypeElement | TextNode)[];
|
|
7
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeMain } from '@type-dom/framework';
|
|
2
|
-
import { ITdMain } from './td-main.interface';
|
|
2
|
+
import { ITdMain, ITdMainConfig } from './td-main.interface';
|
|
3
3
|
export declare class TdMain extends TypeMain implements ITdMain {
|
|
4
4
|
className: 'TdMain';
|
|
5
|
-
constructor();
|
|
5
|
+
constructor(config?: Partial<ITdMainConfig>);
|
|
6
6
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TdMain = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
5
|
class TdMain extends framework_1.TypeMain {
|
|
6
|
-
constructor() {
|
|
6
|
+
constructor(config) {
|
|
7
7
|
super();
|
|
8
8
|
this.className = 'TdMain';
|
|
9
9
|
this.addStyleObj({
|
|
@@ -14,6 +14,10 @@ class TdMain extends framework_1.TypeMain {
|
|
|
14
14
|
boxSizing: 'border-box',
|
|
15
15
|
padding: '20px',
|
|
16
16
|
});
|
|
17
|
+
if (config === null || config === void 0 ? void 0 : config.name) {
|
|
18
|
+
this.addAttrName(config.name);
|
|
19
|
+
}
|
|
20
|
+
this.setConfig(config);
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
exports.TdMain = TdMain;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ITypeMain } from '@type-dom/framework';
|
|
1
|
+
import { ITypeConfig, ITypeMain } from '@type-dom/framework';
|
|
2
2
|
export interface ITdMain extends ITypeMain {
|
|
3
3
|
className: 'TdMain';
|
|
4
4
|
}
|
|
5
|
-
export interface ITdMainConfig {
|
|
5
|
+
export interface ITdMainConfig extends ITypeConfig {
|
|
6
|
+
name: string;
|
|
6
7
|
}
|
|
@@ -6,6 +6,6 @@ export declare class TdIcon extends TypeI implements ITdIcon {
|
|
|
6
6
|
svg?: TypeSvgSvg;
|
|
7
7
|
constructor(config?: Partial<ITdIconConfig>);
|
|
8
8
|
createSvg(className: string): void;
|
|
9
|
-
|
|
9
|
+
resetConfig(config?: Partial<ITdIconConfig>): void;
|
|
10
10
|
replaceSvg(svg: TypeSvgSvg): void;
|
|
11
11
|
}
|
|
@@ -7,22 +7,27 @@ class TdIcon extends framework_1.TypeI {
|
|
|
7
7
|
constructor(config) {
|
|
8
8
|
super();
|
|
9
9
|
this.className = 'TdIcon';
|
|
10
|
-
const slot = new framework_1.Slot(this);
|
|
10
|
+
const slot = new framework_1.Slot({ parent: this });
|
|
11
11
|
this.childNodes = [slot];
|
|
12
|
+
this.addStyleObj(td_icon_style_1.$tdIcon);
|
|
12
13
|
this.setConfig(config);
|
|
14
|
+
this.resetConfig(config);
|
|
13
15
|
}
|
|
14
16
|
// todo
|
|
15
17
|
createSvg(className) {
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (config === null || config === void 0 ? void 0 : config.SvgClass) {
|
|
20
|
+
resetConfig(config) {
|
|
21
|
+
if (config === null || config === void 0 ? void 0 : config.SvgClass) { // todo 直接作为 childNodes的子元素更合理;
|
|
21
22
|
const svg = new config.SvgClass(this);
|
|
22
23
|
// svg.resetSize('1em', '1em');
|
|
23
24
|
this.addChild(svg);
|
|
24
25
|
this.svg = svg;
|
|
25
26
|
}
|
|
27
|
+
if (config === null || config === void 0 ? void 0 : config.svgObj) { // 直接作为 childNodes的子元素更合理;
|
|
28
|
+
this.addChild(config.svgObj);
|
|
29
|
+
this.svg = config.svgObj;
|
|
30
|
+
}
|
|
26
31
|
if (config === null || config === void 0 ? void 0 : config.color) {
|
|
27
32
|
this.addStyleObj({
|
|
28
33
|
color: config.color,
|
|
@@ -40,7 +45,7 @@ class TdIcon extends framework_1.TypeI {
|
|
|
40
45
|
this.addStyleObj(td_icon_style_1.$iconRight);
|
|
41
46
|
}
|
|
42
47
|
else {
|
|
43
|
-
|
|
48
|
+
this.addStyleObj(td_icon_style_1.$iconLeft);
|
|
44
49
|
}
|
|
45
50
|
// this.addStyleObj(sizeOpts[size]);
|
|
46
51
|
// this.addAttrObj({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ITypeI } from '@type-dom/framework';
|
|
1
|
+
import { ITypeConfig, ITypeI, TypeSvgSvg } from '@type-dom/framework';
|
|
2
2
|
export interface ITdIcon extends ITypeI {
|
|
3
3
|
className: 'TdIcon';
|
|
4
4
|
}
|
|
5
|
-
export interface ITdIconConfig {
|
|
5
|
+
export interface ITdIconConfig extends ITypeConfig {
|
|
6
6
|
SvgClass: any;
|
|
7
|
+
svgObj: TypeSvgSvg;
|
|
7
8
|
size: string;
|
|
8
9
|
color: string;
|
|
9
10
|
loading: boolean;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.$iconLeft = exports.$iconRight = exports.$iconLoading = exports.$tdIcon = void 0;
|
|
4
4
|
const framework_1 = require("@type-dom/framework");
|
|
5
5
|
exports.$tdIcon = {
|
|
6
|
-
height: '1em',
|
|
6
|
+
// height: '1em',
|
|
7
7
|
width: '1em',
|
|
8
8
|
lineHeight: '1em',
|
|
9
9
|
display: framework_1.StyleDisplay.inlineFlex,
|
|
@@ -12,8 +12,7 @@ class TdSelect extends framework_1.TypeSelect {
|
|
|
12
12
|
this.childNodes = [];
|
|
13
13
|
}
|
|
14
14
|
setOptions(options, value) {
|
|
15
|
-
this.
|
|
16
|
-
this.clearChildDom();
|
|
15
|
+
this.clearChildren();
|
|
17
16
|
const firstOpt = new option_class_1.SelectOption();
|
|
18
17
|
firstOpt.text.setText('请选择');
|
|
19
18
|
firstOpt.addAttrObj({
|
|
@@ -13,7 +13,7 @@ class Overlay extends framework_1.TypeDiv {
|
|
|
13
13
|
top: '0',
|
|
14
14
|
right: '0',
|
|
15
15
|
bottom: '0',
|
|
16
|
-
height: '100%',
|
|
16
|
+
height: '100%', // ???
|
|
17
17
|
zIndex: 2000,
|
|
18
18
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
19
19
|
overflow: 'auto',
|
|
@@ -30,10 +30,14 @@ class Overlay extends framework_1.TypeDiv {
|
|
|
30
30
|
}
|
|
31
31
|
// 设置消息
|
|
32
32
|
setMsg(msg) {
|
|
33
|
-
const span = new framework_1.Span(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const span = new framework_1.Span({
|
|
34
|
+
parent: this.container.body,
|
|
35
|
+
childNodes: [
|
|
36
|
+
new framework_1.TextNode(msg),
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
// this.container.body.clearChild();
|
|
40
|
+
this.container.body.clearChildren();
|
|
37
41
|
this.container.body.appendChild(span);
|
|
38
42
|
}
|
|
39
43
|
// 设置复杂的内容
|
|
@@ -48,10 +52,8 @@ class Overlay extends framework_1.TypeDiv {
|
|
|
48
52
|
}
|
|
49
53
|
clear() {
|
|
50
54
|
this.container.header.title.text.setText('标题');
|
|
51
|
-
this.container.body.
|
|
52
|
-
this.container.
|
|
53
|
-
this.container.body.clearChildNodes();
|
|
54
|
-
this.container.footer.clearChildDom();
|
|
55
|
+
this.container.body.clearChildren();
|
|
56
|
+
this.container.footer.clearChildrenDom();
|
|
55
57
|
}
|
|
56
58
|
clearBody() {
|
|
57
59
|
// this.container.body.clearChildDom();
|
|
@@ -12,8 +12,7 @@ class CheckboxGroup extends framework_1.TypeDiv {
|
|
|
12
12
|
this.value = [];
|
|
13
13
|
}
|
|
14
14
|
setOptions(options) {
|
|
15
|
-
this.
|
|
16
|
-
this.clearChildDom();
|
|
15
|
+
this.clearChildren();
|
|
17
16
|
this.value = [];
|
|
18
17
|
const random = Math.random();
|
|
19
18
|
options.forEach((opt) => {
|
|
@@ -7,7 +7,7 @@ class CheckboxOption extends framework_1.TypeSpan {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
this.className = 'CheckboxOption';
|
|
10
|
-
this.input = new framework_1.Input(this);
|
|
10
|
+
this.input = new framework_1.Input({ parent: this });
|
|
11
11
|
this.input.addAttrObj({
|
|
12
12
|
type: 'checkbox',
|
|
13
13
|
// name: optionConfig.name,
|
|
@@ -15,11 +15,11 @@ class FieldItem extends framework_1.TypeComponent {
|
|
|
15
15
|
// marginBottom: '10px!important',
|
|
16
16
|
fontSize: '14px',
|
|
17
17
|
};
|
|
18
|
-
this.label = new framework_1.Label(this);
|
|
18
|
+
this.label = new framework_1.Label({ parent: this });
|
|
19
19
|
this.label.textNode.setText(labelText);
|
|
20
20
|
this.label.childNodes.push(this.label.textNode);
|
|
21
21
|
this.label.addStyleObj(Object.assign({}, field_item_style_1.labelStyle));
|
|
22
|
-
this.button = new framework_1.Button(this);
|
|
22
|
+
this.button = new framework_1.Button({ parent: this });
|
|
23
23
|
this.button.addStyleObj({
|
|
24
24
|
height: '28px',
|
|
25
25
|
background: '#ffffff',
|
|
@@ -8,7 +8,7 @@ const field_item_style_1 = require("../field-item.style");
|
|
|
8
8
|
class FieldInput extends field_item_abstract_1.FieldItem {
|
|
9
9
|
constructor(labelText = '控件名称', placeholder = '请输入') {
|
|
10
10
|
super(labelText);
|
|
11
|
-
this.content = new framework_1.Input(this);
|
|
11
|
+
this.content = new framework_1.Input({ parent: this });
|
|
12
12
|
this.content.propObj = {
|
|
13
13
|
styleObj: Object.assign({}, field_item_style_1.itemContentStyle),
|
|
14
14
|
attrObj: {
|
|
@@ -43,7 +43,7 @@ class PropertyOptions extends field_item_abstract_1.FieldItem {
|
|
|
43
43
|
borderRadius: '4px 0 0 4px',
|
|
44
44
|
borderRight: 'none',
|
|
45
45
|
}));
|
|
46
|
-
this.btn = new framework_1.Button(this.selectDiv);
|
|
46
|
+
this.btn = new framework_1.Button({ parent: this.selectDiv });
|
|
47
47
|
this.btn.addStyleObj({
|
|
48
48
|
// position: 'absolute',
|
|
49
49
|
// right: '10px',
|
|
@@ -132,8 +132,7 @@ class PropertyOptions extends field_item_abstract_1.FieldItem {
|
|
|
132
132
|
this.selectObj.setOptions(optionConfig.options, optionConfig.resultValue);
|
|
133
133
|
// todo 监听事件
|
|
134
134
|
this.optionConfig = optionConfig;
|
|
135
|
-
this.optionsContent.
|
|
136
|
-
this.optionsContent.clearChildDom();
|
|
135
|
+
this.optionsContent.clearChildren();
|
|
137
136
|
const styleObj = {
|
|
138
137
|
display: 'inline-block',
|
|
139
138
|
width: '45%',
|
|
@@ -187,8 +186,7 @@ class PropertyOptions extends field_item_abstract_1.FieldItem {
|
|
|
187
186
|
// this.selectConfigDiv.clearChildNodes();
|
|
188
187
|
// this.selectConfigDiv.clearChildDom();
|
|
189
188
|
// this.selectConfigDiv.appendChild(this.selectObj).appendChild(this.firstDiv);
|
|
190
|
-
this.optionsContent.
|
|
191
|
-
this.optionsContent.clearChildDom();
|
|
189
|
+
this.optionsContent.clearChildren();
|
|
192
190
|
const styleObj = {
|
|
193
191
|
display: 'inline-block',
|
|
194
192
|
width: '45%',
|
|
@@ -18,7 +18,7 @@ class FieldRadio extends field_item_abstract_1.FieldItem {
|
|
|
18
18
|
options.forEach((option, index) => {
|
|
19
19
|
let button;
|
|
20
20
|
if (!this.optionDiv.childNodes[index]) {
|
|
21
|
-
button = new framework_1.Button(this);
|
|
21
|
+
button = new framework_1.Button({ parent: this });
|
|
22
22
|
button.setTitle(option.label);
|
|
23
23
|
// const label = new TextNode(button, option.label);
|
|
24
24
|
// button.childNodes = [label];
|
|
@@ -7,7 +7,7 @@ const field_item_abstract_1 = require("../field-item.abstract");
|
|
|
7
7
|
class FieldSpan extends field_item_abstract_1.FieldItem {
|
|
8
8
|
constructor(labelText = '控件名称') {
|
|
9
9
|
super(labelText);
|
|
10
|
-
this.content = new framework_1.Span(this);
|
|
10
|
+
this.content = new framework_1.Span({ parent: this });
|
|
11
11
|
this.content.propObj = {
|
|
12
12
|
styleObj: {
|
|
13
13
|
height: '28px',
|
|
@@ -9,10 +9,10 @@ class FieldTextarea extends field_item_abstract_1.FieldItem {
|
|
|
9
9
|
super(labelText);
|
|
10
10
|
this.mode = 'edit';
|
|
11
11
|
this.addStyleObj({
|
|
12
|
-
display: 'block',
|
|
12
|
+
display: 'block', // 不是 flex
|
|
13
13
|
marginBottom: '20px',
|
|
14
14
|
});
|
|
15
|
-
this.content = new framework_1.Textarea(this);
|
|
15
|
+
this.content = new framework_1.Textarea({ parent: this });
|
|
16
16
|
this.content.propObj = {
|
|
17
17
|
styleObj: {
|
|
18
18
|
height: '100%',
|
|
@@ -12,8 +12,7 @@ class RadioGroup extends framework_1.TypeDiv {
|
|
|
12
12
|
this.childNodes = [];
|
|
13
13
|
}
|
|
14
14
|
setOptions(options) {
|
|
15
|
-
this.
|
|
16
|
-
this.clearChildDom();
|
|
15
|
+
this.clearChildren();
|
|
17
16
|
const random = Math.random();
|
|
18
17
|
options.forEach((opt) => {
|
|
19
18
|
const optObj = new radio_option_class_1.RadioOption();
|
|
@@ -10,7 +10,7 @@ class RadioOption extends framework_1.TypeSpan {
|
|
|
10
10
|
this.addStyleObj({
|
|
11
11
|
padding: '0 5px',
|
|
12
12
|
});
|
|
13
|
-
this.input = new framework_1.Input(this);
|
|
13
|
+
this.input = new framework_1.Input({ parent: this });
|
|
14
14
|
this.input.addAttrObj({
|
|
15
15
|
type: 'radio',
|
|
16
16
|
// name: optionConfig.name,
|
|
@@ -11,10 +11,9 @@ class Select extends framework_1.TypeSelect {
|
|
|
11
11
|
this.value = '';
|
|
12
12
|
}
|
|
13
13
|
setOptionConfig(optionConfig) {
|
|
14
|
-
this.
|
|
15
|
-
this.clearChildDom();
|
|
14
|
+
this.clearChildren();
|
|
16
15
|
optionConfig.options.forEach((opt) => {
|
|
17
|
-
const optionObj = new framework_1.Option(this);
|
|
16
|
+
const optionObj = new framework_1.Option({ parent: this });
|
|
18
17
|
optionObj.setAttrObj({
|
|
19
18
|
// label: opt.label,
|
|
20
19
|
value: opt.value,
|
|
@@ -32,7 +32,7 @@ class ExpandHeading extends framework_1.TypeComponent {
|
|
|
32
32
|
});
|
|
33
33
|
this.title = new framework_1.TextNode(title);
|
|
34
34
|
// span.setStyle('verticalAlign', 'middle');
|
|
35
|
-
const span = new framework_1.Span(this);
|
|
35
|
+
const span = new framework_1.Span({ parent: this });
|
|
36
36
|
span.childNodes = [this.title];
|
|
37
37
|
this.childNodes = [this.svg, span];
|
|
38
38
|
}
|
package/src/styles/var.js
CHANGED
|
@@ -187,7 +187,7 @@ console.log('$colors is ', exports.$colors);
|
|
|
187
187
|
// Button
|
|
188
188
|
// css3 var in packages/theme-chalk/src/button.scss
|
|
189
189
|
exports.$button = {
|
|
190
|
-
fontWeight: exports.$fontWeightPrimary,
|
|
190
|
+
fontWeight: exports.$fontWeightPrimary, // getCssVar('font-weight-primary'),
|
|
191
191
|
borderColor: exports.$borderColors[''],
|
|
192
192
|
bgColor: exports.$fillColors.blank,
|
|
193
193
|
textColor: exports.$textColors.regular,
|
|
@@ -209,8 +209,8 @@ exports.$button = {
|
|
|
209
209
|
},
|
|
210
210
|
active: {
|
|
211
211
|
textColor: exports.$colorPrimary,
|
|
212
|
-
borderColor: exports.$colorPrimary,
|
|
213
|
-
bgColor: exports.$colors.primary['light-9'],
|
|
212
|
+
borderColor: exports.$colorPrimary, // 'hover-text-color'
|
|
213
|
+
bgColor: exports.$colors.primary['light-9'], // getCssVar('button', 'hover-bg-color),
|
|
214
214
|
color: exports.$textColors.primary, // getCssVar('text-color', 'primary'),
|
|
215
215
|
},
|
|
216
216
|
outline: {
|