@gct-paas/render 0.1.4-dev.9 → 0.1.5-dev.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/dist/index.min.css +2 -0
- package/dist/loader.esm.min.js +1 -0
- package/es/Event/Dependency/controller.d.ts +1 -1
- package/es/Event/Dependency/controller.mjs +81 -94
- package/es/Event/Dependency/displayRule.mjs +130 -68
- package/es/Event/Dependency/useDependency.mjs +117 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +1 -1
- package/es/Event/Dependency/useDependencyToShow.mjs +100 -96
- package/es/Event/baseEvent.d.ts +28 -32
- package/es/Event/baseEvent.mjs +383 -439
- package/es/Event/bizServiceRequest.d.ts +1 -1
- package/es/Event/bizServiceRequest.mjs +29 -41
- package/es/Event/eventType.d.ts +1 -1
- package/es/Event/eventType.mjs +1 -0
- package/es/Event/index.d.ts +6 -3
- package/es/Event/index.mjs +7 -0
- package/es/Event/utils/appRedis.mjs +39 -49
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +104 -0
- package/es/Event/utils/processRovedInfo.mjs +228 -294
- package/es/Event/utils/runGlobalByPage.d.ts +4 -1
- package/es/Event/utils/runGlobalByPage.mjs +297 -301
- package/es/Event/utils/verificationVar.mjs +32 -38
- package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
- package/es/_virtual/_rolldown/runtime.mjs +13 -0
- package/es/components/HandwritingPad.vue.d.ts +27 -0
- package/es/components/HandwritingPad.vue.mjs +7 -0
- package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
- package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.mjs +1 -0
- package/es/constant/data-format.d.ts +52 -0
- package/es/constant/data-format.mjs +66 -0
- package/es/constant/date-time.d.ts +99 -0
- package/es/constant/date-time.mjs +187 -0
- package/es/constant/index.d.ts +94 -0
- package/es/constant/index.mjs +100 -0
- package/es/controller/design-render/design-render.controller.d.ts +18 -0
- package/es/controller/design-render/design-render.controller.mjs +78 -0
- package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
- package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
- package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
- package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
- package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
- package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
- package/es/controller/index.d.ts +4 -0
- package/es/controller/index.mjs +4 -0
- package/es/enums/index.mjs +17 -5
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +2 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
- package/es/hooks/useStorageRef.mjs +35 -31
- package/es/index.d.ts +4 -0
- package/es/index.mjs +34 -21
- package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
- package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render.controller.d.ts +93 -0
- package/es/interface/index.d.ts +12 -0
- package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
- package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
- package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
- package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
- package/es/interface/state/i-design-render-base.state.d.ts +19 -0
- package/es/interface/state/i-design-render-container.state.d.ts +11 -0
- package/es/interface/state/i-design-render-item.state.d.ts +11 -0
- package/es/interface/state/i-design-render.state.d.ts +18 -0
- package/es/loader.d.ts +1 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +2 -0
- package/es/register/node/node.register.d.ts +92 -0
- package/es/register/node/node.register.mjs +116 -0
- package/es/register/render-register/render-register.mjs +63 -58
- package/es/state/design-render/design-render.state.d.ts +13 -0
- package/es/state/design-render/design-render.state.mjs +15 -0
- package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
- package/es/state/design-render-base/design-render-base.state.mjs +6 -0
- package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
- package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
- package/es/state/index.d.ts +4 -0
- package/es/utils/cacheAdapter.mjs +62 -54
- package/es/utils/expression/index.d.ts +1 -1
- package/es/utils/expression/index.mjs +105 -122
- package/es/utils/expression/regularExpression/methods.mjs +426 -567
- package/es/utils/field-attrs/basicAttrs.mjs +56 -80
- package/es/utils/field-attrs/index.mjs +16 -13
- package/es/utils/get-ref-data.mjs +41 -59
- package/es/utils/getFieldSchema.mjs +66 -80
- package/es/utils/index.d.ts +6 -3
- package/es/utils/index.mjs +11 -0
- package/es/utils/model-transformer.mjs +74 -64
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
- package/es/utils/search/index.d.ts +2 -0
- package/es/utils/search/index.mjs +2 -0
- package/es/utils/search/search-default-value.d.ts +7 -0
- package/es/utils/search/search-default-value.mjs +244 -0
- package/es/utils/search/search-hooks.d.ts +6 -0
- package/es/utils/search/search-hooks.mjs +67 -0
- package/es/utils/useStyle.d.ts +2 -2
- package/es/utils/useStyle.mjs +20 -15
- package/package.json +20 -17
- package/dist/index.esm.min.mjs +0 -7758
- package/dist/index.min.cjs +0 -9
- package/dist/index.system.min.js +0 -9
|
@@ -1,82 +1,58 @@
|
|
|
1
|
-
import { FIELD_TYPE } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
}
|
|
1
|
+
import { FIELD_TYPE } from "@gct-paas/core";
|
|
2
|
+
//#region src/utils/field-attrs/basicAttrs.ts
|
|
3
|
+
/**
|
|
4
|
+
*运行时转化字段属性映射
|
|
5
|
+
*/
|
|
6
|
+
var FieldPropsMap = {
|
|
7
|
+
[FIELD_TYPE.TEXT]: { attrsTransform: [{
|
|
8
|
+
from: "specificConfig.minValue",
|
|
9
|
+
to: "minlength"
|
|
10
|
+
}, {
|
|
11
|
+
from: "specificConfig.maxValue",
|
|
12
|
+
to: "maxlength"
|
|
13
|
+
}] },
|
|
14
|
+
[FIELD_TYPE.LONG_TEXT]: { attrsTransform: [{
|
|
15
|
+
from: "specificConfig.minValue",
|
|
16
|
+
to: "minlength"
|
|
17
|
+
}, {
|
|
18
|
+
from: "specificConfig.maxValue",
|
|
19
|
+
to: "maxlength"
|
|
20
|
+
}] },
|
|
21
|
+
[FIELD_TYPE.INTEGER]: { attrsTransform: [{
|
|
22
|
+
from: "specificConfig.minValue",
|
|
23
|
+
to: "minValue"
|
|
24
|
+
}, {
|
|
25
|
+
from: "specificConfig.maxValue",
|
|
26
|
+
to: "maxValue"
|
|
27
|
+
}] },
|
|
28
|
+
[FIELD_TYPE.LONG]: { attrsTransform: [{
|
|
29
|
+
from: "specificConfig.minValue",
|
|
30
|
+
to: "minValue"
|
|
31
|
+
}, {
|
|
32
|
+
from: "specificConfig.maxValue",
|
|
33
|
+
to: "maxValue"
|
|
34
|
+
}] },
|
|
35
|
+
[FIELD_TYPE.DOUBLE]: { attrsTransform: [{
|
|
36
|
+
from: "specificConfig.minValue",
|
|
37
|
+
to: "minValue"
|
|
38
|
+
}, {
|
|
39
|
+
from: "specificConfig.maxValue",
|
|
40
|
+
to: "maxValue"
|
|
41
|
+
}] },
|
|
42
|
+
[FIELD_TYPE.DECIMAL]: { attrsTransform: [
|
|
43
|
+
{
|
|
44
|
+
from: "specificConfig.digits",
|
|
45
|
+
to: "precision"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
from: "specificConfig.minValue",
|
|
49
|
+
to: "minValue"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
from: "specificConfig.maxValue",
|
|
53
|
+
to: "maxValue"
|
|
54
|
+
}
|
|
55
|
+
] }
|
|
80
56
|
};
|
|
81
|
-
|
|
57
|
+
//#endregion
|
|
82
58
|
export { FieldPropsMap };
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { FieldPropsMap } from "./basicAttrs.mjs";
|
|
2
|
+
import "@gct-paas/core";
|
|
3
|
+
import { get } from "lodash-es";
|
|
4
|
+
//#region src/utils/field-attrs/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* @description: 处理字段属性转换
|
|
7
|
+
* 运行时同步字段
|
|
8
|
+
*/
|
|
9
|
+
var transformPropsField = (fieldType, Props) => {
|
|
10
|
+
const { attrsTransform = [] } = FieldPropsMap[fieldType] ?? {};
|
|
11
|
+
return attrsTransform.reduce((curr, row) => {
|
|
12
|
+
const value = get(Props, row.from);
|
|
13
|
+
curr[row.to] = value;
|
|
14
|
+
return curr;
|
|
15
|
+
}, {});
|
|
13
16
|
};
|
|
14
|
-
|
|
17
|
+
//#endregion
|
|
15
18
|
export { transformPropsField };
|
|
@@ -1,62 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
modelKey: model,
|
|
16
|
-
foreignFields,
|
|
17
|
-
ids
|
|
18
|
-
});
|
|
19
|
-
if (info?.data) {
|
|
20
|
-
return transSelectData(refOriginField, info.data, info.dict);
|
|
21
|
-
}
|
|
1
|
+
import { transSelectData } from "./model-transformer.mjs";
|
|
2
|
+
import { cacheAdapter } from "./cacheAdapter.mjs";
|
|
3
|
+
import { EntityModelCategoryEnum, FIELD_TYPE } from "@gct-paas/core";
|
|
4
|
+
//#region src/utils/get-ref-data.ts
|
|
5
|
+
/**根据id查询 */
|
|
6
|
+
async function getRefDataById({ ids, refOriginField, refOriginFieldType, model, foreignFields }) {
|
|
7
|
+
if (!ids) return Promise.reject();
|
|
8
|
+
const info = await getDataByModelType({
|
|
9
|
+
refOriginFieldType,
|
|
10
|
+
modelKey: model,
|
|
11
|
+
foreignFields,
|
|
12
|
+
ids
|
|
13
|
+
});
|
|
14
|
+
if (info?.data) return transSelectData(refOriginField, info.data, info.dict);
|
|
22
15
|
}
|
|
23
|
-
async function getDataByModelType({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
bsKey: "getOne",
|
|
49
|
-
modelCategory: EntityModelCategoryEnum.ENTITY
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
query: { "id_.eq": ids },
|
|
53
|
-
foreignFields
|
|
54
|
-
},
|
|
55
|
-
{}
|
|
56
|
-
);
|
|
57
|
-
return { data, dict };
|
|
58
|
-
}
|
|
16
|
+
async function getDataByModelType({ refOriginFieldType, modelKey, foreignFields, ids }) {
|
|
17
|
+
if (refOriginFieldType === FIELD_TYPE.RDO_REF) {
|
|
18
|
+
const { data = {}, dict = {} } = await _gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey({
|
|
19
|
+
modelKey,
|
|
20
|
+
bsKey: "rdoGetVersionByRefId",
|
|
21
|
+
modelCategory: EntityModelCategoryEnum.ENTITY
|
|
22
|
+
}, { foreignFields }, { refId: ids });
|
|
23
|
+
return {
|
|
24
|
+
data,
|
|
25
|
+
dict
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
const { data = {}, dict = {} } = await _gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey({
|
|
29
|
+
modelKey,
|
|
30
|
+
bsKey: "getOne",
|
|
31
|
+
modelCategory: EntityModelCategoryEnum.ENTITY
|
|
32
|
+
}, {
|
|
33
|
+
query: { "id_.eq": ids },
|
|
34
|
+
foreignFields
|
|
35
|
+
}, {});
|
|
36
|
+
return {
|
|
37
|
+
data,
|
|
38
|
+
dict
|
|
39
|
+
};
|
|
40
|
+
}
|
|
59
41
|
}
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
var getRefInfoId = (arg) => cacheAdapter(arg, getRefDataById);
|
|
43
|
+
//#endregion
|
|
62
44
|
export { getRefInfoId };
|
|
@@ -1,83 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
1
|
+
//#region src/utils/getFieldSchema.ts
|
|
2
|
+
var FieldSchema = class {
|
|
3
|
+
static modelData = /* @__PURE__ */ new Map();
|
|
4
|
+
static FiledData = /* @__PURE__ */ new Map();
|
|
5
|
+
static responsePromise = /* @__PURE__ */ new Map();
|
|
6
|
+
static silent = false;
|
|
7
|
+
static async getMap(modelKey, useCache = true) {
|
|
8
|
+
if (!modelKey) return Promise.reject();
|
|
9
|
+
if (!this.responsePromise.has(modelKey) || !useCache) {
|
|
10
|
+
/**防止同一时刻同事调用接口 */
|
|
11
|
+
const P = (async () => {
|
|
12
|
+
const data = await _gct.api.apaas.modelMeta.getDetail({ modelKey });
|
|
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) this.responsePromise.clear();
|
|
46
|
+
this.modelData.clear();
|
|
47
|
+
this.FiledData.clear();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**字段运行时需要同步的数据 */
|
|
52
51
|
async function initFieldWidgetRuntime(widget, isVanField = false) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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;
|
|
52
|
+
const { modelKey, field, isCustomField, fieldName, readonly, fieldType } = widget.props;
|
|
53
|
+
if (!widget.isField && !isVanField || field === "table_name_") return {};
|
|
54
|
+
let fieldInfo;
|
|
55
|
+
if (isCustomField) fieldInfo = {
|
|
56
|
+
name: fieldName,
|
|
57
|
+
type: ""
|
|
58
|
+
};
|
|
59
|
+
else if (modelKey) fieldInfo = await FieldSchema.getConfigByField(modelKey, field);
|
|
60
|
+
if (!isCustomField && (!fieldInfo || fieldInfo.type !== fieldType)) throw new Error("该字段可能已经被删除");
|
|
61
|
+
if (!fieldInfo) return {};
|
|
62
|
+
const { required, specificConfig } = fieldInfo;
|
|
63
|
+
widget.props.fieldRequired = !!required;
|
|
64
|
+
if (required && !readonly) widget.props.required = true;
|
|
65
|
+
if (specificConfig?.digits !== void 0) widget.props.precision = specificConfig.digits;
|
|
66
|
+
return fieldInfo;
|
|
81
67
|
}
|
|
82
|
-
|
|
68
|
+
//#endregion
|
|
83
69
|
export { FieldSchema, initFieldWidgetRuntime };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export { calculate, identify } from './expression';
|
|
1
2
|
export { transformPropsField } from './field-attrs';
|
|
2
|
-
export {
|
|
3
|
+
export { RenderPluginPgkUtil } from './render-plugin-pkg-util/render-plugin-pkg-util';
|
|
4
|
+
export { useStyle, schemaToStyle } from './useStyle';
|
|
3
5
|
export { initFieldWidgetRuntime, FieldSchema } from './getFieldSchema';
|
|
4
|
-
export { transformDataToDict, transformSourceData, transformData, addDataByForm, setDataByForm, transSelectData, } from './model-transformer';
|
|
5
|
-
export { calculate, identify } from './expression';
|
|
6
|
+
export { transformDataToDict, transformSourceData, transformData, addDataByForm, setDataByForm, transSelectData, type RowData, type DictMap, } from './model-transformer';
|
|
6
7
|
export { getRefInfoId } from './get-ref-data';
|
|
8
|
+
export * from './cacheAdapter';
|
|
9
|
+
export * from './search';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./expression/index.mjs";
|
|
2
|
+
import "./field-attrs/index.mjs";
|
|
3
|
+
import "./render-plugin-pkg-util/render-plugin-pkg-util.mjs";
|
|
4
|
+
import "./useStyle.mjs";
|
|
5
|
+
import "./getFieldSchema.mjs";
|
|
6
|
+
import "./model-transformer.mjs";
|
|
7
|
+
import "./cacheAdapter.mjs";
|
|
8
|
+
import "./get-ref-data.mjs";
|
|
9
|
+
import "./search/search-hooks.mjs";
|
|
10
|
+
import "./search/search-default-value.mjs";
|
|
11
|
+
import "./search/index.mjs";
|
|
@@ -1,77 +1,87 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { cloneDeep, merge } from "lodash-es";
|
|
2
|
+
//#region src/utils/model-transformer.ts
|
|
3
|
+
/**
|
|
4
|
+
* table 后端返回的分页 数据处理
|
|
5
|
+
* @param data 数据信息
|
|
6
|
+
* @param dict 翻译信息
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
3
9
|
function transformSourceData(data, dict) {
|
|
4
|
-
|
|
5
|
-
return list || [];
|
|
10
|
+
return data?.map((i) => transformData(i, dict)) || [];
|
|
6
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* 表单 form 数据处理
|
|
14
|
+
* @param data 数据信息
|
|
15
|
+
* @param dict 翻译信息
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
7
18
|
function transformData(row = {}, dict = {}) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_DICT,
|
|
24
|
-
_OPCT: data.__FOREIGN__ && typeof data.__FOREIGN__ === "object" ? transformData(data.__FOREIGN__, dict) : {}
|
|
25
|
-
// __FOREIGN__: null,
|
|
26
|
-
};
|
|
19
|
+
const data = cloneDeep(row);
|
|
20
|
+
data._X_ROW_KEY = void 0;
|
|
21
|
+
const _DICT = Object.keys(dict ?? {})?.length ? Object.keys(data).reduce((total, curr) => {
|
|
22
|
+
const map = dict[curr], value = data[curr];
|
|
23
|
+
if (map && value) try {
|
|
24
|
+
const label = (value + "").split(",").map((k) => map[k]);
|
|
25
|
+
total[curr] = { [value + ""]: label };
|
|
26
|
+
} catch {}
|
|
27
|
+
return total;
|
|
28
|
+
}, {}) : data._DICT || {};
|
|
29
|
+
return {
|
|
30
|
+
...data,
|
|
31
|
+
_DICT,
|
|
32
|
+
_OPCT: data.__FOREIGN__ && typeof data.__FOREIGN__ === "object" ? transformData(data.__FOREIGN__, dict) : {}
|
|
33
|
+
};
|
|
27
34
|
}
|
|
28
35
|
function addDataByForm(formState, data, dict) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
merge(formState, formdata);
|
|
36
|
+
if (typeof data !== "object") return;
|
|
37
|
+
merge(formState, transformData(data, dict));
|
|
32
38
|
}
|
|
33
39
|
function setDataByForm(formState, data, dict) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
const formdata = transformData(data, dict);
|
|
41
|
-
formdata._X_ROW_KEY = data._X_ROW_KEY;
|
|
42
|
-
merge(formState, formdata);
|
|
40
|
+
if (typeof data !== "object") return;
|
|
41
|
+
for (const k in formState) if (k !== "_OPCT" && k !== "_NOSUBMIT") delete formState[k];
|
|
42
|
+
const formdata = transformData(data, dict);
|
|
43
|
+
formdata._X_ROW_KEY = data._X_ROW_KEY;
|
|
44
|
+
merge(formState, formdata);
|
|
43
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* 表单 select 数据处理
|
|
48
|
+
* @param data 数据信息
|
|
49
|
+
* @param dict 翻译信息
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
44
52
|
function transSelectData(field, row = {}, dict = {}) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
...data,
|
|
61
|
-
_OPCT
|
|
62
|
-
};
|
|
53
|
+
const data = cloneDeep(row.__FOREIGN__ || row);
|
|
54
|
+
const _OPCT = { _DICT: {} };
|
|
55
|
+
Object.keys(data).forEach((curr) => {
|
|
56
|
+
const fieldkey = `${field}.${curr}`;
|
|
57
|
+
const map = dict[curr], value = data[curr];
|
|
58
|
+
if (map && value) try {
|
|
59
|
+
const label = (value + "").split(",").map((k) => map[k]);
|
|
60
|
+
_OPCT._DICT[fieldkey] = { [value + ""]: label };
|
|
61
|
+
} catch {}
|
|
62
|
+
_OPCT[fieldkey] = value;
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
...data,
|
|
66
|
+
_OPCT
|
|
67
|
+
};
|
|
63
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 表单 form 数据f翻译不保留原始信息
|
|
71
|
+
* @param data 翻译信息
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
64
74
|
function transformDataToDict(row = {}, dict = {}) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
const data = cloneDeep(row);
|
|
76
|
+
return Object.keys(dict ?? {})?.length ? Object.keys(data).reduce((total, curr) => {
|
|
77
|
+
const map = dict[curr] || {}, value = data[curr];
|
|
78
|
+
try {
|
|
79
|
+
total[curr] = (value + "").split(",").map((k) => map[k]).join(",");
|
|
80
|
+
} catch {
|
|
81
|
+
total[curr] = value;
|
|
82
|
+
}
|
|
83
|
+
return total;
|
|
84
|
+
}, {}) : data;
|
|
75
85
|
}
|
|
76
|
-
|
|
86
|
+
//#endregion
|
|
77
87
|
export { addDataByForm, setDataByForm, transSelectData, transformData, transformDataToDict, transformSourceData };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PluginTenant } from '@gct-paas/api/platform';
|
|
2
|
+
import { PluginModeEnum, PluginPgkUtil } from '@gct-paas/core';
|
|
3
|
+
/**
|
|
4
|
+
* 插件包处理工具类
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class RenderPluginPgkUtil
|
|
8
|
+
*/
|
|
9
|
+
export declare class RenderPluginPgkUtil extends PluginPgkUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 加载渲染态指定端插件包
|
|
12
|
+
*
|
|
13
|
+
* @static
|
|
14
|
+
* @param {PluginModeEnum} mode
|
|
15
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
16
|
+
* @return {*} {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
static loadRenderPlugin(mode: PluginModeEnum, configs?: PluginTenant['plugins']): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 加载渲染态移动端插件包
|
|
21
|
+
*
|
|
22
|
+
* @static
|
|
23
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
24
|
+
* @return {*} {Promise<void>}
|
|
25
|
+
*/
|
|
26
|
+
static loadMobilePlugin(configs?: PluginTenant['plugins']): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* 加载渲染态平板端插件包
|
|
29
|
+
*
|
|
30
|
+
* @static
|
|
31
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
32
|
+
* @return {*} {Promise<void>}
|
|
33
|
+
*/
|
|
34
|
+
static loadPadPlugin(configs?: PluginTenant['plugins']): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* 加载渲染态网页端插件包
|
|
37
|
+
*
|
|
38
|
+
* @static
|
|
39
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
40
|
+
* @return {*} {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
static loadWebPlugin(configs?: PluginTenant['plugins']): Promise<void>;
|
|
43
|
+
}
|