@wawjs/ngx-bos 22.0.5 → 22.0.6

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/ai/code-style.md CHANGED
@@ -31,3 +31,18 @@ Follow Angular 22 and local BOS conventions.
31
31
 
32
32
  Use the signal-based forms API for new forms when feasible. Keep dynamic form schemas registered
33
33
  through the existing form component registry.
34
+
35
+ ## Translation Files
36
+
37
+ - Translations use `@wawjs/ngx-translate` compact string arrays. `en.json` is the ordered
38
+ source array; every other language file in the same folder keeps the same order and length.
39
+ - `src/i18n/<lang>.json` holds shared interface text: layouts, shared components, common messages,
40
+ and pages with little text.
41
+ - A page with a large amount of text (for example a long landing page) gets its own bundle in
42
+ `src/i18n/<page>/<lang>.json`, with its own `en.json` source array. Load it from the page
43
+ with `TranslateService.loadExtraTranslation('/i18n/<page>/')`. Do not create page folders for
44
+ pages with only a few strings.
45
+ - Write attributes such as `alt` and `aria-label` as plain source-language text so they are present
46
+ in the rendered HTML.
47
+ - This is a browser-only SPA: source text is what users see until the translation file loads.
48
+ - When a string is removed from the source array, remove the same index from every language file.
@@ -1 +1 @@
1
- {"version":3,"file":"wawjs-ngx-bos-ngx-bos.config-B6tWU_X3.mjs","names":[],"sources":["../../../projects/ngx-bos/src/ngx-bos.config.ts"],"sourcesContent":["import {\r\n\tEnvironmentProviders,\r\n\tInjectionToken,\r\n\tProvider,\r\n\tmakeEnvironmentProviders,\r\n} from '@angular/core';\r\nimport { FormComponentInterface } from '@wawjs/ngx-form';\r\n\r\nexport interface NgxBosConfig {\r\n\tappId?: string;\r\n\turl?: string;\r\n\tcdnUrl?: string;\r\n\troles?: string[];\r\n\tuserFields?: string[];\r\n\tuserForm?: FormComponentInterface[];\r\n\tsignPath?: string;\r\n\tprofilePath?: string;\r\n\tdefaultUserThumb?: string;\r\n}\r\n\r\nexport const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {\r\n\tappId: '',\r\n\turl: '',\r\n\tcdnUrl: 'https://cdn.webart.work',\r\n\troles: [],\r\n\tuserFields: [],\r\n\tuserForm: [],\r\n\tsignPath: '/sign',\r\n\tprofilePath: '/profile',\r\n\tdefaultUserThumb: 'default.png',\n};\r\n\r\nexport const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(\r\n\t'NGX_BOS_CONFIG',\r\n\t{\r\n\t\tfactory: () => DEFAULT_NGX_BOS_CONFIG,\r\n\t},\r\n);\r\n\r\nexport function ngxBosProvide(config: NgxBosConfig = {}): EnvironmentProviders {\r\n\treturn makeEnvironmentProviders([\r\n\t\t{\r\n\t\t\tprovide: NGX_BOS_CONFIG,\r\n\t\t\tuseValue: {\r\n\t\t\t\t...DEFAULT_NGX_BOS_CONFIG,\r\n\t\t\t\t...config,\r\n\t\t\t\troles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,\r\n\t\t\t\tuserFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,\r\n\t\t\t\tuserForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,\r\n\t\t\t},\r\n\t\t} satisfies Provider,\r\n\t]);\r\n}\r\n\r\nexport const provideNgxBos = ngxBosProvide;\r\n"],"mappings":";AAoBA,MAAa,yBAAiD;CAC7D,OAAO;CACP,KAAK;CACL,QAAQ;CACR,OAAO,CAAA;CACP,YAAY,CAAA;CACZ,UAAU,CAAA;CACV,UAAU;CACV,aAAa;CACb,kBAAkB;AAClB;AAED,MAAa,iBAAiB,IAAI,eACjC,kBACA,EACC,eAAe,uBACf,CAAA;AAGF,SAAgB,cAAc,SAAuB,CAAA,GAAE;CACtD,OAAO,yBAAyB,CAC/B;EACC,SAAS;EACT,UAAU;GACT,GAAG;GACH,GAAG;GACH,OAAO,OAAO,SAAS,uBAAuB;GAC9C,YAAY,OAAO,cAAc,uBAAuB;GACxD,UAAU,OAAO,YAAY,uBAAuB;EACpD;CACkB,CACpB,CAAA;AACF;AAEA,MAAa,gBAAgB"}
1
+ {"version":3,"file":"wawjs-ngx-bos-ngx-bos.config-B6tWU_X3.mjs","names":[],"sources":["../../../projects/ngx-bos/src/ngx-bos.config.ts"],"sourcesContent":["import {\r\n\tEnvironmentProviders,\r\n\tInjectionToken,\r\n\tProvider,\r\n\tmakeEnvironmentProviders,\r\n} from '@angular/core';\r\nimport { FormComponentInterface } from '@wawjs/ngx-form';\r\n\r\nexport interface NgxBosConfig {\r\n\tappId?: string;\r\n\turl?: string;\r\n\tcdnUrl?: string;\r\n\troles?: string[];\r\n\tuserFields?: string[];\r\n\tuserForm?: FormComponentInterface[];\r\n\tsignPath?: string;\r\n\tprofilePath?: string;\r\n\tdefaultUserThumb?: string;\r\n}\r\n\r\nexport const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {\r\n\tappId: '',\r\n\turl: '',\r\n\tcdnUrl: 'https://cdn.webart.work',\r\n\troles: [],\r\n\tuserFields: [],\r\n\tuserForm: [],\r\n\tsignPath: '/sign',\r\n\tprofilePath: '/profile',\r\n\tdefaultUserThumb: 'default.png',\r\n};\r\n\r\nexport const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(\r\n\t'NGX_BOS_CONFIG',\r\n\t{\r\n\t\tfactory: () => DEFAULT_NGX_BOS_CONFIG,\r\n\t},\r\n);\r\n\r\nexport function ngxBosProvide(config: NgxBosConfig = {}): EnvironmentProviders {\r\n\treturn makeEnvironmentProviders([\r\n\t\t{\r\n\t\t\tprovide: NGX_BOS_CONFIG,\r\n\t\t\tuseValue: {\r\n\t\t\t\t...DEFAULT_NGX_BOS_CONFIG,\r\n\t\t\t\t...config,\r\n\t\t\t\troles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,\r\n\t\t\t\tuserFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,\r\n\t\t\t\tuserForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,\r\n\t\t\t},\r\n\t\t} satisfies Provider,\r\n\t]);\r\n}\r\n\r\nexport const provideNgxBos = ngxBosProvide;\r\n"],"mappings":";AAoBA,MAAa,yBAAiD;CAC7D,OAAO;CACP,KAAK;CACL,QAAQ;CACR,OAAO,CAAA;CACP,YAAY,CAAA;CACZ,UAAU,CAAA;CACV,UAAU;CACV,aAAa;CACb,kBAAkB;AAClB;AAED,MAAa,iBAAiB,IAAI,eACjC,kBACA,EACC,eAAe,uBACf,CAAA;AAGF,SAAgB,cAAc,SAAuB,CAAA,GAAE;CACtD,OAAO,yBAAyB,CAC/B;EACC,SAAS;EACT,UAAU;GACT,GAAG;GACH,GAAG;GACH,OAAO,OAAO,SAAS,uBAAuB;GAC9C,YAAY,OAAO,cAAc,uBAAuB;GACxD,UAAU,OAAO,YAAY,uBAAuB;EACpD;CACkB,CACpB,CAAA;AACF;AAEA,MAAa,gBAAgB"}
@@ -136,12 +136,18 @@ var UserService = class UserService extends CrudService {
136
136
  logout() {
137
137
  this.user.set(this.prepareDocument()());
138
138
  localStorage.removeItem(USER_STORAGE_KEY);
139
+ let finished = false;
140
+ const finish = () => {
141
+ if (finished) return;
142
+ finished = true;
143
+ this._router.navigateByUrl(this._bosConfig.signPath);
144
+ setTimeout(() => {
145
+ location.reload();
146
+ }, 100);
147
+ };
148
+ this._userHttpService.get("/api/user/logout", finish, { err: finish });
139
149
  this._userHttpService.remove("token");
140
- this._userHttpService.get("/api/user/logout");
141
- this._router.navigateByUrl(this._bosConfig.signPath);
142
- setTimeout(() => {
143
- location.reload();
144
- }, 100);
150
+ setTimeout(finish, 3e3);
145
151
  }
146
152
  updateAdmin(user) {
147
153
  return this.update(user, { name: "admin" });
@@ -178,4 +184,4 @@ i0.ɵɵngDeclareClassMetadata({
178
184
  });
179
185
  export { userFormComponentsFactory as i, readStoredUser as n, createUserFormComponents as r, UserService as t };
180
186
 
181
- //# sourceMappingURL=wawjs-ngx-bos-user.service-BL0vq7J4.mjs.map
187
+ //# sourceMappingURL=wawjs-ngx-bos-user.service-DFgHcvNR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wawjs-ngx-bos-user.service-DFgHcvNR.mjs","names":[],"sources":["../../../projects/ngx-bos/src/feature/user/user.form.ts","../../../projects/ngx-bos/src/feature/user/user.storage.ts","../../../projects/ngx-bos/src/feature/user/user.service.ts"],"sourcesContent":["import { inject } from '@angular/core';\r\nimport { FormComponentInterface } from '@wawjs/ngx-form';\r\nimport { NGX_BOS_CONFIG } from '../../ngx-bos.config';\r\n\r\nexport const createUserFormComponents = (\r\n\tuserForm: FormComponentInterface[] = [],\r\n) => ({\r\n\tformId: 'user',\r\n\ttitle: 'Profile Settings',\r\n\tcomponents: [\r\n\t\t{\r\n\t\t\tname: 'Input',\r\n\t\t\tkey: 'name',\r\n\t\t\tfocused: true,\r\n\t\t\tprops: {\r\n\t\t\t\tplaceholder: 'Enter name...',\r\n\t\t\t\tlabel: 'Name',\r\n\t\t\t},\r\n\t\t},\r\n\t\t{\r\n\t\t\tname: 'Input',\r\n\t\t\tkey: 'email',\r\n\t\t\tprops: {\r\n\t\t\t\tplaceholder: 'Enter email...',\r\n\t\t\t\tlabel: 'Email',\r\n\t\t\t\ttype: 'email',\r\n\t\t\t},\r\n\t\t},\r\n\t\t{\r\n\t\t\tname: 'Input',\r\n\t\t\tkey: 'phone',\r\n\t\t\tprops: {\r\n\t\t\t\tplaceholder: 'Enter phone...',\r\n\t\t\t\tlabel: 'Phone',\r\n\t\t\t},\r\n\t\t},\r\n\t\t{\r\n\t\t\tname: 'Input',\r\n\t\t\tkey: 'bio',\r\n\t\t\tprops: {\r\n\t\t\t\tplaceholder: 'Enter bio...',\r\n\t\t\t\tlabel: 'Biography',\r\n\t\t\t\ttype: 'textarea',\r\n\t\t\t},\r\n\t\t},\r\n\t\t...userForm,\r\n\t],\r\n});\r\n\r\nexport const userFormComponentsFactory = () => {\r\n\tconst config = inject(NGX_BOS_CONFIG);\r\n\r\n\treturn createUserFormComponents(config.userForm);\r\n};\r\n","import { User } from './user.interface';\r\n\r\n/** localStorage key holding the signed-in user snapshot. */\r\nexport const USER_STORAGE_KEY = 'waw_user';\r\n\r\n/**\r\n * Reads the stored user snapshot. Returns `null` when nothing is stored or when the\r\n * stored value is corrupted; a corrupted value is removed so it cannot break guards\r\n * or service initialization again.\r\n */\r\nexport function readStoredUser(): User | null {\r\n\tconst stored = localStorage.getItem(USER_STORAGE_KEY);\r\n\r\n\tif (!stored) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\ttry {\r\n\t\tconst user = JSON.parse(stored) as User | null;\r\n\r\n\t\tif (user && typeof user === 'object') {\r\n\t\t\treturn user;\r\n\t\t}\r\n\t} catch {\r\n\t\t// fall through to cleanup\r\n\t}\r\n\r\n\tlocalStorage.removeItem(USER_STORAGE_KEY);\r\n\r\n\treturn null;\r\n}\r\n","import { Service, computed, inject, signal } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { AlertService } from '@wawjs/ngx-ui';\r\nimport { CrudService } from '@wawjs/ngx-crud';\r\nimport { EmitterService } from '@wawjs/ngx-core';\r\nimport { HttpService } from '@wawjs/ngx-http';\r\nimport { NGX_BOS_CONFIG } from '../../ngx-bos.config';\r\nimport { User } from './user.interface';\r\nimport { readStoredUser, USER_STORAGE_KEY } from './user.storage';\r\n@Service()\r\nexport class UserService extends CrudService<User> {\r\n\tprivate readonly _userHttpService = inject(HttpService);\r\n\r\n\tprivate readonly _alertService = inject(AlertService);\r\n\r\n\tprivate readonly _router = inject(Router);\r\n\r\n\tprivate readonly _emitterService = inject(EmitterService);\r\n\r\n\tprivate readonly _bosConfig = inject(NGX_BOS_CONFIG);\r\n\r\n\treadonly url = this._bosConfig.url;\r\n\r\n\troles = this._bosConfig.roles.concat(['admin']);\r\n\r\n\temployees = this._bosConfig.roles;\r\n\r\n\treadonly users = this.documents;\r\n\r\n\tuser = signal<User>(readStoredUser() ?? this.prepareDocument()());\r\n\r\n\tthumb = computed(() => {\r\n\t\tconst thumb = this.user().thumb;\r\n\r\n\t\treturn !thumb || thumb.includes(this._bosConfig.defaultUserThumb)\r\n\t\t\t? this._bosConfig.defaultUserThumb\r\n\t\t\t: /^https?:\\/\\//i.test(thumb)\r\n\t\t\t\t? thumb\r\n\t\t\t\t: this.url + thumb;\r\n\t});\r\n\r\n\trole(role: string): boolean {\r\n\t\treturn !!(this.user().is || {})[role];\r\n\t}\r\n\r\n\treadonly usersByRole = computed<Record<string, User[]>>(() => {\r\n\t\tconst splitted: Record<string, User[]> = {};\r\n\r\n\t\tfor (const user of this.documents()) {\r\n\t\t\tfor (const role of user.roles || []) {\r\n\t\t\t\tif (role === undefined || role === null) continue;\r\n\t\t\t\t(splitted[String(role)] ??= []).push(user);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn splitted;\r\n\t});\r\n\r\n\tconstructor() {\r\n\t\tsuper({\r\n\t\t\tname: 'user',\r\n\t\t\treplace: (user) => {\r\n\t\t\t\tuser.roles = [];\r\n\t\t\t\tuser.data = user.data || {};\r\n\t\t\t\tuser.is = user.is || {};\r\n\r\n\t\t\t\tfor (const field of this._bosConfig.userFields) {\r\n\t\t\t\t\tuser.data[field] = user.data[field] || {};\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (const role of this.roles) {\r\n\t\t\t\t\tif (user.is[role]) {\r\n\t\t\t\t\t\tuser.roles.push(role);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn user;\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\tif (localStorage.getItem(USER_STORAGE_KEY)) {\r\n\t\t\tthis.fetch({}, { name: 'me' }).subscribe((user: User) => {\r\n\t\t\t\tif (user) {\r\n\t\t\t\t\tthis.setUser(user);\r\n\t\t\t\t} else if (localStorage.getItem(USER_STORAGE_KEY)) {\r\n\t\t\t\t\tthis.logout();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tthis.get({\r\n\t\t\t\tquery: this._bosConfig.appId ? 'appId=' + this._bosConfig.appId : '',\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\tsetUser(user: User) {\r\n\t\tthis.user.set(user);\r\n\r\n\t\tlocalStorage.setItem(USER_STORAGE_KEY, JSON.stringify(user));\r\n\r\n\t\tthis._emitterService.complete('us.user');\r\n\t}\r\n\r\n\tupdateMe() {\r\n\t\tthis.setUser(this.user());\r\n\r\n\t\treturn this.update(this.user()).subscribe(() => {\r\n\t\t\tthis._alertService.info({\r\n\t\t\t\ttext: 'Profile information has been updated',\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tupdateMeAfterWhile() {\r\n\t\tthis.setUser(this.user());\r\n\r\n\t\tthis.updateAfterWhile(this.user());\r\n\t}\r\n\r\n\tchangePassword(oldPass: string, newPass: string) {\r\n\t\treturn this._userHttpService.post(\r\n\t\t\t'/api/user/changePassword',\r\n\t\t\t{\r\n\t\t\t\tnewPass: newPass,\r\n\t\t\t\toldPass: oldPass,\r\n\t\t\t},\r\n\t\t\t(resp: boolean) => {\r\n\t\t\t\tif (resp) {\r\n\t\t\t\t\tthis._alertService.info({\r\n\t\t\t\t\t\ttext: 'Successfully changed password',\r\n\t\t\t\t\t});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._alertService.error({\r\n\t\t\t\t\t\ttext: 'Incorrect current password',\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t);\r\n\t}\r\n\r\n\tlogout() {\r\n\t\tthis.user.set(this.prepareDocument()());\r\n\r\n\t\tlocalStorage.removeItem(USER_STORAGE_KEY);\r\n\r\n\t\t// Reload only after the server has cleared the session cookie: reloading right away can\r\n\t\t// cancel the request and leave the session alive. Do not wait longer than 3s if the API is down.\r\n\t\tlet finished = false;\r\n\r\n\t\tconst finish = () => {\r\n\t\t\tif (finished) return;\r\n\r\n\t\t\tfinished = true;\r\n\r\n\t\t\tthis._router.navigateByUrl(this._bosConfig.signPath);\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tlocation.reload();\r\n\t\t\t}, 100);\r\n\t\t};\r\n\r\n\t\tthis._userHttpService.get('/api/user/logout', finish, { err: finish });\r\n\r\n\t\tthis._userHttpService.remove('token');\r\n\r\n\t\tsetTimeout(finish, 3000);\r\n\t}\r\n\r\n\tupdateAdmin(user: User) {\r\n\t\treturn this.update(user, {\r\n\t\t\tname: 'admin',\r\n\t\t});\r\n\t}\r\n\r\n\tdeleteAdmin(user: User) {\r\n\t\treturn this.delete(user, {\r\n\t\t\tname: 'admin',\r\n\t\t});\r\n\t}\r\n}\r\n"],"mappings":";;;;;;;;AAIA,MAAa,4BACZ,WAAqC,CAAA,OAChC;CACL,QAAQ;CACR,OAAO;CACP,YAAY;EACX;GACC,MAAM;GACN,KAAK;GACL,SAAS;GACT,OAAO;IACN,aAAa;IACb,OAAO;GACP;EACD;EACD;GACC,MAAM;GACN,KAAK;GACL,OAAO;IACN,aAAa;IACb,OAAO;IACP,MAAM;GACN;EACD;EACD;GACC,MAAM;GACN,KAAK;GACL,OAAO;IACN,aAAa;IACb,OAAO;GACP;EACD;EACD;GACC,MAAM;GACN,KAAK;GACL,OAAO;IACN,aAAa;IACb,OAAO;IACP,MAAM;GACN;EACD;EACD,GAAG;CACH;AACD;AAED,MAAa,kCAAiC;CAC7C,MAAM,SAAS,OAAO,cAAc;CAEpC,OAAO,yBAAyB,OAAO,QAAQ;AAChD;AClDA,MAAa,mBAAmB;AAOhC,SAAgB,iBAAc;CAC7B,MAAM,SAAS,aAAa,QAAQ,gBAAgB;CAEpD,IAAI,CAAC,QACJ,OAAO;CAGR,IAAI;EACH,MAAM,OAAO,KAAK,MAAM,MAAM;EAE9B,IAAI,QAAQ,OAAO,SAAS,UAC3B,OAAO;CAET,QAAQ,CAER;CAEA,aAAa,WAAW,gBAAgB;CAExC,OAAO;AACR;ACpBA,IAAa,cAAb,MAAa,oBAAoB,YAAiB;CA+BjD,KAAK,MAAY;EAChB,OAAO,CAAC,EAAE,KAAK,KAAI,CAAE,CAAC,MAAM,CAAA,EAAA,CAAI;CACjC;CAeA,cAA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I,UAAU;GAEd,WAAW;GAEX,KAAK,QAAQ,cAAc,KAAK,WAAW,QAAQ;GAEnD,iBAAgB;IACf,SAAS,OAAM;GAChB,GAAG,GAAG;EACP;EAEA,KAAK,iBAAiB,IAAI,oBAAoB,QAAQ,EAAE,KAAK,OAAM,CAAE;EAErE,KAAK,iBAAiB,OAAO,OAAO;EAEpC,WAAW,QAAQ,GAAI;CACxB;CAEA,YAAY,MAAU;EACrB,OAAO,KAAK,OAAO,MAAM,EACxB,MAAM,QACN,CAAA;CACF;CAEA,YAAY,MAAU;EACrB,OAAO,KAAK,OAAO,MAAM,EACxB,MAAM,QACN,CAAA;CACF;CAxKY;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAW,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAX;EAAA,KAAA,QAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAW,CAAA;CAAA;;AAAX,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA,EADvB,MAAA,Q"}
@@ -1,5 +1,5 @@
1
1
  import { i as provideNgxBos, n as NGX_BOS_CONFIG, r as ngxBosProvide, t as DEFAULT_NGX_BOS_CONFIG } from "./wawjs-ngx-bos-ngx-bos.config-B6tWU_X3.mjs";
2
- import { i as userFormComponentsFactory, n as readStoredUser, r as createUserFormComponents, t as UserService } from "./wawjs-ngx-bos-user.service-BL0vq7J4.mjs";
2
+ import { i as userFormComponentsFactory, n as readStoredUser, r as createUserFormComponents, t as UserService } from "./wawjs-ngx-bos-user.service-DFgHcvNR.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { APP_INITIALIZER, ApplicationRef, Component, EnvironmentInjector, Pipe, Service, computed, createComponent, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
5
5
  import { NgTemplateOutlet } from "@angular/common";
@@ -62,8 +62,10 @@ async function resizeImageToBounds(file, bounds) {
62
62
  canvas.width = width;
63
63
  canvas.height = height;
64
64
  canvas.getContext("2d")?.drawImage(img, 0, 0, width, height);
65
- resolve(canvas.toDataURL("image/jpeg", 1));
65
+ const type = file.type === "image/png" || file.type === "image/webp" ? file.type : "image/jpeg";
66
+ resolve(canvas.toDataURL(type, 1));
66
67
  };
68
+ img.onerror = () => resolve(original);
67
69
  img.src = original;
68
70
  });
69
71
  }
@@ -830,7 +832,7 @@ var FilesComponent = class FilesComponent {
830
832
  isStandalone: true,
831
833
  selector: "ng-component",
832
834
  ngImport: i0,
833
- template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows()\">\n <ng-template cell=\"img\" let-element>\n <img\n [src]=\"element.url || ''\"\n (click)=\"copy(element.url)\"\n style=\"height: 100px\"\n />\n </ng-template>\n <ng-template cell=\"url\" let-element>\n <span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\n </ng-template>\n</wtable>\n",
835
+ template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows()\">\r\n <ng-template cell=\"img\" let-element>\r\n <img\r\n [src]=\"element.url || ''\"\r\n (click)=\"copy(element.url)\"\r\n style=\"height: 100px\"\r\n />\r\n </ng-template>\r\n <ng-template cell=\"url\" let-element>\r\n <span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\r\n </ng-template>\r\n</wtable>\r\n",
834
836
  dependencies: [{
835
837
  kind: "component",
836
838
  type: TableComponent,
@@ -862,7 +864,7 @@ i0.ɵɵngDeclareClassMetadata({
862
864
  type: Component,
863
865
  args: [{
864
866
  imports: [TableComponent, CellDirective],
865
- template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows()\">\n <ng-template cell=\"img\" let-element>\n <img\n [src]=\"element.url || ''\"\n (click)=\"copy(element.url)\"\n style=\"height: 100px\"\n />\n </ng-template>\n <ng-template cell=\"url\" let-element>\n <span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\n </ng-template>\n</wtable>\n"
867
+ template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows()\">\r\n <ng-template cell=\"img\" let-element>\r\n <img\r\n [src]=\"element.url || ''\"\r\n (click)=\"copy(element.url)\"\r\n style=\"height: 100px\"\r\n />\r\n </ng-template>\r\n <ng-template cell=\"url\" let-element>\r\n <span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\r\n </ng-template>\r\n</wtable>\r\n"
866
868
  }]
867
869
  }],
868
870
  ctorParameters: () => []
@@ -3103,7 +3105,7 @@ i0.ɵɵngDeclareClassMetadata({
3103
3105
  args: [{ name: "phone" }]
3104
3106
  }]
3105
3107
  });
3106
- const NGX_BOS_VERSION = "22.0.4";
3108
+ const NGX_BOS_VERSION = "22.0.5";
3107
3109
  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 };
3108
3110
 
3109
3111
  //# sourceMappingURL=wawjs-ngx-bos.mjs.map