@vunk/form 2.13.0 → 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/form-item/index.cjs +138 -143
- package/components/form-item/index.css +13 -16
- package/components/form-item/index.mjs +140 -145
- package/components/form-item/src/core.vue.d.ts +1847 -0
- package/components/form-item/src/index.vue.d.ts +4 -745
- package/components/form-item/src/types.d.ts +1 -0
- package/index.css +13 -16
- package/package.json +1 -1
|
@@ -59,140 +59,65 @@ var ctx = /*#__PURE__*/Object.freeze({
|
|
|
59
59
|
props: props
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
var _sfc_main = vue.defineComponent({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
ElFormItem: elementPlus.ElFormItem,
|
|
66
|
-
ElIcon: elementPlus.ElIcon,
|
|
67
|
-
ElTooltip: elementPlus.ElTooltip,
|
|
68
|
-
Warning: index.warning_default,
|
|
69
|
-
ElButton: elementPlus.ElButton
|
|
62
|
+
var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
63
|
+
...{
|
|
64
|
+
inheritAttrs: false
|
|
70
65
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
if (utilsObject.isPlainObject(props2.rules)) {
|
|
100
|
-
data = [props2.rules];
|
|
101
|
-
}
|
|
102
|
-
if (Array.isArray(props2.rules)) {
|
|
103
|
-
data = props2.rules;
|
|
104
|
-
if (props2.required && !props2.rules.find((item) => item.required)) {
|
|
105
|
-
data.push({
|
|
106
|
-
required: true
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
data = data.filter((rule) => {
|
|
111
|
-
if (!rule) return;
|
|
112
|
-
if (utilsObject.isPlainObject(rule)) {
|
|
113
|
-
const enableKeys = Object.keys(rule).filter((key) => !key.startsWith("data-"));
|
|
114
|
-
return enableKeys.length > 0;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
data.forEach((rule) => {
|
|
118
|
-
setDefaultMessage(rule);
|
|
119
|
-
});
|
|
120
|
-
return data;
|
|
121
|
-
});
|
|
122
|
-
const elFormItemSlots = vue.computed(() => {
|
|
123
|
-
const slots2 = {};
|
|
124
|
-
const keys = ["label", "default", "error"];
|
|
125
|
-
const formItemSlots = props2.formItemSlots;
|
|
126
|
-
if (formItemSlots) {
|
|
127
|
-
Object.keys(formItemSlots).forEach((key) => {
|
|
128
|
-
if (keys.includes(key)) {
|
|
129
|
-
slots2[key] = formItemSlots?.[key];
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return slots2;
|
|
134
|
-
});
|
|
135
|
-
const customSlots = vue.computed(() => {
|
|
136
|
-
const theSlots = {
|
|
137
|
-
labelActions: slots?.labelActions ? () => slots.labelActions?.() : void 0
|
|
138
|
-
};
|
|
139
|
-
const keys = ["labelActions", "after"];
|
|
140
|
-
const formItemSlots = props2.formItemSlots;
|
|
141
|
-
formItemSlots && Object.keys(formItemSlots).filter((key) => keys.includes(key)).forEach((key) => {
|
|
142
|
-
const slot = formItemSlots?.[key];
|
|
143
|
-
if (slot) {
|
|
144
|
-
theSlots[key] = slot;
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return theSlots;
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
formItemBindProps,
|
|
151
|
-
readonly,
|
|
152
|
-
rules: rules$1,
|
|
153
|
-
localeName,
|
|
154
|
-
elFormItemSlots,
|
|
155
|
-
customSlots
|
|
156
|
-
};
|
|
66
|
+
__name: "core",
|
|
67
|
+
props: {
|
|
68
|
+
labelTip: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
formItemTip: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ""
|
|
75
|
+
},
|
|
76
|
+
formItemTipClass: null
|
|
77
|
+
},
|
|
78
|
+
setup(__props, { expose: __expose }) {
|
|
79
|
+
__expose();
|
|
80
|
+
const __returned__ = { get ElFormItem() {
|
|
81
|
+
return elementPlus.ElFormItem;
|
|
82
|
+
}, get ElTooltip() {
|
|
83
|
+
return elementPlus.ElTooltip;
|
|
84
|
+
}, get ElIcon() {
|
|
85
|
+
return elementPlus.ElIcon;
|
|
86
|
+
}, get ElButton() {
|
|
87
|
+
return elementPlus.ElButton;
|
|
88
|
+
}, get Warning() {
|
|
89
|
+
return index.warning_default;
|
|
90
|
+
} };
|
|
91
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
92
|
+
return __returned__;
|
|
157
93
|
}
|
|
158
94
|
});
|
|
159
95
|
|
|
160
96
|
const _hoisted_1 = {
|
|
161
97
|
key: 1,
|
|
162
|
-
class: "
|
|
98
|
+
class: "vkf-form-item-label__actions"
|
|
163
99
|
};
|
|
164
100
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
165
|
-
|
|
166
|
-
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
167
|
-
const _component_ElButton = vue.resolveComponent("ElButton");
|
|
168
|
-
const _component_ElTooltip = vue.resolveComponent("ElTooltip");
|
|
169
|
-
const _component_ElFormItem = vue.resolveComponent("ElFormItem");
|
|
170
|
-
return vue.openBlock(), vue.createBlock(_component_ElFormItem, vue.mergeProps(_ctx.formItemBindProps, {
|
|
171
|
-
ref: _ctx.elRef,
|
|
101
|
+
return vue.openBlock(), vue.createBlock($setup["ElFormItem"], vue.mergeProps(_ctx.$attrs, {
|
|
172
102
|
class: ["vkf-form-item", {
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"is-information": _ctx.information,
|
|
177
|
-
"has-label-actions": _ctx.customSlots.labelActions
|
|
178
|
-
}],
|
|
179
|
-
size: _ctx.formItemSize,
|
|
180
|
-
rules: _ctx.rules
|
|
181
|
-
}), vue.createSlots({
|
|
103
|
+
"has-label-actions": _ctx.$slots.labelActions
|
|
104
|
+
}]
|
|
105
|
+
}), {
|
|
182
106
|
default: vue.withCtx(() => [
|
|
107
|
+
vue.renderSlot(_ctx.$slots, "before"),
|
|
183
108
|
vue.renderSlot(_ctx.$slots, "default"),
|
|
184
|
-
|
|
185
|
-
|
|
109
|
+
vue.renderSlot(_ctx.$slots, "after"),
|
|
110
|
+
$props.formItemTip ? (vue.openBlock(), vue.createElementBlock(
|
|
186
111
|
"div",
|
|
187
112
|
{
|
|
188
|
-
key:
|
|
189
|
-
class: vue.normalizeClass(["vkf-form-item__tip",
|
|
113
|
+
key: 0,
|
|
114
|
+
class: vue.normalizeClass(["vkf-form-item__tip", $props.formItemTipClass])
|
|
190
115
|
},
|
|
191
116
|
[
|
|
192
117
|
vue.createElementVNode(
|
|
193
118
|
"span",
|
|
194
119
|
null,
|
|
195
|
-
vue.toDisplayString(
|
|
120
|
+
vue.toDisplayString($props.formItemTip),
|
|
196
121
|
1
|
|
197
122
|
/* TEXT */
|
|
198
123
|
)
|
|
@@ -201,32 +126,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
201
126
|
/* CLASS */
|
|
202
127
|
)) : vue.createCommentVNode("v-if", true)
|
|
203
128
|
]),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}, [
|
|
207
|
-
!_ctx.formItemSlots?.label && (_ctx.label || _ctx.labelTip) ? {
|
|
208
|
-
name: "label",
|
|
209
|
-
fn: vue.withCtx(() => [
|
|
129
|
+
label: vue.withCtx((e) => [
|
|
130
|
+
vue.renderSlot(_ctx.$slots, "label", vue.normalizeProps(vue.guardReactiveProps(e)), () => [
|
|
210
131
|
vue.createElementVNode(
|
|
211
132
|
"span",
|
|
212
133
|
null,
|
|
213
|
-
vue.toDisplayString(
|
|
134
|
+
vue.toDisplayString(e.label),
|
|
214
135
|
1
|
|
215
136
|
/* TEXT */
|
|
216
137
|
),
|
|
217
|
-
|
|
138
|
+
$props.labelTip ? (vue.openBlock(), vue.createBlock($setup["ElTooltip"], {
|
|
218
139
|
key: 0,
|
|
219
|
-
content:
|
|
140
|
+
content: $props.labelTip
|
|
220
141
|
}, {
|
|
221
142
|
default: vue.withCtx(() => [
|
|
222
|
-
vue.createVNode(
|
|
143
|
+
vue.createVNode($setup["ElButton"], {
|
|
223
144
|
text: "",
|
|
224
145
|
class: "vkf-form-item-label-tip-button"
|
|
225
146
|
}, {
|
|
226
147
|
default: vue.withCtx(() => [
|
|
227
|
-
vue.createVNode(
|
|
148
|
+
vue.createVNode($setup["ElIcon"], null, {
|
|
228
149
|
default: vue.withCtx(() => [
|
|
229
|
-
vue.createVNode(
|
|
150
|
+
vue.createVNode($setup["Warning"])
|
|
230
151
|
]),
|
|
231
152
|
_: 1
|
|
232
153
|
/* STABLE */
|
|
@@ -239,23 +160,97 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
239
160
|
_: 1
|
|
240
161
|
/* STABLE */
|
|
241
162
|
}, 8, ["content"])) : vue.createCommentVNode("v-if", true),
|
|
242
|
-
_ctx.
|
|
243
|
-
|
|
163
|
+
_ctx.$slots.labelActions ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
164
|
+
vue.renderSlot(_ctx.$slots, "labelActions")
|
|
244
165
|
])) : vue.createCommentVNode("v-if", true)
|
|
245
|
-
])
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
])
|
|
254
|
-
};
|
|
255
|
-
})
|
|
256
|
-
]), 1040, ["class", "size", "rules"]);
|
|
166
|
+
])
|
|
167
|
+
]),
|
|
168
|
+
error: vue.withCtx((e) => [
|
|
169
|
+
vue.renderSlot(_ctx.$slots, "error", vue.normalizeProps(vue.guardReactiveProps(e)))
|
|
170
|
+
]),
|
|
171
|
+
_: 3
|
|
172
|
+
/* FORWARDED */
|
|
173
|
+
}, 16, ["class"]);
|
|
257
174
|
}
|
|
258
|
-
var
|
|
175
|
+
var FormItemCore = /* @__PURE__ */ _pluginVue_exportHelper._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"]]);
|
|
176
|
+
|
|
177
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
178
|
+
name: "VkfFormItem",
|
|
179
|
+
props,
|
|
180
|
+
setup(props2, {
|
|
181
|
+
slots
|
|
182
|
+
}) {
|
|
183
|
+
const formItemBindProps = elementPlus$1.createFormItemBindProps(props2, ["rules"]);
|
|
184
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
185
|
+
const globalConfig = elementPlus.useGlobalConfig();
|
|
186
|
+
const localeName = vue.computed(() => {
|
|
187
|
+
return globalConfig.value?.locale?.name;
|
|
188
|
+
});
|
|
189
|
+
const requiredMessage = `${props2.label || "\u8BE5\u5B57\u6BB5"}\u4E0D\u80FD\u4E3A\u7A7A`;
|
|
190
|
+
const setDefaultMessage = rule => {
|
|
191
|
+
if (localeName.value === "zh-cn") {
|
|
192
|
+
if (rule.message) return;
|
|
193
|
+
if (rule.required) {
|
|
194
|
+
rule.message = requiredMessage;
|
|
195
|
+
}
|
|
196
|
+
const ruleInfo = rules.PATTERN_OPTIONS.find(i => i.value === rule.pattern);
|
|
197
|
+
if (ruleInfo) {
|
|
198
|
+
rule.message = `\u8F93\u5165 ${props2.label || "\u8BE5\u5B57\u6BB5"} ${ruleInfo.title}`;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const rules$1 = vue.computed(() => {
|
|
203
|
+
let data = [];
|
|
204
|
+
if (!props2.rules && props2.required) {
|
|
205
|
+
data.push({
|
|
206
|
+
required: true
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (utilsObject.isPlainObject(props2.rules)) {
|
|
210
|
+
data = [props2.rules];
|
|
211
|
+
}
|
|
212
|
+
if (Array.isArray(props2.rules)) {
|
|
213
|
+
data = props2.rules;
|
|
214
|
+
if (props2.required && !props2.rules.find(item => item.required)) {
|
|
215
|
+
data.push({
|
|
216
|
+
required: true
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
data = data.filter(rule => {
|
|
221
|
+
if (!rule) return;
|
|
222
|
+
if (utilsObject.isPlainObject(rule)) {
|
|
223
|
+
const enableKeys = Object.keys(rule).filter(key => !key.startsWith("data-"));
|
|
224
|
+
return enableKeys.length > 0;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
data.forEach(rule => {
|
|
228
|
+
setDefaultMessage(rule);
|
|
229
|
+
});
|
|
230
|
+
return data;
|
|
231
|
+
});
|
|
232
|
+
return () => vue.h(FormItemCore, {
|
|
233
|
+
...formItemBindProps.value,
|
|
234
|
+
ref: props2.elRef,
|
|
235
|
+
class: {
|
|
236
|
+
"is-readonly": readonly.value,
|
|
237
|
+
"vkf-form-item--inline": props2.inline,
|
|
238
|
+
"is-empty-label": !props2.label,
|
|
239
|
+
"is-information": props2.information
|
|
240
|
+
},
|
|
241
|
+
size: props2.formItemSize,
|
|
242
|
+
rules: rules$1.value,
|
|
243
|
+
formItemTip: props2.formItemTip,
|
|
244
|
+
formItemTipClass: props2.formItemTipClass,
|
|
245
|
+
labelTip: props2.labelTip
|
|
246
|
+
}, {
|
|
247
|
+
...slots,
|
|
248
|
+
...props2.formItemSlots
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
var VkfFormItem = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/form-item/src/index.vue"]]);
|
|
259
254
|
|
|
260
255
|
var types = /*#__PURE__*/Object.freeze({
|
|
261
256
|
__proto__: null
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
.vkf-form-item.is-information{
|
|
2
|
-
margin-bottom: 0;
|
|
3
|
-
}
|
|
4
|
-
.vkf-form-item--inline{
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
}
|
|
7
|
-
.vkf-form-item__tip {
|
|
8
|
-
color: var(--el-text-color-secondary);
|
|
9
|
-
}
|
|
10
1
|
.vkf-form-item-label-tip-button:hover .el-icon {
|
|
11
2
|
color: var(--el-color-primary);
|
|
12
3
|
}
|
|
@@ -17,19 +8,25 @@
|
|
|
17
8
|
margin-left: 4px;
|
|
18
9
|
padding: 4px;
|
|
19
10
|
}
|
|
20
|
-
.vkf-form-item.
|
|
21
|
-
display: none;
|
|
22
|
-
}
|
|
23
|
-
.vkf-form-item.has-label-actions > .el-form-item__label {
|
|
11
|
+
.el-form-item--label-top.vkf-form-item.has-label-actions > .el-form-item__label {
|
|
24
12
|
width: 100%;
|
|
25
13
|
padding-right: 0;
|
|
26
14
|
}
|
|
27
|
-
.
|
|
15
|
+
.vkf-form-item__tip {
|
|
16
|
+
color: var(--el-text-color-secondary);
|
|
17
|
+
}
|
|
18
|
+
.vkf-form-item-label__actions {
|
|
28
19
|
float: right;
|
|
29
20
|
align-items: center;
|
|
30
|
-
display:
|
|
21
|
+
display: inline-flex;
|
|
31
22
|
height: 1.8em;
|
|
32
23
|
}
|
|
33
|
-
.
|
|
24
|
+
.vkf-form-item.is-information{
|
|
25
|
+
margin-bottom: 0;
|
|
26
|
+
}
|
|
27
|
+
.vkf-form-item--inline{
|
|
34
28
|
display: inline-flex;
|
|
35
29
|
}
|
|
30
|
+
.vkf-form-item.is-empty-label .el-form-item__label:before{
|
|
31
|
+
display: none;
|
|
32
|
+
}
|