@xh/hoist 80.0.0-SNAPSHOT.1767973504648 → 80.0.0-SNAPSHOT.1767974090726
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 +0 -11
- package/build/types/cmp/grid/GridModel.d.ts +2 -2
- package/build/types/cmp/layout/Tags.d.ts +0 -2
- package/build/types/cmp/tab/TabContainerModel.d.ts +1 -1
- package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +6 -46
- package/cmp/grid/GridModel.ts +2 -2
- package/cmp/layout/Tags.ts +0 -2
- package/cmp/tab/TabContainerModel.ts +1 -1
- package/desktop/cmp/dash/canvas/DashCanvas.ts +4 -21
- package/desktop/cmp/dash/canvas/DashCanvasModel.ts +24 -140
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/types/desktop/cmp/button/FieldsetCollapseButton.d.ts +0 -10
- package/build/types/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.d.ts +0 -17
- package/build/types/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWellModel.d.ts +0 -11
- package/build/types/desktop/cmp/form/CollapsibleFieldset.d.ts +0 -11
- package/desktop/cmp/button/FieldsetCollapseButton.ts +0 -44
- package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.scss +0 -26
- package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.ts +0 -126
- package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWellModel.ts +0 -65
- package/desktop/cmp/form/CollapsibleFieldset.scss +0 -14
- package/desktop/cmp/form/CollapsibleFieldset.ts +0 -65
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
-
import { HoistProps } from '@xh/hoist/core';
|
|
3
|
-
export interface FieldsetCollapseButtonProps extends HoistProps {
|
|
4
|
-
icon?: ReactElement;
|
|
5
|
-
text: ReactNode;
|
|
6
|
-
clickHandler?: (boolean: any) => void;
|
|
7
|
-
collapsed?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const FieldsetCollapseButton: import("react").FC<FieldsetCollapseButtonProps>, fieldsetCollapseButton: import("@xh/hoist/core").ElementFactory<FieldsetCollapseButtonProps>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { HoistProps } from '@xh/hoist/core';
|
|
2
|
-
import { DashCanvasModel } from '@xh/hoist/desktop/cmp/dash';
|
|
3
|
-
import './DashCanvasWidgetWell.scss';
|
|
4
|
-
export interface DashCanvasWidgetWellProps extends HoistProps {
|
|
5
|
-
/** DashCanvasModel for which this widget well should allow the user to add views from. */
|
|
6
|
-
dashCanvasModel?: DashCanvasModel;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Widget Well from which to add items to a DashCanvas by drag-and-drop.
|
|
10
|
-
*
|
|
11
|
-
* Available view specs are listed in their defined order,
|
|
12
|
-
* grouped by their 'groupName' property if present.
|
|
13
|
-
*
|
|
14
|
-
* Typically, an app developer would place this inside a collapsible panel to the side of
|
|
15
|
-
* a DashCanvas.
|
|
16
|
-
*/
|
|
17
|
-
export declare const DashCanvasWidgetWell: import("react").FC<DashCanvasWidgetWellProps>, dashCanvasWidgetWell: import("@xh/hoist/core").ElementFactory<DashCanvasWidgetWellProps>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DragEvent } from 'react';
|
|
2
|
-
import { DashCanvasModel } from '@xh/hoist/desktop/cmp/dash';
|
|
3
|
-
import { HoistModel } from '@xh/hoist/core';
|
|
4
|
-
import '@xh/hoist/desktop/register';
|
|
5
|
-
export declare class DashCanvasWidgetWellModel extends HoistModel {
|
|
6
|
-
dashCanvasModel: DashCanvasModel;
|
|
7
|
-
constructor();
|
|
8
|
-
onLinked(): void;
|
|
9
|
-
onDragStart(evt: DragEvent<HTMLDivElement>): void;
|
|
10
|
-
onDragEnd(evt: DragEvent<HTMLDivElement>): void;
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type FieldsetHTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
2
|
-
import { HoistProps } from '@xh/hoist/core';
|
|
3
|
-
import './CollapsibleFieldset.scss';
|
|
4
|
-
export interface CollapsibleFieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement>, HoistProps {
|
|
5
|
-
icon?: ReactElement;
|
|
6
|
-
label: ReactNode;
|
|
7
|
-
clickHandler?: () => void;
|
|
8
|
-
collapsed?: boolean;
|
|
9
|
-
hideItemCount?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const CollapsibleFieldset: import("react").FC<CollapsibleFieldsetProps>, collapsibleFieldset: import("@xh/hoist/core").ElementFactory<CollapsibleFieldsetProps>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {type ReactElement, type ReactNode, useState} from 'react';
|
|
9
|
-
import {hoistCmp, HoistProps} from '@xh/hoist/core';
|
|
10
|
-
import {button} from '@xh/hoist/desktop/cmp/button';
|
|
11
|
-
import {legend} from '@xh/hoist/cmp/layout';
|
|
12
|
-
import {Icon} from '@xh/hoist/icon/Icon';
|
|
13
|
-
|
|
14
|
-
export interface FieldsetCollapseButtonProps extends HoistProps {
|
|
15
|
-
icon?: ReactElement;
|
|
16
|
-
text: ReactNode;
|
|
17
|
-
clickHandler?: (boolean) => void;
|
|
18
|
-
collapsed?: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const [FieldsetCollapseButton, fieldsetCollapseButton] =
|
|
23
|
-
hoistCmp.withFactory<FieldsetCollapseButtonProps>({
|
|
24
|
-
displayName: 'FieldsetCollapseButton',
|
|
25
|
-
model: false,
|
|
26
|
-
render({icon, text, clickHandler, collapsed, disabled}) {
|
|
27
|
-
const [isCollapsed, setIsCollapsed] = useState<boolean>(collapsed === true);
|
|
28
|
-
|
|
29
|
-
return legend(
|
|
30
|
-
button({
|
|
31
|
-
text,
|
|
32
|
-
icon,
|
|
33
|
-
rightIcon: isCollapsed ? Icon.angleDown() : Icon.angleUp(),
|
|
34
|
-
outlined: false,
|
|
35
|
-
disabled,
|
|
36
|
-
onClick: () => {
|
|
37
|
-
const val = !isCollapsed;
|
|
38
|
-
setIsCollapsed(val);
|
|
39
|
-
clickHandler?.(val);
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.xh-dash-canvas-widget-well {
|
|
2
|
-
padding: 0 var(--xh-pad-px);
|
|
3
|
-
|
|
4
|
-
.xh-collapsible-fieldset {
|
|
5
|
-
margin: var(--xh-pad-half-px) 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.xh-dash-canvas-draggable-widget {
|
|
9
|
-
border: var(--xh-border-dotted);
|
|
10
|
-
background-color: var(--xh-bg-alt);
|
|
11
|
-
padding: var(--xh-pad-half-px);
|
|
12
|
-
margin: var(--xh-pad-half-px) 0;
|
|
13
|
-
cursor: grab;
|
|
14
|
-
|
|
15
|
-
&.is-dragging {
|
|
16
|
-
cursor: grabbing;
|
|
17
|
-
// lighten background color of left behind placeholder
|
|
18
|
-
// when dragging
|
|
19
|
-
opacity: 0.25;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:active {
|
|
23
|
-
cursor: grabbing;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {uniqBy} from 'lodash';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
import type {ReactElement} from 'react';
|
|
11
|
-
import {div, vframe} from '@xh/hoist/cmp/layout';
|
|
12
|
-
import {creates, hoistCmp, HoistProps, uses} from '@xh/hoist/core';
|
|
13
|
-
import {DashCanvasModel, DashCanvasViewSpec} from '@xh/hoist/desktop/cmp/dash';
|
|
14
|
-
import {DashCanvasWidgetWellModel} from '@xh/hoist/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWellModel';
|
|
15
|
-
import {collapsibleFieldset} from '@xh/hoist/desktop/cmp/form/CollapsibleFieldset';
|
|
16
|
-
|
|
17
|
-
import './DashCanvasWidgetWell.scss';
|
|
18
|
-
|
|
19
|
-
export interface DashCanvasWidgetWellProps extends HoistProps {
|
|
20
|
-
/** DashCanvasModel for which this widget well should allow the user to add views from. */
|
|
21
|
-
dashCanvasModel?: DashCanvasModel;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Widget Well from which to add items to a DashCanvas by drag-and-drop.
|
|
26
|
-
*
|
|
27
|
-
* Available view specs are listed in their defined order,
|
|
28
|
-
* grouped by their 'groupName' property if present.
|
|
29
|
-
*
|
|
30
|
-
* Typically, an app developer would place this inside a collapsible panel to the side of
|
|
31
|
-
* a DashCanvas.
|
|
32
|
-
*/
|
|
33
|
-
export const [DashCanvasWidgetWell, dashCanvasWidgetWell] =
|
|
34
|
-
hoistCmp.withFactory<DashCanvasWidgetWellProps>({
|
|
35
|
-
displayName: 'DashCanvasWidgetWell',
|
|
36
|
-
model: creates(DashCanvasWidgetWellModel),
|
|
37
|
-
className: 'xh-dash-canvas-widget-well',
|
|
38
|
-
render({dashCanvasModel, className}) {
|
|
39
|
-
if (!dashCanvasModel) return;
|
|
40
|
-
|
|
41
|
-
return vframe({
|
|
42
|
-
className: classNames(className),
|
|
43
|
-
overflow: 'auto',
|
|
44
|
-
items: createDraggableItems(dashCanvasModel)
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
//---------------------------
|
|
50
|
-
// Implementation
|
|
51
|
-
//---------------------------
|
|
52
|
-
const draggableWidget = hoistCmp.factory<DashCanvasWidgetWellModel>({
|
|
53
|
-
displayName: 'DraggableWidget',
|
|
54
|
-
model: uses(DashCanvasWidgetWellModel),
|
|
55
|
-
render({model, viewSpec}) {
|
|
56
|
-
const {id, icon, title} = viewSpec as DashCanvasViewSpec;
|
|
57
|
-
return div({
|
|
58
|
-
id: `draggableFor-${id}`,
|
|
59
|
-
className: 'xh-dash-canvas-draggable-widget',
|
|
60
|
-
draggable: true,
|
|
61
|
-
unselectable: 'on',
|
|
62
|
-
onDragStart: e => model.onDragStart(e),
|
|
63
|
-
onDragEnd: e => model.onDragEnd(e),
|
|
64
|
-
items: [icon, ' ', title]
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Used to create draggable items (for adding views)
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
function createDraggableItems(dashCanvasModel: DashCanvasModel): any[] {
|
|
74
|
-
if (!dashCanvasModel.ref.current) return [];
|
|
75
|
-
|
|
76
|
-
const groupedItems = {},
|
|
77
|
-
ungroupedItems = [];
|
|
78
|
-
|
|
79
|
-
const addToGroup = (item, icon, groupName) => {
|
|
80
|
-
const group = groupedItems[groupName];
|
|
81
|
-
if (group) {
|
|
82
|
-
group.push({item, icon});
|
|
83
|
-
} else {
|
|
84
|
-
groupedItems[groupName] = [{item, icon}];
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
dashCanvasModel.viewSpecs
|
|
89
|
-
.filter(viewSpec => {
|
|
90
|
-
return (
|
|
91
|
-
viewSpec.allowAdd &&
|
|
92
|
-
(!viewSpec.unique || !dashCanvasModel.getViewsBySpecId(viewSpec.id).length)
|
|
93
|
-
);
|
|
94
|
-
})
|
|
95
|
-
.forEach(viewSpec => {
|
|
96
|
-
const {groupName} = viewSpec,
|
|
97
|
-
item = draggableWidget({viewSpec});
|
|
98
|
-
|
|
99
|
-
if (groupName) {
|
|
100
|
-
addToGroup(item, viewSpec.icon, groupName);
|
|
101
|
-
} else {
|
|
102
|
-
ungroupedItems.push(item);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
return [
|
|
107
|
-
...Object.keys(groupedItems).map(group => {
|
|
108
|
-
const label = group,
|
|
109
|
-
items = groupedItems[group],
|
|
110
|
-
sameIcons =
|
|
111
|
-
uniqBy<{item: ReactElement; icon: ReactElement}>(
|
|
112
|
-
items,
|
|
113
|
-
it => it.icon.props.iconName
|
|
114
|
-
).length === 1,
|
|
115
|
-
icon = sameIcons ? items[0].icon : null;
|
|
116
|
-
|
|
117
|
-
return collapsibleFieldset({
|
|
118
|
-
icon,
|
|
119
|
-
collapsed: false,
|
|
120
|
-
label,
|
|
121
|
-
items: items.map(it => it.item)
|
|
122
|
-
});
|
|
123
|
-
}),
|
|
124
|
-
...ungroupedItems
|
|
125
|
-
];
|
|
126
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import {DragEvent} from 'react';
|
|
8
|
-
import {DashCanvasModel} from '@xh/hoist/desktop/cmp/dash';
|
|
9
|
-
import {HoistModel, managed} from '@xh/hoist/core';
|
|
10
|
-
import '@xh/hoist/desktop/register';
|
|
11
|
-
import {makeObservable, observable} from '@xh/hoist/mobx';
|
|
12
|
-
import {runInAction} from 'mobx';
|
|
13
|
-
|
|
14
|
-
export class DashCanvasWidgetWellModel extends HoistModel {
|
|
15
|
-
@managed
|
|
16
|
-
@observable.ref
|
|
17
|
-
dashCanvasModel: DashCanvasModel;
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
makeObservable(this);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
override onLinked() {
|
|
25
|
-
this.addReaction({
|
|
26
|
-
track: () => this.componentProps,
|
|
27
|
-
run: () =>
|
|
28
|
-
runInAction(() => (this.dashCanvasModel = this.componentProps.dashCanvasModel)),
|
|
29
|
-
fireImmediately: true
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
onDragStart(evt: DragEvent<HTMLDivElement>) {
|
|
34
|
-
const target = evt.target as HTMLElement;
|
|
35
|
-
if (!target) return;
|
|
36
|
-
|
|
37
|
-
this.dashCanvasModel.showAddViewButtonWhenEmpty = false;
|
|
38
|
-
evt.dataTransfer.effectAllowed = 'move';
|
|
39
|
-
target.classList.add('is-dragging');
|
|
40
|
-
|
|
41
|
-
const viewSpecId: string = target.getAttribute('id').split('draggableFor-')[1],
|
|
42
|
-
viewSpec = this.dashCanvasModel.viewSpecs.find(it => it.id === viewSpecId),
|
|
43
|
-
{width, height} = viewSpec,
|
|
44
|
-
widget = {
|
|
45
|
-
viewSpecId,
|
|
46
|
-
layout: {
|
|
47
|
-
x: 0,
|
|
48
|
-
y: 0,
|
|
49
|
-
w: width,
|
|
50
|
-
h: height
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
this.dashCanvasModel.setDraggedInView(widget);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onDragEnd(evt: DragEvent<HTMLDivElement>) {
|
|
58
|
-
this.dashCanvasModel.showAddViewButtonWhenEmpty = true;
|
|
59
|
-
|
|
60
|
-
const target = evt.target as HTMLElement;
|
|
61
|
-
if (!target) return;
|
|
62
|
-
|
|
63
|
-
target.classList.remove('is-dragging');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
.xh-collapsible-fieldset {
|
|
9
|
-
&--collapsed {
|
|
10
|
-
border-bottom: none;
|
|
11
|
-
border-left: none;
|
|
12
|
-
border-right: none;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2026 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {fieldsetCollapseButton} from '@xh/hoist/desktop/cmp/button/FieldsetCollapseButton';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
import {castArray} from 'lodash';
|
|
11
|
-
import {type FieldsetHTMLAttributes, type ReactElement, type ReactNode, useState} from 'react';
|
|
12
|
-
import {hoistCmp, HoistProps} from '@xh/hoist/core';
|
|
13
|
-
import {fieldset} from '@xh/hoist/cmp/layout';
|
|
14
|
-
|
|
15
|
-
import './CollapsibleFieldset.scss';
|
|
16
|
-
|
|
17
|
-
export interface CollapsibleFieldsetProps
|
|
18
|
-
extends FieldsetHTMLAttributes<HTMLFieldSetElement>, HoistProps {
|
|
19
|
-
icon?: ReactElement;
|
|
20
|
-
label: ReactNode;
|
|
21
|
-
clickHandler?: () => void;
|
|
22
|
-
collapsed?: boolean;
|
|
23
|
-
hideItemCount?: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const [CollapsibleFieldset, collapsibleFieldset] =
|
|
27
|
-
hoistCmp.withFactory<CollapsibleFieldsetProps>({
|
|
28
|
-
displayName: 'FieldsetCollapseButton',
|
|
29
|
-
model: false,
|
|
30
|
-
className: 'xh-collapsible-fieldset',
|
|
31
|
-
render({icon, label, collapsed, children, hideItemCount, className, disabled, ...rest}) {
|
|
32
|
-
const [isCollapsed, setIsCollapsed] = useState<boolean>(collapsed === true),
|
|
33
|
-
items = castArray(children),
|
|
34
|
-
itemCount = hideItemCount === true ? '' : ` (${items.length})`,
|
|
35
|
-
classes = [];
|
|
36
|
-
|
|
37
|
-
if (isCollapsed) {
|
|
38
|
-
classes.push('xh-collapsible-fieldset--collapsed');
|
|
39
|
-
} else {
|
|
40
|
-
classes.push('xh-collapsible-fieldset--expanded');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (disabled) {
|
|
44
|
-
classes.push('xh-collapsible-fieldset--disabled');
|
|
45
|
-
} else {
|
|
46
|
-
classes.push('xh-collapsible-fieldset--enabled');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return fieldset({
|
|
50
|
-
className: classNames(className, classes),
|
|
51
|
-
items: [
|
|
52
|
-
fieldsetCollapseButton({
|
|
53
|
-
icon,
|
|
54
|
-
text: `${label}${itemCount}`,
|
|
55
|
-
clickHandler: val => setIsCollapsed(val),
|
|
56
|
-
collapsed: isCollapsed,
|
|
57
|
-
disabled
|
|
58
|
-
}),
|
|
59
|
-
...(isCollapsed ? [] : items)
|
|
60
|
-
],
|
|
61
|
-
disabled,
|
|
62
|
-
...rest
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|