Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Nov 24, 2023
1 parent 002f803 commit 402a9ef
Show file tree
Hide file tree
Showing 25 changed files with 285 additions and 218 deletions.
9 changes: 3 additions & 6 deletions packages/abc/date-picker/range-shortcut.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import { AlainDateRangePickerShortcutItem } from '@delon/util/config';
selector: '',
template: `
<ng-template #tpl>
<a
*ngFor="let i of list; let first = first"
(click)="click(i)"
[innerHTML]="i._text"
[ngClass]="{ 'ml-sm': !first }"
></a>
@for (i of list; track $index) {
<a (click)="click(i)" [innerHTML]="i._text" [ngClass]="{ 'ml-sm': !$first }"></a>
}
</ng-template>
`
})
Expand Down
31 changes: 16 additions & 15 deletions packages/abc/down-file/down-file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,22 @@ describe('abc: down-file', () => {

@Component({
template: `
<button
*ngFor="let i of fileTypes"
id="down-{{ i }}"
down-file
[http-data]="data"
[http-body]="body"
[http-method]="method"
http-url="/demo.{{ i }}"
[file-name]="fileName"
[pre]="pre"
(success)="success()"
(error)="error()"
>
{{ i }}
</button>
@for (i of fileTypes; track $index) {
<button
id="down-{{ i }}"
down-file
[http-data]="data"
[http-body]="body"
[http-method]="method"
http-url="/demo.{{ i }}"
[file-name]="fileName"
[pre]="pre"
(success)="success()"
(error)="error()"
>
{{ i }}
</button>
}
`
})
class TestComponent {
Expand Down
8 changes: 5 additions & 3 deletions packages/abc/notice-icon/notice-icon.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
<nz-dropdown-menu #noticeMenu="nzDropdownMenu">
<nz-spin [nzSpinning]="loading" [nzDelay]="0">
<nz-tabset nzSelectedIndex="0" [nzCentered]="centered">
<nz-tab *ngFor="let i of data" [nzTitle]="i.title">
<notice-icon-tab [locale]="locale" [data]="i" (select)="onSelect($event)" (clear)="onClear($event)" />
</nz-tab>
@for (i of data; track $index) {
<nz-tab [nzTitle]="i.title">
<notice-icon-tab [locale]="locale" [data]="i" (select)="onSelect($event)" (clear)="onClear($event)" />
</nz-tab>
}
</nz-tabset>
</nz-spin>
</nz-dropdown-menu>
Expand Down
22 changes: 11 additions & 11 deletions packages/abc/st/st-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ import { _STColumn } from './st.types';
}
@default {
<ul nz-menu>
@if (f.multiple) {
<li nz-menu-item *ngFor="let filter of f.menus">
<label nz-checkbox [(ngModel)]="filter.checked" (ngModelChange)="checkboxChange()">
{{ filter.text }}
</label>
</li>
} @else {
<li nz-menu-item *ngFor="let filter of f.menus">
<label nz-radio [ngModel]="filter.checked" (ngModelChange)="radioChange(filter)">
{{ filter.text }}
</label>
@for (filter of f.menus; track $index) {
<li nz-menu-item>
@if (f.multiple) {
<label nz-checkbox [(ngModel)]="filter.checked" (ngModelChange)="checkboxChange()">
{{ filter.text }}
</label>
} @else {
<label nz-radio [ngModel]="filter.checked" (ngModelChange)="radioChange(filter)">
{{ filter.text }}
</label>
}
</li>
}
</ul>
Expand Down
10 changes: 5 additions & 5 deletions packages/abc/st/st-td.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@
}
</ng-container>
</ng-container>
<ng-container *ngFor="let btn of i._values[cIdx].buttons; let last = last">
@for (btn of i._values[cIdx].buttons; track $index) {
@if (btn.children!.length > 0) {
<a nz-dropdown [nzDropdownMenu]="btnMenu" nzOverlayClassName="st__btn-sub">
<span [innerHTML]="btn._text"></span>
<i nz-icon nzType="down"></i>
</a>
<nz-dropdown-menu #btnMenu="nzDropdownMenu">
<ul nz-menu>
<ng-container *ngFor="let subBtn of btn.children!">
@for (subBtn of btn.children; track $index) {
@if (subBtn.type === 'divider') {
<li nz-menu-divider></li>
} @else {
Expand All @@ -113,16 +113,16 @@
/>
</li>
}
</ng-container>
}
</ul>
</nz-dropdown-menu>
} @else {
<span [class.st__btn-disabled]="btn._disabled">
<ng-template [ngTemplateOutlet]="btnTpl" [ngTemplateOutletContext]="{ $implicit: btn, child: false }" />
</span>
}
@if (!last) {
@if (!$last) {
<nz-divider nzType="vertical" />
}
</ng-container>
}
</ng-container>
168 changes: 85 additions & 83 deletions packages/abc/st/st.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,92 +55,94 @@
>
@if (showHeader) {
<thead>
<tr *ngFor="let row of _headers; let rowFirst = first">
@if (rowFirst && expand) {
<th nzWidth="50px" [rowSpan]="_headers.length"></th>
}
<ng-container *ngFor="let h of row; let index = index; let last = last">
<th
*let="h.column as _c"
[colSpan]="h.colSpan"
[rowSpan]="h.rowSpan"
[nzWidth]="$any(_c).width"
[nzLeft]="_c._left!"
[nzRight]="_c._right!"
[ngClass]="_c._className"
[attr.data-col]="_c.indexKey"
[attr.data-col-index]="index"
[nzShowSort]="_c._sort.enabled"
[nzSortOrder]="$any(_c)._sort.default"
(nzSortOrderChange)="sort(_c, index, $event)"
[nzCustomFilter]="!!_c.filter"
[class.st__has-filter]="_c.filter"
nz-resizable
[nzDisabled]="last || $any(_c).resizable.disabled"
[nzMaxWidth]="$any(_c).resizable.maxWidth"
[nzMinWidth]="$any(_c).resizable.minWidth"
[nzBounds]="$any(_c).resizable.bounds"
[nzPreview]="$any(_c).resizable.preview"
(nzResizeEnd)="colResize($event, _c)"
>
@if ($any(!last && !$any(_c).resizable.disabled)) {
<nz-resize-handle nzDirection="right">
<i></i>
</nz-resize-handle>
}
<ng-template
#renderTitle
[ngTemplateOutlet]="_c.__renderTitle!"
[ngTemplateOutletContext]="{ $implicit: h.column, index: index }"
/>
<ng-container *ngIf="!_c.__renderTitle; else renderTitle">
<ng-container [ngSwitch]="_c.type">
<ng-container *ngSwitchCase="'checkbox'">
@if (_c.selections!.length === 0) {
<ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: false }" />
} @else {
<div class="ant-table-selection">
<ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: true }" />
@if (_c.selections!.length) {
<div class="ant-table-selection-extra">
<div
nz-dropdown
nzPlacement="bottomLeft"
[nzDropdownMenu]="selectionMenu"
class="ant-table-selection-down st__checkall-selection"
>
<i nz-icon nzType="down"></i>
@for (row of _headers; track $index) {
<tr>
@if ($first && expand) {
<th nzWidth="50px" [rowSpan]="_headers.length"></th>
}
<ng-container *ngFor="let h of row; let index = index; let last = last">
<th
*let="h.column as _c"
[colSpan]="h.colSpan"
[rowSpan]="h.rowSpan"
[nzWidth]="$any(_c).width"
[nzLeft]="_c._left!"
[nzRight]="_c._right!"
[ngClass]="_c._className"
[attr.data-col]="_c.indexKey"
[attr.data-col-index]="index"
[nzShowSort]="_c._sort.enabled"
[nzSortOrder]="$any(_c)._sort.default"
(nzSortOrderChange)="sort(_c, index, $event)"
[nzCustomFilter]="!!_c.filter"
[class.st__has-filter]="_c.filter"
nz-resizable
[nzDisabled]="last || $any(_c).resizable.disabled"
[nzMaxWidth]="$any(_c).resizable.maxWidth"
[nzMinWidth]="$any(_c).resizable.minWidth"
[nzBounds]="$any(_c).resizable.bounds"
[nzPreview]="$any(_c).resizable.preview"
(nzResizeEnd)="colResize($event, _c)"
>
@if ($any(!last && !$any(_c).resizable.disabled)) {
<nz-resize-handle nzDirection="right">
<i></i>
</nz-resize-handle>
}
<ng-template
#renderTitle
[ngTemplateOutlet]="_c.__renderTitle!"
[ngTemplateOutletContext]="{ $implicit: h.column, index: index }"
/>
<ng-container *ngIf="!_c.__renderTitle; else renderTitle">
<ng-container [ngSwitch]="_c.type">
<ng-container *ngSwitchCase="'checkbox'">
@if (_c.selections!.length === 0) {
<ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: false }" />
} @else {
<div class="ant-table-selection">
<ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: true }" />
@if (_c.selections!.length) {
<div class="ant-table-selection-extra">
<div
nz-dropdown
nzPlacement="bottomLeft"
[nzDropdownMenu]="selectionMenu"
class="ant-table-selection-down st__checkall-selection"
>
<i nz-icon nzType="down"></i>
</div>
</div>
</div>
}
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
@for (rw of _c.selections; track $index) {
<li nz-menu-item (click)="_rowSelection(rw)" [innerHTML]="rw.text"></li>
}
</ul>
</nz-dropdown-menu>
</div>
}
</ng-container>
<ng-container *ngSwitchDefault>
<ng-template [ngTemplateOutlet]="titleTpl" [ngTemplateOutletContext]="{ $implicit: _c.title }" />
}
<nz-dropdown-menu #selectionMenu="nzDropdownMenu">
<ul nz-menu class="ant-table-selection-menu">
@for (rw of _c.selections; track $index) {
<li nz-menu-item (click)="_rowSelection(rw)" [innerHTML]="rw.text"></li>
}
</ul>
</nz-dropdown-menu>
</div>
}
</ng-container>
<ng-container *ngSwitchDefault>
<ng-template [ngTemplateOutlet]="titleTpl" [ngTemplateOutletContext]="{ $implicit: _c.title }" />
</ng-container>
</ng-container>
</ng-container>
</ng-container>
@if (_c.filter) {
<st-filter
nz-th-extra
[col]="h.column"
[f]="_c.filter"
[locale]="locale"
(n)="handleFilterNotify($event)"
(handle)="_handleFilter(_c, $event)"
/>
}
</th>
</ng-container>
</tr>
@if (_c.filter) {
<st-filter
nz-th-extra
[col]="h.column"
[f]="_c.filter"
[locale]="locale"
(n)="handleFilterNotify($event)"
(handle)="_handleFilter(_c, $event)"
/>
}
</th>
</ng-container>
</tr>
}
</thead>
}
<tbody class="st__body">
Expand Down
4 changes: 3 additions & 1 deletion packages/abc/tag-select/tag-select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ describe('abc: tag-select', () => {
@Component({
template: `
<tag-select #comp [expandable]="expandable" (change)="change()">
<li *ngFor="let i of categories; let idx = index" style="width: 30%">{{ i.text }}</li>
@for (i of categories; track $index) {
<li style="width: 30%">{{ i.text }}</li>
}
</tag-select>
`
})
Expand Down
4 changes: 3 additions & 1 deletion packages/chart/bar/bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export interface G2BarClickItem {
<ng-container *nzStringTemplateOutlet="title">
<h4 style="margin-bottom: 20px;">{{ title }}</h4>
</ng-container>
<nz-skeleton *ngIf="!loaded" />
@if (!loaded) {
<nz-skeleton />
}
<div #container></div>
`,
host: {
Expand Down
28 changes: 18 additions & 10 deletions packages/chart/card/card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,31 @@
</div>
<div class="g2-card__meta-wrap">
<div class="g2-card__meta">
<span class="g2-card__meta-title" *ngIf="title">
<ng-container *nzStringTemplateOutlet="title">{{ title }}</ng-container>
</span>
<span class="g2-card__meta-action" *ngIf="action">
<ng-container *nzStringTemplateOutlet="action">{{ action }}</ng-container>
</span>
@if (title) {
<span class="g2-card__meta-title">
<ng-container *nzStringTemplateOutlet="title">{{ title }}</ng-container>
</span>
}
@if (action) {
<span class="g2-card__meta-action">
<ng-container *nzStringTemplateOutlet="action">{{ action }}</ng-container>
</span>
}
</div>
<p *ngIf="total" class="g2-card__total" [innerHTML]="total"></p>
@if (total) {
<p class="g2-card__total" [innerHTML]="total"></p>
}
</div>
</div>
<div class="g2-card__desc" [ngStyle]="{ height: _height }">
<div [ngClass]="{ 'g2-card__fixed': !!_orgHeight }">
<ng-content />
</div>
</div>
<div class="g2-card__footer" *ngIf="footer">
<ng-container *nzStringTemplateOutlet="footer">{{ footer }}</ng-container>
</div>
@if (footer) {
<div class="g2-card__footer">
<ng-container *nzStringTemplateOutlet="footer">{{ footer }}</ng-container>
</div>
}
</nz-spin>
</nz-card>
4 changes: 3 additions & 1 deletion packages/chart/chart-echarts/echarts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import {
selector: 'chart-echarts, [chart-echarts]',
exportAs: 'chartECharts',
template: `
<nz-skeleton *ngIf="!loaded" />
@if (!loaded) {
<nz-skeleton />
}
<div #container [style.width]="_width" [style.height]="_height"></div>
`,
host: {
Expand Down
4 changes: 3 additions & 1 deletion packages/chart/custom/custom.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { InputNumber, NumberInput } from '@delon/util/decorator';
selector: 'g2,g2-custom',
exportAs: 'g2Custom',
template: `
<nz-skeleton *ngIf="!loaded" />
@if (!loaded) {
<nz-skeleton />
}
<ng-content />
`,
host: {
Expand Down
Loading

0 comments on commit 402a9ef

Please sign in to comment.