@kp-ui/lowcode 2.14.0-beta → 2.14.0-beta.10

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 (117) hide show
  1. package/install.js +26 -25
  2. package/package.json +2 -2
  3. package/src/components/FormRender/useFormRender.js +18 -0
  4. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +18 -18
  5. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue2.js +18 -20
  6. package/src/components/form-designer/form-widget/container-widget/index.js +6 -6
  7. package/src/components/form-designer/form-widget/container-widget/vf-box-item.vue.js +9 -9
  8. package/src/components/form-designer/form-widget/container-widget/vf-dialog-widget.vue.js +20 -19
  9. package/src/components/form-designer/form-widget/field-widget/cascader-widget.vue.js +32 -39
  10. package/src/components/form-designer/form-widget/field-widget/date-range-widget.vue.js +24 -31
  11. package/src/components/form-designer/form-widget/field-widget/date-widget.vue.js +26 -33
  12. package/src/components/form-designer/form-widget/field-widget/diy-compontent-widget.vue.js +1 -1
  13. package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +4 -1
  14. package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue.js +84 -152
  15. package/src/components/form-designer/form-widget/field-widget/input-widget.vue.js +31 -38
  16. package/src/components/form-designer/form-widget/field-widget/number-widget.vue.js +23 -30
  17. package/src/components/form-designer/form-widget/field-widget/select-widget.vue.js +56 -63
  18. package/src/components/form-designer/form-widget/field-widget/switch-widget.vue.js +1 -1
  19. package/src/components/form-designer/form-widget/field-widget/textarea-widget.vue.js +23 -32
  20. package/src/components/form-designer/form-widget/field-widget/treeSelect-widget.vue.js +26 -33
  21. package/src/components/form-designer/index.vue.js +55 -54
  22. package/src/components/form-designer/setting-panel/form-crud-setting.vue.js +62 -23
  23. package/src/components/form-designer/setting-panel/form-setting.vue.js +2 -2
  24. package/src/components/form-designer/setting-panel/form-setting.vue2.js +81 -94
  25. package/src/components/form-designer/setting-panel/index.vue.js +4 -386
  26. package/src/components/form-designer/setting-panel/index.vue2.js +273 -0
  27. package/src/components/form-designer/setting-panel/property-editor/button-list-editor.vue2.js +5 -4
  28. package/src/components/form-designer/setting-panel/property-editor/container-data-table/customRowEvent/data-table-customRow-editor.vue.js +1 -0
  29. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-colorRow-editor.vue2.js +8 -7
  30. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-dsEnabled-editor.vue.js +26 -24
  31. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-pagination-editor.vue.js +1 -0
  32. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-selections-editor.vue2.js +24 -24
  33. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-showButtonsColumn-editor.vue.js +9 -8
  34. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue.js +3 -3
  35. package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue2.js +13 -12
  36. package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/bodyStyle-editor.vue2.js +7 -6
  37. package/src/components/form-designer/setting-panel/property-editor/container-vf-dialog/line-height-editor.vue2.js +7 -6
  38. package/src/components/form-designer/setting-panel/property-editor/customRender-editor.vue.js +2 -40
  39. package/src/components/form-designer/setting-panel/property-editor/customRender-editor.vue2.js +41 -0
  40. package/src/components/form-designer/setting-panel/property-editor/event-handler/onClickIcon-editor.vue.js +2 -47
  41. package/src/components/form-designer/setting-panel/property-editor/event-handler/onClickIcon-editor.vue2.js +44 -0
  42. package/src/components/form-designer/setting-panel/property-editor/event-handler/onCreated-editor.vue.js +2 -47
  43. package/src/components/form-designer/setting-panel/property-editor/event-handler/onCreated-editor.vue2.js +43 -0
  44. package/src/components/form-designer/setting-panel/property-editor/event-handler/onOkButtonClick-editor.vue.js +2 -46
  45. package/src/components/form-designer/setting-panel/property-editor/event-handler/onOkButtonClick-editor.vue2.js +43 -0
  46. package/src/components/form-designer/setting-panel/property-editor/event-handler/onValidate-editor.vue.js +2 -47
  47. package/src/components/form-designer/setting-panel/property-editor/event-handler/onValidate-editor.vue2.js +44 -0
  48. package/src/components/form-designer/setting-panel/property-editor/field-dropdown/dropdown-menuList-editor.vue.js +2 -66
  49. package/src/components/form-designer/setting-panel/property-editor/field-dropdown/dropdown-menuList-editor.vue2.js +42 -0
  50. package/src/components/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue.js +5 -4
  51. package/src/components/form-designer/setting-panel/property-editor/hidden-editor.vue.js +6 -5
  52. package/src/components/form-designer/setting-panel/property-editor/index.js +146 -153
  53. package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue.js +8 -7
  54. package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue.js +38 -35
  55. package/src/components/form-designer/setting-panel/propertyRegister.js +3 -18
  56. package/src/components/form-designer/widget-panel/advanced/cascader.js +0 -1
  57. package/src/components/form-designer/widget-panel/advanced/data-table.js +1 -1
  58. package/src/components/form-designer/widget-panel/advanced/file-upload.js +0 -1
  59. package/src/components/form-designer/widget-panel/advanced/rich-editor.js +4 -5
  60. package/src/components/form-designer/widget-panel/advanced/tree-select.js +0 -1
  61. package/src/components/form-designer/widget-panel/basicFields/checkbox.js +2 -3
  62. package/src/components/form-designer/widget-panel/basicFields/color.js +0 -1
  63. package/src/components/form-designer/widget-panel/basicFields/date.js +0 -1
  64. package/src/components/form-designer/widget-panel/basicFields/dateRange.js +0 -1
  65. package/src/components/form-designer/widget-panel/basicFields/input.js +0 -1
  66. package/src/components/form-designer/widget-panel/basicFields/number.js +0 -1
  67. package/src/components/form-designer/widget-panel/basicFields/radio.js +0 -1
  68. package/src/components/form-designer/widget-panel/basicFields/rate.js +5 -6
  69. package/src/components/form-designer/widget-panel/basicFields/select.js +2 -3
  70. package/src/components/form-designer/widget-panel/basicFields/slider.js +0 -1
  71. package/src/components/form-designer/widget-panel/basicFields/switch.js +0 -1
  72. package/src/components/form-designer/widget-panel/basicFields/textarea.js +0 -1
  73. package/src/components/form-designer/widget-panel/basicFields/time.js +0 -1
  74. package/src/components/form-designer/widget-panel/basicFields/timeRange.js +0 -1
  75. package/src/components/form-designer/widget-panel/business/department-select.js +0 -1
  76. package/src/components/form-designer/widget-panel/business/material-select.js +0 -1
  77. package/src/components/form-designer/widget-panel/business/operation-select.js +2 -3
  78. package/src/components/form-designer/widget-panel/business/post-select.js +0 -1
  79. package/src/components/form-designer/widget-panel/business/project-group-select.js +2 -3
  80. package/src/components/form-designer/widget-panel/business/project-select.js +2 -3
  81. package/src/components/form-designer/widget-panel/business/user-select.js +0 -1
  82. package/src/components/form-render/RenderWigetList.vue.js +61 -0
  83. package/src/components/form-render/RenderWigetList.vue2.js +4 -0
  84. package/src/components/form-render/SubmitButtonRender.vue.js +33 -29
  85. package/src/components/form-render/container-item/container-item-wrapper.vue.js +2 -23
  86. package/src/components/form-render/container-item/container-item-wrapper.vue2.js +20 -0
  87. package/src/components/form-render/container-item/data-table-item.vue.js +135 -0
  88. package/src/components/form-render/container-item/grid-col-item.vue.js +149 -0
  89. package/src/components/form-render/container-item/grid-item.vue.js +92 -0
  90. package/src/components/form-render/container-item/grid-sub-form-item.vue.js +319 -0
  91. package/src/components/form-render/container-item/index.js +24 -0
  92. package/src/components/form-render/container-item/sub-form-item.vue.js +398 -0
  93. package/src/components/form-render/container-item/tab-item.vue.js +160 -0
  94. package/src/components/form-render/container-item/table-cell-item.vue.js +95 -0
  95. package/src/components/form-render/container-item/table-item.vue.js +96 -0
  96. package/src/components/form-render/container-item/vf-collapse-item.vue.js +252 -0
  97. package/src/components/form-render/container-item/vf-dialog-item.vue.js +12 -0
  98. package/src/components/form-render/container-item/vf-drawer-item.vue.js +12 -0
  99. package/src/components/form-render/dynamic-dialog.vue.js +66 -81
  100. package/src/components/form-render/index.vue.js +96 -114
  101. package/src/components/http-editor/index.vue.js +10 -10
  102. package/src/components/public/ActionButtonListRender.vue.js +19 -24
  103. package/src/hooks/useLowcode.js +40 -39
  104. package/src/lang/en-US.js +4 -4
  105. package/src/lang/zh-CN.js +3 -4
  106. package/src/mixins/useDataTableMixin.js +18 -23
  107. package/src/utils/useEmitter.js +57 -0
  108. package/src/utils/util.js +50 -49
  109. package/stats.html +1 -1
  110. package/styles/style.css +1 -1
  111. package/src/components/form-designer/setting-panel/property-editor/displayStyle-editor.vue.js +0 -46
  112. package/src/components/form-designer/setting-panel/property-editor/event-handler/onVformAdd-editor.vue.js +0 -49
  113. package/src/components/form-designer/setting-panel/property-editor/labelTooltip-editor.vue.js +0 -31
  114. package/src/components/form-designer/setting-panel/property-editor/multipleSelect-editor.vue.js +0 -30
  115. package/src/components/form-designer/setting-panel/property-editor/uploadTip-editor.vue.js +0 -31
  116. package/src/components/form-designer/setting-panel/property-editor/uploadURL-editor.vue.js +0 -44
  117. package/src/components/form-designer/setting-panel/property-editor/withCredentials-editor.vue.js +0 -30
@@ -0,0 +1,135 @@
1
+ import p from "./container-item-wrapper.vue2.js";
2
+ import h from "../../../utils/emitter.js";
3
+ import g from "../../../utils/i18n.js";
4
+ import w from "../../form-designer/form-widget/field-widget/index.js";
5
+ import f from "../refMixin.js";
6
+ import C from "./containerItemMixin.js";
7
+ import b from "../../../mixins/useDataTableMixin.js";
8
+ import { resolveComponent as n, withDirectives as y, createBlock as a, openBlock as s, normalizeStyle as l, withCtx as i, createVNode as r, normalizeClass as R, createCommentVNode as S, vShow as F } from "vue";
9
+ /* empty css */
10
+ /* empty css */
11
+ import z from "../../../../_virtual/_plugin-vue_export-helper.js";
12
+ const _ = {
13
+ name: "DataTableItem",
14
+ componentName: "ContainerItem",
15
+ // 必须固定为ContainerItem,用于接收父级组件的broadcast事件
16
+ mixins: [h, g, f, C, b],
17
+ components: {
18
+ ContainerItemWrapper: p,
19
+ ...w
20
+ },
21
+ props: {
22
+ widget: Object,
23
+ data: {
24
+ type: Array,
25
+ default: () => []
26
+ }
27
+ },
28
+ inject: ["refList", "sfRefList", "globalModel", "getFormConfig", "getGlobalDsv"],
29
+ data() {
30
+ return {};
31
+ },
32
+ computed: {
33
+ formConfig() {
34
+ return this.getFormConfig();
35
+ }
36
+ },
37
+ created() {
38
+ this.initRefList(), this.handleOnCreated();
39
+ },
40
+ mounted() {
41
+ this.setPagination({
42
+ pageSize: this.widget.options.pagination.pageSize,
43
+ page: 1,
44
+ total: 1
45
+ }), this.$nextTick(() => {
46
+ this.handleOnMounted();
47
+ });
48
+ },
49
+ beforeUnmount() {
50
+ this.unregisterFromRefList();
51
+ },
52
+ methods: {
53
+ getDataTableRef() {
54
+ return this;
55
+ },
56
+ selectWidget(e) {
57
+ this.designer.setSelected(e);
58
+ },
59
+ handleOnCreated() {
60
+ this.widget.options.onCreated && new Function(this.widget.options.onCreated).call(this);
61
+ },
62
+ handleOnMounted() {
63
+ this.widget.options.onMounted && new Function(this.widget.options.onMounted).call(this);
64
+ },
65
+ // --------------------- 以下为组件支持外部调用的API方法 begin ------------------//
66
+ /* 提示:用户可自行扩充这些方法!!! */
67
+ getTableColumns() {
68
+ return this.widget.options.tableColumns;
69
+ },
70
+ /**
71
+ * 获取选中行数据,格式为对象数组
72
+ * @returns {[]}
73
+ */
74
+ getSelectedRow() {
75
+ return this.selectedRows;
76
+ },
77
+ /**
78
+ * 获取选中行索引,格式为数组
79
+ * @returns {[]}
80
+ */
81
+ getSelectedIndex() {
82
+ return this.selectedIndices;
83
+ }
84
+ // --------------------- 以上为组件支持外部调用的API方法 end ------------------//
85
+ }
86
+ };
87
+ function I(e, T, t, M, v, B) {
88
+ const d = n("a-empty"), m = n("RenderBodyCell"), c = n("s-table"), u = n("container-item-wrapper");
89
+ return y((s(), a(u, {
90
+ style: l({ display: "flex", minWidth: 0, height: parseFloat(e.tableHeight || 0) + "px" }),
91
+ widget: t.widget
92
+ }, {
93
+ default: i(() => [
94
+ r(c, {
95
+ class: R(["tpf-surely-table", [e.customClass]]),
96
+ ref: "dataTable2",
97
+ columns: e.columns.columns,
98
+ size: e.widgetSize,
99
+ dataSource: t.data,
100
+ "deep-watch-data-source": !0,
101
+ rowKey: (o) => o[t.widget.options.rowKey],
102
+ scroll: { y: parseFloat(e.tableHeight || 0), x: 300 },
103
+ bordered: t.widget.options.border,
104
+ style: l({ width: t.widget.options.tableWidth }),
105
+ "row-class-name": e.rowClassName,
106
+ rowSelection: e.handleRowSelection(),
107
+ pagination: e.fmtPagination,
108
+ customRow: e.handleCustomRow,
109
+ onChange: e.handleTablePageChange,
110
+ onResizeColumn: e.handleResizeColumn,
111
+ loading: e.loading,
112
+ "row-height": e.lineHeight
113
+ }, {
114
+ emptyText: i(() => [
115
+ r(d)
116
+ ]),
117
+ bodyCell: i((o) => [
118
+ e.isShowBodyCell(o.column.dataIndex) ? (s(), a(m, {
119
+ key: 0,
120
+ bodyCell: e.columns.bodyCell,
121
+ scope: o
122
+ }, null, 8, ["bodyCell", "scope"])) : S("", !0)
123
+ ]),
124
+ _: 1
125
+ }, 8, ["columns", "class", "size", "dataSource", "rowKey", "scroll", "bordered", "style", "row-class-name", "rowSelection", "pagination", "customRow", "onChange", "onResizeColumn", "loading", "row-height"])
126
+ ]),
127
+ _: 1
128
+ }, 8, ["style", "widget"])), [
129
+ [F, !e.handleHidden()]
130
+ ]);
131
+ }
132
+ const A = /* @__PURE__ */ z(_, [["render", I], ["__scopeId", "data-v-de3544fc"]]);
133
+ export {
134
+ A as default
135
+ };
@@ -0,0 +1,149 @@
1
+ import x from "../../../utils/emitter.js";
2
+ import C from "../../../utils/i18n.js";
3
+ import P from "../refMixin.js";
4
+ import _ from "../../form-designer/form-widget/field-widget/index.js";
5
+ import { resolveComponent as L, withDirectives as k, createBlock as d, openBlock as i, mergeProps as m, withCtx as l, createElementBlock as g, Fragment as p, renderList as u, resolveDynamicComponent as c, createSlots as w, renderSlot as h, createElementVNode as y, toDisplayString as F, vShow as v } from "vue";
6
+ /* empty css */
7
+ import I from "../../../../_virtual/_plugin-vue_export-helper.js";
8
+ const S = {
9
+ name: "GridColItem",
10
+ componentName: "ContainerItem",
11
+ mixins: [x, C, P],
12
+ components: {
13
+ ..._
14
+ },
15
+ props: {
16
+ widget: Object,
17
+ parentWidget: Object,
18
+ parentList: Array,
19
+ indexOfParentList: Number,
20
+ data: Object,
21
+ colHeight: {
22
+ type: String,
23
+ default: null
24
+ },
25
+ subFormRowIndex: {
26
+ /* 子表单组件行索引,从0开始计数 */
27
+ type: Number,
28
+ default: -1
29
+ },
30
+ subFormColIndex: {
31
+ /* 子表单组件列索引,从0开始计数 */
32
+ type: Number,
33
+ default: -1
34
+ },
35
+ subFormRowId: {
36
+ /* 子表单组件行Id,唯一id且不可变 */
37
+ type: String,
38
+ default: ""
39
+ }
40
+ },
41
+ inject: ["refList", "globalModel", "getFormConfig", "previewState"],
42
+ data() {
43
+ return {
44
+ layoutProps: {
45
+ span: this.widget.options.span,
46
+ md: this.widget.options.md || 12,
47
+ sm: this.widget.options.sm || 12,
48
+ xs: this.widget.options.xs || 12,
49
+ offset: this.widget.options.offset || 0,
50
+ push: this.widget.options.push || 0,
51
+ pull: this.widget.options.pull || 0
52
+ }
53
+ };
54
+ },
55
+ computed: {
56
+ isHidden() {
57
+ return this.widget.widgetList.some((t) => t.options.holdHidden ? !1 : t.options.hidden);
58
+ },
59
+ formConfig() {
60
+ return this.getFormConfig();
61
+ },
62
+ customClass() {
63
+ return this.widget.options.customClass || "";
64
+ },
65
+ colHeightStyle() {
66
+ return this.colHeight ? { height: this.colHeight + "px" } : {};
67
+ }
68
+ },
69
+ created() {
70
+ this.initLayoutProps(), this.initRefList();
71
+ },
72
+ methods: {
73
+ initLayoutProps() {
74
+ if (this.widget.options.responsive)
75
+ if (this.previewState) {
76
+ this.layoutProps.md = void 0, this.layoutProps.sm = void 0, this.layoutProps.xs = void 0;
77
+ const t = this.formConfig.layoutType;
78
+ t === "H5" ? this.layoutProps.span = this.widget.options.xs || 12 : t === "Pad" ? this.layoutProps.span = this.widget.options.sm || 12 : this.layoutProps.span = this.widget.options.md || 12;
79
+ } else
80
+ this.layoutProps.span = void 0;
81
+ else
82
+ this.layoutProps.md = void 0, this.layoutProps.sm = void 0, this.layoutProps.xs = void 0;
83
+ }
84
+ }
85
+ }, H = { class: "blank-cell" }, R = { class: "invisible-content" };
86
+ function j(t, O, e, N, b, n) {
87
+ const f = L("a-col");
88
+ return k((i(), d(f, m({
89
+ class: ["grid-cell", [n.customClass]]
90
+ }, b.layoutProps, {
91
+ style: n.colHeightStyle,
92
+ key: e.widget.id
93
+ }), {
94
+ default: l(() => [
95
+ e.widget.widgetList && e.widget.widgetList.length > 0 ? (i(!0), g(p, { key: 0 }, u(e.widget.widgetList, (o, r) => (i(), g(p, null, [
96
+ o.category === "container" ? (i(), d(c(t.getComponentByContainer(o)), {
97
+ widget: o,
98
+ key: r,
99
+ "parent-list": e.widget.widgetList,
100
+ "index-of-parent-list": r,
101
+ "parent-widget": e.widget,
102
+ "sub-form-row-id": e.subFormRowId,
103
+ "sub-form-row-index": e.subFormRowIndex,
104
+ "sub-form-col-index": e.subFormColIndex,
105
+ data: e.data,
106
+ model: n.globalModel
107
+ }, w({ _: 2 }, [
108
+ u(Object.keys(t.$slots), (s) => ({
109
+ name: s,
110
+ fn: l((a) => [
111
+ h(t.$slots, s, m({ ref_for: !0 }, a), void 0, !0)
112
+ ])
113
+ }))
114
+ ]), 1032, ["widget", "parent-list", "index-of-parent-list", "parent-widget", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index", "data", "model"])) : (i(), d(c(o.type + "-widget"), {
115
+ field: o,
116
+ designer: null,
117
+ key: r,
118
+ "parent-list": e.widget.widgetList,
119
+ "index-of-parent-list": r,
120
+ "parent-widget": e.widget,
121
+ "sub-form-row-id": e.subFormRowId,
122
+ "sub-form-row-index": e.subFormRowIndex,
123
+ "sub-form-col-index": e.subFormColIndex
124
+ }, w({ _: 2 }, [
125
+ u(Object.keys(t.$slots), (s) => ({
126
+ name: s,
127
+ fn: l((a) => [
128
+ h(t.$slots, s, m({ ref_for: !0 }, a), void 0, !0)
129
+ ])
130
+ }))
131
+ ]), 1032, ["field", "parent-list", "index-of-parent-list", "parent-widget", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index"]))
132
+ ], 64))), 256)) : (i(), d(f, { key: 1 }, {
133
+ default: l(() => [
134
+ y("div", H, [
135
+ y("span", R, F(t.i18nt("render.hint.blankCellContent")), 1)
136
+ ])
137
+ ]),
138
+ _: 1
139
+ }))
140
+ ]),
141
+ _: 3
142
+ }, 16, ["class", "style"])), [
143
+ [v, !n.isHidden && !e.widget.options.hidden]
144
+ ]);
145
+ }
146
+ const V = /* @__PURE__ */ I(S, [["render", j], ["__scopeId", "data-v-8b0497df"]]);
147
+ export {
148
+ V as default
149
+ };
@@ -0,0 +1,92 @@
1
+ import g from "../../../utils/emitter.js";
2
+ import w from "../../../utils/i18n.js";
3
+ import _ from "../refMixin.js";
4
+ import b from "./container-item-wrapper.vue2.js";
5
+ import p from "./grid-col-item.vue.js";
6
+ import h from "./containerItemMixin.js";
7
+ import { resolveComponent as i, createBlock as r, openBlock as t, withCtx as n, withDirectives as x, normalizeClass as I, createElementBlock as C, Fragment as F, renderList as a, createSlots as R, renderSlot as k, mergeProps as y, vShow as j } from "vue";
8
+ import L from "../../../../_virtual/_plugin-vue_export-helper.js";
9
+ const v = {
10
+ name: "vf-grid-item",
11
+ //grid-item跟VueGridLayout全局注册组件重名,故特殊处理!!
12
+ componentName: "ContainerItem",
13
+ mixins: [g, w, _, h],
14
+ components: {
15
+ ContainerItemWrapper: b,
16
+ GridColItem: p
17
+ },
18
+ props: {
19
+ widget: Object,
20
+ model: Object,
21
+ data: Object,
22
+ subFormRowIndex: {
23
+ /* 子表单组件行索引,从0开始计数 */
24
+ type: Number,
25
+ default: -1
26
+ },
27
+ subFormColIndex: {
28
+ /* 子表单组件列索引,从0开始计数 */
29
+ type: Number,
30
+ default: -1
31
+ },
32
+ subFormRowId: {
33
+ /* 子表单组件行Id,唯一id且不可变 */
34
+ type: String,
35
+ default: ""
36
+ }
37
+ },
38
+ inject: ["refList", "sfRefList", "globalModel"],
39
+ created() {
40
+ this.initRefList();
41
+ },
42
+ mounted() {
43
+ },
44
+ beforeUnmount() {
45
+ this.unregisterFromRefList();
46
+ },
47
+ methods: {}
48
+ };
49
+ function O(o, S, e, B, M, N) {
50
+ const s = i("grid-col-item"), c = i("a-row"), l = i("container-item-wrapper");
51
+ return t(), r(l, { widget: e.widget }, {
52
+ default: n(() => [
53
+ x((t(), r(c, {
54
+ key: e.widget.id,
55
+ gutter: e.widget.options.gutter,
56
+ class: I(["grid-container", [o.customClass]]),
57
+ ref: e.widget.id
58
+ }, {
59
+ default: n(() => [
60
+ (t(!0), C(F, null, a(e.widget.cols, (f, m) => (t(), r(s, {
61
+ key: m,
62
+ model: e.model,
63
+ data: e.data,
64
+ widget: f,
65
+ "parent-list": e.widget.cols,
66
+ "index-of-parent-list": m,
67
+ "parent-widget": e.widget,
68
+ "col-height": e.widget.options.colHeight,
69
+ "sub-form-row-id": e.subFormRowId,
70
+ "sub-form-row-index": e.subFormRowIndex,
71
+ "sub-form-col-index": e.subFormColIndex
72
+ }, R({ _: 2 }, [
73
+ a(Object.keys(o.$slots), (d) => ({
74
+ name: d,
75
+ fn: n((u) => [
76
+ k(o.$slots, d, y({ ref_for: !0 }, u))
77
+ ])
78
+ }))
79
+ ]), 1032, ["model", "data", "widget", "parent-list", "index-of-parent-list", "parent-widget", "col-height", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index"]))), 128))
80
+ ]),
81
+ _: 3
82
+ }, 8, ["gutter", "class"])), [
83
+ [j, !e.widget.options.hidden]
84
+ ])
85
+ ]),
86
+ _: 3
87
+ }, 8, ["widget"]);
88
+ }
89
+ const q = /* @__PURE__ */ L(v, [["render", O]]);
90
+ export {
91
+ q as default
92
+ };
@@ -0,0 +1,319 @@
1
+ import v from "../../../utils/emitter.js";
2
+ import I from "../../../utils/i18n.js";
3
+ import { deepClone as F, generateId as m, traverseFieldWidgetsOfContainer as T } from "../../../utils/util.js";
4
+ import y from "../refMixin.js";
5
+ import A from "./container-item-wrapper.vue2.js";
6
+ import M from "./containerItemMixin.js";
7
+ import E from "../../form-designer/form-widget/field-widget/index.js";
8
+ import { TpfConfirm as B } from "../../../hooks/TpfConfirm.js";
9
+ import { SvgIcon as N } from "tmgc2-share";
10
+ import { resolveComponent as f, createBlock as p, openBlock as s, withCtx as l, withDirectives as S, createElementBlock as u, createElementVNode as r, Fragment as R, renderList as C, normalizeClass as _, createVNode as h, vShow as W, toDisplayString as L, resolveDynamicComponent as O, createCommentVNode as V, createTextVNode as H } from "vue";
11
+ /* empty css */
12
+ import j from "../../../../_virtual/_plugin-vue_export-helper.js";
13
+ const x = {
14
+ name: "grid-sub-form-item",
15
+ componentName: "ContainerItem",
16
+ mixins: [v, I, y, M],
17
+ components: {
18
+ SvgIcon: N,
19
+ ContainerItemWrapper: A,
20
+ ...E
21
+ },
22
+ props: {
23
+ widget: Object
24
+ },
25
+ provide() {
26
+ return {
27
+ getSubFormFieldFlag: () => !0,
28
+ getSubFormName: () => this.widget.options.name
29
+ };
30
+ },
31
+ inject: ["refList", "sfRefList", "globalModel", "getReadMode"],
32
+ data() {
33
+ return {
34
+ rowIdData: [],
35
+ widgetSchemaData: [],
36
+ actionDisabled: !1,
37
+ insertDisabled: !1,
38
+ //是否禁止新增、插入记录
39
+ deleteDisabled: !1,
40
+ //是否禁止删除记录
41
+ fieldWidgetList: []
42
+ };
43
+ },
44
+ computed: {
45
+ isReadMode() {
46
+ return this.getReadMode();
47
+ },
48
+ actionBtnsClass() {
49
+ return this.widget.options.actionColumnPosition, "right-action-column";
50
+ }
51
+ },
52
+ created() {
53
+ this.initRefList(), this.registerSubFormToRefList(), this.initRowIdData(!0), this.initWidgetSchemaData(), this.initEventHandler();
54
+ },
55
+ mounted() {
56
+ this.extractFieldWidgetList(), this.handleSubFormFirstRowAdd();
57
+ },
58
+ beforeUnmount() {
59
+ this.unregisterFromRefList();
60
+ },
61
+ methods: {
62
+ extractFieldWidgetList() {
63
+ this.fieldWidgetList.splice(0, this.fieldWidgetList.length);
64
+ const t = (e) => {
65
+ this.fieldWidgetList.push(e);
66
+ };
67
+ T(this.widget, t);
68
+ },
69
+ getLabelAlign(t, e) {
70
+ return e.options.labelAlign || t.options.labelAlign;
71
+ },
72
+ registerSubFormToRefList() {
73
+ this.widget.type === "grid-sub-form" && (this.sfRefList[this.widget.options.name] = this);
74
+ },
75
+ initRowIdData(t) {
76
+ if (this.widget.type === "grid-sub-form") {
77
+ this.rowIdData.splice(0, this.rowIdData.length);
78
+ const e = this.formModel[this.widget.options.name];
79
+ e && e.length > 0 && (e.forEach(() => {
80
+ this.rowIdData.push("id" + m());
81
+ }), t && setTimeout(() => {
82
+ this.handleSubFormRowChange(e);
83
+ }, 800));
84
+ }
85
+ },
86
+ addToRowIdData() {
87
+ this.rowIdData.push("id" + m());
88
+ },
89
+ insertToRowIdData(t) {
90
+ this.rowIdData.splice(t, 0, "id" + m());
91
+ },
92
+ deleteFromRowIdData(t) {
93
+ this.rowIdData.splice(t, 1);
94
+ },
95
+ getRowIdData() {
96
+ return this.rowIdData;
97
+ },
98
+ getWidgetRefOfSubForm(t, e) {
99
+ const i = t + "@row" + this.rowIdData[e];
100
+ return this.getWidgetRef(i);
101
+ },
102
+ initWidgetSchemaData() {
103
+ if (this.widget.type !== "grid-sub-form")
104
+ return;
105
+ const t = this.rowIdData.length;
106
+ if (this.widgetSchemaData.splice(0, this.widgetSchemaData.length), t > 0)
107
+ for (let e = 0; e < t; e++) {
108
+ const i = [];
109
+ this.widget.widgetList.forEach((a) => {
110
+ i.push(this.cloneSchemaOfWidget(a));
111
+ }), this.widgetSchemaData.push(i);
112
+ }
113
+ },
114
+ addToWidgetSchemaData(t) {
115
+ const e = [];
116
+ this.widget.widgetList.forEach((i) => {
117
+ e.push(this.cloneSchemaOfWidget(i));
118
+ }), t === void 0 ? this.widgetSchemaData.push(e) : this.widgetSchemaData.splice(t, 0, e);
119
+ },
120
+ deleteFromWidgetSchemaData(t) {
121
+ this.widgetSchemaData.splice(t, 1);
122
+ },
123
+ cloneSchemaOfWidget(t) {
124
+ const e = F(t);
125
+ return e.id = t.type + m(), e;
126
+ },
127
+ initEventHandler() {
128
+ this.widget.type === "grid-sub-form" && this.on$("setFormData", (t) => {
129
+ this.initRowIdData(!1), this.initWidgetSchemaData();
130
+ const e = t[this.widget.options.name] || [];
131
+ setTimeout(() => {
132
+ this.handleSubFormRowChange(e);
133
+ }, 800);
134
+ });
135
+ },
136
+ handleSubFormFirstRowAdd() {
137
+ if (this.widget.type === "grid-sub-form" && this.widget.options.showBlankRow && this.rowIdData.length === 1) {
138
+ const t = this.formModel[this.widget.options.name] || [];
139
+ this.$nextTick(() => {
140
+ this.handleSubFormRowAdd(t, this.rowIdData[0]), this.handleSubFormRowChange(t);
141
+ });
142
+ }
143
+ },
144
+ addSubFormRow() {
145
+ const t = {};
146
+ this.fieldWidgetList.forEach((i) => {
147
+ i.formItemFlag && (t[i.options.name] = i.options.defaultValue);
148
+ });
149
+ const e = this.formModel[this.widget.options.name] || [];
150
+ e.push(t), this.addToRowIdData(), this.addToWidgetSchemaData(), this.$nextTick(() => {
151
+ this.handleSubFormRowAdd(
152
+ e,
153
+ this.rowIdData[e.length - 1]
154
+ ), this.handleSubFormRowChange(e);
155
+ });
156
+ },
157
+ insertSubFormRow(t) {
158
+ const e = {};
159
+ this.fieldWidgetList.forEach((a) => {
160
+ a.formItemFlag && (e[a.options.name] = a.options.defaultValue);
161
+ });
162
+ const i = this.formModel[this.widget.options.name] || [];
163
+ i.splice(t, 0, e), this.insertToRowIdData(t), this.addToWidgetSchemaData(t), this.$nextTick(() => {
164
+ this.handleSubFormRowInsert(i, this.rowIdData[t]), this.handleSubFormRowChange(i);
165
+ });
166
+ },
167
+ deleteSubFormRow(t) {
168
+ B({
169
+ type: "confirm",
170
+ content: this.i18nt("render.hint.deleteSubFormRow") + "?",
171
+ title: this.i18nt("render.hint.prompt"),
172
+ okText: this.i18nt("render.hint.confirm"),
173
+ cancelText: this.i18nt("render.hint.cancel")
174
+ }).then(() => {
175
+ const e = this.formModel[this.widget.options.name] || [], i = F(e[t]);
176
+ e.splice(t, 1), this.deleteFromRowIdData(t), this.deleteFromWidgetSchemaData(t), this.$nextTick(() => {
177
+ this.handleSubFormRowDelete(e, i), this.handleSubFormRowChange(e);
178
+ });
179
+ }).catch(() => {
180
+ });
181
+ },
182
+ handleSubFormRowChange(t) {
183
+ this.widget.options.onSubFormRowChange && new Function(
184
+ "subFormData",
185
+ this.widget.options.onSubFormRowChange
186
+ ).call(this, t);
187
+ },
188
+ handleSubFormRowAdd(t, e) {
189
+ this.widget.options.onSubFormRowAdd && new Function(
190
+ "subFormData",
191
+ "newRowId",
192
+ this.widget.options.onSubFormRowAdd
193
+ ).call(this, t, e);
194
+ },
195
+ handleSubFormRowInsert(t, e) {
196
+ this.widget.options.onSubFormRowInsert && new Function(
197
+ "subFormData",
198
+ "newRowId",
199
+ this.widget.options.onSubFormRowInsert
200
+ ).call(this, t, e);
201
+ },
202
+ handleSubFormRowDelete(t, e) {
203
+ this.widget.options.onSubFormRowDelete && new Function(
204
+ "subFormData",
205
+ "deletedDataRow",
206
+ this.widget.options.onSubFormRowDelete
207
+ ).call(this, t, e);
208
+ },
209
+ setDisabled(t) {
210
+ t ? this.disableGridSubForm() : this.enableGridSubForm();
211
+ },
212
+ /**
213
+ * 设置单行子表单是否禁止新增、插入记录
214
+ * @param flag
215
+ */
216
+ setInsertDisabled(t) {
217
+ this.insertDisabled = t;
218
+ },
219
+ /**
220
+ * 设置单行子表单是否禁止删除记录
221
+ * @param flag
222
+ */
223
+ setDeleteDisabled(t) {
224
+ this.deleteDisabled = t;
225
+ }
226
+ }
227
+ }, z = { class: "row-no-column" }, G = { class: "row-number-span" }, P = { class: "grid-sub-form-data-row" }, U = { class: "header-row" };
228
+ function q(t, e, i, a, o, n) {
229
+ const w = f("svg-icon"), g = f("a-button"), k = f("container-item-wrapper");
230
+ return s(), p(k, { widget: i.widget }, {
231
+ default: l(() => [
232
+ S((s(), u("div", {
233
+ key: i.widget.id,
234
+ class: "sub-form-container"
235
+ }, [
236
+ (s(!0), u(R, null, C(o.rowIdData, (D, d) => (s(), u("div", {
237
+ class: "sub-form-row",
238
+ key: D
239
+ }, [
240
+ r("div", {
241
+ class: _(["sub-form-action-column hide-label", n.actionBtnsClass])
242
+ }, [
243
+ S(r("div", {
244
+ class: _(["action-button-column", n.actionBtnsClass])
245
+ }, [
246
+ h(g, {
247
+ type: "link",
248
+ title: t.i18nt("render.hint.insertSubFormRow"),
249
+ disabled: o.actionDisabled || o.deleteDisabled,
250
+ onClick: (b) => n.insertSubFormRow(d)
251
+ }, {
252
+ icon: l(() => [
253
+ h(w, { "icon-class": "icon-el-plus" })
254
+ ]),
255
+ _: 2
256
+ }, 1032, ["title", "disabled", "onClick"]),
257
+ h(g, {
258
+ type: "link",
259
+ title: t.i18nt("render.hint.deleteSubFormRow"),
260
+ disabled: o.actionDisabled || o.deleteDisabled,
261
+ onClick: (b) => n.deleteSubFormRow(d)
262
+ }, {
263
+ icon: l(() => [
264
+ h(w, { "icon-class": "icon-el-delete" })
265
+ ]),
266
+ _: 2
267
+ }, 1032, ["title", "disabled", "onClick"])
268
+ ], 2), [
269
+ [W, !n.isReadMode]
270
+ ])
271
+ ], 2),
272
+ r("div", z, [
273
+ r("span", G, "#" + L(d + 1), 1)
274
+ ]),
275
+ r("div", P, [
276
+ (s(!0), u(R, null, C(i.widget.widgetList, (b, c) => (s(), p(O(t.getComponentByContainer(b)), {
277
+ key: o.widgetSchemaData[d][c].id,
278
+ widget: o.widgetSchemaData[d][c],
279
+ "parent-list": i.widget.widgetList,
280
+ "index-of-parent-list": c,
281
+ "parent-widget": i.widget,
282
+ "sub-form-row-id": D,
283
+ "sub-form-row-index": d,
284
+ "sub-form-col-index": c
285
+ }, null, 8, ["widget", "parent-list", "index-of-parent-list", "parent-widget", "sub-form-row-id", "sub-form-row-index", "sub-form-col-index"]))), 128))
286
+ ])
287
+ ]))), 128)),
288
+ r("div", U, [
289
+ n.isReadMode ? V("", !0) : (s(), p(g, {
290
+ key: 0,
291
+ block: "",
292
+ disabled: o.actionDisabled || o.insertDisabled,
293
+ shape: "round",
294
+ type: "dashed",
295
+ size: "small",
296
+ class: "action-button",
297
+ onClick: n.addSubFormRow,
298
+ title: t.i18nt("render.hint.subFormAddActionHint")
299
+ }, {
300
+ icon: l(() => [
301
+ h(w, { "icon-class": "icon-el-plus" })
302
+ ]),
303
+ default: l(() => [
304
+ H(" " + L(t.i18nt("render.hint.subFormAddAction")), 1)
305
+ ]),
306
+ _: 1
307
+ }, 8, ["disabled", "onClick", "title"]))
308
+ ])
309
+ ])), [
310
+ [W, !i.widget.options.hidden]
311
+ ])
312
+ ]),
313
+ _: 1
314
+ }, 8, ["widget"]);
315
+ }
316
+ const st = /* @__PURE__ */ j(x, [["render", q], ["__scopeId", "data-v-5f0ac14f"]]);
317
+ export {
318
+ st as default
319
+ };