create-tengits-app 1.0.0
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/PUBLISH.md +151 -0
- package/README.md +255 -0
- package/USAGE.md +154 -0
- package/bin/cli.js +195 -0
- package/eslint.config.mjs +33 -0
- package/global.d.ts +9 -0
- package/package.json +67 -0
- package/packages/main/.env +24 -0
- package/packages/main/.env.pre +3 -0
- package/packages/main/.env.test +4 -0
- package/packages/main/.eslintrc +9 -0
- package/packages/main/README.md +18 -0
- package/packages/main/dist/manifest.json +40 -0
- package/packages/main/index.html +80 -0
- package/packages/main/index.ts +12 -0
- package/packages/main/package.json +43 -0
- package/packages/main/postcss.config.js +7 -0
- package/packages/main/public/antd.dark.css +26419 -0
- package/packages/main/public/dark.css +32 -0
- package/packages/main/public/evaluation-template.csv +10 -0
- package/packages/main/rsbuild.config.ts +79 -0
- package/packages/main/src/App.tsx +108 -0
- package/packages/main/src/configSystemData.ts +27 -0
- package/packages/main/src/i18n.js +140 -0
- package/packages/main/src/index.jsx +22 -0
- package/packages/main/src/index.less +250 -0
- package/packages/main/src/menus.jsx +123 -0
- package/packages/main/src/pages/Home/index.tsx +102 -0
- package/packages/main/src/pages/Login/common.ts +26 -0
- package/packages/main/src/pages/Login/index.less +15 -0
- package/packages/main/src/pages/Login/index.tsx +238 -0
- package/packages/main/src/routes.tsx +75 -0
- package/packages/main/src/styles/index.css +38 -0
- package/packages/main/src/types/less.d.ts +4 -0
- package/packages/main/src/types/tengitsui.d.ts +7 -0
- package/packages/main/src/types/utils.d.ts +39 -0
- package/packages/main/src/utils/checkPermission.js +19 -0
- package/packages/main/src/utils/day.js +18 -0
- package/packages/main/src/utils/download.js +30 -0
- package/packages/main/src/utils/fileUtils.ts +45 -0
- package/packages/main/src/utils/guid.js +6 -0
- package/packages/main/src/utils/gzip.js +26 -0
- package/packages/main/src/utils/importFile.js +51 -0
- package/packages/main/src/utils/index.ts +9 -0
- package/packages/main/src/utils/request.js +40 -0
- package/packages/main/src/utils/uploadFileToCloud.js +102 -0
- package/packages/main/src/utils/utils.ts +331 -0
- package/packages/main/src/utils/uuid.js +13 -0
- package/packages/main/src/utils/version.js +158 -0
- package/packages/main/tailwind.config.js +27 -0
- package/packages/main/tsconfig.json +6 -0
- package/pnpm-workspace.yaml +16 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 版本控制工具
|
|
3
|
+
* 用于根据系统版本控制组件的显示/隐藏
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import ConditionModal from '../pages/Editor/Components/ConditionsV2/index';
|
|
7
|
+
import ConditionModalV2 from '../pages/Editor/Components/ConditionsV2/index2';
|
|
8
|
+
import Conditions from '../pages/Editor/Components/Conditions';
|
|
9
|
+
import DataContainerCondition from '../pages/DataSource/DataContainer/Detail/FieldSetting/Conditions'
|
|
10
|
+
import { Select , Input } from 'tengits-ui5';
|
|
11
|
+
|
|
12
|
+
const { VITE_SYSTEM_VERSION } = import.meta.env;
|
|
13
|
+
|
|
14
|
+
const comMap = {
|
|
15
|
+
'ConditionModal': ConditionModal,
|
|
16
|
+
'ConditionModalV2': ConditionModalV2,
|
|
17
|
+
'Conditions': Conditions,
|
|
18
|
+
'VeriableSelect': Select,
|
|
19
|
+
'VeriableInput': Input,
|
|
20
|
+
'CallbakKeySelect': Select,
|
|
21
|
+
'CallbakKeyInput': Input,
|
|
22
|
+
'DataContainerCondition': DataContainerCondition
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 系统版本号
|
|
26
|
+
const SYSTEM_VERSION = VITE_SYSTEM_VERSION;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 版本配置映射表
|
|
30
|
+
* 用于定义不同版本下组件的显示规则
|
|
31
|
+
*/
|
|
32
|
+
const VERSION_CONFIGS = {
|
|
33
|
+
'3.0.0': {
|
|
34
|
+
visibleComponents: ['ConditionModal', 'VeriableSelect', 'CallbakKeySelect','ConditionModalV2'],
|
|
35
|
+
hiddenComponents: []
|
|
36
|
+
},
|
|
37
|
+
'2.0.0': {
|
|
38
|
+
visibleComponents: ['Conditions', 'VeriableInput', 'CallbakKeyInput','DataContainerCondition'],
|
|
39
|
+
hiddenComponents: []
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 比较版本号
|
|
46
|
+
* @param {string} v1 - 版本号1
|
|
47
|
+
* @param {string} v2 - 版本号2
|
|
48
|
+
* @returns {number} 1: v1 > v2, 0: v1 = v2, -1: v1 < v2
|
|
49
|
+
*/
|
|
50
|
+
function compareVersions(v1, v2) {
|
|
51
|
+
const v1Parts = v1.split('.').map(Number);
|
|
52
|
+
const v2Parts = v2.split('.').map(Number);
|
|
53
|
+
|
|
54
|
+
for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
|
55
|
+
const v1Part = v1Parts[i] || 0;
|
|
56
|
+
const v2Part = v2Parts[i] || 0;
|
|
57
|
+
|
|
58
|
+
if (v1Part >= v2Part) return 1;
|
|
59
|
+
if (v1Part < v2Part) return -1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 获取当前版本适用的配置
|
|
67
|
+
* @returns {Object} 版本配置
|
|
68
|
+
*/
|
|
69
|
+
function getCurrentVersionConfig() {
|
|
70
|
+
const versions = Object.keys(VERSION_CONFIGS).sort(compareVersions);
|
|
71
|
+
let applicableConfig = null;
|
|
72
|
+
|
|
73
|
+
for (const version of versions) {
|
|
74
|
+
if (compareVersions(SYSTEM_VERSION, version) >= 0) {
|
|
75
|
+
applicableConfig = VERSION_CONFIGS[version];
|
|
76
|
+
} else {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return applicableConfig || {
|
|
82
|
+
visibleComponents: [],
|
|
83
|
+
hiddenComponents: []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 判断组件是否应该显示
|
|
89
|
+
* @param {string} componentName - 组件名称
|
|
90
|
+
* @returns {boolean} 是否应该显示
|
|
91
|
+
*/
|
|
92
|
+
export function shouldShowComponent(componentName) {
|
|
93
|
+
const config = getCurrentVersionConfig();
|
|
94
|
+
return config.visibleComponents.includes(componentName);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 判断组件是否应该隐藏
|
|
99
|
+
* @param {string} componentName - 组件名称
|
|
100
|
+
* @returns {boolean} 是否应该隐藏
|
|
101
|
+
*/
|
|
102
|
+
export function shouldHideComponent(componentName) {
|
|
103
|
+
const config = getCurrentVersionConfig();
|
|
104
|
+
return config.hiddenComponents.includes(componentName);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 获取当前系统版本
|
|
109
|
+
* @returns {string} 系统版本号
|
|
110
|
+
*/
|
|
111
|
+
export function getSystemVersion() {
|
|
112
|
+
return SYSTEM_VERSION;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 获取指定版本下应该显示的组件列表
|
|
117
|
+
* @param {string} version - 目标版本号
|
|
118
|
+
* @param {string[]} components - 所有可能的组件名称数组
|
|
119
|
+
* @returns {Array} 应该显示的组件实例数组
|
|
120
|
+
*/
|
|
121
|
+
//type: component 组件 | string组件类型
|
|
122
|
+
export function getVisibleComponentsForVersion(version = '', components, type = 'component') {
|
|
123
|
+
const versions = Object.keys(VERSION_CONFIGS).sort(compareVersions);
|
|
124
|
+
let applicableConfig = null;
|
|
125
|
+
|
|
126
|
+
// 找到适用的版本配置
|
|
127
|
+
for (const configVersion of versions) {
|
|
128
|
+
if (compareVersions(version, configVersion) >= 0) {
|
|
129
|
+
applicableConfig = VERSION_CONFIGS[configVersion];
|
|
130
|
+
} else {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!applicableConfig) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
// 过滤出应该显示的组件
|
|
139
|
+
const result = components
|
|
140
|
+
.filter(component => {
|
|
141
|
+
// 如果组件在隐藏列表中,则不显示
|
|
142
|
+
if (applicableConfig.hiddenComponents.includes(component)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// 如果组件在显示列表中,则显示
|
|
146
|
+
if (applicableConfig.visibleComponents.includes(component)) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
// 默认不显示,如果调用此方法,则说明有版本要求,必须在visibleComponents中进行配置
|
|
150
|
+
return false;
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
const [comType = null] = result
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
return comMap[comType]&&type==='component' ? comMap[comType] : comType
|
|
157
|
+
|
|
158
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
const { fontFamily } = require("tailwindcss/defaultTheme");
|
|
3
|
+
import plugin from "tailwindcss/plugin";
|
|
4
|
+
|
|
5
|
+
/** @type {import('tailwindcss').Config} */
|
|
6
|
+
export default {
|
|
7
|
+
content: [
|
|
8
|
+
'.index.html',
|
|
9
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
10
|
+
],
|
|
11
|
+
safelist: [
|
|
12
|
+
"bg-status-blue",
|
|
13
|
+
"bg-status-green",
|
|
14
|
+
"bg-status-red",
|
|
15
|
+
"bg-status-yellow",
|
|
16
|
+
"max-w-64",
|
|
17
|
+
// 或者使用正则表达式保留所有 max-w 类名
|
|
18
|
+
{ pattern: /max-w-\d+/ },
|
|
19
|
+
],
|
|
20
|
+
plugins: [
|
|
21
|
+
require('tailwindcss-animate'),
|
|
22
|
+
require('@tailwindcss/forms')({
|
|
23
|
+
strategy: 'class', // only generate classes
|
|
24
|
+
}),
|
|
25
|
+
require('@tailwindcss/typography'),
|
|
26
|
+
],
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
# all packages in subdirs of packages/ and components/
|
|
3
|
+
- 'packages/*'
|
|
4
|
+
catalog:
|
|
5
|
+
# 需要 pnpm 版本 >= 9.5.0
|
|
6
|
+
# 参考:https://pnpm.io/zh/9.x/catalogs
|
|
7
|
+
|
|
8
|
+
# rsbuild 相关
|
|
9
|
+
'@rsbuild/core': ^1.4.7
|
|
10
|
+
'@rsbuild/plugin-image-compress': ^1.2.0
|
|
11
|
+
'@rsbuild/plugin-less': ^1.2.5
|
|
12
|
+
'@rsbuild/plugin-node-polyfill': ^1.3.1
|
|
13
|
+
'@rsbuild/plugin-react': ^1.3.4
|
|
14
|
+
'@rsbuild/plugin-svgr': ^1.2.1
|
|
15
|
+
'@rsdoctor/rspack-plugin': ^1.1.8
|
|
16
|
+
rsbuild-plugin-ejs: ^1.0.1
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"module": "ES2020",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"paths": {
|
|
9
|
+
},
|
|
10
|
+
"typeRoots": [
|
|
11
|
+
"./node_modules/@types",
|
|
12
|
+
"./packages/*/src/types"
|
|
13
|
+
],
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
// "noUnusedParameters": true,
|
|
19
|
+
"esModuleInterop": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["**/src", "global.d.ts"],
|
|
22
|
+
"exclude": ["node_modules", "dist"]
|
|
23
|
+
}
|