@tsi-developpement/tsi-shared-ui 1.10.7 → 1.10.8

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.
@@ -28,3 +28,22 @@ export declare function isNullOrEmpty(value: any): boolean;
28
28
  */
29
29
  export declare function distinct<T extends string | number | boolean | bigint | symbol>(values: T[]): T[];
30
30
  export declare function lowerFirst(value?: string): string;
31
+ /**
32
+ * Mirrors .NET's `JsonNamingPolicy.CamelCase`, which the API applies to a custom column's `Nom`
33
+ * when it writes that column's value onto each row. Use this — not `lowerFirst` — whenever a
34
+ * client-side field name has to line up with a server-serialized property name.
35
+ *
36
+ * `lowerFirst` is NOT equivalent: .NET lowercases the whole leading uppercase run, so `TVA` gives
37
+ * `tva` where `lowerFirst` gives `tVA` and the value lookup misses.
38
+ *
39
+ * Assumes no separator characters, which `Nom` is validated against (`^[A-Za-z][A-Za-z0-9]*$`).
40
+ * Note the "next char is not uppercase" test is true for DIGITS too, exactly as in .NET
41
+ * (`AB2c` -> `aB2c`).
42
+ *
43
+ * @example
44
+ * toDotNetCamelCase('Matricule2'); // 'matricule2'
45
+ * toDotNetCamelCase('TVA'); // 'tva'
46
+ * toDotNetCamelCase('ABCValue'); // 'abcValue'
47
+ * toDotNetCamelCase('XMLHttp'); // 'xmlHttp'
48
+ */
49
+ export declare function toDotNetCamelCase(value?: string): string;
@@ -61,5 +61,9 @@ export interface ISortMeta {
61
61
  export interface ICustomColumnSchema {
62
62
  columnName: string;
63
63
  columnLibelle: string;
64
- type: 'date' | 'numeric' | 'boolean' | 'text';
64
+ /**
65
+ * Raw `ColonnePersonnalisee.Type` (the TypeColonneEnum vocabulary) — the same values the
66
+ * definitions endpoint reports. Not a union: the API validates it against the enum nowhere.
67
+ */
68
+ type: string;
65
69
  }
@@ -2,7 +2,7 @@ import { DynamicDialogConfig, DynamicDialogRef } from "primeng/dynamicdialog";
2
2
  import { TabView } from "primeng/tabview";
3
3
  import { JwtHelperService } from "@auth0/angular-jwt";
4
4
  import { ConfirmationService, MessageService } from "primeng/api";
5
- export declare const SharedUiTsiProviders: (typeof DynamicDialogRef | typeof DynamicDialogConfig | typeof JwtHelperService | typeof TabView | typeof MessageService | typeof ConfirmationService | {
5
+ export declare const SharedUiTsiProviders: (typeof TabView | typeof DynamicDialogRef | typeof DynamicDialogConfig | typeof JwtHelperService | typeof MessageService | typeof ConfirmationService | {
6
6
  provide: import("@angular/core").InjectionToken<unknown>;
7
7
  useValue: import("@angular/core").InjectionToken<unknown>;
8
8
  })[];
@@ -117,6 +117,13 @@ export declare class TsiGenericGridComponent implements OnInit, AfterViewInit {
117
117
  tempSearchFields: Array<SearchField>;
118
118
  private _columns;
119
119
  private _kanbanSummaryColumns;
120
+ /** Set at the end of ngOnInit. Before that the column pools are still being seeded, so nothing
121
+ * arriving through the `columns` setter can be considered "late". */
122
+ private _columnsInitialized;
123
+ /** Column order of the presentation last restored. Kept so a column that only arrives afterwards
124
+ * — a custom column lands on an async response — can be placed per that saved layout instead of
125
+ * being dropped by `findColumnByKey`. */
126
+ private _restoredColumnOrder?;
120
127
  set columns(value: Array<GridColumn> | undefined);
121
128
  get columns(): Array<GridColumn>;
122
129
  private _isSearchButtonDisabled;
@@ -225,8 +232,23 @@ export declare class TsiGenericGridComponent implements OnInit, AfterViewInit {
225
232
  private applyEntityInfo;
226
233
  getState(): TableState | undefined;
227
234
  restoreState(configuration: string): void;
235
+ /**
236
+ * Renders exactly the saved columns, in the saved order. `_columns` is assigned directly rather
237
+ * than through the setter: every element has already been through `initialColumnsProcess()`, and
238
+ * the setter would re-enter `adoptLateColumns()` and narrow `_tempColumns` — the full pool
239
+ * `findColumnByKey` needs to resolve a saved key.
240
+ */
241
+ private applyColumnOrder;
228
242
  onSelectedColumnsChange(newValue: GridColumn[]): void;
229
243
  sortColumns(): void;
244
+ /**
245
+ * The owner can append columns after init — custom columns arrive on the
246
+ * `getColonnesPersonnalisee` response. The `columns` setter refreshes the chooser pool
247
+ * (`_columns`) and the lookup pool (`_tempColumns`), but the rendered selection
248
+ * (`_selectedColumns`) is a copy taken at init, so without this a late column shows up in the
249
+ * column chooser and never renders.
250
+ */
251
+ private adoptLateColumns;
230
252
  getReorderedColumns(columnOrder: string[]): any[];
231
253
  findColumnByKey(key: any): GridColumn | null;
232
254
  resetSelectedColumns(configuration: string): void;
@@ -105,6 +105,11 @@ export declare class TsiGenericCrudComponent implements OnInit, AfterContentChec
105
105
  key: string;
106
106
  id?: string;
107
107
  _businessClass: string | undefined;
108
+ /**
109
+ * Custom columns are the same set whichever source delivers them, so they are registered exactly
110
+ * once. Latched by whichever source gets there first; reset when the entity changes.
111
+ */
112
+ private _customColumnsRegistered;
108
113
  get businessClass(): string | undefined;
109
114
  set businessClass(value: string | undefined);
110
115
  set searchOnInit(value: boolean);
@@ -116,7 +121,6 @@ export declare class TsiGenericCrudComponent implements OnInit, AfterContentChec
116
121
  searchFieldsValueChanged: EventEmitter<Array<SearchField>>;
117
122
  buttonColumnClicked: EventEmitter<ButtonClickResult>;
118
123
  onImportFromOutlookClicked: EventEmitter<any>;
119
- isCustomColumnRendered: boolean;
120
124
  clickCount: number;
121
125
  currentIcon: string;
122
126
  currentTooltip: string;
@@ -130,6 +134,7 @@ export declare class TsiGenericCrudComponent implements OnInit, AfterContentChec
130
134
  getWorkflowEtatFormForCurrentBusinessClass(): void;
131
135
  searchFieldValueChanges(newSearchFieldValues: Array<SearchField>): void;
132
136
  ngOnInit(): void;
137
+ private _initSelectedColumns;
133
138
  isLastPage(): boolean;
134
139
  isFirstPage(): boolean;
135
140
  /**
@@ -146,6 +151,23 @@ export declare class TsiGenericCrudComponent implements OnInit, AfterContentChec
146
151
  private _setformEndpointBody;
147
152
  private _initModels;
148
153
  private _loadDS;
154
+ /** Definitions source — reached wherever `businessClass` matches `ColonnePersonnalisee.Classe`. */
155
+ private _registerCustomColumnsFromDefinitions;
156
+ /**
157
+ * Grid-response source. `columnName` is camelCased by the same serializer pass that writes the row
158
+ * properties, and `type` is the same raw vocabulary the definitions report — so this produces an
159
+ * identical column, not a degraded one.
160
+ */
161
+ private _registerCustomColumnsFromSchema;
162
+ /**
163
+ * The single registration point — whichever source got here first is the only one that runs.
164
+ * Both derive `field` with the same camelCase policy, so the dedup is only a guard against a
165
+ * custom column colliding with a native one, which must never be replaced.
166
+ *
167
+ * Assigns a NEW array: an in-place mutation keeps the same reference, so Angular's identity check
168
+ * never re-invokes the grid's `columns` setter and the column is never rendered.
169
+ */
170
+ private _registerCustomColumns;
149
171
  private loadNotesCounts;
150
172
  private _editRow;
151
173
  private _deleteRow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsi-developpement/tsi-shared-ui",
3
- "version": "1.10.7",
3
+ "version": "1.10.8",
4
4
  "author": "TSI",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {