@dovetail-v2/refine 0.0.30 → 0.0.32-beta.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-7505595f.js → MonacoYamlDiffEditor-0d108b88.js} +1 -3
- package/dist/MonacoYamlEditor-e382457d.js +167 -0
- package/dist/{index-d02782c8.js → index-3a367ae3.js} +7089 -4127
- package/dist/refine.js +133 -105
- package/dist/refine.umd.cjs +8081 -4966
- package/dist/style.css +40 -24
- package/lib/src/components/CronJobDropdown/index.d.ts +2 -0
- package/lib/src/components/CronjobJobsTable/index.d.ts +1 -0
- package/lib/src/components/K8sDropdown/index.d.ts +2 -0
- package/lib/src/components/RefineForm/RefineFormContent.d.ts +10 -0
- package/lib/src/components/RefineForm/RefineFormModal.d.ts +8 -0
- package/lib/src/components/RefineForm/RefineFormPage.d.ts +7 -0
- package/lib/src/components/RefineForm/index.d.ts +3 -0
- package/lib/src/components/RefineForm/type.d.ts +20 -0
- package/lib/src/components/RefineForm/useRefineForm.d.ts +10 -0
- package/lib/src/components/ServiceComponents/index.d.ts +8 -0
- package/lib/src/components/ShowContent/fields.d.ts +34 -24
- package/lib/src/components/ShowContent/groups.d.ts +11 -0
- package/lib/src/components/ShowContent/index.d.ts +2 -0
- package/lib/src/components/ShowContent/tabs.d.ts +12 -0
- package/lib/src/components/StateTag/StateTag.d.ts +1 -0
- package/lib/src/components/Tabs/index.d.ts +10 -0
- package/lib/src/components/TextTags/index.d.ts +6 -0
- package/lib/src/components/Time/index.d.ts +2 -3
- package/lib/src/components/WorkloadDropdown/index.d.ts +2 -0
- package/lib/src/components/WorkloadReplicas/index.d.ts +1 -2
- package/lib/src/components/YamlForm/index.d.ts +2 -0
- package/lib/src/components/index.d.ts +4 -0
- package/lib/src/constants/k8s.d.ts +23 -0
- package/lib/src/contexts/component.d.ts +2 -0
- package/lib/src/hooks/useEagleTable/columns.d.ts +9 -3
- package/lib/src/i18n.d.ts +132 -10
- package/lib/src/locales/en-US/index.d.ts +95 -1
- package/lib/src/locales/zh-CN/index.d.ts +36 -9
- package/lib/src/models/index.d.ts +1 -0
- package/lib/src/models/service-model.d.ts +10 -1
- package/lib/src/pages/services/index.d.ts +2 -2
- package/lib/src/pages/statefulsets/index.d.ts +4 -3
- package/lib/src/types/resource.d.ts +5 -1
- package/package.json +10 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./index-
|
|
1
|
+
import { j as jsxRuntimeExports } from "./index-3a367ae3.js";
|
|
2
2
|
import * as monaco from "monaco-editor";
|
|
3
3
|
import { useRef, useEffect } from "react";
|
|
4
4
|
import "i18next";
|
|
@@ -10,8 +10,6 @@ import "js-yaml";
|
|
|
10
10
|
import "lodash-es";
|
|
11
11
|
import "sunflower-antd";
|
|
12
12
|
import "@cloudtower/icons-react";
|
|
13
|
-
import "monaco-yaml";
|
|
14
|
-
import "react-dom";
|
|
15
13
|
import "antd";
|
|
16
14
|
import "k8s-api-provider";
|
|
17
15
|
const MonacoYamlDiffEditor = (props) => {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports, c as cx_default, Y as YamlEditorStyle } from "./index-3a367ae3.js";
|
|
2
|
+
import * as monaco from "monaco-editor";
|
|
3
|
+
import { setDiagnosticsOptions } from "monaco-yaml";
|
|
4
|
+
import { useRef, useEffect } from "react";
|
|
5
|
+
import ReactDOM from "react-dom";
|
|
6
|
+
import "i18next";
|
|
7
|
+
import "@refinedev/core";
|
|
8
|
+
import "qs";
|
|
9
|
+
import "react-router-dom";
|
|
10
|
+
import "@cloudtower/eagle";
|
|
11
|
+
import "js-yaml";
|
|
12
|
+
import "lodash-es";
|
|
13
|
+
import "sunflower-antd";
|
|
14
|
+
import "@cloudtower/icons-react";
|
|
15
|
+
import "antd";
|
|
16
|
+
import "k8s-api-provider";
|
|
17
|
+
const schemaMap = /* @__PURE__ */ new Map();
|
|
18
|
+
const MonacoYamlEditor = (props) => {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
const instanceRef = useRef({ editor: null });
|
|
21
|
+
const {
|
|
22
|
+
defaultValue,
|
|
23
|
+
id,
|
|
24
|
+
height,
|
|
25
|
+
readOnly,
|
|
26
|
+
schema,
|
|
27
|
+
isScrollOnFocus,
|
|
28
|
+
onChange,
|
|
29
|
+
onValidate,
|
|
30
|
+
getInstance,
|
|
31
|
+
onEditorCreate,
|
|
32
|
+
onBlur
|
|
33
|
+
} = props;
|
|
34
|
+
const uri = id ? monaco.Uri.parse(`${id}.yaml`) : void 0;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (schema) {
|
|
37
|
+
schemaMap.set(id, {
|
|
38
|
+
// Id of the first schema
|
|
39
|
+
uri: String(uri),
|
|
40
|
+
// Associate with our model
|
|
41
|
+
fileMatch: uri ? [String(uri)] : [],
|
|
42
|
+
schema
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const schemas = [...schemaMap.values()];
|
|
46
|
+
setDiagnosticsOptions({
|
|
47
|
+
enableSchemaRequest: false,
|
|
48
|
+
hover: true,
|
|
49
|
+
completion: true,
|
|
50
|
+
validate: true,
|
|
51
|
+
format: true,
|
|
52
|
+
isKubernetes: true,
|
|
53
|
+
schemas
|
|
54
|
+
});
|
|
55
|
+
const model = monaco.editor.createModel(defaultValue, "yaml", uri);
|
|
56
|
+
const editor = monaco.editor.create(ref.current, {
|
|
57
|
+
automaticLayout: true,
|
|
58
|
+
scrollBeyondLastLine: false,
|
|
59
|
+
model,
|
|
60
|
+
scrollbar: {
|
|
61
|
+
handleMouseWheel: !isScrollOnFocus
|
|
62
|
+
},
|
|
63
|
+
tabSize: 2,
|
|
64
|
+
readOnly,
|
|
65
|
+
autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
|
|
66
|
+
});
|
|
67
|
+
instanceRef.current.editor = editor;
|
|
68
|
+
getInstance == null ? void 0 : getInstance(editor);
|
|
69
|
+
onEditorCreate == null ? void 0 : onEditorCreate(editor);
|
|
70
|
+
return () => {
|
|
71
|
+
instanceRef.current.editor = null;
|
|
72
|
+
schemaMap.delete(id);
|
|
73
|
+
model.dispose();
|
|
74
|
+
editor.dispose();
|
|
75
|
+
};
|
|
76
|
+
}, [defaultValue, schema, id, readOnly, isScrollOnFocus, getInstance]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const editor = instanceRef.current.editor;
|
|
79
|
+
if (editor) {
|
|
80
|
+
const stop = editor.onDidChangeModelContent(() => {
|
|
81
|
+
ReactDOM.unstable_batchedUpdates(() => {
|
|
82
|
+
onChange == null ? void 0 : onChange(editor.getValue());
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return () => {
|
|
86
|
+
stop.dispose();
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [onChange, instanceRef.current.editor]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const editor = instanceRef.current.editor;
|
|
92
|
+
if (editor) {
|
|
93
|
+
const stop = monaco.editor.onDidChangeMarkers((uri2) => {
|
|
94
|
+
var _a;
|
|
95
|
+
const model = (_a = instanceRef.current.editor) == null ? void 0 : _a.getModel();
|
|
96
|
+
const currentEditorUri = model == null ? void 0 : model.uri;
|
|
97
|
+
if (model && uri2.toString() === (currentEditorUri == null ? void 0 : currentEditorUri.toString())) {
|
|
98
|
+
const marks = monaco.editor.getModelMarkers({ owner: "yaml", resource: currentEditorUri });
|
|
99
|
+
const yamlMarks = marks.filter((m) => m.source === "YAML");
|
|
100
|
+
const schemaMarks = marks.filter((m) => m.source !== "YAML");
|
|
101
|
+
const yamlValid = yamlMarks.length === 0;
|
|
102
|
+
const schemaValid = schemaMarks.length === 0;
|
|
103
|
+
onValidate == null ? void 0 : onValidate(yamlValid, schemaValid);
|
|
104
|
+
if (marks.some((mark) => {
|
|
105
|
+
var _a2;
|
|
106
|
+
return (_a2 = mark.source) == null ? void 0 : _a2.includes("yaml-schema");
|
|
107
|
+
})) {
|
|
108
|
+
monaco.editor.setModelMarkers(model, "yaml", marks.map((mark) => ({ ...mark, source: "", resource: {} })));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return () => {
|
|
113
|
+
stop.dispose();
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}, [onValidate, instanceRef.current.editor]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
const editor = instanceRef.current.editor;
|
|
119
|
+
if (editor) {
|
|
120
|
+
const stop = editor.onDidBlurEditorWidget(() => {
|
|
121
|
+
ReactDOM.unstable_batchedUpdates(() => {
|
|
122
|
+
onBlur == null ? void 0 : onBlur();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
return () => {
|
|
126
|
+
stop.dispose();
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}, [onBlur, instanceRef.current.editor]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
const editor = instanceRef.current.editor;
|
|
132
|
+
const stops = [];
|
|
133
|
+
if (editor && isScrollOnFocus) {
|
|
134
|
+
stops.push(editor.onDidFocusEditorWidget(() => {
|
|
135
|
+
editor.updateOptions({
|
|
136
|
+
scrollbar: {
|
|
137
|
+
handleMouseWheel: true
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}));
|
|
141
|
+
stops.push(editor.onDidBlurEditorWidget(() => {
|
|
142
|
+
editor.updateOptions({
|
|
143
|
+
scrollbar: {
|
|
144
|
+
handleMouseWheel: false
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
return () => {
|
|
150
|
+
stops.forEach((stop) => stop.dispose());
|
|
151
|
+
};
|
|
152
|
+
}, [instanceRef.current.editor, isScrollOnFocus]);
|
|
153
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
ref,
|
|
157
|
+
className: cx_default(YamlEditorStyle, props.className),
|
|
158
|
+
style: {
|
|
159
|
+
width: "100%",
|
|
160
|
+
height: height || "500px"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
export {
|
|
166
|
+
MonacoYamlEditor as default
|
|
167
|
+
};
|