@indigina/ui-kit 1.1.426 → 1.1.428

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.
@@ -9395,12 +9395,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
9395
9395
 
9396
9396
  const KIT_GRID_CELL_DATE_FORMAT_CONFIG = new InjectionToken('KIT_GRID_CELL_DATE_FORMAT_CONFIG');
9397
9397
 
9398
+ class KitUserApiService {
9399
+ constructor() {
9400
+ this.httpClient = inject(HttpClient);
9401
+ this.basePath = inject(KIT_BASE_PATH);
9402
+ this.userPath = inject(KIT_USER_PATH);
9403
+ this.userApplicationsPath = inject(KIT_USER_APPLICATIONS_PATH);
9404
+ }
9405
+ getUserInfo() {
9406
+ const url = `${this.basePath}/${this.userPath}`;
9407
+ return this.httpClient.get(url);
9408
+ }
9409
+ getUserApplicationList() {
9410
+ const url = `${this.basePath}/${this.userApplicationsPath}`;
9411
+ return this.httpClient.get(url);
9412
+ }
9413
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9414
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, providedIn: 'root' }); }
9415
+ }
9416
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, decorators: [{
9417
+ type: Injectable,
9418
+ args: [{
9419
+ providedIn: 'root',
9420
+ }]
9421
+ }] });
9422
+
9423
+ class FetchUser {
9424
+ static { this.type = '[User] Fetch'; }
9425
+ }
9426
+
9427
+ const KIT_USER_STATE_TOKEN = new StateToken('user');
9428
+ let KitUserState = class KitUserState {
9429
+ constructor() {
9430
+ this.kitUserApiService = inject(KitUserApiService);
9431
+ }
9432
+ fetchUser(ctx) {
9433
+ return this.kitUserApiService.getUserInfo().pipe(tap(user => ctx.setState({
9434
+ data: user,
9435
+ loading: false,
9436
+ })));
9437
+ }
9438
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9439
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState }); }
9440
+ };
9441
+ __decorate([
9442
+ Action(FetchUser)
9443
+ ], KitUserState.prototype, "fetchUser", null);
9444
+ KitUserState = __decorate([
9445
+ State({
9446
+ name: KIT_USER_STATE_TOKEN,
9447
+ defaults: {
9448
+ data: null,
9449
+ loading: true,
9450
+ },
9451
+ })
9452
+ ], KitUserState);
9453
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState, decorators: [{
9454
+ type: Injectable
9455
+ }], propDecorators: { fetchUser: [] } });
9456
+
9398
9457
  class KitGridCellService {
9399
9458
  constructor() {
9400
9459
  this.translateService = inject(TranslateService);
9401
9460
  this.decimalPipe = inject(DecimalPipe);
9402
9461
  this.datePipe = inject(DatePipe);
9403
9462
  this.dateFormatConfig = inject(KIT_GRID_CELL_DATE_FORMAT_CONFIG, { optional: true });
9463
+ this.store = inject(Store);
9464
+ this.userState = this.store.selectSignal(KIT_USER_STATE_TOKEN)();
9404
9465
  const dateFormatConfig = this.dateFormatConfig;
9405
9466
  this.dateFormat = dateFormatConfig?.dateFormat ?? KIT_DATE_FORMAT;
9406
9467
  this.dateTimeFormat = dateFormatConfig?.dateTimeFormat ?? KIT_DATETIME_FORMAT_LONG;
@@ -9421,6 +9482,10 @@ class KitGridCellService {
9421
9482
  return this.datePipe.transform(value, this.dateFormat) ?? defaultValue;
9422
9483
  case 'dateTimeLocal':
9423
9484
  return this.datePipe.transform(value, this.dateTimeFormat) ?? defaultValue;
9485
+ case 'dateZone':
9486
+ return this.formatDateWithUserTimezone(value, this.dateFormat) ?? defaultValue;
9487
+ case 'dateTimeZone':
9488
+ return this.formatDateWithUserTimezone(value, this.dateTimeFormat) ?? defaultValue;
9424
9489
  case 'boolean':
9425
9490
  return this.translateService.instant(value ? 'common.yes' : 'common.no');
9426
9491
  default:
@@ -9434,6 +9499,16 @@ class KitGridCellService {
9434
9499
  }
9435
9500
  return value;
9436
9501
  }
9502
+ formatDateWithUserTimezone(value, format) {
9503
+ if (!value) {
9504
+ return null;
9505
+ }
9506
+ return this.datePipe.transform(new Intl.DateTimeFormat('en-GB', {
9507
+ timeZone: this.userState.data?.namedTimeZone ?? 'UTC',
9508
+ dateStyle: 'medium',
9509
+ timeStyle: 'medium',
9510
+ }).format(new Date(value)), format);
9511
+ }
9437
9512
  getNestedGridCellValue(dataItem, field) {
9438
9513
  const value = field.split('.').reduce((acc, key) => acc !== null && typeof acc === 'object' && key in acc
9439
9514
  ? acc[key]
@@ -10099,31 +10174,6 @@ class FetchUserApplications {
10099
10174
  static { this.type = '[User] FetchApplications'; }
10100
10175
  }
10101
10176
 
10102
- class KitUserApiService {
10103
- constructor() {
10104
- this.httpClient = inject(HttpClient);
10105
- this.basePath = inject(KIT_BASE_PATH);
10106
- this.userPath = inject(KIT_USER_PATH);
10107
- this.userApplicationsPath = inject(KIT_USER_APPLICATIONS_PATH);
10108
- }
10109
- getUserInfo() {
10110
- const url = `${this.basePath}/${this.userPath}`;
10111
- return this.httpClient.get(url);
10112
- }
10113
- getUserApplicationList() {
10114
- const url = `${this.basePath}/${this.userApplicationsPath}`;
10115
- return this.httpClient.get(url);
10116
- }
10117
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10118
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, providedIn: 'root' }); }
10119
- }
10120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserApiService, decorators: [{
10121
- type: Injectable,
10122
- args: [{
10123
- providedIn: 'root',
10124
- }]
10125
- }] });
10126
-
10127
10177
  const KIT_USER_APPLICATIONS_STATE_TOKEN = new StateToken('userApplications');
10128
10178
  let KitUserApplicationsState = class KitUserApplicationsState {
10129
10179
  constructor() {
@@ -10180,40 +10230,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
10180
10230
  ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"kit-sidebar\">\n @if (menuItems$ | async; as menuItems) {\n <kit-navigation-menu class=\"navigation-menu\"\n logoPath=\"assets/config/logo.svg\"\n [menuItems]=\"menuItems\"\n [appsMenuItems]=\"(appsMenuItems$ | async) ?? []\"\n ></kit-navigation-menu>\n }\n</div>\n\n", styles: [".kit-sidebar{height:100%}.kit-sidebar .navigation-menu{display:block;height:100%}.kit-sidebar .navigation-menu ::ng-deep .logo-wrapper{display:flex;justify-content:center;align-items:center}\n"] }]
10181
10231
  }], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], hasSelectedClient: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasSelectedClient", required: false }] }] } });
10182
10232
 
10183
- class FetchUser {
10184
- static { this.type = '[User] Fetch'; }
10185
- }
10186
-
10187
- const KIT_USER_STATE_TOKEN = new StateToken('user');
10188
- let KitUserState = class KitUserState {
10189
- constructor() {
10190
- this.kitUserApiService = inject(KitUserApiService);
10191
- }
10192
- fetchUser(ctx) {
10193
- return this.kitUserApiService.getUserInfo().pipe(tap(user => ctx.setState({
10194
- data: user,
10195
- loading: false,
10196
- })));
10197
- }
10198
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10199
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState }); }
10200
- };
10201
- __decorate([
10202
- Action(FetchUser)
10203
- ], KitUserState.prototype, "fetchUser", null);
10204
- KitUserState = __decorate([
10205
- State({
10206
- name: KIT_USER_STATE_TOKEN,
10207
- defaults: {
10208
- data: null,
10209
- loading: true,
10210
- },
10211
- })
10212
- ], KitUserState);
10213
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitUserState, decorators: [{
10214
- type: Injectable
10215
- }], propDecorators: { fetchUser: [] } });
10216
-
10217
10233
  class KitTopBarUserComponent {
10218
10234
  constructor() {
10219
10235
  this.store = inject(Store);