@fecp/designer 5.3.5 → 5.3.7

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 (52) hide show
  1. package/es/designer.css +197 -240
  2. package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/config-provider/src/hooks/use-global-config.mjs +1 -1
  3. package/es/packages/designer/package.json.mjs +1 -1
  4. package/es/packages/designer/src/components/FilterConfigDisplay.vue.mjs +2 -3
  5. package/es/packages/designer/src/components/FormulaEditorInput.vue.mjs +33 -8
  6. package/es/packages/designer/src/components/ValueSelectorPopover.vue2.mjs +62 -39
  7. package/es/packages/designer/src/layout/aside/HiddenFieldDialog.vue.mjs +3 -3
  8. package/es/packages/designer/src/layout/header/index.vue.mjs +1 -1
  9. package/es/packages/designer/src/packages/advancedFilter/AdvancedFilter.vue2.mjs +4 -4
  10. package/es/packages/designer/src/packages/advancedFilter/ValueInput.vue2.mjs +34 -28
  11. package/es/packages/designer/src/packages/dataLinkage/index.vue.mjs +75 -69
  12. package/es/packages/designer/src/packages/dialogGlobal/index.vue.mjs +1 -0
  13. package/es/packages/designer/src/packages/eventFlow/dialog/action/Dialog.vue.mjs +49 -11
  14. package/es/packages/designer/src/packages/eventFlow/dialog/action/config.mjs +2 -2
  15. package/es/packages/designer/src/packages/form/aside/index.mjs +1 -0
  16. package/es/packages/designer/src/packages/form/components/SubForm.vue.mjs +33 -7
  17. package/es/packages/designer/src/packages/form/index.vue.mjs +15 -2
  18. package/es/packages/designer/src/packages/form/property/subForm.vue.mjs +53 -11
  19. package/es/packages/designer/src/packages/formulaEditor/components/FieldVariable.vue2.mjs +3 -2
  20. package/es/packages/designer/src/packages/table/headerBtn.vue.mjs +1 -0
  21. package/es/packages/vue/src/components/bus/approvalHistory/ApprovalHistory.vue.mjs +2 -2
  22. package/es/packages/vue/src/components/forms/form/Form.vue.mjs +35 -12
  23. package/es/packages/vue/src/components/forms/form/validation.mjs +18 -6
  24. package/es/packages/vue/src/components/forms/subForm/SubForm.vue.mjs +33 -5
  25. package/es/packages/vue/src/components/forms/subTable/SubTable.vue.mjs +1 -1
  26. package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +10 -3
  27. package/lib/designer.css +197 -240
  28. package/lib/packages/designer/package.json.js +1 -1
  29. package/lib/packages/designer/src/components/FilterConfigDisplay.vue.js +2 -3
  30. package/lib/packages/designer/src/components/FormulaEditorInput.vue.js +32 -7
  31. package/lib/packages/designer/src/components/ValueSelectorPopover.vue2.js +68 -45
  32. package/lib/packages/designer/src/layout/aside/HiddenFieldDialog.vue.js +3 -3
  33. package/lib/packages/designer/src/layout/header/index.vue.js +1 -1
  34. package/lib/packages/designer/src/packages/advancedFilter/AdvancedFilter.vue2.js +4 -4
  35. package/lib/packages/designer/src/packages/advancedFilter/ValueInput.vue2.js +34 -28
  36. package/lib/packages/designer/src/packages/dataLinkage/index.vue.js +75 -69
  37. package/lib/packages/designer/src/packages/dialogGlobal/index.vue.js +1 -0
  38. package/lib/packages/designer/src/packages/eventFlow/dialog/action/Dialog.vue.js +48 -10
  39. package/lib/packages/designer/src/packages/eventFlow/dialog/action/config.js +2 -2
  40. package/lib/packages/designer/src/packages/form/aside/index.js +1 -0
  41. package/lib/packages/designer/src/packages/form/components/SubForm.vue.js +33 -7
  42. package/lib/packages/designer/src/packages/form/index.vue.js +15 -2
  43. package/lib/packages/designer/src/packages/form/property/subForm.vue.js +53 -11
  44. package/lib/packages/designer/src/packages/formulaEditor/components/FieldVariable.vue2.js +3 -2
  45. package/lib/packages/designer/src/packages/table/headerBtn.vue.js +1 -0
  46. package/lib/packages/vue/src/components/bus/approvalHistory/ApprovalHistory.vue.js +2 -2
  47. package/lib/packages/vue/src/components/forms/form/Form.vue.js +47 -24
  48. package/lib/packages/vue/src/components/forms/form/validation.js +18 -6
  49. package/lib/packages/vue/src/components/forms/subForm/SubForm.vue.js +32 -4
  50. package/lib/packages/vue/src/components/forms/subTable/SubTable.vue.js +1 -1
  51. package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +10 -3
  52. package/package.json +1 -1
@@ -68,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
68
68
  if (foundItem) {
69
69
  foundItem.fixedH = true;
70
70
  foundItem.h = dom.offsetHeight + titleHeight;
71
- setFormItemHeight(props.config.id, dom.offsetHeight + titleHeight);
71
+ setFormItemHeight(props.config.id, true, dom.offsetHeight + titleHeight);
72
72
  }
73
73
  }
74
74
  return (_ctx, _cache) => {
@@ -125,7 +125,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
125
125
  };
126
126
  }
127
127
  });
128
- const _ApprovalHistory = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ca0519c9"]]);
128
+ const _ApprovalHistory = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f7d02612"]]);
129
129
  export {
130
130
  _ApprovalHistory as default
131
131
  };
@@ -5,7 +5,7 @@
5
5
  /* empty css */
6
6
  /* empty css */
7
7
  /* empty css */
8
- import { getCurrentInstance, ref, onMounted, onBeforeUnmount, watch, provide, createBlock, openBlock, withCtx, createCommentVNode, createVNode, unref, normalizeStyle, createElementBlock, Fragment, renderList } from "vue";
8
+ import { getCurrentInstance, ref, watch, onMounted, onBeforeUnmount, provide, createBlock, openBlock, withCtx, createCommentVNode, createVNode, unref, normalizeStyle, createElementBlock, Fragment, renderList } from "vue";
9
9
  import "../../../../../../node_modules/.pnpm/grid-layout-plus@1.1.1_vue@3.5.13_typescript@5.7.3_/node_modules/grid-layout-plus/es/index.mjs";
10
10
  import { getCurrentVueInstance } from "../../../utils/getInstance.mjs";
11
11
  import getJsonAsyncUtil from "../../../utils/getJsonAsyncUtil.mjs";
@@ -34,10 +34,10 @@ import { footer } from "../../details/footer/index.mjs";
34
34
  import { checkFilterMatch, checkFieldInFilterConfig, checkFieldInResultConfig } from "../../../utils/parseFilterConfig.mjs";
35
35
  import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
36
36
  /* empty css */
37
+ import { ElMessage } from "../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.mjs";
37
38
  import { ElContainer } from "../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/container/index.mjs";
38
39
  import { ElForm } from "../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/form/index.mjs";
39
40
  import De from "../../../../../../node_modules/.pnpm/grid-layout-plus@1.1.1_vue@3.5.13_typescript@5.7.3_/node_modules/grid-layout-plus/es/components/grid-layout.vue.mjs";
40
- import { ElMessage } from "../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.mjs";
41
41
  const _hoisted_1 = ["name", "value"];
42
42
  const _sfc_main = /* @__PURE__ */ Object.assign({
43
43
  inheritAttrs: false
@@ -119,6 +119,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
119
119
  pageEvents.handleUnmounted();
120
120
  }
121
121
  const formMode = ref("");
122
+ watch(
123
+ () => props.templateKey,
124
+ (key) => {
125
+ if (key) {
126
+ loadConfig();
127
+ }
128
+ }
129
+ );
122
130
  const loadConfig = async () => {
123
131
  if (!props.templateKey) {
124
132
  return;
@@ -152,6 +160,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
152
160
  mergeOptionsToFields();
153
161
  loadFormData();
154
162
  loadEventFlow();
163
+ initGridLayoutDataConfig();
155
164
  if (pageEvents && localConfig.value.pageEventConfig) {
156
165
  const onCreatedEvent = localConfig.value.pageEventConfig.find(
157
166
  (e) => e.name === "onCreated"
@@ -181,7 +190,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
181
190
  defaultData[component.fieldName] = defaultValue;
182
191
  }
183
192
  if (component.fieldName) {
184
- const fieldRules = generateFieldRules(component);
193
+ const fieldRules = generateFieldRules(component, formData, [
194
+ ...fieldsData.value,
195
+ ...hiddenFields.value
196
+ ]);
185
197
  if (fieldRules.length > 0) {
186
198
  rules[component.fieldName] = fieldRules;
187
199
  }
@@ -708,6 +720,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
708
720
  return result;
709
721
  };
710
722
  const applyLinkageEffectsForChangedFields = (changedFieldNames) => {
723
+ var _a;
711
724
  console.log(
712
725
  "🚀 ~ applyLinkageEffectsForChangedFields ~ 变化的字段:",
713
726
  changedFieldNames
@@ -723,9 +736,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
723
736
  if (checkFilterMatch(item.filterConfig, formData.value, fields)) {
724
737
  const fieldAssignments = item.fieldAssignments || [];
725
738
  fieldAssignments.forEach((assignment) => {
726
- var _a, _b;
739
+ var _a2, _b;
727
740
  const fieldId = assignment.fieldId;
728
- const formulaText = (_b = (_a = assignment.formula) == null ? void 0 : _a.value) == null ? void 0 : _b.text;
741
+ const formulaText = (_b = (_a2 = assignment.formula) == null ? void 0 : _a2.value) == null ? void 0 : _b.text;
729
742
  const field = fields.find((f) => f.id == fieldId);
730
743
  if (field && formulaText) {
731
744
  const calcResult = calculate({
@@ -778,7 +791,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
778
791
  const rules = {};
779
792
  updatedLayoutData.forEach(({ component }) => {
780
793
  if (component.fieldName) {
781
- const fieldRules = generateFieldRules(component);
794
+ const fieldRules = generateFieldRules(component, formData, fields);
782
795
  if (fieldRules.length > 0) {
783
796
  rules[component.fieldName] = fieldRules;
784
797
  }
@@ -825,11 +838,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
825
838
  }
826
839
  });
827
840
  gridLayoutFieldsData.value = updatedLayoutData.filter((item) => !item.hidden);
841
+ (_a = gridLayout == null ? void 0 : gridLayout.value) == null ? void 0 : _a.resizeEvent();
828
842
  };
829
843
  watch(
830
844
  formData,
831
845
  (newVal, oldVal) => {
832
- initGridLayoutDataConfig();
833
846
  const changedFields = findChangedFields(newVal, prevFormData.value);
834
847
  if (changedFields.length > 0) {
835
848
  applyLinkageEffectsForChangedFields(changedFields);
@@ -839,11 +852,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
839
852
  },
840
853
  { deep: true }
841
854
  );
842
- function setFormItemHeight(id, h) {
855
+ function setFormItemHeight(id, fixedH, h) {
856
+ var _a;
843
857
  const item = gridLayoutFieldsData.value.find((item2) => item2.id == id);
844
- if (item) {
845
- item.h = h;
846
- }
858
+ if (!fixedH) {
859
+ item.h = h * 60;
860
+ } else if (fixedH) {
861
+ item.h = h / (localConfig.value.labelPosition == "top" ? 1.5 : 1);
862
+ }
863
+ const oriItem = oriGridLayoutData.value.find((item2) => item2.id == id);
864
+ if (!fixedH) {
865
+ oriItem.h = h * 60;
866
+ } else if (fixedH) {
867
+ oriItem.h = h / (localConfig.value.labelPosition == "top" ? 1.5 : 1);
868
+ }
869
+ (_a = gridLayout == null ? void 0 : gridLayout.value) == null ? void 0 : _a.resizeEvent();
847
870
  }
848
871
  provide("formData", formData);
849
872
  provide("localConfig", localConfig);
@@ -945,7 +968,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
945
968
  };
946
969
  }
947
970
  });
948
- const _Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5e8468de"]]);
971
+ const _Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-63966ae6"]]);
949
972
  export {
950
973
  _Form as default
951
974
  };
@@ -1,3 +1,4 @@
1
+ import { checkFilterMatch } from "../../../utils/parseFilterConfig.mjs";
1
2
  const VALIDATION_RULES = {
2
3
  // 身份证
3
4
  idCard: {
@@ -45,7 +46,7 @@ const VALIDATION_RULES = {
45
46
  message: "请输入正确的联系电话"
46
47
  }
47
48
  };
48
- function generateFieldRules(component) {
49
+ function generateFieldRules(component, formData, fields) {
49
50
  const rules = [];
50
51
  if (!component.fieldName) {
51
52
  return rules;
@@ -58,16 +59,27 @@ function generateFieldRules(component) {
58
59
  });
59
60
  }
60
61
  if (component.validationType && component.validationType !== "none") {
61
- if (component.validationType === "regex" && component.regexPattern) {
62
+ if (component.validationType === "regex" && component.validationPattern) {
62
63
  try {
63
- const regex = new RegExp(component.regexPattern);
64
+ const validator = (_rule, _value, callback) => {
65
+ try {
66
+ const isMatch = checkFilterMatch(component.validationPattern, formData.value, fields);
67
+ if (!isMatch) {
68
+ callback(new Error(component.validationMessage || "校验失败"));
69
+ } else {
70
+ callback();
71
+ }
72
+ } catch (error) {
73
+ console.error("Validation function error:", error);
74
+ callback(new Error(component.validationMessage || "校验函数执行出错"));
75
+ }
76
+ };
64
77
  rules.push({
65
- pattern: regex,
66
- message: component.regexMessage || "输入格式不正确",
78
+ validator,
67
79
  trigger: "blur"
68
80
  });
69
81
  } catch (e) {
70
- console.error("Invalid regex pattern:", component.regexPattern, e);
82
+ console.error("Invalid validation pattern:", component.validationPattern, e);
71
83
  }
72
84
  } else if (component.validationType === "custom" && component.customValidator) {
73
85
  try {
@@ -1,4 +1,4 @@
1
- import { inject, createElementBlock, openBlock, Fragment, createCommentVNode, createVNode, createBlock, unref, isRef } from "vue";
1
+ import { inject, computed, createElementBlock, openBlock, Fragment, createCommentVNode, createVNode, createBlock, unref, isRef } from "vue";
2
2
  import { Form } from "../form/index.mjs";
3
3
  import { SubTitle } from "../subTitle/index.mjs";
4
4
  import { H2 } from "../h2/index.mjs";
@@ -50,6 +50,35 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
50
50
  inject("rowHeight");
51
51
  inject("gridLayout");
52
52
  const setFormItemHeight = inject("setFormItemHeight");
53
+ const templateKey = computed(() => {
54
+ if (props.config.formSource == "dynamic") {
55
+ const dynamicSubFormKey = props.config.dynamicSubFormKey;
56
+ if (dynamicSubFormKey) {
57
+ if (typeof dynamicSubFormKey === "object") {
58
+ const fieldId = dynamicSubFormKey.value;
59
+ const fieldsData = props.localConfig.fieldsData.map((item) => {
60
+ return item.component;
61
+ });
62
+ const hiddenFields = props.localConfig.hiddenFields;
63
+ const formItem = [...fieldsData, ...hiddenFields].find(
64
+ (item) => item.id == fieldId
65
+ );
66
+ if (formItem != null) {
67
+ const key = formData.value[formItem.fieldName];
68
+ return key ? key + "V5" : "";
69
+ } else {
70
+ return "";
71
+ }
72
+ } else {
73
+ return dynamicSubFormKey;
74
+ }
75
+ } else {
76
+ return "";
77
+ }
78
+ } else {
79
+ return props.config.subFormKey;
80
+ }
81
+ });
53
82
  function subFormLoaded(subOption) {
54
83
  const fieldsData = subOption.fieldsData;
55
84
  console.log("🚀 ~ loaded ~ subOption:", subOption);
@@ -59,11 +88,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
59
88
  const foundItem = props.localConfig.fieldsData.find(
60
89
  (item) => item.id == props.config.id
61
90
  );
62
- const y = 1;
63
91
  const titleHeight = props.config.titleMode != "none" ? 1 : 0;
64
92
  if (foundItem) {
65
- foundItem.h = maxY + y + titleHeight;
66
- setFormItemHeight(props.config.id, maxY + y + titleHeight);
93
+ foundItem.h = maxY + titleHeight;
94
+ setFormItemHeight(props.config.id, false, maxY + titleHeight);
67
95
  }
68
96
  }
69
97
  return (_ctx, _cache) => {
@@ -78,7 +106,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
78
106
  }, null, 8, ["config"])) : createCommentVNode("", true)
79
107
  ])) : createCommentVNode("", true),
80
108
  createVNode(unref(Form), {
81
- templateKey: __props.config.subFormKey,
109
+ templateKey: unref(templateKey),
82
110
  isSubForm: "",
83
111
  onLoaded: subFormLoaded,
84
112
  canPageEvent: __props.config.triggerSubFormPageEvent,
@@ -79,7 +79,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
79
79
  });
80
80
  function subTableLoaded(subOption) {
81
81
  subTableOption.value = subOption;
82
- console.log("🚀 ~ subTableLoaded ~ subOption:", subOption);
83
82
  const foundItem = props.localConfig.fieldsData.find(
84
83
  (item) => item.id == props.config.id
85
84
  );
@@ -89,6 +88,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
89
88
  foundItem.h = props.config.subTableHeight + titleHeight;
90
89
  setFormItemHeight(
91
90
  props.config.id,
91
+ true,
92
92
  props.config.subTableHeight + titleHeight
93
93
  );
94
94
  }
@@ -262,7 +262,7 @@ async function handleTableRefresh(node, data, fields, context) {
262
262
  var _a, _b, _c;
263
263
  console.log("[EventFlow] 执行表格刷新:", node.basic);
264
264
  const basic = node.basic || {};
265
- const refreshOptions2 = {
265
+ const refreshOptions = {
266
266
  resetSort: basic.resetSort !== false,
267
267
  // 默认 true
268
268
  resetFilter: basic.resetFilter !== false,
@@ -270,11 +270,11 @@ async function handleTableRefresh(node, data, fields, context) {
270
270
  resetPagination: basic.resetPagination !== false
271
271
  // 默认 true
272
272
  };
273
- console.log("[EventFlow] 刷新选项:", refreshOptions2);
273
+ console.log("[EventFlow] 刷新选项:", refreshOptions);
274
274
  const tableComponent = (_a = context.components) == null ? void 0 : _a.table;
275
275
  const refreshMethod = (_c = (_b = tableComponent == null ? void 0 : tableComponent.$) == null ? void 0 : _b.exposed) == null ? void 0 : _c.refresh;
276
276
  if (typeof refreshMethod === "function") {
277
- await refreshMethod(refreshOptions2);
277
+ await refreshMethod(refreshOptions);
278
278
  return {
279
279
  success: true,
280
280
  message: "表格已刷新"
@@ -346,6 +346,11 @@ async function handleTableRowDelete(node, data, fields, context) {
346
346
  const tableComponent = (_a = context.components) == null ? void 0 : _a.table;
347
347
  const refreshMethod = (_c = (_b = tableComponent == null ? void 0 : tableComponent.$) == null ? void 0 : _b.exposed) == null ? void 0 : _c.refresh;
348
348
  if (typeof refreshMethod === "function") {
349
+ const refreshOptions = {
350
+ resetSort: false,
351
+ resetFilter: false,
352
+ resetPagination: false
353
+ };
349
354
  await refreshMethod(refreshOptions);
350
355
  return {
351
356
  success: true,
@@ -531,6 +536,8 @@ async function handleDialog(node, data, fields, context) {
531
536
  } else if (basic.dialogSource == "custom") {
532
537
  const dialogList = context.localConfig.dialogs || [];
533
538
  dialog = dialogList.find((item) => item.id == (basic == null ? void 0 : basic.dialogId));
539
+ dialog.subFormMode = basic.subFormMode;
540
+ dialog.selectionMode = basic.selectionMode;
534
541
  }
535
542
  if (!dialog) {
536
543
  console.error("ui-dialog: 未找到匹配的弹层配置," + (basic == null ? void 0 : basic.dialogId));