@xh/hoist 55.2.1 → 55.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## v55.3.1 - 2023-03-14
4
+
5
+ ### 🐞 Bug Fixes
6
+ * Revert `structuredClone` to lodash `deepClone` throughout toolkit.
7
+
8
+ ## v55.3.0 - 2023-03-03
9
+
10
+ ### 🐞 Bug Fixes
11
+ * Grid column filters scroll their internal grid horizontally to avoid clipping longer values.
12
+ * Minor improvements to the same grid filter dialog's alignment and labelling.
13
+
14
+ ### ⚙️ Technical
15
+ * Use native `structuredClone` instead of lodash `deepClone` throughout toolkit.
16
+
3
17
  ## v55.2.1 - 2023-02-24
4
18
 
5
19
  ### 🐞 Bug Fixes
@@ -306,14 +306,6 @@
306
306
  .ag-cell {
307
307
  padding-left: var(--xh-grid-tiny-cell-lr-pad-px);
308
308
  padding-right: var(--xh-grid-tiny-cell-lr-pad-px);
309
-
310
- .xh-check-box {
311
- padding-top: 1px;
312
-
313
- .bp4-control-indicator {
314
- font-size: calc(var(--xh-grid-tiny-font-size-px) + 2px);
315
- }
316
- }
317
309
  }
318
310
 
319
311
  .ag-header-cell,
@@ -377,6 +369,11 @@
377
369
  color: var(--xh-grid-empty-text-color);
378
370
  }
379
371
  }
372
+
373
+ // Set Blueprint controls - specifically checkboxes - to match grid size.
374
+ .bp4-control .bp4-control-indicator {
375
+ font-size: 1em;
376
+ }
380
377
  }
381
378
 
382
379
  //------------------------
@@ -390,7 +390,7 @@ export class AgGridModel extends HoistModel {
390
390
  const {agColumnApi} = this,
391
391
  validColIds = [
392
392
  AgGridModel.AUTO_GROUP_COL_ID,
393
- ...agColumnApi.getAllColumns().map(it => it.colId)
393
+ ...agColumnApi.getColumns().map(it => it.colId)
394
394
  ];
395
395
 
396
396
  let {isPivot, columns} = colState;
package/core/HoistBase.ts CHANGED
@@ -7,8 +7,8 @@
7
7
  import {XH, PersistenceProvider, PersistOptions, DebounceSpec} from './';
8
8
  import {throwIf, getOrCreate} from '@xh/hoist/utils/js';
9
9
  import {
10
- debounce as lodashDebounce,
11
10
  cloneDeep,
11
+ debounce as lodashDebounce,
12
12
  isFunction,
13
13
  isNil,
14
14
  isNumber,
@@ -6,9 +6,10 @@
6
6
  */
7
7
  import {PersistenceProvider, PersistOptions, HoistBaseClass} from './';
8
8
 
9
- import {cloneDeep, isUndefined} from 'lodash';
9
+ import {isUndefined} from 'lodash';
10
10
  import {wait} from '../promise';
11
11
  import {throwIf} from '../utils/js';
12
+ import {cloneDeep} from 'lodash';
12
13
 
13
14
  /**
14
15
  * Decorator to make a property "managed". Managed properties are designed to hold objects that
@@ -8,8 +8,8 @@
8
8
  import {DebounceSpec, XH} from '../';
9
9
  import {LocalStorageProvider, PrefProvider, DashViewProvider, CustomProvider, PersistOptions} from './';
10
10
  import {
11
- isUndefined,
12
11
  cloneDeep,
12
+ isUndefined,
13
13
  get,
14
14
  set,
15
15
  unset,
@@ -70,24 +70,27 @@ const content = hoistCmp.factory({
70
70
  const bbar = hoistCmp.factory<ColumnHeaderFilterModel>({
71
71
  render({model}) {
72
72
  const {commitOnChange} = model;
73
- return toolbar(
74
- filler(),
75
- button({
76
- icon: Icon.delete(),
77
- text: 'Clear Filter',
78
- intent: 'danger',
79
- disabled: !model.hasFilter,
80
- onClick: () => model.clear()
81
- }),
82
- button({
83
- omit: commitOnChange,
84
- icon: Icon.check(),
85
- text: 'Apply Filter',
86
- intent: 'success',
87
- disabled: !model.hasFilter && !model.hasPendingFilter,
88
- onClick: () => model.commit()
89
- })
90
- );
73
+ return toolbar({
74
+ compact: true,
75
+ items: [
76
+ filler(),
77
+ button({
78
+ icon: Icon.delete(),
79
+ text: 'Clear Filter',
80
+ intent: 'danger',
81
+ disabled: !model.hasFilter,
82
+ onClick: () => model.clear()
83
+ }),
84
+ button({
85
+ omit: commitOnChange,
86
+ icon: Icon.check(),
87
+ text: 'Apply Filter',
88
+ intent: 'success',
89
+ disabled: !model.hasFilter && !model.hasPendingFilter,
90
+ onClick: () => model.commit()
91
+ })
92
+ ]
93
+ });
91
94
  }
92
95
  });
93
96
 
@@ -24,4 +24,23 @@
24
24
  margin-top: var(--xh-pad-px);
25
25
  }
26
26
  }
27
- }
27
+
28
+ // Fix up alignment on first checkbox column.
29
+ .ag-header-cell.xh-column-header-align-center {
30
+ padding: 0 !important;
31
+ }
32
+
33
+ .ag-pinned-left-header,
34
+ .ag-cell.ag-cell-last-left-pinned {
35
+ .bp4-control.bp4-inline {
36
+ margin-right: -8px;
37
+
38
+ input {
39
+ margin: 0;
40
+ }
41
+ }
42
+
43
+ // Less obvious pinning for the checkbox column.
44
+ border-right: none !important;
45
+ }
46
+ }
@@ -105,6 +105,12 @@ export class ValuesTabModel extends HoistModel {
105
105
  without(this.pendingValues, ...values);
106
106
  }
107
107
 
108
+ toggleAllRecsChecked() {
109
+ const setAllToChecked = !this.allVisibleRecsChecked,
110
+ values = this.gridModel.store.records.map(it => it.get('value'));
111
+ this.setRecsChecked(setAllToChecked, values);
112
+ }
113
+
108
114
  //-------------------
109
115
  // Implementation
110
116
  //-------------------
@@ -175,13 +181,13 @@ export class ValuesTabModel extends HoistModel {
175
181
 
176
182
  private createGridModel() {
177
183
  const {BLANK_PLACEHOLDER} = GridFilterModel,
178
- {align, headerAlign, displayName} = this.headerFilterModel.column,
179
- {fieldType} = this.headerFilterModel,
180
- renderer = this.fieldSpec.renderer ?? (fieldType !== 'tags' ? this.headerFilterModel.column.renderer : null);
184
+ {headerFilterModel, fieldSpec} = this,
185
+ {fieldType} = headerFilterModel,
186
+ renderer = fieldSpec.renderer ?? (fieldType !== 'tags' ? this.headerFilterModel.column.renderer : null);
181
187
 
182
188
  return new GridModel({
183
189
  store: {
184
- idSpec: (raw) => this.fieldSpec.getUniqueValue(raw.value).toString(),
190
+ idSpec: (raw) => fieldSpec.getUniqueValue(raw.value).toString(),
185
191
  fields: [
186
192
  {name: 'value', type: 'auto'},
187
193
  {name: 'isChecked', type: 'bool'}
@@ -190,7 +196,10 @@ export class ValuesTabModel extends HoistModel {
190
196
  selModel: 'disabled',
191
197
  emptyText: 'No records found...',
192
198
  contextMenu: null,
193
- autosizeOptions: {mode: 'disabled'},
199
+ // Autosize enabled to ensure that long values don't get clipped and user can scroll
200
+ // right if necessary to view full string. For longer strings that differ only in their
201
+ // endings this is important - e.g. instrument or contract names ending in a date.
202
+ autosizeOptions: {mode: 'managed'},
194
203
  sizingMode: 'compact',
195
204
  stripeRows: false,
196
205
  sortBy: 'value',
@@ -202,16 +211,18 @@ export class ValuesTabModel extends HoistModel {
202
211
  {
203
212
  field: 'isChecked',
204
213
  headerName: ({gridModel}) => {
205
- const {store} = gridModel,
206
- values = store.records.map(it => it.get('value'));
207
214
  return checkbox({
208
- disabled: store.empty,
215
+ disabled: gridModel.store.empty,
209
216
  displayUnsetState: true,
210
217
  value: this.allVisibleRecsChecked,
211
- onChange: () => this.setRecsChecked(!this.allVisibleRecsChecked, values)
218
+ onChange: () => this.toggleAllRecsChecked()
212
219
  });
213
220
  },
214
- width: 30,
221
+ width: 28,
222
+ autosizable: false,
223
+ pinned: true,
224
+ align: 'center',
225
+ headerAlign: 'center',
215
226
  rendererIsComplex: true,
216
227
  renderer: (v, {record}) => {
217
228
  return checkbox({
@@ -223,10 +234,8 @@ export class ValuesTabModel extends HoistModel {
223
234
  },
224
235
  {
225
236
  field: 'value',
226
- flex: 1,
227
- displayName,
228
- align,
229
- headerAlign,
237
+ displayName: '(Select All)',
238
+ align: 'left',
230
239
  comparator: (v1, v2, sortDir, abs, {defaultComparator}) => {
231
240
  const mul = sortDir === 'desc' ? -1 : 1;
232
241
  if (v1 === BLANK_PLACEHOLDER) return 1 * mul;
@@ -8,11 +8,11 @@ import {grid, GridProps} from '@xh/hoist/cmp/grid';
8
8
  import {hframe, vbox} from '@xh/hoist/cmp/layout';
9
9
  import {BoxProps, hoistCmp, HoistProps, uses} from '@xh/hoist/core';
10
10
  import '@xh/hoist/desktop/register';
11
- import {cloneDeep} from 'lodash';
12
11
  import {chooserToolbar} from './impl/ChooserToolbar';
13
12
  import {description} from './impl/Description';
14
13
  import './LeftRightChooser.scss';
15
14
  import {LeftRightChooserModel} from './LeftRightChooserModel';
15
+ import {cloneDeep} from 'lodash';
16
16
 
17
17
  export interface LeftRightChooserProps extends HoistProps<LeftRightChooserModel>, BoxProps {}
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "55.2.1",
3
+ "version": "55.3.1",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",