feat: 支持 PanelDock 的 disable / enable 方法, 可用于初始化前后的开闭操作

fix(designer settings style): 修复settings样式
This commit is contained in:
力皓 2021-01-08 12:37:01 +08:00
parent 83f61ee46e
commit 60b12a4e8b
5 changed files with 69 additions and 38 deletions

View File

@ -3,6 +3,10 @@
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
ul {
margin: 0;
}
.lc-settings-content { .lc-settings-content {
position: absolute; position: absolute;
top: 0; top: 0;
@ -34,7 +38,7 @@
position: absolute; position: absolute;
left: 8px; left: 8px;
top: 8px; top: 8px;
color: #8F9BB3; color: #8f9bb3;
cursor: pointer; cursor: pointer;
} }
} }

View File

@ -73,6 +73,7 @@ export class PanelDockView extends Component<DockProps & { dock: PanelDock }> {
...props, ...props,
className: classNames(className, { className: classNames(className, {
actived: dock.actived, actived: dock.actived,
disabled: dock.disabled,
}), }),
onClick: () => { onClick: () => {
onClick && onClick(); onClick && onClick();

View File

@ -1,4 +1,4 @@
@import "./theme.less"; @import './theme.less';
:root { :root {
--font-family: @font-family; --font-family: @font-family;
@ -38,14 +38,13 @@ body {
font-family: var(--font-family); font-family: var(--font-family);
font-size: var(--font-size-text); font-size: var(--font-size-text);
color: var(--color-text); color: var(--color-text);
background-color:#EDEFF3; background-color: #edeff3;
} }
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
.lc-titled-panel { .lc-titled-panel {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -71,7 +70,7 @@ body {
font-size: 16px; font-size: 16px;
padding: 0 15px; padding: 0 15px;
// border-bottom: 1px solid var(--color-line-normal,rgba(31,56,88,.1)); // border-bottom: 1px solid var(--color-line-normal,rgba(31,56,88,.1));
color: #0F1726; color: #0f1726;
font-weight: bold; font-weight: bold;
} }
@ -117,7 +116,7 @@ body {
*/ */
} }
.lc-outline-pane { .lc-outline-pane {
border-top: 1px solid var(--color-line-normal,rgba(31,56,88,.1)); border-top: 1px solid var(--color-line-normal, rgba(31, 56, 88, 0.1));
} }
} }
.lc-panel { .lc-panel {
@ -129,12 +128,11 @@ body {
} }
} }
.lc-workbench { .lc-workbench {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #EDEFF3; background-color: #edeff3;
.lc-top-area { .lc-top-area {
height: var(--top-area-height); height: var(--top-area-height);
background-color: var(--color-pane-background); background-color: var(--color-pane-background);
@ -185,7 +183,7 @@ body {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
// background: rgba(31,56,88,0.04); // background: rgba(31,56,88,0.04);
border-bottom: 1px solid #EDEFF3; border-bottom: 1px solid #edeff3;
.lc-tab-title { .lc-tab-title {
flex: 1; flex: 1;
height: 32px; height: 32px;
@ -196,8 +194,8 @@ body {
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;
&.actived { &.actived {
color: #0079F2; color: #0079f2;
border-bottom-color: #0079F2; border-bottom-color: #0079f2;
} }
} }
} }
@ -222,7 +220,8 @@ body {
} }
} }
.lc-pane-icon-fix, .lc-pane-icon-float{ .lc-pane-icon-fix,
.lc-pane-icon-float {
position: absolute; position: absolute;
right: 38px; right: 38px;
top: 14px; top: 14px;
@ -281,7 +280,10 @@ body {
cursor: pointer; cursor: pointer;
} }
&.actived { &.actived {
color: #0079F2; color: #0079f2;
}
&.disabled {
opacity: 0.4;
} }
.lc-title-icon { .lc-title-icon {
height: 20px; height: 20px;

View File

@ -247,6 +247,10 @@ export class Skeleton {
return widget; return widget;
} }
getWidget(name: string): IWidget | undefined {
return this.widgets.find(widget => widget.name === name);
}
createPanel(config: PanelConfig) { createPanel(config: PanelConfig) {
config = this.parseConfig(config); config = this.parseConfig(config);
const panel = new Panel(this, config); const panel = new Panel(this, config);

View File

@ -70,6 +70,8 @@ export default class PanelDock implements IWidget {
private _panel?: Panel; private _panel?: Panel;
@obx.ref private _disabled = false;
@computed get panel() { @computed get panel() {
return this._panel || this.skeleton.getPanel(this.panelName); return this._panel || this.skeleton.getPanel(this.panelName);
} }
@ -122,9 +124,27 @@ export default class PanelDock implements IWidget {
this.setVisible(!this._visible); this.setVisible(!this._visible);
} }
private setDisabled(flag: boolean) {
this._disabled = flag;
}
disable() {
this.setDisabled(true);
}
enable() {
this.setDisabled(false);
}
get disabled(): boolean {
return this._disabled;
}
togglePanel() { togglePanel() {
if (!this._disabled) {
this.panel?.toggle(); this.panel?.toggle();
} }
}
getName() { getName() {
return this.name; return this.name;