@type-dom/ui 0.0.1
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 -0
- package/package.json +14 -0
- package/src/basic/index.d.ts +15 -0
- package/src/basic/index.js +19 -0
- package/src/basic/td-button/td-button.class.d.ts +16 -0
- package/src/basic/td-button/td-button.class.js +140 -0
- package/src/basic/td-button/td-button.interface.d.ts +38 -0
- package/src/basic/td-button/td-button.interface.js +2 -0
- package/src/basic/td-button/td-button.style.d.ts +13 -0
- package/src/basic/td-button/td-button.style.js +143 -0
- package/src/basic/td-container/td-aside/td-aside.class.d.ts +6 -0
- package/src/basic/td-container/td-aside/td-aside.class.js +17 -0
- package/src/basic/td-container/td-aside/td-aside.interface.d.ts +7 -0
- package/src/basic/td-container/td-aside/td-aside.interface.js +2 -0
- package/src/basic/td-container/td-container.class.d.ts +7 -0
- package/src/basic/td-container/td-container.class.js +27 -0
- package/src/basic/td-container/td-container.d.ts +8 -0
- package/src/basic/td-container/td-container.interface.d.ts +8 -0
- package/src/basic/td-container/td-container.interface.js +2 -0
- package/src/basic/td-container/td-container.js +21 -0
- package/src/basic/td-container/td-footer/td-footer.class.d.ts +6 -0
- package/src/basic/td-container/td-footer/td-footer.class.js +18 -0
- package/src/basic/td-container/td-footer/td-footer.interface.d.ts +7 -0
- package/src/basic/td-container/td-footer/td-footer.interface.js +2 -0
- package/src/basic/td-container/td-header/td-header.class.d.ts +8 -0
- package/src/basic/td-container/td-header/td-header.class.js +18 -0
- package/src/basic/td-container/td-header/td-header.interface.d.ts +7 -0
- package/src/basic/td-container/td-header/td-header.interface.js +2 -0
- package/src/basic/td-container/td-main/td-main.class.d.ts +6 -0
- package/src/basic/td-container/td-main/td-main.class.js +19 -0
- package/src/basic/td-container/td-main/td-main.interface.d.ts +6 -0
- package/src/basic/td-container/td-main/td-main.interface.js +2 -0
- package/src/basic/td-icon/td-icon.class.d.ts +11 -0
- package/src/basic/td-icon/td-icon.class.js +57 -0
- package/src/basic/td-icon/td-icon.interface.d.ts +11 -0
- package/src/basic/td-icon/td-icon.interface.js +2 -0
- package/src/basic/td-icon/td-icon.style.d.ts +13 -0
- package/src/basic/td-icon/td-icon.style.js +27 -0
- package/src/basic/td-select/option/option.class.d.ts +12 -0
- package/src/basic/td-select/option/option.class.js +18 -0
- package/src/basic/td-select/option/option.interface.d.ts +5 -0
- package/src/basic/td-select/option/option.interface.js +2 -0
- package/src/basic/td-select/td-select.class.d.ts +14 -0
- package/src/basic/td-select/td-select.class.js +68 -0
- package/src/basic/td-select/td-select.interface.d.ts +6 -0
- package/src/basic/td-select/td-select.interface.js +2 -0
- package/src/data/index.d.ts +0 -0
- package/src/data/index.js +1 -0
- package/src/feedback/dialog/dialog.d.ts +7 -0
- package/src/feedback/dialog/dialog.js +14 -0
- package/src/feedback/index.d.ts +2 -0
- package/src/feedback/index.js +7 -0
- package/src/feedback/message-box/message-box.d.ts +9 -0
- package/src/feedback/message-box/message-box.js +24 -0
- package/src/feedback/overlay/container/body/body.d.ts +7 -0
- package/src/feedback/overlay/container/body/body.js +21 -0
- package/src/feedback/overlay/container/container.d.ts +15 -0
- package/src/feedback/overlay/container/container.js +41 -0
- package/src/feedback/overlay/container/footer/cancel-button/cancel-button.d.ts +8 -0
- package/src/feedback/overlay/container/footer/cancel-button/cancel-button.js +31 -0
- package/src/feedback/overlay/container/footer/confirm-button/confirm-button.d.ts +9 -0
- package/src/feedback/overlay/container/footer/confirm-button/confirm-button.js +35 -0
- package/src/feedback/overlay/container/footer/footer.d.ts +11 -0
- package/src/feedback/overlay/container/footer/footer.js +49 -0
- package/src/feedback/overlay/container/header/close-button/close-button.d.ts +11 -0
- package/src/feedback/overlay/container/header/close-button/close-button.js +37 -0
- package/src/feedback/overlay/container/header/header.d.ts +12 -0
- package/src/feedback/overlay/container/header/header.js +25 -0
- package/src/feedback/overlay/container/header/title/title.d.ts +9 -0
- package/src/feedback/overlay/container/header/title/title.js +23 -0
- package/src/feedback/overlay/overlay.abstract.d.ts +16 -0
- package/src/feedback/overlay/overlay.abstract.js +65 -0
- package/src/form/checkbox-group/checkbox-group.class.d.ts +13 -0
- package/src/form/checkbox-group/checkbox-group.class.js +59 -0
- package/src/form/checkbox-group/checkbox-group.interface.d.ts +6 -0
- package/src/form/checkbox-group/checkbox-group.interface.js +2 -0
- package/src/form/checkbox-group/checkbox-option/checkbox-option.class.d.ts +12 -0
- package/src/form/checkbox-group/checkbox-option/checkbox-option.class.js +44 -0
- package/src/form/checkbox-group/checkbox-option/checkbox-option.interface.d.ts +10 -0
- package/src/form/checkbox-group/checkbox-option/checkbox-option.interface.js +2 -0
- package/src/form/field-item/cascade/field-cascade.abstract.d.ts +22 -0
- package/src/form/field-item/cascade/field-cascade.abstract.js +186 -0
- package/src/form/field-item/field-item.abstract.d.ts +11 -0
- package/src/form/field-item/field-item.abstract.js +42 -0
- package/src/form/field-item/field-item.interface.d.ts +12 -0
- package/src/form/field-item/field-item.interface.js +2 -0
- package/src/form/field-item/field-item.style.d.ts +3 -0
- package/src/form/field-item/field-item.style.js +39 -0
- package/src/form/field-item/input/field-input.abstract.d.ts +13 -0
- package/src/form/field-item/input/field-input.abstract.js +52 -0
- package/src/form/field-item/options/field-options.abstract.d.ts +22 -0
- package/src/form/field-item/options/field-options.abstract.js +246 -0
- package/src/form/field-item/radio/field-radio.abstract.d.ts +16 -0
- package/src/form/field-item/radio/field-radio.abstract.js +98 -0
- package/src/form/field-item/select/field-select.abstract.d.ts +12 -0
- package/src/form/field-item/select/field-select.abstract.js +44 -0
- package/src/form/field-item/span/field-span.abstract.d.ts +9 -0
- package/src/form/field-item/span/field-span.abstract.js +54 -0
- package/src/form/field-item/textarea/field-textarea.abstract.d.ts +11 -0
- package/src/form/field-item/textarea/field-textarea.abstract.js +63 -0
- package/src/form/index.d.ts +11 -0
- package/src/form/index.js +23 -0
- package/src/form/input-number/td-input-number.class.d.ts +9 -0
- package/src/form/input-number/td-input-number.class.js +55 -0
- package/src/form/input-number/td-input-number.interface.d.ts +9 -0
- package/src/form/input-number/td-input-number.interface.js +2 -0
- package/src/form/radio-group/radio-group.class.d.ts +13 -0
- package/src/form/radio-group/radio-group.class.js +48 -0
- package/src/form/radio-group/radio-group.interface.d.ts +6 -0
- package/src/form/radio-group/radio-group.interface.js +2 -0
- package/src/form/radio-group/radio-option/radio-option.class.d.ts +12 -0
- package/src/form/radio-group/radio-option/radio-option.class.js +33 -0
- package/src/form/radio-group/radio-option/radio-option.interface.d.ts +5 -0
- package/src/form/radio-group/radio-option/radio-option.interface.js +2 -0
- package/src/form/select/select.class.d.ts +17 -0
- package/src/form/select/select.class.js +132 -0
- package/src/form/select/select.interface.d.ts +10 -0
- package/src/form/select/select.interface.js +2 -0
- package/src/form/td-input/td-input.class.d.ts +9 -0
- package/src/form/td-input/td-input.class.js +55 -0
- package/src/form/td-input/td-input.interface.d.ts +11 -0
- package/src/form/td-input/td-input.interface.js +2 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +8 -0
- package/src/navigation/index.d.ts +0 -0
- package/src/navigation/index.js +1 -0
- package/src/others/collapsible-box/collapsible-box.d.ts +15 -0
- package/src/others/collapsible-box/collapsible-box.js +37 -0
- package/src/others/collapsible-box/contents/contents.d.ts +7 -0
- package/src/others/collapsible-box/contents/contents.js +25 -0
- package/src/others/collapsible-box/heading/expand-heading.d.ts +12 -0
- package/src/others/collapsible-box/heading/expand-heading.js +70 -0
- package/src/others/index.d.ts +3 -0
- package/src/others/index.js +9 -0
- package/src/styles/color-scheme.d.ts +1 -0
- package/src/styles/color-scheme.js +88 -0
- package/src/styles/config.d.ts +5 -0
- package/src/styles/config.js +8 -0
- package/src/styles/function.d.ts +10 -0
- package/src/styles/function.js +75 -0
- package/src/styles/var.d.ts +184 -0
- package/src/styles/var.js +250 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypeDiv } from '@type-dom/framework';
|
|
2
|
+
import { OverlayContainer } from '../container';
|
|
3
|
+
import { OverlayTitle } from './title/title';
|
|
4
|
+
import { CloseButton } from './close-button/close-button';
|
|
5
|
+
export declare class OverlayHeader extends TypeDiv {
|
|
6
|
+
className: 'OverlayHeader';
|
|
7
|
+
parent?: OverlayContainer;
|
|
8
|
+
childNodes: [OverlayTitle, CloseButton];
|
|
9
|
+
title: OverlayTitle;
|
|
10
|
+
closeBtn: CloseButton;
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverlayHeader = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const title_1 = require("./title/title");
|
|
6
|
+
const close_button_1 = require("./close-button/close-button");
|
|
7
|
+
class OverlayHeader extends framework_1.TypeDiv {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.className = 'OverlayHeader';
|
|
11
|
+
this.addStyleObj({
|
|
12
|
+
padding: '20px',
|
|
13
|
+
paddingBottom: '10px',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
});
|
|
16
|
+
this.addAttrObj({
|
|
17
|
+
name: 'overlay-header',
|
|
18
|
+
});
|
|
19
|
+
this.title = new title_1.OverlayTitle();
|
|
20
|
+
this.closeBtn = new close_button_1.CloseButton();
|
|
21
|
+
this.closeBtn.parent = this;
|
|
22
|
+
this.childNodes = [this.title, this.closeBtn];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.OverlayHeader = OverlayHeader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextNode, TypeSpan } from '@type-dom/framework';
|
|
2
|
+
import { OverlayHeader } from '../header';
|
|
3
|
+
export declare class OverlayTitle extends TypeSpan {
|
|
4
|
+
className: 'OverlayTitle';
|
|
5
|
+
parent?: OverlayHeader;
|
|
6
|
+
childNodes: TextNode[];
|
|
7
|
+
text: TextNode;
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverlayTitle = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
class OverlayTitle extends framework_1.TypeSpan {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.className = 'OverlayTitle';
|
|
9
|
+
this.propObj = {
|
|
10
|
+
styleObj: {
|
|
11
|
+
lineHeight: '16px',
|
|
12
|
+
fontSize: '16px',
|
|
13
|
+
color: '#000',
|
|
14
|
+
},
|
|
15
|
+
attrObj: {
|
|
16
|
+
name: 'overlay-title',
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
this.text = new framework_1.TextNode('标题');
|
|
20
|
+
this.childNodes = [this.text];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.OverlayTitle = OverlayTitle;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TypeDiv } from '@type-dom/framework';
|
|
2
|
+
import { OverlayContainer } from './container/container';
|
|
3
|
+
export declare abstract class Overlay extends TypeDiv {
|
|
4
|
+
abstract className: string;
|
|
5
|
+
childNodes: [OverlayContainer];
|
|
6
|
+
container: OverlayContainer;
|
|
7
|
+
protected constructor();
|
|
8
|
+
setTitle(title: string): void;
|
|
9
|
+
setMsg(msg: string): void;
|
|
10
|
+
setContent(content: string): void;
|
|
11
|
+
show(): void;
|
|
12
|
+
hide(): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
clearBody(): void;
|
|
15
|
+
initEvents(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Overlay = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
const container_1 = require("./container/container");
|
|
7
|
+
class Overlay extends framework_1.TypeDiv {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.addStyleObj({
|
|
11
|
+
position: framework_1.StylePosition.fixed,
|
|
12
|
+
left: '0',
|
|
13
|
+
top: '0',
|
|
14
|
+
right: '0',
|
|
15
|
+
bottom: '0',
|
|
16
|
+
height: '100%',
|
|
17
|
+
zIndex: 2000,
|
|
18
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
19
|
+
overflow: 'auto',
|
|
20
|
+
display: framework_1.StyleDisplay.none,
|
|
21
|
+
});
|
|
22
|
+
// document.body.appendChild(this.dom); // 挂载在 body 上
|
|
23
|
+
this.container = new container_1.OverlayContainer();
|
|
24
|
+
this.container.parent = this;
|
|
25
|
+
this.childNodes = [this.container];
|
|
26
|
+
}
|
|
27
|
+
setTitle(title) {
|
|
28
|
+
this.container.header.title.text.setText(title);
|
|
29
|
+
this.container.header.render();
|
|
30
|
+
}
|
|
31
|
+
// 设置消息
|
|
32
|
+
setMsg(msg) {
|
|
33
|
+
const span = new framework_1.Span(this.container.body);
|
|
34
|
+
const textNode = new framework_1.TextNode(msg);
|
|
35
|
+
span.addChild(textNode);
|
|
36
|
+
this.container.body.clearChild();
|
|
37
|
+
this.container.body.appendChild(span);
|
|
38
|
+
}
|
|
39
|
+
// 设置复杂的内容
|
|
40
|
+
setContent(content) {
|
|
41
|
+
// ToDo
|
|
42
|
+
}
|
|
43
|
+
show() {
|
|
44
|
+
this.setStyle('display', 'block');
|
|
45
|
+
}
|
|
46
|
+
hide() {
|
|
47
|
+
this.setStyle('display', 'none');
|
|
48
|
+
}
|
|
49
|
+
clear() {
|
|
50
|
+
this.container.header.title.text.setText('标题');
|
|
51
|
+
this.container.body.clearChildNodes();
|
|
52
|
+
this.container.body.clearChildDom();
|
|
53
|
+
this.container.body.clearChildNodes();
|
|
54
|
+
this.container.footer.clearChildDom();
|
|
55
|
+
}
|
|
56
|
+
clearBody() {
|
|
57
|
+
// this.container.body.clearChildDom();
|
|
58
|
+
}
|
|
59
|
+
initEvents() {
|
|
60
|
+
this.events.push((0, rxjs_1.fromEvent)(this.dom, 'click').subscribe(() => {
|
|
61
|
+
this.hide();
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Overlay = Overlay;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TypeDiv, TypeHtml } from '@type-dom/framework';
|
|
2
|
+
import { CheckboxOption } from './checkbox-option/checkbox-option.class';
|
|
3
|
+
import { ICheckboxGroup } from './checkbox-group.interface';
|
|
4
|
+
import { IOption } from './checkbox-option/checkbox-option.interface';
|
|
5
|
+
export declare class CheckboxGroup extends TypeDiv implements ICheckboxGroup {
|
|
6
|
+
className: 'CheckboxGroup';
|
|
7
|
+
parent?: TypeHtml;
|
|
8
|
+
childNodes: CheckboxOption[];
|
|
9
|
+
value: (string | number | boolean)[];
|
|
10
|
+
constructor();
|
|
11
|
+
setOptions(options: IOption[]): void;
|
|
12
|
+
setValue(value: string | number | boolean): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxGroup = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const checkbox_option_class_1 = require("./checkbox-option/checkbox-option.class");
|
|
6
|
+
class CheckboxGroup extends framework_1.TypeDiv {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.className = 'CheckboxGroup';
|
|
10
|
+
this.addAttrName('checkbox-group');
|
|
11
|
+
this.childNodes = [];
|
|
12
|
+
this.value = [];
|
|
13
|
+
}
|
|
14
|
+
setOptions(options) {
|
|
15
|
+
this.clearChildNodes();
|
|
16
|
+
this.clearChildDom();
|
|
17
|
+
this.value = [];
|
|
18
|
+
const random = Math.random();
|
|
19
|
+
options.forEach((opt) => {
|
|
20
|
+
const optObj = new checkbox_option_class_1.CheckboxOption();
|
|
21
|
+
optObj.input.addAttrObj({
|
|
22
|
+
name: 'checkbox' + random,
|
|
23
|
+
label: opt.label,
|
|
24
|
+
value: opt.value,
|
|
25
|
+
checked: opt.checked || false
|
|
26
|
+
});
|
|
27
|
+
if (opt.checked) {
|
|
28
|
+
this.value.push(opt.value);
|
|
29
|
+
}
|
|
30
|
+
optObj.text.setText(opt.label);
|
|
31
|
+
this.addChild(optObj);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
setValue(value) {
|
|
35
|
+
// console.error('checkbox group setValue ');
|
|
36
|
+
value = String(value);
|
|
37
|
+
if (value.trim()) {
|
|
38
|
+
// console.error('value is ', value);
|
|
39
|
+
this.value = value.split(',');
|
|
40
|
+
this.childNodes.forEach(optObj => {
|
|
41
|
+
if (this.value.indexOf(String(optObj.input.attrObj.value)) !== -1) {
|
|
42
|
+
optObj.input.setAttrObj({
|
|
43
|
+
checked: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
optObj.input.removeAttribute('checked');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// console.error('value is ', value);
|
|
53
|
+
this.childNodes.forEach(optObj => {
|
|
54
|
+
optObj.input.removeAttribute('checked');
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Input, TextNode, TypeSpan } from '@type-dom/framework';
|
|
2
|
+
import { CheckboxGroup } from '../checkbox-group.class';
|
|
3
|
+
import { ICheckboxOption } from './checkbox-option.interface';
|
|
4
|
+
export declare class CheckboxOption extends TypeSpan implements ICheckboxOption {
|
|
5
|
+
className: 'CheckboxOption';
|
|
6
|
+
parent?: CheckboxGroup;
|
|
7
|
+
childNodes: [Input, TextNode];
|
|
8
|
+
input: Input;
|
|
9
|
+
text: TextNode;
|
|
10
|
+
constructor();
|
|
11
|
+
initEvents(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxOption = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
class CheckboxOption extends framework_1.TypeSpan {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.className = 'CheckboxOption';
|
|
10
|
+
this.input = new framework_1.Input(this);
|
|
11
|
+
this.input.addAttrObj({
|
|
12
|
+
type: 'checkbox',
|
|
13
|
+
// name: optionConfig.name,
|
|
14
|
+
// label: opt.label,
|
|
15
|
+
// value: opt.value,
|
|
16
|
+
// checked: opt.checked || false
|
|
17
|
+
});
|
|
18
|
+
this.text = new framework_1.TextNode();
|
|
19
|
+
this.childNodes = [this.input, this.text];
|
|
20
|
+
}
|
|
21
|
+
initEvents() {
|
|
22
|
+
this.events.push((0, rxjs_1.fromEvent)(this.input.dom, 'click').subscribe(() => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
console.log('this.input.dom click . ');
|
|
25
|
+
console.log('this.input.dom.value is ', this.input.dom.value);
|
|
26
|
+
const flag = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.value.findIndex(item => item === this.input.dom.value);
|
|
27
|
+
if (this.input.dom.checked) {
|
|
28
|
+
if (flag === -1) {
|
|
29
|
+
(_b = this.parent) === null || _b === void 0 ? void 0 : _b.value.push(this.input.dom.value);
|
|
30
|
+
this.input.setAttrObj({
|
|
31
|
+
checked: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.input.removeAttribute('checked');
|
|
37
|
+
if (flag && flag !== -1) {
|
|
38
|
+
(_c = this.parent) === null || _c === void 0 ? void 0 : _c.value.splice(flag, 1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CheckboxOption = CheckboxOption;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ITypeSpan, IInput, ITextNode } from '@type-dom/framework';
|
|
2
|
+
export interface ICheckboxOption extends ITypeSpan {
|
|
3
|
+
className: 'CheckboxOption';
|
|
4
|
+
childNodes: [IInput, ITextNode];
|
|
5
|
+
}
|
|
6
|
+
export interface IOption {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
checked: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Division, Label, Button } from '@type-dom/framework';
|
|
2
|
+
import { FieldItem } from '../field-item.abstract';
|
|
3
|
+
import { TdSelect } from '../../../basic/td-select/td-select.class';
|
|
4
|
+
import { IOptionConfig } from '../field-item.interface';
|
|
5
|
+
/**
|
|
6
|
+
* 两级联动,
|
|
7
|
+
* 目前只有 字段名称属性项用到。 控件属性栏 control-field 字段属性栏 field-name
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class PropertyCascade extends FieldItem {
|
|
10
|
+
childNodes: [Label, Division, Button];
|
|
11
|
+
cascadeDiv: Division;
|
|
12
|
+
firstStageSelectObj: TdSelect;
|
|
13
|
+
secondStageSelectObj: TdSelect;
|
|
14
|
+
private cascadeConfig?;
|
|
15
|
+
abstract reset(value?: string): void;
|
|
16
|
+
protected constructor(labelText?: string);
|
|
17
|
+
get fieldConfig(): IOptionConfig | undefined;
|
|
18
|
+
set fieldConfig(value: IOptionConfig | undefined);
|
|
19
|
+
resetCascadeConfigResultValue(value: string | number | boolean): void;
|
|
20
|
+
resetCascadeConfig(optionConfig: IOptionConfig): void;
|
|
21
|
+
initEvents(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PropertyCascade = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
const field_item_abstract_1 = require("../field-item.abstract");
|
|
7
|
+
const field_item_style_1 = require("../field-item.style");
|
|
8
|
+
const td_select_class_1 = require("../../../basic/td-select/td-select.class");
|
|
9
|
+
/**
|
|
10
|
+
* 两级联动,
|
|
11
|
+
* 目前只有 字段名称属性项用到。 控件属性栏 control-field 字段属性栏 field-name
|
|
12
|
+
*/
|
|
13
|
+
class PropertyCascade extends field_item_abstract_1.FieldItem {
|
|
14
|
+
constructor(labelText = '二级级联') {
|
|
15
|
+
super(labelText);
|
|
16
|
+
this.addAttrName('cascade-property');
|
|
17
|
+
this.cascadeDiv = new framework_1.Division();
|
|
18
|
+
this.cascadeDiv.addAttrName('cascade');
|
|
19
|
+
this.cascadeDiv.addStyleObj({
|
|
20
|
+
height: '100%',
|
|
21
|
+
lineHeight: '32px',
|
|
22
|
+
textAlign: 'center',
|
|
23
|
+
backgroundColor: '#FFF',
|
|
24
|
+
backgroundImage: 'none',
|
|
25
|
+
borderRadius: '4px',
|
|
26
|
+
// border: '1px solid #DCDFE6',
|
|
27
|
+
// -webkit-box-sizing: border-box;
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
color: '#606266',
|
|
30
|
+
display: framework_1.StyleDisplay.inlineBlock,
|
|
31
|
+
outline: '0',
|
|
32
|
+
// -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
|
|
33
|
+
transition: 'border-color .2s cubic-bezier(.645,.045,.355,1)',
|
|
34
|
+
width: 'calc(100% - 100px)',
|
|
35
|
+
});
|
|
36
|
+
// 单独的方法实现
|
|
37
|
+
this.firstStageSelectObj = new td_select_class_1.TdSelect();
|
|
38
|
+
this.firstStageSelectObj.addAttrName('first-stage-select');
|
|
39
|
+
this.firstStageSelectObj.setStyleObj(Object.assign({}, field_item_style_1.itemContentStyle, {
|
|
40
|
+
width: '100%',
|
|
41
|
+
margin: '5px 0'
|
|
42
|
+
// borderRadius: '4px 0 0 4px',
|
|
43
|
+
// borderRight: 'none',
|
|
44
|
+
}));
|
|
45
|
+
this.secondStageSelectObj = new td_select_class_1.TdSelect();
|
|
46
|
+
this.secondStageSelectObj.addAttrName('second-stage-select');
|
|
47
|
+
this.secondStageSelectObj.setStyleObj(Object.assign({}, field_item_style_1.itemContentStyle, {
|
|
48
|
+
width: '100%',
|
|
49
|
+
}));
|
|
50
|
+
this.cascadeDiv.childNodes = [this.firstStageSelectObj, this.secondStageSelectObj];
|
|
51
|
+
this.childNodes = [this.label, this.cascadeDiv, this.button];
|
|
52
|
+
}
|
|
53
|
+
get fieldConfig() {
|
|
54
|
+
var _a;
|
|
55
|
+
const fieldConfigStr = (_a = this.configs) === null || _a === void 0 ? void 0 : _a.fieldConfig;
|
|
56
|
+
if (fieldConfigStr) {
|
|
57
|
+
const configJson = JSON.parse(fieldConfigStr);
|
|
58
|
+
const optionConfig = {
|
|
59
|
+
name: configJson.name,
|
|
60
|
+
resultValue: configJson.resultValue,
|
|
61
|
+
options: []
|
|
62
|
+
};
|
|
63
|
+
if (configJson.options[0].options === undefined) { // 如果只有一级,应该是老数据,要重新组装
|
|
64
|
+
const values = [];
|
|
65
|
+
configJson.options.forEach(opt => {
|
|
66
|
+
if (opt.value.indexOf('.') === -1) {
|
|
67
|
+
// 错误的测试数据,业务数据不会有这个问题。
|
|
68
|
+
throw Error('字段名称不是二级组装的 。 ');
|
|
69
|
+
}
|
|
70
|
+
const tableValue = opt.value.split('.')[0];
|
|
71
|
+
const tableLabel = opt.label.split('.')[0];
|
|
72
|
+
values.push(JSON.stringify({
|
|
73
|
+
label: tableLabel,
|
|
74
|
+
value: tableValue,
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
// todo 如何去重
|
|
78
|
+
const firstStageValues = Array.from(new Set(values));
|
|
79
|
+
firstStageValues.forEach((value) => {
|
|
80
|
+
optionConfig.options.push(Object.assign({}, JSON.parse(value), { options: [] }));
|
|
81
|
+
});
|
|
82
|
+
configJson.options.forEach((opt2) => {
|
|
83
|
+
optionConfig.options.forEach(opt1 => {
|
|
84
|
+
var _a;
|
|
85
|
+
if (String(opt1.value) === String(opt2.value.split('.')[0])) {
|
|
86
|
+
(_a = opt1.options) === null || _a === void 0 ? void 0 : _a.push(opt2);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
// this.fieldConfig = optionConfig;
|
|
91
|
+
return optionConfig;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return configJson;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
set fieldConfig(value) {
|
|
100
|
+
// TypeFormDesigner.webDocument.setAttribute('field-config', JSON.stringify(value));
|
|
101
|
+
if (this.configs === undefined) {
|
|
102
|
+
if (value !== undefined) {
|
|
103
|
+
this.configs = {
|
|
104
|
+
fieldConfig: JSON.stringify(value),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (value === undefined) {
|
|
110
|
+
delete this.configs.fieldConfig;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.configs.fieldConfig = JSON.stringify(value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
resetCascadeConfigResultValue(value) {
|
|
118
|
+
// AppRoot.selectedControl?.propObj.attrObj.optionConfig''
|
|
119
|
+
// this.cascadeConfig = Object.assign(this.cascadeConfig, { resultValue: value });
|
|
120
|
+
if (this.cascadeConfig) {
|
|
121
|
+
this.cascadeConfig.resultValue = value;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// todo vue项目中返回的是选中的项目。只有一层,没有两层。
|
|
125
|
+
resetCascadeConfig(optionConfig) {
|
|
126
|
+
console.log('optionConfig is ', optionConfig);
|
|
127
|
+
// this.cascadeDiv.clearChildNodes();
|
|
128
|
+
// this.cascadeDiv.clearChildDom();
|
|
129
|
+
this.cascadeConfig = optionConfig;
|
|
130
|
+
if (optionConfig.resultValue === 0) { // 如果第1级还没有选择
|
|
131
|
+
this.firstStageSelectObj.resetOptions(optionConfig.options, optionConfig.resultValue);
|
|
132
|
+
// todo 第2级,应该没有可选项。
|
|
133
|
+
this.secondStageSelectObj.resetOptions([], 0);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// todo config.options设置
|
|
137
|
+
if (String(optionConfig.resultValue).indexOf('.') !== -1) {
|
|
138
|
+
const firstStageValue = String(optionConfig.resultValue).split('.')[0];
|
|
139
|
+
this.firstStageSelectObj.resetOptions(optionConfig.options, firstStageValue);
|
|
140
|
+
// const firstStageValue = optionConfig.resultValue.split('.')[0];
|
|
141
|
+
const selectedOption = optionConfig.options.find(opt => opt.value === firstStageValue);
|
|
142
|
+
if (!(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.options)) {
|
|
143
|
+
// throw Error('选项有问题'); // 会阻塞修改单元格的控件类型
|
|
144
|
+
this.secondStageSelectObj.resetOptions([], 0);
|
|
145
|
+
console.error('选项有问题');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.secondStageSelectObj.resetOptions(selectedOption.options, optionConfig.resultValue);
|
|
149
|
+
// this.secondStageSelectObj.setSelectedValue(secondStageValue);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
initEvents() {
|
|
153
|
+
this.events.push((0, rxjs_1.fromEvent)(this.firstStageSelectObj.dom, 'change').subscribe(() => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
console.log('this.firstStageSelectObj.dom change . ');
|
|
156
|
+
console.log('this.firstStageSelectObj.dom.value is ', this.firstStageSelectObj.dom.value);
|
|
157
|
+
const selectedOption = (_b = (_a = this.cascadeConfig) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.find(opt => String(opt.value) === this.firstStageSelectObj.dom.value);
|
|
158
|
+
if (!this.cascadeConfig) {
|
|
159
|
+
throw Error('无法获取cascadeConfig');
|
|
160
|
+
}
|
|
161
|
+
// todo 没有改变值 ?????
|
|
162
|
+
if (selectedOption) {
|
|
163
|
+
this.resetCascadeConfigResultValue(selectedOption.value);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this.secondStageSelectObj.resetOptions([{
|
|
167
|
+
label: '请先选择上级',
|
|
168
|
+
value: 0
|
|
169
|
+
}], 0);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (selectedOption && selectedOption.options) {
|
|
173
|
+
console.log('this.cascadeConfig is ', this.cascadeConfig);
|
|
174
|
+
console.log('selectedOption is ', selectedOption);
|
|
175
|
+
this.secondStageSelectObj.resetOptions(selectedOption.options, 0);
|
|
176
|
+
}
|
|
177
|
+
}), (0, rxjs_1.fromEvent)(this.secondStageSelectObj.dom, 'click').subscribe(() => {
|
|
178
|
+
console.log('this.secondStageSelectObj.dom change . ');
|
|
179
|
+
this.reset(this.secondStageSelectObj.dom.value);
|
|
180
|
+
}), (0, rxjs_1.fromEvent)(this.secondStageSelectObj.dom, 'change').subscribe(() => {
|
|
181
|
+
console.log('this.secondStageSelectObj.dom change . ');
|
|
182
|
+
this.reset(this.secondStageSelectObj.dom.value);
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.PropertyCascade = PropertyCascade;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Division, Input, Label, Span, Textarea, TypeComponent, Button } from '@type-dom/framework';
|
|
2
|
+
import { Select } from '../select/select.class';
|
|
3
|
+
export declare abstract class FieldItem extends TypeComponent {
|
|
4
|
+
abstract className: string;
|
|
5
|
+
abstract childNodes: [Label, ...(Span | Input | Textarea | Select | Division)[], Button];
|
|
6
|
+
label: Label;
|
|
7
|
+
button: Button;
|
|
8
|
+
protected constructor(labelText: string);
|
|
9
|
+
setLabelTitle(text: string): void;
|
|
10
|
+
show(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldItem = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const field_item_style_1 = require("./field-item.style");
|
|
6
|
+
class FieldItem extends framework_1.TypeComponent {
|
|
7
|
+
constructor(labelText) {
|
|
8
|
+
super('div');
|
|
9
|
+
this.propObj.styleObj = {
|
|
10
|
+
// border: '1px solid #1890ff',
|
|
11
|
+
// background: '#f3f9ff',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
padding: '10px 0',
|
|
15
|
+
// marginBottom: '10px!important',
|
|
16
|
+
fontSize: '14px',
|
|
17
|
+
};
|
|
18
|
+
this.label = new framework_1.Label(this);
|
|
19
|
+
this.label.textNode.setText(labelText);
|
|
20
|
+
this.label.childNodes.push(this.label.textNode);
|
|
21
|
+
this.label.addStyleObj(Object.assign({}, field_item_style_1.labelStyle));
|
|
22
|
+
this.button = new framework_1.Button(this);
|
|
23
|
+
this.button.addStyleObj({
|
|
24
|
+
height: '28px',
|
|
25
|
+
background: '#ffffff',
|
|
26
|
+
borderWidth: '1px',
|
|
27
|
+
borderStyle: 'solid',
|
|
28
|
+
borderLeft: 'none',
|
|
29
|
+
borderColor: '#dcdfe6',
|
|
30
|
+
display: 'none',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
setLabelTitle(text) {
|
|
34
|
+
this.label.childNodes[0].nodeValue = text;
|
|
35
|
+
}
|
|
36
|
+
show() {
|
|
37
|
+
this.setStyleObj({
|
|
38
|
+
display: framework_1.StyleDisplay.flex,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.FieldItem = FieldItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | number | boolean;
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
options?: IOption[];
|
|
7
|
+
}
|
|
8
|
+
export interface IOptionConfig {
|
|
9
|
+
name: string;
|
|
10
|
+
resultValue: string | number | boolean;
|
|
11
|
+
options: IOption[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.itemContentStyle = exports.labelStyle = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
exports.labelStyle = {
|
|
6
|
+
width: '80px',
|
|
7
|
+
lineHeight: '28px',
|
|
8
|
+
textAlign: 'right',
|
|
9
|
+
verticalAlign: 'middle',
|
|
10
|
+
float: 'left',
|
|
11
|
+
fontSize: '14px',
|
|
12
|
+
color: '#606266',
|
|
13
|
+
paddingRight: '2px',
|
|
14
|
+
// padding: '0 12px 0 0',
|
|
15
|
+
// '-webkit-box-sizing': 'border-box',
|
|
16
|
+
boxSizing: 'border-box',
|
|
17
|
+
};
|
|
18
|
+
exports.itemContentStyle = {
|
|
19
|
+
height: '28px',
|
|
20
|
+
lineHeight: '28px',
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
backgroundColor: '#FFF',
|
|
23
|
+
backgroundImage: 'none',
|
|
24
|
+
borderRadius: '4px',
|
|
25
|
+
border: '1px solid #DCDFE6',
|
|
26
|
+
// -webkit-box-sizing: border-box;
|
|
27
|
+
boxSizing: 'border-box',
|
|
28
|
+
color: '#606266',
|
|
29
|
+
display: framework_1.StyleDisplay.inlineBlock,
|
|
30
|
+
fontSize: 'inherit',
|
|
31
|
+
outline: '0',
|
|
32
|
+
// padding: '0 5px',
|
|
33
|
+
paddingLeft: '15px',
|
|
34
|
+
paddingRight: '5px',
|
|
35
|
+
margin: '0',
|
|
36
|
+
// -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
|
|
37
|
+
transition: 'border-color .2s cubic-bezier(.645,.045,.355,1)',
|
|
38
|
+
width: 'calc(100% - ' + exports.labelStyle.width + ')',
|
|
39
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TypeHtml, Input, Label, Button } from '@type-dom/framework';
|
|
2
|
+
import { FieldItem } from '../field-item.abstract';
|
|
3
|
+
export declare abstract class FieldInput extends FieldItem {
|
|
4
|
+
mode?: string;
|
|
5
|
+
parent?: TypeHtml;
|
|
6
|
+
abstract reset(value?: string): void;
|
|
7
|
+
childNodes: [Label, Input, Button];
|
|
8
|
+
content: Input;
|
|
9
|
+
protected constructor(labelText?: string, placeholder?: string);
|
|
10
|
+
resetInputPlaceholder(placeholder: string): void;
|
|
11
|
+
resetInputValue(value?: string | number): void;
|
|
12
|
+
initEvents(): void;
|
|
13
|
+
}
|