@dckj-npm/dc-material 0.1.129 → 0.1.131

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,44 @@
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
+ const projectId = new URLSearchParams(location.search.slice(1)).get('projectId') || 'general'
10
+ const dcAuthType = 'authToken-' + projectId
11
+
12
+ const response = await fetch(url, {
13
+ method: 'POST',
14
+ // headers: {
15
+ // 'Content-Type': 'application/json',
16
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
17
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
18
+ // sitecode: '936702478408355840',
19
+ // dcauthtype: 'authToken-936702478408355840',
20
+ // },
21
+ headers: {
22
+ 'Content-Type': 'application/json',
23
+ authToken: encodeURIComponent(localStorage.getItem('authToken') || ('' as string)),
24
+ siteCode: projectId,
25
+ dcAuthType,
26
+ [dcAuthType]: encodeURIComponent(localStorage.getItem(dcAuthType) || ('' as string)),
27
+ },
28
+ body: JSON.stringify(params),
29
+ })
30
+
31
+ if (!response.ok) {
32
+ throw new Error(`HTTP error! status: ${response.status}`)
33
+ }
34
+
35
+ const data = await response.json()
36
+ return data.map((item: any) => ({
37
+ title: item.tableComment,
38
+ value: item.tableName,
39
+ }))
40
+ }
41
+
3
42
  const DCFormMeta: IPublicTypeComponentMetadata = {
4
43
  componentName: 'DCForm',
5
44
  title: 'DCForm',
@@ -16,6 +55,18 @@ const DCFormMeta: IPublicTypeComponentMetadata = {
16
55
  },
17
56
  configure: {
18
57
  props: [
58
+ {
59
+ title: '表单',
60
+ name: 'name',
61
+ setter: {
62
+ componentName: 'SelectSetter',
63
+ initialValue: 'small',
64
+ props: {
65
+ defaultValue: 'small',
66
+ options: fetchFormOptions(),
67
+ },
68
+ },
69
+ },
19
70
  {
20
71
  name: '数据源绑定',
21
72
  setter: {
@@ -26,7 +77,7 @@ const DCFormMeta: IPublicTypeComponentMetadata = {
26
77
  label: '图文数据',
27
78
  value: 'dataList',
28
79
  children: [
29
- { label: '图片链接', value: 'title' },
80
+ { label: '表单项标题', value: 'title' },
30
81
  { label: '表单项组件类型', value: 'type' },
31
82
  { label: '是否只读', value: 'isOnlyRead' },
32
83
  { label: '是否必填', value: 'isRequired' },
@@ -1,4 +1,67 @@
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 _headers;
11
+ var url, params, projectId, dcAuthType, response, data;
12
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ while (1) switch (_context.prev = _context.next) {
14
+ case 0:
15
+ url = '/source/api/dynamicFormTable/map';
16
+ params = {
17
+ fkProjectSpace: '1046107745394233344'
18
+ };
19
+ projectId = new URLSearchParams(location.search.slice(1)).get('projectId') || 'general';
20
+ dcAuthType = 'authToken-' + projectId;
21
+ _context.next = 6;
22
+ return fetch(url, {
23
+ method: 'POST',
24
+ // headers: {
25
+ // 'Content-Type': 'application/json',
26
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
27
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
28
+ // sitecode: '936702478408355840',
29
+ // dcauthtype: 'authToken-936702478408355840',
30
+ // },
31
+ headers: (_headers = {
32
+ 'Content-Type': 'application/json',
33
+ authToken: encodeURIComponent(localStorage.getItem('authToken') || ''),
34
+ siteCode: projectId,
35
+ dcAuthType: dcAuthType
36
+ }, _headers[dcAuthType] = encodeURIComponent(localStorage.getItem(dcAuthType) || ''), _headers),
37
+ body: JSON.stringify(params)
38
+ });
39
+ case 6:
40
+ response = _context.sent;
41
+ if (response.ok) {
42
+ _context.next = 9;
43
+ break;
44
+ }
45
+ throw new Error("HTTP error! status: " + response.status);
46
+ case 9:
47
+ _context.next = 11;
48
+ return response.json();
49
+ case 11:
50
+ data = _context.sent;
51
+ return _context.abrupt("return", data.map(function (item) {
52
+ return {
53
+ title: item.tableComment,
54
+ value: item.tableName
55
+ };
56
+ }));
57
+ case 13:
58
+ case "end":
59
+ return _context.stop();
60
+ }
61
+ }, _callee);
62
+ }));
63
+ return _fetchFormOptions.apply(this, arguments);
64
+ }
2
65
  var DCFormMeta = {
3
66
  componentName: 'DCForm',
4
67
  title: 'DCForm',
@@ -15,6 +78,17 @@ var DCFormMeta = {
15
78
  },
16
79
  configure: {
17
80
  props: [{
81
+ title: '表单',
82
+ name: 'name',
83
+ setter: {
84
+ componentName: 'SelectSetter',
85
+ initialValue: 'small',
86
+ props: {
87
+ defaultValue: 'small',
88
+ options: fetchFormOptions()
89
+ }
90
+ }
91
+ }, {
18
92
  name: '数据源绑定',
19
93
  setter: {
20
94
  componentName: 'SetterFormVariable',
@@ -23,7 +97,7 @@ var DCFormMeta = {
23
97
  label: '图文数据',
24
98
  value: 'dataList',
25
99
  children: [{
26
- label: '图片链接',
100
+ label: '表单项标题',
27
101
  value: 'title'
28
102
  }, {
29
103
  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.131';
99
99
  }
100
100
  if (basicLibraryVersion === void 0) {
101
101
  basicLibraryVersion = {
@@ -3,7 +3,70 @@
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 _headers;
16
+ var url, params, projectId, dcAuthType, response, data;
17
+ return _regenerator["default"].wrap(function _callee$(_context) {
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ url = '/source/api/dynamicFormTable/map';
21
+ params = {
22
+ fkProjectSpace: '1046107745394233344'
23
+ };
24
+ projectId = new URLSearchParams(location.search.slice(1)).get('projectId') || 'general';
25
+ dcAuthType = 'authToken-' + projectId;
26
+ _context.next = 6;
27
+ return fetch(url, {
28
+ method: 'POST',
29
+ // headers: {
30
+ // 'Content-Type': 'application/json',
31
+ // authtoken: 'd5e654eb19f44b4e94093abcddfeff29',
32
+ // 'authtoken-936702478408355840': 'efadae8252af42da94aeea90240ff2dc',
33
+ // sitecode: '936702478408355840',
34
+ // dcauthtype: 'authToken-936702478408355840',
35
+ // },
36
+ headers: (_headers = {
37
+ 'Content-Type': 'application/json',
38
+ authToken: encodeURIComponent(localStorage.getItem('authToken') || ''),
39
+ siteCode: projectId,
40
+ dcAuthType: dcAuthType
41
+ }, _headers[dcAuthType] = encodeURIComponent(localStorage.getItem(dcAuthType) || ''), _headers),
42
+ body: JSON.stringify(params)
43
+ });
44
+ case 6:
45
+ response = _context.sent;
46
+ if (response.ok) {
47
+ _context.next = 9;
48
+ break;
49
+ }
50
+ throw new Error("HTTP error! status: " + response.status);
51
+ case 9:
52
+ _context.next = 11;
53
+ return response.json();
54
+ case 11:
55
+ data = _context.sent;
56
+ return _context.abrupt("return", data.map(function (item) {
57
+ return {
58
+ title: item.tableComment,
59
+ value: item.tableName
60
+ };
61
+ }));
62
+ case 13:
63
+ case "end":
64
+ return _context.stop();
65
+ }
66
+ }, _callee);
67
+ }));
68
+ return _fetchFormOptions.apply(this, arguments);
69
+ }
7
70
  var DCFormMeta = {
8
71
  componentName: 'DCForm',
9
72
  title: 'DCForm',
@@ -20,6 +83,17 @@ var DCFormMeta = {
20
83
  },
21
84
  configure: {
22
85
  props: [{
86
+ title: '表单',
87
+ name: 'name',
88
+ setter: {
89
+ componentName: 'SelectSetter',
90
+ initialValue: 'small',
91
+ props: {
92
+ defaultValue: 'small',
93
+ options: fetchFormOptions()
94
+ }
95
+ }
96
+ }, {
23
97
  name: '数据源绑定',
24
98
  setter: {
25
99
  componentName: 'SetterFormVariable',
@@ -28,7 +102,7 @@ var DCFormMeta = {
28
102
  label: '图文数据',
29
103
  value: 'dataList',
30
104
  children: [{
31
- label: '图片链接',
105
+ label: '表单项标题',
32
106
  value: 'title'
33
107
  }, {
34
108
  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.131';
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.131",
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.131/build/lowcode/assets-prod.json"
107
107
  },
108
108
  "lcMeta": {
109
109
  "type": "component"