@vunk/form 1.1.84 → 1.2.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/components/_plugin-vue_export-helper.cjs +11 -0
- package/components/button/index.cjs +112 -0
- package/components/cascader/index.cjs +130 -0
- package/components/checkbox/index.cjs +153 -0
- package/components/color-picker/index.cjs +80 -0
- package/components/date-picker/index.cjs +120 -0
- package/components/date-picker-range/index.cjs +170 -0
- package/components/download-plus/index.cjs +445 -0
- package/components/esri-input-geojson/index.cjs +1120 -0
- package/components/form/index.cjs +220 -0
- package/components/form-item/index.cjs +162 -0
- package/components/form-item-renderer/index.cjs +103 -0
- package/components/form-item-renderer-template/index.cjs +47 -0
- package/components/geoinput/index.cjs +95 -0
- package/components/geoinput-read/index.cjs +304 -0
- package/components/geoinput-update/index.cjs +406 -0
- package/components/index.cjs +13 -0
- package/components/index2.cjs +323 -0
- package/components/index3.cjs +486 -0
- package/components/input/index.cjs +119 -0
- package/components/input-link/index.cjs +157 -0
- package/components/input-number/index.cjs +100 -0
- package/components/radio/index.cjs +142 -0
- package/components/select/index.cjs +165 -0
- package/components/slider/index.cjs +89 -0
- package/components/switch/index.cjs +92 -0
- package/components/templates-default/index.cjs +308 -0
- package/components/templates-element-plus/index.cjs +112 -0
- package/components/templates-esri/index.cjs +65 -0
- package/components/templates-layout/index.cjs +137 -0
- package/components/templates-mapbox/index.cjs +65 -0
- package/components/templates-variant/index.cjs +70 -0
- package/components/upload/index.cjs +508 -0
- package/components/upload-plus/index.cjs +18658 -0
- package/components/van-cascader/index.cjs +128 -0
- package/components/var-datetime-picker/index.cjs +330 -0
- package/components/vditor/index.cjs +451 -0
- package/composables/index.cjs +89 -0
- package/package.json +97 -49
- package/shared/const/index.cjs +59 -0
- package/shared/element-plus/index.cjs +317 -0
- package/shared/form/index.cjs +33 -0
- package/shared/helper/index.cjs +11 -0
- package/shared/index.cjs +8 -0
- package/shared/infer-prop/index.cjs +36 -0
- package/shared/progress-it/index.cjs +40 -0
- package/shared/rules/index.cjs +56 -0
- package/shared/types/form/index.cjs +2 -0
- package/shared/types/index.cjs +2 -0
- package/shared/types/source/index.cjs +2 -0
- package/shared/types/source-manager/index.cjs +2 -0
- package/shared/upload/index.cjs +774 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var input = require('@vunk/form/components/input');
|
|
6
|
+
var vue = require('vue');
|
|
7
|
+
var elementPlus = require('element-plus');
|
|
8
|
+
var index = require('../index2.cjs');
|
|
9
|
+
var utilsObject = require('@vunk/core/shared/utils-object');
|
|
10
|
+
var composables = require('@vunk/form/composables');
|
|
11
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
12
|
+
|
|
13
|
+
const props = {
|
|
14
|
+
...input._VkfInputCtx.props,
|
|
15
|
+
type: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "textarea"
|
|
18
|
+
},
|
|
19
|
+
rows: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 4
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "\u56DE\u586B\u5730\u5740"
|
|
26
|
+
},
|
|
27
|
+
placeholder: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "\u4E0A\u4F20\u6587\u4EF6\u540E, \u5C06\u6587\u4EF6\u4E0B\u8F7D\u5730\u5740\u7C98\u8D34\u5230\u6B64\u5904"
|
|
30
|
+
},
|
|
31
|
+
readonly: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated 请使用 referenceUrl
|
|
37
|
+
*/
|
|
38
|
+
uploadUrl: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "https://pan.baidu.com/disk/main#/index?category=all"
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* 参考地址
|
|
44
|
+
*/
|
|
45
|
+
referenceUrl: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "https://pan.baidu.com/disk/main#/index?category=all"
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* 仅展示参考地址
|
|
51
|
+
*/
|
|
52
|
+
referenceOnly: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description 参考地址的 label
|
|
58
|
+
*/
|
|
59
|
+
referenceLabel: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "\u53C2\u8003\u5730\u5740"
|
|
62
|
+
},
|
|
63
|
+
modelValue: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: ""
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const emits = {
|
|
69
|
+
...input._VkfInputCtx.emits
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _sfc_main = vue.defineComponent({
|
|
73
|
+
name: "VkfInputLink",
|
|
74
|
+
components: {
|
|
75
|
+
VkfInput: input.VkfInput
|
|
76
|
+
},
|
|
77
|
+
emits,
|
|
78
|
+
props,
|
|
79
|
+
setup(props2, { emit }) {
|
|
80
|
+
const coreProps = input._VkfInputCtx.createBindProps(props2);
|
|
81
|
+
const coreEmits = input._VkfInputCtx.createOnEmits(emit);
|
|
82
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
83
|
+
const createAppendEl = (url) => () => vue.h(
|
|
84
|
+
elementPlus.ElButton,
|
|
85
|
+
{
|
|
86
|
+
onClick: () => window.open(url),
|
|
87
|
+
disabled: !url
|
|
88
|
+
},
|
|
89
|
+
() => vue.h(
|
|
90
|
+
elementPlus.ElIcon,
|
|
91
|
+
{
|
|
92
|
+
class: "vkf-input-link-icon",
|
|
93
|
+
size: 16
|
|
94
|
+
},
|
|
95
|
+
() => vue.h(index.right_default)
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
const rules = vue.computed(() => {
|
|
99
|
+
const data = [
|
|
100
|
+
{
|
|
101
|
+
pattern: /^(http|https):\/\/([\w.]+\/?)\S*$/,
|
|
102
|
+
message: "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u94FE\u63A5\u5730\u5740"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
if (Array.isArray(props2.rules)) {
|
|
106
|
+
data.push(...props2.rules);
|
|
107
|
+
}
|
|
108
|
+
if (utilsObject.isPlainObject(props2.rules)) {
|
|
109
|
+
data.push(props2.rules);
|
|
110
|
+
}
|
|
111
|
+
return data;
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
coreProps,
|
|
115
|
+
coreEmits,
|
|
116
|
+
createAppendEl,
|
|
117
|
+
rules,
|
|
118
|
+
readonly
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const _hoisted_1 = { class: "vkf-form-item vkf-input-link" };
|
|
124
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
125
|
+
const _component_VkfInput = vue.resolveComponent("VkfInput");
|
|
126
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
127
|
+
vue.createVNode(_component_VkfInput, {
|
|
128
|
+
label: _ctx.referenceLabel,
|
|
129
|
+
disabled: true,
|
|
130
|
+
modelValue: _ctx.referenceUrl ?? _ctx.uploadUrl,
|
|
131
|
+
inputSlots: {
|
|
132
|
+
append: _ctx.createAppendEl(_ctx.referenceUrl ?? _ctx.uploadUrl)
|
|
133
|
+
}
|
|
134
|
+
}, null, 8, ["label", "modelValue", "inputSlots"]),
|
|
135
|
+
!_ctx.referenceOnly ? (vue.openBlock(), vue.createBlock(_component_VkfInput, vue.mergeProps({ key: 0 }, _ctx.coreProps, vue.toHandlers(_ctx.coreEmits), {
|
|
136
|
+
rules: _ctx.rules,
|
|
137
|
+
readonly: _ctx.readonly,
|
|
138
|
+
type: _ctx.readonly ? "text" : _ctx.type,
|
|
139
|
+
inputSlots: {
|
|
140
|
+
append: _ctx.readonly ? _ctx.createAppendEl(_ctx.modelValue) : void 0
|
|
141
|
+
}
|
|
142
|
+
}), null, 16, ["rules", "readonly", "type", "inputSlots"])) : vue.createCommentVNode("v-if", true)
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
var VkfInputLink = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-link/src/index.vue"]]);
|
|
146
|
+
|
|
147
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
148
|
+
__proto__: null
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
VkfInputLink.install = (app) => {
|
|
152
|
+
app.component(VkfInputLink.name, VkfInputLink);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
exports.VkfInputLink = VkfInputLink;
|
|
156
|
+
exports.__VkfInputLink = types;
|
|
157
|
+
exports.default = VkfInputLink;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var formItem = require('@vunk/form/components/form-item');
|
|
6
|
+
var utilsVue = require('@vunk/core/shared/utils-vue');
|
|
7
|
+
var elementPlus = require('element-plus');
|
|
8
|
+
var vue = require('vue');
|
|
9
|
+
var elementPlus$1 = require('@vunk/form/shared/element-plus');
|
|
10
|
+
var composables = require('@vunk/form/composables');
|
|
11
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
12
|
+
|
|
13
|
+
const props = {
|
|
14
|
+
...formItem._VkfFormItemCtx.props,
|
|
15
|
+
...elementPlus.inputNumberProps,
|
|
16
|
+
readonly: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
unit: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
utilsVue.bindPropsFactory(props);
|
|
26
|
+
const emits = {
|
|
27
|
+
...elementPlus.inputNumberEmits
|
|
28
|
+
};
|
|
29
|
+
utilsVue.onEmitsFactory(emits);
|
|
30
|
+
|
|
31
|
+
var _sfc_main = vue.defineComponent({
|
|
32
|
+
name: "VkfInputNumber",
|
|
33
|
+
components: {
|
|
34
|
+
VkfFormItem: formItem.VkfFormItem,
|
|
35
|
+
ElInputNumber: elementPlus.ElInputNumber
|
|
36
|
+
},
|
|
37
|
+
emits,
|
|
38
|
+
props,
|
|
39
|
+
setup(props2, { emit }) {
|
|
40
|
+
const iBindProps = elementPlus$1.createInputNumberBindProps(props2, ["disabled", "readonly", "label"]);
|
|
41
|
+
const iOnEmits = elementPlus$1.createInputNumberOnEmits(emit);
|
|
42
|
+
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
43
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
44
|
+
return {
|
|
45
|
+
formItemBindProps,
|
|
46
|
+
iBindProps,
|
|
47
|
+
iOnEmits,
|
|
48
|
+
readonly
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const _hoisted_1 = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "vkf-input-number-unit"
|
|
56
|
+
};
|
|
57
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
58
|
+
const _component_ElInputNumber = vue.resolveComponent("ElInputNumber");
|
|
59
|
+
const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
|
|
60
|
+
return vue.openBlock(), vue.createBlock(
|
|
61
|
+
_component_VkfFormItem,
|
|
62
|
+
vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
|
|
63
|
+
{
|
|
64
|
+
default: vue.withCtx(() => [
|
|
65
|
+
vue.createVNode(_component_ElInputNumber, vue.mergeProps({
|
|
66
|
+
class: {
|
|
67
|
+
"is-readonly": _ctx.readonly
|
|
68
|
+
}
|
|
69
|
+
}, _ctx.iBindProps, vue.toHandlers(_ctx.iOnEmits), {
|
|
70
|
+
readonly: _ctx.readonly,
|
|
71
|
+
disabled: _ctx.readonly || _ctx.disabled
|
|
72
|
+
}), null, 16, ["class", "readonly", "disabled"]),
|
|
73
|
+
_ctx.unit ? (vue.openBlock(), vue.createElementBlock(
|
|
74
|
+
"span",
|
|
75
|
+
_hoisted_1,
|
|
76
|
+
vue.toDisplayString(_ctx.unit),
|
|
77
|
+
1
|
|
78
|
+
/* TEXT */
|
|
79
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
80
|
+
]),
|
|
81
|
+
_: 1
|
|
82
|
+
/* STABLE */
|
|
83
|
+
},
|
|
84
|
+
16
|
|
85
|
+
/* FULL_PROPS */
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
var VkfInputNumber = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-number/src/index.vue"]]);
|
|
89
|
+
|
|
90
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
91
|
+
__proto__: null
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
VkfInputNumber.install = (app) => {
|
|
95
|
+
app.component(VkfInputNumber.name, VkfInputNumber);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.VkfInputNumber = VkfInputNumber;
|
|
99
|
+
exports.__VkfInputNumber = types;
|
|
100
|
+
exports.default = VkfInputNumber;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var formItem = require('@vunk/form/components/form-item');
|
|
6
|
+
var elementPlus = require('element-plus');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
var elementPlus$1 = require('@vunk/form/shared/element-plus');
|
|
9
|
+
var utilsObject = require('@vunk/core/shared/utils-object');
|
|
10
|
+
var composables = require('@vunk/form/composables');
|
|
11
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
12
|
+
|
|
13
|
+
const props = {
|
|
14
|
+
...formItem._VkfFormItemCtx.props,
|
|
15
|
+
...elementPlus.radioGroupProps,
|
|
16
|
+
options: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => []
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "default"
|
|
23
|
+
},
|
|
24
|
+
modelValue: {
|
|
25
|
+
type: [String, Number]
|
|
26
|
+
},
|
|
27
|
+
defaultModelValue: null
|
|
28
|
+
};
|
|
29
|
+
const emits = {
|
|
30
|
+
...elementPlus.radioGroupEmits
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var _sfc_main = vue.defineComponent({
|
|
34
|
+
name: "VkfRadio",
|
|
35
|
+
components: {
|
|
36
|
+
VkfFormItem: formItem.VkfFormItem,
|
|
37
|
+
ElRadio: elementPlus.ElRadio,
|
|
38
|
+
ElRadioGroup: elementPlus.ElRadioGroup,
|
|
39
|
+
ElRadioButton: elementPlus.ElRadioButton
|
|
40
|
+
},
|
|
41
|
+
emits,
|
|
42
|
+
props,
|
|
43
|
+
setup(props2, { emit }) {
|
|
44
|
+
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
45
|
+
const coreBindProps = elementPlus$1.createRadioGroupBindProps(props2, ["disabled", "label"]);
|
|
46
|
+
const coreOnEmits = elementPlus$1.createRadioGroupOnEmits(emit);
|
|
47
|
+
const options = vue.computed(() => {
|
|
48
|
+
return props2.options.filter((item) => item.value !== void 0 && item.value !== null);
|
|
49
|
+
});
|
|
50
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
51
|
+
!props2.modelValue && props2.defaultModelValue && emit("update:modelValue", props2.defaultModelValue);
|
|
52
|
+
const pickRadioProps = (item) => {
|
|
53
|
+
const obj = utilsObject.pickObject(item, {
|
|
54
|
+
excludes: ["label", "value"]
|
|
55
|
+
});
|
|
56
|
+
if (elementPlus$1.isGte2_6_0) {
|
|
57
|
+
obj.value = item.value;
|
|
58
|
+
} else {
|
|
59
|
+
obj.label = item.value;
|
|
60
|
+
}
|
|
61
|
+
return obj;
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
formItemBindProps,
|
|
65
|
+
coreBindProps,
|
|
66
|
+
coreOnEmits,
|
|
67
|
+
options,
|
|
68
|
+
readonly,
|
|
69
|
+
pickRadioProps
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
75
|
+
const _component_ElRadioGroup = vue.resolveComponent("ElRadioGroup");
|
|
76
|
+
const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
|
|
77
|
+
return vue.openBlock(), vue.createBlock(
|
|
78
|
+
_component_VkfFormItem,
|
|
79
|
+
vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
|
|
80
|
+
{
|
|
81
|
+
default: vue.withCtx(() => [
|
|
82
|
+
vue.createVNode(_component_ElRadioGroup, vue.mergeProps({
|
|
83
|
+
class: {
|
|
84
|
+
"is-readonly": _ctx.readonly
|
|
85
|
+
}
|
|
86
|
+
}, _ctx.coreBindProps, vue.toHandlers(_ctx.coreOnEmits), {
|
|
87
|
+
disabled: _ctx.readonly || _ctx.disabled
|
|
88
|
+
}), {
|
|
89
|
+
default: vue.withCtx(() => [
|
|
90
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
91
|
+
vue.Fragment,
|
|
92
|
+
null,
|
|
93
|
+
vue.renderList(_ctx.options, (item) => {
|
|
94
|
+
return vue.openBlock(), vue.createBlock(
|
|
95
|
+
vue.resolveDynamicComponent(_ctx.type === "button" ? "ElRadioButton" : "ElRadio"),
|
|
96
|
+
vue.mergeProps({
|
|
97
|
+
key: item.value,
|
|
98
|
+
ref_for: true
|
|
99
|
+
}, _ctx.pickRadioProps(item)),
|
|
100
|
+
{
|
|
101
|
+
default: vue.withCtx(() => [
|
|
102
|
+
vue.createTextVNode(
|
|
103
|
+
vue.toDisplayString(item.label ?? item.value),
|
|
104
|
+
1
|
|
105
|
+
/* TEXT */
|
|
106
|
+
)
|
|
107
|
+
]),
|
|
108
|
+
_: 2
|
|
109
|
+
/* DYNAMIC */
|
|
110
|
+
},
|
|
111
|
+
1040
|
|
112
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
113
|
+
);
|
|
114
|
+
}),
|
|
115
|
+
128
|
|
116
|
+
/* KEYED_FRAGMENT */
|
|
117
|
+
))
|
|
118
|
+
]),
|
|
119
|
+
_: 1
|
|
120
|
+
/* STABLE */
|
|
121
|
+
}, 16, ["class", "disabled"])
|
|
122
|
+
]),
|
|
123
|
+
_: 1
|
|
124
|
+
/* STABLE */
|
|
125
|
+
},
|
|
126
|
+
16
|
|
127
|
+
/* FULL_PROPS */
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
var VkfRadio = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/radio/src/index.vue"]]);
|
|
131
|
+
|
|
132
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
133
|
+
__proto__: null
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
VkfRadio.install = (app) => {
|
|
137
|
+
app.component(VkfRadio.name, VkfRadio);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.VkfRadio = VkfRadio;
|
|
141
|
+
exports.__VkfRadio = types;
|
|
142
|
+
exports.default = VkfRadio;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var formItem = require('@vunk/form/components/form-item');
|
|
6
|
+
var elementPlus = require('@vunk/form/shared/element-plus');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
var elementPlus$1 = require('element-plus');
|
|
9
|
+
var utilsObject = require('@vunk/core/shared/utils-object');
|
|
10
|
+
var composables = require('@vunk/form/composables');
|
|
11
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
12
|
+
|
|
13
|
+
const props = {
|
|
14
|
+
...formItem._VkfFormItemCtx.props,
|
|
15
|
+
...elementPlus.selectProps,
|
|
16
|
+
options: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => []
|
|
19
|
+
},
|
|
20
|
+
selectSlots: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
optionsUrl: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
defaultModelValue: null
|
|
29
|
+
};
|
|
30
|
+
const emits = {
|
|
31
|
+
...elementPlus.selectEmits
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var _sfc_main = vue.defineComponent({
|
|
35
|
+
name: "VkfSelect",
|
|
36
|
+
components: {
|
|
37
|
+
VkfFormItem: formItem.VkfFormItem,
|
|
38
|
+
ElSelect: elementPlus$1.ElSelect,
|
|
39
|
+
ElOption: elementPlus$1.ElOption
|
|
40
|
+
},
|
|
41
|
+
props,
|
|
42
|
+
emits,
|
|
43
|
+
setup(props2, { emit }) {
|
|
44
|
+
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
45
|
+
const selectBindProps = elementPlus.createSelectBindProps(props2, ["disabled", "modelValue"]);
|
|
46
|
+
const selectOnEmits = elementPlus.createSelectOnEmits(emit);
|
|
47
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
48
|
+
const optionsFromUrl = vue.ref([]);
|
|
49
|
+
const rUrlOptions = (url) => {
|
|
50
|
+
if (url) {
|
|
51
|
+
fetch(url).then((res) => res.json()).then((data) => {
|
|
52
|
+
optionsFromUrl.value = data;
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
optionsFromUrl.value = [];
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (props2.optionsUrl) {
|
|
59
|
+
rUrlOptions(props2.optionsUrl);
|
|
60
|
+
}
|
|
61
|
+
vue.watch(() => props2.optionsUrl, (url) => {
|
|
62
|
+
emit("update:modelValue", void 0);
|
|
63
|
+
rUrlOptions(url);
|
|
64
|
+
});
|
|
65
|
+
const getKey = (item) => utilsObject.isPlainObject(item.value) ? item.value[selectBindProps.value.valueKey] : item.value;
|
|
66
|
+
const selectOptions = vue.computed(() => {
|
|
67
|
+
const options = optionsFromUrl.value.length ? optionsFromUrl.value : props2.options;
|
|
68
|
+
return options.reduce((a, c) => {
|
|
69
|
+
const k = getKey(c);
|
|
70
|
+
if (!k && k !== 0 && k !== false) return a;
|
|
71
|
+
a.push({
|
|
72
|
+
...c,
|
|
73
|
+
key: k
|
|
74
|
+
});
|
|
75
|
+
return a;
|
|
76
|
+
}, []);
|
|
77
|
+
});
|
|
78
|
+
const reshow = vue.ref(true);
|
|
79
|
+
vue.watch(() => selectBindProps.value.multiple, () => {
|
|
80
|
+
emit("update:modelValue", void 0);
|
|
81
|
+
reshow.value = false;
|
|
82
|
+
vue.nextTick(() => {
|
|
83
|
+
reshow.value = true;
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
formItemBindProps,
|
|
88
|
+
selectBindProps,
|
|
89
|
+
selectOnEmits,
|
|
90
|
+
selectOptions,
|
|
91
|
+
reshow,
|
|
92
|
+
readonly
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
98
|
+
const _component_ElOption = vue.resolveComponent("ElOption");
|
|
99
|
+
const _component_ElSelect = vue.resolveComponent("ElSelect");
|
|
100
|
+
const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
|
|
101
|
+
return vue.openBlock(), vue.createBlock(
|
|
102
|
+
_component_VkfFormItem,
|
|
103
|
+
vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
|
|
104
|
+
{
|
|
105
|
+
default: vue.withCtx(() => [
|
|
106
|
+
_ctx.reshow ? (vue.openBlock(), vue.createBlock(_component_ElSelect, vue.mergeProps({ key: 0 }, _ctx.selectBindProps, {
|
|
107
|
+
"model-value": _ctx.defaultModelValue ?? _ctx.modelValue,
|
|
108
|
+
disabled: _ctx.readonly || _ctx.disabled,
|
|
109
|
+
class: {
|
|
110
|
+
"is-readonly": _ctx.readonly
|
|
111
|
+
}
|
|
112
|
+
}, vue.toHandlers(_ctx.selectOnEmits)), vue.createSlots({
|
|
113
|
+
default: vue.withCtx(() => [
|
|
114
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
115
|
+
vue.Fragment,
|
|
116
|
+
null,
|
|
117
|
+
vue.renderList(_ctx.selectOptions, (item) => {
|
|
118
|
+
return vue.openBlock(), vue.createBlock(
|
|
119
|
+
_component_ElOption,
|
|
120
|
+
vue.mergeProps({ ref_for: true }, item, {
|
|
121
|
+
key: item.key
|
|
122
|
+
}),
|
|
123
|
+
null,
|
|
124
|
+
16
|
|
125
|
+
/* FULL_PROPS */
|
|
126
|
+
);
|
|
127
|
+
}),
|
|
128
|
+
128
|
|
129
|
+
/* KEYED_FRAGMENT */
|
|
130
|
+
))
|
|
131
|
+
]),
|
|
132
|
+
_: 2
|
|
133
|
+
/* DYNAMIC */
|
|
134
|
+
}, [
|
|
135
|
+
vue.renderList(_ctx.selectSlots, (item, key) => {
|
|
136
|
+
return {
|
|
137
|
+
name: key,
|
|
138
|
+
fn: vue.withCtx((e) => [
|
|
139
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item?.(e))))
|
|
140
|
+
])
|
|
141
|
+
};
|
|
142
|
+
})
|
|
143
|
+
]), 1040, ["model-value", "disabled", "class"])) : vue.createCommentVNode("v-if", true),
|
|
144
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
145
|
+
]),
|
|
146
|
+
_: 3
|
|
147
|
+
/* FORWARDED */
|
|
148
|
+
},
|
|
149
|
+
16
|
|
150
|
+
/* FULL_PROPS */
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
var VkfSelect = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/select/src/index.vue"]]);
|
|
154
|
+
|
|
155
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
156
|
+
__proto__: null
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
VkfSelect.install = (app) => {
|
|
160
|
+
app.component(VkfSelect.name, VkfSelect);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
exports.VkfSelect = VkfSelect;
|
|
164
|
+
exports.__VkfSelect = types;
|
|
165
|
+
exports.default = VkfSelect;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var formItem = require('@vunk/form/components/form-item');
|
|
6
|
+
var elementPlus = require('element-plus');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
var composables = require('@vunk/form/composables');
|
|
9
|
+
var elementPlus$1 = require('@vunk/form/shared/element-plus');
|
|
10
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
11
|
+
|
|
12
|
+
const props = {
|
|
13
|
+
...formItem._VkfFormItemCtx.props,
|
|
14
|
+
...elementPlus.sliderProps,
|
|
15
|
+
modelValue: null,
|
|
16
|
+
defaultModelValue: null
|
|
17
|
+
};
|
|
18
|
+
const emits = {
|
|
19
|
+
...elementPlus.sliderEmits
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var _sfc_main = vue.defineComponent({
|
|
23
|
+
name: "VkfSlider",
|
|
24
|
+
components: {
|
|
25
|
+
ElSlider: elementPlus.ElSlider,
|
|
26
|
+
VkfFormItem: formItem.VkfFormItem
|
|
27
|
+
},
|
|
28
|
+
emits,
|
|
29
|
+
props,
|
|
30
|
+
setup(props2, { emit }) {
|
|
31
|
+
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
32
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
33
|
+
const coreProps = elementPlus$1.createSliderBindProps(props2, [
|
|
34
|
+
"modelValue",
|
|
35
|
+
"disabled"
|
|
36
|
+
]);
|
|
37
|
+
const coreEmits = elementPlus$1.createSliderOnEmits(emit);
|
|
38
|
+
return {
|
|
39
|
+
readonly,
|
|
40
|
+
formItemBindProps,
|
|
41
|
+
coreProps,
|
|
42
|
+
coreEmits
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
48
|
+
const _component_ElSlider = vue.resolveComponent("ElSlider");
|
|
49
|
+
const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
|
|
50
|
+
return vue.openBlock(), vue.createBlock(
|
|
51
|
+
_component_VkfFormItem,
|
|
52
|
+
vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
|
|
53
|
+
{
|
|
54
|
+
default: vue.withCtx(() => [
|
|
55
|
+
vue.createVNode(_component_ElSlider, vue.mergeProps({
|
|
56
|
+
class: {
|
|
57
|
+
"is-readonly": _ctx.readonly
|
|
58
|
+
}
|
|
59
|
+
}, _ctx.coreProps, vue.toHandlers(_ctx.coreEmits), {
|
|
60
|
+
"model-value": _ctx.modelValue ?? _ctx.defaultModelValue,
|
|
61
|
+
disabled: _ctx.readonly || _ctx.disabled
|
|
62
|
+
}), {
|
|
63
|
+
default: vue.withCtx(() => [
|
|
64
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
65
|
+
]),
|
|
66
|
+
_: 3
|
|
67
|
+
/* FORWARDED */
|
|
68
|
+
}, 16, ["class", "model-value", "disabled"])
|
|
69
|
+
]),
|
|
70
|
+
_: 3
|
|
71
|
+
/* FORWARDED */
|
|
72
|
+
},
|
|
73
|
+
16
|
|
74
|
+
/* FULL_PROPS */
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
var VkfSlider = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/slider/src/index.vue"]]);
|
|
78
|
+
|
|
79
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
80
|
+
__proto__: null
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
VkfSlider.install = (app) => {
|
|
84
|
+
app.component(VkfSlider.name, VkfSlider);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.VkfSlider = VkfSlider;
|
|
88
|
+
exports.__VkfSlider = types;
|
|
89
|
+
exports.default = VkfSlider;
|