@linxin666/dsh-usage 0.4.11 → 0.4.12

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/lib/client.js CHANGED
@@ -781,17 +781,19 @@ window.__ModuleLoader__.load({
781
781
  })
782
782
  ]
783
783
  });
784
+ const notExposedNotice = state.exposed || props.hideNotExposedNotice === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
785
+ className: settings_card_module_css_default.notExposed,
786
+ role: "status",
787
+ children: props.t("settings.notExposed")
788
+ });
784
789
  if (!state.exposed && props.renderChildrenWhenNotExposed !== true) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
785
790
  className: cardClass,
786
- children: [header, bodyRegion(props.hideNotExposedNotice !== true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
787
- className: settings_card_module_css_default.notExposed,
788
- role: "status",
789
- children: props.t("settings.notExposed")
790
- }) : null)]
791
+ children: [header, bodyRegion(notExposedNotice)]
791
792
  });
792
793
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
793
794
  className: cardClass,
794
795
  children: [header, props.headerOnly !== true ? bodyRegion(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
796
+ notExposedNotice,
795
797
  !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
796
798
  className: settings_card_module_css_default.readOnly,
797
799
  role: "status",
@@ -821,9 +823,11 @@ window.__ModuleLoader__.load({
821
823
  */
822
824
  function ValueField(props) {
823
825
  const apply = (0, react.useContext)(CardApply);
826
+ const settledByKey = (0, react.useRef)(false);
824
827
  const onKeyDown = (event) => {
825
828
  if (apply === null || event.key !== "Enter" && event.key !== "Escape") return;
826
829
  event.preventDefault();
830
+ settledByKey.current = true;
827
831
  if (event.key === "Enter") apply.commit();
828
832
  else apply.revert();
829
833
  event.currentTarget.blur();
@@ -841,7 +845,14 @@ window.__ModuleLoader__.load({
841
845
  props.onEdit(event.target.value);
842
846
  },
843
847
  onKeyDown,
848
+ onFocus: () => {
849
+ settledByKey.current = false;
850
+ },
844
851
  onBlur: () => {
852
+ if (settledByKey.current) {
853
+ settledByKey.current = false;
854
+ return;
855
+ }
845
856
  apply?.commit();
846
857
  }
847
858
  });