@ibiz-template/vue3-components 0.3.5 → 0.3.6-dev.0
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/index-IQggCeg0.js +14 -0
- package/dist/index-IQggCeg0.js.map +1 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{xlsx-util-kEnxvxaf.js → xlsx-util--ODZUMX_.js} +2 -2
- package/dist/{xlsx-util-kEnxvxaf.js.map → xlsx-util--ODZUMX_.js.map} +1 -1
- package/es/control/form/edit-form/edit-form.mjs +18 -3
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.d.ts +7 -6
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.mjs +51 -53
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.d.ts +19 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.mjs +72 -0
- package/es/control/form/form-detail/form-mdctrl/{form-mdctrl-data-view/form-mdctrl-data-view.d.ts → form-mdctrl-repeater/form-mdctrl-repeater.d.ts} +5 -7
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.mjs +57 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.d.ts +2 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +203 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-multi-form/repeater-multi-form.d.ts +19 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-multi-form/repeater-multi-form.mjs +59 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.d.ts +29 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.mjs +54 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl.d.ts +4 -2
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl.mjs +40 -54
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl.provider.mjs +21 -2
- package/es/control/form/form-detail/form-mdctrl/index.d.ts +2 -3
- package/es/control/form/form-detail/form-mdctrl/index.mjs +6 -14
- package/es/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.css +1 -0
- package/es/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.d.ts +40 -0
- package/es/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.mjs +99 -0
- package/es/control/index.d.ts +1 -1
- package/es/control/index.mjs +1 -3
- package/es/control/report-panel/index.d.ts +2 -0
- package/es/control/report-panel/index.mjs +23 -0
- package/es/control/report-panel/report-detail/index.d.ts +2 -0
- package/es/control/report-panel/report-detail/index.mjs +4 -0
- package/es/control/report-panel/report-detail/user-report-panel/index.d.ts +14 -0
- package/es/control/report-panel/report-detail/user-report-panel/index.mjs +12 -0
- package/es/control/report-panel/report-detail/user-report-panel/user-report-panel.css +1 -0
- package/es/control/report-panel/report-detail/user-report-panel/user-report-panel.d.ts +16 -0
- package/es/control/report-panel/report-detail/user-report-panel/user-report-panel.mjs +45 -0
- package/es/control/report-panel/report-detail/user2-report-panel/index.d.ts +15 -0
- package/es/control/report-panel/report-detail/user2-report-panel/index.mjs +12 -0
- package/es/control/report-panel/report-detail/user2-report-panel/user2-report-panel.css +1 -0
- package/es/control/report-panel/report-detail/user2-report-panel/user2-report-panel.d.ts +17 -0
- package/es/control/report-panel/report-detail/user2-report-panel/user2-report-panel.mjs +67 -0
- package/es/control/report-panel/report-panel.css +1 -0
- package/es/control/{panel/panel/panel.d.ts → report-panel/report-panel.d.ts} +12 -22
- package/es/control/report-panel/report-panel.mjs +72 -0
- package/es/control/report-panel/report-panel.provider.d.ts +11 -0
- package/es/control/{panel/panel/panel.provider.mjs → report-panel/report-panel.provider.mjs} +3 -3
- package/es/control/tree-grid/tree-grid.mjs +1 -1
- package/es/index.mjs +4 -4
- package/es/panel-component/searchform-buttons/index.d.ts +1 -0
- package/es/panel-component/searchform-buttons/searchform-buttons.controller.d.ts +9 -1
- package/es/panel-component/searchform-buttons/searchform-buttons.controller.mjs +11 -0
- package/es/panel-component/searchform-buttons/searchform-buttons.css +1 -1
- package/es/panel-component/searchform-buttons/searchform-buttons.d.ts +1 -0
- package/es/panel-component/searchform-buttons/searchform-buttons.mjs +35 -1
- package/es/view-engine/index.mjs +5 -0
- package/es/view-engine/report-view.engine.d.ts +96 -0
- package/es/view-engine/report-view.engine.mjs +178 -0
- package/lib/control/form/edit-form/edit-form.cjs +17 -2
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.cjs +48 -53
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.css +1 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.cjs +74 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-md/form-mdctrl-md.css +1 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater.cjs +59 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +205 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css +1 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-multi-form/repeater-multi-form.cjs +61 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.cjs +56 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-single-form/repeater-single-form.css +1 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl.cjs +38 -52
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl.css +1 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl.provider.cjs +20 -1
- package/lib/control/form/form-detail/form-mdctrl/index.cjs +6 -14
- package/lib/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.cjs +101 -0
- package/lib/control/form/form-detail/form-mdctrl/mdctrl-container/mdctrl-container.css +1 -0
- package/lib/control/index.cjs +64 -67
- package/lib/control/report-panel/index.cjs +28 -0
- package/lib/control/report-panel/report-detail/index.cjs +9 -0
- package/lib/control/report-panel/report-detail/user-report-panel/index.cjs +17 -0
- package/lib/control/report-panel/report-detail/user-report-panel/user-report-panel.cjs +47 -0
- package/lib/control/report-panel/report-detail/user-report-panel/user-report-panel.css +1 -0
- package/lib/control/report-panel/report-detail/user2-report-panel/index.cjs +17 -0
- package/lib/control/report-panel/report-detail/user2-report-panel/user2-report-panel.cjs +69 -0
- package/lib/control/report-panel/report-detail/user2-report-panel/user2-report-panel.css +1 -0
- package/lib/control/report-panel/report-panel.cjs +74 -0
- package/lib/control/report-panel/report-panel.css +1 -0
- package/lib/control/{panel/panel/panel.provider.cjs → report-panel/report-panel.provider.cjs} +3 -3
- package/lib/control/tree-grid/tree-grid.cjs +1 -1
- package/lib/index.cjs +120 -121
- package/lib/panel-component/searchform-buttons/searchform-buttons.cjs +35 -1
- package/lib/panel-component/searchform-buttons/searchform-buttons.controller.cjs +11 -0
- package/lib/panel-component/searchform-buttons/searchform-buttons.css +1 -1
- package/lib/view-engine/index.cjs +5 -0
- package/lib/view-engine/report-view.engine.cjs +180 -0
- package/package.json +6 -6
- package/dist/index-JckMKMdE.js +0 -14
- package/dist/index-JckMKMdE.js.map +0 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.css +0 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.d.ts +0 -36
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.mjs +0 -67
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-data-view/form-mdctrl-data-view.mjs +0 -68
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-grid/form-mdctrl-grid.d.ts +0 -17
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-grid/form-mdctrl-grid.mjs +0 -70
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-list/form-mdctrl-list.d.ts +0 -17
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-list/form-mdctrl-list.mjs +0 -68
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.d.ts +0 -72
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.mjs +0 -158
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.d.ts +0 -17
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.mjs +0 -58
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.d.ts +0 -17
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.mjs +0 -55
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.css +0 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.d.ts +0 -19
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.mjs +0 -113
- package/es/control/panel/index.d.ts +0 -2
- package/es/control/panel/index.mjs +0 -4
- package/es/control/panel/panel/index.d.ts +0 -56
- package/es/control/panel/panel/index.mjs +0 -12
- package/es/control/panel/panel/panel.css +0 -1
- package/es/control/panel/panel/panel.mjs +0 -133
- package/es/control/panel/panel/panel.provider.d.ts +0 -13
- package/es/control/panel/view-layout-panel/index.d.ts +0 -57
- package/es/control/panel/view-layout-panel/index.mjs +0 -18
- package/es/control/panel/view-layout-panel/view-layout-panel.css +0 -1
- package/es/control/panel/view-layout-panel/view-layout-panel.d.ts +0 -61
- package/es/control/panel/view-layout-panel/view-layout-panel.mjs +0 -135
- package/es/control/panel/view-layout-panel/view-layout-panel.provider.d.ts +0 -13
- package/es/control/panel/view-layout-panel/view-layout-panel.provider.mjs +0 -14
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.cjs +0 -72
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.css +0 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-data-view/form-mdctrl-data-view.cjs +0 -73
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-grid/form-mdctrl-grid.cjs +0 -75
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-list/form-mdctrl-list.cjs +0 -73
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.cjs +0 -160
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form.cjs +0 -63
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form-one/form-mdctrl-repeater-form-one.cjs +0 -60
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.cjs +0 -118
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.css +0 -1
- package/lib/control/panel/index.cjs +0 -9
- package/lib/control/panel/panel/index.cjs +0 -17
- package/lib/control/panel/panel/panel.cjs +0 -135
- package/lib/control/panel/panel/panel.css +0 -1
- package/lib/control/panel/view-layout-panel/index.cjs +0 -23
- package/lib/control/panel/view-layout-panel/view-layout-panel.cjs +0 -137
- package/lib/control/panel/view-layout-panel/view-layout-panel.css +0 -1
- package/lib/control/panel/view-layout-panel/view-layout-panel.provider.cjs +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive, resolveComponent, createVNode, defineComponent } from 'vue';
|
|
1
|
+
import { watch, reactive, resolveComponent, createVNode, defineComponent } from 'vue';
|
|
2
2
|
import { EditFormController } from '@ibiz-template/runtime';
|
|
3
3
|
import { useControlController, useNamespace } from '@ibiz-template/vue3-util';
|
|
4
4
|
|
|
@@ -35,9 +35,24 @@ const EditFormControl = /* @__PURE__ */ defineComponent({
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
setup(props) {
|
|
38
|
-
const c = useControlController((...args) => new EditFormController(...args)
|
|
38
|
+
const c = useControlController((...args) => new EditFormController(...args), {
|
|
39
|
+
excludePropsKeys: ["data"]
|
|
40
|
+
});
|
|
39
41
|
if (props.isSimple) {
|
|
40
|
-
c.
|
|
42
|
+
c.evt.on("onMounted", () => {
|
|
43
|
+
c.setSimpleData(props.data || {});
|
|
44
|
+
});
|
|
45
|
+
watch(() => props.data, (newVal) => {
|
|
46
|
+
const changeVal = newVal || {};
|
|
47
|
+
const find = Object.keys(c.data).find((key) => {
|
|
48
|
+
return changeVal[key] !== c.data[key];
|
|
49
|
+
});
|
|
50
|
+
if (find) {
|
|
51
|
+
c.setSimpleData(changeVal);
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
deep: true
|
|
55
|
+
});
|
|
41
56
|
}
|
|
42
57
|
const ns = useNamespace(`control-${c.model.controlType.toLowerCase()}`);
|
|
43
58
|
c.evt.on("onCreated", () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-form-mdctrl-form-item{display:flex}.ibiz-form-mdctrl-form-item__form{flex-grow:1}.ibiz-form-mdctrl-form-item-actions{flex-shrink:0;width:80px;text-align:center}.ibiz-form-mdctrl-form-item-actions .el-button+.el-button{margin-left:0}.ibiz-form-mdctrl-form-item-actions__btn{margin-top:var(--ibiz-spacing-tight)}.ibiz-form-mdctrl-form-no-data{width:100%;display:flex;justify-content:flex-end}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { EventBase, FormMDCtrlFormController } from '@ibiz-template/runtime';
|
|
2
|
+
import './form-mdctrl-form.scss';
|
|
3
3
|
export declare const FormMDCtrlForm: import("vue").DefineComponent<{
|
|
4
4
|
controller: {
|
|
5
|
-
type:
|
|
5
|
+
type: typeof FormMDCtrlFormController;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
8
|
}, {
|
|
9
9
|
ns: import("@ibiz-template/core").Namespace;
|
|
10
|
-
|
|
10
|
+
showActions: import("vue").ComputedRef<boolean>;
|
|
11
|
+
onCreated: (id: string, event: EventBase) => void;
|
|
12
|
+
renderAddBtn: () => JSX.Element;
|
|
11
13
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
14
|
controller: {
|
|
13
|
-
type:
|
|
15
|
+
type: typeof FormMDCtrlFormController;
|
|
14
16
|
required: true;
|
|
15
17
|
};
|
|
16
18
|
}>>, {}, {}>;
|
|
17
|
-
export default FormMDCtrlForm;
|
|
@@ -1,75 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { computed, resolveComponent, createTextVNode, createVNode, h, defineComponent } from 'vue';
|
|
2
|
+
import { FormMDCtrlFormController } from '@ibiz-template/runtime';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import './form-mdctrl-form.css';
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
|
-
function _isSlot(s) {
|
|
8
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9
|
-
}
|
|
10
7
|
const FormMDCtrlForm = /* @__PURE__ */ defineComponent({
|
|
11
8
|
name: "IBizFormMDCtrlForm",
|
|
12
9
|
props: {
|
|
13
10
|
controller: {
|
|
14
|
-
type:
|
|
11
|
+
type: FormMDCtrlFormController,
|
|
15
12
|
required: true
|
|
16
13
|
}
|
|
17
14
|
},
|
|
18
15
|
setup(props) {
|
|
19
|
-
const ns = useNamespace("form-mdctrl");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const ns = useNamespace("form-mdctrl-form");
|
|
17
|
+
const showActions = computed(() => {
|
|
18
|
+
return props.controller.enableCreate || props.controller.enableDelete;
|
|
19
|
+
});
|
|
20
|
+
const renderAddBtn = () => {
|
|
21
|
+
return createVNode(resolveComponent("el-button"), {
|
|
22
|
+
"class": [ns.be("item-actions", "create"), ns.be("item-actions", "btn")],
|
|
23
|
+
"onClick": () => props.controller.create()
|
|
24
|
+
}, {
|
|
25
|
+
default: () => [createTextVNode("\u6DFB\u52A0")]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const onCreated = (id, event) => {
|
|
29
|
+
props.controller.setFormController(id, event.ctrl);
|
|
30
|
+
};
|
|
23
31
|
return {
|
|
24
32
|
ns,
|
|
25
|
-
|
|
33
|
+
showActions,
|
|
34
|
+
onCreated,
|
|
35
|
+
renderAddBtn
|
|
26
36
|
};
|
|
27
37
|
},
|
|
28
38
|
render() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
const {
|
|
40
|
+
state,
|
|
41
|
+
formProvider,
|
|
42
|
+
model
|
|
43
|
+
} = this.controller;
|
|
44
|
+
return createVNode(resolveComponent("iBizMDCtrlContainer"), {
|
|
45
|
+
"class": this.ns.b(),
|
|
46
|
+
"items": state.items,
|
|
47
|
+
"enableCreate": this.controller.enableCreate,
|
|
48
|
+
"enableDelete": this.controller.enableDelete,
|
|
49
|
+
"onAddClick": () => this.controller.create(),
|
|
50
|
+
"onRemoveClick": (item) => this.controller.remove(item.id)
|
|
51
|
+
}, {
|
|
52
|
+
item: ({
|
|
53
|
+
data
|
|
54
|
+
}) => {
|
|
55
|
+
if (!formProvider) {
|
|
56
|
+
return createVNode("div", null, [createTextVNode("\u672A\u627E\u5230\u8868\u5355\u7684\u9002\u914D\u5668")]);
|
|
57
|
+
}
|
|
58
|
+
const formComponent = h(resolveComponent(formProvider.component), {
|
|
59
|
+
class: this.ns.be("item", "form"),
|
|
60
|
+
modelData: model.contentControl,
|
|
61
|
+
context: data.context,
|
|
62
|
+
params: data.params,
|
|
63
|
+
onCreated: (event) => {
|
|
64
|
+
this.onCreated(data.id, event);
|
|
38
65
|
}
|
|
39
|
-
const controlProps = {
|
|
40
|
-
modelData: c.controlModel,
|
|
41
|
-
context: tempContext,
|
|
42
|
-
params: c.parent.form.params,
|
|
43
|
-
onFormDataChange: (arg) => c.onFormChange(arg.data, index),
|
|
44
|
-
onRemoveSuccess: () => c.onFormRemoveSuccess(index),
|
|
45
|
-
onCreated: (event) => c.onControlCreated(event, index)
|
|
46
|
-
};
|
|
47
|
-
const controlComponent = h(resolveComponent(c.provider.component), controlProps);
|
|
48
|
-
return createVNode("div", {
|
|
49
|
-
"class": this.ns.b("form-content"),
|
|
50
|
-
"key": item.srfkey
|
|
51
|
-
}, [controlComponent, createVNode("div", {
|
|
52
|
-
"class": this.ns.b("btn")
|
|
53
|
-
}, [c.parent.isDelete && createVNode(resolveComponent("el-button"), {
|
|
54
|
-
"type": "danger",
|
|
55
|
-
"class": this.ns.b("remove-btn"),
|
|
56
|
-
"onClick": () => this.c.onDataRemove(index)
|
|
57
|
-
}, {
|
|
58
|
-
default: () => [createTextVNode("\u5220\u9664")]
|
|
59
|
-
})])]);
|
|
60
66
|
});
|
|
67
|
+
return formComponent;
|
|
61
68
|
}
|
|
62
|
-
};
|
|
63
|
-
return createVNode(FormMDCtrlContainer, {
|
|
64
|
-
"class": this.ns.b("form"),
|
|
65
|
-
"controller": c.parent,
|
|
66
|
-
"onInsertButtonClick": () => {
|
|
67
|
-
c.onDataInsert();
|
|
68
|
-
}
|
|
69
|
-
}, _isSlot(_slot = renderContent()) ? _slot : {
|
|
70
|
-
default: () => [_slot]
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
});
|
|
74
72
|
|
|
75
|
-
export { FormMDCtrlForm
|
|
73
|
+
export { FormMDCtrlForm };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-form-mdctrl-md{display:flex}.ibiz-form-mdctrl-md-content{flex-grow:1}.ibiz-form-mdctrl-md-actions{flex-shrink:0;width:80px;text-align:center}.ibiz-form-mdctrl-md-actions .el-button+.el-button{margin-left:0}.ibiz-form-mdctrl-md-actions__btn{margin-bottom:var(--ibiz-spacing-tight)}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EventBase, FormMDCtrlMDController } from '@ibiz-template/runtime';
|
|
2
|
+
import './form-mdctrl-md.scss';
|
|
3
|
+
export declare const FormMDCtrlMD: import("vue").DefineComponent<{
|
|
4
|
+
controller: {
|
|
5
|
+
type: typeof FormMDCtrlMDController;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}, {
|
|
9
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
10
|
+
showActions: import("vue").ComputedRef<boolean>;
|
|
11
|
+
isSelected: import("vue").Ref<boolean>;
|
|
12
|
+
onCreated: (event: EventBase) => void;
|
|
13
|
+
onSelectionChange: (event: EventBase) => void;
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
controller: {
|
|
16
|
+
type: typeof FormMDCtrlMDController;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>>, {}, {}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { computed, ref, resolveComponent, h, createTextVNode, createVNode, defineComponent } from 'vue';
|
|
2
|
+
import { FormMDCtrlMDController } from '@ibiz-template/runtime';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import './form-mdctrl-md.css';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const FormMDCtrlMD = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "IBizFormMDCtrlMD",
|
|
9
|
+
props: {
|
|
10
|
+
controller: {
|
|
11
|
+
type: FormMDCtrlMDController,
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(props) {
|
|
16
|
+
const ns = useNamespace("form-mdctrl-md");
|
|
17
|
+
const showActions = computed(() => {
|
|
18
|
+
return props.controller.enableCreate || props.controller.enableDelete;
|
|
19
|
+
});
|
|
20
|
+
const onCreated = (event) => {
|
|
21
|
+
props.controller.setMDControl(event.ctrl);
|
|
22
|
+
};
|
|
23
|
+
const isSelected = ref(false);
|
|
24
|
+
const onSelectionChange = (event) => {
|
|
25
|
+
isSelected.value = event.data.length > 0;
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
ns,
|
|
29
|
+
showActions,
|
|
30
|
+
isSelected,
|
|
31
|
+
onCreated,
|
|
32
|
+
onSelectionChange
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
render() {
|
|
36
|
+
const {
|
|
37
|
+
mdProvider,
|
|
38
|
+
model
|
|
39
|
+
} = this.controller;
|
|
40
|
+
const controlProps = {
|
|
41
|
+
class: this.ns.b("content"),
|
|
42
|
+
modelData: model.contentControl,
|
|
43
|
+
context: this.controller.form.context,
|
|
44
|
+
params: this.controller.form.params,
|
|
45
|
+
onCreated: this.onCreated,
|
|
46
|
+
onSelectionChange: this.onSelectionChange
|
|
47
|
+
};
|
|
48
|
+
if (model.contentType === "GRID") {
|
|
49
|
+
controlProps.rowEditOpen = true;
|
|
50
|
+
}
|
|
51
|
+
const controlComponent = h(resolveComponent(mdProvider.component), controlProps);
|
|
52
|
+
return createVNode("div", {
|
|
53
|
+
"class": this.ns.b()
|
|
54
|
+
}, [controlComponent, this.showActions && createVNode("div", {
|
|
55
|
+
"class": this.ns.b("actions")
|
|
56
|
+
}, [this.controller.enableCreate && createVNode(resolveComponent("el-button"), {
|
|
57
|
+
"class": [this.ns.be("actions", "create"), this.ns.be("actions", "btn")],
|
|
58
|
+
"onClick": () => this.controller.create()
|
|
59
|
+
}, {
|
|
60
|
+
default: () => [createTextVNode("\u6DFB\u52A0")]
|
|
61
|
+
}), this.controller.enableDelete && createVNode(resolveComponent("el-button"), {
|
|
62
|
+
"type": "danger",
|
|
63
|
+
"disabled": !this.isSelected,
|
|
64
|
+
"class": [this.ns.be("actions", "remove"), this.ns.be("actions", "btn")],
|
|
65
|
+
"onClick": () => this.controller.remove()
|
|
66
|
+
}, {
|
|
67
|
+
default: () => [createTextVNode("\u5220\u9664")]
|
|
68
|
+
})])]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export { FormMDCtrlMD };
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const FormMDCtrlDataView: import("vue").DefineComponent<{
|
|
1
|
+
import { FormMDCtrlRepeaterController } from '@ibiz-template/runtime';
|
|
2
|
+
export declare const FormMDCtrlRepeater: import("vue").DefineComponent<{
|
|
4
3
|
controller: {
|
|
5
|
-
type:
|
|
4
|
+
type: typeof FormMDCtrlRepeaterController;
|
|
6
5
|
required: true;
|
|
7
6
|
};
|
|
8
7
|
}, {
|
|
9
8
|
ns: import("@ibiz-template/core").Namespace;
|
|
10
|
-
|
|
9
|
+
onDataChange: (data: IData | IData[] | null) => void;
|
|
11
10
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
11
|
controller: {
|
|
13
|
-
type:
|
|
12
|
+
type: typeof FormMDCtrlRepeaterController;
|
|
14
13
|
required: true;
|
|
15
14
|
};
|
|
16
15
|
}>>, {}, {}>;
|
|
17
|
-
export default FormMDCtrlDataView;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createTextVNode, createVNode, defineComponent } from 'vue';
|
|
2
|
+
import { FormMDCtrlRepeaterController } from '@ibiz-template/runtime';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import { RepeaterSingleForm } from './repeater-single-form/repeater-single-form.mjs';
|
|
5
|
+
import { RepeaterMultiForm } from './repeater-multi-form/repeater-multi-form.mjs';
|
|
6
|
+
import { RepeaterGrid } from './repeater-grid/repeater-grid.mjs';
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
const FormMDCtrlRepeater = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "IBizFormMDCtrlRepeater",
|
|
11
|
+
props: {
|
|
12
|
+
controller: {
|
|
13
|
+
type: FormMDCtrlRepeaterController,
|
|
14
|
+
required: true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
setup(props) {
|
|
18
|
+
const ns = useNamespace("form-mdctrl-repeater");
|
|
19
|
+
const onDataChange = (data) => {
|
|
20
|
+
props.controller.setValue(data);
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
ns,
|
|
24
|
+
onDataChange
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
render() {
|
|
28
|
+
const classNames = [this.ns.b()];
|
|
29
|
+
switch (this.controller.repeaterStyle) {
|
|
30
|
+
case "MultiForm":
|
|
31
|
+
return createVNode(RepeaterMultiForm, {
|
|
32
|
+
"class": classNames,
|
|
33
|
+
"onChange": this.onDataChange,
|
|
34
|
+
"controller": this.controller
|
|
35
|
+
}, null);
|
|
36
|
+
case "Grid":
|
|
37
|
+
return createVNode(RepeaterGrid, {
|
|
38
|
+
"class": classNames,
|
|
39
|
+
"controller": this.controller,
|
|
40
|
+
"onChange": this.onDataChange
|
|
41
|
+
}, null);
|
|
42
|
+
case "SingleForm":
|
|
43
|
+
return createVNode(RepeaterSingleForm, {
|
|
44
|
+
"class": classNames,
|
|
45
|
+
"data": this.controller.value,
|
|
46
|
+
"controller": this.controller,
|
|
47
|
+
"onChange": this.onDataChange
|
|
48
|
+
}, null);
|
|
49
|
+
default:
|
|
50
|
+
return createVNode("div", {
|
|
51
|
+
"class": classNames
|
|
52
|
+
}, [createTextVNode("\u6682\u672A\u652F\u6301\u91CD\u590D\u5668\u6837\u5F0F"), this.controller.repeaterStyle]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { FormMDCtrlRepeater };
|
package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-repeater-grid{position:relative;width:100%;--ibiz-grid-column-justify-content:center}.ibiz-repeater-grid__add-btn{position:absolute;top:0;right:0;z-index:2}.ibiz-repeater-grid .el-table__row:hover .ibiz-repeater-grid-index__text:last-child{display:none}.ibiz-repeater-grid .el-table__row:hover .ibiz-repeater-grid-index__remove{display:inline}.ibiz-repeater-grid .ibiz-repeater-grid-index__remove.el-button.el-button--danger{--el-button-text-color:var(--ibiz-color-danger)}.ibiz-repeater-grid-index .cell{padding:4px}.ibiz-repeater-grid-index__remove{display:none}
|
package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { isVNode, reactive, watch, resolveComponent, createTextVNode, createVNode, h, defineComponent } from 'vue';
|
|
2
|
+
import { FormMDCtrlRepeaterController, EditFormController } from '@ibiz-template/runtime';
|
|
3
|
+
import { useNamespace, useCtx } from '@ibiz-template/vue3-util';
|
|
4
|
+
import './repeater-grid.css';
|
|
5
|
+
import { recursiveIterate } from '@ibiz-template/core';
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
function _isSlot(s) {
|
|
9
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
10
|
+
}
|
|
11
|
+
const RepeaterGrid = /* @__PURE__ */ defineComponent({
|
|
12
|
+
name: "IBizRepeaterGrid",
|
|
13
|
+
props: {
|
|
14
|
+
controller: {
|
|
15
|
+
type: FormMDCtrlRepeaterController,
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
emits: {
|
|
20
|
+
change: (_value) => true
|
|
21
|
+
},
|
|
22
|
+
setup(props, {
|
|
23
|
+
emit
|
|
24
|
+
}) {
|
|
25
|
+
const ns = useNamespace("repeater-grid");
|
|
26
|
+
const formItems = [];
|
|
27
|
+
recursiveIterate(props.controller.repeatedForm, (item) => {
|
|
28
|
+
if (item.detailType === "FORMITEM") {
|
|
29
|
+
formItems.push(item);
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
childrenFields: ["deformPages", "deformTabPages", "deformDetails"]
|
|
33
|
+
});
|
|
34
|
+
const onSingleValueChange = (value, index) => {
|
|
35
|
+
const arrData = [...props.controller.value];
|
|
36
|
+
arrData[index] = value;
|
|
37
|
+
emit("change", arrData);
|
|
38
|
+
};
|
|
39
|
+
const ctx = useCtx();
|
|
40
|
+
const formControllers = reactive([]);
|
|
41
|
+
const addFormController = async (data = {}) => {
|
|
42
|
+
const formC = new EditFormController(props.controller.repeatedForm, props.controller.context, props.controller.params, ctx);
|
|
43
|
+
formC.state.isSimple = true;
|
|
44
|
+
await formC.created();
|
|
45
|
+
formC.setSimpleData(data);
|
|
46
|
+
formControllers.push(formC);
|
|
47
|
+
formC.evt.on("onFormDataChange", (event) => {
|
|
48
|
+
const formData = {
|
|
49
|
+
...event.data[0]
|
|
50
|
+
};
|
|
51
|
+
const index = formControllers.indexOf(formC);
|
|
52
|
+
onSingleValueChange(formData, index);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
watch(() => props.controller.value, (newVal) => {
|
|
56
|
+
if (newVal && newVal.length > 0) {
|
|
57
|
+
newVal.forEach((item, index) => {
|
|
58
|
+
const formC = formControllers[index];
|
|
59
|
+
if (formC) {
|
|
60
|
+
const changeVal = item || {};
|
|
61
|
+
const find = Object.keys(formC.data).find((key) => {
|
|
62
|
+
return changeVal[key] !== formC.data[key];
|
|
63
|
+
});
|
|
64
|
+
if (find) {
|
|
65
|
+
formC.setSimpleData(changeVal);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
addFormController(item);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (newVal.length < formControllers.length) {
|
|
72
|
+
formControllers.forEach((c, index) => {
|
|
73
|
+
if (index >= newVal.length) {
|
|
74
|
+
c.state.isLoaded = false;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
immediate: true,
|
|
81
|
+
deep: true
|
|
82
|
+
});
|
|
83
|
+
const renderRemoveBtn = (index) => {
|
|
84
|
+
if (!props.controller.enableDelete) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (ibiz.config.form.mdCtrlConfirmBeforeRemove) {
|
|
88
|
+
return createVNode(resolveComponent("el-popconfirm"), {
|
|
89
|
+
"title": "\u662F\u5426\u5220\u9664\u9009\u4E2D\u9879",
|
|
90
|
+
"confirm-button-text": "\u786E\u8BA4",
|
|
91
|
+
"cancel-button-text": "\u53D6\u6D88",
|
|
92
|
+
"onConfirm": () => props.controller.remove(index)
|
|
93
|
+
}, {
|
|
94
|
+
reference: () => {
|
|
95
|
+
return createVNode(resolveComponent("el-button"), {
|
|
96
|
+
"text": true,
|
|
97
|
+
"type": "danger",
|
|
98
|
+
"class": [ns.be("index", "remove")]
|
|
99
|
+
}, {
|
|
100
|
+
default: () => [createTextVNode("\u5220\u9664")]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return createVNode(resolveComponent("el-button"), {
|
|
106
|
+
"text": true,
|
|
107
|
+
"type": "danger",
|
|
108
|
+
"class": [ns.be("index", "remove")],
|
|
109
|
+
"onClick": () => props.controller.remove(index)
|
|
110
|
+
}, {
|
|
111
|
+
default: () => [createTextVNode("\u5220\u9664")]
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
ns,
|
|
116
|
+
formItems,
|
|
117
|
+
formControllers,
|
|
118
|
+
renderRemoveBtn
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
render() {
|
|
122
|
+
return createVNode("div", {
|
|
123
|
+
"class": this.ns.b()
|
|
124
|
+
}, [this.controller.enableCreate && createVNode(resolveComponent("el-button"), {
|
|
125
|
+
"class": this.ns.e("add-btn"),
|
|
126
|
+
"onClick": () => {
|
|
127
|
+
this.controller.create();
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
default: () => [createTextVNode("\u6DFB\u52A0")]
|
|
131
|
+
}), createVNode(resolveComponent("el-table"), {
|
|
132
|
+
"class": this.ns.e("table"),
|
|
133
|
+
"show-header": true,
|
|
134
|
+
"data": this.controller.value,
|
|
135
|
+
"cell-class-name": ({
|
|
136
|
+
columnIndex
|
|
137
|
+
}) => {
|
|
138
|
+
return columnIndex === 0 ? this.ns.b("index") : "";
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
default: () => [createVNode(resolveComponent("el-table-column"), {
|
|
142
|
+
"type": "index",
|
|
143
|
+
"width": 66,
|
|
144
|
+
"align": "center"
|
|
145
|
+
}, {
|
|
146
|
+
default: (opts) => {
|
|
147
|
+
const {
|
|
148
|
+
$index
|
|
149
|
+
} = opts;
|
|
150
|
+
if (!this.controller.enableDelete) {
|
|
151
|
+
return createVNode("span", null, [$index + 1]);
|
|
152
|
+
}
|
|
153
|
+
return [this.renderRemoveBtn($index), createVNode("span", {
|
|
154
|
+
"class": this.ns.be("index", "text")
|
|
155
|
+
}, [$index + 1])];
|
|
156
|
+
}
|
|
157
|
+
}), this.formItems.length > 0 && this.formItems.map((item) => {
|
|
158
|
+
return createVNode(resolveComponent("el-table-column"), {
|
|
159
|
+
"label": item.caption,
|
|
160
|
+
"prop": item.id,
|
|
161
|
+
"align": "center"
|
|
162
|
+
}, {
|
|
163
|
+
default: (opts) => {
|
|
164
|
+
const {
|
|
165
|
+
$index
|
|
166
|
+
} = opts;
|
|
167
|
+
const formC = this.formControllers[$index];
|
|
168
|
+
if (!formC || !formC.state.isLoaded) {
|
|
169
|
+
return createVNode("div", null, [createTextVNode("\u4E0D\u5B58\u5728\u6216\u52A0\u8F7D\u4E2D")]);
|
|
170
|
+
}
|
|
171
|
+
const formItemC = formC.formItems.find((x) => x.name === item.id);
|
|
172
|
+
let editor = null;
|
|
173
|
+
if (!formItemC.editorProvider) {
|
|
174
|
+
editor = createVNode(resolveComponent("not-supported-editor"), {
|
|
175
|
+
"modelData": item.editor
|
|
176
|
+
}, null);
|
|
177
|
+
} else {
|
|
178
|
+
const component = resolveComponent(formItemC.editorProvider.formEditor);
|
|
179
|
+
editor = h(component, {
|
|
180
|
+
value: formItemC.value,
|
|
181
|
+
data: formItemC.data,
|
|
182
|
+
controller: formItemC.editor,
|
|
183
|
+
disabled: formItemC.state.disabled,
|
|
184
|
+
readonly: formItemC.model.editor.readOnly,
|
|
185
|
+
onChange: (val, name) => {
|
|
186
|
+
formItemC.setDataValue(val, name);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return createVNode(resolveComponent("iBizGridEditItem"), {
|
|
191
|
+
"error": formItemC.state.error,
|
|
192
|
+
"required": formItemC.state.required
|
|
193
|
+
}, _isSlot(editor) ? editor : {
|
|
194
|
+
default: () => [editor]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
})]
|
|
199
|
+
})]);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export { RepeaterGrid };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormMDCtrlRepeaterController } from '@ibiz-template/runtime';
|
|
2
|
+
export declare const RepeaterMultiForm: import("vue").DefineComponent<{
|
|
3
|
+
controller: {
|
|
4
|
+
type: typeof FormMDCtrlRepeaterController;
|
|
5
|
+
required: true;
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
9
|
+
onValueChange: (value: IData, index: number) => void;
|
|
10
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
change: (_value: IData[]) => true;
|
|
12
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
controller: {
|
|
14
|
+
type: typeof FormMDCtrlRepeaterController;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
}>> & {
|
|
18
|
+
onChange?: ((_value: IData[]) => any) | undefined;
|
|
19
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { resolveComponent, createVNode, defineComponent } from 'vue';
|
|
2
|
+
import { FormMDCtrlRepeaterController } from '@ibiz-template/runtime';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import { RepeaterSingleForm } from '../repeater-single-form/repeater-single-form.mjs';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const RepeaterMultiForm = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "IBizRepeaterMultiForm",
|
|
9
|
+
props: {
|
|
10
|
+
controller: {
|
|
11
|
+
type: FormMDCtrlRepeaterController,
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
emits: {
|
|
16
|
+
change: (_value) => true
|
|
17
|
+
},
|
|
18
|
+
setup(props, {
|
|
19
|
+
emit
|
|
20
|
+
}) {
|
|
21
|
+
const ns = useNamespace("repeater-multi-form");
|
|
22
|
+
const onValueChange = (value, index) => {
|
|
23
|
+
const arrData = [...props.controller.value];
|
|
24
|
+
arrData[index] = value;
|
|
25
|
+
emit("change", arrData);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
ns,
|
|
29
|
+
onValueChange
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
render() {
|
|
33
|
+
const items = this.controller.value;
|
|
34
|
+
return createVNode(resolveComponent("iBizMDCtrlContainer"), {
|
|
35
|
+
"class": this.ns.b(),
|
|
36
|
+
"items": items,
|
|
37
|
+
"enableCreate": this.controller.enableCreate,
|
|
38
|
+
"enableDelete": this.controller.enableDelete,
|
|
39
|
+
"onAddClick": () => this.controller.create(),
|
|
40
|
+
"onRemoveClick": (_item, index) => this.controller.remove(index)
|
|
41
|
+
}, {
|
|
42
|
+
item: ({
|
|
43
|
+
data,
|
|
44
|
+
index
|
|
45
|
+
}) => {
|
|
46
|
+
return createVNode(RepeaterSingleForm, {
|
|
47
|
+
"key": index,
|
|
48
|
+
"data": data,
|
|
49
|
+
"controller": this.controller,
|
|
50
|
+
"onChange": (value) => {
|
|
51
|
+
this.onValueChange(value, index);
|
|
52
|
+
}
|
|
53
|
+
}, null);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export { RepeaterMultiForm };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-repeater-single-form{--ibiz-repeater-single-form-header-height:32px;width:100%}.ibiz-repeater-single-form__content{width:100%}.ibiz-repeater-single-form-header{height:var(--ibiz-repeater-single-form-header-height)}
|