Skip to content

Commit 3dcbd5c

Browse files
committed
Support minus column
1 parent 0d74667 commit 3dcbd5c

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

src/renderer/app/views/object_designer/designer.style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414

1515
:host ::ng-deep .ant-card-small > .ant-card-body {
16-
padding: 2px;
16+
padding: 5px;
1717
}
1818

1919
:host ::ng-deep .ant-divider-horizontal {

src/renderer/app/views/object_designer/layout/content/components/create_table/create.table.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class CreateTableComponent {
1818

1919
applyTableName: string;
2020
applyColumns: DesignerColumn[] = [];
21+
applyCheckedColumns = new Set<string>;
2122
dataType = [
2223
'varchar',
2324
'int',
@@ -59,6 +60,19 @@ export class CreateTableComponent {
5960
this.applyColumns = [...this.applyColumns, column];
6061
}
6162

63+
handlerMinusColumn() {
64+
this.applyColumns = this.applyColumns.filter(column => !this.applyCheckedColumns.has(column.id));
65+
}
66+
67+
handlerColumnChecked(column: string, checked: boolean) {
68+
if (checked) {
69+
this.applyCheckedColumns.add(column);
70+
} else {
71+
this.applyCheckedColumns.delete(column);
72+
this.applyData.table = null;
73+
}
74+
}
75+
6276
handlerSqlPreview() {
6377
const sql = this.builderFactory.createBuilder(this.applyData.dataSource.type)
6478
.builderCreateTable(this.applyData.database, this.applyTableName, this.applyData.engine, this.applyColumns);

src/renderer/app/views/object_designer/layout/content/components/create_table/create.table.view.html

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[nzShowPagination]="false" [nzData]="applyColumns">
1111
<thead>
1212
<tr>
13+
<th></th>
1314
<th>{{'common.name'|translate}}</th>
1415
<th>{{'common.type'|translate}}</th>
1516
<th>{{'common.length'|translate}}</th>
@@ -19,6 +20,8 @@
1920
</thead>
2021
<tbody>
2122
<tr *ngFor="let data of tableContainer.data">
23+
<td [nzChecked]="applyCheckedColumns.has(data['id'])"
24+
(nzCheckedChange)="handlerColumnChecked(data['id'], $event)"></td>
2225
<td nzEllipsis>
2326
<input nz-input [(ngModel)]="data['name']"/>
2427
</td>
@@ -57,12 +60,12 @@
5760
{{'common.engine'|translate}}
5861
</ng-template>
5962
<div nz-row [nzGutter]="[16, 16]" style="padding: 10px;">
60-
<div *ngFor="let engine of applyTableEngines" [nzSpan]="4" nz-col>
61-
<nz-radio-group [(ngModel)]="applyData.engine">
62-
<label nzValue="{{engine}}" nz-radio-button>
63-
{{engine}}
64-
</label>
65-
</nz-radio-group>
63+
<div *ngFor="let engine of applyTableEngines" [nzSpan]="4" nz-col>
64+
<nz-radio-group [(ngModel)]="applyData.engine">
65+
<label nzValue="{{engine}}" nz-radio-button>
66+
{{engine}}
67+
</label>
68+
</nz-radio-group>
6669
</div>
6770
</div>
6871
</nz-tab>
@@ -95,4 +98,10 @@
9598
(click)="handlerPlusColumn()">
9699
<i nz-icon nzType="plus-circle" class="action-button-success"></i>
97100
</button>
101+
<button nz-button nzSize="small" nzType="text" [disabled]="applyCheckedColumns.size <= 0"
102+
nz-tooltip nzTooltipTitle="{{'common.delete'|translate}}{{'common.column'|translate}}"
103+
(click)="handlerMinusColumn()">
104+
<span nz-icon nzType="minus-circle" class="action-button-danger"></span>
105+
<span *ngIf="applyCheckedColumns.size > 0">({{applyCheckedColumns.size}})</span>
106+
</button>
98107
</ng-template>

src/renderer/styles.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
line-height: 16px;
2727
}
2828

29-
.cdk-global-scrollblock {
30-
overflow-y: hidden;
31-
}
29+
//.cdk-global-scrollblock {
30+
// overflow-y: hidden;
31+
//}

0 commit comments

Comments
 (0)