@simplysm/angular 14.0.41 → 14.0.42
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/dist/controls/collapse/sd-collapse-icon.d.ts +2 -4
- package/dist/controls/collapse/sd-collapse-icon.d.ts.map +1 -1
- package/dist/controls/collapse/sd-collapse-icon.js +5 -5
- package/dist/core/modal/sd-modal.d.ts +2 -1
- package/dist/core/modal/sd-modal.d.ts.map +1 -1
- package/dist/core/modal/sd-modal.js +6 -4
- package/dist/core/modal/sd-modal.provider.d.ts +1 -0
- package/dist/core/modal/sd-modal.provider.d.ts.map +1 -1
- package/dist/data/data-sheet/sd-data-sheet.d.ts.map +1 -1
- package/dist/data/data-sheet/sd-data-sheet.js +75 -43
- package/dist/data/sheet/sd-sheet-column-cell-template.d.ts +9 -0
- package/dist/data/sheet/sd-sheet-column-cell-template.d.ts.map +1 -0
- package/dist/data/sheet/sd-sheet-column-cell-template.js +17 -0
- package/dist/data/sheet/sd-sheet-column.d.ts +10 -7
- package/dist/data/sheet/sd-sheet-column.d.ts.map +1 -1
- package/dist/data/sheet/sd-sheet-column.js +10 -6
- package/dist/data/sheet/sd-sheet-config.modal.d.ts +1 -1
- package/dist/data/sheet/sd-sheet-config.modal.d.ts.map +1 -1
- package/dist/data/sheet/sd-sheet.d.ts +3 -2
- package/dist/data/sheet/sd-sheet.d.ts.map +1 -1
- package/dist/data/sheet/sd-sheet.js +59 -34
- package/dist/data/sheet/types.d.ts +2 -0
- package/dist/data/sheet/types.d.ts.map +1 -1
- package/dist/data/sheet/useSheetCellStyling.d.ts.map +1 -1
- package/dist/data/sheet/useSheetCellStyling.js +7 -1
- package/dist/data/sheet/useSheetLayoutEngine.d.ts.map +1 -1
- package/dist/data/sheet/useSheetLayoutEngine.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +6 -6
- package/src/controls/collapse/sd-collapse-icon.ts +2 -3
- package/src/core/modal/sd-modal.provider.ts +1 -0
- package/src/core/modal/sd-modal.ts +2 -1
- package/src/data/data-sheet/sd-data-sheet.ts +14 -5
- package/src/data/sheet/sd-sheet-column-cell-template.ts +17 -0
- package/src/data/sheet/sd-sheet-column.ts +12 -5
- package/src/data/sheet/sd-sheet.ts +12 -1
- package/src/data/sheet/types.ts +2 -0
- package/src/data/sheet/useSheetCellStyling.ts +5 -1
- package/src/data/sheet/useSheetLayoutEngine.ts +2 -0
- package/src/index.ts +2 -1
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { SdButton } from "../../controls/button/sd-button";
|
|
14
14
|
import { SdForm } from "../../controls/form/sd-form";
|
|
15
15
|
import { SdSheetColumn } from "../sheet/sd-sheet-column";
|
|
16
|
+
import { SdSheetColumnCellTemplate } from "../sheet/sd-sheet-column-cell-template";
|
|
16
17
|
import { SdSheet } from "../sheet/sd-sheet";
|
|
17
18
|
import { injectParent } from "../../core/injectParent";
|
|
18
19
|
import { FormatPipe } from "../../core/format.pipe";
|
|
@@ -45,6 +46,7 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
45
46
|
SdButton,
|
|
46
47
|
SdSheet,
|
|
47
48
|
SdSheetColumn,
|
|
49
|
+
SdSheetColumnCellTemplate,
|
|
48
50
|
NgTemplateOutlet,
|
|
49
51
|
SdBaseContainer,
|
|
50
52
|
FormatPipe,
|
|
@@ -214,7 +216,7 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
214
216
|
parent.itemPropInfo.isDeleted
|
|
215
217
|
) {
|
|
216
218
|
<sd-sheet-column [fixed]="true" [key]="parent.itemPropInfo.isDeleted!">
|
|
217
|
-
<ng-template
|
|
219
|
+
<ng-template [cell]="parent.items()" let-item="item">
|
|
218
220
|
<div class="p-xs-sm tx-center">
|
|
219
221
|
<sd-anchor
|
|
220
222
|
[theme]="'danger'"
|
|
@@ -244,12 +246,19 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
244
246
|
[key]="columnControl.key()"
|
|
245
247
|
[fixed]="columnControl.fixed()"
|
|
246
248
|
[header]="columnControl.header()"
|
|
249
|
+
[headerStyle]="columnControl.headerStyle()"
|
|
250
|
+
[tooltip]="columnControl.tooltip()"
|
|
247
251
|
[width]="columnControl.width()"
|
|
248
252
|
[disableSorting]="columnControl.disableSorting()"
|
|
249
253
|
[disableResizing]="columnControl.disableResizing()"
|
|
250
254
|
[hidden]="columnControl.hidden()"
|
|
251
255
|
[collapse]="columnControl.collapse()"
|
|
252
256
|
>
|
|
257
|
+
@if (columnControl.headerTplRef()) {
|
|
258
|
+
<ng-template #headerTpl>
|
|
259
|
+
<ng-template [ngTemplateOutlet]="columnControl.headerTplRef()!" />
|
|
260
|
+
</ng-template>
|
|
261
|
+
}
|
|
253
262
|
@if (columnControl.summaryTplRef()) {
|
|
254
263
|
<ng-template #summaryTpl>
|
|
255
264
|
<ng-template [ngTemplateOutlet]="columnControl.summaryTplRef()!" />
|
|
@@ -257,8 +266,8 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
<ng-template
|
|
260
|
-
|
|
261
|
-
let-item
|
|
269
|
+
[cell]="parent.items()"
|
|
270
|
+
let-item="item"
|
|
262
271
|
let-index="index"
|
|
263
272
|
let-depth="depth"
|
|
264
273
|
let-edit="edit"
|
|
@@ -311,7 +320,7 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
311
320
|
[key]="parent.itemPropInfo.lastModifiedAt!"
|
|
312
321
|
[hidden]="true"
|
|
313
322
|
>
|
|
314
|
-
<ng-template
|
|
323
|
+
<ng-template [cell]="parent.items()" let-item="item">
|
|
315
324
|
<div class="p-xs-sm tx-center">
|
|
316
325
|
{{
|
|
317
326
|
item[parent.itemPropInfo.lastModifiedAt!]
|
|
@@ -327,7 +336,7 @@ import { SdDataSheetBase } from "./sd-data-sheet.base";
|
|
|
327
336
|
[key]="parent.itemPropInfo.lastModifiedBy!"
|
|
328
337
|
[hidden]="true"
|
|
329
338
|
>
|
|
330
|
-
<ng-template
|
|
339
|
+
<ng-template [cell]="parent.items()" let-item="item">
|
|
331
340
|
<div class="p-xs-sm tx-center">
|
|
332
341
|
{{ item[parent.itemPropInfo.lastModifiedBy!] }}
|
|
333
342
|
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Directive, input } from "@angular/core";
|
|
2
|
+
import type { SdSheetCellContext } from "./sd-sheet-column";
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: "ng-template[cell]",
|
|
6
|
+
standalone: true,
|
|
7
|
+
})
|
|
8
|
+
export class SdSheetColumnCellTemplate<T> {
|
|
9
|
+
cell = input.required<T[]>();
|
|
10
|
+
|
|
11
|
+
static ngTemplateContextGuard<TContextItem>(
|
|
12
|
+
_dir: SdSheetColumnCellTemplate<TContextItem>,
|
|
13
|
+
_ctx: unknown,
|
|
14
|
+
): _ctx is SdSheetCellContext<TContextItem> {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -5,10 +5,11 @@ import {
|
|
|
5
5
|
input,
|
|
6
6
|
TemplateRef,
|
|
7
7
|
} from "@angular/core";
|
|
8
|
+
import { SdSheetColumnCellTemplate } from "./sd-sheet-column-cell-template";
|
|
8
9
|
|
|
9
|
-
export interface SdSheetCellContext {
|
|
10
|
-
$implicit:
|
|
11
|
-
item:
|
|
10
|
+
export interface SdSheetCellContext<T = unknown> {
|
|
11
|
+
$implicit: T;
|
|
12
|
+
item: T;
|
|
12
13
|
index: number;
|
|
13
14
|
depth: number;
|
|
14
15
|
edit: boolean;
|
|
@@ -18,9 +19,11 @@ export interface SdSheetCellContext {
|
|
|
18
19
|
selector: "sd-sheet-column",
|
|
19
20
|
standalone: true,
|
|
20
21
|
})
|
|
21
|
-
export class SdSheetColumn {
|
|
22
|
+
export class SdSheetColumn<T = unknown> {
|
|
22
23
|
key = input.required<string>();
|
|
23
24
|
header = input<string | string[]>("");
|
|
25
|
+
headerStyle = input<string>();
|
|
26
|
+
tooltip = input<string>();
|
|
24
27
|
width = input<string>();
|
|
25
28
|
fixed = input(false, { transform: booleanAttribute });
|
|
26
29
|
hidden = input(false, { transform: booleanAttribute });
|
|
@@ -29,6 +32,10 @@ export class SdSheetColumn {
|
|
|
29
32
|
disableResizing = input(false, { transform: booleanAttribute });
|
|
30
33
|
ordering = input(0);
|
|
31
34
|
|
|
32
|
-
cellTplRef = contentChild<TemplateRef<SdSheetCellContext
|
|
35
|
+
cellTplRef = contentChild.required<any, TemplateRef<SdSheetCellContext<T>>>(
|
|
36
|
+
SdSheetColumnCellTemplate,
|
|
37
|
+
{ read: TemplateRef },
|
|
38
|
+
);
|
|
39
|
+
headerTplRef = contentChild<TemplateRef<void>>("headerTpl");
|
|
33
40
|
summaryTplRef = contentChild<TemplateRef<void>>("summaryTpl");
|
|
34
41
|
}
|
|
@@ -99,10 +99,16 @@ import { SdSheetConfigModal } from "./sd-sheet-config.modal";
|
|
|
99
99
|
[attr.colspan]="cell.colspan > 1 ? cell.colspan : null"
|
|
100
100
|
[attr.rowspan]="cell.rowspan > 1 ? cell.rowspan : null"
|
|
101
101
|
[attr.aria-sort]="getAriaSortValue(cell)"
|
|
102
|
+
[attr.title]="cell.colDef?.tooltip ?? cell.text"
|
|
103
|
+
[class.help]="cell.colDef?.tooltip"
|
|
102
104
|
[style]="getHeaderCellStyle(cell)"
|
|
103
105
|
(click)="onHeaderClick($event, cell)"
|
|
104
106
|
>
|
|
105
|
-
|
|
107
|
+
@if (cell.colDef && getColumnHeaderTpl(cell.colDef.key); as headerTpl) {
|
|
108
|
+
<ng-template [ngTemplateOutlet]="headerTpl" />
|
|
109
|
+
} @else {
|
|
110
|
+
<span>{{ cell.text }}</span>
|
|
111
|
+
}
|
|
106
112
|
@if (cell.colDef && getSortDef(cell.colDef.key); as sortDef) {
|
|
107
113
|
<ng-icon
|
|
108
114
|
class="_sort-icon"
|
|
@@ -463,6 +469,11 @@ export class SdSheet<T> {
|
|
|
463
469
|
return map;
|
|
464
470
|
});
|
|
465
471
|
|
|
472
|
+
getColumnHeaderTpl(key: string) {
|
|
473
|
+
const col = this._columnControlMap().get(key);
|
|
474
|
+
return col?.headerTplRef() ?? null;
|
|
475
|
+
}
|
|
476
|
+
|
|
466
477
|
getColumnCellTpl(key: string) {
|
|
467
478
|
const col = this._columnControlMap().get(key);
|
|
468
479
|
return col?.cellTplRef() ?? null;
|
package/src/data/sheet/types.ts
CHANGED
|
@@ -60,7 +60,11 @@ export function useSheetCellStyling<T>(options: {
|
|
|
60
60
|
|
|
61
61
|
function getHeaderCellStyle(cell: SdSheetHeaderDef): string | null {
|
|
62
62
|
if (cell.colDef == null) return null;
|
|
63
|
-
|
|
63
|
+
const parts: string[] = [];
|
|
64
|
+
const baseStyle = headerColumnStyles().get(cell.colDef.key);
|
|
65
|
+
if (baseStyle != null) parts.push(baseStyle);
|
|
66
|
+
if (cell.colDef.headerStyle != null) parts.push(cell.colDef.headerStyle);
|
|
67
|
+
return parts.length > 0 ? parts.join("; ") : null;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
function getCellStyle(item: T, colDef: SdSheetColumnDef): string | null {
|
|
@@ -17,6 +17,8 @@ export function useSheetLayoutEngine(options: {
|
|
|
17
17
|
return {
|
|
18
18
|
key,
|
|
19
19
|
header: col.header(),
|
|
20
|
+
headerStyle: col.headerStyle(),
|
|
21
|
+
tooltip: col.tooltip(),
|
|
20
22
|
width: cfgCol?.width ?? col.width(),
|
|
21
23
|
fixed: cfgCol?.fixed ?? col.fixed(),
|
|
22
24
|
hidden: cfgCol?.hidden ?? col.hidden(),
|
package/src/index.ts
CHANGED
|
@@ -224,7 +224,8 @@ export {
|
|
|
224
224
|
|
|
225
225
|
// data/sheet
|
|
226
226
|
export { SdSheet } from "./data/sheet/sd-sheet";
|
|
227
|
-
export { SdSheetColumn } from "./data/sheet/sd-sheet-column";
|
|
227
|
+
export { SdSheetColumn, type SdSheetCellContext } from "./data/sheet/sd-sheet-column";
|
|
228
|
+
export { SdSheetColumnCellTemplate } from "./data/sheet/sd-sheet-column-cell-template";
|
|
228
229
|
export { SdSheetConfigModal } from "./data/sheet/sd-sheet-config.modal";
|
|
229
230
|
export type {
|
|
230
231
|
SdSheetColumnDef,
|