@wawjs/ngx-bos 22.0.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.
Files changed (90) hide show
  1. package/AGENTS.md +23 -0
  2. package/README.md +105 -0
  3. package/RELEASES.md +21 -0
  4. package/ai/architecture.md +40 -0
  5. package/ai/code-style.md +33 -0
  6. package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -0
  7. package/ai/decisions/2026-06-02-package-boundary.md +22 -0
  8. package/ai/decisions/2026-06-02-version-start.md +12 -0
  9. package/ai/decisions/index.md +7 -0
  10. package/ai/onboarding.md +19 -0
  11. package/ai/task-execution.md +35 -0
  12. package/ai/tooling.md +33 -0
  13. package/fesm2022/wawjs-ngx-bos.mjs +2287 -0
  14. package/fesm2022/wawjs-ngx-bos.mjs.map +1 -0
  15. package/package.json +38 -0
  16. package/src/feature/file/file.component.html +123 -0
  17. package/src/feature/file/file.component.scss +209 -0
  18. package/src/feature/file/file.component.ts +220 -0
  19. package/src/feature/file/file.const.ts +20 -0
  20. package/src/feature/file/file.interface.ts +12 -0
  21. package/src/feature/file/file.service.ts +34 -0
  22. package/src/feature/file/file.util.ts +72 -0
  23. package/src/feature/file/index.ts +9 -0
  24. package/src/feature/file/pages/files/files.component.html +12 -0
  25. package/src/feature/file/pages/files/files.component.ts +117 -0
  26. package/src/feature/file/pages/files/files.routes.ts +9 -0
  27. package/src/feature/file/selectors/file/file-selector.component.html +11 -0
  28. package/src/feature/file/selectors/file/file-selector.component.ts +27 -0
  29. package/src/feature/user/LICENSE +21 -0
  30. package/src/feature/user/README.md +1 -0
  31. package/src/feature/user/components/user-preview/user-preview.component.html +7 -0
  32. package/src/feature/user/components/user-preview/user-preview.component.scss +27 -0
  33. package/src/feature/user/components/user-preview/user-preview.component.ts +16 -0
  34. package/src/feature/user/guards/admins.guard.ts +22 -0
  35. package/src/feature/user/guards/authenticated.guard.ts +14 -0
  36. package/src/feature/user/guards/guest.guard.ts +14 -0
  37. package/src/feature/user/module.json +1 -0
  38. package/src/feature/user/pages/clients/clients.component.html +8 -0
  39. package/src/feature/user/pages/clients/clients.component.scss +0 -0
  40. package/src/feature/user/pages/clients/clients.component.ts +45 -0
  41. package/src/feature/user/pages/clients/clients.routes.ts +9 -0
  42. package/src/feature/user/pages/users/users.component.html +18 -0
  43. package/src/feature/user/pages/users/users.component.ts +57 -0
  44. package/src/feature/user/pages/users/users.routes.ts +9 -0
  45. package/src/feature/user/selectors/user/user-selector.component.html +6 -0
  46. package/src/feature/user/selectors/user/user-selector.component.scss +0 -0
  47. package/src/feature/user/selectors/user/user-selector.component.ts +17 -0
  48. package/src/feature/user/user.const.ts +13 -0
  49. package/src/feature/user/user.form.ts +54 -0
  50. package/src/feature/user/user.interface.ts +12 -0
  51. package/src/feature/user/user.service.ts +176 -0
  52. package/src/form-components/ace/ace.component.html +14 -0
  53. package/src/form-components/ace/ace.component.scss +22 -0
  54. package/src/form-components/ace/ace.component.ts +210 -0
  55. package/src/form-components/ace/ace.form.ts +184 -0
  56. package/src/form-components/button/button.component.html +15 -0
  57. package/src/form-components/button/button.component.ts +31 -0
  58. package/src/form-components/button/button.form.ts +74 -0
  59. package/src/form-components/file/file.component.html +73 -0
  60. package/src/form-components/file/file.component.ts +91 -0
  61. package/src/form-components/file/file.form.ts +112 -0
  62. package/src/form-components/form-bridge.interface.ts +27 -0
  63. package/src/form-components/index.ts +85 -0
  64. package/src/form-components/input/input.component.html +16 -0
  65. package/src/form-components/input/input.component.ts +31 -0
  66. package/src/form-components/input/input.form.ts +117 -0
  67. package/src/form-components/select/select.component.html +24 -0
  68. package/src/form-components/select/select.component.ts +31 -0
  69. package/src/form-components/select/select.form.ts +88 -0
  70. package/src/form-components/tinymce/tinymce.component.html +13 -0
  71. package/src/form-components/tinymce/tinymce.component.scss +19 -0
  72. package/src/form-components/tinymce/tinymce.component.ts +221 -0
  73. package/src/form-components/tinymce/tinymce.form.ts +191 -0
  74. package/src/icons/spider/LICENSE +21 -0
  75. package/src/icons/spider/README.md +127 -0
  76. package/src/icons/spider/index.ts +1 -0
  77. package/src/icons/spider/module.json +4 -0
  78. package/src/icons/spider/spider.component.html +115 -0
  79. package/src/icons/spider/spider.component.scss +20 -0
  80. package/src/icons/spider/spider.component.ts +20 -0
  81. package/src/ngx-bos.config.ts +55 -0
  82. package/src/pages/form/form.component.html +9 -0
  83. package/src/pages/form/form.component.ts +86 -0
  84. package/src/pages/form/form.routes.ts +9 -0
  85. package/src/pages/forms/forms.component.html +9 -0
  86. package/src/pages/forms/forms.component.ts +77 -0
  87. package/src/pages/forms/forms.routes.ts +9 -0
  88. package/src/pipes/phone.pipe.ts +17 -0
  89. package/src/public-api.ts +36 -0
  90. package/types/wawjs-ngx-bos.d.ts +332 -0
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+
3
+ export const filesRoutes: Routes = [
4
+ {
5
+ path: '',
6
+ loadComponent: () =>
7
+ import('./files.component').then((m) => m.FilesComponent),
8
+ },
9
+ ];
@@ -0,0 +1,11 @@
1
+ <wselect
2
+ [placeholder]="placeholder()"
3
+ [items]="items()"
4
+ bindLabel="name"
5
+ bindValue="_id"
6
+ ></wselect>
7
+
8
+ <!--
9
+ [(wModel)]="wModel()"
10
+ (wChange)="wChange.emit($event as string | null)"
11
+ -->
@@ -0,0 +1,27 @@
1
+ import {
2
+ Component,
3
+ inject,
4
+ input,
5
+ output,
6
+ Signal,
7
+ signal,
8
+ } from '@angular/core';
9
+ import { SelectComponent } from '@wawjs/ngx-ui';
10
+ import { TranslateService } from '@wawjs/ngx-translate';
11
+ import { File, FileService } from '../..';
12
+
13
+ @Component({
14
+ selector: 'file-selector',
15
+ imports: [SelectComponent],
16
+ templateUrl: './file-selector.component.html',
17
+ })
18
+ export class FileSelectorComponent {
19
+ private _files = inject(FileService);
20
+ private _translate = inject(TranslateService);
21
+ readonly wModel = input<string | null>(null, { alias: 'wModel' });
22
+ readonly wChange = output<string | null>();
23
+
24
+ readonly items: Signal<File[]> = signal(this._files.documents());
25
+
26
+ readonly placeholder = this._translate.translate('Select file...');
27
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Web Art Work
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ # ngx-user
@@ -0,0 +1,7 @@
1
+ <a
2
+ class="space__header-avatar"
3
+ [routerLink]="bosConfig.profilePath"
4
+ aria-label="Profile"
5
+ >
6
+ <img [src]="userService.thumb()" alt="" />
7
+ </a>
@@ -0,0 +1,27 @@
1
+ .space {
2
+ &__header {
3
+ &-avatar {
4
+ margin-inline-start: var(--sp-3);
5
+ inline-size: 32px;
6
+ block-size: 32px;
7
+ border-radius: 999px;
8
+ overflow: hidden;
9
+ display: inline-flex;
10
+ cursor: pointer;
11
+ text-decoration: none;
12
+
13
+ &:focus-visible {
14
+ outline: none;
15
+ box-shadow: var(--focus-ring);
16
+ }
17
+
18
+ img {
19
+ inline-size: 100%;
20
+ block-size: 100%;
21
+ object-fit: cover;
22
+ border-radius: inherit;
23
+ display: block;
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,16 @@
1
+ import { Component, inject } from '@angular/core';
2
+ import { RouterLink } from '@angular/router';
3
+ import { NGX_BOS_CONFIG } from '../../../../ngx-bos.config';
4
+ import { UserService } from '../../user.service';
5
+
6
+ @Component({
7
+ selector: 'user-preview',
8
+ imports: [RouterLink],
9
+ templateUrl: './user-preview.component.html',
10
+ styleUrl: './user-preview.component.scss',
11
+ })
12
+ export class UserPreviewComponent {
13
+ userService = inject(UserService);
14
+
15
+ protected readonly bosConfig = inject(NGX_BOS_CONFIG);
16
+ }
@@ -0,0 +1,22 @@
1
+ import { inject } from '@angular/core';
2
+ import { CanActivateFn, Router } from '@angular/router';
3
+ import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
4
+
5
+ export const adminsGuard: CanActivateFn = () => {
6
+ const router = inject(Router);
7
+ const config = inject(NGX_BOS_CONFIG);
8
+
9
+ const stored = localStorage.getItem('waw_user');
10
+
11
+ if (!stored) {
12
+ return router.parseUrl(config.signPath);
13
+ }
14
+
15
+ const user = JSON.parse(stored);
16
+
17
+ if (user.is && user.is.admin) {
18
+ return true;
19
+ }
20
+
21
+ return router.parseUrl(config.profilePath);
22
+ };
@@ -0,0 +1,14 @@
1
+ import { inject } from '@angular/core';
2
+ import { CanActivateFn, Router } from '@angular/router';
3
+ import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
4
+
5
+ export const authenticatedGuard: CanActivateFn = () => {
6
+ const router = inject(Router);
7
+ const config = inject(NGX_BOS_CONFIG);
8
+
9
+ if (localStorage.getItem('waw_user')) {
10
+ return true;
11
+ }
12
+
13
+ return router.parseUrl(config.signPath);
14
+ };
@@ -0,0 +1,14 @@
1
+ import { inject } from '@angular/core';
2
+ import { CanActivateFn, Router } from '@angular/router';
3
+ import { NGX_BOS_CONFIG } from '../../../ngx-bos.config';
4
+
5
+ export const guestGuard: CanActivateFn = () => {
6
+ const router = inject(Router);
7
+ const config = inject(NGX_BOS_CONFIG);
8
+
9
+ if (localStorage.getItem('waw_user')) {
10
+ return router.parseUrl(config.profilePath);
11
+ }
12
+
13
+ return true;
14
+ };
@@ -0,0 +1 @@
1
+ { "repo": "https://github.com/WebArtWork/ngx-user.git" }
@@ -0,0 +1,8 @@
1
+ <!--==== Table Module ====-->
2
+ <wtable
3
+ [rows]="documents()"
4
+ [columns]="columns"
5
+ [config]="config"
6
+ title="Clients"
7
+ ></wtable>
8
+ <!-- ==================== -->
@@ -0,0 +1,45 @@
1
+ import { Component, inject } from '@angular/core';
2
+ import { FormInterface, FormService } from '@wawjs/ngx-form';
3
+ import { TableComponent } from '@wawjs/ngx-ui';
4
+ import { CrudComponent } from '@wawjs/ngx-crud';
5
+ import { userFormComponentsFactory } from '../../user.form';
6
+ import { User } from '../../user.interface';
7
+ import { UserService } from '../../user.service';
8
+
9
+ @Component({
10
+ imports: [TableComponent],
11
+ templateUrl: './clients.component.html',
12
+ styleUrl: './clients.component.scss',
13
+ })
14
+ export class ClientsComponent extends CrudComponent<
15
+ UserService,
16
+ User,
17
+ FormInterface
18
+ > {
19
+ /** Use server-side pagination for clients */
20
+ protected override configType: 'server' | 'local' = 'server';
21
+
22
+ /** Basic columns for clients table */
23
+ columns = ['name', 'email'];
24
+
25
+ /** wtable config built by CrudComponent, aware of server mode */
26
+ config = this.getConfig();
27
+
28
+ protected override allowUrl(): boolean {
29
+ // no URL-driven filters for now, same as UsersComponent
30
+ return false;
31
+ }
32
+
33
+ constructor() {
34
+ // 'user' docType reuses existing user form components
35
+ super(
36
+ userFormComponentsFactory(),
37
+ inject(FormService),
38
+ inject(UserService),
39
+ 'user',
40
+ );
41
+
42
+ // fetch first page from server using CrudComponent logic
43
+ this.setDocuments();
44
+ }
45
+ }
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+
3
+ export const clientsRoutes: Routes = [
4
+ {
5
+ path: '',
6
+ loadComponent: () =>
7
+ import('./clients.component').then((m) => m.ClientsComponent),
8
+ },
9
+ ];
@@ -0,0 +1,18 @@
1
+ <!--==== Table Module ====-->
2
+ <wtable
3
+ [rows]="documents()"
4
+ [columns]="columns"
5
+ [config]="config"
6
+ title="Users"
7
+ >
8
+ @for (role of roles; track role) {
9
+ <ng-template [cell]="role" let-user>
10
+ <winput
11
+ (wChange)="user.is[role] = $event; update(user)"
12
+ [wModel]="user.is[role]"
13
+ type="checkbox"
14
+ />
15
+ </ng-template>
16
+ }
17
+ </wtable>
18
+ <!-- ==================== -->
@@ -0,0 +1,57 @@
1
+ import { Component, inject } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { FormInterface, FormService } from '@wawjs/ngx-form';
4
+ import { CrudComponent } from '@wawjs/ngx-crud';
5
+ import { CellDirective, InputComponent, TableComponent } from '@wawjs/ngx-ui';
6
+ import { userFormComponentsFactory } from '../../user.form';
7
+ import { User } from '../../user.interface';
8
+ import { UserService } from '../../user.service';
9
+
10
+ @Component({
11
+ imports: [TableComponent, CellDirective, InputComponent],
12
+ templateUrl: './users.component.html',
13
+ })
14
+ export class UsersComponent extends CrudComponent<
15
+ UserService,
16
+ User,
17
+ FormInterface
18
+ > {
19
+ protected override configType: 'server' | 'local' = 'local';
20
+
21
+ protected override allowUrl(): boolean {
22
+ return false;
23
+ }
24
+
25
+ protected override async delete(doc: User) {
26
+ this.userService.deleteAdmin(doc).subscribe(() => {
27
+ this.setDocuments();
28
+ });
29
+ }
30
+
31
+ private _router = inject(Router);
32
+
33
+ userService = inject(UserService);
34
+
35
+ readonly roles = this._router.url.includes('admin')
36
+ ? this.userService.roles
37
+ : this.userService.employees;
38
+
39
+ columns = ['name', 'email'];
40
+
41
+ config = this.getConfig();
42
+
43
+ constructor() {
44
+ super(
45
+ userFormComponentsFactory(),
46
+ inject(FormService),
47
+ inject(UserService),
48
+ 'user',
49
+ );
50
+
51
+ this.setDocuments();
52
+
53
+ for (const role of this.userService.roles) {
54
+ this.columns.push(role);
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+
3
+ export const usersRoutes: Routes = [
4
+ {
5
+ path: '',
6
+ loadComponent: () =>
7
+ import('./users.component').then((m) => m.UsersComponent),
8
+ },
9
+ ];
@@ -0,0 +1,6 @@
1
+ <wselect
2
+ (wChange)="onChange.emit($event)"
3
+ placeholder="Select user..."
4
+ [items]="userService.users()"
5
+ [wModel]="value()"
6
+ ></wselect>
@@ -0,0 +1,17 @@
1
+ import { Component, inject, input, output } from '@angular/core';
2
+ import { SelectComponent, SelectValue } from '@wawjs/ngx-ui';
3
+ import { UserService } from '../../user.service';
4
+
5
+ @Component({
6
+ imports: [SelectComponent],
7
+ selector: 'user-selector',
8
+ templateUrl: './user-selector.component.html',
9
+ styleUrl: './user-selector.component.scss',
10
+ })
11
+ export class UserSelectorComponent {
12
+ userService = inject(UserService);
13
+
14
+ value = input('');
15
+
16
+ onChange = output<SelectValue>();
17
+ }
@@ -0,0 +1,13 @@
1
+ import { User } from './user.interface';
2
+
3
+ export const NEW_USER: User = {
4
+ _id: '',
5
+ data: {},
6
+ is: {},
7
+ roles: [],
8
+ name: '',
9
+ phone: '',
10
+ bio: '',
11
+ email: '',
12
+ thumb: '',
13
+ };
@@ -0,0 +1,54 @@
1
+ import { inject } from '@angular/core';
2
+ import { FormComponentInterface } from '@wawjs/ngx-form';
3
+ import { NGX_BOS_CONFIG } from '../../ngx-bos.config';
4
+
5
+ export const createUserFormComponents = (
6
+ userForm: FormComponentInterface[] = [],
7
+ ) => ({
8
+ formId: 'user',
9
+ title: 'Profile Settings',
10
+ components: [
11
+ {
12
+ name: 'Input',
13
+ key: 'name',
14
+ focused: true,
15
+ props: {
16
+ placeholder: 'Enter name...',
17
+ label: 'Name',
18
+ },
19
+ },
20
+ {
21
+ name: 'Input',
22
+ key: 'email',
23
+ props: {
24
+ placeholder: 'Enter email...',
25
+ label: 'Email',
26
+ type: 'email',
27
+ },
28
+ },
29
+ {
30
+ name: 'Input',
31
+ key: 'phone',
32
+ props: {
33
+ placeholder: 'Enter phone...',
34
+ label: 'Phone',
35
+ },
36
+ },
37
+ {
38
+ name: 'Input',
39
+ key: 'bio',
40
+ props: {
41
+ placeholder: 'Enter bio...',
42
+ label: 'Biography',
43
+ type: 'textarea',
44
+ },
45
+ },
46
+ ...userForm,
47
+ ],
48
+ });
49
+
50
+ export const userFormComponentsFactory = () => {
51
+ const config = inject(NGX_BOS_CONFIG);
52
+
53
+ return createUserFormComponents(config.userForm);
54
+ };
@@ -0,0 +1,12 @@
1
+ import { CrudDocument } from '@wawjs/ngx-crud';
2
+
3
+ export interface User extends CrudDocument<User> {
4
+ data: Record<string, unknown>;
5
+ is: Record<string, boolean>;
6
+ roles: string[];
7
+ name: string;
8
+ phone: string;
9
+ bio: string;
10
+ email: string;
11
+ thumb: string;
12
+ }
@@ -0,0 +1,176 @@
1
+ import { Service, computed, inject, signal } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { AlertService } from '@wawjs/ngx-ui';
4
+ import { CrudService } from '@wawjs/ngx-crud';
5
+ import { EmitterService } from '@wawjs/ngx-core';
6
+ import { HttpService } from '@wawjs/ngx-http';
7
+ import { NGX_BOS_CONFIG } from '../../ngx-bos.config';
8
+ import { User } from './user.interface';
9
+ @Service()
10
+ export class UserService extends CrudService<User> {
11
+ private readonly _userHttpService = inject(HttpService);
12
+
13
+ private readonly _alertService = inject(AlertService);
14
+
15
+ private readonly _router = inject(Router);
16
+
17
+ private readonly _emitterService = inject(EmitterService);
18
+
19
+ private readonly _bosConfig = inject(NGX_BOS_CONFIG);
20
+
21
+ readonly url = this._bosConfig.url;
22
+
23
+ roles = this._bosConfig.roles.concat(['admin']);
24
+
25
+ employees = this._bosConfig.roles;
26
+
27
+ users = signal<User[]>(this.documents());
28
+
29
+ user = signal<User>(
30
+ localStorage.getItem('waw_user')
31
+ ? JSON.parse(localStorage.getItem('waw_user') as string)
32
+ : this.prepareDocument()(),
33
+ );
34
+
35
+ thumb = computed(() => {
36
+ const thumb = this.user().thumb;
37
+
38
+ return !thumb || thumb.includes(this._bosConfig.defaultUserThumb)
39
+ ? this._bosConfig.defaultUserThumb
40
+ : this.url + thumb;
41
+ });
42
+
43
+ role(role: string): boolean {
44
+ return !!(this.user().is || {})[role];
45
+ }
46
+
47
+ readonly usersByRole = computed<Record<string, User[]>>(() => {
48
+ const splitted: Record<string, User[]> = {};
49
+
50
+ for (const user of this.documents()) {
51
+ for (const role of user.roles || []) {
52
+ if (role === undefined || role === null) continue;
53
+ (splitted[String(role)] ??= []).push(user);
54
+ }
55
+ }
56
+
57
+ return splitted;
58
+ });
59
+
60
+ constructor() {
61
+ super({
62
+ name: 'user',
63
+ replace: (user) => {
64
+ user.roles = [];
65
+ user.data = user.data || {};
66
+ user.is = user.is || {};
67
+
68
+ for (const field of this._bosConfig.userFields) {
69
+ user.data[field] = user.data[field] || {};
70
+ }
71
+
72
+ for (const role of this.roles) {
73
+ if (user.is[role]) {
74
+ user.roles.push(role);
75
+ }
76
+ }
77
+
78
+ return user;
79
+ },
80
+ });
81
+
82
+ if (localStorage.getItem('waw_user')) {
83
+ this.fetch({}, { name: 'me' }).subscribe((user: User) => {
84
+ if (user) {
85
+ if (
86
+ !localStorage.getItem('waw_user') &&
87
+ this._router.url === this._bosConfig.signPath
88
+ ) {
89
+ this._router.navigateByUrl(this._bosConfig.profilePath);
90
+ }
91
+
92
+ this.setUser(user);
93
+ } else if (localStorage.getItem('waw_user')) {
94
+ this.logout();
95
+ }
96
+ });
97
+
98
+ this.get({
99
+ query: this._bosConfig.appId ? 'appId=' + this._bosConfig.appId : '',
100
+ });
101
+ }
102
+ }
103
+
104
+ setUser(user: User) {
105
+ this.user.set(user);
106
+
107
+ localStorage.setItem('waw_user', JSON.stringify(user));
108
+
109
+ this._emitterService.complete('us.user');
110
+ }
111
+
112
+ updateMe() {
113
+ this.setUser(this.user());
114
+
115
+ return this.update(this.user()).subscribe(() => {
116
+ this._alertService.info({
117
+ text: 'Profile information has been updated',
118
+ });
119
+ });
120
+ }
121
+
122
+ updateMeAfterWhile() {
123
+ this.setUser(this.user());
124
+
125
+ this.updateAfterWhile(this.user());
126
+ }
127
+
128
+ changePassword(oldPass: string, newPass: string) {
129
+ return this._userHttpService.post(
130
+ '/api/user/changePassword',
131
+ {
132
+ newPass: newPass,
133
+ oldPass: oldPass,
134
+ },
135
+ (resp: boolean) => {
136
+ if (resp) {
137
+ this._alertService.info({
138
+ text: 'Successfully changed password',
139
+ });
140
+ } else {
141
+ this._alertService.error({
142
+ text: 'Incorrect current password',
143
+ });
144
+ }
145
+ },
146
+ );
147
+ }
148
+
149
+ logout() {
150
+ this.user.set(this.prepareDocument()());
151
+
152
+ localStorage.removeItem('waw_user');
153
+
154
+ this._userHttpService.remove('token');
155
+
156
+ this._userHttpService.get('/api/user/logout');
157
+
158
+ this._router.navigateByUrl(this._bosConfig.signPath);
159
+
160
+ setTimeout(() => {
161
+ location.reload();
162
+ }, 100);
163
+ }
164
+
165
+ updateAdmin(user: User) {
166
+ return this.update(user, {
167
+ name: 'admin',
168
+ });
169
+ }
170
+
171
+ deleteAdmin(user: User) {
172
+ return this.delete(user, {
173
+ name: 'admin',
174
+ });
175
+ }
176
+ }
@@ -0,0 +1,14 @@
1
+ <ng-template #templateRef let-data>
2
+ <div class="w-ace" [class]="data.component?.class">
3
+ <ace
4
+ class="w-ace__editor"
5
+ (valueChange)="onValueChange(data, $event)"
6
+ [value]="getValue(data)"
7
+ [config]="getConfig(data)"
8
+ [mode]="$any(getMode(data))"
9
+ [theme]="$any(getTheme(data))"
10
+ [disabled]="isDisabled(data)"
11
+ [useAceClass]="getUseAceClass(data)"
12
+ ></ace>
13
+ </div>
14
+ </ng-template>
@@ -0,0 +1,22 @@
1
+ .w-ace {
2
+ width: 100%;
3
+ background: var(--c-bg-secondary);
4
+ color: var(--c-text-primary);
5
+ border: 1px solid var(--c-border);
6
+ border-radius: var(--radius-card);
7
+ box-shadow: var(--shadow-sm);
8
+ overflow: hidden;
9
+ }
10
+
11
+ /*
12
+ * Editor height:
13
+ * - at least 240px so it’s usable,
14
+ * - ideally ~60% of viewport height,
15
+ * - capped at 720px so it doesn’t explode on huge screens.
16
+ * Works nicely inside a modal of ~80–90vh (leaves room for header/footer/buttons).
17
+ */
18
+ .w-ace__editor {
19
+ display: block;
20
+ width: 100%;
21
+ height: clamp(240px, 60vh, 720px);
22
+ }