@type-dom/ui 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -44
- package/package.json +1 -1
- package/src/components/basic/td-button/td-button.abstract.js +3 -3
- package/src/components/basic/td-button/td-button.class.js +1 -1
- package/src/components/basic/td-button-group/td-button-group.class.js +1 -1
- package/src/components/basic/td-container/td-aside/td-aside.class.js +2 -2
- package/src/components/basic/td-container/td-container.class.js +2 -2
- package/src/components/basic/td-container/td-footer/td-footer.class.js +3 -3
- package/src/components/basic/td-container/td-header/td-header.class.js +6 -6
- package/src/components/basic/td-container/td-main/td-main.class.js +2 -2
- package/src/components/basic/td-icon/td-icon.class.js +13 -13
- package/src/components/basic/td-layout/td-col/td-col.class.js +4 -4
- package/src/components/basic/td-layout/td-row/td-row.class.js +2 -2
- package/src/components/basic/td-link/td-link.class.js +1 -1
- package/src/components/basic/td-scrollbar/bar/bar.class.js +2 -2
- package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +1 -1
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +2 -2
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +2 -2
- package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +1 -1
- package/src/components/basic/td-space/td-space.class.js +2 -2
- package/src/components/basic/td-text/td-text.class.js +2 -2
- package/src/components/data/td-avatar/td-avatar.class.js +3 -3
- package/src/components/data/td-badge/td-badge.class.d.ts +1 -0
- package/src/components/data/td-badge/td-badge.class.js +10 -7
- package/src/components/data/td-card/td-card.class.js +2 -2
- package/src/components/data/td-check-tag/td-check-tag.class.js +2 -2
- package/src/components/data/td-collapse/td-collapse.class.js +2 -5
- package/src/components/data/td-collapse/td-collapse.interface.d.ts +1 -0
- package/src/components/data/td-collapse-item/td-collapse-item.class.js +3 -3
- package/src/components/data/td-collapse-transition/td-collapse-transition.class.js +1 -1
- package/src/components/data/td-count-down/td-count-down.class.js +2 -4
- package/src/components/data/td-descriptions/td-descriptions-row.d.ts +1 -1
- package/src/components/data/td-descriptions/td-descriptions-row.js +3 -3
- package/src/components/data/td-descriptions/td-descriptions.class.js +2 -2
- package/src/components/data/td-descriptions/td-descritions-cell.js +2 -2
- package/src/components/data/td-descriptions-item/td-descriptions-item.class.js +3 -5
- package/src/components/data/td-empty/img-empty.class.js +2 -2
- package/src/components/data/td-empty/td-empty.class.js +2 -2
- package/src/components/data/td-image/td-image.class.js +3 -3
- package/src/components/data/td-image-viewer/td-image-viewer.class.js +3 -2
- package/src/components/data/td-result/td-result.class.js +5 -9
- package/src/components/data/td-segmented/td-segmented.class.js +14 -15
- package/src/components/data/td-statistic/td-statistic.abstract.d.ts +1 -1
- package/src/components/data/td-statistic/td-statistic.abstract.js +2 -2
- package/src/components/data/td-tag/td-tag.class.js +3 -3
- package/src/components/feedback/dialog/dialog.class.js +2 -2
- package/src/components/feedback/message-box/message-box.js +2 -2
- package/src/components/feedback/overlay/container/container.js +5 -4
- package/src/components/feedback/overlay/container/footer/cancel-button/cancel-button.js +6 -5
- package/src/components/feedback/overlay/container/footer/confirm-button/confirm-button.js +6 -5
- package/src/components/feedback/overlay/container/header/close-button/close-button.js +6 -5
- package/src/components/feedback/overlay/overlay.abstract.js +5 -4
- package/src/components/feedback/td-alert/td-alert.class.js +2 -2
- package/src/components/feedback/td-dialog/td-dialog.class.d.ts +3 -0
- package/src/components/feedback/td-dialog/td-dialog.class.js +20 -3
- package/src/components/feedback/td-dialog/td-dialog.interface.d.ts +19 -0
- package/src/components/feedback/td-dialog/td-dialog.interface.js +12 -0
- package/src/components/feedback/td-dialog-content/td-dialog-content.class.js +2 -2
- package/src/components/feedback/td-drawer/td-drawer.class.js +13 -11
- package/src/components/feedback/td-drawer/td-drawer.interface.d.ts +5 -5
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +2 -2
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +5 -5
- package/src/components/feedback/td-focus-trap/utils.d.ts +1 -1
- package/src/components/feedback/td-loading/td-loading.class.js +2 -2
- package/src/components/feedback/td-message/td-message.class.d.ts +1 -0
- package/src/components/feedback/td-message/td-message.class.js +19 -12
- package/src/components/feedback/td-message-box/td-message-box.class.js +3 -4
- package/src/components/feedback/td-notification/td-notification.class.js +4 -4
- package/src/components/feedback/td-overlay/td-overlay.class.js +2 -2
- package/src/components/feedback/td-popper/arrow/arrow.class.js +2 -2
- package/src/components/feedback/td-popper/content/content.class.js +2 -2
- package/src/components/feedback/td-popper/td-popper.class.js +2 -2
- package/src/components/feedback/td-popper/trigger/trigger.class.js +2 -2
- package/src/components/feedback/td-tooltip/content/content.class.js +2 -2
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +2 -2
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +2 -2
- package/src/components/form/checkbox-group/checkbox-option/checkbox-option.class.js +19 -18
- package/src/components/form/field-item/cascade/field-cascade.abstract.js +40 -35
- package/src/components/form/field-item/input/field-input.abstract.js +7 -6
- package/src/components/form/field-item/options/field-options.abstract.js +19 -18
- package/src/components/form/field-item/radio/field-radio.abstract.js +2 -3
- package/src/components/form/field-item/select/field-select.abstract.js +14 -14
- package/src/components/form/field-select/field-select.class.js +16 -16
- package/src/components/form/radio-group/radio-group.class.js +2 -2
- package/src/components/form/radio-group/radio-group.interface.d.ts +2 -2
- package/src/components/form/radio-group/radio-option/radio-option.class.js +10 -9
- package/src/components/form/select/select.class.js +17 -16
- package/src/components/form/td-checkbox/td-checkbox.class.js +2 -2
- package/src/components/form/td-checkbox/td-checkbox.style.js +2 -2
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +2 -2
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +2 -2
- package/src/components/form/td-form/td-form.class.js +2 -2
- package/src/components/form/td-form-item/td-form-item.class.js +2 -2
- package/src/components/form/td-input/td-input.class.js +2 -2
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +2 -2
- package/src/components/form/td-input/widget/td-textarea-wrapper.js +2 -2
- package/src/components/form/td-input/widget/utils.js +8 -8
- package/src/components/form/td-option/td-option.class.js +2 -2
- package/src/components/form/td-option/td-option.interface.d.ts +1 -1
- package/src/components/form/td-option-group/td-option-group.class.js +2 -2
- package/src/components/form/td-radio/td-radio.class.js +2 -3
- package/src/components/form/td-radio-button/td-radio-button.class.js +2 -3
- package/src/components/form/td-radio-group/td-radio-group.class.js +2 -2
- 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.js +8 -9
- package/src/components/form/td-switch/widget/td-switch-core.js +2 -2
- package/src/components/form/td-switch/widget/td-switch-left.js +2 -2
- package/src/components/form/td-switch/widget/td-switch-right.js +2 -2
- package/src/components/navigation/td-affix/td-affix.class.js +2 -2
- package/src/components/navigation/td-anchor/td-anchor-link/td-anchor-link.class.js +2 -2
- package/src/components/navigation/td-anchor/td-anchor.class.d.ts +1 -1
- package/src/components/navigation/td-anchor/td-anchor.class.js +2 -2
- package/src/components/navigation/td-backtop/td-backtop.class.js +5 -6
- package/src/components/navigation/td-breadcrumb/td-breadcrumb.class.js +3 -5
- package/src/components/navigation/td-breadcrumb-item/td-breadcrumb-item.class.js +2 -2
- package/src/components/navigation/td-menu/td-menu.class.js +2 -2
- package/src/components/navigation/td-tabs/td-tab-bar.class.d.ts +1 -1
- package/src/components/navigation/td-tabs/td-tab-bar.class.js +7 -7
- package/src/components/navigation/td-tabs/td-tab-bar.interface.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tab-nav.class.d.ts +2 -2
- package/src/components/navigation/td-tabs/td-tab-nav.class.js +13 -13
- package/src/components/navigation/td-tabs/td-tab-nav.interface.d.ts +1 -1
- package/src/components/navigation/td-tabs/td-tab-pane.class.js +2 -2
- package/src/components/navigation/td-tabs/td-tabs.class.js +20 -23
- package/src/components/others/collapsible-box/heading/expand-heading.js +24 -23
- package/src/components/others/custom-block/custom-block.d.ts +11 -0
- package/src/components/others/custom-block/custom-block.js +58 -0
- package/src/components/others/example/example-float-control.d.ts +8 -0
- package/src/components/others/example/example-float-control.js +63 -0
- package/src/components/others/example/example-showcase.d.ts +7 -0
- package/src/components/others/example/example-showcase.js +20 -0
- package/src/components/others/example/example-source-wrapper.d.ts +5 -0
- package/src/components/others/example/example-source-wrapper.js +30 -0
- package/src/components/others/example/example.d.ts +15 -0
- package/src/components/others/example/example.js +77 -0
- package/src/components/others/example/index.d.ts +5 -0
- package/src/components/others/example/index.js +13 -0
- package/src/components/others/example/op-btns.d.ts +7 -0
- package/src/components/others/example/op-btns.js +96 -0
- package/src/components/others/index.d.ts +4 -0
- package/src/components/others/index.js +9 -1
- package/src/components/others/menus/menu.d.ts +16 -0
- package/src/components/others/menus/menu.js +123 -0
- package/src/components/others/menus/menus.d.ts +10 -0
- package/src/components/others/menus/menus.js +79 -0
- package/src/components/others/td-divider/td-divider.class.js +2 -2
- package/src/ui/ui.abstract.js +1 -1
- package/src/ui/ui.interface.d.ts +3 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomBlock = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const var_1 = require("../../../styles/var");
|
|
6
|
+
class CustomBlock extends framework_1.TypeDiv {
|
|
7
|
+
constructor(params) {
|
|
8
|
+
super();
|
|
9
|
+
this.className = 'CustomBlock';
|
|
10
|
+
this.ctrl.addAttrName('tip');
|
|
11
|
+
const bgColor = params.type === 'warning' ? var_1.$colorDangerRgb : var_1.$colorPrimaryRgb;
|
|
12
|
+
const borderLeftColor = params.type === 'warning' ? var_1.$colors.danger.base : var_1.$colors.primary.base;
|
|
13
|
+
this.ctrl.addStyleObj({
|
|
14
|
+
padding: '8px 16px',
|
|
15
|
+
// background-color: var(--block-tip-bg-color),
|
|
16
|
+
backgroundColor: 'rgba(' + bgColor + ', 0.1)',
|
|
17
|
+
borderRadius: '4px',
|
|
18
|
+
// border-left: 5px solid var(--el-color-primary),
|
|
19
|
+
borderLeft: '5px solid ' + borderLeftColor,
|
|
20
|
+
margin: '20px 0'
|
|
21
|
+
});
|
|
22
|
+
if (params.title) {
|
|
23
|
+
this.addChild(new framework_1.P({
|
|
24
|
+
text: params.title,
|
|
25
|
+
styleObj: {
|
|
26
|
+
fontSize: '1.1rem',
|
|
27
|
+
fontWeight: 700,
|
|
28
|
+
marginTop: '0'
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
if (params.paragraphs) {
|
|
33
|
+
params.paragraphs.forEach((paragraph) => {
|
|
34
|
+
this.addChild(new framework_1.P({
|
|
35
|
+
styleObj: {
|
|
36
|
+
fontSize: '0.9rem'
|
|
37
|
+
},
|
|
38
|
+
childNodes: [paragraph]
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (params.blockquote) {
|
|
43
|
+
this.addChild(new framework_1.BlockQuote({
|
|
44
|
+
styleObj: {
|
|
45
|
+
margin: '1rem 0',
|
|
46
|
+
// border-left: .2rem solid var(--el-border-color),
|
|
47
|
+
borderLeft: '.2rem solid ' + var_1.$borderColor.base,
|
|
48
|
+
padding: '.25rem 0 .25rem 1rem',
|
|
49
|
+
fontSize: '1rem',
|
|
50
|
+
// color: var(--text-color-lighter),
|
|
51
|
+
color: var_1.$textColor.secondary
|
|
52
|
+
},
|
|
53
|
+
childNodes: [params.blockquote]
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.CustomBlock = CustomBlock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITypeConfig, TypeDiv } from '@type-dom/framework';
|
|
2
|
+
import { Example } from './example';
|
|
3
|
+
export declare class ExampleFloatControl extends TypeDiv {
|
|
4
|
+
className: 'ExampleFloatControl';
|
|
5
|
+
parent: Example;
|
|
6
|
+
constructor(params: ITypeConfig);
|
|
7
|
+
initEvents(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExampleFloatControl = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const var_1 = require("../../../styles/var");
|
|
6
|
+
const svgs_1 = require("@type-dom/svgs");
|
|
7
|
+
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
8
|
+
class ExampleFloatControl extends framework_1.TypeDiv {
|
|
9
|
+
constructor(params) {
|
|
10
|
+
super();
|
|
11
|
+
this.className = 'ExampleFloatControl';
|
|
12
|
+
this.ctrl.addAttrName('example-float-control');
|
|
13
|
+
this.ctrl.addAttrObj({
|
|
14
|
+
role: 'button',
|
|
15
|
+
tabIndex: 0
|
|
16
|
+
});
|
|
17
|
+
this.ctrl.addStyleObj({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
// border-top: 1px solid var(--border-color),
|
|
22
|
+
borderTop: '1px solid ' + var_1.$borderColor.base,
|
|
23
|
+
height: '44px',
|
|
24
|
+
boxSizing: 'border-box',
|
|
25
|
+
// background-color: var(--bg-color, #fff),
|
|
26
|
+
backgroundColor: var_1.$bgColor.default,
|
|
27
|
+
borderBottomLeftRadius: '4px',
|
|
28
|
+
borderBottomRightRadius: '4px',
|
|
29
|
+
marginTop: '-1px',
|
|
30
|
+
// color: var(--el-text-color-secondary),
|
|
31
|
+
color: var_1.$textColor.secondary,
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
position: 'sticky',
|
|
34
|
+
left: '0',
|
|
35
|
+
right: '0',
|
|
36
|
+
bottom: '0',
|
|
37
|
+
zIndex: 10
|
|
38
|
+
});
|
|
39
|
+
this.addChildren(new td_icon_class_1.TdIcon({
|
|
40
|
+
svgObj: new svgs_1.ElCaretTopSvg(),
|
|
41
|
+
styleObj: {
|
|
42
|
+
fontSize: '16px'
|
|
43
|
+
}
|
|
44
|
+
}), new framework_1.Span({
|
|
45
|
+
text: '隐藏源代码',
|
|
46
|
+
styleObj: {
|
|
47
|
+
fontSize: '14px',
|
|
48
|
+
marginLeft: '10px'
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
this.setProps(params);
|
|
52
|
+
}
|
|
53
|
+
initEvents() {
|
|
54
|
+
this.addEvents({
|
|
55
|
+
click: () => {
|
|
56
|
+
// 隐藏 代码
|
|
57
|
+
this.ctrl.hide();
|
|
58
|
+
this.parent.sourceWrapper.ctrl.hide();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ExampleFloatControl = ExampleFloatControl;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExampleShowcase = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const var_1 = require("../../../styles/var");
|
|
6
|
+
class ExampleShowcase extends framework_1.TypeDiv {
|
|
7
|
+
constructor(params) {
|
|
8
|
+
super();
|
|
9
|
+
this.className = 'ExampleShowcase';
|
|
10
|
+
this.ctrl.addAttrName('example-showcase');
|
|
11
|
+
this.ctrl.addStyleObj({
|
|
12
|
+
padding: '1.5rem',
|
|
13
|
+
margin: '.5px',
|
|
14
|
+
// background-color: var(--bg-color),
|
|
15
|
+
backgroundColor: var_1.$bgColor.default
|
|
16
|
+
});
|
|
17
|
+
this.setProps(params);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ExampleShowcase = ExampleShowcase;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExampleSourceWrapper = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const styles_1 = require("../../../styles");
|
|
6
|
+
class ExampleSourceWrapper extends framework_1.TypeDiv {
|
|
7
|
+
constructor(params) {
|
|
8
|
+
var _a;
|
|
9
|
+
super();
|
|
10
|
+
this.className = 'ExampleSourceWrapper';
|
|
11
|
+
this.ctrl.addAttrName('example-source-wrapper');
|
|
12
|
+
this.ctrl.addStyleObj({
|
|
13
|
+
// background-color: var(--code-bg-color),
|
|
14
|
+
backgroundColor: styles_1.$fillColor.light,
|
|
15
|
+
overflowX: 'auto'
|
|
16
|
+
});
|
|
17
|
+
this.addChild(new framework_1.Pre({
|
|
18
|
+
childNodes: [
|
|
19
|
+
new framework_1.Code({
|
|
20
|
+
text: (_a = params.sourceWrapper) !== null && _a !== void 0 ? _a : ''
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
}));
|
|
24
|
+
// if (params?.slot) {
|
|
25
|
+
// this.slotChild(params.slot);
|
|
26
|
+
// }
|
|
27
|
+
this.setProps(params);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ExampleSourceWrapper = ExampleSourceWrapper;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IJsonData, ITypeConfig, TypeDiv, TypeElement, XProxy } from '@type-dom/framework';
|
|
2
|
+
import { ExampleSourceWrapper } from './example-source-wrapper';
|
|
3
|
+
import { ExampleFloatControl } from './example-float-control';
|
|
4
|
+
interface IExampleConfig extends ITypeConfig {
|
|
5
|
+
showcase: TypeElement[];
|
|
6
|
+
sourceWrapper: string | XProxy<IJsonData>;
|
|
7
|
+
}
|
|
8
|
+
export declare class Example extends TypeDiv {
|
|
9
|
+
className: 'Example';
|
|
10
|
+
sourceWrapper: ExampleSourceWrapper;
|
|
11
|
+
floatControl: ExampleFloatControl;
|
|
12
|
+
props: IExampleConfig;
|
|
13
|
+
constructor(params: IExampleConfig);
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Example = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const var_1 = require("../../../styles/var");
|
|
6
|
+
const example_showcase_1 = require("./example-showcase");
|
|
7
|
+
const example_source_wrapper_1 = require("./example-source-wrapper");
|
|
8
|
+
const op_btns_1 = require("./op-btns");
|
|
9
|
+
const example_float_control_1 = require("./example-float-control");
|
|
10
|
+
const td_divider_class_1 = require("../td-divider/td-divider.class");
|
|
11
|
+
// todo slots 改造
|
|
12
|
+
class Example extends framework_1.TypeDiv {
|
|
13
|
+
constructor(params) {
|
|
14
|
+
super();
|
|
15
|
+
this.className = 'Example';
|
|
16
|
+
this.ctrl.addAttrName('example');
|
|
17
|
+
this.ctrl.addStyleObj({
|
|
18
|
+
// border: '1px solid 'var(--border-color),
|
|
19
|
+
border: '1px solid ' + var_1.$borderColor.base,
|
|
20
|
+
// border-radius: var(--el-border-radius-base);
|
|
21
|
+
borderRadius: var_1.$borderRadius.base
|
|
22
|
+
});
|
|
23
|
+
const exampleShowcase = new example_showcase_1.ExampleShowcase({
|
|
24
|
+
parent: this
|
|
25
|
+
});
|
|
26
|
+
exampleShowcase.addChildren(...params.showcase);
|
|
27
|
+
this.addChild(exampleShowcase);
|
|
28
|
+
this.addChild(new td_divider_class_1.TdDivider({
|
|
29
|
+
styleObj: {
|
|
30
|
+
margin: '0'
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
const opBtns = new op_btns_1.OpBtns({
|
|
34
|
+
parent: this
|
|
35
|
+
});
|
|
36
|
+
this.addChild(opBtns);
|
|
37
|
+
this.sourceWrapper = new example_source_wrapper_1.ExampleSourceWrapper({
|
|
38
|
+
parent: this,
|
|
39
|
+
styleObj: {
|
|
40
|
+
display: 'none'
|
|
41
|
+
},
|
|
42
|
+
sourceWrapper: params.sourceWrapper,
|
|
43
|
+
// slot: [
|
|
44
|
+
// new Div({
|
|
45
|
+
// attrObj: {
|
|
46
|
+
// name: 'source-wrapper'
|
|
47
|
+
// },
|
|
48
|
+
// styleObj: {
|
|
49
|
+
// // background-color: var(--code-bg-color),
|
|
50
|
+
// backgroundColor: $fillColor.light,
|
|
51
|
+
// overflowX: 'auto'
|
|
52
|
+
// },
|
|
53
|
+
// childNodes: [
|
|
54
|
+
// new Pre({
|
|
55
|
+
// childNodes: [
|
|
56
|
+
// new Code({
|
|
57
|
+
// text: params.sourceWrapper
|
|
58
|
+
// })
|
|
59
|
+
// ]
|
|
60
|
+
// })
|
|
61
|
+
// ]
|
|
62
|
+
// })
|
|
63
|
+
// ]
|
|
64
|
+
});
|
|
65
|
+
// this.sourceWrapper.addChild(config.sourceWrapper);
|
|
66
|
+
this.addChild(this.sourceWrapper);
|
|
67
|
+
this.floatControl = new example_float_control_1.ExampleFloatControl({
|
|
68
|
+
parent: this,
|
|
69
|
+
styleObj: {
|
|
70
|
+
display: 'none'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.addChild(this.floatControl);
|
|
74
|
+
this.props = this.setProps(params);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.Example = Example;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpBtns = exports.ExampleSourceWrapper = exports.ExampleShowcase = exports.ExampleFloatControl = exports.Example = void 0;
|
|
4
|
+
var example_1 = require("./example");
|
|
5
|
+
Object.defineProperty(exports, "Example", { enumerable: true, get: function () { return example_1.Example; } });
|
|
6
|
+
var example_float_control_1 = require("./example-float-control");
|
|
7
|
+
Object.defineProperty(exports, "ExampleFloatControl", { enumerable: true, get: function () { return example_float_control_1.ExampleFloatControl; } });
|
|
8
|
+
var example_showcase_1 = require("./example-showcase");
|
|
9
|
+
Object.defineProperty(exports, "ExampleShowcase", { enumerable: true, get: function () { return example_showcase_1.ExampleShowcase; } });
|
|
10
|
+
var example_source_wrapper_1 = require("./example-source-wrapper");
|
|
11
|
+
Object.defineProperty(exports, "ExampleSourceWrapper", { enumerable: true, get: function () { return example_source_wrapper_1.ExampleSourceWrapper; } });
|
|
12
|
+
var op_btns_1 = require("./op-btns");
|
|
13
|
+
Object.defineProperty(exports, "OpBtns", { enumerable: true, get: function () { return op_btns_1.OpBtns; } });
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpBtns = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
const var_1 = require("../../../styles/var");
|
|
7
|
+
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
8
|
+
const svgs_1 = require("@type-dom/svgs");
|
|
9
|
+
class OpBtns extends framework_1.TypeDiv {
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super();
|
|
12
|
+
this.className = 'OpBtns';
|
|
13
|
+
this.parent = params.parent;
|
|
14
|
+
this.ctrl.addAttrName('op-btns');
|
|
15
|
+
this.ctrl.addStyleObj({
|
|
16
|
+
padding: '.5rem',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'flex-end',
|
|
20
|
+
height: '2.5rem',
|
|
21
|
+
boxSizing: 'border-box'
|
|
22
|
+
});
|
|
23
|
+
this.addChild(new td_icon_class_1.TdIcon({
|
|
24
|
+
styleObj: {
|
|
25
|
+
height: '1em',
|
|
26
|
+
width: '1em',
|
|
27
|
+
lineHeight: '1em',
|
|
28
|
+
display: 'inline-flex',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
color: var_1.$textColor.secondary
|
|
31
|
+
},
|
|
32
|
+
svgObj: new svgs_1.ElCopyDocumentSvg(),
|
|
33
|
+
events: {
|
|
34
|
+
click: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
// 选取要复制的文本
|
|
37
|
+
let textToCopy = '';
|
|
38
|
+
if (this.parent.props.sourceWrapper instanceof framework_1.XProxy) {
|
|
39
|
+
textToCopy = (_a = this.parent.props.sourceWrapper) === null || _a === void 0 ? void 0 : _a.value;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
textToCopy = (_b = this.parent.props.sourceWrapper) !== null && _b !== void 0 ? _b : '';
|
|
43
|
+
}
|
|
44
|
+
// 尝试使用Async Clipboard API
|
|
45
|
+
try {
|
|
46
|
+
yield navigator.clipboard.writeText(textToCopy);
|
|
47
|
+
alert('文本已复制到剪贴板!');
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.error('无法复制文本: ', err);
|
|
51
|
+
alert('复制失败,请手动复制。');
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
this.addChild(new td_icon_class_1.TdIcon({
|
|
57
|
+
// text: '查看代码',
|
|
58
|
+
styleObj: {
|
|
59
|
+
height: '1em',
|
|
60
|
+
width: '1em',
|
|
61
|
+
lineHeight: '1em',
|
|
62
|
+
display: 'inline-flex',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
position: 'relative',
|
|
66
|
+
fill: 'currentColor',
|
|
67
|
+
// color: var(--color),
|
|
68
|
+
fontSize: '16px',
|
|
69
|
+
background: 'none',
|
|
70
|
+
border: 'none',
|
|
71
|
+
padding: '0',
|
|
72
|
+
cursor: 'pointer',
|
|
73
|
+
margin: '0 .5rem',
|
|
74
|
+
// color: var(--text-color-lighter),
|
|
75
|
+
color: var_1.$textColor.secondary,
|
|
76
|
+
transition: '.2s'
|
|
77
|
+
},
|
|
78
|
+
svgObj: new svgs_1.TdViewCodeSvg(),
|
|
79
|
+
events: {
|
|
80
|
+
click: () => {
|
|
81
|
+
var _a;
|
|
82
|
+
if (((_a = this.parent.sourceWrapper.props.styleObj) === null || _a === void 0 ? void 0 : _a.display) === 'none') {
|
|
83
|
+
this.parent.sourceWrapper.ctrl.show();
|
|
84
|
+
this.parent.floatControl.ctrl.show('flex');
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.parent.sourceWrapper.ctrl.hide();
|
|
88
|
+
this.parent.floatControl.ctrl.hide();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
this.setProps(params);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.OpBtns = OpBtns;
|
|
@@ -3,3 +3,7 @@ export { ExpandHeading } from './collapsible-box/heading/expand-heading';
|
|
|
3
3
|
export { CollapsibleBoxContents } from './collapsible-box/contents/contents';
|
|
4
4
|
export { TdDivider } from './td-divider/td-divider.class';
|
|
5
5
|
export type { ITdDivider, ITdDividerConfig } from './td-divider/td-divider.interface';
|
|
6
|
+
export * from './example';
|
|
7
|
+
export { Menus } from './menus/menus';
|
|
8
|
+
export { Menu } from './menus/menu';
|
|
9
|
+
export { CustomBlock } from './custom-block/custom-block';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TdDivider = exports.CollapsibleBoxContents = exports.ExpandHeading = exports.CollapsibleBox = void 0;
|
|
3
|
+
exports.CustomBlock = exports.Menu = exports.Menus = exports.TdDivider = exports.CollapsibleBoxContents = exports.ExpandHeading = exports.CollapsibleBox = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
var collapsible_box_1 = require("./collapsible-box/collapsible-box");
|
|
5
6
|
Object.defineProperty(exports, "CollapsibleBox", { enumerable: true, get: function () { return collapsible_box_1.CollapsibleBox; } });
|
|
6
7
|
var expand_heading_1 = require("./collapsible-box/heading/expand-heading");
|
|
@@ -9,3 +10,10 @@ var contents_1 = require("./collapsible-box/contents/contents");
|
|
|
9
10
|
Object.defineProperty(exports, "CollapsibleBoxContents", { enumerable: true, get: function () { return contents_1.CollapsibleBoxContents; } });
|
|
10
11
|
var td_divider_class_1 = require("./td-divider/td-divider.class");
|
|
11
12
|
Object.defineProperty(exports, "TdDivider", { enumerable: true, get: function () { return td_divider_class_1.TdDivider; } });
|
|
13
|
+
tslib_1.__exportStar(require("./example"), exports);
|
|
14
|
+
var menus_1 = require("./menus/menus");
|
|
15
|
+
Object.defineProperty(exports, "Menus", { enumerable: true, get: function () { return menus_1.Menus; } });
|
|
16
|
+
var menu_1 = require("./menus/menu");
|
|
17
|
+
Object.defineProperty(exports, "Menu", { enumerable: true, get: function () { return menu_1.Menu; } });
|
|
18
|
+
var custom_block_1 = require("./custom-block/custom-block");
|
|
19
|
+
Object.defineProperty(exports, "CustomBlock", { enumerable: true, get: function () { return custom_block_1.CustomBlock; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Div, TypeMenu, type IRoute, Router } from '@type-dom/framework';
|
|
2
|
+
import { TdIcon } from '../../basic/td-icon/td-icon.class';
|
|
3
|
+
import { Menus } from './menus';
|
|
4
|
+
export declare class Menu extends TypeMenu {
|
|
5
|
+
className: 'Menu';
|
|
6
|
+
route: IRoute;
|
|
7
|
+
router: Router;
|
|
8
|
+
parent?: Menu | Menus;
|
|
9
|
+
contentItem: Div;
|
|
10
|
+
menuItems: Menu[];
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
caret?: TdIcon;
|
|
13
|
+
constructor(route: IRoute, router: Router);
|
|
14
|
+
get menuRoot(): Menus | undefined;
|
|
15
|
+
initEvents(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Menu = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
const svgs_1 = require("@type-dom/svgs");
|
|
7
|
+
const td_icon_class_1 = require("../../basic/td-icon/td-icon.class");
|
|
8
|
+
class Menu extends framework_1.TypeMenu {
|
|
9
|
+
constructor(route, router) {
|
|
10
|
+
super();
|
|
11
|
+
this.className = 'Menu';
|
|
12
|
+
this.route = route;
|
|
13
|
+
this.router = router;
|
|
14
|
+
this.ctrl.addStyleObj({
|
|
15
|
+
paddingInlineStart: '20px'
|
|
16
|
+
// display: 'flex',
|
|
17
|
+
// flexDirection: 'column',
|
|
18
|
+
});
|
|
19
|
+
const div = new framework_1.Div({
|
|
20
|
+
parent: this,
|
|
21
|
+
styleObj: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
alignItems: 'center'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (route.svgObj) {
|
|
27
|
+
div.addChild(new td_icon_class_1.TdIcon({
|
|
28
|
+
svgObj: route.svgObj,
|
|
29
|
+
styleObj: {
|
|
30
|
+
paddingRight: '5px'
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
div.addChild(new framework_1.Div({
|
|
35
|
+
text: route.name,
|
|
36
|
+
attrObj: {
|
|
37
|
+
name: 'route-name'
|
|
38
|
+
},
|
|
39
|
+
styleObj: {
|
|
40
|
+
width: '160px'
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
if (route.children) {
|
|
44
|
+
const caret = new td_icon_class_1.TdIcon({
|
|
45
|
+
svgObj: new svgs_1.ElCaretBottomSvg(),
|
|
46
|
+
size: '30px'
|
|
47
|
+
});
|
|
48
|
+
caret.appendParent(div);
|
|
49
|
+
this.caret = caret;
|
|
50
|
+
}
|
|
51
|
+
div.appendParent(this);
|
|
52
|
+
this.contentItem = div;
|
|
53
|
+
this.menuItems = [];
|
|
54
|
+
}
|
|
55
|
+
get menuRoot() {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = this.parent) === null || _a === void 0 ? void 0 : _a.menuRoot;
|
|
58
|
+
}
|
|
59
|
+
initEvents() {
|
|
60
|
+
if (this.route.redirect === undefined) {
|
|
61
|
+
// todo addEvent 如何pipe ??
|
|
62
|
+
(0, rxjs_1.fromEvent)(this.contentItem.dom, 'click')
|
|
63
|
+
.pipe((0, rxjs_1.filter)(() => {
|
|
64
|
+
var _a;
|
|
65
|
+
return ((_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.selectedMenu) !== this;
|
|
66
|
+
}))
|
|
67
|
+
.subscribe((event) => {
|
|
68
|
+
var _a;
|
|
69
|
+
// if (this.menuRoot.selectedMenu === this) {
|
|
70
|
+
// return;
|
|
71
|
+
// }
|
|
72
|
+
this.router.push(this.route.path);
|
|
73
|
+
(_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.setSelectedMenu(this);
|
|
74
|
+
document.title = 'UI - ' + this.route.name;
|
|
75
|
+
event.stopPropagation(); // 防止冒泡
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// todo 添加展开、收起的监听
|
|
81
|
+
const leftSvg = new svgs_1.ElCaretLeftSvg();
|
|
82
|
+
// console.log(' leftSvg.resetSize ');
|
|
83
|
+
// leftSvg.resetSize('1.5em', '1.5em');
|
|
84
|
+
// leftSvg.ctrl.setStyleObj({
|
|
85
|
+
// width: '1.5em',
|
|
86
|
+
// height: '1.5em'
|
|
87
|
+
// })
|
|
88
|
+
const bottomSvg = new svgs_1.ElCaretBottomSvg();
|
|
89
|
+
// bottomSvg.ctrl.setStyleObj({
|
|
90
|
+
// width: '1.5em',
|
|
91
|
+
// height: '1.5em'
|
|
92
|
+
// })
|
|
93
|
+
// bottomSvg.resetSize('1.5em', '1.5em');
|
|
94
|
+
this.addEvent('click', this.contentItem.dom, (event) => {
|
|
95
|
+
var _a, _b, _c;
|
|
96
|
+
if (((_a = this.menuRoot) === null || _a === void 0 ? void 0 : _a.selectedMenu) === this) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (this.collapsed === undefined || this.collapsed === false) {
|
|
100
|
+
this.collapsed = true;
|
|
101
|
+
this.menuItems.forEach((menu) => {
|
|
102
|
+
menu.ctrl.setStyleObj({
|
|
103
|
+
display: 'none'
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
(_b = this.caret) === null || _b === void 0 ? void 0 : _b.replaceSvg(leftSvg); // 左三角
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this.collapsed = false;
|
|
110
|
+
this.menuItems.forEach((menu) => {
|
|
111
|
+
menu.ctrl.setStyleObj({
|
|
112
|
+
display: 'block'
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
(_c = this.caret) === null || _c === void 0 ? void 0 : _c.replaceSvg(bottomSvg); // 向下三角
|
|
116
|
+
}
|
|
117
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation(); // 防止冒泡
|
|
118
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.Menu = Menu;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IRoute, ITypeConfig, Router, TypeDiv } from '@type-dom/framework';
|
|
2
|
+
import { Menu } from './menu';
|
|
3
|
+
export declare class Menus extends TypeDiv {
|
|
4
|
+
className: 'Menus';
|
|
5
|
+
selectedMenu?: Menu;
|
|
6
|
+
constructor(params?: ITypeConfig);
|
|
7
|
+
get menuRoot(): Menus;
|
|
8
|
+
createMenus(parent: Menus | Menu, routes: IRoute[], router: Router): void;
|
|
9
|
+
setSelectedMenu(menu: Menu): void;
|
|
10
|
+
}
|