@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.
Files changed (52) hide show
  1. package/components/_plugin-vue_export-helper.cjs +11 -0
  2. package/components/button/index.cjs +112 -0
  3. package/components/cascader/index.cjs +130 -0
  4. package/components/checkbox/index.cjs +153 -0
  5. package/components/color-picker/index.cjs +80 -0
  6. package/components/date-picker/index.cjs +120 -0
  7. package/components/date-picker-range/index.cjs +170 -0
  8. package/components/download-plus/index.cjs +445 -0
  9. package/components/esri-input-geojson/index.cjs +1120 -0
  10. package/components/form/index.cjs +220 -0
  11. package/components/form-item/index.cjs +162 -0
  12. package/components/form-item-renderer/index.cjs +103 -0
  13. package/components/form-item-renderer-template/index.cjs +47 -0
  14. package/components/geoinput/index.cjs +95 -0
  15. package/components/geoinput-read/index.cjs +304 -0
  16. package/components/geoinput-update/index.cjs +406 -0
  17. package/components/index.cjs +13 -0
  18. package/components/index2.cjs +323 -0
  19. package/components/index3.cjs +486 -0
  20. package/components/input/index.cjs +119 -0
  21. package/components/input-link/index.cjs +157 -0
  22. package/components/input-number/index.cjs +100 -0
  23. package/components/radio/index.cjs +142 -0
  24. package/components/select/index.cjs +165 -0
  25. package/components/slider/index.cjs +89 -0
  26. package/components/switch/index.cjs +92 -0
  27. package/components/templates-default/index.cjs +308 -0
  28. package/components/templates-element-plus/index.cjs +112 -0
  29. package/components/templates-esri/index.cjs +65 -0
  30. package/components/templates-layout/index.cjs +137 -0
  31. package/components/templates-mapbox/index.cjs +65 -0
  32. package/components/templates-variant/index.cjs +70 -0
  33. package/components/upload/index.cjs +508 -0
  34. package/components/upload-plus/index.cjs +18658 -0
  35. package/components/van-cascader/index.cjs +128 -0
  36. package/components/var-datetime-picker/index.cjs +330 -0
  37. package/components/vditor/index.cjs +451 -0
  38. package/composables/index.cjs +89 -0
  39. package/package.json +97 -49
  40. package/shared/const/index.cjs +59 -0
  41. package/shared/element-plus/index.cjs +317 -0
  42. package/shared/form/index.cjs +33 -0
  43. package/shared/helper/index.cjs +11 -0
  44. package/shared/index.cjs +8 -0
  45. package/shared/infer-prop/index.cjs +36 -0
  46. package/shared/progress-it/index.cjs +40 -0
  47. package/shared/rules/index.cjs +56 -0
  48. package/shared/types/form/index.cjs +2 -0
  49. package/shared/types/index.cjs +2 -0
  50. package/shared/types/source/index.cjs +2 -0
  51. package/shared/types/source-manager/index.cjs +2 -0
  52. package/shared/upload/index.cjs +774 -0
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cascader = require('@vunk/form/components/cascader');
6
+ var vue = require('vue');
7
+ var formItem = require('@vunk/form/components/form-item');
8
+ var vant = require('vant');
9
+ var elementPlus = require('element-plus');
10
+ require('vant/es/cascader/style');
11
+ require('vant/es/popup/style');
12
+ var composables = require('@vunk/form/composables');
13
+ var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
14
+
15
+ const props = {
16
+ ...cascader._VkfCascaderCtx.props
17
+ };
18
+ const emits = {
19
+ ...cascader._VkfCascaderCtx.emits
20
+ };
21
+
22
+ var _sfc_main = vue.defineComponent({
23
+ name: "VkfVanCascader",
24
+ components: {
25
+ VkfFormItem: formItem.VkfFormItem,
26
+ Cascader: vant.Cascader,
27
+ Popup: vant.Popup,
28
+ ElSelect: elementPlus.ElSelect
29
+ },
30
+ emits,
31
+ props,
32
+ setup(props2, { emit }) {
33
+ const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
34
+ const popupShow = vue.ref(false);
35
+ const fieldValue = vue.ref("");
36
+ const cascaderValue = vue.ref("");
37
+ const options = cascader._VkfCascaderUse.useOptions(props2, emit);
38
+ const readonly = composables.useComputedReadonly(props2);
39
+ vue.watch(() => props2.modelValue, (val) => {
40
+ if (Array.isArray(val) && val.length) {
41
+ fieldValue.value = val.join("/");
42
+ const last = val.at(-1);
43
+ if (typeof last === "string" || typeof last === "number") {
44
+ cascaderValue.value = last + "";
45
+ }
46
+ }
47
+ }, {
48
+ deep: true
49
+ });
50
+ const handleFinish = ({ selectedOptions }) => {
51
+ popupShow.value = false;
52
+ emit("update:modelValue", selectedOptions.map((item) => item.value));
53
+ };
54
+ const preInput = () => {
55
+ if (readonly.value) return;
56
+ popupShow.value = true;
57
+ };
58
+ return {
59
+ formItemBindProps,
60
+ fieldValue,
61
+ popupShow,
62
+ handleFinish,
63
+ cascaderValue,
64
+ options,
65
+ preInput
66
+ };
67
+ }
68
+ });
69
+
70
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
71
+ const _component_ElSelect = vue.resolveComponent("ElSelect");
72
+ const _component_Cascader = vue.resolveComponent("Cascader");
73
+ const _component_Popup = vue.resolveComponent("Popup");
74
+ const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
75
+ return vue.openBlock(), vue.createBlock(
76
+ _component_VkfFormItem,
77
+ vue.mergeProps({ class: "vkf-van-cascader" }, _ctx.formItemBindProps),
78
+ {
79
+ default: vue.withCtx(() => [
80
+ vue.createVNode(_component_ElSelect, {
81
+ "popper-class": "vkf-van-cascader-input",
82
+ "model-value": _ctx.fieldValue,
83
+ onClick: _ctx.preInput
84
+ }, null, 8, ["model-value", "onClick"]),
85
+ vue.createVNode(_component_Popup, {
86
+ show: _ctx.popupShow,
87
+ "onUpdate:show": _cache[2] || (_cache[2] = ($event) => _ctx.popupShow = $event),
88
+ round: "",
89
+ position: "bottom"
90
+ }, {
91
+ default: vue.withCtx(() => [
92
+ vue.createVNode(_component_Cascader, {
93
+ modelValue: _ctx.cascaderValue,
94
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.cascaderValue = $event),
95
+ onClose: _cache[1] || (_cache[1] = ($event) => _ctx.popupShow = false),
96
+ options: _ctx.options,
97
+ "field-names": {
98
+ text: "label",
99
+ value: "value",
100
+ children: "children"
101
+ },
102
+ onFinish: _ctx.handleFinish
103
+ }, null, 8, ["modelValue", "options", "onFinish"])
104
+ ]),
105
+ _: 1
106
+ /* STABLE */
107
+ }, 8, ["show"])
108
+ ]),
109
+ _: 1
110
+ /* STABLE */
111
+ },
112
+ 16
113
+ /* FULL_PROPS */
114
+ );
115
+ }
116
+ var VkfVanCascader = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/van-cascader/src/index.vue"]]);
117
+
118
+ var types = /*#__PURE__*/Object.freeze({
119
+ __proto__: null
120
+ });
121
+
122
+ VkfVanCascader.install = (app) => {
123
+ app.component(VkfVanCascader.name, VkfVanCascader);
124
+ };
125
+
126
+ exports.VkfVanCascader = VkfVanCascader;
127
+ exports.__VkfVanCascader = types;
128
+ exports.default = VkfVanCascader;
@@ -0,0 +1,330 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var formItem = require('@vunk/form/components/form-item');
6
+ var vue = require('vue');
7
+ var composables = require('@vunk/form/composables');
8
+ var vant = require('vant');
9
+ var ui = require('@varlet/ui');
10
+ var elementPlus = require('element-plus');
11
+ require('vant/es/popup/style');
12
+ require('@varlet/ui/es/date-picker/style');
13
+ require('@varlet/ui/es/time-picker/style');
14
+ var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
15
+
16
+ const props = {
17
+ ...formItem._VkfFormItemCtx.props,
18
+ modelValue: null,
19
+ readonly: Boolean,
20
+ type: {
21
+ type: String,
22
+ default: "month"
23
+ },
24
+ // allowed-dates
25
+ allowedDates: {
26
+ type: Function,
27
+ default: void 0
28
+ },
29
+ useSeconds: Boolean,
30
+ valueFormat: {
31
+ type: String,
32
+ default: "YYYY-MM-DD HH:mm"
33
+ }
34
+ };
35
+ const emits = {
36
+ "update:modelValue": null
37
+ };
38
+
39
+ const VarDatePickerTypeOptions = [
40
+ {
41
+ label: "\u65E5\u671F",
42
+ value: "date" /* date */,
43
+ format: "YYYY-MM-DD"
44
+ },
45
+ {
46
+ label: "\u5E74",
47
+ value: "year" /* year */,
48
+ format: "YYYY"
49
+ },
50
+ {
51
+ label: "\u6708",
52
+ value: "month" /* month */,
53
+ format: "YYYY-MM"
54
+ }
55
+ ];
56
+ const VarDatePickerTypeReflect = VarDatePickerTypeOptions.reduce((acc, cur) => {
57
+ acc[cur.value] = cur;
58
+ return acc;
59
+ }, {});
60
+ const ElDatePickerTypeOptions = [
61
+ {
62
+ label: "\u65E5\u671F",
63
+ value: "date",
64
+ varDatePickerType: "date" /* date */,
65
+ isRange: false
66
+ },
67
+ {
68
+ label: "\u5E74",
69
+ value: "year",
70
+ varDatePickerType: "year" /* year */,
71
+ isRange: false
72
+ },
73
+ {
74
+ label: "\u6708",
75
+ value: "month",
76
+ varDatePickerType: "month" /* month */,
77
+ isRange: false
78
+ },
79
+ {
80
+ value: "dates",
81
+ label: "\u591A\u9009\u65E5\u671F",
82
+ varDatePickerType: "date" /* date */,
83
+ isRange: false
84
+ },
85
+ {
86
+ value: "week",
87
+ label: "\u5468",
88
+ varDatePickerType: "date" /* date */,
89
+ isRange: false
90
+ },
91
+ {
92
+ value: "datetime",
93
+ label: "\u65E5\u671F\u65F6\u95F4",
94
+ varDatePickerType: "date" /* date */,
95
+ isRange: false,
96
+ hasTime: true
97
+ },
98
+ {
99
+ value: "datetimerange",
100
+ label: "\u65E5\u671F\u65F6\u95F4\u8303\u56F4",
101
+ varDatePickerType: "date" /* date */,
102
+ /**
103
+ * 采用独立的时间选择器
104
+ */
105
+ isRange: false,
106
+ hasTime: true
107
+ },
108
+ {
109
+ value: "daterange",
110
+ label: "\u65E5\u671F\u8303\u56F4",
111
+ varDatePickerType: "date" /* date */,
112
+ isRange: true
113
+ },
114
+ {
115
+ value: "monthrange",
116
+ label: "\u6708\u8303\u56F4",
117
+ varDatePickerType: "month" /* month */,
118
+ isRange: true
119
+ }
120
+ ];
121
+ const ElDatePickerTypeReflect = ElDatePickerTypeOptions.reduce((acc, cur) => {
122
+ acc[cur.value] = cur;
123
+ return acc;
124
+ }, {});
125
+
126
+ var _sfc_main = vue.defineComponent({
127
+ name: "VkfVarDatetimePicker",
128
+ components: {
129
+ VkfFormItem: formItem.VkfFormItem,
130
+ ElDatePicker: elementPlus.ElDatePicker,
131
+ DatePicker: ui.DatePicker,
132
+ TimePicker: ui.TimePicker,
133
+ Popup: vant.Popup,
134
+ ElTabPane: elementPlus.ElTabPane,
135
+ ElTabs: elementPlus.ElTabs
136
+ },
137
+ emits,
138
+ props,
139
+ setup(props2, { emit }) {
140
+ const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
141
+ const varDatePickerType = vue.computed(() => {
142
+ return ElDatePickerTypeReflect[props2.type].varDatePickerType;
143
+ });
144
+ const varDatePickerFormat = vue.computed(() => {
145
+ return VarDatePickerTypeReflect[varDatePickerType.value].format;
146
+ });
147
+ const isRange = vue.computed(() => {
148
+ return !!ElDatePickerTypeReflect[props2.type].isRange;
149
+ });
150
+ const hasTime = vue.computed(() => {
151
+ return !!ElDatePickerTypeReflect[props2.type].hasTime;
152
+ });
153
+ const getDateFromModelValue = () => {
154
+ return props2.modelValue ? elementPlus.dayjs(props2.modelValue).format(varDatePickerFormat.value) : "";
155
+ };
156
+ const getTimeFromModelValue = () => {
157
+ return props2.modelValue ? elementPlus.dayjs(props2.modelValue).format(props2.useSeconds ? "HH:mm:ss" : "HH:mm") : "";
158
+ };
159
+ const tansformModelValueByDateValue = (dateValue) => {
160
+ if (!dateValue) return "";
161
+ const date = elementPlus.dayjs(dateValue, varDatePickerFormat.value);
162
+ if (!props2.modelValue) {
163
+ return date.format(props2.valueFormat);
164
+ }
165
+ return elementPlus.dayjs(props2.modelValue).year(date.year()).month(date.month()).date(date.date()).format(props2.valueFormat);
166
+ };
167
+ const tansformModelValueByTimeValue = (timeValue) => {
168
+ if (!timeValue) return "";
169
+ const time = elementPlus.dayjs(
170
+ timeValue,
171
+ props2.useSeconds ? "HH:mm:ss" : "HH:mm"
172
+ );
173
+ if (!props2.modelValue) {
174
+ return time.format(props2.valueFormat);
175
+ }
176
+ return elementPlus.dayjs(props2.modelValue).hour(time.hour()).minute(time.minute()).second(time.second()).format(props2.valueFormat);
177
+ };
178
+ const valueDate = vue.computed({
179
+ get() {
180
+ return getDateFromModelValue();
181
+ },
182
+ set(val) {
183
+ const nModelValue = tansformModelValueByDateValue(val);
184
+ emit("update:modelValue", nModelValue);
185
+ }
186
+ });
187
+ const valueTime = vue.computed({
188
+ get() {
189
+ return getTimeFromModelValue();
190
+ },
191
+ set(val) {
192
+ const nModelValue = tansformModelValueByTimeValue(val);
193
+ emit("update:modelValue", nModelValue);
194
+ }
195
+ });
196
+ const readonly = composables.useComputedReadonly(props2);
197
+ const popupShow = vue.ref(false);
198
+ const currentTab = vue.ref("date");
199
+ const inputBlur = (e) => {
200
+ const target = e.target;
201
+ target.blur();
202
+ };
203
+ const preInput = () => {
204
+ if (readonly.value) return;
205
+ if (props2.modelValue && hasTime.value) {
206
+ currentTab.value = "time";
207
+ }
208
+ popupShow.value = true;
209
+ };
210
+ return {
211
+ preInput,
212
+ inputBlur,
213
+ popupShow,
214
+ formItemBindProps,
215
+ varDatePickerType,
216
+ isRange,
217
+ hasTime,
218
+ currentTab,
219
+ valueTime,
220
+ valueDate
221
+ };
222
+ }
223
+ });
224
+
225
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
226
+ const _component_ElDatePicker = vue.resolveComponent("ElDatePicker");
227
+ const _component_DatePicker = vue.resolveComponent("DatePicker");
228
+ const _component_ElTabPane = vue.resolveComponent("ElTabPane");
229
+ const _component_TimePicker = vue.resolveComponent("TimePicker");
230
+ const _component_ElTabs = vue.resolveComponent("ElTabs");
231
+ const _component_Popup = vue.resolveComponent("Popup");
232
+ const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
233
+ return vue.openBlock(), vue.createBlock(
234
+ _component_VkfFormItem,
235
+ vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
236
+ {
237
+ default: vue.withCtx(() => [
238
+ vue.createElementVNode(
239
+ "div",
240
+ {
241
+ onClickCapture: _cache[0] || (_cache[0] = (...args) => _ctx.preInput && _ctx.preInput(...args))
242
+ },
243
+ [
244
+ vue.createVNode(_component_ElDatePicker, {
245
+ "popper-class": "var-datetime-picker-el-popover",
246
+ "model-value": _ctx.modelValue,
247
+ onFocus: _ctx.inputBlur,
248
+ type: _ctx.type,
249
+ readonly: true,
250
+ "value-format": _ctx.valueFormat
251
+ }, null, 8, ["model-value", "onFocus", "type", "value-format"])
252
+ ],
253
+ 32
254
+ /* NEED_HYDRATION */
255
+ ),
256
+ vue.createVNode(_component_Popup, {
257
+ position: "bottom",
258
+ show: _ctx.popupShow,
259
+ "onUpdate:show": _cache[4] || (_cache[4] = ($event) => _ctx.popupShow = $event),
260
+ round: ""
261
+ }, {
262
+ default: vue.withCtx(() => [
263
+ vue.createVNode(_component_ElTabs, {
264
+ class: vue.normalizeClass(["var-datetime-picker-el-tabs", {
265
+ "is-hidden": !_ctx.hasTime
266
+ }]),
267
+ modelValue: _ctx.currentTab,
268
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.currentTab = $event)
269
+ }, {
270
+ default: vue.withCtx(() => [
271
+ vue.createVNode(_component_ElTabPane, {
272
+ label: _ctx.valueDate || "\u9009\u62E9\u65E5\u671F",
273
+ name: "date"
274
+ }, {
275
+ default: vue.withCtx(() => [
276
+ vue.createVNode(_component_DatePicker, {
277
+ type: _ctx.varDatePickerType,
278
+ range: _ctx.isRange,
279
+ modelValue: _ctx.valueDate,
280
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.valueDate = $event),
281
+ "allowed-dates": _ctx.allowedDates
282
+ }, null, 8, ["type", "range", "modelValue", "allowed-dates"])
283
+ ]),
284
+ _: 1
285
+ /* STABLE */
286
+ }, 8, ["label"]),
287
+ _ctx.hasTime ? (vue.openBlock(), vue.createBlock(_component_ElTabPane, {
288
+ key: 0,
289
+ label: _ctx.valueTime || "\u9009\u62E9\u65F6\u95F4",
290
+ name: "time"
291
+ }, {
292
+ default: vue.withCtx(() => [
293
+ vue.createVNode(_component_TimePicker, {
294
+ modelValue: _ctx.valueTime,
295
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.valueTime = $event),
296
+ format: "24hr"
297
+ }, null, 8, ["modelValue"])
298
+ ]),
299
+ _: 1
300
+ /* STABLE */
301
+ }, 8, ["label"])) : vue.createCommentVNode("v-if", true)
302
+ ]),
303
+ _: 1
304
+ /* STABLE */
305
+ }, 8, ["class", "modelValue"])
306
+ ]),
307
+ _: 1
308
+ /* STABLE */
309
+ }, 8, ["show"])
310
+ ]),
311
+ _: 1
312
+ /* STABLE */
313
+ },
314
+ 16
315
+ /* FULL_PROPS */
316
+ );
317
+ }
318
+ var VkfVarDatetimePicker = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/var-datetime-picker/src/index.vue"]]);
319
+
320
+ var types = /*#__PURE__*/Object.freeze({
321
+ __proto__: null
322
+ });
323
+
324
+ VkfVarDatetimePicker.install = (app) => {
325
+ app.component(VkfVarDatetimePicker.name, VkfVarDatetimePicker);
326
+ };
327
+
328
+ exports.VkfVarDatetimePicker = VkfVarDatetimePicker;
329
+ exports.__VkfVarDatetimePicker = types;
330
+ exports.default = VkfVarDatetimePicker;