@babylonjs/shared-ui-components 5.28.0 → 5.30.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/colorPicker/colorComponentEntry.d.ts +18 -18
- package/colorPicker/colorComponentEntry.js +36 -36
- package/colorPicker/colorPicker.d.ts +43 -43
- package/colorPicker/colorPicker.js +136 -136
- package/colorPicker/hexColor.d.ts +20 -20
- package/colorPicker/hexColor.js +42 -42
- package/components/Button.d.ts +10 -10
- package/components/Button.js +6 -6
- package/components/Icon.d.ts +6 -6
- package/components/Icon.js +6 -6
- package/components/Label.d.ts +7 -7
- package/components/Label.js +6 -6
- package/components/MessageDialog.d.ts +7 -7
- package/components/MessageDialog.js +22 -22
- package/components/Toggle.d.ts +8 -8
- package/components/Toggle.js +15 -15
- package/components/bars/CommandBarComponent.d.ts +16 -16
- package/components/bars/CommandBarComponent.js +68 -68
- package/components/bars/CommandBarComponent.js.map +1 -1
- package/components/bars/CommandButtonComponent.d.ts +11 -11
- package/components/bars/CommandButtonComponent.js +6 -6
- package/components/bars/CommandDropdownComponent.d.ts +26 -26
- package/components/bars/CommandDropdownComponent.js +48 -48
- package/components/classNames.d.ts +2 -2
- package/components/classNames.js +18 -18
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -18
- package/components/colorPicker/ColorComponentEntry.js +37 -37
- package/components/colorPicker/ColorPicker.d.ts +43 -43
- package/components/colorPicker/ColorPicker.js +137 -137
- package/components/colorPicker/HexColor.d.ts +20 -20
- package/components/colorPicker/HexColor.js +45 -45
- package/components/layout/DraggableIcon.d.ts +23 -0
- package/components/layout/DraggableIcon.js +18 -0
- package/components/layout/DraggableIcon.js.map +1 -0
- package/components/layout/FlexibleColumn.d.ts +17 -0
- package/components/layout/FlexibleColumn.js +12 -0
- package/components/layout/FlexibleColumn.js.map +1 -0
- package/components/layout/FlexibleDragHandler.d.ts +18 -0
- package/components/layout/FlexibleDragHandler.js +88 -0
- package/components/layout/FlexibleDragHandler.js.map +1 -0
- package/components/layout/FlexibleDropZone.d.ts +19 -0
- package/components/layout/FlexibleDropZone.js +12 -0
- package/components/layout/FlexibleDropZone.js.map +1 -0
- package/components/layout/FlexibleGridContainer.d.ts +10 -0
- package/components/layout/FlexibleGridContainer.js +23 -0
- package/components/layout/FlexibleGridContainer.js.map +1 -0
- package/components/layout/FlexibleGridLayout.d.ts +16 -0
- package/components/layout/FlexibleGridLayout.js +24 -0
- package/components/layout/FlexibleGridLayout.js.map +1 -0
- package/components/layout/FlexibleResizeBar.d.ts +40 -0
- package/components/layout/FlexibleResizeBar.js +21 -0
- package/components/layout/FlexibleResizeBar.js.map +1 -0
- package/components/layout/FlexibleTab.d.ts +34 -0
- package/components/layout/FlexibleTab.js +36 -0
- package/components/layout/FlexibleTab.js.map +1 -0
- package/components/layout/FlexibleTabsContainer.d.ts +28 -0
- package/components/layout/FlexibleTabsContainer.js +54 -0
- package/components/layout/FlexibleTabsContainer.js.map +1 -0
- package/components/layout/LayoutContext.d.ts +12 -0
- package/components/layout/LayoutContext.js +3 -0
- package/components/layout/LayoutContext.js.map +1 -0
- package/components/layout/types.d.ts +82 -0
- package/components/layout/types.js +13 -0
- package/components/layout/types.js.map +1 -0
- package/components/layout/utils.d.ts +25 -0
- package/components/layout/utils.js +68 -0
- package/components/layout/utils.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -40
- package/components/lines/ColorLineComponent.js +145 -145
- package/components/lines/ColorPickerLineComponent.d.ts +33 -33
- package/components/lines/ColorPickerLineComponent.js +61 -61
- package/components/lines/FileButtonLineComponent.d.ts +16 -16
- package/components/lines/FileButtonLineComponent.js +21 -21
- package/components/lines/NumericInputComponent.d.ts +31 -31
- package/components/lines/NumericInputComponent.js +86 -86
- package/lines/booleanLineComponent.d.ts +11 -11
- package/lines/booleanLineComponent.js +14 -14
- package/lines/buttonLineComponent.d.ts +12 -12
- package/lines/buttonLineComponent.js +10 -10
- package/lines/checkBoxLineComponent.d.ts +36 -36
- package/lines/checkBoxLineComponent.js +88 -88
- package/lines/color3LineComponent.d.ts +18 -18
- package/lines/color3LineComponent.js +9 -9
- package/lines/color4LineComponent.d.ts +18 -18
- package/lines/color4LineComponent.js +9 -9
- package/lines/colorLineComponent.d.ts +40 -40
- package/lines/colorLineComponent.js +144 -144
- package/lines/colorPickerComponent.d.ts +31 -31
- package/lines/colorPickerComponent.js +60 -60
- package/lines/draggableLineComponent.d.ts +9 -9
- package/lines/draggableLineComponent.js +12 -12
- package/lines/fileButtonLineComponent.d.ts +17 -17
- package/lines/fileButtonLineComponent.js +20 -20
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -17
- package/lines/fileMultipleButtonLineComponent.js +20 -20
- package/lines/floatLineComponent.d.ts +50 -50
- package/lines/floatLineComponent.js +175 -175
- package/lines/hexLineComponent.d.ts +40 -40
- package/lines/hexLineComponent.js +121 -121
- package/lines/iSelectedLineContainer.d.ts +4 -4
- package/lines/iSelectedLineContainer.js +1 -1
- package/lines/iconButtonLineComponent.d.ts +11 -11
- package/lines/iconButtonLineComponent.js +10 -10
- package/lines/iconComponent.d.ts +9 -9
- package/lines/iconComponent.js +7 -7
- package/lines/indentedTextLineComponent.d.ts +16 -16
- package/lines/indentedTextLineComponent.js +26 -26
- package/lines/inputArrowsComponent.d.ts +13 -13
- package/lines/inputArrowsComponent.js +37 -37
- package/lines/lineContainerComponent.d.ts +19 -19
- package/lines/lineContainerComponent.js +49 -49
- package/lines/linkButtonComponent.d.ts +16 -16
- package/lines/linkButtonComponent.js +20 -20
- package/lines/matrixLineComponent.d.ts +36 -36
- package/lines/matrixLineComponent.js +102 -102
- package/lines/messageLineComponent.d.ts +12 -12
- package/lines/messageLineComponent.js +14 -14
- package/lines/numericInputComponent.d.ts +31 -31
- package/lines/numericInputComponent.js +85 -85
- package/lines/optionsLineComponent.d.ts +48 -48
- package/lines/optionsLineComponent.js +118 -118
- package/lines/popup.d.ts +4 -4
- package/lines/popup.js +67 -67
- package/lines/radioLineComponent.d.ts +21 -21
- package/lines/radioLineComponent.js +26 -26
- package/lines/sliderLineComponent.d.ts +37 -37
- package/lines/sliderLineComponent.js +89 -89
- package/lines/targetsProxy.d.ts +11 -11
- package/lines/targetsProxy.js +42 -42
- package/lines/textInputLineComponent.d.ts +47 -47
- package/lines/textInputLineComponent.js +154 -154
- package/lines/textLineComponent.d.ts +21 -21
- package/lines/textLineComponent.js +30 -30
- package/lines/unitButton.d.ts +8 -8
- package/lines/unitButton.js +7 -7
- package/lines/valueLineComponent.d.ts +15 -15
- package/lines/valueLineComponent.js +12 -12
- package/lines/vector2LineComponent.d.ts +36 -36
- package/lines/vector2LineComponent.js +63 -63
- package/lines/vector3LineComponent.d.ts +41 -41
- package/lines/vector3LineComponent.js +74 -74
- package/lines/vector4LineComponent.d.ts +42 -42
- package/lines/vector4LineComponent.js +81 -81
- package/nodeGraphSystem/displayLedger.d.ts +5 -5
- package/nodeGraphSystem/displayLedger.js +3 -3
- package/nodeGraphSystem/frameNodePort.d.ts +25 -25
- package/nodeGraphSystem/frameNodePort.js +59 -59
- package/nodeGraphSystem/graphCanvas.d.ts +117 -111
- package/nodeGraphSystem/graphCanvas.js +1137 -1131
- package/nodeGraphSystem/graphCanvas.js.map +1 -1
- package/nodeGraphSystem/graphFrame.d.ts +153 -153
- package/nodeGraphSystem/graphFrame.js +1328 -1328
- package/nodeGraphSystem/graphNode.d.ts +81 -79
- package/nodeGraphSystem/graphNode.js +465 -459
- package/nodeGraphSystem/graphNode.js.map +1 -1
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -13
- package/nodeGraphSystem/interfaces/displayManager.js +1 -1
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -6
- package/nodeGraphSystem/interfaces/nodeContainer.js +1 -1
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -15
- package/nodeGraphSystem/interfaces/nodeData.js +1 -1
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -26
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +1 -1
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -28
- package/nodeGraphSystem/interfaces/portData.js +7 -7
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -6
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +1 -1
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -11
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +1 -1
- package/nodeGraphSystem/nodeLink.d.ts +31 -31
- package/nodeGraphSystem/nodeLink.js +182 -182
- package/nodeGraphSystem/nodePort.d.ts +35 -35
- package/nodeGraphSystem/nodePort.js +128 -128
- package/nodeGraphSystem/propertyLedger.d.ts +8 -8
- package/nodeGraphSystem/propertyLedger.js +3 -3
- package/nodeGraphSystem/stateManager.d.ts +45 -45
- package/nodeGraphSystem/stateManager.js +18 -18
- package/nodeGraphSystem/tools.d.ts +5 -5
- package/nodeGraphSystem/tools.js +36 -36
- package/nodeGraphSystem/typeLedger.d.ts +8 -8
- package/nodeGraphSystem/typeLedger.js +2 -2
- package/nodeGraphSystem/types/framePortData.d.ts +7 -7
- package/nodeGraphSystem/types/framePortData.js +1 -1
- package/package.json +4 -3
- package/propertyChangedEvent.d.ts +7 -7
- package/propertyChangedEvent.js +2 -2
- package/stories/Button.stories.d.ts +10 -10
- package/stories/Button.stories.js +19 -19
- package/stories/Icon.stories.d.ts +9 -9
- package/stories/Icon.stories.js +16 -16
- package/stories/Label.stories.d.ts +8 -8
- package/stories/Label.stories.js +10 -10
- package/stories/MessageDialog.stories.d.ts +9 -9
- package/stories/MessageDialog.stories.js +19 -19
- package/stories/Toggle.stories.d.ts +9 -9
- package/stories/Toggle.stories.js +17 -17
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -11
- package/stories/bars/CommandBarComponent.stories.js +12 -12
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -6
- package/stories/bars/CommandButtonComponent.stories.js +6 -6
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -11
- package/stories/colorPicker/ColorPicker.stories.js +4 -4
- package/stories/layout/FlexibleGridLayout.stories.d.ts +46 -0
- package/stories/layout/FlexibleGridLayout.stories.js +48 -0
- package/stories/layout/FlexibleGridLayout.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -21
- package/stories/lines/ColorLineComponent.stories.js +9 -9
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -14
- package/stories/lines/ColorPickerLineComponent.stories.js +10 -10
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -6
- package/stories/lines/FileButtonLineComponent.stories.js +5 -5
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -11
- package/stories/lines/NumericInputComponent.stories.js +5 -5
- package/stringTools.d.ts +11 -11
- package/stringTools.js +88 -88
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +55 -55
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +12 -12
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +38 -38
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +25 -25
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -16
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +27 -27
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +34 -34
- package/tabs/propertyGrids/lockObject.d.ts +9 -9
- package/tabs/propertyGrids/lockObject.js +11 -11
@@ -1,146 +1,146 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
-
import { NumericInputComponent } from "./NumericInputComponent.js";
|
5
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
6
|
-
import { faMinus, faPlus } from "@fortawesome/free-solid-svg-icons";
|
7
|
-
import { ColorPickerLineComponent } from "./ColorPickerLineComponent.js";
|
8
|
-
import style from "./ColorLineComponent.modules.scss";
|
9
|
-
import copyIcon from "../../imgs/copy.svg";
|
10
|
-
import { JoinClassNames } from "../classNames.js";
|
11
|
-
const emptyColor = new Color4(0, 0, 0, 0);
|
12
|
-
export class ColorLineComponent extends React.Component {
|
13
|
-
constructor(props) {
|
14
|
-
super(props);
|
15
|
-
this.state = { isExpanded: false, color: this.getValue() };
|
16
|
-
const target = this.props.target;
|
17
|
-
target._isLinearColor = props.isLinear; // so that replayRecorder can append toLinearSpace() as appropriate
|
18
|
-
}
|
19
|
-
shouldComponentUpdate(nextProps, nextState) {
|
20
|
-
const stateColor = nextState.color;
|
21
|
-
const propsColor = this.getValue(nextProps);
|
22
|
-
if (stateColor !== this.state.color) {
|
23
|
-
nextState.color = stateColor;
|
24
|
-
return true;
|
25
|
-
}
|
26
|
-
if (propsColor !== this.state.color) {
|
27
|
-
nextState.color = propsColor;
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
if (nextState.isExpanded !== this.state.isExpanded) {
|
31
|
-
return true;
|
32
|
-
}
|
33
|
-
return false;
|
34
|
-
}
|
35
|
-
getValue(props = this.props) {
|
36
|
-
const target = props.target;
|
37
|
-
const property = target[props.propertyName];
|
38
|
-
if (!property)
|
39
|
-
return emptyColor;
|
40
|
-
if (typeof property === "string") {
|
41
|
-
// if (property === conflictingValuesPlaceholder) {
|
42
|
-
// return emptyColor;
|
43
|
-
// }
|
44
|
-
return this._convertToColor(property);
|
45
|
-
}
|
46
|
-
else {
|
47
|
-
if (props.isLinear) {
|
48
|
-
return property.toGammaSpace();
|
49
|
-
}
|
50
|
-
return property.clone();
|
51
|
-
}
|
52
|
-
}
|
53
|
-
setColorFromString(colorString) {
|
54
|
-
const color = this._convertToColor(colorString);
|
55
|
-
this.setColor(color);
|
56
|
-
}
|
57
|
-
setColor(newColor) {
|
58
|
-
this.setState({ color: newColor.clone() });
|
59
|
-
if (this.props.isLinear) {
|
60
|
-
newColor.toLinearSpaceToRef(newColor);
|
61
|
-
}
|
62
|
-
// whether to set properties to color3 or color4
|
63
|
-
const setColor = this.props.disableAlpha ? this._toColor3(newColor) : newColor;
|
64
|
-
const target = this.props.target;
|
65
|
-
const initialValue = target[this.props.propertyName];
|
66
|
-
const value = typeof target[this.props.propertyName] === "string" ? setColor.toHexString() : setColor;
|
67
|
-
// make the change
|
68
|
-
target[this.props.propertyName] = value;
|
69
|
-
// notify observers
|
70
|
-
if (this.props.onPropertyChangedObservable) {
|
71
|
-
this.props.onPropertyChangedObservable.notifyObservers({
|
72
|
-
object: target,
|
73
|
-
property: this.props.propertyName,
|
74
|
-
value,
|
75
|
-
initialValue,
|
76
|
-
});
|
77
|
-
}
|
78
|
-
if (this.props.onChange) {
|
79
|
-
this.props.onChange();
|
80
|
-
}
|
81
|
-
}
|
82
|
-
switchExpandState() {
|
83
|
-
this.setState({ isExpanded: !this.state.isExpanded });
|
84
|
-
}
|
85
|
-
updateStateR(value) {
|
86
|
-
this.setColor(new Color4(value, this.state.color.g, this.state.color.b, this.state.color.a));
|
87
|
-
}
|
88
|
-
updateStateG(value) {
|
89
|
-
this.setColor(new Color4(this.state.color.r, value, this.state.color.b, this.state.color.a));
|
90
|
-
}
|
91
|
-
updateStateB(value) {
|
92
|
-
this.setColor(new Color4(this.state.color.r, this.state.color.g, value, this.state.color.a));
|
93
|
-
}
|
94
|
-
updateStateA(value) {
|
95
|
-
if (this.props.disableAlpha) {
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
this.setColor(new Color4(this.state.color.r, this.state.color.g, this.state.color.b, value));
|
99
|
-
}
|
100
|
-
copyToClipboard() {
|
101
|
-
const element = document.createElement("div");
|
102
|
-
element.textContent = this.state.color.toHexString();
|
103
|
-
document.body.appendChild(element);
|
104
|
-
if (window.getSelection) {
|
105
|
-
const range = document.createRange();
|
106
|
-
range.selectNode(element);
|
107
|
-
window.getSelection().removeAllRanges();
|
108
|
-
window.getSelection().addRange(range);
|
109
|
-
}
|
110
|
-
document.execCommand("copy");
|
111
|
-
element.remove();
|
112
|
-
}
|
113
|
-
_convertToColor(color) {
|
114
|
-
if (color === "" || color === "transparent") {
|
115
|
-
return emptyColor;
|
116
|
-
}
|
117
|
-
if (color.substring(0, 1) !== "#" || (color.length !== 7 && color.length !== 9)) {
|
118
|
-
const d = document.createElement("div");
|
119
|
-
d.style.color = color;
|
120
|
-
document.body.append(d);
|
121
|
-
const rgb = window.getComputedStyle(d).color;
|
122
|
-
document.body.removeChild(d);
|
123
|
-
const rgbArray = rgb
|
124
|
-
.substring(4, rgb.length - 1)
|
125
|
-
.replace(/ /g, "")
|
126
|
-
.split(",");
|
127
|
-
const alpha = rgbArray.length > 3 ? parseInt(rgbArray[3]) / 255 : 1.0;
|
128
|
-
return new Color4(parseInt(rgbArray[0]) / 255, parseInt(rgbArray[1]) / 255, parseInt(rgbArray[2]) / 255, alpha);
|
129
|
-
}
|
130
|
-
if (this.props.disableAlpha) {
|
131
|
-
const color3 = Color3.FromHexString(color);
|
132
|
-
return new Color4(color3.r, color3.g, color3.b, 1.0);
|
133
|
-
}
|
134
|
-
return Color4.FromHexString(color);
|
135
|
-
}
|
136
|
-
_toColor3(color) {
|
137
|
-
return new Color3(color.r, color.g, color.b);
|
138
|
-
}
|
139
|
-
render() {
|
140
|
-
const chevron = this.state.isExpanded ? _jsx(FontAwesomeIcon, { icon: faMinus }) : _jsx(FontAwesomeIcon, { icon: faPlus });
|
141
|
-
return (_jsxs("div", { className: style.color3Line, children: [_jsxs("div", { className: style.firstLine, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), _jsx("div", { className: style.label, title: this.props.label, children: this.props.label }), _jsx("div", { className: style.color3, children: _jsx(ColorPickerLineComponent, { lockObject: this.props.lockObject, linearHint: this.props.isLinear, value: this.props.disableAlpha ? this._toColor3(this.state.color) : this.state.color, onColorChanged: (colorString) => {
|
142
|
-
this.setColorFromString(colorString);
|
143
|
-
} }) }), _jsx("div", { className: JoinClassNames(style, "copy", "hoverIcon"), onClick: () => this.copyToClipboard(), title: "Copy to clipboard", children: _jsx("img", { src: copyIcon, alt: "Copy" }) }), _jsx("div", { className: JoinClassNames("expand", "hoverIcon"), onClick: () => this.switchExpandState(), title: "Expand", children: chevron })] }), this.state.isExpanded && (_jsxs("div", { className: style.secondLine, children: [_jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "r", value: this.state.color.r, onChange: (value) => this.updateStateR(value) }), _jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "g", value: this.state.color.g, onChange: (value) => this.updateStateG(value) }), _jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "b", value: this.state.color.b, onChange: (value) => this.updateStateB(value) }), this.props.disableAlpha || (_jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "a", value: this.state.color.a, onChange: (value) => this.updateStateA(value) }))] }))] }));
|
144
|
-
}
|
145
|
-
}
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
+
import { NumericInputComponent } from "./NumericInputComponent.js";
|
5
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
6
|
+
import { faMinus, faPlus } from "@fortawesome/free-solid-svg-icons";
|
7
|
+
import { ColorPickerLineComponent } from "./ColorPickerLineComponent.js";
|
8
|
+
import style from "./ColorLineComponent.modules.scss";
|
9
|
+
import copyIcon from "../../imgs/copy.svg";
|
10
|
+
import { JoinClassNames } from "../classNames.js";
|
11
|
+
const emptyColor = new Color4(0, 0, 0, 0);
|
12
|
+
export class ColorLineComponent extends React.Component {
|
13
|
+
constructor(props) {
|
14
|
+
super(props);
|
15
|
+
this.state = { isExpanded: false, color: this.getValue() };
|
16
|
+
const target = this.props.target;
|
17
|
+
target._isLinearColor = props.isLinear; // so that replayRecorder can append toLinearSpace() as appropriate
|
18
|
+
}
|
19
|
+
shouldComponentUpdate(nextProps, nextState) {
|
20
|
+
const stateColor = nextState.color;
|
21
|
+
const propsColor = this.getValue(nextProps);
|
22
|
+
if (stateColor !== this.state.color) {
|
23
|
+
nextState.color = stateColor;
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (propsColor !== this.state.color) {
|
27
|
+
nextState.color = propsColor;
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
if (nextState.isExpanded !== this.state.isExpanded) {
|
31
|
+
return true;
|
32
|
+
}
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
getValue(props = this.props) {
|
36
|
+
const target = props.target;
|
37
|
+
const property = target[props.propertyName];
|
38
|
+
if (!property)
|
39
|
+
return emptyColor;
|
40
|
+
if (typeof property === "string") {
|
41
|
+
// if (property === conflictingValuesPlaceholder) {
|
42
|
+
// return emptyColor;
|
43
|
+
// }
|
44
|
+
return this._convertToColor(property);
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
if (props.isLinear) {
|
48
|
+
return property.toGammaSpace();
|
49
|
+
}
|
50
|
+
return property.clone();
|
51
|
+
}
|
52
|
+
}
|
53
|
+
setColorFromString(colorString) {
|
54
|
+
const color = this._convertToColor(colorString);
|
55
|
+
this.setColor(color);
|
56
|
+
}
|
57
|
+
setColor(newColor) {
|
58
|
+
this.setState({ color: newColor.clone() });
|
59
|
+
if (this.props.isLinear) {
|
60
|
+
newColor.toLinearSpaceToRef(newColor);
|
61
|
+
}
|
62
|
+
// whether to set properties to color3 or color4
|
63
|
+
const setColor = this.props.disableAlpha ? this._toColor3(newColor) : newColor;
|
64
|
+
const target = this.props.target;
|
65
|
+
const initialValue = target[this.props.propertyName];
|
66
|
+
const value = typeof target[this.props.propertyName] === "string" ? setColor.toHexString() : setColor;
|
67
|
+
// make the change
|
68
|
+
target[this.props.propertyName] = value;
|
69
|
+
// notify observers
|
70
|
+
if (this.props.onPropertyChangedObservable) {
|
71
|
+
this.props.onPropertyChangedObservable.notifyObservers({
|
72
|
+
object: target,
|
73
|
+
property: this.props.propertyName,
|
74
|
+
value,
|
75
|
+
initialValue,
|
76
|
+
});
|
77
|
+
}
|
78
|
+
if (this.props.onChange) {
|
79
|
+
this.props.onChange();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
switchExpandState() {
|
83
|
+
this.setState({ isExpanded: !this.state.isExpanded });
|
84
|
+
}
|
85
|
+
updateStateR(value) {
|
86
|
+
this.setColor(new Color4(value, this.state.color.g, this.state.color.b, this.state.color.a));
|
87
|
+
}
|
88
|
+
updateStateG(value) {
|
89
|
+
this.setColor(new Color4(this.state.color.r, value, this.state.color.b, this.state.color.a));
|
90
|
+
}
|
91
|
+
updateStateB(value) {
|
92
|
+
this.setColor(new Color4(this.state.color.r, this.state.color.g, value, this.state.color.a));
|
93
|
+
}
|
94
|
+
updateStateA(value) {
|
95
|
+
if (this.props.disableAlpha) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
this.setColor(new Color4(this.state.color.r, this.state.color.g, this.state.color.b, value));
|
99
|
+
}
|
100
|
+
copyToClipboard() {
|
101
|
+
const element = document.createElement("div");
|
102
|
+
element.textContent = this.state.color.toHexString();
|
103
|
+
document.body.appendChild(element);
|
104
|
+
if (window.getSelection) {
|
105
|
+
const range = document.createRange();
|
106
|
+
range.selectNode(element);
|
107
|
+
window.getSelection().removeAllRanges();
|
108
|
+
window.getSelection().addRange(range);
|
109
|
+
}
|
110
|
+
document.execCommand("copy");
|
111
|
+
element.remove();
|
112
|
+
}
|
113
|
+
_convertToColor(color) {
|
114
|
+
if (color === "" || color === "transparent") {
|
115
|
+
return emptyColor;
|
116
|
+
}
|
117
|
+
if (color.substring(0, 1) !== "#" || (color.length !== 7 && color.length !== 9)) {
|
118
|
+
const d = document.createElement("div");
|
119
|
+
d.style.color = color;
|
120
|
+
document.body.append(d);
|
121
|
+
const rgb = window.getComputedStyle(d).color;
|
122
|
+
document.body.removeChild(d);
|
123
|
+
const rgbArray = rgb
|
124
|
+
.substring(4, rgb.length - 1)
|
125
|
+
.replace(/ /g, "")
|
126
|
+
.split(",");
|
127
|
+
const alpha = rgbArray.length > 3 ? parseInt(rgbArray[3]) / 255 : 1.0;
|
128
|
+
return new Color4(parseInt(rgbArray[0]) / 255, parseInt(rgbArray[1]) / 255, parseInt(rgbArray[2]) / 255, alpha);
|
129
|
+
}
|
130
|
+
if (this.props.disableAlpha) {
|
131
|
+
const color3 = Color3.FromHexString(color);
|
132
|
+
return new Color4(color3.r, color3.g, color3.b, 1.0);
|
133
|
+
}
|
134
|
+
return Color4.FromHexString(color);
|
135
|
+
}
|
136
|
+
_toColor3(color) {
|
137
|
+
return new Color3(color.r, color.g, color.b);
|
138
|
+
}
|
139
|
+
render() {
|
140
|
+
const chevron = this.state.isExpanded ? _jsx(FontAwesomeIcon, { icon: faMinus }) : _jsx(FontAwesomeIcon, { icon: faPlus });
|
141
|
+
return (_jsxs("div", { className: style.color3Line, children: [_jsxs("div", { className: style.firstLine, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), _jsx("div", { className: style.label, title: this.props.label, children: this.props.label }), _jsx("div", { className: style.color3, children: _jsx(ColorPickerLineComponent, { lockObject: this.props.lockObject, linearHint: this.props.isLinear, value: this.props.disableAlpha ? this._toColor3(this.state.color) : this.state.color, onColorChanged: (colorString) => {
|
142
|
+
this.setColorFromString(colorString);
|
143
|
+
} }) }), _jsx("div", { className: JoinClassNames(style, "copy", "hoverIcon"), onClick: () => this.copyToClipboard(), title: "Copy to clipboard", children: _jsx("img", { src: copyIcon, alt: "Copy" }) }), _jsx("div", { className: JoinClassNames("expand", "hoverIcon"), onClick: () => this.switchExpandState(), title: "Expand", children: chevron })] }), this.state.isExpanded && (_jsxs("div", { className: style.secondLine, children: [_jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "r", value: this.state.color.r, onChange: (value) => this.updateStateR(value) }), _jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "g", value: this.state.color.g, onChange: (value) => this.updateStateG(value) }), _jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "b", value: this.state.color.b, onChange: (value) => this.updateStateB(value) }), this.props.disableAlpha || (_jsx(NumericInputComponent, { lockObject: this.props.lockObject, label: "a", value: this.state.color.a, onChange: (value) => this.updateStateA(value) }))] }))] }));
|
144
|
+
}
|
145
|
+
}
|
146
146
|
//# sourceMappingURL=ColorLineComponent.js.map
|
@@ -1,33 +1,33 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import type { Color4, Color3 } from "@babylonjs/core/Maths/math.color.js";
|
3
|
-
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
4
|
-
export interface IColorPickerComponentProps {
|
5
|
-
value: Color4 | Color3;
|
6
|
-
linearHint?: boolean;
|
7
|
-
onColorChanged: (newOne: string) => void;
|
8
|
-
icon?: string;
|
9
|
-
iconLabel?: string;
|
10
|
-
shouldPopRight?: boolean;
|
11
|
-
lockObject?: LockObject;
|
12
|
-
backgroundColor?: string;
|
13
|
-
}
|
14
|
-
interface IColorPickerComponentState {
|
15
|
-
pickerEnabled: boolean;
|
16
|
-
color: Color3 | Color4;
|
17
|
-
hex: string;
|
18
|
-
}
|
19
|
-
export declare class ColorPickerLineComponent extends React.Component<IColorPickerComponentProps, IColorPickerComponentState> {
|
20
|
-
private _floatRef;
|
21
|
-
private _floatHostRef;
|
22
|
-
private _coverRef;
|
23
|
-
constructor(props: IColorPickerComponentProps);
|
24
|
-
syncPositions(): void;
|
25
|
-
shouldComponentUpdate(nextProps: IColorPickerComponentProps, nextState: IColorPickerComponentState): boolean;
|
26
|
-
getHexString(props?: Readonly<IColorPickerComponentProps> & Readonly<{
|
27
|
-
children?: React.ReactNode;
|
28
|
-
}>): string;
|
29
|
-
componentDidUpdate(): void;
|
30
|
-
componentDidMount(): void;
|
31
|
-
render(): JSX.Element;
|
32
|
-
}
|
33
|
-
export {};
|
1
|
+
import * as React from "react";
|
2
|
+
import type { Color4, Color3 } from "@babylonjs/core/Maths/math.color.js";
|
3
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
4
|
+
export interface IColorPickerComponentProps {
|
5
|
+
value: Color4 | Color3;
|
6
|
+
linearHint?: boolean;
|
7
|
+
onColorChanged: (newOne: string) => void;
|
8
|
+
icon?: string;
|
9
|
+
iconLabel?: string;
|
10
|
+
shouldPopRight?: boolean;
|
11
|
+
lockObject?: LockObject;
|
12
|
+
backgroundColor?: string;
|
13
|
+
}
|
14
|
+
interface IColorPickerComponentState {
|
15
|
+
pickerEnabled: boolean;
|
16
|
+
color: Color3 | Color4;
|
17
|
+
hex: string;
|
18
|
+
}
|
19
|
+
export declare class ColorPickerLineComponent extends React.Component<IColorPickerComponentProps, IColorPickerComponentState> {
|
20
|
+
private _floatRef;
|
21
|
+
private _floatHostRef;
|
22
|
+
private _coverRef;
|
23
|
+
constructor(props: IColorPickerComponentProps);
|
24
|
+
syncPositions(): void;
|
25
|
+
shouldComponentUpdate(nextProps: IColorPickerComponentProps, nextState: IColorPickerComponentState): boolean;
|
26
|
+
getHexString(props?: Readonly<IColorPickerComponentProps> & Readonly<{
|
27
|
+
children?: React.ReactNode;
|
28
|
+
}>): string;
|
29
|
+
componentDidUpdate(): void;
|
30
|
+
componentDidMount(): void;
|
31
|
+
render(): JSX.Element;
|
32
|
+
}
|
33
|
+
export {};
|
@@ -1,62 +1,62 @@
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import { ColorPicker } from "../colorPicker/ColorPicker.js";
|
4
|
-
import style from "./ColorPickerLineComponent.modules.scss";
|
5
|
-
export class ColorPickerLineComponent extends React.Component {
|
6
|
-
constructor(props) {
|
7
|
-
super(props);
|
8
|
-
this.state = { pickerEnabled: false, color: this.props.value, hex: this.getHexString(props) };
|
9
|
-
this._floatRef = React.createRef();
|
10
|
-
this._floatHostRef = React.createRef();
|
11
|
-
this._coverRef = React.createRef();
|
12
|
-
}
|
13
|
-
syncPositions() {
|
14
|
-
const div = this._floatRef.current;
|
15
|
-
const host = this._floatHostRef.current;
|
16
|
-
if (!div || !host) {
|
17
|
-
return;
|
18
|
-
}
|
19
|
-
let top = host.getBoundingClientRect().top;
|
20
|
-
const height = div.getBoundingClientRect().height;
|
21
|
-
if (top + height + 10 > window.innerHeight) {
|
22
|
-
top = window.innerHeight - height - 10;
|
23
|
-
}
|
24
|
-
div.style.top = top + "px";
|
25
|
-
if (!this.props.shouldPopRight) {
|
26
|
-
div.style.left = host.getBoundingClientRect().left - div.getBoundingClientRect().width + "px";
|
27
|
-
}
|
28
|
-
else {
|
29
|
-
div.style.left = host.getBoundingClientRect().left + "px";
|
30
|
-
}
|
31
|
-
}
|
32
|
-
shouldComponentUpdate(nextProps, nextState) {
|
33
|
-
const diffProps = this.getHexString(nextProps) !== this.getHexString();
|
34
|
-
if (diffProps) {
|
35
|
-
nextState.color = nextProps.value;
|
36
|
-
nextState.hex = this.getHexString(nextProps);
|
37
|
-
}
|
38
|
-
return diffProps || nextState.hex !== this.state.hex || nextState.pickerEnabled !== this.state.pickerEnabled;
|
39
|
-
}
|
40
|
-
getHexString(props = this.props) {
|
41
|
-
return props.value.toHexString();
|
42
|
-
}
|
43
|
-
componentDidUpdate() {
|
44
|
-
this.syncPositions();
|
45
|
-
}
|
46
|
-
componentDidMount() {
|
47
|
-
this.syncPositions();
|
48
|
-
}
|
49
|
-
render() {
|
50
|
-
return (_jsxs("div", { className: style.colorPicker, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), _jsx("div", { className: style.colorRectBackground, ref: this._floatHostRef, onClick: () => this.setState({ pickerEnabled: true }), children: _jsx("div", { className: style.colorRect, style: { background: this.state.hex } }) }), this.state.pickerEnabled && (_jsx(_Fragment, { children: _jsx("div", { ref: this._coverRef, className: style.colorPickerCover, onClick: (evt) => {
|
51
|
-
if (evt.target !== this._coverRef.current) {
|
52
|
-
return;
|
53
|
-
}
|
54
|
-
this.setState({ pickerEnabled: false });
|
55
|
-
}, children: _jsx("div", { className: style.colorPickerFloat, ref: this._floatRef, children: _jsx(ColorPicker, { backgroundColor: this.props.backgroundColor, lockObject: this.props.lockObject || {}, color: this.state.color, linearhint: this.props.linearHint, onColorChanged: (color) => {
|
56
|
-
const hex = color.toHexString();
|
57
|
-
this.setState({ hex, color });
|
58
|
-
this.props.onColorChanged(hex);
|
59
|
-
} }) }) }) }))] }));
|
60
|
-
}
|
61
|
-
}
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { ColorPicker } from "../colorPicker/ColorPicker.js";
|
4
|
+
import style from "./ColorPickerLineComponent.modules.scss";
|
5
|
+
export class ColorPickerLineComponent extends React.Component {
|
6
|
+
constructor(props) {
|
7
|
+
super(props);
|
8
|
+
this.state = { pickerEnabled: false, color: this.props.value, hex: this.getHexString(props) };
|
9
|
+
this._floatRef = React.createRef();
|
10
|
+
this._floatHostRef = React.createRef();
|
11
|
+
this._coverRef = React.createRef();
|
12
|
+
}
|
13
|
+
syncPositions() {
|
14
|
+
const div = this._floatRef.current;
|
15
|
+
const host = this._floatHostRef.current;
|
16
|
+
if (!div || !host) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
let top = host.getBoundingClientRect().top;
|
20
|
+
const height = div.getBoundingClientRect().height;
|
21
|
+
if (top + height + 10 > window.innerHeight) {
|
22
|
+
top = window.innerHeight - height - 10;
|
23
|
+
}
|
24
|
+
div.style.top = top + "px";
|
25
|
+
if (!this.props.shouldPopRight) {
|
26
|
+
div.style.left = host.getBoundingClientRect().left - div.getBoundingClientRect().width + "px";
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
div.style.left = host.getBoundingClientRect().left + "px";
|
30
|
+
}
|
31
|
+
}
|
32
|
+
shouldComponentUpdate(nextProps, nextState) {
|
33
|
+
const diffProps = this.getHexString(nextProps) !== this.getHexString();
|
34
|
+
if (diffProps) {
|
35
|
+
nextState.color = nextProps.value;
|
36
|
+
nextState.hex = this.getHexString(nextProps);
|
37
|
+
}
|
38
|
+
return diffProps || nextState.hex !== this.state.hex || nextState.pickerEnabled !== this.state.pickerEnabled;
|
39
|
+
}
|
40
|
+
getHexString(props = this.props) {
|
41
|
+
return props.value.toHexString();
|
42
|
+
}
|
43
|
+
componentDidUpdate() {
|
44
|
+
this.syncPositions();
|
45
|
+
}
|
46
|
+
componentDidMount() {
|
47
|
+
this.syncPositions();
|
48
|
+
}
|
49
|
+
render() {
|
50
|
+
return (_jsxs("div", { className: style.colorPicker, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, className: "icon" }), _jsx("div", { className: style.colorRectBackground, ref: this._floatHostRef, onClick: () => this.setState({ pickerEnabled: true }), children: _jsx("div", { className: style.colorRect, style: { background: this.state.hex } }) }), this.state.pickerEnabled && (_jsx(_Fragment, { children: _jsx("div", { ref: this._coverRef, className: style.colorPickerCover, onClick: (evt) => {
|
51
|
+
if (evt.target !== this._coverRef.current) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
this.setState({ pickerEnabled: false });
|
55
|
+
}, children: _jsx("div", { className: style.colorPickerFloat, ref: this._floatRef, children: _jsx(ColorPicker, { backgroundColor: this.props.backgroundColor, lockObject: this.props.lockObject || {}, color: this.state.color, linearhint: this.props.linearHint, onColorChanged: (color) => {
|
56
|
+
const hex = color.toHexString();
|
57
|
+
this.setState({ hex, color });
|
58
|
+
this.props.onColorChanged(hex);
|
59
|
+
} }) }) }) }))] }));
|
60
|
+
}
|
61
|
+
}
|
62
62
|
//# sourceMappingURL=ColorPickerLineComponent.js.map
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
export interface IFileButtonLineComponentProps {
|
3
|
-
label: string;
|
4
|
-
onClick: (file: File) => void;
|
5
|
-
accept: string;
|
6
|
-
icon?: string;
|
7
|
-
iconLabel?: string;
|
8
|
-
}
|
9
|
-
export declare class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
|
10
|
-
private static _IDGenerator;
|
11
|
-
private _id;
|
12
|
-
private _uploadInputRef;
|
13
|
-
constructor(props: IFileButtonLineComponentProps);
|
14
|
-
onChange(evt: any): void;
|
15
|
-
render(): JSX.Element;
|
16
|
-
}
|
1
|
+
import * as React from "react";
|
2
|
+
export interface IFileButtonLineComponentProps {
|
3
|
+
label: string;
|
4
|
+
onClick: (file: File) => void;
|
5
|
+
accept: string;
|
6
|
+
icon?: string;
|
7
|
+
iconLabel?: string;
|
8
|
+
}
|
9
|
+
export declare class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {
|
10
|
+
private static _IDGenerator;
|
11
|
+
private _id;
|
12
|
+
private _uploadInputRef;
|
13
|
+
constructor(props: IFileButtonLineComponentProps);
|
14
|
+
onChange(evt: any): void;
|
15
|
+
render(): JSX.Element;
|
16
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import styles from "./FileButtonLineComponent.modules.scss";
|
4
|
-
export class FileButtonLineComponent extends React.Component {
|
5
|
-
constructor(props) {
|
6
|
-
super(props);
|
7
|
-
this._id = FileButtonLineComponent._IDGenerator++;
|
8
|
-
this._uploadInputRef = React.createRef();
|
9
|
-
}
|
10
|
-
onChange(evt) {
|
11
|
-
const files = evt.target.files;
|
12
|
-
if (files && files.length) {
|
13
|
-
this.props.onClick(files[0]);
|
14
|
-
}
|
15
|
-
evt.target.value = "";
|
16
|
-
}
|
17
|
-
render() {
|
18
|
-
return (_jsxs("div", { className: styles.buttonLine, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel }), _jsx("label", { htmlFor: "file-upload" + this._id, className: styles.fileUpload, children: this.props.label }), _jsx("input", { ref: this._uploadInputRef, id: "file-upload" + this._id, type: "file", accept: this.props.accept, onChange: (evt) => this.onChange(evt) })] }));
|
19
|
-
}
|
20
|
-
}
|
21
|
-
FileButtonLineComponent._IDGenerator = 0;
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import styles from "./FileButtonLineComponent.modules.scss";
|
4
|
+
export class FileButtonLineComponent extends React.Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
this._id = FileButtonLineComponent._IDGenerator++;
|
8
|
+
this._uploadInputRef = React.createRef();
|
9
|
+
}
|
10
|
+
onChange(evt) {
|
11
|
+
const files = evt.target.files;
|
12
|
+
if (files && files.length) {
|
13
|
+
this.props.onClick(files[0]);
|
14
|
+
}
|
15
|
+
evt.target.value = "";
|
16
|
+
}
|
17
|
+
render() {
|
18
|
+
return (_jsxs("div", { className: styles.buttonLine, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel }), _jsx("label", { htmlFor: "file-upload" + this._id, className: styles.fileUpload, children: this.props.label }), _jsx("input", { ref: this._uploadInputRef, id: "file-upload" + this._id, type: "file", accept: this.props.accept, onChange: (evt) => this.onChange(evt) })] }));
|
19
|
+
}
|
20
|
+
}
|
21
|
+
FileButtonLineComponent._IDGenerator = 0;
|
22
22
|
//# sourceMappingURL=FileButtonLineComponent.js.map
|
@@ -1,31 +1,31 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
-
interface INumericInputComponentProps {
|
4
|
-
label: string;
|
5
|
-
value: number;
|
6
|
-
step?: number;
|
7
|
-
onChange: (value: number) => void;
|
8
|
-
precision?: number;
|
9
|
-
icon?: string;
|
10
|
-
iconLabel?: string;
|
11
|
-
lockObject: LockObject;
|
12
|
-
}
|
13
|
-
export declare class NumericInputComponent extends React.Component<INumericInputComponentProps, {
|
14
|
-
value: string;
|
15
|
-
}> {
|
16
|
-
static defaultProps: {
|
17
|
-
step: number;
|
18
|
-
};
|
19
|
-
private _localChange;
|
20
|
-
constructor(props: INumericInputComponentProps);
|
21
|
-
componentWillUnmount(): void;
|
22
|
-
shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
|
23
|
-
value: string;
|
24
|
-
}): boolean;
|
25
|
-
updateValue(valueString: string): void;
|
26
|
-
onBlur(): void;
|
27
|
-
incrementValue(amount: number): void;
|
28
|
-
onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>): void;
|
29
|
-
render(): JSX.Element;
|
30
|
-
}
|
31
|
-
export {};
|
1
|
+
import * as React from "react";
|
2
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
+
interface INumericInputComponentProps {
|
4
|
+
label: string;
|
5
|
+
value: number;
|
6
|
+
step?: number;
|
7
|
+
onChange: (value: number) => void;
|
8
|
+
precision?: number;
|
9
|
+
icon?: string;
|
10
|
+
iconLabel?: string;
|
11
|
+
lockObject: LockObject;
|
12
|
+
}
|
13
|
+
export declare class NumericInputComponent extends React.Component<INumericInputComponentProps, {
|
14
|
+
value: string;
|
15
|
+
}> {
|
16
|
+
static defaultProps: {
|
17
|
+
step: number;
|
18
|
+
};
|
19
|
+
private _localChange;
|
20
|
+
constructor(props: INumericInputComponentProps);
|
21
|
+
componentWillUnmount(): void;
|
22
|
+
shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: {
|
23
|
+
value: string;
|
24
|
+
}): boolean;
|
25
|
+
updateValue(valueString: string): void;
|
26
|
+
onBlur(): void;
|
27
|
+
incrementValue(amount: number): void;
|
28
|
+
onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>): void;
|
29
|
+
render(): JSX.Element;
|
30
|
+
}
|
31
|
+
export {};
|