@vunk/form 2.0.2 → 2.1.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 (36) hide show
  1. package/components/esri-input-geojson/index.cjs +484 -2
  2. package/components/esri-input-geojson/index.mjs +483 -1
  3. package/components/esri-input-geojson/src/ctx.d.ts +1 -1
  4. package/components/esri-input-geojson/src/index.vue.d.ts +1 -1
  5. package/components/index2.cjs +0 -19
  6. package/components/index2.mjs +1 -19
  7. package/components/input-collection/index.mjs +1 -1
  8. package/components/input-number/src/ctx.d.ts +1 -1
  9. package/components/input-number/src/index.vue.d.ts +2 -2
  10. package/components/select/index.cjs +12 -0
  11. package/components/select/index.d.ts +1 -0
  12. package/components/select/index.mjs +12 -1
  13. package/components/select/src/ctx.d.ts +2 -0
  14. package/components/select/src/index.vue.d.ts +1 -1
  15. package/components/tables-select/index.cjs +225 -0
  16. package/components/tables-select/index.css +3 -0
  17. package/components/tables-select/index.d.ts +4 -0
  18. package/components/tables-select/index.mjs +219 -0
  19. package/components/tables-select/src/ctx.d.ts +338 -0
  20. package/components/tables-select/src/index.vue.d.ts +4953 -0
  21. package/components/tables-select/src/types.d.ts +1 -0
  22. package/components/upload/index.mjs +1 -1
  23. package/components/upload-plus/index.mjs +1 -1
  24. package/index.css +4 -41
  25. package/package.json +9 -9
  26. package/shared/element-plus/ctx.d.ts +1 -1
  27. package/components/geoinput-update/index.cjs +0 -406
  28. package/components/geoinput-update/index.css +0 -40
  29. package/components/geoinput-update/index.d.ts +0 -5
  30. package/components/geoinput-update/index.mjs +0 -399
  31. package/components/geoinput-update/src/append.vue.d.ts +0 -815
  32. package/components/geoinput-update/src/ctx.d.ts +0 -219
  33. package/components/geoinput-update/src/index.vue.d.ts +0 -1143
  34. package/components/geoinput-update/src/types.d.ts +0 -6
  35. package/components/index3.cjs +0 -486
  36. package/components/index3.mjs +0 -484
@@ -11,7 +11,6 @@ var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
11
11
  var core = require('@vuesri/core');
12
12
  var MapView = require('@arcgis/core/views/MapView');
13
13
  var SceneView = require('@arcgis/core/views/SceneView');
14
- var index$1 = require('../index3.cjs');
15
14
  var core$1 = require('@vunk/core');
16
15
  var Graphic = require('@arcgis/core/Graphic');
17
16
  var composables = require('@vunk/form/composables');
@@ -326,6 +325,489 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
326
325
  }
327
326
  var ViewerVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/esri-input-geojson/src/viewer.vue"]]);
328
327
 
328
+ function array_cancel() {
329
+ this._array = null;
330
+ return Promise.resolve();
331
+ }
332
+
333
+ function array_read() {
334
+ var array = this._array;
335
+ this._array = null;
336
+ return Promise.resolve(array ? {done: false, value: array} : {done: true, value: undefined});
337
+ }
338
+
339
+ function array(array) {
340
+ return new ArraySource(array instanceof Uint8Array ? array : new Uint8Array(array));
341
+ }
342
+
343
+ function ArraySource(array) {
344
+ this._array = array;
345
+ }
346
+
347
+ ArraySource.prototype.read = array_read;
348
+ ArraySource.prototype.cancel = array_cancel;
349
+
350
+ function fetchPath(url) {
351
+ return fetch(url).then(function(response) {
352
+ return response.body && response.body.getReader
353
+ ? response.body.getReader()
354
+ : response.arrayBuffer().then(array);
355
+ });
356
+ }
357
+
358
+ function requestPath(url) {
359
+ return new Promise(function(resolve, reject) {
360
+ var request = new XMLHttpRequest;
361
+ request.responseType = "arraybuffer";
362
+ request.onload = function() { resolve(array(request.response)); };
363
+ request.onerror = reject;
364
+ request.ontimeout = reject;
365
+ request.open("GET", url, true);
366
+ request.send();
367
+ });
368
+ }
369
+
370
+ function path(path) {
371
+ return (typeof fetch === "function" ? fetchPath : requestPath)(path);
372
+ }
373
+
374
+ function stream(source) {
375
+ return typeof source.read === "function" ? source : source.getReader();
376
+ }
377
+
378
+ var empty = new Uint8Array(0);
379
+
380
+ function slice_cancel() {
381
+ return this._source.cancel();
382
+ }
383
+
384
+ function concat$1(a, b) {
385
+ if (!a.length) return b;
386
+ if (!b.length) return a;
387
+ var c = new Uint8Array(a.length + b.length);
388
+ c.set(a);
389
+ c.set(b, a.length);
390
+ return c;
391
+ }
392
+
393
+ function slice_read() {
394
+ var that = this, array = that._array.subarray(that._index);
395
+ return that._source.read().then(function(result) {
396
+ that._array = empty;
397
+ that._index = 0;
398
+ return result.done ? (array.length > 0
399
+ ? {done: false, value: array}
400
+ : {done: true, value: undefined})
401
+ : {done: false, value: concat$1(array, result.value)};
402
+ });
403
+ }
404
+
405
+ function slice_slice(length) {
406
+ if ((length |= 0) < 0) throw new Error("invalid length");
407
+ var that = this, index = this._array.length - this._index;
408
+
409
+ // If the request fits within the remaining buffer, resolve it immediately.
410
+ if (this._index + length <= this._array.length) {
411
+ return Promise.resolve(this._array.subarray(this._index, this._index += length));
412
+ }
413
+
414
+ // Otherwise, read chunks repeatedly until the request is fulfilled.
415
+ var array = new Uint8Array(length);
416
+ array.set(this._array.subarray(this._index));
417
+ return (function read() {
418
+ return that._source.read().then(function(result) {
419
+
420
+ // When done, it’s possible the request wasn’t fully fullfilled!
421
+ // If so, the pre-allocated array is too big and needs slicing.
422
+ if (result.done) {
423
+ that._array = empty;
424
+ that._index = 0;
425
+ return index > 0 ? array.subarray(0, index) : null;
426
+ }
427
+
428
+ // If this chunk fulfills the request, return the resulting array.
429
+ if (index + result.value.length >= length) {
430
+ that._array = result.value;
431
+ that._index = length - index;
432
+ array.set(result.value.subarray(0, length - index), index);
433
+ return array;
434
+ }
435
+
436
+ // Otherwise copy this chunk into the array, then read the next chunk.
437
+ array.set(result.value, index);
438
+ index += result.value.length;
439
+ return read();
440
+ });
441
+ })();
442
+ }
443
+
444
+ function slice(source) {
445
+ return typeof source.slice === "function" ? source :
446
+ new SliceSource(typeof source.read === "function" ? source
447
+ : source.getReader());
448
+ }
449
+
450
+ function SliceSource(source) {
451
+ this._source = source;
452
+ this._array = empty;
453
+ this._index = 0;
454
+ }
455
+
456
+ SliceSource.prototype.read = slice_read;
457
+ SliceSource.prototype.slice = slice_slice;
458
+ SliceSource.prototype.cancel = slice_cancel;
459
+
460
+ function dbf_cancel() {
461
+ return this._source.cancel();
462
+ }
463
+
464
+ function readBoolean(value) {
465
+ return /^[nf]$/i.test(value) ? false
466
+ : /^[yt]$/i.test(value) ? true
467
+ : null;
468
+ }
469
+
470
+ function readDate(value) {
471
+ return new Date(+value.substring(0, 4), value.substring(4, 6) - 1, +value.substring(6, 8));
472
+ }
473
+
474
+ function readNumber(value) {
475
+ return !(value = value.trim()) || isNaN(value = +value) ? null : value;
476
+ }
477
+
478
+ function readString(value) {
479
+ return value.trim() || null;
480
+ }
481
+
482
+ var types$1 = {
483
+ B: readNumber,
484
+ C: readString,
485
+ D: readDate,
486
+ F: readNumber,
487
+ L: readBoolean,
488
+ M: readNumber,
489
+ N: readNumber
490
+ };
491
+
492
+ function dbf_read() {
493
+ var that = this, i = 1;
494
+ return that._source.slice(that._recordLength).then(function(value) {
495
+ return value && (value[0] !== 0x1a) ? {done: false, value: that._fields.reduce(function(p, f) {
496
+ p[f.name] = types$1[f.type](that._decode(value.subarray(i, i += f.length)));
497
+ return p;
498
+ }, {})} : {done: true, value: undefined};
499
+ });
500
+ }
501
+
502
+ function view(array) {
503
+ return new DataView(array.buffer, array.byteOffset, array.byteLength);
504
+ }
505
+
506
+ function dbf(source, decoder) {
507
+ source = slice(source);
508
+ return source.slice(32).then(function(array) {
509
+ var head = view(array);
510
+ return source.slice(head.getUint16(8, true) - 32).then(function(array) {
511
+ return new Dbf(source, decoder, head, view(array));
512
+ });
513
+ });
514
+ }
515
+
516
+ function Dbf(source, decoder, head, body) {
517
+ this._source = source;
518
+ this._decode = decoder.decode.bind(decoder);
519
+ this._recordLength = head.getUint16(10, true);
520
+ this._fields = [];
521
+ for (var n = 0; body.getUint8(n) !== 0x0d; n += 32) {
522
+ for (var j = 0; j < 11; ++j) if (body.getUint8(n + j) === 0) break;
523
+ this._fields.push({
524
+ name: this._decode(new Uint8Array(body.buffer, body.byteOffset + n, j)),
525
+ type: String.fromCharCode(body.getUint8(n + 11)),
526
+ length: body.getUint8(n + 16)
527
+ });
528
+ }
529
+ }
530
+
531
+ var prototype$2 = Dbf.prototype;
532
+ prototype$2.read = dbf_read;
533
+ prototype$2.cancel = dbf_cancel;
534
+
535
+ function cancel() {
536
+ return this._source.cancel();
537
+ }
538
+
539
+ function parseMultiPoint(record) {
540
+ var i = 40, j, n = record.getInt32(36, true), coordinates = new Array(n);
541
+ for (j = 0; j < n; ++j, i += 16) coordinates[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
542
+ return {type: "MultiPoint", coordinates: coordinates};
543
+ }
544
+
545
+ function parseNull() {
546
+ return null;
547
+ }
548
+
549
+ function parsePoint(record) {
550
+ return {type: "Point", coordinates: [record.getFloat64(4, true), record.getFloat64(12, true)]};
551
+ }
552
+
553
+ function parsePolygon(record) {
554
+ var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m), polygons = [], holes = [];
555
+ for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
556
+ for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
557
+
558
+ parts.forEach(function(i, j) {
559
+ var ring = points.slice(i, parts[j + 1]);
560
+ if (ringClockwise(ring)) polygons.push([ring]);
561
+ else holes.push(ring);
562
+ });
563
+
564
+ holes.forEach(function(hole) {
565
+ polygons.some(function(polygon) {
566
+ if (ringContainsSome(polygon[0], hole)) {
567
+ polygon.push(hole);
568
+ return true;
569
+ }
570
+ }) || polygons.push([hole]);
571
+ });
572
+
573
+ return polygons.length === 1
574
+ ? {type: "Polygon", coordinates: polygons[0]}
575
+ : {type: "MultiPolygon", coordinates: polygons};
576
+ }
577
+ function ringClockwise(ring) {
578
+ if ((n = ring.length) < 4) return false;
579
+ var i = 0, n, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];
580
+ while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];
581
+ return area >= 0;
582
+ }
583
+
584
+ function ringContainsSome(ring, hole) {
585
+ var i = -1, n = hole.length, c;
586
+ while (++i < n) {
587
+ if (c = ringContains(ring, hole[i])) {
588
+ return c > 0;
589
+ }
590
+ }
591
+ return false;
592
+ }
593
+
594
+ function ringContains(ring, point) {
595
+ var x = point[0], y = point[1], contains = -1;
596
+ for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {
597
+ var pi = ring[i], xi = pi[0], yi = pi[1],
598
+ pj = ring[j], xj = pj[0], yj = pj[1];
599
+ if (segmentContains(pi, pj, point)) {
600
+ return 0;
601
+ }
602
+ if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) {
603
+ contains = -contains;
604
+ }
605
+ }
606
+ return contains;
607
+ }
608
+
609
+ function segmentContains(p0, p1, p2) {
610
+ var x20 = p2[0] - p0[0], y20 = p2[1] - p0[1];
611
+ if (x20 === 0 && y20 === 0) return true;
612
+ var x10 = p1[0] - p0[0], y10 = p1[1] - p0[1];
613
+ if (x10 === 0 && y10 === 0) return false;
614
+ var t = (x20 * x10 + y20 * y10) / (x10 * x10 + y10 * y10);
615
+ return t < 0 || t > 1 ? false : t === 0 || t === 1 ? true : t * x10 === x20 && t * y10 === y20;
616
+ }
617
+
618
+ function parsePolyLine(record) {
619
+ var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m);
620
+ for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
621
+ for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
622
+ return n === 1
623
+ ? {type: "LineString", coordinates: points}
624
+ : {type: "MultiLineString", coordinates: parts.map(function(i, j) { return points.slice(i, parts[j + 1]); })};
625
+ }
626
+
627
+ function concat(a, b) {
628
+ var ab = new Uint8Array(a.length + b.length);
629
+ ab.set(a, 0);
630
+ ab.set(b, a.length);
631
+ return ab;
632
+ }
633
+
634
+ function shp_read() {
635
+ var that = this;
636
+ ++that._index;
637
+ return that._source.slice(12).then(function(array) {
638
+ if (array == null) return {done: true, value: undefined};
639
+ var header = view(array);
640
+
641
+ // If the record starts with an invalid shape type (see #36), scan ahead in
642
+ // four-byte increments to find the next valid record, identified by the
643
+ // expected index, a non-empty content length and a valid shape type.
644
+ function skip() {
645
+ return that._source.slice(4).then(function(chunk) {
646
+ if (chunk == null) return {done: true, value: undefined};
647
+ header = view(array = concat(array.slice(4), chunk));
648
+ return header.getInt32(0, false) !== that._index ? skip() : read();
649
+ });
650
+ }
651
+
652
+ // All records should have at least four bytes (for the record shape type),
653
+ // so an invalid content length indicates corruption.
654
+ function read() {
655
+ var length = header.getInt32(4, false) * 2 - 4, type = header.getInt32(8, true);
656
+ return length < 0 || (type && type !== that._type) ? skip() : that._source.slice(length).then(function(chunk) {
657
+ return {done: false, value: type ? that._parse(view(concat(array.slice(8), chunk))) : null};
658
+ });
659
+ }
660
+
661
+ return read();
662
+ });
663
+ }
664
+
665
+ var parsers = {
666
+ 0: parseNull,
667
+ 1: parsePoint,
668
+ 3: parsePolyLine,
669
+ 5: parsePolygon,
670
+ 8: parseMultiPoint,
671
+ 11: parsePoint, // PointZ
672
+ 13: parsePolyLine, // PolyLineZ
673
+ 15: parsePolygon, // PolygonZ
674
+ 18: parseMultiPoint, // MultiPointZ
675
+ 21: parsePoint, // PointM
676
+ 23: parsePolyLine, // PolyLineM
677
+ 25: parsePolygon, // PolygonM
678
+ 28: parseMultiPoint // MultiPointM
679
+ };
680
+
681
+ function shp(source) {
682
+ source = slice(source);
683
+ return source.slice(100).then(function(array) {
684
+ return new Shp(source, view(array));
685
+ });
686
+ }
687
+ function Shp(source, header) {
688
+ var type = header.getInt32(32, true);
689
+ if (!(type in parsers)) throw new Error("unsupported shape type: " + type);
690
+ this._source = source;
691
+ this._type = type;
692
+ this._index = 0;
693
+ this._parse = parsers[type];
694
+ this.bbox = [header.getFloat64(36, true), header.getFloat64(44, true), header.getFloat64(52, true), header.getFloat64(60, true)];
695
+ }
696
+
697
+ var prototype$1 = Shp.prototype;
698
+ prototype$1.read = shp_read;
699
+ prototype$1.cancel = cancel;
700
+
701
+ function noop() {}
702
+
703
+ function shapefile_cancel() {
704
+ return Promise.all([
705
+ this._dbf && this._dbf.cancel(),
706
+ this._shp.cancel()
707
+ ]).then(noop);
708
+ }
709
+
710
+ function shapefile_read() {
711
+ var that = this;
712
+ return Promise.all([
713
+ that._dbf ? that._dbf.read() : {value: {}},
714
+ that._shp.read()
715
+ ]).then(function(results) {
716
+ var dbf = results[0], shp = results[1];
717
+ return shp.done ? shp : {
718
+ done: false,
719
+ value: {
720
+ type: "Feature",
721
+ properties: dbf.value,
722
+ geometry: shp.value
723
+ }
724
+ };
725
+ });
726
+ }
727
+
728
+ function shapefile(shpSource, dbfSource, decoder) {
729
+ return Promise.all([
730
+ shp(shpSource),
731
+ dbfSource && dbf(dbfSource, decoder)
732
+ ]).then(function(sources) {
733
+ return new Shapefile(sources[0], sources[1]);
734
+ });
735
+ }
736
+
737
+ function Shapefile(shp, dbf) {
738
+ this._shp = shp;
739
+ this._dbf = dbf;
740
+ this.bbox = shp.bbox;
741
+ }
742
+
743
+ var prototype = Shapefile.prototype;
744
+ prototype.read = shapefile_read;
745
+ prototype.cancel = shapefile_cancel;
746
+
747
+ function open(shp, dbf, options) {
748
+ if (typeof dbf === "string") {
749
+ if (!/\.dbf$/.test(dbf)) dbf += ".dbf";
750
+ dbf = path(dbf);
751
+ } else if (dbf instanceof ArrayBuffer || dbf instanceof Uint8Array) {
752
+ dbf = array(dbf);
753
+ } else if (dbf != null) {
754
+ dbf = stream(dbf);
755
+ }
756
+ if (typeof shp === "string") {
757
+ if (!/\.shp$/.test(shp)) shp += ".shp";
758
+ if (dbf === undefined) dbf = path(shp.substring(0, shp.length - 4) + ".dbf").catch(function() {});
759
+ shp = path(shp);
760
+ } else if (shp instanceof ArrayBuffer || shp instanceof Uint8Array) {
761
+ shp = array(shp);
762
+ } else {
763
+ shp = stream(shp);
764
+ }
765
+ return Promise.all([shp, dbf]).then(function(sources) {
766
+ var shp = sources[0], dbf = sources[1], encoding = "windows-1252";
767
+ return shapefile(shp, dbf, dbf && new TextDecoder(encoding));
768
+ });
769
+ }
770
+
771
+ const shpToGeojson = (file) => {
772
+ return new Promise((resolve, reject) => {
773
+ const reader = new FileReader();
774
+ reader.readAsArrayBuffer(file);
775
+ const data = {
776
+ type: "FeatureCollection",
777
+ features: []
778
+ };
779
+ reader.onload = function() {
780
+ open(this.result).then((source) => source.read().then(
781
+ function log(result) {
782
+ if (!result.done) {
783
+ data.features.push(result.value);
784
+ source.read().then(log);
785
+ } else {
786
+ if (result.value) {
787
+ data.features.push(result.value);
788
+ }
789
+ resolve(data);
790
+ }
791
+ }
792
+ )).catch(reject);
793
+ };
794
+ });
795
+ };
796
+
797
+ const toGeojson = (file) => {
798
+ const actions = {
799
+ shp: shpToGeojson
800
+ };
801
+ return new Promise((resolve, reject) => {
802
+ const suffix = file.name.split(".").pop();
803
+ if (suffix && actions[suffix]) {
804
+ resolve(actions[suffix](file));
805
+ } else {
806
+ reject(new Error(`Can't resolve the .${suffix} file`));
807
+ }
808
+ });
809
+ };
810
+
329
811
  /* @preserve
330
812
  * @terraformer/arcgis - v2.1.1 - MIT
331
813
  * Copyright (c) 2012-2022 Environmental Systems Research Institute, Inc.
@@ -883,7 +1365,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
883
1365
  }, null);
884
1366
  async function onUpload(e) {
885
1367
  if (!e.raw) return;
886
- index$1.toGeojson(e.raw).then(res => {
1368
+ toGeojson(e.raw).then(res => {
887
1369
  emit("update:modelValue", res);
888
1370
  }).then(() => {
889
1371
  elementPlus.ElMessage.success("\u4E0A\u4F20\u6210\u529F");