@masterteam/components 0.0.163 → 0.0.164

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.
Files changed (27) hide show
  1. package/assets/common.css +1 -1
  2. package/assets/i18n/ar.json +24 -0
  3. package/assets/i18n/en.json +24 -0
  4. package/fesm2022/masterteam-components-business-fields.mjs +288 -88
  5. package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
  6. package/fesm2022/masterteam-components-color-picker-field.mjs +11 -3
  7. package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
  8. package/fesm2022/masterteam-components-field-validation.mjs +19 -18
  9. package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
  10. package/fesm2022/masterteam-components-sidebar.mjs +2 -2
  11. package/fesm2022/masterteam-components-sidebar.mjs.map +1 -1
  12. package/fesm2022/masterteam-components-text-field.mjs +21 -26
  13. package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
  14. package/fesm2022/masterteam-components-toast.mjs +28 -23
  15. package/fesm2022/masterteam-components-toast.mjs.map +1 -1
  16. package/fesm2022/masterteam-components-topbar.mjs +2 -2
  17. package/fesm2022/masterteam-components-topbar.mjs.map +1 -1
  18. package/fesm2022/masterteam-components-user-search-field.mjs +7 -3
  19. package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
  20. package/fesm2022/masterteam-components.mjs +1 -1
  21. package/fesm2022/masterteam-components.mjs.map +1 -1
  22. package/package.json +2 -2
  23. package/types/masterteam-components-business-fields.d.ts +67 -21
  24. package/types/masterteam-components-text-field.d.ts +11 -2
  25. package/types/masterteam-components-toast.d.ts +1 -0
  26. package/types/masterteam-components-user-search-field.d.ts +2 -0
  27. package/types/masterteam-components.d.ts +7 -5
@@ -1,8 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, Type } from '@angular/core';
2
3
  import { LookupMatrixFieldConfig, LookupOptionItemConfig, LookupMatrixCellConfig, SchedulePredecessorFieldRuntimeContext, EntityListFieldRuntimeContext } from '@masterteam/components';
3
4
  import { ControlValueAccessor, Validators, NgControl } from '@angular/forms';
4
5
  import { HttpContext } from '@angular/common/http';
5
6
  import { ColumnDef, TableAction } from '@masterteam/components/table';
7
+ import { EntityData } from '@masterteam/components/entities';
6
8
 
7
9
  declare class LookupMatrixField {
8
10
  readonly config: _angular_core.InputSignal<LookupMatrixFieldConfig>;
@@ -228,16 +230,19 @@ declare class SchedulePredecessorField implements ControlValueAccessor {
228
230
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchedulePredecessorField, "mt-schedule-predecessor-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; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
229
231
  }
230
232
 
231
- interface EntityListRowValue {
232
- propertyId?: number;
233
+ interface EntityListColumnDef extends ColumnDef {
234
+ key: string;
235
+ label: string;
236
+ type: 'entity';
237
+ viewType?: string;
238
+ order?: number;
239
+ visible?: boolean;
240
+ configuration?: Record<string, unknown> | null;
241
+ /** Underlying catalog property key (e.g. "task_name") used to look up
242
+ * form values keyed by property key when a new row is added locally. */
233
243
  propertyKey?: string;
234
- rawValue?: unknown;
235
- value?: unknown;
236
- }
237
- interface EntityListReadRow {
238
- entityId: number;
239
- values?: EntityListRowValue[];
240
244
  }
245
+ type EntityListRow = Record<string, unknown | EntityData>;
241
246
  /** Stored EntityList property value (round-tripped through the form). */
242
247
  interface EntityListStoredValue {
243
248
  entityIds?: number[];
@@ -251,43 +256,84 @@ declare class EntityListField implements ControlValueAccessor {
251
256
  readonly label: _angular_core.InputSignal<string>;
252
257
  readonly readonly: _angular_core.InputSignal<boolean>;
253
258
  readonly required: _angular_core.InputSignal<boolean>;
254
- /** EntityList property id used in the read endpoint route. */
259
+ /** EntityList property id (kept for back-compat; unused by fetch/query). */
255
260
  readonly propertyId: _angular_core.InputSignal<number | null>;
256
- /** Property configuration (sourceType, moduleId, access, etc). */
261
+ /** Property configuration (sourceType, moduleId, access, readFields, etc). */
257
262
  readonly configuration: _angular_core.InputSignal<Record<string, unknown> | null>;
258
263
  /** Runtime ids needed to call the read endpoint. */
259
264
  readonly runtimeContext: _angular_core.InputSignal<EntityListFieldRuntimeContext | null>;
260
- /** Optional HttpContext (e.g. to disable base URL prefixing). */
265
+ /** Optional HttpContext (kept for back-compat). */
261
266
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
262
267
  private readonly storedValue;
263
- protected readonly rows: _angular_core.WritableSignal<EntityListReadRow[]>;
268
+ protected readonly columns: _angular_core.WritableSignal<EntityListColumnDef[]>;
269
+ protected readonly rows: _angular_core.WritableSignal<EntityListRow[]>;
264
270
  protected readonly loading: _angular_core.WritableSignal<boolean>;
265
271
  protected readonly errorMessage: _angular_core.WritableSignal<string | null>;
266
272
  protected readonly disabled: _angular_core.WritableSignal<boolean>;
267
273
  protected requiredValidator: typeof Validators.required;
268
274
  ngControl: NgControl | null;
269
- protected readonly sourceId: _angular_core.Signal<number | null>;
270
- protected readonly levelDataIdParam: _angular_core.Signal<number | null>;
275
+ protected readonly levelId: _angular_core.Signal<string | number | null>;
276
+ protected readonly levelDataId: _angular_core.Signal<string | number | null>;
277
+ protected readonly moduleId: _angular_core.Signal<string | number | null>;
278
+ protected readonly readFields: _angular_core.Signal<string[]>;
271
279
  protected readonly canRead: _angular_core.Signal<boolean>;
280
+ protected readonly canWrite: _angular_core.Signal<boolean>;
281
+ protected readonly writeFields: _angular_core.Signal<string[]>;
282
+ /** Locally-added rows (Write mode). Persisted via CVA value. */
283
+ protected readonly localRows: _angular_core.WritableSignal<EntityListRow[]>;
284
+ private localRowSeq;
285
+ protected readonly displayRows: _angular_core.Signal<EntityListRow[]>;
272
286
  protected readonly hasRows: _angular_core.Signal<boolean>;
287
+ protected readonly hasRequiredContext: _angular_core.Signal<boolean>;
273
288
  protected onTouched: () => void;
274
289
  protected onModelChange: (value: EntityListStoredValue | null) => void;
275
290
  private readonly http;
276
291
  private readonly destroyRef;
292
+ private readonly modal;
293
+ /**
294
+ * Optional rich add-row dialog (provided by `@masterteam/forms` via
295
+ * `provideEntityListAddForm()`). When available, used instead of the local
296
+ * minimal dialog so the popup renders `mt-client-form` filtered by
297
+ * `writeFields`.
298
+ */
299
+ private readonly addDialogComponent;
277
300
  constructor();
278
301
  writeValue(value: EntityListStoredValue | null): void;
279
302
  registerOnChange(fn: (value: EntityListStoredValue | null) => void): void;
280
303
  registerOnTouched(fn: () => void): void;
281
304
  setDisabledState(isDisabled: boolean): void;
305
+ /** Row actions shown in Write mode — edit and delete (local-only). */
306
+ protected readonly writeRowActions: _angular_core.Signal<TableAction[]>;
307
+ protected openAddDialog(): void;
308
+ protected openEditDialog(row: EntityListRow): void;
309
+ protected deleteLocalRow(row: EntityListRow): void;
310
+ private buildRowFromValues;
311
+ private emitLocalValue;
282
312
  private fetchRows;
283
- protected rowTitle(row: EntityListReadRow): string;
284
- protected rowFields(row: EntityListReadRow): EntityListRowValue[];
285
- protected trackByRow(_i: number, row: EntityListReadRow): number | string;
286
- protected trackByField(_i: number, value: EntityListRowValue): string | number;
287
- protected formatValue(value: EntityListRowValue): string;
313
+ private applyResponse;
314
+ private toEntityData;
288
315
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
289
316
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListField, "mt-entity-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
290
317
  }
291
318
 
292
- export { EntityListField, LookupMatrixField, SchedulePredecessorField, SchemaConnectionField };
293
- export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, SchemaConnectionConfig, SourceLevelState };
319
+ /** Inputs the EntityList add-row dialog will receive via ModalService inputValues. */
320
+ interface EntityListAddDialogInputs {
321
+ moduleId: number | string | null;
322
+ levelId: number | string | null;
323
+ levelDataId: number | string | null;
324
+ /** Property keys that should be editable in the dialog. */
325
+ writeFields: string[];
326
+ /** Pre-populated form values (keyed by property key) for the Edit flow. */
327
+ initialValues?: Record<string, unknown>;
328
+ }
329
+ /**
330
+ * Token used by `mt-entity-list-field` (Write mode) to open the rich add-row
331
+ * dialog backed by `@masterteam/forms`'s `mt-client-form`. Apps that want this
332
+ * behavior should call `provideEntityListAddForm()` from
333
+ * `@masterteam/forms/entity-list-add-form` in their app providers. When the
334
+ * token is not registered, the field falls back to a minimal text-only popup.
335
+ */
336
+ declare const ENTITY_LIST_ADD_DIALOG_COMPONENT: InjectionToken<Type<unknown>>;
337
+
338
+ export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LookupMatrixField, SchedulePredecessorField, SchemaConnectionField };
339
+ export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, EntityListAddDialogInputs, SchemaConnectionConfig, SourceLevelState };
@@ -5,7 +5,6 @@ import { isInvalid } from '@masterteam/components';
5
5
  import { MTIcon } from '@masterteam/icons';
6
6
 
7
7
  declare class TextField implements ControlValueAccessor, OnInit, OnChanges {
8
- private dir;
9
8
  inputText: HTMLInputElement;
10
9
  readonly field: _angular_core.InputSignal<boolean>;
11
10
  readonly hint: _angular_core.InputSignal<string | undefined>;
@@ -22,7 +21,16 @@ declare class TextField implements ControlValueAccessor, OnInit, OnChanges {
22
21
  requiredValidator: typeof Validators.required;
23
22
  value: _angular_core.WritableSignal<string | null>;
24
23
  disabled: _angular_core.WritableSignal<boolean>;
25
- iconPos: _angular_core.Signal<"right" | "left">;
24
+ passwordVisible: _angular_core.WritableSignal<boolean>;
25
+ isPasswordField: _angular_core.Signal<boolean>;
26
+ inputType: _angular_core.Signal<string>;
27
+ hasStartIcon: _angular_core.Signal<boolean>;
28
+ hasEndIcon: _angular_core.Signal<boolean>;
29
+ hasHint: _angular_core.Signal<boolean>;
30
+ hasEndActions: _angular_core.Signal<boolean>;
31
+ hasTwoEndActions: _angular_core.Signal<boolean>;
32
+ passwordToggleIcon: _angular_core.Signal<MTIcon>;
33
+ passwordToggleLabel: _angular_core.Signal<"Hide password" | "Show password">;
26
34
  alphaNum: RegExp;
27
35
  onTouched: () => void;
28
36
  onModelChange: (value: any) => void;
@@ -32,6 +40,7 @@ declare class TextField implements ControlValueAccessor, OnInit, OnChanges {
32
40
  ngOnInit(): void;
33
41
  applyInputsToInputText(): void;
34
42
  onValueChange(value: any): void;
43
+ togglePasswordVisibility(): void;
35
44
  ngOnChanges(changes: SimpleChanges): void;
36
45
  writeValue(value: string): void;
37
46
  registerOnChange(fn: any): void;
@@ -10,6 +10,7 @@ declare class Toast {
10
10
 
11
11
  declare class ToastService {
12
12
  messageService: MessageService;
13
+ private readonly translocoService;
13
14
  add(message: ToastMessageOptions): void;
14
15
  addAll(messages: ToastMessageOptions[]): void;
15
16
  clear(key?: string): void;
@@ -32,6 +32,8 @@ declare class UserSearchField implements ControlValueAccessor, OnInit {
32
32
  readonly size: _angular_core.InputSignal<"small" | "large" | undefined>;
33
33
  filteredUsers: _angular_core.WritableSignal<User[]>;
34
34
  private searchTerms;
35
+ private readonly translocoService;
36
+ translatedPlaceholder: _angular_core.Signal<string>;
35
37
  readonly autocomplete: _angular_core.Signal<AutoComplete | undefined>;
36
38
  onTouched: () => void;
37
39
  onModelChange: (value: any) => void;
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { EnvironmentProviders, InjectionToken, Signal, PipeTransform } from '@angular/core';
3
3
  import { MessageService, ConfirmationService } from 'primeng/api';
4
4
  import { HttpContext, HttpContextToken } from '@angular/common/http';
5
- import { ValidatorFn, AbstractControl } from '@angular/forms';
5
+ import { AbstractControl, ValidatorFn } from '@angular/forms';
6
6
  import * as _masterteam_components from '@masterteam/components';
7
7
  import { StateContext } from '@ngxs/store';
8
8
  import { Observable } from 'rxjs';
@@ -73,12 +73,12 @@ declare class ValidatorConfig {
73
73
  type: ValidatorType;
74
74
  value?: any;
75
75
  message?: string;
76
- customValidator?: (value: any) => boolean | Promise<boolean>;
76
+ customValidator?: (value: any, control?: AbstractControl) => boolean | Promise<boolean>;
77
77
  constructor(config: {
78
78
  type: ValidatorType;
79
79
  value?: any;
80
80
  message?: string;
81
- customValidator?: (value: any) => boolean | Promise<boolean>;
81
+ customValidator?: (value: any, control?: AbstractControl) => boolean | Promise<boolean>;
82
82
  });
83
83
  static required(message?: string): ValidatorConfig;
84
84
  static email(message?: string): ValidatorConfig;
@@ -87,7 +87,7 @@ declare class ValidatorConfig {
87
87
  static min(value: number, message?: string): ValidatorConfig;
88
88
  static max(value: number, message?: string): ValidatorConfig;
89
89
  static pattern(pattern: string, message?: string): ValidatorConfig;
90
- static custom(validator: (value: any) => boolean | Promise<boolean>, message?: string): ValidatorConfig;
90
+ static custom(validator: (value: any, control?: AbstractControl) => boolean | Promise<boolean>, message?: string): ValidatorConfig;
91
91
  }
92
92
  type BaseFieldConstructorConfig = ConstructorParameters<typeof BaseFieldConfig>[0];
93
93
  declare abstract class BaseFieldConfig {
@@ -498,6 +498,8 @@ interface EntityListFieldRuntimeContext {
498
498
  * - Module-scoped EntityList properties → source module-data id
499
499
  */
500
500
  sourceId?: number | string | null;
501
+ /** Current level id (used to build the fetch/query contextKey). */
502
+ levelId?: number | string | null;
501
503
  levelDataId?: number | string | null;
502
504
  }
503
505
  declare class EntityListFieldConfig extends BaseFieldConfig {
@@ -543,7 +545,7 @@ interface FieldState {
543
545
  hidden: boolean;
544
546
  disabled: boolean;
545
547
  }
546
- declare function createCustomValidator(customValidator: (value: any) => boolean | Promise<boolean>, message?: string): ValidatorFn;
548
+ declare function createCustomValidator(customValidator: (value: any, control?: AbstractControl) => boolean | Promise<boolean>, message?: string): ValidatorFn;
547
549
  declare function wrapValidatorWithMessage(validator: ValidatorFn, errorKey: string, message: string): ValidatorFn;
548
550
 
549
551
  /**