@vunk/form 2.12.2 → 2.13.1
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/api-tables-select/src/ctx.d.ts +1 -1
- package/components/api-tables-select/src/index.vue.d.ts +5 -5
- package/components/api-tables-select/src/types.d.ts +2 -2
- package/components/button/index.cjs +1 -1
- package/components/button/index.mjs +1 -1
- package/components/button/src/ctx.d.ts +1 -6
- package/components/button/src/index.vue.d.ts +3 -12
- package/components/button/src/types.d.ts +2 -2
- package/components/card-input-collection/src/ctx.d.ts +1 -6
- package/components/card-input-collection/src/index.vue.d.ts +4 -18
- package/components/card-input-collection/src/types.d.ts +2 -2
- package/components/cascader/src/ctx.d.ts +2 -7
- package/components/cascader/src/index.vue.d.ts +3 -12
- package/components/cascader/src/types.d.ts +1 -1
- package/components/checkbox/src/ctx.d.ts +2 -7
- package/components/checkbox/src/index.vue.d.ts +3 -12
- package/components/checkbox/src/types.d.ts +1 -1
- package/components/color-picker/src/ctx.d.ts +1 -6
- package/components/color-picker/src/index.vue.d.ts +3 -12
- package/components/color-picker/src/types.d.ts +1 -1
- package/components/date-picker/src/ctx.d.ts +2 -7
- package/components/date-picker/src/index.vue.d.ts +3 -12
- package/components/date-picker/src/types.d.ts +2 -2
- package/components/date-picker-range/src/types.d.ts +3 -3
- package/components/dialog-input-collection/index.cjs +6 -2
- package/components/dialog-input-collection/index.mjs +6 -2
- package/components/dialog-input-collection/src/ctx.d.ts +1 -6
- package/components/dialog-input-collection/src/index.vue.d.ts +4 -18
- package/components/dialog-input-collection/src/types.d.ts +2 -2
- package/components/download-plus/src/ctx.d.ts +1 -6
- package/components/download-plus/src/index.vue.d.ts +3 -12
- package/components/editable-text/src/ctx.d.ts +1 -6
- package/components/editable-text/src/index.vue.d.ts +5 -19
- package/components/esri-input-geojson/src/ctx.d.ts +2 -7
- package/components/esri-input-geojson/src/index.vue.d.ts +4 -13
- package/components/esri-input-geojson/src/types.d.ts +2 -2
- package/components/form/src/types.d.ts +1 -1
- package/components/form-item/index.cjs +140 -144
- package/components/form-item/index.css +13 -16
- package/components/form-item/index.mjs +142 -146
- package/components/form-item/src/core.vue.d.ts +1847 -0
- package/components/form-item/src/ctx.d.ts +2 -7
- package/components/form-item/src/index.vue.d.ts +7 -757
- package/components/form-item/src/types.d.ts +1 -0
- package/components/information/src/types.d.ts +1 -1
- package/components/information-collection/src/ctx.d.ts +1 -6
- package/components/information-collection/src/index.vue.d.ts +3 -12
- package/components/input/src/ctx.d.ts +2 -7
- package/components/input/src/index.vue.d.ts +3 -12
- package/components/input/src/types.d.ts +2 -2
- package/components/input-collection/src/ctx.d.ts +1 -6
- package/components/input-collection/src/index.vue.d.ts +4 -18
- package/components/input-collection/src/types.d.ts +2 -2
- package/components/input-link/src/ctx.d.ts +1 -6
- package/components/input-link/src/index.vue.d.ts +3 -12
- package/components/input-link/src/types.d.ts +1 -1
- package/components/input-number/src/ctx.d.ts +2 -7
- package/components/input-number/src/index.vue.d.ts +3 -12
- package/components/input-number/src/types.d.ts +1 -1
- package/components/input-tag/src/ctx.d.ts +2 -7
- package/components/input-tag/src/index.vue.d.ts +3 -12
- package/components/input-tag/src/types.d.ts +2 -2
- package/components/monaco-editor/src/ctx.d.ts +1 -6
- package/components/monaco-editor/src/index.vue.d.ts +3 -12
- package/components/monaco-editor/src/types.d.ts +2 -2
- package/components/radio/src/ctx.d.ts +1 -6
- package/components/radio/src/index.vue.d.ts +3 -12
- package/components/radio/src/types.d.ts +1 -1
- package/components/select/src/ctx.d.ts +2 -7
- package/components/select/src/index.vue.d.ts +3 -12
- package/components/select/src/types.d.ts +1 -1
- package/components/slider/src/ctx.d.ts +1 -6
- package/components/slider/src/index.vue.d.ts +3 -12
- package/components/slider/src/types.d.ts +1 -1
- package/components/switch/src/ctx.d.ts +1 -6
- package/components/switch/src/index.vue.d.ts +3 -12
- package/components/switch/src/types.d.ts +1 -1
- package/components/tables-select/src/ctx.d.ts +1 -1
- package/components/tables-select/src/index.vue.d.ts +2 -2
- package/components/tables-select/src/types.d.ts +2 -2
- package/components/templates-default/src/types.d.ts +16 -16
- package/components/templates-esri/src/types.d.ts +1 -1
- package/components/templates-variant/src/types.d.ts +1 -1
- package/components/upload/src/ctx.d.ts +2 -7
- package/components/upload/src/index.vue.d.ts +3 -12
- package/components/upload/src/types.d.ts +1 -1
- package/components/upload-plus/src/ctx.d.ts +1 -6
- package/components/upload-plus/src/index.vue.d.ts +4 -18
- package/components/van-cascader/src/ctx.d.ts +1 -6
- package/components/van-cascader/src/index.vue.d.ts +3 -12
- package/components/var-datetime-picker/src/ctx.d.ts +1 -6
- package/components/var-datetime-picker/src/index.vue.d.ts +3 -12
- package/components/var-datetime-picker/src/types.d.ts +2 -2
- package/components/vditor/src/ctx.d.ts +1 -6
- package/components/vditor/src/index.vue.d.ts +3 -12
- package/components/vditor/src/types.d.ts +2 -2
- package/index.css +13 -16
- package/package.json +1 -1
- package/shared/types/source/index.d.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { formItemProps, ElFormItem,
|
|
1
|
+
import { formItemProps, ElFormItem, ElTooltip, ElIcon, ElButton, useGlobalConfig } from 'element-plus';
|
|
2
2
|
import { bindPropsFactory } from '@vunk/core/shared/utils-vue';
|
|
3
|
-
import { defineComponent,
|
|
3
|
+
import { defineComponent, openBlock, createBlock, mergeProps, withCtx, renderSlot, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, normalizeProps, guardReactiveProps, createVNode, computed, h } from 'vue';
|
|
4
4
|
import { createFormItemBindProps } from '@vunk/form/shared/element-plus';
|
|
5
5
|
import { useComputedReadonly } from '@vunk/form/composables';
|
|
6
6
|
import { isPlainObject } from '@vunk/core/shared/utils-object';
|
|
@@ -42,7 +42,8 @@ const _props = {
|
|
|
42
42
|
information: {
|
|
43
43
|
type: Boolean,
|
|
44
44
|
default: false
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
|
+
prop: null
|
|
46
47
|
};
|
|
47
48
|
Reflect.deleteProperty(_props, "size");
|
|
48
49
|
const props = _props;
|
|
@@ -54,140 +55,65 @@ var ctx = /*#__PURE__*/Object.freeze({
|
|
|
54
55
|
props: props
|
|
55
56
|
});
|
|
56
57
|
|
|
57
|
-
var _sfc_main = defineComponent({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ElFormItem,
|
|
61
|
-
ElIcon,
|
|
62
|
-
ElTooltip,
|
|
63
|
-
Warning: warning_default,
|
|
64
|
-
ElButton
|
|
58
|
+
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
59
|
+
...{
|
|
60
|
+
inheritAttrs: false
|
|
65
61
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
if (isPlainObject(props2.rules)) {
|
|
95
|
-
data = [props2.rules];
|
|
96
|
-
}
|
|
97
|
-
if (Array.isArray(props2.rules)) {
|
|
98
|
-
data = props2.rules;
|
|
99
|
-
if (props2.required && !props2.rules.find((item) => item.required)) {
|
|
100
|
-
data.push({
|
|
101
|
-
required: true
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
data = data.filter((rule) => {
|
|
106
|
-
if (!rule) return;
|
|
107
|
-
if (isPlainObject(rule)) {
|
|
108
|
-
const enableKeys = Object.keys(rule).filter((key) => !key.startsWith("data-"));
|
|
109
|
-
return enableKeys.length > 0;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
data.forEach((rule) => {
|
|
113
|
-
setDefaultMessage(rule);
|
|
114
|
-
});
|
|
115
|
-
return data;
|
|
116
|
-
});
|
|
117
|
-
const elFormItemSlots = computed(() => {
|
|
118
|
-
const slots2 = {};
|
|
119
|
-
const keys = ["label", "default", "error"];
|
|
120
|
-
const formItemSlots = props2.formItemSlots;
|
|
121
|
-
if (formItemSlots) {
|
|
122
|
-
Object.keys(formItemSlots).forEach((key) => {
|
|
123
|
-
if (keys.includes(key)) {
|
|
124
|
-
slots2[key] = formItemSlots?.[key];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return slots2;
|
|
129
|
-
});
|
|
130
|
-
const customSlots = computed(() => {
|
|
131
|
-
const theSlots = {
|
|
132
|
-
labelActions: slots?.labelActions ? () => slots.labelActions?.() : void 0
|
|
133
|
-
};
|
|
134
|
-
const keys = ["labelActions", "after"];
|
|
135
|
-
const formItemSlots = props2.formItemSlots;
|
|
136
|
-
formItemSlots && Object.keys(formItemSlots).filter((key) => keys.includes(key)).forEach((key) => {
|
|
137
|
-
const slot = formItemSlots?.[key];
|
|
138
|
-
if (slot) {
|
|
139
|
-
theSlots[key] = slot;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return theSlots;
|
|
143
|
-
});
|
|
144
|
-
return {
|
|
145
|
-
formItemBindProps,
|
|
146
|
-
readonly,
|
|
147
|
-
rules,
|
|
148
|
-
localeName,
|
|
149
|
-
elFormItemSlots,
|
|
150
|
-
customSlots
|
|
151
|
-
};
|
|
62
|
+
__name: "core",
|
|
63
|
+
props: {
|
|
64
|
+
labelTip: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
formItemTip: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
formItemTipClass: null
|
|
73
|
+
},
|
|
74
|
+
setup(__props, { expose: __expose }) {
|
|
75
|
+
__expose();
|
|
76
|
+
const __returned__ = { get ElFormItem() {
|
|
77
|
+
return ElFormItem;
|
|
78
|
+
}, get ElTooltip() {
|
|
79
|
+
return ElTooltip;
|
|
80
|
+
}, get ElIcon() {
|
|
81
|
+
return ElIcon;
|
|
82
|
+
}, get ElButton() {
|
|
83
|
+
return ElButton;
|
|
84
|
+
}, get Warning() {
|
|
85
|
+
return warning_default;
|
|
86
|
+
} };
|
|
87
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
88
|
+
return __returned__;
|
|
152
89
|
}
|
|
153
90
|
});
|
|
154
91
|
|
|
155
92
|
const _hoisted_1 = {
|
|
156
93
|
key: 1,
|
|
157
|
-
class: "
|
|
94
|
+
class: "vkf-form-item-label__actions"
|
|
158
95
|
};
|
|
159
96
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
160
|
-
|
|
161
|
-
const _component_ElIcon = resolveComponent("ElIcon");
|
|
162
|
-
const _component_ElButton = resolveComponent("ElButton");
|
|
163
|
-
const _component_ElTooltip = resolveComponent("ElTooltip");
|
|
164
|
-
const _component_ElFormItem = resolveComponent("ElFormItem");
|
|
165
|
-
return openBlock(), createBlock(_component_ElFormItem, mergeProps(_ctx.formItemBindProps, {
|
|
166
|
-
ref: _ctx.elRef,
|
|
97
|
+
return openBlock(), createBlock($setup["ElFormItem"], mergeProps(_ctx.$attrs, {
|
|
167
98
|
class: ["vkf-form-item", {
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"is-information": _ctx.information,
|
|
172
|
-
"has-label-actions": _ctx.customSlots.labelActions
|
|
173
|
-
}],
|
|
174
|
-
size: _ctx.formItemSize,
|
|
175
|
-
rules: _ctx.rules
|
|
176
|
-
}), createSlots({
|
|
99
|
+
"has-label-actions": _ctx.$slots.labelActions
|
|
100
|
+
}]
|
|
101
|
+
}), {
|
|
177
102
|
default: withCtx(() => [
|
|
103
|
+
renderSlot(_ctx.$slots, "before"),
|
|
178
104
|
renderSlot(_ctx.$slots, "default"),
|
|
179
|
-
|
|
180
|
-
|
|
105
|
+
renderSlot(_ctx.$slots, "after"),
|
|
106
|
+
$props.formItemTip ? (openBlock(), createElementBlock(
|
|
181
107
|
"div",
|
|
182
108
|
{
|
|
183
|
-
key:
|
|
184
|
-
class: normalizeClass(["vkf-form-item__tip",
|
|
109
|
+
key: 0,
|
|
110
|
+
class: normalizeClass(["vkf-form-item__tip", $props.formItemTipClass])
|
|
185
111
|
},
|
|
186
112
|
[
|
|
187
113
|
createElementVNode(
|
|
188
114
|
"span",
|
|
189
115
|
null,
|
|
190
|
-
toDisplayString(
|
|
116
|
+
toDisplayString($props.formItemTip),
|
|
191
117
|
1
|
|
192
118
|
/* TEXT */
|
|
193
119
|
)
|
|
@@ -196,32 +122,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
196
122
|
/* CLASS */
|
|
197
123
|
)) : createCommentVNode("v-if", true)
|
|
198
124
|
]),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, [
|
|
202
|
-
!_ctx.formItemSlots?.label && (_ctx.label || _ctx.labelTip) ? {
|
|
203
|
-
name: "label",
|
|
204
|
-
fn: withCtx(() => [
|
|
125
|
+
label: withCtx((e) => [
|
|
126
|
+
renderSlot(_ctx.$slots, "label", normalizeProps(guardReactiveProps(e)), () => [
|
|
205
127
|
createElementVNode(
|
|
206
128
|
"span",
|
|
207
129
|
null,
|
|
208
|
-
toDisplayString(
|
|
130
|
+
toDisplayString(e.label),
|
|
209
131
|
1
|
|
210
132
|
/* TEXT */
|
|
211
133
|
),
|
|
212
|
-
|
|
134
|
+
$props.labelTip ? (openBlock(), createBlock($setup["ElTooltip"], {
|
|
213
135
|
key: 0,
|
|
214
|
-
content:
|
|
136
|
+
content: $props.labelTip
|
|
215
137
|
}, {
|
|
216
138
|
default: withCtx(() => [
|
|
217
|
-
createVNode(
|
|
139
|
+
createVNode($setup["ElButton"], {
|
|
218
140
|
text: "",
|
|
219
141
|
class: "vkf-form-item-label-tip-button"
|
|
220
142
|
}, {
|
|
221
143
|
default: withCtx(() => [
|
|
222
|
-
createVNode(
|
|
144
|
+
createVNode($setup["ElIcon"], null, {
|
|
223
145
|
default: withCtx(() => [
|
|
224
|
-
createVNode(
|
|
146
|
+
createVNode($setup["Warning"])
|
|
225
147
|
]),
|
|
226
148
|
_: 1
|
|
227
149
|
/* STABLE */
|
|
@@ -234,23 +156,97 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
234
156
|
_: 1
|
|
235
157
|
/* STABLE */
|
|
236
158
|
}, 8, ["content"])) : createCommentVNode("v-if", true),
|
|
237
|
-
_ctx.
|
|
238
|
-
(
|
|
159
|
+
_ctx.$slots.labelActions ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
160
|
+
renderSlot(_ctx.$slots, "labelActions")
|
|
239
161
|
])) : createCommentVNode("v-if", true)
|
|
240
|
-
])
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
])
|
|
249
|
-
};
|
|
250
|
-
})
|
|
251
|
-
]), 1040, ["class", "size", "rules"]);
|
|
162
|
+
])
|
|
163
|
+
]),
|
|
164
|
+
error: withCtx((e) => [
|
|
165
|
+
renderSlot(_ctx.$slots, "error", normalizeProps(guardReactiveProps(e)))
|
|
166
|
+
]),
|
|
167
|
+
_: 3
|
|
168
|
+
/* FORWARDED */
|
|
169
|
+
}, 16, ["class"]);
|
|
252
170
|
}
|
|
253
|
-
var
|
|
171
|
+
var FormItemCore = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/core.vue"]]);
|
|
172
|
+
|
|
173
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
174
|
+
name: "VkfFormItem",
|
|
175
|
+
props,
|
|
176
|
+
setup(props2, {
|
|
177
|
+
slots
|
|
178
|
+
}) {
|
|
179
|
+
const formItemBindProps = createFormItemBindProps(props2, ["rules"]);
|
|
180
|
+
const readonly = useComputedReadonly(props2);
|
|
181
|
+
const globalConfig = useGlobalConfig();
|
|
182
|
+
const localeName = computed(() => {
|
|
183
|
+
return globalConfig.value?.locale?.name;
|
|
184
|
+
});
|
|
185
|
+
const requiredMessage = `${props2.label || "\u8BE5\u5B57\u6BB5"}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
186
|
+
const setDefaultMessage = rule => {
|
|
187
|
+
if (localeName.value === "zh-cn") {
|
|
188
|
+
if (rule.message) return;
|
|
189
|
+
if (rule.required) {
|
|
190
|
+
rule.message = requiredMessage;
|
|
191
|
+
}
|
|
192
|
+
const ruleInfo = PATTERN_OPTIONS.find(i => i.value === rule.pattern);
|
|
193
|
+
if (ruleInfo) {
|
|
194
|
+
rule.message = `\u8F93\u5165 ${props2.label || "\u8BE5\u5B57\u6BB5"} ${ruleInfo.title}`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const rules = computed(() => {
|
|
199
|
+
let data = [];
|
|
200
|
+
if (!props2.rules && props2.required) {
|
|
201
|
+
data.push({
|
|
202
|
+
required: true
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (isPlainObject(props2.rules)) {
|
|
206
|
+
data = [props2.rules];
|
|
207
|
+
}
|
|
208
|
+
if (Array.isArray(props2.rules)) {
|
|
209
|
+
data = props2.rules;
|
|
210
|
+
if (props2.required && !props2.rules.find(item => item.required)) {
|
|
211
|
+
data.push({
|
|
212
|
+
required: true
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
data = data.filter(rule => {
|
|
217
|
+
if (!rule) return;
|
|
218
|
+
if (isPlainObject(rule)) {
|
|
219
|
+
const enableKeys = Object.keys(rule).filter(key => !key.startsWith("data-"));
|
|
220
|
+
return enableKeys.length > 0;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
data.forEach(rule => {
|
|
224
|
+
setDefaultMessage(rule);
|
|
225
|
+
});
|
|
226
|
+
return data;
|
|
227
|
+
});
|
|
228
|
+
return () => h(FormItemCore, {
|
|
229
|
+
...formItemBindProps.value,
|
|
230
|
+
ref: props2.elRef,
|
|
231
|
+
class: {
|
|
232
|
+
"is-readonly": readonly.value,
|
|
233
|
+
"vkf-form-item--inline": props2.inline,
|
|
234
|
+
"is-empty-label": !props2.label,
|
|
235
|
+
"is-information": props2.information
|
|
236
|
+
},
|
|
237
|
+
size: props2.formItemSize,
|
|
238
|
+
rules: rules.value,
|
|
239
|
+
formItemTip: props2.formItemTip,
|
|
240
|
+
formItemTipClass: props2.formItemTipClass,
|
|
241
|
+
labelTip: props2.labelTip
|
|
242
|
+
}, {
|
|
243
|
+
...slots,
|
|
244
|
+
...props2.formItemSlots
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
var VkfFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/index.vue"]]);
|
|
254
250
|
|
|
255
251
|
var types = /*#__PURE__*/Object.freeze({
|
|
256
252
|
__proto__: null
|