@indigina/ui-kit 1.1.280 → 1.1.281

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.
@@ -1,7 +1,7 @@
1
1
  import * as i1$5 from '@angular/common';
2
2
  import { NgClass, NgTemplateOutlet, CommonModule, AsyncPipe, DatePipe, TitleCasePipe, DecimalPipe } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Input, ChangeDetectionStrategy, Component, input, EventEmitter, Output, ViewEncapsulation, effect, inject, ElementRef, NgZone, Renderer2, Directive, ChangeDetectorRef, viewChild, forwardRef, ViewChild, HostListener, signal, TemplateRef, ContentChild, Injectable, output, computed, NgModule, RendererFactory2, DOCUMENT, ViewContainerRef, DestroyRef, model, contentChildren, ContentChildren, viewChildren, Pipe, InjectionToken, contentChild } from '@angular/core';
4
+ import { Input, ChangeDetectionStrategy, Component, input, EventEmitter, Output, ViewEncapsulation, effect, inject, ElementRef, NgZone, Renderer2, Directive, ChangeDetectorRef, viewChild, forwardRef, ViewChild, HostListener, signal, TemplateRef, ContentChild, Injectable, output, computed, NgModule, RendererFactory2, DOCUMENT, ViewContainerRef, DestroyRef, model, contentChildren, ContentChildren, viewChildren, Pipe, InjectionToken, contentChild, Injector, runInInjectionContext } from '@angular/core';
5
5
  import * as i1 from '@progress/kendo-angular-buttons';
6
6
  import { ButtonModule, ButtonGroupModule } from '@progress/kendo-angular-buttons';
7
7
  import * as i1$1 from '@progress/kendo-angular-label';
@@ -52,8 +52,8 @@ import { signalSetFn, SIGNAL } from '@angular/core/primitives/signals';
52
52
  import { StateReset } from 'ngxs-reset-plugin';
53
53
  import { pdf } from '@progress/kendo-drawing';
54
54
  import { saveAs, encodeBase64 } from '@progress/kendo-file-saver';
55
- import { Workbook } from '@progress/kendo-ooxml';
56
55
  import { json2csv } from 'json-2-csv';
56
+ import { Workbook } from '@progress/kendo-ooxml';
57
57
  import * as i1$d from '@progress/kendo-angular-scheduler';
58
58
  import { ToolbarService, KENDO_SCHEDULER } from '@progress/kendo-angular-scheduler';
59
59
  import { catchError as catchError$1, map as map$1 } from 'rxjs/operators';
@@ -8187,6 +8187,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
8187
8187
  type: Injectable
8188
8188
  }], ctorParameters: () => [] });
8189
8189
 
8190
+ const kitExportExcel = async (data, exportedColumns, exportedFileName, translationMap) => {
8191
+ const translateService = inject(TranslateService);
8192
+ const workbook = { sheets: [{ rows: [], columns: [] }] };
8193
+ const columns = exportedColumns
8194
+ .map(({ title, field }) => ({
8195
+ value: translateService.instant(title || field),
8196
+ background: '#7a7a7a',
8197
+ color: '#fff',
8198
+ width: 170,
8199
+ }));
8200
+ workbook.sheets[0].rows = getExportedExcelRows(columns, data, exportedColumns, translationMap);
8201
+ workbook.sheets[0].columns = columns;
8202
+ const dataUrl = await new Workbook(workbook).toDataURL();
8203
+ return saveAs(dataUrl, `${exportedFileName}.xlsx`);
8204
+ };
8205
+ const getExportedExcelRows = (columns, data, gridColumns, translationMap) => {
8206
+ const gridCellService = inject(KitGridCellService);
8207
+ const rows = [{ cells: columns, type: 'header' }];
8208
+ for (const row of data) {
8209
+ const rowCells = gridColumns.map((column) => {
8210
+ const value = row[column.field];
8211
+ if (column.excelFormat) {
8212
+ switch (column.type) {
8213
+ case 'time':
8214
+ return { format: column.excelFormat, value: timeStringToExcelFraction(value) };
8215
+ case 'dateTime':
8216
+ case 'dateTimeLocal':
8217
+ return { format: column.excelFormat, value: value ? new Date(value) : '' };
8218
+ }
8219
+ }
8220
+ return { value: gridCellService.createCellValue(column.type, column.field, row, translationMap) };
8221
+ });
8222
+ rows.push({ cells: rowCells, type: 'data' });
8223
+ }
8224
+ return rows;
8225
+ };
8226
+ const timeStringToExcelFraction = (time) => {
8227
+ if (!time) {
8228
+ return '';
8229
+ }
8230
+ ;
8231
+ const [hoursStr, minutesStr,] = time.split(':');
8232
+ const hours = Number.parseInt(hoursStr, 10);
8233
+ const minutes = Number.parseInt(minutesStr, 10);
8234
+ return (hours * 60 + minutes) / (24 * 60);
8235
+ };
8236
+
8190
8237
  var GridExportOptions;
8191
8238
  (function (GridExportOptions) {
8192
8239
  GridExportOptions["PDF"] = "pdf";
@@ -8227,6 +8274,7 @@ class KitGridExportComponent {
8227
8274
  this.notificationService = inject(KitNotificationService);
8228
8275
  this.gridCellService = inject(KitGridCellService);
8229
8276
  this.store = inject(Store);
8277
+ this.injector = inject(Injector);
8230
8278
  this.getExportedData = input.required(...(ngDevMode ? [{ debugName: "getExportedData" }] : []));
8231
8279
  this.translationMap = input.required(...(ngDevMode ? [{ debugName: "translationMap" }] : []));
8232
8280
  this.exportedFileName = input.required(...(ngDevMode ? [{ debugName: "exportedFileName" }] : []));
@@ -8291,55 +8339,17 @@ class KitGridExportComponent {
8291
8339
  onExportExcel() {
8292
8340
  return new Promise((resolve, reject) => this.getExportedData()().subscribe({
8293
8341
  next: ({ data }) => {
8294
- const workbook = { sheets: [{ rows: [], columns: [] }] };
8295
- const columns = this.exportedColumns
8296
- .map(({ title, field }) => ({
8297
- value: this.translateService.instant(title || field),
8298
- background: '#7a7a7a',
8299
- color: '#fff',
8300
- width: 170,
8301
- }));
8302
- workbook.sheets[0].rows = this.getExportedExcelRows(columns, data, this.exportedColumns);
8303
- workbook.sheets[0].columns = columns;
8304
- new Workbook(workbook).toDataURL()
8305
- .then((dataUrl) => saveAs(dataUrl, `${this.exportedFileName()}.xlsx`))
8306
- .finally(resolve);
8342
+ runInInjectionContext(this.injector, () => {
8343
+ kitExportExcel(data, this.exportedColumns, this.exportedFileName(), this.translationMap())
8344
+ .then(resolve)
8345
+ .catch(reject);
8346
+ });
8307
8347
  },
8308
8348
  error: (err) => {
8309
8349
  reject(new Error(err));
8310
8350
  },
8311
8351
  }));
8312
8352
  }
8313
- getExportedExcelRows(columns, data, gridColumns) {
8314
- const rows = [{ cells: columns, type: 'header' }];
8315
- data.forEach(row => {
8316
- const rowCells = gridColumns.map((column) => {
8317
- const value = row[column.field];
8318
- if (column.excelFormat) {
8319
- switch (column.type) {
8320
- case 'time':
8321
- return { format: column.excelFormat, value: this.timeStringToExcelFraction(value) };
8322
- case 'dateTime':
8323
- case 'dateTimeLocal':
8324
- return { format: column.excelFormat, value: value ? new Date(value) : '' };
8325
- }
8326
- }
8327
- return { value: this.gridCellService.createCellValue(column.type, column.field, row, this.translationMap()) };
8328
- });
8329
- rows.push({ cells: rowCells, type: 'data' });
8330
- });
8331
- return rows;
8332
- }
8333
- timeStringToExcelFraction(time) {
8334
- if (!time) {
8335
- return '';
8336
- }
8337
- ;
8338
- const [hoursStr, minutesStr,] = time.split(':');
8339
- const hours = parseInt(hoursStr, 10);
8340
- const minutes = parseInt(minutesStr, 10);
8341
- return (hours * 60 + minutes) / (24 * 60);
8342
- }
8343
8353
  onExportCSV() {
8344
8354
  return new Promise((resolve, reject) => this.getExportedData()().subscribe({
8345
8355
  next: ({ data }) => {
@@ -9616,5 +9626,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
9616
9626
  * Generated bundle index. Do not edit.
9617
9627
  */
9618
9628
 
9619
- export { AbstractKitCtaPanelConfirmationComponent, AddGridFilter, FetchUser, FetchUserIdentities, FetchUserPermissions, FetchUserSettings, HighlightPipe, KIT_BASE_PATH, KIT_DATETIME_FORMAT_LONG, KIT_DATE_FORMAT, KIT_GRID_CELL_DATE_FORMAT_CONFIG, KIT_GRID_STATE_TOKEN, KIT_USER_APPLICATIONS_PATH, KIT_USER_IDENTITIES_STATE_TOKEN, KIT_USER_PATH, KIT_USER_PERMISSIONS_PATH, KIT_USER_PERMISSIONS_STATE_TOKEN, KIT_USER_STATE_TOKEN, KitAccountService, KitAutocompleteComponent, KitAutocompleteDirective, KitAvatarComponent, KitAvatarSize, KitBadgeDirective, KitBadgeTheme, KitBreadcrumbsComponent, KitBreadcrumbsService, KitButtonComponent, KitButtonIconPosition, KitButtonKind, KitButtonState, KitButtonType, KitCardComponent, KitCardDetailsComponent, KitCardTheme, KitCheckboxComponent, KitCheckboxState, KitCollapsedListComponent, KitCollapsedListDropdownAlign, KitCopyTextComponent, KitCtaPanelAbstractConfirmationComponent, KitCtaPanelActionComponent, KitCtaPanelConfirmationComponent, KitCtaPanelItemComponent, KitCtaPanelItemType, KitDataFieldComponent, KitDataFieldState, KitDatepickerComponent, KitDatepickerSize, KitDaterangeComponent, KitDaterangeType, KitDatetimepickerComponent, KitDialogActionsComponent, KitDialogComponent, KitDialogService, KitDialogTitlebarComponent, KitDialogType, KitDropdownComponent, KitDropdownItemTemplateDirective, KitDropdownSize, KitEmptySectionComponent, KitEntityGridComponent, KitEntitySectionComponent, KitEntitySectionContainerComponent, KitEntityTitleComponent, KitFileCardComponent, KitFileCardMessagesComponent, KitFileUploadComponent, KitFilterCheckboxComponent, KitFilterLogic, KitFilterOperator, KitFilterType, KitForbiddenComponent, KitGlobalSearchComponent, KitGridCellComponent, KitGridCellService, KitGridCellTemplateDirective, KitGridColumnComponent, KitGridColumnManagerComponent, KitGridComponent, KitGridDetailTemplateDirective, KitGridDetailsButtonComponent, KitGridExportComponent, KitGridFiltersComponent, KitGridSearchComponent, KitGridSortSettingsMode, KitGridState, KitGridUrlStateService, KitGridViewType, KitGridViewsComponent, KitGridViewsState, KitInputLabelComponent, KitInputMessageComponent, KitListComponent, KitLoaderComponent, KitLocationStepperComponent, KitMobileHeaderComponent, KitMobileMenuComponent, KitMobileMenuState, KitMultiselectComponent, KitNavigationMenuComponent, KitNavigationMenuService, KitNavigationMenuSubmenuComponent, KitNavigationTabsComponent, KitNavigationTabsType, KitNotFoundComponent, KitNoteComponent, KitNotificationComponent, KitNotificationService, KitNotificationType, KitNumericTextboxComponent, KitNumericTextboxSize, KitNumericTextboxState, KitOptionToggleComponent, KitPageLayoutComponent, KitPermissionDirective, KitPillComponent, KitPillTheme, KitPillType, KitPopupAlignHorizontal, KitPopupAlignVertical, KitPopupComponent, KitPopupPositionMode, KitProfileMenuComponent, KitQueryParamsName, KitQueryParamsService, KitRadioButtonComponent, KitRadioButtonType, KitRoutePathComponent, KitSchedulerComponent, KitSchedulerMonthEventTemplateDirective, KitSchedulerWeekEventTemplateDirective, KitScrollNavigationComponent, KitScrollNavigationSectionComponent, KitSearchBarComponent, KitSidebarComponent, KitSkeletonAnimation, KitSkeletonComponent, KitSkeletonShape, KitSortDirection, KitSortableComponent, KitSplitContainerComponent, KitStatusLabelColor, KitStatusLabelComponent, KitStatusLabelSize, KitSvgIcon, KitSvgIconComponent, KitSvgIconType, KitSvgSpriteComponent, KitSwitchComponent, KitSwitchMode, KitSwitchState, KitTabComponent, KitTabContentDirective, KitTabsComponent, KitTabsSize, KitTabsType, KitTextLabelComponent, KitTextLabelState, KitTextareaAutoresizeDirective, KitTextareaComponent, KitTextareaState, KitTextboxComponent, KitTextboxSize, KitTextboxState, KitThemeService, KitThemes, KitTileLayoutComponent, KitTileLayoutItemComponent, KitTimelineCardComponent, KitTimelineComponent, KitTimelineTheme, KitTimelineType, KitTimepickerComponent, KitTitleTemplateDirective, KitToastrModule, KitToastrPosition, KitToastrService, KitToastrType, KitToggleComponent, KitToggleSize, KitTooltipDirective, KitTooltipPosition, KitTopBarComponent, KitTrackingCardComponent, KitTrackingTimelineComponent, KitTranslateLoader, KitTranslateService, KitTruncateTextComponent, KitUnitsTextboxComponent, KitUnitsTextboxDropdownPosition, KitUnitsTextboxType, KitUserApplicationsState, KitUserIdentitiesInterceptor, KitUserIdentitiesSelector, KitUserIdentitiesState, KitUserPermissionsState, KitUserSettingsComponent, KitUserSettingsKeys, KitUserSettingsState, KitUserState, KitUserType, RemoveGridFilter, SetGridColumns, SetGridFilters, SetGridSearch, SetGridSkip, SetGridSort, SetGridTake, SetUserIdentity, UpdateGridFilter, buildRandomUUID, changeFilterField, createDataFetcherFactory, findMatches, kitBuildFilterBooleanOptions, kitBuildFilterListOptions, kitBuildFilters, kitBuildGridColumn, kitBuildGridDataResults, kitBuildOdataFilter, kitBuildSortString, kitDataStateToODataString, kitEncodeViewNameToUrl, kitGetPermissionTypesByCategory, kitHasPermission, kitUserPermissionsGuard, mapGlobalSearchResult, trimTrailingSlash };
9629
+ export { AbstractKitCtaPanelConfirmationComponent, AddGridFilter, FetchUser, FetchUserIdentities, FetchUserPermissions, FetchUserSettings, HighlightPipe, KIT_BASE_PATH, KIT_DATETIME_FORMAT_LONG, KIT_DATE_FORMAT, KIT_GRID_CELL_DATE_FORMAT_CONFIG, KIT_GRID_STATE_TOKEN, KIT_USER_APPLICATIONS_PATH, KIT_USER_IDENTITIES_STATE_TOKEN, KIT_USER_PATH, KIT_USER_PERMISSIONS_PATH, KIT_USER_PERMISSIONS_STATE_TOKEN, KIT_USER_STATE_TOKEN, KitAccountService, KitAutocompleteComponent, KitAutocompleteDirective, KitAvatarComponent, KitAvatarSize, KitBadgeDirective, KitBadgeTheme, KitBreadcrumbsComponent, KitBreadcrumbsService, KitButtonComponent, KitButtonIconPosition, KitButtonKind, KitButtonState, KitButtonType, KitCardComponent, KitCardDetailsComponent, KitCardTheme, KitCheckboxComponent, KitCheckboxState, KitCollapsedListComponent, KitCollapsedListDropdownAlign, KitCopyTextComponent, KitCtaPanelAbstractConfirmationComponent, KitCtaPanelActionComponent, KitCtaPanelConfirmationComponent, KitCtaPanelItemComponent, KitCtaPanelItemType, KitDataFieldComponent, KitDataFieldState, KitDatepickerComponent, KitDatepickerSize, KitDaterangeComponent, KitDaterangeType, KitDatetimepickerComponent, KitDialogActionsComponent, KitDialogComponent, KitDialogService, KitDialogTitlebarComponent, KitDialogType, KitDropdownComponent, KitDropdownItemTemplateDirective, KitDropdownSize, KitEmptySectionComponent, KitEntityGridComponent, KitEntitySectionComponent, KitEntitySectionContainerComponent, KitEntityTitleComponent, KitFileCardComponent, KitFileCardMessagesComponent, KitFileUploadComponent, KitFilterCheckboxComponent, KitFilterLogic, KitFilterOperator, KitFilterType, KitForbiddenComponent, KitGlobalSearchComponent, KitGridCellComponent, KitGridCellService, KitGridCellTemplateDirective, KitGridColumnComponent, KitGridColumnManagerComponent, KitGridComponent, KitGridDetailTemplateDirective, KitGridDetailsButtonComponent, KitGridExportComponent, KitGridFiltersComponent, KitGridSearchComponent, KitGridSortSettingsMode, KitGridState, KitGridUrlStateService, KitGridViewType, KitGridViewsComponent, KitGridViewsState, KitInputLabelComponent, KitInputMessageComponent, KitListComponent, KitLoaderComponent, KitLocationStepperComponent, KitMobileHeaderComponent, KitMobileMenuComponent, KitMobileMenuState, KitMultiselectComponent, KitNavigationMenuComponent, KitNavigationMenuService, KitNavigationMenuSubmenuComponent, KitNavigationTabsComponent, KitNavigationTabsType, KitNotFoundComponent, KitNoteComponent, KitNotificationComponent, KitNotificationService, KitNotificationType, KitNumericTextboxComponent, KitNumericTextboxSize, KitNumericTextboxState, KitOptionToggleComponent, KitPageLayoutComponent, KitPermissionDirective, KitPillComponent, KitPillTheme, KitPillType, KitPopupAlignHorizontal, KitPopupAlignVertical, KitPopupComponent, KitPopupPositionMode, KitProfileMenuComponent, KitQueryParamsName, KitQueryParamsService, KitRadioButtonComponent, KitRadioButtonType, KitRoutePathComponent, KitSchedulerComponent, KitSchedulerMonthEventTemplateDirective, KitSchedulerWeekEventTemplateDirective, KitScrollNavigationComponent, KitScrollNavigationSectionComponent, KitSearchBarComponent, KitSidebarComponent, KitSkeletonAnimation, KitSkeletonComponent, KitSkeletonShape, KitSortDirection, KitSortableComponent, KitSplitContainerComponent, KitStatusLabelColor, KitStatusLabelComponent, KitStatusLabelSize, KitSvgIcon, KitSvgIconComponent, KitSvgIconType, KitSvgSpriteComponent, KitSwitchComponent, KitSwitchMode, KitSwitchState, KitTabComponent, KitTabContentDirective, KitTabsComponent, KitTabsSize, KitTabsType, KitTextLabelComponent, KitTextLabelState, KitTextareaAutoresizeDirective, KitTextareaComponent, KitTextareaState, KitTextboxComponent, KitTextboxSize, KitTextboxState, KitThemeService, KitThemes, KitTileLayoutComponent, KitTileLayoutItemComponent, KitTimelineCardComponent, KitTimelineComponent, KitTimelineTheme, KitTimelineType, KitTimepickerComponent, KitTitleTemplateDirective, KitToastrModule, KitToastrPosition, KitToastrService, KitToastrType, KitToggleComponent, KitToggleSize, KitTooltipDirective, KitTooltipPosition, KitTopBarComponent, KitTrackingCardComponent, KitTrackingTimelineComponent, KitTranslateLoader, KitTranslateService, KitTruncateTextComponent, KitUnitsTextboxComponent, KitUnitsTextboxDropdownPosition, KitUnitsTextboxType, KitUserApplicationsState, KitUserIdentitiesInterceptor, KitUserIdentitiesSelector, KitUserIdentitiesState, KitUserPermissionsState, KitUserSettingsComponent, KitUserSettingsKeys, KitUserSettingsState, KitUserState, KitUserType, RemoveGridFilter, SetGridColumns, SetGridFilters, SetGridSearch, SetGridSkip, SetGridSort, SetGridTake, SetUserIdentity, UpdateGridFilter, buildRandomUUID, changeFilterField, createDataFetcherFactory, findMatches, kitBuildFilterBooleanOptions, kitBuildFilterListOptions, kitBuildFilters, kitBuildGridColumn, kitBuildGridDataResults, kitBuildOdataFilter, kitBuildSortString, kitDataStateToODataString, kitEncodeViewNameToUrl, kitExportExcel, kitGetPermissionTypesByCategory, kitHasPermission, kitUserPermissionsGuard, mapGlobalSearchResult, trimTrailingSlash };
9620
9630
  //# sourceMappingURL=indigina-ui-kit.mjs.map