kitchen-simulator 4.0.2-react-18 → 4.0.2
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/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +165 -107
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/png/helper/video_preview_start.png +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +1 -0
- package/es/catalog/utils/item-loader.js +18 -12
- package/es/class/hole.js +0 -2
- package/es/class/item.js +95 -69
- package/es/class/line.js +4 -8
- package/es/class/project.js +93 -80
- package/es/components/content.js +5 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +11 -22
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +17 -47
- package/es/components/viewer2d/ruler.js +5 -3
- package/es/components/viewer2d/rulerDist.js +8 -7
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +4 -1
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/viewer2d.js +51 -84
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +51 -15
- package/es/components/viewer3d/viewer3d-first-person.js +8 -0
- package/es/components/viewer3d/viewer3d.js +80 -88
- package/es/constants.js +6 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +567 -25
- package/es/models.js +2 -1
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +3 -0
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +64 -106
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +824 -605
- package/es/utils/molding.js +457 -11
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +164 -107
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/png/helper/video_preview_start.png +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +1 -0
- package/lib/catalog/utils/item-loader.js +18 -12
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +93 -67
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +93 -80
- package/lib/components/content.js +5 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +11 -22
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +17 -47
- package/lib/components/viewer2d/ruler.js +4 -2
- package/lib/components/viewer2d/rulerDist.js +8 -7
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +4 -1
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/viewer2d.js +49 -81
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +49 -13
- package/lib/components/viewer3d/viewer3d-first-person.js +8 -0
- package/lib/components/viewer3d/viewer3d.js +77 -84
- package/lib/constants.js +11 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +567 -25
- package/lib/models.js +2 -1
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +3 -0
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +64 -106
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +824 -604
- package/lib/utils/molding.js +458 -9
- package/package.json +21 -16
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
package/es/LiteRenderer.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -7,74 +6,57 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
8
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
-
var _excluded = ["width", "height", "configData", "
|
|
11
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
var _excluded = ["width", "height", "configData", "externalEvent", "onInternalEvent", "onError"];
|
|
12
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
16
|
-
|
|
17
|
+
// LiteRenderer.jsx
|
|
18
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
17
19
|
import PropTypes from 'prop-types';
|
|
18
20
|
import { Provider } from 'react-redux';
|
|
19
21
|
import { createStore } from 'redux';
|
|
22
|
+
import { Map } from 'immutable';
|
|
23
|
+
import * as Sentry from '@sentry/react';
|
|
24
|
+
import * as THREE from 'three';
|
|
20
25
|
import * as Models from "./models";
|
|
21
26
|
import { State } from "./models";
|
|
22
27
|
import PlannerReducer from "./reducers/reducer";
|
|
28
|
+
import AppContext from "./AppContext";
|
|
23
29
|
import Catalog from "./catalog/catalog";
|
|
24
30
|
import * as Areas from "./catalog/areas/area/planner-element";
|
|
25
31
|
import * as Lines from "./catalog/lines/wall/planner-element";
|
|
26
32
|
import * as Holes from "./catalog/holes/export";
|
|
27
|
-
import {
|
|
28
|
-
import * as Sentry from '@sentry/react';
|
|
29
|
-
import * as THREE from 'three';
|
|
33
|
+
import { ConsoleDebugger, Keyboard } from "./plugins/export";
|
|
30
34
|
import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
|
|
31
|
-
|
|
35
|
+
var isBrowser = typeof window !== 'undefined';
|
|
36
|
+
if (isBrowser) window.THREE = THREE;
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//define reducer
|
|
45
|
-
var reducer = function reducer(state, action) {
|
|
46
|
-
state = state || AppState;
|
|
47
|
-
state = state.update('KitchenConfigurator', function (plannerState) {
|
|
48
|
-
return PlannerReducer(plannerState, action);
|
|
38
|
+
// ---- Keep prior Sentry behavior but ensure it only initializes once ----
|
|
39
|
+
var __sentryInited = false;
|
|
40
|
+
function ensureSentryInit() {
|
|
41
|
+
if (!isBrowser) return;
|
|
42
|
+
// assumes isProduction exists in your build just like today
|
|
43
|
+
if (!isProduction) return;
|
|
44
|
+
if (__sentryInited) return;
|
|
45
|
+
__sentryInited = true;
|
|
46
|
+
Sentry.init({
|
|
47
|
+
dsn: process.env.SENTRY_DSN,
|
|
48
|
+
environment: process.env.SENTRY_ENVIRONMENT
|
|
49
49
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"export": true,
|
|
61
|
-
// export history of actions in a file
|
|
62
|
-
"import": 'custom',
|
|
63
|
-
// import history of actions from a file
|
|
64
|
-
jump: true,
|
|
65
|
-
// jump back and forth (time travelling)
|
|
66
|
-
skip: true,
|
|
67
|
-
// skip (cancel) actions
|
|
68
|
-
reorder: true,
|
|
69
|
-
// drag and drop actions in the history list
|
|
70
|
-
dispatch: true,
|
|
71
|
-
// dispatch custom actions or action creators
|
|
72
|
-
test: true // generate tests for the selected actions
|
|
73
|
-
},
|
|
74
|
-
maxAge: 999999
|
|
75
|
-
}) : function (f) {
|
|
76
|
-
return f;
|
|
77
|
-
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ---------------- error helpers ----------------
|
|
53
|
+
function safeJson(v) {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(JSON.stringify(v));
|
|
56
|
+
} catch (_unused) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
78
60
|
function serializeError(err) {
|
|
79
61
|
try {
|
|
80
62
|
if (!err) return {
|
|
@@ -91,19 +73,12 @@ function serializeError(err) {
|
|
|
91
73
|
message: String(err),
|
|
92
74
|
raw: safeJson(err)
|
|
93
75
|
};
|
|
94
|
-
} catch (
|
|
76
|
+
} catch (_unused2) {
|
|
95
77
|
return {
|
|
96
78
|
message: 'Error serializing error'
|
|
97
79
|
};
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
|
-
function safeJson(v) {
|
|
101
|
-
try {
|
|
102
|
-
return JSON.parse(JSON.stringify(v));
|
|
103
|
-
} catch (_unused2) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
82
|
|
|
108
83
|
/* ---------- Error Boundary that pushes into buffer ---------- */
|
|
109
84
|
var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
@@ -131,35 +106,139 @@ var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
131
106
|
}
|
|
132
107
|
}]);
|
|
133
108
|
}(React.Component);
|
|
109
|
+
ToolErrorBoundary.propTypes = {
|
|
110
|
+
pushError: PropTypes.func.isRequired,
|
|
111
|
+
children: PropTypes.any
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// ----------------- catalog init -----------------
|
|
115
|
+
function initCatalogOnce(catalog) {
|
|
116
|
+
if (!catalog) return;
|
|
117
|
+
if (catalog.__ksInitialized) return;
|
|
118
|
+
for (var x in Areas) catalog.registerElement(Areas[x]);
|
|
119
|
+
for (var _x in Lines) catalog.registerElement(Lines[_x]);
|
|
120
|
+
for (var _x2 in Holes) catalog.registerElement(Holes[_x2]);
|
|
121
|
+
catalog.registerCategory('Windows', 'Windows', [Holes.windowClear, Holes.windowCross, Holes.windowDoubleHung, Holes.windowVertical]);
|
|
122
|
+
catalog.registerCategory('Doors', 'Doors', [Holes.doorInterior, Holes.doorExterior, Holes.doorCloset, Holes.doorSliding, Holes.doorwayFramed, Holes.doorwayFrameless]);
|
|
123
|
+
catalog.__ksInitialized = true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ----------------- store factory -----------------
|
|
127
|
+
function createInstanceStore() {
|
|
128
|
+
var AppState = Map({
|
|
129
|
+
KitchenConfigurator: new State()
|
|
130
|
+
});
|
|
131
|
+
var reducer = function reducer(state, action) {
|
|
132
|
+
state = state || AppState;
|
|
133
|
+
return state.update('KitchenConfigurator', function (plannerState) {
|
|
134
|
+
return PlannerReducer(plannerState, action);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
var enhancer = !isProduction && isBrowser && window.devToolsExtension ? window.devToolsExtension({
|
|
138
|
+
features: {
|
|
139
|
+
pause: true,
|
|
140
|
+
lock: true,
|
|
141
|
+
persist: true,
|
|
142
|
+
"export": true,
|
|
143
|
+
"import": 'custom',
|
|
144
|
+
jump: true,
|
|
145
|
+
skip: true,
|
|
146
|
+
reorder: true,
|
|
147
|
+
dispatch: true,
|
|
148
|
+
test: true
|
|
149
|
+
},
|
|
150
|
+
maxAge: 999999
|
|
151
|
+
}) : function (f) {
|
|
152
|
+
return f;
|
|
153
|
+
};
|
|
154
|
+
return createStore(reducer, null, enhancer);
|
|
155
|
+
}
|
|
156
|
+
function createPlugins() {
|
|
157
|
+
return [Keyboard(), ConsoleDebugger()];
|
|
158
|
+
}
|
|
134
159
|
export default function LiteRenderer(props) {
|
|
160
|
+
ensureSentryInit();
|
|
135
161
|
var width = props.width,
|
|
136
162
|
height = props.height,
|
|
137
163
|
configData = props.configData,
|
|
138
|
-
options = props.options,
|
|
139
|
-
user = props.user,
|
|
140
|
-
auth = props.auth,
|
|
141
|
-
featureFlags = props.featureFlags,
|
|
142
|
-
sentry = props.sentry,
|
|
143
|
-
analytics = props.analytics,
|
|
144
164
|
externalEvent = props.externalEvent,
|
|
145
165
|
onInternalEvent = props.onInternalEvent,
|
|
146
166
|
onError = props.onError,
|
|
147
167
|
passThrough = _objectWithoutProperties(props, _excluded);
|
|
148
168
|
|
|
169
|
+
// ✅ instance-scoped store (no module singleton)
|
|
170
|
+
var storeRef = useRef(null);
|
|
171
|
+
if (!storeRef.current) storeRef.current = createInstanceStore();
|
|
172
|
+
|
|
173
|
+
// ✅ instance-scoped catalog (no module singleton)
|
|
174
|
+
var catalogRef = useRef(null);
|
|
175
|
+
if (!catalogRef.current) {
|
|
176
|
+
catalogRef.current = new Catalog();
|
|
177
|
+
initCatalogOnce(catalogRef.current);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ✅ stable plugins array
|
|
181
|
+
var plugins = useMemo(function () {
|
|
182
|
+
return createPlugins();
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
// ✅ plugin lifecycle: supports cleanup if plugin returns function
|
|
186
|
+
var pluginCleanupsRef = useRef([]);
|
|
187
|
+
useEffect(function () {
|
|
188
|
+
var store = storeRef.current;
|
|
189
|
+
var stateExtractor = function stateExtractor(state) {
|
|
190
|
+
return state.get('KitchenConfigurator');
|
|
191
|
+
};
|
|
192
|
+
var cleanups = [];
|
|
193
|
+
var _iterator = _createForOfIteratorHelper(plugins),
|
|
194
|
+
_step;
|
|
195
|
+
try {
|
|
196
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
197
|
+
var p = _step.value;
|
|
198
|
+
try {
|
|
199
|
+
var maybeCleanup = p === null || p === void 0 ? void 0 : p(store, stateExtractor);
|
|
200
|
+
if (typeof maybeCleanup === 'function') cleanups.push(maybeCleanup);
|
|
201
|
+
} catch (_unused4) {
|
|
202
|
+
// keep prior behavior: do not crash
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} catch (err) {
|
|
206
|
+
_iterator.e(err);
|
|
207
|
+
} finally {
|
|
208
|
+
_iterator.f();
|
|
209
|
+
}
|
|
210
|
+
pluginCleanupsRef.current = cleanups;
|
|
211
|
+
return function () {
|
|
212
|
+
var _iterator2 = _createForOfIteratorHelper(pluginCleanupsRef.current),
|
|
213
|
+
_step2;
|
|
214
|
+
try {
|
|
215
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
216
|
+
var fn = _step2.value;
|
|
217
|
+
try {
|
|
218
|
+
fn();
|
|
219
|
+
} catch (_unused3) {}
|
|
220
|
+
}
|
|
221
|
+
} catch (err) {
|
|
222
|
+
_iterator2.e(err);
|
|
223
|
+
} finally {
|
|
224
|
+
_iterator2.f();
|
|
225
|
+
}
|
|
226
|
+
pluginCleanupsRef.current = [];
|
|
227
|
+
};
|
|
228
|
+
}, [plugins]);
|
|
229
|
+
|
|
149
230
|
/* ---------- track last external event ---------- */
|
|
150
231
|
var lastExternalEventRef = useRef(null);
|
|
151
232
|
useEffect(function () {
|
|
152
|
-
if (externalEvent)
|
|
153
|
-
lastExternalEventRef.current = externalEvent;
|
|
154
|
-
}
|
|
233
|
+
if (externalEvent) lastExternalEventRef.current = externalEvent;
|
|
155
234
|
}, [externalEvent]);
|
|
156
235
|
|
|
157
236
|
/* ---------- error buffer + last emitted bundle ---------- */
|
|
158
|
-
var errorsBufferRef = useRef([]);
|
|
237
|
+
var errorsBufferRef = useRef([]);
|
|
159
238
|
var lastEmittedRef = useRef({
|
|
160
239
|
externalEvent: null,
|
|
161
240
|
errors: []
|
|
162
|
-
});
|
|
241
|
+
});
|
|
163
242
|
var flushTimerRef = useRef(null);
|
|
164
243
|
var emit = useCallback(function (external, errors) {
|
|
165
244
|
var payload = {
|
|
@@ -168,13 +247,11 @@ export default function LiteRenderer(props) {
|
|
|
168
247
|
};
|
|
169
248
|
try {
|
|
170
249
|
onError === null || onError === void 0 || onError(payload);
|
|
171
|
-
} catch (
|
|
250
|
+
} catch (_unused5) {}
|
|
172
251
|
// eslint-disable-next-line no-console
|
|
173
252
|
console.debug('[LiteRenderer:onError]', payload);
|
|
174
253
|
lastEmittedRef.current = payload;
|
|
175
254
|
}, [onError]);
|
|
176
|
-
|
|
177
|
-
// batch short bursts (e.g., multiple async errors in same tick)
|
|
178
255
|
var scheduleFlush = useCallback(function () {
|
|
179
256
|
if (flushTimerRef.current) return;
|
|
180
257
|
flushTimerRef.current = setTimeout(function () {
|
|
@@ -183,7 +260,7 @@ export default function LiteRenderer(props) {
|
|
|
183
260
|
if (!errors.length) return;
|
|
184
261
|
errorsBufferRef.current = [];
|
|
185
262
|
emit(lastExternalEventRef.current, errors);
|
|
186
|
-
}, 0);
|
|
263
|
+
}, 0);
|
|
187
264
|
}, [emit]);
|
|
188
265
|
var pushError = useCallback(function (errPayload) {
|
|
189
266
|
errorsBufferRef.current.push(_objectSpread({
|
|
@@ -194,6 +271,7 @@ export default function LiteRenderer(props) {
|
|
|
194
271
|
|
|
195
272
|
/* ---------- global runtime + async error capture ---------- */
|
|
196
273
|
useEffect(function () {
|
|
274
|
+
if (!isBrowser) return;
|
|
197
275
|
var onWindowError = function onWindowError(event) {
|
|
198
276
|
pushError({
|
|
199
277
|
type: 'runtime-error',
|
|
@@ -225,79 +303,33 @@ export default function LiteRenderer(props) {
|
|
|
225
303
|
var prev = prevExternalEventRef.current;
|
|
226
304
|
if (prev === externalEvent) return;
|
|
227
305
|
prevExternalEventRef.current = externalEvent;
|
|
228
|
-
|
|
229
|
-
// if we already emitted something before, re-send it with the new event context
|
|
230
306
|
var last = lastEmittedRef.current;
|
|
231
307
|
if (last && last.errors && last.errors.length) {
|
|
232
308
|
emit(lastExternalEventRef.current, last.errors);
|
|
233
309
|
}
|
|
234
310
|
}, [externalEvent, emit]);
|
|
235
|
-
var
|
|
236
|
-
logoImg =
|
|
237
|
-
companyUrl =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
241
|
-
var x, _x, _x2;
|
|
242
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
243
|
-
while (1) switch (_context.prev = _context.next) {
|
|
244
|
-
case 0:
|
|
245
|
-
for (x in Areas) MyCatalog.registerElement(Areas[x]);
|
|
246
|
-
for (_x in Lines) MyCatalog.registerElement(Lines[_x]);
|
|
247
|
-
for (_x2 in Holes) MyCatalog.registerElement(Holes[_x2]);
|
|
248
|
-
MyCatalog.registerCategory('Windows', 'Windows', [Holes.windowClear, Holes.windowCross, Holes.windowDoubleHung, Holes.windowVertical]);
|
|
249
|
-
MyCatalog.registerCategory('Doors', 'Doors', [Holes.doorInterior, Holes.doorExterior, Holes.doorCloset, Holes.doorSliding, Holes.doorwayFramed, Holes.doorwayFrameless]);
|
|
250
|
-
case 1:
|
|
251
|
-
case "end":
|
|
252
|
-
return _context.stop();
|
|
253
|
-
}
|
|
254
|
-
}, _callee);
|
|
255
|
-
}));
|
|
256
|
-
return function initMyCatalog() {
|
|
257
|
-
return _ref.apply(this, arguments);
|
|
258
|
-
};
|
|
259
|
-
}();
|
|
260
|
-
var initCatalog = /*#__PURE__*/function () {
|
|
261
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
262
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
263
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
264
|
-
case 0:
|
|
265
|
-
_context2.next = 1;
|
|
266
|
-
return initMyCatalog();
|
|
267
|
-
case 1:
|
|
268
|
-
case "end":
|
|
269
|
-
return _context2.stop();
|
|
270
|
-
}
|
|
271
|
-
}, _callee2);
|
|
272
|
-
}));
|
|
273
|
-
return function initCatalog() {
|
|
274
|
-
return _ref2.apply(this, arguments);
|
|
275
|
-
};
|
|
276
|
-
}();
|
|
277
|
-
initCatalog();
|
|
278
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
279
|
-
}, [id]);
|
|
280
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
281
|
-
store: store
|
|
311
|
+
var _ref = configData || {},
|
|
312
|
+
logoImg = _ref.logoImg,
|
|
313
|
+
companyUrl = _ref.companyUrl;
|
|
314
|
+
return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
|
|
315
|
+
store: storeRef.current
|
|
282
316
|
}, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
|
|
283
317
|
pushError: pushError
|
|
284
318
|
}, /*#__PURE__*/React.createElement(LiteKitchenConfigurator, _extends({
|
|
285
|
-
catalog:
|
|
319
|
+
catalog: catalogRef.current,
|
|
286
320
|
width: width,
|
|
287
321
|
height: height,
|
|
288
322
|
logoImage: logoImg,
|
|
289
323
|
companyURL: companyUrl,
|
|
324
|
+
plugins: plugins,
|
|
290
325
|
stateExtractor: function stateExtractor(state) {
|
|
291
326
|
return state.get('KitchenConfigurator');
|
|
292
327
|
},
|
|
293
328
|
configData: configData,
|
|
294
329
|
externalEvent: externalEvent,
|
|
295
330
|
onInternalEvent: onInternalEvent
|
|
296
|
-
}, passThrough))));
|
|
331
|
+
}, passThrough)))));
|
|
297
332
|
}
|
|
298
|
-
|
|
299
|
-
/* ============================== prop types ============================== */
|
|
300
|
-
|
|
301
333
|
LiteRenderer.propTypes = {
|
|
302
334
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
303
335
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
package/es/actions/export.js
CHANGED
|
@@ -8,16 +8,29 @@ import * as verticesActions from "./vertices-actions";
|
|
|
8
8
|
import * as itemsActions from "./items-actions";
|
|
9
9
|
import * as areaActions from "./area-actions";
|
|
10
10
|
import * as groupsActions from "./groups-actions";
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
projectActions,
|
|
14
|
+
viewer2DActions,
|
|
15
|
+
viewer3DActions,
|
|
16
|
+
linesActions,
|
|
17
|
+
holesActions,
|
|
18
|
+
sceneActions,
|
|
19
|
+
verticesActions,
|
|
20
|
+
itemsActions,
|
|
21
|
+
areaActions,
|
|
22
|
+
groupsActions
|
|
23
|
+
};
|
|
24
|
+
|
|
12
25
|
export default {
|
|
13
|
-
projectActions
|
|
14
|
-
viewer2DActions
|
|
15
|
-
viewer3DActions
|
|
16
|
-
linesActions
|
|
17
|
-
holesActions
|
|
18
|
-
sceneActions
|
|
19
|
-
verticesActions
|
|
20
|
-
itemsActions
|
|
21
|
-
areaActions
|
|
22
|
-
groupsActions
|
|
23
|
-
};
|
|
26
|
+
projectActions,
|
|
27
|
+
viewer2DActions,
|
|
28
|
+
viewer3DActions,
|
|
29
|
+
linesActions,
|
|
30
|
+
holesActions,
|
|
31
|
+
sceneActions,
|
|
32
|
+
verticesActions,
|
|
33
|
+
itemsActions,
|
|
34
|
+
areaActions,
|
|
35
|
+
groupsActions
|
|
36
|
+
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<path
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
5
|
-
<path d="M8
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1516_100789)">
|
|
3
|
+
<path d="M4.25 6L2 7.125L8 10.125L14 7.125L11.75 6" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M2 10.125L8 13.125L14 10.125" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M8 7.125V1.875" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M5.75 4.125L8 1.875L10.25 4.125" stroke="rgba(58, 11, 128, 1)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="clip0_1516_100789">
|
|
10
|
+
<rect width="16" height="16" fill="white"/>
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
6
13
|
</svg>
|
package/es/catalog/catalog.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import {
|
|
4
|
+
import { PropertyColor, PropertyEnum, PropertyString, PropertyNumber, PropertyLengthMeasure, PropertyToggle, PropertyCheckbox, PropertyHidden, PropertyReadOnly } from "./properties/export";
|
|
5
|
+
import { UNIT_CENTIMETER, UNIT_INCH } from "../constants";
|
|
5
6
|
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
6
7
|
var Catalog = /*#__PURE__*/function () {
|
|
7
8
|
function Catalog() {
|
|
@@ -18,6 +19,7 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
18
19
|
};
|
|
19
20
|
this.propertyTypes = {};
|
|
20
21
|
this.unit = unit;
|
|
22
|
+
this.registerMultiplePropertyType([['color', PropertyColor, PropertyColor], ['enum', PropertyEnum, PropertyEnum], ['string', PropertyString, PropertyString], ['number', PropertyNumber, PropertyNumber], ['length-measure', PropertyLengthMeasure, PropertyLengthMeasure], ['toggle', PropertyToggle, PropertyToggle], ['checkbox', PropertyCheckbox, PropertyCheckbox], ['hidden', PropertyHidden, PropertyHidden], ['read-only', PropertyReadOnly, PropertyReadOnly]]);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -83,6 +85,20 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @description Register multiple elements
|
|
90
|
+
* @param {array} [elementArray] Array of elements
|
|
91
|
+
* @return {void}
|
|
92
|
+
*/
|
|
93
|
+
}, {
|
|
94
|
+
key: "registerMultipleElements",
|
|
95
|
+
value: function registerMultipleElements(elementArray) {
|
|
96
|
+
var _this = this;
|
|
97
|
+
elementArray.forEach(function (el) {
|
|
98
|
+
return _this.registerElement(el);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
86
102
|
/**
|
|
87
103
|
* @description Register a new property
|
|
88
104
|
* @param {string} type Type of property
|
|
@@ -108,9 +124,9 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
108
124
|
}, {
|
|
109
125
|
key: "registerMultiplePropertyType",
|
|
110
126
|
value: function registerMultiplePropertyType(propertyTypeArray) {
|
|
111
|
-
var
|
|
127
|
+
var _this2 = this;
|
|
112
128
|
propertyTypeArray.forEach(function (el) {
|
|
113
|
-
return
|
|
129
|
+
return _this2.registerPropertyType.apply(_this2, _toConsumableArray(el));
|
|
114
130
|
});
|
|
115
131
|
}
|
|
116
132
|
|
|
@@ -163,7 +179,7 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
163
179
|
}, {
|
|
164
180
|
key: "registerCategory",
|
|
165
181
|
value: function registerCategory(name, label, childs) {
|
|
166
|
-
var
|
|
182
|
+
var _this3 = this;
|
|
167
183
|
if (this.validateCategory(name, label)) {
|
|
168
184
|
this.categories[name] = {
|
|
169
185
|
name: name,
|
|
@@ -174,7 +190,7 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
174
190
|
this.categories.root.categories.push(this.categories[name]);
|
|
175
191
|
if (childs && childs.length) {
|
|
176
192
|
childs.forEach(function (el) {
|
|
177
|
-
return
|
|
193
|
+
return _this3.addToCategory(name, el);
|
|
178
194
|
});
|
|
179
195
|
}
|
|
180
196
|
return this.categories[name];
|
|
@@ -4,12 +4,12 @@ import { loadGLTF, scaleObject } from "../../utils/load-obj";
|
|
|
4
4
|
import { OBJTYPE_MESH } from "../../../constants";
|
|
5
5
|
var cached3DWindow = null;
|
|
6
6
|
export default {
|
|
7
|
-
name: '
|
|
7
|
+
name: 'Window',
|
|
8
8
|
prototype: 'holes',
|
|
9
9
|
info: {
|
|
10
10
|
title: 'Clear',
|
|
11
11
|
tag: ['window'],
|
|
12
|
-
description: '
|
|
12
|
+
description: 'Window',
|
|
13
13
|
image: '/assets/img/svg/window/Clear.svg',
|
|
14
14
|
url: '/assets/gltf/window_clear.gltf'
|
|
15
15
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PropertyColor from "./property-color";
|
|
2
|
+
import PropertyEnum from "./property-enum";
|
|
3
|
+
import PropertyString from "./property-string";
|
|
4
|
+
import PropertyNumber from "./property-number";
|
|
5
|
+
import PropertyLengthMeasure from "./property-length-measure";
|
|
6
|
+
import PropertyToggle from "./property-toggle";
|
|
7
|
+
import PropertyCheckbox from "./property-checkbox";
|
|
8
|
+
import PropertyHidden from "./property-hidden";
|
|
9
|
+
import PropertyReadOnly from "./property-read-only";
|
|
10
|
+
export { PropertyColor, PropertyEnum, PropertyString, PropertyNumber, PropertyLengthMeasure, PropertyToggle, PropertyCheckbox, PropertyHidden, PropertyReadOnly };
|
|
11
|
+
export default {
|
|
12
|
+
PropertyColor: PropertyColor,
|
|
13
|
+
PropertyEnum: PropertyEnum,
|
|
14
|
+
PropertyString: PropertyString,
|
|
15
|
+
PropertyNumber: PropertyNumber,
|
|
16
|
+
PropertyLengthMeasure: PropertyLengthMeasure,
|
|
17
|
+
PropertyToggle: PropertyToggle,
|
|
18
|
+
PropertyCheckbox: PropertyCheckbox,
|
|
19
|
+
PropertyHidden: PropertyHidden,
|
|
20
|
+
PropertyReadOnly: PropertyReadOnly
|
|
21
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { FormLabel } from "../../components/style/export";
|
|
9
|
+
import PropertyStyle from "./shared-property-style";
|
|
10
|
+
import styled from 'styled-components';
|
|
11
|
+
import { DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR, TEXT_COLOR_NEUTRAL_0 } from "../../constants";
|
|
12
|
+
var FlipWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin: 15px 0;\n justify-content: space-between;\n"])));
|
|
13
|
+
var FlipTitle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: auto;\n color: ", ";\n font-family: ", ";\n font-size: 16px;\n font-weight: 600;\n line-height: 18px;\n text-align: left;\n"])), SECONDARY_PURPLE_COLOR, DEFAULT_FONT_FAMILY);
|
|
14
|
+
var FlipDescription = styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-right: auto;\n color: ", ";\n font-family: ", ";\n font-size: 13px;\n font-weight: 400;\n line-height: 18px;\n text-align: left;\n"])), TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY);
|
|
15
|
+
var FlipInfoWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
|
|
16
|
+
var FlipToggle = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n"])));
|
|
17
|
+
var FlipToggleIcon = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n top: 0;\n position: absolute;\n ", "\n img {\n font-size: 1.4rem;\n box-sizing: border-box;\n border-radius: 50%;\n }\n"])), '' /* transition-duration: .3s; */);
|
|
18
|
+
export default function PropertyCheckbox(_ref) {
|
|
19
|
+
var value = _ref.value,
|
|
20
|
+
onUpdate = _ref.onUpdate,
|
|
21
|
+
configs = _ref.configs,
|
|
22
|
+
sourceElement = _ref.sourceElement,
|
|
23
|
+
internalState = _ref.internalState,
|
|
24
|
+
state = _ref.state;
|
|
25
|
+
var update = function update(val) {
|
|
26
|
+
if (configs.hook) {
|
|
27
|
+
return configs.hook(val, sourceElement, internalState, state).then(function (_val) {
|
|
28
|
+
return onUpdate(_val);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return onUpdate(val);
|
|
32
|
+
};
|
|
33
|
+
var activeStyle = value == 0 ? {
|
|
34
|
+
left: 0
|
|
35
|
+
} : {
|
|
36
|
+
right: 0
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(FlipWrapper, null, /*#__PURE__*/React.createElement(FlipInfoWrapper, null, /*#__PURE__*/React.createElement(FlipTitle, null, configs.label), configs.description && /*#__PURE__*/React.createElement(FlipDescription, null, configs.description)), /*#__PURE__*/React.createElement(FlipToggle, {
|
|
39
|
+
style: {
|
|
40
|
+
color: 'black'
|
|
41
|
+
},
|
|
42
|
+
onClick: function onClick(e) {
|
|
43
|
+
return update(!value);
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
46
|
+
src: "/assets/img/svg/bottombar/".concat(value != 0 ? '2d3d_toggle_active.svg' : '2d3d_toggle.svg'),
|
|
47
|
+
style: {
|
|
48
|
+
width: '55px',
|
|
49
|
+
height: '30px'
|
|
50
|
+
}
|
|
51
|
+
}), /*#__PURE__*/React.createElement(FlipToggleIcon, {
|
|
52
|
+
style: _objectSpread({}, activeStyle)
|
|
53
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
54
|
+
src: "/assets/img/svg/bottombar/".concat(value != 0 ? '2d3d_button_active.svg' : '2d3d_button.svg'),
|
|
55
|
+
style: {
|
|
56
|
+
width: '30px',
|
|
57
|
+
height: '30px'
|
|
58
|
+
}
|
|
59
|
+
}))));
|
|
60
|
+
}
|
|
61
|
+
PropertyCheckbox.propTypes = {
|
|
62
|
+
value: PropTypes.any.isRequired,
|
|
63
|
+
onUpdate: PropTypes.func.isRequired,
|
|
64
|
+
configs: PropTypes.object.isRequired,
|
|
65
|
+
sourceElement: PropTypes.object,
|
|
66
|
+
internalState: PropTypes.object,
|
|
67
|
+
state: PropTypes.object.isRequired
|
|
68
|
+
};
|