@salesforce/templates 66.10.4 → 66.11.1
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/lib/generators/apexClassGenerator.js +9 -2
- package/lib/generators/apexClassGenerator.js.map +1 -1
- package/lib/i18n/i18n.d.ts +1 -0
- package/lib/i18n/i18n.js +1 -0
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/templates/apexclass/Batchable.cls +15 -0
- package/lib/templates/apexclass/Queueable.cls +13 -0
- package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +1245 -1169
- package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +1238 -1162
- package/lib/templates/uiBundles/angularbasic/angular.json +11 -7
- package/lib/templates/uiBundles/angularbasic/eslint.config.js +4 -0
- package/lib/templates/uiBundles/angularbasic/package-lock.json +459 -908
- package/lib/templates/uiBundles/angularbasic/package.json +6 -2
- package/lib/templates/uiBundles/angularbasic/src/app/api/{graphql-client.service.spec.ts → data-client.service.spec.ts} +36 -6
- package/lib/templates/uiBundles/angularbasic/src/app/api/data-client.service.ts +74 -0
- package/lib/templates/uiBundles/angularbasic/src/app/app.config.ts +15 -1
- package/lib/templates/uiBundles/angularbasic/src/app/app.routes.ts +6 -1
- package/lib/templates/uiBundles/angularbasic/src/app/app.ts +7 -2
- package/lib/templates/uiBundles/angularbasic/src/app/{layout → components/layout/app-layout}/app-layout.component.html +2 -1
- package/lib/templates/uiBundles/angularbasic/src/app/{layout → components/layout/app-layout}/app-layout.component.ts +9 -3
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/_field-size.scss +42 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/alert/alert.component.html +31 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/alert/alert.component.ts +53 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/button/button.component.html +18 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/button/button.component.scss +112 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/button/button.component.ts +57 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/card/card.component.scss +34 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/card/card.component.ts +110 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/collapsible/collapsible.component.html +10 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/collapsible/collapsible.component.ts +26 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-picker/date-picker.component.html +25 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-picker/date-picker.component.scss +36 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-picker/date-picker.component.ts +41 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-range-picker/date-range-picker.component.html +34 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-range-picker/date-range-picker.component.scss +33 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/date-range-picker/date-range-picker.component.ts +66 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/dialog/dialog.component.html +37 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/dialog/dialog.component.ts +55 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/field/field.component.html +21 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/field/field.component.ts +36 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/field-size.ts +8 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/input/input.component.html +19 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/input/input.component.scss +35 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/input/input.component.ts +36 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/label/label.component.html +3 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/label/label.component.ts +17 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/paginator/paginator.component.html +10 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/paginator/paginator.component.ts +37 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/popover/popover.component.html +41 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/popover/popover.component.ts +40 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/select/select.component.html +24 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/select/select.component.scss +35 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/select/select.component.ts +72 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/separator/separator.component.html +1 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/separator/separator.component.scss +23 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/separator/separator.component.ts +56 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.html +1 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.scss +28 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.ts +24 -0
- package/lib/templates/uiBundles/angularbasic/src/app/components/ui/spinner/spinner.component.ts +35 -0
- package/lib/templates/uiBundles/angularbasic/src/app/pages/home/home.component.ts +7 -1
- package/lib/templates/uiBundles/angularbasic/src/app/pages/not-found/not-found.component.ts +7 -1
- package/lib/templates/uiBundles/angularbasic/src/app/utils/async-data.ts +99 -0
- package/lib/templates/uiBundles/angularbasic/src/index.html +1 -0
- package/lib/templates/uiBundles/angularbasic/src/styles.scss +170 -0
- package/lib/templates/uiBundles/angularbasic/src/theme.scss +39 -0
- package/lib/templates/uiBundles/reactbasic/package-lock.json +1238 -1162
- package/lib/utils/createUtil.d.ts +2 -0
- package/lib/utils/createUtil.js +7 -0
- package/lib/utils/createUtil.js.map +1 -1
- package/lib/utils/types.d.ts +11 -3
- package/package.json +3 -3
- package/lib/templates/uiBundles/angularbasic/src/app/api/graphql-client.service.ts +0 -51
- package/lib/templates/uiBundles/angularbasic/src/app/app.css +0 -0
- package/lib/templates/uiBundles/angularbasic/src/styles.css +0 -12
- /package/lib/templates/uiBundles/angularbasic/src/app/{layout → components/layout/app-layout}/app-layout.component.spec.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<mat-paginator
|
|
2
|
+
[length]="length()"
|
|
3
|
+
[pageIndex]="pageIndex()"
|
|
4
|
+
[pageSize]="pageSize()"
|
|
5
|
+
[pageSizeOptions]="pageSizeOptions()"
|
|
6
|
+
[hidePageSize]="hidePageSize()"
|
|
7
|
+
[showFirstLastButtons]="showFirstLastButtons()"
|
|
8
|
+
[disabled]="disabled()"
|
|
9
|
+
(page)="page.emit($event)"
|
|
10
|
+
/>
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/paginator/paginator.component.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, input, output } from '@angular/core';
|
|
7
|
+
import { MatPaginator, type PageEvent } from '@angular/material/paginator';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Thin wrapper over Material's `mat-paginator`. Presentation only — the host
|
|
11
|
+
* decides what each page change means by listening to `(page)`.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-paginator',
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
imports: [MatPaginator],
|
|
17
|
+
templateUrl: './paginator.component.html',
|
|
18
|
+
})
|
|
19
|
+
export class PaginatorComponent {
|
|
20
|
+
/** Total item count; Material derives the page count as `ceil(length / pageSize)`. */
|
|
21
|
+
readonly length = input<number>(0);
|
|
22
|
+
/** Zero-based index of the current page. */
|
|
23
|
+
readonly pageIndex = input<number>(0);
|
|
24
|
+
/** Items shown per page. */
|
|
25
|
+
readonly pageSize = input<number>(10);
|
|
26
|
+
/** Selectable page sizes; omit/empty to hide the size selector. */
|
|
27
|
+
readonly pageSizeOptions = input<readonly number[]>([]);
|
|
28
|
+
/** Disable navigation buttons and the size select (e.g. while loading). */
|
|
29
|
+
readonly disabled = input(false, { transform: booleanAttribute });
|
|
30
|
+
/** Hide the "Items per page" selector. */
|
|
31
|
+
readonly hidePageSize = input(false, { transform: booleanAttribute });
|
|
32
|
+
/** Show the first / last page jump buttons. */
|
|
33
|
+
readonly showFirstLastButtons = input(false, { transform: booleanAttribute });
|
|
34
|
+
|
|
35
|
+
/** Emitted when the user changes page or page size. */
|
|
36
|
+
readonly page = output<PageEvent>();
|
|
37
|
+
}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/popover/popover.component.html
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<span
|
|
2
|
+
cdkOverlayOrigin
|
|
3
|
+
#origin="cdkOverlayOrigin"
|
|
4
|
+
role="button"
|
|
5
|
+
tabindex="0"
|
|
6
|
+
[attr.aria-expanded]="open()"
|
|
7
|
+
(click)="toggle()"
|
|
8
|
+
(keydown.enter)="toggle()"
|
|
9
|
+
(keydown.space)="$event.preventDefault(); toggle()"
|
|
10
|
+
>
|
|
11
|
+
<ng-content select="[trigger]" />
|
|
12
|
+
</span>
|
|
13
|
+
|
|
14
|
+
<ng-template
|
|
15
|
+
cdkConnectedOverlay
|
|
16
|
+
[cdkConnectedOverlayOrigin]="origin"
|
|
17
|
+
[cdkConnectedOverlayOpen]="open()"
|
|
18
|
+
[cdkConnectedOverlayHasBackdrop]="true"
|
|
19
|
+
cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
|
|
20
|
+
[cdkConnectedOverlayOffsetY]="sideOffset()"
|
|
21
|
+
[cdkConnectedOverlayPositions]="[
|
|
22
|
+
{
|
|
23
|
+
originX: align(),
|
|
24
|
+
originY: 'bottom',
|
|
25
|
+
overlayX: align(),
|
|
26
|
+
overlayY: 'top',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
originX: align(),
|
|
30
|
+
originY: 'top',
|
|
31
|
+
overlayX: align(),
|
|
32
|
+
overlayY: 'bottom',
|
|
33
|
+
},
|
|
34
|
+
]"
|
|
35
|
+
(backdropClick)="close()"
|
|
36
|
+
(detach)="close()"
|
|
37
|
+
>
|
|
38
|
+
<div class="bg-white text-sm rounded-lg shadow-md ring-1 ring-black/10 outline-none">
|
|
39
|
+
<ng-content />
|
|
40
|
+
</div>
|
|
41
|
+
</ng-template>
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/popover/popover.component.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
7
|
+
import { ChangeDetectionStrategy, Component, input, model } from '@angular/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Popover backed by CDK Overlay. Slots: `[trigger]` (anchor, toggles the
|
|
11
|
+
* popover) and default (body). `open` is a two-way model; a backdrop click
|
|
12
|
+
* closes it.
|
|
13
|
+
*/
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'app-popover',
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
imports: [CdkConnectedOverlay, CdkOverlayOrigin],
|
|
18
|
+
templateUrl: './popover.component.html',
|
|
19
|
+
})
|
|
20
|
+
export class PopoverComponent {
|
|
21
|
+
/**
|
|
22
|
+
* Two-way bindable open state. Supports `[(open)]`, a plain `[open]`
|
|
23
|
+
* input, or listening to the auto-generated `(openChange)` event.
|
|
24
|
+
*/
|
|
25
|
+
readonly open = model<boolean>(false);
|
|
26
|
+
|
|
27
|
+
/** Panel alignment relative to the trigger. Defaults to below-start. */
|
|
28
|
+
readonly align = input<'start' | 'center' | 'end'>('start');
|
|
29
|
+
|
|
30
|
+
/** Vertical gap between the trigger and the panel, in px. */
|
|
31
|
+
readonly sideOffset = input<number>(4);
|
|
32
|
+
|
|
33
|
+
toggle(): void {
|
|
34
|
+
this.open.set(!this.open());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
close(): void {
|
|
38
|
+
this.open.set(false);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/select/select.component.html
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<mat-form-field
|
|
2
|
+
class="w-full"
|
|
3
|
+
[class]="'size-' + size()"
|
|
4
|
+
[appearance]="appearance()"
|
|
5
|
+
subscriptSizing="dynamic"
|
|
6
|
+
>
|
|
7
|
+
@if (label()) {
|
|
8
|
+
<mat-label>{{ label() }}</mat-label>
|
|
9
|
+
}
|
|
10
|
+
<mat-select
|
|
11
|
+
[multiple]="multiple()"
|
|
12
|
+
[placeholder]="placeholder()"
|
|
13
|
+
[disabled]="disabled()"
|
|
14
|
+
[ngModel]="selection()"
|
|
15
|
+
(ngModelChange)="onSelectionChange($event)"
|
|
16
|
+
>
|
|
17
|
+
@if (multiple()) {
|
|
18
|
+
<mat-select-trigger>{{ multiTriggerLabel() }}</mat-select-trigger>
|
|
19
|
+
}
|
|
20
|
+
@for (option of options(); track option.value) {
|
|
21
|
+
<mat-option [value]="option.value">{{ option.label }}</mat-option>
|
|
22
|
+
}
|
|
23
|
+
</mat-select>
|
|
24
|
+
</mat-form-field>
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/select/select.component.scss
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
@use '../field-size' as field-size;
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Form-field-specific structural styling. Height comes from the `size` input
|
|
11
|
+
* (see field-size.scss); colour comes from the --mat-sys-* remap (styles.css).
|
|
12
|
+
* Here we only: give the outline our design-token radius, emit the size
|
|
13
|
+
* classes, and collapse the empty hint/error subscript row.
|
|
14
|
+
*/
|
|
15
|
+
@include field-size.sizes;
|
|
16
|
+
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
/*
|
|
20
|
+
* Allow the host to shrink below the mat-form-field's intrinsic width when
|
|
21
|
+
* used as a flex item (e.g. the operator select beside a date picker in a
|
|
22
|
+
* date filter row). Without this, the default `min-width: auto` on a flex
|
|
23
|
+
* item keeps each field at its content width and the row overflows.
|
|
24
|
+
*/
|
|
25
|
+
min-width: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.mat-mdc-form-field {
|
|
29
|
+
--mdc-outlined-text-field-container-shape: var(--radius-md);
|
|
30
|
+
font-size: 0.875rem; /* text-sm, matches the React inputs */
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mat-mdc-form-field-subscript-wrapper {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
booleanAttribute,
|
|
8
|
+
ChangeDetectionStrategy,
|
|
9
|
+
Component,
|
|
10
|
+
computed,
|
|
11
|
+
input,
|
|
12
|
+
model,
|
|
13
|
+
} from '@angular/core';
|
|
14
|
+
import { FormsModule } from '@angular/forms';
|
|
15
|
+
import { MatFormFieldModule, type MatFormFieldAppearance } from '@angular/material/form-field';
|
|
16
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
17
|
+
import type { AppFieldSize } from '../field-size';
|
|
18
|
+
|
|
19
|
+
/** Shape of an option rendered in the dropdown. */
|
|
20
|
+
export interface AppSelectOption {
|
|
21
|
+
value: string;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Thin wrapper over Material's `mat-form-field` + `mat-select`. */
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'app-select',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
imports: [FormsModule, MatFormFieldModule, MatSelectModule],
|
|
30
|
+
templateUrl: './select.component.html',
|
|
31
|
+
styleUrl: './select.component.scss',
|
|
32
|
+
})
|
|
33
|
+
export class SelectComponent {
|
|
34
|
+
/** Two-way bindable single-select value. Ignored when `multiple` is set. */
|
|
35
|
+
readonly value = model<string>('');
|
|
36
|
+
|
|
37
|
+
/** Two-way bindable multi-select values. Used only when `multiple` is `true`. */
|
|
38
|
+
readonly values = model<readonly string[]>([]);
|
|
39
|
+
|
|
40
|
+
/** Render checkbox options and allow more than one selection. */
|
|
41
|
+
readonly multiple = input(false, { transform: booleanAttribute });
|
|
42
|
+
|
|
43
|
+
readonly options = input<readonly AppSelectOption[]>([]);
|
|
44
|
+
readonly placeholder = input<string>('');
|
|
45
|
+
readonly label = input<string>('');
|
|
46
|
+
readonly disabled = input<boolean>(false);
|
|
47
|
+
readonly appearance = input<MatFormFieldAppearance>('outline');
|
|
48
|
+
/** Field height: `sm` = 24px, `default` = 32px, `lg` = 40px. */
|
|
49
|
+
readonly size = input<AppFieldSize>('default');
|
|
50
|
+
|
|
51
|
+
/** Value handed to `mat-select`: the `values` array when `multiple`, else `value`. */
|
|
52
|
+
protected readonly selection = computed(() => (this.multiple() ? this.values() : this.value()));
|
|
53
|
+
|
|
54
|
+
/** Multi-select trigger summary: the sole option's label, else "N selected". */
|
|
55
|
+
protected readonly multiTriggerLabel = computed(() => {
|
|
56
|
+
const selected = this.values();
|
|
57
|
+
if (selected.length === 1) {
|
|
58
|
+
const only = selected[0];
|
|
59
|
+
return this.options().find((o) => o.value === only)?.label ?? only;
|
|
60
|
+
}
|
|
61
|
+
return `${selected.length} selected`;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/** Single change handler — routes to the right model based on `multiple`. */
|
|
65
|
+
protected onSelectionChange(next: string | string[]): void {
|
|
66
|
+
if (this.multiple()) {
|
|
67
|
+
this.values.set((next as string[]) ?? []);
|
|
68
|
+
} else {
|
|
69
|
+
this.value.set((next as string) ?? '');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<mat-divider role="presentation" [vertical]="isVertical()" [inset]="inset()" />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Material's `mat-divider` draws a full-height border for the vertical variant,
|
|
9
|
+
* so its element must fill the host. The host itself carries `self-stretch`
|
|
10
|
+
* (see component `hostClass`) to take the flex row's height; here we make the
|
|
11
|
+
* inner divider fill that height. Horizontal needs nothing extra — the divider
|
|
12
|
+
* is already `display:block; width:100%`.
|
|
13
|
+
*/
|
|
14
|
+
:host {
|
|
15
|
+
// A vertical divider is a zero-width line; keep it out of flex growth math.
|
|
16
|
+
&[data-orientation='vertical'] {
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mat-divider-vertical {
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/separator/separator.component.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
booleanAttribute,
|
|
8
|
+
ChangeDetectionStrategy,
|
|
9
|
+
Component,
|
|
10
|
+
computed,
|
|
11
|
+
input,
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { MatDivider } from '@angular/material/divider';
|
|
14
|
+
|
|
15
|
+
/** Layout axis of the separator line. */
|
|
16
|
+
export type AppSeparatorOrientation = 'horizontal' | 'vertical';
|
|
17
|
+
|
|
18
|
+
const BASE_CLASSES = 'shrink-0';
|
|
19
|
+
const ORIENTATION_CLASSES: Record<AppSeparatorOrientation, string> = {
|
|
20
|
+
horizontal: 'block w-full',
|
|
21
|
+
vertical: 'self-stretch',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Divider built on Material's `mat-divider`. `decorative` (default) hides the
|
|
26
|
+
* host from assistive tech (`role="none"`); when false it exposes
|
|
27
|
+
* `role="separator"` + `aria-orientation`. The inner `mat-divider` is marked
|
|
28
|
+
* `role="presentation"` so it never announces a duplicate separator.
|
|
29
|
+
*/
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'app-separator',
|
|
32
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
|
+
imports: [MatDivider],
|
|
34
|
+
templateUrl: './separator.component.html',
|
|
35
|
+
styleUrl: './separator.component.scss',
|
|
36
|
+
host: {
|
|
37
|
+
'data-slot': 'separator',
|
|
38
|
+
'[attr.data-orientation]': 'orientation()',
|
|
39
|
+
'[attr.role]': "decorative() ? 'none' : 'separator'",
|
|
40
|
+
'[attr.aria-orientation]':
|
|
41
|
+
"decorative() ? null : (orientation() === 'vertical' ? 'vertical' : 'horizontal')",
|
|
42
|
+
'[class]': 'hostClass()',
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
export class SeparatorComponent {
|
|
46
|
+
readonly orientation = input<AppSeparatorOrientation>('horizontal');
|
|
47
|
+
readonly decorative = input(true, { transform: booleanAttribute });
|
|
48
|
+
/** Adds Material's horizontal inset margin so the line doesn't run edge-to-edge. */
|
|
49
|
+
readonly inset = input(false, { transform: booleanAttribute });
|
|
50
|
+
|
|
51
|
+
protected readonly isVertical = computed(() => this.orientation() === 'vertical');
|
|
52
|
+
|
|
53
|
+
protected readonly hostClass = computed(
|
|
54
|
+
() => `${BASE_CLASSES} ${ORIENTATION_CLASSES[this.orientation()]}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content />
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.scss
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* The skeleton is a block by default so call sites only need to supply a width
|
|
9
|
+
* and height (`h-4 w-32`) — no `block` utility to repeat. The pulse lives here
|
|
10
|
+
* (rather than Tailwind's `animate-pulse`) so it can be switched off for users
|
|
11
|
+
* who ask for reduced motion.
|
|
12
|
+
*/
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
animation: app-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes app-skeleton-pulse {
|
|
19
|
+
50% {
|
|
20
|
+
opacity: 0.5;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media (prefers-reduced-motion: reduce) {
|
|
25
|
+
:host {
|
|
26
|
+
animation: none;
|
|
27
|
+
}
|
|
28
|
+
}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/skeleton/skeleton.component.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Loading skeleton — a pulsing block sized by host `class` utilities (e.g.
|
|
10
|
+
* `class="h-4 w-32"`); it has no intrinsic size, so always set width/height.
|
|
11
|
+
* `aria-hidden`, so announce loading via the container's `aria-busy`.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-skeleton',
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
templateUrl: './skeleton.component.html',
|
|
17
|
+
styleUrl: './skeleton.component.scss',
|
|
18
|
+
host: {
|
|
19
|
+
'data-slot': 'skeleton',
|
|
20
|
+
'aria-hidden': 'true',
|
|
21
|
+
class: 'bg-accent rounded-md',
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
export class SkeletonComponent {}
|
package/lib/templates/uiBundles/angularbasic/src/app/components/ui/spinner/spinner.component.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
7
|
+
import { MatProgressSpinnerModule, ProgressSpinnerMode } from '@angular/material/progress-spinner';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Thin wrapper over Material's `mat-progress-spinner`. Defaults to an
|
|
11
|
+
* indeterminate 24px spinner. `ariaLabel` names the `role="progressbar"`.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-spinner',
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
imports: [MatProgressSpinnerModule],
|
|
17
|
+
template: `
|
|
18
|
+
<mat-progress-spinner
|
|
19
|
+
[mode]="mode()"
|
|
20
|
+
[diameter]="diameter()"
|
|
21
|
+
[value]="value()"
|
|
22
|
+
[attr.aria-label]="ariaLabel()"
|
|
23
|
+
/>
|
|
24
|
+
`,
|
|
25
|
+
})
|
|
26
|
+
export class SpinnerComponent {
|
|
27
|
+
readonly diameter = input<number>(24);
|
|
28
|
+
readonly mode = input<ProgressSpinnerMode>('indeterminate');
|
|
29
|
+
|
|
30
|
+
/** Progress value (0–100) used only when `mode` is `determinate`. */
|
|
31
|
+
readonly value = input<number>(0);
|
|
32
|
+
|
|
33
|
+
/** Accessible name announced by assistive tech. */
|
|
34
|
+
readonly ariaLabel = input<string>('Loading', { alias: 'aria-label' });
|
|
35
|
+
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
7
|
|
|
3
8
|
@Component({
|
|
4
9
|
selector: 'app-home',
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5
11
|
templateUrl: './home.component.html',
|
|
6
12
|
})
|
|
7
13
|
export class HomeComponent {}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
7
|
import { RouterLink } from '@angular/router';
|
|
3
8
|
|
|
4
9
|
@Component({
|
|
5
10
|
selector: 'app-not-found',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
6
12
|
imports: [RouterLink],
|
|
7
13
|
templateUrl: './not-found.component.html',
|
|
8
14
|
})
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
import { effect, Injector, signal, type Signal } from '@angular/core';
|
|
7
|
+
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
8
|
+
import { from, of, switchMap } from 'rxjs';
|
|
9
|
+
import { catchError, map, tap } from 'rxjs/operators';
|
|
10
|
+
|
|
11
|
+
/** Reactive async-data snapshot: current data, loading, and error. */
|
|
12
|
+
export interface AsyncData<T> {
|
|
13
|
+
/** Latest successful result. Kept visible during a refetch. */
|
|
14
|
+
readonly data: Signal<T | null>;
|
|
15
|
+
/** True while a fetch for the current args is in flight. */
|
|
16
|
+
readonly loading: Signal<boolean>;
|
|
17
|
+
/** Error message from the most recent failed fetch, else null. */
|
|
18
|
+
readonly error: Signal<string | null>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Angular analogue of the React `useAsyncData` hook.
|
|
23
|
+
*
|
|
24
|
+
* Re-runs `fetcher(args)` whenever the `args` signal changes, using RxJS
|
|
25
|
+
* `switchMap` so an in-flight request is cancelled (ignored) when newer args
|
|
26
|
+
* arrive — the latest-wins guarantee, matching the React hook's cleanup flag.
|
|
27
|
+
*
|
|
28
|
+
* Behavioural parity notes:
|
|
29
|
+
* - `loading` flips true the instant args change and false when the matching
|
|
30
|
+
* response resolves.
|
|
31
|
+
* - `data` retains the previous result while a refetch is in flight (avoids a
|
|
32
|
+
* flash of empty state); it only resets to `null` on error.
|
|
33
|
+
* - Errors are surfaced as a message string and logged, mirroring the hook.
|
|
34
|
+
*
|
|
35
|
+
* Must be called within an injection context (component/service constructor or
|
|
36
|
+
* field initializer) unless an `injector` is supplied.
|
|
37
|
+
*
|
|
38
|
+
* @param argsSignal - Reactive inputs; a change triggers a refetch.
|
|
39
|
+
* @param fetcher - Async function producing the result for the given args.
|
|
40
|
+
* @param injector - Optional injector when called outside an injection context.
|
|
41
|
+
*/
|
|
42
|
+
export function createAsyncData<TArgs, T>(
|
|
43
|
+
argsSignal: Signal<TArgs>,
|
|
44
|
+
fetcher: (args: TArgs) => Promise<T>,
|
|
45
|
+
injector?: Injector,
|
|
46
|
+
): AsyncData<T> {
|
|
47
|
+
const data = signal<T | null>(null);
|
|
48
|
+
const error = signal<string | null>(null);
|
|
49
|
+
// A fetch is pending from the moment args change until its response lands.
|
|
50
|
+
const pending = signal(true);
|
|
51
|
+
|
|
52
|
+
const args$ = toObservable(argsSignal, injector ? { injector } : undefined);
|
|
53
|
+
|
|
54
|
+
const result = toSignal(
|
|
55
|
+
args$.pipe(
|
|
56
|
+
// Mark loading + clear stale error synchronously as new args arrive.
|
|
57
|
+
tap(() => {
|
|
58
|
+
pending.set(true);
|
|
59
|
+
error.set(null);
|
|
60
|
+
}),
|
|
61
|
+
switchMap((args) =>
|
|
62
|
+
from(fetcher(args)).pipe(
|
|
63
|
+
map((value) => ({ value, err: null as string | null })),
|
|
64
|
+
catchError((err: unknown) => {
|
|
65
|
+
console.error(err);
|
|
66
|
+
return of({
|
|
67
|
+
value: null as T | null,
|
|
68
|
+
err: err instanceof Error ? err.message : 'An error occurred',
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
73
|
+
tap((outcome) => {
|
|
74
|
+
if (outcome.err !== null) {
|
|
75
|
+
error.set(outcome.err);
|
|
76
|
+
data.set(null);
|
|
77
|
+
} else {
|
|
78
|
+
data.set(outcome.value);
|
|
79
|
+
}
|
|
80
|
+
pending.set(false);
|
|
81
|
+
}),
|
|
82
|
+
),
|
|
83
|
+
{ initialValue: null, ...(injector ? { injector } : {}) },
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// Keep `result` subscribed so the pipeline runs even if no template reads it.
|
|
87
|
+
effect(
|
|
88
|
+
() => {
|
|
89
|
+
result();
|
|
90
|
+
},
|
|
91
|
+
injector ? { injector } : undefined,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
data: data.asReadonly(),
|
|
96
|
+
loading: pending.asReadonly(),
|
|
97
|
+
error: error.asReadonly(),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<base href="/" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
8
|
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
9
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
|
9
10
|
</head>
|
|
10
11
|
<body>
|
|
11
12
|
<app-root></app-root>
|