@decaf-ts/for-angular 0.0.57 → 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.
@@ -490,7 +490,11 @@ class ValidatorFactory {
490
490
  * and exposes helper providers such as DB adapter registration and logger utilities.
491
491
  * @link {@link ForAngularCommonModule}
492
492
  */
493
- 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
+ ;
494
498
  /**
495
499
  * @description Injection token for registering the database adapter provider.
496
500
  * @summary Used to inject the database adapter instance that implements DecafRepositoryAdapter.
@@ -586,7 +590,7 @@ function getModelAndRepository(model, clazz) {
586
590
  const constructor = Model.get((modelName.charAt(0).toUpperCase() + modelName.slice(1)));
587
591
  if (!constructor)
588
592
  return undefined;
589
- const dbAdapterFlavour = getOnWindow(DB_ADAPTER_PROVIDER) || undefined;
593
+ const dbAdapterFlavour = getOnWindow(DB_ADAPTER_FLAVOUR_TOKEN) || undefined;
590
594
  if (dbAdapterFlavour)
591
595
  uses(dbAdapterFlavour)(constructor);
592
596
  const repository = Repository.forModel(constructor);
@@ -630,10 +634,10 @@ function getModelAndRepository(model, clazz) {
630
634
  */
631
635
  function provideDecafDbAdapter(clazz, options = {}, flavour) {
632
636
  const adapter = new clazz(options);
633
- if (flavour)
637
+ if (!flavour)
634
638
  flavour = adapter.flavour;
635
639
  getLogger(provideDecafDbAdapter).info(`Using ${adapter.constructor.name} ${flavour} as Db Provider`);
636
- setOnWindow(DB_ADAPTER_PROVIDER, flavour);
640
+ setOnWindow(DB_ADAPTER_FLAVOUR_TOKEN, flavour);
637
641
  return {
638
642
  provide: DB_ADAPTER_PROVIDER_TOKEN,
639
643
  useValue: adapter,
@@ -2306,7 +2310,7 @@ class DecafFakerRepository extends LoggedClass {
2306
2310
  throw new InternalError(`Cannot find model ${modelName}. was it registered with @model?`);
2307
2311
  try {
2308
2312
  this.model = new constructor();
2309
- const dbAdapterFlavour = getOnWindow(DB_ADAPTER_PROVIDER) || undefined;
2313
+ const dbAdapterFlavour = getOnWindow(DB_ADAPTER_FLAVOUR_TOKEN) || undefined;
2310
2314
  if (dbAdapterFlavour)
2311
2315
  uses(dbAdapterFlavour)(constructor);
2312
2316
  this._repository = Repository.forModel(constructor);
@@ -2606,7 +2610,8 @@ class NgxRenderingEngine extends RenderingEngine {
2606
2610
  // NgxRenderingEngine._projectable = false;
2607
2611
  }
2608
2612
  result.children = fieldDef.children.map((child) => {
2609
- 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);
2610
2615
  // const hiddenOn = (child?.props?.hidden || []) as string[];
2611
2616
  // // moved to ui decorators
2612
2617
  // if (child?.children?.length) {
@@ -12766,5 +12771,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
12766
12771
  * Generated bundle index. Do not edit.
12767
12772
  */
12768
12773
 
12769
- 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 };
12770
12775
  //# sourceMappingURL=decaf-ts-for-angular.mjs.map