uiconfig-blueprint 0.1.0-dev.5 → 0.1.0-dev.7
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/dist/{allPaths-By_mBgwU.js → allPaths-BOo4cECg.js} +5 -5
- package/dist/{allPaths-By_mBgwU.js.map → allPaths-BOo4cECg.js.map} +1 -1
- package/dist/{allPathsLoader-DzKtBkYf.js → allPathsLoader-B4vYL2gG.js} +4 -4
- package/dist/{allPathsLoader-DzKtBkYf.js.map → allPathsLoader-B4vYL2gG.js.map} +1 -1
- package/dist/bpComponents/BPButtonComponent.d.ts +1 -0
- package/dist/bpComponents/BPColorInputComponent.d.ts +1 -0
- package/dist/bpComponents/BPComponent.d.ts +1 -0
- package/dist/bpComponents/BPFileComponent.d.ts +1 -0
- package/dist/bpComponents/BPFolderComponent.d.ts +5 -0
- package/dist/bpComponents/BPTreeComponent.d.ts +9 -3
- package/dist/components/InspectorStackComponent.d.ts +2 -1
- package/dist/components/Tree2.d.ts +52 -0
- package/dist/components/TreeNode2.d.ts +43 -0
- package/dist/components/treeTypes.d.ts +18 -0
- package/dist/{index-CIM_EzrF.js → index-13b-jSvJ.js} +5336 -5038
- package/dist/index-13b-jSvJ.js.map +1 -0
- package/dist/{index-Dm8yRRlW.js → index-B0IO--x7.js} +2 -2
- package/dist/{index-Dm8yRRlW.js.map → index-B0IO--x7.js.map} +1 -1
- package/dist/{index-C2vRz8Oc.js → index-BttMe1vP.js} +2 -2
- package/dist/{index-C2vRz8Oc.js.map → index-BttMe1vP.js.map} +1 -1
- package/dist/index.js +43 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{splitPathsBySizeLoader-DWtVZ468.js → splitPathsBySizeLoader-nUv2DYaP.js} +5 -5
- package/dist/{splitPathsBySizeLoader-DWtVZ468.js.map → splitPathsBySizeLoader-nUv2DYaP.js.map} +1 -1
- package/docs/classes/UI.html +3 -3
- package/docs/classes/UiConfigRendererBlueprint.html +3 -3
- package/lib/css/renderer.css +80 -13
- package/lib/css/renderer.css.map +1 -1
- package/lib/esm/ConfigObject.js +8 -4
- package/lib/esm/ConfigObject.js.map +1 -1
- package/lib/esm/UiConfigRendererBlueprint.js +22 -11
- package/lib/esm/UiConfigRendererBlueprint.js.map +1 -1
- package/lib/esm/bpComponents/BPButtonComponent.d.ts +1 -0
- package/lib/esm/bpComponents/BPButtonComponent.js +4 -2
- package/lib/esm/bpComponents/BPButtonComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPColorInputComponent.d.ts +1 -0
- package/lib/esm/bpComponents/BPColorInputComponent.js +3 -1
- package/lib/esm/bpComponents/BPColorInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPComponent.d.ts +1 -0
- package/lib/esm/bpComponents/BPComponent.js +4 -2
- package/lib/esm/bpComponents/BPComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPDropdownInputComponent.js +2 -2
- package/lib/esm/bpComponents/BPDropdownInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPFileComponent.d.ts +1 -0
- package/lib/esm/bpComponents/BPFileComponent.js +8 -2
- package/lib/esm/bpComponents/BPFileComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPFolderComponent.d.ts +5 -0
- package/lib/esm/bpComponents/BPFolderComponent.js +46 -6
- package/lib/esm/bpComponents/BPFolderComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPInputComponent.js +2 -1
- package/lib/esm/bpComponents/BPInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPNumberInputComponent.js +1 -1
- package/lib/esm/bpComponents/BPNumberInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPTextInputComponent.js +1 -1
- package/lib/esm/bpComponents/BPTextInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPToggleInputComponent.js +3 -2
- package/lib/esm/bpComponents/BPToggleInputComponent.js.map +1 -1
- package/lib/esm/bpComponents/BPTreeComponent.d.ts +9 -3
- package/lib/esm/bpComponents/BPTreeComponent.js +15 -6
- package/lib/esm/bpComponents/BPTreeComponent.js.map +1 -1
- package/lib/esm/components/ConfigurationPanelComponent.js +6 -1
- package/lib/esm/components/ConfigurationPanelComponent.js.map +1 -1
- package/lib/esm/components/ExtendedNumericInput.js +1 -1
- package/lib/esm/components/ExtendedNumericInput.js.map +1 -1
- package/lib/esm/components/InspectorStackComponent.d.ts +2 -1
- package/lib/esm/components/InspectorStackComponent.js +2 -2
- package/lib/esm/components/InspectorStackComponent.js.map +1 -1
- package/lib/esm/components/Tree2.d.ts +52 -0
- package/lib/esm/components/Tree2.js +177 -0
- package/lib/esm/components/Tree2.js.map +1 -0
- package/lib/esm/components/TreeNode2.d.ts +43 -0
- package/lib/esm/components/TreeNode2.js +111 -0
- package/lib/esm/components/TreeNode2.js.map +1 -0
- package/lib/esm/components/treeTypes.d.ts +18 -0
- package/lib/esm/components/treeTypes.js +2 -0
- package/lib/esm/components/treeTypes.js.map +1 -0
- package/package.json +2 -2
- package/src/ConfigObject.tsx +11 -4
- package/src/UiConfigRendererBlueprint.tsx +22 -11
- package/src/bpComponents/BPButtonComponent.scss +3 -1
- package/src/bpComponents/BPButtonComponent.tsx +8 -2
- package/src/bpComponents/BPColorInputComponent.tsx +7 -1
- package/src/bpComponents/BPComponent.tsx +3 -0
- package/src/bpComponents/BPDropdownInputComponent.tsx +2 -1
- package/src/bpComponents/BPFileComponent.tsx +15 -3
- package/src/bpComponents/BPFolderComponent.scss +8 -3
- package/src/bpComponents/BPFolderComponent.tsx +85 -13
- package/src/bpComponents/BPInputComponent.tsx +4 -1
- package/src/bpComponents/BPNumberInputComponent.tsx +2 -1
- package/src/bpComponents/BPTextInputComponent.tsx +1 -0
- package/src/bpComponents/BPToggleInputComponent.tsx +6 -3
- package/src/bpComponents/BPTreeComponent.tsx +22 -7
- package/src/components/ConfigurationPanelComponent.tsx +14 -3
- package/src/components/ExtendedNumericInput.tsx +1 -1
- package/src/components/InspectorStackComponent.tsx +2 -2
- package/src/components/Tree2.tsx +344 -0
- package/src/components/TreeNode2.tsx +192 -0
- package/src/components/common.scss +3 -0
- package/src/components/tree2.scss +42 -0
- package/src/components/treeTypes.ts +97 -0
- package/src/renderer.scss +43 -10
- package/dist/index-CIM_EzrF.js.map +0 -1
|
@@ -59,12 +59,13 @@ export class BPDropdownInputComponent extends BPInputComponent<string|number, BP
|
|
|
59
59
|
activeItem={item}
|
|
60
60
|
key={this.props.config.uuid}
|
|
61
61
|
disabled={this.state.disabled}
|
|
62
|
+
fill={true}
|
|
62
63
|
popoverProps={{
|
|
63
64
|
minimal: true,
|
|
64
65
|
}}
|
|
65
66
|
popoverTargetProps={{
|
|
66
67
|
style: {
|
|
67
|
-
height: "
|
|
68
|
+
height: "var(--pt-input-height)",
|
|
68
69
|
}
|
|
69
70
|
}}
|
|
70
71
|
noResults={<MenuItem disabled={true} text="No results." roleStructure="listoption" />}
|
|
@@ -13,6 +13,7 @@ export type BPFileComponentState = BPValueComponentState<StateValue> & {
|
|
|
13
13
|
type BPFileComponentExtras = {fileLoader?: {load: (v: string|File|{path: string, file: File|Blob})=>Promise<FileImportType>}}
|
|
14
14
|
type BPFileComponentContextType = UiConfigRendererContextType & BPFileComponentExtras
|
|
15
15
|
|
|
16
|
+
// todo make this abstract?
|
|
16
17
|
// @ts-ignore
|
|
17
18
|
export class BPFileComponent<T extends FileImportType=FileImportType, TP = {}> extends BPValueComponent<T | null, BPFileComponentState, StateValue> {
|
|
18
19
|
declare context: BPFileComponentContextType
|
|
@@ -67,7 +68,7 @@ export class BPFileComponent<T extends FileImportType=FileImportType, TP = {}> e
|
|
|
67
68
|
// }
|
|
68
69
|
|
|
69
70
|
renderPreviewSlot() {
|
|
70
|
-
return <img src={"https://
|
|
71
|
+
return <img src={"https://threepipe.org/logo.svg"}
|
|
71
72
|
style={{width: "100%", maxHeight: "80px", objectFit: "contain"}}/>
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -76,9 +77,20 @@ export class BPFileComponent<T extends FileImportType=FileImportType, TP = {}> e
|
|
|
76
77
|
// return super.updateStateValue(state, last);
|
|
77
78
|
// }
|
|
78
79
|
|
|
80
|
+
protected flexBasis = "100%"
|
|
81
|
+
|
|
79
82
|
render() {
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
let show = !this.state.hidden
|
|
84
|
+
// todo - document hideOnEmpty. it hides the whole component if there is no value and no preview. (used in SSReflectionPlugin)
|
|
85
|
+
if (show && this.props.config.hideOnEmpty && !this.state.preview && !this.state.value) {
|
|
86
|
+
show = false
|
|
87
|
+
}
|
|
88
|
+
return show ? (
|
|
89
|
+
<FormGroupComponent
|
|
90
|
+
label={this.state.label}
|
|
91
|
+
disabled={this.state.disabled}
|
|
92
|
+
flexBasis={this.state.baseWidth ?? this.flexBasis}
|
|
93
|
+
>
|
|
82
94
|
<FileComponent previewSlot={this.renderPreviewSlot()} state={this.state} onChange={(s) =>
|
|
83
95
|
this.updateStateValue({...this.state, preview: undefined, ...s}) // todo: set loading while this promise is happening.
|
|
84
96
|
} key={this.props.config.uuid}/>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
background-color: $light-gray4 !important;
|
|
30
30
|
}
|
|
31
31
|
.bp5-dark .folder-card {
|
|
32
|
-
background-color: $dark-
|
|
32
|
+
background-color: $dark-gray1 !important;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
|
|
@@ -68,11 +68,15 @@
|
|
|
68
68
|
background-color: $dark-gray1 !important;
|
|
69
69
|
|
|
70
70
|
&:hover {
|
|
71
|
-
background-color: $dark-
|
|
71
|
+
background-color: $dark-gray2 !important;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
&:active {
|
|
75
|
-
background-color: $dark-
|
|
75
|
+
background-color: $dark-gray2 !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.folder-trigger-button-expanded{
|
|
79
|
+
background-color: $dark-gray2 !important;
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -93,6 +97,7 @@
|
|
|
93
97
|
//margin-left: $pt-grid-size;
|
|
94
98
|
padding-top: 6px;
|
|
95
99
|
padding-bottom: 6px;
|
|
100
|
+
min-height: 36px;
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
|
|
@@ -5,6 +5,9 @@ import {ConfigObject} from "../ConfigObject";
|
|
|
5
5
|
import {PanelActions} from "@blueprintjs/core/lib/esm/components/panel-stack2/panelTypes";
|
|
6
6
|
import {safeSetProperty} from 'ts-browser-helpers'
|
|
7
7
|
import {BPContainerComponent, BPContainerComponentState} from './BPContainerComponent'
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import {Classes} from "@blueprintjs/core/src/common";
|
|
10
|
+
import {AnimationStates} from "@blueprintjs/core/lib/esm/components/collapse/collapse";
|
|
8
11
|
|
|
9
12
|
export type BPFolderComponentState = BPContainerComponentState & {
|
|
10
13
|
}
|
|
@@ -39,18 +42,21 @@ export class BPFolderComponent extends BPContainerComponent<BPFolderComponentSta
|
|
|
39
42
|
enabled={enabledToggle ? this.context.methods.getRawValue(enabledToggle) : undefined}
|
|
40
43
|
onEnabledChange={(e) => enabledToggle && this.context.methods.setValue(enabledToggle, e.target.checked, {}).then(() => this.setState(this.state))}
|
|
41
44
|
>
|
|
42
|
-
<
|
|
45
|
+
<Collapse2 isOpen={this.state.expanded} keepChildrenMounted={true} transitionDuration={300}>
|
|
43
46
|
<div className="folder-children" style={{listStyleType: "none", paddingLeft: this.props.level??0 > 2 ? "6px" : 0}}> {/*todo use parameter instead of const 6*/}
|
|
44
|
-
{this.state.children.map((c, i) =>
|
|
45
|
-
|
|
47
|
+
{this.state.children.map((c, i) =>
|
|
48
|
+
<ConfigObject key={'c' + i} {...this.props} config={c}
|
|
49
|
+
level={(this.props.level ?? 0) + 1}/>
|
|
50
|
+
)}
|
|
46
51
|
</div>
|
|
47
|
-
</
|
|
52
|
+
</Collapse2>
|
|
48
53
|
</FolderHeadCard>
|
|
49
54
|
) : null
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
export const FolderHeadCard: React.FC<React.PropsWithChildren<{ open: boolean, label: string, minimal: boolean, level: number, disabled?: boolean, enabled?: boolean, onEnabledChange?: ChangeEventHandler<HTMLInputElement>, onClick: DOMAttributes<HTMLElement>['onClick'] }>> = (props) => {
|
|
59
|
+
const hasEnabled = (props.enabled !== undefined)
|
|
54
60
|
return (
|
|
55
61
|
<div
|
|
56
62
|
// interactive={!props.open}
|
|
@@ -76,7 +82,7 @@ export const FolderHeadCard: React.FC<React.PropsWithChildren<{ open: boolean, l
|
|
|
76
82
|
{/*</Button>*/}
|
|
77
83
|
|
|
78
84
|
<Button
|
|
79
|
-
className="folder-trigger-button"
|
|
85
|
+
className={"folder-trigger-button " + (props.open ? "folder-trigger-button-expanded" : "")}
|
|
80
86
|
// fill={!props.minimal}
|
|
81
87
|
fill={true}
|
|
82
88
|
onClick={props.onClick}
|
|
@@ -85,16 +91,18 @@ export const FolderHeadCard: React.FC<React.PropsWithChildren<{ open: boolean, l
|
|
|
85
91
|
small={props.minimal}
|
|
86
92
|
style={props.level ? {marginLeft: "6px"} : {fontSize: "0.95rem", paddingTop: "8px", paddingBottom: "8px"}}
|
|
87
93
|
intent={props.open ? Intent.PRIMARY : Intent.NONE}
|
|
88
|
-
icon={props.enabled !== undefined && <span style={{minWidth: '20px'}}></span>} // adding a span here will center the text in the button
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
// icon={props.enabled !== undefined && <span style={{minWidth: '20px'}}></span>} // adding a span here will center the text in the button
|
|
95
|
+
icon={(
|
|
96
|
+
<>
|
|
97
|
+
<Icon icon="caret-right" style={{
|
|
98
|
+
rotate: props.open ? "90deg" : "0deg",
|
|
99
|
+
transition: "rotate 0.25s ease-in-out"
|
|
100
|
+
}}/>
|
|
101
|
+
</>
|
|
94
102
|
)}>{props.label}
|
|
95
103
|
</Button>
|
|
96
|
-
{
|
|
97
|
-
style={{margin: 0, position: 'absolute', left: '
|
|
104
|
+
{hasEnabled && <Checkbox
|
|
105
|
+
style={{margin: 0, position: 'absolute', left: '10px'}}
|
|
98
106
|
large inline
|
|
99
107
|
defaultChecked={props.enabled}
|
|
100
108
|
onChange={props.onEnabledChange}
|
|
@@ -106,3 +114,67 @@ export const FolderHeadCard: React.FC<React.PropsWithChildren<{ open: boolean, l
|
|
|
106
114
|
</div>
|
|
107
115
|
)
|
|
108
116
|
}
|
|
117
|
+
|
|
118
|
+
export class Collapse2 extends Collapse{
|
|
119
|
+
private contentsRefHandler2 = (el: HTMLElement | null) => {
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
this.contents = el;
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
if (this.contents != null) {
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
const height = this.contents.clientHeight;
|
|
126
|
+
this.setState({
|
|
127
|
+
animationState: this.props.isOpen ? AnimationStates.OPEN : AnimationStates.CLOSED,
|
|
128
|
+
height: height === 0 ? undefined : `${height}px`,
|
|
129
|
+
heightWhenOpen: height === 0 ? undefined : height,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
public render() {
|
|
135
|
+
const isContentVisible = this.state.animationState !== AnimationStates.CLOSED;
|
|
136
|
+
const shouldRenderChildren = isContentVisible || this.props.keepChildrenMounted;
|
|
137
|
+
// const displayWithTransform = isContentVisible && this.state.animationState !== AnimationStates.CLOSING;
|
|
138
|
+
const isAutoHeight = this.state.height === "auto";
|
|
139
|
+
|
|
140
|
+
const containerStyle = {
|
|
141
|
+
height: isContentVisible ? this.state.height : undefined,
|
|
142
|
+
overflowY: isAutoHeight ? "visible" : undefined,
|
|
143
|
+
// transitions don't work with height: auto
|
|
144
|
+
transition: isAutoHeight ? "none" : undefined,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const contentsStyle = {
|
|
148
|
+
// only use heightWhenOpen while closing
|
|
149
|
+
// transform: displayWithTransform ? "translateY(0)" : `translateY(-${this.state.heightWhenOpen}px)`,
|
|
150
|
+
// transitions don't work with height: auto
|
|
151
|
+
// transition: isAutoHeight ? "none" : undefined,
|
|
152
|
+
display: "block", // for opacity animation
|
|
153
|
+
visibility: isContentVisible ? "visible" : "hidden",
|
|
154
|
+
opacity: this.state.animationState === AnimationStates.CLOSING || this.state.animationState === AnimationStates.CLOSED ? 0.1 : 1,
|
|
155
|
+
} as React.CSSProperties;
|
|
156
|
+
|
|
157
|
+
// if(isContentVisible && !isAutoHeight && this.state.heightWhenOpen && this.state.height){
|
|
158
|
+
// const h = parseInt(this.state.height)
|
|
159
|
+
// contentsStyle.opacity = h / this.state.heightWhenOpen;
|
|
160
|
+
// console.log(contentsStyle.opacity)
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
return React.createElement(
|
|
164
|
+
this.props.component!,
|
|
165
|
+
{
|
|
166
|
+
className: classNames(Classes.COLLAPSE, this.props.className),
|
|
167
|
+
style: containerStyle,
|
|
168
|
+
},
|
|
169
|
+
<div
|
|
170
|
+
className={Classes.COLLAPSE_BODY}
|
|
171
|
+
ref={this.contentsRefHandler2}
|
|
172
|
+
style={contentsStyle}
|
|
173
|
+
aria-hidden={!isContentVisible}
|
|
174
|
+
>
|
|
175
|
+
{shouldRenderChildren ? this.props.children : null}
|
|
176
|
+
</div>,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
@@ -26,7 +26,10 @@ export abstract class BPInputComponent<
|
|
|
26
26
|
|
|
27
27
|
render() {
|
|
28
28
|
return !this.state.hidden ? (
|
|
29
|
-
<FormGroupComponent disabled={this.state.disabled}
|
|
29
|
+
<FormGroupComponent disabled={this.state.disabled}
|
|
30
|
+
label={this.state.label}
|
|
31
|
+
flexBasis={this.state.baseWidth ?? this.flexBasis}
|
|
32
|
+
>
|
|
30
33
|
{this.renderInput()}
|
|
31
34
|
</FormGroupComponent>
|
|
32
35
|
) : null
|
|
@@ -27,9 +27,10 @@ export class BPNumberInputComponent extends BPInputComponent<number> {
|
|
|
27
27
|
disabled={this.state.disabled}
|
|
28
28
|
readOnly={this.state.readOnly}
|
|
29
29
|
defaultValue={this.state.value}
|
|
30
|
+
fill={true}
|
|
30
31
|
ref={this._inputs[0]}
|
|
31
32
|
key={this.props.config.uuid}
|
|
32
|
-
onChange2={this._onChange}
|
|
33
|
+
onChange2={this._onChange}/>
|
|
33
34
|
)
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -16,14 +16,17 @@ export class BPToggleInputComponent extends BPInputComponent<boolean> {
|
|
|
16
16
|
return (
|
|
17
17
|
<Switch alignIndicator="right" defaultChecked={this.state.value}
|
|
18
18
|
disabled={this.state.disabled} readOnly={this.state.readOnly}
|
|
19
|
-
label={this.state.label} onChange={this._onChange}
|
|
20
|
-
|
|
19
|
+
labelElement={(<span className={"bp5-label"} title={this.state.label}>{this.state.label}</span>)} onChange={this._onChange}
|
|
20
|
+
inline={false} large={false}
|
|
21
|
+
className="switch"/>
|
|
21
22
|
)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
render() {
|
|
25
26
|
return !this.state.hidden ? (
|
|
26
|
-
<div className="xPaddedContent folderContent"
|
|
27
|
+
<div className="xPaddedContent folderContent"
|
|
28
|
+
style={{flexBasis: this.state.baseWidth ?? this.flexBasis}}
|
|
29
|
+
>
|
|
27
30
|
{this.renderInput()}
|
|
28
31
|
</div>
|
|
29
32
|
) : null
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import {Tree2} from "../components/Tree2";
|
|
1
2
|
import {BPComponent, BPComponentProps, BPComponentState, UiConfigRendererContextType} from "./BPComponent";
|
|
2
|
-
import {
|
|
3
|
+
import {TreeNodeInfo} from "@blueprintjs/core";
|
|
4
|
+
import React from "react";
|
|
3
5
|
|
|
4
6
|
export type BPTreeComponentState<T = {}> = BPComponentState & {
|
|
5
7
|
nodes: TreeNodeInfo<T>[]
|
|
@@ -8,8 +10,8 @@ export type BPTreeComponentState<T = {}> = BPComponentState & {
|
|
|
8
10
|
// https://github.com/palantir/blueprint/blob/develop/packages/docs-app/src/examples/core-examples/treeExample.tsx
|
|
9
11
|
type NodePath = (string|number)[];
|
|
10
12
|
|
|
11
|
-
export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|PrimitiveVal|void*/ = void> extends BPComponent<TConfigVal, BPTreeComponentState<T
|
|
12
|
-
constructor(props: BPComponentProps<TConfigVal
|
|
13
|
+
export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|PrimitiveVal|void*/ = void> extends BPComponent<TConfigVal, BPTreeComponentState<T>, BPComponentProps<TConfigVal> & {className: string}> {
|
|
14
|
+
constructor(props: BPComponentProps<TConfigVal> & {className: string}, context: UiConfigRendererContextType) {
|
|
13
15
|
super(props, context, {nodes: []});
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -53,7 +55,6 @@ export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|Primitiv
|
|
|
53
55
|
protected _getNodePath(id: string, nodes?: TreeNodeInfo<T>[]): NodePath {
|
|
54
56
|
let path1: NodePath|null = null
|
|
55
57
|
this._forEachNode(nodes ?? this.state.nodes, (node, path) => {
|
|
56
|
-
if(!path1) return
|
|
57
58
|
if (node.id === id) path1 = path
|
|
58
59
|
})
|
|
59
60
|
return path1 ?? []
|
|
@@ -116,7 +117,7 @@ export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|Primitiv
|
|
|
116
117
|
async setSelected(id?: string, expand = false) {
|
|
117
118
|
const nodes = this._cloneNodes(n => n.isSelected = n.id === id)
|
|
118
119
|
if(expand && id!==undefined){
|
|
119
|
-
const parents = this._getNodePath(id)
|
|
120
|
+
const parents = this._getNodePath(id, nodes)
|
|
120
121
|
for (let i = 0; i < parents.length; i++) {
|
|
121
122
|
const node = this._infoMap.get(parents[i])
|
|
122
123
|
if(node) node.isExpanded = true
|
|
@@ -190,8 +191,15 @@ export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|Primitiv
|
|
|
190
191
|
e.stopPropagation()
|
|
191
192
|
}
|
|
192
193
|
|
|
194
|
+
protected _canDropNode(_sourceNode: TreeNodeInfo<T>, _sourcePath: NodePath, _targetNode: TreeNodeInfo<T>, _targetPath: NodePath, _index?: number) {
|
|
195
|
+
return true
|
|
196
|
+
}
|
|
197
|
+
protected _onDropNode(_sourceNode: TreeNodeInfo<T>, _sourcePath: NodePath, _targetNode: TreeNodeInfo<T>, _targetPath: NodePath, _e?: React.DragEvent, _index?: number) {
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
|
|
193
201
|
render() {
|
|
194
|
-
const TreeT =
|
|
202
|
+
const TreeT = Tree2.ofType<T>()
|
|
195
203
|
return !this.state.hidden ? (
|
|
196
204
|
<div
|
|
197
205
|
style={{width: "100%", height: "100%"}}
|
|
@@ -200,7 +208,14 @@ export abstract class BPTreeComponent<T = {}, TConfigVal extends any /*|Primitiv
|
|
|
200
208
|
>
|
|
201
209
|
<TreeT
|
|
202
210
|
contents={this.state.nodes}
|
|
203
|
-
className="folderContent"
|
|
211
|
+
className={"folderContent " + (this.props.className||'')}
|
|
212
|
+
canDropNode={(node, path, targetNode, targetPath, index) => {
|
|
213
|
+
return this._canDropNode(node, path, targetNode, targetPath, index)
|
|
214
|
+
}}
|
|
215
|
+
onNodeDrop={(node, path, targetNode, targetPath, e, index) => {
|
|
216
|
+
console.log(node, path, targetNode, targetPath, e);
|
|
217
|
+
this._onDropNode(node, path, targetNode, targetPath, e, index)
|
|
218
|
+
}}
|
|
204
219
|
onNodeExpand={(node, _path, _e) => {
|
|
205
220
|
this._onNodeExpandCollapse(node.id)
|
|
206
221
|
}}
|
|
@@ -31,6 +31,7 @@ export function ConfigurationPanelComponent({config}: { config: UiObjectConfig<a
|
|
|
31
31
|
} as Panel<{ config: UiObjectConfig }>
|
|
32
32
|
}, [config])
|
|
33
33
|
const [currentPanelStack, setCurrentPanelStack] = React.useState<Array<Panel<{ config: UiObjectConfig }>>>([stackItem()]);
|
|
34
|
+
const [isMinimized, setIsMinimized] = React.useState(false);
|
|
34
35
|
|
|
35
36
|
React.useEffect(() => {
|
|
36
37
|
setCurrentPanelStack([stackItem()])
|
|
@@ -40,7 +41,7 @@ export function ConfigurationPanelComponent({config}: { config: UiObjectConfig<a
|
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
43
|
<VisualStyleContext.Provider value={{...defaultVisualStyle, ...style}}>
|
|
43
|
-
<Card className={`bpInspectorCard ${style.darkMode?Classes.DARK:""}`}>
|
|
44
|
+
<Card className={`bpInspectorCard ${style.darkMode?Classes.DARK:""}`} style={{display: isMinimized ? 'none' : 'block'}}>
|
|
44
45
|
<PanelStack2 className="inspectorPanelStack"
|
|
45
46
|
showPanelHeader={true}
|
|
46
47
|
renderActivePanelOnly={true}
|
|
@@ -48,16 +49,26 @@ export function ConfigurationPanelComponent({config}: { config: UiObjectConfig<a
|
|
|
48
49
|
onClose={() => setCurrentPanelStack(currentPanelStack.slice(0, -1))}
|
|
49
50
|
stack={currentPanelStack}/>
|
|
50
51
|
<div className={"bpPanelStackHeaderOverlay " + Classes.PANEL_STACK2_HEADER}>
|
|
51
|
-
<Popover targetProps={{style: {position: "absolute", right: "
|
|
52
|
+
<Popover targetProps={{style: {position: "absolute", right: "30px"}}}
|
|
52
53
|
minimal={true}
|
|
53
54
|
targetTagName={"div"}
|
|
54
55
|
content={
|
|
55
56
|
<ThemeSettingsMenuComponent/>
|
|
56
57
|
} placement="bottom">
|
|
57
|
-
<Button icon="
|
|
58
|
+
<Button icon="more" small minimal text="" />
|
|
58
59
|
</Popover>
|
|
60
|
+
<Button icon="minus" small minimal text="" style={{position: "absolute", right: "5px"}}
|
|
61
|
+
onClick={() => {
|
|
62
|
+
setIsMinimized(!isMinimized);
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
59
65
|
</div>
|
|
60
66
|
</Card>
|
|
67
|
+
{isMinimized && <Button icon="cog" small text="Configuration" style={{position: "absolute", right: "5px"}}
|
|
68
|
+
onClick={() => {
|
|
69
|
+
setIsMinimized(!isMinimized);
|
|
70
|
+
}}
|
|
71
|
+
/>}
|
|
61
72
|
</VisualStyleContext.Provider>
|
|
62
73
|
)
|
|
63
74
|
}
|
|
@@ -49,7 +49,7 @@ export class ExtendedNumericInput extends React.PureComponent<HTMLInputProps & N
|
|
|
49
49
|
|
|
50
50
|
public render() {
|
|
51
51
|
const {value} = this.state;
|
|
52
|
-
const props2: HTMLInputProps & NumericInputProps & { onChange2?: (v: number, last?: boolean) => void } = {...this.props}
|
|
52
|
+
const props2: HTMLInputProps & NumericInputProps & { onChange2?: (v: number, last?: boolean) => void } = {...this.props, leftIcon: undefined}
|
|
53
53
|
if (props2.onChange2) delete props2.onChange2
|
|
54
54
|
|
|
55
55
|
return (
|
|
@@ -6,7 +6,7 @@ import {UiConfigRendererContext} from '../bpComponents/BPComponent'
|
|
|
6
6
|
|
|
7
7
|
// import {ViewerAppContext} from "./ViewerAppComponent";
|
|
8
8
|
|
|
9
|
-
export function InspectorStackComponent({config}: { config: UiObjectConfig<any, 'panel'
|
|
9
|
+
export function InspectorStackComponent({config, className}: { config: UiObjectConfig<any, 'panel'>, className?: string }) {
|
|
10
10
|
const renderer = React.useContext(UiConfigRendererContext)
|
|
11
11
|
const stackItem = React.useCallback(() => {
|
|
12
12
|
return {
|
|
@@ -30,7 +30,7 @@ export function InspectorStackComponent({config}: { config: UiObjectConfig<any,
|
|
|
30
30
|
}, [setCurrentPanelStack, stackItem])
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<Card className="bpInspectorCard" style={{borderRadius: 0}}>
|
|
33
|
+
<Card className={"bpInspectorCard " + className||''} style={{borderRadius: 0}}>
|
|
34
34
|
<PanelStack2 className="inspectorPanelStack"
|
|
35
35
|
showPanelHeader={true}
|
|
36
36
|
renderActivePanelOnly={true}
|