@masterteam/properties 0.0.28 → 0.0.30

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/properties",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/properties",
6
6
  "linkDirectory": false,
@@ -19,9 +19,10 @@
19
19
  "tailwindcss": "^4.1.17",
20
20
  "tailwindcss-primeui": "^0.6.1",
21
21
  "@ngxs/store": "^20.1.0",
22
- "@masterteam/components": "^0.0.79",
23
- "@masterteam/forms": "^0.0.34",
24
- "@masterteam/icons": "^0.0.12"
22
+ "@masterteam/formula-builder": "^0.0.2",
23
+ "@masterteam/forms": "^0.0.35",
24
+ "@masterteam/icons": "^0.0.13",
25
+ "@masterteam/components": "^0.0.86"
25
26
  },
26
27
  "sideEffects": false,
27
28
  "exports": {
@@ -3,11 +3,13 @@ import { BreadcrumbItem } from '@masterteam/components/breadcrumb';
3
3
  import * as _angular_core from '@angular/core';
4
4
  import { OnDestroy } from '@angular/core';
5
5
  import { ColumnDef, TableAction } from '@masterteam/components/table';
6
- import { DynamicFormConfig } from '@masterteam/components';
6
+ import { FormulaBuilderValue } from '@masterteam/formula-builder';
7
+ import { CrudStateBase, DynamicFormConfig } from '@masterteam/components';
7
8
  import { FormGroup, FormControl } from '@angular/forms';
8
9
  import * as rxjs from 'rxjs';
9
10
  import { Observable } from 'rxjs';
10
11
  import { StateContext } from '@ngxs/store';
12
+ import * as _masterteam_properties from '@masterteam/properties';
11
13
  import { HttpContextToken } from '@angular/common/http';
12
14
 
13
15
  interface LoadingStateShape<L extends string = string> {
@@ -28,7 +30,7 @@ interface PropertyItem {
28
30
  canBeDeleted?: boolean;
29
31
  displayOverView?: boolean;
30
32
  enabled?: boolean;
31
- formula?: unknown[];
33
+ formula?: FormulaBuilderValue | null;
32
34
  isBasic?: boolean;
33
35
  isCalculated?: boolean;
34
36
  isConfigurable?: boolean;
@@ -119,8 +121,21 @@ interface ApiTestResponse {
119
121
  schema?: ApiSchema | null;
120
122
  data?: unknown;
121
123
  }
122
- type PropertiesLoadingName = 'getAll' | 'getOne' | 'create' | 'update' | 'delete' | 'getLookups' | 'getGroups' | 'getConfigProperties' | 'getConfigAsType' | 'getCountries' | 'testApiConfiguration';
123
- interface PropertiesStateModel extends LoadingStateShape<PropertiesLoadingName> {
124
+ declare enum PropertiesActionKey {
125
+ GetAll = "getAll",
126
+ GetOne = "getOne",
127
+ Create = "create",
128
+ Update = "update",
129
+ Delete = "delete",
130
+ GetLookups = "getLookups",
131
+ GetGroups = "getGroups",
132
+ GetConfigProperties = "getConfigProperties",
133
+ GetConfigAsType = "getConfigAsType",
134
+ GetCountries = "getCountries",
135
+ TestApiConfiguration = "testApiConfiguration"
136
+ }
137
+ type PropertiesLoadingName = PropertiesActionKey;
138
+ interface PropertiesStateModel extends LoadingStateShape<PropertiesActionKey> {
124
139
  properties: PropertyItem[];
125
140
  selectedProperty: PropertyItem | null;
126
141
  moduleType: string | null;
@@ -136,7 +151,7 @@ interface PropertiesStateModel extends LoadingStateShape<PropertiesLoadingName>
136
151
  countries: CountryDefinition[];
137
152
  apiSchema: ApiSchema | null;
138
153
  apiProperties: ApiPropertyOption[];
139
- propertyTypes?: any[];
154
+ propertyTypes?: any;
140
155
  breadcrumbItems: BreadcrumbItem[];
141
156
  defaultViewType: string | null;
142
157
  }
@@ -151,6 +166,7 @@ interface PropertiesQueryParams {
151
166
  interface PropertyPayload {
152
167
  viewType: string;
153
168
  isCalculated: boolean;
169
+ formula?: FormulaBuilderValue | null;
154
170
  name: Record<string, string>;
155
171
  description?: string;
156
172
  defaultValue?: any;
@@ -257,7 +273,7 @@ interface Response<T> {
257
273
  cacheSession?: string;
258
274
  }
259
275
 
260
- declare class PropertiesState {
276
+ declare class PropertiesState extends CrudStateBase<PropertyItem, PropertiesStateModel, PropertiesActionKey> {
261
277
  private readonly http;
262
278
  private readonly baseUrl;
263
279
  private readonly lookupsUrl;
@@ -268,6 +284,8 @@ declare class PropertiesState {
268
284
  private readonly apiDetectUrl;
269
285
  static properties(state: PropertiesStateModel): PropertyItem[];
270
286
  static selectedProperty(state: PropertiesStateModel): PropertyItem | null;
287
+ static moduleId(state: PropertiesStateModel): string | number | null;
288
+ static parentModuleId(state: PropertiesStateModel): string | number | null;
271
289
  static lookups(state: PropertiesStateModel): LookupDefinition[];
272
290
  static configTypeProperties(state: PropertiesStateModel): PropertyItem[];
273
291
  static groups(state: PropertiesStateModel): GroupDefinition[];
@@ -275,53 +293,78 @@ declare class PropertiesState {
275
293
  static countries(state: PropertiesStateModel): CountryDefinition[];
276
294
  static apiSchema(state: PropertiesStateModel): ApiSchema | null;
277
295
  static apiProperties(state: PropertiesStateModel): ApiPropertyOption[];
278
- static propertyTypes(state: PropertiesStateModel): any[];
296
+ static propertyTypes(state: PropertiesStateModel): any;
279
297
  static breadcrumbItems(state: PropertiesStateModel): BreadcrumbItem[];
280
298
  static defaultViewType(state: PropertiesStateModel): string | null;
281
- static isLoadingFactory(state: PropertiesStateModel): (loadingName: PropertiesLoadingName) => boolean;
282
- static errorFactory(state: PropertiesStateModel): (loadingName: PropertiesLoadingName) => string | null;
299
+ static getLoadingActive(state: PropertiesStateModel): string[];
300
+ static getErrors(state: PropertiesStateModel): Record<string, string | null>;
283
301
  static propertyById(state: PropertiesStateModel): (id: number | string) => PropertyItem | null;
284
- getAll(ctx: StateContext<PropertiesStateModel>, action: GetProperties): rxjs.Observable<Response<PropertyItem[]> | null>;
285
- getOne(ctx: StateContext<PropertiesStateModel>, action: GetProperty): rxjs.Observable<Response<PropertyItem> | null>;
286
- getLookups(ctx: StateContext<PropertiesStateModel>, _action: GetLookups): rxjs.Observable<LookupDefinition[]> | rxjs.Observable<never[] | Response<LookupDefinition[]>>;
287
- getGroups(ctx: StateContext<PropertiesStateModel>, _action: GetGroups): rxjs.Observable<GroupDefinition[]> | rxjs.Observable<never[] | Response<GroupDefinition[]>>;
288
- getConfigAsType(ctx: StateContext<PropertiesStateModel>, action: GetConfigAsType): rxjs.Observable<ConfigScope[]> | rxjs.Observable<never[] | Response<ConfigScope[]>>;
302
+ getAll(ctx: StateContext<PropertiesStateModel>, action: GetProperties): rxjs.Observable<Response<PropertyItem[]>>;
303
+ getOne(ctx: StateContext<PropertiesStateModel>, action: GetProperty): rxjs.Observable<Response<PropertyItem>>;
304
+ getLookups(ctx: StateContext<PropertiesStateModel>, _action: GetLookups): rxjs.Observable<LookupDefinition[]> | rxjs.Observable<Response<LookupDefinition[]>>;
305
+ getGroups(ctx: StateContext<PropertiesStateModel>, _action: GetGroups): rxjs.Observable<GroupDefinition[]> | rxjs.Observable<Response<GroupDefinition[]>>;
306
+ getConfigAsType(ctx: StateContext<PropertiesStateModel>, action: GetConfigAsType): rxjs.Observable<ConfigScope[]> | rxjs.Observable<Response<ConfigScope[]>>;
289
307
  getCountries(ctx: StateContext<PropertiesStateModel>, _action: GetCountries): rxjs.Observable<CountryDefinition[]>;
290
308
  testApiConfiguration(ctx: StateContext<PropertiesStateModel>, action: TestApiConfiguration): rxjs.Observable<Response<ApiSchema> | null>;
291
- resetApiConfiguration(ctx: StateContext<PropertiesStateModel>): void;
292
- private mapSchemaToOptions;
293
- getPropertiesForConfigType(ctx: StateContext<PropertiesStateModel>, action: GetPropertiesForConfigType): rxjs.Observable<never[] | Response<PropertyItem[]>>;
309
+ getPropertiesForConfigType(ctx: StateContext<PropertiesStateModel>, action: GetPropertiesForConfigType): rxjs.Observable<Response<PropertyItem[]>>;
294
310
  resetConfigProperties(ctx: StateContext<PropertiesStateModel>): void;
295
311
  resetConfigScopes(ctx: StateContext<PropertiesStateModel>): void;
296
312
  resetSelectedProperty(ctx: StateContext<PropertiesStateModel>): void;
313
+ resetApiConfiguration(ctx: StateContext<PropertiesStateModel>): void;
297
314
  setModuleInfo(ctx: StateContext<PropertiesStateModel>, action: SetPropertiesModuleInfo): void;
298
- create(ctx: StateContext<PropertiesStateModel>, action: CreateProperty): rxjs.Observable<null> | rxjs.Observable<Response<PropertyItem>>;
299
- update(ctx: StateContext<PropertiesStateModel>, action: UpdateProperty): rxjs.Observable<Response<PropertyItem> | null>;
300
- delete(ctx: StateContext<PropertiesStateModel>, action: DeleteProperty): rxjs.Observable<void | null>;
301
315
  SetPropertyTypes(ctx: StateContext<PropertiesStateModel>, action: SetPropertyTypes): void;
302
316
  setBreadcrumb(ctx: StateContext<PropertiesStateModel>, action: SetBreadcrumb): void;
303
317
  setDefaultViewType(ctx: StateContext<PropertiesStateModel>, action: SetDefaultViewType): void;
318
+ createProperty(ctx: StateContext<PropertiesStateModel>, action: CreateProperty): rxjs.Observable<null> | rxjs.Observable<Response<PropertyItem>>;
319
+ updateProperty(ctx: StateContext<PropertiesStateModel>, action: UpdateProperty): rxjs.Observable<null> | rxjs.Observable<Response<PropertyItem>>;
320
+ deleteProperty(ctx: StateContext<PropertiesStateModel>, action: DeleteProperty): rxjs.Observable<void>;
321
+ private mapSchemaToOptions;
304
322
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PropertiesState, never>;
305
323
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<PropertiesState>;
306
324
  }
307
325
 
308
326
  declare class PropertiesFacade {
309
327
  private readonly store;
310
- readonly list: _angular_core.Signal<PropertyItem[]>;
328
+ readonly list: _angular_core.Signal<_masterteam_properties.PropertyItem[]>;
311
329
  readonly propertyTypes: _angular_core.Signal<any>;
312
- readonly selected: _angular_core.Signal<PropertyItem | null>;
313
- readonly lookups: _angular_core.Signal<LookupDefinition[]>;
314
- readonly configProperties: _angular_core.Signal<PropertyItem[]>;
315
- readonly groups: _angular_core.Signal<GroupDefinition[]>;
316
- readonly configScopes: _angular_core.Signal<ConfigScope[]>;
317
- readonly countries: _angular_core.Signal<CountryDefinition[]>;
318
- readonly apiSchema: _angular_core.Signal<ApiSchema | null>;
319
- readonly apiProperties: _angular_core.Signal<ApiPropertyOption[]>;
330
+ readonly selected: _angular_core.Signal<_masterteam_properties.PropertyItem | null>;
331
+ readonly moduleId: _angular_core.Signal<string | number | null>;
332
+ readonly parentModuleId: _angular_core.Signal<string | number | null>;
333
+ readonly lookups: _angular_core.Signal<_masterteam_properties.LookupDefinition[]>;
334
+ readonly configProperties: _angular_core.Signal<_masterteam_properties.PropertyItem[]>;
335
+ readonly groups: _angular_core.Signal<_masterteam_properties.GroupDefinition[]>;
336
+ readonly configScopes: _angular_core.Signal<_masterteam_properties.ConfigScope[]>;
337
+ readonly countries: _angular_core.Signal<_masterteam_properties.CountryDefinition[]>;
338
+ readonly apiSchema: _angular_core.Signal<_masterteam_properties.ApiSchema | null>;
339
+ readonly apiProperties: _angular_core.Signal<_masterteam_properties.ApiPropertyOption[]>;
320
340
  readonly breadcrumbItems: _angular_core.Signal<BreadcrumbItem[]>;
321
341
  readonly defaultViewType: _angular_core.Signal<string | null>;
322
- readonly systemProperties: _angular_core.Signal<PropertyItem[]>;
323
- readonly customProperties: _angular_core.Signal<PropertyItem[]>;
324
- isLoading(loadingName: PropertiesLoadingName): _angular_core.Signal<boolean>;
342
+ private readonly loadingActive;
343
+ private readonly errors;
344
+ readonly isLoadingAll: _angular_core.Signal<boolean>;
345
+ readonly isLoadingOne: _angular_core.Signal<boolean>;
346
+ readonly isCreating: _angular_core.Signal<boolean>;
347
+ readonly isUpdating: _angular_core.Signal<boolean>;
348
+ readonly isDeleting: _angular_core.Signal<boolean>;
349
+ readonly isLoadingLookups: _angular_core.Signal<boolean>;
350
+ readonly isLoadingGroups: _angular_core.Signal<boolean>;
351
+ readonly isLoadingConfigProperties: _angular_core.Signal<boolean>;
352
+ readonly isLoadingConfigAsType: _angular_core.Signal<boolean>;
353
+ readonly isLoadingCountries: _angular_core.Signal<boolean>;
354
+ readonly isTestingApi: _angular_core.Signal<boolean>;
355
+ readonly allError: _angular_core.Signal<string | null>;
356
+ readonly oneError: _angular_core.Signal<string | null>;
357
+ readonly createError: _angular_core.Signal<string | null>;
358
+ readonly updateError: _angular_core.Signal<string | null>;
359
+ readonly deleteError: _angular_core.Signal<string | null>;
360
+ readonly lookupsError: _angular_core.Signal<string | null>;
361
+ readonly groupsError: _angular_core.Signal<string | null>;
362
+ readonly configPropertiesError: _angular_core.Signal<string | null>;
363
+ readonly configAsTypeError: _angular_core.Signal<string | null>;
364
+ readonly countriesError: _angular_core.Signal<string | null>;
365
+ readonly apiTestError: _angular_core.Signal<string | null>;
366
+ readonly systemProperties: _angular_core.Signal<_masterteam_properties.PropertyItem[]>;
367
+ readonly customProperties: _angular_core.Signal<_masterteam_properties.PropertyItem[]>;
325
368
  loadAll(params?: Partial<PropertiesQueryParams>): Observable<unknown>;
326
369
  loadOne(id: string | number, mode?: 'edit'): Observable<unknown>;
327
370
  delete(id: string | number): Observable<unknown>;
@@ -397,14 +440,18 @@ declare class PropertyForm implements OnDestroy {
397
440
  readonly propertyForm: FormGroup<{
398
441
  main: FormControl<any>;
399
442
  configuration: FormControl<any>;
443
+ formula: FormControl<FormulaBuilderValue | null>;
400
444
  }>;
401
445
  private readonly mainControl;
402
446
  private readonly configurationControl;
447
+ private readonly formulaControl;
403
448
  private readonly creating;
404
449
  private readonly updating;
405
450
  readonly loading: _angular_core.Signal<boolean>;
406
451
  readonly submitting: _angular_core.Signal<boolean>;
407
452
  readonly propertyType: _angular_core.Signal<any>;
453
+ readonly isCalculated: _angular_core.Signal<boolean>;
454
+ readonly formulaSchemaId: _angular_core.Signal<number | undefined>;
408
455
  private readonly selectedPropertyTypeConfiguration;
409
456
  readonly configurationFormConfig: _angular_core.Signal<any>;
410
457
  private configurationHost?;
@@ -426,6 +473,7 @@ declare class PropertyForm implements OnDestroy {
426
473
  private extractConfigurationForm;
427
474
  private resolveConfigurationComponent;
428
475
  private applyConfigurationComponentResult;
476
+ private resolveSchemaId;
429
477
  createOrEditProperty(): void;
430
478
  private syncFormWithSelectedProperty;
431
479
  goBack(): void;
@@ -434,5 +482,5 @@ declare class PropertyForm implements OnDestroy {
434
482
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PropertyForm, "mt-property-form", never, { "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
435
483
  }
436
484
 
437
- export { CreateProperty, DeleteProperty, GetConfigAsType, GetCountries, GetGroups, GetLookups, GetProperties, GetPropertiesForConfigType, GetProperty, PropertiesFacade, PropertiesList, PropertiesState, PropertyForm, REQUEST_CONTEXT, ResetApiConfiguration, ResetConfigProperties, ResetConfigScopes, ResetSelectedProperty, SetBreadcrumb, SetDefaultViewType, SetPropertiesModuleInfo, SetPropertyTypes, TestApiConfiguration, UpdateProperty };
485
+ export { CreateProperty, DeleteProperty, GetConfigAsType, GetCountries, GetGroups, GetLookups, GetProperties, GetPropertiesForConfigType, GetProperty, PropertiesActionKey, PropertiesFacade, PropertiesList, PropertiesState, PropertyForm, REQUEST_CONTEXT, ResetApiConfiguration, ResetConfigProperties, ResetConfigScopes, ResetSelectedProperty, SetBreadcrumb, SetDefaultViewType, SetPropertiesModuleInfo, SetPropertyTypes, TestApiConfiguration, UpdateProperty };
438
486
  export type { ApiConfigurationValue, ApiPropertyOption, ApiSchema, ApiSchemaProperty, ApiTestPayload, ApiTestResponse, ConfigScope, CountryDefinition, GroupDefinition, LogDefinition, LookupDefinition, LookupDefinitionItem, PropertiesLoadingName, PropertiesQueryParams, PropertiesStateModel, PropertyItem, PropertyPayload };