@esri/solutions-components 0.10.11 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-alert_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +5 -3
- package/dist/cjs/calcite-flow_6.cjs.entry.js +103 -7
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +173 -43
- package/dist/cjs/feature-list.cjs.entry.js +110 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -1
- package/dist/cjs/{popupUtils-92e52dbf.js → popupUtils-47bd97e7.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/collection/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/collection/assets/t9n/feature-list/resources.json +3 -1
- package/dist/collection/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/collection/components/create-feature/create-feature.js +145 -2
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +227 -43
- package/dist/collection/components/feature-list/feature-list.css +16 -1
- package/dist/collection/components/feature-list/feature-list.js +165 -15
- package/dist/collection/components/layer-list/layer-list.js +35 -6
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +6 -4
- package/dist/collection/components/map-select-tools/map-select-tools.js +2 -1
- package/dist/collection/demos/crowdsource-reporter.html +2 -0
- package/dist/collection/utils/popupUtils.js +1 -1
- package/dist/collection/utils/popupUtils.ts +1 -1
- package/dist/components/create-feature2.js +91 -3
- package/dist/components/crowdsource-reporter.js +178 -45
- package/dist/components/feature-list2.js +152 -50
- package/dist/components/layer-list2.js +18 -6
- package/dist/components/map-layer-picker2.js +6 -4
- package/dist/components/map-select-tools2.js +2 -1
- package/dist/components/popupUtils.js +1 -1
- package/dist/esm/calcite-alert_4.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +6 -4
- package/dist/esm/calcite-flow_6.entry.js +104 -8
- package/dist/esm/crowdsource-reporter.entry.js +173 -43
- package/dist/esm/feature-list.entry.js +110 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +2 -1
- package/dist/esm/{popupUtils-00c655fb.js → popupUtils-349a26e6.js} +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/solutions-components/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources.json +3 -1
- package/dist/solutions-components/assets/t9n/feature-list/resources_en.json +3 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +2 -0
- package/dist/solutions-components/{p-1f40908b.entry.js → p-15622ace.entry.js} +2 -2
- package/dist/solutions-components/p-40e305b4.entry.js +17 -0
- package/dist/solutions-components/p-4d44410b.entry.js +6 -0
- package/dist/solutions-components/{p-900fee65.js → p-5a473f0d.js} +1 -1
- package/dist/solutions-components/p-9b83e593.entry.js +6 -0
- package/dist/solutions-components/p-abd3e579.entry.js +6 -0
- package/dist/solutions-components/{p-cde8d6e5.entry.js → p-f6bc95b3.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/popupUtils.ts +1 -1
- package/dist/types/components/create-feature/create-feature.d.ts +34 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +80 -21
- package/dist/types/components/feature-list/feature-list.d.ts +49 -7
- package/dist/types/components/layer-list/layer-list.d.ts +4 -0
- package/dist/types/components.d.ts +77 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-058b77d7.entry.js +0 -6
- package/dist/solutions-components/p-064e43e0.entry.js +0 -6
- package/dist/solutions-components/p-2d1afda0.entry.js +0 -17
- package/dist/solutions-components/p-c9260b4c.entry.js +0 -6
@@ -5,7 +5,7 @@
|
|
5
5
|
*/
|
6
6
|
import { r as registerInstance, c as createEvent, g as getElement, h } from './index-b793d9aa.js';
|
7
7
|
import { l as loadModules, g as getLocaleComponentStrings } from './locale-b1d53fb1.js';
|
8
|
-
import { P as PopupUtils } from './popupUtils-
|
8
|
+
import { P as PopupUtils } from './popupUtils-349a26e6.js';
|
9
9
|
import { g as getLayerOrTable, c as getFeatureLayerView, h as highlightFeatures } from './mapViewUtils-3e3d33ea.js';
|
10
10
|
import './esri-loader-c6842c6b.js';
|
11
11
|
import './_commonjsHelpers-089957fe.js';
|
@@ -14,7 +14,7 @@ import './solution-resource-966f8511.js';
|
|
14
14
|
import './restHelpersGet-788d7f7b.js';
|
15
15
|
import './interfaces-659e3836.js';
|
16
16
|
|
17
|
-
const featureListCss = ":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-padding{padding:10px 12px}.feature-list-popup-title-padding-reduced{padding:10px 0}.profile-img{margin:0 0.75rem;min-width:32px}";
|
17
|
+
const featureListCss = ":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-padding{padding:10px 12px}.feature-list-popup-title-padding-reduced{padding:10px 0}.profile-img{margin:0 0.75rem;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:3px 10px;min-width:30px;display:flex;justify-content:center}";
|
18
18
|
const FeatureListStyle0 = featureListCss;
|
19
19
|
|
20
20
|
const FeatureList = class {
|
@@ -33,6 +33,9 @@ const FeatureList = class {
|
|
33
33
|
this.showInitialLoading = true;
|
34
34
|
this.showErrorWhenNoFeatures = true;
|
35
35
|
this.showUserImageInList = false;
|
36
|
+
this.showFeatureSymbol = false;
|
37
|
+
this.applyLayerViewFilter = false;
|
38
|
+
this.reportingOptions = undefined;
|
36
39
|
this._featureItems = [];
|
37
40
|
this._featuresCount = 0;
|
38
41
|
this._isLoading = false;
|
@@ -54,6 +57,11 @@ const FeatureList = class {
|
|
54
57
|
* Esri config
|
55
58
|
*/
|
56
59
|
esriConfig;
|
60
|
+
/**
|
61
|
+
* "esri/symbols/support/symbolUtils": https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html
|
62
|
+
* Symbol utils
|
63
|
+
*/
|
64
|
+
symbolUtils;
|
57
65
|
/**
|
58
66
|
* IPopupUtils: To fetch the list label using popup titles
|
59
67
|
*/
|
@@ -70,6 +78,18 @@ const FeatureList = class {
|
|
70
78
|
* HTMLCalcitePaginationElement: Calcite pagination element instance
|
71
79
|
*/
|
72
80
|
_pagination;
|
81
|
+
/**
|
82
|
+
* string[]: Valid field types for like
|
83
|
+
*/
|
84
|
+
_validFieldTypes = ["small-integer", "integer", "big-integer", "single", "long"];
|
85
|
+
/**
|
86
|
+
* string: Abbrivated like count of the feature
|
87
|
+
*/
|
88
|
+
_abbreviatedLikeCount;
|
89
|
+
/**
|
90
|
+
* boolean: When true configured like field is available in selected layer
|
91
|
+
*/
|
92
|
+
_likeFieldAvailable = false;
|
73
93
|
//--------------------------------------------------------------------------
|
74
94
|
//
|
75
95
|
// Watch handlers
|
@@ -143,9 +163,9 @@ const FeatureList = class {
|
|
143
163
|
* Renders the component.
|
144
164
|
*/
|
145
165
|
render() {
|
146
|
-
return (h("calcite-panel", { key: '
|
147
|
-
h("calcite-notice", { key: '
|
148
|
-
h("div", { key: '
|
166
|
+
return (h("calcite-panel", { key: 'b84cbd9d8c0f4d9d84fe7a49d149b67e88e46c53', "full-height": true, "full-width": true }, this._isLoading && h("calcite-loader", { key: '91ee86a3223b55141206be0d3f20bca1b777e4db', label: "", scale: "m" }), this.showErrorWhenNoFeatures && this._featureItems.length === 0 && !this._isLoading &&
|
167
|
+
h("calcite-notice", { key: '3c3b4a35c45715a86bd17630e8f3f9b566592c27', class: "error-msg", icon: "feature-details", kind: "info", open: true }, h("div", { key: '63a35389ac64f66c706fa05e92fb8f1af8dd0b69', slot: "message" }, this.noFeaturesFoundMsg ? this.noFeaturesFoundMsg : this._translations.featureErrorMsg)), h("calcite-list", { key: 'a237f97a0d286af17cce837bfbdd3c0d868ea023', "selection-appearance": "border", "selection-mode": "none" }, !this._isLoading && this._featureItems.length > 0 && this._featureItems), this._featuresCount > this.pageSize &&
|
168
|
+
h("div", { key: '9cb166b5095167a2004e93217240bea6789e9039', class: "width-full", slot: "footer" }, h("calcite-pagination", { key: 'a413b26dd30fdc89be1d65ef06995604f1430a18', class: "pagination", "full-width": true, onCalcitePaginationChange: this.pageChanged.bind(this), "page-size": this.pageSize, ref: el => this._pagination = el, "start-item": "1", "total-items": this._featuresCount }))));
|
149
169
|
}
|
150
170
|
//--------------------------------------------------------------------------
|
151
171
|
//
|
@@ -153,23 +173,25 @@ const FeatureList = class {
|
|
153
173
|
//
|
154
174
|
//--------------------------------------------------------------------------
|
155
175
|
/**
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
176
|
+
* Load esri javascript api modules
|
177
|
+
* @returns Promise resolving when function is done
|
178
|
+
* @protected
|
179
|
+
*/
|
160
180
|
async initModules() {
|
161
|
-
const [Color, esriConfig] = await loadModules([
|
181
|
+
const [Color, esriConfig, symbolUtils] = await loadModules([
|
162
182
|
"esri/Color",
|
163
183
|
"esri/config",
|
184
|
+
"esri/symbols/support/symbolUtils"
|
164
185
|
]);
|
165
186
|
this.Color = Color;
|
166
187
|
this.esriConfig = esriConfig;
|
188
|
+
this.symbolUtils = symbolUtils;
|
167
189
|
}
|
168
190
|
/**
|
169
191
|
* Return the where condition string considering the defined where clause and layer's definition expression
|
170
192
|
* @protected
|
171
193
|
*/
|
172
|
-
getWhereCondition() {
|
194
|
+
async getWhereCondition() {
|
173
195
|
//By Default load all the features
|
174
196
|
let whereClause = '1=1';
|
175
197
|
//if where clause is defined use it
|
@@ -180,6 +202,13 @@ const FeatureList = class {
|
|
180
202
|
if (this._selectedLayer?.definitionExpression) {
|
181
203
|
whereClause = whereClause + ' AND ' + this._selectedLayer.definitionExpression;
|
182
204
|
}
|
205
|
+
// if layerview has any applied filter, use it
|
206
|
+
if (this.applyLayerViewFilter) {
|
207
|
+
const selectedLayerView = await getFeatureLayerView(this.mapView, this.selectedLayerId);
|
208
|
+
if (selectedLayerView?.filter?.where) {
|
209
|
+
whereClause = whereClause + ' AND ' + selectedLayerView.filter.where;
|
210
|
+
}
|
211
|
+
}
|
183
212
|
return whereClause;
|
184
213
|
}
|
185
214
|
/**
|
@@ -191,8 +220,9 @@ const FeatureList = class {
|
|
191
220
|
void this._pagination?.goTo("start");
|
192
221
|
this._isLoading = this.showInitialLoading;
|
193
222
|
this._featureItems = await this.queryPage(0);
|
223
|
+
const whereCondition = await this.getWhereCondition();
|
194
224
|
const query = {
|
195
|
-
where:
|
225
|
+
where: whereCondition
|
196
226
|
};
|
197
227
|
this._featuresCount = await this._selectedLayer.queryFeatureCount(query);
|
198
228
|
this._isLoading = false;
|
@@ -278,12 +308,13 @@ const FeatureList = class {
|
|
278
308
|
const featureLayer = this._selectedLayer;
|
279
309
|
const sortField = this.sortingInfo?.field ? this.sortingInfo.field : featureLayer.objectIdField;
|
280
310
|
const sortOrder = this.sortingInfo?.order ? this.sortingInfo.order : 'desc';
|
311
|
+
const whereCondition = await this.getWhereCondition();
|
281
312
|
const query = {
|
282
313
|
start: page,
|
283
314
|
num: this.pageSize,
|
284
315
|
outFields: ["*"],
|
285
316
|
returnGeometry: true,
|
286
|
-
where:
|
317
|
+
where: whereCondition,
|
287
318
|
outSpatialReference: this.mapView.spatialReference.toJSON()
|
288
319
|
};
|
289
320
|
//sort only when sort field and order is valid
|
@@ -301,10 +332,12 @@ const FeatureList = class {
|
|
301
332
|
*/
|
302
333
|
async createFeatureItem(featureSet) {
|
303
334
|
const currentFeatures = featureSet?.features;
|
335
|
+
const showLikeCount = this.reportingOptions && this.reportingOptions[this.selectedLayerId].like;
|
304
336
|
const items = currentFeatures.map(async (feature) => {
|
305
337
|
const popupTitle = await this._popupUtils.getPopupTitle(feature, this.mapView.map);
|
306
338
|
//fetch the feature creator user info to show the creator user image
|
307
339
|
let userInfo;
|
340
|
+
let featureSymbol;
|
308
341
|
if (this.showUserImageInList) {
|
309
342
|
const creatorField = this._selectedLayer.editFieldsInfo?.creatorField.toLowerCase();
|
310
343
|
// if feature's creator field is present then only we can fetch the information of user
|
@@ -312,10 +345,37 @@ const FeatureList = class {
|
|
312
345
|
userInfo = await this.getUserInformation(feature, creatorField);
|
313
346
|
}
|
314
347
|
}
|
315
|
-
|
348
|
+
if (this.showFeatureSymbol) {
|
349
|
+
featureSymbol = await this.getFeatureSymbol(feature);
|
350
|
+
}
|
351
|
+
if (showLikeCount) {
|
352
|
+
void this.getAbbreviatedLikeCount(feature);
|
353
|
+
}
|
354
|
+
return this.getFeatureItem(feature, popupTitle, featureSymbol, userInfo);
|
316
355
|
});
|
317
356
|
return Promise.all(items);
|
318
357
|
}
|
358
|
+
/**
|
359
|
+
* Displays the abbrivated like count on the feature list
|
360
|
+
* @param feature feature of the layer
|
361
|
+
* @protected
|
362
|
+
*/
|
363
|
+
getAbbreviatedLikeCount(feature) {
|
364
|
+
const selectedLayer = this._selectedLayer;
|
365
|
+
const likeField = this.reportingOptions[selectedLayer.id].likeField;
|
366
|
+
selectedLayer.fields.forEach((eachField) => {
|
367
|
+
if (this._validFieldTypes.indexOf(eachField.type) > -1) {
|
368
|
+
if (eachField.name === likeField && this.reportingOptions[selectedLayer.id].like) {
|
369
|
+
this._likeFieldAvailable = true;
|
370
|
+
let likes = feature.attributes[likeField] || 0;
|
371
|
+
if (likes > 999) {
|
372
|
+
likes = likes > 999999 ? this._translations.millionsAbbreviation.replace("{{abbreviated_value}}", Math.floor(likes / 1000000).toString()) : this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}", Math.floor(likes / 1000).toString());
|
373
|
+
}
|
374
|
+
this._abbreviatedLikeCount = likes;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
});
|
378
|
+
}
|
319
379
|
/**
|
320
380
|
* Get each feature item
|
321
381
|
* @param selectedFeature Each individual feature instance to be listed
|
@@ -323,15 +383,19 @@ const FeatureList = class {
|
|
323
383
|
* @returns individual feature item to be rendered
|
324
384
|
* @protected
|
325
385
|
*/
|
326
|
-
getFeatureItem(selectedFeature, popupTitle, userInfo) {
|
386
|
+
getFeatureItem(selectedFeature, popupTitle, featureSymbol, userInfo) {
|
327
387
|
//get the object id value of the feature
|
328
388
|
const oId = selectedFeature.attributes[this._selectedLayer.objectIdField].toString();
|
329
389
|
//use object id if popupTitle is null or undefined
|
330
390
|
popupTitle = popupTitle ?? oId;
|
391
|
+
// get the formatted like count
|
392
|
+
const formattedLikeCount = Number(selectedFeature.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString();
|
331
393
|
const popupTitleClass = this.textSize === 'small' ? 'feature-list-popup-title-small' : 'feature-list-popup-title';
|
332
|
-
const popupTitlePaddingClass = this.showUserImageInList ? 'feature-list-popup-title-padding-reduced' : 'feature-list-popup-title-padding';
|
394
|
+
const popupTitlePaddingClass = this.showUserImageInList || this.showFeatureSymbol ? 'feature-list-popup-title-padding-reduced' : 'feature-list-popup-title-padding';
|
333
395
|
return (h("calcite-list-item", { onCalciteListItemSelect: (e) => { void this.featureClicked(e, selectedFeature); }, onMouseLeave: () => { void this.clearHighlights(); }, onMouseOver: () => { void this.onFeatureHover(selectedFeature); }, value: oId }, this.showUserImageInList &&
|
334
|
-
h("calcite-avatar", { class: 'profile-img', "full-name": userInfo?.fullName, id: userInfo?.id, scale: "m", slot: "content-start", thumbnail: userInfo?.userProfileUrl, username: userInfo?.username }),
|
396
|
+
h("calcite-avatar", { class: 'profile-img', "full-name": userInfo?.fullName, id: userInfo?.id, scale: "m", slot: "content-start", thumbnail: userInfo?.userProfileUrl, username: userInfo?.username }), this.showFeatureSymbol &&
|
397
|
+
h("div", { class: 'feature-symbol', ref: (el) => el && el.appendChild(featureSymbol), slot: "content-start" }), h("div", { class: `${popupTitleClass} ${popupTitlePaddingClass}`, slot: "content-start" }, popupTitle), this._likeFieldAvailable &&
|
398
|
+
h("div", { class: "like-container", id: oId.concat("like"), slot: "content-end" }, h("span", null, this._abbreviatedLikeCount), h("calcite-icon", { icon: "thumbs-up", scale: 's' }), h("calcite-tooltip", { "reference-element": oId.concat("like") }, formattedLikeCount)), h("calcite-icon", { flipRtl: true, icon: "chevron-right", scale: "s", slot: "content-end" })));
|
335
399
|
}
|
336
400
|
/**
|
337
401
|
*
|
@@ -358,6 +422,35 @@ const FeatureList = class {
|
|
358
422
|
userInfo.userProfileUrl = userProfileUrl;
|
359
423
|
return userInfo;
|
360
424
|
}
|
425
|
+
/**
|
426
|
+
* Creates a feature symbology
|
427
|
+
* @param feature Each individual feature
|
428
|
+
* @returns Feature symbology
|
429
|
+
* @protected
|
430
|
+
*/
|
431
|
+
async getFeatureSymbol(feature) {
|
432
|
+
const nodeHtml = document.createElement('div');
|
433
|
+
await this.symbolUtils.getDisplayedSymbol(feature).then(async (symbol) => {
|
434
|
+
symbol && await this.symbolUtils?.renderPreviewHTML(symbol, {
|
435
|
+
node: nodeHtml
|
436
|
+
});
|
437
|
+
if (nodeHtml.children?.length) {
|
438
|
+
const imgOrSvgElm = nodeHtml.children[0];
|
439
|
+
if (imgOrSvgElm) {
|
440
|
+
const height = Number(imgOrSvgElm.getAttribute('height'));
|
441
|
+
const width = Number(imgOrSvgElm.getAttribute('width'));
|
442
|
+
if (width > 30) {
|
443
|
+
imgOrSvgElm.setAttribute('width', '30');
|
444
|
+
}
|
445
|
+
else if (width < 19) {
|
446
|
+
imgOrSvgElm.setAttribute('width', '20');
|
447
|
+
}
|
448
|
+
imgOrSvgElm.setAttribute('viewBox', `0 0 ${width} ${height}`);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
});
|
452
|
+
return nodeHtml;
|
453
|
+
}
|
361
454
|
/**
|
362
455
|
* Fetches the component's translations
|
363
456
|
* @returns Promise when complete
|