@wawjs/ngx-bos 22.0.2 → 22.0.4
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/README.md +3 -3
- package/RELEASES.md +31 -19
- package/ai/architecture.md +40 -2
- package/ai/decisions/2026-06-02-version-start.md +1 -1
- package/fesm2022/wawjs-ngx-bos.mjs +82 -70
- package/fesm2022/wawjs-ngx-bos.mjs.map +1 -1
- package/package.json +10 -10
- package/src/feature/user/guards/admins.guard.ts +7 -1
- package/src/feature/user/guards/authenticated.guard.ts +9 -1
- package/src/feature/user/guards/guest.guard.ts +3 -2
- package/src/feature/user/pages/users/users.component.html +3 -3
- package/src/feature/user/pages/users/users.component.scss +12 -12
- package/src/feature/user/pages/users/users.component.ts +42 -42
- package/src/feature/user/user.service.ts +9 -4
- package/src/icons/spider/spider.component.ts +4 -4
- package/src/ngx-bos.config.ts +1 -1
- package/src/public-api.ts +1 -1
- package/types/wawjs-ngx-bos.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wawjs/ngx-bos",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^22.0.0",
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"@angular/core": "^22.0.0",
|
|
9
9
|
"@angular/forms": "^22.0.0",
|
|
10
10
|
"@angular/router": "^22.0.0",
|
|
11
|
-
"@wawjs/ngx-core": "^22.0.
|
|
12
|
-
"@wawjs/ngx-crud": "^22.0.
|
|
13
|
-
"@wawjs/ngx-ace": "^22.0.
|
|
14
|
-
"@wawjs/ngx-fabric": "^22.0.
|
|
15
|
-
"@wawjs/ngx-form": "^22.0.
|
|
16
|
-
"@wawjs/ngx-http": "^22.0.
|
|
17
|
-
"@wawjs/ngx-tinymce": "^22.0.
|
|
18
|
-
"@wawjs/ngx-translate": "^22.0.
|
|
19
|
-
"@wawjs/ngx-ui": "^22.0.
|
|
11
|
+
"@wawjs/ngx-core": "^22.0.7",
|
|
12
|
+
"@wawjs/ngx-crud": "^22.0.7",
|
|
13
|
+
"@wawjs/ngx-ace": "^22.0.7",
|
|
14
|
+
"@wawjs/ngx-fabric": "^22.0.7",
|
|
15
|
+
"@wawjs/ngx-form": "^22.0.7",
|
|
16
|
+
"@wawjs/ngx-http": "^22.0.7",
|
|
17
|
+
"@wawjs/ngx-tinymce": "^22.0.7",
|
|
18
|
+
"@wawjs/ngx-translate": "^22.0.7",
|
|
19
|
+
"@wawjs/ngx-ui": "^22.0.7",
|
|
20
20
|
"libphonenumber-js": "^1.13.7"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
1
|
+
import { inject, PLATFORM_ID } from '@angular/core';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
3
|
import { CanActivateFn, Router } from '@angular/router';
|
|
3
4
|
import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
|
|
4
5
|
|
|
@@ -6,6 +7,11 @@ export const adminsGuard: CanActivateFn = () => {
|
|
|
6
7
|
const router = inject(Router);
|
|
7
8
|
const config = inject(NGX_BOS_CONFIG);
|
|
8
9
|
|
|
10
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
11
|
+
// See authenticatedGuard — no real session at build/prerender time, defer to the client.
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
const stored = localStorage.getItem('waw_user');
|
|
10
16
|
|
|
11
17
|
if (!stored) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
1
|
+
import { inject, PLATFORM_ID } from '@angular/core';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
3
|
import { CanActivateFn, Router } from '@angular/router';
|
|
3
4
|
import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
|
|
4
5
|
|
|
@@ -6,6 +7,13 @@ export const authenticatedGuard: CanActivateFn = () => {
|
|
|
6
7
|
const router = inject(Router);
|
|
7
8
|
const config = inject(NGX_BOS_CONFIG);
|
|
8
9
|
|
|
10
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
11
|
+
// No real session exists at build/prerender time — render the shell and let the client
|
|
12
|
+
// re-check against the real localStorage after hydration, instead of baking a redirect
|
|
13
|
+
// stub into the static file (which would bounce an already-authenticated user on reload).
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
if (localStorage.getItem('waw_user')) {
|
|
10
18
|
return true;
|
|
11
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
1
|
+
import { inject, PLATFORM_ID } from '@angular/core';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
3
|
import { CanActivateFn, Router } from '@angular/router';
|
|
3
4
|
import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ export const guestGuard: CanActivateFn = () => {
|
|
|
6
7
|
const router = inject(Router);
|
|
7
8
|
const config = inject(NGX_BOS_CONFIG);
|
|
8
9
|
|
|
9
|
-
if (localStorage.getItem('waw_user')) {
|
|
10
|
+
if (isPlatformBrowser(inject(PLATFORM_ID)) && localStorage.getItem('waw_user')) {
|
|
10
11
|
return router.parseUrl(config.profilePath);
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
>
|
|
8
8
|
@for (role of roles; track role) {
|
|
9
9
|
<ng-template [cell]="role" let-user>
|
|
10
|
-
<winput
|
|
11
|
-
(click)="$event.stopPropagation()"
|
|
12
|
-
(wChange)="updateRole(user, role, !!$event)"
|
|
10
|
+
<winput
|
|
11
|
+
(click)="$event.stopPropagation()"
|
|
12
|
+
(wChange)="updateRole(user, role, !!$event)"
|
|
13
13
|
[wModel]="user.is[role]"
|
|
14
14
|
type="checkbox"
|
|
15
15
|
/>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
:host ::ng-deep {
|
|
2
|
-
.wtable__th:nth-child(n + 3):not(:last-child),
|
|
3
|
-
.wtable__td:nth-child(n + 3):not(:last-child) {
|
|
4
|
-
width: 1%;
|
|
5
|
-
padding-inline: var(--sp-2);
|
|
6
|
-
white-space: nowrap;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.wtable__td:nth-child(n + 3):not(:last-child) winput {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
:host ::ng-deep {
|
|
2
|
+
.wtable__th:nth-child(n + 3):not(:last-child),
|
|
3
|
+
.wtable__td:nth-child(n + 3):not(:last-child) {
|
|
4
|
+
width: 1%;
|
|
5
|
+
padding-inline: var(--sp-2);
|
|
6
|
+
white-space: nowrap;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wtable__td:nth-child(n + 3):not(:last-child) winput {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -8,55 +8,55 @@ import { User } from '../../user.interface';
|
|
|
8
8
|
import { UserService } from '../../user.service';
|
|
9
9
|
|
|
10
10
|
@Component({
|
|
11
|
-
imports: [TableComponent, CellDirective, InputComponent],
|
|
12
|
-
templateUrl: './users.component.html',
|
|
13
|
-
styleUrl: './users.component.scss',
|
|
14
|
-
})
|
|
11
|
+
imports: [TableComponent, CellDirective, InputComponent],
|
|
12
|
+
templateUrl: './users.component.html',
|
|
13
|
+
styleUrl: './users.component.scss',
|
|
14
|
+
})
|
|
15
15
|
export class UsersComponent extends CrudComponent<
|
|
16
16
|
UserService,
|
|
17
17
|
User,
|
|
18
18
|
FormInterface
|
|
19
19
|
> {
|
|
20
|
-
protected override configType: 'server' | 'local' = 'local';
|
|
21
|
-
private readonly _formService = inject(FormService);
|
|
20
|
+
protected override configType: 'server' | 'local' = 'local';
|
|
21
|
+
private readonly _formService = inject(FormService);
|
|
22
22
|
|
|
23
23
|
protected override allowUrl(): boolean {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
protected override async delete(doc: User) {
|
|
27
|
+
protected override async delete(doc: User) {
|
|
28
28
|
this.userService.deleteAdmin(doc).subscribe(() => {
|
|
29
29
|
this.setDocuments();
|
|
30
30
|
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected override update(doc: User): void {
|
|
34
|
-
if (this.form.formId) {
|
|
35
|
-
this._formService.reset(
|
|
36
|
-
this.form.formId,
|
|
37
|
-
doc as unknown as Record<string, unknown>,
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this._formService.modal(
|
|
42
|
-
this.form,
|
|
43
|
-
{
|
|
44
|
-
label: 'Update',
|
|
45
|
-
click: (updated: unknown, close: () => void) => {
|
|
46
|
-
close();
|
|
47
|
-
Object.assign(doc, updated as User);
|
|
48
|
-
this.userService.updateAdmin(doc).subscribe(() => {
|
|
49
|
-
this.setDocuments();
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
doc,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected override update(doc: User): void {
|
|
34
|
+
if (this.form.formId) {
|
|
35
|
+
this._formService.reset(
|
|
36
|
+
this.form.formId,
|
|
37
|
+
doc as unknown as Record<string, unknown>,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this._formService.modal(
|
|
42
|
+
this.form,
|
|
43
|
+
{
|
|
44
|
+
label: 'Update',
|
|
45
|
+
click: (updated: unknown, close: () => void) => {
|
|
46
|
+
close();
|
|
47
|
+
Object.assign(doc, updated as User);
|
|
48
|
+
this.userService.updateAdmin(doc).subscribe(() => {
|
|
49
|
+
this.setDocuments();
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
doc,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
56
|
|
|
57
57
|
private _router = inject(Router);
|
|
58
58
|
|
|
59
|
-
userService = inject(UserService);
|
|
59
|
+
userService = inject(UserService);
|
|
60
60
|
|
|
61
61
|
readonly roles = this._router.url.includes('admin')
|
|
62
62
|
? this.userService.roles
|
|
@@ -79,12 +79,12 @@ export class UsersComponent extends CrudComponent<
|
|
|
79
79
|
for (const role of this.userService.roles) {
|
|
80
80
|
this.columns.push(role);
|
|
81
81
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
updateRole(user: User, role: string, value: boolean): void {
|
|
85
|
-
user.is[role] = value;
|
|
86
|
-
this.userService.updateAdmin(user).subscribe(() => {
|
|
87
|
-
this.setDocuments();
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
updateRole(user: User, role: string, value: boolean): void {
|
|
85
|
+
user.is[role] = value;
|
|
86
|
+
this.userService.updateAdmin(user).subscribe(() => {
|
|
87
|
+
this.setDocuments();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Service, computed, inject, signal } from '@angular/core';
|
|
1
|
+
import { Service, computed, inject, PLATFORM_ID, signal } from '@angular/core';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
3
|
import { Router } from '@angular/router';
|
|
3
4
|
import { AlertService } from '@wawjs/ngx-ui';
|
|
4
5
|
import { CrudService } from '@wawjs/ngx-crud';
|
|
@@ -18,6 +19,8 @@ export class UserService extends CrudService<User> {
|
|
|
18
19
|
|
|
19
20
|
private readonly _bosConfig = inject(NGX_BOS_CONFIG);
|
|
20
21
|
|
|
22
|
+
private readonly _isBrowserPlatform = isPlatformBrowser(inject(PLATFORM_ID));
|
|
23
|
+
|
|
21
24
|
readonly url = this._bosConfig.url;
|
|
22
25
|
|
|
23
26
|
roles = this._bosConfig.roles.concat(['admin']);
|
|
@@ -26,9 +29,11 @@ export class UserService extends CrudService<User> {
|
|
|
26
29
|
|
|
27
30
|
readonly users = this.documents;
|
|
28
31
|
|
|
32
|
+
private readonly _storedUser = this._isBrowserPlatform ? localStorage.getItem('waw_user') : null;
|
|
33
|
+
|
|
29
34
|
user = signal<User>(
|
|
30
|
-
|
|
31
|
-
? JSON.parse(
|
|
35
|
+
this._storedUser
|
|
36
|
+
? JSON.parse(this._storedUser)
|
|
32
37
|
: this.prepareDocument()(),
|
|
33
38
|
);
|
|
34
39
|
|
|
@@ -81,7 +86,7 @@ export class UserService extends CrudService<User> {
|
|
|
81
86
|
},
|
|
82
87
|
});
|
|
83
88
|
|
|
84
|
-
if (localStorage.getItem('waw_user')) {
|
|
89
|
+
if (this._isBrowserPlatform && localStorage.getItem('waw_user')) {
|
|
85
90
|
this.fetch({}, { name: 'me' }).subscribe((user: User) => {
|
|
86
91
|
if (user) {
|
|
87
92
|
if (
|
|
@@ -6,10 +6,10 @@ import { Component, input } from '@angular/core';
|
|
|
6
6
|
styleUrl: './spider.component.scss',
|
|
7
7
|
host: {
|
|
8
8
|
class: 'spider',
|
|
9
|
-
'[style.--spider-w]': 'width',
|
|
10
|
-
'[style.--spider-h]': 'height',
|
|
11
|
-
'[style.--spider-start]': 'start',
|
|
12
|
-
'[style.--spider-end]': 'end',
|
|
9
|
+
'[style.--spider-w]': 'width()',
|
|
10
|
+
'[style.--spider-h]': 'height()',
|
|
11
|
+
'[style.--spider-start]': 'start()',
|
|
12
|
+
'[style.--spider-end]': 'end()',
|
|
13
13
|
},
|
|
14
14
|
})
|
|
15
15
|
export class SpiderComponent {
|
package/src/ngx-bos.config.ts
CHANGED
|
@@ -27,7 +27,7 @@ export const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {
|
|
|
27
27
|
userForm: [],
|
|
28
28
|
signPath: '/sign',
|
|
29
29
|
profilePath: '/profile',
|
|
30
|
-
defaultUserThumb: '
|
|
30
|
+
defaultUserThumb: 'default.png',
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(
|
package/src/public-api.ts
CHANGED
package/types/wawjs-ngx-bos.d.ts
CHANGED
|
@@ -197,10 +197,12 @@ declare class UserService extends CrudService<User> {
|
|
|
197
197
|
private readonly _router;
|
|
198
198
|
private readonly _emitterService;
|
|
199
199
|
private readonly _bosConfig;
|
|
200
|
+
private readonly _isBrowserPlatform;
|
|
200
201
|
readonly url: string;
|
|
201
202
|
roles: string[];
|
|
202
203
|
employees: string[];
|
|
203
204
|
readonly users: _angular_core.Signal<User[]>;
|
|
205
|
+
private readonly _storedUser;
|
|
204
206
|
user: _angular_core.WritableSignal<User>;
|
|
205
207
|
thumb: _angular_core.Signal<string>;
|
|
206
208
|
role(role: string): boolean;
|
|
@@ -329,7 +331,7 @@ declare class PhonePipe implements PipeTransform {
|
|
|
329
331
|
static ɵpipe: _angular_core.ɵɵPipeDeclaration<PhonePipe, "phone", true>;
|
|
330
332
|
}
|
|
331
333
|
|
|
332
|
-
declare const NGX_BOS_VERSION: "22.0.
|
|
334
|
+
declare const NGX_BOS_VERSION: "22.0.4";
|
|
333
335
|
type NgxBosVersion = typeof NGX_BOS_VERSION;
|
|
334
336
|
|
|
335
337
|
export { ClientsComponent, DEFAULT_NGX_BOS_CONFIG, FORM_COMPONENTS, FORM_COMPONENT_FORM, FORM_TEMPLATE_COMPONENTS, FileComponent, FileSelectorComponent, FileService, FilesComponent, FormComponent, FormsComponent, NEW_USER, NGX_BOS_CONFIG, NGX_BOS_VERSION, PhonePipe, SpiderComponent, UserPreviewComponent, UserSelectorComponent, UserService, UsersComponent, adminsGuard, authenticatedGuard, clientsRoutes, createUserFormComponents, fileDefaults, fileToDataUrl, filesRoutes, formRoutes, formsRoutes, guestGuard, ngxBosProvide, provideFormComponents, provideNgxBos, resizeImageToBounds, userFormComponentsFactory, usersRoutes };
|