@byteluck-fe/model-driven-engine 2.3.1-beta.12 → 2.3.1-beta.16

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.
@@ -25,7 +25,7 @@ function _instanceof(left, right) {
25
25
  }
26
26
  import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
27
27
  import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
28
- import { loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
28
+ import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
29
29
  var Store = /*#__PURE__*/ function() {
30
30
  "use strict";
31
31
  function Store(props) {
@@ -57,7 +57,7 @@ var Store = /*#__PURE__*/ function() {
57
57
  // }
58
58
  } else {
59
59
  if (rowIndex !== undefined) {
60
- //TODO 目前只找了一层明细表,没有递归
60
+ //TODO 目前只找了一层明细表,没有递归 如果是添加uid
61
61
  Object.keys(this.controlIdMapping).map(function(subtableId) {
62
62
  var dataView = _this.controlIdMapping[subtableId].dataView;
63
63
  var children = _this.controlIdMapping[subtableId].children;
@@ -131,9 +131,16 @@ var Store = /*#__PURE__*/ function() {
131
131
  } else {
132
132
  var controlInfo = this.controlIdMapping[controlId];
133
133
  if (controlInfo !== undefined) {
134
- return this.emptyState[controlInfo.dataView][controlId];
134
+ var state = this.emptyState[controlInfo.dataView][controlId];
135
+ //判断找到的是否是明细表的控件
136
+ if ("children" in this.emptyState[controlInfo.dataView]) {
137
+ Object.assign(state, {
138
+ uid: "new:" + buildUUID("uid")
139
+ });
140
+ }
141
+ return state;
135
142
  } else {
136
- var state;
143
+ var state1;
137
144
  //TODO 目前只找了一层明细表,没有递归
138
145
  Object.keys(this.controlIdMapping).map(function(subtableId) {
139
146
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
@@ -141,12 +148,12 @@ var Store = /*#__PURE__*/ function() {
141
148
  if (children !== undefined) {
142
149
  Object.keys(children).map(function(childControlId) {
143
150
  if (childControlId === controlId) {
144
- state = _this.emptyState[dataViewId][subtableId][controlId];
151
+ state1 = _this.emptyState[dataViewId][subtableId][controlId];
145
152
  }
146
153
  });
147
154
  }
148
155
  });
149
- return state;
156
+ return state1;
150
157
  }
151
158
  }
152
159
  };
@@ -32,3 +32,12 @@ callback) {
32
32
  });
33
33
  }
34
34
  }
35
+ var unique = 0;
36
+ // uuid生成
37
+ export function buildUUID() {
38
+ var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
39
+ var time = Date.now();
40
+ var random = Math.floor(Math.random() * 1000000000);
41
+ unique++;
42
+ return prefix + "_" + random + unique + String(time);
43
+ }