super-page-runtime 2.1.15 → 2.1.17

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.
@@ -283,8 +283,10 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
283
283
  }
284
284
  function packageFormRules(pageContext, configure) {
285
285
  var _a, _b;
286
+ const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
286
287
  const isWorkflow = pageContext.workflowCode ? true : false;
287
288
  if (isWorkflow) {
289
+ console.log("packageFormRules-----prop=", prop, "--pageContext.fieldPermissionMap=", pageContext.fieldPermissionMap);
288
290
  if (configure.name !== "button-detail" && pageContext.fieldPermissionMap) {
289
291
  const allFields = pageContext.fieldPermissionMap.get("all_fields");
290
292
  if ((allFields == null ? void 0 : allFields["canEdit"]) === false && ((_a = configure.runtime) == null ? void 0 : _a.props)) {
@@ -298,7 +300,6 @@ function packageFormRules(pageContext, configure) {
298
300
  });
299
301
  }
300
302
  }
301
- const prop = configure.props && configure.props.base ? configure.props.base.prop : null;
302
303
  if (prop) {
303
304
  const propName = getFormPropName(prop);
304
305
  if (!pageContext.rules) {
@@ -312,12 +313,15 @@ function packageFormRules(pageContext, configure) {
312
313
  }
313
314
  if (configure.name !== "button-detail" && pageContext.fieldPermissionMap) {
314
315
  const propEditPermission = pageContext.fieldPermissionMap.get(propName);
316
+ console.log("packageFormRules-----prop=", prop, "--propEditPermission=", propEditPermission);
315
317
  if (propEditPermission) {
316
318
  if (propEditPermission["canEdit"] === false) {
317
319
  configure.runtime.props.state = "disabled";
318
320
  } else if (propEditPermission["canEdit"]) {
321
+ configure.runtime.props.state = "";
319
322
  configure.runtime.props.required = true;
320
323
  }
324
+ console.log("packageFormRules-----prop=", prop, "--configure.runtime.props=", configure.runtime.props);
321
325
  }
322
326
  }
323
327
  if ((_b = configure.props) == null ? void 0 : _b.customRuleEvents) {
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, createBlock, unref, createCommentVNode } from "vue";
1
+ import { defineComponent, ref, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, createBlock, unref, createCommentVNode } from "vue";
2
2
  import { setTableEvents, gridSelectRecord, gridSelectAllRecords, gridSelectionChange, cellClick, cellDblClick, rowClick, rowDblClick, headerClick } from "../../../../utils/events/event-util.js";
3
- import { setVariableValue, getVariableValue } from "../../../../utils/page-helper-util.js";
3
+ import { getVariableValue, setVariableValue } from "../../../../utils/page-helper-util.js";
4
4
  import { getModelFields, getDefaultValue } from "../../../../utils/page-init-util.js";
5
5
  import eventBus from "../../../../utils/eventBus.js";
6
6
  import { popupToPage } from "../../../../utils/table-utils.js";
@@ -31,6 +31,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
31
31
  const entity = props.pageContext.entity ? props.pageContext.entity : {};
32
32
  let dynamicFields = getModelFields(props.configure, prop);
33
33
  const listViewShowFlag = ref(false);
34
+ let componentKey = ref(0);
34
35
  const baseURL = window["$vueApp"].config.globalProperties.baseURL;
35
36
  const listViewOptions = ref({
36
37
  isSql: true,
@@ -58,14 +59,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
58
59
  listViewOptions.value.showPageArea = false;
59
60
  }
60
61
  const gridRef = ref(null);
62
+ onMounted(() => {
63
+ const tableUuid = configure.uuid;
64
+ const subTableWatchProps = pageContext.subTableWatchProps;
65
+ eventBus.$on("_refreshSubTable_" + tableUuid, (params) => {
66
+ console.log("-_refreshSubTable--tableUuid=", tableUuid, "params=", params);
67
+ const propName = params.propName;
68
+ if (subTableWatchProps && subTableWatchProps[tableUuid] && subTableWatchProps[tableUuid].length > 0) {
69
+ const mainFormProps = subTableWatchProps[tableUuid];
70
+ if (mainFormProps.indexOf(propName) >= 0) {
71
+ if (gridRef.value) {
72
+ changeInitializationSubTable();
73
+ }
74
+ }
75
+ }
76
+ });
77
+ eventBus.$on("_refreshSubTableHandle_" + tableUuid, (params) => {
78
+ console.log("-_refreshSubTableHandle_--tableUuid=", tableUuid, "params=", params);
79
+ changeInitializationSubTable();
80
+ });
81
+ eventBus.$on(
82
+ "_refreshChildData_" + tableUuid,
83
+ (gridData) => {
84
+ console.log("-_refreshChildData_--tableUuid=", tableUuid);
85
+ refreshChildTableData(gridData);
86
+ }
87
+ );
88
+ });
89
+ onUnmounted(() => {
90
+ const tableUuid = configure.uuid;
91
+ eventBus.$off("_refreshSubTable_" + tableUuid);
92
+ eventBus.$off("_refreshSubTableHandle_" + tableUuid);
93
+ eventBus.$off("_refreshChildData_" + tableUuid);
94
+ });
61
95
  function currencyListViewSetting(canRrefreshSubtableData) {
62
96
  if (canRrefreshSubtableData === void 0) {
63
97
  canRrefreshSubtableData = judgeInitializationSubTable();
64
98
  }
99
+ listViewOptions.value["isPageInfo"] = false;
65
100
  listViewOptions.value["isFormSubTable"] = true;
66
101
  listViewOptions.value["canRrefreshSubtableData"] = canRrefreshSubtableData;
67
102
  listViewOptions.value["getFormData"] = getParentFormData;
68
103
  listViewOptions.value["getGridData"] = getGridData;
104
+ listViewOptions.value.extraParam["subTableListViewCode"] = listCode;
105
+ listViewOptions.value.extraParam["subtableSetting"] = configure.props && configure.props.otherSettings ? JSON.stringify(configure.props.otherSettings) : null;
106
+ listViewOptions.value.extraParam["additionalParamMap"] = additionalParamMap;
107
+ listViewOptions.value.extraParam["entityMap"] = pageContext.entity.data;
108
+ listViewOptions.value.extraParam["contextMap"] = pageContext.entity.context;
109
+ listViewOptions.value.extraParam["taskMap"] = pageContext.entity.task;
69
110
  if (!(configure.props && configure.props.base && configure.props.base.showOperation)) {
70
111
  let hiddenColumns = listViewOptions.value.hiddenColumns;
71
112
  if (!hiddenColumns) {
@@ -127,20 +168,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
127
168
  function getGridData() {
128
169
  return getVariableValue(entity, dynamicFields);
129
170
  }
171
+ function initializationSubTable() {
172
+ const canRrefreshSubtableData = judgeInitializationSubTable();
173
+ if (canRrefreshSubtableData) {
174
+ changeInitializationSubTable(canRrefreshSubtableData);
175
+ } else {
176
+ currencyListViewSetting(canRrefreshSubtableData);
177
+ listViewOptions.value["isPageInfo"] = false;
178
+ listViewOptions.value["subTableData"] = getValue();
179
+ setGridDataEventOptions();
180
+ }
181
+ }
130
182
  function changeInitializationSubTable(canRrefreshSubtableData) {
131
183
  currencyListViewSetting(canRrefreshSubtableData);
132
- listViewOptions.value["isPageInfo"] = false;
133
- listViewOptions.value["subTableData"] = getValue();
134
- listViewOptions.value.extraParam["subTableListViewCode"] = listCode;
135
- listViewOptions.value.extraParam["subtableSetting"] = configure.props && configure.props.otherSettings ? JSON.stringify(configure.props.otherSettings) : null;
136
- listViewOptions.value.extraParam["additionalParamMap"] = additionalParamMap;
137
- listViewOptions.value.extraParam["entityMap"] = pageContext.entity.data;
138
- listViewOptions.value.extraParam["contextMap"] = pageContext.entity.context;
139
- listViewOptions.value.extraParam["taskMap"] = pageContext.entity.task;
184
+ listViewOptions.value["subTableData"] = null;
140
185
  setGridDataEventOptions();
141
186
  listViewShowFlag.value = false;
142
187
  setTimeout(() => {
143
188
  listViewShowFlag.value = true;
189
+ componentKey.value = componentKey.value + 1;
144
190
  setGridToStore();
145
191
  }, 10);
146
192
  }
@@ -189,7 +235,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
189
235
  if (!pageContext.tableUuids) {
190
236
  pageContext.tableUuids = [];
191
237
  }
192
- pageContext.tableUuids.push(configure.uuid);
238
+ if (pageContext.tableUuids.indexOf(configure.uuid) < 0) {
239
+ pageContext.tableUuids.push(configure.uuid);
240
+ }
193
241
  }
194
242
  function getOperations() {
195
243
  let operations = [];
@@ -224,7 +272,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
224
272
  }
225
273
  return operations;
226
274
  }
227
- changeInitializationSubTable();
275
+ initializationSubTable();
228
276
  function getEntityId(row) {
229
277
  if (row && row.id) {
230
278
  return row.id;
@@ -427,6 +475,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
427
475
  function setValue(value) {
428
476
  return setVariableValue(entity, dynamicFields, value);
429
477
  }
478
+ function refreshChildTableData(gridData) {
479
+ setValue(gridData);
480
+ setTimeout(() => {
481
+ if (gridRef.value) {
482
+ gridRef.value.refreshChildData(listCode, gridData, configure.props && configure.props.base && configure.props.base.subPaging === true);
483
+ listViewOptions.value.extraParam["entityMap"] = pageContext.entity.data;
484
+ }
485
+ }, 10);
486
+ }
430
487
  __expose({
431
488
  createRow,
432
489
  getSelections,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",