@gct-paas/render 0.1.4-dev.7

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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # 版本变更日志
2
+
3
+ 这个项目的所有关键变化都将记录在此文件中.
4
+
5
+ 此日志格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
6
+ 并且此项目遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2025-01-07
11
+
12
+ ### Added
13
+
14
+ - 初始化项目.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 冠骋信息技术有限公司
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,89 @@
1
+ import { FIELD_TYPE as o } from "@gct-paas/core";
2
+ import { get as e } from "lodash-es";
3
+ const n = {
4
+ [o.TEXT]: {
5
+ attrsTransform: [
6
+ {
7
+ from: "specificConfig.minValue",
8
+ to: "minlength"
9
+ },
10
+ {
11
+ from: "specificConfig.maxValue",
12
+ to: "maxlength"
13
+ }
14
+ ]
15
+ },
16
+ [o.LONG_TEXT]: {
17
+ attrsTransform: [
18
+ {
19
+ from: "specificConfig.minValue",
20
+ to: "minlength"
21
+ },
22
+ {
23
+ from: "specificConfig.maxValue",
24
+ to: "maxlength"
25
+ }
26
+ ]
27
+ },
28
+ [o.INTEGER]: {
29
+ attrsTransform: [
30
+ {
31
+ from: "specificConfig.minValue",
32
+ to: "minValue"
33
+ },
34
+ {
35
+ from: "specificConfig.maxValue",
36
+ to: "maxValue"
37
+ }
38
+ ]
39
+ },
40
+ [o.LONG]: {
41
+ attrsTransform: [
42
+ {
43
+ from: "specificConfig.minValue",
44
+ to: "minValue"
45
+ },
46
+ {
47
+ from: "specificConfig.maxValue",
48
+ to: "maxValue"
49
+ }
50
+ ]
51
+ },
52
+ [o.DOUBLE]: {
53
+ attrsTransform: [
54
+ {
55
+ from: "specificConfig.minValue",
56
+ to: "minValue"
57
+ },
58
+ {
59
+ from: "specificConfig.maxValue",
60
+ to: "maxValue"
61
+ }
62
+ ]
63
+ },
64
+ [o.DECIMAL]: {
65
+ attrsTransform: [
66
+ {
67
+ from: "specificConfig.digits",
68
+ to: "precision"
69
+ },
70
+ {
71
+ from: "specificConfig.minValue",
72
+ to: "minValue"
73
+ },
74
+ {
75
+ from: "specificConfig.maxValue",
76
+ to: "maxValue"
77
+ }
78
+ ]
79
+ }
80
+ }, u = (f, m) => {
81
+ const { attrsTransform: r = [] } = n[f] ?? {};
82
+ return r.reduce((i, a) => {
83
+ const t = e(m, a.from);
84
+ return i[a.to] = t, i;
85
+ }, {});
86
+ };
87
+ export {
88
+ u as transformPropsField
89
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@gct-paas/core"),n=require("lodash-es"),m={[o.FIELD_TYPE.TEXT]:{attrsTransform:[{from:"specificConfig.minValue",to:"minlength"},{from:"specificConfig.maxValue",to:"maxlength"}]},[o.FIELD_TYPE.LONG_TEXT]:{attrsTransform:[{from:"specificConfig.minValue",to:"minlength"},{from:"specificConfig.maxValue",to:"maxlength"}]},[o.FIELD_TYPE.INTEGER]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.FIELD_TYPE.LONG]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.FIELD_TYPE.DOUBLE]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.FIELD_TYPE.DECIMAL]:{attrsTransform:[{from:"specificConfig.digits",to:"precision"},{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]}},s=(r,a)=>{const{attrsTransform:t=[]}=m[r]??{};return t.reduce((i,e)=>{const f=n.get(a,e.from);return i[e.to]=f,i},{})};exports.transformPropsField=s;
@@ -0,0 +1 @@
1
+ System.register(["@gct-paas/core","lodash-es"],(function(r,c){"use strict";var o,e;return{setters:[i=>{o=i.FIELD_TYPE},i=>{e=i.get}],execute:(function(){const i={[o.TEXT]:{attrsTransform:[{from:"specificConfig.minValue",to:"minlength"},{from:"specificConfig.maxValue",to:"maxlength"}]},[o.LONG_TEXT]:{attrsTransform:[{from:"specificConfig.minValue",to:"minlength"},{from:"specificConfig.maxValue",to:"maxlength"}]},[o.INTEGER]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.LONG]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.DOUBLE]:{attrsTransform:[{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]},[o.DECIMAL]:{attrsTransform:[{from:"specificConfig.digits",to:"precision"},{from:"specificConfig.minValue",to:"minValue"},{from:"specificConfig.maxValue",to:"maxValue"}]}},l=r("transformPropsField",(f,n)=>{const{attrsTransform:s=[]}=i[f]??{};return s.reduce((t,a)=>{const m=e(n,a.from);return t[a.to]=m,t},{})})})}}));
package/es/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './utils';
package/es/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { transformPropsField } from './utils/field-attrs/index.mjs';
@@ -0,0 +1 @@
1
+ import '@gct-paas/core/types';
@@ -0,0 +1,12 @@
1
+ import { FIELD_TYPE } from '@gct-paas/core';
2
+ /**
3
+ *运行时转化字段属性映射
4
+ */
5
+ export declare const FieldPropsMap: Partial<Record<FIELD_TYPE, {
6
+ attrsTransform: AttrsTransform[];
7
+ }>>;
8
+ interface AttrsTransform {
9
+ from: string;
10
+ to: string;
11
+ }
12
+ export {};
@@ -0,0 +1,82 @@
1
+ import { FIELD_TYPE } from '@gct-paas/core';
2
+
3
+ const FieldPropsMap = {
4
+ [FIELD_TYPE.TEXT]: {
5
+ attrsTransform: [
6
+ {
7
+ from: "specificConfig.minValue",
8
+ to: "minlength"
9
+ },
10
+ {
11
+ from: "specificConfig.maxValue",
12
+ to: "maxlength"
13
+ }
14
+ ]
15
+ },
16
+ [FIELD_TYPE.LONG_TEXT]: {
17
+ attrsTransform: [
18
+ {
19
+ from: "specificConfig.minValue",
20
+ to: "minlength"
21
+ },
22
+ {
23
+ from: "specificConfig.maxValue",
24
+ to: "maxlength"
25
+ }
26
+ ]
27
+ },
28
+ [FIELD_TYPE.INTEGER]: {
29
+ attrsTransform: [
30
+ {
31
+ from: "specificConfig.minValue",
32
+ to: "minValue"
33
+ },
34
+ {
35
+ from: "specificConfig.maxValue",
36
+ to: "maxValue"
37
+ }
38
+ ]
39
+ },
40
+ [FIELD_TYPE.LONG]: {
41
+ attrsTransform: [
42
+ {
43
+ from: "specificConfig.minValue",
44
+ to: "minValue"
45
+ },
46
+ {
47
+ from: "specificConfig.maxValue",
48
+ to: "maxValue"
49
+ }
50
+ ]
51
+ },
52
+ [FIELD_TYPE.DOUBLE]: {
53
+ attrsTransform: [
54
+ {
55
+ from: "specificConfig.minValue",
56
+ to: "minValue"
57
+ },
58
+ {
59
+ from: "specificConfig.maxValue",
60
+ to: "maxValue"
61
+ }
62
+ ]
63
+ },
64
+ [FIELD_TYPE.DECIMAL]: {
65
+ attrsTransform: [
66
+ {
67
+ from: "specificConfig.digits",
68
+ to: "precision"
69
+ },
70
+ {
71
+ from: "specificConfig.minValue",
72
+ to: "minValue"
73
+ },
74
+ {
75
+ from: "specificConfig.maxValue",
76
+ to: "maxValue"
77
+ }
78
+ ]
79
+ }
80
+ };
81
+
82
+ export { FieldPropsMap };
@@ -0,0 +1,6 @@
1
+ import { FIELD_TYPE } from '@gct-paas/core';
2
+ /**
3
+ * @description: 处理字段属性转换
4
+ * 运行时同步字段
5
+ */
6
+ export declare const transformPropsField: (fieldType: FIELD_TYPE, Props: Record<string, string>) => Record<string, string>;
@@ -0,0 +1,15 @@
1
+ import '@gct-paas/core';
2
+ import { get } from 'lodash-es';
3
+ import { FieldPropsMap } from './basicAttrs.mjs';
4
+
5
+ const transformPropsField = (fieldType, Props) => {
6
+ const { attrsTransform = [] } = FieldPropsMap[fieldType] ?? {};
7
+ const attrs = attrsTransform.reduce((curr, row) => {
8
+ const value = get(Props, row.from);
9
+ curr[row.to] = value;
10
+ return curr;
11
+ }, {});
12
+ return attrs;
13
+ };
14
+
15
+ export { transformPropsField };
@@ -0,0 +1,28 @@
1
+ import { ModelMetaDTO, FieldMetaDTO } from '@gct-paas/api/apaas';
2
+ import { LowCodeWidget } from '@gct-paas/schema';
3
+ export declare class FieldSchema {
4
+ static modelData: Map<string, ModelMetaDTO>;
5
+ static FiledData: Map<string, Record<string, FieldMetaDTO>>;
6
+ static responsePromise: Map<string, Promise<void>>;
7
+ static silent: boolean;
8
+ static getMap(modelKey: string, useCache?: boolean): Promise<void>;
9
+ /**
10
+ * 获取模型下字段信息
11
+ * @param modelKey 模型key
12
+ * @param field 字段key
13
+ * @param useCache 是否是用缓存
14
+ * @returns 字段信息
15
+ */
16
+ static getConfigByField(modelKey: string, field: string, useCache?: boolean): Promise<FieldMetaDTO | undefined>;
17
+ /**
18
+ * 获取模型信息
19
+ * @param modelKey 模型key
20
+ * @returns 模型信息
21
+ */
22
+ static getConfigByModel(modelKey: string): Promise<ModelMetaDTO>;
23
+ static clearCacheMap(useRequest?: boolean): void;
24
+ }
25
+ /**字段运行时需要同步的数据 */
26
+ export declare function initFieldWidgetRuntime(widget: LowCodeWidget.FieldSchema & {
27
+ props: Record<string, string | number | boolean | undefined>;
28
+ }, isVanField?: boolean): Promise<FieldMetaDTO | undefined>;
@@ -0,0 +1 @@
1
+ export { transformPropsField } from './field-attrs';
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@gct-paas/render",
3
+ "version": "0.1.4-dev.7",
4
+ "type": "module",
5
+ "description": "paas 平台网页端底包",
6
+ "main": "dist/index.min.cjs",
7
+ "module": "es/index.mjs",
8
+ "types": "es/index.d.ts",
9
+ "system": "dist/index.system.min.js",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./es/index.d.ts",
13
+ "import": "./es/index.mjs",
14
+ "require": "./dist/index.min.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "es",
20
+ "CHANGELOG.md",
21
+ "README.md"
22
+ ],
23
+ "keywords": [
24
+ "paas",
25
+ "gct"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://git.gct-china.com/paas/frontend/paas-package.git"
30
+ },
31
+ "license": "MIT",
32
+ "author": "gct",
33
+ "scripts": {
34
+ "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
35
+ "es:build": "vite build --config vite.dev.config.ts",
36
+ "build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
37
+ "lint": "eslint src/",
38
+ "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
39
+ "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
40
+ "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
41
+ "publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
42
+ "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
43
+ },
44
+ "dependencies": {
45
+ "@gct-paas/core": "workspace:*",
46
+ "@gct-paas/core-web": "workspace:*",
47
+ "@gct-paas/scss": "workspace:*"
48
+ },
49
+ "devDependencies": {
50
+ "@gct-paas/build": "^0.1.5-dev.6"
51
+ }
52
+ }