@gct-paas/render 0.1.6-dev.9 → 6.0.0-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.
@@ -8,6 +8,8 @@ interface DisplayRule {
8
8
  }
9
9
  /**单组件显隐控制 */
10
10
  export declare function useVisibileByRuleHook(props: DisplayRule, id: string): Readonly<import('vue').Ref<boolean, boolean>>;
11
+ /**组件显示规则 */
12
+ export declare function getOptionsByDisplayRule({ displayRule, tableForm }: DisplayRule, callback: (value: unknown) => void): void;
11
13
  /**
12
14
  * 需要做控制的数组组件
13
15
  * @param optopns 被控制的数组
@@ -135,4 +135,4 @@ function useDisplayRuleOptionsBytable(optopns, tableForm) {
135
135
  }));
136
136
  }
137
137
  //#endregion
138
- export { useDisplayRuleColumnByStyles, useDisplayRuleOptions, useVisibileByRuleHook };
138
+ export { getOptionsByDisplayRule, useDisplayRuleColumnByStyles, useDisplayRuleOptions, useVisibileByRuleHook };
@@ -0,0 +1,43 @@
1
+ import { Context } from './baseEvent';
2
+ /** 上下文扩展方法 */
3
+ export type ContextExtension = {
4
+ bivarianceHack(context: Context, ...args: unknown[]): unknown;
5
+ }['bivarianceHack'];
6
+ /** 上下文扩展方法映射 */
7
+ export type ContextExtensionMethods = Record<string, unknown>;
8
+ /**
9
+ * 上下文扩展注册中心。
10
+ *
11
+ * 注册数据由核心包统一维护,端包和应用层仅通过继承补充保留键策略。
12
+ */
13
+ export declare class ContextExtensionRegistry {
14
+ private static readonly extensions;
15
+ /**
16
+ * 注册套件提供的上下文扩展方法。
17
+ *
18
+ * @param suiteKey 套件标识
19
+ * @param methods 扩展方法映射
20
+ */
21
+ static register(suiteKey: string, methods: ContextExtensionMethods): void;
22
+ /**
23
+ * 将已注册扩展挂载到指定上下文。
24
+ *
25
+ * @param context 当前页面上下文
26
+ */
27
+ apply(context: Context): void;
28
+ /**
29
+ * 判断方法名是否为当前层级的内置上下文方法。
30
+ *
31
+ * @param context 当前页面上下文
32
+ * @param methodName 上下文方法名
33
+ * @returns 是否为保留方法
34
+ */
35
+ protected isReservedKey(context: Context, methodName: string): boolean;
36
+ }
37
+ /**
38
+ * 注册套件上下文扩展。
39
+ *
40
+ * @param suiteKey 套件标识
41
+ * @param methods 扩展方法映射
42
+ */
43
+ export declare function registerContextExtension(suiteKey: string, methods: ContextExtensionMethods): void;
@@ -0,0 +1,67 @@
1
+ //#region src/Event/context-extension-registry.ts
2
+ /**
3
+ * 上下文扩展注册中心。
4
+ *
5
+ * 注册数据由核心包统一维护,端包和应用层仅通过继承补充保留键策略。
6
+ */
7
+ var ContextExtensionRegistry = class ContextExtensionRegistry {
8
+ static extensions = /* @__PURE__ */ new Map();
9
+ /**
10
+ * 注册套件提供的上下文扩展方法。
11
+ *
12
+ * @param suiteKey 套件标识
13
+ * @param methods 扩展方法映射
14
+ */
15
+ static register(suiteKey, methods) {
16
+ Object.entries(methods).forEach(([methodName, method]) => {
17
+ if (typeof method !== "function") {
18
+ console.error(`套件 ${suiteKey} 注册上下文扩展 ${methodName} 失败:扩展值必须是函数`);
19
+ return;
20
+ }
21
+ const previous = this.extensions.get(methodName);
22
+ if (previous) {
23
+ const duplicateType = previous.suiteKey === suiteKey ? "同一套件重复" : "套件间";
24
+ console.warn(`${duplicateType}注册上下文扩展 ${methodName}:${previous.suiteKey} 将被 ${suiteKey} 覆盖`);
25
+ }
26
+ this.extensions.set(methodName, {
27
+ suiteKey,
28
+ method
29
+ });
30
+ });
31
+ }
32
+ /**
33
+ * 将已注册扩展挂载到指定上下文。
34
+ *
35
+ * @param context 当前页面上下文
36
+ */
37
+ apply(context) {
38
+ ContextExtensionRegistry.extensions.forEach(({ suiteKey, method }, methodName) => {
39
+ if (this.isReservedKey(context, methodName)) {
40
+ console.error(`套件 ${suiteKey} 的上下文扩展 ${methodName} 与内置上下文方法冲突,已跳过挂载`);
41
+ return;
42
+ }
43
+ context[methodName] = (...args) => method(context, ...args);
44
+ });
45
+ }
46
+ /**
47
+ * 判断方法名是否为当前层级的内置上下文方法。
48
+ *
49
+ * @param context 当前页面上下文
50
+ * @param methodName 上下文方法名
51
+ * @returns 是否为保留方法
52
+ */
53
+ isReservedKey(context, methodName) {
54
+ return methodName in context;
55
+ }
56
+ };
57
+ /**
58
+ * 注册套件上下文扩展。
59
+ *
60
+ * @param suiteKey 套件标识
61
+ * @param methods 扩展方法映射
62
+ */
63
+ function registerContextExtension(suiteKey, methods) {
64
+ ContextExtensionRegistry.register(suiteKey, methods);
65
+ }
66
+ //#endregion
67
+ export { ContextExtensionRegistry, registerContextExtension };
@@ -1,5 +1,6 @@
1
1
  export { Globals, pageGlobaVariables, globalVarCaches, formMap, setFormData, pageDataforJson, getPageTitle, getPremission, PageTypeEnum, } from './utils/runGlobalByPage';
2
2
  export { Events, Context, GctComponent, type ModalInstance } from './baseEvent';
3
+ export { ContextExtensionRegistry, registerContextExtension, type ContextExtension, type ContextExtensionMethods, } from './context-extension-registry';
3
4
  export * from './eventType';
4
5
  export * from './Dependency/useDependencyToShow';
5
6
  export * from './Dependency/useDependency';
@@ -1,6 +1,7 @@
1
1
  import "./utils/appRedis.mjs";
2
2
  import "./utils/runGlobalByPage.mjs";
3
3
  import "./baseEvent.mjs";
4
+ import "./context-extension-registry.mjs";
4
5
  import "./eventType.mjs";
5
6
  import "./Dependency/controller.mjs";
6
7
  import "./Dependency/displayRule.mjs";
@@ -125,6 +125,9 @@ export declare const pageDataforJson: import('vue').Ref<{
125
125
  title?: string | undefined;
126
126
  } | undefined;
127
127
  hasFooter?: boolean | undefined;
128
+ unitType?: "px" | "%" | undefined;
129
+ pageWidth?: number | undefined;
130
+ independentDetailPage?: boolean | undefined;
128
131
  } | undefined;
129
132
  pageName?: string | undefined;
130
133
  }, {
@@ -238,6 +241,9 @@ export declare const pageDataforJson: import('vue').Ref<{
238
241
  title?: string | undefined;
239
242
  } | undefined;
240
243
  hasFooter?: boolean | undefined;
244
+ unitType?: "px" | "%" | undefined;
245
+ pageWidth?: number | undefined;
246
+ independentDetailPage?: boolean | undefined;
241
247
  } | undefined;
242
248
  pageName?: string | undefined;
243
249
  } | {
@@ -322,6 +328,16 @@ export declare class Globals {
322
328
  data: RuntimePageJson;
323
329
  name: string | undefined;
324
330
  }>;
331
+ static initTxnPageByid(id: string, isDetail?: boolean): Promise<{
332
+ res: import('@gct-paas/api/apaas').TransactionResponse;
333
+ data: RuntimePageJson;
334
+ name: string | undefined;
335
+ }>;
336
+ static initDetailPageById(id: string): Promise<{
337
+ res: import('@gct-paas/api/apaas').DetailPageResponse;
338
+ data: RuntimePageJson;
339
+ name: string | undefined;
340
+ }>;
325
341
  static initHistoryByid(id: string): Promise<{
326
342
  res: import('@gct-paas/api/apaas').PageDesignerLogResponse;
327
343
  data: any;
@@ -14,9 +14,16 @@ var PageTypeEnum = /* @__PURE__ */ function(PageTypeEnum) {
14
14
  return PageTypeEnum;
15
15
  }({});
16
16
  var getPageApiByMap = {
17
- [PageTypeEnum.WEB]: { getPageInfo: _gct.api.apaas.webpage.getInfo },
17
+ [PageTypeEnum.WEB]: {
18
+ getPageInfo: _gct.api.apaas.webpage.getInfo,
19
+ getTxnPageInfo: _gct.api.apaas.transaction.getGetVersionById,
20
+ getDetailPageInfo: _gct.api.apaas.detailPage.getInfo
21
+ },
18
22
  [PageTypeEnum.MOBILE]: { getPageInfo: _gct.api.apaas.mobilePage.getInfo },
19
- [PageTypeEnum.PAD]: { getPageInfo: _gct.api.apaas.padPage.getInfo }
23
+ [PageTypeEnum.PAD]: {
24
+ getPageInfo: _gct.api.apaas.padPage.getInfo,
25
+ getTxnPageInfo: _gct.api.apaas.transaction.getGetVersionById
26
+ }
20
27
  };
21
28
  var pageGlobaVariables = ref({});
22
29
  /**app全局变量 */
@@ -235,6 +242,43 @@ var Globals = class Globals {
235
242
  name
236
243
  };
237
244
  }
245
+ static async initTxnPageByid(id, isDetail = false) {
246
+ this.pageID = id;
247
+ const getJSon = getPageApiByMap[PageTypeEnum.WEB].getTxnPageInfo;
248
+ const res = await getJSon({ id });
249
+ const { runtimeJson: createJson, detailRuntimeJson: detailJson, name } = res || {};
250
+ const runtimeJson = isDetail ? detailJson : createJson;
251
+ pageDataforJson.value.pageName = name;
252
+ if (!runtimeJson) return Promise.reject();
253
+ const data = JSON.parse(runtimeJson);
254
+ if (!data.widgets.filter((item) => item.type !== "bottom-button-container").length) return Promise.reject();
255
+ await this.initGlobalS(data);
256
+ pageDataforJson.value.pageConfig = data.pageConfig || {};
257
+ pageDataforJson.value.pageStyle = data.pageStyle || {};
258
+ return {
259
+ res,
260
+ data,
261
+ name
262
+ };
263
+ }
264
+ static async initDetailPageById(id) {
265
+ this.pageID = id;
266
+ const getJSon = getPageApiByMap[PageTypeEnum.WEB].getDetailPageInfo;
267
+ const res = await getJSon({ id });
268
+ const { runtimeJson, name } = res || {};
269
+ pageDataforJson.value.pageName = name;
270
+ if (!runtimeJson) return Promise.reject();
271
+ const data = JSON.parse(runtimeJson);
272
+ if (!data.widgets.filter((item) => item.type !== "bottom-button-container").length) return Promise.reject();
273
+ await this.initGlobalS(data);
274
+ pageDataforJson.value.pageConfig = data.pageConfig || {};
275
+ pageDataforJson.value.pageStyle = data.pageStyle || {};
276
+ return {
277
+ res,
278
+ data,
279
+ name
280
+ };
281
+ }
238
282
  static async initHistoryByid(id) {
239
283
  this.pageID = id;
240
284
  const res = await _gct.api.apaas.pageDesignerLog.getInfo({ id });
package/es/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './providers';
8
8
  export * from './register';
9
9
  export * from './utils';
10
10
  export * from './modules/vue3-dnd';
11
+ export { renderSetupApp } from './setup-app';
11
12
  export declare function onInit(): void;
package/es/index.mjs CHANGED
@@ -31,8 +31,9 @@ import { is, isArray, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyStr,
31
31
  import { emptyValueDisplay } from "./utils/field-empty-value.mjs";
32
32
  import "./utils/index.mjs";
33
33
  import { Context, Events, GctComponent } from "./Event/baseEvent.mjs";
34
+ import { ContextExtensionRegistry, registerContextExtension } from "./Event/context-extension-registry.mjs";
34
35
  import { calculateDepResult, insetDep } from "./Event/Dependency/controller.mjs";
35
- import { useDisplayRuleColumnByStyles, useDisplayRuleOptions, useVisibileByRuleHook } from "./Event/Dependency/displayRule.mjs";
36
+ import { getOptionsByDisplayRule, useDisplayRuleColumnByStyles, useDisplayRuleOptions, useVisibileByRuleHook } from "./Event/Dependency/displayRule.mjs";
36
37
  import { dependencyToShow, dependencyToShowSync, tableWidgetByDept, tableWidgetToShow, useDependencyToShow, useDependencyToShowList } from "./Event/Dependency/useDependencyToShow.mjs";
37
38
  import { useDependency, useDependencyByRequired } from "./Event/Dependency/useDependency.mjs";
38
39
  import "./Event/index.mjs";
@@ -40,10 +41,17 @@ import { containerNodeProps, nodeEditorProps, nodeProps } from "./props/index.mj
40
41
  import { Vue3DndDraggableItem } from "./modules/vue3-dnd/components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.mjs";
41
42
  import { Vue3DndDraggable } from "./modules/vue3-dnd/components/vue3-dnd-draggable/vue3-dnd-draggable.mjs";
42
43
  import "./modules/vue3-dnd/index.mjs";
44
+ import { renderSetupApp } from "./setup-app.mjs";
43
45
  //#region src/index.ts
44
46
  function onInit() {
45
47
  if (!_gct.register.render) _gct.register.render = new RenderRegister();
46
48
  else console.warn("渲染注册已存在,可能存在重复注册问题,请检查是否有重复引入渲染包的情况");
49
+ if (!window._kit) Object.defineProperty(window, "_kit", {
50
+ value: {},
51
+ writable: false,
52
+ configurable: false
53
+ });
47
54
  }
55
+ onInit();
48
56
  //#endregion
49
- export { Context, ControllerType, DESIGN_DATA_KEY_TAG, DESIGN_TYPE, DateFormat, DateRangeMap, DatepickerRanges, DesignItemAttribute, DesignNodeType, DesignRender, DesignRenderViewPrefix, Events, FieldSchema, GctComponent, GlobaAppInfo, Globals, HandwritingPad_default as HandwritingPad, PageTypeEnum, RenderDesignEditor, RenderNodeRegister, RenderNodeType, RenderPluginPgkUtil, RenderRegister, Vue3DndDraggable, Vue3DndDraggableItem, addDataByForm, cacheAdapter, calculate, calculateDepResult, containerNodeProps, defaultValMap, dependencyToShow, dependencyToShowSync, emptyValueDisplay, formMap, getDefaultDate, getDisabledDate, getIExp, getIKeywordFieldKeys, getMobileDateRange, getPageTitle, getPremission, getQueryDateByKeyWord, getQuerySort, getRefInfoId, globalVarCaches, identify, initFieldWidgetRuntime, insetDep, is, isArray, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyStr, isFunction, isMap, isNull, isNullAndUnDef, isNullOrUnDef, isNumber, isObject, isPromise, isRegExp, isString, isUnDef, isUrl, isWindow, nodeEditorProps, nodeProps, onInit, pageDataforJson, pageGlobaVariables, schemaToStyle, setDataByForm, setFormData, tableWidgetByDept, tableWidgetToShow, transSelectData, transformData, transformDataToDict, transformPropsField, transformSourceData, useAsyncFileAttrs, useDependency, useDependencyByRequired, useDependencyToShow, useDependencyToShowList, useDesignRenderController, useDisplayRuleColumnByStyles, useDisplayRuleOptions, useGctSelect, useGetBodyBySearch, useQueryfilter, useStyle, useVisibileByRuleHook, widthRenderDesignEditorInstall };
57
+ export { Context, ContextExtensionRegistry, ControllerType, DESIGN_DATA_KEY_TAG, DESIGN_TYPE, DateFormat, DateRangeMap, DatepickerRanges, DesignItemAttribute, DesignNodeType, DesignRender, DesignRenderViewPrefix, Events, FieldSchema, GctComponent, GlobaAppInfo, Globals, HandwritingPad_default as HandwritingPad, PageTypeEnum, RenderDesignEditor, RenderNodeRegister, RenderNodeType, RenderPluginPgkUtil, RenderRegister, Vue3DndDraggable, Vue3DndDraggableItem, addDataByForm, cacheAdapter, calculate, calculateDepResult, containerNodeProps, defaultValMap, dependencyToShow, dependencyToShowSync, emptyValueDisplay, formMap, getDefaultDate, getDisabledDate, getIExp, getIKeywordFieldKeys, getMobileDateRange, getOptionsByDisplayRule, getPageTitle, getPremission, getQueryDateByKeyWord, getQuerySort, getRefInfoId, globalVarCaches, identify, initFieldWidgetRuntime, insetDep, is, isArray, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyStr, isFunction, isMap, isNull, isNullAndUnDef, isNullOrUnDef, isNumber, isObject, isPromise, isRegExp, isString, isUnDef, isUrl, isWindow, nodeEditorProps, nodeProps, onInit, pageDataforJson, pageGlobaVariables, registerContextExtension, renderSetupApp, schemaToStyle, setDataByForm, setFormData, tableWidgetByDept, tableWidgetToShow, transSelectData, transformData, transformDataToDict, transformPropsField, transformSourceData, useAsyncFileAttrs, useDependency, useDependencyByRequired, useDependencyToShow, useDependencyToShowList, useDesignRenderController, useDisplayRuleColumnByStyles, useDisplayRuleOptions, useGctSelect, useGetBodyBySearch, useQueryfilter, useStyle, useVisibileByRuleHook, widthRenderDesignEditorInstall };
@@ -0,0 +1,2 @@
1
+ /** 注册 render 包的 locale 多语言资源 */
2
+ export declare function registerRenderLocale(): void;
@@ -0,0 +1,13 @@
1
+ import { process_exports } from "./sys/process.mjs";
2
+ import { sys_exports } from "./sys.mjs";
3
+ //#region src/locale/auto-register.ts
4
+ var localeModules = /* @__PURE__ */ Object.assign({
5
+ "./sys/process.ts": process_exports,
6
+ "./sys.ts": sys_exports
7
+ });
8
+ /** 注册 render 包的 locale 多语言资源 */
9
+ function registerRenderLocale() {
10
+ _gct.i18nUtil.autoRegisterLocale(localeModules);
11
+ }
12
+ //#endregion
13
+ export { registerRenderLocale };
@@ -0,0 +1,10 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
2
+ //#region src/locale/sys/process.ts
3
+ var process_exports = /* @__PURE__ */ __exportAll({ default: () => process_default });
4
+ var process_default = {
5
+ pleaseInitiateTheProcessFirst: "未找到流程数据,请先发起流程",
6
+ processInstanceMismatch: "流程实例不匹配!",
7
+ element: { approval: "审批" }
8
+ };
9
+ //#endregion
10
+ export { process_exports };
@@ -0,0 +1,6 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
+ //#region src/locale/sys.ts
3
+ var sys_exports = /* @__PURE__ */ __exportAll({ default: () => sys_default });
4
+ var sys_default = { success: "成功" };
5
+ //#endregion
6
+ export { sys_exports };
@@ -0,0 +1,2 @@
1
+ import { App } from 'vue';
2
+ export declare function renderSetupApp(_app: App): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { registerRenderLocale } from "./locale/auto-register.mjs";
2
+ //#region src/setup-app.ts
3
+ async function renderSetupApp(_app) {
4
+ registerRenderLocale();
5
+ }
6
+ //#endregion
7
+ export { renderSetupApp };
@@ -5,3 +5,13 @@ declare module '@gct-paas/core' {
5
5
  render: RenderRegister;
6
6
  }
7
7
  }
8
+ declare global {
9
+ interface Window {
10
+ /**
11
+ * 套件全局方法
12
+ *
13
+ * @type {IObject}
14
+ */
15
+ _kit: IObject;
16
+ }
17
+ }
@@ -40,6 +40,7 @@ declare function MIN(...args: (number | '')[]): number | '';
40
40
  declare function SMALL(v: number[], n: number): number | undefined;
41
41
  declare function AVERAGE(...args: (number | '')[]): number | '';
42
42
  declare function ABS(v: number): number;
43
+ declare function MAXABS(...args: number[]): number | '';
43
44
  declare function MOD(v: number, n: number): number | string;
44
45
  declare function POWER(v: number, n: number): number;
45
46
  declare function SQRT(v: number): number;
@@ -74,4 +75,6 @@ declare function SUMSQ(...args: (string | '')[]): number | string;
74
75
  declare function COUNT(v: number[]): number | '';
75
76
  /**标准差函数 */
76
77
  declare function STDEV(...args: number[]): number | '';
77
- export { IF, ISEMPTY, ISNULL, ISUNDEFINED, AND, OR, EQ, NE, LE, LT, GE, GT, LEN, CONCAT, SUBSTRING, SUBSTR, UPPER, LOWER, TRIM, LTRIM, RTRIM, REPEAT, REPLACE, FINDSTR, SEARCHSTR, PARSENUMBER, SPLIT, SUM, ADD, REDUCE, MULTIPLICATION, DIVISION, FIXED, ROUND, ROUNDUP, MAX, LARGE, MIN, SMALL, AVERAGE, ABS, MOD, POWER, SQRT, GET, PUT, PUSH, HEADPUSH, TIMESTAMP2DATE, DATE2TIMESTAMP, DATEFORMAT, NOW, TODAY, YEAR, MONTH, DAY, HOUR, MINUTE, WEEKRANGE, LASTWEEKRANGE, MONTHRANGE, LASTMONTHRANGE, YEARRANGE, LASTYEARRANGE, QUARTER, LASTQUARTER, ISDATERANGE, ISTIMERANGE, TUPLE, SEQMAP, SUMSQ, COUNT, STDEV, };
78
+ /** RSQ函数 */
79
+ declare function RSQ(arr1: number[], arr2: number[]): number | '';
80
+ export { IF, ISEMPTY, ISNULL, ISUNDEFINED, AND, OR, EQ, NE, LE, LT, GE, GT, LEN, CONCAT, SUBSTRING, SUBSTR, UPPER, LOWER, TRIM, LTRIM, RTRIM, REPEAT, REPLACE, FINDSTR, SEARCHSTR, PARSENUMBER, SPLIT, SUM, ADD, REDUCE, MULTIPLICATION, DIVISION, FIXED, ROUND, ROUNDUP, MAX, LARGE, MIN, SMALL, AVERAGE, ABS, MAXABS, MOD, POWER, SQRT, GET, PUT, PUSH, HEADPUSH, TIMESTAMP2DATE, DATE2TIMESTAMP, DATEFORMAT, NOW, TODAY, YEAR, MONTH, DAY, HOUR, MINUTE, WEEKRANGE, LASTWEEKRANGE, MONTHRANGE, LASTMONTHRANGE, YEARRANGE, LASTYEARRANGE, QUARTER, LASTQUARTER, ISDATERANGE, ISTIMERANGE, TUPLE, SEQMAP, SUMSQ, COUNT, STDEV, RSQ, };
@@ -44,6 +44,7 @@ var methods_exports = /* @__PURE__ */ __exportAll({
44
44
  LT: () => LT,
45
45
  LTRIM: () => LTRIM,
46
46
  MAX: () => MAX,
47
+ MAXABS: () => MAXABS,
47
48
  MIN: () => MIN,
48
49
  MINUTE: () => MINUTE,
49
50
  MOD: () => MOD,
@@ -63,6 +64,7 @@ var methods_exports = /* @__PURE__ */ __exportAll({
63
64
  REPLACE: () => REPLACE,
64
65
  ROUND: () => ROUND,
65
66
  ROUNDUP: () => ROUNDUP,
67
+ RSQ: () => RSQ,
66
68
  RTRIM: () => RTRIM,
67
69
  SEARCHSTR: () => SEARCHSTR,
68
70
  SEQMAP: () => SEQMAP,
@@ -324,6 +326,12 @@ function ABS(v) {
324
326
  const fn = () => Math.abs.call(null, v);
325
327
  return fn();
326
328
  }
329
+ function MAXABS(...args) {
330
+ const v = args.flat().filter((i) => i !== null && i !== void 0);
331
+ if (!v.length) return "";
332
+ const fn = () => v.reduce((prev, current) => Math.abs(Number(current)) > Math.abs(Number(prev)) ? current : prev);
333
+ return fn();
334
+ }
327
335
  function MOD(v, n) {
328
336
  const fn = () => {
329
337
  if (v === 0) throw new Error("The second value should not be zero.");
@@ -564,6 +572,30 @@ function STDEV(...args) {
564
572
  }, 0) / (data.length - 1);
565
573
  return Math.sqrt(variance);
566
574
  }
575
+ /** RSQ函数 */
576
+ function RSQ(arr1, arr2) {
577
+ if (!Array.isArray(arr1) || !Array.isArray(arr2)) return "";
578
+ const y = arr1.map((v) => Number(v)).filter((v) => Number.isFinite(v));
579
+ const x = arr2.map((v) => Number(v)).filter((v) => Number.isFinite(v));
580
+ if (y.length <= 1 || x.length <= 1 || y.length !== x.length) return "";
581
+ const n = y.length;
582
+ const meanY = y.reduce((sum, val) => sum + val, 0) / n;
583
+ const meanX = x.reduce((sum, val) => sum + val, 0) / n;
584
+ let numerator = 0;
585
+ let denomY = 0;
586
+ let denomX = 0;
587
+ for (let i = 0; i < n; i++) {
588
+ const diffY = y[i] - meanY;
589
+ const diffX = x[i] - meanX;
590
+ numerator += diffX * diffY;
591
+ denomY += diffY * diffY;
592
+ denomX += diffX * diffX;
593
+ }
594
+ if (denomY === 0 || denomX === 0) return "";
595
+ const r = numerator / Math.sqrt(denomX * denomY);
596
+ const rsq = r * r;
597
+ return Math.min(Math.max(rsq, 0), 1);
598
+ }
567
599
  function plus(a, b) {
568
600
  const result = new BigNumberJS(a).plus(new BigNumberJS(b)).toNumber();
569
601
  if (isNaN(result)) return "";
@@ -19,7 +19,7 @@ async function getDataByModelType({ refOriginFieldType, modelKey, foreignFields,
19
19
  modelKey,
20
20
  bsKey: "rdoGetVersionByRefId",
21
21
  modelCategory: EntityModelCategoryEnum.ENTITY
22
- }, { foreignFields }, { refId: ids });
22
+ }, { refId: ids }, { foreignFields });
23
23
  return {
24
24
  data,
25
25
  dict
@@ -29,10 +29,10 @@ async function getDataByModelType({ refOriginFieldType, modelKey, foreignFields,
29
29
  modelKey,
30
30
  bsKey: "getOne",
31
31
  modelCategory: EntityModelCategoryEnum.ENTITY
32
- }, {
32
+ }, {}, {
33
33
  query: { "id_.eq": ids },
34
34
  foreignFields
35
- }, {});
35
+ });
36
36
  return {
37
37
  data,
38
38
  dict
@@ -73,15 +73,21 @@ function transSelectData(field, row = {}, dict = {}) {
73
73
  */
74
74
  function transformDataToDict(row = {}, dict = {}) {
75
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;
76
+ if (!dict || Object.keys(dict).length === 0) return data;
77
+ return Object.keys(data).reduce((total, currKey) => {
78
+ const rawVal = data[currKey];
79
+ const fieldDict = dict[currKey];
80
+ if (!fieldDict) {
81
+ total[currKey] = rawVal;
82
+ return total;
82
83
  }
84
+ if (rawVal === null || rawVal === void 0) {
85
+ total[currKey] = rawVal;
86
+ return total;
87
+ }
88
+ total[currKey] = String(rawVal).split(",").map((code) => fieldDict[code] ?? code).filter(Boolean).join(",");
83
89
  return total;
84
- }, {}) : data;
90
+ }, {});
85
91
  }
86
92
  //#endregion
87
93
  export { addDataByForm, setDataByForm, transSelectData, transformData, transformDataToDict, transformSourceData };
@@ -6,6 +6,12 @@ var isArrayOpe = [
6
6
  SEARCH_SERVICE.IN,
7
7
  SEARCH_SERVICE.NOTIN
8
8
  ];
9
+ /** 空字符串、空数组、区间两端皆空视为无查询值;保留 0 / false */
10
+ function isEmptySearchValue(value) {
11
+ if (value === null || value === void 0 || value === "") return true;
12
+ if (Array.isArray(value)) return value.length === 0 || value.every((v) => v === null || v === void 0 || v === "");
13
+ return false;
14
+ }
9
15
  /**查询组件body转化为算子 */
10
16
  function useGetBodyBySearch(formState, cacheColumns, expStr) {
11
17
  /**
@@ -20,7 +26,7 @@ function useGetBodyBySearch(formState, cacheColumns, expStr) {
20
26
  const field = i.props.fieldSearchKey || i.props.field;
21
27
  const ope = i.props.ope || [];
22
28
  let value = state[i.id];
23
- if (value !== null && value !== void 0 || i.props.useMore) ope.forEach((o) => {
29
+ if (!isEmptySearchValue(value) || i.props.useMore) ope.forEach((o) => {
24
30
  value = getMultipleChoiceToArray(value, o);
25
31
  const key = `${field}.${o}:${i.id}`, expkey = `${i.id}.${o}`;
26
32
  body[key] = i.props.useMore ? null : value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/render",
3
- "version": "0.1.6-dev.9",
3
+ "version": "6.0.0-dev.10",
4
4
  "type": "module",
5
5
  "description": "paas 平台网页端底包",
6
6
  "loader": "dist/loader.esm.min.js",
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "author": "gct",
33
33
  "dependencies": {
34
- "@gct-paas/api": "^0.1.6-dev.5",
34
+ "@gct-paas/api": "^6.0.0-dev.7",
35
35
  "@vueuse/core": "^14.1.0",
36
36
  "axios": "^1.13.2",
37
37
  "bignumber.js": "^10.0.2",
@@ -44,10 +44,10 @@
44
44
  "qx-util": "^0.4.8",
45
45
  "vue": "^3.5.30",
46
46
  "vue3-dnd": "^2.1.0",
47
- "@gct-paas/core-web": "0.1.6-dev.9",
48
- "@gct-paas/core": "0.1.6-dev.9",
49
- "@gct-paas/schema": "0.1.6-dev.9",
50
- "@gct-paas/scss": "0.1.6-dev.9"
47
+ "@gct-paas/core": "6.0.0-dev.10",
48
+ "@gct-paas/schema": "6.0.0-dev.10",
49
+ "@gct-paas/core-web": "6.0.0-dev.10",
50
+ "@gct-paas/scss": "6.0.0-dev.10"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/escodegen": "^0.0.10",
@@ -55,12 +55,12 @@
55
55
  "@types/estree": "^1.0.8"
56
56
  },
57
57
  "peerDependencies": {
58
- "@gct-paas/api": "^0.1.6-dev.5",
58
+ "@gct-paas/api": "^6.0.0-dev.7",
59
59
  "vue": ">=3",
60
- "@gct-paas/core": "0.1.6-dev.9",
61
- "@gct-paas/schema": "0.1.6-dev.9",
62
- "@gct-paas/core-web": "0.1.6-dev.9",
63
- "@gct-paas/scss": "0.1.6-dev.9"
60
+ "@gct-paas/core": "6.0.0-dev.10",
61
+ "@gct-paas/core-web": "6.0.0-dev.10",
62
+ "@gct-paas/schema": "6.0.0-dev.10",
63
+ "@gct-paas/scss": "6.0.0-dev.10"
64
64
  },
65
65
  "scripts": {
66
66
  "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",