@dovetail-v2/refine 0.2.1 → 0.2.2-alpha.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/dist/{MonacoYamlDiffEditor-ddff69c1.js → MonacoYamlDiffEditor-fe64524b.js} +1 -1
- package/dist/{index-c44daab0.js → index-d00a6dbe.js} +49 -29
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +48 -28
- package/lib/components/ShowContent/fields.d.ts +1 -0
- package/lib/components/YamlEditor/YamlEditorComponent.d.ts +3 -0
- package/package.json +1 -1
|
@@ -12322,7 +12322,7 @@ const ShowContent = (props) => {
|
|
|
12322
12322
|
},
|
|
12323
12323
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
12324
12324
|
className: cx_default(Typo.Display.d2_regular_title, NameStyle),
|
|
12325
|
-
children: (_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name
|
|
12325
|
+
children: showConfig.displayName || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
|
|
12326
12326
|
}), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
|
|
12327
12327
|
state: stateDisplay,
|
|
12328
12328
|
customResourceStateMap: showConfig.resourceStateMap
|
|
@@ -19512,15 +19512,19 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19512
19512
|
} = props;
|
|
19513
19513
|
const uri = id ? monaco.Uri.parse(`${id}.yaml`) : void 0;
|
|
19514
19514
|
useEffect(() => {
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19515
|
+
if (!window._MonacoSchemaMap) {
|
|
19516
|
+
window._MonacoSchemaMap = /* @__PURE__ */ new Map();
|
|
19517
|
+
}
|
|
19518
|
+
window._MonacoSchemaMap.set(id || "", {
|
|
19519
|
+
// Id of the first schema
|
|
19520
|
+
uri: String(uri),
|
|
19521
|
+
// Associate with our model
|
|
19522
|
+
fileMatch: [String(uri)],
|
|
19523
|
+
schema: {
|
|
19524
|
+
oneOf: schemas || [{ type: "object" }]
|
|
19522
19525
|
}
|
|
19523
|
-
|
|
19526
|
+
});
|
|
19527
|
+
const finalSchemas = [...window._MonacoSchemaMap.values()];
|
|
19524
19528
|
setDiagnosticsOptions({
|
|
19525
19529
|
enableSchemaRequest: false,
|
|
19526
19530
|
validate: true,
|
|
@@ -19541,13 +19545,15 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19541
19545
|
tabSize: 2,
|
|
19542
19546
|
lineNumbersMinChars: 7,
|
|
19543
19547
|
readOnly,
|
|
19544
|
-
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
19548
|
+
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
|
|
19549
|
+
theme: "vs"
|
|
19545
19550
|
});
|
|
19546
19551
|
instanceRef.current.editor = editor;
|
|
19547
19552
|
getInstance == null ? void 0 : getInstance(editor);
|
|
19548
19553
|
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
19549
19554
|
return () => {
|
|
19550
19555
|
instanceRef.current.editor = null;
|
|
19556
|
+
window._MonacoSchemaMap.delete(id || "");
|
|
19551
19557
|
model.dispose();
|
|
19552
19558
|
editor.dispose();
|
|
19553
19559
|
};
|
|
@@ -19564,7 +19570,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19564
19570
|
stop.dispose();
|
|
19565
19571
|
};
|
|
19566
19572
|
}
|
|
19567
|
-
}, [onChange
|
|
19573
|
+
}, [onChange]);
|
|
19568
19574
|
useEffect(() => {
|
|
19569
19575
|
const editor = instanceRef.current.editor;
|
|
19570
19576
|
if (editor) {
|
|
@@ -19598,7 +19604,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19598
19604
|
stop.dispose();
|
|
19599
19605
|
};
|
|
19600
19606
|
}
|
|
19601
|
-
}, [onValidate
|
|
19607
|
+
}, [onValidate]);
|
|
19602
19608
|
useEffect(() => {
|
|
19603
19609
|
const editor = instanceRef.current.editor;
|
|
19604
19610
|
if (editor) {
|
|
@@ -19611,7 +19617,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19611
19617
|
stop.dispose();
|
|
19612
19618
|
};
|
|
19613
19619
|
}
|
|
19614
|
-
}, [onBlur
|
|
19620
|
+
}, [onBlur]);
|
|
19615
19621
|
useEffect(() => {
|
|
19616
19622
|
const editor = instanceRef.current.editor;
|
|
19617
19623
|
const stops = [];
|
|
@@ -19638,7 +19644,7 @@ const MonacoYamlEditor$1 = (props) => {
|
|
|
19638
19644
|
return () => {
|
|
19639
19645
|
stops.forEach((stop) => stop.dispose());
|
|
19640
19646
|
};
|
|
19641
|
-
}, [
|
|
19647
|
+
}, [isScrollOnFocus]);
|
|
19642
19648
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19643
19649
|
"div",
|
|
19644
19650
|
{
|
|
@@ -38786,33 +38792,36 @@ const Separator = () => {
|
|
|
38786
38792
|
});
|
|
38787
38793
|
};
|
|
38788
38794
|
const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
|
|
38789
|
-
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-
|
|
38795
|
+
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-fe64524b.js"));
|
|
38790
38796
|
const YamlEditorComponent = forwardRef(
|
|
38791
38797
|
function YamlEditorComponent2(props, ref) {
|
|
38792
38798
|
const {
|
|
38793
38799
|
title,
|
|
38794
38800
|
collapsable = true,
|
|
38795
38801
|
isDefaultCollapsed,
|
|
38802
|
+
value: value2,
|
|
38796
38803
|
defaultValue = "",
|
|
38797
38804
|
height,
|
|
38798
38805
|
readOnly,
|
|
38799
38806
|
errorMsgs = [],
|
|
38800
38807
|
schemas,
|
|
38801
38808
|
eleRef,
|
|
38802
|
-
className
|
|
38809
|
+
className,
|
|
38810
|
+
debounceTime,
|
|
38811
|
+
isScrollOnFocus = true
|
|
38803
38812
|
} = props;
|
|
38804
38813
|
const { t: t2 } = useTranslation();
|
|
38805
38814
|
const [isCollapsed, setIsCollapsed] = useState(
|
|
38806
38815
|
collapsable ? isDefaultCollapsed : false
|
|
38807
38816
|
);
|
|
38808
38817
|
const [isDiff, setIsDiff] = useState(false);
|
|
38809
|
-
const [
|
|
38818
|
+
const [_value, _setValue] = useState(value2 || defaultValue);
|
|
38810
38819
|
const editorInstance = useRef();
|
|
38811
38820
|
const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
|
|
38812
38821
|
const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
|
|
38813
38822
|
useImperativeHandle(ref, () => {
|
|
38814
38823
|
return {
|
|
38815
|
-
setValue,
|
|
38824
|
+
setValue: _setValue,
|
|
38816
38825
|
setEditorValue: (value22) => {
|
|
38817
38826
|
var _a, _b;
|
|
38818
38827
|
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
|
|
@@ -38827,11 +38836,14 @@ const YamlEditorComponent = forwardRef(
|
|
|
38827
38836
|
const onChange = useCallback(
|
|
38828
38837
|
(newVal) => {
|
|
38829
38838
|
var _a;
|
|
38830
|
-
|
|
38839
|
+
_setValue(newVal);
|
|
38831
38840
|
(_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
|
|
38832
38841
|
},
|
|
38833
38842
|
[props.onChange]
|
|
38834
38843
|
);
|
|
38844
|
+
const finalOnChange = useMemo(() => {
|
|
38845
|
+
return debounceTime ? debounce(onChange, debounceTime) : onChange;
|
|
38846
|
+
}, [onChange, debounceTime]);
|
|
38835
38847
|
const onValidate = useCallback(
|
|
38836
38848
|
(valid, schemaValid) => {
|
|
38837
38849
|
var _a;
|
|
@@ -38842,16 +38854,23 @@ const YamlEditorComponent = forwardRef(
|
|
|
38842
38854
|
const onEditorCreate = useCallback(
|
|
38843
38855
|
(editor) => {
|
|
38844
38856
|
var _a, _b, _c;
|
|
38845
|
-
if (editor.getValue() !==
|
|
38846
|
-
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(
|
|
38857
|
+
if (editor.getValue() !== _value) {
|
|
38858
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
|
|
38847
38859
|
}
|
|
38848
38860
|
(_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
|
|
38849
38861
|
},
|
|
38850
|
-
[
|
|
38862
|
+
[_value, props.onEditorCreate]
|
|
38851
38863
|
);
|
|
38852
38864
|
const getInstance = useCallback((ins) => {
|
|
38853
38865
|
editorInstance.current = ins;
|
|
38854
38866
|
}, []);
|
|
38867
|
+
useEffect(() => {
|
|
38868
|
+
var _a, _b;
|
|
38869
|
+
if (value2 !== void 0 && value2 !== _value) {
|
|
38870
|
+
_setValue(value2);
|
|
38871
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
|
|
38872
|
+
}
|
|
38873
|
+
}, [value2]);
|
|
38855
38874
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
38856
38875
|
"div",
|
|
38857
38876
|
{
|
|
@@ -38905,7 +38924,7 @@ const YamlEditorComponent = forwardRef(
|
|
|
38905
38924
|
iconHeight: 16,
|
|
38906
38925
|
onClick: () => {
|
|
38907
38926
|
if (!isCollapsed) {
|
|
38908
|
-
copyToClipboard(
|
|
38927
|
+
copyToClipboard(_value);
|
|
38909
38928
|
setCopyTooltip(t2("dovetail.copied"));
|
|
38910
38929
|
}
|
|
38911
38930
|
}
|
|
@@ -38998,27 +39017,28 @@ const YamlEditorComponent = forwardRef(
|
|
|
38998
39017
|
zIndex: 1
|
|
38999
39018
|
},
|
|
39000
39019
|
children: [
|
|
39001
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39020
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39002
39021
|
MonacoYamlEditor,
|
|
39003
39022
|
{
|
|
39004
39023
|
id: props.id,
|
|
39005
39024
|
getInstance,
|
|
39006
|
-
defaultValue:
|
|
39025
|
+
defaultValue: _value,
|
|
39007
39026
|
height,
|
|
39008
|
-
onChange,
|
|
39027
|
+
onChange: finalOnChange,
|
|
39009
39028
|
onValidate,
|
|
39010
39029
|
onEditorCreate,
|
|
39011
39030
|
onBlur: props.onBlur,
|
|
39012
39031
|
schemas,
|
|
39013
|
-
readOnly
|
|
39032
|
+
readOnly,
|
|
39033
|
+
isScrollOnFocus
|
|
39014
39034
|
}
|
|
39015
39035
|
) }) }),
|
|
39016
|
-
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39036
|
+
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39017
39037
|
MonacoYamlDiffEditor,
|
|
39018
39038
|
{
|
|
39019
39039
|
id: props.id,
|
|
39020
39040
|
origin: defaultValue,
|
|
39021
|
-
modified:
|
|
39041
|
+
modified: _value,
|
|
39022
39042
|
height
|
|
39023
39043
|
}
|
|
39024
39044
|
) }) : null
|
package/dist/refine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bP, cF, A, aY, a_, aH, cd, bm, a3, cr, cf, aS, V, C, l, cL, aK, br, ae, cN, ak, ar, cW, az, cg, ce, cZ, aO, by, y, aF, bF, cY, cG, bI, D, b3, au, bL, at, av, a2, cc, cb, cX, bk, aW, cI, af, bS, cK, cJ, cM, cp, aI, al, v, t, cO, I, bv, aV, w, Q, bg, bi, ch, cQ, aN, bu, as, aA, aB, aa, aC, aZ, aG, bG, bJ, ab, d7, cq, cA, bO, N, a4, g, aX, a8, bR, bA, bz, cP, c2, d2, i, d1, aL, bs, cj, O, bc, bd, bq, K, be, L, bf, F, b7, cD, E, b6, J, ba, G, b8, H, b9, M, c3, bb, cC, ac, d5, d4, P, bo, x, ag, aj, c1, bl, cU, cT, b1, bw, c9, c8, s, aM, bn, z, bx, b2, d6, B, ct, cH, bM, bU, bV, d9, aJ, R, ai, ap, ao, bN, am, cV, c5, an, cE, ca, bj, bC, aw, k, U, T, bh, cw, cz, cv, cu, cx, cy, cs, ck, cn, co, cm, cl, ci, cB, bW, aP, bt, aD, o, bZ, n, a$, d0, q, b_, b0, p, aU, bp, m, c$, aR, aT, c7, bE, bD, c6, aQ, S, bH, c_, d3, b4, b5, bB, bK, c4, b$, c0, ad, a1, cS, ah, W, cR, aq, ay, ax, h, aE, bX, X, a5, d, dc, db, de, d8, a9, df, da, bT, dd, a7, a6, r, a, c, e, Z, Y, _, f, $, u, bQ, a0, bY, b } from "./index-
|
|
1
|
+
import { bP, cF, A, aY, a_, aH, cd, bm, a3, cr, cf, aS, V, C, l, cL, aK, br, ae, cN, ak, ar, cW, az, cg, ce, cZ, aO, by, y, aF, bF, cY, cG, bI, D, b3, au, bL, at, av, a2, cc, cb, cX, bk, aW, cI, af, bS, cK, cJ, cM, cp, aI, al, v, t, cO, I, bv, aV, w, Q, bg, bi, ch, cQ, aN, bu, as, aA, aB, aa, aC, aZ, aG, bG, bJ, ab, d7, cq, cA, bO, N, a4, g, aX, a8, bR, bA, bz, cP, c2, d2, i, d1, aL, bs, cj, O, bc, bd, bq, K, be, L, bf, F, b7, cD, E, b6, J, ba, G, b8, H, b9, M, c3, bb, cC, ac, d5, d4, P, bo, x, ag, aj, c1, bl, cU, cT, b1, bw, c9, c8, s, aM, bn, z, bx, b2, d6, B, ct, cH, bM, bU, bV, d9, aJ, R, ai, ap, ao, bN, am, cV, c5, an, cE, ca, bj, bC, aw, k, U, T, bh, cw, cz, cv, cu, cx, cy, cs, ck, cn, co, cm, cl, ci, cB, bW, aP, bt, aD, o, bZ, n, a$, d0, q, b_, b0, p, aU, bp, m, c$, aR, aT, c7, bE, bD, c6, aQ, S, bH, c_, d3, b4, b5, bB, bK, c4, b$, c0, ad, a1, cS, ah, W, cR, aq, ay, ax, h, aE, bX, X, a5, d, dc, db, de, d8, a9, df, da, bT, dd, a7, a6, r, a, c, e, Z, Y, _, f, $, u, bQ, a0, bY, b } from "./index-d00a6dbe.js";
|
|
2
2
|
import "@cloudtower/eagle";
|
|
3
3
|
import "@refinedev/core";
|
|
4
4
|
import "react";
|
package/dist/refine.umd.cjs
CHANGED
|
@@ -12328,7 +12328,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12328
12328
|
},
|
|
12329
12329
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
12330
12330
|
className: cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
|
|
12331
|
-
children: (_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name
|
|
12331
|
+
children: showConfig.displayName || ((_c = record == null ? void 0 : record.metadata) == null ? void 0 : _c.name)
|
|
12332
12332
|
}), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
|
|
12333
12333
|
state: stateDisplay,
|
|
12334
12334
|
customResourceStateMap: showConfig.resourceStateMap
|
|
@@ -19518,15 +19518,19 @@ var __publicField = (obj, key, value) => {
|
|
|
19518
19518
|
} = props;
|
|
19519
19519
|
const uri = id ? monaco__namespace.Uri.parse(`${id}.yaml`) : void 0;
|
|
19520
19520
|
React.useEffect(() => {
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19521
|
+
if (!window._MonacoSchemaMap) {
|
|
19522
|
+
window._MonacoSchemaMap = /* @__PURE__ */ new Map();
|
|
19523
|
+
}
|
|
19524
|
+
window._MonacoSchemaMap.set(id || "", {
|
|
19525
|
+
// Id of the first schema
|
|
19526
|
+
uri: String(uri),
|
|
19527
|
+
// Associate with our model
|
|
19528
|
+
fileMatch: [String(uri)],
|
|
19529
|
+
schema: {
|
|
19530
|
+
oneOf: schemas || [{ type: "object" }]
|
|
19528
19531
|
}
|
|
19529
|
-
|
|
19532
|
+
});
|
|
19533
|
+
const finalSchemas = [...window._MonacoSchemaMap.values()];
|
|
19530
19534
|
monacoYaml.setDiagnosticsOptions({
|
|
19531
19535
|
enableSchemaRequest: false,
|
|
19532
19536
|
validate: true,
|
|
@@ -19547,13 +19551,15 @@ var __publicField = (obj, key, value) => {
|
|
|
19547
19551
|
tabSize: 2,
|
|
19548
19552
|
lineNumbersMinChars: 7,
|
|
19549
19553
|
readOnly,
|
|
19550
|
-
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
19554
|
+
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
|
|
19555
|
+
theme: "vs"
|
|
19551
19556
|
});
|
|
19552
19557
|
instanceRef.current.editor = editor;
|
|
19553
19558
|
getInstance == null ? void 0 : getInstance(editor);
|
|
19554
19559
|
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
19555
19560
|
return () => {
|
|
19556
19561
|
instanceRef.current.editor = null;
|
|
19562
|
+
window._MonacoSchemaMap.delete(id || "");
|
|
19557
19563
|
model.dispose();
|
|
19558
19564
|
editor.dispose();
|
|
19559
19565
|
};
|
|
@@ -19570,7 +19576,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19570
19576
|
stop.dispose();
|
|
19571
19577
|
};
|
|
19572
19578
|
}
|
|
19573
|
-
}, [onChange
|
|
19579
|
+
}, [onChange]);
|
|
19574
19580
|
React.useEffect(() => {
|
|
19575
19581
|
const editor = instanceRef.current.editor;
|
|
19576
19582
|
if (editor) {
|
|
@@ -19604,7 +19610,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19604
19610
|
stop.dispose();
|
|
19605
19611
|
};
|
|
19606
19612
|
}
|
|
19607
|
-
}, [onValidate
|
|
19613
|
+
}, [onValidate]);
|
|
19608
19614
|
React.useEffect(() => {
|
|
19609
19615
|
const editor = instanceRef.current.editor;
|
|
19610
19616
|
if (editor) {
|
|
@@ -19617,7 +19623,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19617
19623
|
stop.dispose();
|
|
19618
19624
|
};
|
|
19619
19625
|
}
|
|
19620
|
-
}, [onBlur
|
|
19626
|
+
}, [onBlur]);
|
|
19621
19627
|
React.useEffect(() => {
|
|
19622
19628
|
const editor = instanceRef.current.editor;
|
|
19623
19629
|
const stops = [];
|
|
@@ -19644,7 +19650,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19644
19650
|
return () => {
|
|
19645
19651
|
stops.forEach((stop) => stop.dispose());
|
|
19646
19652
|
};
|
|
19647
|
-
}, [
|
|
19653
|
+
}, [isScrollOnFocus]);
|
|
19648
19654
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19649
19655
|
"div",
|
|
19650
19656
|
{
|
|
@@ -38799,26 +38805,29 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38799
38805
|
title,
|
|
38800
38806
|
collapsable = true,
|
|
38801
38807
|
isDefaultCollapsed,
|
|
38808
|
+
value: value2,
|
|
38802
38809
|
defaultValue = "",
|
|
38803
38810
|
height,
|
|
38804
38811
|
readOnly,
|
|
38805
38812
|
errorMsgs = [],
|
|
38806
38813
|
schemas,
|
|
38807
38814
|
eleRef,
|
|
38808
|
-
className
|
|
38815
|
+
className,
|
|
38816
|
+
debounceTime,
|
|
38817
|
+
isScrollOnFocus = true
|
|
38809
38818
|
} = props;
|
|
38810
38819
|
const { t: t2 } = useTranslation();
|
|
38811
38820
|
const [isCollapsed, setIsCollapsed] = React.useState(
|
|
38812
38821
|
collapsable ? isDefaultCollapsed : false
|
|
38813
38822
|
);
|
|
38814
38823
|
const [isDiff, setIsDiff] = React.useState(false);
|
|
38815
|
-
const [
|
|
38824
|
+
const [_value, _setValue] = React.useState(value2 || defaultValue);
|
|
38816
38825
|
const editorInstance = React.useRef();
|
|
38817
38826
|
const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
|
|
38818
38827
|
const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
|
|
38819
38828
|
React.useImperativeHandle(ref, () => {
|
|
38820
38829
|
return {
|
|
38821
|
-
setValue,
|
|
38830
|
+
setValue: _setValue,
|
|
38822
38831
|
setEditorValue: (value22) => {
|
|
38823
38832
|
var _a, _b;
|
|
38824
38833
|
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
|
|
@@ -38833,11 +38842,14 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38833
38842
|
const onChange = React.useCallback(
|
|
38834
38843
|
(newVal) => {
|
|
38835
38844
|
var _a;
|
|
38836
|
-
|
|
38845
|
+
_setValue(newVal);
|
|
38837
38846
|
(_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
|
|
38838
38847
|
},
|
|
38839
38848
|
[props.onChange]
|
|
38840
38849
|
);
|
|
38850
|
+
const finalOnChange = React.useMemo(() => {
|
|
38851
|
+
return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
|
|
38852
|
+
}, [onChange, debounceTime]);
|
|
38841
38853
|
const onValidate = React.useCallback(
|
|
38842
38854
|
(valid, schemaValid) => {
|
|
38843
38855
|
var _a;
|
|
@@ -38848,16 +38860,23 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38848
38860
|
const onEditorCreate = React.useCallback(
|
|
38849
38861
|
(editor) => {
|
|
38850
38862
|
var _a, _b, _c;
|
|
38851
|
-
if (editor.getValue() !==
|
|
38852
|
-
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(
|
|
38863
|
+
if (editor.getValue() !== _value) {
|
|
38864
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
|
|
38853
38865
|
}
|
|
38854
38866
|
(_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
|
|
38855
38867
|
},
|
|
38856
|
-
[
|
|
38868
|
+
[_value, props.onEditorCreate]
|
|
38857
38869
|
);
|
|
38858
38870
|
const getInstance = React.useCallback((ins) => {
|
|
38859
38871
|
editorInstance.current = ins;
|
|
38860
38872
|
}, []);
|
|
38873
|
+
React.useEffect(() => {
|
|
38874
|
+
var _a, _b;
|
|
38875
|
+
if (value2 !== void 0 && value2 !== _value) {
|
|
38876
|
+
_setValue(value2);
|
|
38877
|
+
(_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
|
|
38878
|
+
}
|
|
38879
|
+
}, [value2]);
|
|
38861
38880
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
38862
38881
|
"div",
|
|
38863
38882
|
{
|
|
@@ -38911,7 +38930,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38911
38930
|
iconHeight: 16,
|
|
38912
38931
|
onClick: () => {
|
|
38913
38932
|
if (!isCollapsed) {
|
|
38914
|
-
copyToClipboard(
|
|
38933
|
+
copyToClipboard(_value);
|
|
38915
38934
|
setCopyTooltip(t2("dovetail.copied"));
|
|
38916
38935
|
}
|
|
38917
38936
|
}
|
|
@@ -39004,27 +39023,28 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39004
39023
|
zIndex: 1
|
|
39005
39024
|
},
|
|
39006
39025
|
children: [
|
|
39007
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39026
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39008
39027
|
MonacoYamlEditor,
|
|
39009
39028
|
{
|
|
39010
39029
|
id: props.id,
|
|
39011
39030
|
getInstance,
|
|
39012
|
-
defaultValue:
|
|
39031
|
+
defaultValue: _value,
|
|
39013
39032
|
height,
|
|
39014
|
-
onChange,
|
|
39033
|
+
onChange: finalOnChange,
|
|
39015
39034
|
onValidate,
|
|
39016
39035
|
onEditorCreate,
|
|
39017
39036
|
onBlur: props.onBlur,
|
|
39018
39037
|
schemas,
|
|
39019
|
-
readOnly
|
|
39038
|
+
readOnly,
|
|
39039
|
+
isScrollOnFocus
|
|
39020
39040
|
}
|
|
39021
39041
|
) }) }),
|
|
39022
|
-
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children:
|
|
39042
|
+
isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39023
39043
|
MonacoYamlDiffEditor$2,
|
|
39024
39044
|
{
|
|
39025
39045
|
id: props.id,
|
|
39026
39046
|
origin: defaultValue,
|
|
39027
|
-
modified:
|
|
39047
|
+
modified: _value,
|
|
39028
39048
|
height
|
|
39029
39049
|
}
|
|
39030
39050
|
) }) : null
|
|
@@ -39,6 +39,7 @@ export interface ShowConfig<Model extends ResourceModel = ResourceModel> {
|
|
|
39
39
|
color: Record<string, StatusCapsuleColor | 'loading'>;
|
|
40
40
|
text: Record<string, string>;
|
|
41
41
|
};
|
|
42
|
+
displayName?: string;
|
|
42
43
|
}
|
|
43
44
|
export declare const ImageField: <Model extends WorkloadBaseModel>(i18n: I18nType) => ShowField<Model>;
|
|
44
45
|
export declare const ReplicaField: <Model extends JobModel | WorkloadModel>() => ShowField<Model>;
|
|
@@ -4,6 +4,7 @@ import React from 'react';
|
|
|
4
4
|
export type YamlEditorProps = {
|
|
5
5
|
eleRef?: React.MutableRefObject<HTMLDivElement>;
|
|
6
6
|
title?: string;
|
|
7
|
+
value?: string;
|
|
7
8
|
defaultValue?: string;
|
|
8
9
|
errorMsgs?: string[];
|
|
9
10
|
schemas?: JSONSchema7[] | null;
|
|
@@ -13,6 +14,8 @@ export type YamlEditorProps = {
|
|
|
13
14
|
collapsable?: boolean;
|
|
14
15
|
isDefaultCollapsed?: boolean;
|
|
15
16
|
readOnly?: boolean;
|
|
17
|
+
debounceTime?: number;
|
|
18
|
+
isScrollOnFocus?: boolean;
|
|
16
19
|
onChange?: (value: string) => void;
|
|
17
20
|
onValidate?: (valid: boolean, schemaValid: boolean) => void;
|
|
18
21
|
onEditorCreate?: (editor: monaco.editor.IStandaloneCodeEditor) => void;
|