door_models 0.1.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/README.md +70 -0
- package/dist/components/DoorModels.js +924 -0
- package/dist/components/Interface.js +1307 -0
- package/dist/context/DoorContext.js +631 -0
- package/dist/index.js +33 -0
- package/package.json +59 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useConfigurator = exports.ConfiguratorProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
const _excluded = ["doorDepth"];
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // --- Type Definitions to Match JSON Structure ---
|
|
18
|
+
// --- Main Context Type ---
|
|
19
|
+
const ConfiguratorContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
20
|
+
const ConfiguratorProvider = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
children
|
|
23
|
+
} = _ref;
|
|
24
|
+
const [isPlaneVisible, setIsPlaneVisible] = (0, _react.useState)(false);
|
|
25
|
+
const [isFrameVisible, setIsFrameVisible] = (0, _react.useState)(true);
|
|
26
|
+
const [cpid, setCpid] = (0, _react.useState)("");
|
|
27
|
+
const [totalHeight, setTotalHeight] = (0, _react.useState)(2700);
|
|
28
|
+
const [totalWidth, setTotalWidth] = (0, _react.useState)(974);
|
|
29
|
+
const [glassVisible, setGlassVisible] = (0, _react.useState)(false);
|
|
30
|
+
const [glassDepth, setGlassDepth] = (0, _react.useState)(8);
|
|
31
|
+
const [door, setDoor] = (0, _react.useState)({
|
|
32
|
+
doorMaterial: "door_material",
|
|
33
|
+
doorWidth: 0,
|
|
34
|
+
doorHeight: 0,
|
|
35
|
+
theDoorDepth: 40,
|
|
36
|
+
doorPivot: "left",
|
|
37
|
+
doorOpening: "out"
|
|
38
|
+
});
|
|
39
|
+
const [doorFrame, setDoorFrame] = (0, _react.useState)({
|
|
40
|
+
frameMaterial: "doorFrame_material",
|
|
41
|
+
doorStopMaterial: "doorStop_material",
|
|
42
|
+
gasketMaterial: "gasket_material",
|
|
43
|
+
hingeMaterial: "hinge_material",
|
|
44
|
+
glassMaterial: "glass_material",
|
|
45
|
+
frameDepth: 103,
|
|
46
|
+
topThk: "20mm",
|
|
47
|
+
sidesThk: "20mm",
|
|
48
|
+
doorStopOffset: "30mm",
|
|
49
|
+
doorStopWidth: 20,
|
|
50
|
+
doorStopDepth: 13,
|
|
51
|
+
notchWidth: "20mm",
|
|
52
|
+
notchDepth: "40mm",
|
|
53
|
+
notchposition: 0.01,
|
|
54
|
+
gasketDepth: 5,
|
|
55
|
+
gasketWidth: 5,
|
|
56
|
+
secondDoorStopWidth: 20,
|
|
57
|
+
secondDoorStopDepth: 30,
|
|
58
|
+
secondDoorStopOffset: 13
|
|
59
|
+
});
|
|
60
|
+
const [interiorFanlight, setInteriorFanlight] = (0, _react.useState)({
|
|
61
|
+
visible: false,
|
|
62
|
+
height: 300,
|
|
63
|
+
material: "interiorFanlight_material"
|
|
64
|
+
});
|
|
65
|
+
const [exteriorFanlight, setExteriorFanlight] = (0, _react.useState)({
|
|
66
|
+
visible: false,
|
|
67
|
+
height: 300,
|
|
68
|
+
depth: 60,
|
|
69
|
+
material: "exteriorFanlight_material"
|
|
70
|
+
});
|
|
71
|
+
const [occulus, setOcculus] = (0, _react.useState)({
|
|
72
|
+
visible: false,
|
|
73
|
+
infillVisible: true,
|
|
74
|
+
x1: 120,
|
|
75
|
+
x2: 120,
|
|
76
|
+
y1: 600,
|
|
77
|
+
y2: 220,
|
|
78
|
+
material: "infill_material",
|
|
79
|
+
depth: 20
|
|
80
|
+
});
|
|
81
|
+
const [frontCoverPanel, setFrontCoverPanel] = (0, _react.useState)({
|
|
82
|
+
visible: false,
|
|
83
|
+
width: 73,
|
|
84
|
+
height: 2200,
|
|
85
|
+
depth: 12,
|
|
86
|
+
material: "front_cover_material"
|
|
87
|
+
});
|
|
88
|
+
const [backCoverPanel, setBackCoverPanel] = (0, _react.useState)({
|
|
89
|
+
visible: false,
|
|
90
|
+
width: 73,
|
|
91
|
+
height: 2200,
|
|
92
|
+
depth: 12,
|
|
93
|
+
material: "back_cover_material"
|
|
94
|
+
});
|
|
95
|
+
const [glass, setGlass] = (0, _react.useState)({
|
|
96
|
+
visible: false,
|
|
97
|
+
material: "infill_material",
|
|
98
|
+
depth: 20
|
|
99
|
+
});
|
|
100
|
+
const [frameType, setFrameType] = (0, _react.useState)("AF20_40");
|
|
101
|
+
const [bodyType, setBodyType] = (0, _react.useState)("40");
|
|
102
|
+
const [exteriorFanlightType, setExteriorFanlightType] = (0, _react.useState)("WPFL");
|
|
103
|
+
const [testDoorMaterial, setTestDoorMaterial] = (0, _react.useState)("brown");
|
|
104
|
+
const [testFrameMaterial, setTestFrameMaterial] = (0, _react.useState)("black");
|
|
105
|
+
const [testGasketMaterial, setTestGasketMaterial] = (0, _react.useState)("darkgrey");
|
|
106
|
+
const [testInteriorFanlightMaterial, setTestInteriorFanlightMaterial] = (0, _react.useState)("grey");
|
|
107
|
+
const [testExteriorFanlightMaterial, setTestExteriorFanlightMaterial] = (0, _react.useState)("metal");
|
|
108
|
+
const [testOcculusInfillMaterial, setTestOcculusInfillMaterial] = (0, _react.useState)("glass");
|
|
109
|
+
const [testGlassInfillMaterial, setTestGlassInfillMaterial] = (0, _react.useState)("glass");
|
|
110
|
+
const [testDoorStopMaterial, setTestDoorStopMaterial] = (0, _react.useState)("black");
|
|
111
|
+
const [testHingeMaterial, setTestHingeMaterial] = (0, _react.useState)("metal");
|
|
112
|
+
const [testFrontCoverPanelMaterial, setTestFrontCoverPanelMaterial] = (0, _react.useState)("aluminum");
|
|
113
|
+
const [testBackCoverPanelMaterial, setTestBackCoverPanelMaterial] = (0, _react.useState)("aluminum");
|
|
114
|
+
|
|
115
|
+
//
|
|
116
|
+
const [parseMessage, setParseMessage] = (0, _react.useState)({
|
|
117
|
+
type: "",
|
|
118
|
+
text: ""
|
|
119
|
+
});
|
|
120
|
+
const handleParseCpid = (0, _react.useCallback)(cpidToParse => {
|
|
121
|
+
const showMessage = function (text) {
|
|
122
|
+
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "error";
|
|
123
|
+
setParseMessage({
|
|
124
|
+
text,
|
|
125
|
+
type
|
|
126
|
+
});
|
|
127
|
+
setTimeout(() => setParseMessage({
|
|
128
|
+
text: "",
|
|
129
|
+
type: ""
|
|
130
|
+
}), 4000);
|
|
131
|
+
};
|
|
132
|
+
if (!cpidToParse || !cpidToParse.trim().startsWith("P_")) {
|
|
133
|
+
showMessage("Invalid format: CPID must start with 'P_'.");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const parts = cpidToParse.trim().split("_");
|
|
137
|
+
if (parts.length < 4) {
|
|
138
|
+
showMessage("Invalid format: Not enough parts in CPID.");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const newConfig = {
|
|
142
|
+
fanlightVisible: false,
|
|
143
|
+
fanlightType: "WPFL",
|
|
144
|
+
interiorFanlightVisible: false,
|
|
145
|
+
occulusVisible: false,
|
|
146
|
+
frameType: "",
|
|
147
|
+
bodyType: ""
|
|
148
|
+
};
|
|
149
|
+
let currentIndex = 1;
|
|
150
|
+
|
|
151
|
+
// Door Type
|
|
152
|
+
if (parts[currentIndex] === "SD") {
|
|
153
|
+
currentIndex++;
|
|
154
|
+
} else {
|
|
155
|
+
showMessage("Unsupported Door Type: Only 'SD' is supported.");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//Fanlight Type
|
|
160
|
+
const fanlightPart = parts[currentIndex];
|
|
161
|
+
const validFanlights = ["WPFL", "ALDGFL", "ALSGFL"];
|
|
162
|
+
if (fanlightPart === "FH") {
|
|
163
|
+
newConfig.fanlightVisible = false;
|
|
164
|
+
currentIndex++;
|
|
165
|
+
} else if (validFanlights.includes(fanlightPart)) {
|
|
166
|
+
newConfig.fanlightVisible = true;
|
|
167
|
+
newConfig.fanlightType = fanlightPart;
|
|
168
|
+
currentIndex++;
|
|
169
|
+
} else {
|
|
170
|
+
showMessage("Invalid Fanlight Type: '".concat(fanlightPart, "'."));
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Frame and Body Type
|
|
175
|
+
const validSimpleFrameTypes = ["AF20", "AF40", "WF", "MXF", "MXCAF", "NOF"];
|
|
176
|
+
const validBodyTypes = ["40", "50", "FLI", "100", "WDG100", "SG8", "SG10", "SG12"];
|
|
177
|
+
let framePart = parts[currentIndex];
|
|
178
|
+
let bodyPartRaw = parts[currentIndex + 1] || "";
|
|
179
|
+
let frameFound = false;
|
|
180
|
+
if ("".concat(framePart, "_").concat(bodyPartRaw) === "WDGF_WDG100") {
|
|
181
|
+
newConfig.frameType = "WDGF_WDG100";
|
|
182
|
+
newConfig.bodyType = "WDG100";
|
|
183
|
+
currentIndex += 2;
|
|
184
|
+
frameFound = true;
|
|
185
|
+
} else if (validSimpleFrameTypes.includes(framePart)) {
|
|
186
|
+
let tempBody = bodyPartRaw.replace("OCC", "");
|
|
187
|
+
if (validBodyTypes.includes(tempBody)) {
|
|
188
|
+
newConfig.frameType = framePart === "NOF" ? "NOF" : "".concat(framePart, "_").concat(tempBody);
|
|
189
|
+
newConfig.bodyType = tempBody;
|
|
190
|
+
if (bodyPartRaw.endsWith("OCC")) {
|
|
191
|
+
newConfig.occulusVisible = true;
|
|
192
|
+
}
|
|
193
|
+
currentIndex += 2;
|
|
194
|
+
frameFound = true;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!frameFound) {
|
|
198
|
+
showMessage("Invalid Frame/Body combination starting with '".concat(framePart, "'."));
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (let i = currentIndex; i < parts.length; i++) {
|
|
202
|
+
if (parts[i] === "IFL") {
|
|
203
|
+
newConfig.interiorFanlightVisible = true;
|
|
204
|
+
} else if (parts[i] === "OCC") {
|
|
205
|
+
newConfig.occulusVisible = true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Apply final configuration
|
|
210
|
+
setFrameType(newConfig.frameType);
|
|
211
|
+
setBodyType(newConfig.bodyType);
|
|
212
|
+
setExteriorFanlight(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
213
|
+
visible: newConfig.fanlightVisible
|
|
214
|
+
}));
|
|
215
|
+
if (newConfig.fanlightVisible) {
|
|
216
|
+
setExteriorFanlightType(newConfig.fanlightType);
|
|
217
|
+
}
|
|
218
|
+
setInteriorFanlight(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
219
|
+
visible: newConfig.interiorFanlightVisible
|
|
220
|
+
}));
|
|
221
|
+
setOcculus(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
222
|
+
visible: newConfig.occulusVisible
|
|
223
|
+
}));
|
|
224
|
+
showMessage("Configuration Applied!", "success");
|
|
225
|
+
}, [setBodyType, setExteriorFanlight, setExteriorFanlightType, setFrameType, setInteriorFanlight, setOcculus]);
|
|
226
|
+
|
|
227
|
+
// --- BodyType Effect ---
|
|
228
|
+
(0, _react.useEffect)(() => {
|
|
229
|
+
let newDoorDepth = 40;
|
|
230
|
+
let newMaterial = "brown";
|
|
231
|
+
switch (bodyType) {
|
|
232
|
+
case "50":
|
|
233
|
+
newDoorDepth = 50;
|
|
234
|
+
break;
|
|
235
|
+
case "SG8":
|
|
236
|
+
newDoorDepth = 8;
|
|
237
|
+
newMaterial = "glass";
|
|
238
|
+
break;
|
|
239
|
+
case "SG10":
|
|
240
|
+
newDoorDepth = 10;
|
|
241
|
+
newMaterial = "glass";
|
|
242
|
+
break;
|
|
243
|
+
case "SG12":
|
|
244
|
+
newDoorDepth = 12;
|
|
245
|
+
newMaterial = "glass";
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
setDoor(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
249
|
+
theDoorDepth: newDoorDepth
|
|
250
|
+
}));
|
|
251
|
+
setTestDoorMaterial(newMaterial);
|
|
252
|
+
}, [bodyType]);
|
|
253
|
+
|
|
254
|
+
// --- FrameType Effect ---
|
|
255
|
+
(0, _react.useEffect)(() => {
|
|
256
|
+
setIsFrameVisible(frameType !== "NOF");
|
|
257
|
+
setGlassVisible(false);
|
|
258
|
+
let newSettings = {};
|
|
259
|
+
let lookupKey = frameType;
|
|
260
|
+
if (frameType.startsWith("AF20_SG")) {
|
|
261
|
+
lookupKey = "AF20_40";
|
|
262
|
+
} else if (frameType.startsWith("AF40_SG")) {
|
|
263
|
+
lookupKey = "AF40_40";
|
|
264
|
+
}
|
|
265
|
+
switch (lookupKey) {
|
|
266
|
+
case "NOF":
|
|
267
|
+
newSettings = {
|
|
268
|
+
topThk: "0mm",
|
|
269
|
+
sidesThk: "0mm",
|
|
270
|
+
frameDepth: 0
|
|
271
|
+
};
|
|
272
|
+
break;
|
|
273
|
+
case "AF20_40":
|
|
274
|
+
newSettings = {
|
|
275
|
+
frameDepth: 103,
|
|
276
|
+
topThk: "20mm",
|
|
277
|
+
sidesThk: "20mm",
|
|
278
|
+
doorStopOffset: "42mm",
|
|
279
|
+
doorStopWidth: 20,
|
|
280
|
+
doorStopDepth: 13,
|
|
281
|
+
notchWidth: "20mm",
|
|
282
|
+
notchDepth: "40mm",
|
|
283
|
+
notchposition: 0.01,
|
|
284
|
+
gasketDepth: 5,
|
|
285
|
+
gasketWidth: 5
|
|
286
|
+
};
|
|
287
|
+
if (frameType === "AF20_40") {
|
|
288
|
+
newSettings.doorDepth = 40;
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case "AF20_50":
|
|
292
|
+
newSettings = {
|
|
293
|
+
doorDepth: 50,
|
|
294
|
+
frameDepth: 103,
|
|
295
|
+
topThk: "20mm",
|
|
296
|
+
sidesThk: "20mm",
|
|
297
|
+
doorStopOffset: "30mm",
|
|
298
|
+
doorStopWidth: 20,
|
|
299
|
+
doorStopDepth: 13,
|
|
300
|
+
notchWidth: "20mm",
|
|
301
|
+
notchDepth: "40mm",
|
|
302
|
+
notchposition: 0.01,
|
|
303
|
+
gasketDepth: 5,
|
|
304
|
+
gasketWidth: 5
|
|
305
|
+
};
|
|
306
|
+
break;
|
|
307
|
+
case "AF40_40":
|
|
308
|
+
newSettings = {
|
|
309
|
+
frameDepth: 103,
|
|
310
|
+
topThk: "40mm",
|
|
311
|
+
sidesThk: "40mm",
|
|
312
|
+
doorStopOffset: "42mm",
|
|
313
|
+
doorStopWidth: 20,
|
|
314
|
+
doorStopDepth: 13,
|
|
315
|
+
notchWidth: "20mm",
|
|
316
|
+
notchDepth: "40mm",
|
|
317
|
+
notchposition: 0.01,
|
|
318
|
+
gasketDepth: 5,
|
|
319
|
+
gasketWidth: 5
|
|
320
|
+
};
|
|
321
|
+
if (frameType === "AF40_40") {
|
|
322
|
+
newSettings.doorDepth = 40;
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
case "AF40_50":
|
|
326
|
+
newSettings = {
|
|
327
|
+
doorDepth: 50,
|
|
328
|
+
frameDepth: 103,
|
|
329
|
+
topThk: "40mm",
|
|
330
|
+
sidesThk: "40mm",
|
|
331
|
+
doorStopOffset: "30mm",
|
|
332
|
+
doorStopWidth: 20,
|
|
333
|
+
doorStopDepth: 13,
|
|
334
|
+
notchWidth: "20mm",
|
|
335
|
+
notchDepth: "40mm",
|
|
336
|
+
notchposition: 0.01,
|
|
337
|
+
gasketDepth: 5,
|
|
338
|
+
gasketWidth: 5
|
|
339
|
+
};
|
|
340
|
+
break;
|
|
341
|
+
case "WF_40":
|
|
342
|
+
newSettings = {
|
|
343
|
+
doorDepth: 39.6,
|
|
344
|
+
frameDepth: 103,
|
|
345
|
+
topThk: "31.6mm",
|
|
346
|
+
sidesThk: "31.6mm",
|
|
347
|
+
doorStopOffset: "0mm",
|
|
348
|
+
doorStopWidth: 16.4,
|
|
349
|
+
doorStopDepth: 58.4,
|
|
350
|
+
notchWidth: "20mm",
|
|
351
|
+
notchDepth: "40mm",
|
|
352
|
+
notchposition: 0.01,
|
|
353
|
+
gasketDepth: 5,
|
|
354
|
+
gasketWidth: 5
|
|
355
|
+
};
|
|
356
|
+
break;
|
|
357
|
+
case "WF_50":
|
|
358
|
+
newSettings = {
|
|
359
|
+
doorDepth: 51.6,
|
|
360
|
+
frameDepth: 103,
|
|
361
|
+
topThk: "31.6mm",
|
|
362
|
+
sidesThk: "31.6mm",
|
|
363
|
+
doorStopOffset: "0mm",
|
|
364
|
+
doorStopWidth: 16,
|
|
365
|
+
doorStopDepth: 46.4,
|
|
366
|
+
notchWidth: "20mm",
|
|
367
|
+
notchDepth: "40mm",
|
|
368
|
+
notchposition: 0.01,
|
|
369
|
+
gasketDepth: 5,
|
|
370
|
+
gasketWidth: 5
|
|
371
|
+
};
|
|
372
|
+
break;
|
|
373
|
+
case "WF_100":
|
|
374
|
+
newSettings = {
|
|
375
|
+
doorDepth: 102,
|
|
376
|
+
frameDepth: 102,
|
|
377
|
+
topThk: "52mm",
|
|
378
|
+
sidesThk: "52mm",
|
|
379
|
+
doorStopOffset: "17.6mm",
|
|
380
|
+
doorStopWidth: 16.4,
|
|
381
|
+
doorStopDepth: 44.8,
|
|
382
|
+
notchWidth: "16mm",
|
|
383
|
+
notchDepth: "66.5mm",
|
|
384
|
+
notchposition: 0.02,
|
|
385
|
+
gasketDepth: 5,
|
|
386
|
+
gasketWidth: 5,
|
|
387
|
+
secondDoorStopWidth: 29,
|
|
388
|
+
secondDoorStopDepth: 17.6,
|
|
389
|
+
secondDoorStopOffset: 0
|
|
390
|
+
};
|
|
391
|
+
break;
|
|
392
|
+
case "WF_FLI":
|
|
393
|
+
newSettings = {
|
|
394
|
+
doorDepth: 51,
|
|
395
|
+
frameDepth: 102,
|
|
396
|
+
topThk: "52mm",
|
|
397
|
+
sidesThk: "52mm",
|
|
398
|
+
doorStopOffset: "17.4mm",
|
|
399
|
+
doorStopWidth: 16.4,
|
|
400
|
+
doorStopDepth: 34,
|
|
401
|
+
notchWidth: "14mm",
|
|
402
|
+
notchDepth: "66mm",
|
|
403
|
+
notchposition: 0.02,
|
|
404
|
+
gasketDepth: 5,
|
|
405
|
+
gasketWidth: 5,
|
|
406
|
+
secondDoorStopWidth: 29,
|
|
407
|
+
secondDoorStopDepth: 17.6,
|
|
408
|
+
secondDoorStopOffset: 0
|
|
409
|
+
};
|
|
410
|
+
break;
|
|
411
|
+
case "WDGF_WDG100":
|
|
412
|
+
newSettings = {
|
|
413
|
+
doorDepth: 86,
|
|
414
|
+
frameDepth: 86,
|
|
415
|
+
topThk: "50mm",
|
|
416
|
+
sidesThk: "50mm",
|
|
417
|
+
doorStopOffset: "34mm",
|
|
418
|
+
doorStopWidth: 13,
|
|
419
|
+
doorStopDepth: 30,
|
|
420
|
+
notchWidth: "14mm",
|
|
421
|
+
notchDepth: "66mm",
|
|
422
|
+
notchposition: 0.02,
|
|
423
|
+
gasketDepth: 4.5,
|
|
424
|
+
gasketWidth: 5,
|
|
425
|
+
secondDoorStopWidth: 23,
|
|
426
|
+
secondDoorStopDepth: 30,
|
|
427
|
+
secondDoorStopOffset: 13
|
|
428
|
+
};
|
|
429
|
+
setGlassVisible(true);
|
|
430
|
+
break;
|
|
431
|
+
case "MXF_40":
|
|
432
|
+
newSettings = {
|
|
433
|
+
doorDepth: 38,
|
|
434
|
+
frameDepth: 103,
|
|
435
|
+
topThk: "18mm",
|
|
436
|
+
sidesThk: "18mm",
|
|
437
|
+
doorStopOffset: "45mm",
|
|
438
|
+
doorStopWidth: 15,
|
|
439
|
+
doorStopDepth: 15,
|
|
440
|
+
notchWidth: "20mm",
|
|
441
|
+
notchDepth: "40mm",
|
|
442
|
+
notchposition: 0.01,
|
|
443
|
+
gasketDepth: 5,
|
|
444
|
+
gasketWidth: 5
|
|
445
|
+
};
|
|
446
|
+
break;
|
|
447
|
+
case "MXF_50":
|
|
448
|
+
newSettings = {
|
|
449
|
+
doorDepth: 50,
|
|
450
|
+
frameDepth: 103,
|
|
451
|
+
topThk: "18.2mm",
|
|
452
|
+
sidesThk: "18.2mm",
|
|
453
|
+
doorStopOffset: "33mm",
|
|
454
|
+
doorStopWidth: 15,
|
|
455
|
+
doorStopDepth: 15,
|
|
456
|
+
notchWidth: "20mm",
|
|
457
|
+
notchDepth: "40mm",
|
|
458
|
+
notchposition: 0.01,
|
|
459
|
+
gasketDepth: 5,
|
|
460
|
+
gasketWidth: 5
|
|
461
|
+
};
|
|
462
|
+
break;
|
|
463
|
+
case "MXCAF_40":
|
|
464
|
+
newSettings = {
|
|
465
|
+
doorDepth: 38,
|
|
466
|
+
frameDepth: 103,
|
|
467
|
+
topThk: "18mm",
|
|
468
|
+
sidesThk: "18mm",
|
|
469
|
+
doorStopOffset: "45mm",
|
|
470
|
+
doorStopWidth: 15,
|
|
471
|
+
doorStopDepth: 15,
|
|
472
|
+
notchWidth: "20mm",
|
|
473
|
+
notchDepth: "40mm",
|
|
474
|
+
notchposition: 0.01,
|
|
475
|
+
gasketDepth: 5,
|
|
476
|
+
gasketWidth: 5
|
|
477
|
+
};
|
|
478
|
+
break;
|
|
479
|
+
case "MXCAF_50":
|
|
480
|
+
newSettings = {
|
|
481
|
+
doorDepth: 50,
|
|
482
|
+
frameDepth: 103,
|
|
483
|
+
topThk: "18.2mm",
|
|
484
|
+
sidesThk: "18.2mm",
|
|
485
|
+
doorStopOffset: "33mm",
|
|
486
|
+
doorStopWidth: 15,
|
|
487
|
+
doorStopDepth: 15,
|
|
488
|
+
notchWidth: "20mm",
|
|
489
|
+
notchDepth: "40mm",
|
|
490
|
+
notchposition: 0.01,
|
|
491
|
+
gasketDepth: 5,
|
|
492
|
+
gasketWidth: 5
|
|
493
|
+
};
|
|
494
|
+
break;
|
|
495
|
+
default:
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
const isMxCaf = frameType.startsWith("MXCAF");
|
|
499
|
+
setFrontCoverPanel(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
500
|
+
visible: isMxCaf
|
|
501
|
+
}));
|
|
502
|
+
setBackCoverPanel(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
503
|
+
visible: isMxCaf
|
|
504
|
+
}));
|
|
505
|
+
const {
|
|
506
|
+
doorDepth
|
|
507
|
+
} = newSettings,
|
|
508
|
+
newFrameSettings = _objectWithoutProperties(newSettings, _excluded);
|
|
509
|
+
setDoorFrame(prev => _objectSpread(_objectSpread({}, prev), newFrameSettings));
|
|
510
|
+
if (doorDepth !== undefined) {
|
|
511
|
+
setDoor(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
512
|
+
theDoorDepth: doorDepth
|
|
513
|
+
}));
|
|
514
|
+
}
|
|
515
|
+
}, [frameType]);
|
|
516
|
+
|
|
517
|
+
// --- Exterior Fanlight Logic ---
|
|
518
|
+
(0, _react.useEffect)(() => {
|
|
519
|
+
if (!exteriorFanlight.visible) return;
|
|
520
|
+
switch (exteriorFanlightType) {
|
|
521
|
+
case "WPFL":
|
|
522
|
+
setExteriorFanlight(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
523
|
+
depth: doorFrame.frameDepth
|
|
524
|
+
}));
|
|
525
|
+
setTestExteriorFanlightMaterial("metal");
|
|
526
|
+
break;
|
|
527
|
+
case "ALDGL":
|
|
528
|
+
setExteriorFanlight(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
529
|
+
depth: doorFrame.frameDepth
|
|
530
|
+
}));
|
|
531
|
+
setTestExteriorFanlightMaterial("glass");
|
|
532
|
+
break;
|
|
533
|
+
case "ALSGL":
|
|
534
|
+
setExteriorFanlight(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
535
|
+
depth: 40
|
|
536
|
+
}));
|
|
537
|
+
setTestExteriorFanlightMaterial("glass");
|
|
538
|
+
break;
|
|
539
|
+
default:
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
}, [exteriorFanlight.visible, exteriorFanlightType, doorFrame.frameDepth, setTestExteriorFanlightMaterial, setExteriorFanlight]);
|
|
543
|
+
(0, _react.useEffect)(() => {
|
|
544
|
+
const topThkValue = parseInt(doorFrame.topThk) || 0;
|
|
545
|
+
const exteriorFanlightHeight = exteriorFanlight.visible ? exteriorFanlight.height : 0;
|
|
546
|
+
const newDoorHeight = totalHeight - topThkValue - exteriorFanlightHeight;
|
|
547
|
+
setDoor(prevDoor => _objectSpread(_objectSpread({}, prevDoor), {}, {
|
|
548
|
+
doorHeight: newDoorHeight > 0 ? newDoorHeight : 0
|
|
549
|
+
}));
|
|
550
|
+
}, [totalHeight, doorFrame.topThk, exteriorFanlight.visible, exteriorFanlight.height]);
|
|
551
|
+
(0, _react.useEffect)(() => {
|
|
552
|
+
const sidesThkValue = parseInt(doorFrame.sidesThk) || 0;
|
|
553
|
+
const newDoorWidth = totalWidth - sidesThkValue * 2;
|
|
554
|
+
setDoor(prevDoor => _objectSpread(_objectSpread({}, prevDoor), {}, {
|
|
555
|
+
doorWidth: newDoorWidth > 0 ? newDoorWidth : 0
|
|
556
|
+
}));
|
|
557
|
+
}, [totalWidth, doorFrame.sidesThk]);
|
|
558
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ConfiguratorContext.Provider, {
|
|
559
|
+
value: {
|
|
560
|
+
isPlaneVisible,
|
|
561
|
+
setIsPlaneVisible,
|
|
562
|
+
isFrameVisible,
|
|
563
|
+
setIsFrameVisible,
|
|
564
|
+
cpid,
|
|
565
|
+
setCpid,
|
|
566
|
+
door,
|
|
567
|
+
setDoor,
|
|
568
|
+
doorFrame,
|
|
569
|
+
setDoorFrame,
|
|
570
|
+
interiorFanlight,
|
|
571
|
+
setInteriorFanlight,
|
|
572
|
+
exteriorFanlight,
|
|
573
|
+
setExteriorFanlight,
|
|
574
|
+
occulus,
|
|
575
|
+
setOcculus,
|
|
576
|
+
frontCoverPanel,
|
|
577
|
+
setFrontCoverPanel,
|
|
578
|
+
backCoverPanel,
|
|
579
|
+
setBackCoverPanel,
|
|
580
|
+
glass,
|
|
581
|
+
setGlass,
|
|
582
|
+
frameType,
|
|
583
|
+
setFrameType,
|
|
584
|
+
bodyType,
|
|
585
|
+
setBodyType,
|
|
586
|
+
totalHeight,
|
|
587
|
+
setTotalHeight,
|
|
588
|
+
totalWidth,
|
|
589
|
+
setTotalWidth,
|
|
590
|
+
exteriorFanlightType,
|
|
591
|
+
setExteriorFanlightType,
|
|
592
|
+
testDoorMaterial,
|
|
593
|
+
setTestDoorMaterial,
|
|
594
|
+
testFrameMaterial,
|
|
595
|
+
setTestFrameMaterial,
|
|
596
|
+
testGasketMaterial,
|
|
597
|
+
setTestGasketMaterial,
|
|
598
|
+
testInteriorFanlightMaterial,
|
|
599
|
+
setTestInteriorFanlightMaterial,
|
|
600
|
+
testExteriorFanlightMaterial,
|
|
601
|
+
setTestExteriorFanlightMaterial,
|
|
602
|
+
testOcculusInfillMaterial,
|
|
603
|
+
setTestOcculusInfillMaterial,
|
|
604
|
+
testGlassInfillMaterial,
|
|
605
|
+
setTestGlassInfillMaterial,
|
|
606
|
+
testDoorStopMaterial,
|
|
607
|
+
setTestDoorStopMaterial,
|
|
608
|
+
testHingeMaterial,
|
|
609
|
+
setTestHingeMaterial,
|
|
610
|
+
testFrontCoverPanelMaterial,
|
|
611
|
+
setTestFrontCoverPanelMaterial,
|
|
612
|
+
testBackCoverPanelMaterial,
|
|
613
|
+
setTestBackCoverPanelMaterial,
|
|
614
|
+
glassVisible,
|
|
615
|
+
setGlassVisible,
|
|
616
|
+
glassDepth,
|
|
617
|
+
setGlassDepth,
|
|
618
|
+
handleParseCpid
|
|
619
|
+
},
|
|
620
|
+
children: children
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
exports.ConfiguratorProvider = ConfiguratorProvider;
|
|
624
|
+
const useConfigurator = () => {
|
|
625
|
+
const context = (0, _react.useContext)(ConfiguratorContext);
|
|
626
|
+
if (!context) {
|
|
627
|
+
throw new Error("useConfigurator must be used within a ConfiguratorProvider");
|
|
628
|
+
}
|
|
629
|
+
return context;
|
|
630
|
+
};
|
|
631
|
+
exports.useConfigurator = useConfigurator;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ConfiguratorProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _DoorContext.ConfiguratorProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DoorModels", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _DoorModels.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "Interface", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _Interface.Interface;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "useConfigurator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _DoorContext.useConfigurator;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _DoorContext = require("./context/DoorContext");
|
|
31
|
+
var _DoorModels = _interopRequireDefault(require("./components/DoorModels"));
|
|
32
|
+
var _Interface = require("./components/Interface");
|
|
33
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|