@arcgis/core 4.27.0-next.20230421 → 4.27.0-next.20230422
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/085e9a46ee3a8a1a5e20.js +1 -0
- package/assets/esri/core/workers/chunks/5f3899efbb967c6e8422.js +1 -0
- package/assets/esri/core/workers/chunks/f47046967c3b13996a14.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
- package/assets/esri/themes/base/widgets/_FeatureMedia.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_en.json +1 -1
- package/chunks/Button.js +5 -0
- package/chunks/ColorSet.js +5 -0
- package/chunks/DefaultTheme.js +5 -0
- package/chunks/Theme.js +5 -0
- package/chunks/Tick.js +5 -0
- package/chunks/Tooltip.js +5 -0
- package/interfaces.d.ts +6 -0
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureMedia/chartCommon.js +5 -0
- package/widgets/Feature/FeatureMedia/pieChart.js +5 -0
- package/widgets/Feature/FeatureMedia/xyChart.js +5 -0
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/support/chartUtilsAm5.js +5 -0
- package/assets/esri/core/workers/chunks/353e5b283e0f4416684a.js +0 -1
- package/assets/esri/core/workers/chunks/81529aee5e6efa3afc83.js +0 -1
- package/assets/esri/core/workers/chunks/bcd79124744cd3682c78.js +0 -1
- package/widgets/support/am5chartUtils.js +0 -5
package/widgets/Editor.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as i,on as n,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"./Attachments.js";import h from"./FeatureForm.js";import g from"./FeatureTemplates.js";import f from"./Spinner.js";import _ from"./Widget.js";import{workflowDeprecation as w}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as y}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as b,incrementHeadingLevel as C}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as E}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as S}from"../intl/substitute.js";const L="esri-editor",I=`${L}__panel`,j=`${L}__prompt`,P={base:`${L} esri-widget esri-widget--panel`,message:`${L}__message`,actions:`${L}__actions`,helpMessage:`${L}__help-message`,progressBar:`${L}__progress-bar`,panelToolbar:`${I}-toolbar`,panelContent:`${I}-content`,panelContentMessage:`${I}-content__message`,panelContentSection:`${I}-content__section`,panelContentSectionGroup:`${I}-content__section__group`,panelContentScrimContainer:`${I}-content__scrim-container`,settingsContainer:`${L}__settings`,updateFeaturesActionButtons:`${L}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${L}__update-features-action-buttons--button`,featureTemplatesContainer:`${L}__feature-templates-container`,ownerAdminNotice:`${L}__owner-admin-notice`,templateItemContentEnd:`${L}__template-item-content-end`,templateItemContentEndSuccess:`${L}__template-item-content-end--success`,templateItemContentEndError:`${L}__template-item-content-end--error`,templateItemLoader:`${L}__template-item-loader`,promptContainer:j,promptHeader:`${j}__header`,promptHeading:`${j}__header__heading`,promptMessage:`${j}__message`,promptDivider:`${j}__divider`,promptActions:`${j}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},U={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function B(e){requestAnimationFrame((()=>e.setFocus()))}const $="esri.widgets.Editor",D=a.getLogger($);let O=class extends(s(_)){constructor(e,t){super(e,t),this._featureForm=new h,this._attachments=new u({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1,renderItemContentEnd:e=>this._renderTemplateContentEnd(e),renderItemDescription:e=>this._renderTemplateDescription(e),renderItemLabel:e=>this._renderTemplateLabel(e)}),this._filterText="",this._prompt=null,this._spinner=new f,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...U},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:a},...o)=>{const{messagesCommon:i,viewModel:n,visibleElements:r}=this,l=n.sketchViewModel,c=n.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:a,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:i.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},i.undo),W("calcite-button",{key:"redo-button",label:i.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},i.redo)]),...o)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=o();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){this.addHandles([i((()=>C(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const s=this.viewModel;if(s.activeWorkflow)try{await s.cancelWorkflow({force:!s.hasPendingEdits})}catch{return s.featureTemplatesViewModel.select(t,{emit:!1})}if(!e||e.id===t?.id)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.viewModel.startCreateFeaturesWorkflow(a);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(a):this.startCreateFeaturesWorkflowAtFeatureCreation(a)})),i((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,{emit:!1}))),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),i((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),i((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:o}]=e;this._prompt={title:t.errorWarningTitle,message:S(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}}})),i((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),i((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return k({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion.js"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...U,...e,snappingControlsElements:{...U.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return w(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return w(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return w(D,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{key:"empty",class:P.base});const{state:t}=e;return W("div",{key:"base",class:P.base},W("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,_onBack:o}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:o,heading:a.selectTemplate,headingLevel:s},W("div",{key:"feature-templates",class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:o,headingLevel:i,_onBack:n,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?a.editFeature:a.createFeatures,m="update"===l?o.update:o.create,u="create-features"===l&&"create-new"===t.createFeatureState,h="create-features"===l?t.numPendingFeatures:0,g=h>1?S(a.createFeaturesTemplate,{numFeatures:h}):m,f=t.shouldShowAttachments,_=c.inputs.every((e=>!e.visible))&&!f?this._renderMessage(S(a.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),f&&W("div",{key:"attachments"},W(b,{level:C(i)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:i,handleBack:n},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:u})},_,u&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:o.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesCommon:n}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:i.addAttachment,headingLevel:o,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?n.cancel:n.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:a,activeWorkflow:o,headingLevel:i,messages:n,messagesCommon:r}=this;return o?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:i,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),o.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(t).map((({type:e,disabled:t,class:s,clickHandler:a,label:o,...i},n)=>W("calcite-button",{key:`action-${n}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:a,width:"full",...i},o))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:a,actions:o}=e,i=o.secondary;let n;switch(a){case"danger":n="danger";break;case"info":n="brand";break;default:n="neutral"}const r=W("calcite-button",{afterCreate:B,appearance:"solid",key:"prompt-primary-button",kind:n,onclick:o.primary.action,scale:"m",width:i?"half":"full"},o.primary.label),l=i&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:n,onclick:i.action,scale:"m",width:"half"},i.label);return W("calcite-scrim",{key:"prompt"},W("div",{class:`${P.promptContainer}--${a}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(b,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,viewModel:o}=this,{canUpdate:i}=o,n=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!i&&0===n;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s},W("div",{key:"landing-content",class:P.panelContent},i&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),n>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},a.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,a=e?.helpMessage,o=a?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[a]:null;return o?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},o):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(b,{level:C(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(b,{level:C(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderTemplateLabel(e){return e.label}_renderTemplateDescription(e){const t=this._getUploadForTemplateItem(e);if(!t)return null;switch(t.state){case"pending":return this.messages?.uploadingModel;case"error":return t.error?.message;default:return null}}_renderTemplateContentEnd(e){const t=this._getUploadForTemplateItem(e),s=W("calcite-icon",{key:"upload-icon",class:P.templateItemContentEnd,icon:"upload-to"});if(!t)return e.supportsUpload?s:null;switch(t.state){case"success":return W("calcite-icon",{key:"success-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndSuccess),icon:"check"});case"error":return W("calcite-icon",{key:"error-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndError),icon:"exclamation-mark-circle-f"});case"pending":return W("calcite-loader",{class:P.templateItemLoader,inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"});case"cancelled":case"default":return s}}_getUploadForTemplateItem(e){const t=this.activeWorkflow;if("create-features"!==t?.type)return null;const{data:s}=t,{creationInfo:a,upload:o}=s;return a?.template===e.template&&a?.layer===e.layer?o:null}_renderFeatureList(e){const{EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesTemplates:n,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=S(i.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:o}=s.layer,i=l.find((e=>e.layer===s.layer));if(!i)return null;const{attachmentsOnUpdateEnabled:n,supports:r}=i;return(r.includes("update")||r.includes("delete")||n)&&(!a||t?.toLowerCase().includes(a)||o?.toLowerCase().includes(a))})).filter(t).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const u=l.toArray().map((({layer:e})=>p.get(e))).filter(t),h=m>10||this._filterText.length>0;return W(s,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:o,handleBack:a},W("div",{key:"feature-list",class:P.panelContent},W("div",{class:P.panelContentSection},y({enableListScroll:!1,filterEnabled:h,filterText:this._filterText,id:this.id,items:u,messages:{filterPlaceholder:n.filterPlaceholder,noItems:n.noItems,noMatches:n.noMatches},onFilterChange:e=>this._filterText=e,onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0)}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{key:"settings",class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(E,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,o=m(t);return o&&a[o]&&`${a[o]}`||S(this.messages.untitledFeatureTemplate,{id:a[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),M("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),M("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),M("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),T(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([F()],O.prototype,"_onSave",null),e([F()],O.prototype,"_onDelete",null),e([F()],O.prototype,"_onToggleUpdateWorkflow",null),e([F()],O.prototype,"_onBack",null),e([F()],O.prototype,"_onAttachmentAdd",null),e([F()],O.prototype,"_onAttachmentUpdate",null),e([F()],O.prototype,"_onAttachmentDelete",null),O=e([p($)],O);const x=O;export{x as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as n,on as i,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"./Attachments.js";import h from"./FeatureForm.js";import g from"./FeatureTemplates.js";import _ from"./Spinner.js";import f from"./Widget.js";import{workflowDeprecation as w}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as k}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{Heading as b,incrementHeadingLevel as C}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as E}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as S}from"../intl/substitute.js";const L="esri-editor",j=`${L}__panel`,I=`${L}__prompt`,P={base:`${L} esri-widget esri-widget--panel`,message:`${L}__message`,actions:`${L}__actions`,helpMessage:`${L}__help-message`,progressBar:`${L}__progress-bar`,panelToolbar:`${j}-toolbar`,panelContent:`${j}-content`,panelContentMessage:`${j}-content__message`,panelContentSection:`${j}-content__section`,panelContentSectionGroup:`${j}-content__section__group`,panelContentScrimContainer:`${j}-content__scrim-container`,settingsContainer:`${L}__settings`,updateFeaturesActionButtons:`${L}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${L}__update-features-action-buttons--button`,featureTemplatesContainer:`${L}__feature-templates-container`,ownerAdminNotice:`${L}__owner-admin-notice`,templateItemContentEnd:`${L}__template-item-content-end`,templateItemContentEndSuccess:`${L}__template-item-content-end--success`,templateItemContentEndError:`${L}__template-item-content-end--error`,templateItemLoader:`${L}__template-item-loader`,promptContainer:I,promptHeader:`${I}__header`,promptHeading:`${I}__header__heading`,promptMessage:`${I}__message`,promptDivider:`${I}__divider`,promptActions:`${I}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},U={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function B(e){requestAnimationFrame((()=>e.setFocus()))}const $="esri.widgets.Editor",D=a.getLogger($);let O=class extends(s(f)){constructor(e,t){super(e,t),this._featureForm=new h,this._attachments=new u({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1,renderItemContentEnd:e=>this._renderTemplateContentEnd(e),renderItemDescription:e=>this._renderTemplateDescription(e),renderItemLabel:e=>this._renderTemplateLabel(e)}),this._filterText="",this._prompt=null,this._spinner=new _,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...U},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:a},...o)=>{const{messagesCommon:n,viewModel:i,visibleElements:r}=this,l=i.sketchViewModel,c=i.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:a,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:n.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},n.undo),W("calcite-button",{key:"redo-button",label:n.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},n.redo)]),...o)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=o();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){this.addHandles([n((()=>C(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,{emit:!1}))),i((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),n((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),n((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:o}]=e;this._prompt={title:t.errorWarningTitle,message:S(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}}})),n((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),n((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),i((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return y({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion.js"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get useDeprecatedCreateWorkflow(){return this.viewModel.useDeprecatedCreateWorkflow}set useDeprecatedCreateWorkflow(e){this.viewModel.useDeprecatedCreateWorkflow=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...U,...e,snappingControlsElements:{...U.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return w(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return w(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return w(D,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{key:"empty",class:P.base});const{state:t}=e;return W("div",{key:"base",class:P.base},W("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,_onBack:o}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:o,heading:a.selectTemplate,headingLevel:s},W("div",{key:"feature-templates",class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:o,headingLevel:n,_onBack:i,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?a.editFeature:a.createFeatures,m="update"===l?o.update:o.create,u="create-features"===l&&"create-new"===t.createFeatureState,h="create-features"===l?t.numPendingFeatures:0,g=h>1?S(a.createFeaturesTemplate,{numFeatures:h}):m,_=t.shouldShowAttachments,f=c.inputs.every((e=>!e.visible))&&!_?this._renderMessage(S(a.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),_&&W("div",{key:"attachments"},W(b,{level:C(n)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:n,handleBack:i},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:u})},f,u&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:o.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:a,headingLevel:o,messages:n,messagesCommon:i}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:n.addAttachment,headingLevel:o,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?i.cancel:i.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:a,activeWorkflow:o,headingLevel:n,messages:i,messagesCommon:r}=this;return o?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:i.editAttachment,headingLevel:n,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),o.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(t).map((({type:e,disabled:t,class:s,clickHandler:a,label:o,...n},i)=>W("calcite-button",{key:`action-${i}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:a,width:"full",...n},o))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:a,actions:o}=e,n=o.secondary;let i;switch(a){case"danger":i="danger";break;case"info":i="brand";break;default:i="neutral"}const r=W("calcite-button",{afterCreate:B,appearance:"solid",key:"prompt-primary-button",kind:i,onclick:o.primary.action,scale:"m",width:n?"half":"full"},o.primary.label),l=n&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:i,onclick:n.action,scale:"m",width:"half"},n.label);return W("calcite-scrim",{key:"prompt"},W("div",{class:`${P.promptContainer}--${a}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(b,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,viewModel:o}=this,{canUpdate:n}=o,i=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!n&&0===i;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s},W("div",{key:"landing-content",class:P.panelContent},n&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),i>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},a.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,a=e?.helpMessage,o=a?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[a]:null;return o?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},o):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(b,{level:C(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(b,{level:C(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderTemplateLabel(e){return e.label}_renderTemplateDescription(e){const t=this._getUploadForTemplateItem(e);if(!t)return null;switch(t.state){case"pending":return this.messages?.uploadingModel;case"error":return t.error?.message;default:return null}}_renderTemplateContentEnd(e){const t=this._getUploadForTemplateItem(e),s=W("calcite-icon",{key:"upload-icon",class:P.templateItemContentEnd,icon:"upload-to"});if(!t)return e.supportsUpload?s:null;switch(t.state){case"success":return W("calcite-icon",{key:"success-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndSuccess),icon:"check"});case"error":return W("calcite-icon",{key:"error-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndError),icon:"exclamation-mark-circle-f"});case"pending":return W("calcite-loader",{class:P.templateItemLoader,inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"});case"cancelled":case"default":return s}}_getUploadForTemplateItem(e){const t=this.activeWorkflow;if("create-features"!==t?.type)return null;const{data:s}=t,{creationInfo:a,upload:o}=s;return a?.template===e.template&&a?.layer===e.layer?o:null}_renderFeatureList(e){const{EditorPanel:s,_onBack:a,headingLevel:o,messages:n,messagesTemplates:i,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=S(n.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:o}=s.layer,n=l.find((e=>e.layer===s.layer));if(!n)return null;const{attachmentsOnUpdateEnabled:i,supports:r}=n;return(r.includes("update")||r.includes("delete")||i)&&(!a||t?.toLowerCase().includes(a)||o?.toLowerCase().includes(a))})).filter(t).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const u=l.toArray().map((({layer:e})=>p.get(e))).filter(t),h=m>10||this._filterText.length>0;return W(s,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:o,handleBack:a},W("div",{key:"feature-list",class:P.panelContent},W("div",{class:P.panelContentSection},k({enableListScroll:!1,filterEnabled:h,filterText:this._filterText,id:this.id,items:u,messages:{filterPlaceholder:i.filterPlaceholder,noItems:i.noItems,noMatches:i.noMatches},onFilterChange:e=>this._filterText=e,onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0)}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{key:"settings",class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(E,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,o=m(t);return o&&a[o]&&`${a[o]}`||S(this.messages.untitledFeatureTemplate,{id:a[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",null),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),F("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),F("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),F("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),T(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([M()],O.prototype,"_onSave",null),e([M()],O.prototype,"_onDelete",null),e([M()],O.prototype,"_onToggleUpdateWorkflow",null),e([M()],O.prototype,"_onBack",null),e([M()],O.prototype,"_onAttachmentAdd",null),e([M()],O.prototype,"_onAttachmentUpdate",null),e([M()],O.prototype,"_onAttachmentDelete",null),O=e([p($)],O);const x=O;export{x as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{a2 as t,ak as e,a6 as i,ap as s,g as a,ai as n,C as r,M as h,ac as o,a3 as l,Q as d}from"../../../chunks/Theme.js";export{a5 as colorAm5}from"../../../chunks/Theme.js";import{R as u,B as g}from"../../../chunks/Button.js";export{T as TooltipAm5}from"../../../chunks/Tooltip.js";export{C as ColorSetAm5}from"../../../chunks/ColorSet.js";class m extends t{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:this._makeThumb()}),Object.defineProperty(this,"startGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"endGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"_thumbBusy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_startDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_endDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_thumbDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_gripDown",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_addOrientationClass(){this._settings.themeTags=e(this._settings.themeTags,["scrollbar",this._settings.orientation]),this._settings.background||(this._settings.background=u.new(this._root,{themeTags:e(this._settings.themeTags,["main","background"])}))}_makeButton(){return this.children.push(g.new(this._root,{themeTags:["resize","button",this.get("orientation")],icon:i.new(this._root,{themeTags:["icon"]})}))}_makeThumb(){return this.children.push(u.new(this._root,{themeTags:["thumb",this.get("orientation")]}))}_handleAnimation(t){t&&this._disposers.push(t.events.on("stopped",(()=>{this.setPrivateRaw("isBusy",!1),this._thumbBusy=!1})))}_afterNew(){this._addOrientationClass(),super._afterNew();const t=this.startGrip,e=this.endGrip,i=this.thumb,a=this.get("background");a&&this._disposers.push(a.events.on("click",(t=>{this.setPrivateRaw("isBusy",!0);const e=this._display.toLocal(t.point),s=this.width(),a=this.height(),n=this.get("orientation");let r,h,o;r="vertical"==n?(e.y-i.height()/2)/a:(e.x-i.width()/2)/s,"vertical"==n?(h=r*a,o="y"):(h=r*s,o="x");const l=this.get("animationDuration",0);l>0?(this._thumbBusy=!0,this._handleAnimation(this.thumb.animate({key:o,to:h,duration:l,easing:this.get("animationEasing")}))):(this.thumb.set(o,h),this._root.events.once("frameended",(()=>{this.setPrivateRaw("isBusy",!1)})))}))),this._disposers.push(i.events.on("dblclick",(t=>{if(!s(t.originalEvent,this))return;const e=this.get("animationDuration",0),i=this.get("animationEasing");this.animate({key:"start",to:0,duration:e,easing:i}),this.animate({key:"end",to:1,duration:e,easing:i})}))),this._disposers.push(t.events.on("pointerdown",(()=>{this.setPrivateRaw("isBusy",!0),this._startDown=!0,this._gripDown="start"}))),this._disposers.push(e.events.on("pointerdown",(()=>{this.setPrivateRaw("isBusy",!0),this._endDown=!0,this._gripDown="end"}))),this._disposers.push(i.events.on("pointerdown",(()=>{this.setPrivateRaw("isBusy",!0),this._thumbDown=!0,this._gripDown=void 0}))),this._disposers.push(t.events.on("globalpointerup",(()=>{this._startDown&&this.setPrivateRaw("isBusy",!1),this._startDown=!1}))),this._disposers.push(e.events.on("globalpointerup",(()=>{this._endDown&&this.setPrivateRaw("isBusy",!1),this._endDown=!1}))),this._disposers.push(i.events.on("globalpointerup",(()=>{this._thumbDown&&this.setPrivateRaw("isBusy",!1),this._thumbDown=!1}))),this._disposers.push(t.on("x",(()=>{this._updateThumb()}))),this._disposers.push(e.on("x",(()=>{this._updateThumb()}))),this._disposers.push(t.on("y",(()=>{this._updateThumb()}))),this._disposers.push(e.on("y",(()=>{this._updateThumb()}))),this._disposers.push(i.events.on("positionchanged",(()=>{this._updateGripsByThumb()}))),"vertical"==this.get("orientation")?(t.set("x",0),e.set("x",0),this._disposers.push(i.adapters.add("y",(t=>Math.max(Math.min(Number(t),this.height()-i.height()),0)))),this._disposers.push(i.adapters.add("x",(t=>this.width()/2))),this._disposers.push(t.adapters.add("x",(t=>this.width()/2))),this._disposers.push(e.adapters.add("x",(t=>this.width()/2))),this._disposers.push(t.adapters.add("y",(t=>Math.max(Math.min(Number(t),this.height()),0)))),this._disposers.push(e.adapters.add("y",(t=>Math.max(Math.min(Number(t),this.height()),0))))):(t.set("y",0),e.set("y",0),this._disposers.push(i.adapters.add("x",(t=>Math.max(Math.min(Number(t),this.width()-i.width()),0)))),this._disposers.push(i.adapters.add("y",(t=>this.height()/2))),this._disposers.push(t.adapters.add("y",(t=>this.height()/2))),this._disposers.push(e.adapters.add("y",(t=>this.height()/2))),this._disposers.push(t.adapters.add("x",(t=>Math.max(Math.min(Number(t),this.width()),0)))),this._disposers.push(e.adapters.add("x",(t=>Math.max(Math.min(Number(t),this.width()),0)))))}_updateChildren(){super._updateChildren(),(this.isDirty("end")||this.isDirty("start")||this._sizeDirty)&&this.updateGrips()}_changed(){if(super._changed(),this.isDirty("start")||this.isDirty("end")){const t="rangechanged";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,start:this.get("start",0),end:this.get("end",1),grip:this._gripDown})}}updateGrips(){const t=this.startGrip,e=this.endGrip,i=this.get("orientation"),s=this.height(),a=this.width();"vertical"==i?(t.set("y",s*this.get("start",0)),e.set("y",s*this.get("end",1))):(t.set("x",a*this.get("start",0)),e.set("x",a*this.get("end",1)));const n=this.getPrivate("positionTextFunction"),r=Math.round(100*this.get("start",0)),h=Math.round(100*this.get("end",0));let o,l;n?(o=n.call(this,this.get("start",0)),l=n.call(this,this.get("end",0))):(o=r+"%",l=h+"%"),t.set("ariaLabel",this._t("From %1",void 0,o)),t.set("ariaValueNow",""+r),t.set("ariaValueText",r+"%"),t.set("ariaValueMin","0"),t.set("ariaValueMax","100"),e.set("ariaLabel",this._t("To %1",void 0,l)),e.set("ariaValueNow",""+h),e.set("ariaValueText",h+"%"),e.set("ariaValueMin","0"),e.set("ariaValueMax","100")}_updateThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip,s=this.height(),n=this.width();let r=e.x(),h=i.x(),o=e.y(),l=i.y(),d=0,u=1;"vertical"==this.get("orientation")?a(o)&&a(l)&&(this._thumbBusy||t.isDragging()||(t.set("height",l-o),t.set("y",o)),d=o/s,u=l/s):a(r)&&a(h)&&(this._thumbBusy||t.isDragging()||(t.set("width",h-r),t.set("x",r)),d=r/n,u=h/n),!this.getPrivate("isBusy")||this.get("start")==d&&this.get("end")==u||(this.set("start",d),this.set("end",u));const g=this.getPrivate("positionTextFunction"),m=Math.round(100*this.get("start",0)),p=Math.round(100*this.get("end",0));let c,b;g?(c=g.call(this,this.get("start",0)),b=g.call(this,this.get("end",0))):(c=m+"%",b=p+"%"),t.set("ariaLabel",this._t("From %1 to %2",void 0,c,b)),t.set("ariaValueNow",""+m),t.set("ariaValueText",m+"%")}_updateGripsByThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip;if("vertical"==this.get("orientation")){const s=t.height();e.set("y",t.y()),i.set("y",t.y()+s)}else{const s=t.width();e.set("x",t.x()),i.set("x",t.x()+s)}}}Object.defineProperty(m,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Scrollbar"}),Object.defineProperty(m,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:t.classNames.concat([m.className])});const p=class extends n{setupDefaultRules(){super.setupDefaultRules(),this.rule("Component").setAll({interpolationDuration:600}),this.rule("Hierarchy").set("animationDuration",600),this.rule("Scrollbar").set("animationDuration",600),this.rule("Tooltip").set("animationDuration",300),this.rule("MapChart").set("animationDuration",1e3),this.rule("MapChart").set("wheelDuration",300),this.rule("Entity").setAll({stateAnimationDuration:600}),this.rule("Sprite").states.create("default",{stateAnimationDuration:600}),this.rule("Tooltip",["axis"]).setAll({animationDuration:200}),this.rule("WordCloud").set("animationDuration",500)}};const c=class extends n{setupDefaultRules(){super.setupDefaultRules(),this.rule("InterfaceColors").setAll({stroke:r.fromHex(0),fill:r.fromHex(2829099),primaryButton:r.lighten(r.fromHex(6788316),-.2),primaryButtonHover:r.lighten(r.fromHex(6779356),-.2),primaryButtonDown:r.lighten(r.fromHex(6872181),-.2),primaryButtonActive:r.lighten(r.fromHex(6872182),-.2),primaryButtonText:r.fromHex(16777215),primaryButtonStroke:r.lighten(r.fromHex(6788316),-.2),secondaryButton:r.fromHex(3881787),secondaryButtonHover:r.lighten(r.fromHex(3881787),.1),secondaryButtonDown:r.lighten(r.fromHex(3881787),.15),secondaryButtonActive:r.lighten(r.fromHex(3881787),.2),secondaryButtonText:r.fromHex(12303291),secondaryButtonStroke:r.lighten(r.fromHex(3881787),-.2),grid:r.fromHex(12303291),background:r.fromHex(0),alternativeBackground:r.fromHex(16777215),text:r.fromHex(16777215),alternativeText:r.fromHex(0),disabled:r.fromHex(11382189),positive:r.fromHex(5288704),negative:r.fromHex(11730944)})}};let b=class extends n{constructor(){super(...arguments),Object.defineProperty(this,"responsiveRules",{enumerable:!0,configurable:!0,writable:!0,value:[]})}static widthXXS(t,e){return t<=b.XXS}static widthXS(t,e){return t<=b.XS}static widthS(t,e){return t<=b.S}static widthM(t,e){return t<=b.M}static widthL(t,e){return t<=b.L}static widthXL(t,e){return t<=b.XL}static widthXXL(t,e){return t<=b.XXL}static heightXXS(t,e){return e<=b.XXS}static heightXS(t,e){return e<=b.XS}static heightS(t,e){return e<=b.S}static heightM(t,e){return e<=b.M}static heightL(t,e){return e<=b.L}static heightXL(t,e){return e<=b.XL}static heightXXL(t,e){return e<=b.XXL}static isXXS(t,e){return t<=b.XXS&&e<=b.XXS}static isXS(t,e){return t<=b.XS&&e<=b.XS}static isS(t,e){return t<=b.S&&e<=b.S}static isM(t,e){return t<=b.M&&e<=b.M}static isL(t,e){return t<=b.L&&e<=b.L}static isXL(t,e){return t<=b.XL&&e<=b.XL}static isXXL(t,e){return t<=b.XXL&&e<=b.XXL}static maybeXXS(t,e){return t<=b.XXS||e<=b.XXS}static maybeXS(t,e){return t<=b.XS||e<=b.XS}static maybeS(t,e){return t<=b.S||e<=b.S}static maybeM(t,e){return t<=b.M||e<=b.M}static maybeL(t,e){return t<=b.L||e<=b.L}static maybeXL(t,e){return t<=b.XL||e<=b.XL}static maybeXXL(t,e){return t<=b.XXL||e<=b.XXL}static newEmpty(t){return new this(t,!0)}addRule(t){return t.name&&!t.template&&(t.template=this.rule(t.name,t.tags)),t._dp=new h([this._root._rootContainer.onPrivate("width",(e=>{this._isUsed()&&this._applyRule(t)})),this._root._rootContainer.onPrivate("height",(e=>{this._isUsed()&&this._applyRule(t)}))]),this.responsiveRules.push(t),this._applyRule(t),t}removeRule(t){o(this.responsiveRules,t),t._dp&&t._dp.dispose()}_isUsed(){return-1!==this._root._rootContainer.get("themes").indexOf(this)}_applyRule(t){const e=this._root._rootContainer.getPrivate("width"),i=this._root._rootContainer.getPrivate("height"),s=t.relevant.call(t,e,i),a=t.applied;s?a||(t.applied=!0,t.template&&t.settings&&t.template.setAll(t.settings),t.applying&&t.applying.call(t)):a&&(t.applied=!1,t.template&&t.template.removeAll(),t.removing&&t.removing.call(t))}setupDefaultRules(){super.setupDefaultRules();const t=t=>this.addRule(t);t({name:"Chart",relevant:b.widthXXS,settings:{paddingLeft:0,paddingRight:0}}),t({name:"Chart",relevant:b.heightXXS,settings:{paddingTop:0,paddingBottom:0}}),t({name:"Bullet",relevant:b.isXS,settings:{forceHidden:!0}}),t({name:"Legend",relevant:b.isXS,settings:{forceHidden:!0}}),t({name:"HeatLegend",tags:["vertical"],relevant:b.widthXS,settings:{forceHidden:!0}}),t({name:"HeatLegend",tags:["horizontal"],relevant:b.heightXS,settings:{forceHidden:!0}}),t({name:"Label",tags:["heatlegend","start"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"Label",tags:["heatlegend","end"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"Button",tags:["resize"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"AxisRendererX",relevant:b.heightXS,settings:{inside:!0}}),t({name:"AxisRendererY",relevant:b.widthXS,settings:{inside:!0}}),t({name:"AxisRendererXLabel",relevant:b.heightXS,settings:{minPosition:.1,maxPosition:.9}}),t({name:"AxisLabel",tags:["y"],relevant:b.widthXS,settings:{centerY:l,maxPosition:.9}}),t({name:"AxisLabel",tags:["x"],relevant:b.heightXXS,settings:{forceHidden:!0}}),t({name:"AxisLabel",tags:["y"],relevant:b.widthXXS,settings:{forceHidden:!0}}),t({name:"AxisTick",tags:["x"],relevant:b.heightXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),t({name:"AxisTick",tags:["y"],relevant:b.widthXXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),t({name:"Grid",relevant:b.maybeXXS,settings:{forceHidden:!0}}),t({name:"RadialLabel",tags:["radial"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"RadialLabel",tags:["circular"],relevant:b.maybeS,settings:{inside:!0}}),t({name:"AxisTick",relevant:b.maybeS,settings:{inside:!0}}),t({name:"RadialLabel",tags:["circular"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"AxisTick",tags:["circular"],relevant:b.maybeXS,settings:{inside:!0}}),t({name:"PieChart",relevant:b.maybeXS,settings:{radius:d(99)}}),t({name:"PieChart",relevant:b.widthM,settings:{radius:d(99)}}),t({name:"RadialLabel",tags:["pie"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"RadialLabel",tags:["pie"],relevant:b.widthM,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pie"],relevant:b.maybeXS,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pie"],relevant:b.widthM,settings:{forceHidden:!0}}),t({name:"FunnelSeries",relevant:b.widthM,settings:{alignLabels:!1}}),t({name:"Label",tags:["funnel","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Tick",tags:["funnel","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Label",tags:["funnel","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"Tick",tags:["funnel","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"PyramidSeries",relevant:b.widthM,settings:{alignLabels:!1}}),t({name:"Label",tags:["pyramid","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pyramid","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Label",tags:["pyramid","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pyramid","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"PictorialStackedSeries",relevant:b.widthM,settings:{alignLabels:!1}}),t({name:"Label",tags:["pictorial","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pictorial","vertical"],relevant:b.widthL,settings:{forceHidden:!0}}),t({name:"Label",tags:["pictorial","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"Tick",tags:["pictorial","horizontal"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"Label",tags:["flow","horizontal"],relevant:b.widthS,settings:{forceHidden:!0}}),t({name:"Label",tags:["flow","vertical"],relevant:b.heightS,settings:{forceHidden:!0}}),t({name:"Chord",relevant:b.maybeXS,settings:{radius:d(99)}}),t({name:"Label",tags:["hierarchy","node"],relevant:b.maybeXS,settings:{forceHidden:!0}})}};Object.defineProperty(b,"XXS",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(b,"XS",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(b,"S",{enumerable:!0,configurable:!0,writable:!0,value:300}),Object.defineProperty(b,"M",{enumerable:!0,configurable:!0,writable:!0,value:400}),Object.defineProperty(b,"L",{enumerable:!0,configurable:!0,writable:!0,value:600}),Object.defineProperty(b,"XL",{enumerable:!0,configurable:!0,writable:!0,value:800}),Object.defineProperty(b,"XXL",{enumerable:!0,configurable:!0,writable:!0,value:1e3});const v=b;export{p as AnimatedThemeAm5,c as DarkThemeAm5,v as ResponsiveThemeAm5,m as ScrollbarAm5};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{a as e}from"../../../chunks/tslib.es6.js";import{w as t,c as i,S as s,a,T as r}from"../../../chunks/Tick.js";import{af as l,ar as n,al as o,aq as h,R as c,as as u,at as d,an as g,O as p,a6 as y,g as b,ai as m,a3 as f,Q as _,a2 as x,e as v,au as w,W as k,av as D,aw as R,ax as A,ak as P}from"../../../chunks/Theme.js";import{C as T}from"../../../chunks/ColorSet.js";import{s as L}from"../../../chunks/DefaultTheme.js";class N extends l{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeRadialText("",this.textStyle)})}_afterNew(){super._afterNew()}_beforeChanged(){super._beforeChanged(),this._display.clear(),this.isDirty("textType")&&(this._display.textType=this.get("textType"),this.markDirtyBounds()),this.isDirty("radius")&&(this._display.radius=this.get("radius"),this.markDirtyBounds()),this.isDirty("startAngle")&&(this._display.startAngle=(this.get("startAngle",0)+90)*n,this.markDirtyBounds()),this.isDirty("inside")&&(this._display.inside=this.get("inside"),this.markDirtyBounds()),this.isDirty("orientation")&&(this._display.orientation=this.get("orientation"),this.markDirtyBounds()),this.isDirty("kerning")&&(this._display.kerning=this.get("kerning"),this.markDirtyBounds())}}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialText"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:l.classNames.concat([N.className])});class C extends o{constructor(){super(...arguments),Object.defineProperty(this,"_flipped",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._textKeys.push("textType","kerning"),super._afterNew()}_makeText(){this._text=this.children.push(N.new(this._root,{}))}baseRadius(){const e=this.getPrivate("radius",0),t=this.getPrivate("innerRadius",0),i=this.get("baseRadius",0);return t+h(i,e-t)}radius(){const e=this.get("inside",!1);return this.baseRadius()+this.get("radius",0)*(e?-1:1)}_updateChildren(){if(super._updateChildren(),this.isDirty("baseRadius")||this.isPrivateDirty("radius")||this.isPrivateDirty("innerRadius")||this.isDirty("labelAngle")||this.isDirty("radius")||this.isDirty("inside")||this.isDirty("orientation")||this.isDirty("textType")){const e=this.get("textType","adjusted"),t=this.get("inside",!1),i=this.get("orientation");let s=c(this.get("labelAngle",0));this._text.set("startAngle",this.get("labelAngle",0)),this._text.set("inside",t);const a=u(s),r=d(s);let l=this.baseRadius(),n=this.radius();if(this._display.angle=0,"circular"==e)this.setAll({paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}),this._text.set("orientation",i),this._text.set("radius",n);else{0==l&&(s=0,n=0);let t=n*r,o=n*a;"radial"==e?(this.setRaw("x",t),this.setRaw("y",o),s<90||s>270||"auto"!=i?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):"adjusted"==e?(this.setRaw("centerX",g),this.setRaw("centerY",g),this.setRaw("x",t),this.setRaw("y",o)):"regular"==e&&(this.setRaw("x",t),this.setRaw("y",o))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const e=this.get("textType","regular"),t=this.get("inside",!1);let i=0,s=0,a=this.get("labelAngle",0),r=this.localBounds(),l=r.right-r.left,n=r.bottom-r.top;if("radial"==e){if(this._flipped){let e=this.get("centerX");e instanceof p&&(l*=1-2*e.value),i=l*d(a),s=l*u(a)}}else t||"adjusted"!=e||(i=l/2*d(a),s=n/2*u(a));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(C,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(C,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:o.classNames.concat([C.className])});const j=Math.abs,S=Math.atan2,O=Math.cos,I=Math.max,M=Math.min,B=Math.sin,F=Math.sqrt,H=1e-12,X=Math.PI,Y=X/2,V=2*X;function W(e){return e>1?0:e<-1?X:Math.acos(e)}function z(e){return e>=1?Y:e<=-1?-Y:Math.asin(e)}function U(e){return e.innerRadius}function q(e){return e.outerRadius}function K(e){return e.startAngle}function E(e){return e.endAngle}function G(e){return e&&e.padAngle}function J(e,t,i,s,a,r,l,n){var o=i-e,h=s-t,c=l-a,u=n-r,d=u*o-c*h;if(!(d*d<H))return[e+(d=(c*(t-r)-u*(e-a))/d)*o,t+d*h]}function Q(e,t,i,s,a,r,l){var n=e-i,o=t-s,h=(l?r:-r)/F(n*n+o*o),c=h*o,u=-h*n,d=e+c,g=t+u,p=i+c,y=s+u,b=(d+p)/2,m=(g+y)/2,f=p-d,_=y-g,x=f*f+_*_,v=a-r,w=d*y-p*g,k=(_<0?-1:1)*F(I(0,v*v*x-w*w)),D=(w*_-f*k)/x,R=(-w*f-_*k)/x,A=(w*_+f*k)/x,P=(-w*f+_*k)/x,T=D-b,L=R-m,N=A-b,C=P-m;return T*T+L*L>N*N+C*C&&(D=A,R=P),{cx:D,cy:R,x01:-c,y01:-u,x11:D*(a/v-1),y11:R*(a/v-1)}}function Z(){var e=U,s=q,a=i(0),r=null,l=K,n=E,o=G,h=null,c=t(u);function u(){var t,i,u=+e.apply(this,arguments),d=+s.apply(this,arguments),g=l.apply(this,arguments)-Y,p=n.apply(this,arguments)-Y,y=j(p-g),b=p>g;if(h||(h=t=c()),d<u&&(i=d,d=u,u=i),d>H)if(y>V-H)h.moveTo(d*O(g),d*B(g)),h.arc(0,0,d,g,p,!b),u>H&&(h.moveTo(u*O(p),u*B(p)),h.arc(0,0,u,p,g,b));else{var m,f,_=g,x=p,v=g,w=p,k=y,D=y,R=o.apply(this,arguments)/2,A=R>H&&(r?+r.apply(this,arguments):F(u*u+d*d)),P=M(j(d-u)/2,+a.apply(this,arguments)),T=P,L=P;if(A>H){var N=z(A/u*B(R)),C=z(A/d*B(R));(k-=2*N)>H?(v+=N*=b?1:-1,w-=N):(k=0,v=w=(g+p)/2),(D-=2*C)>H?(_+=C*=b?1:-1,x-=C):(D=0,_=x=(g+p)/2)}var I=d*O(_),U=d*B(_),q=u*O(w),K=u*B(w);if(P>H){var E,G=d*O(x),Z=d*B(x),$=u*O(v),ee=u*B(v);if(y<X)if(E=J(I,U,$,ee,G,Z,q,K)){var te=I-E[0],ie=U-E[1],se=G-E[0],ae=Z-E[1],re=1/B(W((te*se+ie*ae)/(F(te*te+ie*ie)*F(se*se+ae*ae)))/2),le=F(E[0]*E[0]+E[1]*E[1]);T=M(P,(u-le)/(re-1)),L=M(P,(d-le)/(re+1))}else T=L=0}D>H?L>H?(m=Q($,ee,I,U,d,L,b),f=Q(G,Z,q,K,d,L,b),h.moveTo(m.cx+m.x01,m.cy+m.y01),L<P?h.arc(m.cx,m.cy,L,S(m.y01,m.x01),S(f.y01,f.x01),!b):(h.arc(m.cx,m.cy,L,S(m.y01,m.x01),S(m.y11,m.x11),!b),h.arc(0,0,d,S(m.cy+m.y11,m.cx+m.x11),S(f.cy+f.y11,f.cx+f.x11),!b),h.arc(f.cx,f.cy,L,S(f.y11,f.x11),S(f.y01,f.x01),!b))):(h.moveTo(I,U),h.arc(0,0,d,_,x,!b)):h.moveTo(I,U),u>H&&k>H?T>H?(m=Q(q,K,G,Z,u,-T,b),f=Q(I,U,$,ee,u,-T,b),h.lineTo(m.cx+m.x01,m.cy+m.y01),T<P?h.arc(m.cx,m.cy,T,S(m.y01,m.x01),S(f.y01,f.x01),!b):(h.arc(m.cx,m.cy,T,S(m.y01,m.x01),S(m.y11,m.x11),!b),h.arc(0,0,u,S(m.cy+m.y11,m.cx+m.x11),S(f.cy+f.y11,f.cx+f.x11),b),h.arc(f.cx,f.cy,T,S(f.y11,f.x11),S(f.y01,f.x01),!b))):h.arc(0,0,u,w,v,b):h.lineTo(q,K)}else h.moveTo(0,0);if(h.closePath(),t)return h=null,t+""||null}return u.centroid=function(){var t=(+e.apply(this,arguments)+ +s.apply(this,arguments))/2,i=(+l.apply(this,arguments)+ +n.apply(this,arguments))/2-X/2;return[O(i)*t,B(i)*t]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),u):e},u.outerRadius=function(e){return arguments.length?(s="function"==typeof e?e:i(+e),u):s},u.cornerRadius=function(e){return arguments.length?(a="function"==typeof e?e:i(+e),u):a},u.padRadius=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:i(+e),u):r},u.startAngle=function(e){return arguments.length?(l="function"==typeof e?e:i(+e),u):l},u.endAngle=function(e){return arguments.length?(n="function"==typeof e?e:i(+e),u):n},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:i(+e),u):o},u.context=function(e){return arguments.length?(h=e??null,u):h},u}class $ extends y{constructor(){super(...arguments),Object.defineProperty(this,"ix",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generator",{enumerable:!0,configurable:!0,writable:!0,value:Z()})}_getTooltipPoint(){let e=this.get("tooltipX"),t=this.get("tooltipY"),i=0,s=0;b(e)&&(i=e),b(t)&&(s=t);let a=this.get("radius",0),r=this.get("innerRadius",0);return a+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=a+r),e instanceof p&&(i=this.ix*(r+(a-r)*e.value)),t instanceof p&&(s=this.iy*(r+(a-r)*t.value)),this.get("arc")>=360&&0==r&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let e=this.get("startAngle",0),t=this.get("arc",0);const i=this._generator;t<0&&(e+=t,t*=-1),t>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),a=this.get("innerRadius",0);s+=this.get("dRadius",0),a+=this.get("dInnerRadius",0),a<0&&(a=s+a),i({innerRadius:a,outerRadius:s,startAngle:(e+90)*n,endAngle:(e+t+90)*n});let r=e+t/2;this.ix=d(r),this.iy=u(r)}if(this.isDirty("shiftRadius")){const e=this.get("shiftRadius",0);this.setRaw("dx",this.ix*e),this.setRaw("dy",this.iy*e),this.markDirtyPosition()}}}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:y.classNames.concat([$.className])});class ee extends m{setupDefaultRules(){super.setupDefaultRules();const e=this._root.interfaceColors,t=this.rule.bind(this);t("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:T.new(this._root,{}),width:f,height:f}),t("PieChart").setAll({radius:_(80),startAngle:-90,endAngle:270}),t("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),t("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),t("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),t("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),t("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),t("Slice",["pie"]).states.create("hover",{scale:1.04}),t("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),t("Tick",["pie"]).setAll({location:1}),t("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),t("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),t("FunnelSlice").setAll({interactive:!0,expandDistance:0}),t("FunnelSlice").states.create("hover",{expandDistance:.15}),t("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["funnel","vertical"]).setAll({centerY:g,centerX:0}),t("Tick",["funnel"]).setAll({location:1}),t("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),t("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),t("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),t("PyramidSeries").setAll({valueIs:"area"}),t("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),t("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),t("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),t("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),t("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),t("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["pyramid","vertical"]).setAll({centerY:g,centerX:0}),t("Tick",["pyramid"]).setAll({location:1}),t("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),t("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:g}),t("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:g,rotation:-90}),t("Label",["pictorial","vertical"]).setAll({centerY:g,centerX:0}),t("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),t("Tick",["pictorial"]).setAll({location:.5});{const i=t("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),L(i,"fill",e,"alternativeBackground")}}}class te extends s{_afterNew(){this._defaultThemes.push(ee.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(e){super._processSeries(e),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(te,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(te,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:s.classNames.concat([te.className])});class ie extends a{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this._makeSlices()}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this._makeLabels()}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this._makeTicks()})}makeSlice(e){const t=this.slicesContainer.children.push(this.slices.make());return t.on("fill",(()=>{this.updateLegendMarker(e)})),t.on("stroke",(()=>{this.updateLegendMarker(e)})),t._setDataItem(e),e.set("slice",t),this.slices.push(t),t}makeLabel(e){const t=this.labelsContainer.children.push(this.labels.make());return t._setDataItem(e),e.set("label",t),this.labels.push(t),t}_shouldMakeBullet(e){return null!=e.get("value")}makeTick(e){const t=this.ticksContainer.children.push(this.ticks.make());return t._setDataItem(e),e.set("tick",t),this.ticks.push(t),t}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const e=this.get("colors");e&&e.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let e=0,t=0,i=0,s=1/0,a=0;v(this._dataItems,(i=>{let s=i.get("valueWorking",0);e+=s,t+=Math.abs(s)})),v(this._dataItems,(e=>{let r=e.get("valueWorking",0);r>i&&(i=r),r<s&&(s=r),a++;let l=r/t;0==t&&(l=0),e.setRaw("valuePercentTotal",100*l)})),this.setPrivateRaw("valueLow",s),this.setPrivateRaw("valueHigh",i),this.setPrivateRaw("valueSum",e),this.setPrivateRaw("valueAverage",e/a),this.setPrivateRaw("valueAbsoluteSum",t)}}show(t){const i=Object.create(null,{show:{get:()=>super.show}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.show.call(this,t)),e.push(this._sequencedShowHide(!0,t)),yield Promise.all(e)}))}hide(t){const i=Object.create(null,{hide:{get:()=>super.hide}});return e(this,void 0,void 0,(function*(){let e=[];e.push(i.hide.call(this,t)),e.push(this._sequencedShowHide(!1,t)),yield Promise.all(e)}))}_updateChildren(){super._updateChildren(),this._valuesDirty&&v(this._dataItems,(e=>{e.get("label").text.markDirtyText()})),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&v(this._dataItems,(e=>{this.updateLegendValue(e)})),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),v(this.dataItems,(e=>{this._updateTick(e)}))}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(e){if(super.processDataItem(e),null==e.get("fill")){let t=this.get("colors");t&&e.setRaw("fill",t.next())}}showDataItem(t,i){const s=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.showDataItem.call(this,t,i)];b(i)||(i=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");let r=t.get("value");const l=t.animate({key:"valueWorking",to:r,duration:i,easing:a});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.show(i));const o=t.get("label");o&&e.push(o.show(i));const h=t.get("slice");h&&e.push(h.show(i)),h.get("active")&&h.states.applyAnimate("active"),yield Promise.all(e)}))}hideDataItem(t,i){const s=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,(function*(){const e=[s.hideDataItem.call(this,t,i)],a=this.states.create("hidden",{});b(i)||(i=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),l=t.animate({key:"valueWorking",to:0,duration:i,easing:r});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.hide(i));const o=t.get("label");o&&e.push(o.hide(i));const h=t.get("slice");h.hideTooltip(),h&&e.push(h.hide(i)),yield Promise.all(e)}))}disposeDataItem(e){super.disposeDataItem(e);let t=e.get("label");t&&(this.labels.removeValue(t),t.dispose());let i=e.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=e.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(e){const t=e.get("slice");t&&!t.isHidden()&&t.hover()}unhoverDataItem(e){const t=e.get("slice");t&&t.unhover()}updateLegendMarker(e){const t=e.get("slice");if(t){const i=e.get("legendDataItem");if(i){const e=i.get("markerRectangle");v(w,(i=>{null!=t.get(i)&&e.set(i,t.get(i))}))}}}_arrangeDown(e){if(e){let t=this._getNextDown();e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.top;e.y+s<t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.bottom}))}}_getNextUp(){return this.labelsContainer.maxHeight()}_getNextDown(){return 0}_arrangeUp(e){if(e){let t=this._getNextUp();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.bottom;e.y+s>t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.top}))}}_arrangeRight(e){if(e){let t=0;e.sort(((e,t)=>e.y>t.y?1:e.y<t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.left;e.y+s<t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.right}))}}_arrangeLeft(e){if(e){let t=this.labelsContainer.maxWidth();e.sort(((e,t)=>e.y<t.y?1:e.y>t.y?-1:0)),v(e,(e=>{const i=e.label.adjustedLocalBounds();let s=i.right;e.y+s>t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.left}))}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(e){}_dispose(){super._dispose();const e=this.chart;e&&e.series.removeValue(this)}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:a.classNames.concat([ie.className])});class se extends te{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:g,y:g})}_prepareChildren(){super._prepareChildren();const e=this.chartContainer,t=e.innerWidth(),i=e.innerHeight(),s=this.get("startAngle",0),a=this.get("endAngle",0),r=this.get("innerRadius");let l=k(0,0,s,a,1);const n=t/(l.right-l.left),o=i/(l.bottom-l.top);let c={left:0,right:0,top:0,bottom:0};if(r instanceof p){let e=r.value,l=Math.min(n,o);e=Math.max(l*e,l-Math.min(i,t))/l,c=k(0,0,s,a,e),this.setPrivateRaw("irModifyer",e/r.value)}l=D([l,c]);const u=this._maxRadius;this._maxRadius=Math.min(n,o);const d=h(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-d*(l.bottom+l.top)/2,dx:-d*(l.right+l.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||u!=this._maxRadius)&&this.series.each((e=>{e._markDirtyKey("startAngle")})),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each((e=>{e._markDirtyKey("innerRadius")}))}radius(e){let t=h(this.get("radius",0),this._maxRadius),i=h(this.get("innerRadius",0),t);if(e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("radius");return null!=r?i+h(r,t-i):i+(t-i)/a*(s+1)}return t}innerRadius(e){const t=this.radius();let i=h(this.get("innerRadius",0),t);if(i<0&&(i=t+i),e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("innerRadius");return null!=r?i+h(r,t-i):i+(t-i)/a*s}return i}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([se.className])});class ae extends ie{_makeSlices(){return new R(A.new({}),(()=>$._new(this._root,{themeTags:P(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template])))}_makeLabels(){return new R(A.new({}),(()=>C._new(this._root,{themeTags:P(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template])))}_makeTicks(){return new R(A.new({}),(()=>r._new(this._root,{themeTags:P(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template])))}processDataItem(e){super.processDataItem(e);const t=this.makeSlice(e);t.on("scale",(()=>{this._updateTick(e)})),t.on("shiftRadius",(()=>{this._updateTick(e)})),t.events.on("positionchanged",(()=>{this._updateTick(e)}));const i=this.makeLabel(e);i.events.on("positionchanged",(()=>{this._updateTick(e)})),this.makeTick(e),t.events.on("positionchanged",(()=>{i.markDirty()}))}_getNextUp(){const e=this.chart;return e?e._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const e=this.chart;return e?-e._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const e=this.chart;if(e){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let t=e.get("textType");null!=t&&"aligned"!=t||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const t=this.get("startAngle",e.get("startAngle",-90)),i=this.get("endAngle",e.get("endAngle",270))-t;let s=t;const a=e.radius(this);this.setPrivateRaw("radius",a);let r=e.innerRadius(this)*e.getPrivate("irModifyer",1);r<0&&(r=a+r),v(this._dataItems,(e=>{this.updateLegendValue(e);let t=i*e.get("valuePercentTotal")/100;const l=e.get("slice");if(l){l.set("radius",a),l.set("innerRadius",r),l.set("startAngle",s),l.set("arc",t);const i=e.get("fill");l._setDefault("fill",i),l._setDefault("stroke",i)}let n=c(s+t/2);const o=e.get("label");if(o&&(o.setPrivate("radius",a),o.setPrivate("innerRadius",r),o.set("labelAngle",n),"aligned"==o.get("textType"))){let e=a+o.get("radius",0),t=a*u(n);n>90&&n<=270?(o.isHidden()||o.isHiding()||this._lLabels.push({label:o,y:t}),e*=-1,e-=this.labelsContainer.get("paddingLeft",0),o.set("centerX",f),o.setPrivateRaw("left",!0)):(o.isHidden()||o.isHiding()||this._rLabels.push({label:o,y:t}),e+=this.labelsContainer.get("paddingRight",0),o.set("centerX",0),o.setPrivateRaw("left",!1)),o.set("x",e),o.set("y",a*u(n))}s+=t,this._updateTick(e)}))}}}_updateTick(e){const t=e.get("tick"),i=e.get("label"),s=e.get("slice"),a=t.get("location",1);if(t&&i&&s){const e=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*a,r=i.get("labelAngle",0),l=d(r),n=u(r),o=this.labelsContainer,h=o.get("paddingLeft",0),c=o.get("paddingRight",0);let g=0,p=0;if(g=i.x(),p=i.y(),"circular"==i.get("textType")){const e=i.radius()-i.get("paddingBottom",0),t=i.get("labelAngle",0);g=e*d(t),p=e*u(t)}let y=-c;i.getPrivate("left")&&(y=h),t.set("points",[{x:s.x()+e*l,y:s.y()+e*n},{x:g+y,y:p},{x:g,y:p}])}}_positionBullet(e){const t=e.get("sprite");if(t){const i=t.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),a=i.get("radius",0),r=i.get("startAngle",0)+i.get("arc",0)*e.get("locationX",.5),l=s+(a-s)*e.get("locationY",.5);t.setAll({x:d(r)*l,y:u(r)*l})}}}}Object.defineProperty(ae,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(ae,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:ie.classNames.concat([ae.className])});export{se as PieChartAm5,ae as PieSeriesAm5};
|