@dovetail-v2/refine 0.3.11-alpha.1 → 0.3.11-alpha.3

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/style.css CHANGED
@@ -470,6 +470,10 @@
470
470
  background-color: transparent !important;
471
471
  padding: 0;
472
472
  }
473
+ .s82411.small {
474
+ padding: 0 10px;
475
+ height: 18px;
476
+ }
473
477
 
474
478
  .n9ja9cs.ant-tag.ant-tag-gray {
475
479
  background-color: rgba(237, 241, 250, 0.6);
@@ -3335,7 +3339,6 @@
3335
3339
  .b1f1s2pc {
3336
3340
  margin: 0 24px;
3337
3341
  overflow: auto;
3338
- margin-bottom: 16;
3339
3342
  }
3340
3343
 
3341
3344
  .g1qw3bxx {
@@ -3357,7 +3360,6 @@
3357
3360
  }
3358
3361
 
3359
3362
  .t1pt61xk {
3360
- padding-bottom: 16px;
3361
3363
  display: flex;
3362
3364
  flex-direction: column;
3363
3365
  align-items: center;
@@ -17,21 +17,21 @@ export declare function validateResourceName({ v, allNames, i18n, emptyText, dup
17
17
  isValid: boolean;
18
18
  errorMessage: string;
19
19
  };
20
- export declare function validateRfc1123Name({ v, allNames, i18n, emptyText, duplicatedText, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
20
+ export declare function validateRfc1123Name({ v, allNames, i18n, emptyText, duplicatedText, maxLength, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
21
21
  isValid: boolean;
22
22
  errorMessage?: undefined;
23
23
  } | {
24
24
  isValid: boolean;
25
25
  errorMessage: string;
26
26
  };
27
- export declare function ValidateRfc1035Name({ v, allNames, i18n, emptyText, duplicatedText, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
27
+ export declare function ValidateRfc1035Name({ v, allNames, i18n, emptyText, duplicatedText, maxLength, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
28
28
  isValid: boolean;
29
29
  errorMessage?: undefined;
30
30
  } | {
31
31
  isValid: boolean;
32
32
  errorMessage: string;
33
33
  };
34
- export declare function validateDnsSubdomainName({ v, allNames, i18n, emptyText, duplicatedText, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
34
+ export declare function validateDnsSubdomainName({ v, allNames, i18n, emptyText, duplicatedText, maxLength, isOptional, }: Omit<ValidateResourceNameOptions, 'regex' | 'formatErrorText'>): {
35
35
  isValid: boolean;
36
36
  errorMessage?: undefined;
37
37
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.11-alpha.1",
3
+ "version": "0.3.11-alpha.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const common = require("./common-1eb43414.cjs");
4
- const monaco = require("monaco-editor");
5
- const React = require("react");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const monaco__namespace = /* @__PURE__ */ _interopNamespaceDefault(monaco);
23
- const MonacoYamlDiffEditor = (props) => {
24
- const ref = React.useRef(null);
25
- const { origin, modified, id, height } = props;
26
- React.useEffect(() => {
27
- const originalUri = id ? monaco__namespace.Uri.parse(`${id}_original.yaml`) : void 0;
28
- const modifiedUri = id ? monaco__namespace.Uri.parse(`${id}_modified.yaml`) : void 0;
29
- const originalModel = monaco__namespace.editor.createModel(origin, "yaml", originalUri);
30
- const modifiedModel = monaco__namespace.editor.createModel(modified, "yaml", modifiedUri);
31
- const diffEditor = monaco__namespace.editor.createDiffEditor(ref.current, {
32
- renderSideBySide: true,
33
- originalEditable: false,
34
- readOnly: true,
35
- ignoreTrimWhitespace: false,
36
- scrollBeyondLastLine: false
37
- });
38
- diffEditor.setModel({
39
- original: originalModel,
40
- modified: modifiedModel
41
- });
42
- return () => {
43
- diffEditor.dispose();
44
- originalModel.dispose();
45
- modifiedModel.dispose();
46
- };
47
- }, [modified, origin, id]);
48
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
49
- "div",
50
- {
51
- ref,
52
- style: {
53
- width: "100%",
54
- height: height || "500px"
55
- }
56
- }
57
- );
58
- };
59
- exports.default = MonacoYamlDiffEditor;
@@ -1,42 +0,0 @@
1
- import { j as jsxRuntimeExports } from "./common-241b21f8.js";
2
- import * as monaco from "monaco-editor";
3
- import { useRef, useEffect } from "react";
4
- const MonacoYamlDiffEditor = (props) => {
5
- const ref = useRef(null);
6
- const { origin, modified, id, height } = props;
7
- useEffect(() => {
8
- const originalUri = id ? monaco.Uri.parse(`${id}_original.yaml`) : void 0;
9
- const modifiedUri = id ? monaco.Uri.parse(`${id}_modified.yaml`) : void 0;
10
- const originalModel = monaco.editor.createModel(origin, "yaml", originalUri);
11
- const modifiedModel = monaco.editor.createModel(modified, "yaml", modifiedUri);
12
- const diffEditor = monaco.editor.createDiffEditor(ref.current, {
13
- renderSideBySide: true,
14
- originalEditable: false,
15
- readOnly: true,
16
- ignoreTrimWhitespace: false,
17
- scrollBeyondLastLine: false
18
- });
19
- diffEditor.setModel({
20
- original: originalModel,
21
- modified: modifiedModel
22
- });
23
- return () => {
24
- diffEditor.dispose();
25
- originalModel.dispose();
26
- modifiedModel.dispose();
27
- };
28
- }, [modified, origin, id]);
29
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
30
- "div",
31
- {
32
- ref,
33
- style: {
34
- width: "100%",
35
- height: height || "500px"
36
- }
37
- }
38
- );
39
- };
40
- export {
41
- MonacoYamlDiffEditor as default
42
- };
@@ -1,214 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const common = require("./common-1eb43414.cjs");
4
- const yaml = require("js-yaml");
5
- const monaco = require("monaco-editor");
6
- const monacoYaml = require("monaco-yaml");
7
- const React = require("react");
8
- const ReactDOM = require("react-dom");
9
- const refine = require("./index-e5d37dbf.cjs");
10
- require("dayjs");
11
- require("i18next");
12
- require("@refinedev/core");
13
- require("qs");
14
- require("react-router-dom");
15
- require("@cloudtower/eagle");
16
- require("@cloudtower/icons-react");
17
- require("lodash-es");
18
- require("usehooks-ts");
19
- require("k8s-api-provider");
20
- require("@patternfly/react-log-viewer");
21
- require("react-hook-form");
22
- require("sunflower-antd");
23
- require("antd");
24
- function _interopNamespaceDefault(e) {
25
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
26
- if (e) {
27
- for (const k in e) {
28
- if (k !== "default") {
29
- const d = Object.getOwnPropertyDescriptor(e, k);
30
- Object.defineProperty(n, k, d.get ? d : {
31
- enumerable: true,
32
- get: () => e[k]
33
- });
34
- }
35
- }
36
- }
37
- n.default = e;
38
- return Object.freeze(n);
39
- }
40
- const monaco__namespace = /* @__PURE__ */ _interopNamespaceDefault(monaco);
41
- function MonacoYamlEditor(props) {
42
- const ref = React.useRef(null);
43
- const instanceRef = React.useRef({
44
- editor: null
45
- });
46
- const {
47
- defaultValue,
48
- id,
49
- height,
50
- readOnly,
51
- schemas,
52
- isScrollOnFocus,
53
- onChange,
54
- onValidate,
55
- getInstance,
56
- onEditorCreate,
57
- onBlur
58
- } = props;
59
- const uri = id ? monaco__namespace.Uri.parse(`${id}.yaml`) : void 0;
60
- React.useEffect(() => {
61
- if (!window._MonacoSchemaMap) {
62
- window._MonacoSchemaMap = /* @__PURE__ */ new Map();
63
- }
64
- window._MonacoSchemaMap.set(id || "", {
65
- // Id of the first schema
66
- uri: String(uri),
67
- // Associate with our model
68
- fileMatch: [String(uri)],
69
- schema: {
70
- oneOf: schemas || [{ type: "object" }]
71
- }
72
- });
73
- const finalSchemas = [...window._MonacoSchemaMap.values()];
74
- monacoYaml.setDiagnosticsOptions({
75
- enableSchemaRequest: false,
76
- validate: true,
77
- format: true,
78
- isKubernetes: true,
79
- schemas: finalSchemas
80
- });
81
- const defaultValueString = typeof defaultValue === "string" ? defaultValue : yaml.dump(defaultValue);
82
- const model = monaco__namespace.editor.createModel(defaultValueString, "yaml", uri);
83
- const editor = monaco__namespace.editor.create(ref.current, {
84
- automaticLayout: true,
85
- scrollBeyondLastLine: false,
86
- model,
87
- scrollbar: {
88
- handleMouseWheel: !isScrollOnFocus,
89
- alwaysConsumeMouseWheel: false
90
- // https://github.com/microsoft/monaco-editor/issues/2007
91
- },
92
- tabSize: 2,
93
- lineNumbersMinChars: 7,
94
- readOnly,
95
- autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
96
- theme: "vs"
97
- });
98
- instanceRef.current.editor = editor;
99
- getInstance == null ? void 0 : getInstance(editor);
100
- onEditorCreate == null ? void 0 : onEditorCreate(editor);
101
- return () => {
102
- instanceRef.current.editor = null;
103
- window._MonacoSchemaMap.delete(id || "");
104
- model.dispose();
105
- editor.dispose();
106
- };
107
- }, [id, schemas, readOnly, isScrollOnFocus, getInstance]);
108
- React.useEffect(() => {
109
- const editor = instanceRef.current.editor;
110
- if (editor) {
111
- const stop = editor.onDidChangeModelContent(() => {
112
- ReactDOM.unstable_batchedUpdates(() => {
113
- const editorValue = editor.getValue();
114
- const newValue = typeof defaultValue === "string" ? editorValue : yaml.load(editorValue) || {};
115
- if (typeof defaultValue !== "string" && typeof newValue === "string") {
116
- onValidate == null ? void 0 : onValidate(false, true);
117
- } else {
118
- onValidate == null ? void 0 : onValidate(true, true);
119
- onChange == null ? void 0 : onChange(newValue);
120
- }
121
- });
122
- });
123
- return () => {
124
- stop.dispose();
125
- };
126
- }
127
- }, [onChange, defaultValue]);
128
- React.useEffect(() => {
129
- const editor = instanceRef.current.editor;
130
- if (editor) {
131
- const stop = monaco__namespace.editor.onDidChangeMarkers((uri2) => {
132
- var _a;
133
- const model = (_a = instanceRef.current.editor) == null ? void 0 : _a.getModel();
134
- const currentEditorUri = model == null ? void 0 : model.uri;
135
- if (model && uri2.toString() === (currentEditorUri == null ? void 0 : currentEditorUri.toString())) {
136
- const marks = monaco__namespace.editor.getModelMarkers({
137
- owner: "yaml",
138
- resource: currentEditorUri
139
- });
140
- const yamlMarks = marks.filter((m) => m.source === "YAML");
141
- const schemaMarks = marks.filter((m) => m.source !== "YAML");
142
- const yamlValid = yamlMarks.length === 0;
143
- const schemaValid = schemaMarks.length === 0;
144
- onValidate == null ? void 0 : onValidate(yamlValid, schemaValid);
145
- if (marks.some((mark) => {
146
- var _a2;
147
- return (_a2 = mark.source) == null ? void 0 : _a2.includes("yaml-schema");
148
- })) {
149
- monaco__namespace.editor.setModelMarkers(
150
- model,
151
- "yaml",
152
- marks.map((mark) => ({ ...mark, source: "", resource: {} }))
153
- );
154
- }
155
- }
156
- });
157
- return () => {
158
- stop.dispose();
159
- };
160
- }
161
- }, [onValidate]);
162
- React.useEffect(() => {
163
- const editor = instanceRef.current.editor;
164
- if (editor) {
165
- const stop = editor.onDidBlurEditorWidget(() => {
166
- ReactDOM.unstable_batchedUpdates(() => {
167
- onBlur == null ? void 0 : onBlur();
168
- });
169
- });
170
- return () => {
171
- stop.dispose();
172
- };
173
- }
174
- }, [onBlur]);
175
- React.useEffect(() => {
176
- const editor = instanceRef.current.editor;
177
- const stops = [];
178
- if (editor && isScrollOnFocus) {
179
- stops.push(
180
- editor.onDidFocusEditorWidget(() => {
181
- editor.updateOptions({
182
- scrollbar: {
183
- handleMouseWheel: true
184
- }
185
- });
186
- })
187
- );
188
- stops.push(
189
- editor.onDidBlurEditorWidget(() => {
190
- editor.updateOptions({
191
- scrollbar: {
192
- handleMouseWheel: false
193
- }
194
- });
195
- })
196
- );
197
- }
198
- return () => {
199
- stops.forEach((stop) => stop.dispose());
200
- };
201
- }, [isScrollOnFocus]);
202
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
203
- "div",
204
- {
205
- ref,
206
- className: common.cx_default(refine.YamlEditorStyle, props.className),
207
- style: {
208
- width: "100%",
209
- height: height || "500px"
210
- }
211
- }
212
- );
213
- }
214
- exports.default = MonacoYamlEditor;
@@ -1,197 +0,0 @@
1
- import { j as jsxRuntimeExports, c as cx_default } from "./common-241b21f8.js";
2
- import yaml from "js-yaml";
3
- import * as monaco from "monaco-editor";
4
- import { setDiagnosticsOptions } from "monaco-yaml";
5
- import { useRef, useEffect } from "react";
6
- import ReactDOM from "react-dom";
7
- import { Y as YamlEditorStyle } from "./index-4f353f96.js";
8
- import "dayjs";
9
- import "i18next";
10
- import "@refinedev/core";
11
- import "qs";
12
- import "react-router-dom";
13
- import "@cloudtower/eagle";
14
- import "@cloudtower/icons-react";
15
- import "lodash-es";
16
- import "usehooks-ts";
17
- import "k8s-api-provider";
18
- import "@patternfly/react-log-viewer";
19
- import "react-hook-form";
20
- import "sunflower-antd";
21
- import "antd";
22
- function MonacoYamlEditor(props) {
23
- const ref = useRef(null);
24
- const instanceRef = useRef({
25
- editor: null
26
- });
27
- const {
28
- defaultValue,
29
- id,
30
- height,
31
- readOnly,
32
- schemas,
33
- isScrollOnFocus,
34
- onChange,
35
- onValidate,
36
- getInstance,
37
- onEditorCreate,
38
- onBlur
39
- } = props;
40
- const uri = id ? monaco.Uri.parse(`${id}.yaml`) : void 0;
41
- useEffect(() => {
42
- if (!window._MonacoSchemaMap) {
43
- window._MonacoSchemaMap = /* @__PURE__ */ new Map();
44
- }
45
- window._MonacoSchemaMap.set(id || "", {
46
- // Id of the first schema
47
- uri: String(uri),
48
- // Associate with our model
49
- fileMatch: [String(uri)],
50
- schema: {
51
- oneOf: schemas || [{ type: "object" }]
52
- }
53
- });
54
- const finalSchemas = [...window._MonacoSchemaMap.values()];
55
- setDiagnosticsOptions({
56
- enableSchemaRequest: false,
57
- validate: true,
58
- format: true,
59
- isKubernetes: true,
60
- schemas: finalSchemas
61
- });
62
- const defaultValueString = typeof defaultValue === "string" ? defaultValue : yaml.dump(defaultValue);
63
- const model = monaco.editor.createModel(defaultValueString, "yaml", uri);
64
- const editor = monaco.editor.create(ref.current, {
65
- automaticLayout: true,
66
- scrollBeyondLastLine: false,
67
- model,
68
- scrollbar: {
69
- handleMouseWheel: !isScrollOnFocus,
70
- alwaysConsumeMouseWheel: false
71
- // https://github.com/microsoft/monaco-editor/issues/2007
72
- },
73
- tabSize: 2,
74
- lineNumbersMinChars: 7,
75
- readOnly,
76
- autoIndent: {}.VITE_IS_TEST ? "none" : "advanced",
77
- theme: "vs"
78
- });
79
- instanceRef.current.editor = editor;
80
- getInstance == null ? void 0 : getInstance(editor);
81
- onEditorCreate == null ? void 0 : onEditorCreate(editor);
82
- return () => {
83
- instanceRef.current.editor = null;
84
- window._MonacoSchemaMap.delete(id || "");
85
- model.dispose();
86
- editor.dispose();
87
- };
88
- }, [id, schemas, readOnly, isScrollOnFocus, getInstance]);
89
- useEffect(() => {
90
- const editor = instanceRef.current.editor;
91
- if (editor) {
92
- const stop = editor.onDidChangeModelContent(() => {
93
- ReactDOM.unstable_batchedUpdates(() => {
94
- const editorValue = editor.getValue();
95
- const newValue = typeof defaultValue === "string" ? editorValue : yaml.load(editorValue) || {};
96
- if (typeof defaultValue !== "string" && typeof newValue === "string") {
97
- onValidate == null ? void 0 : onValidate(false, true);
98
- } else {
99
- onValidate == null ? void 0 : onValidate(true, true);
100
- onChange == null ? void 0 : onChange(newValue);
101
- }
102
- });
103
- });
104
- return () => {
105
- stop.dispose();
106
- };
107
- }
108
- }, [onChange, defaultValue]);
109
- useEffect(() => {
110
- const editor = instanceRef.current.editor;
111
- if (editor) {
112
- const stop = monaco.editor.onDidChangeMarkers((uri2) => {
113
- var _a;
114
- const model = (_a = instanceRef.current.editor) == null ? void 0 : _a.getModel();
115
- const currentEditorUri = model == null ? void 0 : model.uri;
116
- if (model && uri2.toString() === (currentEditorUri == null ? void 0 : currentEditorUri.toString())) {
117
- const marks = monaco.editor.getModelMarkers({
118
- owner: "yaml",
119
- resource: currentEditorUri
120
- });
121
- const yamlMarks = marks.filter((m) => m.source === "YAML");
122
- const schemaMarks = marks.filter((m) => m.source !== "YAML");
123
- const yamlValid = yamlMarks.length === 0;
124
- const schemaValid = schemaMarks.length === 0;
125
- onValidate == null ? void 0 : onValidate(yamlValid, schemaValid);
126
- if (marks.some((mark) => {
127
- var _a2;
128
- return (_a2 = mark.source) == null ? void 0 : _a2.includes("yaml-schema");
129
- })) {
130
- monaco.editor.setModelMarkers(
131
- model,
132
- "yaml",
133
- marks.map((mark) => ({ ...mark, source: "", resource: {} }))
134
- );
135
- }
136
- }
137
- });
138
- return () => {
139
- stop.dispose();
140
- };
141
- }
142
- }, [onValidate]);
143
- useEffect(() => {
144
- const editor = instanceRef.current.editor;
145
- if (editor) {
146
- const stop = editor.onDidBlurEditorWidget(() => {
147
- ReactDOM.unstable_batchedUpdates(() => {
148
- onBlur == null ? void 0 : onBlur();
149
- });
150
- });
151
- return () => {
152
- stop.dispose();
153
- };
154
- }
155
- }, [onBlur]);
156
- useEffect(() => {
157
- const editor = instanceRef.current.editor;
158
- const stops = [];
159
- if (editor && isScrollOnFocus) {
160
- stops.push(
161
- editor.onDidFocusEditorWidget(() => {
162
- editor.updateOptions({
163
- scrollbar: {
164
- handleMouseWheel: true
165
- }
166
- });
167
- })
168
- );
169
- stops.push(
170
- editor.onDidBlurEditorWidget(() => {
171
- editor.updateOptions({
172
- scrollbar: {
173
- handleMouseWheel: false
174
- }
175
- });
176
- })
177
- );
178
- }
179
- return () => {
180
- stops.forEach((stop) => stop.dispose());
181
- };
182
- }, [isScrollOnFocus]);
183
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
184
- "div",
185
- {
186
- ref,
187
- className: cx_default(YamlEditorStyle, props.className),
188
- style: {
189
- width: "100%",
190
- height: height || "500px"
191
- }
192
- }
193
- );
194
- }
195
- export {
196
- MonacoYamlEditor as default
197
- };