@esri/solutions-components 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/cjs/{calcite-action-menu_2.cjs.entry.js → calcite-action-menu_3.cjs.entry.js} +114 -7
- package/dist/cjs/calcite-alert_4.cjs.entry.js +46 -5
- package/dist/cjs/{calcite-input-date-picker_3.cjs.entry.js → calcite-block_5.cjs.entry.js} +691 -13
- package/dist/cjs/{calcite-combobox_5.cjs.entry.js → calcite-combobox_3.cjs.entry.js} +876 -844
- package/dist/cjs/calcite-dropdown_4.cjs.entry.js +1023 -0
- package/dist/cjs/{calcite-flow_5.cjs.entry.js → calcite-flow_6.cjs.entry.js} +327 -2
- package/dist/cjs/card-manager_3.cjs.entry.js +5 -5
- package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +122 -21
- package/dist/cjs/{downloadUtils-8b05d7cc.js → downloadUtils-dc349b1a.js} +2 -2
- package/dist/cjs/{index.es-e7587227.js → index.es-1830a1e6.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +8 -8
- package/dist/cjs/{mapViewUtils-3e0fa457.js → mapViewUtils-9dc05308.js} +11 -5
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/create-feature/create-feature.js +18 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +16 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +155 -35
- package/dist/collection/components/feature-details/feature-details.css +18 -0
- package/dist/collection/components/feature-details/feature-details.js +500 -0
- package/dist/collection/components/feature-details/test/feature-details.e2e.js +14 -0
- package/dist/collection/components/feature-details/test/feature-details.spec.js +22 -0
- package/dist/collection/components/feature-list/feature-list.js +14 -1
- package/dist/collection/components/info-card/info-card.css +15 -5
- package/dist/collection/components/info-card/info-card.js +178 -5
- package/dist/collection/components/layer-table/layer-table.js +2 -2
- package/dist/collection/components/map-card/map-card.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/demos/crowdsource-reporter.html +115 -1
- package/dist/collection/utils/mapViewUtils.js +11 -5
- package/dist/collection/utils/mapViewUtils.ts +13 -5
- package/dist/components/create-feature2.js +4 -0
- package/dist/components/crowdsource-reporter.js +270 -81
- package/dist/components/feature-details.d.ts +11 -0
- package/dist/components/feature-details.js +11 -0
- package/dist/components/feature-details2.js +449 -0
- package/dist/components/feature-list2.js +14 -1
- package/dist/components/info-card2.js +53 -5
- package/dist/components/layer-table2.js +2 -2
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-select-tools2.js +5 -5
- package/dist/components/mapViewUtils.js +11 -5
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/{calcite-action-menu_2.entry.js → calcite-action-menu_3.entry.js} +118 -12
- package/dist/esm/calcite-alert_4.entry.js +46 -5
- package/dist/esm/{calcite-input-date-picker_3.entry.js → calcite-block_5.entry.js} +688 -12
- package/dist/esm/{calcite-combobox_5.entry.js → calcite-combobox_3.entry.js} +878 -844
- package/dist/esm/calcite-date-picker-day_3.entry.js +1 -1
- package/dist/esm/calcite-dropdown_4.entry.js +1016 -0
- package/dist/esm/{calcite-flow_5.entry.js → calcite-flow_6.entry.js} +327 -3
- package/dist/esm/card-manager_3.entry.js +5 -5
- package/dist/esm/crowdsource-manager.entry.js +1 -1
- package/dist/esm/crowdsource-reporter.entry.js +122 -21
- package/dist/esm/{date-5630530d.js → date-0c026a8b.js} +1 -1
- package/dist/esm/{downloadUtils-0c1e4d7b.js → downloadUtils-df4f21f6.js} +2 -2
- package/dist/esm/{index.es-286e3cfa.js → index.es-904fb846.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +8 -8
- package/dist/esm/{mapViewUtils-253178f1.js → mapViewUtils-2ec19fb0.js} +11 -5
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +115 -1
- package/dist/solutions-components/{p-813fd8a4.entry.js → p-29f518fd.entry.js} +2 -2
- package/dist/solutions-components/{p-13ca3b00.entry.js → p-452fd697.entry.js} +1 -1
- package/dist/solutions-components/p-511b1c91.entry.js +23 -0
- package/dist/solutions-components/p-577efb16.js +36 -0
- package/dist/solutions-components/{p-94de9279.js → p-5817d78c.js} +1 -1
- package/dist/solutions-components/p-602cd811.entry.js +17 -0
- package/dist/solutions-components/{p-15f9624a.entry.js → p-6557b703.entry.js} +1 -1
- package/dist/solutions-components/p-7269c49b.entry.js +6 -0
- package/dist/solutions-components/p-760bd17e.entry.js +6 -0
- package/dist/solutions-components/p-95fea07a.entry.js +17 -0
- package/dist/solutions-components/{p-212b02e7.js → p-ae4d86e8.js} +1 -1
- package/dist/solutions-components/{p-038fcd93.entry.js → p-c273ab7a.entry.js} +1 -1
- package/dist/solutions-components/p-d742b915.entry.js +29 -0
- package/dist/solutions-components/p-dfad61a8.entry.js +24 -0
- package/dist/solutions-components/{p-331b5d1e.js → p-fca434c8.js} +2 -2
- package/dist/solutions-components/p-fd82a00f.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +13 -5
- package/dist/types/components/create-feature/create-feature.d.ts +4 -4
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +91 -10
- package/dist/types/components/feature-details/feature-details.d.ts +151 -0
- package/dist/types/components/feature-list/feature-list.d.ts +6 -0
- package/dist/types/components/info-card/info-card.d.ts +33 -1
- package/dist/types/components.d.ts +129 -12
- package/dist/types/preact.d.ts +6 -1
- package/dist/types/utils/mapViewUtils.d.ts +5 -3
- package/package.json +1 -1
- package/dist/cjs/calcite-block_2.cjs.entry.js +0 -652
- package/dist/cjs/calcite-graph_2.cjs.entry.js +0 -1055
- package/dist/cjs/calcite-scrim.cjs.entry.js +0 -125
- package/dist/cjs/utils-7bc7f595.js +0 -64
- package/dist/esm/calcite-block_2.entry.js +0 -647
- package/dist/esm/calcite-graph_2.entry.js +0 -1050
- package/dist/esm/calcite-scrim.entry.js +0 -121
- package/dist/esm/utils-9fb4104a.js +0 -61
- package/dist/solutions-components/p-04c37d69.entry.js +0 -17
- package/dist/solutions-components/p-0b92e4b1.entry.js +0 -11
- package/dist/solutions-components/p-238d3b5f.entry.js +0 -6
- package/dist/solutions-components/p-3af79063.js +0 -36
- package/dist/solutions-components/p-80b11ec1.entry.js +0 -17
- package/dist/solutions-components/p-a3a11749.entry.js +0 -6
- package/dist/solutions-components/p-aec06ce4.entry.js +0 -18
- package/dist/solutions-components/p-bfdf89c2.js +0 -11
- package/dist/solutions-components/p-c4ff3b52.entry.js +0 -17
- package/dist/solutions-components/p-ced067bd.entry.js +0 -17
- package/dist/solutions-components/p-d136eab0.entry.js +0 -23
- package/dist/solutions-components/p-e0446d5b.entry.js +0 -6
@@ -16,7 +16,7 @@ const locale = require('./locale-d237c9d5.js');
|
|
16
16
|
const t9n = require('./t9n-993a84de.js');
|
17
17
|
const resources = require('./resources-3e593312.js');
|
18
18
|
const locale$1 = require('./locale-3d0a4bc2.js');
|
19
|
-
const mapViewUtils = require('./mapViewUtils-
|
19
|
+
const mapViewUtils = require('./mapViewUtils-9dc05308.js');
|
20
20
|
const popupUtils = require('./popupUtils-6be3588c.js');
|
21
21
|
require('./guid-ae73cd27.js');
|
22
22
|
require('./resources-9447c777.js');
|
@@ -349,6 +349,7 @@ const CreateFeature = class {
|
|
349
349
|
this.fail = index.createEvent(this, "fail", 7);
|
350
350
|
this.drawComplete = index.createEvent(this, "drawComplete", 7);
|
351
351
|
this.editingAttachment = index.createEvent(this, "editingAttachment", 7);
|
352
|
+
this.progressStatus = index.createEvent(this, "progressStatus", 7);
|
352
353
|
this.mapView = undefined;
|
353
354
|
this.selectedLayerId = undefined;
|
354
355
|
this.customizeSubmit = false;
|
@@ -493,6 +494,7 @@ const CreateFeature = class {
|
|
493
494
|
//Add handle to watch featureTemplatesViewModel ready state and then start the creation
|
494
495
|
const handle = this.reactiveUtils.watch(() => this._editor.viewModel.featureTemplatesViewModel.state, (state) => {
|
495
496
|
if (state === 'ready') {
|
497
|
+
this.progressStatus.emit(0.5);
|
496
498
|
void this.startCreate();
|
497
499
|
}
|
498
500
|
});
|
@@ -516,6 +518,7 @@ const CreateFeature = class {
|
|
516
518
|
//once the feature template is selected handle the event for formSubmit and sketch complete
|
517
519
|
//also, hide the headers and footer in the editor as we will be showing our own submit and cancel button
|
518
520
|
this._editor.viewModel.featureTemplatesViewModel.on('select', () => {
|
521
|
+
this.progressStatus.emit(0.75);
|
519
522
|
setTimeout(() => {
|
520
523
|
//on form submit
|
521
524
|
this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
|
@@ -523,6 +526,7 @@ const CreateFeature = class {
|
|
523
526
|
this._editor.viewModel.sketchViewModel.on("create", (evt) => {
|
524
527
|
if (evt.state === "complete") {
|
525
528
|
this.showSearchWidget = false;
|
529
|
+
this.progressStatus.emit(1);
|
526
530
|
this.drawComplete.emit();
|
527
531
|
}
|
528
532
|
});
|
@@ -687,6 +691,313 @@ const CreateFeature = class {
|
|
687
691
|
};
|
688
692
|
CreateFeature.style = createFeatureCss;
|
689
693
|
|
694
|
+
const featureDetailsCss = ":host{display:block}.buttons{align-items:center;background-color:white;display:flex;padding:10px 0 10px 15px;border-block-start:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3)}.comment-btn{display:flex;gap:5px;width:35px}";
|
695
|
+
|
696
|
+
const FeatureDetails = class {
|
697
|
+
constructor(hostRef) {
|
698
|
+
index.registerInstance(this, hostRef);
|
699
|
+
this.loadingStatus = index.createEvent(this, "loadingStatus", 7);
|
700
|
+
/**
|
701
|
+
* string[]: Valid field types for like and dislike
|
702
|
+
*/
|
703
|
+
this._validFieldTypes = ["small-integer", "integer", "big-integer", "single", "long"];
|
704
|
+
this.mapView = undefined;
|
705
|
+
this.graphics = undefined;
|
706
|
+
this.reportingOptions = undefined;
|
707
|
+
this._likeFieldAvailable = false;
|
708
|
+
this._likeCount = 0;
|
709
|
+
this._disLikeCount = 0;
|
710
|
+
this._dislikeFieldAvailable = false;
|
711
|
+
this._isLikeBtnClicked = false;
|
712
|
+
this._isDislikeBtnClicked = false;
|
713
|
+
}
|
714
|
+
//--------------------------------------------------------------------------
|
715
|
+
//
|
716
|
+
// Watch handlers
|
717
|
+
//
|
718
|
+
//--------------------------------------------------------------------------
|
719
|
+
/**
|
720
|
+
* Called each time the graphics prop is changed
|
721
|
+
*/
|
722
|
+
async graphicsWatchHandler() {
|
723
|
+
await this.getCompleteGraphic(this.graphics[0]);
|
724
|
+
this.checkLikeDislikeFields();
|
725
|
+
}
|
726
|
+
//--------------------------------------------------------------------------
|
727
|
+
//
|
728
|
+
// Methods (public)
|
729
|
+
/**
|
730
|
+
* Refresh the features comments which will fetch like, dislike and update the component
|
731
|
+
* @returns Promise that resolves when the operation is complete
|
732
|
+
*/
|
733
|
+
async refresh(graphic) {
|
734
|
+
if (this.isLikeDislikeConfigured(graphic.layer)) {
|
735
|
+
// in case of multiple features selected fetch complete feature and update like dislike for current feature
|
736
|
+
if (graphic && this.graphics.length > 1) {
|
737
|
+
await this.getCompleteGraphic(graphic);
|
738
|
+
this.checkLikeDislikeFields();
|
739
|
+
}
|
740
|
+
}
|
741
|
+
else {
|
742
|
+
this._likeFieldAvailable = false;
|
743
|
+
this._dislikeFieldAvailable = false;
|
744
|
+
}
|
745
|
+
}
|
746
|
+
/**
|
747
|
+
* Go to the previous feature in the features widget
|
748
|
+
*/
|
749
|
+
async back() {
|
750
|
+
void this._infoCard.back();
|
751
|
+
}
|
752
|
+
/**
|
753
|
+
* Go to the next feature in the features widget
|
754
|
+
*/
|
755
|
+
async next() {
|
756
|
+
void this._infoCard.next();
|
757
|
+
}
|
758
|
+
/**
|
759
|
+
* Toggle the visibility of the features list view
|
760
|
+
*/
|
761
|
+
async toggleListView() {
|
762
|
+
void this._infoCard.toggleListView();
|
763
|
+
}
|
764
|
+
/**
|
765
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
766
|
+
*
|
767
|
+
* @returns Promise when complete
|
768
|
+
*/
|
769
|
+
async componentWillLoad() {
|
770
|
+
await this._initModules();
|
771
|
+
await this.getCompleteGraphic(this.graphics[0]);
|
772
|
+
this.checkLikeDislikeFields();
|
773
|
+
}
|
774
|
+
render() {
|
775
|
+
var _a, _b, _c, _d;
|
776
|
+
return (index.h("calcite-panel", { "full-height": true }, index.h("info-card", { allowEditing: false, graphics: this.graphics, highlightEnabled: false, isLoading: false, isMobile: false, mapView: this.mapView, paginationEnabled: false, position: "relative", ref: el => this._infoCard = el, zoomAndScrollToSelected: true }), (this._likeFieldAvailable || this._dislikeFieldAvailable) &&
|
777
|
+
index.h("div", { class: 'buttons' }, this._likeFieldAvailable &&
|
778
|
+
index.h("calcite-button", { appearance: "transparent", iconEnd: "thumbs-up", kind: this._isLikeBtnClicked ? "brand" : "neutral", onClick: this.onLikeButtonClick.bind(this), scale: 's' }, (_b = (_a = this._likeCount) !== null && _a !== void 0 ? _a : this._selectedGraphic.attributes[this._likeField]) !== null && _b !== void 0 ? _b : 0), this._dislikeFieldAvailable &&
|
779
|
+
index.h("calcite-button", { appearance: "transparent", iconEnd: "thumbs-down", kind: this._isDislikeBtnClicked ? "brand" : "neutral", onClick: this.onDislikeButtonClick.bind(this), scale: 's' }, (_d = (_c = this._disLikeCount) !== null && _c !== void 0 ? _c : this._selectedGraphic.attributes[this._dislikeField]) !== null && _d !== void 0 ? _d : 0))));
|
780
|
+
}
|
781
|
+
/**
|
782
|
+
* Load esri javascript api modules
|
783
|
+
*
|
784
|
+
* @returns Promise resolving when function is done
|
785
|
+
*
|
786
|
+
* @protected
|
787
|
+
*/
|
788
|
+
async _initModules() {
|
789
|
+
const [Graphic] = await locale$1.loadModules([
|
790
|
+
"esri/Graphic"
|
791
|
+
]);
|
792
|
+
this.Graphic = Graphic;
|
793
|
+
}
|
794
|
+
/**
|
795
|
+
* Get complete graphic with complete attributes
|
796
|
+
* @param graphic selected feature graphic
|
797
|
+
* @protected
|
798
|
+
*/
|
799
|
+
async getCompleteGraphic(graphic) {
|
800
|
+
const layer = graphic.layer;
|
801
|
+
const query = layer.createQuery();
|
802
|
+
query.objectIds = [graphic.getObjectId()];
|
803
|
+
const completeGraphic = await layer.queryFeatures(query);
|
804
|
+
this._selectedGraphic = completeGraphic.features[0];
|
805
|
+
}
|
806
|
+
/**
|
807
|
+
* Checks if the layers is configured for like dislike or not
|
808
|
+
* @param selectedLayer Feature layer
|
809
|
+
* @returns boolean
|
810
|
+
* @protected
|
811
|
+
*/
|
812
|
+
isLikeDislikeConfigured(selectedLayer) {
|
813
|
+
let likeFieldAvailable = false;
|
814
|
+
let dislikeFieldAvailable = false;
|
815
|
+
// check if reporting options are configured for the current selected feature's layer
|
816
|
+
if (this.reportingOptions && this.reportingOptions[selectedLayer.id]) {
|
817
|
+
//return false if both like and dislike are disabled for the layer
|
818
|
+
if (!this.reportingOptions[selectedLayer.id].like && !this.reportingOptions[selectedLayer.id].dislike) {
|
819
|
+
return false;
|
820
|
+
}
|
821
|
+
const likeField = this.reportingOptions[selectedLayer.id].likeField;
|
822
|
+
const dislikeField = this.reportingOptions[selectedLayer.id].dislikeField;
|
823
|
+
//if both fields are not configured return false
|
824
|
+
if (!likeField && !dislikeField) {
|
825
|
+
return false;
|
826
|
+
}
|
827
|
+
selectedLayer.fields.forEach((eachField) => {
|
828
|
+
if (this._validFieldTypes.indexOf(eachField.type) > -1) {
|
829
|
+
if (eachField.name === likeField && this.reportingOptions[selectedLayer.id].like) {
|
830
|
+
likeFieldAvailable = true;
|
831
|
+
}
|
832
|
+
else if (eachField.name === dislikeField && this.reportingOptions[selectedLayer.id].dislike) {
|
833
|
+
dislikeFieldAvailable = true;
|
834
|
+
}
|
835
|
+
}
|
836
|
+
});
|
837
|
+
}
|
838
|
+
return likeFieldAvailable || dislikeFieldAvailable;
|
839
|
+
}
|
840
|
+
/**
|
841
|
+
* Check if configured like or dislike fields are available in the selected layer
|
842
|
+
* @protected
|
843
|
+
*/
|
844
|
+
checkLikeDislikeFields() {
|
845
|
+
this._likeFieldAvailable = false;
|
846
|
+
this._dislikeFieldAvailable = false;
|
847
|
+
this._isLikeBtnClicked = false;
|
848
|
+
this._isDislikeBtnClicked = false;
|
849
|
+
this._likeCount = 0;
|
850
|
+
this._disLikeCount = 0;
|
851
|
+
const selectedLayer = this._selectedGraphic.layer;
|
852
|
+
// check if reporting options are configured for the current selected feature's layer
|
853
|
+
if (this.reportingOptions && this.reportingOptions[selectedLayer.id]) {
|
854
|
+
this._likeField = this.reportingOptions[selectedLayer.id].likeField;
|
855
|
+
this._dislikeField = this.reportingOptions[selectedLayer.id].dislikeField;
|
856
|
+
//if both fields are not found return
|
857
|
+
if (!this._likeField && !this._dislikeField) {
|
858
|
+
return;
|
859
|
+
}
|
860
|
+
//Check if selected layer have the configured like and dislike fields
|
861
|
+
//also, get the current value for like and dislike field from the attributes
|
862
|
+
selectedLayer.fields.forEach((eachField) => {
|
863
|
+
if (this._validFieldTypes.indexOf(eachField.type) > -1) {
|
864
|
+
if (eachField.name === this._likeField && this.reportingOptions[this._selectedGraphic.layer.id].like) {
|
865
|
+
this._likeFieldAvailable = true;
|
866
|
+
this._likeCount = this._selectedGraphic.attributes[eachField.name];
|
867
|
+
}
|
868
|
+
else if (eachField.name === this._dislikeField && this.reportingOptions[this._selectedGraphic.layer.id].dislike) {
|
869
|
+
this._dislikeFieldAvailable = true;
|
870
|
+
this._disLikeCount = this._selectedGraphic.attributes[eachField.name];
|
871
|
+
}
|
872
|
+
}
|
873
|
+
});
|
874
|
+
this.getFromLocalStorage();
|
875
|
+
}
|
876
|
+
}
|
877
|
+
/**
|
878
|
+
* On like button click highlight the like button and update the feature
|
879
|
+
* @protected
|
880
|
+
*/
|
881
|
+
onLikeButtonClick() {
|
882
|
+
this.loadingStatus.emit(true);
|
883
|
+
if (this._isDislikeBtnClicked && this.reportingOptions[this._selectedGraphic.layer.id].dislike) {
|
884
|
+
this.onDislikeButtonClick();
|
885
|
+
}
|
886
|
+
this._isLikeBtnClicked = !this._isLikeBtnClicked;
|
887
|
+
if (this._isLikeBtnClicked) {
|
888
|
+
this._likeCount++;
|
889
|
+
}
|
890
|
+
else {
|
891
|
+
this._likeCount--;
|
892
|
+
}
|
893
|
+
void this.updateFeaturesLikeDislikeField(this._likeField, this._isLikeBtnClicked);
|
894
|
+
}
|
895
|
+
/**
|
896
|
+
* On dislike button click highlight the dislike button and update the feature
|
897
|
+
* @protected
|
898
|
+
*/
|
899
|
+
onDislikeButtonClick() {
|
900
|
+
this.loadingStatus.emit(true);
|
901
|
+
if (this._isLikeBtnClicked && this.reportingOptions[this._selectedGraphic.layer.id].like) {
|
902
|
+
this.onLikeButtonClick();
|
903
|
+
}
|
904
|
+
this._isDislikeBtnClicked = !this._isDislikeBtnClicked;
|
905
|
+
if (this._isDislikeBtnClicked) {
|
906
|
+
this._disLikeCount++;
|
907
|
+
}
|
908
|
+
else {
|
909
|
+
this._disLikeCount--;
|
910
|
+
}
|
911
|
+
void this.updateFeaturesLikeDislikeField(this._dislikeField, this._isDislikeBtnClicked);
|
912
|
+
}
|
913
|
+
/**
|
914
|
+
* Update the feature if user click on like or dislike button
|
915
|
+
* @param fieldName field name of the feature for like or dislike attribute
|
916
|
+
* @param buttonClicked is like or dislike button clicked
|
917
|
+
* @protected
|
918
|
+
*/
|
919
|
+
async updateFeaturesLikeDislikeField(fieldName, buttonClicked) {
|
920
|
+
const attributesToUpdate = {};
|
921
|
+
const selectedLayer = this._selectedGraphic.layer;
|
922
|
+
//Increment the value if button is clicked or else decrement it
|
923
|
+
const selectFeatureAttr = this._selectedGraphic;
|
924
|
+
if (buttonClicked) {
|
925
|
+
selectFeatureAttr.attributes[fieldName] = Number(selectFeatureAttr.attributes[fieldName]) + 1;
|
926
|
+
}
|
927
|
+
else {
|
928
|
+
selectFeatureAttr.attributes[fieldName] = Number(selectFeatureAttr.attributes[fieldName]) - 1;
|
929
|
+
}
|
930
|
+
//use the oid and like/dislike field value to update
|
931
|
+
attributesToUpdate[selectedLayer.objectIdField] = selectFeatureAttr.attributes[selectedLayer.objectIdField];
|
932
|
+
attributesToUpdate[fieldName] = selectFeatureAttr.attributes[fieldName];
|
933
|
+
const newGraphicInstance = new this.Graphic();
|
934
|
+
newGraphicInstance.attributes = attributesToUpdate;
|
935
|
+
// Update the feature attribute in the feature layer
|
936
|
+
const param = { updateFeatures: [newGraphicInstance] };
|
937
|
+
await selectedLayer.applyEdits(param).then(() => {
|
938
|
+
this._selectedGraphic = selectFeatureAttr;
|
939
|
+
//update the current graphics in info card so that, the updated values are reflected in popup content
|
940
|
+
if (this._infoCard) {
|
941
|
+
void this._infoCard.updateCurrentGraphic(this._selectedGraphic);
|
942
|
+
}
|
943
|
+
//store the like dislike value for the current selected graphic in local storage
|
944
|
+
this.setInLocalStorage();
|
945
|
+
this.loadingStatus.emit(false);
|
946
|
+
}, (err) => {
|
947
|
+
this.loadingStatus.emit(false);
|
948
|
+
console.log(err);
|
949
|
+
});
|
950
|
+
}
|
951
|
+
/**
|
952
|
+
* Gets the like/dislike information form local storage and updates the like and dislike button states
|
953
|
+
* @protected
|
954
|
+
*/
|
955
|
+
getFromLocalStorage() {
|
956
|
+
const uniqueLayerId = this._selectedGraphic.layer.id;
|
957
|
+
//get the data from local storage and check current feature is liked or disliked
|
958
|
+
const localStorageUser = localStorage[uniqueLayerId];
|
959
|
+
if (localStorageUser) {
|
960
|
+
const parseArr = JSON.parse(localStorageUser);
|
961
|
+
const res = parseArr.filter((arr) => arr.id === this._selectedGraphic.getObjectId());
|
962
|
+
if (res.length > 0) {
|
963
|
+
this._isLikeBtnClicked = res[0].like;
|
964
|
+
this._isDislikeBtnClicked = res[0].dislike;
|
965
|
+
}
|
966
|
+
}
|
967
|
+
}
|
968
|
+
/**
|
969
|
+
* Sets the like/dislike information for the current selected graphic in local storage
|
970
|
+
* @protected
|
971
|
+
*/
|
972
|
+
setInLocalStorage() {
|
973
|
+
const uniqueLayerId = this._selectedGraphic.layer.id;
|
974
|
+
const localStorageInfo = localStorage[uniqueLayerId];
|
975
|
+
let information = [];
|
976
|
+
//if information for the current layer found in local storage update it
|
977
|
+
//else add new information for the current layer in the local storage
|
978
|
+
if (localStorageInfo) {
|
979
|
+
information = JSON.parse(localStorageInfo);
|
980
|
+
const index = information.findIndex((arr) => arr.id === this._selectedGraphic.getObjectId());
|
981
|
+
//if information for current objectid found delete it, so that we always have info for each oid in a layer only once
|
982
|
+
if (index >= 0) {
|
983
|
+
information.splice(index, 1);
|
984
|
+
}
|
985
|
+
}
|
986
|
+
//add the information for current selected graphic
|
987
|
+
information.push({
|
988
|
+
id: this._selectedGraphic.getObjectId(),
|
989
|
+
like: this._isLikeBtnClicked && this._likeCount !== 0,
|
990
|
+
dislike: this._isDislikeBtnClicked && this._disLikeCount !== 0
|
991
|
+
});
|
992
|
+
localStorage.setItem(uniqueLayerId, JSON.stringify(information));
|
993
|
+
}
|
994
|
+
get el() { return index.getElement(this); }
|
995
|
+
static get watchers() { return {
|
996
|
+
"graphics": ["graphicsWatchHandler"]
|
997
|
+
}; }
|
998
|
+
};
|
999
|
+
FeatureDetails.style = featureDetailsCss;
|
1000
|
+
|
690
1001
|
const featureListCss = ":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.popup-title{font-weight:500;padding:10px 12px}";
|
691
1002
|
|
692
1003
|
const FeatureList = class {
|
@@ -816,7 +1127,20 @@ const FeatureList = class {
|
|
816
1127
|
const selectedLayerView = await mapViewUtils.getFeatureLayerView(this.mapView, this.selectedLayerId);
|
817
1128
|
this._highlightHandle = await mapViewUtils.highlightFeatures([selectedFeatureObjectId], selectedLayerView, this.mapView, true);
|
818
1129
|
}
|
819
|
-
this.
|
1130
|
+
await this.emitSelectedFeature(selectedFeature);
|
1131
|
+
}
|
1132
|
+
/**
|
1133
|
+
* Emit selected feature with its complete graphics and attributes
|
1134
|
+
* @param graphic selected feature graphic
|
1135
|
+
* @protected
|
1136
|
+
*/
|
1137
|
+
async emitSelectedFeature(graphic) {
|
1138
|
+
const layer = graphic.layer;
|
1139
|
+
const query = layer.createQuery();
|
1140
|
+
query.returnGeometry = true;
|
1141
|
+
query.objectIds = [graphic.getObjectId()];
|
1142
|
+
const completeGraphic = await layer.queryFeatures(query);
|
1143
|
+
this.featureSelect.emit(completeGraphic.features[0]);
|
820
1144
|
}
|
821
1145
|
/**
|
822
1146
|
* On feature hover in feature list highlight the feature on the map
|
@@ -1102,5 +1426,6 @@ LayerList.style = layerListCss;
|
|
1102
1426
|
exports.calcite_flow = Flow;
|
1103
1427
|
exports.calcite_flow_item = FlowItem;
|
1104
1428
|
exports.create_feature = CreateFeature;
|
1429
|
+
exports.feature_details = FeatureDetails;
|
1105
1430
|
exports.feature_list = FeatureList;
|
1106
1431
|
exports.layer_list = LayerList;
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
10
10
|
const index = require('./index-105cf2b9.js');
|
11
11
|
const locale = require('./locale-3d0a4bc2.js');
|
12
|
-
const mapViewUtils = require('./mapViewUtils-
|
13
|
-
const downloadUtils = require('./downloadUtils-
|
12
|
+
const mapViewUtils = require('./mapViewUtils-9dc05308.js');
|
13
|
+
const downloadUtils = require('./downloadUtils-dc349b1a.js');
|
14
14
|
require('./esri-loader-ce6c3d3d.js');
|
15
15
|
require('./_commonjsHelpers-480c2e77.js');
|
16
16
|
require('./interfaces-7cd0a48a.js');
|
@@ -305,7 +305,7 @@ const LayerTable = class {
|
|
305
305
|
* @param evt CustomEvent the graphic for the current selection
|
306
306
|
*/
|
307
307
|
async selectionChanged(evt) {
|
308
|
-
const g = evt.detail[0];
|
308
|
+
const g = evt.detail.selectedFeature[0];
|
309
309
|
const oid = g.getObjectId();
|
310
310
|
if (this.zoomAndScrollToSelected) {
|
311
311
|
const i = this._table.viewModel.getObjectIdIndex(oid);
|
@@ -462,7 +462,7 @@ const LayerTable = class {
|
|
462
462
|
_getActionBar() {
|
463
463
|
const containerClass = this.isMobile ? "width-full" : "";
|
464
464
|
const mobileClass = this.isMobile ? "border-top" : "";
|
465
|
-
return (index.h("calcite-action-bar", { class: containerClass, expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, index.h("div", { class: `border-end ${containerClass} ${mobileClass}`, id: "solutions-map-layer-picker-container" }, index.h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, display: "inline-flex", height: 50, isMobile: this.isMobile, mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), !this.isMobile ? this._getActions() : undefined));
|
465
|
+
return (index.h("calcite-action-bar", { class: containerClass, expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, index.h("div", { class: `border-end ${containerClass} ${mobileClass}`, id: "solutions-map-layer-picker-container" }, index.h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, display: "inline-flex", height: 50, isMobile: this.isMobile, mapView: this.mapView, onLayerSelectionChange: (evt) => void this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), !this.isMobile ? this._getActions() : undefined));
|
466
466
|
}
|
467
467
|
/**
|
468
468
|
* Get the actions that are used for various interactions with the table
|
@@ -1749,7 +1749,7 @@ const MapCard = class {
|
|
1749
1749
|
}
|
1750
1750
|
else if (loadDefaultMap) {
|
1751
1751
|
this._defaultWebmapHonored = true;
|
1752
|
-
this._mapPicker.setMapByID(id);
|
1752
|
+
void this._mapPicker.setMapByID(id);
|
1753
1753
|
}
|
1754
1754
|
else if (mapConfigChanged) {
|
1755
1755
|
// Map is the same so no need to reload but we need to update for any changes from the config
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
const index = require('./index-105cf2b9.js');
|
11
11
|
const locale = require('./locale-3d0a4bc2.js');
|
12
12
|
const interfaces = require('./interfaces-7cd0a48a.js');
|
13
|
-
const mapViewUtils = require('./mapViewUtils-
|
13
|
+
const mapViewUtils = require('./mapViewUtils-9dc05308.js');
|
14
14
|
require('./esri-loader-ce6c3d3d.js');
|
15
15
|
require('./_commonjsHelpers-480c2e77.js');
|
16
16
|
|