@nocobase/plugin-field-code 2.0.25 → 2.1.0-alpha.11

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.
@@ -57,5 +57,36 @@ export declare class CodeFieldInterface extends CollectionFieldInterface {
57
57
  description: string;
58
58
  };
59
59
  };
60
+ availableTypes: string[];
61
+ filterable: {
62
+ operators: ({
63
+ label: string;
64
+ value: string;
65
+ selected: boolean;
66
+ schema: {
67
+ type: string;
68
+ 'x-component': string;
69
+ };
70
+ noValue?: undefined;
71
+ } | {
72
+ label: string;
73
+ value: string;
74
+ schema: {
75
+ type: string;
76
+ 'x-component': string;
77
+ };
78
+ selected?: undefined;
79
+ noValue?: undefined;
80
+ } | {
81
+ label: string;
82
+ value: string;
83
+ noValue: boolean;
84
+ schema: {
85
+ type: string;
86
+ 'x-component': string;
87
+ };
88
+ selected?: undefined;
89
+ })[];
90
+ };
60
91
  titleUsable: boolean;
61
92
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ import { FieldModel } from '@nocobase/client';
11
+ export declare class CodeFieldModel extends FieldModel {
12
+ render(): React.JSX.Element;
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ import { FieldModel } from '@nocobase/client';
11
+ export declare class DisplayCodeFieldModel extends FieldModel {
12
+ render(): React.JSX.Element;
13
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare const HEIGHT_VALUES: string[];
11
+ export declare const INDENT_UNIT_OPTIONS: {
12
+ label: number;
13
+ value: number;
14
+ }[];
15
+ export declare const normalizeHeight: (value?: string) => string;
16
+ export declare const normalizeIndentUnit: (value?: number) => number;
17
+ export declare const getHeightOptions: (ctx: any) => {
18
+ label: any;
19
+ value: string;
20
+ }[];
21
+ export declare const CustomHeight: ({ defaultValue, handleChange, setOpen, t }: {
22
+ defaultValue: any;
23
+ handleChange: any;
24
+ setOpen: any;
25
+ t: any;
26
+ }) => React.JSX.Element;
27
+ export declare const CustomIndentUnit: ({ defaultValue, handleChange, setOpen, t }: {
28
+ defaultValue: any;
29
+ handleChange: any;
30
+ setOpen: any;
31
+ t: any;
32
+ }) => React.JSX.Element;
33
+ export declare const renderHeightDropdown: (ctx: any, menu: any, setOpen: any, handleChange: any, currentHeight?: string) => React.JSX.Element;
34
+ export declare const renderIndentDropdown: (ctx: any, menu: any, setOpen: any, handleChange: any, currentIndentUnit?: number) => React.JSX.Element;
@@ -9,9 +9,10 @@
9
9
 
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
- "antd": "5.24.2",
13
12
  "antd-style": "3.7.1",
14
13
  "@formily/react": "2.3.7",
15
- "@nocobase/client": "2.0.25",
16
- "@nocobase/server": "2.0.25"
14
+ "@nocobase/client": "2.1.0-alpha.11",
15
+ "@nocobase/flow-engine": "2.1.0-alpha.11",
16
+ "@nocobase/server": "2.1.0-alpha.11",
17
+ "antd": "5.24.2"
17
18
  };
@@ -1,7 +1,15 @@
1
1
  {
2
+ "Auto": "Auto",
2
3
  "Code": "Code",
4
+ "Code editor": "Code editor",
5
+ "Choose language": "Choose language",
6
+ "Content settings": "Content settings",
3
7
  "Content height": "Content height",
8
+ "Custom height": "Custom height",
9
+ "Custom indent unit": "Custom indent unit",
10
+ "e.g. 300px or 50%": "e.g. 300px or 50%",
4
11
  "Could use CSS values (e.g., \"300px\" or \"50%\"). Use \"auto\" for automatic height adjustment based on content.": "Could use CSS values (e.g., \"300px\" or \"50%\"). Use \"auto\" for automatic height adjustment based on content.",
12
+ "Indent unit": "Indent unit",
5
13
  "Programming code editor with syntax highlighting.": "Programming code editor with syntax highlighting.",
6
14
  "Programming language": "Programming language"
7
15
  }
@@ -1,7 +1,15 @@
1
1
  {
2
+ "Auto": "自动",
2
3
  "Code": "代码",
4
+ "Code editor": "代码编辑器",
5
+ "Choose language": "选择语言",
6
+ "Content settings": "内容设置",
3
7
  "Content height": "内容高度",
8
+ "Custom height": "自定义高度",
9
+ "Custom indent unit": "自定义缩进单位",
10
+ "e.g. 300px or 50%": "例如 300px 或 50%",
4
11
  "Could use CSS values (e.g., \"300px\" or \"50%\"). Use \"auto\" for automatic height adjustment based on content.": "可以使用 CSS 值(例如,\"300px\" 或 \"50%\")。使用 \"auto\" 以根据内容自动调整高度。",
12
+ "Indent unit": "缩进单位",
5
13
  "Programming code editor with syntax highlighting.": "带语法高亮的编程代码编辑器。",
6
14
  "Programming language": "编程语言"
7
15
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { FlowSchemaContribution } from '@nocobase/flow-engine';
10
+ export declare const flowSchemaContribution: FlowSchemaContribution;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var flow_schema_contributions_exports = {};
28
+ __export(flow_schema_contributions_exports, {
29
+ flowSchemaContribution: () => flowSchemaContribution
30
+ });
31
+ module.exports = __toCommonJS(flow_schema_contributions_exports);
32
+ function createFieldContribution(use, title) {
33
+ return {
34
+ use,
35
+ title,
36
+ source: "plugin",
37
+ strict: false,
38
+ exposure: "internal",
39
+ stepParamsSchema: {
40
+ type: "object",
41
+ properties: {
42
+ fieldSettings: {
43
+ type: "object",
44
+ properties: {
45
+ init: {
46
+ type: "object",
47
+ properties: {
48
+ dataSourceKey: { type: "string" },
49
+ collectionName: { type: "string" },
50
+ fieldPath: { type: "string" },
51
+ associationPathName: { type: "string" }
52
+ },
53
+ additionalProperties: true
54
+ }
55
+ },
56
+ additionalProperties: true
57
+ }
58
+ },
59
+ additionalProperties: true
60
+ },
61
+ skeleton: {
62
+ uid: `todo-${use}`.replace(/[^a-zA-Z0-9]+/g, "-").toLowerCase(),
63
+ use
64
+ }
65
+ };
66
+ }
67
+ const flowSchemaContribution = {
68
+ models: [
69
+ createFieldContribution("CodeFieldModel", "Code"),
70
+ createFieldContribution("DisplayCodeFieldModel", "Display code")
71
+ ],
72
+ fieldBindings: [
73
+ {
74
+ context: "editable-field",
75
+ use: "CodeFieldModel",
76
+ interfaces: ["code"],
77
+ isDefault: true
78
+ },
79
+ {
80
+ context: "display-field",
81
+ use: "DisplayCodeFieldModel",
82
+ interfaces: ["code"],
83
+ isDefault: true
84
+ },
85
+ {
86
+ context: "filter-field",
87
+ use: "InputFieldModel",
88
+ interfaces: ["code"],
89
+ isDefault: true
90
+ }
91
+ ],
92
+ defaults: {
93
+ source: "plugin"
94
+ }
95
+ };
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ flowSchemaContribution
99
+ });
@@ -6,9 +6,11 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import type { FlowSchemaContribution } from '@nocobase/flow-engine';
9
10
  import { Plugin } from '@nocobase/server';
10
11
  export declare class PluginFieldCodeServer extends Plugin {
11
12
  afterAdd(): Promise<void>;
13
+ getFlowSchemaContributions(): FlowSchemaContribution;
12
14
  beforeLoad(): Promise<void>;
13
15
  load(): Promise<void>;
14
16
  install(): Promise<void>;
@@ -31,9 +31,13 @@ __export(plugin_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(plugin_exports);
33
33
  var import_server = require("@nocobase/server");
34
+ var import_flow_schema_contributions = require("./flow-schema-contributions");
34
35
  class PluginFieldCodeServer extends import_server.Plugin {
35
36
  async afterAdd() {
36
37
  }
38
+ getFlowSchemaContributions() {
39
+ return import_flow_schema_contributions.flowSchemaContribution;
40
+ }
37
41
  async beforeLoad() {
38
42
  }
39
43
  async load() {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "数据表字段:代码",
5
5
  "description": "For code editing and highlighting, supporting Java, JavaScript, Python, SQL and other languages.",
6
6
  "description.zh-CN": "用于代码编辑和高亮显示,支持 Java、JavaScript、Python、SQL 等语言。",
7
- "version": "2.0.25",
7
+ "version": "2.1.0-alpha.11",
8
8
  "main": "dist/server/index.js",
9
9
  "nocobase": {
10
10
  "supportedVersions": [
@@ -36,5 +36,5 @@
36
36
  "Collection fields"
37
37
  ],
38
38
  "license": "Apache-2.0",
39
- "gitHead": "9644a56bc97170ad2b8b56333fc8fa6c35f265b3"
39
+ "gitHead": "bb96d633a6371afb586072ff516bd0613c757db0"
40
40
  }