@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,221 +1,221 @@
1
- import {
2
- Component,
3
- OnInit,
4
- TemplateRef,
5
- inject,
6
- viewChild,
7
- } from '@angular/core';
8
- import { FormsModule } from '@angular/forms';
9
- import { TinymceComponent } from '@wawjs/ngx-tinymce';
10
- import { FormService } from '@wawjs/ngx-form';
11
- import { FormBridgeData } from '../form-bridge.interface';
12
-
13
- @Component({
14
- templateUrl: './tinymce.component.html',
15
- styleUrl: './tinymce.component.scss',
16
- imports: [FormsModule, TinymceComponent],
17
- })
18
- export class TinymceFormComponent implements OnInit {
19
- private readonly _form = inject(FormService);
20
-
21
- readonly templateRef =
22
- viewChild.required<TemplateRef<unknown>>('templateRef');
23
-
24
- ngOnInit(): void {
25
- this._form.addTemplateComponent('Tinymce', this.templateRef());
26
- }
27
-
28
- /** Read current value: prefer Signal Form field, fallback to raw submition. */
29
- getValue(data: FormBridgeData): string {
30
- const key = (data?.key as string | null) ?? null;
31
-
32
- // Signal Forms field (preferred)
33
- if (data?.field) {
34
- try {
35
- const state = data.field();
36
- if (state?.value && typeof state.value === 'function') {
37
- return (state.value() as string) ?? '';
38
- }
39
- } catch {
40
- // fall through
41
- }
42
- }
43
-
44
- // Model signal fallback
45
- if (data?.model && typeof data.model === 'function' && key) {
46
- const current = data.model() as Record<string, unknown>;
47
- return (current?.[key] as string) ?? '';
48
- }
49
-
50
- // Legacy submission object
51
- if (!key || !data?.submition) return '';
52
- return (data.submition[key] as string) ?? '';
53
- }
54
-
55
- /** Bridge TinyMCE -> Signal Forms (field/model) + legacy submition. */
56
- onValueChange(data: FormBridgeData, value: string): void {
57
- const key = data.key as string | null;
58
-
59
- // 1) Signal Forms field (preferred)
60
- if (data.field) {
61
- try {
62
- const state = data.field();
63
- if (state?.value?.set) {
64
- state.value.set(value);
65
- }
66
- } catch {
67
- // ignore and fall through
68
- }
69
- }
70
- // 2) Fallback to model signal if present
71
- else if (data.model && typeof data.model.update === 'function' && key) {
72
- data.model.update((current: Record<string, unknown>) => ({
73
- ...current,
74
- [key]: value,
75
- }));
76
- }
77
- // 3) Legacy: mutate submition object
78
- else if (data.submition && key) {
79
- data.submition[key] = value;
80
- }
81
-
82
- // Notify wform so it can emit debounced change + keep Modal submition in sync
83
- if (typeof data.wChange === 'function') {
84
- data.wChange();
85
- }
86
- }
87
-
88
- // ---- Props helpers (all via component.props) -----------------------------
89
-
90
- getConfig(data: FormBridgeData): any {
91
- const props = data?.props ?? {};
92
-
93
- const toNumber = (v: unknown): number | undefined => {
94
- if (v === null || v === undefined || v === '') return undefined;
95
- const n = Number(v);
96
- return Number.isNaN(n) ? undefined : n;
97
- };
98
-
99
- // Base config from simple props
100
- const config: any = {};
101
-
102
- // Layout
103
- const height = toNumber(props['height']);
104
- const minHeight = toNumber(props['minHeight']);
105
- const maxHeight = toNumber(props['maxHeight']);
106
- if (height !== undefined) config.height = height;
107
- if (minHeight !== undefined) config.min_height = minHeight;
108
- if (maxHeight !== undefined) config.max_height = maxHeight;
109
-
110
- // Toggles
111
- if (typeof props['menubar'] === 'boolean') {
112
- config.menubar = props['menubar'];
113
- }
114
- if (typeof props['statusbar'] === 'boolean') {
115
- config.statusbar = props['statusbar'];
116
- }
117
- if (typeof props['branding'] === 'boolean') {
118
- config.branding = props['branding'];
119
- }
120
- if (typeof props['pasteAsText'] === 'boolean') {
121
- config.paste_as_text = props['pasteAsText'];
122
- }
123
-
124
- // Toolbar presets
125
- if (props['toolbarPreset']) {
126
- const preset = String(props['toolbarPreset']);
127
- const toolbarMap: Record<string, string> = {
128
- basic: 'undo redo | bold italic underline | bullist numlist | link',
129
- standard:
130
- 'undo redo | styles | bold italic underline | alignleft aligncenter alignright | bullist numlist | link image table',
131
- full: 'undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | forecolor backcolor | removeformat',
132
- };
133
- if (preset !== 'custom' && toolbarMap[preset]) {
134
- config.toolbar = toolbarMap[preset];
135
- }
136
- }
137
-
138
- // Plugins presets
139
- if (props['pluginsPreset']) {
140
- const preset = String(props['pluginsPreset']);
141
- const pluginsMap: Record<string, string> = {
142
- minimal: 'lists link',
143
- standard: 'lists link image table code',
144
- media: 'lists link image media table code',
145
- all: 'advlist anchor autolink charmap code emoticons image link lists media searchreplace table visualblocks wordcount',
146
- };
147
- if (preset !== 'custom' && pluginsMap[preset]) {
148
- config.plugins = pluginsMap[preset];
149
- }
150
- }
151
-
152
- // Content behavior
153
- if (props['forceRootBlock']) {
154
- const value = String(props['forceRootBlock']);
155
- if (value === 'false') {
156
- config.forced_root_block = false;
157
- } else if (value === 'default') {
158
- // let TinyMCE decide; do not set
159
- } else {
160
- config.forced_root_block = value;
161
- }
162
- }
163
-
164
- // Uploads / assets
165
- if (props['imageUploadUrl']) {
166
- config.images_upload_url = String(props['imageUploadUrl']);
167
- }
168
-
169
- // Styling
170
- if (props['contentCss']) {
171
- config.content_css = String(props['contentCss']);
172
- }
173
- if (props['contentStyle']) {
174
- config.content_style = String(props['contentStyle']);
175
- }
176
- if (props['bodyClass']) {
177
- config.body_class = String(props['bodyClass']);
178
- }
179
-
180
- // Localization
181
- if (props['language']) {
182
- config.language = String(props['language']);
183
- }
184
- if (props['skin']) {
185
- config.skin = String(props['skin']);
186
- }
187
-
188
- // Raw config (object)
189
- const rawConfig = props['config'];
190
- if (rawConfig && typeof rawConfig === 'object') {
191
- Object.assign(config, rawConfig as Record<string, unknown>);
192
- }
193
-
194
- // Raw config JSON (string)
195
- const configJson = props['configJson'];
196
- if (typeof configJson === 'string' && configJson.trim()) {
197
- try {
198
- const json = JSON.parse(configJson);
199
- if (json && typeof json === 'object') {
200
- Object.assign(config, json);
201
- }
202
- } catch {
203
- // invalid JSON -> silently ignore, keep safe
204
- }
205
- }
206
-
207
- return config;
208
- }
209
-
210
- isDisabled(data: FormBridgeData): boolean {
211
- return !!(data?.props?.['disabled'] || data?.component?.disabled);
212
- }
213
-
214
- isInline(data: FormBridgeData): boolean {
215
- return (data?.props?.['inline'] as boolean) ?? false;
216
- }
217
-
218
- getPlaceholder(data: FormBridgeData): string {
219
- return (data?.props?.['placeholder'] as string) ?? '';
220
- }
221
- }
1
+ import {
2
+ Component,
3
+ OnInit,
4
+ TemplateRef,
5
+ inject,
6
+ viewChild,
7
+ } from '@angular/core';
8
+ import { FormsModule } from '@angular/forms';
9
+ import { TinymceComponent } from '@wawjs/ngx-tinymce';
10
+ import { FormService } from '@wawjs/ngx-form';
11
+ import { FormBridgeData } from '../form-bridge.interface';
12
+
13
+ @Component({
14
+ templateUrl: './tinymce.component.html',
15
+ styleUrl: './tinymce.component.scss',
16
+ imports: [FormsModule, TinymceComponent],
17
+ })
18
+ export class TinymceFormComponent implements OnInit {
19
+ private readonly _form = inject(FormService);
20
+
21
+ readonly templateRef =
22
+ viewChild.required<TemplateRef<unknown>>('templateRef');
23
+
24
+ ngOnInit(): void {
25
+ this._form.addTemplateComponent('Tinymce', this.templateRef());
26
+ }
27
+
28
+ /** Read current value: prefer Signal Form field, fallback to raw submition. */
29
+ getValue(data: FormBridgeData): string {
30
+ const key = (data?.key as string | null) ?? null;
31
+
32
+ // Signal Forms field (preferred)
33
+ if (data?.field) {
34
+ try {
35
+ const state = data.field();
36
+ if (state?.value && typeof state.value === 'function') {
37
+ return (state.value() as string) ?? '';
38
+ }
39
+ } catch {
40
+ // fall through
41
+ }
42
+ }
43
+
44
+ // Model signal fallback
45
+ if (data?.model && typeof data.model === 'function' && key) {
46
+ const current = data.model() as Record<string, unknown>;
47
+ return (current?.[key] as string) ?? '';
48
+ }
49
+
50
+ // Legacy submission object
51
+ if (!key || !data?.submition) return '';
52
+ return (data.submition[key] as string) ?? '';
53
+ }
54
+
55
+ /** Bridge TinyMCE -> Signal Forms (field/model) + legacy submition. */
56
+ onValueChange(data: FormBridgeData, value: string): void {
57
+ const key = data.key as string | null;
58
+
59
+ // 1) Signal Forms field (preferred)
60
+ if (data.field) {
61
+ try {
62
+ const state = data.field();
63
+ if (state?.value?.set) {
64
+ state.value.set(value);
65
+ }
66
+ } catch {
67
+ // ignore and fall through
68
+ }
69
+ }
70
+ // 2) Fallback to model signal if present
71
+ else if (data.model && typeof data.model.update === 'function' && key) {
72
+ data.model.update((current: Record<string, unknown>) => ({
73
+ ...current,
74
+ [key]: value,
75
+ }));
76
+ }
77
+ // 3) Legacy: mutate submition object
78
+ else if (data.submition && key) {
79
+ data.submition[key] = value;
80
+ }
81
+
82
+ // Notify wform so it can emit debounced change + keep Modal submition in sync
83
+ if (typeof data.wChange === 'function') {
84
+ data.wChange();
85
+ }
86
+ }
87
+
88
+ // ---- Props helpers (all via component.props) -----------------------------
89
+
90
+ getConfig(data: FormBridgeData): any {
91
+ const props = data?.props ?? {};
92
+
93
+ const toNumber = (v: unknown): number | undefined => {
94
+ if (v === null || v === undefined || v === '') return undefined;
95
+ const n = Number(v);
96
+ return Number.isNaN(n) ? undefined : n;
97
+ };
98
+
99
+ // Base config from simple props
100
+ const config: any = {};
101
+
102
+ // Layout
103
+ const height = toNumber(props['height']);
104
+ const minHeight = toNumber(props['minHeight']);
105
+ const maxHeight = toNumber(props['maxHeight']);
106
+ if (height !== undefined) config.height = height;
107
+ if (minHeight !== undefined) config.min_height = minHeight;
108
+ if (maxHeight !== undefined) config.max_height = maxHeight;
109
+
110
+ // Toggles
111
+ if (typeof props['menubar'] === 'boolean') {
112
+ config.menubar = props['menubar'];
113
+ }
114
+ if (typeof props['statusbar'] === 'boolean') {
115
+ config.statusbar = props['statusbar'];
116
+ }
117
+ if (typeof props['branding'] === 'boolean') {
118
+ config.branding = props['branding'];
119
+ }
120
+ if (typeof props['pasteAsText'] === 'boolean') {
121
+ config.paste_as_text = props['pasteAsText'];
122
+ }
123
+
124
+ // Toolbar presets
125
+ if (props['toolbarPreset']) {
126
+ const preset = String(props['toolbarPreset']);
127
+ const toolbarMap: Record<string, string> = {
128
+ basic: 'undo redo | bold italic underline | bullist numlist | link',
129
+ standard:
130
+ 'undo redo | styles | bold italic underline | alignleft aligncenter alignright | bullist numlist | link image table',
131
+ full: 'undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | forecolor backcolor | removeformat',
132
+ };
133
+ if (preset !== 'custom' && toolbarMap[preset]) {
134
+ config.toolbar = toolbarMap[preset];
135
+ }
136
+ }
137
+
138
+ // Plugins presets
139
+ if (props['pluginsPreset']) {
140
+ const preset = String(props['pluginsPreset']);
141
+ const pluginsMap: Record<string, string> = {
142
+ minimal: 'lists link',
143
+ standard: 'lists link image table code',
144
+ media: 'lists link image media table code',
145
+ all: 'advlist anchor autolink charmap code emoticons image link lists media searchreplace table visualblocks wordcount',
146
+ };
147
+ if (preset !== 'custom' && pluginsMap[preset]) {
148
+ config.plugins = pluginsMap[preset];
149
+ }
150
+ }
151
+
152
+ // Content behavior
153
+ if (props['forceRootBlock']) {
154
+ const value = String(props['forceRootBlock']);
155
+ if (value === 'false') {
156
+ config.forced_root_block = false;
157
+ } else if (value === 'default') {
158
+ // let TinyMCE decide; do not set
159
+ } else {
160
+ config.forced_root_block = value;
161
+ }
162
+ }
163
+
164
+ // Uploads / assets
165
+ if (props['imageUploadUrl']) {
166
+ config.images_upload_url = String(props['imageUploadUrl']);
167
+ }
168
+
169
+ // Styling
170
+ if (props['contentCss']) {
171
+ config.content_css = String(props['contentCss']);
172
+ }
173
+ if (props['contentStyle']) {
174
+ config.content_style = String(props['contentStyle']);
175
+ }
176
+ if (props['bodyClass']) {
177
+ config.body_class = String(props['bodyClass']);
178
+ }
179
+
180
+ // Localization
181
+ if (props['language']) {
182
+ config.language = String(props['language']);
183
+ }
184
+ if (props['skin']) {
185
+ config.skin = String(props['skin']);
186
+ }
187
+
188
+ // Raw config (object)
189
+ const rawConfig = props['config'];
190
+ if (rawConfig && typeof rawConfig === 'object') {
191
+ Object.assign(config, rawConfig as Record<string, unknown>);
192
+ }
193
+
194
+ // Raw config JSON (string)
195
+ const configJson = props['configJson'];
196
+ if (typeof configJson === 'string' && configJson.trim()) {
197
+ try {
198
+ const json = JSON.parse(configJson);
199
+ if (json && typeof json === 'object') {
200
+ Object.assign(config, json);
201
+ }
202
+ } catch {
203
+ // invalid JSON -> silently ignore, keep safe
204
+ }
205
+ }
206
+
207
+ return config;
208
+ }
209
+
210
+ isDisabled(data: FormBridgeData): boolean {
211
+ return !!(data?.props?.['disabled'] || data?.component?.disabled);
212
+ }
213
+
214
+ isInline(data: FormBridgeData): boolean {
215
+ return (data?.props?.['inline'] as boolean) ?? false;
216
+ }
217
+
218
+ getPlaceholder(data: FormBridgeData): string {
219
+ return (data?.props?.['placeholder'] as string) ?? '';
220
+ }
221
+ }
@@ -1,55 +1,55 @@
1
- import {
2
- EnvironmentProviders,
3
- InjectionToken,
4
- Provider,
5
- makeEnvironmentProviders,
6
- } from '@angular/core';
7
- import { FormComponentInterface } from '@wawjs/ngx-form';
8
-
9
- export interface NgxBosConfig {
10
- appId?: string;
11
- url?: string;
12
- cdnUrl?: string;
13
- roles?: string[];
14
- userFields?: string[];
15
- userForm?: FormComponentInterface[];
16
- signPath?: string;
17
- profilePath?: string;
18
- defaultUserThumb?: string;
19
- }
20
-
21
- export const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {
22
- appId: '',
23
- url: '',
24
- cdnUrl: 'https://cdn.webart.work',
25
- roles: [],
26
- userFields: [],
27
- userForm: [],
28
- signPath: '/sign',
29
- profilePath: '/profile',
30
- defaultUserThumb: 'assets/default.png',
31
- };
32
-
33
- export const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(
34
- 'NGX_BOS_CONFIG',
35
- {
36
- factory: () => DEFAULT_NGX_BOS_CONFIG,
37
- },
38
- );
39
-
40
- export function ngxBosProvide(config: NgxBosConfig = {}): EnvironmentProviders {
41
- return makeEnvironmentProviders([
42
- {
43
- provide: NGX_BOS_CONFIG,
44
- useValue: {
45
- ...DEFAULT_NGX_BOS_CONFIG,
46
- ...config,
47
- roles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,
48
- userFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,
49
- userForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,
50
- },
51
- } satisfies Provider,
52
- ]);
53
- }
54
-
55
- export const provideNgxBos = ngxBosProvide;
1
+ import {
2
+ EnvironmentProviders,
3
+ InjectionToken,
4
+ Provider,
5
+ makeEnvironmentProviders,
6
+ } from '@angular/core';
7
+ import { FormComponentInterface } from '@wawjs/ngx-form';
8
+
9
+ export interface NgxBosConfig {
10
+ appId?: string;
11
+ url?: string;
12
+ cdnUrl?: string;
13
+ roles?: string[];
14
+ userFields?: string[];
15
+ userForm?: FormComponentInterface[];
16
+ signPath?: string;
17
+ profilePath?: string;
18
+ defaultUserThumb?: string;
19
+ }
20
+
21
+ export const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {
22
+ appId: '',
23
+ url: '',
24
+ cdnUrl: 'https://cdn.webart.work',
25
+ roles: [],
26
+ userFields: [],
27
+ userForm: [],
28
+ signPath: '/sign',
29
+ profilePath: '/profile',
30
+ defaultUserThumb: 'assets/default.png',
31
+ };
32
+
33
+ export const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(
34
+ 'NGX_BOS_CONFIG',
35
+ {
36
+ factory: () => DEFAULT_NGX_BOS_CONFIG,
37
+ },
38
+ );
39
+
40
+ export function ngxBosProvide(config: NgxBosConfig = {}): EnvironmentProviders {
41
+ return makeEnvironmentProviders([
42
+ {
43
+ provide: NGX_BOS_CONFIG,
44
+ useValue: {
45
+ ...DEFAULT_NGX_BOS_CONFIG,
46
+ ...config,
47
+ roles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,
48
+ userFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,
49
+ userForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,
50
+ },
51
+ } satisfies Provider,
52
+ ]);
53
+ }
54
+
55
+ export const provideNgxBos = ngxBosProvide;