@sneat/space-components 0.2.0
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/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/avatar/avatar.component.js +15 -0
- package/esm2022/lib/avatar/avatar.component.js.map +1 -0
- package/esm2022/lib/index.js +13 -0
- package/esm2022/lib/index.js.map +1 -0
- package/esm2022/lib/space-base-component.directive.js +350 -0
- package/esm2022/lib/space-base-component.directive.js.map +1 -0
- package/esm2022/lib/space-component-base-params.service.js +22 -0
- package/esm2022/lib/space-component-base-params.service.js.map +1 -0
- package/esm2022/lib/space-item-page-base.component.js +121 -0
- package/esm2022/lib/space-item-page-base.component.js.map +1 -0
- package/esm2022/lib/space-items-base.component.js +8 -0
- package/esm2022/lib/space-items-base.component.js.map +1 -0
- package/esm2022/lib/space-menu/index.js +2 -0
- package/esm2022/lib/space-menu/index.js.map +1 -0
- package/esm2022/lib/space-menu/space-menu.component.js +119 -0
- package/esm2022/lib/space-menu/space-menu.component.js.map +1 -0
- package/esm2022/lib/space-module-base.component.js +28 -0
- package/esm2022/lib/space-module-base.component.js.map +1 -0
- package/esm2022/lib/space-page-base-component.service.js +11 -0
- package/esm2022/lib/space-page-base-component.service.js.map +1 -0
- package/esm2022/lib/space-page-title/space-page-title.component.js +27 -0
- package/esm2022/lib/space-page-title/space-page-title.component.js.map +1 -0
- package/esm2022/lib/spaces-card/index.js +2 -0
- package/esm2022/lib/spaces-card/index.js.map +1 -0
- package/esm2022/lib/spaces-card/spaces-card.component.js +208 -0
- package/esm2022/lib/spaces-card/spaces-card.component.js.map +1 -0
- package/esm2022/lib/spaces-list/index.js +2 -0
- package/esm2022/lib/spaces-list/index.js.map +1 -0
- package/esm2022/lib/spaces-list/spaces-list.component.js +111 -0
- package/esm2022/lib/spaces-list/spaces-list.component.js.map +1 -0
- package/esm2022/lib/spaces-menu/index.js +2 -0
- package/esm2022/lib/spaces-menu/index.js.map +1 -0
- package/esm2022/lib/spaces-menu/spaces-menu.component.js +105 -0
- package/esm2022/lib/spaces-menu/spaces-menu.component.js.map +1 -0
- package/esm2022/sneat-space-components.js +5 -0
- package/esm2022/sneat-space-components.js.map +1 -0
- package/index.d.ts +1 -0
- package/lib/avatar/avatar.component.d.ts +7 -0
- package/lib/index.d.ts +12 -0
- package/lib/space-base-component.directive.d.ts +68 -0
- package/lib/space-component-base-params.service.d.ts +15 -0
- package/lib/space-item-page-base.component.d.ts +22 -0
- package/lib/space-items-base.component.d.ts +4 -0
- package/lib/space-menu/index.d.ts +1 -0
- package/lib/space-menu/space-menu.component.d.ts +19 -0
- package/lib/space-module-base.component.d.ts +10 -0
- package/lib/space-page-base-component.service.d.ts +6 -0
- package/lib/space-page-title/space-page-title.component.d.ts +11 -0
- package/lib/spaces-card/index.d.ts +1 -0
- package/lib/spaces-card/spaces-card.component.d.ts +33 -0
- package/lib/spaces-list/index.d.ts +1 -0
- package/lib/spaces-list/spaces-list.component.d.ts +22 -0
- package/lib/spaces-menu/index.d.ts +1 -0
- package/lib/spaces-menu/spaces-menu.component.d.ts +22 -0
- package/package.json +27 -0
- package/sneat-space-components.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { TitleCasePipe } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, inject, } from '@angular/core';
|
|
3
|
+
import { RouterLink } from '@angular/router';
|
|
4
|
+
import { IonBadge, IonIcon, IonItem, IonLabel, IonSpinner, } from '@ionic/angular/standalone';
|
|
5
|
+
import { UserRequiredFieldsService } from '@sneat/auth-ui';
|
|
6
|
+
import { SpaceNavService, SpaceService } from '@sneat/space-services';
|
|
7
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
8
|
+
import { ClassName, SneatBaseComponent } from '@sneat/ui';
|
|
9
|
+
import { first } from 'rxjs';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
export class SpacesListComponent extends SneatBaseComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.userService = inject(SneatUserService);
|
|
15
|
+
this.spaceNavService = inject(SpaceNavService);
|
|
16
|
+
this.spaceService = inject(SpaceService);
|
|
17
|
+
this.userRequiredFieldsService = inject(UserRequiredFieldsService);
|
|
18
|
+
this.pathPrefix = '/space';
|
|
19
|
+
// Outputs
|
|
20
|
+
this.beforeNavigateToSpace = new EventEmitter();
|
|
21
|
+
}
|
|
22
|
+
goSpace(event, space) {
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
if (space.id) {
|
|
26
|
+
this.navigateToSpace(space);
|
|
27
|
+
}
|
|
28
|
+
else if (space.type) {
|
|
29
|
+
this.createNewSpace(space.type);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
navigateToSpace(space) {
|
|
34
|
+
this.beforeNavigateToSpace.emit(space);
|
|
35
|
+
this.spaceNavService
|
|
36
|
+
.navigateToSpace(space)
|
|
37
|
+
.catch(this.errorLogger.logErrorHandler('Failed to navigate to teams overview page from teams menu'));
|
|
38
|
+
}
|
|
39
|
+
createNewSpace(type) {
|
|
40
|
+
const request = {
|
|
41
|
+
type,
|
|
42
|
+
};
|
|
43
|
+
this.userService.userState
|
|
44
|
+
.pipe(first(), this.takeUntilDestroyed())
|
|
45
|
+
.subscribe({
|
|
46
|
+
next: (userState) => {
|
|
47
|
+
if (userState.record) {
|
|
48
|
+
this.createSpace(request);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.userRequiredFieldsService
|
|
52
|
+
.open()
|
|
53
|
+
.then((modalResult) => {
|
|
54
|
+
if (modalResult) {
|
|
55
|
+
this.createSpace(request);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
.catch(this.errorLogger.logErrorHandler('Failed to open user required fields modal'));
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
// this.closeMenu();
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
createSpace(request) {
|
|
66
|
+
this.spaceService
|
|
67
|
+
.createSpace(request)
|
|
68
|
+
.pipe(this.takeUntilDestroyed())
|
|
69
|
+
.subscribe({
|
|
70
|
+
next: (value) => {
|
|
71
|
+
this.navigateToSpace(value);
|
|
72
|
+
},
|
|
73
|
+
error: this.errorLogger.logErrorHandler('failed to create a new family team'),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SpacesListComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: SpacesListComponent, isStandalone: true, selector: "sneat-spaces-list", inputs: { userID: "userID", spaces: "spaces", pathPrefix: "pathPrefix" }, outputs: { beforeNavigateToSpace: "beforeNavigateToSpace" }, providers: [
|
|
78
|
+
{
|
|
79
|
+
provide: ClassName,
|
|
80
|
+
useValue: 'SpacesListComponent',
|
|
81
|
+
},
|
|
82
|
+
], usesInheritance: true, ngImport: i0, template: "@for (space of spaces; track space.id; let last = $last) {\n <ion-item\n tappable=\"true\"\n [disabled]=\"!space.brief\"\n [lines]=\"last ? 'full' : 'inset'\"\n routerLink=\"{{ pathPrefix }}/{{ space.type }}/{{ space.id }}\"\n (click)=\"goSpace($event, space)\"\n >\n <ion-icon\n [name]=\"\n space.type === 'family'\n ? 'people-outline'\n : space.type === 'private'\n ? 'person-circle-outline'\n : 'people-outline'\n \"\n slot=\"start\"\n />\n <ion-label class=\"ion-text-wrap\">\n {{ space.brief?.title || (space.type | titlecase) || space.id }}\n @if (!space.id && space.brief) {\n <ion-badge color=\"light\">(new)</ion-badge>\n }\n </ion-label>\n @if (!space.id && !space.brief) {\n <ion-spinner name=\"lines-small\" />\n }\n </ion-item>\n}\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonBadge, selector: "ion-badge", inputs: ["color", "mode"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SpacesListComponent, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{ selector: 'sneat-spaces-list', imports: [
|
|
87
|
+
RouterLink,
|
|
88
|
+
TitleCasePipe,
|
|
89
|
+
IonItem,
|
|
90
|
+
IonIcon,
|
|
91
|
+
IonLabel,
|
|
92
|
+
IonBadge,
|
|
93
|
+
IonSpinner,
|
|
94
|
+
], providers: [
|
|
95
|
+
{
|
|
96
|
+
provide: ClassName,
|
|
97
|
+
useValue: 'SpacesListComponent',
|
|
98
|
+
},
|
|
99
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (space of spaces; track space.id; let last = $last) {\n <ion-item\n tappable=\"true\"\n [disabled]=\"!space.brief\"\n [lines]=\"last ? 'full' : 'inset'\"\n routerLink=\"{{ pathPrefix }}/{{ space.type }}/{{ space.id }}\"\n (click)=\"goSpace($event, space)\"\n >\n <ion-icon\n [name]=\"\n space.type === 'family'\n ? 'people-outline'\n : space.type === 'private'\n ? 'person-circle-outline'\n : 'people-outline'\n \"\n slot=\"start\"\n />\n <ion-label class=\"ion-text-wrap\">\n {{ space.brief?.title || (space.type | titlecase) || space.id }}\n @if (!space.id && space.brief) {\n <ion-badge color=\"light\">(new)</ion-badge>\n }\n </ion-label>\n @if (!space.id && !space.brief) {\n <ion-spinner name=\"lines-small\" />\n }\n </ion-item>\n}\n" }]
|
|
100
|
+
}], propDecorators: { userID: [{
|
|
101
|
+
type: Input,
|
|
102
|
+
args: [{ required: true }]
|
|
103
|
+
}], spaces: [{
|
|
104
|
+
type: Input,
|
|
105
|
+
args: [{ required: true }]
|
|
106
|
+
}], pathPrefix: [{
|
|
107
|
+
type: Input
|
|
108
|
+
}], beforeNavigateToSpace: [{
|
|
109
|
+
type: Output
|
|
110
|
+
}] } });
|
|
111
|
+
//# sourceMappingURL=spaces-list.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaces-list.component.js","sourceRoot":"","sources":["../../../../../../../libs/space/components/src/lib/spaces-list/spaces-list.component.ts","../../../../../../../libs/space/components/src/lib/spaces-list/spaces-list.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;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P,QAAQ;wBACR,QAAQ;wBACR,UAAU;qBACX,aACU;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,qBAAqB;yBAChC;qBACF,mBACgB,uBAAuB,CAAC,MAAM;;sBAW9C,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,KAAK;;sBAGL,MAAM","sourcesContent":["import { TitleCasePipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n inject,\n} from '@angular/core';\nimport { RouterLink } from '@angular/router';\nimport {\n IonBadge,\n IonIcon,\n IonItem,\n IonLabel,\n IonSpinner,\n} from '@ionic/angular/standalone';\nimport { UserRequiredFieldsService } from '@sneat/auth-ui';\nimport { SpaceType } from '@sneat/core';\nimport { ICreateSpaceRequest, ISpaceContext } from '@sneat/space-models';\nimport { SpaceNavService, SpaceService } from '@sneat/space-services';\nimport { SneatUserService } from '@sneat/auth-core';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { first } from 'rxjs';\n\n@Component({\n selector: 'sneat-spaces-list',\n templateUrl: 'spaces-list.component.html',\n imports: [\n RouterLink,\n TitleCasePipe,\n IonItem,\n IonIcon,\n IonLabel,\n IonBadge,\n IonSpinner,\n ],\n providers: [\n {\n provide: ClassName,\n useValue: 'SpacesListComponent',\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SpacesListComponent extends SneatBaseComponent {\n public readonly userService = inject(SneatUserService);\n private readonly spaceNavService = inject(SpaceNavService);\n private readonly spaceService = inject(SpaceService);\n private readonly userRequiredFieldsService = inject(\n UserRequiredFieldsService,\n );\n\n // Inputs\n @Input({ required: true }) userID?: string;\n @Input({ required: true }) spaces?: ISpaceContext[];\n @Input() pathPrefix = '/space';\n\n // Outputs\n @Output() readonly beforeNavigateToSpace = new EventEmitter<ISpaceContext>();\n\n protected goSpace(event: Event, space: ISpaceContext): boolean {\n event.stopPropagation();\n event.preventDefault();\n if (space.id) {\n this.navigateToSpace(space);\n } else if (space.type) {\n this.createNewSpace(space.type);\n }\n return false;\n }\n\n private navigateToSpace(space: ISpaceContext): void {\n this.beforeNavigateToSpace.emit(space);\n this.spaceNavService\n .navigateToSpace(space)\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to navigate to teams overview page from teams menu',\n ),\n );\n }\n\n protected createNewSpace(type: SpaceType): boolean {\n const request: ICreateSpaceRequest = {\n type,\n };\n\n this.userService.userState\n .pipe(first(), this.takeUntilDestroyed())\n .subscribe({\n next: (userState) => {\n if (userState.record) {\n this.createSpace(request);\n } else {\n this.userRequiredFieldsService\n .open()\n .then((modalResult) => {\n if (modalResult) {\n this.createSpace(request);\n }\n })\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to open user required fields modal',\n ),\n );\n }\n },\n });\n // this.closeMenu();\n return false;\n }\n\n private createSpace(request: ICreateSpaceRequest): void {\n this.spaceService\n .createSpace(request)\n .pipe(this.takeUntilDestroyed())\n .subscribe({\n next: (value) => {\n this.navigateToSpace(value);\n },\n error: this.errorLogger.logErrorHandler(\n 'failed to create a new family team',\n ),\n });\n }\n}\n","@for (space of spaces; track space.id; let last = $last) {\n <ion-item\n tappable=\"true\"\n [disabled]=\"!space.brief\"\n [lines]=\"last ? 'full' : 'inset'\"\n routerLink=\"{{ pathPrefix }}/{{ space.type }}/{{ space.id }}\"\n (click)=\"goSpace($event, space)\"\n >\n <ion-icon\n [name]=\"\n space.type === 'family'\n ? 'people-outline'\n : space.type === 'private'\n ? 'person-circle-outline'\n : 'people-outline'\n \"\n slot=\"start\"\n />\n <ion-label class=\"ion-text-wrap\">\n {{ space.brief?.title || (space.type | titlecase) || space.id }}\n @if (!space.id && space.brief) {\n <ion-badge color=\"light\">(new)</ion-badge>\n }\n </ion-label>\n @if (!space.id && !space.brief) {\n <ion-spinner name=\"lines-small\" />\n }\n </ion-item>\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/space/components/src/lib/spaces-menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './spaces-menu.component';\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, Input, signal, inject, } from '@angular/core';
|
|
2
|
+
import { IonIcon, IonItem, IonLabel, MenuController, NavController, } from '@ionic/angular/standalone';
|
|
3
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
4
|
+
import { UserRequiredFieldsService } from '@sneat/auth-ui';
|
|
5
|
+
import { spaceContextFromBrief, zipMapBriefsWithIDs, } from '@sneat/space-models';
|
|
6
|
+
import { ClassName, SneatBaseComponent } from '@sneat/ui';
|
|
7
|
+
import { SpacesListComponent } from '../spaces-list';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export class SpacesMenuComponent extends SneatBaseComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.userService = inject(SneatUserService);
|
|
13
|
+
this.navController = inject(NavController);
|
|
14
|
+
this.menuController = inject(MenuController);
|
|
15
|
+
this.spacesLabel = 'Spaces';
|
|
16
|
+
this.pathPrefix = '/space';
|
|
17
|
+
this.$userSpaces = signal(undefined, ...(ngDevMode ? [{ debugName: "$userSpaces" }] : []));
|
|
18
|
+
this.$userID = signal('', ...(ngDevMode ? [{ debugName: "$userID" }] : []));
|
|
19
|
+
this.$spacesToShow = computed(() => {
|
|
20
|
+
const userSpaces = this.$userSpaces();
|
|
21
|
+
const spaces = (this.spaceType
|
|
22
|
+
? userSpaces?.filter((t) => t.type === this.spaceType)
|
|
23
|
+
: userSpaces) || [];
|
|
24
|
+
if (!this.spaceType) {
|
|
25
|
+
const addPseudoSpace = (type) => {
|
|
26
|
+
if (!spaces.some((t) => t.type === type)) {
|
|
27
|
+
spaces.push({
|
|
28
|
+
id: '',
|
|
29
|
+
type,
|
|
30
|
+
brief: userSpaces
|
|
31
|
+
? {
|
|
32
|
+
type,
|
|
33
|
+
title: '',
|
|
34
|
+
}
|
|
35
|
+
: undefined, // define brief indicates we have user record loaded
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
addPseudoSpace('family');
|
|
40
|
+
addPseudoSpace('private');
|
|
41
|
+
}
|
|
42
|
+
const sortOrder = {
|
|
43
|
+
family: 1,
|
|
44
|
+
private: 2,
|
|
45
|
+
};
|
|
46
|
+
spaces.sort((a, b) => {
|
|
47
|
+
// Determine the sorting priority (lower values mean higher priority)
|
|
48
|
+
const priorityA = (a.type && sortOrder[a.type]) ?? 3; // Default to 3 for all other types
|
|
49
|
+
const priorityB = (b.type && sortOrder[b.type]) ?? 3;
|
|
50
|
+
// Compare priority first
|
|
51
|
+
if (priorityA !== priorityB) {
|
|
52
|
+
return priorityA - priorityB;
|
|
53
|
+
}
|
|
54
|
+
// If same priority, sort by title alphabetically
|
|
55
|
+
return a.brief?.title.localeCompare(b.brief?.title || '') || 0;
|
|
56
|
+
});
|
|
57
|
+
return spaces;
|
|
58
|
+
}, ...(ngDevMode ? [{ debugName: "$spacesToShow" }] : []));
|
|
59
|
+
this.onUserStateChanged = (user) => {
|
|
60
|
+
this.$userID.set(user.user?.uid || '');
|
|
61
|
+
if (!user?.record) {
|
|
62
|
+
this.$userSpaces.set(undefined);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.$userSpaces.set(user?.record?.spaces
|
|
66
|
+
? zipMapBriefsWithIDs(user?.record?.spaces).map((t) => spaceContextFromBrief(t.id, t.brief))
|
|
67
|
+
: []);
|
|
68
|
+
};
|
|
69
|
+
this.$familySpace = signal(undefined, ...(ngDevMode ? [{ debugName: "$familySpace" }] : []));
|
|
70
|
+
const userService = this.userService;
|
|
71
|
+
userService.userState.pipe(this.takeUntilDestroyed()).subscribe({
|
|
72
|
+
next: this.onUserStateChanged,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
closeMenu() {
|
|
76
|
+
this.menuController
|
|
77
|
+
.close()
|
|
78
|
+
.catch(this.errorLogger.logErrorHandler('Failed to close teams menu'));
|
|
79
|
+
}
|
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SpacesMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
81
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: SpacesMenuComponent, isStandalone: true, selector: "sneat-spaces-menu", inputs: { spacesLabel: "spacesLabel", pathPrefix: "pathPrefix", spaceType: "spaceType" }, providers: [
|
|
82
|
+
{
|
|
83
|
+
provide: ClassName,
|
|
84
|
+
useValue: 'SpacesMenuComponent',
|
|
85
|
+
},
|
|
86
|
+
UserRequiredFieldsService,
|
|
87
|
+
], usesInheritance: true, ngImport: i0, template: "<ion-item>\n <ion-label color=\"medium\" style=\"font-weight: bold\">{{\n spacesLabel || \"Spaces\"\n }}</ion-label>\n</ion-item>\n\n@if ($spacesToShow().length) {\n <sneat-spaces-list\n [spaces]=\"$spacesToShow()\"\n [userID]=\"$userID()\"\n (beforeNavigateToSpace)=\"closeMenu()\"\n />\n} @else if (spaceType) {\n <ion-item>\n <ion-icon name=\"people-outline\" slot=\"start\" />\n <ion-label color=\"medium\">\n @if (spaceType === \"company\") {\n No companies\n } @else {\n No {{ spaceType }}\n }\n </ion-label>\n </ion-item>\n}\n", dependencies: [{ kind: "component", type: SpacesListComponent, selector: "sneat-spaces-list", inputs: ["userID", "spaces", "pathPrefix"], outputs: ["beforeNavigateToSpace"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
88
|
+
}
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SpacesMenuComponent, decorators: [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{ selector: 'sneat-spaces-menu', imports: [SpacesListComponent, IonItem, IonLabel, IonIcon], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
92
|
+
{
|
|
93
|
+
provide: ClassName,
|
|
94
|
+
useValue: 'SpacesMenuComponent',
|
|
95
|
+
},
|
|
96
|
+
UserRequiredFieldsService,
|
|
97
|
+
], template: "<ion-item>\n <ion-label color=\"medium\" style=\"font-weight: bold\">{{\n spacesLabel || \"Spaces\"\n }}</ion-label>\n</ion-item>\n\n@if ($spacesToShow().length) {\n <sneat-spaces-list\n [spaces]=\"$spacesToShow()\"\n [userID]=\"$userID()\"\n (beforeNavigateToSpace)=\"closeMenu()\"\n />\n} @else if (spaceType) {\n <ion-item>\n <ion-icon name=\"people-outline\" slot=\"start\" />\n <ion-label color=\"medium\">\n @if (spaceType === \"company\") {\n No companies\n } @else {\n No {{ spaceType }}\n }\n </ion-label>\n </ion-item>\n}\n" }]
|
|
98
|
+
}], ctorParameters: () => [], propDecorators: { spacesLabel: [{
|
|
99
|
+
type: Input
|
|
100
|
+
}], pathPrefix: [{
|
|
101
|
+
type: Input
|
|
102
|
+
}], spaceType: [{
|
|
103
|
+
type: Input
|
|
104
|
+
}] } });
|
|
105
|
+
//# sourceMappingURL=spaces-menu.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaces-menu.component.js","sourceRoot":"","sources":["../../../../../../../libs/space/components/src/lib/spaces-menu/spaces-menu.component.ts","../../../../../../../libs/space/components/src/lib/spaces-menu/spaces-menu.component.html"],"names":[],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2FAU9C,mBAAmB;kBAb/B,SAAS;+BACE,mBAAmB,WAEpB,CAAC,mBAAmB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,mBACzC,uBAAuB,CAAC,MAAM,aACpC;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,qBAAqB;yBAChC;wBACD,yBAAyB;qBAC1B;;sBAOA,KAAK;;sBACL,KAAK;;sBAEL,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n Input,\n signal,\n inject,\n} from '@angular/core';\nimport {\n IonIcon,\n IonItem,\n IonLabel,\n MenuController,\n NavController,\n} from '@ionic/angular/standalone';\nimport { ISneatUserState, SneatUserService } from '@sneat/auth-core';\nimport { UserRequiredFieldsService } from '@sneat/auth-ui';\nimport { SpaceType } from '@sneat/core';\nimport {\n ISpaceContext,\n spaceContextFromBrief,\n zipMapBriefsWithIDs,\n} from '@sneat/space-models';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { SpacesListComponent } from '../spaces-list';\n\n@Component({\n selector: 'sneat-spaces-menu',\n templateUrl: './spaces-menu.component.html',\n imports: [SpacesListComponent, IonItem, IonLabel, IonIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: ClassName,\n useValue: 'SpacesMenuComponent',\n },\n UserRequiredFieldsService,\n ],\n})\nexport class SpacesMenuComponent extends SneatBaseComponent {\n readonly userService = inject(SneatUserService);\n private readonly navController = inject(NavController);\n private readonly menuController = inject(MenuController);\n\n @Input() spacesLabel = 'Spaces';\n @Input() pathPrefix = '/space';\n\n @Input() spaceType?: SpaceType;\n\n protected readonly $userSpaces = signal<ISpaceContext[] | undefined>(\n undefined,\n );\n\n protected readonly $userID = signal<string>('');\n\n protected readonly $spacesToShow = computed<ISpaceContext[]>(() => {\n const userSpaces = this.$userSpaces();\n const spaces =\n (this.spaceType\n ? userSpaces?.filter((t) => t.type === this.spaceType)\n : userSpaces) || [];\n if (!this.spaceType) {\n const addPseudoSpace = (type: 'family' | 'private'): void => {\n if (!spaces.some((t) => t.type === type)) {\n spaces.push({\n id: '',\n type,\n brief: userSpaces\n ? {\n type,\n title: '',\n }\n : undefined, // define brief indicates we have user record loaded\n });\n }\n };\n addPseudoSpace('family');\n addPseudoSpace('private');\n }\n const sortOrder: Record<string, number> = {\n family: 1,\n private: 2,\n };\n spaces.sort((a: ISpaceContext, b: ISpaceContext) => {\n // Determine the sorting priority (lower values mean higher priority)\n const priorityA = (a.type && sortOrder[a.type]) ?? 3; // Default to 3 for all other types\n const priorityB = (b.type && sortOrder[b.type]) ?? 3;\n\n // Compare priority first\n if (priorityA !== priorityB) {\n return priorityA - priorityB;\n }\n\n // If same priority, sort by title alphabetically\n return a.brief?.title.localeCompare(b.brief?.title || '') || 0;\n });\n return spaces;\n });\n\n private onUserStateChanged = (user: ISneatUserState): void => {\n this.$userID.set(user.user?.uid || '');\n if (!user?.record) {\n this.$userSpaces.set(undefined);\n return;\n }\n\n this.$userSpaces.set(\n user?.record?.spaces\n ? zipMapBriefsWithIDs(user?.record?.spaces).map((t) =>\n spaceContextFromBrief(t.id, t.brief),\n )\n : [],\n );\n };\n\n protected readonly $familySpace = signal<ISpaceContext | undefined>(\n undefined,\n );\n\n constructor() {\n super();\n const userService = this.userService;\n\n userService.userState.pipe(this.takeUntilDestroyed()).subscribe({\n next: this.onUserStateChanged,\n });\n }\n\n protected closeMenu(): void {\n this.menuController\n .close()\n .catch(this.errorLogger.logErrorHandler('Failed to close teams menu'));\n }\n}\n","<ion-item>\n <ion-label color=\"medium\" style=\"font-weight: bold\">{{\n spacesLabel || \"Spaces\"\n }}</ion-label>\n</ion-item>\n\n@if ($spacesToShow().length) {\n <sneat-spaces-list\n [spaces]=\"$spacesToShow()\"\n [userID]=\"$userID()\"\n (beforeNavigateToSpace)=\"closeMenu()\"\n />\n} @else if (spaceType) {\n <ion-item>\n <ion-icon name=\"people-outline\" slot=\"start\" />\n <ion-label color=\"medium\">\n @if (spaceType === \"company\") {\n No companies\n } @else {\n No {{ spaceType }}\n }\n </ion-label>\n </ion-item>\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sneat-space-components.js","sourceRoot":"","sources":["../../../../../libs/space/components/src/sneat-space-components.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IAvatar } from '@sneat/auth-models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AvatarComponent {
|
|
4
|
+
avatar?: IAvatar;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvatarComponent, never>;
|
|
6
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvatarComponent, "sneat-avatar", never, { "avatar": { "alias": "avatar"; "required": true; }; }, {}, never, never, true, never>;
|
|
7
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './avatar/avatar.component';
|
|
2
|
+
export * from './space-menu';
|
|
3
|
+
export * from './spaces-menu';
|
|
4
|
+
export * from './space-page-title/space-page-title.component';
|
|
5
|
+
export * from './space-page-base-component.service';
|
|
6
|
+
export * from './space-component-base-params.service';
|
|
7
|
+
export * from './space-item-page-base.component';
|
|
8
|
+
export * from './space-items-base.component';
|
|
9
|
+
export * from './spaces-list';
|
|
10
|
+
export * from './spaces-card';
|
|
11
|
+
export * from './space-module-base.component';
|
|
12
|
+
export * from './space-base-component.directive';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, ParamMap } from '@angular/router';
|
|
3
|
+
import { NavController } from '@ionic/angular/standalone';
|
|
4
|
+
import { ILogger, ISpaceRef, SpaceType } from '@sneat/core';
|
|
5
|
+
import { ISpaceBrief, ISpaceDbo } from '@sneat/dto';
|
|
6
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
7
|
+
import { SpaceService } from '@sneat/space-services';
|
|
8
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
9
|
+
import { SneatBaseComponent } from '@sneat/ui';
|
|
10
|
+
import { MonoTypeOperatorFunction, Observable, Subject } from 'rxjs';
|
|
11
|
+
import { SpaceComponentBaseParams } from './space-component-base-params.service';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
type NavigationOptions = NonNullable<Parameters<NavController['navigateRoot']>[1]>;
|
|
14
|
+
export declare abstract class SpaceBaseComponent extends SneatBaseComponent implements OnInit {
|
|
15
|
+
protected readonly $spaceRef: import("@angular/core").WritableSignal<ISpaceRef | null | undefined>;
|
|
16
|
+
private readonly $spaceBrief;
|
|
17
|
+
private readonly $spaceDbo;
|
|
18
|
+
protected readonly $spaceID: import("@angular/core").Signal<string | undefined>;
|
|
19
|
+
protected readonly $spaceType: import("@angular/core").Signal<SpaceType | undefined>;
|
|
20
|
+
protected readonly $space: import("@angular/core").Signal<ISpaceContext>;
|
|
21
|
+
private readonly spaceIDChanged;
|
|
22
|
+
private readonly spaceTypeChanged;
|
|
23
|
+
protected takeUntilSpaceIdChanged<T>(): MonoTypeOperatorFunction<T>;
|
|
24
|
+
protected noPermissions: boolean;
|
|
25
|
+
protected readonly spaceBriefChanged: Subject<ISpaceBrief | null | undefined>;
|
|
26
|
+
protected readonly spaceDboChanged: Subject<ISpaceDbo | null | undefined>;
|
|
27
|
+
private readonly spaceChanged;
|
|
28
|
+
protected readonly spaceChanged$: Observable<ISpaceContext>;
|
|
29
|
+
protected readonly navController: NavController;
|
|
30
|
+
protected readonly userService: SneatUserService;
|
|
31
|
+
protected readonly spaceService: SpaceService;
|
|
32
|
+
protected readonly logger: ILogger;
|
|
33
|
+
protected defaultBackPage?: string;
|
|
34
|
+
protected readonly spaceIDChanged$: Observable<string | undefined>;
|
|
35
|
+
protected readonly spaceTypeChanged$: Observable<SpaceType | undefined>;
|
|
36
|
+
protected readonly spaceBriefChanged$: Observable<ISpaceBrief | null | undefined>;
|
|
37
|
+
readonly spaceDboChanged$: Observable<ISpaceDbo | null | undefined>;
|
|
38
|
+
protected get space(): ISpaceContext;
|
|
39
|
+
protected get preloader(): import("@sneat/core").NgModulePreloaderService;
|
|
40
|
+
protected get spaceNav(): import("@sneat/space-services").SpaceNavService;
|
|
41
|
+
protected get currentUserId(): string | undefined;
|
|
42
|
+
protected readonly $defaultBackUrlSpacePath: import("@angular/core").WritableSignal<string>;
|
|
43
|
+
protected $defaultBackUrl: import("@angular/core").Signal<string>;
|
|
44
|
+
protected readonly route: ActivatedRoute;
|
|
45
|
+
protected readonly spaceParams: SpaceComponentBaseParams;
|
|
46
|
+
constructor();
|
|
47
|
+
ngOnInit(): void;
|
|
48
|
+
protected onUserIdChanged(): void;
|
|
49
|
+
protected navigateForwardToSpacePage(page: string, navOptions?: NavigationOptions): Promise<boolean>;
|
|
50
|
+
protected onSpaceIdChanged(): void;
|
|
51
|
+
protected onSpaceDboChanged(): void;
|
|
52
|
+
protected onRouteParamsChanged(params: ParamMap): void;
|
|
53
|
+
protected trackRouteParamMap(paramMap$: Observable<ParamMap>): void;
|
|
54
|
+
private trackSpaceIdFromRouteParams;
|
|
55
|
+
private readonly onSpaceIdChangedInUrl;
|
|
56
|
+
private subscribeForSpaceChanges;
|
|
57
|
+
private getSpaceContextFromRouteState;
|
|
58
|
+
private cleanupOnUserLogout;
|
|
59
|
+
protected setSpaceRef(spaceRef?: ISpaceRef): void;
|
|
60
|
+
private setSpaceContext;
|
|
61
|
+
private readonly onSpaceContextChanged;
|
|
62
|
+
protected saveNotes(event: Event): void;
|
|
63
|
+
protected spacePageUrl(page: string): string;
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpaceBaseComponent, never>;
|
|
65
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SpaceBaseComponent, never, never, {}, {}, never, never, true, never>;
|
|
66
|
+
}
|
|
67
|
+
export declare const spacePageUrl: (team?: ISpaceContext, page?: string) => string | undefined;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAppInfo, ILoggerFactory, NgModulePreloaderService } from '@sneat/core';
|
|
2
|
+
import { IErrorLogger } from '@sneat/core';
|
|
3
|
+
import { SpaceNavService } from '@sneat/space-services';
|
|
4
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class SpaceComponentBaseParams {
|
|
7
|
+
readonly errorLogger: IErrorLogger;
|
|
8
|
+
readonly loggerFactory: ILoggerFactory;
|
|
9
|
+
protected readonly appService: IAppInfo;
|
|
10
|
+
readonly userService: SneatUserService;
|
|
11
|
+
readonly spaceNavService: SpaceNavService;
|
|
12
|
+
readonly preloader: NgModulePreloaderService;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpaceComponentBaseParams, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SpaceComponentBaseParams>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ParamMap } from '@angular/router';
|
|
2
|
+
import { INavContext, SpaceItem } from '@sneat/core';
|
|
3
|
+
import { ISpaceItemNavContext } from '@sneat/space-models';
|
|
4
|
+
import { ModuleSpaceItemService } from '@sneat/space-services';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { SpacePageBaseComponent } from './space-page-base-component.service';
|
|
7
|
+
export declare abstract class SpaceItemPageBaseComponent<Brief, Dbo extends Brief> extends SpacePageBaseComponent {
|
|
8
|
+
private readonly itemName;
|
|
9
|
+
protected readonly spaceItemService: ModuleSpaceItemService<Brief, Dbo>;
|
|
10
|
+
protected readonly $item: import("@angular/core").WritableSignal<ISpaceItemNavContext<Brief, Dbo>>;
|
|
11
|
+
protected readonly $itemID: import("@angular/core").Signal<string>;
|
|
12
|
+
protected constructor(defaultBackPage: string, itemName: SpaceItem, spaceItemService: ModuleSpaceItemService<Brief, Dbo>);
|
|
13
|
+
protected setItemContext(item?: ISpaceItemNavContext<Brief, Dbo>): void;
|
|
14
|
+
protected abstract briefs(): Readonly<Record<string, Brief>> | undefined;
|
|
15
|
+
private itemSubscription?;
|
|
16
|
+
protected watchItemChanges(): Observable<INavContext<Brief, Dbo>>;
|
|
17
|
+
protected trackRouteParamMap(paramMap$: Observable<ParamMap>): void;
|
|
18
|
+
protected trackRouteParamItemID(paramMap$: Observable<ParamMap>): void;
|
|
19
|
+
protected getItemID$(paramMap$: Observable<ParamMap>): Observable<string>;
|
|
20
|
+
private onItemIDChanged;
|
|
21
|
+
private setBriefFromSpace;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './space-menu.component';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IUserSpaceBrief } from '@sneat/auth-models';
|
|
2
|
+
import { IIdAndBrief } from '@sneat/core';
|
|
3
|
+
import { SpaceBaseComponent } from '../space-base-component.directive';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SpaceMenuComponent extends SpaceBaseComponent {
|
|
6
|
+
protected readonly $spaces: import("@angular/core").WritableSignal<readonly IIdAndBrief<IUserSpaceBrief>[] | undefined>;
|
|
7
|
+
protected readonly $disabled: import("@angular/core").Signal<boolean>;
|
|
8
|
+
protected readonly $currentPage: import("@angular/core").WritableSignal<string>;
|
|
9
|
+
private readonly activatedRoute;
|
|
10
|
+
private readonly menuCtrl;
|
|
11
|
+
constructor();
|
|
12
|
+
protected goOverview(): boolean;
|
|
13
|
+
protected goSpacePage(event: Event, _p: string): boolean;
|
|
14
|
+
protected closeMenu(): void;
|
|
15
|
+
protected onSpaceSelected(event: Event): void;
|
|
16
|
+
private readonly onUserStateChanged;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpaceMenuComponent, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpaceMenuComponent, "sneat-space-menu", never, {}, {}, never, never, true, never>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { SpaceBaseComponent } from './space-base-component.directive';
|
|
3
|
+
import { SpaceModuleService } from '@sneat/space-services';
|
|
4
|
+
export declare abstract class SpaceModuleBaseComponent<Brief, Dbo extends Brief> extends SpaceBaseComponent {
|
|
5
|
+
protected spaceModuleService: SpaceModuleService<Dbo>;
|
|
6
|
+
protected readonly spaceModuleDbo$: BehaviorSubject<Dbo | null | undefined>;
|
|
7
|
+
constructor(spaceModuleService: SpaceModuleService<Dbo>);
|
|
8
|
+
protected onSpaceIdChanged(): void;
|
|
9
|
+
protected onSpaceModuleDboChanged(_dbo: Dbo | null): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SpaceBaseComponent } from './space-base-component.directive';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare abstract class SpacePageBaseComponent extends SpaceBaseComponent {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpacePageBaseComponent, never>;
|
|
5
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SpacePageBaseComponent>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SpacePageTitleComponent {
|
|
4
|
+
icon?: string;
|
|
5
|
+
generalTitle?: string;
|
|
6
|
+
space?: ISpaceContext;
|
|
7
|
+
titlesBySpaceType?: Record<string, string>;
|
|
8
|
+
get typeTitle(): string;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpacePageTitleComponent, never>;
|
|
10
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpacePageTitleComponent, "sneat-space-page-title", never, { "icon": { "alias": "icon"; "required": false; }; "generalTitle": { "alias": "generalTitle"; "required": false; }; "space": { "alias": "space"; "required": true; }; "titlesBySpaceType": { "alias": "titlesBySpaceType"; "required": false; }; }, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spaces-card.component';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { IonInput } from '@ionic/angular/standalone';
|
|
3
|
+
import { IUserSpaceBrief } from '@sneat/auth-models';
|
|
4
|
+
import { IIdAndBrief } from '@sneat/core';
|
|
5
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class SpacesCardComponent implements OnInit, OnDestroy {
|
|
8
|
+
private readonly errorLogger;
|
|
9
|
+
private readonly navService;
|
|
10
|
+
private readonly userService;
|
|
11
|
+
private readonly spaceService;
|
|
12
|
+
private readonly analyticsService;
|
|
13
|
+
private readonly toastController;
|
|
14
|
+
addSpaceInput?: IonInput;
|
|
15
|
+
spaces?: IIdAndBrief<IUserSpaceBrief>[];
|
|
16
|
+
loadingState: 'Authenticating' | 'Loading';
|
|
17
|
+
spaceName: string;
|
|
18
|
+
adding: boolean;
|
|
19
|
+
showAdd: boolean;
|
|
20
|
+
private readonly destroyed;
|
|
21
|
+
private subscriptions;
|
|
22
|
+
ngOnDestroy(): void;
|
|
23
|
+
ngOnInit(): void;
|
|
24
|
+
goSpace(space: ISpaceContext): void;
|
|
25
|
+
addSpace(): void;
|
|
26
|
+
startAddingSpace(): void;
|
|
27
|
+
leaveSpace(space: IIdAndBrief<IUserSpaceBrief>, event?: Event): void;
|
|
28
|
+
private watchUserRecord;
|
|
29
|
+
private unsubscribe;
|
|
30
|
+
private setUser;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpacesCardComponent, never>;
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpacesCardComponent, "sneat-spaces-card", never, {}, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spaces-list.component';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { SpaceType } from '@sneat/core';
|
|
3
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
4
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
5
|
+
import { SneatBaseComponent } from '@sneat/ui';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class SpacesListComponent extends SneatBaseComponent {
|
|
8
|
+
readonly userService: SneatUserService;
|
|
9
|
+
private readonly spaceNavService;
|
|
10
|
+
private readonly spaceService;
|
|
11
|
+
private readonly userRequiredFieldsService;
|
|
12
|
+
userID?: string;
|
|
13
|
+
spaces?: ISpaceContext[];
|
|
14
|
+
pathPrefix: string;
|
|
15
|
+
readonly beforeNavigateToSpace: EventEmitter<ISpaceContext>;
|
|
16
|
+
protected goSpace(event: Event, space: ISpaceContext): boolean;
|
|
17
|
+
private navigateToSpace;
|
|
18
|
+
protected createNewSpace(type: SpaceType): boolean;
|
|
19
|
+
private createSpace;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpacesListComponent, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpacesListComponent, "sneat-spaces-list", never, { "userID": { "alias": "userID"; "required": true; }; "spaces": { "alias": "spaces"; "required": true; }; "pathPrefix": { "alias": "pathPrefix"; "required": false; }; }, { "beforeNavigateToSpace": "beforeNavigateToSpace"; }, never, never, true, never>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spaces-menu.component';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
2
|
+
import { SpaceType } from '@sneat/core';
|
|
3
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
4
|
+
import { SneatBaseComponent } from '@sneat/ui';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class SpacesMenuComponent extends SneatBaseComponent {
|
|
7
|
+
readonly userService: SneatUserService;
|
|
8
|
+
private readonly navController;
|
|
9
|
+
private readonly menuController;
|
|
10
|
+
spacesLabel: string;
|
|
11
|
+
pathPrefix: string;
|
|
12
|
+
spaceType?: SpaceType;
|
|
13
|
+
protected readonly $userSpaces: import("@angular/core").WritableSignal<ISpaceContext[] | undefined>;
|
|
14
|
+
protected readonly $userID: import("@angular/core").WritableSignal<string>;
|
|
15
|
+
protected readonly $spacesToShow: import("@angular/core").Signal<ISpaceContext[]>;
|
|
16
|
+
private onUserStateChanged;
|
|
17
|
+
protected readonly $familySpace: import("@angular/core").WritableSignal<ISpaceContext | undefined>;
|
|
18
|
+
constructor();
|
|
19
|
+
protected closeMenu(): void;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SpacesMenuComponent, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpacesMenuComponent, "sneat-spaces-menu", never, { "spacesLabel": { "alias": "spacesLabel"; "required": false; }; "pathPrefix": { "alias": "pathPrefix"; "required": false; }; "spaceType": { "alias": "spaceType"; "required": false; }; }, {}, never, never, true, never>;
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sneat/space-components",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@angular/common": ">=21.0.0",
|
|
9
|
+
"@angular/core": ">=21.0.0",
|
|
10
|
+
"@ionic/angular": ">=8"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tslib": "2.8.1"
|
|
14
|
+
},
|
|
15
|
+
"module": "esm2022/sneat-space-components.js",
|
|
16
|
+
"typings": "sneat-space-components.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./sneat-space-components.d.ts",
|
|
23
|
+
"default": "./esm2022/sneat-space-components.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"sideEffects": false
|
|
27
|
+
}
|