@masterteam/components 0.0.350 → 0.0.352

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/components",
3
- "version": "0.0.350",
3
+ "version": "0.0.352",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -51,6 +51,8 @@ declare class SelectField implements ControlValueAccessor, OnInit, OnChanges, Af
51
51
  readonly options: _angular_core.InputSignal<any[] | undefined>;
52
52
  readonly optionValue: _angular_core.InputSignal<string | undefined>;
53
53
  readonly optionLabel: _angular_core.InputSignal<string | undefined>;
54
+ /** Name of the option property that, when truthy, makes it unpickable. */
55
+ readonly optionDisabled: _angular_core.InputSignal<string | undefined>;
54
56
  readonly filter: _angular_core.InputSignal<boolean | undefined>;
55
57
  readonly filterBy: _angular_core.InputSignal<string | undefined>;
56
58
  readonly dataKey: _angular_core.InputSignal<string | undefined>;
@@ -162,7 +164,7 @@ declare class SelectField implements ControlValueAccessor, OnInit, OnChanges, Af
162
164
  isCurrentUserOption(option: any): boolean;
163
165
  private resolveOption;
164
166
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectField, never>;
165
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectField, "mt-select-field", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hasPlaceholderPrefix": { "alias": "hasPlaceholderPrefix"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionValue": { "alias": "optionValue"; "required": false; "isSignal": true; }; "optionLabel": { "alias": "optionLabel"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; "clearAfterSelect": { "alias": "clearAfterSelect"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "group": { "alias": "group"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "optionGroupLabel": { "alias": "optionGroupLabel"; "required": false; "isSignal": true; }; "optionGroupChildren": { "alias": "optionGroupChildren"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "optionIcon": { "alias": "optionIcon"; "required": false; "isSignal": true; }; "optionIconColor": { "alias": "optionIconColor"; "required": false; "isSignal": true; }; "optionIconShape": { "alias": "optionIconShape"; "required": false; "isSignal": true; }; "optionAvatarShape": { "alias": "optionAvatarShape"; "required": false; "isSignal": true; }; "optionGroupIcon": { "alias": "optionGroupIcon"; "required": false; "isSignal": true; }; "optionGroupIconColor": { "alias": "optionGroupIconColor"; "required": false; "isSignal": true; }; "optionGroupIconShape": { "alias": "optionGroupIconShape"; "required": false; "isSignal": true; }; "optionGroupAvatarShape": { "alias": "optionGroupAvatarShape"; "required": false; "isSignal": true; }; "markCurrentUser": { "alias": "markCurrentUser"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
167
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectField, "mt-select-field", never, { "field": { "alias": "field"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hasPlaceholderPrefix": { "alias": "hasPlaceholderPrefix"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionValue": { "alias": "optionValue"; "required": false; "isSignal": true; }; "optionLabel": { "alias": "optionLabel"; "required": false; "isSignal": true; }; "optionDisabled": { "alias": "optionDisabled"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; "clearAfterSelect": { "alias": "clearAfterSelect"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "group": { "alias": "group"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "optionGroupLabel": { "alias": "optionGroupLabel"; "required": false; "isSignal": true; }; "optionGroupChildren": { "alias": "optionGroupChildren"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "optionIcon": { "alias": "optionIcon"; "required": false; "isSignal": true; }; "optionIconColor": { "alias": "optionIconColor"; "required": false; "isSignal": true; }; "optionIconShape": { "alias": "optionIconShape"; "required": false; "isSignal": true; }; "optionAvatarShape": { "alias": "optionAvatarShape"; "required": false; "isSignal": true; }; "optionGroupIcon": { "alias": "optionGroupIcon"; "required": false; "isSignal": true; }; "optionGroupIconColor": { "alias": "optionGroupIconColor"; "required": false; "isSignal": true; }; "optionGroupIconShape": { "alias": "optionGroupIconShape"; "required": false; "isSignal": true; }; "optionGroupAvatarShape": { "alias": "optionGroupAvatarShape"; "required": false; "isSignal": true; }; "markCurrentUser": { "alias": "markCurrentUser"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
166
168
  }
167
169
 
168
170
  export { SelectField };
@@ -113,11 +113,29 @@ type TablePersistStateKey = 'pageSize' | 'pagePosition' | 'sort' | 'selection' |
113
113
  * schema-agnostic (open/closed for new column types).
114
114
  */
115
115
  type TableExportValueResolver = (row: unknown, column: ColumnDef) => string | number | boolean | null;
116
+ /**
117
+ * A numeric Excel cell: the number itself plus the number format that makes it
118
+ * read like the on-screen value (`0.0%`, `0.0" ريال"`). `text` is the displayed
119
+ * form, used only to size the column.
120
+ */
121
+ interface TableExportNumericCell {
122
+ value: number;
123
+ /** Excel number format code; `null` leaves the cell on `General`. */
124
+ format: string | null;
125
+ text: string;
126
+ }
127
+ /**
128
+ * Optional Excel-only hook. Returning a cell makes the workbook write a number
129
+ * (with its format) instead of the scalar from `resolveValue`; returning `null`
130
+ * keeps today's output. Print/PDF never calls it.
131
+ */
132
+ type TableExportNumericCellResolver = (row: unknown, column: ColumnDef) => TableExportNumericCell | null;
116
133
  interface TableExportConfig {
117
134
  rows: any[];
118
135
  columns: ColumnDef[];
119
136
  filename: string;
120
137
  resolveValue: TableExportValueResolver;
138
+ resolveExcelCell?: TableExportNumericCellResolver;
121
139
  }
122
140
  interface TablePrintConfig extends TableExportConfig {
123
141
  title?: string;
@@ -769,6 +787,12 @@ declare class TableValueResolver {
769
787
  private static extractUserFilterValue;
770
788
  static getColumnFilterValue(row: Record<string, unknown>, column: ColumnDef): string | number | boolean | null;
771
789
  static resolveDateValue(value: unknown): string | number | Date | null;
790
+ /**
791
+ * The entity as its cell shows it: a submitted ChangeRequest's "after" side
792
+ * replaces `value`. `rawValue` is left as it was, so a caller that reads it
793
+ * must skip it for a comparison cell (it still holds the pre-change figure).
794
+ */
795
+ static unwrapComparison(entityData: EntityData): EntityData;
772
796
  static getEntityValueByType(value: unknown, usage: TableEntityUsage): string | number | boolean | null;
773
797
  static stripHtml(value: string | number | boolean | null): string | number | boolean | null;
774
798
  static resolveDisplayValue(value: unknown): string | number | boolean | null;
@@ -1071,6 +1095,13 @@ declare class TableExportService {
1071
1095
  * cell. Non-string values (numbers, booleans, dates) pass through untouched.
1072
1096
  */
1073
1097
  private toPlainExportValue;
1098
+ /**
1099
+ * Replaces the cells whose caller offered a numeric form with real number
1100
+ * cells carrying their format. A column-level `exportValue` always wins, and
1101
+ * a cell the hook declines (`null`) is left exactly as `json_to_sheet` wrote
1102
+ * it. Returns the cells by row then column so widths can measure their text.
1103
+ */
1104
+ private writeNumericCells;
1074
1105
  private configureWorksheet;
1075
1106
  private isArabicExport;
1076
1107
  private isRtlExport;
@@ -1079,5 +1110,17 @@ declare class TableExportService {
1079
1110
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<TableExportService>;
1080
1111
  }
1081
1112
 
1082
- export { EMPTY_GROUP_KEY, Table, TableActionsMenu, TableCaption, TableColumnFilter, TableExportService, TableFilter, TableFilterField, TableGroupingController, TableValueResolver };
1083
- export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionPlacement, TableActionShape, TableEntityUsage, TableExportConfig, TableExportValueResolver, TableFilterMode, TableFilters, TablePersistStateKey, TablePrintConfig, TableSearchScope, TableStatusMapValue };
1113
+ /**
1114
+ * The Excel cell for a Number / Percentage / Currency entity, or `null` when
1115
+ * the entity is not one of those or holds no single figure (text stays text).
1116
+ *
1117
+ * The number comes from `rawValue` (the same source the on-screen percentage
1118
+ * reads), falling back to `value`; the display form decides the unit and
1119
+ * decimals, so the sheet reads like the screen while SUM stays exact.
1120
+ */
1121
+ declare function resolveEntityExcelCell(entity: unknown): TableExportNumericCell | null;
1122
+ /** `TableExportConfig.resolveExcelCell` for tables whose entity columns export. */
1123
+ declare function resolveEntityColumnExcelCell(row: unknown, column: ColumnDef): TableExportNumericCell | null;
1124
+
1125
+ export { EMPTY_GROUP_KEY, Table, TableActionsMenu, TableCaption, TableColumnFilter, TableExportService, TableFilter, TableFilterField, TableGroupingController, TableValueResolver, resolveEntityColumnExcelCell, resolveEntityExcelCell };
1126
+ export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionPlacement, TableActionShape, TableEntityUsage, TableExportConfig, TableExportNumericCell, TableExportNumericCellResolver, TableExportValueResolver, TableFilterMode, TableFilters, TablePersistStateKey, TablePrintConfig, TableSearchScope, TableStatusMapValue };
@@ -48,6 +48,8 @@ declare class UploadField implements ControlValueAccessor {
48
48
  readonly disabled: _angular_core.WritableSignal<boolean>;
49
49
  readonly policyChecking: _angular_core.WritableSignal<boolean>;
50
50
  readonly policyUnavailable: _angular_core.WritableSignal<boolean>;
51
+ /** Backend cap from the capabilities endpoint; unknown until it loads. */
52
+ private readonly maxFileSizeBytes;
51
53
  readonly uploadProgress: _angular_core.WritableSignal<number>;
52
54
  readonly loading: _angular_core.WritableSignal<boolean>;
53
55
  readonly uploadInteractionDisabled: _angular_core.Signal<boolean>;
@@ -55,6 +57,8 @@ declare class UploadField implements ControlValueAccessor {
55
57
  private readonly uploader;
56
58
  private readonly destroyRef;
57
59
  private readonly pendingUploads;
60
+ private validationRun;
61
+ private destroyed;
58
62
  private metadataSubscription?;
59
63
  private metadataHydrationKey;
60
64
  private metadataHydrationContext?;
@@ -71,6 +75,11 @@ declare class UploadField implements ControlValueAccessor {
71
75
  private performDelete;
72
76
  onFileSelect(event: Event): void;
73
77
  prepareFiles(files: File[]): void;
78
+ /**
79
+ * Marks the selection as refused. `mt-field-validation` only renders once the
80
+ * control is touched, so touch it to make the message visible.
81
+ */
82
+ private refuse;
74
83
  uploadFile(file: File): void;
75
84
  handleUploadDone(file: any): void;
76
85
  downloadFile(value: any): void;
@@ -4,6 +4,7 @@ import { ControlValueAccessor, Validators, NgControl } from '@angular/forms';
4
4
  import { AutoComplete } from 'primeng/autocomplete';
5
5
  import { isInvalid } from '@masterteam/components';
6
6
  import { HttpContext } from '@angular/common/http';
7
+ import { Observable } from 'rxjs';
7
8
 
8
9
  interface User {
9
10
  isExternal: boolean;
@@ -40,6 +41,14 @@ declare class UserSearchField implements ControlValueAccessor, OnInit, OnDestroy
40
41
  readonly paramName: _angular_core.InputSignal<string>;
41
42
  readonly minLength: _angular_core.InputSignal<number>;
42
43
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
44
+ /**
45
+ * Marks the people who are being replaced (Replace by) and cannot be given
46
+ * new work: their suggestions say so and cannot be picked. A person the
47
+ * field already held when its value was written stays selectable. Turn it
48
+ * on for pickers that give someone work (form User fields, assignees, team
49
+ * members, owners), not for filters or group membership.
50
+ */
51
+ readonly markUnavailable: _angular_core.InputSignal<boolean>;
43
52
  styleClass: string;
44
53
  requiredValidator: typeof Validators.required;
45
54
  value: _angular_core.WritableSignal<User | User[] | null>;
@@ -62,6 +71,13 @@ declare class UserSearchField implements ControlValueAccessor, OnInit, OnDestroy
62
71
  */
63
72
  readonly unlinkedSingleUser: _angular_core.Signal<boolean>;
64
73
  private readonly translocoService;
74
+ private readonly unavailableAssignees;
75
+ /** Read with each search while `markUnavailable` is on. */
76
+ private readonly unavailableIds;
77
+ /** The users the field held when its value was written: never blocked. */
78
+ private savedUserIds;
79
+ /** PrimeNG `optionDisabled`; also drives the "being replaced" line. */
80
+ readonly isUnavailable: (user: User) => boolean;
65
81
  readonly autocomplete: _angular_core.Signal<AutoComplete | undefined>;
66
82
  private readonly handleDocumentPointerDown;
67
83
  onTouched: () => void;
@@ -101,8 +117,31 @@ declare class UserSearchField implements ControlValueAccessor, OnInit, OnDestroy
101
117
  private writeInput;
102
118
  private clearSearchState;
103
119
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserSearchField, never>;
104
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserSearchField, "mt-user-search-field", never, { "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "hideUnlinkedHint": { "alias": "hideUnlinkedHint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "isMultiple": { "alias": "isMultiple"; "required": false; "isSignal": true; }; "apiUrl": { "alias": "apiUrl"; "required": true; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "paramName": { "alias": "paramName"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
120
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserSearchField, "mt-user-search-field", never, { "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "hideUnlinkedHint": { "alias": "hideUnlinkedHint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "class": { "alias": "class"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "isMultiple": { "alias": "isMultiple"; "required": false; "isSignal": true; }; "apiUrl": { "alias": "apiUrl"; "required": true; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "paramName": { "alias": "paramName"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "markUnavailable": { "alias": "markUnavailable"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
121
+ }
122
+
123
+ /**
124
+ * The backend's list of people who cannot be given new work right now: from
125
+ * the moment their replacement (Replace by) starts running until it completes
126
+ * or is closed. Any signed-in user may read it; it is usually empty.
127
+ */
128
+ declare const UNAVAILABLE_ASSIGNEES_URL = "identity/users/replacement/unavailable-assignees";
129
+ /** Kept this long, so opening several pickers in a row costs one request. */
130
+ declare const UNAVAILABLE_ASSIGNEES_TTL_MS = 30000;
131
+ /**
132
+ * Reads {@link UNAVAILABLE_ASSIGNEES_URL} for the user pickers that opt in
133
+ * (`mt-user-search-field` `[markUnavailable]`). A backend without the route, or
134
+ * any failure, counts as "nobody": the picker then behaves as before and the
135
+ * save itself still refuses the person.
136
+ */
137
+ declare class UnavailableAssignees {
138
+ private readonly http;
139
+ private cached;
140
+ /** Lower-cased user IDs. */
141
+ ids(): Observable<ReadonlySet<string>>;
142
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UnavailableAssignees, never>;
143
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<UnavailableAssignees>;
105
144
  }
106
145
 
107
- export { UserSearchField };
146
+ export { UNAVAILABLE_ASSIGNEES_TTL_MS, UNAVAILABLE_ASSIGNEES_URL, UnavailableAssignees, UserSearchField };
108
147
  export type { User };
@@ -254,6 +254,8 @@ declare class UserSearchFieldConfig extends BaseFieldConfig {
254
254
  context: HttpContext | undefined;
255
255
  isMultiple: boolean;
256
256
  hideUnlinkedHint: boolean;
257
+ /** See `mt-user-search-field` `markUnavailable` (people being replaced). */
258
+ markUnavailable: boolean;
257
259
  dataKey: string;
258
260
  paramName: string;
259
261
  minLength: number;
@@ -267,6 +269,7 @@ declare class UserSearchFieldConfig extends BaseFieldConfig {
267
269
  placeholder?: string;
268
270
  isMultiple?: boolean;
269
271
  hideUnlinkedHint?: boolean;
272
+ markUnavailable?: boolean;
270
273
  dataKey?: string;
271
274
  paramName?: string;
272
275
  minLength?: number;