@nettyapps/ntybase 21.0.21 → 21.0.23

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.
@@ -1161,6 +1161,128 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
1161
1161
  args: [{ selector: 'ntybase-checkbox-renderer', imports: [], template: "@if (supportClick) {\n<input\n id=\"checkbox\"\n type=\"checkbox\"\n [checked]=\"checked\"\n (click)=\"onClick($event)\"\n/>\n} @if (!supportClick) {\n<input id=\"checkbox\" type=\"checkbox\" [checked]=\"params.value\" disabled />\n}\n\n<label for=\"checkbox\">{{label}}</label>\n" }]
1162
1162
  }] });
1163
1163
 
1164
+ class NettyAppsBase {
1165
+ // ---------------------------------
1166
+ // --- SERVICES ---
1167
+ // ---------------------------------
1168
+ alertService = inject(AlertService);
1169
+ // ---------------------------------
1170
+ // --- DOWNLOAD METHODS ---
1171
+ // ---------------------------------
1172
+ /**
1173
+ * Download the given base64Encoded data as file
1174
+ *
1175
+ * @param base64Data: base64 encoded data
1176
+ * @param fileName: filename to download
1177
+ */
1178
+ downloadFile(base64Data, fileName) {
1179
+ if (base64Data == null) {
1180
+ return;
1181
+ }
1182
+ if (fileName == null) {
1183
+ return;
1184
+ }
1185
+ // Check if header is present
1186
+ if (!base64Data.startsWith('data:')) {
1187
+ console.error('Provided data is not in base64 format (missing header)');
1188
+ return;
1189
+ }
1190
+ const contentType = base64Data.split(';')[0].split(':')[1];
1191
+ const byteCharacters = atob(base64Data.split(',')[1]);
1192
+ const byteArrays = [];
1193
+ for (let i = 0; i < byteCharacters.length; i++) {
1194
+ const byteArray = byteCharacters.charCodeAt(i);
1195
+ byteArrays.push(byteArray);
1196
+ }
1197
+ const byteArray = new Uint8Array(byteArrays);
1198
+ const blob = new Blob([byteArray], { type: contentType });
1199
+ const link = document.createElement('a');
1200
+ link.href = URL.createObjectURL(blob);
1201
+ link.download = fileName;
1202
+ link.click();
1203
+ }
1204
+ /** Download the given base64Endoced data as text file
1205
+ *
1206
+ * @param base64EncodedFileData
1207
+ * @param fileName
1208
+ */
1209
+ downloadTextFile(base64EncodedFileData, fileName) {
1210
+ // Check if the data has a prefix like "data:application/pdf;base64,"
1211
+ if (base64EncodedFileData == null) {
1212
+ return;
1213
+ }
1214
+ if (fileName == null) {
1215
+ return;
1216
+ }
1217
+ let _data = base64EncodedFileData;
1218
+ const prefix = 'data:';
1219
+ if (_data.startsWith(prefix)) {
1220
+ // Remove the prefix
1221
+ _data = _data.slice(_data.indexOf(',') + 1);
1222
+ }
1223
+ // Convert the base64 data to a Uint8Array
1224
+ const textData = Buffer.from(_data ?? '', 'base64').toString();
1225
+ this.downloadTextFileNotEncoded(textData, fileName);
1226
+ }
1227
+ /** Save the given text as a text file
1228
+ *
1229
+ * @param fileData
1230
+ * @param fileName
1231
+ */
1232
+ downloadTextFileNotEncoded(fileData, fileName) {
1233
+ if (fileData == null) {
1234
+ return;
1235
+ }
1236
+ if (fileName == null) {
1237
+ return;
1238
+ }
1239
+ // Create a Blob from the Text
1240
+ const blob = new Blob([fileData], { type: 'text/plain' });
1241
+ // Create a download link
1242
+ const url = window.URL.createObjectURL(blob);
1243
+ const a = document.createElement('a');
1244
+ document.body.appendChild(a);
1245
+ a.style.display = 'none';
1246
+ a.href = url;
1247
+ a.download = fileName ?? 'filename';
1248
+ // Trigger the download
1249
+ a.click();
1250
+ // Clean up
1251
+ window.URL.revokeObjectURL(url);
1252
+ document.body.removeChild(a);
1253
+ }
1254
+ /**
1255
+ * Download file where the data is provided as blob
1256
+ * @param data - Array Buffer data
1257
+ * @param type - type of the document.
1258
+ */
1259
+ downloadBlobFile(data, type, fileName) {
1260
+ let blob = new Blob([data], { type: type });
1261
+ let downloadLink = document.createElement('a');
1262
+ downloadLink.href = window.URL.createObjectURL(blob);
1263
+ downloadLink.setAttribute('download', fileName);
1264
+ document.body.appendChild(downloadLink);
1265
+ downloadLink.click();
1266
+ downloadLink.parentNode?.removeChild(downloadLink);
1267
+ }
1268
+ // ---------------------------------
1269
+ // --- INTERFACE IMPLEMENTATIONS ---
1270
+ // ---------------------------------
1271
+ onDestroy$ = new Subject();
1272
+ ngOnDestroy() {
1273
+ //Called once, before the instance is destroyed.
1274
+ //Add 'implements OnDestroy' to the class.
1275
+ this.onDestroy$.next();
1276
+ this.onDestroy$.complete();
1277
+ }
1278
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAppsBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1279
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: NettyAppsBase, isStandalone: true, selector: "ntybase-netty-apps-base", ngImport: i0, template: "", styles: [""] });
1280
+ }
1281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAppsBase, decorators: [{
1282
+ type: Component,
1283
+ args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: "" }]
1284
+ }] });
1285
+
1164
1286
  ModuleRegistry.registerModules([
1165
1287
  AllCommunityModule,
1166
1288
  StatusBarModule,
@@ -1179,7 +1301,7 @@ const myTheme = themeQuartz.withParams({
1179
1301
  browserColorScheme: 'dark',
1180
1302
  }, 'dark');
1181
1303
  const FILTER_MODE_KEY = 'nettyapps_filter_mode';
1182
- class NettyAgGridBase {
1304
+ class NettyAgGridBase extends NettyAppsBase {
1183
1305
  // Input signals
1184
1306
  readOnly = input(false, ...(ngDevMode ? [{ debugName: "readOnly" }] : []));
1185
1307
  popupFilterValid = input(false, ...(ngDevMode ? [{ debugName: "popupFilterValid" }] : []));
@@ -1247,7 +1369,6 @@ class NettyAgGridBase {
1247
1369
  commonService = inject(CommonService);
1248
1370
  router = inject(Router);
1249
1371
  routerActive = inject(ActivatedRoute);
1250
- alertService = inject(AlertService);
1251
1372
  dialog = inject(MatDialog);
1252
1373
  sysFunctionProxy = inject(SysfunctionProxy);
1253
1374
  environment = inject(EnvironmentProxy);
@@ -1603,6 +1724,7 @@ class NettyAgGridBase {
1603
1724
  * - The update type doesn't match
1604
1725
  */
1605
1726
  constructor() {
1727
+ super();
1606
1728
  this.frameworkComponents = {
1607
1729
  buttonRenderer: ButtonRenderer,
1608
1730
  checkboxRenderer: CheckboxRenderer,
@@ -1864,19 +1986,18 @@ class NettyAgGridBase {
1864
1986
  this.selectedElement.emit(null);
1865
1987
  }
1866
1988
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1867
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NettyAgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null }, componantParameterGUID: { classPropertyName: "componantParameterGUID", publicName: "componantParameterGUID", isSignal: true, isRequired: false, transformFunction: null }, componantParameterType: { classPropertyName: "componantParameterType", publicName: "componantParameterType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onElementSelect: "onElementSelect", selectedElement: "selectedElement" }, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1989
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NettyAgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null }, componantParameterGUID: { classPropertyName: "componantParameterGUID", publicName: "componantParameterGUID", isSignal: true, isRequired: false, transformFunction: null }, componantParameterType: { classPropertyName: "componantParameterType", publicName: "componantParameterType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onElementSelect: "onElementSelect", selectedElement: "selectedElement" }, usesInheritance: true, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1868
1990
  }
1869
1991
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridBase, decorators: [{
1870
1992
  type: Component,
1871
1993
  args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: "<p>ag-grid-base works!</p>\n" }]
1872
1994
  }], ctorParameters: () => [], propDecorators: { readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], popupFilterValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupFilterValid", required: false }] }], popupValid: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupValid", required: false }] }], isEmbedded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isEmbedded", required: false }] }], componantParameterGUID: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterGUID", required: false }] }], componantParameterType: [{ type: i0.Input, args: [{ isSignal: true, alias: "componantParameterType", required: false }] }], onElementSelect: [{ type: i0.Output, args: ["onElementSelect"] }], selectedElement: [{ type: i0.Output, args: ["selectedElement"] }] } });
1873
1995
 
1874
- class NettyAgGridSaveBase {
1996
+ class NettyAgGridSaveBase extends NettyAppsBase {
1875
1997
  // Services
1876
1998
  router = inject(Router);
1877
1999
  route = inject(ActivatedRoute);
1878
2000
  commonService = inject(CommonService);
1879
- alertService = inject(AlertService);
1880
2001
  environment = inject(EnvironmentProxy);
1881
2002
  dialog = inject(MatDialog);
1882
2003
  viewMode = signal('sidenav', ...(ngDevMode ? [{ debugName: "viewMode" }] : []));
@@ -2108,8 +2229,8 @@ class NettyAgGridSaveBase {
2108
2229
  },
2109
2230
  ]);
2110
2231
  }
2111
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridSaveBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
2112
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NettyAgGridSaveBase, isStandalone: true, selector: "ntybase-ag-grid-save-base", inputs: { parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null }, closeAfterSave: { classPropertyName: "closeAfterSave", publicName: "closeAfterSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeAfterSave: "closeAfterSaveChange" }, viewQueries: [{ propertyName: "saveForm", first: true, predicate: ["saveForm"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<p>ag-grid-save-base works!</p>\n", styles: [""] });
2232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridSaveBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
2233
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: NettyAgGridSaveBase, isStandalone: true, selector: "ntybase-ag-grid-save-base", inputs: { parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, embedded: { classPropertyName: "embedded", publicName: "embedded", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null }, closeAfterSave: { classPropertyName: "closeAfterSave", publicName: "closeAfterSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeAfterSave: "closeAfterSaveChange" }, viewQueries: [{ propertyName: "saveForm", first: true, predicate: ["saveForm"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<p>ag-grid-save-base works!</p>\n", styles: [""] });
2113
2234
  }
2114
2235
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridSaveBase, decorators: [{
2115
2236
  type: Component,
@@ -3844,5 +3965,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
3844
3965
  * Generated bundle index. Do not edit.
3845
3966
  */
3846
3967
 
3847
- export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridSaveBase, NettyAgGridService, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, Ntybase, NtybaseModule, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService };
3968
+ export { AlertService, AuthenticationGuard, AuthenticationInterceptor, AuthenticationService, ButtonRenderer, CanDeactivateGuard, CheckboxRenderer, CommonService, ConfirmDialog, CredentialsService, CurrentUserPreference, ENVIRONMENT_CONFIG, EnvironmentInfo, EnvironmentInfoService, ExcelImportBase, ForgotPassword, Login, LoginDto, MFACodeDto, MfaLogin, NettyAgGridBase, NettyAgGridSaveBase, NettyAgGridService, NettyAppsBase, NettyBaseApp, NettyHelper, NettyImageService, NettyMenuService, Ntybase, NtybaseModule, RangeDateTimeFilter, RangeNumberFilter, RangeStringFilter, UrlHelperService };
3848
3969
  //# sourceMappingURL=nettyapps-ntybase.mjs.map