super-page-runtime 2.0.69 → 2.0.72

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.
@@ -9,7 +9,7 @@ import axios from "axios";
9
9
  import { getTableUuid, doAfterClickEvent, handleEvent } from "./event-util.js";
10
10
  import { setStoreInfo } from "../store-util.js";
11
11
  import { refreshPage } from "../api/api-util.js";
12
- import { getPermissionCodes, getModelFields } from "../page-init-util.js";
12
+ import { getPermissionCodes, getDefaultValue, getModelFields } from "../page-init-util.js";
13
13
  import { updateChartDatasources, getVariableValue, setVariableValue } from "../page-helper-util.js";
14
14
  import printLabelUtil from "./print-label.js";
15
15
  import { getTableNameByTableUuid } from "../table-utils.js";
@@ -1615,7 +1615,8 @@ function lineEditCreateFunc(params) {
1615
1615
  const tableUuid = params["tableUuid"];
1616
1616
  const gridRef = getComponentRef(pageContext, tableUuid);
1617
1617
  if (gridRef) {
1618
- gridRef.createRow(params);
1618
+ params.getDefaultValueFunc = getDefaultValue;
1619
+ gridRef.createRow(params.listCode, {}, params);
1619
1620
  }
1620
1621
  }
1621
1622
  function printLabel(params) {
@@ -24,6 +24,7 @@ export declare function getModelFields(pageContext: PageContext, formItemConfigu
24
24
  * @param formItemConfigure 表单元素配置参数
25
25
  */
26
26
  export declare function getFormModelFields(pageContext: PageContext, formItemConfigure: any, prop?: string): string[];
27
+ export declare function getDefaultValue(pageContext: PageContext, defaultValueSet: any, componentType: string, multiple: boolean): any;
27
28
  /**
28
29
  * 获取组件的权限编码
29
30
  * @param configure
@@ -2,7 +2,7 @@ import http from "agilebuilder-ui/src/utils/request";
2
2
  import { useRoute } from "vue-router";
3
3
  import { getAdditionalParamMap } from "./events/standard-event.js";
4
4
  import { PageDimensions } from "./interfaces/page-design-types.js";
5
- import { formatVariableValue, setVariableValue, getFormPropName } from "./page-helper-util.js";
5
+ import { formatVariableValue, getFormPropName, setVariableValue } from "./page-helper-util.js";
6
6
  import { getSessionCache } from "agilebuilder-ui/src/utils/auth";
7
7
  function queryPageDesignByCode(pageCode) {
8
8
  return http.get(
@@ -156,29 +156,43 @@ function getModelFields(pageContext, formItemConfigure, prop) {
156
156
  function getFormModelFields(pageContext, formItemConfigure, prop) {
157
157
  const fields = getModelFields(pageContext, formItemConfigure, prop);
158
158
  const entity = pageContext.entity;
159
- let propsBase;
160
- if (formItemConfigure) {
161
- propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
162
- }
163
159
  if (entity.data.ID == void 0 && entity.data.id == void 0) {
164
- if (propsBase && propsBase.defaultValue) {
165
- let defaultValue = formatVariableValue(pageContext, propsBase.defaultValue);
166
- if (defaultValue != null && defaultValue != void 0) {
167
- let isMultiple = false;
168
- if (formItemConfigure.name == "checkbox") {
169
- isMultiple = true;
170
- } else if (formItemConfigure.name == "select") {
171
- isMultiple = propsBase.multiple;
172
- }
173
- if (isMultiple) {
174
- defaultValue = (defaultValue + "").split(",");
175
- }
176
- }
160
+ let propsBase;
161
+ let componentType;
162
+ let multiple = false;
163
+ if (formItemConfigure) {
164
+ propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
165
+ componentType = formItemConfigure.name;
166
+ multiple = propsBase.multiple;
167
+ }
168
+ const defaultValueSet = propsBase ? propsBase.defaultValue : null;
169
+ let defaultValue = getDefaultValue(pageContext, defaultValueSet, componentType, multiple);
170
+ if (defaultValue !== void 0 && defaultValue !== null) {
177
171
  setVariableValue(entity, fields, defaultValue);
178
172
  }
179
173
  }
180
174
  return fields;
181
175
  }
176
+ function getDefaultValue(pageContext, defaultValueSet, componentType, multiple) {
177
+ let defaultValue;
178
+ console.log("pageRuntime11---getDefaultValue---defaultValueSet---", defaultValueSet, "pageContext=", pageContext);
179
+ if (defaultValueSet) {
180
+ defaultValue = formatVariableValue(pageContext, defaultValueSet);
181
+ console.log("pageRuntime22---getDefaultValue---defaultValue---", defaultValue);
182
+ if (defaultValue != null && defaultValue != void 0 && componentType) {
183
+ let isMultiple = false;
184
+ if (componentType == "checkbox") {
185
+ isMultiple = true;
186
+ } else if (componentType == "select") {
187
+ isMultiple = multiple;
188
+ }
189
+ if (isMultiple) {
190
+ defaultValue = (defaultValue + "").split(",");
191
+ }
192
+ }
193
+ }
194
+ return defaultValue;
195
+ }
182
196
  function getPermissionCodes(configure, pageContext) {
183
197
  if (!pageContext || !configure || pageContext.isTest) {
184
198
  return "true";
@@ -278,6 +292,7 @@ function packageFormRules(pageContext, configure) {
278
292
  }
279
293
  export {
280
294
  convertToPageContext,
295
+ getDefaultValue,
281
296
  getFormModelFields,
282
297
  getModelFields,
283
298
  getPermissionCodes,
@@ -6,7 +6,7 @@ import { getAdditionalParamMap, getSaveFormRequestWithRow, standardEvents } from
6
6
  import { isPromise } from "agilebuilder-ui/src/utils/common-util";
7
7
  import { getDataTypeMapRequest, popupToPage } from "../../../../utils/table-utils.js";
8
8
  import eventBus from "../../../../utils/eventBus.js";
9
- import { getPermissionCodes } from "../../../../utils/page-init-util.js";
9
+ import { getPermissionCodes, getDefaultValue } from "../../../../utils/page-init-util.js";
10
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
11
11
  __name: "main-table-runtime",
12
12
  props: {
@@ -618,7 +618,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
618
618
  return gridRef.value.refresh();
619
619
  }
620
620
  function createRow() {
621
- return gridRef.value.createRow(listCode);
621
+ return gridRef.value.createRow(listCode, {}, { getDefaultValueFunc: getDefaultValue });
622
622
  }
623
623
  function getSelections() {
624
624
  return selections.value;
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, 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
3
  import { setVariableValue, getVariableValue } from "../../../../utils/page-helper-util.js";
4
- import { getModelFields } from "../../../../utils/page-init-util.js";
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";
7
7
  import { getListCode } from "../../../../utils/common-util.js";
@@ -278,7 +278,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
278
278
  return canDelete;
279
279
  }
280
280
  function addSubTableData(originalValue, formatValue, row, column, rowIndex) {
281
- gridRef.value.createRow(listCode);
281
+ gridRef.value.createRow(listCode, {}, { getDefaultValueFunc: getDefaultValue });
282
282
  }
283
283
  function removeSubTableData(originalValue, formatValue, row, column, rowIndex) {
284
284
  gridRef.value.deleteRow(rowIndex, listCode, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.0.69",
3
+ "version": "2.0.72",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",
@@ -48,7 +48,7 @@
48
48
  "@vitejs/plugin-vue-jsx": "^3.1.0",
49
49
  "@vue/eslint-config-prettier": "^8.0.0",
50
50
  "@vue/test-utils": "^2.4.4",
51
- "agilebuilder-ui": "1.0.50",
51
+ "agilebuilder-ui": "1.0.51",
52
52
  "axios": "^1.6.8",
53
53
  "cypress": "^13.6.6",
54
54
  "element-plus": "^2.6.1",