@byteluck-fe/model-driven-engine 4.37.0-lx2 → 5.3.0-1-beta4

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.
Files changed (33) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +4 -4
  3. package/dist/esm/common/DataManager.js +1 -0
  4. package/dist/esm/common/Engine.js +121 -188
  5. package/dist/esm/common/Runtime.js +9 -5
  6. package/dist/esm/common/Store.js +15 -13
  7. package/dist/esm/common/checkerValue.js +1 -1
  8. package/dist/esm/common/proxyState.js +52 -45
  9. package/dist/esm/plugins/CalcPlugin.js +43 -43
  10. package/dist/esm/plugins/ControlsEventPlugin.js +11 -1
  11. package/dist/esm/plugins/StylePlugin.js +32 -10
  12. package/dist/esm/utils/runtimeUtils.js +2 -1
  13. package/dist/index.umd.js +40 -6
  14. package/dist/types/common/ActionManager.d.ts +14 -14
  15. package/dist/types/common/DataManager.d.ts +10 -10
  16. package/dist/types/common/Engine.d.ts +201 -209
  17. package/dist/types/common/OkWorker.d.ts +13 -13
  18. package/dist/types/common/Plugin.d.ts +6 -6
  19. package/dist/types/common/Runtime.d.ts +31 -31
  20. package/dist/types/common/Store.d.ts +54 -54
  21. package/dist/types/common/checkerValue.d.ts +3 -3
  22. package/dist/types/common/index.d.ts +2 -2
  23. package/dist/types/common/proxyState.d.ts +30 -33
  24. package/dist/types/index.d.ts +3 -3
  25. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  26. package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -15
  27. package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
  28. package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
  29. package/dist/types/plugins/StylePlugin.d.ts +13 -12
  30. package/dist/types/plugins/index.d.ts +5 -5
  31. package/dist/types/utils/index.d.ts +1 -1
  32. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  33. package/package.json +10 -6
@@ -68,10 +68,10 @@ var Store = /*#__PURE__*/ function() {
68
68
  }
69
69
  _create_class(Store, [
70
70
  {
71
- /**
72
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
73
- * @param controlId 组件ID
74
- * @param value
71
+ /**
72
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
73
+ * @param controlId 组件ID
74
+ * @param value
75
75
  */ key: "setState",
76
76
  value: function setState(controlId, value, rowIndex) {
77
77
  var _this = this;
@@ -366,15 +366,17 @@ item) {
366
366
  Object.keys(item.props.dataBind).map(function(key) {
367
367
  var dataBind = item.props.dataBind;
368
368
  var dataCode = dataBind[key].dataCode;
369
- data[dataCode].fields.push({
370
- fieldCode: dataBind[key].fieldCode,
371
- controlId: item.id,
372
- dataBind: dataBind,
373
- dataViewId: [
374
- dataViewId,
375
- subtableId
376
- ]
377
- });
369
+ if (dataBind[key].fieldCode !== '') {
370
+ data[dataCode].fields.push({
371
+ fieldCode: dataBind[key].fieldCode,
372
+ controlId: item.id,
373
+ dataBind: dataBind,
374
+ dataViewId: [
375
+ dataViewId,
376
+ subtableId
377
+ ]
378
+ });
379
+ }
378
380
  });
379
381
  } else {
380
382
  if (data[item.props.dataBind.dataCode] === undefined) {
@@ -530,7 +530,7 @@ var ValueCheckerFactory = /*#__PURE__*/ function() {
530
530
  case FieldTypes.VARCHAR:
531
531
  case FieldTypes.TIMESTAMP:
532
532
  case FieldTypes.TEXT:
533
- case FieldTypes.RELATION:
533
+ // case FieldTypes.RELATION:
534
534
  case FieldTypes.AUTO_NUMBER:
535
535
  checker = new StringValueChecker();
536
536
  break;
@@ -28,7 +28,7 @@ function _unsupported_iterable_to_array(o, minLen) {
28
28
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
29
29
  }
30
30
  var cc = console;
31
- import { error, logerror, JSONCopy } from '@byteluck-fe/model-driven-shared';
31
+ import { CONTROL_BASE_TYPE, error, logerror, JSONCopy } from '@byteluck-fe/model-driven-shared';
32
32
  var proxyArrayApi = [
33
33
  'splice',
34
34
  'push',
@@ -105,11 +105,11 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
105
105
  }
106
106
  }
107
107
  }
108
- /**
109
- * 返回proxy操作对象
110
- * @param thisKey 当前对象在上级中的key
111
- * @param callback 需要在修改的时候,触发的回调函数
112
- * @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
108
+ /**
109
+ * 返回proxy操作对象
110
+ * @param thisKey 当前对象在上级中的key
111
+ * @param callback 需要在修改的时候,触发的回调函数
112
+ * @param beforeSetCallback 需要在修改之前触发的回调函数,可以进行校验和对值的修改等等,最终的返回值不为undefined就会使用
113
113
  * */ function handler(thisKey, callback, beforeSetCallback) {
114
114
  return {
115
115
  __engineProxy__: true,
@@ -183,12 +183,12 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
183
183
  }
184
184
  };
185
185
  }
186
- /**
187
- * 代理state数据
188
- * @param state 数据对象
189
- * @param callback 触发set时候的回调函数
190
- * @param beforeSetCallback
191
- * @param prevKey 递归对象的key
186
+ /**
187
+ * 代理state数据
188
+ * @param state 数据对象
189
+ * @param callback 触发set时候的回调函数
190
+ * @param beforeSetCallback
191
+ * @param prevKey 递归对象的key
192
192
  * */ export function proxyState(state, callback, beforeSetCallback) {
193
193
  var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
194
194
  // 冻结的对象不需要再执行proxy,否则会报错
@@ -216,37 +216,44 @@ function flatInstanceForChildren(controls) {
216
216
  });
217
217
  return result;
218
218
  }
219
- /**
220
- * 在flatInstance中通过key查找出对应的instance
221
- * @param flatInstance 拍平的instance数组
222
- * @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
223
- * */ export function findItem(key, engine) {
224
- if (key === '') return {
225
- instance: undefined,
226
- rowIndex: undefined
227
- };
219
+ /**
220
+ * 在flatInstance中通过key查找出对应的instance
221
+ * @param flatInstance 拍平的instance数组
222
+ * @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
223
+ * */ export function findItem(flatInstance, key, instanceMap) {
224
+ if (key === '') return undefined;
228
225
  var keys = key.split('.');
229
- if (keys.length === 0) return {
230
- instance: undefined,
231
- rowIndex: undefined
232
- };
233
- var instanceIndex = keys.filter(function(item) {
234
- return !isNaN(item);
235
- }).at(-1);
236
- var findKeyIndex = instanceIndex ? keys.lastIndexOf(instanceIndex) : -1;
237
- var rowIndex;
238
- var controlId;
239
- if (findKeyIndex > -1) {
240
- rowIndex = Number(keys[findKeyIndex]);
241
- controlId = keys === null || keys === void 0 ? void 0 : keys[findKeyIndex + 1];
242
- } else {
243
- controlId = keys[1];
244
- }
245
- var proxyInstance = engine.getInstance(controlId, rowIndex);
246
- return {
247
- instance: proxyInstance,
248
- rowIndex: rowIndex
249
- };
226
+ if (keys.length === 0) return undefined;
227
+ var oneKey = keys[0];
228
+ var otherKeys = keys.slice(1);
229
+ // 3.4.1 优化速度,读取instanceMap
230
+ // cc.time('findItem flatInstance find')
231
+ // const initInstance = flatInstance.find((item) => item.id === oneKey)
232
+ // cc.log('🏠 findItem flatInstance find result', initInstance)
233
+ // cc.timeEnd('findItem flatInstance find')
234
+ // cc.time('findItem instanceMap match')
235
+ var initInstance = instanceMap[oneKey] ? instanceMap[oneKey][0] : undefined;
236
+ // cc.log('🏠 findItem instanceMap match result', initInstance)
237
+ // cc.timeEnd('findItem instanceMap match')
238
+ if (otherKeys.length === 0) return initInstance;
239
+ // @ts-ignore
240
+ return otherKeys.reduce(function(prevItem, key) {
241
+ var index = Number(key);
242
+ var isNotIndex = Number.isNaN(index);
243
+ if (isNotIndex && prevItem) {
244
+ var flatChildren = (prevItem === null || prevItem === void 0 ? void 0 : prevItem.children) ? flatInstanceForChildren(prevItem.children) : undefined;
245
+ var findEndItem = flatChildren === null || flatChildren === void 0 ? void 0 : flatChildren.find(function(item) {
246
+ return item.id === key;
247
+ });
248
+ // 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
249
+ return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
250
+ } else {
251
+ var _prevItem_children;
252
+ var _prevItem_children_index;
253
+ // 如果有children,则取children中对应的下标,没有的话一直返回prevItem
254
+ return (_prevItem_children_index = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem_children = prevItem.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _prevItem_children_index !== void 0 ? _prevItem_children_index : prevItem;
255
+ }
256
+ }, initInstance);
250
257
  }
251
258
  function getArrayNewValue(type, args) {
252
259
  if ([
@@ -269,9 +276,9 @@ function getArrayNewArgs(type, args, value) {
269
276
  return args.slice(0, 2).concat(value);
270
277
  }
271
278
  }
272
- /**
273
- * TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
274
- * 劫持数组api,达到操作数组api的时候,可以同步操作instance
279
+ /**
280
+ * TODO 数组劫持操作需要模仿vue3进行重构,不再直接劫持原生property
281
+ * 劫持数组api,达到操作数组api的时候,可以同步操作instance
275
282
  * */ function hijackArrayProperty() {
276
283
  proxyArrayApi.forEach(function(key) {
277
284
  var oldApiHandler = Array.prototype[key];
@@ -62,11 +62,11 @@ function _unsupported_iterable_to_array(o, minLen) {
62
62
  import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from '@byteluck-fe/model-driven-shared';
63
63
  import { format } from 'mathjs';
64
64
  var DisplayType = /*#__PURE__*/ function(DisplayType) {
65
- /**
66
- * 完全等于
65
+ /**
66
+ * 完全等于
67
67
  */ DisplayType["EQ"] = "EQ";
68
- /**
69
- * 包含
68
+ /**
69
+ * 包含
70
70
  * */ DisplayType["IN"] = "IN";
71
71
  return DisplayType;
72
72
  }(DisplayType || {});
@@ -76,16 +76,16 @@ export var CalcPlugin = /*#__PURE__*/ function() {
76
76
  _class_call_check(this, CalcPlugin);
77
77
  _define_property(this, "engine", void 0);
78
78
  _define_property(this, "options", void 0);
79
- /**
80
- * 所有的计算公式控件
79
+ /**
80
+ * 所有的计算公式控件
81
81
  * */ // @ts-ignore
82
82
  _define_property(this, "calcControls", []);
83
- /**
84
- * key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
85
- * 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
83
+ /**
84
+ * key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
85
+ * 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
86
86
  * */ _define_property(this, "dependenciesTriggerMap", new Map());
87
- /**
88
- * 隐藏以后需要被计算的控件
87
+ /**
88
+ * 隐藏以后需要被计算的控件
89
89
  * */ _define_property(this, "hideNotRememberControlIds", []);
90
90
  _define_property(this, "dontHasPermissionControlIds", []);
91
91
  _define_property(this, "cacheComputedResult", {});
@@ -96,8 +96,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
96
96
  _create_class(CalcPlugin, [
97
97
  {
98
98
  key: "getNeedHideRememberControlIds",
99
- value: /**
100
- * @description 获取显隐控制的需要被记住值的控件id
99
+ value: /**
100
+ * @description 获取显隐控制的需要被记住值的控件id
101
101
  * */ function getNeedHideRememberControlIds() {
102
102
  var _this_options;
103
103
  if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.displayBoList)) {
@@ -114,8 +114,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
114
114
  },
115
115
  {
116
116
  key: "getDontHasPermissionControlIds",
117
- value: /**
118
- * @description 获取权限控制的隐藏的字段,不需要参与计算
117
+ value: /**
118
+ * @description 获取权限控制的隐藏的字段,不需要参与计算
119
119
  * */ function getDontHasPermissionControlIds() {
120
120
  var _this_options;
121
121
  if (!((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.behavior)) {
@@ -131,9 +131,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
131
131
  },
132
132
  {
133
133
  key: "controlNeedComputedValue",
134
- value: /**
135
- * @description 判断控件是否需要被计算
136
- * @param control 控件
134
+ value: /**
135
+ * @description 判断控件是否需要被计算
136
+ * @param control 控件
137
137
  * */ function controlNeedComputedValue(control) {
138
138
  if (!control) {
139
139
  return false;
@@ -153,9 +153,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
153
153
  },
154
154
  {
155
155
  key: "getControlIsHide",
156
- value: /**
157
- * @description 获取控件是否被隐藏
158
- * @param control 控件
156
+ value: /**
157
+ * @description 获取控件是否被隐藏
158
+ * @param control 控件
159
159
  * */ function getControlIsHide(control) {
160
160
  if (control.props.isHide) {
161
161
  return true;
@@ -184,8 +184,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
184
184
  },
185
185
  {
186
186
  key: "resetDependencies",
187
- value: /**
188
- * @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
187
+ value: /**
188
+ * @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
189
189
  * */ function resetDependencies() {
190
190
  this.calcControls = [];
191
191
  this.dependenciesTriggerMap.clear();
@@ -195,8 +195,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
195
195
  },
196
196
  {
197
197
  key: "allCalcControlComputed",
198
- value: /**
199
- * @description 执行所有计算公式控件的计算
198
+ value: /**
199
+ * @description 执行所有计算公式控件的计算
200
200
  * */ function allCalcControlComputed() {
201
201
  var _this = this;
202
202
  this.calcControls.forEach(function(item) {
@@ -210,8 +210,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
210
210
  },
211
211
  {
212
212
  key: "getAllCalcControl",
213
- value: /**
214
- * @description 获取所有的计算公式控件
213
+ value: /**
214
+ * @description 获取所有的计算公式控件
215
215
  * */ function getAllCalcControl() {
216
216
  this.calcControls = this.engine.runtime.flatInstances.filter(// @ts-ignore
217
217
  function(item) {
@@ -221,8 +221,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
221
221
  },
222
222
  {
223
223
  key: "getCalcDependencies",
224
- value: /**
225
- * @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
224
+ value: /**
225
+ * @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
226
226
  * */ function getCalcDependencies() {
227
227
  var _this = this;
228
228
  this.calcControls.forEach(function(item) {
@@ -274,8 +274,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
274
274
  },
275
275
  {
276
276
  key: "watchSchemaHideChange",
277
- value: /**
278
- * @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
277
+ value: /**
278
+ * @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
279
279
  * */ function watchSchemaHideChange() {
280
280
  var _this = this;
281
281
  this.engine.on('schema-change', function(payload) {
@@ -291,8 +291,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
291
291
  },
292
292
  {
293
293
  key: "watchSubtableChange",
294
- value: /**
295
- * @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
294
+ value: /**
295
+ * @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
296
296
  * */ function watchSubtableChange() {
297
297
  var _this = this;
298
298
  this.engine.on('list-change', function(payload) {
@@ -319,8 +319,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
319
319
  },
320
320
  {
321
321
  key: "watchControlChange",
322
- value: /**
323
- * @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
322
+ value: /**
323
+ * @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
324
324
  * */ function watchControlChange() {
325
325
  var _this = this;
326
326
  this.engine.on('change', function(payload) {
@@ -355,8 +355,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
355
355
  },
356
356
  {
357
357
  key: "controlInSubtable",
358
- value: /**
359
- * @description 控件在明细子表内
358
+ value: /**
359
+ * @description 控件在明细子表内
360
360
  * */ function controlInSubtable(control) {
361
361
  var _control_parent;
362
362
  return ((_control_parent = control.parent) === null || _control_parent === void 0 ? void 0 : _control_parent.type) === CONTROL_TYPE.SUBTABLE_COLUMN;
@@ -364,8 +364,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
364
364
  },
365
365
  {
366
366
  key: "computedCalcValue",
367
- value: /**
368
- * @description 执行计算公式的计算
367
+ value: /**
368
+ * @description 执行计算公式的计算
369
369
  * */ // @ts-ignore
370
370
  function computedCalcValue(control) {
371
371
  var _this = this;
@@ -455,8 +455,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
455
455
  },
456
456
  {
457
457
  key: "getNumberValue",
458
- value: /**
459
- * @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
458
+ value: /**
459
+ * @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
460
460
  * */ function getNumberValue(value) {
461
461
  if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value) {
462
462
  if ('result' in value) {
@@ -473,8 +473,8 @@ export var CalcPlugin = /*#__PURE__*/ function() {
473
473
  },
474
474
  {
475
475
  key: "getAggregateTypeValue",
476
- value: /**
477
- * 计算明细子表最大值最小值平均值总和
476
+ value: /**
477
+ * 计算明细子表最大值最小值平均值总和
478
478
  * */ function getAggregateTypeValue(values, type) {
479
479
  if (!type || !values || !values.length) return 0;
480
480
  switch(type){
@@ -156,11 +156,13 @@ import { EventLogic } from '@byteluck-fe/model-driven-shared';
156
156
  // }
157
157
  export var ControlsEventPlugin = /*#__PURE__*/ function() {
158
158
  "use strict";
159
- function ControlsEventPlugin(config) {
159
+ function ControlsEventPlugin(config, customEvents) {
160
160
  _class_call_check(this, ControlsEventPlugin);
161
161
  _define_property(this, "config", void 0);
162
162
  _define_property(this, "engine", void 0);
163
+ _define_property(this, "customEvents", void 0);
163
164
  this.config = config;
165
+ this.customEvents = customEvents;
164
166
  }
165
167
  _create_class(ControlsEventPlugin, [
166
168
  {
@@ -197,6 +199,14 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
197
199
  _this.engineAddEventListener(eventItem.code, eventItem.key);
198
200
  }
199
201
  });
202
+ //注册自定义组件事件
203
+ this.customEvents.map(function(item) {
204
+ var key = item.key;
205
+ if (item.namespace !== undefined && item.namespace !== null && item.namespace !== '') {
206
+ key = item.namespace + ':' + item.key;
207
+ }
208
+ _this.engineAddEventListener(key, key);
209
+ });
200
210
  }
201
211
  },
202
212
  {
@@ -1,9 +1,9 @@
1
- /*
2
- * @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
3
- * @Date: 2022-04-15 14:06:03
4
- * @LastEditors: zhaoxiaoyang zhaoxiaoyang@byteluck.com
5
- * @LastEditTime: 2023-11-30 16:38:47
6
- * @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
1
+ /*
2
+ * @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
3
+ * @Date: 2022-04-15 14:06:03
4
+ * @LastEditors: SuperLuckyqi
5
+ * @LastEditTime: 2024-11-08 11:17:53
6
+ * @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
7
7
  */ function _class_call_check(instance, Constructor) {
8
8
  if (!(instance instanceof Constructor)) {
9
9
  throw new TypeError("Cannot call a class as a function");
@@ -36,13 +36,19 @@ function _define_property(obj, key, value) {
36
36
  }
37
37
  return obj;
38
38
  }
39
+ import postcss from 'postcss';
40
+ import prefixSelector from 'postcss-prefix-selector';
41
+ import postcssNested from 'postcss-nested';
39
42
  export var StylePlugin = /*#__PURE__*/ function() {
40
43
  "use strict";
41
44
  function StylePlugin(config) {
45
+ var isPC = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
42
46
  _class_call_check(this, StylePlugin);
43
47
  _define_property(this, "config", void 0);
44
48
  _define_property(this, "engine", void 0);
49
+ _define_property(this, "isPc", void 0);
45
50
  this.config = config;
51
+ this.isPc = isPC;
46
52
  }
47
53
  _create_class(StylePlugin, [
48
54
  {
@@ -53,11 +59,27 @@ export var StylePlugin = /*#__PURE__*/ function() {
53
59
  var _this_config_source;
54
60
  var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : '';
55
61
  var style = document.createElement('style');
56
- style.className = 'edit-css';
57
- style.type = 'text/css';
58
- style.innerHTML = compiledStyle;
62
+ style.className = 'edit-css-' + engine.id;
59
63
  var dom = document.querySelector('head');
60
- dom.appendChild(style);
64
+ dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
65
+ var plugins = [
66
+ postcssNested()
67
+ ];
68
+ if (this.isPc) {
69
+ var _this_engine;
70
+ plugins.push(prefixSelector({
71
+ prefix: ".render-engine-".concat((_this_engine = this.engine) === null || _this_engine === void 0 ? void 0 : _this_engine.id),
72
+ // 明确将前缀通过空格连接到每个选择器,避免重复前缀
73
+ transform: function transform(prefix, selector) {
74
+ if (selector.startsWith(prefix)) return selector;
75
+ return "".concat(prefix, " ").concat(selector);
76
+ }
77
+ }));
78
+ }
79
+ var cssStyleText = postcss(plugins).process(compiledStyle, {
80
+ from: undefined
81
+ }).css;
82
+ style.appendChild(document.createTextNode(cssStyleText));
61
83
  }
62
84
  }
63
85
  ]);
@@ -6,7 +6,8 @@ export function loopFormControl(control, callback) {
6
6
  if (Array.isArray(control)) {
7
7
  control.map(function(item) {
8
8
  //TODO 此处需要再抽象一层 datagrid/datalist
9
- if (item.type === CONTROL_TYPE.SUBTABLE) {
9
+ // if (item.type === CONTROL_TYPE.SUBTABLE) {
10
+ if (item.controlType === CONTROL_BASE_TYPE.LIST) {
10
11
  // @ts-ignore
11
12
  var children = []//item.getChildrenFormControl() as RuntimeFormControl[]
12
13
  ;