@decaf-ts/for-angular 0.0.56 → 0.0.58

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,4 +1,3 @@
1
- import '@tabler/icons-webfont/dist/tabler-icons.min.css';
2
1
  import { HTML5InputTypes, parseValueByType, HTML5CheckTypes, escapeHtml, parseToNumber, RenderingEngine, DecafComponent, UIKeys, RenderingError, UIMediaBreakPoints, DecafEventHandler } from '@decaf-ts/ui-decorators';
3
2
  import * as i0 from '@angular/core';
4
3
  import { InjectionToken, provideEnvironmentInitializer, NgModule, isDevMode, reflectComponentType, Injector, createEnvironmentInjector, runInInjectionContext, createComponent, inject, NgZone, Injectable, ChangeDetectorRef, Renderer2, EventEmitter, ElementRef, Input, Output, ViewChild, Inject, Directive, EnvironmentInjector, ViewContainerRef, TemplateRef, Component, ViewEncapsulation, HostListener } from '@angular/core';
@@ -491,7 +490,11 @@ class ValidatorFactory {
491
490
  * and exposes helper providers such as DB adapter registration and logger utilities.
492
491
  * @link {@link ForAngularCommonModule}
493
492
  */
494
- const DB_ADAPTER_PROVIDER = 'DB_ADAPTER_PROVIDER';
493
+ const DB_ADAPTER_FLAVOUR_TOKEN = 'DbAdapterFlavour';
494
+ function getDbAdapterFlavour() {
495
+ return (getOnWindow(DB_ADAPTER_FLAVOUR_TOKEN) || '');
496
+ }
497
+ ;
495
498
  /**
496
499
  * @description Injection token for registering the database adapter provider.
497
500
  * @summary Used to inject the database adapter instance that implements DecafRepositoryAdapter.
@@ -587,7 +590,7 @@ function getModelAndRepository(model, clazz) {
587
590
  const constructor = Model.get((modelName.charAt(0).toUpperCase() + modelName.slice(1)));
588
591
  if (!constructor)
589
592
  return undefined;
590
- const dbAdapterFlavour = getOnWindow(DB_ADAPTER_PROVIDER) || undefined;
593
+ const dbAdapterFlavour = getOnWindow(DB_ADAPTER_FLAVOUR_TOKEN) || undefined;
591
594
  if (dbAdapterFlavour)
592
595
  uses(dbAdapterFlavour)(constructor);
593
596
  const repository = Repository.forModel(constructor);
@@ -631,10 +634,10 @@ function getModelAndRepository(model, clazz) {
631
634
  */
632
635
  function provideDecafDbAdapter(clazz, options = {}, flavour) {
633
636
  const adapter = new clazz(options);
634
- if (flavour)
637
+ if (!flavour)
635
638
  flavour = adapter.flavour;
636
639
  getLogger(provideDecafDbAdapter).info(`Using ${adapter.constructor.name} ${flavour} as Db Provider`);
637
- setOnWindow(DB_ADAPTER_PROVIDER, flavour);
640
+ setOnWindow(DB_ADAPTER_FLAVOUR_TOKEN, flavour);
638
641
  return {
639
642
  provide: DB_ADAPTER_PROVIDER_TOKEN,
640
643
  useValue: adapter,
@@ -2307,7 +2310,7 @@ class DecafFakerRepository extends LoggedClass {
2307
2310
  throw new InternalError(`Cannot find model ${modelName}. was it registered with @model?`);
2308
2311
  try {
2309
2312
  this.model = new constructor();
2310
- const dbAdapterFlavour = getOnWindow(DB_ADAPTER_PROVIDER) || undefined;
2313
+ const dbAdapterFlavour = getOnWindow(DB_ADAPTER_FLAVOUR_TOKEN) || undefined;
2311
2314
  if (dbAdapterFlavour)
2312
2315
  uses(dbAdapterFlavour)(constructor);
2313
2316
  this._repository = Repository.forModel(constructor);
@@ -2607,7 +2610,8 @@ class NgxRenderingEngine extends RenderingEngine {
2607
2610
  // NgxRenderingEngine._projectable = false;
2608
2611
  }
2609
2612
  result.children = fieldDef.children.map((child) => {
2610
- const readonly = operation === OperationKeys.UPDATE && (child?.props?.hidden || []).includes(OperationKeys.CREATE);
2613
+ const childOperation = (child?.props?.['operation'] || operation);
2614
+ const readonly = fieldDef.props?.['readonly'] || (operation === OperationKeys.UPDATE && (child?.props?.hidden || []).includes(OperationKeys.CREATE)) || [OperationKeys.READ, OperationKeys.DELETE].includes(childOperation);
2611
2615
  // const hiddenOn = (child?.props?.hidden || []) as string[];
2612
2616
  // // moved to ui decorators
2613
2617
  // if (child?.children?.length) {
@@ -12767,5 +12771,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
12767
12771
  * Generated bundle index. Do not edit.
12768
12772
  */
12769
12773
 
12770
- export { ActionRoles, AngularEngineKeys, BaseComponentProps, CPTKN, CardComponent, ComponentEventNames, ComponentRendererComponent, ComponentsTagNames, CrudFieldComponent, CrudFormComponent, CssClasses, DB_ADAPTER_PROVIDER, DB_ADAPTER_PROVIDER_TOKEN, DecafFakerRepository, DefaultFormReactiveOptions, DefaultListEmptyOptions, DefaultModalOptions, Dynamic, DynamicModule, ElementPositions, ElementSizes, EmptyStateComponent, FieldsetComponent, FileUploadComponent, FilterComponent, ForAngularCommonModule, ForAngularComponentsModule, FormConstants, I18N_CONFIG_TOKEN, I18nLoader, I18nLoaderFactory, I18nParser, IconComponent, LOCALE_ROOT_TOKEN, LayoutComponent, LayoutGridGaps, ListComponent, ListComponentsTypes, ListItemComponent, ListItemPositions, LoggerLevels, ModalComponent, ModelRendererComponent, NgxComponentDirective, NgxEventHandler, NgxFormDirective, NgxFormFieldDirective, NgxFormService, NgxMediaService, NgxModelPageDirective, NgxPageDirective, NgxParentComponentDirective, NgxRenderingEngine, NgxSvgDirective, PaginationComponent, RouteDirections, SearchbarComponent, SelectFieldInterfaces, SteppedFormComponent, WindowColorSchemes, cleanSpaces, dataMapper, decafPageTransition, filterString, formatDate, generateRandomValue, getFakerData, getInjectablesRegistry, getLocaleContext, getLocaleContextByKey, getLocaleFromClassName, getLocaleLanguage, getLogger, getMenuIcon, getModelAndRepository, getNgxInlineModal, getNgxModalComponent, getNgxModalCrudComponent, getNgxSelectOptionsModal, getOnWindow, getOnWindowDocument, getWindow, getWindowDocument, getWindowWidth, isDarkMode, isDevelopmentMode, isNotUndefined, isValidDate, itemMapper, parseToValidDate, presentNgxInlineModal, presentNgxLightBoxModal, provideDecafDarkMode, provideDecafDbAdapter, provideDecafDynamicComponents, provideDecafI18nConfig, provideDecafI18nLoader, provideDecafPageTransition, removeFocusTrap, setOnWindow, stringToBoolean, windowEventEmitter };
12774
+ export { ActionRoles, AngularEngineKeys, BaseComponentProps, CPTKN, CardComponent, ComponentEventNames, ComponentRendererComponent, ComponentsTagNames, CrudFieldComponent, CrudFormComponent, CssClasses, DB_ADAPTER_FLAVOUR_TOKEN, DB_ADAPTER_PROVIDER_TOKEN, DecafFakerRepository, DefaultFormReactiveOptions, DefaultListEmptyOptions, DefaultModalOptions, Dynamic, DynamicModule, ElementPositions, ElementSizes, EmptyStateComponent, FieldsetComponent, FileUploadComponent, FilterComponent, ForAngularCommonModule, ForAngularComponentsModule, FormConstants, I18N_CONFIG_TOKEN, I18nLoader, I18nLoaderFactory, I18nParser, IconComponent, LOCALE_ROOT_TOKEN, LayoutComponent, LayoutGridGaps, ListComponent, ListComponentsTypes, ListItemComponent, ListItemPositions, LoggerLevels, ModalComponent, ModelRendererComponent, NgxComponentDirective, NgxEventHandler, NgxFormDirective, NgxFormFieldDirective, NgxFormService, NgxMediaService, NgxModelPageDirective, NgxPageDirective, NgxParentComponentDirective, NgxRenderingEngine, NgxSvgDirective, PaginationComponent, RouteDirections, SearchbarComponent, SelectFieldInterfaces, SteppedFormComponent, WindowColorSchemes, cleanSpaces, dataMapper, decafPageTransition, filterString, formatDate, generateRandomValue, getDbAdapterFlavour, getFakerData, getInjectablesRegistry, getLocaleContext, getLocaleContextByKey, getLocaleFromClassName, getLocaleLanguage, getLogger, getMenuIcon, getModelAndRepository, getNgxInlineModal, getNgxModalComponent, getNgxModalCrudComponent, getNgxSelectOptionsModal, getOnWindow, getOnWindowDocument, getWindow, getWindowDocument, getWindowWidth, isDarkMode, isDevelopmentMode, isNotUndefined, isValidDate, itemMapper, parseToValidDate, presentNgxInlineModal, presentNgxLightBoxModal, provideDecafDarkMode, provideDecafDbAdapter, provideDecafDynamicComponents, provideDecafI18nConfig, provideDecafI18nLoader, provideDecafPageTransition, removeFocusTrap, setOnWindow, stringToBoolean, windowEventEmitter };
12771
12775
  //# sourceMappingURL=decaf-ts-for-angular.mjs.map