UNPKG

@arcgis/map-components

Version:
106 lines (105 loc) 8.34 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { c as o } from "../../chunks/runtime.js"; import { css as r, html as t } from "lit"; import { watch as s } from "@arcgis/core/core/reactiveUtils.js"; import { LitElement as c } from "@arcgis/lumina"; import { u as h } from "../../chunks/useHandles.js"; const u = r`.advanced-options-container{padding:var(--calcite-spacing-xxs);display:flex;flex-direction:column;gap:var(--calcite-spacing-xs)}`, d = [ "catalog-footprint", "geojson", "csv", "graphics", "kml", "map-notes", "stream" ]; function p(i) { if (!i) return !1; const { map: e, graphics: n } = i; return n?.length ? !0 : e?.allLayers.some((a) => { if (a.type === "feature" && "source" in a) { const { type: l } = a.source; return l !== "feature-layer" && l !== "ogc-feature"; } return d.includes(a.type); }) ?? !1; } function m(i) { const e = i?.map; return !!e && e.tables.length > 0; } class g extends c { constructor() { super(...arguments), this._handles = h("disconnect"), this.autoPopulateAuthor = !1, this.hideFeatureAttributes = !1, this.hideIncludeTables = !1; } static { this.properties = { _selectedTemplate: 16, _showAuthorInput: 16, _showCopyrightInput: 16, _showLegendInput: 16, _showNorthArrowInput: 16, _showScaleBarInput: 16, _showForceFeatureAttributes: 16, _showTablesInput: 16, autoPopulateAuthor: 5, viewModel: 0, messages: 0, hideFeatureAttributes: 5, hideIncludeTables: 5 }; } static { this.styles = u; } loaded() { this.manager.onLifecycle(() => [ s(() => this.viewModel.templateOptions.id, (e) => { this._handles.removeHandles("template-handle"), this._selectedTemplate = e ? this.viewModel.getLayoutTemplateById(e) ?? void 0 : void 0, this._handles.addHandles(s(() => [ this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText, this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText, this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend, this._selectedTemplate?.mapSurroundInfoOptions?.northArrow?.length, this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar?.length ], () => { this._showAuthorInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText ?? !0, this._showCopyrightInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText ?? !0, this._showLegendInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend ?? !0, this._showNorthArrowInput = !!this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length, this._showScaleBarInput = !!this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length, this._showForceFeatureAttributes = p(this.viewModel.view) && !!this._selectedTemplate?.layoutItem?.id && !this.hideFeatureAttributes, this._showTablesInput = m(this.viewModel.view) && !!this._selectedTemplate?.layoutItem?.id && !this.hideIncludeTables; }, { initial: !0 }), "template-handle"); }, { initial: !0 }), s(() => [this.viewModel.portal?.user, this.autoPopulateAuthor], () => { !this.viewModel.templateOptions.author && this.autoPopulateAuthor && this.viewModel.portal?.user?.username && (this.viewModel.templateOptions.author = this.viewModel.portal.user.username, this.requestUpdate()); }, { initial: !0 }) ]); } render() { return t`<div aria-labelledby=${`${this.el.id}__advancedOptionsForLayout`} class="advanced-options-container">${this._renderScaleSection()}${this._renderAuthorSection()}${this._renderCopyrightSection()}${this._renderDpiSection()}${this._renderOutSpatialReferenceSection()}${this._renderDatumTransformationSection()}${this._renderCustomTextElementSection()}${this._renderLegendSection()}${this._renderNorthArrowSection()}${this._renderScaleBarSection()}${this._renderForceFeatureAttributesSection()}${this._renderIncludeTablesSection()}</div>`; } _renderScaleSection() { return t`<arcgis-print-scale-section .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-scale-section>`; } _renderAuthorSection() { return this._showAuthorInput ? t`<div><calcite-label>${this.messages.author}<calcite-input .value=${this.viewModel.templateOptions.author ?? ""} @calciteInputInput=${(e) => this.viewModel.templateOptions.author = e.target.value}></calcite-input></calcite-label></div>` : null; } _renderCopyrightSection() { return this._showCopyrightInput ? t`<div><calcite-label>${this.messages.copyright}<calcite-input .value=${this.viewModel.templateOptions.copyright ?? ""} @calciteInputInput=${(e) => this.viewModel.templateOptions.copyright = e.target.value}></calcite-input></calcite-label></div>` : null; } _renderDpiSection() { return t`<arcgis-print-dpi-input .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-dpi-input>`; } _renderOutSpatialReferenceSection() { return t`<arcgis-print-out-spatial-reference-input .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-out-spatial-reference-input>`; } _renderDatumTransformationSection() { return t`<arcgis-print-datum-transformation-input .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-datum-transformation-input>`; } _renderCustomTextElementSection() { return t`<arcgis-print-custom-text-elements .viewModel=${this.viewModel}></arcgis-print-custom-text-elements>`; } _renderLegendSection() { return this._showLegendInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.legendEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.legendEnabled = e.target.checked}></calcite-checkbox>${this.messages.legend}</calcite-label>${this.viewModel.templateOptions.legendEnabled ? t`<calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.dynamicLegendEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.dynamicLegendEnabled = e.target.checked}></calcite-checkbox>${this.messages.dynamicLegend}</calcite-label>` : null}</div>` : null; } _renderNorthArrowSection() { return this._showNorthArrowInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.northArrowEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.northArrowEnabled = e.target.checked}></calcite-checkbox>${this.messages.northArrow}</calcite-label></div>` : null; } _renderScaleBarSection() { return this._showScaleBarInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.scaleBarEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.scaleBarEnabled = e.target.checked}></calcite-checkbox>${this.messages.scaleBar}</calcite-label>${this.viewModel.templateOptions.scaleBarEnabled && !this._selectedTemplate?.layoutItem?.id ? t`<calcite-label>${this.messages.scaleBarUnit}<calcite-select label="Scale bar unit" .value=${this.viewModel.templateOptions.scaleBarUnit || void 0} @calciteSelectChange=${(e) => { this.viewModel.templateOptions.scaleBarUnit = e.target.value; }}><calcite-option value=kilometers>${this.messages.milesAndKilometers}</calcite-option><calcite-option value=meters>${this.messages.feetAndMeters}</calcite-option></calcite-select></calcite-label>` : null}</div>` : null; } _renderForceFeatureAttributesSection() { return this._showForceFeatureAttributes ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.forceFeatureAttributes} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.forceFeatureAttributes = e.target.checked}></calcite-checkbox>${this.messages.forceFeatureAttributes}</calcite-label></div>` : null; } _renderIncludeTablesSection() { return this._showTablesInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.includeTables} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.includeTables = e.target.checked}></calcite-checkbox>${this.messages.includeTables}</calcite-label></div>` : null; } } o("arcgis-print-layout-advanced-options", g); export { g as PrintLayoutAdvancedOptions };