From f5b030a001af06fb5a62c86bf9fdf785cc7b04b3 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Mon, 1 Jul 2024 16:05:07 +0300 Subject: [PATCH 01/14] fix: ts-toolbelt build errors for ng-packs --- npm/ng-packs/package.json | 2 +- .../extensible-form.component.ts | 4 +- .../src/lib/utils/form-props.util.ts | 14 ++++-- .../extensible/src/lib/utils/props.util.ts | 47 ++++++++++--------- .../src/lib/utils/typeahead.util.ts | 2 +- .../packages/components/tsconfig.json | 4 +- .../core/src/lib/models/environment.ts | 9 ++-- 7 files changed, 46 insertions(+), 36 deletions(-) diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 4b34ba425f3..f47c982cb71 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -124,7 +124,7 @@ "should-quote": "^1.0.0", "ts-jest": "29.1.0", "ts-node": "10.9.1", - "ts-toolbelt": "6.15.4", + "ts-toolbelt": "^9.0.0", "tslib": "^2.0.0", "tslint": "~6.1.0", "typescript": "~5.3.0", diff --git a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts index 455f8cdd99c..ae725c1563b 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts @@ -55,7 +55,7 @@ export class ExtensibleFormComponent { extraPropertiesKey = EXTRA_PROPERTIES_KEY; groupedPropList!: GroupedFormPropList; - groupedPropListOfArray: FormProp[][]; + groupedPropListOfArray!: FormProp[][]; record!: R; get form(): UntypedFormGroup { @@ -76,7 +76,7 @@ export class ExtensibleFormComponent { } //TODO: Reactor this method - isAnyGroupMemberVisible(index: number, data) { + isAnyGroupMemberVisible(index: number, data: any) { const { items } = this.groupedPropList; const formPropList = items[index].formPropList.toArray(); return formPropList.some(prop => prop.visible(data)); diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts index ab7c669d477..aacc6fe5976 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts @@ -1,10 +1,10 @@ import { UntypedFormControl, UntypedFormGroup } from '@angular/forms'; -import { DateTimeAdapter,DateAdapter,TimeAdapter } from '@abp/ng.theme.shared'; +import { DateTimeAdapter, DateAdapter, TimeAdapter } from '@abp/ng.theme.shared'; import { EXTRA_PROPERTIES_KEY } from '../constants/extra-properties'; import { ePropType } from '../enums/props.enum'; -import { FormPropList } from "../models/form-props"; -import { PropData } from "../models/props"; +import { FormPropList } from '../models/form-props'; +import { PropData } from '../models/props'; import { ExtensionsService } from '../services/extensions.service'; import { EXTENSIONS_IDENTIFIER } from '../tokens/extensions.token'; @@ -16,7 +16,7 @@ export function generateFormFromProps(data: PropData) { const extraForm = new UntypedFormGroup({}); form.addControl(EXTRA_PROPERTIES_KEY, extraForm); - const record = data.record || {}; + const record: any = data.record || {}; const type = JSON.stringify(record) === '{}' ? 'create' : 'edit'; const props: FormPropList = extensions[`${type}FormProps`].get(identifier).props; const extraProperties = record[EXTRA_PROPERTIES_KEY] || {}; @@ -24,7 +24,11 @@ export function generateFormFromProps(data: PropData) { props.forEach(({ value: prop }) => { const name = prop.name; const isExtraProperty = prop.isExtra || name in extraProperties; - let value = isExtraProperty ? extraProperties[name] : name in record ? record[name] : undefined; + let value = isExtraProperty + ? extraProperties[name as string] + : name in record + ? record[name] + : undefined; if (typeof value === 'undefined') value = prop.defaultValue; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts index 24360dccc17..ccd00d3862c 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts @@ -26,7 +26,7 @@ import { export function createExtraPropertyValueResolver( name: string, ): PropCallback> { - return (data?) => of((data.record as { [key: string]: any })[EXTRA_PROPERTIES_KEY][name]); + return (data?) => of((data?.record as { [key: string]: any })[EXTRA_PROPERTIES_KEY][name]); } export function mergeWithDefaultProps>( @@ -47,26 +47,29 @@ export function mergeWithDefaultProps>( ); }); } -type InferredPropDefaults = F extends EntityPropsFactory - ? EntityPropDefaults - : F extends CreateFormPropsFactory - ? CreateFormPropDefaults - : F extends EditFormPropsFactory - ? EditFormPropDefaults - : never; +type InferredPropDefaults = + F extends EntityPropsFactory + ? EntityPropDefaults + : F extends CreateFormPropsFactory + ? CreateFormPropDefaults + : F extends EditFormPropsFactory + ? EditFormPropDefaults + : never; -type InferredPropContributorCallbacks = F extends EntityPropsFactory - ? EntityPropContributorCallbacks - : F extends CreateFormPropsFactory - ? CreateFormPropContributorCallbacks - : F extends EditFormPropsFactory - ? EditFormPropContributorCallbacks - : never; +type InferredPropContributorCallbacks = + F extends EntityPropsFactory + ? EntityPropContributorCallbacks + : F extends CreateFormPropsFactory + ? CreateFormPropContributorCallbacks + : F extends EditFormPropsFactory + ? EditFormPropContributorCallbacks + : never; -type InferredProps = F extends EntityPropsFactory - ? EntityProps - : F extends CreateFormPropsFactory - ? FormProps - : F extends EditFormPropsFactory - ? FormProps - : never; +type InferredProps = + F extends EntityPropsFactory + ? EntityProps + : F extends CreateFormPropsFactory + ? FormProps + : F extends EditFormPropsFactory + ? FormProps + : never; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts index eec592ad0c2..565aed66dca 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts @@ -39,7 +39,7 @@ export function createTypeaheadOptions( } export function getTypeaheadType(lookup: ExtensionPropertyUiLookupDto, name: string) { - if (!!lookup.url) { + if (!lookup.url) { return ePropType.Typeahead; } else { return name.endsWith(TYPEAHEAD_TEXT_SUFFIX) ? ePropType.Hidden : undefined; diff --git a/npm/ng-packs/packages/components/tsconfig.json b/npm/ng-packs/packages/components/tsconfig.json index 03261df5a47..e810769905b 100644 --- a/npm/ng-packs/packages/components/tsconfig.json +++ b/npm/ng-packs/packages/components/tsconfig.json @@ -11,6 +11,8 @@ } ], "compilerOptions": { - "target": "es2020" + "target": "es2020", + "strict": true, + "strictNullChecks": true } } diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index 78a9294525f..a3979186318 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -1,5 +1,6 @@ import { AuthConfig } from 'angular-oauth2-oidc'; import { ABP } from './common'; +import { O } from 'ts-toolbelt'; export interface Environment { apis: Apis; @@ -20,17 +21,17 @@ export interface ApplicationInfo { export interface HasAdditional { [key: string]: string; } -export interface ApiConfig extends Partial{ +export interface ApiConfig extends O.Partial { url: string; - rootNamespace?: string; + rootNamespace: string; } export interface Apis { - [key: string]: Partial; + [key: string]: O.Partial; default: ApiConfig; } -export type customMergeFn = (localEnv: Partial, remoteEnv: any) => Environment; +export type customMergeFn = (localEnv: O.Partial, remoteEnv: any) => Environment; export interface RemoteEnv { url: string; From e8a65c0f525b111f57e25f3fbcf63664bd5c8fe9 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:42:26 +0300 Subject: [PATCH 02/14] fix: exclamation rollback --- .../components/extensible-form/extensible-form.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts index ae725c1563b..455f8cdd99c 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/components/extensible-form/extensible-form.component.ts @@ -55,7 +55,7 @@ export class ExtensibleFormComponent { extraPropertiesKey = EXTRA_PROPERTIES_KEY; groupedPropList!: GroupedFormPropList; - groupedPropListOfArray!: FormProp[][]; + groupedPropListOfArray: FormProp[][]; record!: R; get form(): UntypedFormGroup { @@ -76,7 +76,7 @@ export class ExtensibleFormComponent { } //TODO: Reactor this method - isAnyGroupMemberVisible(index: number, data: any) { + isAnyGroupMemberVisible(index: number, data) { const { items } = this.groupedPropList; const formPropList = items[index].formPropList.toArray(); return formPropList.some(prop => prop.visible(data)); From 2ace075a0e85f68165ef43205d0774d57ae34890 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:43:10 +0300 Subject: [PATCH 03/14] update: core package version allignment --- npm/ng-packs/packages/core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/package.json b/npm/ng-packs/packages/core/package.json index a010a481c36..10a15ab5e5f 100644 --- a/npm/ng-packs/packages/core/package.json +++ b/npm/ng-packs/packages/core/package.json @@ -10,7 +10,7 @@ "@abp/utils": "~8.2.0", "just-clone": "^6.0.0", "just-compare": "^2.0.0", - "ts-toolbelt": "6.15.4", + "ts-toolbelt": "^9.0.0", "tslib": "^2.0.0" }, "publishConfig": { From 915d123747605913e07fce9c453afd85cbee0cdf Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:44:44 +0300 Subject: [PATCH 04/14] update: rollback to ApiConfig rootNamespace --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index a3979186318..85a776a6938 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -23,7 +23,7 @@ export interface HasAdditional { } export interface ApiConfig extends O.Partial { url: string; - rootNamespace: string; + rootNamespace?: string; } export interface Apis { From a92bcd2746459e197a7f828b1c649def0da54239 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:45:22 +0300 Subject: [PATCH 05/14] update: rollback the tsconfig arrangements --- npm/ng-packs/packages/components/tsconfig.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/npm/ng-packs/packages/components/tsconfig.json b/npm/ng-packs/packages/components/tsconfig.json index e810769905b..03261df5a47 100644 --- a/npm/ng-packs/packages/components/tsconfig.json +++ b/npm/ng-packs/packages/components/tsconfig.json @@ -11,8 +11,6 @@ } ], "compilerOptions": { - "target": "es2020", - "strict": true, - "strictNullChecks": true + "target": "es2020" } } From 9baea783e0cfbdbe0628238922b0b52e1b720374 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:46:25 +0300 Subject: [PATCH 06/14] fix: auto syntax arrangement --- npm/ng-packs/packages/components/extensible/src/public-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/components/extensible/src/public-api.ts b/npm/ng-packs/packages/components/extensible/src/public-api.ts index abcc3a1a0cd..4b3d1976233 100644 --- a/npm/ng-packs/packages/components/extensible/src/public-api.ts +++ b/npm/ng-packs/packages/components/extensible/src/public-api.ts @@ -62,7 +62,7 @@ export * from './lib/pipes/create-injector.pipe'; export * from './lib/services/extensions.service'; export * from './lib/tokens/extensions.token'; export * from './lib/tokens/extensible-form-view-provider.token'; - export * from './lib/utils/actions.util'; +export * from './lib/utils/actions.util'; export * from './lib/utils/form-props.util'; export * from './lib/utils/props.util'; export * from './lib/utils/state.util'; From 9b7fd267ecdf216278e6a0ec119c80a2358c4114 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Wed, 17 Jul 2024 16:50:18 +0300 Subject: [PATCH 07/14] fix: build errors --- .../extensible/src/lib/models/actions.ts | 6 ++++-- .../src/lib/models/entity-actions.ts | 9 +++++---- .../extensible/src/lib/models/entity-props.ts | 10 ++++++---- .../extensible/src/lib/models/form-props.ts | 9 +++++---- .../extensible/src/lib/models/props.ts | 6 ++++-- .../src/lib/models/toolbar-actions.ts | 20 +++++++++++-------- .../src/lib/utils/form-props.util.ts | 8 ++------ .../extensible/src/lib/utils/props.util.ts | 2 +- 8 files changed, 39 insertions(+), 31 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts index 07e3c0b91ee..82c995f3cb5 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts @@ -22,8 +22,10 @@ export abstract class ActionData { } } -export type ReadonlyActionData = O.Readonly, 'data'>>; - +export type ReadonlyActionData = O.Merge< + O.Readonly, 'data' | 'record'>>, + { record: R } +>; export abstract class Action { constructor( public readonly permission: string, diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts index eb103cb1bdf..9c28f270d59 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts @@ -47,10 +47,11 @@ export class EntityAction extends Action { } } -export type EntityActionOptions = O.Optional< - O.Writable>, - 'permission' | 'visible' | 'icon' ->; +type OptionalKeys = 'permission' | 'visible' | 'icon'; +type PartialEntityActionOptions = O.Partial, OptionalKeys>>; +type FilteredEntityActionOptions = O.Omit, OptionalKeys>; +export type EntityActionOptions = PartialEntityActionOptions & + FilteredEntityActionOptions; export type EntityActionDefaults = Record[]>; export type EntityActionContributorCallback = ActionContributorCallback< diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts index 7692457cd84..b06845af98c 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts @@ -71,8 +71,7 @@ export class EntityProp extends Prop { } } -export type EntityPropOptions = O.Optional< - O.Writable>, +type OptionalKeys = | 'permission' | 'visible' | 'columnVisible' @@ -83,8 +82,11 @@ export type EntityPropOptions = O.Optional< | 'valueResolver' | 'action' | 'component' - | 'enumList' ->; + | 'enumList'; + +type PartialEntityPropOptions = O.Partial, OptionalKeys>>; +type FilteredEntityPropOptions = O.Omit, OptionalKeys>; +export type EntityPropOptions = PartialEntityPropOptions & FilteredEntityPropOptions; export type EntityPropDefaults = Record[]>; export type EntityPropContributorCallback = PropContributorCallback>; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts index c1b8cacbe28..f9f3736dee4 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts @@ -131,8 +131,7 @@ export class FormPropData extends PropData { } } -export type FormPropOptions = O.Optional< - O.Writable>, +type OptionalKeys = | 'permission' | 'visible' | 'displayName' @@ -147,8 +146,10 @@ export type FormPropOptions = O.Optional< | 'id' | 'displayTextResolver' | 'formText' - | 'tooltip' ->; + | 'tooltip'; +type PartialFormPropOptions = O.Partial, OptionalKeys>>; +type FilteredFormPropOptions = O.Omit, OptionalKeys>; +export type FormPropOptions = PartialFormPropOptions & FilteredFormPropOptions; export type CreateFormPropDefaults = Record[]>; export type CreateFormPropContributorCallback = PropContributorCallback>; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts index 2c88bd99398..549e6aa43dd 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts @@ -24,8 +24,10 @@ export abstract class PropData { } } -export type ReadonlyPropData = O.Readonly, 'data'>>; - +export type ReadonlyPropData = O.Merge< + O.Readonly, 'data' | 'record'>>, + { record: R } +>; export abstract class Prop { constructor( public readonly type: ePropType, diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts index 02b26a81735..b54f2e82568 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts @@ -61,15 +61,19 @@ export class ToolbarComponent extends Action { } } -export type ToolbarActionOptions = O.Optional< - O.Writable>, - 'permission' | 'visible' | 'icon' | 'btnClass' ->; - -export type ToolbarComponentOptions = O.Optional< - O.Writable>, - 'permission' | 'visible' | 'action' +type OptionalActionKeys = 'permission' | 'visible' | 'icon' | 'btnClass'; +type PartialToolbarActionOptions = O.Partial, OptionalActionKeys>>; +type FilteredToolbarActionOptions = O.Omit, OptionalActionKeys>; +export type ToolbarActionOptions = PartialToolbarActionOptions & + FilteredToolbarActionOptions; + +type OptionalComponentKeys = 'permission' | 'visible' | 'action'; +type PartialToolbarComponentOptions = O.Partial< + O.Pick, OptionalComponentKeys> >; +type FilteredToolbarComponentOptions = O.Omit, OptionalComponentKeys>; +export type ToolbarComponentOptions = PartialToolbarComponentOptions & + FilteredToolbarComponentOptions; export type ToolbarActionDefault = ToolbarAction | ToolbarComponent; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts index aacc6fe5976..75b8487b313 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/form-props.util.ts @@ -16,7 +16,7 @@ export function generateFormFromProps(data: PropData) { const extraForm = new UntypedFormGroup({}); form.addControl(EXTRA_PROPERTIES_KEY, extraForm); - const record: any = data.record || {}; + const record = data.record || {}; const type = JSON.stringify(record) === '{}' ? 'create' : 'edit'; const props: FormPropList = extensions[`${type}FormProps`].get(identifier).props; const extraProperties = record[EXTRA_PROPERTIES_KEY] || {}; @@ -24,11 +24,7 @@ export function generateFormFromProps(data: PropData) { props.forEach(({ value: prop }) => { const name = prop.name; const isExtraProperty = prop.isExtra || name in extraProperties; - let value = isExtraProperty - ? extraProperties[name as string] - : name in record - ? record[name] - : undefined; + let value = isExtraProperty ? extraProperties[name] : name in record ? record[name] : undefined; if (typeof value === 'undefined') value = prop.defaultValue; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts index ccd00d3862c..72078580360 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/props.util.ts @@ -26,7 +26,7 @@ import { export function createExtraPropertyValueResolver( name: string, ): PropCallback> { - return (data?) => of((data?.record as { [key: string]: any })[EXTRA_PROPERTIES_KEY][name]); + return (data?) => of((data.record as { [key: string]: any })[EXTRA_PROPERTIES_KEY][name]); } export function mergeWithDefaultProps>( From d1f59723621129b90cd2634d16dc6b28a8340609 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 09:16:44 +0300 Subject: [PATCH 08/14] update: remove unnecessary dependency --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index 85a776a6938..c67d4a687eb 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -1,6 +1,5 @@ import { AuthConfig } from 'angular-oauth2-oidc'; import { ABP } from './common'; -import { O } from 'ts-toolbelt'; export interface Environment { apis: Apis; @@ -21,17 +20,17 @@ export interface ApplicationInfo { export interface HasAdditional { [key: string]: string; } -export interface ApiConfig extends O.Partial { +export interface ApiConfig extends Partial { url: string; rootNamespace?: string; } export interface Apis { - [key: string]: O.Partial; + [key: string]: Partial; default: ApiConfig; } -export type customMergeFn = (localEnv: O.Partial, remoteEnv: any) => Environment; +export type customMergeFn = (localEnv: Partial, remoteEnv: any) => Environment; export interface RemoteEnv { url: string; From df891edc397d4dcb2d0a24599a6a95467d0bfee2 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 10:40:55 +0300 Subject: [PATCH 09/14] update: logic fix --- .../components/extensible/src/lib/utils/typeahead.util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts index 565aed66dca..baf41aacdb6 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/typeahead.util.ts @@ -40,9 +40,9 @@ export function createTypeaheadOptions( export function getTypeaheadType(lookup: ExtensionPropertyUiLookupDto, name: string) { if (!lookup.url) { - return ePropType.Typeahead; - } else { return name.endsWith(TYPEAHEAD_TEXT_SUFFIX) ? ePropType.Hidden : undefined; + } else { + return ePropType.Typeahead; } } From 8d2bbe8881f8bbe1939f8e89af25905da75e3deb Mon Sep 17 00:00:00 2001 From: masumulu28 Date: Thu, 18 Jul 2024 11:10:01 +0300 Subject: [PATCH 10/14] update typescript version & remove README.md --- npm/ng-packs/package.json | 2 +- npm/ng-packs/packages/components/extensible/README.md | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 npm/ng-packs/packages/components/extensible/README.md diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index f47c982cb71..d4d1a61fdbd 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -127,7 +127,7 @@ "ts-toolbelt": "^9.0.0", "tslib": "^2.0.0", "tslint": "~6.1.0", - "typescript": "~5.3.0", + "typescript": "~5.4.0", "zone.js": "~0.14.0" }, "lint-staged": { diff --git a/npm/ng-packs/packages/components/extensible/README.md b/npm/ng-packs/packages/components/extensible/README.md deleted file mode 100644 index 7a14a85f7c3..00000000000 --- a/npm/ng-packs/packages/components/extensible/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @abp/ng.components/extensible - -Secondary entry point of `@abp/ng.components`. It can be used by importing from `@abp/ng.components/extensible`. From a6039ae59a6adbf48a2dfdc06ea7dc2af4e8d0b5 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 16:24:44 +0300 Subject: [PATCH 11/14] update: remove unused dependency and use default TS instead --- .../components/extensible/src/lib/models/actions.ts | 12 +++++++----- .../components/extensible/src/lib/models/props.ts | 7 ++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts index 82c995f3cb5..f56af00b422 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts @@ -1,6 +1,5 @@ import { LinkedList } from '@abp/utils'; import { InjectFlags, InjectionToken, InjectOptions, Type } from '@angular/core'; -import { O } from 'ts-toolbelt'; export abstract class ActionList> extends LinkedList {} @@ -22,10 +21,13 @@ export abstract class ActionData { } } -export type ReadonlyActionData = O.Merge< - O.Readonly, 'data' | 'record'>>, - { record: R } ->; +// export type ReadonlyActionData = O.Merge< +// Readonly, 'data' | 'record'>>, +// { record: R } +// >; + +export type ReadonlyActionData = Readonly, 'data'>>; + export abstract class Action { constructor( public readonly permission: string, diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts index 549e6aa43dd..7b1e2b7949e 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/props.ts @@ -1,6 +1,5 @@ import { LinkedList } from '@abp/utils'; import { InjectFlags, InjectionToken, InjectOptions, Type } from '@angular/core'; -import { O } from 'ts-toolbelt'; import { ePropType } from '../enums/props.enum'; import { FormPropTooltip } from './form-props'; @@ -24,10 +23,8 @@ export abstract class PropData { } } -export type ReadonlyPropData = O.Merge< - O.Readonly, 'data' | 'record'>>, - { record: R } ->; +export type ReadonlyPropData = Readonly, 'data'>>; + export abstract class Prop { constructor( public readonly type: ePropType, From 02c1db39c198681a8fb5835348359850c42573a8 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 16:25:52 +0300 Subject: [PATCH 12/14] fix: remove comment --- .../packages/components/extensible/src/lib/models/actions.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts index f56af00b422..57a8e26bf05 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/actions.ts @@ -21,11 +21,6 @@ export abstract class ActionData { } } -// export type ReadonlyActionData = O.Merge< -// Readonly, 'data' | 'record'>>, -// { record: R } -// >; - export type ReadonlyActionData = Readonly, 'data'>>; export abstract class Action { From 4700fbbe4ce4588cae78762a1e2ddf126b6c0f80 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 16:57:05 +0300 Subject: [PATCH 13/14] add: model util to use in extensible models --- .../packages/components/extensible/src/lib/utils/model.utils.ts | 2 ++ npm/ng-packs/packages/components/extensible/src/public-api.ts | 1 + 2 files changed, 3 insertions(+) create mode 100644 npm/ng-packs/packages/components/extensible/src/lib/utils/model.utils.ts diff --git a/npm/ng-packs/packages/components/extensible/src/lib/utils/model.utils.ts b/npm/ng-packs/packages/components/extensible/src/lib/utils/model.utils.ts new file mode 100644 index 00000000000..c7b7c6426aa --- /dev/null +++ b/npm/ng-packs/packages/components/extensible/src/lib/utils/model.utils.ts @@ -0,0 +1,2 @@ +export type PartialWithOptions = Partial>; +export type FilteredWithOptions = Omit; diff --git a/npm/ng-packs/packages/components/extensible/src/public-api.ts b/npm/ng-packs/packages/components/extensible/src/public-api.ts index 4b3d1976233..35e4696d49b 100644 --- a/npm/ng-packs/packages/components/extensible/src/public-api.ts +++ b/npm/ng-packs/packages/components/extensible/src/public-api.ts @@ -66,4 +66,5 @@ export * from './lib/utils/actions.util'; export * from './lib/utils/form-props.util'; export * from './lib/utils/props.util'; export * from './lib/utils/state.util'; +export * from './lib/utils/model.utils'; export * from './lib/extensible.module'; From 635aeb4b1a6f7f397dcd6e54fb4dafa8cdf6c0e6 Mon Sep 17 00:00:00 2001 From: sumeyyeKurtulus Date: Thu, 18 Jul 2024 16:57:27 +0300 Subject: [PATCH 14/14] update: remove unused dependency and apply model utility --- .../src/lib/models/entity-actions.ts | 8 +++---- .../extensible/src/lib/models/entity-props.ts | 8 +++---- .../extensible/src/lib/models/form-props.ts | 7 +++--- .../src/lib/models/toolbar-actions.ts | 22 +++++++++---------- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts index 9c28f270d59..1de7a5e76e5 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-actions.ts @@ -1,5 +1,4 @@ import { Type } from '@angular/core'; -import { O } from 'ts-toolbelt'; import { Action, ActionContributorCallback, @@ -9,6 +8,7 @@ import { ActionsFactory, } from './actions'; import { FormPropTooltip } from './form-props'; +import { FilteredWithOptions, PartialWithOptions } from '../utils/model.utils'; export class EntityActionList extends ActionList> {} @@ -48,10 +48,8 @@ export class EntityAction extends Action { } type OptionalKeys = 'permission' | 'visible' | 'icon'; -type PartialEntityActionOptions = O.Partial, OptionalKeys>>; -type FilteredEntityActionOptions = O.Omit, OptionalKeys>; -export type EntityActionOptions = PartialEntityActionOptions & - FilteredEntityActionOptions; +export type EntityActionOptions = PartialWithOptions, OptionalKeys> & + FilteredWithOptions, OptionalKeys>; export type EntityActionDefaults = Record[]>; export type EntityActionContributorCallback = ActionContributorCallback< diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts index b06845af98c..8964bd9090d 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/entity-props.ts @@ -1,7 +1,6 @@ import { ABP, escapeHtmlChars } from '@abp/ng.core'; import { InjectFlags, InjectOptions, InjectionToken, Type } from '@angular/core'; import { Observable, of } from 'rxjs'; -import { O } from 'ts-toolbelt'; import { ActionCallback } from './actions'; import { Prop, @@ -13,6 +12,7 @@ import { PropsFactory, } from './props'; import { FormPropTooltip } from './form-props'; +import { FilteredWithOptions, PartialWithOptions } from '../utils/model.utils'; export class EntityPropList extends PropList> {} @@ -83,10 +83,8 @@ type OptionalKeys = | 'action' | 'component' | 'enumList'; - -type PartialEntityPropOptions = O.Partial, OptionalKeys>>; -type FilteredEntityPropOptions = O.Omit, OptionalKeys>; -export type EntityPropOptions = PartialEntityPropOptions & FilteredEntityPropOptions; +export type EntityPropOptions = PartialWithOptions, OptionalKeys> & + FilteredWithOptions, OptionalKeys>; export type EntityPropDefaults = Record[]>; export type EntityPropContributorCallback = PropContributorCallback>; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts index f9f3736dee4..f99aa016236 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/form-props.ts @@ -2,7 +2,6 @@ import { ABP } from '@abp/ng.core'; import { Injector, Type } from '@angular/core'; import { AsyncValidatorFn, ValidatorFn } from '@angular/forms'; import { Observable } from 'rxjs'; -import { O } from 'ts-toolbelt'; import { Prop, PropCallback, @@ -15,6 +14,7 @@ import { Props, PropsFactory, } from './props'; +import { FilteredWithOptions, PartialWithOptions } from '../utils/model.utils'; export class FormPropList extends PropList> {} @@ -147,9 +147,8 @@ type OptionalKeys = | 'displayTextResolver' | 'formText' | 'tooltip'; -type PartialFormPropOptions = O.Partial, OptionalKeys>>; -type FilteredFormPropOptions = O.Omit, OptionalKeys>; -export type FormPropOptions = PartialFormPropOptions & FilteredFormPropOptions; +export type FormPropOptions = PartialWithOptions, OptionalKeys> & + FilteredWithOptions, OptionalKeys>; export type CreateFormPropDefaults = Record[]>; export type CreateFormPropContributorCallback = PropContributorCallback>; diff --git a/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts b/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts index b54f2e82568..676b839bfd0 100644 --- a/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts +++ b/npm/ng-packs/packages/components/extensible/src/lib/models/toolbar-actions.ts @@ -1,5 +1,4 @@ import { Injector, Type } from '@angular/core'; -import { O } from 'ts-toolbelt'; import { Action, ActionContributorCallback, @@ -10,6 +9,7 @@ import { ActionsFactory, ReadonlyActionData, } from './actions'; +import { FilteredWithOptions, PartialWithOptions } from '../utils/model.utils'; export class ToolbarActionList extends ActionList> {} @@ -62,18 +62,18 @@ export class ToolbarComponent extends Action { } type OptionalActionKeys = 'permission' | 'visible' | 'icon' | 'btnClass'; -type PartialToolbarActionOptions = O.Partial, OptionalActionKeys>>; -type FilteredToolbarActionOptions = O.Omit, OptionalActionKeys>; -export type ToolbarActionOptions = PartialToolbarActionOptions & - FilteredToolbarActionOptions; +export type ToolbarActionOptions = PartialWithOptions< + ToolbarAction, + OptionalActionKeys +> & + FilteredWithOptions, OptionalActionKeys>; type OptionalComponentKeys = 'permission' | 'visible' | 'action'; -type PartialToolbarComponentOptions = O.Partial< - O.Pick, OptionalComponentKeys> ->; -type FilteredToolbarComponentOptions = O.Omit, OptionalComponentKeys>; -export type ToolbarComponentOptions = PartialToolbarComponentOptions & - FilteredToolbarComponentOptions; +export type ToolbarComponentOptions = PartialWithOptions< + ToolbarComponent, + OptionalComponentKeys +> & + FilteredWithOptions, OptionalComponentKeys>; export type ToolbarActionDefault = ToolbarAction | ToolbarComponent;