@vunk/form 0.0.0-alpha.3 → 0.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/date-picker/index.d.ts +4 -0
- package/components/date-picker/index.js +81 -0
- package/components/date-picker/src/ctx.d.ts +163 -0
- package/components/date-picker/src/index.vue.d.ts +407 -0
- package/components/date-picker/src/types.d.ts +14 -0
- package/components/form/index.js +16 -1
- package/components/ground/index.css +6 -3
- package/components/ground/index.js +50 -22
- package/components/ground/src/ground-main/src/index.vue.d.ts +5 -1
- package/components/ground/src/ground-widget/src/form-item-widget/src/index.vue.d.ts +594 -0
- package/components/ground/src/index.vue.d.ts +30 -5
- package/components/select/index.js +20 -6
- package/components/select/src/ctx.d.ts +5 -0
- package/components/select/src/index.vue.d.ts +9 -0
- package/components/select/src/types.d.ts +5 -3
- package/full-entry/main.d.ts +1 -1
- package/index.css +6 -3
- package/index.d.ts +11 -9
- package/index.esm.js +1 -1
- package/package.json +1 -1
- package/shared/element-plus/ctx/index.d.ts +2 -0
- package/shared/element-plus/ctx/index.js +22 -2
- package/shared/element-plus/instances/date-picker.d.ts +126 -0
- package/shared/element-plus/instances/date-picker.js +21 -0
- package/shared/types/form-item/date-picker.d.ts +8 -0
- package/shared/types/form-item/date-picker.js +1 -0
- package/shared/types/form-item/index.d.ts +1 -0
- package/shared/types/index.d.ts +2 -2
- package/shared/types/shared/index.d.ts +4 -0
- package/types/components/date-picker/index.d.ts +4 -0
- package/types/components/date-picker/src/ctx.d.ts +163 -0
- package/types/components/date-picker/src/index.vue.d.ts +407 -0
- package/types/components/date-picker/src/types.d.ts +14 -0
- package/types/components/ground/src/ground-main/src/index.vue.d.ts +5 -1
- package/types/components/ground/src/ground-widget/src/form-item-widget/src/index.vue.d.ts +594 -0
- package/types/components/ground/src/index.vue.d.ts +30 -5
- package/types/components/select/src/ctx.d.ts +5 -0
- package/types/components/select/src/index.vue.d.ts +9 -0
- package/types/components/select/src/types.d.ts +5 -3
- package/types/full-entry/main.d.ts +1 -1
- package/types/shared/element-plus/ctx/index.d.ts +2 -0
- package/types/shared/element-plus/instances/date-picker.d.ts +126 -0
- package/types/shared/types/form-item/date-picker.d.ts +8 -0
- package/types/shared/types/form-item/index.d.ts +1 -0
- package/types/shared/types/index.d.ts +2 -2
- package/types/shared/types/shared/index.d.ts +4 -0
package/components/form/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { createFormBindProps, createFormOnEmits } from '@vunk/form/shared/elemen
|
|
|
8
8
|
import { getValue } from '@vunk/form/shared/helper';
|
|
9
9
|
import { VkfSwitch } from '@vunk/form/components/switch';
|
|
10
10
|
import { VkfSelect } from '@vunk/form/components/select';
|
|
11
|
+
import { VkfDatePicker } from '@vunk/form/components/date-picker';
|
|
11
12
|
|
|
12
13
|
const props = {
|
|
13
14
|
...formProps,
|
|
@@ -45,7 +46,8 @@ var script = defineComponent({
|
|
|
45
46
|
VkfFormItemRendererTemplate,
|
|
46
47
|
VkfInput,
|
|
47
48
|
VkfSwitch,
|
|
48
|
-
VkfSelect
|
|
49
|
+
VkfSelect,
|
|
50
|
+
VkfDatePicker
|
|
49
51
|
},
|
|
50
52
|
setup(props2, { emit }) {
|
|
51
53
|
const formProps = createFormBindProps(props2, ["model"]);
|
|
@@ -63,6 +65,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
63
65
|
const _component_VkfFormItemRendererTemplate = resolveComponent("VkfFormItemRendererTemplate");
|
|
64
66
|
const _component_VkfSwitch = resolveComponent("VkfSwitch");
|
|
65
67
|
const _component_VkfSelect = resolveComponent("VkfSelect");
|
|
68
|
+
const _component_VkfDatePicker = resolveComponent("VkfDatePicker");
|
|
66
69
|
const _component_VkfFormItemRenderer = resolveComponent("VkfFormItemRenderer");
|
|
67
70
|
const _component_ElForm = resolveComponent("ElForm");
|
|
68
71
|
return openBlock(), createBlock(_component_ElForm, mergeProps(_ctx.formProps, toHandlers(_ctx.formEmits), {
|
|
@@ -107,6 +110,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
107
110
|
]),
|
|
108
111
|
_: 1
|
|
109
112
|
}),
|
|
113
|
+
createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfDatePicker" }, {
|
|
114
|
+
default: withCtx(({ data: sourceData }) => [
|
|
115
|
+
createVNode(_component_VkfDatePicker, mergeProps({
|
|
116
|
+
modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
|
|
117
|
+
"onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
|
|
118
|
+
k: sourceData.prop,
|
|
119
|
+
v: $event
|
|
120
|
+
})
|
|
121
|
+
}, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
|
|
122
|
+
]),
|
|
123
|
+
_: 1
|
|
124
|
+
}),
|
|
110
125
|
renderSlot(_ctx.$slots, "rendererTemplate")
|
|
111
126
|
]),
|
|
112
127
|
_: 3
|
|
@@ -11,15 +11,18 @@
|
|
|
11
11
|
.vkf-ground-main-x {
|
|
12
12
|
flex: 3;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
.vkf-ground-main-x .vkf-ground-main-card {
|
|
15
16
|
height: 100%;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
.vkf-ground-main-card>.vk-card-title {
|
|
18
20
|
display: flex;
|
|
19
21
|
justify-content: end;
|
|
20
22
|
margin-bottom: var(--gap-xxs);
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
.vkf-ground-main-card>.vk-card-body {
|
|
23
26
|
height: 100%;
|
|
24
27
|
border: 2px var(--el-border-color) dashed;
|
|
25
28
|
overflow: auto;
|
|
@@ -26,6 +26,15 @@ var script$5 = defineComponent({
|
|
|
26
26
|
label: "inputLabel"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
label: "select",
|
|
31
|
+
value: "VkfSelect",
|
|
32
|
+
defaultOptions: {
|
|
33
|
+
templateType: "VkfSelect",
|
|
34
|
+
prop: "",
|
|
35
|
+
label: "label"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
29
38
|
{
|
|
30
39
|
label: "switch",
|
|
31
40
|
value: "VkfSwitch",
|
|
@@ -628,6 +637,7 @@ var script$2 = defineComponent({
|
|
|
628
637
|
type: String,
|
|
629
638
|
default: ""
|
|
630
639
|
},
|
|
640
|
+
data: Object,
|
|
631
641
|
k: {
|
|
632
642
|
type: Array,
|
|
633
643
|
default: () => []
|
|
@@ -635,11 +645,11 @@ var script$2 = defineComponent({
|
|
|
635
645
|
},
|
|
636
646
|
emits: {
|
|
637
647
|
"update:prop": (e) => e,
|
|
648
|
+
"setData": (e) => e,
|
|
638
649
|
"setData:formItems": null,
|
|
639
650
|
"unsetData:formItems": null
|
|
640
651
|
},
|
|
641
652
|
setup(props, { emit }) {
|
|
642
|
-
const formData = ref({});
|
|
643
653
|
const groundEndClassName = ref(DragoverClasses.normal);
|
|
644
654
|
const formItemsWithWrapper = computed(() => {
|
|
645
655
|
const data = [];
|
|
@@ -757,7 +767,6 @@ var script$2 = defineComponent({
|
|
|
757
767
|
drop,
|
|
758
768
|
setData,
|
|
759
769
|
editDrop,
|
|
760
|
-
formData,
|
|
761
770
|
formItemsWithWrapper
|
|
762
771
|
};
|
|
763
772
|
}
|
|
@@ -788,8 +797,8 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
788
797
|
default: withCtx(() => [
|
|
789
798
|
createVNode(_component_VkfForm, {
|
|
790
799
|
formItems: _ctx.formItemsWithWrapper,
|
|
791
|
-
data: _ctx.
|
|
792
|
-
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx
|
|
800
|
+
data: _ctx.data,
|
|
801
|
+
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("setData", $event))
|
|
793
802
|
}, {
|
|
794
803
|
rendererTemplate: withCtx(() => [
|
|
795
804
|
createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfEditingSelect" }, {
|
|
@@ -822,19 +831,20 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
822
831
|
}, 1032, ["name"])
|
|
823
832
|
]),
|
|
824
833
|
_: 1
|
|
825
|
-
})
|
|
834
|
+
}),
|
|
835
|
+
renderSlot(_ctx.$slots, "rendererTemplate")
|
|
826
836
|
]),
|
|
827
|
-
_:
|
|
837
|
+
_: 3
|
|
828
838
|
}, 8, ["formItems", "data"])
|
|
829
839
|
]),
|
|
830
|
-
_:
|
|
840
|
+
_: 3
|
|
831
841
|
}, 8, ["modelValue"]),
|
|
832
842
|
createElementVNode("div", {
|
|
833
843
|
class: normalizeClass(["vkf-ground-end", _ctx.groundEndClassName]),
|
|
834
844
|
ref: "endLineNode"
|
|
835
845
|
}, null, 2)
|
|
836
846
|
]),
|
|
837
|
-
_:
|
|
847
|
+
_: 3
|
|
838
848
|
}, 8, ["onDrop", "onDragover", "onDragleave"]);
|
|
839
849
|
}
|
|
840
850
|
|
|
@@ -1051,22 +1061,33 @@ var script = defineComponent({
|
|
|
1051
1061
|
componentLibCollapseExpanded: {
|
|
1052
1062
|
type: Array,
|
|
1053
1063
|
default: void 0
|
|
1064
|
+
},
|
|
1065
|
+
source: {
|
|
1066
|
+
type: Array,
|
|
1067
|
+
default: () => []
|
|
1068
|
+
},
|
|
1069
|
+
data: {
|
|
1070
|
+
type: Object,
|
|
1071
|
+
default: () => ({})
|
|
1054
1072
|
}
|
|
1055
1073
|
},
|
|
1056
1074
|
emits: {
|
|
1075
|
+
"update:source": null,
|
|
1076
|
+
"setData:source": (e) => e,
|
|
1077
|
+
"unsetData:source": null,
|
|
1078
|
+
"setData": (e) => e,
|
|
1057
1079
|
"update:componentLibCollapseExpanded": null
|
|
1058
1080
|
},
|
|
1059
1081
|
setup(props, { emit }) {
|
|
1060
|
-
const formItems = ref([]);
|
|
1061
|
-
const editProp = ref("");
|
|
1062
1082
|
const propToFormItem = computed(() => {
|
|
1063
|
-
return
|
|
1083
|
+
return props.source.reduce((a, c) => {
|
|
1064
1084
|
if (c.prop) {
|
|
1065
1085
|
a[c.prop] = c;
|
|
1066
1086
|
}
|
|
1067
1087
|
return a;
|
|
1068
1088
|
}, {});
|
|
1069
1089
|
});
|
|
1090
|
+
const editProp = ref("");
|
|
1070
1091
|
const configPropDisabled = ref(true);
|
|
1071
1092
|
const setFormItem = (props2, e) => {
|
|
1072
1093
|
if (e.k === "prop") {
|
|
@@ -1093,7 +1114,7 @@ var script = defineComponent({
|
|
|
1093
1114
|
setData(props2, e);
|
|
1094
1115
|
}
|
|
1095
1116
|
};
|
|
1096
|
-
const formItemStr = computed(() => JSON.stringify(
|
|
1117
|
+
const formItemStr = computed(() => JSON.stringify(props.source));
|
|
1097
1118
|
const formItemClip = useClipboard({
|
|
1098
1119
|
source: formItemStr
|
|
1099
1120
|
});
|
|
@@ -1114,12 +1135,11 @@ var script = defineComponent({
|
|
|
1114
1135
|
}
|
|
1115
1136
|
return obj;
|
|
1116
1137
|
}).then((obj) => {
|
|
1117
|
-
|
|
1138
|
+
emit("update:source", obj);
|
|
1118
1139
|
});
|
|
1119
1140
|
};
|
|
1120
1141
|
return {
|
|
1121
1142
|
propToFormItem,
|
|
1122
|
-
formItems,
|
|
1123
1143
|
editProp,
|
|
1124
1144
|
setData,
|
|
1125
1145
|
unsetData,
|
|
@@ -1177,24 +1197,32 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1177
1197
|
]),
|
|
1178
1198
|
default: withCtx(() => [
|
|
1179
1199
|
createVNode(_component_VkfGroundMain, {
|
|
1200
|
+
data: _ctx.data,
|
|
1201
|
+
onSetData: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("setData", $event)),
|
|
1180
1202
|
prop: _ctx.editProp,
|
|
1181
|
-
"onUpdate:prop": _cache[
|
|
1182
|
-
formItems: _ctx.
|
|
1183
|
-
"onSetData:formItems": _cache[
|
|
1184
|
-
"onUnsetData:formItems": _cache[
|
|
1185
|
-
},
|
|
1203
|
+
"onUpdate:prop": _cache[3] || (_cache[3] = ($event) => _ctx.editProp = $event),
|
|
1204
|
+
formItems: _ctx.source,
|
|
1205
|
+
"onSetData:formItems": _cache[4] || (_cache[4] = ($event) => _ctx.$emit("setData:source", $event)),
|
|
1206
|
+
"onUnsetData:formItems": _cache[5] || (_cache[5] = ($event) => _ctx.$emit("unsetData:source", $event))
|
|
1207
|
+
}, {
|
|
1208
|
+
rendererTemplate: withCtx(() => [
|
|
1209
|
+
renderSlot(_ctx.$slots, "rendererTemplate")
|
|
1210
|
+
]),
|
|
1211
|
+
_: 3
|
|
1212
|
+
}, 8, ["data", "prop", "formItems"])
|
|
1186
1213
|
]),
|
|
1187
|
-
_:
|
|
1214
|
+
_: 3
|
|
1188
1215
|
})
|
|
1189
1216
|
]),
|
|
1190
1217
|
createElementVNode("div", _hoisted_6, [
|
|
1218
|
+
createCommentVNode(" \u901A\u8FC7config \u4FEE\u6539\u6570\u636E\u6E90 \u5355\u9879\u7684\u5185\u5BB9 "),
|
|
1191
1219
|
_ctx.editProp && _ctx.propToFormItem[_ctx.editProp] ? (openBlock(), createBlock(_component_VkfGroundConfig, {
|
|
1192
1220
|
key: 0,
|
|
1193
1221
|
propDisabled: _ctx.configPropDisabled,
|
|
1194
|
-
"onUpdate:propDisabled": _cache[
|
|
1222
|
+
"onUpdate:propDisabled": _cache[6] || (_cache[6] = ($event) => _ctx.configPropDisabled = $event),
|
|
1195
1223
|
templateType: _ctx.propToFormItem[_ctx.editProp].templateType,
|
|
1196
1224
|
data: _ctx.propToFormItem[_ctx.editProp],
|
|
1197
|
-
onSetData: _cache[
|
|
1225
|
+
onSetData: _cache[7] || (_cache[7] = ($event) => _ctx.setFormItem(_ctx.propToFormItem[_ctx.editProp], $event))
|
|
1198
1226
|
}, {
|
|
1199
1227
|
rendererTemplate: withCtx(() => [
|
|
1200
1228
|
renderSlot(_ctx.$slots, "configRendererTemplate")
|
|
@@ -2,6 +2,7 @@ import { PropType, Ref } from 'vue';
|
|
|
2
2
|
import { DragoverClasses } from '@vunk/form/components/drop-wrapper';
|
|
3
3
|
import type { FormItemRendererSourcePlus } from './types';
|
|
4
4
|
import type { DataTransferJson } from '@vunk/form/shared/types/drag';
|
|
5
|
+
import { SetDataEvent } from '@vunk/form/shared/types';
|
|
5
6
|
interface SourceTransfer extends DataTransferJson {
|
|
6
7
|
source: FormItemRendererSourcePlus;
|
|
7
8
|
}
|
|
@@ -14,6 +15,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
15
|
type: StringConstructor;
|
|
15
16
|
default: string;
|
|
16
17
|
};
|
|
18
|
+
data: ObjectConstructor;
|
|
17
19
|
k: {
|
|
18
20
|
type: ArrayConstructor;
|
|
19
21
|
default: () => never[];
|
|
@@ -30,10 +32,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
32
|
insert?: boolean | undefined;
|
|
31
33
|
}) => void;
|
|
32
34
|
editDrop: (e: DragEvent, overClass: DragoverClasses, toData: SourceTransfer) => void;
|
|
33
|
-
formData: Ref<{}>;
|
|
34
35
|
formItemsWithWrapper: import("vue").ComputedRef<FormItemRendererSourcePlus[]>;
|
|
35
36
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
37
|
'update:prop': (e: string) => string;
|
|
38
|
+
setData: (e: SetDataEvent) => SetDataEvent<any>;
|
|
37
39
|
'setData:formItems': null;
|
|
38
40
|
'unsetData:formItems': null;
|
|
39
41
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -45,11 +47,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
47
|
type: StringConstructor;
|
|
46
48
|
default: string;
|
|
47
49
|
};
|
|
50
|
+
data: ObjectConstructor;
|
|
48
51
|
k: {
|
|
49
52
|
type: ArrayConstructor;
|
|
50
53
|
default: () => never[];
|
|
51
54
|
};
|
|
52
55
|
}>> & {
|
|
56
|
+
onSetData?: ((e: SetDataEvent<any>) => any) | undefined;
|
|
53
57
|
"onSetData:formItems"?: ((...args: any[]) => any) | undefined;
|
|
54
58
|
"onUnsetData:formItems"?: ((...args: any[]) => any) | undefined;
|
|
55
59
|
"onUpdate:prop"?: ((e: string) => any) | undefined;
|