@masterteam/components 0.0.91 → 0.0.92
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/assets/common.css +1 -1
- package/fesm2022/masterteam-components-business-fields.mjs +225 -0
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -0
- package/fesm2022/masterteam-components-menu.mjs +21 -2
- package/fesm2022/masterteam-components-menu.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +12 -1
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/masterteam-components-business-fields.d.ts +114 -0
- package/types/masterteam-components-menu.d.ts +3 -0
- package/types/masterteam-components.d.ts +12 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, Validators, NgControl } from '@angular/forms';
|
|
3
|
+
import { HttpContext } from '@angular/common/http';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One source level inside connection configuration.
|
|
7
|
+
* Comes from `field.propertyMetadata.configuration.sourceLevels[]`
|
|
8
|
+
*/
|
|
9
|
+
interface ConnectionSourceLevel {
|
|
10
|
+
levelId: number;
|
|
11
|
+
levelKey: string;
|
|
12
|
+
name: {
|
|
13
|
+
en?: string;
|
|
14
|
+
ar?: string;
|
|
15
|
+
[k: string]: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
connectionId: number;
|
|
18
|
+
isOptional: boolean;
|
|
19
|
+
allowManyToMany: boolean;
|
|
20
|
+
supportWeights: boolean;
|
|
21
|
+
optionsQuery: {
|
|
22
|
+
path: string;
|
|
23
|
+
method?: string;
|
|
24
|
+
query?: Record<string, any>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Full connection configuration from `field.propertyMetadata.configuration`.
|
|
29
|
+
* This is passed as a single input to the component.
|
|
30
|
+
*/
|
|
31
|
+
interface SchemaConnectionConfig {
|
|
32
|
+
targetLevelId: number;
|
|
33
|
+
sourceLevelId?: number;
|
|
34
|
+
propertyKey?: string;
|
|
35
|
+
valueMode?: string;
|
|
36
|
+
sourceLevels: ConnectionSourceLevel[];
|
|
37
|
+
payloadTemplate?: {
|
|
38
|
+
levelId: number;
|
|
39
|
+
sources: any[];
|
|
40
|
+
};
|
|
41
|
+
sourceItemShape?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
/** One selected source in the connection payload */
|
|
44
|
+
interface ConnectionSource {
|
|
45
|
+
sourceLevelId: number;
|
|
46
|
+
sourceLevelDataId: number;
|
|
47
|
+
}
|
|
48
|
+
/** The value shape for a connection field */
|
|
49
|
+
interface ConnectionPayload {
|
|
50
|
+
levelId: number;
|
|
51
|
+
sources: ConnectionSource[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Internal state tracked per source level dropdown.
|
|
55
|
+
*/
|
|
56
|
+
interface SourceLevelState {
|
|
57
|
+
source: ConnectionSourceLevel;
|
|
58
|
+
options: any[];
|
|
59
|
+
loading: boolean;
|
|
60
|
+
}
|
|
61
|
+
declare class SchemaConnectionField implements ControlValueAccessor {
|
|
62
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
63
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
64
|
+
readonly readonly: _angular_core.InputSignal<boolean>;
|
|
65
|
+
readonly required: _angular_core.InputSignal<boolean>;
|
|
66
|
+
readonly filter: _angular_core.InputSignal<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Full connection configuration object from the API.
|
|
69
|
+
* Includes `targetLevelId`, `sourceLevels[]`, `payloadTemplate`, etc.
|
|
70
|
+
*/
|
|
71
|
+
readonly configuration: _angular_core.InputSignal<SchemaConnectionConfig>;
|
|
72
|
+
/**
|
|
73
|
+
* Optional HttpContext for API requests (e.g. to set base URL behavior).
|
|
74
|
+
*/
|
|
75
|
+
readonly context: _angular_core.InputSignal<HttpContext | undefined>;
|
|
76
|
+
/** The full ConnectionPayload value */
|
|
77
|
+
value: _angular_core.WritableSignal<ConnectionPayload | null>;
|
|
78
|
+
disabled: _angular_core.WritableSignal<boolean>;
|
|
79
|
+
/** Per-source-level state: options + loading */
|
|
80
|
+
sourceLevelStates: _angular_core.WritableSignal<SourceLevelState[]>;
|
|
81
|
+
/** Mutable selections per source level: sourceLevelId -> selected value */
|
|
82
|
+
selections: Record<number, any>;
|
|
83
|
+
requiredValidator: typeof Validators.required;
|
|
84
|
+
onTouched: () => void;
|
|
85
|
+
onModelChange: (value: ConnectionPayload | null) => void;
|
|
86
|
+
ngControl: NgControl | null;
|
|
87
|
+
private http;
|
|
88
|
+
private destroyRef;
|
|
89
|
+
/**
|
|
90
|
+
* Source levels from configuration.
|
|
91
|
+
*/
|
|
92
|
+
readonly sourceLevels: _angular_core.Signal<ConnectionSourceLevel[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Percentage width for each dropdown, evenly divided.
|
|
95
|
+
*/
|
|
96
|
+
readonly dropdownWidth: _angular_core.Signal<string>;
|
|
97
|
+
constructor();
|
|
98
|
+
private loadOptions;
|
|
99
|
+
private updateSourceState;
|
|
100
|
+
/**
|
|
101
|
+
* Single handler — no params. Reads all selections, builds the combined payload.
|
|
102
|
+
*/
|
|
103
|
+
syncValue(): void;
|
|
104
|
+
private distributeToSelections;
|
|
105
|
+
writeValue(value: ConnectionPayload | string | null): void;
|
|
106
|
+
registerOnChange(fn: (value: ConnectionPayload | null) => void): void;
|
|
107
|
+
registerOnTouched(fn: any): void;
|
|
108
|
+
setDisabledState(disabled: boolean): void;
|
|
109
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SchemaConnectionField, never>;
|
|
110
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchemaConnectionField, "mt-schema-connection-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": true; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { SchemaConnectionField };
|
|
114
|
+
export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, SchemaConnectionConfig, SourceLevelState };
|
|
@@ -7,6 +7,7 @@ import { ButtonSeverity } from 'primeng/button';
|
|
|
7
7
|
|
|
8
8
|
interface MTMenuItem extends Omit<MenuItem, 'icon'> {
|
|
9
9
|
icon?: MTIcon;
|
|
10
|
+
color?: string;
|
|
10
11
|
severity?: ButtonSeverity | 'danger';
|
|
11
12
|
styleClass?: string;
|
|
12
13
|
id?: string | number;
|
|
@@ -41,6 +42,8 @@ declare class Menu {
|
|
|
41
42
|
show(event: Event): void;
|
|
42
43
|
hide(): void;
|
|
43
44
|
protected getItemIcon(item: any): MTIcon | undefined;
|
|
45
|
+
protected getItemColor(item: any): string | undefined;
|
|
46
|
+
protected getAvatarStyle(color: string): Record<string, string>;
|
|
44
47
|
private transformMenuItem;
|
|
45
48
|
private getSeverityClass;
|
|
46
49
|
private handleItemSelect;
|
|
@@ -383,8 +383,18 @@ declare class SpacerFieldConfig extends BaseFieldConfig {
|
|
|
383
383
|
label?: string;
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
+
declare class SchemaConnectionFieldConfig extends BaseFieldConfig {
|
|
387
|
+
configuration: any;
|
|
388
|
+
context: HttpContext | undefined;
|
|
389
|
+
filter: boolean;
|
|
390
|
+
constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
|
|
391
|
+
configuration: any;
|
|
392
|
+
context?: HttpContext | undefined;
|
|
393
|
+
filter?: boolean;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
386
396
|
type DynamicFieldConfig = {
|
|
387
|
-
[K in keyof (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)]?: (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)[K];
|
|
397
|
+
[K in keyof (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & SchemaConnectionFieldConfig & BaseFieldConfig)]?: (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & SchemaConnectionFieldConfig & BaseFieldConfig)[K];
|
|
388
398
|
};
|
|
389
399
|
interface LayoutConfig {
|
|
390
400
|
containerClass?: string;
|
|
@@ -729,5 +739,5 @@ declare const REQUEST_CONTEXT: HttpContextToken<RequestContextConfig>;
|
|
|
729
739
|
declare function getLightColor(hexColor: string): string;
|
|
730
740
|
declare function getContrastColor(bgColor: string): string;
|
|
731
741
|
|
|
732
|
-
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DateFieldConfig, EditorFieldConfig, IconFieldConfig, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, getContrastColor, getLightColor, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTMessages, setLoadingError, startLoading, wrapValidatorWithMessage };
|
|
742
|
+
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DateFieldConfig, EditorFieldConfig, IconFieldConfig, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, getContrastColor, getLightColor, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTMessages, setLoadingError, startLoading, wrapValidatorWithMessage };
|
|
733
743
|
export type { ApiRequestConfig, BaseFieldConstructorConfig, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, LayoutConfig, LoadingStateShape, MTThemeOptions, PaletteShade, QueryResult, RequestContextConfig, Response, ResponsiveColSpan, SectionConfig, ValidatorType };
|