@skyux/ag-grid 15.0.0-alpha.9 → 15.0.0-beta.0

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.
@@ -87,6 +87,56 @@ const RESOURCES = {
87
87
  sky_ag_grid_locale_no_rows_to_show: { message: 'No data available' },
88
88
  sky_ag_grid_locale_no_matching_rows: { message: 'No matching rows' },
89
89
  },
90
+ ES: {
91
+ sky_ag_grid_row_selector_aria_label: {
92
+ message: 'Selector de fila para la fila {0}',
93
+ },
94
+ sky_ag_grid_row_selector_column_heading: { message: 'Selección de filas' },
95
+ sky_ag_grid_cell_editor_datepicker_aria_label: {
96
+ message: 'Fecha editable {0} para la fila {1}',
97
+ },
98
+ sky_ag_grid_cell_editor_datepicker_hint_text: {
99
+ message: 'Utilice el formato {0}.',
100
+ },
101
+ sky_ag_grid_cell_editor_number_aria_label: {
102
+ message: 'Número editable {0} para la fila {1}',
103
+ },
104
+ sky_ag_grid_cell_editor_text_aria_label: {
105
+ message: 'Texto editable {0} para la fila {1}',
106
+ },
107
+ sky_ag_grid_cell_editor_autocomplete_aria_label: {
108
+ message: 'Autocompletado editable {0} para la fila {1}',
109
+ },
110
+ sky_ag_grid_cell_renderer_number_validator_message: {
111
+ message: 'Introduzca un número válido.',
112
+ },
113
+ sky_ag_grid_cell_renderer_currency_validator_message: {
114
+ message: 'Introduzca un valor de moneda válido.',
115
+ },
116
+ skyux_lookup_tokens_summary: { message: '{0} artículos seleccionados' },
117
+ sky_ag_grid_cell_editor_currency_aria_label: {
118
+ message: 'Valor de moneda editable {0} para la fila {1}',
119
+ },
120
+ sky_ag_grid_column_header_sort_button_aria_label_currently_asc: {
121
+ message: 'Ordenar columna {0}, actualmente en orden ascendente',
122
+ },
123
+ sky_ag_grid_column_header_sort_button_aria_label_currently_desc: {
124
+ message: 'Ordenar columna {0}, actualmente en orden descendente',
125
+ },
126
+ sky_ag_grid_column_header_sort_button_aria_label_currently_not_sorted: {
127
+ message: 'Ordenar columna {0}, actualmente sin ordenar',
128
+ },
129
+ sky_ag_grid_column_group_header_expand_aria_label: {
130
+ message: 'Expandir grupo de columnas {0}',
131
+ },
132
+ sky_ag_grid_column_group_header_collapse_aria_label: {
133
+ message: 'Contraer grupo de columnas {0}',
134
+ },
135
+ sky_ag_grid_locale_no_rows_to_show: { message: 'No hay datos disponibles' },
136
+ sky_ag_grid_locale_no_matching_rows: {
137
+ message: 'No hay filas coincidentes',
138
+ },
139
+ },
90
140
  'FR-CA': {
91
141
  sky_ag_grid_row_selector_aria_label: {
92
142
  message: 'Sélecteur de ligne pour la ligne {0}',
@@ -115,7 +165,7 @@ const RESOURCES = {
115
165
  sky_ag_grid_cell_renderer_currency_validator_message: {
116
166
  message: 'Entrez une devise valide.',
117
167
  },
118
- skyux_lookup_tokens_summary: { message: '{0} articles sélectionnés' },
168
+ skyux_lookup_tokens_summary: { message: '{0} éléments sélectionnés' },
119
169
  sky_ag_grid_cell_editor_currency_aria_label: {
120
170
  message: 'Devise modifiable {0} pour la ligne {1}',
121
171
  },
@@ -134,9 +184,7 @@ const RESOURCES = {
134
184
  sky_ag_grid_column_group_header_collapse_aria_label: {
135
185
  message: 'Réduire le groupe de colonnes {0}',
136
186
  },
137
- sky_ag_grid_locale_no_rows_to_show: {
138
- message: 'Aucune donnée disponible.',
139
- },
187
+ sky_ag_grid_locale_no_rows_to_show: { message: 'Aucune donnée disponible' },
140
188
  sky_ag_grid_locale_no_matching_rows: {
141
189
  message: 'Aucune ligne correspondante',
142
190
  },
@@ -1011,18 +1059,9 @@ class SkyAgGridDataManagerAdapterDirective {
1011
1059
  gridColumnStates?.find((aGridColumnState) => aGridColumnState.sort);
1012
1060
  if (viewConfig && this.#currentDataState) {
1013
1061
  const newState = new SkyDataManagerState(this.#currentDataState.getStateOptions());
1014
- if (activeSortColumnState) {
1015
- const activeSortColumnDef = agGrid.api.getColumnDef(activeSortColumnState.colId);
1016
- newState.activeSortOption = {
1017
- descending: activeSortColumnState.sort === 'desc',
1018
- id: activeSortColumnState.colId,
1019
- propertyName: activeSortColumnDef?.field || '',
1020
- label: activeSortColumnDef?.headerName || '',
1021
- };
1022
- }
1023
- else {
1024
- newState.activeSortOption = undefined;
1025
- }
1062
+ newState.activeSortOption = activeSortColumnState
1063
+ ? this.#resolveActiveSortOption(agGrid.api, activeSortColumnState)
1064
+ : undefined;
1026
1065
  this.#currentDataState = newState;
1027
1066
  this.#dataManagerSvc.updateDataState(newState, viewConfig.id);
1028
1067
  this.#changeDetector.markForCheck();
@@ -1030,6 +1069,24 @@ class SkyAgGridDataManagerAdapterDirective {
1030
1069
  });
1031
1070
  }
1032
1071
  }
1072
+ #resolveActiveSortOption(api, activeSortColumnState) {
1073
+ const activeSortColumnDef = api.getColumnDef(activeSortColumnState.colId);
1074
+ const descending = activeSortColumnState.sort === 'desc';
1075
+ const propertyName = activeSortColumnDef?.field || activeSortColumnState.colId;
1076
+ // Prefer the configured sort option matching this column and direction
1077
+ // so the sort menu's selected item stays in sync; columns without a
1078
+ // matching option fall back to a column-derived sort option.
1079
+ const matchingSortOption = this.#dataManagerSvc
1080
+ .getCurrentDataManagerConfig()
1081
+ .sortOptions?.find((option) => option.propertyName === propertyName &&
1082
+ !!option.descending === descending);
1083
+ return (matchingSortOption ?? {
1084
+ descending,
1085
+ id: activeSortColumnState.colId,
1086
+ propertyName,
1087
+ label: activeSortColumnDef?.headerName || '',
1088
+ });
1089
+ }
1033
1090
  #updateColumnsInCurrentDataState(api) {
1034
1091
  const viewConfig = this.#viewConfig();
1035
1092
  if (viewConfig && this.#currentDataState) {
@@ -1082,17 +1139,30 @@ class SkyAgGridDataManagerAdapterDirective {
1082
1139
  const agGridApi = this.#currentAgGrid()?.api;
1083
1140
  const activeSort = dataState.activeSortOption;
1084
1141
  if (agGridApi && activeSort) {
1085
- agGridApi.applyColumnState({
1086
- state: [
1087
- {
1088
- colId: activeSort.id,
1089
- sort: activeSort.descending ? 'desc' : 'asc',
1090
- },
1091
- ],
1092
- defaultState: { sort: null },
1093
- });
1142
+ const colId = this.#resolveSortColumnId(agGridApi, activeSort);
1143
+ if (colId) {
1144
+ agGridApi.applyColumnState({
1145
+ state: [
1146
+ {
1147
+ colId,
1148
+ sort: activeSort.descending ? 'desc' : 'asc',
1149
+ },
1150
+ ],
1151
+ defaultState: { sort: null },
1152
+ });
1153
+ }
1094
1154
  }
1095
1155
  }
1156
+ #resolveSortColumnId(api, activeSort) {
1157
+ const columnStates = api.getColumnState();
1158
+ const findColId = (predicate) => columnStates.find(predicate)?.colId;
1159
+ // Match on the option's data property first, since a sort option's ID is
1160
+ // arbitrary and could otherwise select an unrelated column. Only fall
1161
+ // back to the legacy ID match for options predating the property lookup.
1162
+ return (findColId((state) => api.getColumnDef(state.colId)?.field === activeSort.propertyName) ??
1163
+ findColId((state) => state.colId === activeSort.propertyName) ??
1164
+ findColId((state) => state.colId === activeSort.id));
1165
+ }
1096
1166
  #updateColumnWidth(colId, width, breakpoint) {
1097
1167
  const viewId = this.viewId();
1098
1168
  const viewState = viewId && this.#currentDataState?.getViewStateById(viewId);