@cniot/mdd-editor 0.2.0-beta.30 → 0.2.0-beta.32

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.
package/build/index.es.js CHANGED
@@ -3468,7 +3468,8 @@ class DetailItemSchema extends JSONWatch {
3468
3468
  current = 1,
3469
3469
  columnsDirection = "row",
3470
3470
  columnsBoxes = [],
3471
- hideCardTitle = false,
3471
+ height = 100,
3472
+ hideCard = true,
3472
3473
  ...more2
3473
3474
  } = props || {};
3474
3475
  super({
@@ -3489,7 +3490,8 @@ class DetailItemSchema extends JSONWatch {
3489
3490
  current,
3490
3491
  columnsDirection,
3491
3492
  columnsBoxes,
3492
- hideCardTitle,
3493
+ height,
3494
+ hideCard,
3493
3495
  ...more2
3494
3496
  });
3495
3497
  }
@@ -24645,13 +24647,8 @@ const TitleRender$2 = (props) => {
24645
24647
  onClick: onRemove
24646
24648
  }));
24647
24649
  };
24648
- const watchFields = (listSchema) => {
24649
- const fieldStringArray = listSchema.map((item) => {
24650
- return `${item.label}_${item.name}`;
24651
- });
24652
- return fieldStringArray.join(",");
24653
- };
24654
24650
  const ContentRender$2 = (props) => {
24651
+ var _a2, _b2;
24655
24652
  const { values, effects, onChange, schema, index: index2, extraFieldSchema: extraFieldSchema2, updateForceFLag, listSchema } = props;
24656
24653
  const { type, label, name } = values;
24657
24654
  const { formilySchema: formilySchema2, dataAdaptor: dataAdaptor2 } = schema || {};
@@ -24663,7 +24660,7 @@ const ContentRender$2 = (props) => {
24663
24660
  debounce_1(() => {
24664
24661
  setUuid(uuidv4());
24665
24662
  }, 500),
24666
- [watchFields(listSchema)]
24663
+ [`${(_a2 = props == null ? void 0 : props.values) == null ? void 0 : _a2.label}_${(_b2 = props == null ? void 0 : props.values) == null ? void 0 : _b2.name}`]
24667
24664
  );
24668
24665
  const realSchema = useMemo(() => {
24669
24666
  const srcSchema = getRealSchema(formilySchema2 || schema, { moduleDataSource, listSchema, blocksDataSource });
@@ -26001,7 +25998,7 @@ const { Panel: Panel$2 } = Collapse;
26001
25998
  const TitleRender$1 = (props) => {
26002
25999
  const ref = useRef(null);
26003
26000
  const { data, onSortUpdate, index: index2, draggable, onRemove, onChange, customRender = () => {
26004
- } } = props;
26001
+ }, otherInfo } = props;
26005
26002
  const { dataMap, getModule } = useModule$1();
26006
26003
  const moduleDataSource = getModule("$ModuleDataSource");
26007
26004
  const [{ isOver }, drop] = useDrop({
@@ -26040,7 +26037,7 @@ const TitleRender$1 = (props) => {
26040
26037
  className: cls,
26041
26038
  style: { cursor: draggable ? "move" : "default", opacity },
26042
26039
  onClick: (e) => e.stopPropagation()
26043
- }, customRender && customRender({ data, index: index2, onChange, moduleDataSource }), /* @__PURE__ */ React$1.createElement(Icon, {
26040
+ }, customRender && customRender({ data, index: index2, onChange, moduleDataSource, otherInfo }), /* @__PURE__ */ React$1.createElement(Icon, {
26044
26041
  type: "close",
26045
26042
  size: "small",
26046
26043
  className: styles$9.itemClose,
@@ -26061,7 +26058,8 @@ function MddTableSimpleArray(props) {
26061
26058
  onRemove,
26062
26059
  draggable = true,
26063
26060
  titleRender,
26064
- contentRender: contentRender2
26061
+ contentRender: contentRender2,
26062
+ otherInfo
26065
26063
  } = props;
26066
26064
  const onSortUpdate = useCallback(
26067
26065
  (dragIndex, hoverIndex) => {
@@ -26106,11 +26104,12 @@ function MddTableSimpleArray(props) {
26106
26104
  onRemove: () => onRemove(idx),
26107
26105
  data: item,
26108
26106
  onSortUpdate,
26109
- customRender: titleRender
26107
+ customRender: titleRender,
26108
+ otherInfo
26110
26109
  })
26111
26110
  }, /* @__PURE__ */ React$1.createElement("div", {
26112
26111
  className: styles$9.collapseContent
26113
- }, contentRender2({ data: item, index: idx, onChange: onTableArrayChange })));
26112
+ }, contentRender2({ data: item, index: idx, onChange: onTableArrayChange, otherInfo })));
26114
26113
  })))), /* @__PURE__ */ React$1.createElement("div", {
26115
26114
  className: styles$9.tableArrayBottom
26116
26115
  }, /* @__PURE__ */ React$1.createElement(Button, {
@@ -27237,7 +27236,7 @@ function DetailColumns(props) {
27237
27236
  data.add(
27238
27237
  {
27239
27238
  moduleName: "",
27240
- cols: 1,
27239
+ hideSelfCard: true,
27241
27240
  params: [],
27242
27241
  canUpdateOtherColumns: true,
27243
27242
  canBeUpdated: true
@@ -27314,13 +27313,14 @@ function DetailColumns(props) {
27314
27313
  forceUpdate({});
27315
27314
  },
27316
27315
  onAdd: onAddHandle,
27317
- onRemove: (index2) => onRemoveHandle(index2)
27316
+ onRemove: (index2) => onRemoveHandle(index2),
27317
+ otherInfo: { columnsDirection: data.get("columnsDirection") }
27318
27318
  })), data.get("hideCardTitle") ? null : /* @__PURE__ */ React$1.createElement(ActionsPanel, {
27319
27319
  schema: data
27320
27320
  }));
27321
27321
  }
27322
27322
  function customTitleRender$1(props) {
27323
- const { data, index: index2, onChange, moduleDataSource } = props;
27323
+ const { data, index: index2, onChange, moduleDataSource, otherInfo = {} } = props;
27324
27324
  return /* @__PURE__ */ React$1.createElement("div", {
27325
27325
  className: styles$5.title
27326
27326
  }, /* @__PURE__ */ React$1.createElement("div", {
@@ -27337,7 +27337,7 @@ function customTitleRender$1(props) {
27337
27337
  dataSource: (moduleDataSource == null ? void 0 : moduleDataSource.l4ModuleOptions) || moduleDataSource || [],
27338
27338
  value: data == null ? void 0 : data.moduleName,
27339
27339
  onChange: (v2) => onChange({ ...data, moduleName: v2 })
27340
- })), /* @__PURE__ */ React$1.createElement("div", {
27340
+ })), (otherInfo == null ? void 0 : otherInfo.columnsDirection) === "row" && /* @__PURE__ */ React$1.createElement("div", {
27341
27341
  className: styles$5.titleItem
27342
27342
  }, /* @__PURE__ */ React$1.createElement("label", {
27343
27343
  className: styles$5.titleItemLabel
@@ -27368,16 +27368,8 @@ function contentRender(props) {
27368
27368
  });
27369
27369
  }
27370
27370
  const ContentRender = (props) => {
27371
- const { data, index: index2, onChange } = props;
27372
- return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(Form.Item, {
27373
- wrapperCol: { span: 20 },
27374
- labelCol: { span: 4 },
27375
- label: "\u9690\u85CF \u5F53\u524D\u680F \u5361\u7247",
27376
- name: ""
27377
- }, /* @__PURE__ */ React$1.createElement(CnSwitch, {
27378
- defaultChecked: data == null ? void 0 : data.hideSelfCard,
27379
- onChange: (v2) => onChange({ index: index2, record: { ...data, hideSelfCard: v2 } })
27380
- })), /* @__PURE__ */ React$1.createElement(Form.Item, {
27371
+ const { data, index: index2, onChange, otherInfo = {} } = props;
27372
+ return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, (otherInfo == null ? void 0 : otherInfo.columnsDirection) === "column" && /* @__PURE__ */ React$1.createElement(Form.Item, {
27381
27373
  wrapperCol: { span: 20 },
27382
27374
  labelCol: { span: 4 },
27383
27375
  label: "\u9AD8\u5EA6",
@@ -27411,6 +27403,14 @@ const ContentRender = (props) => {
27411
27403
  valueTitle: "value(\u53C2\u6570\u503C) - .$ALL \u53EF\u83B7\u53D6\u6574\u4E2A\u52A8\u6001\u5BF9\u8C61",
27412
27404
  value: data == null ? void 0 : data.params,
27413
27405
  onChange: (v2) => onChange({ index: index2, record: { ...data, params: v2 } })
27406
+ })), /* @__PURE__ */ React$1.createElement(Form.Item, {
27407
+ wrapperCol: { span: 20 },
27408
+ labelCol: { span: 4 },
27409
+ label: "\u9690\u85CF \u5F53\u524D\u680F \u5361\u7247",
27410
+ name: ""
27411
+ }, /* @__PURE__ */ React$1.createElement(CnSwitch, {
27412
+ defaultChecked: data == null ? void 0 : data.hideSelfCard,
27413
+ onChange: (v2) => onChange({ index: index2, record: { ...data, hideSelfCard: v2 } })
27414
27414
  })), /* @__PURE__ */ React$1.createElement(Collapse, {
27415
27415
  accordion: true
27416
27416
  }, /* @__PURE__ */ React$1.createElement(Panel, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cniot/mdd-editor",
3
- "version": "0.2.0-beta.30",
3
+ "version": "0.2.0-beta.32",
4
4
  "description": "模型驱动编辑器",
5
5
  "scripts": {
6
6
  "build": "vite build"
@@ -20,7 +20,8 @@ export default class DetailItemSchema extends JSONWatch {
20
20
  current = 1, // 步骤条,当前步数
21
21
  columnsDirection = 'row', // 分栏组件 方向,默认横向分栏
22
22
  columnsBoxes = [],
23
- hideCardTitle = false,
23
+ height = 100,
24
+ hideCard = true,
24
25
  ...more
25
26
  } = props || {};
26
27
  super({
@@ -41,7 +42,8 @@ export default class DetailItemSchema extends JSONWatch {
41
42
  current,
42
43
  columnsDirection,
43
44
  columnsBoxes,
44
- hideCardTitle,
45
+ height,
46
+ hideCard,
45
47
  ...more,
46
48
  });
47
49
  }
@@ -143,7 +145,7 @@ export default class DetailItemSchema extends JSONWatch {
143
145
  * {array} actionColumns 操作列
144
146
  * {object} pagination 分页
145
147
  */
146
- if (['columnsBoxes','columns', 'actionColumns', 'bulkActions'].includes(key)) {
148
+ if (['columnsBoxes', 'columns', 'actionColumns', 'bulkActions'].includes(key)) {
147
149
  this.data[key].splice(index, 1, record);
148
150
  } else {
149
151
  this.data[key] = record;
@@ -195,5 +197,5 @@ export default class DetailItemSchema extends JSONWatch {
195
197
  this.emit('$updated');
196
198
  }
197
199
 
198
- delete() { }
200
+ delete() {}
199
201
  }
@@ -45,7 +45,7 @@ export default function DetailColumns(props) {
45
45
  data.add(
46
46
  {
47
47
  moduleName: '',
48
- cols: 1,
48
+ hideSelfCard: true,
49
49
  params: [],
50
50
  canUpdateOtherColumns: true,
51
51
  canBeUpdated: true,
@@ -106,6 +106,7 @@ export default function DetailColumns(props) {
106
106
  }}
107
107
  onAdd={onAddHandle}
108
108
  onRemove={(index) => onRemoveHandle(index)}
109
+ otherInfo={{ columnsDirection: data.get('columnsDirection') }}
109
110
  // onRemove={onRemoveHandle}
110
111
  />
111
112
  </Form.Item>
@@ -115,7 +116,7 @@ export default function DetailColumns(props) {
115
116
  }
116
117
 
117
118
  function customTitleRender(props) {
118
- const { data, index, onChange, moduleDataSource } = props;
119
+ const { data, index, onChange, moduleDataSource, otherInfo = {} } = props;
119
120
 
120
121
  return (
121
122
  <div className={styles.title}>
@@ -133,28 +134,30 @@ function customTitleRender(props) {
133
134
  onChange={(v) => onChange({ ...data, moduleName: v })}
134
135
  />
135
136
  </div>
136
- <div className={styles.titleItem}>
137
- <label className={styles.titleItemLabel}>
138
- <Balloon
139
- trigger={
140
- <div style={{ display: 'flex', alignItems: 'center' }}>
141
- 占列数 <Icon type="help" size="small" />
142
- </div>
143
- }
144
- align="t"
145
- >
146
- <b>左右布局时,占列数之和应为24</b>
147
- </Balloon>
148
- </label>
149
- <CnNumberPicker
150
- size="small"
151
- min={0}
152
- max={24}
153
- value={data?.cols}
154
- onChange={(v) => onChange({ ...data, cols: v })}
155
- placeholder="占列数 之和应为24"
156
- />
157
- </div>
137
+ {otherInfo?.columnsDirection === 'row' && (
138
+ <div className={styles.titleItem}>
139
+ <label className={styles.titleItemLabel}>
140
+ <Balloon
141
+ trigger={
142
+ <div style={{ display: 'flex', alignItems: 'center' }}>
143
+ 占列数 <Icon type="help" size="small" />
144
+ </div>
145
+ }
146
+ align="t"
147
+ >
148
+ <b>左右布局时,占列数之和应为24</b>
149
+ </Balloon>
150
+ </label>
151
+ <CnNumberPicker
152
+ size="small"
153
+ min={0}
154
+ max={24}
155
+ value={data?.cols}
156
+ onChange={(v) => onChange({ ...data, cols: v })}
157
+ placeholder="占列数 之和应为24"
158
+ />
159
+ </div>
160
+ )}
158
161
  </div>
159
162
  );
160
163
  }
@@ -169,30 +172,26 @@ function contentRender(props) {
169
172
  }
170
173
 
171
174
  const ContentRender = (props) => {
172
- const { data, index, onChange } = props;
175
+ const { data, index, onChange, otherInfo = {} } = props;
173
176
  // const [_, forceUpdate] = React.useState({});
174
177
 
175
178
  return (
176
179
  <>
177
- <Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="隐藏 当前栏 卡片" name="">
178
- <CnSwitch
179
- defaultChecked={data?.hideSelfCard}
180
- onChange={(v) => onChange({ index, record: { ...data, hideSelfCard: v } })}
181
- />
182
- </Form.Item>
183
- <Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="高度" name="">
184
- <CnNumberPicker
185
- min={0}
186
- max={100}
187
- innerAfter="%"
188
- style={{ width: 90 }}
189
- defaultValue={data?.height}
190
- onChange={(v) => onChange({ index, record: { ...data, height: v } })}
191
- />
192
- <CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>
193
- 仅在上下布局中生效:0-100 的整数,0 表示自动高度
194
- </CnTooltip>
195
- </Form.Item>
180
+ {otherInfo?.columnsDirection === 'column' && (
181
+ <Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="高度" name="">
182
+ <CnNumberPicker
183
+ min={0}
184
+ max={100}
185
+ innerAfter="%"
186
+ style={{ width: 90 }}
187
+ defaultValue={data?.height}
188
+ onChange={(v) => onChange({ index, record: { ...data, height: v } })}
189
+ />
190
+ <CnTooltip trigger={<Icon type="prompt" style={{ marginLeft: 6 }} />}>
191
+ 仅在上下布局中生效:0-100 的整数,0 表示自动高度
192
+ </CnTooltip>
193
+ </Form.Item>
194
+ )}
196
195
  <Form.Item
197
196
  name=""
198
197
  wrapperCol={{ span: 20 }}
@@ -220,6 +219,12 @@ const ContentRender = (props) => {
220
219
  onChange={(v) => onChange({ index, record: { ...data, params: v } })}
221
220
  />
222
221
  </Form.Item>
222
+ <Form.Item wrapperCol={{ span: 20 }} labelCol={{ span: 4 }} label="隐藏 当前栏 卡片" name="">
223
+ <CnSwitch
224
+ defaultChecked={data?.hideSelfCard}
225
+ onChange={(v) => onChange({ index, record: { ...data, hideSelfCard: v } })}
226
+ />
227
+ </Form.Item>
223
228
  <Collapse accordion>
224
229
  <Panel
225
230
  title={