@masterteam/properties 0.0.1

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/index.d.ts ADDED
@@ -0,0 +1,311 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { Observable } from 'rxjs';
3
+ import { StateContext } from '@ngxs/store';
4
+ import * as _angular_core from '@angular/core';
5
+ import { HttpContextToken } from '@angular/common/http';
6
+
7
+ interface LoadingStateShape<L extends string = string> {
8
+ loadingActive: L[];
9
+ errors: Partial<Record<L, string>>;
10
+ }
11
+
12
+ interface PropertyItem {
13
+ id: number;
14
+ key: string;
15
+ normalizedKey: string;
16
+ viewType: string;
17
+ viewTypeLabel: string;
18
+ name: string | Record<string, string>;
19
+ description?: string;
20
+ defaultValue?: unknown;
21
+ order?: number;
22
+ canBeDeleted?: boolean;
23
+ displayOverView?: boolean;
24
+ enabled?: boolean;
25
+ formula?: unknown[];
26
+ isBasic?: boolean;
27
+ isCalculated?: boolean;
28
+ isConfigurable?: boolean;
29
+ isHiddenInCreation?: boolean;
30
+ isHiddenInEdition?: boolean;
31
+ isLive?: boolean;
32
+ isLog?: boolean;
33
+ isRequired?: boolean;
34
+ isSystem?: boolean;
35
+ isTranslatable?: boolean;
36
+ shownInTable?: boolean;
37
+ includeInSummary?: boolean;
38
+ dependsOn?: unknown[];
39
+ isFilterFormula?: boolean;
40
+ Configuration?: Record<string, unknown>;
41
+ category?: string;
42
+ valueOnCreation?: boolean;
43
+ isRelated?: boolean;
44
+ [key: string]: unknown;
45
+ }
46
+ interface LookupDefinitionItem {
47
+ id: number;
48
+ key?: string;
49
+ displayName?: string;
50
+ [key: string]: unknown;
51
+ }
52
+ interface LookupDefinition {
53
+ id: number;
54
+ key: string;
55
+ displayName: string;
56
+ allowDelete: boolean;
57
+ allowManage: boolean;
58
+ allowEdit: boolean;
59
+ items: LookupDefinitionItem[];
60
+ [key: string]: unknown;
61
+ }
62
+ interface GroupDefinition {
63
+ id: number;
64
+ name: string;
65
+ [key: string]: unknown;
66
+ }
67
+ interface LogDefinition {
68
+ id: number;
69
+ name: string;
70
+ [key: string]: unknown;
71
+ }
72
+ interface CountryDefinition {
73
+ name: string;
74
+ name_ar?: string;
75
+ code?: string;
76
+ viewBox?: string;
77
+ [key: string]: unknown;
78
+ }
79
+ interface ApiSchemaProperty {
80
+ type?: string;
81
+ [key: string]: unknown;
82
+ }
83
+ interface ApiSchema {
84
+ properties?: Record<string, ApiSchemaProperty>;
85
+ [key: string]: unknown;
86
+ }
87
+ interface ApiPropertyOption {
88
+ key: string;
89
+ name: string;
90
+ type?: string;
91
+ }
92
+ interface ApiConfigurationValue {
93
+ endpoint: string;
94
+ headers: Record<string, string>;
95
+ key?: string;
96
+ value?: string;
97
+ schema?: ApiSchema | null;
98
+ supportMultiSelect?: boolean;
99
+ }
100
+ interface ApiTestPayload {
101
+ endpoint: string;
102
+ headers?: Record<string, string>;
103
+ }
104
+ interface ApiTestResponse {
105
+ schema?: ApiSchema | null;
106
+ data?: unknown;
107
+ }
108
+ type PropertiesLoadingName = 'getAll' | 'getOne' | 'create' | 'update' | 'delete' | 'getLookups' | 'getGroups' | 'getConfigProperties' | 'getLogs' | 'getCountries' | 'testApiConfiguration';
109
+ interface PropertiesStateModel extends LoadingStateShape<PropertiesLoadingName> {
110
+ properties: PropertyItem[];
111
+ selectedProperty: PropertyItem | null;
112
+ moduleType: string | null;
113
+ moduleId: string | number | null;
114
+ lastQueryParams: PropertiesQueryParams | null;
115
+ lookups: LookupDefinition[];
116
+ configTypeProperties: PropertyItem[];
117
+ groups: GroupDefinition[];
118
+ logs: LogDefinition[];
119
+ countries: CountryDefinition[];
120
+ apiSchema: ApiSchema | null;
121
+ apiProperties: ApiPropertyOption[];
122
+ propertyTypes?: any[];
123
+ }
124
+ interface PropertiesQueryParams {
125
+ includeLog?: boolean;
126
+ includeLevel?: boolean;
127
+ includeLevelParent?: boolean;
128
+ isDynamicList?: boolean;
129
+ isSystem?: boolean;
130
+ isCSharpMethod?: boolean;
131
+ }
132
+ interface PropertyPayload {
133
+ viewType: string;
134
+ isCalculated: boolean;
135
+ name: Record<string, string>;
136
+ description?: string;
137
+ defaultValue?: any;
138
+ Configuration?: Record<string, any> | string | null;
139
+ }
140
+
141
+ declare class GetProperties {
142
+ readonly params?: PropertiesQueryParams | undefined;
143
+ static readonly type = "[Properties] Get All";
144
+ constructor(params?: PropertiesQueryParams | undefined);
145
+ }
146
+ declare class GetProperty {
147
+ readonly id: string | number;
148
+ readonly mode: 'edit';
149
+ static readonly type = "[Properties] Get One";
150
+ constructor(id: string | number, mode?: 'edit');
151
+ }
152
+ declare class GetLookups {
153
+ static readonly type = "[Properties] Get Lookups";
154
+ }
155
+ declare class GetGroups {
156
+ static readonly type = "[Properties] Get Groups";
157
+ }
158
+ declare class GetLogs {
159
+ static readonly type = "[Properties] Get Logs";
160
+ }
161
+ declare class GetCountries {
162
+ static readonly type = "[Properties] Get Countries";
163
+ }
164
+ declare class TestApiConfiguration {
165
+ readonly payload: ApiTestPayload;
166
+ static readonly type = "[Properties] Test API Configuration";
167
+ constructor(payload: ApiTestPayload);
168
+ }
169
+ declare class ResetApiConfiguration {
170
+ static readonly type = "[Properties] Reset API Configuration";
171
+ }
172
+ declare class GetPropertiesForConfigType {
173
+ readonly moduleType: string;
174
+ readonly moduleId: string | number;
175
+ readonly params?: PropertiesQueryParams | undefined;
176
+ static readonly type = "[Properties] Get By Config Type";
177
+ constructor(moduleType: string, moduleId: string | number, params?: PropertiesQueryParams | undefined);
178
+ }
179
+ declare class ResetConfigProperties {
180
+ static readonly type = "[Properties] Reset Config Properties";
181
+ }
182
+ declare class ResetSelectedProperty {
183
+ static readonly type = "[Properties] Reset Selected Property";
184
+ }
185
+ declare class DeleteProperty {
186
+ readonly id: string | number;
187
+ static readonly type = "[Properties] Delete";
188
+ constructor(id: string | number);
189
+ }
190
+ declare class CreateProperty {
191
+ readonly payload: PropertyPayload;
192
+ static readonly type = "[Properties] Create";
193
+ constructor(payload: PropertyPayload);
194
+ }
195
+ declare class UpdateProperty {
196
+ readonly id: string | number;
197
+ readonly payload: PropertyPayload;
198
+ static readonly type = "[Properties] Update";
199
+ constructor(id: string | number, payload: PropertyPayload);
200
+ }
201
+ declare class SetPropertiesModuleInfo {
202
+ readonly moduleType: string;
203
+ readonly moduleId: string | number;
204
+ static readonly type = "[Properties] Set Module Info";
205
+ constructor(moduleType: string, moduleId: string | number);
206
+ }
207
+ declare class SetPropertyTypes {
208
+ readonly payload: any;
209
+ static readonly type = "[Properties] Set Property Types";
210
+ constructor(payload: any);
211
+ }
212
+
213
+ interface Response<T> {
214
+ endpoint: string;
215
+ status: number;
216
+ code: number;
217
+ locale: string;
218
+ message?: string | null;
219
+ errors?: any | null;
220
+ data: T;
221
+ cacheSession?: string;
222
+ }
223
+
224
+ declare class PropertiesState {
225
+ private readonly http;
226
+ private readonly baseUrl;
227
+ private readonly lookupsUrl;
228
+ private readonly configPropertiesUrl;
229
+ private readonly groupsUrl;
230
+ private readonly logsUrl;
231
+ private readonly countriesUrl;
232
+ private readonly apiTestUrl;
233
+ private readonly apiDetectUrl;
234
+ static properties(state: PropertiesStateModel): PropertyItem[];
235
+ static selectedProperty(state: PropertiesStateModel): PropertyItem | null;
236
+ static lookups(state: PropertiesStateModel): LookupDefinition[];
237
+ static configTypeProperties(state: PropertiesStateModel): PropertyItem[];
238
+ static groups(state: PropertiesStateModel): GroupDefinition[];
239
+ static logs(state: PropertiesStateModel): LogDefinition[];
240
+ static countries(state: PropertiesStateModel): CountryDefinition[];
241
+ static apiSchema(state: PropertiesStateModel): ApiSchema | null;
242
+ static apiProperties(state: PropertiesStateModel): ApiPropertyOption[];
243
+ static propertyTypes(state: PropertiesStateModel): any[];
244
+ static isLoadingFactory(state: PropertiesStateModel): (loadingName: PropertiesLoadingName) => boolean;
245
+ static errorFactory(state: PropertiesStateModel): (loadingName: PropertiesLoadingName) => string | null;
246
+ static propertyById(state: PropertiesStateModel): (id: number | string) => PropertyItem | null;
247
+ getAll(ctx: StateContext<PropertiesStateModel>, action: GetProperties): rxjs.Observable<Response<PropertyItem[]> | null>;
248
+ getOne(ctx: StateContext<PropertiesStateModel>, action: GetProperty): rxjs.Observable<Response<PropertyItem> | null>;
249
+ getLookups(ctx: StateContext<PropertiesStateModel>, _action: GetLookups): rxjs.Observable<LookupDefinition[]> | rxjs.Observable<never[] | Response<LookupDefinition[]>>;
250
+ getGroups(ctx: StateContext<PropertiesStateModel>, _action: GetGroups): rxjs.Observable<GroupDefinition[]> | rxjs.Observable<never[] | Response<GroupDefinition[]>>;
251
+ getLogs(ctx: StateContext<PropertiesStateModel>, _action: GetLogs): rxjs.Observable<LogDefinition[]> | rxjs.Observable<never[] | Response<LogDefinition[]>>;
252
+ getCountries(ctx: StateContext<PropertiesStateModel>, _action: GetCountries): rxjs.Observable<CountryDefinition[]>;
253
+ testApiConfiguration(ctx: StateContext<PropertiesStateModel>, action: TestApiConfiguration): rxjs.Observable<Response<ApiSchema> | null>;
254
+ resetApiConfiguration(ctx: StateContext<PropertiesStateModel>): void;
255
+ private resolveApiSchema;
256
+ private buildSchemaFromData;
257
+ private resolveValueType;
258
+ private mapSchemaToOptions;
259
+ getPropertiesForConfigType(ctx: StateContext<PropertiesStateModel>, action: GetPropertiesForConfigType): rxjs.Observable<never[] | Response<PropertyItem[]>>;
260
+ resetConfigProperties(ctx: StateContext<PropertiesStateModel>): void;
261
+ resetSelectedProperty(ctx: StateContext<PropertiesStateModel>): void;
262
+ setModuleInfo(ctx: StateContext<PropertiesStateModel>, action: SetPropertiesModuleInfo): void;
263
+ create(ctx: StateContext<PropertiesStateModel>, action: CreateProperty): rxjs.Observable<null> | rxjs.Observable<Response<PropertyItem>>;
264
+ update(ctx: StateContext<PropertiesStateModel>, action: UpdateProperty): rxjs.Observable<Response<PropertyItem> | null>;
265
+ delete(ctx: StateContext<PropertiesStateModel>, action: DeleteProperty): rxjs.Observable<void | null>;
266
+ SetPropertyTypes(ctx: StateContext<PropertiesStateModel>, action: SetPropertyTypes): void;
267
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PropertiesState, never>;
268
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<PropertiesState>;
269
+ }
270
+
271
+ declare class PropertiesFacade {
272
+ private readonly store;
273
+ readonly list: _angular_core.Signal<PropertyItem[]>;
274
+ readonly propertyTypes: _angular_core.Signal<any>;
275
+ readonly selected: _angular_core.Signal<PropertyItem | null>;
276
+ readonly lookups: _angular_core.Signal<LookupDefinition[]>;
277
+ readonly configProperties: _angular_core.Signal<PropertyItem[]>;
278
+ readonly groups: _angular_core.Signal<GroupDefinition[]>;
279
+ readonly logs: _angular_core.Signal<LogDefinition[]>;
280
+ readonly countries: _angular_core.Signal<CountryDefinition[]>;
281
+ readonly apiSchema: _angular_core.Signal<ApiSchema | null>;
282
+ readonly apiProperties: _angular_core.Signal<ApiPropertyOption[]>;
283
+ readonly systemProperties: _angular_core.Signal<PropertyItem[]>;
284
+ readonly customProperties: _angular_core.Signal<PropertyItem[]>;
285
+ isLoading(loadingName: PropertiesLoadingName): _angular_core.Signal<boolean>;
286
+ loadAll(params?: Partial<PropertiesQueryParams>): Observable<unknown>;
287
+ loadOne(id: string | number, mode?: 'edit'): Observable<unknown>;
288
+ delete(id: string | number): Observable<unknown>;
289
+ create(payload: PropertyPayload): Observable<unknown>;
290
+ update(id: string | number, payload: PropertyPayload): Observable<unknown>;
291
+ setModuleInfo(moduleType: string, moduleId: string | number): Observable<unknown>;
292
+ loadLookups(): Observable<unknown>;
293
+ loadGroups(): Observable<unknown>;
294
+ loadLogs(): Observable<unknown>;
295
+ loadCountries(): Observable<unknown>;
296
+ testApiConfiguration(payload: ApiTestPayload): Observable<unknown>;
297
+ resetApiConfiguration(): Observable<unknown>;
298
+ setPropertyTypes(propertyTypes: any): Observable<void>;
299
+ loadPropertiesForConfigType(moduleType: string, moduleId: string | number, params?: Partial<PropertiesQueryParams>): Observable<unknown>;
300
+ resetSelectedProperty(): Observable<unknown>;
301
+ resetConfigProperties(): Observable<unknown>;
302
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PropertiesFacade, never>;
303
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<PropertiesFacade>;
304
+ }
305
+
306
+ declare const REQUEST_CONTEXT: HttpContextToken<{
307
+ useBaseUrl: boolean;
308
+ }>;
309
+
310
+ export { CreateProperty, DeleteProperty, GetCountries, GetGroups, GetLogs, GetLookups, GetProperties, GetPropertiesForConfigType, GetProperty, PropertiesFacade, PropertiesState, REQUEST_CONTEXT, ResetApiConfiguration, ResetConfigProperties, ResetSelectedProperty, SetPropertiesModuleInfo, SetPropertyTypes, TestApiConfiguration, UpdateProperty };
311
+ export type { ApiConfigurationValue, ApiPropertyOption, ApiSchema, ApiSchemaProperty, ApiTestPayload, ApiTestResponse, CountryDefinition, GroupDefinition, LogDefinition, LookupDefinition, LookupDefinitionItem, PropertiesLoadingName, PropertiesQueryParams, PropertiesStateModel, PropertyItem, PropertyPayload };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@masterteam/properties",
3
+ "version": "0.0.1",
4
+ "publishConfig": {
5
+ "directory": ".",
6
+ "linkDirectory": false,
7
+ "access": "public"
8
+ },
9
+ "peerDependencies": {
10
+ "@angular/common": "^20.1.3",
11
+ "@angular/core": "^20.1.3",
12
+ "@angular/forms": "^20.1.3",
13
+ "@primeuix/themes": "^1.2.2",
14
+ "@tailwindcss/postcss": "^4.1.11",
15
+ "postcss": "^8.5.6",
16
+ "primeng": "^20.0.1",
17
+ "rxjs": "^7.8.2",
18
+ "tailwindcss": "^4.1.11",
19
+ "tailwindcss-primeui": "^0.6.1",
20
+ "@ngxs/store": "^20.1.0"
21
+ },
22
+ "dependencies": {
23
+ "@masterteam/components": "x",
24
+ "@masterteam/forms": "x",
25
+ "@masterteam/icons": "x",
26
+ "tslib": "^2.3.0"
27
+ },
28
+ "sideEffects": false,
29
+ "exports": {
30
+ "./assets/properties.css": {
31
+ "style": "./assets/properties.css"
32
+ },
33
+ "./package.json": {
34
+ "default": "./package.json"
35
+ },
36
+ ".": {
37
+ "types": "./index.d.ts",
38
+ "default": "./fesm2022/masterteam-properties.mjs"
39
+ }
40
+ },
41
+ "module": "fesm2022/masterteam-properties.mjs",
42
+ "typings": "index.d.ts"
43
+ }