@vunk/form 1.0.1 → 1.1.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.
Files changed (38) hide show
  1. package/components/geoinput/index.d.ts +4 -0
  2. package/components/geoinput/index.js +94 -0
  3. package/components/geoinput/src/ctx.d.ts +218 -0
  4. package/components/geoinput/src/ctx.js +39 -0
  5. package/components/geoinput/src/index.vue.d.ts +608 -0
  6. package/components/geoinput/src/types.d.ts +12 -0
  7. package/components/geoinput/src/types.js +1 -0
  8. package/components/geoinput-read/index.css +9 -0
  9. package/components/geoinput-read/index.d.ts +5 -0
  10. package/components/geoinput-read/index.js +355 -0
  11. package/components/geoinput-read/src/append.vue.d.ts +6 -0
  12. package/components/geoinput-read/src/core.vue.d.ts +457 -0
  13. package/components/geoinput-read/src/ctx.d.ts +205 -0
  14. package/components/geoinput-read/src/ctx.js +62 -0
  15. package/components/geoinput-read/src/index.vue.d.ts +486 -0
  16. package/components/geoinput-read/src/types.d.ts +3 -0
  17. package/components/geoinput-read/src/types.js +1 -0
  18. package/components/geoinput-update/index.css +44 -0
  19. package/components/geoinput-update/index.d.ts +5 -0
  20. package/components/geoinput-update/index.js +982 -0
  21. package/components/geoinput-update/src/append.vue.d.ts +20 -0
  22. package/components/geoinput-update/src/ctx.d.ts +211 -0
  23. package/components/geoinput-update/src/ctx.js +85 -0
  24. package/components/geoinput-update/src/index.vue.d.ts +483 -0
  25. package/components/geoinput-update/src/types.d.ts +6 -0
  26. package/components/geoinput-update/src/types.js +1 -0
  27. package/components/input-link/index.js +1 -1
  28. package/components/templates-mapbox/index.d.ts +4 -0
  29. package/components/templates-mapbox/index.js +64 -0
  30. package/components/templates-mapbox/src/ctx.d.ts +11 -0
  31. package/components/templates-mapbox/src/ctx.js +11 -0
  32. package/components/templates-mapbox/src/index.vue.d.ts +20 -0
  33. package/components/templates-mapbox/src/types.d.ts +3 -0
  34. package/components/templates-mapbox/src/types.js +1 -0
  35. package/index.css +55 -0
  36. package/package.json +1 -1
  37. package/shared/types/form/radio.d.ts +1 -1
  38. package/shared/types/source/index.d.ts +2 -1
@@ -0,0 +1,355 @@
1
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, resolveComponent, createBlock, withCtx, createVNode, computed, Fragment, withDirectives, mergeProps, toHandlers, vShow, renderSlot, createCommentVNode, normalizeProps, guardReactiveProps } from 'vue';
2
+ import { VkWrapper } from '@vunk/core/components/wrapper';
3
+ import { _VkfInputCtx, VkfInput } from '@vunk/form/components/input';
4
+ import { EMPTY_FEATURE_COLLECTION } from '@vumap/core/shared/static';
5
+ import { _VmGeojsonLayerCtx } from '@vumap/core/components/geojson-layer';
6
+ import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
7
+ import { ElButton, ElIcon, ElButtonGroup } from 'element-plus';
8
+ import { VmGeojsonLayer, _VmGeojsonLayerCtx as _VmGeojsonLayerCtx$1, useMap, VmTdtLayers, VmMap } from '@vumap/core';
9
+ import { fitGeojson } from '@vumap/core/shared/utils';
10
+
11
+ var __defProp$1 = Object.defineProperty;
12
+ var __defProps = Object.defineProperties;
13
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
14
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
15
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
16
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
17
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
+ var __spreadValues$1 = (a, b) => {
19
+ for (var prop in b || (b = {}))
20
+ if (__hasOwnProp$1.call(b, prop))
21
+ __defNormalProp$1(a, prop, b[prop]);
22
+ if (__getOwnPropSymbols$1)
23
+ for (var prop of __getOwnPropSymbols$1(b)) {
24
+ if (__propIsEnum$1.call(b, prop))
25
+ __defNormalProp$1(a, prop, b[prop]);
26
+ }
27
+ return a;
28
+ };
29
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
30
+ const props = __spreadProps(__spreadValues$1(__spreadValues$1({}, _VkfInputCtx.props), _VmGeojsonLayerCtx.props), {
31
+ modelValue: {
32
+ type: Object,
33
+ default: () => EMPTY_FEATURE_COLLECTION
34
+ },
35
+ editStyles: {
36
+ type: Array,
37
+ default: () => []
38
+ },
39
+ editTypes: {
40
+ type: [Array, String],
41
+ default: "polygon"
42
+ },
43
+ paint: {
44
+ type: Object,
45
+ default: void 0
46
+ },
47
+ type: {
48
+ type: String,
49
+ default: void 0
50
+ },
51
+ custom: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ showMap: {
56
+ type: Boolean,
57
+ default: false
58
+ }
59
+ });
60
+ const createBindProps = bindPropsFactory(props);
61
+ const emits = __spreadProps(__spreadValues$1(__spreadValues$1({}, _VmGeojsonLayerCtx.emits), _VkfInputCtx.emits), {
62
+ "layerChange": (layer) => layer,
63
+ "update:modelValue": (e) => e
64
+ });
65
+ const createOnEmits = onEmitsFactory(emits);
66
+
67
+ var ctx = /*#__PURE__*/Object.freeze({
68
+ __proto__: null,
69
+ props: props,
70
+ createBindProps: createBindProps,
71
+ emits: emits,
72
+ createOnEmits: createOnEmits
73
+ });
74
+
75
+ /*! Element Plus Icons Vue v2.1.0 */
76
+
77
+ // unplugin-vue:/plugin-vue/export-helper
78
+ var export_helper_default = (sfc, props) => {
79
+ let target = sfc.__vccOpts || sfc;
80
+ for (let [key, val] of props)
81
+ target[key] = val;
82
+ return target;
83
+ };
84
+
85
+ // unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/map-location.vue?vue&type=script&lang.ts
86
+ var map_location_vue_vue_type_script_lang_default = {
87
+ name: "MapLocation"
88
+ };
89
+ var _hoisted_1160 = {
90
+ xmlns: "http://www.w3.org/2000/svg",
91
+ viewBox: "0 0 1024 1024"
92
+ }, _hoisted_2160 = /* @__PURE__ */ createElementVNode(
93
+ "path",
94
+ {
95
+ fill: "currentColor",
96
+ d: "M800 416a288 288 0 1 0-576 0c0 118.144 94.528 272.128 288 456.576C705.472 688.128 800 534.144 800 416zM512 960C277.312 746.688 160 565.312 160 416a352 352 0 0 1 704 0c0 149.312-117.312 330.688-352 544z"
97
+ },
98
+ null,
99
+ -1
100
+ /* HOISTED */
101
+ ), _hoisted_3159 = /* @__PURE__ */ createElementVNode(
102
+ "path",
103
+ {
104
+ fill: "currentColor",
105
+ d: "M512 448a64 64 0 1 0 0-128 64 64 0 0 0 0 128zm0 64a128 128 0 1 1 0-256 128 128 0 0 1 0 256zm345.6 192L960 960H672v-64H352v64H64l102.4-256h691.2zm-68.928 0H235.328l-76.8 192h706.944l-76.8-192z"
106
+ },
107
+ null,
108
+ -1
109
+ /* HOISTED */
110
+ ), _hoisted_444 = [
111
+ _hoisted_2160,
112
+ _hoisted_3159
113
+ ];
114
+ function _sfc_render160(_ctx, _cache, $props, $setup, $data, $options) {
115
+ return openBlock(), createElementBlock("svg", _hoisted_1160, _hoisted_444);
116
+ }
117
+ var map_location_default = /* @__PURE__ */ export_helper_default(map_location_vue_vue_type_script_lang_default, [["render", _sfc_render160], ["__file", "map-location.vue"]]);
118
+
119
+ var _export_sfc = (sfc, props) => {
120
+ const target = sfc.__vccOpts || sfc;
121
+ for (const [key, val] of props) {
122
+ target[key] = val;
123
+ }
124
+ return target;
125
+ };
126
+
127
+ const _sfc_main$2 = defineComponent({
128
+ components: {
129
+ ElButton,
130
+ ElIcon,
131
+ ElButtonGroup,
132
+ MapLocation: map_location_default
133
+ },
134
+ emits: {
135
+ mapLocationClick: null
136
+ }
137
+ });
138
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
139
+ const _component_MapLocation = resolveComponent("MapLocation");
140
+ const _component_ElIcon = resolveComponent("ElIcon");
141
+ const _component_ElButton = resolveComponent("ElButton");
142
+ const _component_ElButtonGroup = resolveComponent("ElButtonGroup");
143
+ return openBlock(), createBlock(_component_ElButtonGroup, null, {
144
+ default: withCtx(() => [
145
+ createVNode(_component_ElButton, {
146
+ class: "vk-geoinput-read-map-location-x",
147
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("mapLocationClick"))
148
+ }, {
149
+ default: withCtx(() => [
150
+ createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
151
+ default: withCtx(() => [
152
+ createVNode(_component_MapLocation)
153
+ ]),
154
+ _: 1
155
+ }, 8, ["color"])
156
+ ]),
157
+ _: 1
158
+ })
159
+ ]),
160
+ _: 1
161
+ });
162
+ }
163
+ var AppendVue = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "append.vue"]]);
164
+
165
+ var __defProp = Object.defineProperty;
166
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
167
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
168
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
169
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
170
+ var __spreadValues = (a, b) => {
171
+ for (var prop in b || (b = {}))
172
+ if (__hasOwnProp.call(b, prop))
173
+ __defNormalProp(a, prop, b[prop]);
174
+ if (__getOwnPropSymbols)
175
+ for (var prop of __getOwnPropSymbols(b)) {
176
+ if (__propIsEnum.call(b, prop))
177
+ __defNormalProp(a, prop, b[prop]);
178
+ }
179
+ return a;
180
+ };
181
+ var _sfc_main$1 = defineComponent({
182
+ name: "VkfGeoinputReadCore",
183
+ components: {
184
+ VkfInput,
185
+ VmGeojsonLayer,
186
+ ElIcon,
187
+ MapLocation: map_location_default
188
+ },
189
+ emits,
190
+ props,
191
+ setup(props2, { emit }) {
192
+ const inputBindProps = _VkfInputCtx.createBindProps(props2, [
193
+ "inputSlots",
194
+ "readonly",
195
+ "modelValue",
196
+ "type",
197
+ "id"
198
+ ]);
199
+ const inputOnEmits = _VkfInputCtx.createOnEmits(emit, ["update:modelValue"]);
200
+ const mapBindProps = _VmGeojsonLayerCtx$1.createBindProps(props2, ["data", "type", "paint"]);
201
+ const mapOnEmits = _VmGeojsonLayerCtx$1.createOnEmits(emit, ["change"]);
202
+ const map = useMap();
203
+ const geoType = computed(() => {
204
+ var _a, _b, _c;
205
+ if (props2.type)
206
+ return props2.type;
207
+ const typeRaw = (_c = (_b = (_a = props2.modelValue) == null ? void 0 : _a.features[0]) == null ? void 0 : _b.geometry) == null ? void 0 : _c.type;
208
+ const typeRawTo = {
209
+ LineString: "line",
210
+ Polygon: "fill",
211
+ MultiLineString: "line",
212
+ MultiPolygon: "fill"
213
+ };
214
+ return typeRawTo[typeRaw] || "fill";
215
+ });
216
+ const paintFromEditStyles = computed(() => {
217
+ return props2.editStyles.reduce((a, c) => {
218
+ if (geoType.value === "fill") {
219
+ if (c.id.includes("polygon-fill-inactive") || c.id.includes("polygon-stroke-inactive")) {
220
+ const cPaint = c.paint;
221
+ a = __spreadValues(__spreadValues({}, a), cPaint);
222
+ }
223
+ }
224
+ if (geoType.value === "line") {
225
+ if (c.id.includes("line-inactive")) {
226
+ const cPaint = c.paint;
227
+ a = __spreadValues(__spreadValues({}, a), cPaint);
228
+ }
229
+ }
230
+ return a;
231
+ }, {});
232
+ });
233
+ const mapFit = () => {
234
+ fitGeojson(map, props2.modelValue, {
235
+ duration: 1500
236
+ });
237
+ };
238
+ const append = () => /* @__PURE__ */ React.createElement(AppendVue, {
239
+ onMapLocationClick: mapFit
240
+ });
241
+ return {
242
+ mapFit,
243
+ inputBindProps,
244
+ inputOnEmits,
245
+ mapBindProps,
246
+ mapOnEmits,
247
+ append,
248
+ geoType,
249
+ paintFromEditStyles
250
+ };
251
+ }
252
+ });
253
+
254
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
255
+ const _component_VkfInput = resolveComponent("VkfInput");
256
+ const _component_MapLocation = resolveComponent("MapLocation");
257
+ const _component_ElIcon = resolveComponent("ElIcon");
258
+ const _component_VmGeojsonLayer = resolveComponent("VmGeojsonLayer");
259
+
260
+ return (openBlock(), createElementBlock(Fragment, null, [
261
+ withDirectives(createVNode(_component_VkfInput, mergeProps({
262
+ readonly: true,
263
+ modelValue: JSON.stringify(_ctx.modelValue)
264
+ }, _ctx.inputBindProps, toHandlers(_ctx.inputOnEmits), {
265
+ inputSlots: {
266
+ append: _ctx.append
267
+ }
268
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "inputSlots"]), [
269
+ [vShow, !_ctx.custom]
270
+ ]),
271
+ (_ctx.custom)
272
+ ? renderSlot(_ctx.$slots, "default", {
273
+ key: 0,
274
+ mapFit: _ctx.mapFit
275
+ }, () => [
276
+ createVNode(_component_ElIcon, {
277
+ color: 'var(--el-color-primary)',
278
+ onClick: _ctx.mapFit
279
+ }, {
280
+ default: withCtx(() => [
281
+ createVNode(_component_MapLocation)
282
+ ]),
283
+ _: 1 /* STABLE */
284
+ }, 8 /* PROPS */, ["color", "onClick"])
285
+ ])
286
+ : createCommentVNode("v-if", true),
287
+ createVNode(_component_VmGeojsonLayer, mergeProps(_ctx.mapBindProps, {
288
+ data: _ctx.modelValue,
289
+ type: _ctx.geoType,
290
+ onChange: _cache[0] || (_cache[0] = $event => (_ctx.$emit('layerChange', $event))),
291
+ paint: _ctx.paint || _ctx.paintFromEditStyles
292
+ }, toHandlers(_ctx.mapOnEmits)), null, 16 /* FULL_PROPS */, ["data", "type", "paint"])
293
+ ], 64 /* STABLE_FRAGMENT */))
294
+ }
295
+ var CoreVue = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render$1],['__file',"core.vue"]]);
296
+
297
+ const _sfc_main = defineComponent({
298
+ name: "VkfGeoinputRead",
299
+ components: {
300
+ CoreVue,
301
+ VkWrapper,
302
+ VmTdtLayers
303
+ },
304
+ props,
305
+ emits,
306
+ setup(props2, { emit }) {
307
+ const coreBindProps = createBindProps(props2);
308
+ const coreOnEmits = createOnEmits(emit);
309
+ return {
310
+ VmMap,
311
+ coreBindProps,
312
+ coreOnEmits
313
+ };
314
+ }
315
+ });
316
+ const _hoisted_1 = { class: "vk-geoinput-read-x" };
317
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
318
+ const _component_VmTdtLayers = resolveComponent("VmTdtLayers");
319
+ const _component_CoreVue = resolveComponent("CoreVue");
320
+ const _component_VkWrapper = resolveComponent("VkWrapper");
321
+ return openBlock(), createElementBlock("div", _hoisted_1, [
322
+ createVNode(_component_VkWrapper, {
323
+ is: _ctx.VmMap,
324
+ show: _ctx.showMap,
325
+ className: "vk-geoinput-read-map"
326
+ }, {
327
+ default: withCtx(() => [
328
+ renderSlot(_ctx.$slots, "map", {}, () => [
329
+ _ctx.showMap ? (openBlock(), createBlock(_component_VmTdtLayers, {
330
+ key: 0,
331
+ type: "vec_w"
332
+ })) : createCommentVNode("v-if", true)
333
+ ]),
334
+ createVNode(_component_CoreVue, mergeProps(_ctx.coreBindProps, toHandlers(_ctx.coreOnEmits)), {
335
+ default: withCtx((e) => [
336
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(e)))
337
+ ]),
338
+ _: 3
339
+ }, 16)
340
+ ]),
341
+ _: 3
342
+ }, 8, ["is", "show"])
343
+ ]);
344
+ }
345
+ var VkfGeoinputRead = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "index.vue"]]);
346
+
347
+ var types = /*#__PURE__*/Object.freeze({
348
+ __proto__: null
349
+ });
350
+
351
+ VkfGeoinputRead.install = (app) => {
352
+ app.component(VkfGeoinputRead.name, VkfGeoinputRead);
353
+ };
354
+
355
+ export { VkfGeoinputRead, ctx as _VkfGeoinputReadCtx, types as __VkfGeoinputRead, VkfGeoinputRead as default };
@@ -0,0 +1,6 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ mapLocationClick: null;
3
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
4
+ onMapLocationClick?: ((...args: any[]) => any) | undefined;
5
+ }, {}>;
6
+ export default _default;