@dckj-npm/dc-material 0.1.129 → 0.1.130

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.
@@ -1,5 +1,35 @@
1
1
  import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'
2
2
 
3
+ // 假设这是你的异步函数,用于从服务器获取选项
4
+ async function fetchFormOptions(): Promise<{ title: string; value: string }[]> {
5
+ const url = '/source/api/dynamicFormTable/map'
6
+ const params = {
7
+ fkProjectSpace: '1046107745394233344',
8
+ }
9
+
10
+ const response = await fetch(url, {
11
+ method: 'POST',
12
+ // headers: {
13
+ // 'Content-Type': 'application/json',
14
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
15
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
16
+ // sitecode: '936702478408355840',
17
+ // dcauthtype: 'authToken-936702478408355840',
18
+ // },
19
+ body: JSON.stringify(params),
20
+ })
21
+
22
+ if (!response.ok) {
23
+ throw new Error(`HTTP error! status: ${response.status}`)
24
+ }
25
+
26
+ const data = await response.json()
27
+ return data.map((item: any) => ({
28
+ title: item.tableComment,
29
+ value: item.tableName,
30
+ }))
31
+ }
32
+
3
33
  const DCFormMeta: IPublicTypeComponentMetadata = {
4
34
  componentName: 'DCForm',
5
35
  title: 'DCForm',
@@ -16,6 +46,18 @@ const DCFormMeta: IPublicTypeComponentMetadata = {
16
46
  },
17
47
  configure: {
18
48
  props: [
49
+ {
50
+ title: '表单',
51
+ name: 'name',
52
+ setter: {
53
+ componentName: 'SelectSetter',
54
+ initialValue: 'small',
55
+ props: {
56
+ defaultValue: 'small',
57
+ options: fetchFormOptions(),
58
+ },
59
+ },
60
+ },
19
61
  {
20
62
  name: '数据源绑定',
21
63
  setter: {
@@ -26,7 +68,7 @@ const DCFormMeta: IPublicTypeComponentMetadata = {
26
68
  label: '图文数据',
27
69
  value: 'dataList',
28
70
  children: [
29
- { label: '图片链接', value: 'title' },
71
+ { label: '表单项标题', value: 'title' },
30
72
  { label: '表单项组件类型', value: 'type' },
31
73
  { label: '是否只读', value: 'isOnlyRead' },
32
74
  { label: '是否必填', value: 'isRequired' },
@@ -1,4 +1,58 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ // 假设这是你的异步函数,用于从服务器获取选项
5
+ function fetchFormOptions() {
6
+ return _fetchFormOptions.apply(this, arguments);
7
+ }
8
+ function _fetchFormOptions() {
9
+ _fetchFormOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
+ var url, params, response, data;
11
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
12
+ while (1) switch (_context.prev = _context.next) {
13
+ case 0:
14
+ url = '/source/api/dynamicFormTable/map';
15
+ params = {
16
+ fkProjectSpace: '1046107745394233344'
17
+ };
18
+ _context.next = 4;
19
+ return fetch(url, {
20
+ method: 'POST',
21
+ // headers: {
22
+ // 'Content-Type': 'application/json',
23
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
24
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
25
+ // sitecode: '936702478408355840',
26
+ // dcauthtype: 'authToken-936702478408355840',
27
+ // },
28
+ body: JSON.stringify(params)
29
+ });
30
+ case 4:
31
+ response = _context.sent;
32
+ if (response.ok) {
33
+ _context.next = 7;
34
+ break;
35
+ }
36
+ throw new Error("HTTP error! status: " + response.status);
37
+ case 7:
38
+ _context.next = 9;
39
+ return response.json();
40
+ case 9:
41
+ data = _context.sent;
42
+ return _context.abrupt("return", data.map(function (item) {
43
+ return {
44
+ title: item.tableComment,
45
+ value: item.tableName
46
+ };
47
+ }));
48
+ case 11:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }, _callee);
53
+ }));
54
+ return _fetchFormOptions.apply(this, arguments);
55
+ }
2
56
  var DCFormMeta = {
3
57
  componentName: 'DCForm',
4
58
  title: 'DCForm',
@@ -15,6 +69,17 @@ var DCFormMeta = {
15
69
  },
16
70
  configure: {
17
71
  props: [{
72
+ title: '表单',
73
+ name: 'name',
74
+ setter: {
75
+ componentName: 'SelectSetter',
76
+ initialValue: 'small',
77
+ props: {
78
+ defaultValue: 'small',
79
+ options: fetchFormOptions()
80
+ }
81
+ }
82
+ }, {
18
83
  name: '数据源绑定',
19
84
  setter: {
20
85
  componentName: 'SetterFormVariable',
@@ -23,7 +88,7 @@ var DCFormMeta = {
23
88
  label: '图文数据',
24
89
  value: 'dataList',
25
90
  children: [{
26
- label: '图片链接',
91
+ label: '表单项标题',
27
92
  value: 'title'
28
93
  }, {
29
94
  label: '表单项组件类型',
@@ -95,7 +95,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
95
95
  packageName = '@dckj-npm/dc-material';
96
96
  }
97
97
  if (version === void 0) {
98
- version = '0.1.129';
98
+ version = '0.1.130';
99
99
  }
100
100
  if (basicLibraryVersion === void 0) {
101
101
  basicLibraryVersion = {
@@ -3,7 +3,61 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
5
  exports["default"] = void 0;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
6
7
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
+ // 假设这是你的异步函数,用于从服务器获取选项
10
+ function fetchFormOptions() {
11
+ return _fetchFormOptions.apply(this, arguments);
12
+ }
13
+ function _fetchFormOptions() {
14
+ _fetchFormOptions = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
15
+ var url, params, response, data;
16
+ return _regenerator["default"].wrap(function _callee$(_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ url = '/source/api/dynamicFormTable/map';
20
+ params = {
21
+ fkProjectSpace: '1046107745394233344'
22
+ };
23
+ _context.next = 4;
24
+ return fetch(url, {
25
+ method: 'POST',
26
+ // headers: {
27
+ // 'Content-Type': 'application/json',
28
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
29
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
30
+ // sitecode: '936702478408355840',
31
+ // dcauthtype: 'authToken-936702478408355840',
32
+ // },
33
+ body: JSON.stringify(params)
34
+ });
35
+ case 4:
36
+ response = _context.sent;
37
+ if (response.ok) {
38
+ _context.next = 7;
39
+ break;
40
+ }
41
+ throw new Error("HTTP error! status: " + response.status);
42
+ case 7:
43
+ _context.next = 9;
44
+ return response.json();
45
+ case 9:
46
+ data = _context.sent;
47
+ return _context.abrupt("return", data.map(function (item) {
48
+ return {
49
+ title: item.tableComment,
50
+ value: item.tableName
51
+ };
52
+ }));
53
+ case 11:
54
+ case "end":
55
+ return _context.stop();
56
+ }
57
+ }, _callee);
58
+ }));
59
+ return _fetchFormOptions.apply(this, arguments);
60
+ }
7
61
  var DCFormMeta = {
8
62
  componentName: 'DCForm',
9
63
  title: 'DCForm',
@@ -20,6 +74,17 @@ var DCFormMeta = {
20
74
  },
21
75
  configure: {
22
76
  props: [{
77
+ title: '表单',
78
+ name: 'name',
79
+ setter: {
80
+ componentName: 'SelectSetter',
81
+ initialValue: 'small',
82
+ props: {
83
+ defaultValue: 'small',
84
+ options: fetchFormOptions()
85
+ }
86
+ }
87
+ }, {
23
88
  name: '数据源绑定',
24
89
  setter: {
25
90
  componentName: 'SetterFormVariable',
@@ -28,7 +93,7 @@ var DCFormMeta = {
28
93
  label: '图文数据',
29
94
  value: 'dataList',
30
95
  children: [{
31
- label: '图片链接',
96
+ label: '表单项标题',
32
97
  value: 'title'
33
98
  }, {
34
99
  label: '表单项组件类型',
@@ -100,7 +100,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
100
100
  packageName = '@dckj-npm/dc-material';
101
101
  }
102
102
  if (version === void 0) {
103
- version = '0.1.129';
103
+ version = '0.1.130';
104
104
  }
105
105
  if (basicLibraryVersion === void 0) {
106
106
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/dc-material",
3
- "version": "0.1.129",
3
+ "version": "0.1.130",
4
4
  "description": "dc低代码物料",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -103,7 +103,7 @@
103
103
  },
104
104
  "componentConfig": {
105
105
  "isComponentLibrary": true,
106
- "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.129/build/lowcode/assets-prod.json"
106
+ "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.130/build/lowcode/assets-prod.json"
107
107
  },
108
108
  "lcMeta": {
109
109
  "type": "component"