@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
@@ -1,484 +0,0 @@
1
- function array_cancel() {
2
- this._array = null;
3
- return Promise.resolve();
4
- }
5
-
6
- function array_read() {
7
- var array = this._array;
8
- this._array = null;
9
- return Promise.resolve(array ? {done: false, value: array} : {done: true, value: undefined});
10
- }
11
-
12
- function array(array) {
13
- return new ArraySource(array instanceof Uint8Array ? array : new Uint8Array(array));
14
- }
15
-
16
- function ArraySource(array) {
17
- this._array = array;
18
- }
19
-
20
- ArraySource.prototype.read = array_read;
21
- ArraySource.prototype.cancel = array_cancel;
22
-
23
- function fetchPath(url) {
24
- return fetch(url).then(function(response) {
25
- return response.body && response.body.getReader
26
- ? response.body.getReader()
27
- : response.arrayBuffer().then(array);
28
- });
29
- }
30
-
31
- function requestPath(url) {
32
- return new Promise(function(resolve, reject) {
33
- var request = new XMLHttpRequest;
34
- request.responseType = "arraybuffer";
35
- request.onload = function() { resolve(array(request.response)); };
36
- request.onerror = reject;
37
- request.ontimeout = reject;
38
- request.open("GET", url, true);
39
- request.send();
40
- });
41
- }
42
-
43
- function path(path) {
44
- return (typeof fetch === "function" ? fetchPath : requestPath)(path);
45
- }
46
-
47
- function stream(source) {
48
- return typeof source.read === "function" ? source : source.getReader();
49
- }
50
-
51
- var empty = new Uint8Array(0);
52
-
53
- function slice_cancel() {
54
- return this._source.cancel();
55
- }
56
-
57
- function concat$1(a, b) {
58
- if (!a.length) return b;
59
- if (!b.length) return a;
60
- var c = new Uint8Array(a.length + b.length);
61
- c.set(a);
62
- c.set(b, a.length);
63
- return c;
64
- }
65
-
66
- function slice_read() {
67
- var that = this, array = that._array.subarray(that._index);
68
- return that._source.read().then(function(result) {
69
- that._array = empty;
70
- that._index = 0;
71
- return result.done ? (array.length > 0
72
- ? {done: false, value: array}
73
- : {done: true, value: undefined})
74
- : {done: false, value: concat$1(array, result.value)};
75
- });
76
- }
77
-
78
- function slice_slice(length) {
79
- if ((length |= 0) < 0) throw new Error("invalid length");
80
- var that = this, index = this._array.length - this._index;
81
-
82
- // If the request fits within the remaining buffer, resolve it immediately.
83
- if (this._index + length <= this._array.length) {
84
- return Promise.resolve(this._array.subarray(this._index, this._index += length));
85
- }
86
-
87
- // Otherwise, read chunks repeatedly until the request is fulfilled.
88
- var array = new Uint8Array(length);
89
- array.set(this._array.subarray(this._index));
90
- return (function read() {
91
- return that._source.read().then(function(result) {
92
-
93
- // When done, it’s possible the request wasn’t fully fullfilled!
94
- // If so, the pre-allocated array is too big and needs slicing.
95
- if (result.done) {
96
- that._array = empty;
97
- that._index = 0;
98
- return index > 0 ? array.subarray(0, index) : null;
99
- }
100
-
101
- // If this chunk fulfills the request, return the resulting array.
102
- if (index + result.value.length >= length) {
103
- that._array = result.value;
104
- that._index = length - index;
105
- array.set(result.value.subarray(0, length - index), index);
106
- return array;
107
- }
108
-
109
- // Otherwise copy this chunk into the array, then read the next chunk.
110
- array.set(result.value, index);
111
- index += result.value.length;
112
- return read();
113
- });
114
- })();
115
- }
116
-
117
- function slice(source) {
118
- return typeof source.slice === "function" ? source :
119
- new SliceSource(typeof source.read === "function" ? source
120
- : source.getReader());
121
- }
122
-
123
- function SliceSource(source) {
124
- this._source = source;
125
- this._array = empty;
126
- this._index = 0;
127
- }
128
-
129
- SliceSource.prototype.read = slice_read;
130
- SliceSource.prototype.slice = slice_slice;
131
- SliceSource.prototype.cancel = slice_cancel;
132
-
133
- function dbf_cancel() {
134
- return this._source.cancel();
135
- }
136
-
137
- function readBoolean(value) {
138
- return /^[nf]$/i.test(value) ? false
139
- : /^[yt]$/i.test(value) ? true
140
- : null;
141
- }
142
-
143
- function readDate(value) {
144
- return new Date(+value.substring(0, 4), value.substring(4, 6) - 1, +value.substring(6, 8));
145
- }
146
-
147
- function readNumber(value) {
148
- return !(value = value.trim()) || isNaN(value = +value) ? null : value;
149
- }
150
-
151
- function readString(value) {
152
- return value.trim() || null;
153
- }
154
-
155
- var types = {
156
- B: readNumber,
157
- C: readString,
158
- D: readDate,
159
- F: readNumber,
160
- L: readBoolean,
161
- M: readNumber,
162
- N: readNumber
163
- };
164
-
165
- function dbf_read() {
166
- var that = this, i = 1;
167
- return that._source.slice(that._recordLength).then(function(value) {
168
- return value && (value[0] !== 0x1a) ? {done: false, value: that._fields.reduce(function(p, f) {
169
- p[f.name] = types[f.type](that._decode(value.subarray(i, i += f.length)));
170
- return p;
171
- }, {})} : {done: true, value: undefined};
172
- });
173
- }
174
-
175
- function view(array) {
176
- return new DataView(array.buffer, array.byteOffset, array.byteLength);
177
- }
178
-
179
- function dbf(source, decoder) {
180
- source = slice(source);
181
- return source.slice(32).then(function(array) {
182
- var head = view(array);
183
- return source.slice(head.getUint16(8, true) - 32).then(function(array) {
184
- return new Dbf(source, decoder, head, view(array));
185
- });
186
- });
187
- }
188
-
189
- function Dbf(source, decoder, head, body) {
190
- this._source = source;
191
- this._decode = decoder.decode.bind(decoder);
192
- this._recordLength = head.getUint16(10, true);
193
- this._fields = [];
194
- for (var n = 0; body.getUint8(n) !== 0x0d; n += 32) {
195
- for (var j = 0; j < 11; ++j) if (body.getUint8(n + j) === 0) break;
196
- this._fields.push({
197
- name: this._decode(new Uint8Array(body.buffer, body.byteOffset + n, j)),
198
- type: String.fromCharCode(body.getUint8(n + 11)),
199
- length: body.getUint8(n + 16)
200
- });
201
- }
202
- }
203
-
204
- var prototype$2 = Dbf.prototype;
205
- prototype$2.read = dbf_read;
206
- prototype$2.cancel = dbf_cancel;
207
-
208
- function cancel() {
209
- return this._source.cancel();
210
- }
211
-
212
- function parseMultiPoint(record) {
213
- var i = 40, j, n = record.getInt32(36, true), coordinates = new Array(n);
214
- for (j = 0; j < n; ++j, i += 16) coordinates[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
215
- return {type: "MultiPoint", coordinates: coordinates};
216
- }
217
-
218
- function parseNull() {
219
- return null;
220
- }
221
-
222
- function parsePoint(record) {
223
- return {type: "Point", coordinates: [record.getFloat64(4, true), record.getFloat64(12, true)]};
224
- }
225
-
226
- function parsePolygon(record) {
227
- var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m), polygons = [], holes = [];
228
- for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
229
- for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
230
-
231
- parts.forEach(function(i, j) {
232
- var ring = points.slice(i, parts[j + 1]);
233
- if (ringClockwise(ring)) polygons.push([ring]);
234
- else holes.push(ring);
235
- });
236
-
237
- holes.forEach(function(hole) {
238
- polygons.some(function(polygon) {
239
- if (ringContainsSome(polygon[0], hole)) {
240
- polygon.push(hole);
241
- return true;
242
- }
243
- }) || polygons.push([hole]);
244
- });
245
-
246
- return polygons.length === 1
247
- ? {type: "Polygon", coordinates: polygons[0]}
248
- : {type: "MultiPolygon", coordinates: polygons};
249
- }
250
- function ringClockwise(ring) {
251
- if ((n = ring.length) < 4) return false;
252
- var i = 0, n, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];
253
- while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];
254
- return area >= 0;
255
- }
256
-
257
- function ringContainsSome(ring, hole) {
258
- var i = -1, n = hole.length, c;
259
- while (++i < n) {
260
- if (c = ringContains(ring, hole[i])) {
261
- return c > 0;
262
- }
263
- }
264
- return false;
265
- }
266
-
267
- function ringContains(ring, point) {
268
- var x = point[0], y = point[1], contains = -1;
269
- for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {
270
- var pi = ring[i], xi = pi[0], yi = pi[1],
271
- pj = ring[j], xj = pj[0], yj = pj[1];
272
- if (segmentContains(pi, pj, point)) {
273
- return 0;
274
- }
275
- if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) {
276
- contains = -contains;
277
- }
278
- }
279
- return contains;
280
- }
281
-
282
- function segmentContains(p0, p1, p2) {
283
- var x20 = p2[0] - p0[0], y20 = p2[1] - p0[1];
284
- if (x20 === 0 && y20 === 0) return true;
285
- var x10 = p1[0] - p0[0], y10 = p1[1] - p0[1];
286
- if (x10 === 0 && y10 === 0) return false;
287
- var t = (x20 * x10 + y20 * y10) / (x10 * x10 + y10 * y10);
288
- return t < 0 || t > 1 ? false : t === 0 || t === 1 ? true : t * x10 === x20 && t * y10 === y20;
289
- }
290
-
291
- function parsePolyLine(record) {
292
- var i = 44, j, n = record.getInt32(36, true), m = record.getInt32(40, true), parts = new Array(n), points = new Array(m);
293
- for (j = 0; j < n; ++j, i += 4) parts[j] = record.getInt32(i, true);
294
- for (j = 0; j < m; ++j, i += 16) points[j] = [record.getFloat64(i, true), record.getFloat64(i + 8, true)];
295
- return n === 1
296
- ? {type: "LineString", coordinates: points}
297
- : {type: "MultiLineString", coordinates: parts.map(function(i, j) { return points.slice(i, parts[j + 1]); })};
298
- }
299
-
300
- function concat(a, b) {
301
- var ab = new Uint8Array(a.length + b.length);
302
- ab.set(a, 0);
303
- ab.set(b, a.length);
304
- return ab;
305
- }
306
-
307
- function shp_read() {
308
- var that = this;
309
- ++that._index;
310
- return that._source.slice(12).then(function(array) {
311
- if (array == null) return {done: true, value: undefined};
312
- var header = view(array);
313
-
314
- // If the record starts with an invalid shape type (see #36), scan ahead in
315
- // four-byte increments to find the next valid record, identified by the
316
- // expected index, a non-empty content length and a valid shape type.
317
- function skip() {
318
- return that._source.slice(4).then(function(chunk) {
319
- if (chunk == null) return {done: true, value: undefined};
320
- header = view(array = concat(array.slice(4), chunk));
321
- return header.getInt32(0, false) !== that._index ? skip() : read();
322
- });
323
- }
324
-
325
- // All records should have at least four bytes (for the record shape type),
326
- // so an invalid content length indicates corruption.
327
- function read() {
328
- var length = header.getInt32(4, false) * 2 - 4, type = header.getInt32(8, true);
329
- return length < 0 || (type && type !== that._type) ? skip() : that._source.slice(length).then(function(chunk) {
330
- return {done: false, value: type ? that._parse(view(concat(array.slice(8), chunk))) : null};
331
- });
332
- }
333
-
334
- return read();
335
- });
336
- }
337
-
338
- var parsers = {
339
- 0: parseNull,
340
- 1: parsePoint,
341
- 3: parsePolyLine,
342
- 5: parsePolygon,
343
- 8: parseMultiPoint,
344
- 11: parsePoint, // PointZ
345
- 13: parsePolyLine, // PolyLineZ
346
- 15: parsePolygon, // PolygonZ
347
- 18: parseMultiPoint, // MultiPointZ
348
- 21: parsePoint, // PointM
349
- 23: parsePolyLine, // PolyLineM
350
- 25: parsePolygon, // PolygonM
351
- 28: parseMultiPoint // MultiPointM
352
- };
353
-
354
- function shp(source) {
355
- source = slice(source);
356
- return source.slice(100).then(function(array) {
357
- return new Shp(source, view(array));
358
- });
359
- }
360
- function Shp(source, header) {
361
- var type = header.getInt32(32, true);
362
- if (!(type in parsers)) throw new Error("unsupported shape type: " + type);
363
- this._source = source;
364
- this._type = type;
365
- this._index = 0;
366
- this._parse = parsers[type];
367
- this.bbox = [header.getFloat64(36, true), header.getFloat64(44, true), header.getFloat64(52, true), header.getFloat64(60, true)];
368
- }
369
-
370
- var prototype$1 = Shp.prototype;
371
- prototype$1.read = shp_read;
372
- prototype$1.cancel = cancel;
373
-
374
- function noop() {}
375
-
376
- function shapefile_cancel() {
377
- return Promise.all([
378
- this._dbf && this._dbf.cancel(),
379
- this._shp.cancel()
380
- ]).then(noop);
381
- }
382
-
383
- function shapefile_read() {
384
- var that = this;
385
- return Promise.all([
386
- that._dbf ? that._dbf.read() : {value: {}},
387
- that._shp.read()
388
- ]).then(function(results) {
389
- var dbf = results[0], shp = results[1];
390
- return shp.done ? shp : {
391
- done: false,
392
- value: {
393
- type: "Feature",
394
- properties: dbf.value,
395
- geometry: shp.value
396
- }
397
- };
398
- });
399
- }
400
-
401
- function shapefile(shpSource, dbfSource, decoder) {
402
- return Promise.all([
403
- shp(shpSource),
404
- dbfSource && dbf(dbfSource, decoder)
405
- ]).then(function(sources) {
406
- return new Shapefile(sources[0], sources[1]);
407
- });
408
- }
409
-
410
- function Shapefile(shp, dbf) {
411
- this._shp = shp;
412
- this._dbf = dbf;
413
- this.bbox = shp.bbox;
414
- }
415
-
416
- var prototype = Shapefile.prototype;
417
- prototype.read = shapefile_read;
418
- prototype.cancel = shapefile_cancel;
419
-
420
- function open(shp, dbf, options) {
421
- if (typeof dbf === "string") {
422
- if (!/\.dbf$/.test(dbf)) dbf += ".dbf";
423
- dbf = path(dbf);
424
- } else if (dbf instanceof ArrayBuffer || dbf instanceof Uint8Array) {
425
- dbf = array(dbf);
426
- } else if (dbf != null) {
427
- dbf = stream(dbf);
428
- }
429
- if (typeof shp === "string") {
430
- if (!/\.shp$/.test(shp)) shp += ".shp";
431
- if (dbf === undefined) dbf = path(shp.substring(0, shp.length - 4) + ".dbf").catch(function() {});
432
- shp = path(shp);
433
- } else if (shp instanceof ArrayBuffer || shp instanceof Uint8Array) {
434
- shp = array(shp);
435
- } else {
436
- shp = stream(shp);
437
- }
438
- return Promise.all([shp, dbf]).then(function(sources) {
439
- var shp = sources[0], dbf = sources[1], encoding = "windows-1252";
440
- return shapefile(shp, dbf, dbf && new TextDecoder(encoding));
441
- });
442
- }
443
-
444
- const shpToGeojson = (file) => {
445
- return new Promise((resolve, reject) => {
446
- const reader = new FileReader();
447
- reader.readAsArrayBuffer(file);
448
- const data = {
449
- type: "FeatureCollection",
450
- features: []
451
- };
452
- reader.onload = function() {
453
- open(this.result).then((source) => source.read().then(
454
- function log(result) {
455
- if (!result.done) {
456
- data.features.push(result.value);
457
- source.read().then(log);
458
- } else {
459
- if (result.value) {
460
- data.features.push(result.value);
461
- }
462
- resolve(data);
463
- }
464
- }
465
- )).catch(reject);
466
- };
467
- });
468
- };
469
-
470
- const toGeojson = (file) => {
471
- const actions = {
472
- shp: shpToGeojson
473
- };
474
- return new Promise((resolve, reject) => {
475
- const suffix = file.name.split(".").pop();
476
- if (suffix && actions[suffix]) {
477
- resolve(actions[suffix](file));
478
- } else {
479
- reject(new Error(`Can't resolve the .${suffix} file`));
480
- }
481
- });
482
- };
483
-
484
- export { toGeojson as t };