@xh/hoist 83.1.0 → 84.0.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 +76 -0
- package/admin/tabs/cluster/instances/logs/levels/LogLevelDialogModel.ts +106 -10
- package/admin/tabs/cluster/metrics/MetricsModel.ts +3 -3
- package/appcontainer/AppContainerModel.ts +1 -1
- package/appcontainer/README.md +20 -0
- package/assets.d.ts +34 -0
- package/build/types/cmp/ag-grid/AgGrid.d.ts +8 -19
- package/build/types/cmp/ag-grid/AgGridModel.d.ts +18 -5
- package/build/types/cmp/card/Card.d.ts +9 -4
- package/build/types/cmp/card/CardModel.d.ts +15 -2
- package/build/types/cmp/chart/Chart.d.ts +2 -2
- package/build/types/cmp/chart/ChartModel.d.ts +11 -1
- package/build/types/cmp/dataview/DataView.d.ts +4 -2
- package/build/types/cmp/dataview/DataViewModel.d.ts +16 -4
- package/build/types/cmp/filter/FilterChooserModel.d.ts +7 -1
- package/build/types/cmp/form/Form.d.ts +2 -1
- package/build/types/cmp/form/FormModel.d.ts +12 -0
- package/build/types/cmp/form/field/BaseFieldModel.d.ts +7 -0
- package/build/types/cmp/form/formfieldset/FormFieldSetModel.d.ts +7 -1
- package/build/types/cmp/grid/GridModel.d.ts +16 -1
- package/build/types/cmp/grid/GridSorter.d.ts +14 -0
- package/build/types/cmp/grid/Types.d.ts +18 -0
- package/build/types/cmp/grid/columns/Column.d.ts +40 -2
- package/build/types/cmp/grid/columns/ColumnGroup.d.ts +10 -0
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +9 -2
- package/build/types/cmp/layout/Box.d.ts +19 -7
- package/build/types/cmp/layout/Frame.d.ts +17 -5
- package/build/types/cmp/loadingindicator/LoadingIndicator.d.ts +6 -4
- package/build/types/cmp/pinpad/PinPadModel.d.ts +6 -1
- package/build/types/cmp/spinner/Spinner.d.ts +31 -10
- package/build/types/cmp/tab/TabContainerModel.d.ts +11 -0
- package/build/types/cmp/tab/TabModel.d.ts +7 -0
- package/build/types/cmp/tab/Types.d.ts +4 -0
- package/build/types/cmp/treemap/TreeMapModel.d.ts +3 -3
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +9 -0
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +22 -3
- package/build/types/cmp/zoneGrid/impl/ZoneMapperModel.d.ts +6 -0
- package/build/types/core/HoistComponent.d.ts +29 -8
- package/build/types/core/HoistProps.d.ts +9 -3
- package/build/types/core/load/LoadSpec.d.ts +1 -1
- package/build/types/core/persist/provider/ViewManagerProvider.d.ts +7 -0
- package/build/types/data/Store.d.ts +35 -1
- package/build/types/data/StoreSelectionModel.d.ts +18 -2
- package/build/types/data/cube/Cube.d.ts +26 -6
- package/build/types/data/cube/Query.d.ts +10 -0
- package/build/types/data/cube/View.d.ts +21 -2
- package/build/types/data/cube/aggregate/Aggregator.d.ts +13 -0
- package/build/types/data/cube/aggregate/AverageAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/AverageStrictAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/ChildCountAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/LeafCountAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/MaxAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/MinAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/NullAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SingleAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SumAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/SumStrictAggregator.d.ts +1 -0
- package/build/types/data/cube/aggregate/UniqueAggregator.d.ts +1 -0
- package/build/types/data/filter/BaseFilterFieldSpec.d.ts +9 -0
- package/build/types/data/filter/Types.d.ts +12 -0
- package/build/types/desktop/cmp/button/AppMenuButton.d.ts +5 -0
- package/build/types/desktop/cmp/button/Button.d.ts +5 -1
- package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +12 -3
- package/build/types/desktop/cmp/dash/container/DashContainerModel.d.ts +9 -0
- package/build/types/desktop/cmp/dock/DockViewModel.d.ts +7 -0
- package/build/types/desktop/cmp/filechooser/FileChooserModel.d.ts +8 -0
- package/build/types/desktop/cmp/grid/editors/BooleanEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/DateEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/NumberEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/SelectEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/TextAreaEditor.d.ts +1 -0
- package/build/types/desktop/cmp/grid/editors/TextEditor.d.ts +1 -0
- package/build/types/desktop/cmp/input/Picker.d.ts +1 -1
- package/build/types/desktop/cmp/input/SegmentedControl.d.ts +16 -2
- package/build/types/desktop/cmp/leftrightchooser/LeftRightChooserModel.d.ts +7 -0
- package/build/types/desktop/cmp/modalsupport/ModalSupportModel.d.ts +28 -2
- package/build/types/desktop/cmp/panel/Panel.d.ts +5 -2
- package/build/types/desktop/cmp/panel/PanelModel.d.ts +12 -2
- package/build/types/desktop/cmp/rest/RestGrid.d.ts +10 -0
- package/build/types/desktop/cmp/rest/RestGridModel.d.ts +9 -1
- package/build/types/desktop/cmp/toolbar/Toolbar.d.ts +4 -1
- package/build/types/format/FormatDate.d.ts +4 -4
- package/build/types/icon/Icon.d.ts +3 -0
- package/build/types/kit/blueprint/Wrappers.d.ts +12 -1
- package/build/types/mobile/cmp/navigator/NavigatorModel.d.ts +8 -0
- package/build/types/mobile/cmp/navigator/PageModel.d.ts +7 -0
- package/build/types/mobile/cmp/panel/DialogPanel.d.ts +0 -2
- package/build/types/security/BaseOAuthClient.d.ts +9 -0
- package/build/types/security/authzero/AuthZeroClient.d.ts +6 -0
- package/build/types/security/msal/MsalClient.d.ts +6 -0
- package/build/types/svc/FetchService.d.ts +10 -7
- package/build/types/svc/TraceService.d.ts +17 -2
- package/build/types/utils/async/Timer.d.ts +6 -0
- package/build/types/utils/js/LangUtils.d.ts +1 -1
- package/build/types/utils/js/TestUtils.d.ts +1 -1
- package/build/types/utils/react/index.d.ts +0 -1
- package/build/types/utils/telemetry/Span.d.ts +12 -2
- package/cmp/ag-grid/AgGrid.ts +8 -19
- package/cmp/ag-grid/AgGridModel.ts +18 -5
- package/cmp/card/Card.ts +9 -4
- package/cmp/card/CardModel.ts +15 -2
- package/cmp/chart/Chart.ts +2 -2
- package/cmp/chart/ChartModel.ts +11 -1
- package/cmp/dataview/DataView.ts +4 -2
- package/cmp/dataview/DataViewModel.ts +16 -4
- package/cmp/filter/FilterChooserModel.ts +7 -1
- package/cmp/form/Form.ts +2 -1
- package/cmp/form/FormModel.ts +12 -0
- package/cmp/form/README.md +13 -0
- package/cmp/form/field/BaseFieldModel.ts +7 -0
- package/cmp/form/formfieldset/FormFieldSetModel.ts +7 -1
- package/cmp/grid/Grid.scss +14 -8
- package/cmp/grid/GridModel.ts +16 -1
- package/cmp/grid/GridSorter.ts +14 -0
- package/cmp/grid/README.md +12 -0
- package/cmp/grid/Types.ts +18 -0
- package/cmp/grid/columns/Column.ts +40 -2
- package/cmp/grid/columns/ColumnGroup.ts +10 -0
- package/cmp/grouping/GroupingChooserModel.ts +9 -2
- package/cmp/layout/Box.ts +19 -7
- package/cmp/layout/Frame.ts +17 -5
- package/cmp/layout/README.md +16 -21
- package/cmp/loadingindicator/LoadingIndicator.scss +1 -1
- package/cmp/loadingindicator/LoadingIndicator.ts +11 -9
- package/cmp/pinpad/PinPadModel.ts +6 -1
- package/cmp/spinner/Spinner.scss +13 -0
- package/cmp/spinner/Spinner.ts +58 -20
- package/cmp/tab/TabContainerModel.ts +11 -0
- package/cmp/tab/TabModel.ts +7 -0
- package/cmp/tab/Types.ts +4 -0
- package/cmp/treemap/TreeMapModel.ts +3 -3
- package/cmp/viewmanager/ViewManagerModel.ts +9 -0
- package/cmp/zoneGrid/ZoneGridModel.ts +22 -3
- package/cmp/zoneGrid/impl/ZoneMapperModel.ts +6 -0
- package/core/ExceptionHandler.ts +1 -1
- package/core/HoistComponent.ts +36 -11
- package/core/HoistProps.ts +9 -3
- package/core/README.md +68 -6
- package/core/impl/InstanceManager.ts +1 -0
- package/core/load/LoadSpec.ts +1 -1
- package/core/persist/provider/ViewManagerProvider.ts +7 -0
- package/data/README.md +48 -124
- package/data/Store.ts +35 -1
- package/data/StoreSelectionModel.ts +18 -2
- package/data/cube/Cube.ts +26 -6
- package/data/cube/Query.ts +10 -0
- package/data/cube/README.md +236 -0
- package/data/cube/View.ts +21 -2
- package/data/cube/aggregate/Aggregator.ts +13 -0
- package/data/cube/aggregate/AverageAggregator.ts +1 -0
- package/data/cube/aggregate/AverageStrictAggregator.ts +1 -0
- package/data/cube/aggregate/ChildCountAggregator.ts +1 -0
- package/data/cube/aggregate/LeafCountAggregator.ts +1 -0
- package/data/cube/aggregate/MaxAggregator.ts +1 -0
- package/data/cube/aggregate/MinAggregator.ts +1 -0
- package/data/cube/aggregate/NullAggregator.ts +1 -0
- package/data/cube/aggregate/SingleAggregator.ts +1 -0
- package/data/cube/aggregate/SumAggregator.ts +1 -0
- package/data/cube/aggregate/SumStrictAggregator.ts +1 -0
- package/data/cube/aggregate/UniqueAggregator.ts +1 -0
- package/data/filter/BaseFilterFieldSpec.ts +9 -0
- package/data/filter/Types.ts +12 -0
- package/desktop/README.md +131 -9
- package/desktop/appcontainer/AboutDialog.ts +2 -0
- package/desktop/appcontainer/Banner.ts +5 -2
- package/desktop/appcontainer/ChangelogDialog.ts +1 -0
- package/desktop/appcontainer/ExceptionDialog.ts +4 -0
- package/desktop/appcontainer/ExceptionDialogDetails.ts +4 -1
- package/desktop/appcontainer/FeedbackDialog.ts +4 -1
- package/desktop/appcontainer/ImpersonationBar.ts +4 -0
- package/desktop/appcontainer/LockoutPanel.ts +4 -1
- package/desktop/appcontainer/LoginPanel.ts +7 -3
- package/desktop/appcontainer/Message.ts +9 -3
- package/desktop/appcontainer/OptionsDialog.ts +3 -1
- package/desktop/appcontainer/VersionBar.ts +1 -0
- package/desktop/appcontainer/suspend/IdlePanel.ts +4 -4
- package/desktop/appcontainer/suspend/SuspendPanel.ts +3 -0
- package/desktop/cmp/button/AppMenuButton.ts +5 -0
- package/desktop/cmp/button/Button.ts +14 -4
- package/desktop/cmp/dash/README.md +14 -0
- package/desktop/cmp/dash/canvas/DashCanvasModel.ts +12 -3
- package/desktop/cmp/dash/container/DashContainerModel.ts +9 -0
- package/desktop/cmp/dock/DockViewModel.ts +7 -0
- package/desktop/cmp/filechooser/FileChooserModel.ts +9 -2
- package/desktop/cmp/grid/editors/BooleanEditor.ts +1 -0
- package/desktop/cmp/grid/editors/DateEditor.ts +1 -0
- package/desktop/cmp/grid/editors/NumberEditor.ts +1 -0
- package/desktop/cmp/grid/editors/SelectEditor.ts +1 -0
- package/desktop/cmp/grid/editors/TextAreaEditor.ts +1 -0
- package/desktop/cmp/grid/editors/TextEditor.ts +1 -0
- package/desktop/cmp/input/Picker.ts +2 -2
- package/desktop/cmp/input/SegmentedControl.ts +20 -2
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +7 -0
- package/desktop/cmp/modalsupport/ModalSupportModel.ts +31 -2
- package/desktop/cmp/panel/Panel.ts +29 -21
- package/desktop/cmp/panel/PanelModel.ts +12 -2
- package/desktop/cmp/panel/README.md +20 -0
- package/desktop/cmp/rest/RestGrid.ts +10 -0
- package/desktop/cmp/rest/RestGridModel.ts +9 -1
- package/desktop/cmp/toolbar/Toolbar.ts +9 -2
- package/desktop/cmp/viewmanager/ViewManager.ts +1 -1
- package/docs/README.md +9 -4
- package/docs/coding-conventions.md +29 -21
- package/docs/doc-registry.json +31 -15
- package/docs/planning/docs-roadmap-log.md +11 -0
- package/docs/planning/docs-roadmap.md +1 -0
- package/docs/upgrade-notes/v84-upgrade-notes.md +136 -0
- package/docs/version-compatibility.md +2 -0
- package/format/FormatDate.ts +4 -4
- package/icon/Icon.ts +9 -0
- package/icon/README.md +62 -22
- package/icon/index.ts +24 -0
- package/kit/README.md +8 -2
- package/kit/blueprint/Wrappers.ts +12 -1
- package/mcp/README.md +47 -26
- package/mcp/cli/ts.ts +39 -4
- package/mcp/data/ts-registry.ts +57 -17
- package/mcp/tools/typescript.ts +32 -4
- package/mobile/appcontainer/AboutDialog.ts +3 -0
- package/mobile/appcontainer/Banner.ts +2 -0
- package/mobile/appcontainer/ExceptionDialog.ts +4 -0
- package/mobile/appcontainer/ExceptionDialogDetails.ts +1 -0
- package/mobile/appcontainer/FeedbackDialog.ts +4 -1
- package/mobile/appcontainer/ImpersonationBar.ts +2 -0
- package/mobile/appcontainer/LockoutPanel.ts +2 -0
- package/mobile/appcontainer/LoginPanel.ts +7 -3
- package/mobile/appcontainer/Message.ts +9 -3
- package/mobile/appcontainer/OptionsDialog.ts +5 -1
- package/mobile/appcontainer/VersionBar.ts +1 -0
- package/mobile/appcontainer/suspend/IdlePanel.ts +5 -6
- package/mobile/appcontainer/suspend/SuspendPanel.ts +3 -0
- package/mobile/cmp/navigator/NavigatorModel.ts +8 -0
- package/mobile/cmp/navigator/PageModel.ts +7 -0
- package/mobile/cmp/panel/DialogPanel.ts +0 -2
- package/package.json +11 -11
- package/security/BaseOAuthClient.ts +9 -0
- package/security/authzero/AuthZeroClient.ts +6 -0
- package/security/msal/MsalClient.ts +6 -0
- package/styles/vars.scss +14 -0
- package/svc/FetchService.ts +25 -15
- package/svc/README.md +39 -9
- package/svc/TraceService.ts +69 -11
- package/utils/README.md +0 -1
- package/utils/async/Timer.ts +6 -0
- package/utils/js/LangUtils.ts +1 -1
- package/utils/js/TestUtils.ts +1 -1
- package/utils/react/index.ts +0 -1
- package/utils/telemetry/Span.ts +21 -4
- package/build/types/utils/react/ClassName.d.ts +0 -14
- package/utils/react/ClassName.ts +0 -24
|
@@ -33,7 +33,10 @@ import {isFunction, isNumber} from 'lodash';
|
|
|
33
33
|
import {ReactNode} from 'react';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Configuration for a
|
|
36
|
+
* Configuration for a {@link DataViewModel} - a list-style data component that renders
|
|
37
|
+
* each record using a custom `renderer` function. Built on {@link GridModel} internally.
|
|
38
|
+
*
|
|
39
|
+
* @see DataViewModel
|
|
37
40
|
*/
|
|
38
41
|
export interface DataViewConfig {
|
|
39
42
|
/** A Store instance, or a config to create one. */
|
|
@@ -131,10 +134,19 @@ export type ItemHeightFn = (params: {
|
|
|
131
134
|
}) => number;
|
|
132
135
|
|
|
133
136
|
/**
|
|
134
|
-
*
|
|
135
|
-
* using a
|
|
137
|
+
* Model for a {@link DataView} - a list-style data component that renders each record
|
|
138
|
+
* using a custom `renderer` function. Built on {@link GridModel} internally.
|
|
139
|
+
*
|
|
140
|
+
* Use DataView when you need full control over how each row is rendered as a single
|
|
141
|
+
* custom element (e.g. a card or summary tile), as opposed to the column-based layout
|
|
142
|
+
* of a standard Grid. For a middle ground with multi-zone row layouts, see
|
|
143
|
+
* {@link ZoneGridModel}.
|
|
144
|
+
*
|
|
145
|
+
* Key configs: `renderer` (required - produces the visual for each row), `itemHeight`,
|
|
146
|
+
* `groupBy`, and standard store/selection options inherited from GridModel.
|
|
136
147
|
*
|
|
137
|
-
*
|
|
148
|
+
* @see DataView
|
|
149
|
+
* @see DataViewConfig
|
|
138
150
|
*/
|
|
139
151
|
export class DataViewModel extends HoistModel {
|
|
140
152
|
@managed gridModel: GridModel;
|
|
@@ -55,6 +55,12 @@ import {FilterChooserFieldSpec, FilterChooserFieldSpecConfig} from './FilterChoo
|
|
|
55
55
|
import {compoundFilterOption, fieldFilterOption, FilterChooserOption} from './impl/Option';
|
|
56
56
|
import {QueryEngine} from './impl/QueryEngine';
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Configuration for a {@link FilterChooserModel} - an interactive, tokenized filter builder
|
|
60
|
+
* that binds to a {@link Store} or Cube {@link View}.
|
|
61
|
+
*
|
|
62
|
+
* @see FilterChooserModel
|
|
63
|
+
*/
|
|
58
64
|
export interface FilterChooserConfig {
|
|
59
65
|
/**
|
|
60
66
|
* Specifies the fields this model supports for filtering and customizes how their available values
|
|
@@ -136,7 +142,7 @@ export interface FilterChooserConfig {
|
|
|
136
142
|
* across multiple data fields.
|
|
137
143
|
*
|
|
138
144
|
* Manages the current filter value, user-managed favorites, and available field specs. Supports
|
|
139
|
-
* bidirectional binding to a {@link Store} or Cube {@link View} via the `bind` config
|
|
145
|
+
* bidirectional binding to a {@link Store} or Cube {@link View} via the `bind` config - filters
|
|
140
146
|
* are automatically applied to the target as they change, and external filter changes on the
|
|
141
147
|
* target are reflected back into this model.
|
|
142
148
|
*
|
package/cmp/form/Form.ts
CHANGED
|
@@ -43,7 +43,8 @@ export interface FormProps<M extends FormModel = FormModel>
|
|
|
43
43
|
extends HoistProps<M>, TestSupportProps {
|
|
44
44
|
/**
|
|
45
45
|
* Defaults for certain props on child/nested FormFields.
|
|
46
|
-
*
|
|
46
|
+
* Note there are both desktop and mobile implementations of FormField.
|
|
47
|
+
* @see FormField
|
|
47
48
|
*/
|
|
48
49
|
fieldDefaults?: Partial<BaseFormFieldProps> & DefaultHoistProps;
|
|
49
50
|
}
|
package/cmp/form/FormModel.ts
CHANGED
|
@@ -36,6 +36,15 @@ import {FieldModel} from './field/FieldModel';
|
|
|
36
36
|
import {SubformsFieldConfig, SubformsFieldModel} from './field/SubformsFieldModel';
|
|
37
37
|
import {isLocalDate, LocalDate} from '@xh/hoist/utils/datetime';
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for a {@link FormModel}. Provide `fields` to define the form's data schema
|
|
41
|
+
* and validation rules. Optionally supply `initialValues` to pre-populate the form.
|
|
42
|
+
*
|
|
43
|
+
* See the form package README (`cmp/form/README.md`) for usage patterns and validation.
|
|
44
|
+
*
|
|
45
|
+
* @see FormModel
|
|
46
|
+
* @see BaseFieldConfig
|
|
47
|
+
*/
|
|
39
48
|
export interface FormConfig {
|
|
40
49
|
/** FieldModels, or configs to create them, for all data fields managed by the model. */
|
|
41
50
|
fields?: Array<BaseFieldModel | BaseFieldConfig | SubformsFieldConfig | SubformsFieldModel>;
|
|
@@ -87,6 +96,9 @@ export interface FormValidateOptions {
|
|
|
87
96
|
* where each split has its own internal fields for broker, quantity, and time).
|
|
88
97
|
*
|
|
89
98
|
* See {@link FieldModel} for details on state/validation maintained at the individual field level.
|
|
99
|
+
*
|
|
100
|
+
* See the form package README (`cmp/form/README.md`) for full documentation including field
|
|
101
|
+
* configuration, validation patterns, and FormField component binding.
|
|
90
102
|
*/
|
|
91
103
|
export class FormModel extends HoistModel {
|
|
92
104
|
/** Container object for FieldModel instances, keyed by field name.*/
|
package/cmp/form/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Form Package
|
|
2
2
|
|
|
3
|
+
| Section | Description |
|
|
4
|
+
|---------|-------------|
|
|
5
|
+
| [Overview](#overview) | Form infrastructure for data entry with validation and binding |
|
|
6
|
+
| [Architecture](#architecture) | FormModel, FieldModel, and SubformsFieldModel structure |
|
|
7
|
+
| [FormModel](#formmodel) | Creating forms, working with data, validation, and focus |
|
|
8
|
+
| [FieldModel](#fieldmodel) | Individual field state, validation rules, and observable props |
|
|
9
|
+
| [SubformsFieldModel](#subformsfieldmodel) | Nested form collections for complex data structures |
|
|
10
|
+
| [Form Component](#form-component) | Non-visual React context provider for FormField components |
|
|
11
|
+
| [FormFieldSet](#formfieldset) | Visual grouping with aggregate validation and state cascading |
|
|
12
|
+
| [Common Patterns](#common-patterns) | Forms in models, cascading dropdowns, persistence, scrolling |
|
|
13
|
+
| [Common Pitfalls](#common-pitfalls) | Confusing form imports and other issues |
|
|
14
|
+
| [Related Packages](#related-packages) | Links to card, data, input, and platform form packages |
|
|
15
|
+
|
|
3
16
|
## Overview
|
|
4
17
|
|
|
5
18
|
The `/cmp/form/` package works along with `/cmp/input` to provide Hoist's form infrastructure -
|
|
@@ -20,6 +20,13 @@ import {createObservableRef} from '@xh/hoist/utils/react';
|
|
|
20
20
|
import {compact, flatten, isEmpty, isEqual, isFunction, isNil, isString} from 'lodash';
|
|
21
21
|
import {FormModel} from '../FormModel';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for a {@link BaseFieldModel} - defines a single field within a
|
|
25
|
+
* {@link FormModel} including its name, initial value, and validation rules.
|
|
26
|
+
*
|
|
27
|
+
* @see FieldModel
|
|
28
|
+
* @see FormConfig
|
|
29
|
+
*/
|
|
23
30
|
export interface BaseFieldConfig {
|
|
24
31
|
/** Unique name for this field within its parent FormModel. */
|
|
25
32
|
name: string;
|
|
@@ -13,6 +13,12 @@ import {makeObservable} from '@xh/hoist/mobx';
|
|
|
13
13
|
import {uniq, without} from 'lodash';
|
|
14
14
|
import {action, computed, observable} from 'mobx';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for a {@link FormFieldSetModel} - a collapsible container for grouping
|
|
18
|
+
* related form fields with aggregated validation state.
|
|
19
|
+
*
|
|
20
|
+
* @see FormFieldSetModel
|
|
21
|
+
*/
|
|
16
22
|
export interface FormFieldSetConfig {
|
|
17
23
|
/** Can form field set be collapsed? */
|
|
18
24
|
collapsible?: boolean;
|
|
@@ -31,7 +37,7 @@ export interface FormFieldSetConfig {
|
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
/**
|
|
34
|
-
* Model for a FormFieldSet
|
|
40
|
+
* Model for a FormFieldSet - a collapsible container for grouping related form fields.
|
|
35
41
|
*
|
|
36
42
|
* Aggregates validation state from all descendant FieldModels and child FormFieldSetModels,
|
|
37
43
|
* and supports disabling or setting readonly state on all contained fields at once.
|
package/cmp/grid/Grid.scss
CHANGED
|
@@ -358,11 +358,16 @@
|
|
|
358
358
|
display: none;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
// Default minimal styling.
|
|
361
|
+
// Default minimal styling. Not applied when using a custom tooltip.
|
|
362
|
+
// Uses pre-wrap to honor intentional \n line breaks in tooltip content
|
|
363
|
+
// while still wrapping long lines at the max-width boundary.
|
|
362
364
|
&--default {
|
|
363
|
-
padding: var(--xh-
|
|
364
|
-
background: var(--xh-bg);
|
|
365
|
-
border: var(--xh-border
|
|
365
|
+
padding: var(--xh-grid-tooltip-padding);
|
|
366
|
+
background: var(--xh-grid-tooltip-bg);
|
|
367
|
+
border: var(--xh-grid-tooltip-border);
|
|
368
|
+
border-radius: var(--xh-grid-tooltip-border-radius);
|
|
369
|
+
max-width: var(--xh-grid-tooltip-max-width);
|
|
370
|
+
white-space: pre-wrap;
|
|
366
371
|
}
|
|
367
372
|
|
|
368
373
|
// Validation tooltip styling. Adjust depending on if within a default or custom tooltip.
|
|
@@ -383,12 +388,13 @@
|
|
|
383
388
|
}
|
|
384
389
|
|
|
385
390
|
&--custom > div > .xh-grid-tooltip--validation {
|
|
386
|
-
padding: var(--xh-
|
|
387
|
-
|
|
388
|
-
|
|
391
|
+
padding: var(--xh-grid-tooltip-padding) var(--xh-grid-tooltip-padding)
|
|
392
|
+
var(--xh-grid-tooltip-padding) 2em;
|
|
393
|
+
background: var(--xh-grid-tooltip-bg);
|
|
394
|
+
border: var(--xh-grid-tooltip-border);
|
|
389
395
|
|
|
390
396
|
&--single {
|
|
391
|
-
padding: var(--xh-
|
|
397
|
+
padding: var(--xh-grid-tooltip-padding);
|
|
392
398
|
}
|
|
393
399
|
}
|
|
394
400
|
}
|
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -120,6 +120,16 @@ import {
|
|
|
120
120
|
RowClassRuleFn
|
|
121
121
|
} from './Types';
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Configuration for a {@link GridModel} - the primary model backing the Hoist Grid component.
|
|
125
|
+
*
|
|
126
|
+
* At minimum, provide `columns` (an array of {@link ColumnSpec} or {@link ColumnGroupSpec}
|
|
127
|
+
* objects). A {@link Store} can be provided or will be auto-created with fields inferred
|
|
128
|
+
* from the column configs. Use `colDefaults` to apply shared settings across all columns.
|
|
129
|
+
*
|
|
130
|
+
* @see GridModel
|
|
131
|
+
* @see ColumnSpec
|
|
132
|
+
*/
|
|
123
133
|
export interface GridConfig {
|
|
124
134
|
/** Columns for this grid. */
|
|
125
135
|
columns?: ColumnOrGroupSpec[];
|
|
@@ -413,7 +423,7 @@ export interface GridModelDefaults {
|
|
|
413
423
|
}
|
|
414
424
|
|
|
415
425
|
/**
|
|
416
|
-
* Core Model for a Grid, specifying the grid's data store, column definitions,
|
|
426
|
+
* Core Model for a {@link Grid}, specifying the grid's data store, column definitions,
|
|
417
427
|
* sorting/grouping/selection state, and context menu configuration.
|
|
418
428
|
*
|
|
419
429
|
* This is the primary application entry-point for specifying Grid component options and behavior.
|
|
@@ -424,6 +434,11 @@ export interface GridModelDefaults {
|
|
|
424
434
|
* 3) Include a single column with `isTreeColumn: true`. This column will provide expand /
|
|
425
435
|
* collapse controls and indent child columns in addition to displaying its own data.
|
|
426
436
|
*
|
|
437
|
+
* See the grid package README (`cmp/grid/README.md`) for full documentation including column
|
|
438
|
+
* configuration, renderers, filtering, sorting, and common pitfalls.
|
|
439
|
+
*
|
|
440
|
+
* @see Grid
|
|
441
|
+
* @see DataView
|
|
427
442
|
*/
|
|
428
443
|
export class GridModel extends HoistModel {
|
|
429
444
|
/** App-level defaults for GridModel. Instance config takes precedence. */
|
package/cmp/grid/GridSorter.ts
CHANGED
|
@@ -8,12 +8,26 @@ import {isNil, isNumber, isString} from 'lodash';
|
|
|
8
8
|
|
|
9
9
|
export type GridSorterLike = GridSorterSpec | string | GridSorter;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Plain-object form of a {@link GridSorter}, specifying a column sort direction.
|
|
13
|
+
*
|
|
14
|
+
* Accepted by {@link GridModel.sortBy} alongside pipe-delimited strings and GridSorter
|
|
15
|
+
* instances. The framework parses these into immutable GridSorter objects automatically.
|
|
16
|
+
*/
|
|
11
17
|
export interface GridSorterSpec {
|
|
12
18
|
colId: string;
|
|
13
19
|
sort?: 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
20
|
+
/** True to sort by absolute value, ignoring sign. */
|
|
14
21
|
abs?: boolean;
|
|
15
22
|
}
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Immutable value object representing a sort specification for a single grid column.
|
|
26
|
+
*
|
|
27
|
+
* Applications typically don't need to construct these directly - pass `GridSorterSpec` objects
|
|
28
|
+
* or pipe-delimited strings to {@link GridModel.sortBy} and the framework will parse them
|
|
29
|
+
* automatically.
|
|
30
|
+
*/
|
|
17
31
|
export class GridSorter {
|
|
18
32
|
readonly colId: string;
|
|
19
33
|
readonly sort: 'asc' | 'desc';
|
package/cmp/grid/README.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Grid Package
|
|
2
2
|
|
|
3
|
+
| Section | Description |
|
|
4
|
+
|---------|-------------|
|
|
5
|
+
| [Overview](#overview) | Introduction to Hoist's tabular and hierarchical data grid |
|
|
6
|
+
| [Architecture](#architecture) | Class hierarchy and key classes |
|
|
7
|
+
| [Configuration Pattern](#configuration-pattern) | Spec-to-object transformation for declarative config |
|
|
8
|
+
| [Common Usage Patterns](#common-usage-patterns) | Sorting, grouping, tree mode, selection, filtering, and more |
|
|
9
|
+
| [Column Properties Reference](#column-properties-reference) | Key categories of ColumnSpec properties |
|
|
10
|
+
| [Extension Points](#extension-points) | ag-Grid passthrough, custom comparators, and appData |
|
|
11
|
+
| [App-Level Defaults](#app-level-defaults) | Static defaults for GridModel and GridFilterModel |
|
|
12
|
+
| [Pitfalls](#pitfalls) | Duplicate column IDs and other common issues |
|
|
13
|
+
| [Related Packages](#related-packages) | Links to data, ag-grid, desktop/mobile grid, and svc |
|
|
14
|
+
|
|
3
15
|
## Overview
|
|
4
16
|
|
|
5
17
|
Grid is Hoist React's primary component for displaying tabular and hierarchical data. Built on
|
package/cmp/grid/Types.ts
CHANGED
|
@@ -90,6 +90,13 @@ export interface GridModelPersistOptions extends PersistOptions {
|
|
|
90
90
|
persistExpandToLevel?: boolean | PersistOptions;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for a {@link GridFilterModel} - the model powering column-header filter menus.
|
|
95
|
+
* Passed via the `filterModel` config on {@link GridConfig}.
|
|
96
|
+
*
|
|
97
|
+
* @see GridFilterModel
|
|
98
|
+
* @see GridFilterFieldSpec
|
|
99
|
+
*/
|
|
93
100
|
export interface GridFilterModelConfig {
|
|
94
101
|
/**
|
|
95
102
|
* Target (typically a {@link Store} or Cube {@link View}) to be filtered as column filters
|
|
@@ -135,6 +142,13 @@ export interface GridFilterBindTarget extends FilterBindTarget, FilterValueSourc
|
|
|
135
142
|
*/
|
|
136
143
|
export type GroupRowRenderer = (context: ICellRendererParams) => ReactNode;
|
|
137
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Configuration for a {@link ColChooserModel} - the model backing the grid column chooser UI.
|
|
147
|
+
* Passed via the `colChooserModel` config on {@link GridConfig}, or set app-wide via
|
|
148
|
+
* `GridModel.defaults.colChooserModel`.
|
|
149
|
+
*
|
|
150
|
+
* @see ColChooserModel
|
|
151
|
+
*/
|
|
138
152
|
export interface ColChooserConfig {
|
|
139
153
|
/** GridModel to bind to. Not required if creating via `GridModel.colChooserModel` */
|
|
140
154
|
gridModel?: GridModel;
|
|
@@ -359,6 +373,10 @@ export type ColumnGetValueFn<T = any> = (params: {
|
|
|
359
373
|
gridModel: GridModel;
|
|
360
374
|
}) => T;
|
|
361
375
|
|
|
376
|
+
/**
|
|
377
|
+
* Entry within a {@link ColumnSpec.sortingOrder} array, defining one step in the sort cycle
|
|
378
|
+
* applied by successive clicks on a column header.
|
|
379
|
+
*/
|
|
362
380
|
export interface ColumnSortSpec {
|
|
363
381
|
/** Direction to sort, either 'asc' or 'desc', or null to remove sort. */
|
|
364
382
|
sort: 'asc' | 'desc' | null;
|
|
@@ -77,6 +77,17 @@ import type {
|
|
|
77
77
|
CellClickedEvent
|
|
78
78
|
} from '@xh/hoist/kit/ag-grid';
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Configuration object for defining a {@link Column} within a {@link GridModel}.
|
|
82
|
+
*
|
|
83
|
+
* Passed as plain objects in the `columns` array of a {@link GridConfig}. Each spec must
|
|
84
|
+
* identify its data via `field` (and/or `colId`). All other properties are optional and
|
|
85
|
+
* have sensible defaults - many are derived from the corresponding {@link Field} definition
|
|
86
|
+
* on the grid's store when available (e.g. `displayName`, `align`, `sortingOrder`).
|
|
87
|
+
*
|
|
88
|
+
* @see Column
|
|
89
|
+
* @see GridModel
|
|
90
|
+
*/
|
|
80
91
|
export interface ColumnSpec {
|
|
81
92
|
/**
|
|
82
93
|
* Name of data store field to display within the column, or object containing properties
|
|
@@ -241,7 +252,20 @@ export interface ColumnSpec {
|
|
|
241
252
|
*/
|
|
242
253
|
pinned?: boolean | HSide;
|
|
243
254
|
|
|
244
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Function returning a React Element for each cell value in this Column.
|
|
257
|
+
*
|
|
258
|
+
* For number and date formatting, prefer the pre-built `numberRenderer` and `dateRenderer`
|
|
259
|
+
* factories from `@xh/hoist/format` - these accept formatting options and return a reusable
|
|
260
|
+
* renderer function. Also consider the pre-built column specs (`number`, `date`, `dateTime`,
|
|
261
|
+
* `boolCheck` from `@xh/hoist/cmp/grid`) which bundle a renderer with appropriate alignment,
|
|
262
|
+
* sorting, and export formatting.
|
|
263
|
+
*
|
|
264
|
+
* For custom rendering based on record data beyond this column's field, set
|
|
265
|
+
* `rendererIsComplex: true` to ensure cells refresh on any record change.
|
|
266
|
+
*
|
|
267
|
+
* See the grid package README (`cmp/grid/README.md`) for renderer patterns and examples.
|
|
268
|
+
*/
|
|
245
269
|
renderer?: ColumnRenderer;
|
|
246
270
|
|
|
247
271
|
/**
|
|
@@ -406,7 +430,21 @@ export interface ColumnSpec {
|
|
|
406
430
|
|
|
407
431
|
/**
|
|
408
432
|
* Cross-platform definition and API for a standardized Grid column.
|
|
409
|
-
*
|
|
433
|
+
*
|
|
434
|
+
* Columns are defined as plain {@link ColumnSpec} objects within the `columns` array of a
|
|
435
|
+
* {@link GridConfig} - they are never constructed directly. GridModel also supports
|
|
436
|
+
* `colDefaults` for shared config applied to all columns, and `GridModel.defaults.colDefaults`
|
|
437
|
+
* for app-wide column defaults. Columns can be nested within {@link ColumnGroup}s for
|
|
438
|
+
* multi-level headers.
|
|
439
|
+
*
|
|
440
|
+
* Every column must resolve to a unique `colId`, which defaults to `field` when not set.
|
|
441
|
+
* If two columns reference the same `field`, provide an explicit `colId` on one of them.
|
|
442
|
+
*
|
|
443
|
+
* See {@link ColumnSpec} for all available configuration properties, and the grid package
|
|
444
|
+
* README (`cmp/grid/README.md`) for full configuration guidance, renderer patterns, and pitfalls.
|
|
445
|
+
*
|
|
446
|
+
* @see GridModel
|
|
447
|
+
* @see ColumnGroup
|
|
410
448
|
*/
|
|
411
449
|
export class Column {
|
|
412
450
|
static DEFAULT_WIDTH = 60;
|
|
@@ -16,6 +16,16 @@ import {GridModel} from '../GridModel';
|
|
|
16
16
|
import {ColumnHeaderClassFn, ColumnHeaderNameFn, ColumnOrGroup} from '../Types';
|
|
17
17
|
import {Column, ColumnSpec} from './Column';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for a {@link ColumnGroup} - a hierarchical grouping of columns that renders
|
|
21
|
+
* as a multi-level header in the grid. Nest {@link ColumnSpec} and/or additional
|
|
22
|
+
* ColumnGroupSpec objects within `children`.
|
|
23
|
+
*
|
|
24
|
+
* The `groupId` must be unique across the grid, defaulting to `headerName` when not set.
|
|
25
|
+
*
|
|
26
|
+
* @see ColumnGroup
|
|
27
|
+
* @see ColumnSpec
|
|
28
|
+
*/
|
|
19
29
|
export interface ColumnGroupSpec {
|
|
20
30
|
/** Column or ColumnGroup configs for children of this group.*/
|
|
21
31
|
children: Array<ColumnGroupSpec | ColumnSpec>;
|
|
@@ -12,6 +12,13 @@ import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
|
12
12
|
import {executeIfFunction, throwIf} from '@xh/hoist/utils/js';
|
|
13
13
|
import {isArray, isEmpty, isEqual, isObject, isString, keys, sortBy} from 'lodash';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for a {@link GroupingChooserModel} - a control for selecting multi-level
|
|
17
|
+
* dimension groupings, typically bound to a Cube {@link View} or {@link GridModel}.
|
|
18
|
+
*
|
|
19
|
+
* @see GroupingChooserModel
|
|
20
|
+
* @see DimensionSpec
|
|
21
|
+
*/
|
|
15
22
|
export interface GroupingChooserConfig {
|
|
16
23
|
/** True to accept an empty list as a valid value. */
|
|
17
24
|
allowEmpty?: boolean;
|
|
@@ -21,7 +28,7 @@ export interface GroupingChooserConfig {
|
|
|
21
28
|
* should be automatically applied as it changes. When bound to a GridModel, calls
|
|
22
29
|
* `setGroupBy()`; when bound to a View, calls `updateQuery({dimensions: ...})`.
|
|
23
30
|
*
|
|
24
|
-
* This is a two-way binding
|
|
31
|
+
* This is a two-way binding - changes to the target's value are reflected back into
|
|
25
32
|
* the GroupingChooserModel automatically.
|
|
26
33
|
*/
|
|
27
34
|
bind?: GroupingBindTarget;
|
|
@@ -98,7 +105,7 @@ export type GroupingBindTarget = GridModel | View;
|
|
|
98
105
|
*
|
|
99
106
|
* Manages the current dimension selection, available dimensions, user-managed favorites, and
|
|
100
107
|
* drag-and-drop reordering. Supports bidirectional binding to a {@link GridModel} or Cube
|
|
101
|
-
* {@link View} via the `bind` config
|
|
108
|
+
* {@link View} via the `bind` config - grouping changes are automatically applied to the
|
|
102
109
|
* target, and external changes to the target are reflected back into this model.
|
|
103
110
|
*
|
|
104
111
|
* Dimensions can be auto-populated from the bind target or specified explicitly. When binding
|
package/cmp/layout/Box.ts
CHANGED
|
@@ -9,17 +9,21 @@ import {TEST_ID, mergeDeep} from '@xh/hoist/utils/js';
|
|
|
9
9
|
import {splitLayoutProps} from '@xh/hoist/utils/react';
|
|
10
10
|
import {div} from './Tags';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Props for {@link Box}, {@link VBox}, and {@link HBox} layout containers.
|
|
14
|
+
* Combines {@link HoistProps} with {@link BoxProps} (layout attributes resolved to CSS styles).
|
|
15
|
+
*/
|
|
12
16
|
export interface BoxComponentProps extends HoistProps, BoxProps {}
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Access to the internal div is provided via a ref argument.
|
|
19
|
+
* Base flexbox container that merges all {@link LayoutProps} - margin, padding, dimensions,
|
|
20
|
+
* flex, alignment, and overflow - onto a rendered `div`. This is the terminal component where
|
|
21
|
+
* layout props are resolved to CSS; higher-level components pass layout props through to a
|
|
22
|
+
* Box (or {@link Frame}) at the bottom of their render tree.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
24
|
+
* **Application code should generally prefer {@link VBox} or {@link HBox}**, which make layout
|
|
25
|
+
* direction explicit. Bare `box()` applies `display: flex` with the CSS default direction (row)
|
|
26
|
+
* but does not communicate that intent clearly.
|
|
23
27
|
*/
|
|
24
28
|
export const [Box, box] = hoistCmp.withFactory<BoxComponentProps>({
|
|
25
29
|
displayName: 'Box',
|
|
@@ -48,6 +52,10 @@ export const [Box, box] = hoistCmp.withFactory<BoxComponentProps>({
|
|
|
48
52
|
}
|
|
49
53
|
});
|
|
50
54
|
|
|
55
|
+
/**
|
|
56
|
+
* A {@link Box} with vertical (column) flex layout. Does not stretch to fill its parent -
|
|
57
|
+
* use {@link VFrame} instead when the container should grow to consume available space.
|
|
58
|
+
*/
|
|
51
59
|
export const [VBox, vbox] = hoistCmp.withFactory<BoxComponentProps>({
|
|
52
60
|
displayName: 'VBox',
|
|
53
61
|
model: false,
|
|
@@ -64,6 +72,10 @@ export const [VBox, vbox] = hoistCmp.withFactory<BoxComponentProps>({
|
|
|
64
72
|
}
|
|
65
73
|
});
|
|
66
74
|
|
|
75
|
+
/**
|
|
76
|
+
* A {@link Box} with horizontal (row) flex layout. Does not stretch to fill its parent -
|
|
77
|
+
* use {@link HFrame} instead when the container should grow to consume available space.
|
|
78
|
+
*/
|
|
67
79
|
export const [HBox, hbox] = hoistCmp.withFactory<BoxComponentProps>({
|
|
68
80
|
displayName: 'HBox',
|
|
69
81
|
model: false,
|
package/cmp/layout/Frame.ts
CHANGED
|
@@ -7,15 +7,19 @@
|
|
|
7
7
|
import {hoistCmp, BoxProps, HoistProps} from '@xh/hoist/core';
|
|
8
8
|
import {box} from './Box';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Props for {@link Frame}, {@link VFrame}, and {@link HFrame} layout containers.
|
|
12
|
+
* Combines {@link HoistProps} with {@link BoxProps} (layout attributes resolved to CSS styles).
|
|
13
|
+
*/
|
|
10
14
|
export interface FrameProps extends HoistProps, BoxProps {}
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
|
-
* A Box
|
|
14
|
-
*
|
|
17
|
+
* A {@link Box} that stretches to fill its parent via `flex: auto`. Like Box, it supports
|
|
18
|
+
* all {@link LayoutProps} and merges them onto its rendered `div`.
|
|
15
19
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
20
|
+
* **Application code should generally prefer {@link VFrame} or {@link HFrame}**, which make
|
|
21
|
+
* layout direction explicit. Bare `frame()` inherits the CSS default direction (row) but does
|
|
22
|
+
* not communicate that intent clearly.
|
|
19
23
|
*/
|
|
20
24
|
export const [Frame, frame] = hoistCmp.withFactory<FrameProps>({
|
|
21
25
|
displayName: 'Frame',
|
|
@@ -28,6 +32,10 @@ export const [Frame, frame] = hoistCmp.withFactory<FrameProps>({
|
|
|
28
32
|
}
|
|
29
33
|
});
|
|
30
34
|
|
|
35
|
+
/**
|
|
36
|
+
* A {@link Frame} with vertical (column) flex layout. Stretches to fill its parent via
|
|
37
|
+
* `flex: auto` - use {@link VBox} instead when the container should size to its content.
|
|
38
|
+
*/
|
|
31
39
|
export const [VFrame, vframe] = hoistCmp.withFactory<FrameProps>({
|
|
32
40
|
displayName: 'VFrame',
|
|
33
41
|
model: false,
|
|
@@ -45,6 +53,10 @@ export const [VFrame, vframe] = hoistCmp.withFactory<FrameProps>({
|
|
|
45
53
|
}
|
|
46
54
|
});
|
|
47
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A {@link Frame} with horizontal (row) flex layout. Stretches to fill its parent via
|
|
58
|
+
* `flex: auto` - use {@link HBox} instead when the container should size to its content.
|
|
59
|
+
*/
|
|
48
60
|
export const [HFrame, hframe] = hoistCmp.withFactory<FrameProps>({
|
|
49
61
|
displayName: 'HFrame',
|
|
50
62
|
model: false,
|
package/cmp/layout/README.md
CHANGED
|
@@ -10,22 +10,16 @@ All layout components export both a React component (PascalCase) and an element
|
|
|
10
10
|
|
|
11
11
|
## Core Components
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### VBox / HBox / Box
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Flexbox containers with layout prop support.
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
// Generic flex container
|
|
21
|
-
box({
|
|
22
|
-
items: [header(), content(), footer()],
|
|
23
|
-
flexDirection: 'column',
|
|
24
|
-
padding: 10
|
|
25
|
-
})
|
|
18
|
+
import {vbox, hbox} from '@xh/hoist/cmp/layout';
|
|
26
19
|
|
|
27
20
|
// Vertical layout (column direction)
|
|
28
21
|
vbox({
|
|
22
|
+
padding: 10,
|
|
29
23
|
items: [header(), content(), footer()]
|
|
30
24
|
})
|
|
31
25
|
|
|
@@ -35,22 +29,20 @@ hbox({
|
|
|
35
29
|
})
|
|
36
30
|
```
|
|
37
31
|
|
|
38
|
-
**Box
|
|
32
|
+
**All Box variants provide:**
|
|
39
33
|
- `display: flex` with `overflow: hidden` and `position: relative`
|
|
40
|
-
- All flexbox layout props via the `BoxProps` interface
|
|
34
|
+
- All flexbox layout props via the `BoxProps` interface (see [Layout Props](#layout-props-boxprops))
|
|
41
35
|
- Pass-through of standard HTML div attributes
|
|
42
36
|
|
|
43
|
-
**
|
|
37
|
+
**Prefer `vbox` and `hbox`** over bare `box` — they make layout direction explicit. `box` applies
|
|
38
|
+
`display: flex` with the CSS default direction (row) but does not communicate that intent clearly.
|
|
44
39
|
|
|
45
|
-
###
|
|
40
|
+
### VFrame / HFrame / Frame
|
|
46
41
|
|
|
47
42
|
Flexing containers that stretch to fill their parent via `flex: auto`.
|
|
48
43
|
|
|
49
44
|
```typescript
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
// Generic frame
|
|
53
|
-
frame({item: content()})
|
|
45
|
+
import {vframe, hframe} from '@xh/hoist/cmp/layout';
|
|
54
46
|
|
|
55
47
|
// Vertical frame (stretches and arranges children vertically)
|
|
56
48
|
vframe({
|
|
@@ -63,9 +55,12 @@ hframe({
|
|
|
63
55
|
})
|
|
64
56
|
```
|
|
65
57
|
|
|
66
|
-
**Key difference from Box:** Frame adds `flex: auto`, making it stretch to consume
|
|
67
|
-
in its parent container. Use Frame for content areas that should grow;
|
|
68
|
-
explicit size control.
|
|
58
|
+
**Key difference from Box variants:** Frame adds `flex: auto`, making it stretch to consume
|
|
59
|
+
available space in its parent container. Use Frame variants for content areas that should grow;
|
|
60
|
+
use Box variants when you need explicit size control.
|
|
61
|
+
|
|
62
|
+
**Prefer `vframe` and `hframe`** over bare `frame` for the same reason as above — they make
|
|
63
|
+
layout direction explicit.
|
|
69
64
|
|
|
70
65
|
### Viewport
|
|
71
66
|
|