@wawjs/ngx-bos 22.0.0 → 22.0.2

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 (56) hide show
  1. package/AGENTS.md +23 -23
  2. package/README.md +105 -105
  3. package/RELEASES.md +41 -15
  4. package/ai/architecture.md +40 -40
  5. package/ai/code-style.md +33 -33
  6. package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -16
  7. package/ai/decisions/2026-06-02-package-boundary.md +22 -22
  8. package/ai/decisions/2026-06-02-version-start.md +12 -12
  9. package/ai/decisions/index.md +7 -7
  10. package/ai/onboarding.md +19 -19
  11. package/ai/task-execution.md +35 -35
  12. package/ai/tooling.md +33 -33
  13. package/fesm2022/wawjs-ngx-bos.mjs +138 -98
  14. package/fesm2022/wawjs-ngx-bos.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/feature/file/file.component.html +1 -1
  17. package/src/feature/file/file.component.ts +236 -220
  18. package/src/feature/file/file.interface.ts +12 -12
  19. package/src/feature/file/file.service.ts +35 -34
  20. package/src/feature/file/pages/files/files.component.html +2 -2
  21. package/src/feature/file/pages/files/files.component.ts +117 -117
  22. package/src/feature/file/pages/files/files.routes.ts +9 -9
  23. package/src/feature/file/selectors/file/file-selector.component.html +2 -5
  24. package/src/feature/file/selectors/file/file-selector.component.ts +24 -27
  25. package/src/feature/user/guards/admins.guard.ts +22 -22
  26. package/src/feature/user/guards/authenticated.guard.ts +14 -14
  27. package/src/feature/user/guards/guest.guard.ts +14 -14
  28. package/src/feature/user/pages/clients/clients.component.ts +45 -45
  29. package/src/feature/user/pages/clients/clients.routes.ts +1 -1
  30. package/src/feature/user/pages/users/users.component.html +3 -2
  31. package/src/feature/user/pages/users/users.component.scss +12 -0
  32. package/src/feature/user/pages/users/users.component.ts +78 -45
  33. package/src/feature/user/pages/users/users.routes.ts +1 -1
  34. package/src/feature/user/selectors/user/user-selector.component.ts +17 -17
  35. package/src/feature/user/user.const.ts +3 -3
  36. package/src/feature/user/user.form.ts +54 -54
  37. package/src/feature/user/user.interface.ts +12 -12
  38. package/src/feature/user/user.service.ts +178 -176
  39. package/src/form-components/ace/ace.component.ts +210 -210
  40. package/src/form-components/button/button.component.ts +31 -31
  41. package/src/form-components/file/file.component.ts +91 -91
  42. package/src/form-components/form-bridge.interface.ts +27 -27
  43. package/src/form-components/index.ts +85 -85
  44. package/src/form-components/input/input.component.html +1 -0
  45. package/src/form-components/input/input.component.ts +31 -31
  46. package/src/form-components/select/select.component.html +2 -2
  47. package/src/form-components/select/select.component.ts +31 -31
  48. package/src/form-components/tinymce/tinymce.component.ts +221 -221
  49. package/src/ngx-bos.config.ts +55 -55
  50. package/src/pages/form/form.component.ts +86 -86
  51. package/src/pages/form/form.routes.ts +1 -1
  52. package/src/pages/forms/forms.component.ts +15 -15
  53. package/src/pages/forms/forms.routes.ts +1 -1
  54. package/src/pipes/phone.pipe.ts +17 -17
  55. package/src/public-api.ts +36 -36
  56. package/types/wawjs-ngx-bos.d.ts +13 -9
@@ -1,57 +1,90 @@
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({
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
11
  imports: [TableComponent, CellDirective, InputComponent],
12
12
  templateUrl: './users.component.html',
13
+ styleUrl: './users.component.scss',
13
14
  })
14
- export class UsersComponent extends CrudComponent<
15
- UserService,
16
- User,
17
- FormInterface
18
- > {
15
+ export class UsersComponent extends CrudComponent<
16
+ UserService,
17
+ User,
18
+ FormInterface
19
+ > {
19
20
  protected override configType: 'server' | 'local' = 'local';
20
-
21
- protected override allowUrl(): boolean {
22
- return false;
23
- }
24
-
21
+ private readonly _formService = inject(FormService);
22
+
23
+ protected override allowUrl(): boolean {
24
+ return false;
25
+ }
26
+
25
27
  protected override async delete(doc: User) {
26
- this.userService.deleteAdmin(doc).subscribe(() => {
27
- this.setDocuments();
28
- });
28
+ this.userService.deleteAdmin(doc).subscribe(() => {
29
+ this.setDocuments();
30
+ });
29
31
  }
30
32
 
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();
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
+ }
42
40
 
43
- constructor() {
44
- super(
45
- userFormComponentsFactory(),
46
- inject(FormService),
47
- inject(UserService),
48
- 'user',
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,
49
54
  );
55
+ }
56
+
57
+ private _router = inject(Router);
58
+
59
+ userService = inject(UserService);
60
+
61
+ readonly roles = this._router.url.includes('admin')
62
+ ? this.userService.roles
63
+ : this.userService.employees;
64
+
65
+ columns = ['name', 'email'];
66
+
67
+ config = this.getConfig();
68
+
69
+ constructor() {
70
+ super(
71
+ userFormComponentsFactory(),
72
+ inject(FormService),
73
+ inject(UserService),
74
+ 'user',
75
+ );
76
+
77
+ this.setDocuments();
78
+
79
+ for (const role of this.userService.roles) {
80
+ this.columns.push(role);
81
+ }
82
+ }
50
83
 
51
- this.setDocuments();
52
-
53
- for (const role of this.userService.roles) {
54
- this.columns.push(role);
55
- }
84
+ updateRole(user: User, role: string, value: boolean): void {
85
+ user.is[role] = value;
86
+ this.userService.updateAdmin(user).subscribe(() => {
87
+ this.setDocuments();
88
+ });
56
89
  }
57
90
  }
@@ -1,6 +1,6 @@
1
1
  import { Routes } from '@angular/router';
2
2
 
3
- export const usersRoutes: Routes = [
3
+ export const usersRoutes: Routes = [
4
4
  {
5
5
  path: '',
6
6
  loadComponent: () =>
@@ -1,17 +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
- }
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
+ }
@@ -1,8 +1,8 @@
1
1
  import { User } from './user.interface';
2
2
 
3
- export const NEW_USER: User = {
4
- _id: '',
5
- data: {},
3
+ export const NEW_USER: User = {
4
+ _id: '',
5
+ data: {},
6
6
  is: {},
7
7
  roles: [],
8
8
  name: '',
@@ -1,54 +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
- };
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
+ };
@@ -1,12 +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
- }
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
+ }