super-page-runtime 2.0.35 → 2.0.39

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.
@@ -1,16 +1,18 @@
1
+ import { PageContext } from '../interfaces/page-design-types';
2
+
1
3
  /**
2
4
  * 设值自定义校验规则。推荐在按钮的beforeValidateForm事件中调用该方法。
3
5
  * @param params 事件中的params参数
4
6
  * @param customRules 自定义的校验规则
5
7
  */
6
- export declare function setCustomRules(pageContext: any, customRules: any): void;
8
+ export declare function setCustomRules(pageContext: PageContext, customRules: any): void;
7
9
  /**
8
10
  * 刷新页面
9
11
  * @param pageContext
10
12
  */
11
- export declare function refreshPage(pageContext: any): void;
13
+ export declare function refreshPage(pageContext: PageContext): void;
12
14
  /**
13
15
  * 获得表单数据
14
16
  * @param pageContext
15
17
  */
16
- export declare function getFormData(pageContext: any): Promise<unknown>;
18
+ export declare function getFormData(pageContext: PageContext): Promise<unknown>;
@@ -1,4 +1,3 @@
1
- import { getSystemBackendUrl } from "agilebuilder-ui/src/utils/common-util";
2
1
  import { getSessionCache } from "agilebuilder-ui/src/utils/auth";
3
2
  import http from "agilebuilder-ui/src/utils/request";
4
3
  import { getBaseUrl, getListCode } from "../common-util.js";
@@ -37,7 +36,8 @@ function getCommonFormData(pageContext) {
37
36
  const ids = additionalParamMap ? additionalParamMap.ids : null;
38
37
  const taskId = additionalParamMap ? additionalParamMap.taskId : null;
39
38
  const permissionPrefix = pageCode;
40
- const backendUrl = getSystemBackendUrl(pageContext.backendUrl);
39
+ console.log("getCommonFormData-----pageContext=", pageContext);
40
+ const backendUrl = getBaseUrl(pageContext.backendUrl, pageContext.isTest);
41
41
  const param = {
42
42
  pageCode,
43
43
  pageVersion,
@@ -109,7 +109,7 @@ function getWorkflowFormData(pageContext) {
109
109
  const pageCode = pageContext.code;
110
110
  const pageVersion = pageContext.version;
111
111
  const additionalParamMap = getAdditionalParamMap(pageContext);
112
- const dataId = additionalParamMap && additionalParamMap.id ? additionalParamMap.id : 25;
112
+ const dataId = additionalParamMap && additionalParamMap.id ? additionalParamMap.id : null;
113
113
  const ids = additionalParamMap ? additionalParamMap.ids : null;
114
114
  const taskId = additionalParamMap ? additionalParamMap.taskId : null;
115
115
  const permissionPrefix = pageCode;
@@ -135,7 +135,7 @@ function getWorkflowFormData(pageContext) {
135
135
  param["ids"] = formatAdditionalParamMapIds(ids);
136
136
  }
137
137
  if (taskId) {
138
- param["taskId"] = this.taskId;
138
+ param["taskId"] = taskId;
139
139
  } else if (dataId) {
140
140
  param["id"] = dataId;
141
141
  } else {
@@ -152,7 +152,7 @@ function getWorkflowFormData(pageContext) {
152
152
  if (pageContext.beanName) {
153
153
  param["beanName"] = pageContext.beanName;
154
154
  }
155
- const baseUrl = getBaseUrl(pageContext.backendUrl);
155
+ const baseUrl = getBaseUrl(pageContext.backendUrl, pageContext.isTest);
156
156
  const urlForView = baseUrl + "/dsc/workflow-commons/gets";
157
157
  http.post(urlForView, param).then((commonEntity) => {
158
158
  pageContext.definitionId = commonEntity.definitionId;
@@ -1,5 +1,5 @@
1
1
  export declare function isArrayFn(value: any): boolean;
2
- export declare function getBaseUrl(backendUrl: any): any;
2
+ export declare function getBaseUrl(backendUrl: any, isTest?: boolean): any;
3
3
  export declare function getRealRestApiPath(orgRestApiPath: any, systemCode: any, backendUrl: any): any;
4
4
  /**
5
5
  * 封装模板文件列表
@@ -7,12 +7,16 @@ function isArrayFn(value) {
7
7
  return Object.prototype.toString.call(value) === "[object Array]";
8
8
  }
9
9
  }
10
- function getBaseUrl(backendUrl) {
11
- let baseUrl = window["$vueApp"].config.globalProperties.baseURL;
12
- if (backendUrl) {
13
- baseUrl = getSystemBackendUrl(backendUrl);
10
+ function getBaseUrl(backendUrl, isTest) {
11
+ if (isTest) {
12
+ return backendUrl;
13
+ } else {
14
+ let baseUrl = window["$vueApp"].config.globalProperties.baseURL;
15
+ if (backendUrl) {
16
+ baseUrl = getSystemBackendUrl(backendUrl);
17
+ }
18
+ return baseUrl;
14
19
  }
15
- return baseUrl;
16
20
  }
17
21
  function getRealRestApiPath(orgRestApiPath, systemCode, backendUrl) {
18
22
  let path = orgRestApiPath;
@@ -181,17 +181,13 @@ function buttonClickEvent(pageContext, configure, eventParams) {
181
181
  }
182
182
  function doValidateForm(pageContext, configure, eventParams) {
183
183
  const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
184
- let isEnableRequired;
185
184
  const clickEventFunObj = getClickEventFuncByType(pageContext, events, "click");
186
185
  if (clickEventFunObj) {
187
186
  const isStandardEvent = clickEventFunObj.isStandard;
188
187
  const event = clickEventFunObj.event;
189
- const isNotNeedValidate = isNotNeedValidateRequired(isStandardEvent, event);
190
- if (isNotNeedValidate) {
191
- isEnableRequired = false;
192
- }
188
+ isNotNeedValidateRequired(isStandardEvent, event);
193
189
  }
194
- validateDataModelFunc(pageContext, configure, isEnableRequired).then(() => {
190
+ validateDataModelFunc(pageContext, configure, true).then(() => {
195
191
  const beforeClickResult = doBeforeClickEvent(pageContext, configure, eventParams);
196
192
  if (!beforeClickResult) {
197
193
  return;
@@ -200,7 +200,7 @@ function validateWorkflowFormDataModel(dataModel, pageContext) {
200
200
  const subTablePageInfo = pageContext.subTablePageInfo;
201
201
  let result = false;
202
202
  const handleModels = JSON.parse(JSON.stringify(dataModel));
203
- const rules = pageContext.workflowRules;
203
+ const rules = pageContext.rules;
204
204
  if (!rules) {
205
205
  result = true;
206
206
  } else {
@@ -52,7 +52,6 @@ function analysisScanValue(scanValue, scanRuleSets) {
52
52
  if (!scanValue) {
53
53
  return null;
54
54
  }
55
- debugger;
56
55
  const scanSets = Object.values(scanRuleSets);
57
56
  for (let i = 0; i < scanSets.length; i++) {
58
57
  const scanSet = scanSets[i];
@@ -22,7 +22,7 @@ function convertToPageContext(pageDesign, pageRequest) {
22
22
  systemCode: pageDesign.systemCode,
23
23
  systemVersion: pageDesign.systemVersion,
24
24
  backendUrl: pageDesign.backendUrl,
25
- rules: [],
25
+ rules: {},
26
26
  // rules: pageDesign.rules, // 表单验证规则。在runtime object-render中实时获得
27
27
  tableUuids: pageDesign.tableUuids,
28
28
  // 表格uuid集合
@@ -217,8 +217,15 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
217
217
  );
218
218
  }
219
219
  function packageFormRules(pageContext, configure) {
220
+ var _a;
220
221
  const isWorkflow = pageContext.workflowCode ? true : false;
221
222
  if (isWorkflow) {
223
+ if (configure.name !== "button-detail" && pageContext.fieldPermissionMap) {
224
+ const allFields = pageContext.fieldPermissionMap.get("all_fields");
225
+ if ((allFields == null ? void 0 : allFields["canEdit"]) === false && ((_a = configure.runtime) == null ? void 0 : _a.props)) {
226
+ configure.runtime.props.state = "disabled";
227
+ }
228
+ }
222
229
  const requiredRules = configure.props && configure.props.rules ? configure.props.rules.filter((item) => item.required) : null;
223
230
  if (requiredRules && requiredRules.length > 0) {
224
231
  requiredRules.forEach((item) => {
@@ -236,6 +243,16 @@ function packageFormRules(pageContext, configure) {
236
243
  pageContext.rules[propName] = [];
237
244
  }
238
245
  pageContext.rules[propName] = configure.props.rules;
246
+ if (configure.name !== "button-detail" && pageContext.fieldPermissionMap) {
247
+ const propEditPermission = pageContext.fieldPermissionMap.get(propName);
248
+ if (propEditPermission) {
249
+ if (propEditPermission["canEdit"] === false) {
250
+ configure.runtime.props.state = "disabled";
251
+ } else if (propEditPermission["canEdit"]) {
252
+ configure.runtime.props.required = true;
253
+ }
254
+ }
255
+ }
239
256
  }
240
257
  }
241
258
  export {
@@ -315,12 +315,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
315
315
  }
316
316
  }
317
317
  function select(selection, row) {
318
- selections.value = selection;
319
- const params = {
320
- selection,
321
- row
322
- };
323
- gridSelectRecord(pageContext, configure, params);
318
+ if (row !== void 0) {
319
+ selections.value = selection;
320
+ const params = {
321
+ selection,
322
+ row
323
+ };
324
+ gridSelectRecord(pageContext, configure, params);
325
+ }
324
326
  }
325
327
  function selectAll(selection) {
326
328
  selections.value = selection;
@@ -0,0 +1,66 @@
1
+ import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, Fragment, createBlock, unref, isRef, createCommentVNode } from "vue";
2
+ import { formatVariableValue, setVariableValue, getVariableValue } from "../../../../utils/page-helper-util.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "title-suffix-element",
5
+ props: {
6
+ pageContext: {},
7
+ property: {}
8
+ },
9
+ setup(__props) {
10
+ const props = __props;
11
+ const entity = props.pageContext.entity;
12
+ let fields = [];
13
+ if (!props.property.prefixPro || !props.property.prefixPro.startsWith("${")) {
14
+ fields = [];
15
+ } else {
16
+ let propName = props.property.prefixPro;
17
+ propName = propName.substring(2, propName.length - 1);
18
+ fields = propName.split(".");
19
+ }
20
+ if (fields.length > 0 && props.property.prefixDefault) {
21
+ const prefixDefault = props.property.prefixDefault;
22
+ let defaultValue = formatVariableValue(props.pageContext, prefixDefault);
23
+ if (defaultValue != null && defaultValue != void 0) {
24
+ let isMultiple = props.property.prefixType === "checkbox";
25
+ if (isMultiple) {
26
+ defaultValue = (defaultValue + "").split(",");
27
+ }
28
+ setVariableValue(entity, fields, defaultValue);
29
+ }
30
+ }
31
+ let dynamicModelMethod = null;
32
+ if (fields.length > 0) {
33
+ dynamicModelMethod = computed({
34
+ get() {
35
+ return getVariableValue(entity, fields);
36
+ },
37
+ set(value) {
38
+ setVariableValue(entity, fields, value);
39
+ }
40
+ });
41
+ }
42
+ return (_ctx, _cache) => {
43
+ const _component_el_radio = resolveComponent("el-radio");
44
+ const _component_el_checkbox = resolveComponent("el-checkbox");
45
+ return openBlock(), createElementBlock(Fragment, null, [
46
+ _ctx.property.prefixType === "radio" ? (openBlock(), createBlock(_component_el_radio, {
47
+ key: 0,
48
+ value: _ctx.property.prefixValue,
49
+ label: _ctx.property.title,
50
+ modelValue: unref(dynamicModelMethod),
51
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(dynamicModelMethod) ? dynamicModelMethod.value = $event : dynamicModelMethod = $event)
52
+ }, null, 8, ["value", "label", "modelValue"])) : createCommentVNode("", true),
53
+ _ctx.property.prefixType === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox, {
54
+ key: 1,
55
+ label: _ctx.property.title,
56
+ value: _ctx.property.prefixValue,
57
+ modelValue: unref(dynamicModelMethod),
58
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(dynamicModelMethod) ? dynamicModelMethod.value = $event : dynamicModelMethod = $event)
59
+ }, null, 8, ["label", "value", "modelValue"])) : createCommentVNode("", true)
60
+ ], 64);
61
+ };
62
+ }
63
+ });
64
+ export {
65
+ _sfc_main as default
66
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./title-suffix-element.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -1,9 +1,10 @@
1
- import { defineComponent, computed, ref, watch, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode, createVNode, createSlots, createTextVNode } from "vue";
1
+ import { defineComponent, computed, ref, watch, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, createCommentVNode, createVNode, createSlots } from "vue";
2
2
  import { SuperIcon } from "agilebuilder-ui";
3
3
  import { getFormModelFields } from "../../../../utils/page-init-util.js";
4
4
  import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
5
5
  import { handleEvent } from "../../../../utils/events/event-util.js";
6
6
  import { formatScanRuleSets, analysisScanValue, setScanAnalysisValue } from "../../../../utils/form/scan-util.js";
7
+ import _sfc_main$1 from "../common/title-suffix-element.vue.js";
7
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
9
  __name: "inputtext-runtime",
9
10
  props: {
@@ -72,7 +73,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
72
73
  designProperty.value.tittleShow ? (openBlock(), createElementBlock("div", {
73
74
  key: 0,
74
75
  style: normalizeStyle({ ...unref(headerStyle) })
75
- }, toDisplayString(designProperty.value.title), 5)) : createCommentVNode("", true)
76
+ }, [
77
+ designProperty.value.prefixType ? (openBlock(), createBlock(_sfc_main$1, {
78
+ key: 0,
79
+ pageContext: _ctx.pageContext,
80
+ property: designProperty.value
81
+ }, null, 8, ["pageContext", "property"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
82
+ createTextVNode(toDisplayString(designProperty.value.title), 1)
83
+ ], 64))
84
+ ], 4)) : createCommentVNode("", true)
76
85
  ]),
77
86
  default: withCtx(() => [
78
87
  createVNode(_component_el_input, {
@@ -100,6 +100,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
100
100
  if (!thisRef.value || !thisRef.value.parentNode) {
101
101
  return;
102
102
  }
103
+ dynamicallyCalculatePosition();
104
+ });
105
+ const dynamicallyCalculatePosition = () => {
103
106
  const thisProps = props.configure.props ? props.configure.props : {};
104
107
  const thisStyle = props.configure.style ? props.configure.style : {};
105
108
  const position = thisProps.position;
@@ -131,7 +134,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
131
134
  }
132
135
  }
133
136
  }
134
- });
137
+ };
135
138
  return (_ctx, _cache) => {
136
139
  const _directive_permission = resolveDirective("permission");
137
140
  return withDirectives((openBlock(), createBlock(resolveDynamicComponent(dynamicComponent.value), {
@@ -15,9 +15,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15
15
  const workflowId = getWorkflowId(props.pageContext);
16
16
  if (props.pageContext.entity && props.pageContext.entity.task) {
17
17
  watch(
18
- () => props.pageContext.entity.task.id,
19
18
  () => {
20
- if (workflowId && historyList.value) {
19
+ var _a;
20
+ return (_a = props.pageContext.entity.task) == null ? void 0 : _a.id;
21
+ },
22
+ () => {
23
+ if (workflowId && historyList.value && props.pageContext.entity.task) {
21
24
  historyList.value.refresh();
22
25
  }
23
26
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.0.35",
3
+ "version": "2.0.39",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",