@tachybase/components 1.6.3-alpha.0 → 1.6.3-alpha.2

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.
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
8
  var __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -32,23 +33,34 @@ __export(code_mirror_exports, {
32
33
  });
33
34
  module.exports = __toCommonJS(code_mirror_exports);
34
35
  var import_jsx_runtime = require("react/jsx-runtime");
35
- var import_react = require("react");
36
36
  var import_schema = require("@tachybase/schema");
37
37
  var import_react2 = __toESM(require("@monaco-editor/react"));
38
38
  import_react2.loader.config({ paths: { vs: "https://assets.tachybase.com/monaco-editor@0.52.0/min/vs" } });
39
+ const handleBeforeMount = /* @__PURE__ */ __name((monaco) => {
40
+ monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
41
+ target: monaco.languages.typescript.ScriptTarget.ESNext,
42
+ module: monaco.languages.typescript.ModuleKind.ESNext,
43
+ jsx: monaco.languages.typescript.JsxEmit.React,
44
+ allowJs: true,
45
+ allowNonTsExtensions: true
46
+ });
47
+ monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
48
+ target: monaco.languages.typescript.ScriptTarget.ESNext,
49
+ module: monaco.languages.typescript.ModuleKind.ESNext,
50
+ jsx: monaco.languages.typescript.JsxEmit.React,
51
+ allowNonTsExtensions: true
52
+ });
53
+ monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
54
+ noSemanticValidation: true,
55
+ noSyntaxValidation: false
56
+ });
57
+ }, "handleBeforeMount");
39
58
  const CodeMirror = (0, import_schema.connect)(
40
59
  ({ value, onChange, ...otherProps }) => {
41
- const monaco = (0, import_react2.useMonaco)();
42
- (0, import_react.useEffect)(() => {
43
- if (monaco) {
44
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
45
- jsx: 4
46
- });
47
- }
48
- }, [monaco]);
49
60
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
61
  import_react2.default,
51
62
  {
63
+ beforeMount: handleBeforeMount,
52
64
  options: { readOnly: !!otherProps.disabled },
53
65
  value,
54
66
  height: "300px",
@@ -59,21 +71,13 @@ const CodeMirror = (0, import_schema.connect)(
59
71
  );
60
72
  },
61
73
  (0, import_schema.mapReadPretty)(({ value, onChange, ...otherProps }) => {
62
- const monaco = (0, import_react2.useMonaco)();
63
- (0, import_react.useEffect)(() => {
64
- if (monaco) {
65
- monaco.editor.EditorOptions.readOnly.defaultValue = true;
66
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
67
- jsx: 4
68
- });
69
- }
70
- }, [monaco]);
71
74
  if (value == null) {
72
- return;
75
+ return null;
73
76
  }
74
77
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
78
  import_react2.default,
76
79
  {
80
+ beforeMount: handleBeforeMount,
77
81
  options: { readOnly: true },
78
82
  value,
79
83
  height: "300px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/components",
3
- "version": "1.6.3-alpha.0",
3
+ "version": "1.6.3-alpha.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "prop-types": "^15.8.1",
18
18
  "react-modal": "^3.16.3",
19
19
  "react-sticky-box": "^1.0.2",
20
- "@tachybase/schema": "1.6.3-alpha.0"
20
+ "@tachybase/schema": "1.6.3-alpha.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "rc-cascader": "3.31.0",