@gct-paas/render 0.1.4-dev.7 → 0.1.4-dev.9

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.
Files changed (51) hide show
  1. package/dist/index.esm.min.mjs +7684 -15
  2. package/dist/index.min.cjs +9 -1
  3. package/dist/index.system.min.js +9 -1
  4. package/es/Event/Dependency/controller.d.ts +13 -0
  5. package/es/Event/Dependency/controller.mjs +97 -0
  6. package/es/Event/Dependency/displayRule.d.ts +19 -0
  7. package/es/Event/Dependency/displayRule.mjs +76 -0
  8. package/es/Event/Dependency/useDependency.d.ts +7 -0
  9. package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
  10. package/es/Event/Dependency/useDependencyToShow.mjs +109 -0
  11. package/es/Event/baseEvent.d.ts +160 -0
  12. package/es/Event/baseEvent.mjs +445 -0
  13. package/es/Event/bizServiceRequest.d.ts +26 -0
  14. package/es/Event/bizServiceRequest.mjs +47 -0
  15. package/es/Event/eventType.d.ts +20 -0
  16. package/es/Event/index.d.ts +4 -0
  17. package/es/Event/utils/appRedis.d.ts +29 -0
  18. package/es/Event/utils/appRedis.mjs +50 -0
  19. package/es/Event/utils/processRovedInfo.d.ts +100 -0
  20. package/es/Event/utils/processRovedInfo.mjs +297 -0
  21. package/es/Event/utils/runGlobalByPage.d.ts +332 -0
  22. package/es/Event/utils/runGlobalByPage.mjs +306 -0
  23. package/es/Event/utils/verificationVar.d.ts +2 -0
  24. package/es/Event/utils/verificationVar.mjs +42 -0
  25. package/es/enums/index.d.ts +14 -0
  26. package/es/enums/index.mjs +6 -0
  27. package/es/hooks/useStorageRef.d.ts +9 -0
  28. package/es/hooks/useStorageRef.mjs +33 -0
  29. package/es/index.d.ts +2 -0
  30. package/es/index.mjs +22 -0
  31. package/es/register/index.d.ts +1 -0
  32. package/es/register/render-register/render-register.d.ts +54 -0
  33. package/es/register/render-register/render-register.mjs +59 -0
  34. package/es/types/index.d.ts +6 -0
  35. package/es/utils/cacheAdapter.d.ts +7 -0
  36. package/es/utils/cacheAdapter.mjs +57 -0
  37. package/es/utils/expression/index.d.ts +6 -0
  38. package/es/utils/expression/index.mjs +133 -0
  39. package/es/utils/expression/regularExpression/methods.d.ts +77 -0
  40. package/es/utils/expression/regularExpression/methods.mjs +729 -0
  41. package/es/utils/field-attrs/index.d.ts +1 -1
  42. package/es/utils/get-ref-data.d.ts +1 -0
  43. package/es/utils/get-ref-data.mjs +62 -0
  44. package/es/utils/getFieldSchema.d.ts +1 -3
  45. package/es/utils/getFieldSchema.mjs +83 -0
  46. package/es/utils/index.d.ts +5 -0
  47. package/es/utils/model-transformer.d.ts +46 -0
  48. package/es/utils/model-transformer.mjs +77 -0
  49. package/es/utils/useStyle.d.ts +21 -0
  50. package/es/utils/useStyle.mjs +17 -0
  51. package/package.json +26 -6
@@ -3,4 +3,4 @@ import { FIELD_TYPE } from '@gct-paas/core';
3
3
  * @description: 处理字段属性转换
4
4
  * 运行时同步字段
5
5
  */
6
- export declare const transformPropsField: (fieldType: FIELD_TYPE, Props: Record<string, string>) => Record<string, string>;
6
+ export declare const transformPropsField: (fieldType: FIELD_TYPE, Props: IObject) => IObject;
@@ -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 };
@@ -23,6 +23,4 @@ export declare class FieldSchema {
23
23
  static clearCacheMap(useRequest?: boolean): void;
24
24
  }
25
25
  /**字段运行时需要同步的数据 */
26
- export declare function initFieldWidgetRuntime(widget: LowCodeWidget.FieldSchema & {
27
- props: Record<string, string | number | boolean | undefined>;
28
- }, isVanField?: boolean): Promise<FieldMetaDTO | undefined>;
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 };
@@ -1 +1,6 @@
1
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, } 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/render",
3
- "version": "0.1.4-dev.7",
3
+ "version": "0.1.4-dev.9",
4
4
  "type": "module",
5
5
  "description": "paas 平台网页端底包",
6
6
  "main": "dist/index.min.cjs",
@@ -12,6 +12,9 @@
12
12
  "types": "./es/index.d.ts",
13
13
  "import": "./es/index.mjs",
14
14
  "require": "./dist/index.min.cjs"
15
+ },
16
+ "./types": {
17
+ "types": "./es/types/index.d.ts"
15
18
  }
16
19
  },
17
20
  "files": [
@@ -42,11 +45,28 @@
42
45
  "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
43
46
  },
44
47
  "dependencies": {
45
- "@gct-paas/core": "workspace:*",
46
- "@gct-paas/core-web": "workspace:*",
47
- "@gct-paas/scss": "workspace:*"
48
+ "@gct-paas/api": "0.1.0-dev.8",
49
+ "@gct-paas/core": "0.1.4-dev.9",
50
+ "@gct-paas/core-web": "0.1.4-dev.9",
51
+ "@gct-paas/schema": "0.1.4-dev.9",
52
+ "@gct-paas/scss": "0.1.4-dev.9",
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"
48
63
  },
49
64
  "devDependencies": {
50
- "@gct-paas/build": "^0.1.5-dev.6"
51
- }
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": "c51d9883f7d287433d2def4d7338a06773804fbf"
52
72
  }