@theseam/ui-common 2.0.1-beta.115 → 2.0.1-beta.119

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.
@@ -58,6 +58,19 @@ interface FeatureGroupRegistryOptions {
58
58
  newGroupKeyFactory?: () => string;
59
59
  }
60
60
 
61
+ /** A file the map tried to import and could not read. */
62
+ interface TheSeamMapFileImportError {
63
+ /** The file as the consumer's user chose or dropped it. */
64
+ file: File;
65
+ /**
66
+ * Whatever `readGeoFile` rejected with. Usually an `Error` carrying one of
67
+ * its messages — `Shape data not found.`, `Unable to parse as GeoJSON.` —
68
+ * but a malformed file can surface anything a parser throws, so it is not
69
+ * narrowed.
70
+ */
71
+ error: unknown;
72
+ }
73
+
61
74
  /** Which interaction model a map uses. */
62
75
  type TheSeamMapInteractionMode = 'legacy' | 'grouped';
63
76
 
@@ -135,6 +148,13 @@ declare class GoogleMapsService implements OnDestroy {
135
148
  * an attempt.
136
149
  */
137
150
  readonly deleteBlocked$: Observable<TheSeamMapGroupTarget>;
151
+ /**
152
+ * A file reached one of the import paths and could not be read. Plain
153
+ * `Subject`, not `BehaviorSubject`: a consumer subscribing later should not
154
+ * be handed a failure from before it was listening.
155
+ */
156
+ private readonly _fileImportErrorSubject;
157
+ readonly fileImportError$: Observable<TheSeamMapFileImportError>;
138
158
  private readonly _selectionSubject;
139
159
  /**
140
160
  * `distinctUntilChanged` collapses repeated `null`s. Several paths clear the
@@ -351,6 +371,12 @@ declare class GoogleMapsService implements OnDestroy {
351
371
  allowDrawingHoleInPolygon(allow: boolean): void;
352
372
  setFileInputHandler(handler: ((file: File) => void) | undefined | null): void;
353
373
  getFileInputHandler(): ((file: File) => void) | undefined | null;
374
+ /**
375
+ * Reports a file the library tried to import and could not read. Called by
376
+ * the import controls, not by consumers — a consumer that owns importing
377
+ * through `setFileInputHandler` reports its own failures.
378
+ */
379
+ notifyFileImportError(file: File, error: unknown): void;
354
380
  setInteractionMode(mode: TheSeamMapInteractionMode): void;
355
381
  setGroupOptions(options: FeatureGroupRegistryOptions): void;
356
382
  /**
@@ -596,6 +622,17 @@ declare class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase imp
596
622
  streetViewControlEnabled: boolean;
597
623
  allowDrawingHoleInPolygon: boolean;
598
624
  editingEnabled: boolean;
625
+ /**
626
+ * Intercepts a file the user chose or dropped, in place of the library's own
627
+ * import handling. Covers **both** import paths: a file picked through the
628
+ * upload button and one dropped onto the map (`fileDropEnabled` defaults to
629
+ * `true`, so setting this now also intercepts drops a consumer relying on
630
+ * the default previously had handled internally).
631
+ *
632
+ * Once called, the consumer owns the file, including reporting any failure
633
+ * in its own UI — `fileImportError` will not fire for a file handed to this
634
+ * handler.
635
+ */
599
636
  set fileImportHandler(value: ((file: File) => void) | undefined | null);
600
637
  get _attrDisabled(): true | null;
601
638
  get _attrTabIndex(): number;
@@ -659,6 +696,15 @@ declare class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase imp
659
696
  * so the consumer can explain why; only the consumer knows the reason.
660
697
  */
661
698
  deleteBlocked: EventEmitter<TheSeamMapGroupTarget>;
699
+ /**
700
+ * A file reached one of the import paths and could not be read — a corrupt
701
+ * archive, a `.zip` of something else, malformed GeoJSON. Emitted so the
702
+ * consumer can say so in its own UI; the library has nowhere to show it.
703
+ *
704
+ * Not emitted for a file a `fileImportHandler` took: once the consumer owns
705
+ * the file, it owns reporting the outcome too.
706
+ */
707
+ fileImportError: EventEmitter<TheSeamMapFileImportError>;
662
708
  featureContextMenu: MenuComponent;
663
709
  _options: {
664
710
  mapTypeControl: boolean;
@@ -703,7 +749,7 @@ declare class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase imp
703
749
  setEditMode(enabled: boolean): void;
704
750
  isEditMode(): boolean;
705
751
  static ɵfac: i0.ɵɵFactoryDeclaration<TheSeamGoogleMapsComponent, never>;
706
- static ɵcmp: i0.ɵɵComponentDeclaration<TheSeamGoogleMapsComponent, "seam-google-maps", ["seamGoogleMaps"], { "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "fileDropEnabled": { "alias": "fileDropEnabled"; "required": false; }; "fileUploadControlEnabled": { "alias": "fileUploadControlEnabled"; "required": false; }; "fullscreenControlEnabled": { "alias": "fullscreenControlEnabled"; "required": false; }; "reCenterControlEnabled": { "alias": "reCenterControlEnabled"; "required": false; }; "mapTypeControlEnabled": { "alias": "mapTypeControlEnabled"; "required": false; }; "streetViewControlEnabled": { "alias": "streetViewControlEnabled"; "required": false; }; "allowDrawingHoleInPolygon": { "alias": "allowDrawingHoleInPolygon"; "required": false; }; "editingEnabled": { "alias": "editingEnabled"; "required": false; }; "fileImportHandler": { "alias": "fileImportHandler"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "longitude": { "alias": "longitude"; "required": false; }; "latitude": { "alias": "latitude"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "interactionMode": { "alias": "interactionMode"; "required": false; }; "featureGroupProperty": { "alias": "featureGroupProperty"; "required": false; }; "featureLabelProperty": { "alias": "featureLabelProperty"; "required": false; }; "newGroupKeyFactory": { "alias": "newGroupKeyFactory"; "required": false; }; "selectedGroupKey": { "alias": "selectedGroupKey"; "required": false; }; "canDelete": { "alias": "canDelete"; "required": false; }; }, { "mapReady": "mapReady"; "selectionChange": "selectionChange"; "featureHoverChange": "featureHoverChange"; "deleteBlocked": "deleteBlocked"; }, never, never, false, never>;
752
+ static ɵcmp: i0.ɵɵComponentDeclaration<TheSeamGoogleMapsComponent, "seam-google-maps", ["seamGoogleMaps"], { "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "fileDropEnabled": { "alias": "fileDropEnabled"; "required": false; }; "fileUploadControlEnabled": { "alias": "fileUploadControlEnabled"; "required": false; }; "fullscreenControlEnabled": { "alias": "fullscreenControlEnabled"; "required": false; }; "reCenterControlEnabled": { "alias": "reCenterControlEnabled"; "required": false; }; "mapTypeControlEnabled": { "alias": "mapTypeControlEnabled"; "required": false; }; "streetViewControlEnabled": { "alias": "streetViewControlEnabled"; "required": false; }; "allowDrawingHoleInPolygon": { "alias": "allowDrawingHoleInPolygon"; "required": false; }; "editingEnabled": { "alias": "editingEnabled"; "required": false; }; "fileImportHandler": { "alias": "fileImportHandler"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "longitude": { "alias": "longitude"; "required": false; }; "latitude": { "alias": "latitude"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "interactionMode": { "alias": "interactionMode"; "required": false; }; "featureGroupProperty": { "alias": "featureGroupProperty"; "required": false; }; "featureLabelProperty": { "alias": "featureLabelProperty"; "required": false; }; "newGroupKeyFactory": { "alias": "newGroupKeyFactory"; "required": false; }; "selectedGroupKey": { "alias": "selectedGroupKey"; "required": false; }; "canDelete": { "alias": "canDelete"; "required": false; }; }, { "mapReady": "mapReady"; "selectionChange": "selectionChange"; "featureHoverChange": "featureHoverChange"; "deleteBlocked": "deleteBlocked"; "fileImportError": "fileImportError"; }, never, never, false, never>;
707
753
  }
708
754
 
709
755
  /**
@@ -731,10 +777,15 @@ declare class TheSeamMapFileDropComponent implements OnInit, OnDestroy {
731
777
  private _disableFileDrop;
732
778
  private readonly _handleDragOverEvent;
733
779
  private readonly _handleDropEvent;
780
+ /**
781
+ * Routes a dropped file the same way the upload button routes a chosen one,
782
+ * so `fileImportHandler` means "the consumer owns imported files" whichever
783
+ * way the file arrived.
784
+ */
785
+ private _importDroppedFile;
734
786
  private readonly _handleDragEnterEvent;
735
787
  private readonly _handleDragLeaveEvent;
736
788
  private _dropAllowed;
737
- private _isSupportedDataTransfer;
738
789
  private _isSupportedDataTransferTypes;
739
790
  static ɵfac: i0.ɵɵFactoryDeclaration<TheSeamMapFileDropComponent, never>;
740
791
  static ɵcmp: i0.ɵɵComponentDeclaration<TheSeamMapFileDropComponent, "seam-map-file-drop", never, {}, {}, never, never, false, never>;
@@ -763,6 +814,7 @@ declare class TheSeamGoogleMapsUploadButtonControlComponent implements OnDestroy
763
814
  ngOnDestroy(): void;
764
815
  private _getFile;
765
816
  private _importFile;
817
+ private _reportImportError;
766
818
  private _createHiddenInput;
767
819
  private _createTemporaryFormElement;
768
820
  /**
@@ -1260,4 +1312,4 @@ declare class TheSeamNoopGoogleMapsAPILoader extends TheSeamGoogleMapsApiLoader
1260
1312
  }
1261
1313
 
1262
1314
  export { AppFeaturePropertyName, FEATURE_STYLE_OPTIONS_DEFAULT, FEATURE_STYLE_OPTIONS_SELECTED, FEATURE_STYLE_OVERRIDE_OPTIONS_HOVERED, GoogleMapsContextMenu, GoogleMapsControlsService, GoogleMapsService, MAP_CONTROLS_SERVICE, MAP_CONTROL_DATA, MapControlRef, MapValueManagerService, MapValueSource, SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS, SUPPORTED_PROPERTY_STYLE_OPTIONS, THESEAM_LAZY_MAPS_API_CONFIG, TheSeamGoogleMapsApiLoader, TheSeamGoogleMapsComponent, TheSeamGoogleMapsModule, TheSeamGoogleMapsPlacesAutoCompleteComponent, TheSeamGoogleMapsPlacesAutocompleteDirective, TheSeamGoogleMapsRecenterButtonControlComponent, TheSeamGoogleMapsUploadButtonControlComponent, TheSeamLazyMapsApiLoader, TheSeamMapFileDropComponent, TheSeamMapsControlComponent, TheSeamNoopGoogleMapsAPILoader, applyHoleToFeature, buildDeleteMenuItems, computeFeatureHoverStyle, computeFeatureStyle, createFeatureChangeObservable, dataMultiPolygonFromGeoJson, dataPolygonFromGeoJson, featureAllows, geoJsonFeatureFromDataFeature, geoJsonPolygonFromDataFeature, getBoundsWithAllFeatures, getFeatureBounds, getFeatureCenter, getFeaturesCount, getHoveredStyleOptionsDefinedByFeature, getSelectedStyleOptionsDefinedByFeature, getStyleOptionsDefinedByFeature, isAppFeatureProperty, isFeatureSelected, mergeStyleOptions, polygonCoordinates, polygonHasValidPathsLengths, polygonsFromDataFeature, removeAllFeatures, setFeatureSelected, stripAppFeaturePropertiesFromJson };
1263
- export type { GoogleMapsRecenterButtonControlData, GoogleMapsUploadButtonControlData, MapControl, MapControlsService, MapValue, MapValueChange, TheSeamLazyMapsApiLoaderConfig, TheSeamMapContextMenuItem, TheSeamMapDeleteMenuContext, TheSeamMapFeatureGroup, TheSeamMapFeatureStyleContext, TheSeamMapGroupTarget, TheSeamMapInteractionMode };
1315
+ export type { GoogleMapsRecenterButtonControlData, GoogleMapsUploadButtonControlData, MapControl, MapControlsService, MapValue, MapValueChange, TheSeamLazyMapsApiLoaderConfig, TheSeamMapContextMenuItem, TheSeamMapDeleteMenuContext, TheSeamMapFeatureGroup, TheSeamMapFeatureStyleContext, TheSeamMapFileImportError, TheSeamMapGroupTarget, TheSeamMapInteractionMode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theseam/ui-common",
3
- "version": "2.0.1-beta.115",
3
+ "version": "2.0.1-beta.119",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^20.2.3",
6
6
  "@angular/common": "^20.3.0",
package/utils/index.d.ts CHANGED
@@ -219,6 +219,17 @@ declare function noInnerRingsValidator(): ValidatorFn;
219
219
  declare const NO_KINKS_VALIDATOR_NAME = "no-kinks";
220
220
  declare function noKinksValidator(): ValidatorFn;
221
221
 
222
+ /**
223
+ * Property key under which `readGeoFile` records the archive member a feature
224
+ * came from, for shapefile archives only.
225
+ *
226
+ * A zip can hold one shapefile per field, and once their features are
227
+ * concatenated the member name is the only thing distinguishing them — for
228
+ * some producer exports it is the only usable name at all, because the `.dbf`
229
+ * carries nothing but numbers. The value is the member's basename, without its
230
+ * directory or extension.
231
+ */
232
+ declare const GEO_FILE_SOURCE_NAME_PROPERTY = "seamSourceFileName";
222
233
  /**
223
234
  * Reads a File, or buffer of file content, in GeoJSON or ESRI Shapefile format
224
235
  * and returns a GeoJSON `FeatureCollection`.
@@ -484,5 +495,5 @@ interface SanitizeFilenameOptions {
484
495
  }
485
496
  declare function sanitizeFilename(filename: string, options?: SanitizeFilenameOptions): string;
486
497
 
487
- export { IS_FEATURE_COLLECTION_VALIDATOR_NAME, IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME, MIN_MAX_POINTS_VALIDATOR_NAME, NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME, NO_INNER_RINGS_VALIDATOR_NAME, NO_KINKS_VALIDATOR_NAME, PollingTickerOptions, Refreshable, activatedRoutesWithDataProperty, addHoleToPolygon, arrayMoveImmutable, arrayMoveMutable, calcPercentage, closePolygons, coerceFeatureCollection, createPadding, deleteProperties, deleteProperty, fileBufferToBlob, fileBufferToObjectUrl, fileDataFromBuffer, fractionalDigitsCount, geoJsonToArea, getAttribute, getClosestWidgetCdkDrag, getControlName, getControlPath, hasAttribute, hasProperty, hasRequiredControl, isAbsoluteUrl, isEmptyInputValue, isEmptyUrlRoute, isFeatureCollectionValidator, isNullOrUndefined, isNullOrUndefinedOrEmpty, isNumeric, isOnlyGeometryTypes, isOnlyGeometryTypesValidator, leafChildRoute, loadStyle, loadStyleSheet, mapEach, mergePolygons, minMaxPointsValidator, noEmptyFeatureCollectionValidator, noInnerRingsValidator, noKinksValidator, notNullOrUndefined, notNullOrUndefinedOrEmpty, observeControlIsDifferent, observeControlStatus, observeControlValid, observeControlValue, observeControlValueChange, observeQueryList, openBlob, padEnd, padStart, phoneNumberMask, pollingTicker, polygonContains, polygonHasMinDistinctVertices, polygonViolatesMinMax, readFileAsDataUrlAsync, readFileAsync, readGeoFile, ringIsClockwise, routeSnapshotPathFull, routeSnapshotPathRelative, sanitizeFilename, splitMultiPolygons, stripOuter, subscriberCount, tapFirst, toggleAttribute, trimRepeated, waitOnConditionAsync, waitOnNonPendingStatus, willHaveDataProp, withoutProperties, withoutProperty, wrapIntoObservable };
498
+ export { GEO_FILE_SOURCE_NAME_PROPERTY, IS_FEATURE_COLLECTION_VALIDATOR_NAME, IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME, MIN_MAX_POINTS_VALIDATOR_NAME, NO_EMPTY_FEATURE_COLLECTION_VALIDATOR_NAME, NO_INNER_RINGS_VALIDATOR_NAME, NO_KINKS_VALIDATOR_NAME, PollingTickerOptions, Refreshable, activatedRoutesWithDataProperty, addHoleToPolygon, arrayMoveImmutable, arrayMoveMutable, calcPercentage, closePolygons, coerceFeatureCollection, createPadding, deleteProperties, deleteProperty, fileBufferToBlob, fileBufferToObjectUrl, fileDataFromBuffer, fractionalDigitsCount, geoJsonToArea, getAttribute, getClosestWidgetCdkDrag, getControlName, getControlPath, hasAttribute, hasProperty, hasRequiredControl, isAbsoluteUrl, isEmptyInputValue, isEmptyUrlRoute, isFeatureCollectionValidator, isNullOrUndefined, isNullOrUndefinedOrEmpty, isNumeric, isOnlyGeometryTypes, isOnlyGeometryTypesValidator, leafChildRoute, loadStyle, loadStyleSheet, mapEach, mergePolygons, minMaxPointsValidator, noEmptyFeatureCollectionValidator, noInnerRingsValidator, noKinksValidator, notNullOrUndefined, notNullOrUndefinedOrEmpty, observeControlIsDifferent, observeControlStatus, observeControlValid, observeControlValue, observeControlValueChange, observeQueryList, openBlob, padEnd, padStart, phoneNumberMask, pollingTicker, polygonContains, polygonHasMinDistinctVertices, polygonViolatesMinMax, readFileAsDataUrlAsync, readFileAsync, readGeoFile, ringIsClockwise, routeSnapshotPathFull, routeSnapshotPathRelative, sanitizeFilename, splitMultiPolygons, stripOuter, subscriberCount, tapFirst, toggleAttribute, trimRepeated, waitOnConditionAsync, waitOnNonPendingStatus, willHaveDataProp, withoutProperties, withoutProperty, wrapIntoObservable };
488
499
  export type { IActivatedRouteWithData, IFileData, PollingActionFn, RefreshableOptions, SanitizeFilenameOptions, SubscriberCountChangedFn };