@vention/machine-logic-ui-sdk 0.22.0 → 0.23.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.
package/index.esm.js CHANGED
@@ -1814,21 +1814,33 @@ const VirtualKeyboard = () => {
1814
1814
  const [keyboardLayout, setKeyboardLayout] = useState(KeyboardLayout.TEXT);
1815
1815
  const [keyboardLayoutName, setKeyboardLayoutName] = useState(KeyboardLayoutName.DEFAULT);
1816
1816
  const [focusedTextInput, setFocusedTextInput] = useState();
1817
+ const [isSubmitPressed, setIsSubmitPressed] = useState(false);
1817
1818
  const virtualKeyboardRef = useRef(null);
1818
1819
  const keyboardContainerRef = useRef(null);
1819
- useEffect(function handleClickOutsideListeners() {
1820
+ useEffect(function handleClickListeners() {
1820
1821
  function handleClickOutside(event) {
1821
1822
  if (keyboardContainerRef.current && !keyboardContainerRef.current.contains(event.target)) {
1822
1823
  setIsKeyboardVisible(false);
1823
1824
  }
1824
1825
  }
1826
+ function handleMouseOrTouchUp(event) {
1827
+ if (isSubmitPressed) {
1828
+ event.preventDefault();
1829
+ setIsKeyboardVisible(false);
1830
+ setIsSubmitPressed(false);
1831
+ }
1832
+ }
1825
1833
  document.addEventListener("mousedown", handleClickOutside);
1826
1834
  document.addEventListener("touchstart", handleClickOutside);
1835
+ document.addEventListener("mouseup", handleMouseOrTouchUp);
1836
+ document.addEventListener("touchend", handleMouseOrTouchUp);
1827
1837
  return () => {
1828
1838
  document.removeEventListener("mousedown", handleClickOutside);
1829
1839
  document.removeEventListener("touchstart", handleClickOutside);
1840
+ document.removeEventListener("mouseup", handleMouseOrTouchUp);
1841
+ document.removeEventListener("touchend", handleMouseOrTouchUp);
1830
1842
  };
1831
- }, []);
1843
+ }, [isSubmitPressed]);
1832
1844
  useEffect(function showOrHideKeyboard() {
1833
1845
  // The keyboard will appear/disappear on mouse down
1834
1846
  // However, if the user is clicking something, like a submit button or the input itself, the mouse up will happen a few milliseconds after the keyboard is shown/hidden
@@ -1969,7 +1981,7 @@ const VirtualKeyboard = () => {
1969
1981
  break;
1970
1982
  case KeyboardKey.SUBMIT:
1971
1983
  focusedTextInput.blur();
1972
- setIsKeyboardVisible(false);
1984
+ setIsSubmitPressed(true);
1973
1985
  break;
1974
1986
  }
1975
1987
  };
@@ -2885,6 +2897,10 @@ const getMqttWsUrlGivenUiIframeUrl = uiIframeUrl => {
2885
2897
  const closeCustomUi = () => {
2886
2898
  window.parent.postMessage("closeCustomUi", "*");
2887
2899
  };
2900
+ const navigateControlCenter = route => {
2901
+ const capitalizedRoute = route.charAt(0).toUpperCase() + route.slice(1);
2902
+ window.parent.postMessage(`navigateTo${capitalizedRoute}`, "*");
2903
+ };
2888
2904
 
2889
2905
  const defaultContext = {
2890
2906
  client: null,
@@ -2957,4 +2973,4 @@ const useMqttSubscription = props => {
2957
2973
  return message;
2958
2974
  };
2959
2975
 
2960
- export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, useMqttSubscription };
2976
+ export { MqttClient, MqttProvider, VirtualKeyboard, closeCustomUi, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, getMqttWsUrlGivenUiIframeUrl, isOnEdge, isTouchScreenDevice, mqttContext, navigateControlCenter, useMqttSubscription };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-logic-ui-sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"
@@ -7,3 +7,4 @@ export declare const connectToMqttAndGetClient: () => Promise<MqttClient>;
7
7
  export declare const getMachineCodeProcessHttpUrl: (processName: string) => string;
8
8
  export declare const getMqttWsUrlGivenUiIframeUrl: (uiIframeUrl: string) => string;
9
9
  export declare const closeCustomUi: () => void;
10
+ export declare const navigateControlCenter: (route: "remoteSupport" | "controlCenterHomepage") => void;