@fecp/designer 5.3.13 → 5.3.14

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.
@@ -30,26 +30,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
30
30
  type: String,
31
31
  default: ""
32
32
  }
33
- // subFormId: {
34
- // type: String,
35
- // required: true,
36
- // },
37
- // subFormKey: {
38
- // type: String,
39
- // default: "",
40
- // },
41
- // subFormName: {
42
- // type: String,
43
- // default: "",
44
- // },
45
- // dataSourceFrom: {
46
- // type: String,
47
- // default: "",
48
- // },
49
- // triggerSubFormPageEvent: {
50
- // type: Boolean,
51
- // default: false,
52
- // },
53
33
  },
54
34
  setup(__props, { expose: __expose }) {
55
35
  const props = __props;
@@ -57,6 +37,22 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
57
37
  vue.inject("rowHeight");
58
38
  vue.inject("gridLayout");
59
39
  const setFormItemHeight = vue.inject("setFormItemHeight");
40
+ const handleEvent = vue.inject("handleEvent");
41
+ const btnRollbackEvent = vue.computed(() => {
42
+ const btnRollback = props.config.btnRollback || [];
43
+ const data = {};
44
+ for (const item of btnRollback) {
45
+ const handleFunc = () => {
46
+ handleEvent.value(
47
+ formData.value,
48
+ {},
49
+ { eventFlow: item.callbackEventConfig }
50
+ );
51
+ };
52
+ data[item.id] = handleFunc;
53
+ }
54
+ return data;
55
+ });
60
56
  const subTableData = vue.computed(() => {
61
57
  if (props.config.dataSourceFrom == "main") {
62
58
  return formData.value[props.config.fieldName];
@@ -204,8 +200,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
204
200
  tableData: vue.unref(subTableData),
205
201
  initHiddenData: vue.unref(initHiddenData),
206
202
  canLoadBySearchData: __props.config.reloadOnParamsChange,
207
- readonly: __props.config.isSubTableReadOnly || __props.formMode == "query"
208
- }, null, 8, ["templateKey", "mode", "titleMode", "hasPagination", "height", "tableData", "initHiddenData", "canLoadBySearchData", "readonly"])
203
+ readonly: __props.config.isSubTableReadOnly || __props.formMode == "query",
204
+ btnRollbackEvent: vue.unref(btnRollbackEvent)
205
+ }, null, 8, ["templateKey", "mode", "titleMode", "hasPagination", "height", "tableData", "initHiddenData", "canLoadBySearchData", "readonly", "btnRollbackEvent"])
209
206
  ], 64);
210
207
  };
211
208
  }
@@ -100,6 +100,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
100
100
  initHiddenData: {
101
101
  type: Object,
102
102
  default: {}
103
+ },
104
+ btnRollbackEvent: {
105
+ type: Object,
106
+ default: {}
103
107
  }
104
108
  },
105
109
  emits: [
@@ -293,7 +297,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
293
297
  }
294
298
  };
295
299
  const handleFlowEvent = vue.ref(null);
296
- const handleCustomBtnClick = ({ btn, event, type }) => {
300
+ const handleCustomBtnClick = async ({ btn, event, type }) => {
297
301
  var _a, _b;
298
302
  switch (btn.btnType) {
299
303
  case "refresh":
@@ -306,12 +310,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
306
310
  handlePersonalize();
307
311
  break;
308
312
  default:
309
- (_b = handleFlowEvent.value) == null ? void 0 : _b.call(
313
+ await ((_b = handleFlowEvent.value) == null ? void 0 : _b.call(
310
314
  handleFlowEvent,
311
315
  hiddenFormData.value,
312
316
  btn,
313
317
  (_a = btn.eventConfig) == null ? void 0 : _a.find((item) => item.name == "Click")
314
- );
318
+ ));
319
+ const handleFunc = props.btnRollbackEvent[btn.id];
320
+ if (handleFunc && typeof handleFunc == "function") {
321
+ handleFunc();
322
+ }
315
323
  }
316
324
  };
317
325
  const handleSortChange = ({ property, order }) => {
@@ -624,7 +632,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
624
632
  "table-data": displayData.value,
625
633
  readonly: __props.readonly,
626
634
  isDialog: __props.isDialog,
627
- hiddenFormData: hiddenFormData.value
635
+ hiddenFormData: hiddenFormData.value,
636
+ btnRollbackEvent: __props.btnRollbackEvent
628
637
  }, vue.createSlots({ _: 2 }, [
629
638
  vue.renderList(fieldsData.value, (field) => {
630
639
  return {
@@ -634,7 +643,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
634
643
  ])
635
644
  };
636
645
  })
637
- ]), 1032, ["fields-data", "show-index", "select-mode", "is-opt-btns", "opt-btns", "mode-key", "modes", "data-source-options", "dictionary-options", "localConfig", "table-ref", "table-data", "readonly", "isDialog", "hiddenFormData"])
646
+ ]), 1032, ["fields-data", "show-index", "select-mode", "is-opt-btns", "opt-btns", "mode-key", "modes", "data-source-options", "dictionary-options", "localConfig", "table-ref", "table-data", "readonly", "isDialog", "hiddenFormData", "btnRollbackEvent"])
638
647
  ];
639
648
  }),
640
649
  _: 3
@@ -653,5 +662,5 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
653
662
  };
654
663
  }
655
664
  });
656
- const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-fa5e2171"]]);
665
+ const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-3c129bed"]]);
657
666
  exports.default = _Table;
@@ -105,6 +105,10 @@ const _sfc_main = {
105
105
  hiddenFormData: {
106
106
  type: Object,
107
107
  default: {}
108
+ },
109
+ btnRollbackEvent: {
110
+ type: Object,
111
+ default: {}
108
112
  }
109
113
  },
110
114
  setup(__props) {
@@ -271,7 +275,7 @@ const _sfc_main = {
271
275
  );
272
276
  return Math.max(maxVisibleBtns, 1) * btnWidth + padding;
273
277
  });
274
- const { getEventHandlers: createEventHandlers } = eventFlowHandler.useEventFlow({
278
+ const { handleEvent } = eventFlowHandler.useEventFlow({
275
279
  fields: props.fieldsData,
276
280
  instance,
277
281
  localConfig: props.localConfig,
@@ -279,13 +283,17 @@ const _sfc_main = {
279
283
  table: props.tableRef
280
284
  }
281
285
  });
282
- const getEventHandlers = (row, item, eventConfig) => {
283
- return createEventHandlers(
284
- item,
286
+ async function handleButtonClick(row, btn, eventConfig) {
287
+ await handleEvent(
285
288
  { ...row, ...common.removeEmptyValues(props.hiddenFormData) },
286
- eventConfig
289
+ btn,
290
+ eventConfig == null ? void 0 : eventConfig.find((item) => item.name == "Click")
287
291
  );
288
- };
292
+ const handleFunc = props.btnRollbackEvent[btn.id];
293
+ if (handleFunc && typeof handleFunc == "function") {
294
+ handleFunc();
295
+ }
296
+ }
289
297
  return (_ctx, _cache) => {
290
298
  const _component_el_link = index$1.ElLink;
291
299
  const _component_el_icon = index$2.ElIcon;
@@ -335,15 +343,16 @@ const _sfc_main = {
335
343
  field
336
344
  }, () => [
337
345
  field.prefix ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2, vue.toDisplayString(field.prefix), 1)) : vue.createCommentVNode("", true),
338
- field.isLink ? (vue.openBlock(), vue.createBlock(_component_el_link, vue.mergeProps({
346
+ field.isLink ? (vue.openBlock(), vue.createBlock(_component_el_link, {
339
347
  key: 1,
340
- type: "primary"
341
- }, vue.toHandlers(getEventHandlers(row, field, field.linkConfig))), {
348
+ type: "primary",
349
+ onClick: ($event) => handleButtonClick(row, field, field.linkConfig)
350
+ }, {
342
351
  default: vue.withCtx(() => [
343
352
  vue.createTextVNode(vue.toDisplayString(formatCellValue(row, field)), 1)
344
353
  ]),
345
354
  _: 2
346
- }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
355
+ }, 1032, ["onClick"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
347
356
  vue.createTextVNode(vue.toDisplayString(formatCellValue(row, field)), 1)
348
357
  ], 64)),
349
358
  field.suffix ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, vue.toDisplayString(field.suffix), 1)) : vue.createCommentVNode("", true),
@@ -371,17 +380,18 @@ const _sfc_main = {
371
380
  }, {
372
381
  default: vue.withCtx(({ row }) => [
373
382
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getVisibleOptBtns(row), (btn) => {
374
- return vue.openBlock(), vue.createBlock(_component_el_button, vue.mergeProps({
383
+ return vue.openBlock(), vue.createBlock(_component_el_button, {
375
384
  key: btn.id,
376
385
  type: "primary",
377
386
  link: "",
378
- disabled: isBtnDisabled(row, btn)
379
- }, vue.toHandlers(getEventHandlers(row, btn, btn.eventConfig))), {
387
+ disabled: isBtnDisabled(row, btn),
388
+ onClick: ($event) => handleButtonClick(row, btn, btn.eventConfig)
389
+ }, {
380
390
  default: vue.withCtx(() => [
381
391
  vue.createTextVNode(vue.toDisplayString(btn.label), 1)
382
392
  ]),
383
393
  _: 2
384
- }, 1040, ["disabled"]);
394
+ }, 1032, ["disabled", "onClick"]);
385
395
  }), 128))
386
396
  ]),
387
397
  _: 1
@@ -390,5 +400,5 @@ const _sfc_main = {
390
400
  };
391
401
  }
392
402
  };
393
- const TableColumn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-2352d631"]]);
403
+ const TableColumn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-77ad8323"]]);
394
404
  exports.default = TableColumn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/designer",
3
- "version": "5.3.13",
3
+ "version": "5.3.14",
4
4
  "main": "lib/packages/designer/index.js",
5
5
  "module": "es/packages/designer/index.mjs",
6
6
  "files": [