@gct-paas/render 0.1.4-dev.10
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 +14 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.esm.min.mjs +7825 -0
- package/dist/index.min.cjs +17 -0
- package/dist/index.system.min.js +17 -0
- package/es/Event/Dependency/controller.d.ts +13 -0
- package/es/Event/Dependency/controller.mjs +97 -0
- package/es/Event/Dependency/displayRule.d.ts +19 -0
- package/es/Event/Dependency/displayRule.mjs +76 -0
- package/es/Event/Dependency/useDependency.d.ts +7 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
- package/es/Event/Dependency/useDependencyToShow.mjs +109 -0
- package/es/Event/baseEvent.d.ts +155 -0
- package/es/Event/baseEvent.mjs +430 -0
- package/es/Event/bizServiceRequest.d.ts +26 -0
- package/es/Event/bizServiceRequest.mjs +47 -0
- package/es/Event/eventType.d.ts +20 -0
- package/es/Event/index.d.ts +4 -0
- package/es/Event/utils/appRedis.d.ts +29 -0
- package/es/Event/utils/appRedis.mjs +50 -0
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +103 -0
- package/es/Event/utils/processRovedInfo.d.ts +100 -0
- package/es/Event/utils/processRovedInfo.mjs +297 -0
- package/es/Event/utils/runGlobalByPage.d.ts +333 -0
- package/es/Event/utils/runGlobalByPage.mjs +306 -0
- package/es/Event/utils/verificationVar.d.ts +2 -0
- package/es/Event/utils/verificationVar.mjs +42 -0
- package/es/enums/index.d.ts +14 -0
- package/es/enums/index.mjs +6 -0
- package/es/hooks/useStorageRef.d.ts +9 -0
- package/es/hooks/useStorageRef.mjs +33 -0
- package/es/index.d.ts +3 -0
- package/es/index.mjs +23 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/render-register/render-register.d.ts +54 -0
- package/es/register/render-register/render-register.mjs +59 -0
- package/es/types/index.d.ts +7 -0
- package/es/utils/cacheAdapter.d.ts +7 -0
- package/es/utils/cacheAdapter.mjs +57 -0
- package/es/utils/expression/index.d.ts +6 -0
- package/es/utils/expression/index.mjs +133 -0
- package/es/utils/expression/regularExpression/methods.d.ts +77 -0
- package/es/utils/expression/regularExpression/methods.mjs +729 -0
- package/es/utils/field-attrs/basicAttrs.d.ts +12 -0
- package/es/utils/field-attrs/basicAttrs.mjs +82 -0
- package/es/utils/field-attrs/index.d.ts +6 -0
- package/es/utils/field-attrs/index.mjs +15 -0
- package/es/utils/get-ref-data.d.ts +1 -0
- package/es/utils/get-ref-data.mjs +62 -0
- package/es/utils/getFieldSchema.d.ts +26 -0
- package/es/utils/getFieldSchema.mjs +83 -0
- package/es/utils/index.d.ts +6 -0
- package/es/utils/model-transformer.d.ts +46 -0
- package/es/utils/model-transformer.mjs +77 -0
- package/es/utils/useStyle.d.ts +21 -0
- package/es/utils/useStyle.mjs +17 -0
- package/package.json +72 -0
|
@@ -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,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 @@
|
|
|
1
|
+
export declare const getRefInfoId: (arg: IObject) => any;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { cacheAdapter } from './cacheAdapter.mjs';
|
|
2
|
+
import { transSelectData } from './model-transformer.mjs';
|
|
3
|
+
import { FIELD_TYPE, EntityModelCategoryEnum } from '@gct-paas/core';
|
|
4
|
+
|
|
5
|
+
async function getRefDataById({
|
|
6
|
+
ids,
|
|
7
|
+
refOriginField,
|
|
8
|
+
refOriginFieldType,
|
|
9
|
+
model,
|
|
10
|
+
foreignFields
|
|
11
|
+
}) {
|
|
12
|
+
if (!ids) return Promise.reject();
|
|
13
|
+
const info = await getDataByModelType({
|
|
14
|
+
refOriginFieldType,
|
|
15
|
+
modelKey: model,
|
|
16
|
+
foreignFields,
|
|
17
|
+
ids
|
|
18
|
+
});
|
|
19
|
+
if (info?.data) {
|
|
20
|
+
return transSelectData(refOriginField, info.data, info.dict);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function getDataByModelType({
|
|
24
|
+
refOriginFieldType,
|
|
25
|
+
modelKey,
|
|
26
|
+
foreignFields,
|
|
27
|
+
ids
|
|
28
|
+
}) {
|
|
29
|
+
if (refOriginFieldType === FIELD_TYPE.RDO_REF) {
|
|
30
|
+
const { data = {}, dict = {} } = await _gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
31
|
+
{
|
|
32
|
+
modelKey,
|
|
33
|
+
bsKey: "rdoGetVersionByRefId",
|
|
34
|
+
modelCategory: EntityModelCategoryEnum.ENTITY
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
foreignFields
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
refId: ids
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
return { data, dict };
|
|
44
|
+
} else {
|
|
45
|
+
const { data = {}, dict = {} } = await _gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey(
|
|
46
|
+
{
|
|
47
|
+
modelKey,
|
|
48
|
+
bsKey: "getOne",
|
|
49
|
+
modelCategory: EntityModelCategoryEnum.ENTITY
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
query: { "id_.eq": ids },
|
|
53
|
+
foreignFields
|
|
54
|
+
},
|
|
55
|
+
{}
|
|
56
|
+
);
|
|
57
|
+
return { data, dict };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const getRefInfoId = (arg) => cacheAdapter(arg, getRefDataById);
|
|
61
|
+
|
|
62
|
+
export { getRefInfoId };
|
|
@@ -0,0 +1,26 @@
|
|
|
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.BasicSchema, isVanField?: boolean): Promise<FieldMetaDTO>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
class FieldSchema {
|
|
2
|
+
static modelData = /* @__PURE__ */ new Map();
|
|
3
|
+
static FiledData = /* @__PURE__ */ new Map();
|
|
4
|
+
static responsePromise = /* @__PURE__ */ new Map();
|
|
5
|
+
static silent = false;
|
|
6
|
+
static async getMap(modelKey, useCache = true) {
|
|
7
|
+
if (!modelKey) return Promise.reject();
|
|
8
|
+
if (!this.responsePromise.has(modelKey) || !useCache) {
|
|
9
|
+
const P = (async () => {
|
|
10
|
+
const data = await _gct.api.apaas.modelMeta.getDetail({
|
|
11
|
+
modelKey
|
|
12
|
+
});
|
|
13
|
+
this.modelData.set(modelKey, data);
|
|
14
|
+
const fieldMap = !!data?.fieldMetaList && data.fieldMetaList.reduce((total, curr) => {
|
|
15
|
+
if (curr.key) total[curr.key] = curr;
|
|
16
|
+
return total;
|
|
17
|
+
}, {});
|
|
18
|
+
if (fieldMap) this.FiledData.set(modelKey, fieldMap);
|
|
19
|
+
})();
|
|
20
|
+
this.responsePromise.set(modelKey, P);
|
|
21
|
+
}
|
|
22
|
+
return this.responsePromise.get(modelKey);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 获取模型下字段信息
|
|
26
|
+
* @param modelKey 模型key
|
|
27
|
+
* @param field 字段key
|
|
28
|
+
* @param useCache 是否是用缓存
|
|
29
|
+
* @returns 字段信息
|
|
30
|
+
*/
|
|
31
|
+
static async getConfigByField(modelKey, field, useCache = true) {
|
|
32
|
+
await this.getMap(modelKey, useCache);
|
|
33
|
+
return this.FiledData.get(modelKey)[field];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 获取模型信息
|
|
37
|
+
* @param modelKey 模型key
|
|
38
|
+
* @returns 模型信息
|
|
39
|
+
*/
|
|
40
|
+
static async getConfigByModel(modelKey) {
|
|
41
|
+
await this.getMap(modelKey);
|
|
42
|
+
return this.modelData.get(modelKey);
|
|
43
|
+
}
|
|
44
|
+
static clearCacheMap(useRequest = false) {
|
|
45
|
+
if (useRequest) {
|
|
46
|
+
this.responsePromise.clear();
|
|
47
|
+
}
|
|
48
|
+
this.modelData.clear();
|
|
49
|
+
this.FiledData.clear();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function initFieldWidgetRuntime(widget, isVanField = false) {
|
|
53
|
+
const { modelKey, field, isCustomField, fieldName, readonly, fieldType } = widget.props;
|
|
54
|
+
if (!widget.isField && !isVanField || field === "table_name_") {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
let fieldInfo;
|
|
58
|
+
if (isCustomField) {
|
|
59
|
+
fieldInfo = {
|
|
60
|
+
name: fieldName,
|
|
61
|
+
type: ""
|
|
62
|
+
};
|
|
63
|
+
} else if (modelKey) {
|
|
64
|
+
fieldInfo = await FieldSchema.getConfigByField(modelKey, field);
|
|
65
|
+
}
|
|
66
|
+
if (!isCustomField && (!fieldInfo || fieldInfo.type !== fieldType)) {
|
|
67
|
+
throw new Error("该字段可能已经被删除");
|
|
68
|
+
}
|
|
69
|
+
if (!fieldInfo) {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
const { required, specificConfig } = fieldInfo;
|
|
73
|
+
widget.props.fieldRequired = !!required;
|
|
74
|
+
if (required && !readonly) {
|
|
75
|
+
widget.props.required = true;
|
|
76
|
+
}
|
|
77
|
+
if (specificConfig?.digits !== void 0) {
|
|
78
|
+
widget.props.precision = specificConfig.digits;
|
|
79
|
+
}
|
|
80
|
+
return fieldInfo;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { FieldSchema, initFieldWidgetRuntime };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { transformPropsField } from './field-attrs';
|
|
2
|
+
export { useStyle } from './useStyle';
|
|
3
|
+
export { initFieldWidgetRuntime, FieldSchema } from './getFieldSchema';
|
|
4
|
+
export { transformDataToDict, transformSourceData, transformData, addDataByForm, setDataByForm, transSelectData, type RowData, } from './model-transformer';
|
|
5
|
+
export { calculate, identify } from './expression';
|
|
6
|
+
export { getRefInfoId } from './get-ref-data';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* table 后端返回的分页 数据处理
|
|
3
|
+
* @param data 数据信息
|
|
4
|
+
* @param dict 翻译信息
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function transformSourceData(data: RowData[], dict: DictMap): RowData[];
|
|
8
|
+
/**
|
|
9
|
+
* 表单 form 数据处理
|
|
10
|
+
* @param data 数据信息
|
|
11
|
+
* @param dict 翻译信息
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function transformData(row?: RowData, dict?: DictMap): RowData;
|
|
15
|
+
export declare function addDataByForm(formState: RowData, data: RowData, dict: DictMap): void;
|
|
16
|
+
export declare function setDataByForm(formState: RowData, data: RowData, dict: DictMap): void;
|
|
17
|
+
/**
|
|
18
|
+
* 表单 select 数据处理
|
|
19
|
+
* @param data 数据信息
|
|
20
|
+
* @param dict 翻译信息
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function transSelectData(field: string, row?: RowData, dict?: DictMap): {
|
|
24
|
+
_OPCT: IObject;
|
|
25
|
+
_DICT?: IObject;
|
|
26
|
+
_NOSUBMIT?: boolean;
|
|
27
|
+
_X_ROW_KEY?: string | number;
|
|
28
|
+
__FOREIGN__?: RowData;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 表单 form 数据f翻译不保留原始信息
|
|
32
|
+
* @param data 翻译信息
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export declare function transformDataToDict(row?: RowData, dict?: DictMap): IObject | RowData;
|
|
36
|
+
/** 行数据基础结构 */
|
|
37
|
+
export interface RowData {
|
|
38
|
+
_DICT?: IObject;
|
|
39
|
+
_OPCT?: IObject;
|
|
40
|
+
_NOSUBMIT?: boolean;
|
|
41
|
+
_X_ROW_KEY?: string | number;
|
|
42
|
+
__FOREIGN__?: RowData;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/** 字典映射结构 */
|
|
46
|
+
export type DictMap = Record<string, Record<string, string>>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { merge, cloneDeep } from 'lodash-es';
|
|
2
|
+
|
|
3
|
+
function transformSourceData(data, dict) {
|
|
4
|
+
const list = data?.map((i) => transformData(i, dict));
|
|
5
|
+
return list || [];
|
|
6
|
+
}
|
|
7
|
+
function transformData(row = {}, dict = {}) {
|
|
8
|
+
const data = cloneDeep(row);
|
|
9
|
+
data._X_ROW_KEY = void 0;
|
|
10
|
+
const _DICT = Object.keys(dict ?? {})?.length ? Object.keys(data).reduce((total, curr) => {
|
|
11
|
+
const map = dict[curr], value = data[curr];
|
|
12
|
+
if (map && value) {
|
|
13
|
+
try {
|
|
14
|
+
const label = (value + "").split(",").map((k) => map[k]);
|
|
15
|
+
total[curr] = { [value + ""]: label };
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return total;
|
|
20
|
+
}, {}) : data._DICT || {};
|
|
21
|
+
return {
|
|
22
|
+
...data,
|
|
23
|
+
_DICT,
|
|
24
|
+
_OPCT: data.__FOREIGN__ && typeof data.__FOREIGN__ === "object" ? transformData(data.__FOREIGN__, dict) : {}
|
|
25
|
+
// __FOREIGN__: null,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function addDataByForm(formState, data, dict) {
|
|
29
|
+
if (typeof data !== "object") return;
|
|
30
|
+
const formdata = transformData(data, dict);
|
|
31
|
+
merge(formState, formdata);
|
|
32
|
+
}
|
|
33
|
+
function setDataByForm(formState, data, dict) {
|
|
34
|
+
if (typeof data !== "object") return;
|
|
35
|
+
for (const k in formState) {
|
|
36
|
+
if (k !== "_OPCT" && k !== "_NOSUBMIT") {
|
|
37
|
+
delete formState[k];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const formdata = transformData(data, dict);
|
|
41
|
+
formdata._X_ROW_KEY = data._X_ROW_KEY;
|
|
42
|
+
merge(formState, formdata);
|
|
43
|
+
}
|
|
44
|
+
function transSelectData(field, row = {}, dict = {}) {
|
|
45
|
+
const data = cloneDeep(row.__FOREIGN__ || row);
|
|
46
|
+
const _OPCT = { _DICT: {} };
|
|
47
|
+
Object.keys(data).forEach((curr) => {
|
|
48
|
+
const fieldkey = `${field}.${curr}`;
|
|
49
|
+
const map = dict[curr], value = data[curr];
|
|
50
|
+
if (map && value) {
|
|
51
|
+
try {
|
|
52
|
+
const label = (value + "").split(",").map((k) => map[k]);
|
|
53
|
+
_OPCT._DICT[fieldkey] = { [value + ""]: label };
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_OPCT[fieldkey] = value;
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
...data,
|
|
61
|
+
_OPCT
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function transformDataToDict(row = {}, dict = {}) {
|
|
65
|
+
const data = cloneDeep(row);
|
|
66
|
+
return Object.keys(dict ?? {})?.length ? Object.keys(data).reduce((total, curr) => {
|
|
67
|
+
const map = dict[curr] || {}, value = data[curr];
|
|
68
|
+
try {
|
|
69
|
+
total[curr] = (value + "").split(",").map((k) => map[k]).join(",");
|
|
70
|
+
} catch {
|
|
71
|
+
total[curr] = value;
|
|
72
|
+
}
|
|
73
|
+
return total;
|
|
74
|
+
}, {}) : data;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { addDataByForm, setDataByForm, transSelectData, transformData, transformDataToDict, transformSourceData };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LowCodeWidget } from '@gct-paas/schema';
|
|
2
|
+
export declare function useStyle(widget: LowCodeWidget.BasicSchema): {
|
|
3
|
+
wrapperStyle: IObject;
|
|
4
|
+
wStyle: IObject;
|
|
5
|
+
labelFont: IObject;
|
|
6
|
+
contentFont: IObject;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 将样式对象转换为字体样式
|
|
10
|
+
*
|
|
11
|
+
* @param schema - 样式配置对象
|
|
12
|
+
* @returns 转换后的字体样式对象
|
|
13
|
+
*/
|
|
14
|
+
export declare const schemaToStyle: (schema: IObject) => IObject;
|
|
15
|
+
/**
|
|
16
|
+
* 将样式属性对象转换为 CSS 样式字符串格式
|
|
17
|
+
*
|
|
18
|
+
* @param styleProps - 样式属性对象
|
|
19
|
+
* @returns 转换后的样式对象
|
|
20
|
+
*/
|
|
21
|
+
export declare function propsToStyle(styleProps?: IObject): IObject;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { propsToStyle, generateWrapperStyle, extractFontStyle } from '@gct-paas/schema';
|
|
2
|
+
|
|
3
|
+
function useStyle(widget) {
|
|
4
|
+
const { style = {}, ignoringStyle = [] } = widget || {};
|
|
5
|
+
const wStyle = propsToStyle(style);
|
|
6
|
+
const wrapperStyle = generateWrapperStyle(style, ignoringStyle);
|
|
7
|
+
const labelFont = extractFontStyle(style.labelFont);
|
|
8
|
+
const contentFont = extractFontStyle(style.contentFont);
|
|
9
|
+
return {
|
|
10
|
+
wrapperStyle,
|
|
11
|
+
wStyle,
|
|
12
|
+
labelFont,
|
|
13
|
+
contentFont
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { useStyle };
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gct-paas/render",
|
|
3
|
+
"version": "0.1.4-dev.10",
|
|
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
|
+
"./types": {
|
|
17
|
+
"types": "./es/types/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"es",
|
|
23
|
+
"CHANGELOG.md",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"paas",
|
|
28
|
+
"gct"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://git.gct-china.com/paas/frontend/paas-package.git"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"author": "gct",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
|
|
38
|
+
"es:build": "vite build --config vite.dev.config.ts",
|
|
39
|
+
"build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
|
|
40
|
+
"lint": "eslint src/",
|
|
41
|
+
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
42
|
+
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
43
|
+
"publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
|
|
44
|
+
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
45
|
+
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@gct-paas/api": "0.1.0-dev.8",
|
|
49
|
+
"@gct-paas/core": "0.1.4-dev.10",
|
|
50
|
+
"@gct-paas/core-web": "0.1.4-dev.10",
|
|
51
|
+
"@gct-paas/schema": "0.1.4-dev.10",
|
|
52
|
+
"@gct-paas/scss": "0.1.4-dev.10",
|
|
53
|
+
"@vueuse/core": "^14.1.0",
|
|
54
|
+
"axios": "^1.13.2",
|
|
55
|
+
"bignumber.js": "^10.0.2",
|
|
56
|
+
"dayjs": "^1.11.19",
|
|
57
|
+
"escodegen": "^2.1.0",
|
|
58
|
+
"esprima-next": "5.8.4",
|
|
59
|
+
"estraverse": "^5.3.0",
|
|
60
|
+
"qs": "^6.14.1",
|
|
61
|
+
"qx-util": "^0.4.8",
|
|
62
|
+
"vue": "^3.5.29"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@gct-paas/build": "^0.1.5-dev.8",
|
|
66
|
+
"@types/escodegen": "^0.0.10",
|
|
67
|
+
"@types/estraverse": "^5.1.7",
|
|
68
|
+
"@types/estree": "^1.0.8",
|
|
69
|
+
"@types/qs": "^6.14.0"
|
|
70
|
+
},
|
|
71
|
+
"gitHead": "e707c6d6332e7e83a3d5df97b37f619065d8ea39"
|
|
72
|
+
}
|