Newest EFB

This commit is contained in:
Kilian Hofmann 2025-12-07 02:09:41 +01:00
parent f708bbf72c
commit ccb96e15e2
7 changed files with 18 additions and 99 deletions

View File

@ -2,96 +2,7 @@ Index: EFB.js
===================================================================
--- EFB.js
+++ EFB.js
@@ -29548,18 +29548,17 @@
"{shift} Z X C V B N M /",
"{space} {close}"
]
};
- var Keyboard = (0, import_react4.forwardRef)(({ value, inputRef, onInput, onClose }, ref) => {
+ var Keyboard = (0, import_react4.forwardRef)(({ value, blurRef, onInput, onClose }, ref) => {
const [shift, setShift] = (0, import_react4.useState)(false);
const layout = shift ? defaultLayout.shift : defaultLayout.default;
const handleKeyPress = (key) => {
- var _a;
if (key === "{close}") {
onClose();
return;
}
- (_a = inputRef.current) == null ? void 0 : _a.focus();
+ blurRef.current = true;
if (key === "{shift}") {
setShift(!shift);
return;
}
@@ -29603,12 +29602,8 @@
"button",
{
className: `flex justify-center rounded-md p-4 ${key === "{close}" ? "bg-zinc-700 px-12 focus:bg-zinc-600" : "flex-1 bg-zinc-600"}`,
onMouseDown: () => handleKeyPress(key),
- onMouseUp: () => {
- var _a;
- return (_a = inputRef.current) == null ? void 0 : _a.focus();
- },
children: keyIdent
},
`key-${rowIndex}-${keyIndex}`
);
@@ -29628,9 +29623,9 @@
function Input(props) {
const [guid] = (0, import_react5.useState)(v4_default());
const ref = (0, import_react5.useRef)(null);
const keyboardRef = (0, import_react5.useRef)(null);
- const blurTimeoutRef = (0, import_react5.useRef)();
+ const blurRef = (0, import_react5.useRef)(false);
const [isFocused, setFocused] = (0, import_react5.useState)(false);
const [showKeyboard, setShowKeyboard] = (0, import_react5.useState)(false);
(0, import_react5.useEffect)(() => {
if (simulator() === 0 /* MSFS */) {
@@ -29660,25 +29655,23 @@
placeholder: props.placeholder,
disabled: props.disabled,
onFocus: () => {
var _a;
- clearTimeout(blurTimeoutRef.current);
if (!isFocused) {
setFocused(true);
setShowKeyboard(true);
(_a = ref.current) == null ? void 0 : _a.select();
}
},
- onBlur: (e) => {
+ onBlur: () => {
var _a;
- if ((_a = keyboardRef.current) == null ? void 0 : _a.contains(e.relatedTarget)) {
- return;
- }
- blurTimeoutRef.current = setTimeout(() => {
- if (props.onBlur) props.onBlur(e.target.value);
- if (isFocused) setFocused(false);
+ if (blurRef.current && isFocused) (_a = ref.current) == null ? void 0 : _a.focus();
+ else {
setShowKeyboard(false);
- }, 100);
+ setFocused(false);
+ (_a = ref.current) == null ? void 0 : _a.blur();
+ }
+ blurRef.current = false;
},
onChange: (e) => {
if (props.onChange) props.onChange(e.target.value);
},
@@ -29690,9 +29683,9 @@
Keyboard_default,
{
ref: keyboardRef,
value: String(props.value),
- inputRef: ref,
+ blurRef: blurRef,
onInput: (value) => props.onChange && props.onChange(value),
onClose: () => {
var _a;
setShowKeyboard(false);
@@ -30209,9 +30202,9 @@
@@ -30203,9 +30203,9 @@
{
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
"data-ripple-light": "true",
@ -102,7 +13,7 @@ Index: EFB.js
) }) })
] }) }) });
}
@@ -40562,8 +40555,27 @@
@@ -40556,8 +40556,27 @@
] })
] }) }) });
}

View File

@ -1,6 +1,6 @@
{
"name": "tfdidesign-md11-load-manager",
"version": "0.1.182",
"version": "0.1.186",
"description": "",
"main": "index.js",
"type": "module",

View File

@ -4,6 +4,7 @@ import Keyboard from '../keyboard/Keyboard';
export default function Input(props: {
type?: string;
topKeyboard?: boolean;
value: any;
min?: number;
max?: number;
@ -66,6 +67,7 @@ export default function Input(props: {
{showKeyboard && (
<Keyboard
ref={keyboardRef}
top={props.topKeyboard}
value={String(props.value)}
blurRef={blurRef}
onInput={(value) => props.onChange && props.onChange(value)}

View File

@ -23,11 +23,12 @@ const Keyboard = forwardRef<
HTMLDivElement,
{
value: string;
blurRef: RefObject<boolean>
blurRef: RefObject<boolean>;
top?: boolean;
onInput: (value: string) => void;
onClose: () => void;
}
>(({ value, blurRef, onInput, onClose }, ref) => {
>(({ value, top, blurRef, onInput, onClose }, ref) => {
const [shift, setShift] = useState(false);
const layout = shift ? defaultLayout.shift : defaultLayout.default;
@ -63,7 +64,7 @@ const Keyboard = forwardRef<
return createPortal(
<div
ref={ref}
className="absolute bottom-0 left-0 z-50 box-border w-full touch-manipulation select-none overflow-hidden bg-zinc-800 p-2 text-white"
className={`absolute ${top ? 'top-0' : 'bottom-0'} left-0 z-50 box-border w-full touch-manipulation select-none overflow-hidden bg-zinc-800 p-2 text-white`}
>
{layout.map((row, rowIndex) => (
<div key={`row-${rowIndex}`} className="mb-1 flex w-full justify-center gap-1">

View File

@ -3,6 +3,7 @@ import { LoadingState } from '../../types/general';
import { WASMDataPax } from '../../types/WASMData';
import { CoherentCallGSXReset, CoherentCallOptionsSet } from '../../utils/utils';
import ToggleComponentKH from '../toggleComponent/ToggleComponent';
import Input from '../input/Input';
interface OptionsPaxProps {
WASMData: WASMDataPax;
@ -56,12 +57,12 @@ const OptionsPax: FC<OptionsPaxProps> = ({ WASMData, loadingState, gsxActive })
<div className="relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>Pax Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
<Input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={paxWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setPaxWeight)}
onChange={(value) => handleInput(value, Number.MAX_VALUE, setPaxWeight)}
disabled={loadingState !== 'preview' || gsxActive}
/>
</div>
@ -69,12 +70,12 @@ const OptionsPax: FC<OptionsPaxProps> = ({ WASMData, loadingState, gsxActive })
<div className="relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4">
<div className="flex w-full items-center justify-between text-xs">
<label>Bag Weight ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<input
<Input
type="text"
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={bagWeight}
onChange={(e) => handleInput(e.target.value, Number.MAX_VALUE, setBagWeight)}
onChange={(value) => handleInput(value, Number.MAX_VALUE, setBagWeight)}
disabled={loadingState !== 'preview' || gsxActive}
/>
</div>

View File

@ -160,6 +160,7 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActiv
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<Input
type="text"
topKeyboard
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerForward}
@ -173,6 +174,7 @@ const StationEntryF: FC<StationEntryProps> = ({ WASMData, loadingState, gsxActiv
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<Input
type="text"
topKeyboard
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={lowerRear}

View File

@ -160,6 +160,7 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, gsxAct
<label>Forward Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<Input
type="text"
topKeyboard
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={forwardCargo}
@ -173,6 +174,7 @@ const StationEntryPax: FC<StationEntryProps> = ({ WASMData, loadingState, gsxAct
<label>Aft Cargo ({WASMData.userData.isImperial ? 'lbs' : 'kg'})</label>
<Input
type="text"
topKeyboard
placeholder=""
className="w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600"
value={rearCargo}