@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,117 +1,117 @@
1
- import { Clipboard } from '@angular/cdk/clipboard';
2
- import { Component, inject } from '@angular/core';
3
- import { AlertService, TableComponent } from '@wawjs/ngx-ui';
4
- import { FormInterface, FormService } from '@wawjs/ngx-form';
5
- import { CoreService } from '@wawjs/ngx-core';
6
- import { File, FileService } from '../..';
7
-
8
- const fileFormComponents = {
9
- title: 'File',
10
- components: [
11
- {
12
- name: 'Input',
13
- key: 'url',
14
- props: {
15
- label: 'URL',
16
- placeholder: 'Enter file URL...',
17
- },
18
- },
19
- {
20
- name: 'Input',
21
- key: 'name',
22
- props: {
23
- label: 'Name',
24
- placeholder: 'Enter name...',
25
- },
26
- },
27
- {
28
- name: 'Input',
29
- key: 'description',
30
- props: {
31
- label: 'Description',
32
- placeholder: 'Enter description...',
33
- type: 'textarea',
34
- },
35
- },
36
- ],
37
- } as FormInterface;
38
-
39
- @Component({
40
- templateUrl: './files.component.html',
41
- imports: [TableComponent],
42
- })
43
- export class FilesComponent {
44
- private _fileService = inject(FileService);
45
- private _clipboard = inject(Clipboard);
46
- private _alert = inject(AlertService);
47
- private _form = inject(FormService);
48
- private _core = inject(CoreService);
49
-
50
- columns = ['img', 'url'];
51
-
52
- form = fileFormComponents;
53
-
54
- config = {
55
- paginate: this.setRows.bind(this),
56
- perPage: 20,
57
- setPerPage: this._fileService.setPerPage.bind(this._fileService),
58
- allDocs: false,
59
- create: (): void => {
60
- this._form.modal<File>(this.form, {
61
- label: 'Create',
62
- click: async (created: unknown, close: () => void) => {
63
- close();
64
- this._preCreate(created as File);
65
- this._fileService.create(created as File);
66
- this.setRows();
67
- },
68
- });
69
- },
70
- delete: (doc: File): void => {
71
- this._alert.question({
72
- text: 'Are you sure you want to delete this file?',
73
- buttons: [
74
- { text: 'No' },
75
- {
76
- text: 'Yes',
77
- callback: async (): Promise<void> => {
78
- this._fileService.delete(doc);
79
- this.setRows();
80
- },
81
- },
82
- ],
83
- });
84
- },
85
- };
86
-
87
- rows: File[] = [];
88
-
89
- constructor() {
90
- this.setRows();
91
- }
92
-
93
- copy(text: string): void {
94
- this._clipboard.copy(text);
95
- this._alert.info({ text: 'Url has been copied' });
96
- }
97
-
98
- setRows(page = this._page): void {
99
- this._page = page;
100
- this._core.afterWhile(
101
- this,
102
- () => {
103
- this._fileService.get({ page }).subscribe((rows) => {
104
- this.rows.splice(0, this.rows.length);
105
- this.rows.push(...rows);
106
- });
107
- },
108
- 250,
109
- );
110
- }
111
-
112
- private _page = 1;
113
-
114
- private _preCreate(file: File): void {
115
- delete (file as any).__created;
116
- }
117
- }
1
+ import { Clipboard } from '@angular/cdk/clipboard';
2
+ import { Component, inject } from '@angular/core';
3
+ import { AlertService, TableComponent } from '@wawjs/ngx-ui';
4
+ import { FormInterface, FormService } from '@wawjs/ngx-form';
5
+ import { CoreService } from '@wawjs/ngx-core';
6
+ import { File, FileService } from '../..';
7
+
8
+ const fileFormComponents = {
9
+ title: 'File',
10
+ components: [
11
+ {
12
+ name: 'Input',
13
+ key: 'url',
14
+ props: {
15
+ label: 'URL',
16
+ placeholder: 'Enter file URL...',
17
+ },
18
+ },
19
+ {
20
+ name: 'Input',
21
+ key: 'name',
22
+ props: {
23
+ label: 'Name',
24
+ placeholder: 'Enter name...',
25
+ },
26
+ },
27
+ {
28
+ name: 'Input',
29
+ key: 'description',
30
+ props: {
31
+ label: 'Description',
32
+ placeholder: 'Enter description...',
33
+ type: 'textarea',
34
+ },
35
+ },
36
+ ],
37
+ } as FormInterface;
38
+
39
+ @Component({
40
+ templateUrl: './files.component.html',
41
+ imports: [TableComponent],
42
+ })
43
+ export class FilesComponent {
44
+ private _fileService = inject(FileService);
45
+ private _clipboard = inject(Clipboard);
46
+ private _alert = inject(AlertService);
47
+ private _form = inject(FormService);
48
+ private _core = inject(CoreService);
49
+
50
+ columns = ['img', 'url'];
51
+
52
+ form = fileFormComponents;
53
+
54
+ config = {
55
+ paginate: this.setRows.bind(this),
56
+ perPage: 20,
57
+ setPerPage: this._fileService.setPerPage.bind(this._fileService),
58
+ allDocs: false,
59
+ create: (): void => {
60
+ this._form.modal<File>(this.form, {
61
+ label: 'Create',
62
+ click: async (created: unknown, close: () => void) => {
63
+ close();
64
+ this._preCreate(created as File);
65
+ this._fileService.create(created as File);
66
+ this.setRows();
67
+ },
68
+ });
69
+ },
70
+ delete: (doc: File): void => {
71
+ this._alert.question({
72
+ text: 'Are you sure you want to delete this file?',
73
+ buttons: [
74
+ { text: 'No' },
75
+ {
76
+ text: 'Yes',
77
+ callback: async (): Promise<void> => {
78
+ this._fileService.delete(doc);
79
+ this.setRows();
80
+ },
81
+ },
82
+ ],
83
+ });
84
+ },
85
+ };
86
+
87
+ rows: File[] = [];
88
+
89
+ constructor() {
90
+ this.setRows();
91
+ }
92
+
93
+ copy(text: string): void {
94
+ this._clipboard.copy(text);
95
+ this._alert.info({ text: 'Url has been copied' });
96
+ }
97
+
98
+ setRows(page = this._page): void {
99
+ this._page = page;
100
+ this._core.afterWhile(
101
+ this,
102
+ () => {
103
+ this._fileService.get({ page }).subscribe((rows) => {
104
+ this.rows.splice(0, this.rows.length);
105
+ this.rows.push(...rows);
106
+ });
107
+ },
108
+ 250,
109
+ );
110
+ }
111
+
112
+ private _page = 1;
113
+
114
+ private _preCreate(file: File): void {
115
+ delete (file as any).__created;
116
+ }
117
+ }
@@ -1,9 +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
- ];
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
+ ];
@@ -1,11 +1,8 @@
1
1
  <wselect
2
2
  [placeholder]="placeholder()"
3
3
  [items]="items()"
4
+ [wModel]="wModel()"
5
+ (wChange)="onSelect($event)"
4
6
  bindLabel="name"
5
7
  bindValue="_id"
6
8
  ></wselect>
7
-
8
- <!--
9
- [(wModel)]="wModel()"
10
- (wChange)="wChange.emit($event as string | null)"
11
- -->
@@ -1,27 +1,24 @@
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
- }
1
+ import { Component, inject, input, output } from '@angular/core';
2
+ import { SelectComponent, SelectValue } from '@wawjs/ngx-ui';
3
+ import { TranslateService } from '@wawjs/ngx-translate';
4
+ import { FileService } from '../..';
5
+
6
+ @Component({
7
+ selector: 'file-selector',
8
+ imports: [SelectComponent],
9
+ templateUrl: './file-selector.component.html',
10
+ })
11
+ export class FileSelectorComponent {
12
+ private _files = inject(FileService);
13
+ private _translate = inject(TranslateService);
14
+ readonly wModel = input<string | null>(null, { alias: 'wModel' });
15
+ readonly wChange = output<string | null>();
16
+
17
+ readonly items = this._files.documents;
18
+
19
+ readonly placeholder = this._translate.translate('Select file...');
20
+
21
+ onSelect(value: SelectValue): void {
22
+ this.wChange.emit((value ?? null) as string | null);
23
+ }
24
+ }
@@ -1,22 +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
- };
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
+ };
@@ -1,14 +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
- };
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
+ };
@@ -1,14 +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
- };
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
+ };
@@ -1,45 +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
- }
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
+ }
@@ -1,6 +1,6 @@
1
1
  import { Routes } from '@angular/router';
2
2
 
3
- export const clientsRoutes: Routes = [
3
+ export const clientsRoutes: Routes = [
4
4
  {
5
5
  path: '',
6
6
  loadComponent: () =>
@@ -7,8 +7,9 @@
7
7
  >
8
8
  @for (role of roles; track role) {
9
9
  <ng-template [cell]="role" let-user>
10
- <winput
11
- (wChange)="user.is[role] = $event; update(user)"
10
+ <winput
11
+ (click)="$event.stopPropagation()"
12
+ (wChange)="updateRole(user, role, !!$event)"
12
13
  [wModel]="user.is[role]"
13
14
  type="checkbox"
14
15
  />
@@ -0,0 +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
+ }