formax_sgj-ui 1.0.2 → 1.0.4
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/index.d.ts +8 -1
- package/dist/index.global.js +36 -20
- package/dist/index.js +37 -20
- package/dist/index.mjs +36 -20
- package/docs/index.html +1 -3
- package/package.json +6 -3
- package/src/components/{FormaxButton.ts → general/button/FormaxButton/index.ts} +14 -23
- package/src/index.ts +25 -3
- package/src/mock.ts +17 -0
- package/src/types.ts +9 -3
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ interface ComponentMeta {
|
|
|
17
17
|
events: EventMeta[];
|
|
18
18
|
slots?: string[];
|
|
19
19
|
usage: string;
|
|
20
|
+
package?: string;
|
|
21
|
+
category?: string;
|
|
22
|
+
key?: string;
|
|
23
|
+
conKey?: string;
|
|
24
|
+
image?: string;
|
|
20
25
|
}
|
|
21
26
|
type FormaxComponent = any & {
|
|
22
27
|
__doc_meta__?: ComponentMeta;
|
|
@@ -32,4 +37,6 @@ declare const _default: {
|
|
|
32
37
|
componentList: ComponentMeta[];
|
|
33
38
|
};
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
declare const componentGoList: any[];
|
|
41
|
+
|
|
42
|
+
export { ComponentMeta, EventMeta, FormaxButton, FormaxComponent, PropMeta, componentGoList, componentList, _default as default, install };
|
package/dist/index.global.js
CHANGED
|
@@ -36042,6 +36042,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
|
|
|
36042
36042
|
var src_exports = {};
|
|
36043
36043
|
__export(src_exports, {
|
|
36044
36044
|
FormaxButton: () => FormaxButton,
|
|
36045
|
+
componentGoList: () => componentGoList,
|
|
36045
36046
|
componentList: () => componentList,
|
|
36046
36047
|
default: () => src_default,
|
|
36047
36048
|
install: () => install2
|
|
@@ -36087,7 +36088,7 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
|
|
|
36087
36088
|
delete target[key];
|
|
36088
36089
|
}
|
|
36089
36090
|
|
|
36090
|
-
// src/components/FormaxButton.ts
|
|
36091
|
+
// src/components/general/button/FormaxButton/index.ts
|
|
36091
36092
|
var FormaxButton = lib_exports.defineComponent({
|
|
36092
36093
|
name: "FormaxButton",
|
|
36093
36094
|
props: {
|
|
@@ -36134,27 +36135,17 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
|
|
|
36134
36135
|
label: "\u901A\u7528\u6309\u94AE",
|
|
36135
36136
|
description: "\u4E00\u4E2A\u517C\u5BB9Vue 2/3\u7684\u57FA\u7840\u6309\u94AE\u7EC4\u4EF6",
|
|
36136
36137
|
props: {
|
|
36137
|
-
label: {
|
|
36138
|
-
|
|
36139
|
-
default: "Button",
|
|
36140
|
-
description: "\u6309\u94AE\u6587\u672C"
|
|
36141
|
-
},
|
|
36142
|
-
type: {
|
|
36143
|
-
type: "string",
|
|
36144
|
-
default: "default",
|
|
36145
|
-
description: "\u6309\u94AE\u7C7B\u578B",
|
|
36146
|
-
options: ["default", "primary", "danger"]
|
|
36147
|
-
}
|
|
36138
|
+
label: { type: "string", default: "Button", description: "\u6309\u94AE\u6587\u672C" },
|
|
36139
|
+
type: { type: "string", default: "default", description: "\u6309\u94AE\u7C7B\u578B", options: ["default", "primary", "danger"] }
|
|
36148
36140
|
},
|
|
36149
|
-
events: [
|
|
36150
|
-
{
|
|
36151
|
-
name: "click",
|
|
36152
|
-
description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1",
|
|
36153
|
-
payload: "Event"
|
|
36154
|
-
}
|
|
36155
|
-
],
|
|
36141
|
+
events: [{ name: "click", description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1", payload: "Event" }],
|
|
36156
36142
|
slots: ["default"],
|
|
36157
|
-
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick"
|
|
36143
|
+
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick" />`,
|
|
36144
|
+
package: "general",
|
|
36145
|
+
category: "button",
|
|
36146
|
+
key: "FormaxButton",
|
|
36147
|
+
conKey: "GCFormaxButton",
|
|
36148
|
+
image: "GCFormaxButton.png"
|
|
36158
36149
|
};
|
|
36159
36150
|
FormaxButton.__doc_meta__ = meta;
|
|
36160
36151
|
|
|
@@ -36176,6 +36167,31 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
|
|
|
36176
36167
|
install: install2,
|
|
36177
36168
|
componentList
|
|
36178
36169
|
}, components);
|
|
36170
|
+
var __pkgLabelMap = { general: "\u901A\u7528\u7EC4\u4EF6" };
|
|
36171
|
+
var __catLabelMap = { button: "\u6309\u94AE" };
|
|
36172
|
+
var componentGoList = Object.values(components).reduce((acc, comp) => {
|
|
36173
|
+
const meta2 = comp.__doc_meta__;
|
|
36174
|
+
if (!meta2 || !meta2.package || !meta2.category)
|
|
36175
|
+
return acc;
|
|
36176
|
+
const pkg = meta2.package;
|
|
36177
|
+
const cat = meta2.category;
|
|
36178
|
+
const key = meta2.key || meta2.name;
|
|
36179
|
+
let group = acc.find((g) => g.key === pkg);
|
|
36180
|
+
if (!group) {
|
|
36181
|
+
group = { key: pkg, label: __pkgLabelMap[pkg] || pkg, list: [] };
|
|
36182
|
+
acc.push(group);
|
|
36183
|
+
}
|
|
36184
|
+
group.list.push({
|
|
36185
|
+
key: cat,
|
|
36186
|
+
title: meta2.label,
|
|
36187
|
+
package: pkg,
|
|
36188
|
+
category: `${pkg[0].toUpperCase()}${cat}`,
|
|
36189
|
+
categoryName: __catLabelMap[cat] || cat,
|
|
36190
|
+
conKey: `${pkg[0].toUpperCase()}C${key}`,
|
|
36191
|
+
image: `${pkg[0].toUpperCase()}C${key}.png`
|
|
36192
|
+
});
|
|
36193
|
+
return acc;
|
|
36194
|
+
}, []);
|
|
36179
36195
|
return __toCommonJS(src_exports);
|
|
36180
36196
|
})();
|
|
36181
36197
|
/*! Bundled license information:
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
45
45
|
var src_exports = {};
|
|
46
46
|
__export(src_exports, {
|
|
47
47
|
FormaxButton: () => FormaxButton,
|
|
48
|
+
componentGoList: () => componentGoList,
|
|
48
49
|
componentList: () => componentList,
|
|
49
50
|
default: () => src_default,
|
|
50
51
|
install: () => install
|
|
@@ -52,7 +53,7 @@ __export(src_exports, {
|
|
|
52
53
|
module.exports = __toCommonJS(src_exports);
|
|
53
54
|
var VueDemi2 = __toESM(require("vue-demi"));
|
|
54
55
|
|
|
55
|
-
// src/components/FormaxButton.ts
|
|
56
|
+
// src/components/general/button/FormaxButton/index.ts
|
|
56
57
|
var VueDemi = __toESM(require("vue-demi"));
|
|
57
58
|
var FormaxButton = VueDemi.defineComponent({
|
|
58
59
|
name: "FormaxButton",
|
|
@@ -100,27 +101,17 @@ var meta = {
|
|
|
100
101
|
label: "\u901A\u7528\u6309\u94AE",
|
|
101
102
|
description: "\u4E00\u4E2A\u517C\u5BB9Vue 2/3\u7684\u57FA\u7840\u6309\u94AE\u7EC4\u4EF6",
|
|
102
103
|
props: {
|
|
103
|
-
label: {
|
|
104
|
-
|
|
105
|
-
default: "Button",
|
|
106
|
-
description: "\u6309\u94AE\u6587\u672C"
|
|
107
|
-
},
|
|
108
|
-
type: {
|
|
109
|
-
type: "string",
|
|
110
|
-
default: "default",
|
|
111
|
-
description: "\u6309\u94AE\u7C7B\u578B",
|
|
112
|
-
options: ["default", "primary", "danger"]
|
|
113
|
-
}
|
|
104
|
+
label: { type: "string", default: "Button", description: "\u6309\u94AE\u6587\u672C" },
|
|
105
|
+
type: { type: "string", default: "default", description: "\u6309\u94AE\u7C7B\u578B", options: ["default", "primary", "danger"] }
|
|
114
106
|
},
|
|
115
|
-
events: [
|
|
116
|
-
{
|
|
117
|
-
name: "click",
|
|
118
|
-
description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1",
|
|
119
|
-
payload: "Event"
|
|
120
|
-
}
|
|
121
|
-
],
|
|
107
|
+
events: [{ name: "click", description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1", payload: "Event" }],
|
|
122
108
|
slots: ["default"],
|
|
123
|
-
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick"
|
|
109
|
+
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick" />`,
|
|
110
|
+
package: "general",
|
|
111
|
+
category: "button",
|
|
112
|
+
key: "FormaxButton",
|
|
113
|
+
conKey: "GCFormaxButton",
|
|
114
|
+
image: "GCFormaxButton.png"
|
|
124
115
|
};
|
|
125
116
|
FormaxButton.__doc_meta__ = meta;
|
|
126
117
|
|
|
@@ -142,9 +133,35 @@ var src_default = __spreadValues({
|
|
|
142
133
|
install,
|
|
143
134
|
componentList
|
|
144
135
|
}, components);
|
|
136
|
+
var __pkgLabelMap = { general: "\u901A\u7528\u7EC4\u4EF6" };
|
|
137
|
+
var __catLabelMap = { button: "\u6309\u94AE" };
|
|
138
|
+
var componentGoList = Object.values(components).reduce((acc, comp) => {
|
|
139
|
+
const meta2 = comp.__doc_meta__;
|
|
140
|
+
if (!meta2 || !meta2.package || !meta2.category)
|
|
141
|
+
return acc;
|
|
142
|
+
const pkg = meta2.package;
|
|
143
|
+
const cat = meta2.category;
|
|
144
|
+
const key = meta2.key || meta2.name;
|
|
145
|
+
let group = acc.find((g) => g.key === pkg);
|
|
146
|
+
if (!group) {
|
|
147
|
+
group = { key: pkg, label: __pkgLabelMap[pkg] || pkg, list: [] };
|
|
148
|
+
acc.push(group);
|
|
149
|
+
}
|
|
150
|
+
group.list.push({
|
|
151
|
+
key: cat,
|
|
152
|
+
title: meta2.label,
|
|
153
|
+
package: pkg,
|
|
154
|
+
category: `${pkg[0].toUpperCase()}${cat}`,
|
|
155
|
+
categoryName: __catLabelMap[cat] || cat,
|
|
156
|
+
conKey: `${pkg[0].toUpperCase()}C${key}`,
|
|
157
|
+
image: `${pkg[0].toUpperCase()}C${key}.png`
|
|
158
|
+
});
|
|
159
|
+
return acc;
|
|
160
|
+
}, []);
|
|
145
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
146
162
|
0 && (module.exports = {
|
|
147
163
|
FormaxButton,
|
|
164
|
+
componentGoList,
|
|
148
165
|
componentList,
|
|
149
166
|
install
|
|
150
167
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
import * as VueDemi2 from "vue-demi";
|
|
20
20
|
|
|
21
|
-
// src/components/FormaxButton.ts
|
|
21
|
+
// src/components/general/button/FormaxButton/index.ts
|
|
22
22
|
import * as VueDemi from "vue-demi";
|
|
23
23
|
var FormaxButton = VueDemi.defineComponent({
|
|
24
24
|
name: "FormaxButton",
|
|
@@ -66,27 +66,17 @@ var meta = {
|
|
|
66
66
|
label: "\u901A\u7528\u6309\u94AE",
|
|
67
67
|
description: "\u4E00\u4E2A\u517C\u5BB9Vue 2/3\u7684\u57FA\u7840\u6309\u94AE\u7EC4\u4EF6",
|
|
68
68
|
props: {
|
|
69
|
-
label: {
|
|
70
|
-
|
|
71
|
-
default: "Button",
|
|
72
|
-
description: "\u6309\u94AE\u6587\u672C"
|
|
73
|
-
},
|
|
74
|
-
type: {
|
|
75
|
-
type: "string",
|
|
76
|
-
default: "default",
|
|
77
|
-
description: "\u6309\u94AE\u7C7B\u578B",
|
|
78
|
-
options: ["default", "primary", "danger"]
|
|
79
|
-
}
|
|
69
|
+
label: { type: "string", default: "Button", description: "\u6309\u94AE\u6587\u672C" },
|
|
70
|
+
type: { type: "string", default: "default", description: "\u6309\u94AE\u7C7B\u578B", options: ["default", "primary", "danger"] }
|
|
80
71
|
},
|
|
81
|
-
events: [
|
|
82
|
-
{
|
|
83
|
-
name: "click",
|
|
84
|
-
description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1",
|
|
85
|
-
payload: "Event"
|
|
86
|
-
}
|
|
87
|
-
],
|
|
72
|
+
events: [{ name: "click", description: "\u70B9\u51FB\u6309\u94AE\u65F6\u89E6\u53D1", payload: "Event" }],
|
|
88
73
|
slots: ["default"],
|
|
89
|
-
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick"
|
|
74
|
+
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick" />`,
|
|
75
|
+
package: "general",
|
|
76
|
+
category: "button",
|
|
77
|
+
key: "FormaxButton",
|
|
78
|
+
conKey: "GCFormaxButton",
|
|
79
|
+
image: "GCFormaxButton.png"
|
|
90
80
|
};
|
|
91
81
|
FormaxButton.__doc_meta__ = meta;
|
|
92
82
|
|
|
@@ -108,8 +98,34 @@ var src_default = __spreadValues({
|
|
|
108
98
|
install,
|
|
109
99
|
componentList
|
|
110
100
|
}, components);
|
|
101
|
+
var __pkgLabelMap = { general: "\u901A\u7528\u7EC4\u4EF6" };
|
|
102
|
+
var __catLabelMap = { button: "\u6309\u94AE" };
|
|
103
|
+
var componentGoList = Object.values(components).reduce((acc, comp) => {
|
|
104
|
+
const meta2 = comp.__doc_meta__;
|
|
105
|
+
if (!meta2 || !meta2.package || !meta2.category)
|
|
106
|
+
return acc;
|
|
107
|
+
const pkg = meta2.package;
|
|
108
|
+
const cat = meta2.category;
|
|
109
|
+
const key = meta2.key || meta2.name;
|
|
110
|
+
let group = acc.find((g) => g.key === pkg);
|
|
111
|
+
if (!group) {
|
|
112
|
+
group = { key: pkg, label: __pkgLabelMap[pkg] || pkg, list: [] };
|
|
113
|
+
acc.push(group);
|
|
114
|
+
}
|
|
115
|
+
group.list.push({
|
|
116
|
+
key: cat,
|
|
117
|
+
title: meta2.label,
|
|
118
|
+
package: pkg,
|
|
119
|
+
category: `${pkg[0].toUpperCase()}${cat}`,
|
|
120
|
+
categoryName: __catLabelMap[cat] || cat,
|
|
121
|
+
conKey: `${pkg[0].toUpperCase()}C${key}`,
|
|
122
|
+
image: `${pkg[0].toUpperCase()}C${key}.png`
|
|
123
|
+
});
|
|
124
|
+
return acc;
|
|
125
|
+
}, []);
|
|
111
126
|
export {
|
|
112
127
|
FormaxButton,
|
|
128
|
+
componentGoList,
|
|
113
129
|
componentList,
|
|
114
130
|
src_default as default,
|
|
115
131
|
install
|
package/docs/index.html
CHANGED
|
@@ -208,8 +208,7 @@
|
|
|
208
208
|
|
|
209
209
|
<script type="module">
|
|
210
210
|
import { createApp, ref } from "vue";
|
|
211
|
-
import FormaxUI, { componentList as list } from "formax-ui";
|
|
212
|
-
|
|
211
|
+
import FormaxUI, { componentList as list, componentGoList } from "formax-ui";
|
|
213
212
|
const FM = FormaxUI;
|
|
214
213
|
|
|
215
214
|
const App = {
|
|
@@ -222,7 +221,6 @@
|
|
|
222
221
|
return v && v.__doc_meta__ ? v.__doc_meta__ : null;
|
|
223
222
|
})
|
|
224
223
|
.filter(Boolean);
|
|
225
|
-
|
|
226
224
|
const current = ref(componentList[0] || null);
|
|
227
225
|
|
|
228
226
|
const getPreviewProps = (meta) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formax_sgj-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A cross-compatible Vue component library with metadata extraction",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "tsup src/index.ts --format cjs,esm,iife --global-name FormaxUI --dts --clean --env.NODE_ENV production"
|
|
16
|
+
"build": "tsup src/index.ts --format cjs,esm,iife --global-name FormaxUI --dts --clean --env.NODE_ENV production",
|
|
17
|
+
"dev": "http-server . -p 3000 -c-1",
|
|
18
|
+
"start": "npm run dev"
|
|
17
19
|
},
|
|
18
20
|
"peerDependencies": {
|
|
19
21
|
"@vue/composition-api": "^1.0.0-rc.1",
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"tsup": "^6.1.0",
|
|
32
34
|
"typescript": "^5.0.0",
|
|
33
|
-
"vue": "^3.3.0"
|
|
35
|
+
"vue": "^3.3.0",
|
|
36
|
+
"http-server": "^14.1.1"
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as VueDemi from 'vue-demi';
|
|
2
|
-
import { FormaxComponent, ComponentMeta } from '
|
|
1
|
+
import * as VueDemi from 'vue-demi';
|
|
2
|
+
import { FormaxComponent, ComponentMeta } from '../../../../types';
|
|
3
3
|
|
|
4
4
|
export const FormaxButton = (VueDemi as any).defineComponent({
|
|
5
5
|
name: 'FormaxButton',
|
|
@@ -20,8 +20,8 @@ export const FormaxButton = (VueDemi as any).defineComponent({
|
|
|
20
20
|
borderRadius: '4px',
|
|
21
21
|
border: '1px solid #ccc',
|
|
22
22
|
cursor: 'pointer',
|
|
23
|
-
backgroundColor: props.type === 'primary' ? '#007bff' : props.type === 'danger' ? '#dc3545' : '#
|
|
24
|
-
color:
|
|
23
|
+
backgroundColor: props.type === 'primary' ? '#007bff' : props.type === 'danger' ? '#dc3545' : '#007bff',
|
|
24
|
+
color: '#fff',
|
|
25
25
|
fontSize: '14px'
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -49,27 +49,18 @@ const meta: ComponentMeta = {
|
|
|
49
49
|
label: '通用按钮',
|
|
50
50
|
description: '一个兼容Vue 2/3的基础按钮组件',
|
|
51
51
|
props: {
|
|
52
|
-
label: {
|
|
53
|
-
|
|
54
|
-
default: 'Button',
|
|
55
|
-
description: '按钮文本'
|
|
56
|
-
},
|
|
57
|
-
type: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
default: 'default',
|
|
60
|
-
description: '按钮类型',
|
|
61
|
-
options: ['default', 'primary', 'danger']
|
|
62
|
-
}
|
|
52
|
+
label: { type: 'string', default: 'Button', description: '按钮文本' },
|
|
53
|
+
type: { type: 'string', default: 'default', description: '按钮类型', options: ['default', 'primary', 'danger'] }
|
|
63
54
|
},
|
|
64
|
-
events: [
|
|
65
|
-
{
|
|
66
|
-
name: 'click',
|
|
67
|
-
description: '点击按钮时触发',
|
|
68
|
-
payload: 'Event'
|
|
69
|
-
}
|
|
70
|
-
],
|
|
55
|
+
events: [{ name: 'click', description: '点击按钮时触发', payload: 'Event' }],
|
|
71
56
|
slots: ['default'],
|
|
72
|
-
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick"
|
|
57
|
+
usage: `<FormaxButton type="primary" label="Click Me" @click="handleClick" />`,
|
|
58
|
+
package: 'general',
|
|
59
|
+
category: 'button',
|
|
60
|
+
key: 'FormaxButton',
|
|
61
|
+
conKey: 'GCFormaxButton',
|
|
62
|
+
image: 'GCFormaxButton.png'
|
|
73
63
|
};
|
|
74
64
|
|
|
75
65
|
FormaxButton.__doc_meta__ = meta;
|
|
66
|
+
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as VueDemi from 'vue-demi';
|
|
2
|
-
import { FormaxButton } from './components/FormaxButton';
|
|
1
|
+
import * as VueDemi from 'vue-demi';
|
|
2
|
+
import { FormaxButton } from './components/general/button/FormaxButton';
|
|
3
3
|
import { ComponentMeta, FormaxComponent } from './types';
|
|
4
4
|
|
|
5
5
|
const components: Record<string, FormaxComponent> = {
|
|
@@ -20,7 +20,6 @@ export function install(app: any) {
|
|
|
20
20
|
export const componentList: ComponentMeta[] = Object.values(components)
|
|
21
21
|
.map(comp => comp.__doc_meta__)
|
|
22
22
|
.filter((meta): meta is ComponentMeta => !!meta);
|
|
23
|
-
|
|
24
23
|
export { FormaxButton };
|
|
25
24
|
export * from './types';
|
|
26
25
|
|
|
@@ -29,3 +28,26 @@ export default {
|
|
|
29
28
|
componentList,
|
|
30
29
|
...components
|
|
31
30
|
};
|
|
31
|
+
const __pkgLabelMap: Record<string, string> = { general: '通用组件' };
|
|
32
|
+
const __catLabelMap: Record<string, string> = { button: '按钮' };
|
|
33
|
+
|
|
34
|
+
export const componentGoList: any[] = Object.values(components).reduce((acc: any[], comp: any) => {
|
|
35
|
+
const meta = comp.__doc_meta__ as ComponentMeta | undefined;
|
|
36
|
+
if (!meta || !meta.package || !meta.category) return acc;
|
|
37
|
+
const pkg = meta.package;
|
|
38
|
+
const cat = meta.category;
|
|
39
|
+
const key = meta.key || meta.name;
|
|
40
|
+
let group = acc.find((g: any) => g.key === pkg);
|
|
41
|
+
if (!group) { group = { key: pkg, label: __pkgLabelMap[pkg] || pkg, list: [] }; acc.push(group); }
|
|
42
|
+
group.list.push({
|
|
43
|
+
key: cat,
|
|
44
|
+
title: meta.label,
|
|
45
|
+
package: pkg,
|
|
46
|
+
category: `${pkg[0].toUpperCase()}${cat}`,
|
|
47
|
+
categoryName: __catLabelMap[cat] || cat,
|
|
48
|
+
conKey: `${pkg[0].toUpperCase()}C${key}`,
|
|
49
|
+
image: `${pkg[0].toUpperCase()}C${key}.png`
|
|
50
|
+
});
|
|
51
|
+
return acc;
|
|
52
|
+
}, []);
|
|
53
|
+
|
package/src/mock.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const componentGoList = [
|
|
2
|
+
{
|
|
3
|
+
key: 'general',
|
|
4
|
+
label: '通用组件',
|
|
5
|
+
list: [
|
|
6
|
+
{
|
|
7
|
+
key: 'button',
|
|
8
|
+
title: '通用按钮',
|
|
9
|
+
package: 'general',
|
|
10
|
+
category: 'Gbutton',
|
|
11
|
+
categoryName: '按钮',
|
|
12
|
+
conKey: "GCFormaxButton",
|
|
13
|
+
image: "GCFormaxButton.png"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
]
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface PropMeta {
|
|
1
|
+
export interface PropMeta {
|
|
2
2
|
type: string;
|
|
3
3
|
default?: any;
|
|
4
4
|
description: string;
|
|
@@ -13,15 +13,21 @@ export interface EventMeta {
|
|
|
13
13
|
|
|
14
14
|
export interface ComponentMeta {
|
|
15
15
|
name: string;
|
|
16
|
-
label: string;
|
|
16
|
+
label: string;
|
|
17
17
|
description: string;
|
|
18
18
|
props: Record<string, PropMeta>;
|
|
19
19
|
events: EventMeta[];
|
|
20
20
|
slots?: string[];
|
|
21
|
-
usage: string;
|
|
21
|
+
usage: string;
|
|
22
|
+
package?: string;
|
|
23
|
+
category?: string;
|
|
24
|
+
key?: string;
|
|
25
|
+
conKey?: string;
|
|
26
|
+
image?: string;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
// Type for the component with attached metadata
|
|
25
30
|
export type FormaxComponent = any & {
|
|
26
31
|
__doc_meta__?: ComponentMeta;
|
|
27
32
|
};
|
|
33
|
+
|