chunk-KMAHKQ2G.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {
  2. B,
  3. P
  4. } from "./chunk-WZQZRKNH.js";
  5. // node_modules/@arcgis/core/layers/support/FieldsIndex.js
  6. function t(e) {
  7. return e.type === "date" || e.type === "esriFieldTypeDate";
  8. }
  9. function s(e) {
  10. return e.type === "oid" || e.type === "esriFieldTypeOID";
  11. }
  12. function l(e) {
  13. return e.type === "global-id" || e.type === "esriFieldTypeGlobalID";
  14. }
  15. var d = class {
  16. constructor(i) {
  17. if (this.fields = i, this._fieldsMap = new Map(), this._dateFieldsSet = new Set(), this._numericFieldsSet = new Set(), this.dateFields = [], this.numericFields = [], this._requiredFields = null, !i)
  18. return;
  19. const d2 = [];
  20. for (const n of i) {
  21. const i2 = n && n.name;
  22. if (i2) {
  23. const u = r(i2);
  24. this._fieldsMap.set(i2, n), this._fieldsMap.set(u, n), d2.push(u), t(n) ? (this.dateFields.push(n), this._dateFieldsSet.add(n)) : B(n) && (this._numericFieldsSet.add(n), this.numericFields.push(n)), s(n) || l(n) || (n.editable = n.editable == null || !!n.editable, n.nullable = n.nullable == null || !!n.nullable);
  25. }
  26. }
  27. d2.sort(), this.uid = d2.join(",");
  28. }
  29. destroy() {
  30. this._fieldsMap.clear();
  31. }
  32. get requiredFields() {
  33. if (!this._requiredFields) {
  34. this._requiredFields = [];
  35. for (const e of this.fields)
  36. s(e) || l(e) || e.nullable || P(e) !== void 0 || this._requiredFields.push(e);
  37. }
  38. return this._requiredFields;
  39. }
  40. has(e) {
  41. return this.get(e) != null;
  42. }
  43. get(e) {
  44. return e != null ? this._fieldsMap.get(e) || this._fieldsMap.get(r(e)) : void 0;
  45. }
  46. isDateField(e) {
  47. return this._dateFieldsSet.has(this.get(e));
  48. }
  49. isNumericField(e) {
  50. return this._numericFieldsSet.has(this.get(e));
  51. }
  52. normalizeFieldName(e) {
  53. const i = this.get(e);
  54. if (i)
  55. return i.name;
  56. }
  57. };
  58. function r(e) {
  59. return e.toLowerCase().trim();
  60. }
  61. export {
  62. d
  63. };
  64. //# sourceMappingURL=chunk-KMAHKQ2G.js.map