@nettyapps/ntybase 21.0.21 → 21.0.22

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,124 @@ 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
+ // --- DOWNLOAD METHODS ---
1167
+ // ---------------------------------
1168
+ /**
1169
+ * Download the given base64Encoded data as file
1170
+ *
1171
+ * @param base64Data: base64 encoded data
1172
+ * @param fileName: filename to download
1173
+ */
1174
+ downloadFile(base64Data, fileName) {
1175
+ if (base64Data == null) {
1176
+ return;
1177
+ }
1178
+ if (fileName == null) {
1179
+ return;
1180
+ }
1181
+ // Check if header is present
1182
+ if (!base64Data.startsWith('data:')) {
1183
+ console.error('Provided data is not in base64 format (missing header)');
1184
+ return;
1185
+ }
1186
+ const contentType = base64Data.split(';')[0].split(':')[1];
1187
+ const byteCharacters = atob(base64Data.split(',')[1]);
1188
+ const byteArrays = [];
1189
+ for (let i = 0; i < byteCharacters.length; i++) {
1190
+ const byteArray = byteCharacters.charCodeAt(i);
1191
+ byteArrays.push(byteArray);
1192
+ }
1193
+ const byteArray = new Uint8Array(byteArrays);
1194
+ const blob = new Blob([byteArray], { type: contentType });
1195
+ const link = document.createElement('a');
1196
+ link.href = URL.createObjectURL(blob);
1197
+ link.download = fileName;
1198
+ link.click();
1199
+ }
1200
+ /** Download the given base64Endoced data as text file
1201
+ *
1202
+ * @param base64EncodedFileData
1203
+ * @param fileName
1204
+ */
1205
+ downloadTextFile(base64EncodedFileData, fileName) {
1206
+ // Check if the data has a prefix like "data:application/pdf;base64,"
1207
+ if (base64EncodedFileData == null) {
1208
+ return;
1209
+ }
1210
+ if (fileName == null) {
1211
+ return;
1212
+ }
1213
+ let _data = base64EncodedFileData;
1214
+ const prefix = 'data:';
1215
+ if (_data.startsWith(prefix)) {
1216
+ // Remove the prefix
1217
+ _data = _data.slice(_data.indexOf(',') + 1);
1218
+ }
1219
+ // Convert the base64 data to a Uint8Array
1220
+ const textData = Buffer.from(_data ?? '', 'base64').toString();
1221
+ this.downloadTextFileNotEncoded(textData, fileName);
1222
+ }
1223
+ /** Save the given text as a text file
1224
+ *
1225
+ * @param fileData
1226
+ * @param fileName
1227
+ */
1228
+ downloadTextFileNotEncoded(fileData, fileName) {
1229
+ if (fileData == null) {
1230
+ return;
1231
+ }
1232
+ if (fileName == null) {
1233
+ return;
1234
+ }
1235
+ // Create a Blob from the Text
1236
+ const blob = new Blob([fileData], { type: 'text/plain' });
1237
+ // Create a download link
1238
+ const url = window.URL.createObjectURL(blob);
1239
+ const a = document.createElement('a');
1240
+ document.body.appendChild(a);
1241
+ a.style.display = 'none';
1242
+ a.href = url;
1243
+ a.download = fileName ?? 'filename';
1244
+ // Trigger the download
1245
+ a.click();
1246
+ // Clean up
1247
+ window.URL.revokeObjectURL(url);
1248
+ document.body.removeChild(a);
1249
+ }
1250
+ /**
1251
+ * Download file where the data is provided as blob
1252
+ * @param data - Array Buffer data
1253
+ * @param type - type of the document.
1254
+ */
1255
+ downloadBlobFile(data, type, fileName) {
1256
+ let blob = new Blob([data], { type: type });
1257
+ let downloadLink = document.createElement('a');
1258
+ downloadLink.href = window.URL.createObjectURL(blob);
1259
+ downloadLink.setAttribute('download', fileName);
1260
+ document.body.appendChild(downloadLink);
1261
+ downloadLink.click();
1262
+ downloadLink.parentNode?.removeChild(downloadLink);
1263
+ }
1264
+ // ---------------------------------
1265
+ // --- INTERFACE IMPLEMENTATIONS ---
1266
+ // ---------------------------------
1267
+ onDestroy$ = new Subject();
1268
+ ngOnDestroy() {
1269
+ //Called once, before the instance is destroyed.
1270
+ //Add 'implements OnDestroy' to the class.
1271
+ this.onDestroy$.next();
1272
+ this.onDestroy$.complete();
1273
+ }
1274
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAppsBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1275
+ 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: [""] });
1276
+ }
1277
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAppsBase, decorators: [{
1278
+ type: Component,
1279
+ args: [{ selector: 'ntybase-netty-apps-base', imports: [], template: "" }]
1280
+ }] });
1281
+
1164
1282
  ModuleRegistry.registerModules([
1165
1283
  AllCommunityModule,
1166
1284
  StatusBarModule,
@@ -1179,7 +1297,7 @@ const myTheme = themeQuartz.withParams({
1179
1297
  browserColorScheme: 'dark',
1180
1298
  }, 'dark');
1181
1299
  const FILTER_MODE_KEY = 'nettyapps_filter_mode';
1182
- class NettyAgGridBase {
1300
+ class NettyAgGridBase extends NettyAppsBase {
1183
1301
  // Input signals
1184
1302
  readOnly = input(false, ...(ngDevMode ? [{ debugName: "readOnly" }] : []));
1185
1303
  popupFilterValid = input(false, ...(ngDevMode ? [{ debugName: "popupFilterValid" }] : []));
@@ -1603,6 +1721,7 @@ class NettyAgGridBase {
1603
1721
  * - The update type doesn't match
1604
1722
  */
1605
1723
  constructor() {
1724
+ super();
1606
1725
  this.frameworkComponents = {
1607
1726
  buttonRenderer: ButtonRenderer,
1608
1727
  checkboxRenderer: CheckboxRenderer,
@@ -1864,14 +1983,14 @@ class NettyAgGridBase {
1864
1983
  this.selectedElement.emit(null);
1865
1984
  }
1866
1985
  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: [""] });
1986
+ 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
1987
  }
1869
1988
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridBase, decorators: [{
1870
1989
  type: Component,
1871
1990
  args: [{ selector: 'ntybase-ag-grid-base', imports: [], template: "<p>ag-grid-base works!</p>\n" }]
1872
1991
  }], 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
1992
 
1874
- class NettyAgGridSaveBase {
1993
+ class NettyAgGridSaveBase extends NettyAppsBase {
1875
1994
  // Services
1876
1995
  router = inject(Router);
1877
1996
  route = inject(ActivatedRoute);
@@ -2108,8 +2227,8 @@ class NettyAgGridSaveBase {
2108
2227
  },
2109
2228
  ]);
2110
2229
  }
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: [""] });
2230
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridSaveBase, deps: null, target: i0.ɵɵFactoryTarget.Component });
2231
+ 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
2232
  }
2114
2233
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NettyAgGridSaveBase, decorators: [{
2115
2234
  type: Component,
@@ -3844,5 +3963,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
3844
3963
  * Generated bundle index. Do not edit.
3845
3964
  */
3846
3965
 
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 };
3966
+ 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
3967
  //# sourceMappingURL=nettyapps-ntybase.mjs.map