From 4c506787227850cbac1bcad20d315d8adb1f788b Mon Sep 17 00:00:00 2001 From: luxiaobei Date: Wed, 4 Dec 2024 09:48:33 +0800 Subject: [PATCH] fix(components): set height after bottom changed #PJM-21216 (#155) --- packages/components/board/entry/entry-base.ts | 2 +- .../custom-template/add/add.component.html | 28 ++++++++++++++ .../custom-template/add/add.component.ts | 38 +++++++++++++++++++ .../custom-template.component.html | 32 ++-------------- .../custom-template.component.scss | 22 +++++++++++ packages/components/board/examples/module.ts | 8 +++- 6 files changed, 100 insertions(+), 30 deletions(-) create mode 100644 packages/components/board/examples/custom-template/add/add.component.html create mode 100644 packages/components/board/examples/custom-template/add/add.component.ts diff --git a/packages/components/board/entry/entry-base.ts b/packages/components/board/entry/entry-base.ts index 0b251ab..a8531cc 100644 --- a/packages/components/board/entry/entry-base.ts +++ b/packages/components/board/entry/entry-base.ts @@ -77,7 +77,7 @@ export abstract class ThyBoardEntryBase extends ThyBoardEntryDragDrop { ); afterNextRender(() => { - if (this.boardEntry.virtualScroll() && this.boardEntry.hasLane()) { + if (this.boardEntry.virtualScroll()) { const elementsObserve: Observable[] = [ this.sharedResizeObserver.observe(this.boardEntry.container(), { box: 'border-box' }).pipe(debounceTime(100)) ]; diff --git a/packages/components/board/examples/custom-template/add/add.component.html b/packages/components/board/examples/custom-template/add/add.component.html new file mode 100644 index 0000000..230fd5c --- /dev/null +++ b/packages/components/board/examples/custom-template/add/add.component.html @@ -0,0 +1,28 @@ + +
+ + +
+
+ + 取消 +
+
+
diff --git a/packages/components/board/examples/custom-template/add/add.component.ts b/packages/components/board/examples/custom-template/add/add.component.ts new file mode 100644 index 0000000..233913f --- /dev/null +++ b/packages/components/board/examples/custom-template/add/add.component.ts @@ -0,0 +1,38 @@ +import { Component, HostBinding, OnInit, input } from '@angular/core'; +import { ThyBoardCard } from '@tethys/pro/board'; + +interface CardInfo extends ThyBoardCard { + title: string; +} + +@Component({ + selector: 'thy-board-custom-template-add', + templateUrl: './add.component.html', + host: { + class: 'card-add-container' + } +}) +export class ThyBoardCustomTemplateAddComponent implements OnInit { + @HostBinding('class.card-add-container--creating') isCreating = false; + + isAdded = false; + + constructor() {} + + ngOnInit() {} + + goAddStep() { + this.isAdded = true; + this.isCreating=true + } + + create(event: Event) { + this.isAdded = false; + this.isCreating=false + } + + cancel() { + this.isAdded = false; + this.isCreating=false + } +} diff --git a/packages/components/board/examples/custom-template/custom-template.component.html b/packages/components/board/examples/custom-template/custom-template.component.html index 9ec9d3b..d3be03c 100644 --- a/packages/components/board/examples/custom-template/custom-template.component.html +++ b/packages/components/board/examples/custom-template/custom-template.component.html @@ -29,23 +29,11 @@ -
- 栏的顶部《 - @if (lane) { - 泳道:{{ lane.name }}; - } - 栏:{{ entry.name }}》 -
+
-
- 栏的底部《 - @if (lane) { - 泳道:{{ lane.name }}; - } - 栏:{{ entry.name }}》 -
+
@@ -88,23 +76,11 @@ -
- 栏的顶部《 - @if (lane) { - 泳道:{{ lane.name }}; - } - 栏:{{ entry.name }}》 -
+
-
- 栏的底部《 - @if (lane) { - 泳道:{{ lane.name }}; - } - ;栏:{{ entry.name }}》 -
+
diff --git a/packages/components/board/examples/custom-template/custom-template.component.scss b/packages/components/board/examples/custom-template/custom-template.component.scss index 5640bc3..3a27b8b 100644 --- a/packages/components/board/examples/custom-template/custom-template.component.scss +++ b/packages/components/board/examples/custom-template/custom-template.component.scss @@ -23,3 +23,25 @@ margin-bottom: 8px; } } + +.card-add-container { + display: block; + line-height: 1; + background: variables.$gray-80; + position: sticky; + bottom: 0; + width: 100%; + margin: 0 auto; + + &--creating { + width: calc(100% - 16px); + position: relative; + position: relative; + display: block; + padding: 12px 12px 6px 12px; + border-radius: 2px; + background: variables.$white; + cursor: pointer; + border: solid 1px variables.$gray-200; + } +} diff --git a/packages/components/board/examples/module.ts b/packages/components/board/examples/module.ts index 49a2fe1..dc2c5d6 100644 --- a/packages/components/board/examples/module.ts +++ b/packages/components/board/examples/module.ts @@ -8,14 +8,20 @@ import { ThyProBoardVirtualScrollExampleComponent } from './virtual-scroll/virtu import { ThyProBoardMultiExampleComponent } from './multi/multi.component'; import { ThyProBoardDragExampleComponent } from './drag/drag.component'; import { ThyProBoardScrollLoadExampleComponent } from './scroll-load/scroll-load.component'; +import { ThyIconModule } from 'ngx-tethys/icon'; +import { ThySharedModule } from 'ngx-tethys/shared'; +import { ThyButtonModule } from 'ngx-tethys/button'; +import { ThyBoardCustomTemplateAddComponent } from './custom-template/add/add.component'; +import { FormsModule } from '@angular/forms'; export default { - imports: [ThyProBoardModule, CommonModule], + imports: [ThyProBoardModule, CommonModule, FormsModule, ThyIconModule, ThySharedModule, ThyButtonModule], declarations: [ ThyProBoardBasicExampleComponent, ThyBoardBasicCardComponent, ThyProBoardSingleExampleComponent, ThyProBoardCustomTemplateExampleComponent, + ThyBoardCustomTemplateAddComponent, ThyProBoardVirtualScrollExampleComponent, ThyProBoardScrollLoadExampleComponent, ThyProBoardMultiExampleComponent,