@ibiz-template/vue3-components 0.7.41-alpha.37 → 0.7.41-alpha.39
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/dist/ibiz-markdown-editor-D4Og0fLv.js +1 -0
- package/dist/{index-BiFsbM1Y.js → index-BewO9StC.js} +1 -1
- package/dist/{index-BFGNWF-0.js → index-ClxO69TM.js} +1 -1
- package/dist/index-DHKZJQyN.js +11 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-BYeoazrn.js +1 -0
- package/dist/{xlsx-util-DZ5-cWNj.js → xlsx-util-DpgMzatq.js} +1 -1
- package/es/control/form/form-detail/form-item/form-item-container/form-item-container.mjs +42 -8
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +10 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +309 -0
- package/es/editor/code/code-editor.controller.mjs +223 -1
- package/es/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/es/editor/code/monaco-editor/monaco-editor.mjs +132 -10
- package/es/editor/html/html-editor.controller.mjs +122 -2
- package/es/editor/html/wang-editor/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/index.mjs +1 -0
- package/es/editor/html/wang-editor/module/inline-ai-module.mjs +95 -0
- package/es/editor/html/wang-editor/wang-editor.css +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +41 -4
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +43 -0
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +143 -9
- package/es/editor/markdown/markdown-editor.controller.mjs +218 -1
- package/es/index.mjs +1 -0
- package/es/locale/en/index.mjs +18 -2
- package/es/locale/zh-CN/index.mjs +18 -2
- package/es/util/ai-util/ai-util.mjs +6 -2
- package/es/util/app-util/app-util.mjs +41 -2
- package/es/util/index.mjs +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +142 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +217 -0
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +220 -0
- package/es/util/inline-ai-util/inline-ai-util.mjs +145 -0
- package/es/web-app/main.mjs +2 -0
- package/lib/control/form/form-detail/form-item/form-item-container/form-item-container.cjs +42 -8
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +10 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +311 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.css +1 -0
- package/lib/editor/code/code-editor.controller.cjs +222 -0
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +132 -10
- package/lib/editor/code/monaco-editor/monaco-editor.css +1 -1
- package/lib/editor/html/html-editor.controller.cjs +120 -0
- package/lib/editor/html/wang-editor/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/index.cjs +3 -0
- package/lib/editor/html/wang-editor/module/inline-ai-module.cjs +98 -0
- package/lib/editor/html/wang-editor/wang-editor.cjs +41 -4
- package/lib/editor/html/wang-editor/wang-editor.css +1 -1
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +45 -0
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +143 -9
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/markdown/markdown-editor.controller.cjs +217 -0
- package/lib/index.cjs +2 -0
- package/lib/locale/en/index.cjs +18 -2
- package/lib/locale/zh-CN/index.cjs +18 -2
- package/lib/util/ai-util/ai-util.cjs +6 -2
- package/lib/util/app-util/app-util.cjs +40 -1
- package/lib/util/index.cjs +2 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +151 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +222 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +222 -0
- package/lib/util/inline-ai-util/inline-ai-util.cjs +147 -0
- package/lib/web-app/main.cjs +2 -0
- package/package.json +5 -5
- package/dist/ibiz-markdown-editor-Cs1m7gKI.js +0 -1
- package/dist/index-Dds3BDDF.js +0 -11
- package/dist/wang-editor-4cJ6X_hb.js +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { h, createApp } from 'vue';
|
|
2
|
+
import ContextMenu from '@imengyu/vue3-context-menu';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import { InlineAITextArea } from './inline-ai-textarea/inline-ai-textarea.mjs';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __publicField = (obj, key, value) => {
|
|
10
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
class InLineAIUtil {
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of InLineAIUtil.
|
|
16
|
+
* @memberof InLineAIUtil
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
__publicField(this, "currentApp", null);
|
|
20
|
+
__publicField(this, "container", null);
|
|
21
|
+
__publicField(this, "ns", useNamespace("inline-ai-container"));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 计算上下文菜单
|
|
25
|
+
* @param deACMode
|
|
26
|
+
* @param clickCallBack
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
calcContextMenus(deACMode, clickCallBack) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const menus = [];
|
|
32
|
+
if (!deACMode || !deACMode.deuiactionGroup || !deACMode.deuiactionGroup.uiactionGroupDetails)
|
|
33
|
+
return menus;
|
|
34
|
+
(_b = (_a = deACMode.deuiactionGroup) == null ? void 0 : _a.uiactionGroupDetails) == null ? void 0 : _b.forEach((item) => {
|
|
35
|
+
var _a2, _b2, _c;
|
|
36
|
+
const menuItem = {};
|
|
37
|
+
if (item.detailType === "DEUIACTION" && ((_a2 = item.uiactionId) == null ? void 0 : _a2.startsWith("inline"))) {
|
|
38
|
+
if (item.showCaption && item.caption) {
|
|
39
|
+
menuItem.label = item.caption;
|
|
40
|
+
}
|
|
41
|
+
if (item.sysImage && item.showIcon) {
|
|
42
|
+
menuItem.icon = h("iBizIcon", {
|
|
43
|
+
icon: item.sysImage
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
menuItem.clickClose = true;
|
|
47
|
+
const { uiactionId } = item;
|
|
48
|
+
if (uiactionId) {
|
|
49
|
+
menuItem.onClick = () => {
|
|
50
|
+
clickCallBack(uiactionId);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
menus.push(menuItem);
|
|
54
|
+
} else if (item.detailType === "DEUIACTIONGROUP" && item.refUIActionGroup && ((_b2 = item.refUIActionGroup.id) == null ? void 0 : _b2.startsWith("inline"))) {
|
|
55
|
+
menuItem.label = item.refUIActionGroup.name;
|
|
56
|
+
const menuItems = (_c = item.refUIActionGroup.uiactionGroupDetails) == null ? void 0 : _c.filter((detail) => {
|
|
57
|
+
var _a3;
|
|
58
|
+
return detail.detailType === "DEUIACTION" && ((_a3 = detail.uiactionId) == null ? void 0 : _a3.startsWith("inline"));
|
|
59
|
+
}).map((detail) => {
|
|
60
|
+
return {
|
|
61
|
+
label: detail.showCaption ? detail.caption : void 0,
|
|
62
|
+
icon: detail.showIcon && detail.sysImage ? h("iBizIcon", {
|
|
63
|
+
icon: detail.sysImage
|
|
64
|
+
}) : void 0,
|
|
65
|
+
clickableWhenHasChildren: true,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
ContextMenu.closeContextMenu();
|
|
68
|
+
clickCallBack(detail.uiactionId);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
menuItem.children = menuItems;
|
|
73
|
+
menus.push(menuItem);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return menus;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 显示上下文菜单
|
|
80
|
+
* @param x 距离左侧距离
|
|
81
|
+
* @param y 距离上方距离
|
|
82
|
+
* @param menus 菜单集合
|
|
83
|
+
*/
|
|
84
|
+
showContextMenus(x, y, menus) {
|
|
85
|
+
ContextMenu.showContextMenu({
|
|
86
|
+
x,
|
|
87
|
+
y,
|
|
88
|
+
customClass: this.ns.b("context-menu"),
|
|
89
|
+
items: menus
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 销毁组件实例
|
|
94
|
+
*/
|
|
95
|
+
destroyInlineAIComponent() {
|
|
96
|
+
if (this.currentApp && this.container) {
|
|
97
|
+
this.currentApp.unmount();
|
|
98
|
+
this.currentApp = null;
|
|
99
|
+
}
|
|
100
|
+
if (this.container && document.body.contains(this.container)) {
|
|
101
|
+
document.body.removeChild(this.container);
|
|
102
|
+
this.container = null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 显示AI聊天组件
|
|
107
|
+
* @param selectText
|
|
108
|
+
* @param options
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
showAIChat(context, params, data, selectText, deACMode, options) {
|
|
112
|
+
this.destroyInlineAIComponent();
|
|
113
|
+
this.container = document.createElement("div");
|
|
114
|
+
this.container.id = this.ns.b();
|
|
115
|
+
this.container.className = this.ns.b();
|
|
116
|
+
document.body.appendChild(this.container);
|
|
117
|
+
const { editor } = params;
|
|
118
|
+
const { insertText, replaceSelectionText, restoreSelection } = editor;
|
|
119
|
+
delete params.editor;
|
|
120
|
+
const unMountAIChat = () => {
|
|
121
|
+
this.destroyInlineAIComponent();
|
|
122
|
+
};
|
|
123
|
+
this.currentApp = createApp(InlineAITextArea, {
|
|
124
|
+
context,
|
|
125
|
+
params,
|
|
126
|
+
data,
|
|
127
|
+
content: selectText,
|
|
128
|
+
deACMode,
|
|
129
|
+
options,
|
|
130
|
+
insertText: insertText.bind(editor),
|
|
131
|
+
replaceSelectionText: replaceSelectionText.bind(editor),
|
|
132
|
+
restoreSelection: restoreSelection.bind(editor),
|
|
133
|
+
unMountAIChat
|
|
134
|
+
});
|
|
135
|
+
this.currentApp.mount(this.container);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 隐藏AI聊天组件
|
|
139
|
+
*/
|
|
140
|
+
hideAIChat() {
|
|
141
|
+
this.destroyInlineAIComponent();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { InLineAIUtil };
|
package/es/web-app/main.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import { NotificationUtil } from '../util/notification-util/notification-util.mj
|
|
|
21
21
|
import { LoadingUtil } from '../util/loading-util/loading-util.mjs';
|
|
22
22
|
import { NoticeUtil } from '../util/notice-util/notice-util.mjs';
|
|
23
23
|
import { OverlayController } from '../util/overlay-controller/overlay-controller.mjs';
|
|
24
|
+
import { InLineAIUtil } from '../util/inline-ai-util/inline-ai-util.mjs';
|
|
24
25
|
import { FullscreenUtil } from '../util/fullscreen/fullscreen-util.mjs';
|
|
25
26
|
|
|
26
27
|
"use strict";
|
|
@@ -81,6 +82,7 @@ async function runApp(plugins, opts) {
|
|
|
81
82
|
ibiz.loading = new LoadingUtil();
|
|
82
83
|
ibiz.notice = new NoticeUtil();
|
|
83
84
|
ibiz.overlay = new OverlayController();
|
|
85
|
+
ibiz.inLineAIUtil = new InLineAIUtil();
|
|
84
86
|
ibiz.util.text.format = (value, code) => {
|
|
85
87
|
return app.config.globalProperties.$textFormat(value, code);
|
|
86
88
|
};
|
|
@@ -56,7 +56,7 @@ const IBizFormItemContainer = /* @__PURE__ */ vue.defineComponent({
|
|
|
56
56
|
}, null);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
const
|
|
59
|
+
const renderTipsIcon = () => {
|
|
60
60
|
return vue.createVNode(vue.resolveComponent("el-tooltip"), {
|
|
61
61
|
"effect": "light",
|
|
62
62
|
"visible": visible.value,
|
|
@@ -66,16 +66,42 @@ const IBizFormItemContainer = /* @__PURE__ */ vue.defineComponent({
|
|
|
66
66
|
"placement": labelPos === "RIGHT" ? "right" : "left"
|
|
67
67
|
}, {
|
|
68
68
|
default: () => {
|
|
69
|
-
return vue.createVNode("
|
|
70
|
-
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
71
|
-
}, [enableInputTip && ibiz.config.form.showTipsIcon && vue.createVNode("ion-icon", {
|
|
69
|
+
return vue.createVNode("ion-icon", {
|
|
72
70
|
"name": "bulb-outline",
|
|
73
71
|
"class": ns.em("label", "icon")
|
|
74
|
-
}, null)
|
|
72
|
+
}, null);
|
|
73
|
+
},
|
|
74
|
+
content: () => {
|
|
75
|
+
return vue.createVNode("div", {
|
|
76
|
+
"class": ns.em("popper", "content")
|
|
77
|
+
}, [vue.createVNode("div", {
|
|
78
|
+
"class": ns.em("popper", "tooltip")
|
|
79
|
+
}, [renderTipContent()]), c.state.inputTipUrl && vue.createVNode("a", {
|
|
80
|
+
"target": "_blank",
|
|
81
|
+
"href": c.state.inputTipUrl,
|
|
82
|
+
"title": ibiz.i18n.t("component.formItemContainer.more")
|
|
83
|
+
}, [ibiz.i18n.t("component.formItemContainer.more")])]);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const renderLabelWithoutTips = () => {
|
|
88
|
+
return vue.createVNode(vue.resolveComponent("el-tooltip"), {
|
|
89
|
+
"effect": "light",
|
|
90
|
+
"visible": visible.value,
|
|
91
|
+
"onUpdate:visible": ($event) => visible.value = $event,
|
|
92
|
+
"popper-class": [ns.e("popper"), ns.is(ibiz.config.tooltiprendermode.toLowerCase(), true)],
|
|
93
|
+
"disabled": !enableInputTip,
|
|
94
|
+
"placement": labelPos === "RIGHT" ? "right" : "left"
|
|
95
|
+
}, {
|
|
96
|
+
default: () => {
|
|
97
|
+
return vue.createVNode("div", {
|
|
98
|
+
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
99
|
+
}, [sysImage && vue.createVNode(vue3Util.IBizIcon, {
|
|
75
100
|
"class": ns.em("label", "icon"),
|
|
76
101
|
"icon": sysImage
|
|
77
102
|
}, null), vue.createVNode("div", {
|
|
78
|
-
"class": ns.em("label", "text")
|
|
103
|
+
"class": ns.em("label", "text"),
|
|
104
|
+
"title": enableInputTip ? void 0 : core.showTitle(c.labelCaption)
|
|
79
105
|
}, [c.labelCaption])]);
|
|
80
106
|
},
|
|
81
107
|
content: () => {
|
|
@@ -92,10 +118,18 @@ const IBizFormItemContainer = /* @__PURE__ */ vue.defineComponent({
|
|
|
92
118
|
});
|
|
93
119
|
};
|
|
94
120
|
const renderLabel = () => {
|
|
121
|
+
const showTipsIcon = enableInputTip && ibiz.config.form.showTipsIcon;
|
|
95
122
|
return vue.createVNode("div", {
|
|
96
|
-
"title": enableInputTip ? void 0 : core.showTitle(c.labelCaption),
|
|
97
123
|
"class": [ns.e("label"), ...c.labelClass || []]
|
|
98
|
-
}, [
|
|
124
|
+
}, [showTipsIcon && vue.createVNode("div", {
|
|
125
|
+
"class": [ns.em("label", "content"), ns.is("tooltip", enableInputTip)]
|
|
126
|
+
}, [renderTipsIcon(), sysImage && vue.createVNode(vue3Util.IBizIcon, {
|
|
127
|
+
"class": ns.em("label", "icon"),
|
|
128
|
+
"icon": sysImage
|
|
129
|
+
}, null), vue.createVNode("div", {
|
|
130
|
+
"class": ns.em("label", "text"),
|
|
131
|
+
"title": core.showTitle(c.labelCaption)
|
|
132
|
+
}, [c.labelCaption])]), !showTipsIcon && renderLabelWithoutTips()]);
|
|
99
133
|
};
|
|
100
134
|
return {
|
|
101
135
|
ns,
|
package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs
CHANGED
|
@@ -6,6 +6,7 @@ var vue3Util = require('@ibiz-template/vue3-util');
|
|
|
6
6
|
var repeaterSingleForm = require('./repeater-single-form/repeater-single-form.cjs');
|
|
7
7
|
var repeaterMultiForm = require('./repeater-multi-form/repeater-multi-form.cjs');
|
|
8
8
|
var repeaterGrid = require('./repeater-grid/repeater-grid.cjs');
|
|
9
|
+
var repeaterGrid2 = require('./repeater-grid2/repeater-grid2.cjs');
|
|
9
10
|
|
|
10
11
|
"use strict";
|
|
11
12
|
const FormMDCtrlRepeater = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -27,6 +28,7 @@ const FormMDCtrlRepeater = /* @__PURE__ */ vue.defineComponent({
|
|
|
27
28
|
};
|
|
28
29
|
},
|
|
29
30
|
render() {
|
|
31
|
+
var _a;
|
|
30
32
|
const classNames = [this.ns.b()];
|
|
31
33
|
switch (this.controller.repeaterStyle) {
|
|
32
34
|
case "MultiForm":
|
|
@@ -36,6 +38,14 @@ const FormMDCtrlRepeater = /* @__PURE__ */ vue.defineComponent({
|
|
|
36
38
|
"controller": this.controller
|
|
37
39
|
}, null);
|
|
38
40
|
case "Grid":
|
|
41
|
+
const gridStyle = (_a = this.controller.model.ctrlParams) == null ? void 0 : _a.gridStyle;
|
|
42
|
+
if (gridStyle === "style2") {
|
|
43
|
+
return vue.createVNode(repeaterGrid2.RepeaterGrid2, {
|
|
44
|
+
"class": classNames,
|
|
45
|
+
"controller": this.controller,
|
|
46
|
+
"onChange": this.onDataChange
|
|
47
|
+
}, null);
|
|
48
|
+
}
|
|
39
49
|
return vue.createVNode(repeaterGrid.RepeaterGrid, {
|
|
40
50
|
"class": classNames,
|
|
41
51
|
"controller": this.controller,
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var sortable_esm = require('../../../../../../node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.cjs');
|
|
5
|
+
var runtime = require('@ibiz-template/runtime');
|
|
6
|
+
var qxUtil = require('qx-util');
|
|
7
|
+
var vue3Util = require('@ibiz-template/vue3-util');
|
|
8
|
+
var core = require('@ibiz-template/core');
|
|
9
|
+
var formMdctrlRepeater_util = require('../form-mdctrl-repeater.util.cjs');
|
|
10
|
+
require('./repeater-grid2.css');
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
function _isSlot(s) {
|
|
14
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
|
|
15
|
+
}
|
|
16
|
+
const RepeaterGrid2 = /* @__PURE__ */ vue.defineComponent({
|
|
17
|
+
name: "IBizRepeaterGrid2",
|
|
18
|
+
props: {
|
|
19
|
+
controller: {
|
|
20
|
+
type: runtime.FormMDCtrlRepeaterController,
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emits: {
|
|
25
|
+
change: (_value) => true
|
|
26
|
+
},
|
|
27
|
+
setup(props, {
|
|
28
|
+
emit
|
|
29
|
+
}) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const ns = vue3Util.useNamespace("repeater-grid2");
|
|
32
|
+
const formItems = [];
|
|
33
|
+
const tableRef = vue.ref();
|
|
34
|
+
const tableKey = vue.ref(qxUtil.createUUID());
|
|
35
|
+
const chunkSize = ((_a = props.controller.model.ctrlParams) == null ? void 0 : _a.chunkSize) ? Number((_b = props.controller.model.ctrlParams) == null ? void 0 : _b.chunkSize) : 100;
|
|
36
|
+
const {
|
|
37
|
+
renderItems,
|
|
38
|
+
loadMore,
|
|
39
|
+
updateTotalItems
|
|
40
|
+
} = formMdctrlRepeater_util.useLoadMore(props.controller.value, chunkSize);
|
|
41
|
+
core.recursiveIterate(props.controller.repeatedForm, (item) => {
|
|
42
|
+
var _a2;
|
|
43
|
+
if (item.detailType === "FORMITEM") {
|
|
44
|
+
if (((_a2 = item.editor) == null ? void 0 : _a2.editorType) !== "HIDDEN") {
|
|
45
|
+
formItems.push(item);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
childrenFields: ["deformPages", "deformTabPages", "deformDetails"]
|
|
50
|
+
});
|
|
51
|
+
const onSingleValueChange = (value, index) => {
|
|
52
|
+
const arrData = [...props.controller.value || []];
|
|
53
|
+
arrData[index] = value;
|
|
54
|
+
emit("change", arrData);
|
|
55
|
+
};
|
|
56
|
+
const ctx = vue3Util.useCtx();
|
|
57
|
+
const formControllers = vue.reactive([]);
|
|
58
|
+
const addFormController = async (data = {}) => {
|
|
59
|
+
const formC = new runtime.EditFormController(props.controller.repeatedForm, props.controller.context, props.controller.params, ctx);
|
|
60
|
+
formC.state.isSimple = true;
|
|
61
|
+
await formC.created();
|
|
62
|
+
formC.setSimpleData(data);
|
|
63
|
+
formControllers.push(formC);
|
|
64
|
+
props.controller.setRepeaterController("".concat(formControllers.length - 1), formC);
|
|
65
|
+
formC.evt.on("onFormDataChange", (event) => {
|
|
66
|
+
const item = event.data[0];
|
|
67
|
+
const formData = item instanceof runtime.ControlVO ? item.clone() : {
|
|
68
|
+
...item
|
|
69
|
+
};
|
|
70
|
+
const index = formControllers.indexOf(formC);
|
|
71
|
+
onSingleValueChange(formData, index);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
vue.watch(() => props.controller.value, (newVal) => {
|
|
75
|
+
if (newVal && newVal.length > 0) {
|
|
76
|
+
newVal.forEach((item, index) => {
|
|
77
|
+
const formC = formControllers[index];
|
|
78
|
+
if (formC) {
|
|
79
|
+
const changeVal = item || {};
|
|
80
|
+
const find = Object.keys(formC.data).find((key) => {
|
|
81
|
+
return changeVal[key] !== formC.data[key];
|
|
82
|
+
});
|
|
83
|
+
if (find) {
|
|
84
|
+
formC.setSimpleData(changeVal);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
addFormController(item);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
updateTotalItems(newVal || []);
|
|
92
|
+
}, {
|
|
93
|
+
immediate: true,
|
|
94
|
+
deep: true
|
|
95
|
+
});
|
|
96
|
+
let sortable;
|
|
97
|
+
const rowDrop = () => {
|
|
98
|
+
var _a2, _b2;
|
|
99
|
+
const wrapper = (_b2 = (_a2 = tableRef.value) == null ? void 0 : _a2.$el) == null ? void 0 : _b2.querySelector(".el-table__body-wrapper tbody");
|
|
100
|
+
if (!wrapper || !props.controller.enableSort)
|
|
101
|
+
return;
|
|
102
|
+
sortable = sortable_esm.default.create(wrapper, {
|
|
103
|
+
animation: 150,
|
|
104
|
+
handle: ".".concat(ns.e("drag-icon")),
|
|
105
|
+
ghostClass: "".concat(ns.e("sortable-ghost")),
|
|
106
|
+
onEnd({
|
|
107
|
+
newIndex,
|
|
108
|
+
oldIndex
|
|
109
|
+
}) {
|
|
110
|
+
props.controller.dragChange(oldIndex, newIndex);
|
|
111
|
+
tableKey.value = qxUtil.createUUID();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
vue.watch(() => tableRef.value, () => {
|
|
116
|
+
if (!props.controller.enableSort)
|
|
117
|
+
return;
|
|
118
|
+
tableRef.value ? rowDrop() : sortable == null ? void 0 : sortable.destroy();
|
|
119
|
+
});
|
|
120
|
+
vue.onUnmounted(() => sortable == null ? void 0 : sortable.destroy());
|
|
121
|
+
const renderRemoveBtn = (index) => {
|
|
122
|
+
if (ibiz.config.form.mdCtrlConfirmBeforeRemove) {
|
|
123
|
+
return vue.createVNode(vue.resolveComponent("el-popconfirm"), {
|
|
124
|
+
"title": ibiz.i18n.t("control.form.repeaterGrid.promptInformation"),
|
|
125
|
+
"confirm-button-text": ibiz.i18n.t("app.confirm"),
|
|
126
|
+
"cancel-button-text": ibiz.i18n.t("app.cancel"),
|
|
127
|
+
"onConfirm": () => {
|
|
128
|
+
props.controller.remove(index);
|
|
129
|
+
formControllers.splice(index, 1);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
reference: () => {
|
|
133
|
+
return vue.createVNode("ion-icon", {
|
|
134
|
+
"name": "remove-outline",
|
|
135
|
+
"title": ibiz.i18n.t("app.delete"),
|
|
136
|
+
"class": ns.b("remove-btn")
|
|
137
|
+
}, null);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return vue.createVNode("ion-icon", {
|
|
142
|
+
"name": "remove-outline",
|
|
143
|
+
"title": ibiz.i18n.t("app.delete"),
|
|
144
|
+
"class": ns.b("remove-btn"),
|
|
145
|
+
"onClick": () => {
|
|
146
|
+
props.controller.remove(index);
|
|
147
|
+
formControllers.splice(index, 1);
|
|
148
|
+
}
|
|
149
|
+
}, null);
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
ns,
|
|
153
|
+
tableRef,
|
|
154
|
+
tableKey,
|
|
155
|
+
formItems,
|
|
156
|
+
renderItems,
|
|
157
|
+
formControllers,
|
|
158
|
+
renderRemoveBtn,
|
|
159
|
+
loadMore
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
render() {
|
|
163
|
+
var _a;
|
|
164
|
+
const tableHeight = (_a = this.controller.model.layoutPos) == null ? void 0 : _a.height;
|
|
165
|
+
const heightObject = tableHeight ? {
|
|
166
|
+
height: tableHeight
|
|
167
|
+
} : {};
|
|
168
|
+
const isEmpty = this.renderItems.length === 0;
|
|
169
|
+
return vue.createVNode("div", {
|
|
170
|
+
"class": this.ns.b()
|
|
171
|
+
}, [vue.createVNode(vue.resolveComponent("el-table"), vue.mergeProps({
|
|
172
|
+
"ref": "tableRef",
|
|
173
|
+
"key": this.tableKey,
|
|
174
|
+
"show-header": true,
|
|
175
|
+
"class": this.ns.e("table"),
|
|
176
|
+
"data": isEmpty && this.controller.enableCreate ? [{}] : this.renderItems,
|
|
177
|
+
"cell-class-name": ({
|
|
178
|
+
columnIndex
|
|
179
|
+
}) => {
|
|
180
|
+
const shouldShowIndex = this.controller.enableSort ? columnIndex === 1 : columnIndex === 0;
|
|
181
|
+
return shouldShowIndex ? this.ns.b("index") : "";
|
|
182
|
+
}
|
|
183
|
+
}, heightObject), {
|
|
184
|
+
default: () => {
|
|
185
|
+
return [this.controller.enableSort && vue.createVNode(vue.resolveComponent("el-table-column"), {
|
|
186
|
+
"width": 26,
|
|
187
|
+
"type": "default"
|
|
188
|
+
}, {
|
|
189
|
+
default: () => {
|
|
190
|
+
if (isEmpty) {
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
return vue.createVNode("svg", {
|
|
194
|
+
"viewBox": "0 0 16 16",
|
|
195
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
196
|
+
"height": "1em",
|
|
197
|
+
"width": "1em",
|
|
198
|
+
"class": this.ns.e("drag-icon"),
|
|
199
|
+
"preserveAspectRatio": "xMidYMid meet",
|
|
200
|
+
"focusable": "false"
|
|
201
|
+
}, [vue.createVNode("g", {
|
|
202
|
+
"stroke-width": "1",
|
|
203
|
+
"fill-rule": "evenodd"
|
|
204
|
+
}, [vue.createVNode("g", {
|
|
205
|
+
"transform": "translate(5 1)",
|
|
206
|
+
"fill-rule": "nonzero"
|
|
207
|
+
}, [vue.createVNode("path", {
|
|
208
|
+
"d": "M1 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM1 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"
|
|
209
|
+
}, null)])])]);
|
|
210
|
+
}
|
|
211
|
+
}), vue.createVNode(vue.resolveComponent("el-table-column"), {
|
|
212
|
+
"type": "index",
|
|
213
|
+
"width": 66,
|
|
214
|
+
"align": "center"
|
|
215
|
+
}, {
|
|
216
|
+
default: (opts) => {
|
|
217
|
+
if (isEmpty) {
|
|
218
|
+
return "";
|
|
219
|
+
}
|
|
220
|
+
const {
|
|
221
|
+
$index
|
|
222
|
+
} = opts;
|
|
223
|
+
return vue.createVNode("span", null, [$index + 1]);
|
|
224
|
+
}
|
|
225
|
+
}), this.formItems.length > 0 && this.formItems.map((item) => {
|
|
226
|
+
const width = item.labelWidth;
|
|
227
|
+
let widthName = "width";
|
|
228
|
+
let columnWidth = "";
|
|
229
|
+
if (typeof width === "number") {
|
|
230
|
+
if (width === 1) {
|
|
231
|
+
widthName = "min-width";
|
|
232
|
+
}
|
|
233
|
+
columnWidth = "".concat(width, "px");
|
|
234
|
+
}
|
|
235
|
+
return vue.createVNode(vue.resolveComponent("el-table-column"), vue.mergeProps({
|
|
236
|
+
"label": item.caption,
|
|
237
|
+
"prop": item.id
|
|
238
|
+
}, {
|
|
239
|
+
[widthName]: columnWidth
|
|
240
|
+
}, {
|
|
241
|
+
"align": "center"
|
|
242
|
+
}), {
|
|
243
|
+
default: (opts) => {
|
|
244
|
+
if (isEmpty) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
247
|
+
const {
|
|
248
|
+
$index
|
|
249
|
+
} = opts;
|
|
250
|
+
const formC = vue.toRaw(this.formControllers[$index]);
|
|
251
|
+
if (!formC || !formC.state.isLoaded) {
|
|
252
|
+
return vue.createVNode("div", null, [ibiz.i18n.t("control.form.repeaterGrid.absentOrLoad")]);
|
|
253
|
+
}
|
|
254
|
+
const formItemC = formC.formItems.find((x) => x.name === item.id);
|
|
255
|
+
let editor = null;
|
|
256
|
+
if (!formItemC.editorProvider) {
|
|
257
|
+
editor = vue.createVNode(vue.resolveComponent("not-supported-editor"), {
|
|
258
|
+
"modelData": item.editor
|
|
259
|
+
}, null);
|
|
260
|
+
} else {
|
|
261
|
+
const component = vue.resolveComponent(formItemC.editorProvider.formEditor);
|
|
262
|
+
editor = vue.h(component, {
|
|
263
|
+
value: formItemC.value,
|
|
264
|
+
data: formItemC.data,
|
|
265
|
+
controller: formItemC.editor,
|
|
266
|
+
disabled: formItemC.state.disabled,
|
|
267
|
+
readonly: formItemC.state.readonly,
|
|
268
|
+
onChange: (val, name) => {
|
|
269
|
+
formItemC.setDataValue(val, name);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return vue.createVNode(vue.resolveComponent("iBizGridEditItem"), {
|
|
274
|
+
"error": formItemC.state.error,
|
|
275
|
+
"required": formItemC.state.required
|
|
276
|
+
}, _isSlot(editor) ? editor : {
|
|
277
|
+
default: () => [editor]
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}), (this.controller.enableCreate || this.controller.enableDelete) && vue.createVNode(vue.resolveComponent("el-table-column"), {
|
|
282
|
+
"width": 80,
|
|
283
|
+
"align": "center"
|
|
284
|
+
}, {
|
|
285
|
+
default: (opts) => {
|
|
286
|
+
const {
|
|
287
|
+
$index
|
|
288
|
+
} = opts;
|
|
289
|
+
return vue.createVNode("div", {
|
|
290
|
+
"class": this.ns.b("action-group")
|
|
291
|
+
}, [this.controller.enableCreate && vue.createVNode("ion-icon", {
|
|
292
|
+
"name": "add-outline",
|
|
293
|
+
"title": ibiz.i18n.t("app.add"),
|
|
294
|
+
"class": this.ns.b("add-btn"),
|
|
295
|
+
"onClick": () => {
|
|
296
|
+
this.controller.create(isEmpty ? 0 : $index + 1);
|
|
297
|
+
}
|
|
298
|
+
}, null), this.controller.enableDelete && !isEmpty && this.renderRemoveBtn($index)]);
|
|
299
|
+
}
|
|
300
|
+
})];
|
|
301
|
+
},
|
|
302
|
+
append: () => {
|
|
303
|
+
return [tableHeight && vue.withDirectives(vue.createVNode("div", {
|
|
304
|
+
"infinite-scroll-distance": 20
|
|
305
|
+
}, null), [[vue.resolveDirective("infinite-scroll"), () => this.loadMore()]])];
|
|
306
|
+
}
|
|
307
|
+
})]);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
exports.RepeaterGrid2 = RepeaterGrid2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-repeater-grid2{--ibiz-repeater-grid2-row-height:57px;--ibiz-repeater-grid2-index-cell-padding:var(--ibiz-spacing-extra-tight);--ibiz-repeater-grid2-btn-size:var(--ibiz-width-icon-large);--ibiz-repeater-grid2-btn-color:var(--ibiz-color-text-2);--ibiz-repeater-grid2-btn-border:1px solid var(--ibiz-color-border);--ibiz-repeater-grid2-btn-margin-left:var(--ibiz-spacing-tight);--ibiz-repeater-grid2-btn-hover-color:var(--ibiz-color-primary-hover);--ibiz-repeater-grid2-btn-hover-border:1px solid var(--ibiz-color-primary-hover);position:relative;width:100%;--ibiz-grid-column-justify-content:center}.ibiz-repeater-grid2__drag-icon{cursor:move}.ibiz-repeater-grid2__sortable-ghost{opacity:.5}.ibiz-repeater-grid2 .el-table__row{height:var(--ibiz-repeater-grid2-row-height)}.ibiz-repeater-grid2-index .cell{padding:var(--ibiz-repeater-grid2-index-cell-padding)}.ibiz-repeater-grid2-action-group{display:flex;align-items:center;justify-content:center}.ibiz-repeater-grid2-action-group ion-icon{font-size:var(--ibiz-repeater-grid2-btn-size);color:var(--ibiz-repeater-grid2-btn-color);cursor:pointer;border:var(--ibiz-repeater-grid2-btn-border)}.ibiz-repeater-grid2-action-group ion-icon+ion-icon{margin-left:var(--ibiz-repeater-grid2-btn-margin-left)}.ibiz-repeater-grid2-action-group ion-icon:hover{color:var(--ibiz-repeater-grid2-btn-hover-color);border:var(--ibiz-repeater-grid2-btn-hover-border)}
|