@wolkabout/commons 0.0.14 → 0.0.15
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.
|
@@ -422,26 +422,74 @@ const createGlobalPermissionsGuard = (availableRoutesGetter, fallbackRoute, pare
|
|
|
422
422
|
return permissionsGuard;
|
|
423
423
|
};
|
|
424
424
|
|
|
425
|
+
class AssetManager {
|
|
426
|
+
/**
|
|
427
|
+
* Host URL per project.
|
|
428
|
+
* In case of remote projects, this should point to the remote URL.
|
|
429
|
+
*/
|
|
430
|
+
assetLocations = {};
|
|
431
|
+
getAssetLocation(featureSet) {
|
|
432
|
+
return this.assetLocations[featureSet] ?? window.location.host;
|
|
433
|
+
}
|
|
434
|
+
setAssetLocation(featureSet, host) {
|
|
435
|
+
this.assetLocations[featureSet] = host;
|
|
436
|
+
}
|
|
437
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AssetManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
438
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AssetManager, providedIn: 'root' });
|
|
439
|
+
}
|
|
440
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AssetManager, decorators: [{
|
|
441
|
+
type: Injectable,
|
|
442
|
+
args: [{
|
|
443
|
+
providedIn: 'root'
|
|
444
|
+
}]
|
|
445
|
+
}] });
|
|
446
|
+
|
|
425
447
|
class FeatureRegistry {
|
|
426
448
|
injector = inject(Injector);
|
|
449
|
+
features = []; // Temporary holder, until all features are loaded.
|
|
427
450
|
_features$ = new BehaviorSubject([]);
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
451
|
+
expectedFeatures = null;
|
|
452
|
+
/**
|
|
453
|
+
* Set the expected number of features.
|
|
454
|
+
* The features$ will output the value only after this many features were (successfully or unsuccessfully) loaded.
|
|
455
|
+
* If this isn't set, the registration of the feature will output values every time.
|
|
456
|
+
*/
|
|
457
|
+
setExpectedFeatures(expectedFeatures) {
|
|
458
|
+
this.expectedFeatures = expectedFeatures;
|
|
432
459
|
}
|
|
433
460
|
loadExternalFeatures(features) {
|
|
434
461
|
features.forEach((feature) => {
|
|
435
|
-
console.log('Loading external module: ', feature.remote + '/' + feature.feature);
|
|
436
462
|
from(loadRemoteModule(feature.remote, feature.feature)).pipe(map(module => {
|
|
437
463
|
console.log('Received', module);
|
|
438
464
|
return module.default;
|
|
439
465
|
}), catchError((error) => {
|
|
440
466
|
console.warn("Unable to load: ", feature.remote + '/' + feature.feature, error);
|
|
441
467
|
return of(null);
|
|
442
|
-
})
|
|
468
|
+
})).subscribe((feature) => {
|
|
469
|
+
if (feature) {
|
|
470
|
+
this.registerFeature(feature);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
this.features.push(null);
|
|
474
|
+
}
|
|
475
|
+
});
|
|
443
476
|
});
|
|
444
477
|
}
|
|
478
|
+
registerFeature(feature) {
|
|
479
|
+
this.features.push(feature);
|
|
480
|
+
runInInjectionContext(this.injector, () => feature.init?.());
|
|
481
|
+
console.info('Loaded feature: ', feature.name);
|
|
482
|
+
this.finalizeLoading();
|
|
483
|
+
}
|
|
484
|
+
finalizeLoading() {
|
|
485
|
+
const loadedFeatures = this.features.filter((feature) => !!feature);
|
|
486
|
+
if (!this.expectedFeatures) {
|
|
487
|
+
this._features$.next(loadedFeatures);
|
|
488
|
+
}
|
|
489
|
+
else if (this.features.length === this.expectedFeatures) {
|
|
490
|
+
this._features$.next(loadedFeatures);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
445
493
|
get features$() {
|
|
446
494
|
return this._features$.asObservable();
|
|
447
495
|
}
|
|
@@ -6910,5 +6958,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
6910
6958
|
* Generated bundle index. Do not edit.
|
|
6911
6959
|
*/
|
|
6912
6960
|
|
|
6913
|
-
export { AUTHENTICATION_CLIENT, AuthenticationService, AutocompleteChipsComponent, AutocompleteComponent, BasicTimeSeriesGraphComponent, COLORS, CUSTOM_PERIOD, CardLabeledValueComponent, ConfirmationDialogComponent, DEFAULT_LOCALE, DEFAULT_TIMEZONES, DEFAULT_TIME_ZONE, DataType, DateRangeInputComponent, DateTimeFormFieldComponent, DragDropFileUploadComponent, DurationPipe, FeatureRegistry, GoogleMapComponent, ImageDisplayComponent, ImagePreviewComponent, LAST_ACTIVE_TAB_KEY, LOCALES, LabeledValueComponent, LoadedIconComponent, LoadingIndicatorDirective, LocalSortTableComponent, Locale, LocalizedNumberPipe, LocalizedNumericInputDirective, MILLISECONDS_IN_DAY, MapsLoaderService, MasterDetailsViewComponent, MessageTooltipDirective, MissingTranslationHelper, NestedListDataControl, NestedListDataSource, NestedListViewComponent, NgTemplateContentDirective, NotificationService, OverflowClassDirective, PdfViewerComponent, PeriodErrorStateMatcher, Permission, PermissionsService, RELATIVE_TIME_PERIODS, RelativeTimePeriod, RequiresAllGlobalOrAssetPermissionsDirective, RequiresAllPermissionDirective, RequiresGlobalOrAsserPermissionDirective, RequiresPermissionDirective, ScrollIntoViewDirective, SimpleDatePipe, SimpleDateTimePipe, SimpleTimePipe, SortPipe, StandardListDataControl, StandardListDataSource, StandardListViewComponent, TIMEZONES, TabulatedChipViewComponent, TabulatedViewComponent, TenantPropertiesService, ThemeService, TreeComponent, TreeNodeComponent, USERS_TIME_ZONE, ValueDisplayComponent, ValueInputBooleanComponent, ValueInputColorComponent, ValueInputComponent, ValueInputDateComponent, ValueInputDurationComponent, ValueInputEnumComponent, ValueInputHexadecimalComponent, ValueInputLinkComponent, ValueInputLocationComponent, ValueInputNumericComponent, ValueInputStringComponent, ValueInputVectorComponent, angularComponents, arrayToObject, chartThemeDark, chartThemeLight, createGlobalPermissionsGuard, daysAway, determineMagnitude, determineMinMaxValues, endOfPeriod, equalsByValue, fileSizeValidator, flatMap, flatten, format, formatDuration, generateRandomString, groupBy, hoursAway, isContextAccessible, lookUpPathPart, lookUpQueryParam, parseDateRangeInputPeriod, parseTimeInput, saveFile, scale, shared, startOfMonth, startOfPeriod, startOfTheDay, startOfWeek, startOfYear, toDate, toEndOfMonth, toEndOfYear, toJsDate, toOffset, toStartOfMonth, toStartOfTheDay, toStartOfWeek, toStartOfYear, toTime, uniqueBy, uniqueFrom, validateAssetName, validateTypeAssetName };
|
|
6961
|
+
export { AUTHENTICATION_CLIENT, AssetManager, AuthenticationService, AutocompleteChipsComponent, AutocompleteComponent, BasicTimeSeriesGraphComponent, COLORS, CUSTOM_PERIOD, CardLabeledValueComponent, ConfirmationDialogComponent, DEFAULT_LOCALE, DEFAULT_TIMEZONES, DEFAULT_TIME_ZONE, DataType, DateRangeInputComponent, DateTimeFormFieldComponent, DragDropFileUploadComponent, DurationPipe, FeatureRegistry, GoogleMapComponent, ImageDisplayComponent, ImagePreviewComponent, LAST_ACTIVE_TAB_KEY, LOCALES, LabeledValueComponent, LoadedIconComponent, LoadingIndicatorDirective, LocalSortTableComponent, Locale, LocalizedNumberPipe, LocalizedNumericInputDirective, MILLISECONDS_IN_DAY, MapsLoaderService, MasterDetailsViewComponent, MessageTooltipDirective, MissingTranslationHelper, NestedListDataControl, NestedListDataSource, NestedListViewComponent, NgTemplateContentDirective, NotificationService, OverflowClassDirective, PdfViewerComponent, PeriodErrorStateMatcher, Permission, PermissionsService, RELATIVE_TIME_PERIODS, RelativeTimePeriod, RequiresAllGlobalOrAssetPermissionsDirective, RequiresAllPermissionDirective, RequiresGlobalOrAsserPermissionDirective, RequiresPermissionDirective, ScrollIntoViewDirective, SimpleDatePipe, SimpleDateTimePipe, SimpleTimePipe, SortPipe, StandardListDataControl, StandardListDataSource, StandardListViewComponent, TIMEZONES, TabulatedChipViewComponent, TabulatedViewComponent, TenantPropertiesService, ThemeService, TreeComponent, TreeNodeComponent, USERS_TIME_ZONE, ValueDisplayComponent, ValueInputBooleanComponent, ValueInputColorComponent, ValueInputComponent, ValueInputDateComponent, ValueInputDurationComponent, ValueInputEnumComponent, ValueInputHexadecimalComponent, ValueInputLinkComponent, ValueInputLocationComponent, ValueInputNumericComponent, ValueInputStringComponent, ValueInputVectorComponent, angularComponents, arrayToObject, chartThemeDark, chartThemeLight, createGlobalPermissionsGuard, daysAway, determineMagnitude, determineMinMaxValues, endOfPeriod, equalsByValue, fileSizeValidator, flatMap, flatten, format, formatDuration, generateRandomString, groupBy, hoursAway, isContextAccessible, lookUpPathPart, lookUpQueryParam, parseDateRangeInputPeriod, parseTimeInput, saveFile, scale, shared, startOfMonth, startOfPeriod, startOfTheDay, startOfWeek, startOfYear, toDate, toEndOfMonth, toEndOfYear, toJsDate, toOffset, toStartOfMonth, toStartOfTheDay, toStartOfWeek, toStartOfYear, toTime, uniqueBy, uniqueFrom, validateAssetName, validateTypeAssetName };
|
|
6914
6962
|
//# sourceMappingURL=wolkabout-commons.mjs.map
|