@wawjs/ngx-bos 22.0.1 → 22.0.3
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 +27 -1
- package/ai/architecture.md +40 -2
- package/ai/decisions/2026-06-02-version-start.md +1 -1
- package/fesm2022/wawjs-ngx-bos.mjs +159 -107
- package/fesm2022/wawjs-ngx-bos.mjs.map +1 -1
- package/package.json +10 -10
- package/src/feature/file/file.component.html +1 -1
- package/src/feature/file/file.component.ts +25 -9
- package/src/feature/file/file.service.ts +7 -6
- package/src/feature/file/selectors/file/file-selector.component.html +2 -5
- package/src/feature/file/selectors/file/file-selector.component.ts +8 -11
- 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 -2
- package/src/feature/user/pages/users/users.component.scss +12 -0
- package/src/feature/user/pages/users/users.component.ts +42 -9
- package/src/feature/user/user.service.ts +13 -6
- package/src/form-components/input/input.component.html +1 -0
- package/src/form-components/select/select.component.html +2 -2
- package/src/icons/spider/spider.component.ts +4 -4
- package/src/ngx-bos.config.ts +1 -1
- package/src/pages/form/form.component.ts +8 -8
- package/src/public-api.ts +1 -1
- package/types/wawjs-ngx-bos.d.ts +15 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wawjs/ngx-bos",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.3",
|
|
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.3",
|
|
12
|
+
"@wawjs/ngx-crud": "^22.0.3",
|
|
13
|
+
"@wawjs/ngx-ace": "^22.0.3",
|
|
14
|
+
"@wawjs/ngx-fabric": "^22.0.3",
|
|
15
|
+
"@wawjs/ngx-form": "^22.0.3",
|
|
16
|
+
"@wawjs/ngx-http": "^22.0.3",
|
|
17
|
+
"@wawjs/ngx-tinymce": "^22.0.3",
|
|
18
|
+
"@wawjs/ngx-translate": "^22.0.3",
|
|
19
|
+
"@wawjs/ngx-ui": "^22.0.3",
|
|
20
20
|
"libphonenumber-js": "^1.13.7"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
@@ -62,7 +62,6 @@ export class FileComponent {
|
|
|
62
62
|
private readonly _modal = inject(ModalService);
|
|
63
63
|
private readonly _fs = inject(FileService);
|
|
64
64
|
|
|
65
|
-
readonly isDisabled = computed(() => this.disabled());
|
|
66
65
|
readonly isMultiple = computed(() => this.mode().startsWith('multi-'));
|
|
67
66
|
readonly isImageMode = computed(() => this.mode().includes('image'));
|
|
68
67
|
|
|
@@ -84,7 +83,7 @@ export class FileComponent {
|
|
|
84
83
|
});
|
|
85
84
|
|
|
86
85
|
triggerPick(input: HTMLInputElement): void {
|
|
87
|
-
if (!this.
|
|
86
|
+
if (!this.disabled()) {
|
|
88
87
|
input.click();
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -110,6 +109,9 @@ export class FileComponent {
|
|
|
110
109
|
const dataUrl = await fileToDataUrl(f);
|
|
111
110
|
|
|
112
111
|
if (doCrop) {
|
|
112
|
+
const cropWidth = this.cropWidth()!;
|
|
113
|
+
const cropHeight = this.cropHeight()!;
|
|
114
|
+
|
|
113
115
|
// Lazy-load fabric crop modal only when actually cropping
|
|
114
116
|
const { FabricCropModalComponent } = await import(
|
|
115
117
|
'@wawjs/ngx-fabric'
|
|
@@ -119,16 +121,19 @@ export class FileComponent {
|
|
|
119
121
|
component: FabricCropModalComponent,
|
|
120
122
|
size: 'big',
|
|
121
123
|
image: dataUrl,
|
|
122
|
-
width: this.cropWidth
|
|
123
|
-
height: this.cropHeight
|
|
124
|
-
aspectRatio:
|
|
125
|
-
outputWidth:
|
|
126
|
-
outputHeight:
|
|
124
|
+
width: this._cropStageWidth(cropWidth),
|
|
125
|
+
height: this._cropStageHeight(cropHeight),
|
|
126
|
+
aspectRatio: cropWidth / cropHeight,
|
|
127
|
+
outputWidth: cropWidth,
|
|
128
|
+
outputHeight: cropHeight,
|
|
127
129
|
onCrop: (result: FabricCropResult) => {
|
|
128
130
|
this._fs
|
|
129
131
|
.uploadBase64(result.base64, container, name)
|
|
130
132
|
.then((url) => {
|
|
131
|
-
|
|
133
|
+
if (url) {
|
|
134
|
+
urls.push(url);
|
|
135
|
+
}
|
|
136
|
+
|
|
132
137
|
resolve();
|
|
133
138
|
});
|
|
134
139
|
},
|
|
@@ -141,7 +146,10 @@ export class FileComponent {
|
|
|
141
146
|
container,
|
|
142
147
|
name,
|
|
143
148
|
);
|
|
144
|
-
|
|
149
|
+
|
|
150
|
+
if (url) {
|
|
151
|
+
urls.push(url);
|
|
152
|
+
}
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
// If single mode, ignore extra files after first
|
|
@@ -191,6 +199,14 @@ export class FileComponent {
|
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
201
|
|
|
202
|
+
private _cropStageWidth(width: number): number {
|
|
203
|
+
return Math.min(820, Math.max(width, Math.round(width * 1.45)));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private _cropStageHeight(height: number): number {
|
|
207
|
+
return Math.min(620, Math.max(height, Math.round(height * 1.12)));
|
|
208
|
+
}
|
|
209
|
+
|
|
194
210
|
private _applyNewUrls(urls: string[]): void {
|
|
195
211
|
const mode = this.mode();
|
|
196
212
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Service, inject } from '@angular/core';
|
|
2
2
|
import { CrudService } from '@wawjs/ngx-crud';
|
|
3
3
|
import { HttpService } from '@wawjs/ngx-http';
|
|
4
|
-
import { NGX_BOS_CONFIG } from '../../ngx-bos.config';
|
|
5
4
|
import { File } from './file.interface';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
interface UploadBase64Response {
|
|
7
|
+
publicUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Service()
|
|
8
11
|
export class FileService extends CrudService<File> {
|
|
9
12
|
private readonly _http = inject(HttpService);
|
|
10
|
-
private readonly _bosConfig = inject(NGX_BOS_CONFIG);
|
|
11
13
|
|
|
12
14
|
constructor() {
|
|
13
15
|
super({ name: 'file' });
|
|
@@ -26,8 +28,7 @@ export class FileService extends CrudService<File> {
|
|
|
26
28
|
this._http.post(
|
|
27
29
|
'/api/cloudflare/upload-base64',
|
|
28
30
|
{ container, name, dataUrl },
|
|
29
|
-
(resp:
|
|
30
|
-
resolve(this._bosConfig.cdnUrl + '/' + resp.key),
|
|
31
|
+
(resp: UploadBase64Response) => resolve(resp.publicUrl || ''),
|
|
31
32
|
);
|
|
32
33
|
});
|
|
33
34
|
}
|
|
@@ -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,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
inject,
|
|
4
|
-
input,
|
|
5
|
-
output,
|
|
6
|
-
Signal,
|
|
7
|
-
signal,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { SelectComponent } from '@wawjs/ngx-ui';
|
|
1
|
+
import { Component, inject, input, output } from '@angular/core';
|
|
2
|
+
import { SelectComponent, SelectValue } from '@wawjs/ngx-ui';
|
|
10
3
|
import { TranslateService } from '@wawjs/ngx-translate';
|
|
11
|
-
import {
|
|
4
|
+
import { FileService } from '../..';
|
|
12
5
|
|
|
13
6
|
@Component({
|
|
14
7
|
selector: 'file-selector',
|
|
@@ -21,7 +14,11 @@ export class FileSelectorComponent {
|
|
|
21
14
|
readonly wModel = input<string | null>(null, { alias: 'wModel' });
|
|
22
15
|
readonly wChange = output<string | null>();
|
|
23
16
|
|
|
24
|
-
readonly items
|
|
17
|
+
readonly items = this._files.documents;
|
|
25
18
|
|
|
26
19
|
readonly placeholder = this._translate.translate('Select file...');
|
|
20
|
+
|
|
21
|
+
onSelect(value: SelectValue): void {
|
|
22
|
+
this.wChange.emit((value ?? null) as string | null);
|
|
23
|
+
}
|
|
27
24
|
}
|
|
@@ -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,8 +7,9 @@
|
|
|
7
7
|
>
|
|
8
8
|
@for (role of roles; track role) {
|
|
9
9
|
<ng-template [cell]="role" let-user>
|
|
10
|
-
<winput
|
|
11
|
-
(
|
|
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
|
+
}
|
|
@@ -8,29 +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
|
-
|
|
11
|
+
imports: [TableComponent, CellDirective, InputComponent],
|
|
12
|
+
templateUrl: './users.component.html',
|
|
13
|
+
styleUrl: './users.component.scss',
|
|
14
|
+
})
|
|
14
15
|
export class UsersComponent extends CrudComponent<
|
|
15
16
|
UserService,
|
|
16
17
|
User,
|
|
17
18
|
FormInterface
|
|
18
19
|
> {
|
|
19
|
-
protected override configType: 'server' | 'local' = 'local';
|
|
20
|
+
protected override configType: 'server' | 'local' = 'local';
|
|
21
|
+
private readonly _formService = inject(FormService);
|
|
20
22
|
|
|
21
23
|
protected override allowUrl(): boolean {
|
|
22
24
|
return false;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
protected override async delete(doc: User) {
|
|
27
|
+
protected override async delete(doc: User) {
|
|
26
28
|
this.userService.deleteAdmin(doc).subscribe(() => {
|
|
27
29
|
this.setDocuments();
|
|
28
30
|
});
|
|
29
|
-
}
|
|
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
|
+
}
|
|
30
56
|
|
|
31
57
|
private _router = inject(Router);
|
|
32
58
|
|
|
33
|
-
userService = inject(UserService);
|
|
59
|
+
userService = inject(UserService);
|
|
34
60
|
|
|
35
61
|
readonly roles = this._router.url.includes('admin')
|
|
36
62
|
? this.userService.roles
|
|
@@ -53,5 +79,12 @@ export class UsersComponent extends CrudComponent<
|
|
|
53
79
|
for (const role of this.userService.roles) {
|
|
54
80
|
this.columns.push(role);
|
|
55
81
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
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,17 +19,21 @@ 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']);
|
|
24
27
|
|
|
25
28
|
employees = this._bosConfig.roles;
|
|
26
29
|
|
|
27
|
-
users =
|
|
30
|
+
readonly users = this.documents;
|
|
31
|
+
|
|
32
|
+
private readonly _storedUser = this._isBrowserPlatform ? localStorage.getItem('waw_user') : null;
|
|
28
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
|
|
|
@@ -37,7 +42,9 @@ export class UserService extends CrudService<User> {
|
|
|
37
42
|
|
|
38
43
|
return !thumb || thumb.includes(this._bosConfig.defaultUserThumb)
|
|
39
44
|
? this._bosConfig.defaultUserThumb
|
|
40
|
-
:
|
|
45
|
+
: /^https?:\/\//i.test(thumb)
|
|
46
|
+
? thumb
|
|
47
|
+
: this.url + thumb;
|
|
41
48
|
});
|
|
42
49
|
|
|
43
50
|
role(role: string): boolean {
|
|
@@ -79,7 +86,7 @@ export class UserService extends CrudService<User> {
|
|
|
79
86
|
},
|
|
80
87
|
});
|
|
81
88
|
|
|
82
|
-
if (localStorage.getItem('waw_user')) {
|
|
89
|
+
if (this._isBrowserPlatform && localStorage.getItem('waw_user')) {
|
|
83
90
|
this.fetch({}, { name: 'me' }).subscribe((user: User) => {
|
|
84
91
|
if (user) {
|
|
85
92
|
if (
|
|
@@ -12,5 +12,6 @@
|
|
|
12
12
|
[wClass]="data.props.wClass ?? inputDefaults.wClass"
|
|
13
13
|
[autocomplete]="data.props.autocomplete ?? inputDefaults.autocomplete"
|
|
14
14
|
[error]="data.props.error ?? inputDefaults.error"
|
|
15
|
+
(wChange)="data.props.onChange?.($event); data.wChange?.()"
|
|
15
16
|
></winput>
|
|
16
17
|
</ng-template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<ng-template #templateRef let-data>
|
|
2
2
|
<wselect
|
|
3
|
-
[formField]="data.
|
|
3
|
+
[formField]="data.field"
|
|
4
4
|
[items]="data.props.items ?? selectDefaults.items"
|
|
5
5
|
[placeholder]="
|
|
6
6
|
data.props.placeholder ?? selectDefaults.placeholder
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
data.props.disabled === true ||
|
|
20
20
|
data.component.disabled === true
|
|
21
21
|
"
|
|
22
|
-
(wChange)="data.props.onChange?.($event)"
|
|
22
|
+
(wChange)="data.props.onChange?.($event); data.wChange?.()"
|
|
23
23
|
></wselect>
|
|
24
24
|
</ng-template>
|
|
@@ -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>>(
|
|
@@ -48,14 +48,14 @@ export class FormComponent extends CrudComponent<
|
|
|
48
48
|
/** wtable config built by CrudComponent, aware of server mode */
|
|
49
49
|
config = this.getConfig();
|
|
50
50
|
|
|
51
|
-
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
super(formcomponentForm,
|
|
51
|
+
constructor() {
|
|
52
|
+
const formcomponentService = inject(FormcomponentService);
|
|
53
|
+
const formService = inject(FormService);
|
|
54
|
+
|
|
55
|
+
super(formcomponentForm, formService, formcomponentService, 'user');
|
|
56
56
|
|
|
57
57
|
effect(() => {
|
|
58
|
-
if (
|
|
58
|
+
if (formcomponentService.isLoaded()) {
|
|
59
59
|
this.setDocuments();
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -63,7 +63,7 @@ export class FormComponent extends CrudComponent<
|
|
|
63
63
|
this.config.buttons.unshift({
|
|
64
64
|
icon: 'settings',
|
|
65
65
|
click: (doc: Formcomponent) => {
|
|
66
|
-
|
|
66
|
+
formService.modal<Record<string, unknown>>(
|
|
67
67
|
FORM_COMPONENT_FORM(doc.name),
|
|
68
68
|
{
|
|
69
69
|
label: 'Update',
|
|
@@ -75,7 +75,7 @@ export class FormComponent extends CrudComponent<
|
|
|
75
75
|
...(updated as object),
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
formcomponentService.update(doc);
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
doc.props || {},
|
package/src/public-api.ts
CHANGED
package/types/wawjs-ngx-bos.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _wawjs_ngx_crud from '@wawjs/ngx-crud';
|
|
2
2
|
import { CrudDocument, CrudService, CrudComponent } from '@wawjs/ngx-crud';
|
|
3
|
-
import { FormComponentInterface, FormInterface, FormcomponentService, Formcomponent,
|
|
3
|
+
import { FormComponentInterface, FormInterface, FormcomponentService, Formcomponent, Form } from '@wawjs/ngx-form';
|
|
4
4
|
import * as rxjs from 'rxjs';
|
|
5
5
|
import * as _angular_core from '@angular/core';
|
|
6
|
-
import { InjectionToken, EnvironmentProviders, TemplateRef,
|
|
7
|
-
import { CountryCode } from 'libphonenumber-js';
|
|
6
|
+
import { InjectionToken, EnvironmentProviders, TemplateRef, Type, Provider, PipeTransform } from '@angular/core';
|
|
8
7
|
import * as _wawjs_ngx_bos from '@wawjs/ngx-bos';
|
|
9
8
|
import { SelectValue } from '@wawjs/ngx-ui';
|
|
9
|
+
import { CountryCode } from 'libphonenumber-js';
|
|
10
10
|
import { Routes, CanActivateFn } from '@angular/router';
|
|
11
11
|
|
|
12
12
|
interface NgxBosConfig {
|
|
@@ -54,7 +54,6 @@ declare class FileComponent {
|
|
|
54
54
|
readonly wFiles: _angular_core.ModelSignal<string[]>;
|
|
55
55
|
private readonly _modal;
|
|
56
56
|
private readonly _fs;
|
|
57
|
-
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
58
57
|
readonly isMultiple: _angular_core.Signal<boolean>;
|
|
59
58
|
readonly isImageMode: _angular_core.Signal<boolean>;
|
|
60
59
|
/** Normalized list of URLs for rendering */
|
|
@@ -64,6 +63,8 @@ declare class FileComponent {
|
|
|
64
63
|
onPicked(input: HTMLInputElement): Promise<void>;
|
|
65
64
|
removeAt(index: number): void;
|
|
66
65
|
clear(): void;
|
|
66
|
+
private _cropStageWidth;
|
|
67
|
+
private _cropStageHeight;
|
|
67
68
|
private _applyNewUrls;
|
|
68
69
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileComponent, never>;
|
|
69
70
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileComponent, "ngx-file", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "cropWidth": { "alias": "cropWidth"; "required": false; "isSignal": true; }; "cropHeight": { "alias": "cropHeight"; "required": false; "isSignal": true; }; "t_item": { "alias": "t_item"; "required": false; "isSignal": true; }; "t_empty": { "alias": "t_empty"; "required": false; "isSignal": true; }; "container": { "alias": "container"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "wImage": { "alias": "wImage"; "required": false; "isSignal": true; }; "wFile": { "alias": "wFile"; "required": false; "isSignal": true; }; "wImages": { "alias": "wImages"; "required": false; "isSignal": true; }; "wFiles": { "alias": "wFiles"; "required": false; "isSignal": true; }; }, { "wImage": "wImageChange"; "wFile": "wFileChange"; "wImages": "wImagesChange"; "wFiles": "wFilesChange"; }, never, never, true, never>;
|
|
@@ -81,7 +82,6 @@ interface ImageResizeBounds {
|
|
|
81
82
|
|
|
82
83
|
declare class FileService extends CrudService<File$1> {
|
|
83
84
|
private readonly _http;
|
|
84
|
-
private readonly _bosConfig;
|
|
85
85
|
constructor();
|
|
86
86
|
/**
|
|
87
87
|
* Upload base64 (data URL) to backend with optional container/name.
|
|
@@ -122,8 +122,9 @@ declare class FileSelectorComponent {
|
|
|
122
122
|
private _translate;
|
|
123
123
|
readonly wModel: _angular_core.InputSignal<string | null>;
|
|
124
124
|
readonly wChange: _angular_core.OutputEmitterRef<string | null>;
|
|
125
|
-
readonly items: Signal<File
|
|
125
|
+
readonly items: _angular_core.Signal<_wawjs_ngx_bos.File[]>;
|
|
126
126
|
readonly placeholder: _angular_core.WritableSignal<string>;
|
|
127
|
+
onSelect(value: SelectValue): void;
|
|
127
128
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileSelectorComponent, never>;
|
|
128
129
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileSelectorComponent, "file-selector", never, { "wModel": { "alias": "wModel"; "required": false; "isSignal": true; }; }, { "wChange": "wChange"; }, never, never, true, never>;
|
|
129
130
|
}
|
|
@@ -196,10 +197,12 @@ declare class UserService extends CrudService<User> {
|
|
|
196
197
|
private readonly _router;
|
|
197
198
|
private readonly _emitterService;
|
|
198
199
|
private readonly _bosConfig;
|
|
200
|
+
private readonly _isBrowserPlatform;
|
|
199
201
|
readonly url: string;
|
|
200
202
|
roles: string[];
|
|
201
203
|
employees: string[];
|
|
202
|
-
users: _angular_core.
|
|
204
|
+
readonly users: _angular_core.Signal<User[]>;
|
|
205
|
+
private readonly _storedUser;
|
|
203
206
|
user: _angular_core.WritableSignal<User>;
|
|
204
207
|
thumb: _angular_core.Signal<string>;
|
|
205
208
|
role(role: string): boolean;
|
|
@@ -239,14 +242,17 @@ declare class UserPreviewComponent {
|
|
|
239
242
|
|
|
240
243
|
declare class UsersComponent extends CrudComponent<UserService, User, FormInterface> {
|
|
241
244
|
protected configType: 'server' | 'local';
|
|
245
|
+
private readonly _formService;
|
|
242
246
|
protected allowUrl(): boolean;
|
|
243
247
|
protected delete(doc: User): Promise<void>;
|
|
248
|
+
protected update(doc: User): void;
|
|
244
249
|
private _router;
|
|
245
250
|
userService: UserService;
|
|
246
251
|
readonly roles: string[];
|
|
247
252
|
columns: string[];
|
|
248
253
|
config: _wawjs_ngx_crud.TableConfig<User>;
|
|
249
254
|
constructor();
|
|
255
|
+
updateRole(user: User, role: string, value: boolean): void;
|
|
250
256
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<UsersComponent, never>;
|
|
251
257
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<UsersComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
252
258
|
}
|
|
@@ -280,7 +286,7 @@ declare class FormComponent extends CrudComponent<FormcomponentService, Formcomp
|
|
|
280
286
|
columns: string[];
|
|
281
287
|
/** wtable config built by CrudComponent, aware of server mode */
|
|
282
288
|
config: _wawjs_ngx_crud.TableConfig<Formcomponent>;
|
|
283
|
-
constructor(
|
|
289
|
+
constructor();
|
|
284
290
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormComponent, never>;
|
|
285
291
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
286
292
|
}
|
|
@@ -325,7 +331,7 @@ declare class PhonePipe implements PipeTransform {
|
|
|
325
331
|
static ɵpipe: _angular_core.ɵɵPipeDeclaration<PhonePipe, "phone", true>;
|
|
326
332
|
}
|
|
327
333
|
|
|
328
|
-
declare const NGX_BOS_VERSION: "22.0.
|
|
334
|
+
declare const NGX_BOS_VERSION: "22.0.2";
|
|
329
335
|
type NgxBosVersion = typeof NGX_BOS_VERSION;
|
|
330
336
|
|
|
331
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 };
|