@vunk/form 2.18.1 → 2.19.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 (325) hide show
  1. package/components/_plugin-vue_export-helper.cjs +1 -11
  2. package/components/api-tables-select/index.cjs +1 -467
  3. package/components/api-tables-select/index.mjs +56 -413
  4. package/components/api-tables-select/src/ctx.d.ts +152 -172
  5. package/components/api-tables-select/src/index.vue.d.ts +394 -983
  6. package/components/button/index.cjs +1 -112
  7. package/components/button/index.mjs +57 -85
  8. package/components/button/src/ctx.d.ts +28 -113
  9. package/components/button/src/index.vue.d.ts +317 -625
  10. package/components/card-input-collection/index.cjs +1 -352
  11. package/components/card-input-collection/index.mjs +177 -261
  12. package/components/card-input-collection/src/core.vue.d.ts +54 -950
  13. package/components/card-input-collection/src/ctx.d.ts +19 -49
  14. package/components/card-input-collection/src/index.vue.d.ts +46 -110
  15. package/components/cascader/index.cjs +1 -150
  16. package/components/cascader/index.mjs +88 -116
  17. package/components/cascader/src/ctx.d.ts +140 -207
  18. package/components/cascader/src/index.vue.d.ts +315 -522
  19. package/components/cascader/src/use.d.ts +1 -1
  20. package/components/checkbox/index.cjs +1 -152
  21. package/components/checkbox/index.mjs +75 -119
  22. package/components/checkbox/src/ctx.d.ts +46 -69
  23. package/components/checkbox/src/index.vue.d.ts +448 -1016
  24. package/components/cloneDeep.cjs +1 -2106
  25. package/components/color-picker/index.cjs +1 -80
  26. package/components/color-picker/index.mjs +46 -69
  27. package/components/color-picker/src/ctx.d.ts +130 -107
  28. package/components/color-picker/src/index.vue.d.ts +285 -255
  29. package/components/date-picker/index.cjs +1 -119
  30. package/components/date-picker/index.mjs +63 -97
  31. package/components/date-picker/src/ctx.d.ts +123 -206
  32. package/components/date-picker/src/index.vue.d.ts +269 -1358
  33. package/components/date-picker/src/types.d.ts +7 -7
  34. package/components/date-picker-range/index.cjs +1 -177
  35. package/components/date-picker-range/index.mjs +62 -113
  36. package/components/date-picker-range/src/ctx.d.ts +130 -206
  37. package/components/date-picker-range/src/index.vue.d.ts +861 -448
  38. package/components/debounce.cjs +1 -0
  39. package/components/dialog/index.cjs +1 -126
  40. package/components/dialog/index.mjs +65 -99
  41. package/components/dialog/src/ctx.d.ts +17 -108
  42. package/components/dialog/src/index.vue.d.ts +77 -1072
  43. package/components/dialog-input-collection/index.cjs +1 -624
  44. package/components/dialog-input-collection/index.mjs +276 -498
  45. package/components/dialog-input-collection/src/ctx.d.ts +21 -52
  46. package/components/dialog-input-collection/src/dialog-form.vue.d.ts +29 -6371
  47. package/components/dialog-input-collection/src/index.vue.d.ts +65 -7630
  48. package/components/dialog-input-collection/src/layout.vue.d.ts +13 -73
  49. package/components/download-plus/index.cjs +1 -456
  50. package/components/download-plus/index.mjs +215 -358
  51. package/components/download-plus/src/api.d.ts +1 -1
  52. package/components/download-plus/src/ctx.d.ts +21 -52
  53. package/components/download-plus/src/index.vue.d.ts +437 -1177
  54. package/components/editable-text/index.cjs +1 -295
  55. package/components/editable-text/index.mjs +113 -239
  56. package/components/editable-text/src/ctx.d.ts +24 -50
  57. package/components/editable-text/src/index.vue.d.ts +59 -3258
  58. package/components/el-slider/index.cjs +1 -0
  59. package/components/el-slider/index.d.ts +5 -0
  60. package/components/el-slider/index.mjs +475 -0
  61. package/components/el-slider/src/button.d.ts +36 -0
  62. package/components/el-slider/src/button.vue.d.ts +41 -0
  63. package/components/el-slider/src/composables/index.cjs +1 -0
  64. package/components/el-slider/src/composables/index.d.ts +6 -0
  65. package/components/el-slider/src/composables/index.mjs +9 -0
  66. package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
  67. package/components/el-slider/src/composables/use-marks.d.ts +7 -0
  68. package/components/el-slider/src/composables/use-slide.d.ts +23 -0
  69. package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
  70. package/components/el-slider/src/composables/use-stops.d.ts +8 -0
  71. package/components/el-slider/src/composables/use-watch.d.ts +4 -0
  72. package/components/el-slider/src/constants.d.ts +14 -0
  73. package/components/el-slider/src/marker.d.ts +37 -0
  74. package/components/el-slider/src/slider-core.vue.d.ts +218 -0
  75. package/components/el-slider/src/slider.d.ts +174 -0
  76. package/components/esri-input-geojson/index.cjs +2 -1604
  77. package/components/esri-input-geojson/index.mjs +682 -1290
  78. package/components/esri-input-geojson/src/append.vue.d.ts +239 -1099
  79. package/components/esri-input-geojson/src/const.d.ts +1 -1
  80. package/components/esri-input-geojson/src/ctx.d.ts +66 -161
  81. package/components/esri-input-geojson/src/default-view.vue.d.ts +8 -132
  82. package/components/esri-input-geojson/src/index.vue.d.ts +982 -708
  83. package/components/esri-input-geojson/src/types.d.ts +1 -0
  84. package/components/esri-input-geojson/src/viewer.vue.d.ts +53 -282
  85. package/components/fieldset/index.cjs +1 -110
  86. package/components/fieldset/index.mjs +63 -76
  87. package/components/fieldset/src/ctx.d.ts +4 -4
  88. package/components/fieldset/src/index.vue.d.ts +7 -7
  89. package/components/form/index.cjs +1 -248
  90. package/components/form/index.mjs +107 -161
  91. package/components/form/src/ctx.d.ts +15 -64
  92. package/components/form/src/index.vue.d.ts +374 -2431
  93. package/components/form-item/index.cjs +1 -294
  94. package/components/form-item/index.mjs +140 -229
  95. package/components/form-item/src/core.vue.d.ts +32 -1854
  96. package/components/form-item/src/ctx.d.ts +19 -51
  97. package/components/form-item/src/index.vue.d.ts +38 -101
  98. package/components/form-item-renderer/index.cjs +1 -193
  99. package/components/form-item-renderer/index.mjs +103 -162
  100. package/components/form-item-renderer/src/core.vue.d.ts +9 -9
  101. package/components/form-item-renderer/src/ctx.d.ts +3 -3
  102. package/components/form-item-renderer/src/index.vue.d.ts +24 -74
  103. package/components/form-item-renderer-template/index.cjs +1 -47
  104. package/components/form-item-renderer-template/index.mjs +20 -33
  105. package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
  106. package/components/forms-provider/index.cjs +1 -99
  107. package/components/forms-provider/index.mjs +44 -73
  108. package/components/forms-provider/src/core.d.ts +3 -2
  109. package/components/forms-provider/src/segment.vue.d.ts +8 -8
  110. package/components/forms-provider/src/view.vue.d.ts +14 -4
  111. package/components/index.cjs +1 -399
  112. package/components/index2.cjs +1 -17
  113. package/components/information/index.cjs +1 -65
  114. package/components/information/index.mjs +28 -38
  115. package/components/information/src/ctx.d.ts +2 -2
  116. package/components/information/src/index.vue.d.ts +4 -4
  117. package/components/information-collection/index.cjs +1 -81
  118. package/components/information-collection/index.mjs +44 -48
  119. package/components/information-collection/src/ctx.d.ts +29 -65
  120. package/components/information-collection/src/index.vue.d.ts +64 -136
  121. package/components/information-renderer/index.cjs +1 -16
  122. package/components/information-renderer/index.d.ts +9 -9
  123. package/components/information-renderer/index.mjs +9 -10
  124. package/components/information-tag/index.cjs +1 -101
  125. package/components/information-tag/index.mjs +44 -54
  126. package/components/information-tag/src/ctx.d.ts +6 -21
  127. package/components/information-tag/src/index.vue.d.ts +23 -51
  128. package/components/information-templates-default/index.cjs +1 -101
  129. package/components/information-templates-default/index.mjs +63 -73
  130. package/components/information-templates-default/src/index.vue.d.ts +1 -1
  131. package/components/input/index.cjs +1 -115
  132. package/components/input/index.mjs +60 -83
  133. package/components/input/src/ctx.d.ts +51 -152
  134. package/components/input/src/index.vue.d.ts +392 -951
  135. package/components/input-array/index.cjs +1 -297
  136. package/components/input-array/index.mjs +115 -232
  137. package/components/input-array/src/ctx.d.ts +19 -49
  138. package/components/input-array/src/form-template.vue.d.ts +1 -900
  139. package/components/input-array/src/index.vue.d.ts +43 -729
  140. package/components/input-collection/index.cjs +1 -444
  141. package/components/input-collection/index.mjs +195 -347
  142. package/components/input-collection/src/core.vue.d.ts +64 -1026
  143. package/components/input-collection/src/ctx.d.ts +21 -51
  144. package/components/input-collection/src/index.vue.d.ts +50 -114
  145. package/components/input-file/index.cjs +1 -142
  146. package/components/input-file/index.mjs +68 -100
  147. package/components/input-file/src/ctx.d.ts +8 -29
  148. package/components/input-file/src/index.vue.d.ts +444 -74
  149. package/components/input-file/src/template.vue.d.ts +1 -124
  150. package/components/input-link/index.cjs +1 -167
  151. package/components/input-link/index.mjs +60 -83
  152. package/components/input-link/src/ctx.d.ts +52 -137
  153. package/components/input-link/src/index.vue.d.ts +833 -311
  154. package/components/input-number/index.cjs +1 -119
  155. package/components/input-number/index.mjs +73 -87
  156. package/components/input-number/src/ctx.d.ts +38 -131
  157. package/components/input-number/src/index.vue.d.ts +321 -683
  158. package/components/input-tag/index.cjs +1 -100
  159. package/components/input-tag/index.mjs +51 -78
  160. package/components/input-tag/src/ctx.d.ts +43 -145
  161. package/components/input-tag/src/index.vue.d.ts +324 -778
  162. package/components/isObject.cjs +1 -165
  163. package/components/monaco-editor/index.cjs +1 -83
  164. package/components/monaco-editor/index.mjs +40 -59
  165. package/components/monaco-editor/src/ctx.d.ts +19 -44
  166. package/components/monaco-editor/src/index.vue.d.ts +209 -109
  167. package/components/radio/index.cjs +1 -267
  168. package/components/radio/index.mjs +110 -209
  169. package/components/radio/src/ctx.d.ts +27 -91
  170. package/components/radio/src/index.vue.d.ts +298 -1279
  171. package/components/radio/src/option.vue.d.ts +29 -881
  172. package/components/radio/src/wraper.vue.d.ts +64 -196
  173. package/components/renderer-data/index.cjs +1 -41
  174. package/components/renderer-data/index.mjs +19 -26
  175. package/components/renderer-data/src/ctx.d.ts +1 -1
  176. package/components/renderer-data/src/index.vue.d.ts +2 -2
  177. package/components/select/index.cjs +1 -311
  178. package/components/select/index.mjs +156 -214
  179. package/components/select/src/core.vue.d.ts +638 -1080
  180. package/components/select/src/ctx.d.ts +140 -223
  181. package/components/select/src/index.vue.d.ts +334 -610
  182. package/components/select/src/options.vue.d.ts +1 -1
  183. package/components/slider/index.cjs +1 -88
  184. package/components/slider/index.mjs +41 -70
  185. package/components/slider/src/ctx.d.ts +63 -174
  186. package/components/slider/src/index.vue.d.ts +151 -420
  187. package/components/style.css +1 -0
  188. package/components/switch/index.cjs +1 -88
  189. package/components/switch/index.mjs +37 -69
  190. package/components/switch/src/ctx.d.ts +34 -113
  191. package/components/switch/src/index.vue.d.ts +88 -699
  192. package/components/switch/src/types.d.ts +2 -2
  193. package/components/tables-select/index.cjs +1 -263
  194. package/components/tables-select/index.mjs +102 -172
  195. package/components/tables-select/src/ctx.d.ts +76 -91
  196. package/components/tables-select/src/index.vue.d.ts +228 -4969
  197. package/components/template-instances-provider/index.cjs +1 -31
  198. package/components/template-instances-provider/index.mjs +18 -22
  199. package/components/template-instances-provider/src/index.vue.d.ts +2 -2
  200. package/components/templates-default/index.cjs +1 -235
  201. package/components/templates-default/index.mjs +152 -211
  202. package/components/templates-default/src/ctx.d.ts +5 -3
  203. package/components/templates-default/src/index.vue.d.ts +7298 -157
  204. package/components/templates-element-plus/index.cjs +1 -112
  205. package/components/templates-element-plus/index.mjs +49 -91
  206. package/components/templates-element-plus/src/ctx.d.ts +1 -1
  207. package/components/templates-element-plus/src/index.vue.d.ts +65 -258
  208. package/components/templates-esri/index.cjs +1 -65
  209. package/components/templates-esri/index.mjs +29 -39
  210. package/components/templates-esri/src/ctx.d.ts +1 -1
  211. package/components/templates-esri/src/index.vue.d.ts +1776 -24
  212. package/components/templates-layout/index.cjs +1 -137
  213. package/components/templates-layout/index.mjs +78 -116
  214. package/components/templates-layout/src/ctx.d.ts +1 -1
  215. package/components/templates-layout/src/index.vue.d.ts +79 -411
  216. package/components/templates-variant/index.cjs +1 -70
  217. package/components/templates-variant/index.mjs +33 -43
  218. package/components/templates-variant/src/ctx.d.ts +1 -1
  219. package/components/templates-variant/src/index.vue.d.ts +1238 -24
  220. package/components/time-picker/index.cjs +1 -104
  221. package/components/time-picker/index.mjs +57 -87
  222. package/components/time-picker/src/ctx.d.ts +121 -211
  223. package/components/time-picker/src/index.vue.d.ts +263 -1368
  224. package/components/upload/index.cjs +1 -663
  225. package/components/upload/index.mjs +343 -537
  226. package/components/upload/src/ctx.d.ts +108 -195
  227. package/components/upload/src/file.vue.d.ts +197 -776
  228. package/components/upload/src/index.vue.d.ts +689 -1931
  229. package/components/upload/src/types.d.ts +1 -1
  230. package/components/upload/src/wraper.vue.d.ts +232 -407
  231. package/components/upload-plus/index.cjs +21 -18673
  232. package/components/upload-plus/index.mjs +4598 -18372
  233. package/components/upload-plus/src/api.d.ts +2 -2
  234. package/components/upload-plus/src/ctx.d.ts +24 -51
  235. package/components/upload-plus/src/index.vue.d.ts +51 -1656
  236. package/components/use-watch.cjs +1 -0
  237. package/components/van-cascader/index.cjs +1 -125
  238. package/components/van-cascader/index.mjs +51 -96
  239. package/components/van-cascader/src/ctx.d.ts +135 -203
  240. package/components/van-cascader/src/index.vue.d.ts +312 -985
  241. package/components/var-datetime-picker/index.cjs +1 -333
  242. package/components/var-datetime-picker/index.mjs +175 -254
  243. package/components/var-datetime-picker/src/ctx.d.ts +19 -50
  244. package/components/var-datetime-picker/src/index.vue.d.ts +688 -1115
  245. package/components/vditor/index.cjs +1 -86
  246. package/components/vditor/index.mjs +40 -66
  247. package/components/vditor/src/ctx.d.ts +16 -45
  248. package/components/vditor/src/index.vue.d.ts +195 -120
  249. package/composables/element-plus/index.cjs +1 -23
  250. package/composables/element-plus/index.mjs +14 -18
  251. package/composables/index.cjs +1 -161
  252. package/composables/index.d.ts +1 -0
  253. package/composables/index.mjs +102 -135
  254. package/composables/useForm.d.ts +2 -2
  255. package/composables/useRtl.d.ts +18 -0
  256. package/composables/useSourceManager.d.ts +2 -2
  257. package/composables/useTemplateInstances.d.ts +3 -3
  258. package/index.css +1 -562
  259. package/index.d.ts +0 -3
  260. package/index.esm.js +23 -48
  261. package/locale/index.cjs +1 -110
  262. package/locale/index.mjs +37 -45
  263. package/locale/lang/en.d.ts +2 -6
  264. package/locale/lang/index.cjs +1 -2
  265. package/locale/lang/index.d.ts +1 -0
  266. package/locale/lang/zh-cn.d.ts +2 -6
  267. package/package.json +14 -85
  268. package/shared/const/index.cjs +1 -59
  269. package/shared/const/index.d.ts +1 -1
  270. package/shared/const/index.mjs +18 -20
  271. package/shared/element-plus/ctx.d.ts +40 -37
  272. package/shared/element-plus/index.cjs +1 -211
  273. package/shared/element-plus/index.mjs +93 -161
  274. package/shared/element-plus/instances.d.ts +207 -321
  275. package/shared/form/index.cjs +1 -33
  276. package/shared/form/index.mjs +23 -25
  277. package/shared/helper/index.cjs +1 -11
  278. package/shared/helper/index.mjs +7 -8
  279. package/shared/index.cjs +1 -8
  280. package/shared/index.mjs +5 -1
  281. package/shared/infer-prop/index.cjs +1 -36
  282. package/shared/infer-prop/index.mjs +22 -28
  283. package/shared/progress-it/index.cjs +1 -42
  284. package/shared/progress-it/index.mjs +15 -31
  285. package/shared/rules/index.cjs +1 -56
  286. package/shared/rules/index.mjs +19 -18
  287. package/shared/types/form/index.cjs +1 -2
  288. package/shared/types/index.cjs +1 -2
  289. package/shared/types/source/index.cjs +1 -2
  290. package/shared/types/source-manager/index.cjs +1 -2
  291. package/shared/upload/index.cjs +1 -774
  292. package/shared/upload/index.mjs +180 -764
  293. package/component.d.ts +0 -3
  294. package/components/_plugin-vue_export-helper.mjs +0 -9
  295. package/components/card-input-collection/index.css +0 -21
  296. package/components/cascader/index.css +0 -9
  297. package/components/checkbox/index.css +0 -30
  298. package/components/cloneDeep.mjs +0 -2104
  299. package/components/date-picker-range/index.css +0 -18
  300. package/components/dialog-input-collection/index.css +0 -21
  301. package/components/download-plus/index.css +0 -68
  302. package/components/editable-text/index.css +0 -9
  303. package/components/esri-input-geojson/index.css +0 -32
  304. package/components/fieldset/index.css +0 -5
  305. package/components/form-item/index.css +0 -35
  306. package/components/index.mjs +0 -378
  307. package/components/index2.mjs +0 -14
  308. package/components/information-tag/index.css +0 -6
  309. package/components/information-templates-default/index.css +0 -16
  310. package/components/input-array/index.css +0 -14
  311. package/components/input-collection/index.css +0 -20
  312. package/components/input-link/index.css +0 -4
  313. package/components/input-number/index.css +0 -13
  314. package/components/isObject.mjs +0 -158
  315. package/components/monaco-editor/index.css +0 -4
  316. package/components/radio/index.css +0 -40
  317. package/components/select/index.css +0 -15
  318. package/components/switch/index.css +0 -10
  319. package/components/tables-select/index.css +0 -3
  320. package/components/templates-layout/index.css +0 -3
  321. package/components/upload/index.css +0 -34
  322. package/components/upload-plus/index.css +0 -84
  323. package/components/van-cascader/index.css +0 -6
  324. package/components/var-datetime-picker/index.css +0 -17
  325. package/defaults.d.ts +0 -5
@@ -1,1607 +1,5 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var input = require('@vunk/form/components/input');
7
- var utilsVue = require('@vunk/core/shared/utils-vue');
8
- var elementPlus = require('element-plus');
9
- var index = require('../index.cjs');
10
- var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
11
- var core = require('@vuesri/core');
12
- var MapView = require('@arcgis/core/views/MapView');
13
- var SceneView = require('@arcgis/core/views/SceneView');
14
- var core$1 = require('@vunk/core');
15
- var Graphic = require('@arcgis/core/Graphic');
16
- var composables = require('@vunk/form/composables');
17
- var elementPlus$1 = require('@vunk/form/composables/element-plus');
18
- var utilsPromise = require('@vunk/core/shared/utils-promise');
19
-
20
- var EDIT_TYPE = /* @__PURE__ */ ((EDIT_TYPE2) => {
21
- EDIT_TYPE2["POINT"] = "point";
22
- EDIT_TYPE2["POLYGON"] = "polygon";
23
- EDIT_TYPE2["LINE_STRING"] = "line_string";
24
- return EDIT_TYPE2;
25
- })(EDIT_TYPE || {});
26
- const EDIT_TYPE_OPTIONS = [
27
- {
28
- label: "\u70B9",
29
- value: "point" /* POINT */,
30
- availableCreatureTools: ["point"]
31
- },
32
- {
33
- label: "\u7EBF",
34
- value: "line_string" /* LINE_STRING */,
35
- availableCreatureTools: ["polyline"]
36
- },
37
- {
38
- label: "\u9762",
39
- value: "polygon" /* POLYGON */,
40
- availableCreatureTools: ["polygon", "circle", "rectangle"]
41
- }
42
- ];
43
- const EDIT_TYPE_REFLECT = EDIT_TYPE_OPTIONS.reduce((acc, cur) => {
44
- acc[cur.value] = cur;
45
- return acc;
46
- }, {});
47
- const EMPTY_FEATURE_COLLECTION = {
48
- type: "FeatureCollection",
49
- features: []
50
- };
51
-
52
- const props = {
53
- ...input._VkfInputCtx.props,
54
- viewComponent: null,
55
- viewComponentAttrs: null,
56
- readonly: {
57
- type: Boolean,
58
- default: void 0
59
- },
60
- view: {
61
- type: Object
62
- },
63
- editTypes: {
64
- type: [Array, String],
65
- default: () => "polygon"
66
- },
67
- viewModelActiveFillSymbol: {
68
- type: Object,
69
- default: () => ({
70
- // 红色虚线,无色填充
71
- type: "simple-fill",
72
- color: [0, 0, 0, 0],
73
- style: "solid",
74
- outline: {
75
- color: [255, 0, 0, 1],
76
- width: 2,
77
- style: "dash"
78
- }
79
- })
80
- },
81
- viewModelActiveLineSymbol: null,
82
- viewModelActivePointSymbol: null,
83
- modelValue: {
84
- type: Object,
85
- default: () => EMPTY_FEATURE_COLLECTION
86
- },
87
- multiple: {
88
- type: Boolean,
89
- default: true
90
- },
91
- skipSave: {
92
- type: Boolean,
93
- default: false
94
- },
95
- showMap: {
96
- type: Boolean,
97
- default: false
98
- },
99
- dialogEdit: {
100
- type: Boolean,
101
- default: true
102
- },
103
- dialogEditFullscreen: {
104
- type: Boolean,
105
- default: true
106
- },
107
- dialogEditTitle: {
108
- type: String,
109
- default: void 0
110
- },
111
- flying: {
112
- type: Boolean,
113
- default: false
114
- },
115
- layerIndex: {
116
- type: Number,
117
- default: 100
118
- },
119
- visibleElements: {
120
- type: Object,
121
- default: void 0
122
- }
123
- };
124
- const createBindProps = utilsVue.bindPropsFactory(props);
125
- const emits = {
126
- ...input._VkfInputCtx.emits,
127
- "update:modelValue": (e) => e,
128
- "update:flying": null,
129
- /**
130
- * 点击地图定位按钮
131
- */
132
- "appendFly": null,
133
- appendEdit: null
134
- };
135
- const createOnEmits = utilsVue.onEmitsFactory(emits);
136
-
137
- var ctx = /*#__PURE__*/Object.freeze({
138
- __proto__: null,
139
- createBindProps: createBindProps,
140
- createOnEmits: createOnEmits,
141
- emits: emits,
142
- props: props
143
- });
144
-
145
- var _sfc_main$3 = vue.defineComponent({
146
- components: {
147
- ElButton: elementPlus.ElButton,
148
- ElIcon: elementPlus.ElIcon,
149
- ElButtonGroup: elementPlus.ElButtonGroup,
150
- Upload: index.upload_default,
151
- Edit: index.edit_default,
152
- ElUpload: elementPlus.ElUpload,
153
- MapLocation: index.map_location_default
154
- },
155
- props: {
156
- disabled: Boolean,
157
- dialog: Boolean,
158
- upload: {
159
- type: Boolean,
160
- default: true
161
- }
162
- },
163
- emits: {
164
- upload: (e) => e,
165
- edit: null,
166
- fly: null
167
- },
168
- methods: {
169
- getFile(file) {
170
- this.$emit("upload", file);
171
- },
172
- uploadClick(e) {
173
- const target = e.target.querySelector("input[type=file]");
174
- if (!target) return;
175
- target.click();
176
- }
177
- }
178
- });
179
-
180
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
181
- const _component_Upload = vue.resolveComponent("Upload");
182
- const _component_ElIcon = vue.resolveComponent("ElIcon");
183
- const _component_ElUpload = vue.resolveComponent("ElUpload");
184
- const _component_Edit = vue.resolveComponent("Edit");
185
- const _component_ElButton = vue.resolveComponent("ElButton");
186
- const _component_MapLocation = vue.resolveComponent("MapLocation");
187
- const _component_ElButtonGroup = vue.resolveComponent("ElButtonGroup");
188
- return vue.openBlock(), vue.createBlock(_component_ElButtonGroup, null, {
189
- default: vue.withCtx(() => [
190
- _ctx.upload ? (vue.openBlock(), vue.createBlock(_component_ElUpload, {
191
- key: 0,
192
- class: "el-button el-button--default vkf-esri-input-geojson__upload",
193
- action: "",
194
- accept: "file",
195
- multiple: false,
196
- "show-file-list": false,
197
- "auto-upload": false,
198
- "on-change": _ctx.getFile,
199
- disabled: _ctx.disabled,
200
- onClick: _ctx.uploadClick
201
- }, {
202
- default: vue.withCtx(() => [
203
- vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
204
- default: vue.withCtx(() => [
205
- vue.createVNode(_component_Upload)
206
- ]),
207
- _: 1
208
- /* STABLE */
209
- })
210
- ]),
211
- _: 1
212
- /* STABLE */
213
- }, 8, ["on-change", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
214
- _ctx.dialog ? (vue.openBlock(), vue.createBlock(_component_ElButton, {
215
- key: 1,
216
- disabled: _ctx.disabled,
217
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("edit"))
218
- }, {
219
- default: vue.withCtx(() => [
220
- vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
221
- default: vue.withCtx(() => [
222
- vue.createVNode(_component_Edit)
223
- ]),
224
- _: 1
225
- /* STABLE */
226
- })
227
- ]),
228
- _: 1
229
- /* STABLE */
230
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
231
- vue.createVNode(_component_ElButton, {
232
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("fly"))
233
- }, {
234
- default: vue.withCtx(() => [
235
- vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
236
- default: vue.withCtx(() => [
237
- vue.createVNode(_component_MapLocation)
238
- ]),
239
- _: 1
240
- /* STABLE */
241
- })
242
- ]),
243
- _: 1
244
- /* STABLE */
245
- })
246
- ]),
247
- _: 1
248
- /* STABLE */
249
- });
250
- }
251
- var AppendVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__file", "D:\\labCode\\vunk-form2\\packages\\components\\esri-input-geojson\\src\\append.vue"]]);
252
-
253
- var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
254
- __name: "default-view",
255
- setup(__props, { expose: __expose }) {
256
- __expose();
257
- const __returned__ = { get VaTdtBasemap() {
258
- return core.VaTdtBasemap;
259
- }, get VaMapView() {
260
- return core.VaMapView;
261
- } };
262
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
263
- return __returned__;
264
- }
265
- });
266
-
267
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
268
- return vue.openBlock(), vue.createBlock($setup["VaMapView"], null, {
269
- default: vue.withCtx(() => [
270
- vue.createVNode($setup["VaTdtBasemap"]),
271
- vue.renderSlot(_ctx.$slots, "default")
272
- ]),
273
- _: 3
274
- /* FORWARDED */
275
- });
276
- }
277
- var DefaultView = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "D:\\labCode\\vunk-form2\\packages\\components\\esri-input-geojson\\src\\default-view.vue"]]);
278
-
279
- var _sfc_main$1 = vue.defineComponent({
280
- components: {
281
- VaTdtBasemap: core.VaTdtBasemap,
282
- VaMapView: core.VaMapView
283
- },
284
- props: {
285
- view: {
286
- type: Object,
287
- default: void 0
288
- },
289
- viewComponent: {
290
- type: [Object, Function],
291
- default: () => DefaultView
292
- },
293
- viewComponentAttrs: {
294
- type: Object,
295
- default: () => ({})
296
- }
297
- },
298
- setup(props) {
299
- if (props.view) {
300
- vue.provide("vaView", props.view);
301
- if (props.view instanceof MapView) {
302
- vue.provide("vaMapView", props.view);
303
- }
304
- if (props.view instanceof SceneView) {
305
- vue.provide("vaSceneView", props.view);
306
- }
307
- }
308
- return {};
309
- }
310
- });
311
-
312
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
313
- return !_ctx.view ? (vue.openBlock(), vue.createBlock(
314
- vue.resolveDynamicComponent(_ctx.viewComponent),
315
- vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.viewComponentAttrs)),
316
- {
317
- default: vue.withCtx(() => [
318
- vue.renderSlot(_ctx.$slots, "default")
319
- ]),
320
- _: 3
321
- /* FORWARDED */
322
- },
323
- 16
324
- /* FULL_PROPS */
325
- )) : vue.renderSlot(_ctx.$slots, "default", { key: 1 });
326
- }
327
- var ViewerVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "D:\\labCode\\vunk-form2\\packages\\components\\esri-input-geojson\\src\\viewer.vue"]]);
328
-
329
- function array_cancel() {
330
- this._array = null;
331
- return Promise.resolve();
332
- }
333
-
334
- function array_read() {
335
- var array = this._array;
336
- this._array = null;
337
- return Promise.resolve(array ? {done: false, value: array} : {done: true, value: undefined});
338
- }
339
-
340
- function array(array) {
341
- return new ArraySource(array instanceof Uint8Array ? array : new Uint8Array(array));
342
- }
343
-
344
- function ArraySource(array) {
345
- this._array = array;
346
- }
347
-
348
- ArraySource.prototype.read = array_read;
349
- ArraySource.prototype.cancel = array_cancel;
350
-
351
- function fetchPath(url) {
352
- return fetch(url).then(function(response) {
353
- return response.body && response.body.getReader
354
- ? response.body.getReader()
355
- : response.arrayBuffer().then(array);
356
- });
357
- }
358
-
359
- function requestPath(url) {
360
- return new Promise(function(resolve, reject) {
361
- var request = new XMLHttpRequest;
362
- request.responseType = "arraybuffer";
363
- request.onload = function() { resolve(array(request.response)); };
364
- request.onerror = reject;
365
- request.ontimeout = reject;
366
- request.open("GET", url, true);
367
- request.send();
368
- });
369
- }
370
-
371
- function path(path) {
372
- return (typeof fetch === "function" ? fetchPath : requestPath)(path);
373
- }
374
-
375
- function stream(source) {
376
- return typeof source.read === "function" ? source : source.getReader();
377
- }
378
-
379
- var empty = new Uint8Array(0);
380
-
381
- function slice_cancel() {
382
- return this._source.cancel();
383
- }
384
-
385
- function concat$1(a, b) {
386
- if (!a.length) return b;
387
- if (!b.length) return a;
388
- var c = new Uint8Array(a.length + b.length);
389
- c.set(a);
390
- c.set(b, a.length);
391
- return c;
392
- }
393
-
394
- function slice_read() {
395
- var that = this, array = that._array.subarray(that._index);
396
- return that._source.read().then(function(result) {
397
- that._array = empty;
398
- that._index = 0;
399
- return result.done ? (array.length > 0
400
- ? {done: false, value: array}
401
- : {done: true, value: undefined})
402
- : {done: false, value: concat$1(array, result.value)};
403
- });
404
- }
405
-
406
- function slice_slice(length) {
407
- if ((length |= 0) < 0) throw new Error("invalid length");
408
- var that = this, index = this._array.length - this._index;
409
-
410
- // If the request fits within the remaining buffer, resolve it immediately.
411
- if (this._index + length <= this._array.length) {
412
- return Promise.resolve(this._array.subarray(this._index, this._index += length));
413
- }
414
-
415
- // Otherwise, read chunks repeatedly until the request is fulfilled.
416
- var array = new Uint8Array(length);
417
- array.set(this._array.subarray(this._index));
418
- return (function read() {
419
- return that._source.read().then(function(result) {
420
-
421
- // When done, it’s possible the request wasn’t fully fullfilled!
422
- // If so, the pre-allocated array is too big and needs slicing.
423
- if (result.done) {
424
- that._array = empty;
425
- that._index = 0;
426
- return index > 0 ? array.subarray(0, index) : null;
427
- }
428
-
429
- // If this chunk fulfills the request, return the resulting array.
430
- if (index + result.value.length >= length) {
431
- that._array = result.value;
432
- that._index = length - index;
433
- array.set(result.value.subarray(0, length - index), index);
434
- return array;
435
- }
436
-
437
- // Otherwise copy this chunk into the array, then read the next chunk.
438
- array.set(result.value, index);
439
- index += result.value.length;
440
- return read();
441
- });
442
- })();
443
- }
444
-
445
- function slice(source) {
446
- return typeof source.slice === "function" ? source :
447
- new SliceSource(typeof source.read === "function" ? source
448
- : source.getReader());
449
- }
450
-
451
- function SliceSource(source) {
452
- this._source = source;
453
- this._array = empty;
454
- this._index = 0;
455
- }
456
-
457
- SliceSource.prototype.read = slice_read;
458
- SliceSource.prototype.slice = slice_slice;
459
- SliceSource.prototype.cancel = slice_cancel;
460
-
461
- function dbf_cancel() {
462
- return this._source.cancel();
463
- }
464
-
465
- function readBoolean(value) {
466
- return /^[nf]$/i.test(value) ? false
467
- : /^[yt]$/i.test(value) ? true
468
- : null;
469
- }
470
-
471
- function readDate(value) {
472
- return new Date(+value.substring(0, 4), value.substring(4, 6) - 1, +value.substring(6, 8));
473
- }
474
-
475
- function readNumber(value) {
476
- return !(value = value.trim()) || isNaN(value = +value) ? null : value;
477
- }
478
-
479
- function readString(value) {
480
- return value.trim() || null;
481
- }
482
-
483
- var types$1 = {
484
- B: readNumber,
485
- C: readString,
486
- D: readDate,
487
- F: readNumber,
488
- L: readBoolean,
489
- M: readNumber,
490
- N: readNumber
491
- };
492
-
493
- function dbf_read() {
494
- var that = this, i = 1;
495
- return that._source.slice(that._recordLength).then(function(value) {
496
- return value && (value[0] !== 0x1a) ? {done: false, value: that._fields.reduce(function(p, f) {
497
- p[f.name] = types$1[f.type](that._decode(value.subarray(i, i += f.length)));
498
- return p;
499
- }, {})} : {done: true, value: undefined};
500
- });
501
- }
502
-
503
- function view(array) {
504
- return new DataView(array.buffer, array.byteOffset, array.byteLength);
505
- }
506
-
507
- function dbf(source, decoder) {
508
- source = slice(source);
509
- return source.slice(32).then(function(array) {
510
- var head = view(array);
511
- return source.slice(head.getUint16(8, true) - 32).then(function(array) {
512
- return new Dbf(source, decoder, head, view(array));
513
- });
514
- });
515
- }
516
-
517
- function Dbf(source, decoder, head, body) {
518
- this._source = source;
519
- this._decode = decoder.decode.bind(decoder);
520
- this._recordLength = head.getUint16(10, true);
521
- this._fields = [];
522
- for (var n = 0; body.getUint8(n) !== 0x0d; n += 32) {
523
- for (var j = 0; j < 11; ++j) if (body.getUint8(n + j) === 0) break;
524
- this._fields.push({
525
- name: this._decode(new Uint8Array(body.buffer, body.byteOffset + n, j)),
526
- type: String.fromCharCode(body.getUint8(n + 11)),
527
- length: body.getUint8(n + 16)
528
- });
529
- }
530
- }
531
-
532
- var prototype$2 = Dbf.prototype;
533
- prototype$2.read = dbf_read;
534
- prototype$2.cancel = dbf_cancel;
535
-
536
- function cancel() {
537
- return this._source.cancel();
538
- }
539
-
540
- function parseMultiPoint(record) {
541
- var i = 40, j, n = record.getInt32(36, true), coordinates = new Array(n);
542
- for (j = 0; j < n; ++j, i += 16) coordinates[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
543
- return {type: "MultiPoint", coordinates: coordinates};
544
- }
545
-
546
- function parseNull() {
547
- return null;
548
- }
549
-
550
- function parsePoint(record) {
551
- return {type: "Point", coordinates: [record.getFloat64(4, true), record.getFloat64(12, true)]};
552
- }
553
-
554
- function parsePolygon(record) {
555
- var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m), polygons = [], holes = [];
556
- for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
557
- for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
558
-
559
- parts.forEach(function(i, j) {
560
- var ring = points.slice(i, parts[j + 1]);
561
- if (ringClockwise(ring)) polygons.push([ring]);
562
- else holes.push(ring);
563
- });
564
-
565
- holes.forEach(function(hole) {
566
- polygons.some(function(polygon) {
567
- if (ringContainsSome(polygon[0], hole)) {
568
- polygon.push(hole);
569
- return true;
570
- }
571
- }) || polygons.push([hole]);
572
- });
573
-
574
- return polygons.length === 1
575
- ? {type: "Polygon", coordinates: polygons[0]}
576
- : {type: "MultiPolygon", coordinates: polygons};
577
- }
578
- function ringClockwise(ring) {
579
- if ((n = ring.length) < 4) return false;
580
- var i = 0, n, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];
581
- while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];
582
- return area >= 0;
583
- }
584
-
585
- function ringContainsSome(ring, hole) {
586
- var i = -1, n = hole.length, c;
587
- while (++i < n) {
588
- if (c = ringContains(ring, hole[i])) {
589
- return c > 0;
590
- }
591
- }
592
- return false;
593
- }
594
-
595
- function ringContains(ring, point) {
596
- var x = point[0], y = point[1], contains = -1;
597
- for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {
598
- var pi = ring[i], xi = pi[0], yi = pi[1],
599
- pj = ring[j], xj = pj[0], yj = pj[1];
600
- if (segmentContains(pi, pj, point)) {
601
- return 0;
602
- }
603
- if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) {
604
- contains = -contains;
605
- }
606
- }
607
- return contains;
608
- }
609
-
610
- function segmentContains(p0, p1, p2) {
611
- var x20 = p2[0] - p0[0], y20 = p2[1] - p0[1];
612
- if (x20 === 0 && y20 === 0) return true;
613
- var x10 = p1[0] - p0[0], y10 = p1[1] - p0[1];
614
- if (x10 === 0 && y10 === 0) return false;
615
- var t = (x20 * x10 + y20 * y10) / (x10 * x10 + y10 * y10);
616
- return t < 0 || t > 1 ? false : t === 0 || t === 1 ? true : t * x10 === x20 && t * y10 === y20;
617
- }
618
-
619
- function parsePolyLine(record) {
620
- var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m);
621
- for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
622
- for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
623
- return n === 1
624
- ? {type: "LineString", coordinates: points}
625
- : {type: "MultiLineString", coordinates: parts.map(function(i, j) { return points.slice(i, parts[j + 1]); })};
626
- }
627
-
628
- function concat(a, b) {
629
- var ab = new Uint8Array(a.length + b.length);
630
- ab.set(a, 0);
631
- ab.set(b, a.length);
632
- return ab;
633
- }
634
-
635
- function shp_read() {
636
- var that = this;
637
- ++that._index;
638
- return that._source.slice(12).then(function(array) {
639
- if (array == null) return {done: true, value: undefined};
640
- var header = view(array);
641
-
642
- // If the record starts with an invalid shape type (see #36), scan ahead in
643
- // four-byte increments to find the next valid record, identified by the
644
- // expected index, a non-empty content length and a valid shape type.
645
- function skip() {
646
- return that._source.slice(4).then(function(chunk) {
647
- if (chunk == null) return {done: true, value: undefined};
648
- header = view(array = concat(array.slice(4), chunk));
649
- return header.getInt32(0, false) !== that._index ? skip() : read();
650
- });
651
- }
652
-
653
- // All records should have at least four bytes (for the record shape type),
654
- // so an invalid content length indicates corruption.
655
- function read() {
656
- var length = header.getInt32(4, false) * 2 - 4, type = header.getInt32(8, true);
657
- return length < 0 || (type && type !== that._type) ? skip() : that._source.slice(length).then(function(chunk) {
658
- return {done: false, value: type ? that._parse(view(concat(array.slice(8), chunk))) : null};
659
- });
660
- }
661
-
662
- return read();
663
- });
664
- }
665
-
666
- var parsers = {
667
- 0: parseNull,
668
- 1: parsePoint,
669
- 3: parsePolyLine,
670
- 5: parsePolygon,
671
- 8: parseMultiPoint,
672
- 11: parsePoint, // PointZ
673
- 13: parsePolyLine, // PolyLineZ
674
- 15: parsePolygon, // PolygonZ
675
- 18: parseMultiPoint, // MultiPointZ
676
- 21: parsePoint, // PointM
677
- 23: parsePolyLine, // PolyLineM
678
- 25: parsePolygon, // PolygonM
679
- 28: parseMultiPoint // MultiPointM
680
- };
681
-
682
- function shp(source) {
683
- source = slice(source);
684
- return source.slice(100).then(function(array) {
685
- return new Shp(source, view(array));
686
- });
687
- }
688
- function Shp(source, header) {
689
- var type = header.getInt32(32, true);
690
- if (!(type in parsers)) throw new Error("unsupported shape type: " + type);
691
- this._source = source;
692
- this._type = type;
693
- this._index = 0;
694
- this._parse = parsers[type];
695
- this.bbox = [header.getFloat64(36, true), header.getFloat64(44, true), header.getFloat64(52, true), header.getFloat64(60, true)];
696
- }
697
-
698
- var prototype$1 = Shp.prototype;
699
- prototype$1.read = shp_read;
700
- prototype$1.cancel = cancel;
701
-
702
- function noop() {}
703
-
704
- function shapefile_cancel() {
705
- return Promise.all([
706
- this._dbf && this._dbf.cancel(),
707
- this._shp.cancel()
708
- ]).then(noop);
709
- }
710
-
711
- function shapefile_read() {
712
- var that = this;
713
- return Promise.all([
714
- that._dbf ? that._dbf.read() : {value: {}},
715
- that._shp.read()
716
- ]).then(function(results) {
717
- var dbf = results[0], shp = results[1];
718
- return shp.done ? shp : {
719
- done: false,
720
- value: {
721
- type: "Feature",
722
- properties: dbf.value,
723
- geometry: shp.value
724
- }
725
- };
726
- });
727
- }
728
-
729
- function shapefile(shpSource, dbfSource, decoder) {
730
- return Promise.all([
731
- shp(shpSource),
732
- dbfSource && dbf(dbfSource, decoder)
733
- ]).then(function(sources) {
734
- return new Shapefile(sources[0], sources[1]);
735
- });
736
- }
737
-
738
- function Shapefile(shp, dbf) {
739
- this._shp = shp;
740
- this._dbf = dbf;
741
- this.bbox = shp.bbox;
742
- }
743
-
744
- var prototype = Shapefile.prototype;
745
- prototype.read = shapefile_read;
746
- prototype.cancel = shapefile_cancel;
747
-
748
- function open(shp, dbf, options) {
749
- if (typeof dbf === "string") {
750
- if (!/\.dbf$/.test(dbf)) dbf += ".dbf";
751
- dbf = path(dbf);
752
- } else if (dbf instanceof ArrayBuffer || dbf instanceof Uint8Array) {
753
- dbf = array(dbf);
754
- } else if (dbf != null) {
755
- dbf = stream(dbf);
756
- }
757
- if (typeof shp === "string") {
758
- if (!/\.shp$/.test(shp)) shp += ".shp";
759
- if (dbf === undefined) dbf = path(shp.substring(0, shp.length - 4) + ".dbf").catch(function() {});
760
- shp = path(shp);
761
- } else if (shp instanceof ArrayBuffer || shp instanceof Uint8Array) {
762
- shp = array(shp);
763
- } else {
764
- shp = stream(shp);
765
- }
766
- return Promise.all([shp, dbf]).then(function(sources) {
767
- var shp = sources[0], dbf = sources[1], encoding = "windows-1252";
768
- return shapefile(shp, dbf, dbf && new TextDecoder(encoding));
769
- });
770
- }
771
-
772
- const shpToGeojson = (file) => {
773
- return new Promise((resolve, reject) => {
774
- const reader = new FileReader();
775
- reader.readAsArrayBuffer(file);
776
- const data = {
777
- type: "FeatureCollection",
778
- features: []
779
- };
780
- reader.onload = function() {
781
- open(this.result).then((source) => source.read().then(
782
- function log(result) {
783
- if (!result.done) {
784
- data.features.push(result.value);
785
- source.read().then(log);
786
- } else {
787
- if (result.value) {
788
- data.features.push(result.value);
789
- }
790
- resolve(data);
791
- }
792
- }
793
- )).catch(reject);
794
- };
795
- });
796
- };
797
-
798
- const toGeojson = (file) => {
799
- const actions = {
800
- shp: shpToGeojson
801
- };
802
- return new Promise((resolve, reject) => {
803
- const suffix = file.name.split(".").pop();
804
- if (suffix && actions[suffix]) {
805
- resolve(actions[suffix](file));
806
- } else {
807
- reject(new Error(`Can't resolve the .${suffix} file`));
808
- }
809
- });
810
- };
811
-
812
- /* @preserve
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),E=require("@vunk/form/components/input"),W=require("@vunk/core/shared/utils-vue"),w=require("element-plus"),I=require("../index.cjs"),x=require("../_plugin-vue_export-helper.cjs"),_=require("@vuesri/core"),ke=require("@arcgis/core/views/MapView"),Ve=require("@arcgis/core/views/SceneView"),be=require("@vunk/core"),Ee=require("@arcgis/core/Graphic"),Se=require("@vunk/form/composables"),Pe=require("@vunk/form/composables/element-plus"),Ie=require("@vunk/core/shared/utils-promise");var j=(e=>(e.POINT="point",e.POLYGON="polygon",e.LINE_STRING="line_string",e))(j||{});const ee=[{label:"点",value:"point",availableCreatureTools:["point"]},{label:"线",value:"line_string",availableCreatureTools:["polyline"]},{label:"面",value:"polygon",availableCreatureTools:["polygon","circle","rectangle"]}],U=ee.reduce((e,t)=>(e[t.value]=t,e),{}),te={type:"FeatureCollection",features:[]},q={...E._VkfInputCtx.props,viewComponent:null,viewComponentAttrs:null,readonly:{type:Boolean,default:void 0},view:{type:Object},editTypes:{type:[Array,String],default:()=>"polygon"},viewModelActiveFillSymbol:{type:Object,default:()=>({type:"simple-fill",color:[0,0,0,0],style:"solid",outline:{color:[255,0,0,1],width:2,style:"dash"}})},viewModelActiveLineSymbol:null,viewModelActivePointSymbol:null,modelValue:{type:Object,default:()=>te},multiple:{type:Boolean,default:!0},skipSave:{type:Boolean,default:!1},showMap:{type:Boolean,default:!1},dialogEdit:{type:Boolean,default:!0},dialogEditFullscreen:{type:Boolean,default:!0},dialogEditTitle:{type:String,default:void 0},flying:{type:Boolean,default:!1},layerIndex:{type:Number,default:100},visibleElements:{type:Object,default:void 0}},Te=W.bindPropsFactory(q),J={...E._VkfInputCtx.emits,"update:modelValue":e=>e,"update:flying":null,appendFly:null,appendEdit:null},Me=W.onEmitsFactory(J),Be=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:Te,createOnEmits:Me,emits:J,props:q},Symbol.toStringTag,{value:"Module"})),Oe=a.defineComponent({components:{ElButton:w.ElButton,ElIcon:w.ElIcon,ElButtonGroup:w.ElButtonGroup,Upload:I.upload_default,Edit:I.edit_default,ElUpload:w.ElUpload,MapLocation:I.map_location_default},props:{disabled:Boolean,dialog:Boolean,upload:{type:Boolean,default:!0}},emits:{upload:e=>e,edit:null,fly:null},methods:{getFile(e){this.$emit("upload",e)},uploadClick(e){const t=e.target.querySelector("input[type=file]");t&&t.click()}}});function Re(e,t,o,n,r,l){const i=a.resolveComponent("Upload"),u=a.resolveComponent("ElIcon"),c=a.resolveComponent("ElUpload"),d=a.resolveComponent("Edit"),f=a.resolveComponent("ElButton"),v=a.resolveComponent("MapLocation"),y=a.resolveComponent("ElButtonGroup");return a.openBlock(),a.createBlock(y,null,{default:a.withCtx(()=>[e.upload?(a.openBlock(),a.createBlock(c,{key:0,class:"el-button el-button--default vkf-esri-input-geojson__upload",action:"",accept:"file",multiple:!1,"show-file-list":!1,"auto-upload":!1,"on-change":e.getFile,disabled:e.disabled,onClick:e.uploadClick},{default:a.withCtx(()=>[a.createVNode(u,{color:"var(--el-color-primary)"},{default:a.withCtx(()=>[a.createVNode(i)]),_:1})]),_:1},8,["on-change","disabled","onClick"])):a.createCommentVNode("",!0),e.dialog?(a.openBlock(),a.createBlock(f,{key:1,disabled:e.disabled,onClick:t[0]||(t[0]=h=>e.$emit("edit"))},{default:a.withCtx(()=>[a.createVNode(u,{color:"var(--el-color-primary)"},{default:a.withCtx(()=>[a.createVNode(d)]),_:1})]),_:1},8,["disabled"])):a.createCommentVNode("",!0),a.createVNode(f,{onClick:t[1]||(t[1]=h=>e.$emit("fly"))},{default:a.withCtx(()=>[a.createVNode(u,{color:"var(--el-color-primary)"},{default:a.withCtx(()=>[a.createVNode(v)]),_:1})]),_:1})]),_:1})}const Ne=x._export_sfc(Oe,[["render",Re]]),Ae=a.defineComponent({__name:"default-view",setup(e){return(t,o)=>(a.openBlock(),a.createBlock(a.unref(_.VaMapView),null,{default:a.withCtx(()=>[a.createVNode(a.unref(_.VaTdtBasemap)),a.renderSlot(t.$slots,"default")]),_:3}))}}),Fe=a.defineComponent({components:{VaTdtBasemap:_.VaTdtBasemap,VaMapView:_.VaMapView},props:{view:{type:Object,default:void 0},viewComponent:{type:[Object,Function],default:()=>Ae},viewComponentAttrs:{type:Object,default:()=>({})}},setup(e){return e.view&&(a.provide("vaView",e.view),e.view instanceof ke&&a.provide("vaMapView",e.view),e.view instanceof Ve&&a.provide("vaSceneView",e.view)),{}}});function Le(e,t,o,n,r,l){return e.view?a.renderSlot(e.$slots,"default",{key:1}):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(e.viewComponent),a.normalizeProps(a.mergeProps({key:0},e.viewComponentAttrs)),{default:a.withCtx(()=>[a.renderSlot(e.$slots,"default")]),_:3},16))}const $e=x._export_sfc(Fe,[["render",Le]]);function Ue(){return this._array=null,Promise.resolve()}function Ge(){var e=this._array;return this._array=null,Promise.resolve(e?{done:!1,value:e}:{done:!0,value:void 0})}function T(e){return new z(e instanceof Uint8Array?e:new Uint8Array(e))}function z(e){this._array=e}z.prototype.read=Ge;z.prototype.cancel=Ue;function De(e){return fetch(e).then(function(t){return t.body&&t.body.getReader?t.body.getReader():t.arrayBuffer().then(T)})}function xe(e){return new Promise(function(t,o){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onload=function(){t(T(n.response))},n.onerror=o,n.ontimeout=o,n.open("GET",e,!0),n.send()})}function N(e){return(typeof fetch=="function"?De:xe)(e)}function X(e){return typeof e.read=="function"?e:e.getReader()}var Y=new Uint8Array(0);function qe(){return this._source.cancel()}function Je(e,t){if(!e.length)return t;if(!t.length)return e;var o=new Uint8Array(e.length+t.length);return o.set(e),o.set(t,e.length),o}function ze(){var e=this,t=e._array.subarray(e._index);return e._source.read().then(function(o){return e._array=Y,e._index=0,o.done?t.length>0?{done:!1,value:t}:{done:!0,value:void 0}:{done:!1,value:Je(t,o.value)}})}function Ye(e){if((e|=0)<0)throw new Error("invalid length");var t=this,o=this._array.length-this._index;if(this._index+e<=this._array.length)return Promise.resolve(this._array.subarray(this._index,this._index+=e));var n=new Uint8Array(e);return n.set(this._array.subarray(this._index)),function r(){return t._source.read().then(function(l){return l.done?(t._array=Y,t._index=0,o>0?n.subarray(0,o):null):o+l.value.length>=e?(t._array=l.value,t._index=e-o,n.set(l.value.subarray(0,e-o),o),n):(n.set(l.value,o),o+=l.value.length,r())})}()}function ne(e){return typeof e.slice=="function"?e:new M(typeof e.read=="function"?e:e.getReader())}function M(e){this._source=e,this._array=Y,this._index=0}M.prototype.read=ze;M.prototype.slice=Ye;M.prototype.cancel=qe;function Ze(){return this._source.cancel()}function He(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Xe(e){return new Date(+e.substring(0,4),e.substring(4,6)-1,+e.substring(6,8))}function P(e){return!(e=e.trim())||isNaN(e=+e)?null:e}function Ke(e){return e.trim()||null}var Qe={B:P,C:Ke,D:Xe,F:P,L:He,M:P,N:P};function We(){var e=this,t=1;return e._source.slice(e._recordLength).then(function(o){return o&&o[0]!==26?{done:!1,value:e._fields.reduce(function(n,r){return n[r.name]=Qe[r.type](e._decode(o.subarray(t,t+=r.length))),n},{})}:{done:!0,value:void 0}})}function g(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function je(e,t){return e=ne(e),e.slice(32).then(function(o){var n=g(o);return e.slice(n.getUint16(8,!0)-32).then(function(r){return new oe(e,t,n,g(r))})})}function oe(e,t,o,n){this._source=e,this._decode=t.decode.bind(t),this._recordLength=o.getUint16(10,!0),this._fields=[];for(var r=0;n.getUint8(r)!==13;r+=32){for(var l=0;l<11&&n.getUint8(r+l)!==0;++l);this._fields.push({name:this._decode(new Uint8Array(n.buffer,n.byteOffset+r,l)),type:String.fromCharCode(n.getUint8(r+11)),length:n.getUint8(r+16)})}}var re=oe.prototype;re.read=We;re.cancel=Ze;function et(){return this._source.cancel()}function A(e){var t=40,o,n=e.getInt32(36,!0),r=new Array(n);for(o=0;o<n;++o,t+=16)r[o]=[e.getFloat64(t,!0),e.getFloat64(t+8,!0)];return{type:"MultiPoint",coordinates:r}}function tt(){return null}function F(e){return{type:"Point",coordinates:[e.getFloat64(4,!0),e.getFloat64(12,!0)]}}function L(e){var t=44,o,n=e.getInt32(36,!0),r=e.getInt32(40,!0),l=new Array(n),i=new Array(r),u=[],c=[];for(o=0;o<n;++o,t+=4)l[o]=e.getInt32(t,!0);for(o=0;o<r;++o,t+=16)i[o]=[e.getFloat64(t,!0),e.getFloat64(t+8,!0)];return l.forEach(function(d,f){var v=i.slice(d,l[f+1]);nt(v)?u.push([v]):c.push(v)}),c.forEach(function(d){u.some(function(f){if(ot(f[0],d))return f.push(d),!0})||u.push([d])}),u.length===1?{type:"Polygon",coordinates:u[0]}:{type:"MultiPolygon",coordinates:u}}function nt(e){if((o=e.length)<4)return!1;for(var t=0,o,n=e[o-1][1]*e[0][0]-e[o-1][0]*e[0][1];++t<o;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n>=0}function ot(e,t){for(var o=-1,n=t.length,r;++o<n;)if(r=rt(e,t[o]))return r>0;return!1}function rt(e,t){for(var o=t[0],n=t[1],r=-1,l=0,i=e.length,u=i-1;l<i;u=l++){var c=e[l],d=c[0],f=c[1],v=e[u],y=v[0],h=v[1];if(at(c,v,t))return 0;f>n!=h>n&&o<(y-d)*(n-f)/(h-f)+d&&(r=-r)}return r}function at(e,t,o){var n=o[0]-e[0],r=o[1]-e[1];if(n===0&&r===0)return!0;var l=t[0]-e[0],i=t[1]-e[1];if(l===0&&i===0)return!1;var u=(n*l+r*i)/(l*l+i*i);return u<0||u>1?!1:u===0||u===1?!0:u*l===n&&u*i===r}function $(e){var t=44,o,n=e.getInt32(36,!0),r=e.getInt32(40,!0),l=new Array(n),i=new Array(r);for(o=0;o<n;++o,t+=4)l[o]=e.getInt32(t,!0);for(o=0;o<r;++o,t+=16)i[o]=[e.getFloat64(t,!0),e.getFloat64(t+8,!0)];return n===1?{type:"LineString",coordinates:i}:{type:"MultiLineString",coordinates:l.map(function(u,c){return i.slice(u,l[c+1])})}}function K(e,t){var o=new Uint8Array(e.length+t.length);return o.set(e,0),o.set(t,e.length),o}function lt(){var e=this;return++e._index,e._source.slice(12).then(function(t){if(t==null)return{done:!0,value:void 0};var o=g(t);function n(){return e._source.slice(4).then(function(l){return l==null?{done:!0,value:void 0}:(o=g(t=K(t.slice(4),l)),o.getInt32(0,!1)!==e._index?n():r())})}function r(){var l=o.getInt32(4,!1)*2-4,i=o.getInt32(8,!0);return l<0||i&&i!==e._type?n():e._source.slice(l).then(function(u){return{done:!1,value:i?e._parse(g(K(t.slice(8),u))):null}})}return r()})}var Q={0:tt,1:F,3:$,5:L,8:A,11:F,13:$,15:L,18:A,21:F,23:$,25:L,28:A};function it(e){return e=ne(e),e.slice(100).then(function(t){return new ae(e,g(t))})}function ae(e,t){var o=t.getInt32(32,!0);if(!(o in Q))throw new Error("unsupported shape type: "+o);this._source=e,this._type=o,this._index=0,this._parse=Q[o],this.bbox=[t.getFloat64(36,!0),t.getFloat64(44,!0),t.getFloat64(52,!0),t.getFloat64(60,!0)]}var le=ae.prototype;le.read=lt;le.cancel=et;function ut(){}function st(){return Promise.all([this._dbf&&this._dbf.cancel(),this._shp.cancel()]).then(ut)}function ct(){var e=this;return Promise.all([e._dbf?e._dbf.read():{value:{}},e._shp.read()]).then(function(t){var o=t[0],n=t[1];return n.done?n:{done:!1,value:{type:"Feature",properties:o.value,geometry:n.value}}})}function ft(e,t,o){return Promise.all([it(e),t&&je(t,o)]).then(function(n){return new ie(n[0],n[1])})}function ie(e,t){this._shp=e,this._dbf=t,this.bbox=e.bbox}var ue=ie.prototype;ue.read=ct;ue.cancel=st;function dt(e,t,o){return typeof t=="string"?(/\.dbf$/.test(t)||(t+=".dbf"),t=N(t)):t instanceof ArrayBuffer||t instanceof Uint8Array?t=T(t):t!=null&&(t=X(t)),typeof e=="string"?(/\.shp$/.test(e)||(e+=".shp"),t===void 0&&(t=N(e.substring(0,e.length-4)+".dbf").catch(function(){})),e=N(e)):e instanceof ArrayBuffer||e instanceof Uint8Array?e=T(e):e=X(e),Promise.all([e,t]).then(function(n){var r=n[0],l=n[1],i="windows-1252";return ft(r,l,l&&new TextDecoder(i))})}const pt=e=>new Promise((t,o)=>{const n=new FileReader;n.readAsArrayBuffer(e);const r={type:"FeatureCollection",features:[]};n.onload=function(){dt(this.result).then(l=>l.read().then(function i(u){u.done?(u.value&&r.features.push(u.value),t(r)):(r.features.push(u.value),l.read().then(i))})).catch(o)}}),vt=e=>{const t={shp:pt};return new Promise((o,n)=>{const r=e.name.split(".").pop();r&&t[r]?o(t[r](e)):n(new Error(`Can't resolve the .${r} file`))})};/* @preserve
813
2
  * @terraformer/arcgis - v2.1.1 - MIT
814
3
  * Copyright (c) 2012-2022 Environmental Systems Research Institute, Inc.
815
4
  * Tue Aug 02 2022 14:23:48 GMT-0700 (Pacific Daylight Time)
816
- */
817
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
818
- * Apache-2.0 */
819
-
820
- var edgeIntersectsEdge = function edgeIntersectsEdge(a1, a2, b1, b2) {
821
- var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);
822
- var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);
823
- var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);
824
-
825
- if (uB !== 0) {
826
- var ua = uaT / uB;
827
- var ub = ubT / uB;
828
-
829
- if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
830
- return true;
831
- }
832
- }
833
-
834
- return false;
835
- };
836
- var coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {
837
- var contains = false;
838
-
839
- for (var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {
840
- if ((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1] || coordinates[j][1] <= point[1] && point[1] < coordinates[i][1]) && point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0]) {
841
- contains = !contains;
842
- }
843
- }
844
-
845
- return contains;
846
- };
847
- var pointsEqual = function pointsEqual(a, b) {
848
- for (var i = 0; i < a.length; i++) {
849
- if (a[i] !== b[i]) {
850
- return false;
851
- }
852
- }
853
-
854
- return true;
855
- };
856
- var arrayIntersectsArray = function arrayIntersectsArray(a, b) {
857
- for (var i = 0; i < a.length - 1; i++) {
858
- for (var j = 0; j < b.length - 1; j++) {
859
- if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {
860
- return true;
861
- }
862
- }
863
- }
864
-
865
- return false;
866
- };
867
-
868
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
869
- * Apache-2.0 */
870
-
871
- var closeRing = function closeRing(coordinates) {
872
- if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {
873
- coordinates.push(coordinates[0]);
874
- }
875
-
876
- return coordinates;
877
- }; // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring
878
- // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-
879
- // points-are-in-clockwise-order
880
-
881
- var ringIsClockwise = function ringIsClockwise(ringToTest) {
882
- var total = 0;
883
- var i = 0;
884
- var rLength = ringToTest.length;
885
- var pt1 = ringToTest[i];
886
- var pt2;
887
-
888
- for (i; i < rLength - 1; i++) {
889
- pt2 = ringToTest[i + 1];
890
- total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);
891
- pt1 = pt2;
892
- }
893
-
894
- return total >= 0;
895
- }; // This function ensures that rings are oriented in the right directions
896
- // from http://jsperf.com/cloning-an-object/2
897
-
898
- var shallowClone = function shallowClone(obj) {
899
- var target = {};
900
-
901
- for (var i in obj) {
902
- // both arcgis attributes and geojson props are just hardcoded keys
903
- if (obj.hasOwnProperty(i)) {
904
- // eslint-disable-line no-prototype-builtins
905
- target[i] = obj[i];
906
- }
907
- }
908
-
909
- return target;
910
- };
911
-
912
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
913
- * Apache-2.0 */
914
-
915
- var coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {
916
- var intersects = arrayIntersectsArray(outer, inner);
917
- var contains = coordinatesContainPoint(outer, inner[0]);
918
-
919
- if (!intersects && contains) {
920
- return true;
921
- }
922
-
923
- return false;
924
- }; // do any polygons in this array contain any other polygons in this array?
925
- // used for checking for holes in arcgis rings
926
-
927
-
928
- var convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {
929
- var outerRings = [];
930
- var holes = [];
931
- var x; // iterator
932
-
933
- var outerRing; // current outer ring being evaluated
934
-
935
- var hole; // current hole being evaluated
936
- // for each ring
937
-
938
- for (var r = 0; r < rings.length; r++) {
939
- var ring = closeRing(rings[r].slice(0));
940
-
941
- if (ring.length < 4) {
942
- continue;
943
- } // is this ring an outer ring? is it clockwise?
944
-
945
-
946
- if (ringIsClockwise(ring)) {
947
- var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance
948
-
949
- outerRings.push(polygon); // push to outer rings
950
- } else {
951
- holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance
952
- }
953
- }
954
-
955
- var uncontainedHoles = []; // while there are holes left...
956
-
957
- while (holes.length) {
958
- // pop a hole off out stack
959
- hole = holes.pop(); // loop over all outer rings and see if they contain our hole.
960
-
961
- var contained = false;
962
-
963
- for (x = outerRings.length - 1; x >= 0; x--) {
964
- outerRing = outerRings[x][0];
965
-
966
- if (coordinatesContainCoordinates(outerRing, hole)) {
967
- // the hole is contained push it into our polygon
968
- outerRings[x].push(hole);
969
- contained = true;
970
- break;
971
- }
972
- } // ring is not contained in any outer ring
973
- // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320
974
-
975
-
976
- if (!contained) {
977
- uncontainedHoles.push(hole);
978
- }
979
- } // if we couldn't match any holes using contains we can try intersects...
980
-
981
-
982
- while (uncontainedHoles.length) {
983
- // pop a hole off out stack
984
- hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.
985
-
986
- var intersects = false;
987
-
988
- for (x = outerRings.length - 1; x >= 0; x--) {
989
- outerRing = outerRings[x][0];
990
-
991
- if (arrayIntersectsArray(outerRing, hole)) {
992
- // the hole is contained push it into our polygon
993
- outerRings[x].push(hole);
994
- intersects = true;
995
- break;
996
- }
997
- }
998
-
999
- if (!intersects) {
1000
- outerRings.push([hole.reverse()]);
1001
- }
1002
- }
1003
-
1004
- if (outerRings.length === 1) {
1005
- return {
1006
- type: 'Polygon',
1007
- coordinates: outerRings[0]
1008
- };
1009
- } else {
1010
- return {
1011
- type: 'MultiPolygon',
1012
- coordinates: outerRings
1013
- };
1014
- }
1015
- };
1016
-
1017
- var getId = function getId(attributes, idAttribute) {
1018
- var keys = ['OBJECTID', 'FID'];
1019
-
1020
- for (var i = 0; i < keys.length; i++) {
1021
- var key = keys[i];
1022
-
1023
- if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {
1024
- return attributes[key];
1025
- }
1026
- }
1027
-
1028
- throw Error('No valid id attribute found');
1029
- };
1030
-
1031
- var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
1032
- var geojson = {};
1033
-
1034
- if (arcgis.features) {
1035
- geojson.type = 'FeatureCollection';
1036
- geojson.features = [];
1037
-
1038
- for (var i = 0; i < arcgis.features.length; i++) {
1039
- geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));
1040
- }
1041
- }
1042
-
1043
- if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {
1044
- geojson.type = 'Point';
1045
- geojson.coordinates = [arcgis.x, arcgis.y];
1046
-
1047
- if (typeof arcgis.z === 'number') {
1048
- geojson.coordinates.push(arcgis.z);
1049
- }
1050
- }
1051
-
1052
- if (arcgis.points) {
1053
- geojson.type = 'MultiPoint';
1054
- geojson.coordinates = arcgis.points.slice(0);
1055
- }
1056
-
1057
- if (arcgis.paths) {
1058
- if (arcgis.paths.length === 1) {
1059
- geojson.type = 'LineString';
1060
- geojson.coordinates = arcgis.paths[0].slice(0);
1061
- } else {
1062
- geojson.type = 'MultiLineString';
1063
- geojson.coordinates = arcgis.paths.slice(0);
1064
- }
1065
- }
1066
-
1067
- if (arcgis.rings) {
1068
- geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));
1069
- }
1070
-
1071
- if (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {
1072
- geojson.type = 'Polygon';
1073
- geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];
1074
- }
1075
-
1076
- if (arcgis.geometry || arcgis.attributes) {
1077
- geojson.type = 'Feature';
1078
- geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;
1079
- geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;
1080
-
1081
- if (arcgis.attributes) {
1082
- try {
1083
- geojson.id = getId(arcgis.attributes, idAttribute);
1084
- } catch (err) {// don't set an id
1085
- }
1086
- }
1087
- } // if no valid geometry was encountered
1088
-
1089
-
1090
- if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {
1091
- geojson.geometry = null;
1092
- }
1093
-
1094
- if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {
1095
- console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));
1096
- }
1097
-
1098
- return geojson;
1099
- };
1100
-
1101
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
1102
- * Apache-2.0 */
1103
- // outer rings are clockwise, holes are counterclockwise
1104
- // used for converting GeoJSON Polygons to ArcGIS Polygons
1105
-
1106
- var orientRings = function orientRings(poly) {
1107
- var output = [];
1108
- var polygon = poly.slice(0);
1109
- var outerRing = closeRing(polygon.shift().slice(0));
1110
-
1111
- if (outerRing.length >= 4) {
1112
- if (!ringIsClockwise(outerRing)) {
1113
- outerRing.reverse();
1114
- }
1115
-
1116
- output.push(outerRing);
1117
-
1118
- for (var i = 0; i < polygon.length; i++) {
1119
- var hole = closeRing(polygon[i].slice(0));
1120
-
1121
- if (hole.length >= 4) {
1122
- if (ringIsClockwise(hole)) {
1123
- hole.reverse();
1124
- }
1125
-
1126
- output.push(hole);
1127
- }
1128
- }
1129
- }
1130
-
1131
- return output;
1132
- }; // This function flattens holes in multipolygons to one array of polygons
1133
- // used for converting GeoJSON Polygons to ArcGIS Polygons
1134
-
1135
-
1136
- var flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {
1137
- var output = [];
1138
-
1139
- for (var i = 0; i < rings.length; i++) {
1140
- var polygon = orientRings(rings[i]);
1141
-
1142
- for (var x = polygon.length - 1; x >= 0; x--) {
1143
- var ring = polygon[x].slice(0);
1144
- output.push(ring);
1145
- }
1146
- }
1147
-
1148
- return output;
1149
- };
1150
-
1151
- var geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {
1152
- idAttribute = idAttribute || 'OBJECTID';
1153
- var spatialReference = {
1154
- wkid: 4326
1155
- };
1156
- var result = {};
1157
- var i;
1158
-
1159
- switch (geojson.type) {
1160
- case 'Point':
1161
- result.x = geojson.coordinates[0];
1162
- result.y = geojson.coordinates[1];
1163
-
1164
- if (geojson.coordinates[2] != null) {
1165
- result.z = geojson.coordinates[2];
1166
- }
1167
-
1168
- result.spatialReference = spatialReference;
1169
- break;
1170
-
1171
- case 'MultiPoint':
1172
- result.points = geojson.coordinates.slice(0);
1173
-
1174
- if (geojson.coordinates[0][2] != null) {
1175
- result.hasZ = true;
1176
- }
1177
-
1178
- result.spatialReference = spatialReference;
1179
- break;
1180
-
1181
- case 'LineString':
1182
- result.paths = [geojson.coordinates.slice(0)];
1183
-
1184
- if (geojson.coordinates[0][2] != null) {
1185
- result.hasZ = true;
1186
- }
1187
-
1188
- result.spatialReference = spatialReference;
1189
- break;
1190
-
1191
- case 'MultiLineString':
1192
- result.paths = geojson.coordinates.slice(0);
1193
-
1194
- if (geojson.coordinates[0][0][2] != null) {
1195
- result.hasZ = true;
1196
- }
1197
-
1198
- result.spatialReference = spatialReference;
1199
- break;
1200
-
1201
- case 'Polygon':
1202
- result.rings = orientRings(geojson.coordinates.slice(0));
1203
-
1204
- if (geojson.coordinates[0][0][2] != null) {
1205
- result.hasZ = true;
1206
- }
1207
-
1208
- result.spatialReference = spatialReference;
1209
- break;
1210
-
1211
- case 'MultiPolygon':
1212
- result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));
1213
-
1214
- if (geojson.coordinates[0][0][0][2] != null) {
1215
- result.hasZ = true;
1216
- }
1217
-
1218
- result.spatialReference = spatialReference;
1219
- break;
1220
-
1221
- case 'Feature':
1222
- if (geojson.geometry) {
1223
- result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);
1224
- }
1225
-
1226
- result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};
1227
-
1228
- if (geojson.id) {
1229
- result.attributes[idAttribute] = geojson.id;
1230
- }
1231
-
1232
- break;
1233
-
1234
- case 'FeatureCollection':
1235
- result = [];
1236
-
1237
- for (i = 0; i < geojson.features.length; i++) {
1238
- result.push(geojsonToArcGIS(geojson.features[i], idAttribute));
1239
- }
1240
-
1241
- break;
1242
-
1243
- case 'GeometryCollection':
1244
- result = [];
1245
-
1246
- for (i = 0; i < geojson.geometries.length; i++) {
1247
- result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));
1248
- }
1249
-
1250
- break;
1251
- }
1252
-
1253
- return result;
1254
- };
1255
-
1256
- var _sfc_main = /* @__PURE__ */ vue.defineComponent({
1257
- name: "VkfEsriInputGeojson",
1258
- components: {
1259
- VkfInput: input.VkfInput,
1260
- VaSketch: core.VaSketch,
1261
- ViewerVue,
1262
- VkAsyncTeleport: core$1.VkAsyncTeleport,
1263
- DocumentChecked: index.document_checked_default,
1264
- VaGraphicsLayer: core.VaGraphicsLayer
1265
- },
1266
- props,
1267
- emits,
1268
- setup(props2, {
1269
- emit
1270
- }) {
1271
- const inputBindProps = input._VkfInputCtx.createBindProps(props2, ["inputSlots", "readonly", "modelValue"]);
1272
- const inputOnEmits = input._VkfInputCtx.createOnEmits(emit, ["update:modelValue"]);
1273
- const {
1274
- tr
1275
- } = elementPlus$1.useLocale();
1276
- const getInputModelValue = v => {
1277
- const emptyStr = tr("el.table.emptyText", "\u6682\u65E0\u6570\u636E");
1278
- if (!v) return emptyStr;
1279
- if (!v.features.length) return emptyStr;
1280
- return JSON.stringify(v);
1281
- };
1282
- const readonly = composables.useComputedReadonly(props2);
1283
- const sketchIf = vue.ref(!props2.view);
1284
- const sketchRef = vue.shallowRef();
1285
- const shetchPanel = vue.computed(() => {
1286
- const container = sketchRef.value?.container;
1287
- return container?.querySelector(".esri-sketch__panel");
1288
- });
1289
- const viewDef = new utilsPromise.Deferred();
1290
- const layerRef = vue.shallowRef();
1291
- const sketchLoad = async e => {
1292
- await e.sketch.when();
1293
- sketchRef.value = e.sketch;
1294
- viewDef.resolve(sketchRef.value.view);
1295
- };
1296
- const layerLoad = async ({
1297
- view,
1298
- layer
1299
- }) => {
1300
- viewDef.resolve(view);
1301
- layerRef.value = layer;
1302
- };
1303
- const availableCreatureTools = vue.computed(() => {
1304
- if (Array.isArray(props2.editTypes)) {
1305
- return props2.editTypes.reduce((pre, cur) => {
1306
- return pre.concat(EDIT_TYPE_REFLECT[cur].availableCreatureTools);
1307
- }, []);
1308
- } else {
1309
- return EDIT_TYPE_REFLECT[props2.editTypes].availableCreatureTools;
1310
- }
1311
- });
1312
- const sketchValueUpdating = vue.ref(false);
1313
- const sketchValue = vue.shallowRef([]);
1314
- vue.watch(() => props2.modelValue, (v, ov) => {
1315
- if (sketchValueUpdating.value) return;
1316
- uSketchValue();
1317
- if (!ov?.features.length) {
1318
- fly();
1319
- }
1320
- }, {
1321
- immediate: true
1322
- });
1323
- const handleUpdateSketchValue = e => {
1324
- sketchValue.value = Array.isArray(e) ? e : e.toArray();
1325
- if (props2.skipSave) {
1326
- u();
1327
- }
1328
- };
1329
- const normalMapRef = vue.shallowRef();
1330
- const dialogMapRef = vue.shallowRef();
1331
- const mapTo = vue.shallowRef();
1332
- vue.onMounted(() => {
1333
- mapTo.value = normalMapRef.value;
1334
- });
1335
- const dialogShow = vue.ref(false);
1336
- const setDialogShow = v => {
1337
- dialogShow.value = v;
1338
- };
1339
- const dialogOnOpen = async () => {
1340
- mapTo.value = dialogMapRef.value;
1341
- };
1342
- const dialogOnClose = async () => {
1343
- mapTo.value = normalMapRef.value;
1344
- };
1345
- const doSave = () => {
1346
- u();
1347
- elementPlus.ElMessage({
1348
- message: tr("vkf.esriInputGeojson.saveSuccess", "\u4FDD\u5B58\u6210\u529F"),
1349
- type: "success"
1350
- });
1351
- dialogShow.value = false;
1352
- if (props2.view) {
1353
- sketchIf.value = false;
1354
- }
1355
- };
1356
- const append = () => vue.createVNode(AppendVue, {
1357
- "dialog": !readonly.value && props2.dialogEdit,
1358
- "upload": !readonly.value,
1359
- "disabled": props2.disabled,
1360
- "onUpload": onUpload,
1361
- "onEdit": onEdit,
1362
- "onFly": () => {
1363
- if (!props2.showMap && !props2.view) {
1364
- dialogShow.value = true;
1365
- }
1366
- emit("appendFly");
1367
- fly();
1368
- }
1369
- }, null);
1370
- async function onUpload(e) {
1371
- if (!e.raw) return;
1372
- toGeojson(e.raw).then(res => {
1373
- emit("update:modelValue", res);
1374
- }).then(() => {
1375
- elementPlus.ElMessage.success(tr("vkf.esriInputGeojson.uploadSuccess", "\u4E0A\u4F20\u6210\u529F"));
1376
- }).then(fly);
1377
- }
1378
- function onEdit() {
1379
- if (!props2.view) {
1380
- dialogShow.value = true;
1381
- } else {
1382
- sketchIf.value = true;
1383
- }
1384
- emit("appendEdit");
1385
- }
1386
- function u() {
1387
- sketchValueUpdating.value = true;
1388
- const features = sketchValue.value.map(item => {
1389
- return arcgisToGeoJSON(item);
1390
- });
1391
- emit("update:modelValue", {
1392
- type: "FeatureCollection",
1393
- features
1394
- });
1395
- vue.nextTick(() => {
1396
- sketchValueUpdating.value = false;
1397
- });
1398
- }
1399
- function uSketchValue() {
1400
- const esriData = geojsonToArcGIS(props2.modelValue);
1401
- const graphics = esriData.map(item => {
1402
- const g = item.geometry;
1403
- if (g.rings) {
1404
- g.type = "polygon";
1405
- item.symbol = props2.viewModelActiveFillSymbol;
1406
- } else if (g.paths) {
1407
- g.type = "polyline";
1408
- item.symbol = props2.viewModelActiveLineSymbol;
1409
- } else if (g.x) {
1410
- g.type = "point";
1411
- item.symbol = props2.viewModelActivePointSymbol;
1412
- }
1413
- return new Graphic(item);
1414
- });
1415
- sketchValue.value = graphics;
1416
- }
1417
- vue.watch(() => props2.flying, v => {
1418
- v && fly();
1419
- });
1420
- async function fly() {
1421
- const view = await viewDef.promise;
1422
- if (!view) return;
1423
- emit("update:flying", true);
1424
- await view.when();
1425
- view.goTo(sketchValue.value).finally(() => {
1426
- emit("update:flying", false);
1427
- });
1428
- }
1429
- return {
1430
- inputBindProps,
1431
- inputOnEmits,
1432
- append,
1433
- availableCreatureTools,
1434
- sketchValue,
1435
- handleUpdateSketchValue,
1436
- sketchRef,
1437
- sketchLoad,
1438
- shetchPanel,
1439
- dialogShow,
1440
- setDialogShow,
1441
- normalMapRef,
1442
- dialogMapRef,
1443
- dialogOnOpen,
1444
- dialogOnClose,
1445
- mapTo,
1446
- doSave,
1447
- readonly,
1448
- layerLoad,
1449
- sketchIf,
1450
- fly,
1451
- layerRef,
1452
- getInputModelValue,
1453
- tr
1454
- };
1455
- }
1456
- });
1457
-
1458
- const _hoisted_1 = { class: "vkf-form-item" };
1459
- const _hoisted_2 = {
1460
- ref: "normalMapRef",
1461
- class: "vkf-esri-input-geojson__map"
1462
- };
1463
- const _hoisted_3 = {
1464
- ref: "dialogMapRef",
1465
- class: "vkf-esri-input-geojson-dialog__map"
1466
- };
1467
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1468
- const _component_VkfInput = vue.resolveComponent("VkfInput");
1469
- const _component_DocumentChecked = vue.resolveComponent("DocumentChecked");
1470
- const _component_ElIcon = vue.resolveComponent("ElIcon");
1471
- const _component_VkAsyncTeleport = vue.resolveComponent("VkAsyncTeleport");
1472
- const _component_VaSketch = vue.resolveComponent("VaSketch");
1473
- const _component_VaGraphicsLayer = vue.resolveComponent("VaGraphicsLayer");
1474
- const _component_ViewerVue = vue.resolveComponent("ViewerVue");
1475
- const _component_ElDialog = vue.resolveComponent("ElDialog");
1476
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
1477
- vue.renderSlot(_ctx.$slots, "custom", {
1478
- modelValue: _ctx.modelValue,
1479
- fly: _ctx.fly,
1480
- setDialogShow: _ctx.setDialogShow,
1481
- layer: _ctx.layerRef,
1482
- showMap: _ctx.showMap
1483
- }, () => [
1484
- vue.createVNode(_component_VkfInput, vue.mergeProps({
1485
- readonly: true,
1486
- "model-value": _ctx.getInputModelValue(_ctx.modelValue)
1487
- }, _ctx.inputBindProps, {
1488
- "input-slots": {
1489
- append: _ctx.append
1490
- }
1491
- }, vue.toHandlers(_ctx.inputOnEmits)), null, 16, ["model-value", "input-slots"])
1492
- ]),
1493
- vue.createVNode(_component_VkAsyncTeleport, { to: _ctx.mapTo }, {
1494
- default: vue.withCtx(() => [
1495
- vue.createVNode(_component_ViewerVue, {
1496
- view: _ctx.view,
1497
- "view-component": _ctx.viewComponent,
1498
- "view-component-attrs": _ctx.viewComponentAttrs
1499
- }, {
1500
- default: vue.withCtx(() => [
1501
- vue.createVNode(_component_VaGraphicsLayer, {
1502
- index: _ctx.layerIndex,
1503
- graphics: _ctx.sketchValue,
1504
- onLoad: _ctx.layerLoad
1505
- }, {
1506
- default: vue.withCtx(() => [
1507
- !(_ctx.readonly || !_ctx.sketchIf) ? (vue.openBlock(), vue.createBlock(_component_VaSketch, {
1508
- key: 0,
1509
- "view-model-active-fill-symbol": _ctx.viewModelActiveFillSymbol,
1510
- "view-model-active-line-symbol": _ctx.viewModelActiveLineSymbol,
1511
- "view-model-active-point-symbol": _ctx.viewModelActivePointSymbol,
1512
- multiple: _ctx.multiple,
1513
- "available-creature-tools": _ctx.availableCreatureTools,
1514
- "model-value": _ctx.sketchValue,
1515
- "visible-elements": _ctx.visibleElements,
1516
- "onUpdate:modelValue": _ctx.handleUpdateSketchValue,
1517
- onLoad: _ctx.sketchLoad
1518
- }, {
1519
- default: vue.withCtx(() => [
1520
- !_ctx.skipSave && _ctx.shetchPanel ? (vue.openBlock(), vue.createBlock(_component_VkAsyncTeleport, {
1521
- key: 0,
1522
- to: _ctx.shetchPanel
1523
- }, {
1524
- default: vue.withCtx(() => [
1525
- vue.createVNode(_component_ElIcon, {
1526
- class: "esri-sketch-ui-save esri-widget--button",
1527
- onClick: _ctx.doSave
1528
- }, {
1529
- default: vue.withCtx(() => [
1530
- vue.createVNode(_component_DocumentChecked)
1531
- ]),
1532
- _: 1
1533
- /* STABLE */
1534
- }, 8, ["onClick"])
1535
- ]),
1536
- _: 1
1537
- /* STABLE */
1538
- }, 8, ["to"])) : vue.createCommentVNode("v-if", true)
1539
- ]),
1540
- _: 1
1541
- /* STABLE */
1542
- }, 8, ["view-model-active-fill-symbol", "view-model-active-line-symbol", "view-model-active-point-symbol", "multiple", "available-creature-tools", "model-value", "visible-elements", "onUpdate:modelValue", "onLoad"])) : vue.createCommentVNode("v-if", true)
1543
- ]),
1544
- _: 1
1545
- /* STABLE */
1546
- }, 8, ["index", "graphics", "onLoad"])
1547
- ]),
1548
- _: 1
1549
- /* STABLE */
1550
- }, 8, ["view", "view-component", "view-component-attrs"])
1551
- ]),
1552
- _: 1
1553
- /* STABLE */
1554
- }, 8, ["to"]),
1555
- vue.withDirectives(vue.createElementVNode(
1556
- "div",
1557
- _hoisted_2,
1558
- null,
1559
- 512
1560
- /* NEED_PATCH */
1561
- ), [
1562
- [vue.vShow, _ctx.showMap]
1563
- ]),
1564
- vue.createVNode(_component_ElDialog, {
1565
- modelValue: _ctx.dialogShow,
1566
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.dialogShow = $event),
1567
- title: _ctx.dialogEditTitle || _ctx.tr("vkf.esriInputGeojson.dialogEditTitle", "\u7ED8\u5236\u56FE\u6591"),
1568
- fullscreen: _ctx.dialogEditFullscreen,
1569
- "modal-class": "vkf-esri-input-geojson-dialog",
1570
- "append-to-body": true,
1571
- "close-on-click-modal": false,
1572
- draggable: true,
1573
- onOpen: _ctx.dialogOnOpen,
1574
- onClose: _ctx.dialogOnClose
1575
- }, {
1576
- default: vue.withCtx(() => [
1577
- vue.createElementVNode(
1578
- "div",
1579
- _hoisted_3,
1580
- null,
1581
- 512
1582
- /* NEED_PATCH */
1583
- )
1584
- ]),
1585
- _: 1
1586
- /* STABLE */
1587
- }, 8, ["modelValue", "title", "fullscreen", "onOpen", "onClose"])
1588
- ]);
1589
- }
1590
- var VkfEsriInputGeojson = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:\\labCode\\vunk-form2\\packages\\components\\esri-input-geojson\\src\\index.vue"]]);
1591
-
1592
- var types = /*#__PURE__*/Object.freeze({
1593
- __proto__: null
1594
- });
1595
-
1596
- VkfEsriInputGeojson.install = (app) => {
1597
- app.component(VkfEsriInputGeojson.name, VkfEsriInputGeojson);
1598
- };
1599
-
1600
- exports.EDIT_TYPE = EDIT_TYPE;
1601
- exports.EDIT_TYPE_OPTIONS = EDIT_TYPE_OPTIONS;
1602
- exports.EDIT_TYPE_REFLECT = EDIT_TYPE_REFLECT;
1603
- exports.EMPTY_FEATURE_COLLECTION = EMPTY_FEATURE_COLLECTION;
1604
- exports.VkfEsriInputGeojson = VkfEsriInputGeojson;
1605
- exports._VkfEsriInputGeojsonCtx = ctx;
1606
- exports.__VkfEsriInputGeojson = types;
1607
- exports.default = VkfEsriInputGeojson;
5
+ */var yt=function(t,o,n,r){var l=(r[0]-n[0])*(t[1]-n[1])-(r[1]-n[1])*(t[0]-n[0]),i=(o[0]-t[0])*(t[1]-n[1])-(o[1]-t[1])*(t[0]-n[0]),u=(r[1]-n[1])*(o[0]-t[0])-(r[0]-n[0])*(o[1]-t[1]);if(u!==0){var c=l/u,d=i/u;if(c>=0&&c<=1&&d>=0&&d<=1)return!0}return!1},ht=function(t,o){for(var n=!1,r=-1,l=t.length,i=l-1;++r<l;i=r)(t[r][1]<=o[1]&&o[1]<t[i][1]||t[i][1]<=o[1]&&o[1]<t[r][1])&&o[0]<(t[i][0]-t[r][0])*(o[1]-t[r][1])/(t[i][1]-t[r][1])+t[r][0]&&(n=!n);return n},mt=function(t,o){for(var n=0;n<t.length;n++)if(t[n]!==o[n])return!1;return!0},se=function(t,o){for(var n=0;n<t.length-1;n++)for(var r=0;r<o.length-1;r++)if(yt(t[n],t[n+1],o[r],o[r+1]))return!0;return!1},G=function(t){return mt(t[0],t[t.length-1])||t.push(t[0]),t},D=function(t){var o=0,n=0,r=t.length,l=t[n],i;for(n;n<r-1;n++)i=t[n+1],o+=(i[0]-l[0])*(i[1]+l[1]),l=i;return o>=0},ce=function(t){var o={};for(var n in t)t.hasOwnProperty(n)&&(o[n]=t[n]);return o},wt=function(t,o){var n=se(t,o),r=ht(t,o[0]);return!!(!n&&r)},gt=function(t){for(var o=[],n=[],r,l,i,u=0;u<t.length;u++){var c=G(t[u].slice(0));if(!(c.length<4))if(D(c)){var d=[c.slice().reverse()];o.push(d)}else n.push(c.slice().reverse())}for(var f=[];n.length;){i=n.pop();var v=!1;for(r=o.length-1;r>=0;r--)if(l=o[r][0],wt(l,i)){o[r].push(i),v=!0;break}v||f.push(i)}for(;f.length;){i=f.pop();var y=!1;for(r=o.length-1;r>=0;r--)if(l=o[r][0],se(l,i)){o[r].push(i),y=!0;break}y||o.push([i.reverse()])}return o.length===1?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o}},_t=function(t,o){for(var n=["OBJECTID","FID"],r=0;r<n.length;r++){var l=n[r];if(l in t&&(typeof t[l]=="string"||typeof t[l]=="number"))return t[l]}throw Error("No valid id attribute found")},Ct=function e(t,o){var n={};if(t.features){n.type="FeatureCollection",n.features=[];for(var r=0;r<t.features.length;r++)n.features.push(e(t.features[r],o))}if(typeof t.x=="number"&&typeof t.y=="number"&&(n.type="Point",n.coordinates=[t.x,t.y],typeof t.z=="number"&&n.coordinates.push(t.z)),t.points&&(n.type="MultiPoint",n.coordinates=t.points.slice(0)),t.paths&&(t.paths.length===1?(n.type="LineString",n.coordinates=t.paths[0].slice(0)):(n.type="MultiLineString",n.coordinates=t.paths.slice(0))),t.rings&&(n=gt(t.rings.slice(0))),typeof t.xmin=="number"&&typeof t.ymin=="number"&&typeof t.xmax=="number"&&typeof t.ymax=="number"&&(n.type="Polygon",n.coordinates=[[[t.xmax,t.ymax],[t.xmin,t.ymax],[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax]]]),(t.geometry||t.attributes)&&(n.type="Feature",n.geometry=t.geometry?e(t.geometry):null,n.properties=t.attributes?ce(t.attributes):null,t.attributes))try{n.id=_t(t.attributes,o)}catch{}return JSON.stringify(n.geometry)===JSON.stringify({})&&(n.geometry=null),t.spatialReference&&t.spatialReference.wkid&&t.spatialReference.wkid!==4326&&console.warn("Object converted in non-standard crs - "+JSON.stringify(t.spatialReference)),n},fe=function(t){var o=[],n=t.slice(0),r=G(n.shift().slice(0));if(r.length>=4){D(r)||r.reverse(),o.push(r);for(var l=0;l<n.length;l++){var i=G(n[l].slice(0));i.length>=4&&(D(i)&&i.reverse(),o.push(i))}}return o},kt=function(t){for(var o=[],n=0;n<t.length;n++)for(var r=fe(t[n]),l=r.length-1;l>=0;l--){var i=r[l].slice(0);o.push(i)}return o},Vt=function e(t,o){o=o||"OBJECTID";var n={wkid:4326},r={},l;switch(t.type){case"Point":r.x=t.coordinates[0],r.y=t.coordinates[1],t.coordinates[2]!=null&&(r.z=t.coordinates[2]),r.spatialReference=n;break;case"MultiPoint":r.points=t.coordinates.slice(0),t.coordinates[0][2]!=null&&(r.hasZ=!0),r.spatialReference=n;break;case"LineString":r.paths=[t.coordinates.slice(0)],t.coordinates[0][2]!=null&&(r.hasZ=!0),r.spatialReference=n;break;case"MultiLineString":r.paths=t.coordinates.slice(0),t.coordinates[0][0][2]!=null&&(r.hasZ=!0),r.spatialReference=n;break;case"Polygon":r.rings=fe(t.coordinates.slice(0)),t.coordinates[0][0][2]!=null&&(r.hasZ=!0),r.spatialReference=n;break;case"MultiPolygon":r.rings=kt(t.coordinates.slice(0)),t.coordinates[0][0][0][2]!=null&&(r.hasZ=!0),r.spatialReference=n;break;case"Feature":t.geometry&&(r.geometry=e(t.geometry,o)),r.attributes=t.properties?ce(t.properties):{},t.id&&(r.attributes[o]=t.id);break;case"FeatureCollection":for(r=[],l=0;l<t.features.length;l++)r.push(e(t.features[l],o));break;case"GeometryCollection":for(r=[],l=0;l<t.geometries.length;l++)r.push(e(t.geometries[l],o));break}return r};const bt=a.defineComponent({name:"VkfEsriInputGeojson",components:{VkfInput:E.VkfInput,VaSketch:_.VaSketch,ViewerVue:$e,VkAsyncTeleport:be.VkAsyncTeleport,DocumentChecked:I.document_checked_default,VaGraphicsLayer:_.VaGraphicsLayer},props:q,emits:J,setup(e,{emit:t}){const o=E._VkfInputCtx.createBindProps(e,["inputSlots","readonly","modelValue"]),n=E._VkfInputCtx.createOnEmits(t,["update:modelValue"]),{tr:r}=Pe.useLocale(),l=s=>{const p=r("el.table.emptyText","暂无数据");return!s||!s.features.length?p:JSON.stringify(s)},i=Se.useComputedReadonly(e),u=a.ref(!e.view),c=a.shallowRef(),d=a.computed(()=>{var p;const s=(p=c.value)==null?void 0:p.container;return s==null?void 0:s.querySelector(".esri-sketch__panel")}),f=new Ie.Deferred,v=a.shallowRef(),y=async s=>{await s.sketch.when(),c.value=s.sketch,f.resolve(c.value.view)},h=async({view:s,layer:p})=>{f.resolve(s),v.value=p},B=a.computed(()=>Array.isArray(e.editTypes)?e.editTypes.reduce((s,p)=>s.concat(U[p].availableCreatureTools),[]):U[e.editTypes].availableCreatureTools),O=a.ref(!1),C=a.shallowRef([]);a.watch(()=>e.modelValue,(s,p)=>{O.value||(Ce(),p!=null&&p.features.length||V())},{immediate:!0});const pe=s=>{C.value=Array.isArray(s)?s:s.toArray(),e.skipSave&&H()},R=a.shallowRef(),Z=a.shallowRef(),S=a.shallowRef();a.onMounted(()=>{S.value=R.value});const k=a.ref(!1),ve=s=>{k.value=s},ye=async()=>{S.value=Z.value},he=async()=>{S.value=R.value},me=()=>{H(),w.ElMessage({message:r("vkf.esriInputGeojson.saveSuccess","保存成功"),type:"success"}),k.value=!1,e.view&&(u.value=!1)},we=()=>a.createVNode(Ne,{dialog:!i.value&&e.dialogEdit,upload:!i.value,disabled:e.disabled,onUpload:ge,onEdit:_e,onFly:()=>{!e.showMap&&!e.view&&(k.value=!0),t("appendFly"),V()}},null);async function ge(s){s.raw&&vt(s.raw).then(p=>{t("update:modelValue",p)}).then(()=>{w.ElMessage.success(r("vkf.esriInputGeojson.uploadSuccess","上传成功"))}).then(V)}function _e(){e.view?u.value=!0:k.value=!0,t("appendEdit")}function H(){O.value=!0;const s=C.value.map(p=>Ct(p));t("update:modelValue",{type:"FeatureCollection",features:s}),a.nextTick(()=>{O.value=!1})}function Ce(){const p=Vt(e.modelValue).map(b=>{const m=b.geometry;return m.rings?(m.type="polygon",b.symbol=e.viewModelActiveFillSymbol):m.paths?(m.type="polyline",b.symbol=e.viewModelActiveLineSymbol):m.x&&(m.type="point",b.symbol=e.viewModelActivePointSymbol),new Ee(b)});C.value=p}a.watch(()=>e.flying,s=>{s&&V()});async function V(){const s=await f.promise;s&&(t("update:flying",!0),await s.when(),s.goTo(C.value).finally(()=>{t("update:flying",!1)}))}return{inputBindProps:o,inputOnEmits:n,append:we,availableCreatureTools:B,sketchValue:C,handleUpdateSketchValue:pe,sketchRef:c,sketchLoad:y,shetchPanel:d,dialogShow:k,setDialogShow:ve,normalMapRef:R,dialogMapRef:Z,dialogOnOpen:ye,dialogOnClose:he,mapTo:S,doSave:me,readonly:i,layerLoad:h,sketchIf:u,fly:V,layerRef:v,getInputModelValue:l,tr:r}}}),Et={class:"vkf-form-item"},St={ref:"normalMapRef",class:"vkf-esri-input-geojson__map"},Pt={ref:"dialogMapRef",class:"vkf-esri-input-geojson-dialog__map"};function It(e,t,o,n,r,l){const i=a.resolveComponent("VkfInput"),u=a.resolveComponent("DocumentChecked"),c=a.resolveComponent("ElIcon"),d=a.resolveComponent("VkAsyncTeleport"),f=a.resolveComponent("VaSketch"),v=a.resolveComponent("VaGraphicsLayer"),y=a.resolveComponent("ViewerVue"),h=a.resolveComponent("ElDialog");return a.openBlock(),a.createElementBlock("div",Et,[a.renderSlot(e.$slots,"custom",{modelValue:e.modelValue,fly:e.fly,setDialogShow:e.setDialogShow,layer:e.layerRef,showMap:e.showMap},()=>[a.createVNode(i,a.mergeProps({readonly:!0,"model-value":e.getInputModelValue(e.modelValue)},e.inputBindProps,{"input-slots":{append:e.append}},a.toHandlers(e.inputOnEmits)),null,16,["model-value","input-slots"])]),a.createVNode(d,{to:e.mapTo},{default:a.withCtx(()=>[a.createVNode(y,{view:e.view,"view-component":e.viewComponent,"view-component-attrs":e.viewComponentAttrs},{default:a.withCtx(()=>[a.createVNode(v,{index:e.layerIndex,graphics:e.sketchValue,onLoad:e.layerLoad},{default:a.withCtx(()=>[e.readonly||!e.sketchIf?a.createCommentVNode("",!0):(a.openBlock(),a.createBlock(f,{key:0,"view-model-active-fill-symbol":e.viewModelActiveFillSymbol,"view-model-active-line-symbol":e.viewModelActiveLineSymbol,"view-model-active-point-symbol":e.viewModelActivePointSymbol,multiple:e.multiple,"available-creature-tools":e.availableCreatureTools,"model-value":e.sketchValue,"visible-elements":e.visibleElements,"onUpdate:modelValue":e.handleUpdateSketchValue,onLoad:e.sketchLoad},{default:a.withCtx(()=>[!e.skipSave&&e.shetchPanel?(a.openBlock(),a.createBlock(d,{key:0,to:e.shetchPanel},{default:a.withCtx(()=>[a.createVNode(c,{class:"esri-sketch-ui-save esri-widget--button",onClick:e.doSave},{default:a.withCtx(()=>[a.createVNode(u)]),_:1},8,["onClick"])]),_:1},8,["to"])):a.createCommentVNode("",!0)]),_:1},8,["view-model-active-fill-symbol","view-model-active-line-symbol","view-model-active-point-symbol","multiple","available-creature-tools","model-value","visible-elements","onUpdate:modelValue","onLoad"]))]),_:1},8,["index","graphics","onLoad"])]),_:1},8,["view","view-component","view-component-attrs"])]),_:1},8,["to"]),a.withDirectives(a.createElementVNode("div",St,null,512),[[a.vShow,e.showMap]]),a.createVNode(h,{modelValue:e.dialogShow,"onUpdate:modelValue":t[0]||(t[0]=B=>e.dialogShow=B),title:e.dialogEditTitle||e.tr("vkf.esriInputGeojson.dialogEditTitle","绘制图斑"),fullscreen:e.dialogEditFullscreen,"modal-class":"vkf-esri-input-geojson-dialog","append-to-body":!0,"close-on-click-modal":!1,draggable:!0,onOpen:e.dialogOnOpen,onClose:e.dialogOnClose},{default:a.withCtx(()=>[a.createElementVNode("div",Pt,null,512)]),_:1},8,["modelValue","title","fullscreen","onOpen","onClose"])])}const de=x._export_sfc(bt,[["render",It]]),Tt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.EDIT_TYPE=j;exports.EDIT_TYPE_OPTIONS=ee;exports.EDIT_TYPE_REFLECT=U;exports.EMPTY_FEATURE_COLLECTION=te;exports.VkfEsriInputGeojson=de;exports._VkfEsriInputGeojsonCtx=Be;exports.__VkfEsriInputGeojson=Tt;exports.default=de;