Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type improvements #724

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions client-app/src/admin/tests/cube/dimensions/DimensionManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {grid} from '@xh/hoist/cmp/grid';
import {filler} from '@xh/hoist/cmp/layout';
import {hoistCmp, useLocalModel, uses} from '@xh/hoist/core';
import {hoistCmp, HoistProps, useLocalModel, uses, WithoutModelAndRef} from '@xh/hoist/core';
import {groupingChooser} from '@xh/hoist/desktop/cmp/grouping';
import {panel, PanelModel} from '@xh/hoist/desktop/cmp/panel';
import {panel, PanelModel, PanelProps} from '@xh/hoist/desktop/cmp/panel';
import {Icon} from '@xh/hoist/icon/Icon';
import {DimensionManagerModel} from './DimensionManagerModel';

Expand All @@ -14,7 +14,11 @@ import {DimensionManagerModel} from './DimensionManagerModel';
* This component and its backing model are incubating in Toolbox for possible inclusion in
* the core Hoist toolkit in some form.
*/
export const dimensionManager = hoistCmp.factory({
export interface DimensionManagerProps
extends HoistProps<DimensionManagerModel>,
WithoutModelAndRef<PanelProps> {}

export const dimensionManager = hoistCmp.factory<DimensionManagerProps>({
displayName: 'DimensionManager',
model: uses(DimensionManagerModel),
className: 'xh-dim-manager',
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/admin/tests/grids/GridTestPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const tbar = hoistCmp.factory<GridTestModel>(({model}) =>
toolbarSep(),
refreshButton({
text: 'Load Grid',
model
target: model
}),
button({
text: 'Clear Grid',
Expand Down
8 changes: 6 additions & 2 deletions client-app/src/core/cmp/WelcomeMsg.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import {hoistCmp, XH} from '@xh/hoist/core';
import {hoistCmp, HoistProps, XH} from '@xh/hoist/core';
import {div, img, br} from '@xh/hoist/cmp/layout';
import './WelcomeMsg.scss';

export const welcomeMsg = hoistCmp.factory(({multiline}) => {
interface WelcomeMsgProps extends HoistProps {
multiline?: boolean;
}

export const welcomeMsg = hoistCmp.factory<WelcomeMsgProps>(({multiline}) => {
const user = XH.getUser();
return div({
className: `tb-welcome-message ${multiline ? 'tb-welcome-message--multiline' : ''}`,
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/common/grid/SampleTreeGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const [SampleTreeGrid, sampleTreeGrid] = hoistCmp.withFactory({
item: hframe(grid(), gridOptionsPanel({model: gridModel})),
ref: model.panelRef,
tbar: [
refreshButton({model}),
refreshButton({target: model}),
toolbarSep(),
groupingChooser(),
filler(),
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/common/grid/SampleTreeGridModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SampleTreeGridModel extends HoistModel {
@managed
gridModel: GridModel;

panelRef = createRef<HTMLElement>();
panelRef = createRef<HTMLDivElement>();

get store() {
return this.gridModel.store;
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/tabs/grids/DataViewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const dataViewPanel = hoistCmp.factory({
bbar: [
refreshButton({
text: 'Load new (random) records',
model
target: model
}),
filler(),
storeFilterField({store: model.dataViewModel.store})
Expand Down
5 changes: 3 additions & 2 deletions client-app/src/desktop/tabs/layout/widgets/ChartWidget.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {creates, hoistCmp, lookup, managed} from '@xh/hoist/core';
import {creates, hoistCmp, HoistPropsWithModel, lookup, managed} from '@xh/hoist/core';
import {box} from '@xh/hoist/cmp/layout';
import {panel, PanelModel} from '@xh/hoist/desktop/cmp/panel';
import {buttonGroupInput, select} from '@xh/hoist/desktop/cmp/input';
Expand Down Expand Up @@ -37,8 +37,9 @@ export const chartWidget = hoistCmp.factory({
}
});

const rangeSelector = hoistCmp.factory(() =>
const rangeSelector = hoistCmp.factory<HoistPropsWithModel>(({model}) =>
buttonGroupInput({
model,
bind: 'range',
items: [
button({text: '7D', value: 7}),
Expand Down
4 changes: 2 additions & 2 deletions client-app/src/desktop/tabs/panels/BasicPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {ReactElement} from 'react';
import {creates, hoistCmp, XH} from '@xh/hoist/core';
import {div, filler, p} from '@xh/hoist/cmp/layout';
import {menu, menuDivider, menuItem, popover} from '@xh/hoist/kit/blueprint';
Expand Down Expand Up @@ -99,7 +99,7 @@ export const basicPanel = hoistCmp.factory({
menuItem({text: 'Menu Item 2', icon: Icon.skull(), intent: 'danger'}),
menuItem({
text: 'Menu Item 3',
icon: Icon.placeholder(),
icon: Icon.placeholder() as ReactElement,
disabled: true
}),
menuDivider({title: 'Another Section'}),
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/examples/portfolio/GridPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const gridPanel = hoistCmp.factory({
gridCountLabel({unit: 'position'}),
filler(),
relativeTimestamp({bind: 'loadTimestamp'}),
refreshButton({model: XH.refreshContextModel, intent: 'success'})
refreshButton({target: XH.refreshContextModel, intent: 'success'})
]
});
}
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/examples/todo/TodoPanelModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TodoPanelModel extends HoistModel {
@managed
gridModel: GridModel;

panelRef = createRef<HTMLElement>();
panelRef = createRef<HTMLDivElement>();

addAction = new RecordAction({
icon: Icon.add(),
Expand Down
Loading