UNPKG

@arcgis/map-components

Version:
366 lines (364 loc) • 16.4 kB
/// <reference types="@arcgis/core/interfaces.d.ts" /> /// <reference types="../../index.d.ts" /> import { default as PrintViewModel } from '@arcgis/core/widgets/Print/PrintViewModel.js'; import { JsxNode, PublicLitElement as LitElement, TargetedEvent } from '@arcgis/lumina'; import { Use } from '@arcgis/lumina/controllers'; import { HeadingLevel } from '../../support/heading'; import { ArcgisReferenceElement } from '../../utils/component-utils'; import { Formats } from './types'; declare const usePrintViewModel: (component: LitElement & Pick<PrintViewModel, never> & import('../../controllers/useViewModel').ViewModelControllerUses<PrintViewModel>) => PrintViewModel; /** * The Print component connects your application with a [printing service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-the-portal-to-print-maps.htm) to allow the map to be printed. * It takes advantage of server-side, high-quality, full cartographic print functionality using the ExportWebMap service of ArcGIS, * which can be configured with custom layout templates. One is provided that shows the map only, while another provides a layout with legend, etc. * The Print component works with the [print](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-print.html) module, which generates a printer-ready version of the map. * * The Print component uses the ArcGIS Online print service by default, but it can be configured to use a custom print service with the [printServiceUrl](#printServiceUrl) property. * The component can preserve map scale or map extent in the printout. By default, the map extent is preserved. Use * [TemplateOptions.scaleEnabled](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-TemplateOptions.html#scaleEnabled) to preserve scale instead. * * The Print component prints a localized date for all [layouts](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PrintTemplate.html#layout) * except `map-only`. If using a custom print service, then `customTextElements` are supported for each print * template. Values found there will be populated in the Print component under `Advanced options`. These values can * be overwritten in the Print component UI, or programmatically using the * [templateCustomTextElements](#templateCustomTextElements) property. * * For more information about printing with the `MAP_ONLY` layout, please see * [exportOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PrintTemplate.html#exportOptions). * * **Known limitations** * * See [print](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-print.html) for a detailed list of known limitations. * * ```html * <arcgis-map item-id="45725ba7d9fb47a0925398919b13d1fa"> * <arcgis-print position="top-right"></arcgis-print> * </arcgis-map> * ``` * * ```js * // get a reference to the component * const components = document.querySelectorAll("arcgis-print"); * * const portal = new Portal({ * url: "https://user.maps.arcgis.com/sharing", * authMode: "immediate", * authorizedCrossOriginDomains: ["https://user.maps.arcgis.com"], * }); * * components.forEach((component) => { * component.portal = portal; * }); * ``` * * [Read more...](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-print/) */ export declare class ArcgisPrint extends LitElement { /** * Indicates whether the component's header is hidden. * * @default false */ hideHeader: boolean; /** * By passing the `id` of the Map or Scene component into this property, you can position components from the `@arcgis/map-components` * package anywhere in the DOM while still maintaining a connection to the Map or Scene. * * See [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component). */ referenceElement?: ArcgisReferenceElement | string; /** * The UI position of a component. * * @default "top-left" */ position: __esri.UIPosition; /** * Icon which represents the component. * Typically used when the component is controlled by another component (e.g. by the Expand component). * * @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/) * @default "print" */ icon?: string; /** * Specify the print output file format(s) that the user can select based on the options available from the print service. * This property can take a string value or an array of string values. * * When this value is "all" (default value), all the print service formats are available to be used. * When an array of string values is used, only those values that match the options available from the print service will be used. * If none of the input string values match those available from the print service, `allowedFormats` will fallback to default behavior. * * @default "all" */ allowedFormats: string | string[]; /** * Specify the print output layout(s) that the user can select based on the options available from the print service. * This property can take a string value or an array of string values. * * When this value is "all" (default value), all the print service layouts are available to be used. * When an array of string values is used, only those values that match the options available from the print service will be used. * If none of the input string values match those available from the print service, `allowedLayouts` will fallback to default behavior. * * @default "all" */ allowedLayouts: string | string[]; /** @internal */ browseTemplateButtonOnClick?: () => void; /** * Specifies the print output file format(s) that the user can select when saving the exported map printout. * This property can take a string value or an array of string values. */ allowedFormatsForSaving?: Formats; /** The collection of links exported from the Print component. */ exportedLinks: __esri.Collection<__esri.FileLink>; /** This option allows passing extra parameters (in addition to [templateOptions](#templateOptions)) to the print (export webmap) requests. */ extraParameters: any; /** * Indicates the heading level to use for the "Exported files" text where users can * access the exported map printout. By default, this text is rendered * as a level 3 heading (e.g. `<h3>Exported files</h3>`). Depending on the component's placement * in your app, you may need to adjust this heading for proper semantics. This is * important for meeting accessibility standards. * * @default 3 */ headingLevel: HeadingLevel; /** * Indicates whether or not to include [defaultTemplates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html#defaultTemplates). * * @default false */ excludeDefaultTemplates: boolean; /** * Indicates whether or not to include templates from an organization's portal. * * @default false */ excludeOrganizationTemplates: boolean; /** The [spatial reference](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html) used to render the printed map on the server. */ outSpatialReference: nullish | __esri.SpatialReference; /** * It is possible to search a specified portal instance's [locator services](https://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm). * Use this property to set this [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) instance to search. * This is especially helpful when working with a [custom template](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-CustomTemplate.html). * * If this property is set, it is not necessary to set the [printServiceUrl](#printServiceUrl) property. */ portal: __esri.Portal; /** * The initial state of the print area toggle in the Print component UI. * When set to `true`, the print area toggle is enabled by default. * When set to `false`, the print area toggle is disabled by default. * * @default false */ showPrintAreaEnabled: boolean; /** * The URL of the REST endpoint of the Export Web Map Task. * Defaults to the ArcGIS Online print service if this property is not specified. * If the [portal](#portal) property is set, this property will use the portal's print service URL. */ printServiceUrl: string | nullish; /** @internal */ saveAsButtonCallback?: (exportedLink: __esri.FileLink) => Promise<__esri.PortalItem>; /** * An object containing an array of `customTextElements` name-value pair objects * for each print template in a custom print service. Use this property to update * the text for custom text elements on the page layout. * * The Print component calls the `Get Layout Templates Info` task on the GPServer * to discover possible `customTextElements` values for each template. The name of * the task must match `Get Layout Templates Info`, templates must be published * with `customTextElements`, and values must be strings. Values found there will be * populated in the Print component under `Advanced options`. These values can be * overwritten in the Print component UI, or programmatically using this property. * To list all print templates available on the print service to see * see which templates were published with `customTextElements`, use the * [effectiveTemplateCustomTextElements](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html#effectiveTemplateCustomTextElements) * property. */ templateCustomTextElements: nullish | HashMap<HashMap<string>[]>; /** Defines the layout template options used by the Print component to generate the print page. */ templateOptions: __esri.TemplateOptions; /** * If true, the component will not be destroyed automatically when it is * disconnected from the document. This is useful when you want to move the * component to a different place on the page, or temporarily hide it. If this * is set, make sure to call the [destroy](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-print/#destroy) method when you are done to * prevent memory leaks. * * @default false */ autoDestroyDisabled: boolean; /** * Replace localized message strings with your own strings. * * _**Note**: Individual message keys may change between releases._ */ messageOverrides?: typeof this.messages._overrides; /** The component's default label. */ label?: string; /** * The state of the Print component. * * @default "disabled" */ readonly state: "ready" | "disabled" | "error" | "initializing"; /** Permanently destroy the component. */ destroy(): Promise<void>; /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */ readonly arcgisPropertyChange: TargetedEvent<this, { name: "state"; }>; /** Emitted when the component associated with a map or scene view is is ready to be interacted with. */ readonly arcgisReady: TargetedEvent<this, void>; /** Emitted when the component is complete. */ readonly arcgisComplete: TargetedEvent<this, __esri.PrintCompleteEvent>; /** Emitted when the component is submitted. */ readonly arcgisSubmit: TargetedEvent<this, __esri.PrintSubmitEvent>; private messages: { componentLabel: string; title: string; fileName: string; titlePlaceHolder: string; fileNamePlaceHolder: string; formatDefaultOption: string; fileFormatTitle: string; layoutTitle: string; layoutDefaultOption: string; scale: string; scaleLabel: string; reset: string; author: string; copyright: string; legend: string; lock: string; swap: string; panelToggle: string; advancedOptions: string; width: string; height: string; dpi: string; attribution: string; northArrow: string; scaleBar: string; outSpatialReference: string; invalidWkid: string; layoutTab: string; mapOnlyTab: string; printPreview: string; browseTemplates: string; untitled: string; pending: string; ready: string; linkReady: string; errorMessage: string; exportWebMapError: string; exportWebMapCIMError: string; exportedLinksList: string; sceneViewError: string; noViewError: string; serviceError: string; export: string; exportDescription: string; noExportedFiles: string; exportsTab: string; selectTemplate: string; selectTemplateDescription: string; exportHint: string; template: string; "a3-landscape": string; "a3-portrait": string; "a4-landscape": string; "a4-portrait": string; "letter-ansi-a-landscape": string; "letter-ansi-a-portrait": string; "tabloid-ansi-b-landscape": string; "tabloid-ansi-b-portrait": string; defaultTemplates: string; organizationTemplates: string; chooseTemplate: string; templateList: string; generatingExport: string; beta: string; templatesNoLongerAvailable: string; templatesNoLongerAvailableDescription: string; myTemplates: string; saveExportToMyContent: string; saveAs: string; openItem: string; } & import('@arcgis/lumina/controllers').T9nMeta<{ componentLabel: string; title: string; fileName: string; titlePlaceHolder: string; fileNamePlaceHolder: string; formatDefaultOption: string; fileFormatTitle: string; layoutTitle: string; layoutDefaultOption: string; scale: string; scaleLabel: string; reset: string; author: string; copyright: string; legend: string; lock: string; swap: string; panelToggle: string; advancedOptions: string; width: string; height: string; dpi: string; attribution: string; northArrow: string; scaleBar: string; outSpatialReference: string; invalidWkid: string; layoutTab: string; mapOnlyTab: string; printPreview: string; browseTemplates: string; untitled: string; pending: string; ready: string; linkReady: string; errorMessage: string; exportWebMapError: string; exportWebMapCIMError: string; exportedLinksList: string; sceneViewError: string; noViewError: string; serviceError: string; export: string; exportDescription: string; noExportedFiles: string; exportsTab: string; selectTemplate: string; selectTemplateDescription: string; exportHint: string; template: string; "a3-landscape": string; "a3-portrait": string; "a4-landscape": string; "a4-portrait": string; "letter-ansi-a-landscape": string; "letter-ansi-a-portrait": string; "tabloid-ansi-b-landscape": string; "tabloid-ansi-b-portrait": string; defaultTemplates: string; organizationTemplates: string; chooseTemplate: string; templateList: string; generatingExport: string; beta: string; templatesNoLongerAvailable: string; templatesNoLongerAvailableDescription: string; myTemplates: string; saveExportToMyContent: string; saveAs: string; openItem: string; }>; } export {};