@babylonjs/gui-editor 5.12.0 → 5.13.1
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.
@@ -50478,7 +50478,7 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
50478
50478
|
constructor(props) {
|
50479
50479
|
super(props);
|
50480
50480
|
this._localChange = false;
|
50481
|
-
this.state = { value: this._remapValueIn(this.
|
50481
|
+
this.state = { value: this._remapValueIn(this._getValue(props)) };
|
50482
50482
|
}
|
50483
50483
|
_remapValueIn(value) {
|
50484
50484
|
return this.props.allowNullValue && value === null ? Null_Value : value;
|
@@ -50486,12 +50486,18 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
50486
50486
|
_remapValueOut(value) {
|
50487
50487
|
return this.props.allowNullValue && value === Null_Value ? null : value;
|
50488
50488
|
}
|
50489
|
+
_getValue(props) {
|
50490
|
+
if (props.extractValue) {
|
50491
|
+
return props.extractValue(props.target);
|
50492
|
+
}
|
50493
|
+
return props.target && props.propertyName ? props.target[props.propertyName] : props.options[props.defaultIfNull || 0];
|
50494
|
+
}
|
50489
50495
|
shouldComponentUpdate(nextProps, nextState) {
|
50490
50496
|
if (this._localChange) {
|
50491
50497
|
this._localChange = false;
|
50492
50498
|
return true;
|
50493
50499
|
}
|
50494
|
-
const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue() : nextProps.target[nextProps.propertyName]);
|
50500
|
+
const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);
|
50495
50501
|
if (newValue != null && newValue !== nextState.value) {
|
50496
50502
|
nextState.value = newValue;
|
50497
50503
|
return true;
|
@@ -50510,10 +50516,13 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
50510
50516
|
allowNullValue: this.props.allowNullValue,
|
50511
50517
|
});
|
50512
50518
|
}
|
50519
|
+
setValue(value) {
|
50520
|
+
this.setState({ value: value });
|
50521
|
+
}
|
50513
50522
|
updateValue(valueString) {
|
50514
|
-
const value = parseInt(valueString);
|
50523
|
+
const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
|
50515
50524
|
this._localChange = true;
|
50516
|
-
const store = this.props.extractValue ? this.props.extractValue() : this.props.target[this.props.propertyName];
|
50525
|
+
const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
|
50517
50526
|
if (!this.props.noDirectUpdate) {
|
50518
50527
|
this.props.target[this.props.propertyName] = this._remapValueOut(value);
|
50519
50528
|
}
|
@@ -50521,12 +50530,12 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
50521
50530
|
if (this.props.onSelect) {
|
50522
50531
|
this.props.onSelect(value);
|
50523
50532
|
}
|
50524
|
-
const newValue = this.props.extractValue ? this.props.extractValue() : this.props.target[this.props.propertyName];
|
50533
|
+
const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
|
50525
50534
|
this.raiseOnPropertyChanged(newValue, store);
|
50526
50535
|
}
|
50527
50536
|
render() {
|
50528
50537
|
var _a;
|
50529
|
-
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "listLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "options" }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", Object.assign({ onChange: (evt) => this.updateValue(evt.target.value), value: (_a = this.state.value) !== null && _a !== void 0 ? _a : "" }, { children: this.props.options.map((option, i) => {
|
50538
|
+
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: "listLine" + (this.props.className ? " " + this.props.className : "") }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label })), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "options" }, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", Object.assign({ onChange: (evt) => this.updateValue(evt.target.value), value: (_a = this.state.value) !== null && _a !== void 0 ? _a : "" }, { children: this.props.options.map((option, i) => {
|
50530
50539
|
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("option", Object.assign({ selected: option.selected, value: option.value, title: option.label }, { children: option.label }), option.label + i));
|
50531
50540
|
}) })) }))] })));
|
50532
50541
|
}
|
@@ -50889,6 +50898,11 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
|
|
50889
50898
|
}
|
50890
50899
|
this._localChange = true;
|
50891
50900
|
const store = this.props.value !== undefined ? this.props.value : this.props.target[this.props.propertyName];
|
50901
|
+
if (this.props.validator) {
|
50902
|
+
if (this.props.validator(value) == false) {
|
50903
|
+
value = store;
|
50904
|
+
}
|
50905
|
+
}
|
50892
50906
|
this.setState({ value: value });
|
50893
50907
|
if (this.props.propertyName && !this.props.delayInput) {
|
50894
50908
|
this.props.target[this.props.propertyName] = value;
|
@@ -50922,7 +50936,21 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
|
|
50922
50936
|
const value = this.state.value === _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder ? "" : this.state.value;
|
50923
50937
|
const placeholder = this.state.value === _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder ? _targetsProxy__WEBPACK_IMPORTED_MODULE_2__.conflictingValuesPlaceholder : this.props.placeholder || "";
|
50924
50938
|
const step = this.props.step || (this.props.roundValues ? 1 : 0.01);
|
50925
|
-
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: this.props.unit !== undefined ? "textInputLine withUnits" : "textInputLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), this.props.label !== undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label }))), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.
|
50939
|
+
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: this.props.multilines ? "textInputArea" : this.props.unit !== undefined ? "textInputLine withUnits" : "textInputLine" }, { children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), this.props.label !== undefined && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", Object.assign({ className: "label", title: this.props.label }, { children: this.props.label }))), this.props.multilines && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("textarea", { value: this.state.value, onFocus: () => {
|
50940
|
+
if (this.props.lockObject) {
|
50941
|
+
this.props.lockObject.lock = true;
|
50942
|
+
}
|
50943
|
+
}, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => {
|
50944
|
+
if (evt.keyCode !== 13) {
|
50945
|
+
return;
|
50946
|
+
}
|
50947
|
+
this.updateValue(this.state.value);
|
50948
|
+
}, onBlur: (evt) => {
|
50949
|
+
this.updateValue(evt.target.value);
|
50950
|
+
if (this.props.lockObject) {
|
50951
|
+
this.props.lockObject.lock = false;
|
50952
|
+
}
|
50953
|
+
} }) })), !this.props.multilines && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", Object.assign({ className: `value${this.props.noUnderline === true ? " noUnderline" : ""}${this.props.arrows ? " hasArrows" : ""}${this.state.dragging ? " dragging" : ""}` }, { children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { value: value, onBlur: () => {
|
50926
50954
|
if (this.props.lockObject) {
|
50927
50955
|
this.props.lockObject.lock = false;
|
50928
50956
|
}
|
@@ -50931,7 +50959,7 @@ class TextInputLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
|
|
50931
50959
|
if (this.props.lockObject) {
|
50932
50960
|
this.props.lockObject.lock = true;
|
50933
50961
|
}
|
50934
|
-
}, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => this.onKeyDown(evt), placeholder: placeholder, type: this.props.numeric ? "number" : "text", step: step }), this.props.arrows && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_inputArrowsComponent__WEBPACK_IMPORTED_MODULE_3__.InputArrowsComponent, { incrementValue: (amount) => this.incrementValue(amount), setDragging: (dragging) => this.setState({ dragging }) })] })), this.props.unit] })));
|
50962
|
+
}, onChange: (evt) => this.updateValue(evt.target.value), onKeyDown: (evt) => this.onKeyDown(evt), placeholder: placeholder, type: this.props.numeric ? "number" : "text", step: step }), this.props.arrows && ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_inputArrowsComponent__WEBPACK_IMPORTED_MODULE_3__.InputArrowsComponent, { incrementValue: (amount) => this.incrementValue(amount), setDragging: (dragging) => this.setState({ dragging }) }))] }))), this.props.unit] })));
|
50935
50963
|
}
|
50936
50964
|
}
|
50937
50965
|
|