@xh/hoist 87.1.1 → 87.2.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.
- package/.npmignore +39 -0
- package/CHANGELOG.md +92 -20
- package/admin/AdminUtils.ts +64 -0
- package/admin/App.scss +88 -0
- package/admin/columns/UserData.ts +30 -3
- package/admin/detail/RestDetailModel.ts +64 -0
- package/admin/detail/RestDetailPanel.ts +106 -0
- package/admin/tabs/activity/tracking/ActivityTrackingModel.ts +27 -94
- package/admin/tabs/activity/tracking/ActivityTrackingPanel.ts +23 -60
- package/admin/tabs/activity/tracking/detail/ActivityDetailView.ts +1 -2
- package/admin/tabs/general/alertBanner/AlertBannerPanel.ts +2 -13
- package/admin/tabs/general/config/ConfigDetailPanel.ts +72 -0
- package/admin/tabs/general/config/ConfigPanel.ts +41 -53
- package/admin/tabs/general/config/ConfigPanelModel.ts +3 -0
- package/admin/tabs/general/config/ConfigValue.scss +14 -0
- package/admin/tabs/general/config/ConfigValue.ts +104 -65
- package/admin/tabs/userData/jsonblob/JsonBlobDetailPanel.ts +93 -0
- package/admin/tabs/userData/jsonblob/JsonBlobModel.ts +4 -0
- package/admin/tabs/userData/jsonblob/JsonBlobPanel.ts +2 -0
- package/admin/tabs/userData/prefs/UserPreferenceDetailPanel.ts +62 -0
- package/admin/tabs/userData/prefs/UserPreferenceModel.ts +10 -3
- package/admin/tabs/userData/prefs/UserPreferencePanel.ts +3 -1
- package/admin/tabs/userData/roles/details/RoleDetails.scss +2 -19
- package/admin/tabs/userData/roles/details/RoleDetails.ts +13 -13
- package/appcontainer/AboutDialogModel.ts +1 -0
- package/appcontainer/AppContainerModel.ts +3 -0
- package/appcontainer/AppStateModel.ts +1 -0
- package/appcontainer/BannerSourceModel.ts +1 -0
- package/appcontainer/ChangelogDialogModel.ts +1 -0
- package/appcontainer/ColChooserOptionsModel.ts +1 -0
- package/appcontainer/ExceptionDialogModel.ts +1 -0
- package/appcontainer/FeedbackDialogModel.ts +1 -0
- package/appcontainer/ImpersonationBarModel.ts +1 -0
- package/appcontainer/MessageSourceModel.ts +1 -0
- package/appcontainer/OptionsDialogModel.ts +1 -0
- package/appcontainer/PageStateModel.ts +1 -0
- package/appcontainer/RouterModel.ts +2 -0
- package/appcontainer/SizingModeModel.ts +1 -0
- package/appcontainer/ThemeModel.ts +1 -0
- package/appcontainer/ToastSourceModel.ts +1 -0
- package/appcontainer/UserAgentModel.ts +1 -0
- package/appcontainer/ViewportSizeModel.ts +1 -0
- package/build/types/admin/AdminUtils.d.ts +29 -0
- package/build/types/admin/columns/UserData.d.ts +3 -0
- package/build/types/admin/detail/RestDetailModel.d.ts +20 -0
- package/build/types/admin/detail/RestDetailPanel.d.ts +34 -0
- package/build/types/admin/tabs/activity/tracking/ActivityTrackingModel.d.ts +5 -17
- package/build/types/admin/tabs/general/config/ConfigDetailPanel.d.ts +7 -0
- package/build/types/admin/tabs/general/config/ConfigValue.d.ts +10 -4
- package/build/types/admin/tabs/userData/jsonblob/JsonBlobDetailPanel.d.ts +3 -0
- package/build/types/admin/tabs/userData/prefs/UserPreferenceDetailPanel.d.ts +3 -0
- package/build/types/admin/tabs/userData/prefs/UserPreferenceModel.d.ts +3 -0
- package/build/types/appcontainer/AboutDialogModel.d.ts +1 -0
- package/build/types/appcontainer/AppContainerModel.d.ts +1 -0
- package/build/types/appcontainer/AppStateModel.d.ts +1 -0
- package/build/types/appcontainer/BannerSourceModel.d.ts +1 -0
- package/build/types/appcontainer/ChangelogDialogModel.d.ts +1 -0
- package/build/types/appcontainer/ColChooserOptionsModel.d.ts +1 -0
- package/build/types/appcontainer/ExceptionDialogModel.d.ts +1 -0
- package/build/types/appcontainer/FeedbackDialogModel.d.ts +1 -0
- package/build/types/appcontainer/ImpersonationBarModel.d.ts +1 -0
- package/build/types/appcontainer/MessageSourceModel.d.ts +1 -0
- package/build/types/appcontainer/OptionsDialogModel.d.ts +1 -0
- package/build/types/appcontainer/PageStateModel.d.ts +1 -0
- package/build/types/appcontainer/RouterModel.d.ts +1 -0
- package/build/types/appcontainer/SizingModeModel.d.ts +1 -0
- package/build/types/appcontainer/ThemeModel.d.ts +1 -0
- package/build/types/appcontainer/ToastSourceModel.d.ts +1 -0
- package/build/types/appcontainer/UserAgentModel.d.ts +1 -0
- package/build/types/appcontainer/ViewportSizeModel.d.ts +1 -0
- package/build/types/cmp/ag-grid/AgGridModel.d.ts +3 -1
- package/build/types/cmp/card/Card.d.ts +2 -2
- package/build/types/cmp/chart/ChartModel.d.ts +2 -0
- package/build/types/cmp/dataview/DataViewModel.d.ts +2 -0
- package/build/types/cmp/daterange/DateRangePickerModel.d.ts +266 -0
- package/build/types/cmp/daterange/DateRangePresets.d.ts +26 -0
- package/build/types/cmp/daterange/DateRangeUtils.d.ts +96 -0
- package/build/types/cmp/daterange/Types.d.ts +152 -0
- package/build/types/cmp/daterange/index.d.ts +4 -0
- package/build/types/cmp/filter/FilterChooserModel.d.ts +3 -1
- package/build/types/cmp/form/FormModel.d.ts +3 -1
- package/build/types/cmp/grid/GridModel.d.ts +2 -0
- package/build/types/cmp/grid/Types.d.ts +2 -0
- package/build/types/cmp/grid/filter/GridFilterModel.d.ts +1 -1
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +3 -1
- package/build/types/cmp/input/HoistInputProps.d.ts +49 -2
- package/build/types/cmp/tab/TabContainerModel.d.ts +3 -1
- package/build/types/cmp/tab/TabModel.d.ts +3 -1
- package/build/types/cmp/treemap/TreeMapModel.d.ts +2 -0
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +2 -0
- package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +2 -0
- package/build/types/core/HoistBase.d.ts +7 -0
- package/build/types/core/HoistProps.d.ts +26 -1
- package/build/types/core/model/RootRefreshContextModel.d.ts +1 -0
- package/build/types/core/types/Telemetry.d.ts +1 -1
- package/build/types/data/Store.d.ts +3 -1
- package/build/types/data/StoreSelectionModel.d.ts +3 -1
- package/build/types/data/cube/Cube.d.ts +5 -2
- package/build/types/data/cube/View.d.ts +2 -0
- package/build/types/desktop/cmp/appOption/AutoRefreshAppOption.d.ts +3 -0
- package/build/types/desktop/cmp/appOption/ThemeAppOption.d.ts +3 -0
- package/build/types/desktop/cmp/button/Button.d.ts +2 -2
- package/build/types/desktop/cmp/button/ButtonGroup.d.ts +2 -2
- package/build/types/desktop/cmp/dash/DashConfig.d.ts +2 -0
- package/build/types/desktop/cmp/dash/DashViewModel.d.ts +3 -1
- package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +1 -1
- package/build/types/desktop/cmp/dash/container/DashContainerModel.d.ts +1 -1
- package/build/types/desktop/cmp/daterange/DateRangePicker.d.ts +66 -0
- package/build/types/desktop/cmp/daterange/impl/CustomTab.d.ts +3 -0
- package/build/types/desktop/cmp/daterange/impl/DateRangePickerLocalModel.d.ts +121 -0
- package/build/types/desktop/cmp/daterange/impl/PeriodTab.d.ts +2 -0
- package/build/types/desktop/cmp/daterange/impl/PresetsTab.d.ts +3 -0
- package/build/types/desktop/cmp/daterange/impl/RelativeTab.d.ts +3 -0
- package/build/types/desktop/cmp/daterange/impl/TabUtils.d.ts +21 -0
- package/build/types/desktop/cmp/daterange/index.d.ts +2 -0
- package/build/types/desktop/cmp/dock/DockContainerModel.d.ts +3 -1
- package/build/types/desktop/cmp/dock/DockViewModel.d.ts +3 -1
- package/build/types/desktop/cmp/grouping/GroupingChooser.d.ts +4 -1
- package/build/types/desktop/cmp/input/IntentInput.d.ts +38 -0
- package/build/types/desktop/cmp/input/NumberInput.d.ts +2 -2
- package/build/types/desktop/cmp/input/SegmentedControl.d.ts +25 -4
- package/build/types/desktop/cmp/input/TextArea.d.ts +2 -2
- package/build/types/desktop/cmp/input/TextInput.d.ts +2 -2
- package/build/types/desktop/cmp/input/index.d.ts +1 -0
- package/build/types/desktop/cmp/leftrightchooser/LeftRightChooserModel.d.ts +3 -1
- package/build/types/desktop/cmp/panel/PanelModel.d.ts +3 -1
- package/build/types/desktop/cmp/rest/RestGridModel.d.ts +1 -1
- package/build/types/desktop/cmp/tab/impl/TabContainer.d.ts +1 -1
- package/build/types/icon/Icon.d.ts +3 -0
- package/build/types/inspector/impl/InspectorUtils.d.ts +3 -0
- package/build/types/inspector/instances/InstancesModel.d.ts +4 -0
- package/build/types/kit/react-day-picker/index.d.ts +3 -3
- package/build/types/mobile/cmp/button/Button.d.ts +2 -2
- package/build/types/mobile/cmp/input/NumberInput.d.ts +2 -2
- package/build/types/mobile/cmp/input/SegmentedControl.d.ts +18 -4
- package/build/types/mobile/cmp/input/TextArea.d.ts +2 -2
- package/build/types/mobile/cmp/input/TextInput.d.ts +2 -2
- package/build/types/mobile/cmp/navigator/NavigatorModel.d.ts +3 -1
- package/build/types/mobile/cmp/navigator/PageModel.d.ts +3 -1
- package/build/types/mobile/cmp/tab/impl/TabContainer.d.ts +1 -1
- package/build/types/svc/InspectorService.d.ts +1 -0
- package/build/types/utils/js/LangUtils.d.ts +24 -5
- package/cmp/README.md +1 -0
- package/cmp/ag-grid/AgGridModel.ts +5 -0
- package/cmp/badge/Badge.ts +5 -3
- package/cmp/card/Card.ts +4 -3
- package/cmp/chart/ChartModel.ts +11 -1
- package/cmp/dataview/DataViewModel.ts +7 -1
- package/cmp/daterange/DateRangePickerModel.ts +628 -0
- package/cmp/daterange/DateRangePresets.ts +274 -0
- package/cmp/daterange/DateRangeUtils.ts +557 -0
- package/cmp/daterange/README.md +434 -0
- package/cmp/daterange/Types.ts +203 -0
- package/cmp/daterange/index.ts +10 -0
- package/cmp/filter/FilterChooserModel.ts +7 -4
- package/cmp/form/FormModel.ts +6 -0
- package/cmp/form/README.md +1 -0
- package/cmp/grid/GridModel.ts +24 -4
- package/cmp/grid/Types.ts +3 -0
- package/cmp/grid/filter/GridFilterModel.ts +3 -1
- package/cmp/grouping/GroupingChooserModel.ts +6 -1
- package/cmp/input/HoistInputProps.ts +50 -2
- package/cmp/input/README.md +42 -0
- package/cmp/layout/Box.ts +3 -2
- package/cmp/tab/TabContainerModel.ts +9 -1
- package/cmp/tab/TabModel.ts +5 -0
- package/cmp/treemap/SplitTreeMapModel.ts +12 -2
- package/cmp/treemap/TreeMapModel.ts +6 -1
- package/cmp/viewmanager/ViewManagerModel.ts +6 -1
- package/cmp/zoneGrid/ZoneGridModel.ts +7 -0
- package/core/HoistBase.ts +11 -0
- package/core/HoistProps.ts +27 -0
- package/core/README.md +46 -0
- package/core/impl/InstallServices.ts +5 -1
- package/core/model/RootRefreshContextModel.ts +2 -0
- package/core/types/Telemetry.ts +1 -1
- package/data/README.md +3 -1
- package/data/Store.ts +7 -0
- package/data/StoreSelectionModel.ts +5 -1
- package/data/cube/Cube.ts +12 -3
- package/data/cube/View.ts +5 -1
- package/desktop/README.md +2 -0
- package/desktop/appcontainer/LoginPanel.ts +2 -0
- package/desktop/cmp/button/Button.scss +71 -42
- package/desktop/cmp/button/Button.ts +10 -1
- package/desktop/cmp/button/ButtonGroup.ts +4 -1
- package/desktop/cmp/button/grid/ColChooserButton.ts +9 -1
- package/desktop/cmp/button/zoneGrid/ZoneMapperButton.ts +1 -0
- package/desktop/cmp/dash/DashConfig.ts +3 -0
- package/desktop/cmp/dash/DashViewModel.ts +14 -1
- package/desktop/cmp/dash/canvas/DashCanvasModel.ts +3 -1
- package/desktop/cmp/dash/container/DashContainerModel.ts +3 -1
- package/desktop/cmp/daterange/DateRangePicker.scss +577 -0
- package/desktop/cmp/daterange/DateRangePicker.ts +357 -0
- package/desktop/cmp/daterange/impl/CustomTab.ts +165 -0
- package/desktop/cmp/daterange/impl/DateRangePickerLocalModel.ts +482 -0
- package/desktop/cmp/daterange/impl/PeriodTab.ts +138 -0
- package/desktop/cmp/daterange/impl/PresetsTab.ts +58 -0
- package/desktop/cmp/daterange/impl/RelativeTab.ts +108 -0
- package/desktop/cmp/daterange/impl/TabUtils.ts +34 -0
- package/desktop/cmp/daterange/index.ts +8 -0
- package/desktop/cmp/dock/DockContainerModel.ts +6 -1
- package/desktop/cmp/dock/DockViewModel.ts +6 -1
- package/desktop/cmp/filechooser/FileChooser.ts +4 -0
- package/desktop/cmp/form/FormField.ts +1 -0
- package/desktop/cmp/grouping/GroupingChooser.ts +8 -2
- package/desktop/cmp/input/Checkbox.ts +1 -0
- package/desktop/cmp/input/CodeInput.ts +1 -0
- package/desktop/cmp/input/DateInput.scss +1 -1
- package/desktop/cmp/input/DateInput.ts +1 -0
- package/desktop/cmp/input/IntentInput.scss +202 -0
- package/desktop/cmp/input/IntentInput.ts +213 -0
- package/desktop/cmp/input/NumberInput.ts +11 -2
- package/desktop/cmp/input/Picker.ts +1 -0
- package/desktop/cmp/input/RadioInput.ts +2 -1
- package/desktop/cmp/input/SegmentedControl.scss +45 -2
- package/desktop/cmp/input/SegmentedControl.ts +66 -11
- package/desktop/cmp/input/Select.ts +9 -7
- package/desktop/cmp/input/Slider.ts +2 -0
- package/desktop/cmp/input/SwitchInput.ts +1 -0
- package/desktop/cmp/input/TextArea.ts +11 -2
- package/desktop/cmp/input/TextInput.ts +11 -2
- package/desktop/cmp/input/index.ts +1 -0
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +5 -0
- package/desktop/cmp/panel/Panel.ts +8 -5
- package/desktop/cmp/panel/PanelModel.ts +8 -0
- package/desktop/cmp/panel/impl/ResizeContainer.ts +2 -1
- package/desktop/cmp/rest/RestGridModel.ts +4 -0
- package/desktop/cmp/tab/impl/TabContainer.ts +2 -0
- package/docs/README.md +2 -0
- package/docs/build-and-publish.md +23 -7
- package/docs/doc-registry.json +8 -0
- package/docs/version-compatibility.md +2 -0
- package/icon/Icon.ts +9 -0
- package/icon/index.ts +24 -0
- package/inspector/README.md +8 -2
- package/inspector/impl/InspectorUtils.ts +12 -0
- package/inspector/instances/DiagnosticsModel.ts +3 -2
- package/inspector/instances/InstancesModel.ts +81 -14
- package/inspector/instances/InstancesPanel.ts +6 -0
- package/kit/react-day-picker/index.ts +3 -3
- package/mobile/appcontainer/LoginPanel.ts +2 -0
- package/mobile/cmp/button/Button.ts +16 -3
- package/mobile/cmp/form/FormField.ts +1 -0
- package/mobile/cmp/input/Checkbox.ts +1 -0
- package/mobile/cmp/input/DateInput.ts +1 -0
- package/mobile/cmp/input/Label.ts +13 -8
- package/mobile/cmp/input/NumberInput.ts +11 -2
- package/mobile/cmp/input/SearchInput.ts +1 -0
- package/mobile/cmp/input/SegmentedControl.scss +36 -6
- package/mobile/cmp/input/SegmentedControl.ts +37 -11
- package/mobile/cmp/input/Select.ts +2 -0
- package/mobile/cmp/input/SwitchInput.ts +1 -0
- package/mobile/cmp/input/TextArea.ts +11 -2
- package/mobile/cmp/input/TextInput.ts +11 -2
- package/mobile/cmp/navigator/NavigatorModel.ts +6 -1
- package/mobile/cmp/navigator/PageModel.ts +6 -1
- package/mobile/cmp/tab/impl/TabContainer.ts +9 -1
- package/package.json +19 -19
- package/styles/vars.scss +32 -2
- package/svc/InspectorService.ts +2 -0
- package/svc/TraceService.ts +5 -2
- package/utils/js/LangUtils.ts +37 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TestSupportProps } from '@xh/hoist/core';
|
|
2
|
-
export interface HoistInputProps extends TestSupportProps {
|
|
1
|
+
import { DomAttrsProps, TestSupportProps } from '@xh/hoist/core';
|
|
2
|
+
export interface HoistInputProps extends TestSupportProps, DomAttrsProps {
|
|
3
3
|
/**
|
|
4
4
|
* Field or model property name from which this component should read and write its value
|
|
5
5
|
* in controlled mode. Can be set by parent FormField.
|
|
@@ -18,3 +18,50 @@ export interface HoistInputProps extends TestSupportProps {
|
|
|
18
18
|
/** Value of the control, if provided directly. */
|
|
19
19
|
value?: any;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Props for text-like inputs that browser password managers may treat as credential fields.
|
|
23
|
+
*
|
|
24
|
+
* Extended by the inputs that render a free-text `<input>` or `<textarea>` - the elements password
|
|
25
|
+
* manager extensions scan. Controls that cannot present as a credential field (checkboxes, sliders,
|
|
26
|
+
* segmented controls, and similar) do not accept this prop.
|
|
27
|
+
*/
|
|
28
|
+
export interface PasswordManagerSupportProps {
|
|
29
|
+
/**
|
|
30
|
+
* True to allow browser password managers to offer autofill on this input. Defaults to false,
|
|
31
|
+
* suppressing them.
|
|
32
|
+
*
|
|
33
|
+
* Password managers flag any field that *looks* like a username, email, or password and offer
|
|
34
|
+
* a saved-login prompt, whether or not the field has anything to do with signing in. That is
|
|
35
|
+
* unwanted on the ordinary data-entry forms most Hoist applications are built from, so Hoist
|
|
36
|
+
* opts out by default - the same posture as {@link TextInputProps.autoComplete}, which defaults
|
|
37
|
+
* to 'off'. Note `autocomplete="off"` alone does not stop password managers, which have ignored
|
|
38
|
+
* it on login-like fields for years.
|
|
39
|
+
*
|
|
40
|
+
* Set true on genuine credential fields so users get real password manager support.
|
|
41
|
+
*/
|
|
42
|
+
enablePasswordManagers?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Vendor-specific attributes that tell a password manager to skip a field. Each manager checks its
|
|
46
|
+
* own attribute - there is no cross-vendor standard. Covers 1Password, LastPass, and Bitwarden.
|
|
47
|
+
*
|
|
48
|
+
* Frozen and module-level so it adds no per-render allocation.
|
|
49
|
+
*/
|
|
50
|
+
export declare const PW_MANAGER_IGNORE_ATTRS: Readonly<{
|
|
51
|
+
'data-1p-ignore': "true";
|
|
52
|
+
'data-lpignore': "true";
|
|
53
|
+
'data-bwignore': "true";
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Resolve the password manager attributes for an input, given its `enablePasswordManagers` prop.
|
|
57
|
+
* Spread onto the element rendering the native `<input>` / `<textarea>`, ahead of any `domAttrs`
|
|
58
|
+
* so an explicit caller attribute wins.
|
|
59
|
+
*
|
|
60
|
+
* Note these must be present in the DOM before a field is first focused - 1Password caches its
|
|
61
|
+
* assessment of a field on first interaction - so apply them during render, never in an effect.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getPasswordManagerAttrs(enablePasswordManagers: boolean): Readonly<{
|
|
64
|
+
'data-1p-ignore': "true";
|
|
65
|
+
'data-lpignore': "true";
|
|
66
|
+
'data-bwignore': "true";
|
|
67
|
+
}>;
|
|
@@ -57,6 +57,8 @@ export interface TabContainerConfig {
|
|
|
57
57
|
emptyText?: ReactNode;
|
|
58
58
|
/** @internal */
|
|
59
59
|
xhImpl?: boolean;
|
|
60
|
+
/** See {@link HoistBase.xhName}. */
|
|
61
|
+
xhName?: string;
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
64
|
* Model for a TabContainer, representing its layout/contents and the currently displayed Tab.
|
|
@@ -90,7 +92,7 @@ export declare class TabContainerModel extends HoistModel {
|
|
|
90
92
|
* @param config - TabContainer configuration.
|
|
91
93
|
* @param depth - Depth in hierarchy of nested TabContainerModels. Not for application use.
|
|
92
94
|
*/
|
|
93
|
-
constructor({ tabs, defaultTabId, route, track, renderMode, refreshMode, persistWith, emptyText, xhImpl, switcher }: TabContainerConfig, depth?: number);
|
|
95
|
+
constructor({ tabs, defaultTabId, route, track, renderMode, refreshMode, persistWith, emptyText, xhName, xhImpl, switcher }: TabContainerConfig, depth?: number);
|
|
94
96
|
/** Set/replace all tabs within the container. */
|
|
95
97
|
setTabs(tabs: Array<TabModel | TabConfig>): void;
|
|
96
98
|
/** Add a single tab to the container. */
|
|
@@ -44,6 +44,8 @@ export interface TabConfig {
|
|
|
44
44
|
omit?: Thunkable<boolean>;
|
|
45
45
|
/** @internal */
|
|
46
46
|
xhImpl?: boolean;
|
|
47
|
+
/** See {@link HoistBase.xhName}. */
|
|
48
|
+
xhName?: string;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Model for a Tab within a TabContainer. Specifies the actual content (child component) to be
|
|
@@ -68,7 +70,7 @@ export declare class TabModel extends HoistModel {
|
|
|
68
70
|
private _renderMode;
|
|
69
71
|
private _refreshMode;
|
|
70
72
|
get isTabModel(): boolean;
|
|
71
|
-
constructor({ id, title, icon, tooltip, disabled, excludeFromSwitcher, showRemoveAction, content, refreshMode, renderMode, xhImpl }: TabConfig, containerModel: TabContainerModel);
|
|
73
|
+
constructor({ id, title, icon, tooltip, disabled, excludeFromSwitcher, showRemoveAction, content, refreshMode, renderMode, xhName, xhImpl }: TabConfig, containerModel: TabContainerModel);
|
|
72
74
|
activate(): void;
|
|
73
75
|
get renderMode(): RenderMode;
|
|
74
76
|
get refreshMode(): RefreshMode;
|
|
@@ -60,6 +60,8 @@ export interface TreeMapConfig {
|
|
|
60
60
|
emptyText?: ReactNode;
|
|
61
61
|
/** Data filter to apply to records. */
|
|
62
62
|
filter?: FilterLike;
|
|
63
|
+
/** See {@link HoistBase.xhName}. */
|
|
64
|
+
xhName?: string;
|
|
63
65
|
}
|
|
64
66
|
export interface TreeMapModelDefaults {
|
|
65
67
|
algorithm?: TreeMapAlgorithm;
|
|
@@ -103,6 +103,8 @@ export interface ViewManagerConfig {
|
|
|
103
103
|
* ViewManager menu.
|
|
104
104
|
*/
|
|
105
105
|
viewMenuItemFn?: (view: ViewInfo, model: ViewManagerModel) => ReactNode;
|
|
106
|
+
/** See {@link HoistBase.xhName}. */
|
|
107
|
+
xhName?: string;
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* ViewManagerModel coordinates the loading, saving, and management of user-defined bundles of
|
|
@@ -198,6 +198,8 @@ export interface ZoneGridConfig {
|
|
|
198
198
|
appData?: PlainObject;
|
|
199
199
|
/** @internal */
|
|
200
200
|
xhImpl?: boolean;
|
|
201
|
+
/** See {@link HoistBase.xhName}. */
|
|
202
|
+
xhName?: string;
|
|
201
203
|
}
|
|
202
204
|
/**
|
|
203
205
|
* Model for a ZoneGrid - a card-style grid that renders each row as a full-width block
|
|
@@ -31,6 +31,11 @@ export declare abstract class HoistBase {
|
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
33
|
xhImpl: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Optional developer-facing name for this instance, shown in place of its class name in log
|
|
36
|
+
* output, telemetry, and the Inspector. Uniqueness is not enforced.
|
|
37
|
+
*/
|
|
38
|
+
xhName: string;
|
|
34
39
|
private managedInstances;
|
|
35
40
|
private disposers;
|
|
36
41
|
private _destroyed;
|
|
@@ -123,6 +128,8 @@ export declare abstract class HoistBase {
|
|
|
123
128
|
setBindable(property: string, value: any): void;
|
|
124
129
|
/** @returns a unique id for this object within the lifetime of this document. */
|
|
125
130
|
get xhId(): string;
|
|
131
|
+
/** Name for a child of this object - `{xhName}.{key}`, or null if this object is unnamed. */
|
|
132
|
+
childXhName(key: string): string;
|
|
126
133
|
/**
|
|
127
134
|
* Mark an object as managed by this object.
|
|
128
135
|
*
|
|
@@ -57,7 +57,7 @@ export interface DefaultHoistProps<M extends HoistModel = HoistModel> extends Ho
|
|
|
57
57
|
* @see Frame
|
|
58
58
|
* @see LayoutProps
|
|
59
59
|
*/
|
|
60
|
-
export interface BoxProps extends LayoutProps, TestSupportProps, Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'contextMenu'> {
|
|
60
|
+
export interface BoxProps extends LayoutProps, TestSupportProps, DomAttrsProps, Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'contextMenu'> {
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Props for Components that accept standard HTML `style` attributes.
|
|
@@ -78,6 +78,31 @@ export interface TestSupportProps {
|
|
|
78
78
|
*/
|
|
79
79
|
testId?: string;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Props to support applying arbitrary HTML attributes to the primary DOM element rendered by a
|
|
83
|
+
* component.
|
|
84
|
+
*
|
|
85
|
+
* Intended as an escape hatch for `data-*` and `aria-*` attributes that Hoist does not model with
|
|
86
|
+
* a dedicated prop - e.g. attributes read by analytics libraries, browser extensions, or
|
|
87
|
+
* third-party test tooling. Hoist components pick the props they pass to the elements they render,
|
|
88
|
+
* so attributes specified any other way are typically dropped and never reach the DOM.
|
|
89
|
+
*/
|
|
90
|
+
export interface DomAttrsProps {
|
|
91
|
+
/**
|
|
92
|
+
* Additional HTML attributes to apply to the primary DOM element rendered by this component -
|
|
93
|
+
* the same element that receives `data-testid` when {@link TestSupportProps.testId} is set.
|
|
94
|
+
*
|
|
95
|
+
* Keys are constrained to `data-*` and `aria-*` attributes, plus `role`, so this cannot be
|
|
96
|
+
* used to override attributes the component manages itself (`className`, `style`, `value`).
|
|
97
|
+
* Note the constraint applies to object literals only - a pre-built `Record<string, string>`
|
|
98
|
+
* will still assign, for the rare case that calls for an attribute outside this set. Take care
|
|
99
|
+
* there: precedence against component-managed attributes is not guaranteed and varies by
|
|
100
|
+
* component.
|
|
101
|
+
*/
|
|
102
|
+
domAttrs?: Record<`data-${string}` | `aria-${string}`, string | number | boolean> & {
|
|
103
|
+
role?: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
81
106
|
export interface LayoutProps {
|
|
82
107
|
margin?: string | number | boolean;
|
|
83
108
|
marginTop?: string | number | boolean;
|
|
@@ -10,5 +10,6 @@ import { RefreshContextModel } from './';
|
|
|
10
10
|
* The `XH.refreshAppAsync()` convenience method is the recommended entry-point for apps to call.
|
|
11
11
|
*/
|
|
12
12
|
export declare class RootRefreshContextModel extends RefreshContextModel {
|
|
13
|
+
xhName: string;
|
|
13
14
|
doLoadAsync(loadSpec: LoadSpec): Promise<void>;
|
|
14
15
|
}
|
|
@@ -66,7 +66,7 @@ export interface FullSpanConfig extends SpanConfig {
|
|
|
66
66
|
* the span was constructed - e.g. timing an event whose timestamp is known.
|
|
67
67
|
*/
|
|
68
68
|
startTime?: number;
|
|
69
|
-
/**
|
|
69
|
+
/** Usually the calling object/function - source of the `code.namespace` and `xh.name` tags. */
|
|
70
70
|
caller?: NameSource;
|
|
71
71
|
}
|
|
72
72
|
/** Key/value tags attached to a metric recorded via {@link MetricsService}. */
|
|
@@ -161,6 +161,8 @@ export interface StoreConfig {
|
|
|
161
161
|
* it may also be changed on an existing Store at any time.
|
|
162
162
|
*/
|
|
163
163
|
experimental?: PlainObject;
|
|
164
|
+
/** See {@link HoistBase.xhName}. */
|
|
165
|
+
xhName?: string;
|
|
164
166
|
}
|
|
165
167
|
/**
|
|
166
168
|
* App-wide defaults for {@link Store}, applied to every Store constructed without an explicit
|
|
@@ -300,7 +302,7 @@ export declare class Store extends HoistBase implements FilterBindTarget, Filter
|
|
|
300
302
|
experimental: any;
|
|
301
303
|
/** @internal */
|
|
302
304
|
readonly diagnostics: StoreDiagnostics;
|
|
303
|
-
constructor({ fields, fieldDefaults, idSpec, processRawData, filter, filterIncludesChildren, loadTreeData, loadTreeDataFrom, loadRootAsSummary, freezeData, idEncodesTreePath, digestSpec, retainRaw, projectionOnly, validationIsComplex, experimental, data }: StoreConfig);
|
|
305
|
+
constructor({ fields, fieldDefaults, idSpec, processRawData, filter, filterIncludesChildren, loadTreeData, loadTreeDataFrom, loadRootAsSummary, freezeData, idEncodesTreePath, digestSpec, retainRaw, projectionOnly, validationIsComplex, experimental, xhName, data }: StoreConfig);
|
|
304
306
|
/** See {@link StoreConfig.digestSpec} - settable, taking effect on the next load. */
|
|
305
307
|
get digestSpec(): StoreRecordDigestSpec;
|
|
306
308
|
set digestSpec(spec: StoreRecordDigestSpec);
|
|
@@ -12,6 +12,8 @@ export interface StoreSelectionConfig {
|
|
|
12
12
|
mode?: 'single' | 'multiple' | 'disabled';
|
|
13
13
|
/** @internal */
|
|
14
14
|
xhImpl?: boolean;
|
|
15
|
+
/** See {@link HoistBase.xhName}. */
|
|
16
|
+
xhName?: string;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Model for managing record selection within a {@link Store}. Supports `single`, `multiple`,
|
|
@@ -33,7 +35,7 @@ export declare class StoreSelectionModel extends HoistModel {
|
|
|
33
35
|
mode: 'single' | 'multiple' | 'disabled';
|
|
34
36
|
private _ids;
|
|
35
37
|
get isEnabled(): boolean;
|
|
36
|
-
constructor({ store, mode, xhImpl }: StoreSelectionConfig);
|
|
38
|
+
constructor({ store, mode, xhName, xhImpl }: StoreSelectionConfig);
|
|
37
39
|
get selectedRecords(): StoreRecord[];
|
|
38
40
|
get selectedIds(): StoreRecordId[];
|
|
39
41
|
/**
|
|
@@ -54,6 +54,8 @@ export interface CubeConfig {
|
|
|
54
54
|
* Return true to omit the row.
|
|
55
55
|
*/
|
|
56
56
|
omitFn?: OmitFn;
|
|
57
|
+
/** See {@link HoistBase.xhName}. */
|
|
58
|
+
xhName?: string;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
* Configs available for a {@link Cube}'s internal {@link Store}, via {@link CubeConfig.store}.
|
|
@@ -127,7 +129,7 @@ export declare class Cube extends HoistBase {
|
|
|
127
129
|
omitFn: OmitFn;
|
|
128
130
|
info: any;
|
|
129
131
|
_connectedViews: Set<View>;
|
|
130
|
-
constructor({ fields, fieldDefaults, data, idSpec, processRawData, store, info, lockFn, bucketSpecFn, omitFn }: CubeConfig);
|
|
132
|
+
constructor({ fields, fieldDefaults, data, idSpec, processRawData, store, info, lockFn, bucketSpecFn, omitFn, xhName }: CubeConfig);
|
|
131
133
|
/** Fields configured for this Cube. */
|
|
132
134
|
get fields(): CubeField[];
|
|
133
135
|
/** Dimension Fields configured for this Cube. */
|
|
@@ -167,10 +169,11 @@ export declare class Cube extends HoistBase {
|
|
|
167
169
|
* @param stores - Stores to be automatically loaded/reloaded with View results.
|
|
168
170
|
* @param connect - true to update View automatically when data in the underlying Cube changes.
|
|
169
171
|
*/
|
|
170
|
-
createView({ query, stores, connect }: {
|
|
172
|
+
createView({ query, stores, connect, xhName }: {
|
|
171
173
|
query: QueryConfig;
|
|
172
174
|
stores?: Store[] | Store;
|
|
173
175
|
connect?: boolean;
|
|
176
|
+
xhName?: string;
|
|
174
177
|
}): View;
|
|
175
178
|
/** True if the provided view is connected to this Cube for live updates. */
|
|
176
179
|
viewIsConnected(view: View): boolean;
|
|
@@ -73,6 +73,9 @@ export declare const autoRefreshAppOption: ({ formFieldProps, inputProps }?: Aut
|
|
|
73
73
|
position?: import("csstype").Property.Position;
|
|
74
74
|
display?: string;
|
|
75
75
|
testId?: string;
|
|
76
|
+
domAttrs?: Record<`data-${string}` | `aria-${string}`, string | number | boolean> & {
|
|
77
|
+
role?: string;
|
|
78
|
+
};
|
|
76
79
|
slot?: string | undefined;
|
|
77
80
|
style?: import("react").CSSProperties | undefined;
|
|
78
81
|
title?: string | undefined;
|
|
@@ -71,6 +71,9 @@ export declare const themeAppOption: ({ formFieldProps, inputProps }?: ThemeAppO
|
|
|
71
71
|
position?: import("csstype").Property.Position;
|
|
72
72
|
display?: string;
|
|
73
73
|
testId?: string;
|
|
74
|
+
domAttrs?: Record<`data-${string}` | `aria-${string}`, string | number | boolean> & {
|
|
75
|
+
role?: string;
|
|
76
|
+
};
|
|
74
77
|
slot?: string | undefined;
|
|
75
78
|
style?: import("react").CSSProperties | undefined;
|
|
76
79
|
title?: string | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ButtonProps as BpButtonProps } from '@blueprintjs/core';
|
|
2
|
-
import { HoistModel, HoistProps, Intent, LayoutProps, StyleProps, TestSupportProps } from '@xh/hoist/core';
|
|
2
|
+
import { DomAttrsProps, HoistModel, HoistProps, Intent, LayoutProps, StyleProps, TestSupportProps } from '@xh/hoist/core';
|
|
3
3
|
import '@xh/hoist/desktop/register';
|
|
4
4
|
import { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import './Button.scss';
|
|
6
|
-
export interface ButtonProps<M extends HoistModel = null> extends HoistProps<M>, StyleProps, LayoutProps, TestSupportProps, Omit<BpButtonProps, 'ref'> {
|
|
6
|
+
export interface ButtonProps<M extends HoistModel = null> extends HoistProps<M>, StyleProps, LayoutProps, TestSupportProps, DomAttrsProps, Omit<BpButtonProps, 'ref'> {
|
|
7
7
|
active?: boolean;
|
|
8
8
|
autoFocus?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ButtonGroupProps as BpButtonGroupProps } from '@blueprintjs/core';
|
|
2
|
-
import { HoistModel, HoistProps, LayoutProps, StyleProps, TestSupportProps } from '@xh/hoist/core';
|
|
2
|
+
import { DomAttrsProps, HoistModel, HoistProps, LayoutProps, StyleProps, TestSupportProps } from '@xh/hoist/core';
|
|
3
3
|
import '@xh/hoist/desktop/register';
|
|
4
4
|
import { SetOptional } from 'type-fest';
|
|
5
|
-
export interface ButtonGroupProps<M extends HoistModel = null> extends HoistProps<M>, LayoutProps, StyleProps, TestSupportProps, SetOptional<Omit<BpButtonGroupProps, 'ref'>, 'children'> {
|
|
5
|
+
export interface ButtonGroupProps<M extends HoistModel = null> extends HoistProps<M>, LayoutProps, StyleProps, TestSupportProps, DomAttrsProps, SetOptional<Omit<BpButtonGroupProps, 'ref'>, 'children'> {
|
|
6
6
|
/** True to have all buttons fill available width equally. */
|
|
7
7
|
fill?: boolean;
|
|
8
8
|
/** True to render each button with minimal surrounding chrome (default false). */
|
|
@@ -48,7 +48,7 @@ export declare abstract class DashViewModel<T extends DashViewSpec = DashViewSpe
|
|
|
48
48
|
private providers;
|
|
49
49
|
get renderMode(): RenderMode;
|
|
50
50
|
get refreshMode(): RefreshMode;
|
|
51
|
-
constructor({ id, viewSpec, icon, title, viewState, containerModel }: DashViewConfig<T>);
|
|
51
|
+
constructor({ id, viewSpec, icon, title, viewState, containerModel, xhName }: DashViewConfig<T>);
|
|
52
52
|
/**
|
|
53
53
|
* Modify the viewState of this model. This will push the new state to all registered
|
|
54
54
|
* {@link DashViewProvider} instances.
|
|
@@ -78,4 +78,6 @@ export interface DashViewConfig<T extends DashViewSpec = DashViewSpec> {
|
|
|
78
78
|
title?: string;
|
|
79
79
|
viewState?: DashViewState;
|
|
80
80
|
containerModel?: any;
|
|
81
|
+
/** See {@link HoistBase.xhName}. */
|
|
82
|
+
xhName?: string;
|
|
81
83
|
}
|
|
@@ -108,7 +108,7 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
|
|
|
108
108
|
isResizing: boolean;
|
|
109
109
|
private _onDropDragOverFn;
|
|
110
110
|
get rglLayout(): any[];
|
|
111
|
-
constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems, showGridBackground, showAddViewButtonWhenEmpty, allowsDrop, onDropDone, onDropDragOver }: DashCanvasConfig);
|
|
111
|
+
constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems, showGridBackground, showAddViewButtonWhenEmpty, allowsDrop, onDropDone, onDropDragOver, xhName }: DashCanvasConfig);
|
|
112
112
|
/** Remove all views from the canvas. */
|
|
113
113
|
clear(): void;
|
|
114
114
|
/**
|
|
@@ -113,7 +113,7 @@ export declare class DashContainerModel extends DashModel<DashContainerViewSpec,
|
|
|
113
113
|
containerRef: import("react").RefObject<HTMLElement> & import("react").RefCallback<HTMLElement>;
|
|
114
114
|
loadingStateTask: TaskObserver;
|
|
115
115
|
private isDestroyingGoldenLayout;
|
|
116
|
-
constructor({ viewSpecs, viewSpecDefaults, initialState, renderMode, refreshMode, layoutLocked, contentLocked, renameLocked, showMenuButton, margin, goldenLayoutSettings, persistWith, emptyText, addViewButtonText, extraMenuItems }: DashContainerConfig);
|
|
116
|
+
constructor({ viewSpecs, viewSpecDefaults, initialState, renderMode, refreshMode, layoutLocked, contentLocked, renameLocked, showMenuButton, margin, goldenLayoutSettings, persistWith, emptyText, addViewButtonText, extraMenuItems, xhName }: DashContainerConfig);
|
|
117
117
|
/**
|
|
118
118
|
* Remove all views from the container.
|
|
119
119
|
*
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DateRangePickerModel } from '@xh/hoist/cmp/daterange';
|
|
2
|
+
import { type HoistProps, type Intent, type LayoutProps, type TestSupportProps } from '@xh/hoist/core';
|
|
3
|
+
import { type ButtonProps } from '@xh/hoist/desktop/cmp/button';
|
|
4
|
+
import '@xh/hoist/desktop/register';
|
|
5
|
+
import type { PopoverPosition } from '@blueprintjs/core';
|
|
6
|
+
import type { ReactNode } from 'react';
|
|
7
|
+
import './DateRangePicker.scss';
|
|
8
|
+
export interface DateRangePickerProps extends HoistProps<DateRangePickerModel>, LayoutProps, TestSupportProps {
|
|
9
|
+
/**
|
|
10
|
+
* Props forwarded to the trigger button - use to customize its `icon`, `intent`, `minimal`,
|
|
11
|
+
* `outlined`, `tooltip`, or any other {@link ButtonProps}.
|
|
12
|
+
*/
|
|
13
|
+
buttonProps?: Partial<ButtonProps>;
|
|
14
|
+
/**
|
|
15
|
+
* Text rendered in the popover footer, or null to suppress. Default is a note on the date that
|
|
16
|
+
* periods are relative to. Not shown by a single-tab picker, whose footer carries the resolved
|
|
17
|
+
* dates instead.
|
|
18
|
+
*/
|
|
19
|
+
footerNote?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Intent for the popover's selection accent - the highlight on selected presets, months,
|
|
22
|
+
* and calendar days, and the Apply button. Also applied to the trigger button unless
|
|
23
|
+
* overridden via `buttonProps`. Default: the primary intent for the accent, none for the
|
|
24
|
+
* trigger.
|
|
25
|
+
*/
|
|
26
|
+
intent?: Intent;
|
|
27
|
+
/**
|
|
28
|
+
* Placement of the popover relative to the trigger. Default 'bottom-left', which flips to
|
|
29
|
+
* 'top-left' when there is no room below - e.g. from a bottom toolbar - and holds the popover's
|
|
30
|
+
* left edge to the trigger as the trigger's label changes width.
|
|
31
|
+
*/
|
|
32
|
+
popoverPosition?: PopoverPosition;
|
|
33
|
+
/**
|
|
34
|
+
* True (default) to show the resolved dates beside the period label on the trigger. The dates
|
|
35
|
+
* are also dropped automatically when a stretched trigger (e.g. `flex: 1` within a narrow
|
|
36
|
+
* dashboard widget) measures too narrow to fit them - either way, they remain available via
|
|
37
|
+
* the trigger's tooltip.
|
|
38
|
+
*/
|
|
39
|
+
showRange?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* True to flank the trigger with previous/next buttons that move the applied range by its own
|
|
42
|
+
* length - see {@link DateRangePickerModel.stepRange}. Default false.
|
|
43
|
+
*/
|
|
44
|
+
showStepButtons?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* True (default) to style trigger button background and borders to match inputs. Set to
|
|
47
|
+
* false to render an outlined button instead.
|
|
48
|
+
*/
|
|
49
|
+
styleButtonAsInput?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A dropdown control for selecting a period of time - one compact trigger that can express
|
|
53
|
+
* presets (e.g. MTD, Prev 30 Days), relative lookbacks, calendar months, quarters and years, and
|
|
54
|
+
* custom ranges of dates.
|
|
55
|
+
*
|
|
56
|
+
* The trigger shows the applied period's label with its resolved dates, and opens a popover with a
|
|
57
|
+
* tab for each of those selection shapes. The backing {@link DateRangePickerModel}'s `tabs` config
|
|
58
|
+
* selects which tabs show. Preset and period picks commit on click. Relative and custom picks are
|
|
59
|
+
* drafts until Apply, held in a local model that never touches the applied value.
|
|
60
|
+
*
|
|
61
|
+
* App code constructs and persists the {@link DateRangePickerModel}, which owns the applied value
|
|
62
|
+
* and the ranges and filters it resolves to - see that class for the full API.
|
|
63
|
+
*
|
|
64
|
+
* @see DateRangePickerModel
|
|
65
|
+
*/
|
|
66
|
+
export declare const DateRangePicker: import("react").FC<DateRangePickerProps>, dateRangePicker: import("@xh/hoist/core").ElementFactory<DateRangePickerProps>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DateRangePickerLocalModel } from './DateRangePickerLocalModel';
|
|
2
|
+
/** Custom tab - start and end inputs over a two-month calendar, drafted until applied. */
|
|
3
|
+
export declare const customTab: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<DateRangePickerLocalModel>>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { TabContainerModel } from '@xh/hoist/cmp/tab';
|
|
2
|
+
import { HoistModel, type Intent } from '@xh/hoist/core';
|
|
3
|
+
import type { LocalDate } from '@xh/hoist/utils/datetime';
|
|
4
|
+
import { type ReactElement } from 'react';
|
|
5
|
+
import { DateRangePickerModel, type DateRangePickerTab, type DateRangeSelection, type DateRangeUnit, type LocalDateRange } from '@xh/hoist/cmp/daterange';
|
|
6
|
+
/**
|
|
7
|
+
* A tab within the picker popover - its rail entry and its content component. Declared by the
|
|
8
|
+
* platform component alongside its tab components and passed in, keeping this model free of any
|
|
9
|
+
* dependency on them.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface DateRangePickerTabSpec {
|
|
14
|
+
id: DateRangePickerTab;
|
|
15
|
+
title: string;
|
|
16
|
+
icon: ReactElement;
|
|
17
|
+
content: (props: {
|
|
18
|
+
model: DateRangePickerLocalModel;
|
|
19
|
+
testId: string;
|
|
20
|
+
}) => ReactElement;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Local model for DateRangePicker components. Holds popover-local view state - open state, the
|
|
24
|
+
* active tab, and per-tab drafts - that must be per-component-instance, even when multiple
|
|
25
|
+
* pickers share one DateRangePickerModel. Drafts never touch the parent model's applied value
|
|
26
|
+
* until committed, so Cancel / click-outside / Escape discard them for free.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare class DateRangePickerLocalModel extends HoistModel {
|
|
31
|
+
xhImpl: boolean;
|
|
32
|
+
parentModel: DateRangePickerModel;
|
|
33
|
+
isOpen: boolean;
|
|
34
|
+
/** Drives the popover's tab rail + content. Tab ids are {@link DateRangePickerTab} values. */
|
|
35
|
+
tabModel: TabContainerModel;
|
|
36
|
+
/** testId of the host picker - tabs derive their own testIds from it. */
|
|
37
|
+
testId: string;
|
|
38
|
+
/** Measured width of the whole control - drives the compact variant in a narrow host. */
|
|
39
|
+
measuredWidth: number;
|
|
40
|
+
/** Intent of the host picker as of its last render - accents selected months and years. */
|
|
41
|
+
intent: Intent;
|
|
42
|
+
/** Root element of this instance - scopes popover outside-click handling to this picker. */
|
|
43
|
+
viewRef: import("react").RefObject<HTMLDivElement>;
|
|
44
|
+
relativeCount: number;
|
|
45
|
+
relativeUnit: DateRangeUnit;
|
|
46
|
+
relativeSnap: boolean;
|
|
47
|
+
gridYear: number;
|
|
48
|
+
customStart: LocalDate;
|
|
49
|
+
customEnd: LocalDate;
|
|
50
|
+
nextEdge: 'start' | 'end';
|
|
51
|
+
/** Start-of-month for the left-hand calendar. Right-hand shows the following month. */
|
|
52
|
+
leftMonth: LocalDate;
|
|
53
|
+
private tabSpecs;
|
|
54
|
+
private openTabId;
|
|
55
|
+
private seededRelativeDraft;
|
|
56
|
+
private seededCustomDraft;
|
|
57
|
+
get anchorDate(): LocalDate;
|
|
58
|
+
get minDate(): LocalDate | null;
|
|
59
|
+
get maxDate(): LocalDate;
|
|
60
|
+
get singleTab(): boolean;
|
|
61
|
+
get activeTabId(): DateRangePickerTab;
|
|
62
|
+
get clampedCount(): number;
|
|
63
|
+
get relativeDraft(): DateRangeSelection;
|
|
64
|
+
get relativeRange(): LocalDateRange;
|
|
65
|
+
get relativeDayCount(): number;
|
|
66
|
+
/**
|
|
67
|
+
* False for days, where a day is already a calendar boundary - snapping has nothing to round
|
|
68
|
+
* out, so days resolve identically either way.
|
|
69
|
+
*/
|
|
70
|
+
get snapApplies(): boolean;
|
|
71
|
+
/** Explains the Relative tab's snap choice, or the day window when snap does not apply. */
|
|
72
|
+
get relativeModeHelpText(): string;
|
|
73
|
+
/** Secondary line for the Relative tab's preview - the window's length. */
|
|
74
|
+
get relativePreviewCountText(): string;
|
|
75
|
+
get canYearBack(): boolean;
|
|
76
|
+
get canYearForward(): boolean;
|
|
77
|
+
isMonthDisabled(month: number): boolean;
|
|
78
|
+
isQuarterDisabled(quarter: number): boolean;
|
|
79
|
+
get yearSelectable(): boolean;
|
|
80
|
+
/** The Custom tab's draft, or null before the first open seeds it. */
|
|
81
|
+
get customDraft(): DateRangeSelection;
|
|
82
|
+
get rightMonth(): LocalDate;
|
|
83
|
+
get canCalBack(): boolean;
|
|
84
|
+
get canCalForward(): boolean;
|
|
85
|
+
isDayDisabled(day: LocalDate): boolean;
|
|
86
|
+
/** True when the active tab holds a draft to apply - preset and period picks commit on click. */
|
|
87
|
+
get applyEnabled(): boolean;
|
|
88
|
+
/** True to offer Apply and Cancel - drafts wait for Apply rather than committing on change. */
|
|
89
|
+
get showApplyControls(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Default footer note, as a prose prefix plus the date for the component to set apart. A live
|
|
92
|
+
* anchor names its clock, so a user whose day differs from the app's sees why. A pinned or
|
|
93
|
+
* computed anchor is just its date.
|
|
94
|
+
*/
|
|
95
|
+
get anchorNote(): {
|
|
96
|
+
prefix: string;
|
|
97
|
+
date: string;
|
|
98
|
+
};
|
|
99
|
+
private get anchorNoun();
|
|
100
|
+
constructor(testId: string, tabSpecs: DateRangePickerTabSpec[]);
|
|
101
|
+
onLinked(): void;
|
|
102
|
+
toggleOpen(): void;
|
|
103
|
+
open(): void;
|
|
104
|
+
close(): void;
|
|
105
|
+
commit(value: DateRangeSelection): void;
|
|
106
|
+
/** Commit the active tab's draft - a no-op on tabs whose picks commit on click. */
|
|
107
|
+
apply(): void;
|
|
108
|
+
stepCount(delta: number): void;
|
|
109
|
+
stepYear(delta: number): void;
|
|
110
|
+
stepCalendar(delta: number): void;
|
|
111
|
+
pickDay(day: LocalDate): void;
|
|
112
|
+
commitStartInput(val: LocalDate): void;
|
|
113
|
+
commitEndInput(val: LocalDate): void;
|
|
114
|
+
/** Tab configs in the order the app configured them - the model's `tabs` sets the order. */
|
|
115
|
+
private buildTabs;
|
|
116
|
+
private commitDraftIfLive;
|
|
117
|
+
/** Position the calendars so `date`'s month shows on the left, right within maxDate. */
|
|
118
|
+
private showMonthOnLeft;
|
|
119
|
+
/** Position the calendars so `date`'s month shows on the right, clamped to maxDate. */
|
|
120
|
+
private showMonthOnRight;
|
|
121
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DateRangePickerLocalModel } from './DateRangePickerLocalModel';
|
|
2
|
+
/** Presets tab - one row per configured preset, committing on click. */
|
|
3
|
+
export declare const presetsTab: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<DateRangePickerLocalModel>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DateRangePickerLocalModel } from './DateRangePickerLocalModel';
|
|
2
|
+
/** Relative tab - a lookback of N units ending on the anchor date, drafted until applied. */
|
|
3
|
+
export declare const relativeTab: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<DateRangePickerLocalModel>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
export declare const sectionHeader: (text: string) => import("react").ReactElement<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any>;
|
|
3
|
+
/** Props making a styled div act as a keyboard-accessible button. Pass null to disable. */
|
|
4
|
+
export declare const clickable: (onClick: () => void) => {
|
|
5
|
+
role: string;
|
|
6
|
+
tabIndex: number;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
9
|
+
'aria-disabled'?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
role: string;
|
|
12
|
+
'aria-disabled': boolean;
|
|
13
|
+
tabIndex?: undefined;
|
|
14
|
+
onClick?: undefined;
|
|
15
|
+
onKeyDown?: undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Spread arbitrary `data-*` attributes onto a plain element spec. Needed only for attributes
|
|
19
|
+
* `ElementSpec` does not declare - `data-testid` is declared, so pass that as `[TEST_ID]` directly.
|
|
20
|
+
*/
|
|
21
|
+
export declare const dataAttrs: (attrs: Record<string, string>) => object;
|
|
@@ -10,6 +10,8 @@ interface DockContainerConfig {
|
|
|
10
10
|
renderMode?: RenderMode;
|
|
11
11
|
/** Strategy for refreshing DockViews. Can also be set per-view via `DockViewModelConfig.refreshMode` */
|
|
12
12
|
refreshMode?: RefreshMode;
|
|
13
|
+
/** See {@link HoistBase.xhName}. */
|
|
14
|
+
xhName?: string;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Model for a DockContainer, representing its contents.
|
|
@@ -22,7 +24,7 @@ export declare class DockContainerModel extends HoistModel {
|
|
|
22
24
|
direction: DockViewDirection;
|
|
23
25
|
renderMode: RenderMode;
|
|
24
26
|
refreshMode: RefreshMode;
|
|
25
|
-
constructor({ views, direction, renderMode, refreshMode }?: DockContainerConfig);
|
|
27
|
+
constructor({ views, direction, renderMode, refreshMode, xhName }?: DockContainerConfig);
|
|
26
28
|
getView(id: string): DockViewModel;
|
|
27
29
|
addView(cfg: DockViewConfig): void;
|
|
28
30
|
removeView(id: string): void;
|