@esri/solutions-components 0.2.2 → 0.2.4
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/dist/assets/t9n/solution-config-modal/resources.json +22 -0
- package/dist/assets/t9n/solution-config-modal/resources_en.json +22 -0
- package/dist/cjs/calcite-action-menu_2.cjs.entry.js +18 -401
- package/dist/cjs/calcite-action-menu_2.cjs.entry.js.map +1 -1
- package/dist/cjs/calcite-action_2.cjs.entry.js +423 -71
- package/dist/cjs/calcite-action_2.cjs.entry.js.map +1 -1
- package/dist/cjs/calcite-loader.cjs.entry.js +97 -0
- package/dist/cjs/calcite-loader.cjs.entry.js.map +1 -0
- package/dist/cjs/{solution-configuration.cjs.entry.js → calcite-modal_2.cjs.entry.js} +451 -13
- package/dist/cjs/calcite-modal_2.cjs.entry.js.map +1 -0
- package/dist/cjs/{calcite-shell-panel_14.cjs.entry.js → calcite-panel_12.cjs.entry.js} +455 -709
- package/dist/cjs/calcite-panel_12.cjs.entry.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solution-config-modal.cjs.entry.js +131 -0
- package/dist/cjs/solution-config-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/{solution-contents_3.cjs.entry.js → solution-contents_7.cjs.entry.js} +664 -5
- package/dist/cjs/solution-contents_7.cjs.entry.js.map +1 -0
- package/dist/cjs/{solution-store-893499a5.js → solution-store-09b3fc53.js} +4 -6
- package/dist/cjs/solution-store-09b3fc53.js.map +1 -0
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/solution-config-modal/solution-config-modal.css +91 -0
- package/dist/collection/components/solution-config-modal/solution-config-modal.js +245 -0
- package/dist/collection/components/solution-config-modal/solution-config-modal.js.map +1 -0
- package/dist/collection/components/solution-configuration/solution-configuration.js +23 -17
- package/dist/collection/components/solution-configuration/solution-configuration.js.map +1 -1
- package/dist/collection/components/solution-item/solution-item.js +0 -2
- package/dist/collection/components/solution-item/solution-item.js.map +1 -1
- package/dist/collection/components/solution-item-details/solution-item-details.js +0 -13
- package/dist/collection/components/solution-item-details/solution-item-details.js.map +1 -1
- package/dist/collection/utils/solution-store.js +3 -5
- package/dist/collection/utils/solution-store.js.map +1 -1
- package/dist/collection/utils/solution-store.ts +3 -5
- package/dist/esm/buffer-tools_6.entry.js +2 -2
- package/dist/esm/calcite-action-bar_6.entry.js +2 -2
- package/dist/esm/calcite-action-menu_2.entry.js +20 -403
- package/dist/esm/calcite-action-menu_2.entry.js.map +1 -1
- package/dist/esm/calcite-action_2.entry.js +424 -72
- package/dist/esm/calcite-action_2.entry.js.map +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-loader.entry.js +93 -0
- package/dist/esm/calcite-loader.entry.js.map +1 -0
- package/dist/esm/{solution-configuration.entry.js → calcite-modal_2.entry.js} +453 -16
- package/dist/esm/calcite-modal_2.entry.js.map +1 -0
- package/dist/esm/{calcite-shell-panel_14.entry.js → calcite-panel_12.entry.js} +454 -706
- package/dist/esm/calcite-panel_12.entry.js.map +1 -0
- package/dist/esm/config-layer-picker.entry.js +2 -2
- package/dist/esm/{interfaces-e2a2064d.js → interfaces-1bdfc3a8.js} +2 -2
- package/dist/esm/{interfaces-e2a2064d.js.map → interfaces-1bdfc3a8.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mapViewUtils-09f1e7bd.js → mapViewUtils-809947c8.js} +2 -2
- package/dist/esm/{mapViewUtils-09f1e7bd.js.map → mapViewUtils-809947c8.js.map} +1 -1
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solution-config-modal.entry.js +127 -0
- package/dist/esm/solution-config-modal.entry.js.map +1 -0
- package/dist/esm/{solution-contents_3.entry.js → solution-contents_7.entry.js} +661 -6
- package/dist/esm/solution-contents_7.entry.js.map +1 -0
- package/dist/esm/{solution-store-0c58c852.js → solution-store-d8519c64.js} +5 -7
- package/dist/esm/solution-store-d8519c64.js.map +1 -0
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/{p-be1ed982.entry.js → p-11068040.entry.js} +3 -3
- package/dist/solutions-components/{p-be1ed982.entry.js.map → p-11068040.entry.js.map} +0 -0
- package/dist/solutions-components/{p-659edb14.js → p-2910dd9e.js} +5 -7
- package/dist/{cjs/solution-store-893499a5.js.map → solutions-components/p-2910dd9e.js.map} +1 -1
- package/dist/solutions-components/{p-291fd295.entry.js → p-30810b45.entry.js} +3 -3
- package/dist/solutions-components/{p-291fd295.entry.js.map → p-30810b45.entry.js.map} +0 -0
- package/dist/solutions-components/p-38ddadf2.entry.js +342 -0
- package/dist/solutions-components/p-38ddadf2.entry.js.map +1 -0
- package/dist/solutions-components/{p-77c75f3a.entry.js → p-5b20090f.entry.js} +661 -6
- package/dist/solutions-components/p-5b20090f.entry.js.map +1 -0
- package/dist/solutions-components/{p-9393631c.entry.js → p-9ef1328a.entry.js} +3 -3
- package/dist/solutions-components/{p-9393631c.entry.js.map → p-9ef1328a.entry.js.map} +0 -0
- package/dist/solutions-components/{p-984cb687.entry.js → p-a1786d11.entry.js} +454 -706
- package/dist/solutions-components/p-a1786d11.entry.js.map +1 -0
- package/dist/solutions-components/{p-fe0fdd8b.js → p-c20bd963.js} +2 -2
- package/dist/solutions-components/{p-fe0fdd8b.js.map → p-c20bd963.js.map} +1 -1
- package/dist/solutions-components/p-c5721b0f.entry.js +127 -0
- package/dist/solutions-components/p-c5721b0f.entry.js.map +1 -0
- package/dist/solutions-components/{p-24d75151.entry.js → p-c818e661.entry.js} +3 -3
- package/dist/solutions-components/{p-24d75151.entry.js.map → p-c818e661.entry.js.map} +0 -0
- package/dist/solutions-components/{p-90629c1d.entry.js → p-cf59eb16.entry.js} +453 -16
- package/dist/solutions-components/p-cf59eb16.entry.js.map +1 -0
- package/dist/solutions-components/p-e405ebe8.entry.js +93 -0
- package/dist/solutions-components/p-e405ebe8.entry.js.map +1 -0
- package/dist/solutions-components/{p-77e6b03c.entry.js → p-e6fb9cde.entry.js} +3 -3
- package/dist/solutions-components/{p-77e6b03c.entry.js.map → p-e6fb9cde.entry.js.map} +0 -0
- package/dist/solutions-components/{p-97c4a268.entry.js → p-ef6f9e24.entry.js} +113 -229
- package/dist/solutions-components/p-ef6f9e24.entry.js.map +1 -0
- package/dist/solutions-components/{p-6b9dc092.js → p-f04fdb9a.js} +2 -2
- package/dist/solutions-components/{p-6b9dc092.js.map → p-f04fdb9a.js.map} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/solution-store.ts +3 -5
- package/dist/solutions-components_commit.txt +8 -8
- package/dist/types/components/solution-config-modal/solution-config-modal.d.ts +69 -0
- package/dist/types/components/solution-configuration/solution-configuration.d.ts +4 -2
- package/dist/types/components/solution-item-details/solution-item-details.d.ts +0 -1
- package/dist/types/components.d.ts +43 -5
- package/dist/types/preact.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/calcite-modal.cjs.entry.js +0 -449
- package/dist/cjs/calcite-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/calcite-panel_2.cjs.entry.js +0 -439
- package/dist/cjs/calcite-panel_2.cjs.entry.js.map +0 -1
- package/dist/cjs/calcite-scrim.cjs.entry.js +0 -64
- package/dist/cjs/calcite-scrim.cjs.entry.js.map +0 -1
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js.map +0 -1
- package/dist/cjs/solution-configuration.cjs.entry.js.map +0 -1
- package/dist/cjs/solution-contents_3.cjs.entry.js.map +0 -1
- package/dist/esm/calcite-modal.entry.js +0 -445
- package/dist/esm/calcite-modal.entry.js.map +0 -1
- package/dist/esm/calcite-panel_2.entry.js +0 -434
- package/dist/esm/calcite-panel_2.entry.js.map +0 -1
- package/dist/esm/calcite-scrim.entry.js +0 -60
- package/dist/esm/calcite-scrim.entry.js.map +0 -1
- package/dist/esm/calcite-shell-panel_14.entry.js.map +0 -1
- package/dist/esm/solution-configuration.entry.js.map +0 -1
- package/dist/esm/solution-contents_3.entry.js.map +0 -1
- package/dist/esm/solution-store-0c58c852.js.map +0 -1
- package/dist/solutions-components/p-0fda7d9e.entry.js +0 -434
- package/dist/solutions-components/p-0fda7d9e.entry.js.map +0 -1
- package/dist/solutions-components/p-2ff754ce.entry.js +0 -257
- package/dist/solutions-components/p-2ff754ce.entry.js.map +0 -1
- package/dist/solutions-components/p-30a6199a.entry.js +0 -445
- package/dist/solutions-components/p-30a6199a.entry.js.map +0 -1
- package/dist/solutions-components/p-659edb14.js.map +0 -1
- package/dist/solutions-components/p-77c75f3a.entry.js.map +0 -1
- package/dist/solutions-components/p-90629c1d.entry.js.map +0 -1
- package/dist/solutions-components/p-97c4a268.entry.js.map +0 -1
- package/dist/solutions-components/p-984cb687.entry.js.map +0 -1
- package/dist/solutions-components/p-f5268b4f.entry.js +0 -60
- package/dist/solutions-components/p-f5268b4f.entry.js.map +0 -1
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './p-58c69df2.js';
|
|
7
|
-
import { s as state } from './p-
|
|
7
|
+
import { s as state, E as EFileType } from './p-2910dd9e.js';
|
|
8
8
|
import { g as getLocaleComponentStrings } from './p-20bdf42f.js';
|
|
9
|
-
import './p-
|
|
9
|
+
import { e as EUpdateType } from './p-f04fdb9a.js';
|
|
10
10
|
import './p-f759a6e7.js';
|
|
11
11
|
import './p-3b010ce1.js';
|
|
12
12
|
|
|
@@ -95,7 +95,6 @@ const SolutionItem = class {
|
|
|
95
95
|
this._translations = undefined;
|
|
96
96
|
}
|
|
97
97
|
itemIdWatchHandler() {
|
|
98
|
-
console.log("update item; id " + this.itemId); //???
|
|
99
98
|
const itemEdit = state.getItemInfo(this.itemId);
|
|
100
99
|
this.itemType = itemEdit.type;
|
|
101
100
|
}
|
|
@@ -114,7 +113,6 @@ const SolutionItem = class {
|
|
|
114
113
|
* Renders the component.
|
|
115
114
|
*/
|
|
116
115
|
render() {
|
|
117
|
-
console.log("render item " + this.itemId); //???
|
|
118
116
|
return (h(Host, null, h("div", { class: "configuration-container" }, h("div", { class: "configuration" }, this._showGroupTabs(this.itemType === "Group"), this._showItemTabs(this.itemType !== "Group")))));
|
|
119
117
|
}
|
|
120
118
|
//--------------------------------------------------------------------------
|
|
@@ -169,6 +167,565 @@ const SolutionItem = class {
|
|
|
169
167
|
};
|
|
170
168
|
SolutionItem.style = solutionItemCss;
|
|
171
169
|
|
|
170
|
+
const solutionItemDetailsCss = ".inputBottomSeparation{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:1.5rem}.icon-inline--on-left,.icon-inline--on-right{display:inline;vertical-align:middle;-webkit-margin-end:0.375rem;margin-inline-end:0.375rem;fill:#0079c1}.scale-down{-o-object-fit:scale-down;object-fit:scale-down}.img-container{display:inline;-webkit-margin-end:1rem;margin-inline-end:1rem;max-width:363px}.summary-count-container{display:inline;flex-grow:1;-webkit-margin-start:0.75rem;margin-inline-start:0.75rem}.snippet-count-container{width:calc(100vw - 363px)}.parent-container{max-width:100%;padding:1rem}label{position:relative;margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:1.5rem;display:block;min-width:-moz-min-content;min-width:min-content;box-sizing:border-box;margin-left:0.75rem;margin-right:0.75rem;min-width:0;flex-grow:0;flex-shrink:1}label-group-1-up>.block{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}label-group-2-up>.block{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}label-group-3-up>.block{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}label-group-4-up>.block{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}label-group-5-up>.block{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}label-group-6-up>.block{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}label-group-7-up>.block{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}label-group-8-up>.block{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.tablet-block-group-1-up>label{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.tablet-block-group-2-up>label{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.tablet-block-group-3-up>label{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.tablet-block-group-4-up>label{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.tablet-block-group-5-up>label{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.tablet-block-group-6-up>label{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.tablet-block-group-7-up>label{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.tablet-block-group-8-up>label{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.phone-block-group-1-up>label{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.phone-block-group-2-up>label{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.phone-block-group-3-up>label{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.phone-block-group-4-up>label{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.phone-block-group-5-up>label{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.phone-block-group-6-up>label{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.phone-block-group-7-up>label{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.phone-block-group-8-up>label{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.code-face label{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:normal}.code-face label b,.code-face label strong{font-weight:400}.code-italic label{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:italic}.code-italic label b,.code-italic label strong{font-weight:400}";
|
|
171
|
+
|
|
172
|
+
const SolutionItemDetails = class {
|
|
173
|
+
constructor(hostRef) {
|
|
174
|
+
registerInstance(this, hostRef);
|
|
175
|
+
this.itemId = "";
|
|
176
|
+
this.itemDetails = {
|
|
177
|
+
accessInformation: "",
|
|
178
|
+
description: "",
|
|
179
|
+
licenseInfo: "",
|
|
180
|
+
snippet: "",
|
|
181
|
+
tags: [],
|
|
182
|
+
title: ""
|
|
183
|
+
};
|
|
184
|
+
this.itemEdit = undefined;
|
|
185
|
+
this._translations = undefined;
|
|
186
|
+
this.thumbnail = undefined;
|
|
187
|
+
this.thumbnailContainer = undefined;
|
|
188
|
+
}
|
|
189
|
+
//--------------------------------------------------------------------------
|
|
190
|
+
//
|
|
191
|
+
// Lifecycle
|
|
192
|
+
//
|
|
193
|
+
//--------------------------------------------------------------------------
|
|
194
|
+
/**
|
|
195
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
196
|
+
*/
|
|
197
|
+
async componentWillLoad() {
|
|
198
|
+
return this._getTranslations();
|
|
199
|
+
}
|
|
200
|
+
async componentWillRender() {
|
|
201
|
+
this.itemEdit = state.getItemInfo(this.itemId);
|
|
202
|
+
if (this.itemEdit) {
|
|
203
|
+
this.itemDetails = this.itemEdit.item;
|
|
204
|
+
this.itemType = this.itemDetails.type;
|
|
205
|
+
}
|
|
206
|
+
return Promise.resolve();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Renders the component.
|
|
210
|
+
*/
|
|
211
|
+
render() {
|
|
212
|
+
return (h(Host, null, h("div", { class: "parent-container" }, h("div", { class: "inputBottomSeparation" }, h("calcite-input", { id: "item-title", value: this.itemDetails.title })), h("div", { class: "inputBottomSeparation" }, h("input", { accept: ".jpg,.gif,.png,image/jpg,image/gif,image/png", class: "display-none", onChange: (event) => (this._updateThumbnail(event)), ref: (el) => (this.browseForThumbnail = el), type: "file" }), h("button", { class: "font-size--3 btn-link inline-block trailer-quarter", onClick: () => this._getThumbnail() }, h("svg", { class: "icon-inline icon-inline--on-left", height: "16", viewBox: "0 0 16 16", width: "16" }, h("path", { d: "M14.792 2.666l-1.414-1.413a.965.965 0 0 0-1.385-.03l-1.444 1.444-8.763 8.72L.03 15.481a.371.371 0 0 0 .488.488l4.096-1.756 8.763-8.72-.001-.001.002.002 1.443-1.444a.965.965 0 0 0-.03-1.385zM1.569 14.431l.554-1.293.74.739zm2.338-.924l-1.414-1.414 7.963-7.92 1.414 1.415zm8.67-8.626l-1.413-1.414 1.29-1.29a.306.306 0 0 1 .433 0l.981.98a.306.306 0 0 1 0 .433z" })), this._translations.editThumbnail), h("div", { class: "flex" }, h("div", { class: "img-container", ref: (el) => (this.thumbnailContainer = el) }, h("img", { class: "scale-down", height: "133", id: "item-thumbnail", ref: (el) => (this.thumbnail = el), width: "200" })), h("div", { class: "snippet-count-container" }, h("calcite-input", { id: "item-snippet", maxlength: 250, type: "textarea", value: this.itemDetails.snippet }), h("label", { class: "font-size--3", id: "item-snippet-count", ref: (el) => (this.itemSnippetCount = el) })))), h("calcite-label", null, this._translations.description, h("label", { id: "item-description-label" }, h("calcite-input", { id: "item-description", type: "textarea", value: this.itemDetails.description }))), h("calcite-label", null, this._translations.tags, h("label", { id: "item-tags-label" }, h("calcite-input", { id: "item-tags", value: (this.itemDetails.tags && Array.isArray(this.itemDetails.tags) ? this.itemDetails.tags : [this.itemDetails.tags]).join(",") }))), this.itemType !== "Group" ? h("calcite-label", null, this._translations.credits, h("label", { id: "item-credits-label" }, h("calcite-input", { id: "item-credits", value: this.itemDetails.accessInformation }))) : null, this.itemType !== "Group" ? h("calcite-label", null, h("label", { id: "item-terms-label" }, this._translations.termsOfUse, h("calcite-input", { id: "item-terms", type: "textarea", value: this.itemDetails.licenseInfo }))) : null)));
|
|
213
|
+
}
|
|
214
|
+
componentDidRender() {
|
|
215
|
+
this._loadThumb();
|
|
216
|
+
}
|
|
217
|
+
//--------------------------------------------------------------------------
|
|
218
|
+
//
|
|
219
|
+
// Event Listeners
|
|
220
|
+
//
|
|
221
|
+
//--------------------------------------------------------------------------
|
|
222
|
+
/**
|
|
223
|
+
* Updates the component's value with changes to the input fields.
|
|
224
|
+
*/
|
|
225
|
+
inputReceivedHandler(event) {
|
|
226
|
+
switch (event.target.id) {
|
|
227
|
+
case "item-title":
|
|
228
|
+
this.itemDetails.title = event.target.value;
|
|
229
|
+
this._updateStore();
|
|
230
|
+
break;
|
|
231
|
+
case "item-snippet":
|
|
232
|
+
if (event.target.value.length > 250) {
|
|
233
|
+
event.target.value = event.target.value.substring(0, 250);
|
|
234
|
+
}
|
|
235
|
+
this.itemDetails.snippet = event.target.value;
|
|
236
|
+
this._updateLengthLabel(this.itemDetails.snippet);
|
|
237
|
+
this._updateStore();
|
|
238
|
+
break;
|
|
239
|
+
case "item-description":
|
|
240
|
+
this.itemDetails.description = event.target.value;
|
|
241
|
+
this._updateStore();
|
|
242
|
+
break;
|
|
243
|
+
case "item-tags":
|
|
244
|
+
this.itemDetails.tags = event.target.value;
|
|
245
|
+
this._updateStore();
|
|
246
|
+
break;
|
|
247
|
+
case "item-credits":
|
|
248
|
+
this.itemDetails.accessInformation = event.target.value;
|
|
249
|
+
this._updateStore();
|
|
250
|
+
break;
|
|
251
|
+
case "item-terms":
|
|
252
|
+
this.itemDetails.licenseInfo = event.target.value;
|
|
253
|
+
this._updateStore();
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//--------------------------------------------------------------------------
|
|
258
|
+
//
|
|
259
|
+
// Events
|
|
260
|
+
//
|
|
261
|
+
//--------------------------------------------------------------------------
|
|
262
|
+
//--------------------------------------------------------------------------
|
|
263
|
+
//
|
|
264
|
+
// Public Methods (async)
|
|
265
|
+
//
|
|
266
|
+
//--------------------------------------------------------------------------
|
|
267
|
+
//--------------------------------------------------------------------------
|
|
268
|
+
//
|
|
269
|
+
// Private Methods
|
|
270
|
+
//
|
|
271
|
+
//--------------------------------------------------------------------------
|
|
272
|
+
/**
|
|
273
|
+
* Opens image file browse dialog.
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
_getThumbnail() {
|
|
277
|
+
this.browseForThumbnail.click();
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Load the templates thumbnail
|
|
281
|
+
*
|
|
282
|
+
*/
|
|
283
|
+
_loadThumb() {
|
|
284
|
+
var _a;
|
|
285
|
+
if (this.thumbnail && ((_a = this.itemEdit) === null || _a === void 0 ? void 0 : _a.thumbnail)) {
|
|
286
|
+
// Show the thumbnail
|
|
287
|
+
this.thumbnail.src = URL.createObjectURL(this.itemEdit.thumbnail);
|
|
288
|
+
this.thumbnailContainer.classList.remove("empty-box");
|
|
289
|
+
this.thumbnail.classList.remove("display-none");
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
// Replace the thumbnail with an empty box
|
|
293
|
+
this.thumbnailContainer.classList.add("empty-box");
|
|
294
|
+
this.thumbnail.classList.add("display-none");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Updates the length label to reflect the current number of characters
|
|
299
|
+
* relative to the max number of characters supported.
|
|
300
|
+
*
|
|
301
|
+
* @param phrase the current phrase from the control
|
|
302
|
+
*/
|
|
303
|
+
_updateLengthLabel(phrase) {
|
|
304
|
+
this.itemSnippetCount.innerText =
|
|
305
|
+
this._translations.snippetCountPattern.replace("{{n}}", phrase.length.toString());
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Add or remove the value from the store
|
|
309
|
+
*/
|
|
310
|
+
_updateStore() {
|
|
311
|
+
this.itemEdit = state.getItemInfo(this.itemId);
|
|
312
|
+
this.itemEdit.item = this.itemDetails;
|
|
313
|
+
state.setItemInfo(this.itemEdit);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Gets and displays image result from browse and updates the item in the store.
|
|
317
|
+
*
|
|
318
|
+
* @param event The input controls event that contains the new file
|
|
319
|
+
* @param updateStore boolean that controls if the new value is written to the store
|
|
320
|
+
* should be false on the initial load but true the rest of the time
|
|
321
|
+
*/
|
|
322
|
+
_updateThumbnail(event) {
|
|
323
|
+
const files = event.target.files;
|
|
324
|
+
if (files && files[0]) {
|
|
325
|
+
if (this.thumbnail) {
|
|
326
|
+
// Update UI
|
|
327
|
+
this.thumbnail.src = URL.createObjectURL(files[0]);
|
|
328
|
+
// Update info in store
|
|
329
|
+
this.itemEdit = state.getItemInfo(this.itemId);
|
|
330
|
+
this.itemEdit.thumbnail = files[0];
|
|
331
|
+
state.replaceItemThumbnail(this.itemEdit);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Fetches the component's translations
|
|
337
|
+
*
|
|
338
|
+
* @protected
|
|
339
|
+
*/
|
|
340
|
+
async _getTranslations() {
|
|
341
|
+
const translations = await getLocaleComponentStrings(this.el);
|
|
342
|
+
this._translations = translations[0];
|
|
343
|
+
}
|
|
344
|
+
get el() { return getElement(this); }
|
|
345
|
+
};
|
|
346
|
+
SolutionItemDetails.style = solutionItemDetailsCss;
|
|
347
|
+
|
|
348
|
+
const solutionItemSharingCss = ":host{display:block;box-sizing:border-box;margin-left:0.75rem;margin-right:0.75rem;min-width:0;flex-grow:0;flex-shrink:1}:host-group-1-up>.block{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}:host-group-2-up>.block{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}:host-group-3-up>.block{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}:host-group-4-up>.block{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}:host-group-5-up>.block{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}:host-group-6-up>.block{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}:host-group-7-up>.block{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}:host-group-8-up>.block{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.tablet-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.tablet-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.tablet-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.tablet-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.tablet-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.tablet-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.tablet-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.tablet-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.phone-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.phone-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.phone-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.phone-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.phone-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.phone-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.phone-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.phone-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.code-face :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:normal}.code-face :host b,.code-face :host strong{font-weight:400}.code-italic :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:italic}.code-italic :host b,.code-italic :host strong{font-weight:400}.container-border{padding:1rem}.icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
|
|
349
|
+
|
|
350
|
+
const SolutionItemSharing = class {
|
|
351
|
+
constructor(hostRef) {
|
|
352
|
+
registerInstance(this, hostRef);
|
|
353
|
+
this.groupId = "";
|
|
354
|
+
this._translations = undefined;
|
|
355
|
+
this.sharing = [];
|
|
356
|
+
}
|
|
357
|
+
itemIdWatchHandler() {
|
|
358
|
+
const itemEdit = state.getItemInfo(this.groupId);
|
|
359
|
+
this.sharing = itemEdit.groupDetails;
|
|
360
|
+
}
|
|
361
|
+
//--------------------------------------------------------------------------
|
|
362
|
+
//
|
|
363
|
+
// Lifecycle
|
|
364
|
+
//
|
|
365
|
+
//--------------------------------------------------------------------------
|
|
366
|
+
/**
|
|
367
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
368
|
+
*/
|
|
369
|
+
async componentWillLoad() {
|
|
370
|
+
return this._getTranslations();
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Renders the component.
|
|
374
|
+
*/
|
|
375
|
+
render() {
|
|
376
|
+
return (h(Host, null, h("div", { class: "container-border" }, h("calcite-label", null, this._translations.groupInfo), this._renderItems(this.sharing))));
|
|
377
|
+
}
|
|
378
|
+
//--------------------------------------------------------------------------
|
|
379
|
+
//
|
|
380
|
+
// Event Listeners
|
|
381
|
+
//
|
|
382
|
+
//--------------------------------------------------------------------------
|
|
383
|
+
//--------------------------------------------------------------------------
|
|
384
|
+
//
|
|
385
|
+
// Events
|
|
386
|
+
//
|
|
387
|
+
//--------------------------------------------------------------------------
|
|
388
|
+
//--------------------------------------------------------------------------
|
|
389
|
+
//
|
|
390
|
+
// Public Methods (async)
|
|
391
|
+
//
|
|
392
|
+
//--------------------------------------------------------------------------
|
|
393
|
+
async getShareInfo() {
|
|
394
|
+
return this.sharing;
|
|
395
|
+
}
|
|
396
|
+
//--------------------------------------------------------------------------
|
|
397
|
+
//
|
|
398
|
+
// Private Methods
|
|
399
|
+
//
|
|
400
|
+
//--------------------------------------------------------------------------
|
|
401
|
+
/**
|
|
402
|
+
* Render share options based on the list of share details
|
|
403
|
+
*
|
|
404
|
+
* @param objs list of IItemShare objects that are used to expose and store share info for the solutions items
|
|
405
|
+
*/
|
|
406
|
+
_renderItems(objs) {
|
|
407
|
+
return objs && objs.length > 0
|
|
408
|
+
? objs.map(item => {
|
|
409
|
+
return (h("calcite-label", { layout: "inline" }, h("calcite-switch", { id: item.id, name: "setting", onCalciteSwitchChange: (event) => this._updateItem(event), scale: "m", switched: item.shareItem, value: "enabled" }), h("solution-item-icon", { type: item.type, typeKeywords: item.typeKeywords }), h("span", { class: "icon-text", title: item.title }, item.title)));
|
|
410
|
+
})
|
|
411
|
+
: null;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Update the items share prop based on the switch state
|
|
415
|
+
*
|
|
416
|
+
* @param event onCalciteSwitchChange event
|
|
417
|
+
*/
|
|
418
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
419
|
+
_updateItem(event) {
|
|
420
|
+
const id = event.target.id;
|
|
421
|
+
this.sharing = this.sharing.map((itemShare) => {
|
|
422
|
+
if (itemShare.id === id) {
|
|
423
|
+
// update the item
|
|
424
|
+
itemShare.shareItem = event.detail.switched;
|
|
425
|
+
// update the item in the store
|
|
426
|
+
const itemEdit = state.getItemInfo(id);
|
|
427
|
+
if (itemShare.shareItem) {
|
|
428
|
+
// Add the group to the item if it's not already there
|
|
429
|
+
if (!itemEdit.groups) {
|
|
430
|
+
itemEdit.groups = [this.groupId];
|
|
431
|
+
}
|
|
432
|
+
else if (itemEdit.groups.indexOf(this.groupId) < 0) {
|
|
433
|
+
itemEdit.groups.push(this.groupId);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
// Remove the group from the item if it's there
|
|
438
|
+
if (itemEdit.groups) {
|
|
439
|
+
const i = itemEdit.groups.indexOf(this.groupId);
|
|
440
|
+
if (i > -1) {
|
|
441
|
+
itemEdit.groups.splice(i, 1);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
state.setItemInfo(itemEdit);
|
|
446
|
+
}
|
|
447
|
+
return itemShare;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Fetches the component's translations
|
|
452
|
+
*
|
|
453
|
+
* @protected
|
|
454
|
+
*/
|
|
455
|
+
async _getTranslations() {
|
|
456
|
+
const translations = await getLocaleComponentStrings(this.el);
|
|
457
|
+
this._translations = translations[0];
|
|
458
|
+
}
|
|
459
|
+
get el() { return getElement(this); }
|
|
460
|
+
static get watchers() { return {
|
|
461
|
+
"groupId": ["itemIdWatchHandler"]
|
|
462
|
+
}; }
|
|
463
|
+
};
|
|
464
|
+
SolutionItemSharing.style = solutionItemSharingCss;
|
|
465
|
+
|
|
466
|
+
const solutionResourceItemCss = ":host{display:block;box-sizing:border-box;margin-left:0.75rem;margin-right:0.75rem;min-width:0;flex-grow:0;flex-shrink:1}:host-group-1-up>.block{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}:host-group-2-up>.block{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}:host-group-3-up>.block{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}:host-group-4-up>.block{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}:host-group-5-up>.block{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}:host-group-6-up>.block{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}:host-group-7-up>.block{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}:host-group-8-up>.block{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.tablet-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.tablet-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.tablet-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.tablet-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.tablet-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.tablet-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.tablet-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.tablet-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.phone-block-group-1-up>:host{flex-basis:calc(100% - 1.5rem);width:calc(100% - 1.5rem)}.phone-block-group-2-up>:host{flex-basis:calc(50% - 1.5rem);width:calc(50% - 1.5rem)}.phone-block-group-3-up>:host{flex-basis:calc(33.33333% - 1.5rem);width:calc(33.33333% - 1.5rem)}.phone-block-group-4-up>:host{flex-basis:calc(25% - 1.5rem);width:calc(25% - 1.5rem)}.phone-block-group-5-up>:host{flex-basis:calc(20% - 1.5rem);width:calc(20% - 1.5rem)}.phone-block-group-6-up>:host{flex-basis:calc(16.66666% - 1.5rem);width:calc(16.66666% - 1.5rem)}.phone-block-group-7-up>:host{flex-basis:calc(14.2857% - 1.5rem);width:calc(14.2857% - 1.5rem)}.phone-block-group-8-up>:host{flex-basis:calc(12.5% - 1.5rem);width:calc(12.5% - 1.5rem)}.code-face :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:normal}.code-face :host b,.code-face :host strong{font-weight:400}.code-italic :host{letter-spacing:0em;font-family:\"Consolas\", \"Andale Mono\", \"Lucida Console\", \"Monaco\", monospace;font-weight:400;font-style:italic}.code-italic :host b,.code-italic :host strong{font-weight:400}.resource-item{padding:1rem}.resource-button{-webkit-margin-end:1rem;margin-inline-end:1rem}.resource-progress{padding-top:1rem}.resources-container{border:1px #808080 solid}.margin-bottom-1{margin-bottom:1rem}";
|
|
467
|
+
|
|
468
|
+
const SolutionResourceItem = class {
|
|
469
|
+
constructor(hostRef) {
|
|
470
|
+
registerInstance(this, hostRef);
|
|
471
|
+
this._removedResources = {};
|
|
472
|
+
this.authentication = undefined;
|
|
473
|
+
this.itemId = "";
|
|
474
|
+
this.resourceFilePaths = [];
|
|
475
|
+
this.resources = [];
|
|
476
|
+
this._translations = undefined;
|
|
477
|
+
}
|
|
478
|
+
itemIdWatchHandler() {
|
|
479
|
+
const item = state.getItemInfo(this.itemId);
|
|
480
|
+
this.resourceFilePaths = item.resourceFilePaths;
|
|
481
|
+
this.resources = item.resources.map(
|
|
482
|
+
// False linting error
|
|
483
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
484
|
+
(path) => path.substring(path.lastIndexOf("/") + 1));
|
|
485
|
+
}
|
|
486
|
+
//--------------------------------------------------------------------------
|
|
487
|
+
//
|
|
488
|
+
// Lifecycle
|
|
489
|
+
//
|
|
490
|
+
//--------------------------------------------------------------------------
|
|
491
|
+
/**
|
|
492
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
493
|
+
*/
|
|
494
|
+
componentWillLoad() {
|
|
495
|
+
return this._getTranslations();
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Renders the component.
|
|
499
|
+
*/
|
|
500
|
+
render() {
|
|
501
|
+
const hasValidResources = this._hasValidResources();
|
|
502
|
+
return (h(Host, null, h("div", { class: "resource-item" }, h("div", { class: "margin-bottom-1" }, h("calcite-button", { appearance: "solid", class: "resource-button", color: "blue", onClick: () => this._addNewResource() }, this._translations.addResource), h("calcite-button", { appearance: "solid", color: "blue", disabled: !hasValidResources, onClick: () => this._downloadAll() }, this._translations.downloadAll)), h("div", { class: "resources-container", style: { display: hasValidResources ? "inherit" : "none" } }, this._renderResourceList()))));
|
|
503
|
+
}
|
|
504
|
+
//--------------------------------------------------------------------------
|
|
505
|
+
//
|
|
506
|
+
// Event Listeners
|
|
507
|
+
//
|
|
508
|
+
//--------------------------------------------------------------------------
|
|
509
|
+
//--------------------------------------------------------------------------
|
|
510
|
+
//
|
|
511
|
+
// Events
|
|
512
|
+
//
|
|
513
|
+
//--------------------------------------------------------------------------
|
|
514
|
+
//--------------------------------------------------------------------------
|
|
515
|
+
//
|
|
516
|
+
// Public Methods (async)
|
|
517
|
+
//
|
|
518
|
+
//--------------------------------------------------------------------------
|
|
519
|
+
//--------------------------------------------------------------------------
|
|
520
|
+
//
|
|
521
|
+
// Private Methods
|
|
522
|
+
//
|
|
523
|
+
//--------------------------------------------------------------------------
|
|
524
|
+
/**
|
|
525
|
+
* Render resources while avoiding thumbnail resoures that are managed by solution-item
|
|
526
|
+
*
|
|
527
|
+
*/
|
|
528
|
+
_renderResourceList() {
|
|
529
|
+
return (h("calcite-value-list", { multiple: true }, this.resourceFilePaths.reduce((prev, cur) => {
|
|
530
|
+
if (cur.type !== EFileType.Thumbnail) {
|
|
531
|
+
prev.push(this._renderResource(cur));
|
|
532
|
+
}
|
|
533
|
+
return prev;
|
|
534
|
+
}, [])));
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Render the resource and supporting actions for download/update/delete/(reset..if deleted)
|
|
538
|
+
*
|
|
539
|
+
* @param resource the filename and url used to interact with the resource
|
|
540
|
+
*/
|
|
541
|
+
_renderResource(resource) {
|
|
542
|
+
const resettable = resource.updateType === EUpdateType.Remove;
|
|
543
|
+
const fullname = resource.folder ? resource.folder + "/" + resource.filename : resource.filename;
|
|
544
|
+
return (h("calcite-value-list-item", { class: resettable ? "disabled" : "", label: fullname, nonInteractive: true, value: resource.url }, h("calcite-action-group", { "expand-disabled": "true", layout: "horizontal", slot: "actions-end" }, h("calcite-action", { disabled: resettable, icon: "download", label: this._translations.download, onClick: () => this._download(resource.url, resource.filename), scale: "m", text: this._translations.download, title: this._translations.download }), h("calcite-action", { disabled: resettable, icon: "upload-to", label: this._translations.update, onClick: () => this._upload(resource), scale: "m", text: this._translations.update, title: this._translations.update }), h("calcite-action", { disabled: resettable, icon: "trash", label: this._translations.delete, onClick: () => this._delete(resource), scale: "m", text: this._translations.delete, title: this._translations.delete }), resettable ? h("calcite-action", { icon: "reset", label: this._translations.reset, onClick: () => this._reset(resource.filename), scale: "m", text: this._translations.reset, title: this._translations.reset }) : h("div", { class: "display-none" }))));
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Adds the name to the deleted array so it will be skipped while rendering
|
|
548
|
+
* but still exist if the user chooses to reset
|
|
549
|
+
*
|
|
550
|
+
* @param resource the resource to be updated
|
|
551
|
+
*/
|
|
552
|
+
_delete(resource) {
|
|
553
|
+
resource.updateType = EUpdateType.Remove;
|
|
554
|
+
this.resourceFilePaths = [...this.resourceFilePaths]; // to trigger refresh
|
|
555
|
+
this._updateStore();
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Remove the name from the deleted array so it will again be rendered
|
|
559
|
+
*
|
|
560
|
+
* @param name the name to be added to the deleted array
|
|
561
|
+
*/
|
|
562
|
+
_reset(name) {
|
|
563
|
+
// need to make sure I know if this reset is from the source or a new one
|
|
564
|
+
// Because the item's `resources` array is not updated until (and if) the solution is saved,
|
|
565
|
+
// we can use it for the reset info
|
|
566
|
+
this.resources.some(resourceName => resourceName === name) ?
|
|
567
|
+
// Undo removing an existing resource
|
|
568
|
+
this.resourceFilePaths = this.resourceFilePaths.map(p => {
|
|
569
|
+
if (p.filename === name) {
|
|
570
|
+
p.updateType = EUpdateType.None;
|
|
571
|
+
}
|
|
572
|
+
return p;
|
|
573
|
+
}) :
|
|
574
|
+
// Undo cancelling the adding of a resource
|
|
575
|
+
this.resourceFilePaths = this.resourceFilePaths.map(p => {
|
|
576
|
+
if (p.filename === name) {
|
|
577
|
+
p.updateType = EUpdateType.Add;
|
|
578
|
+
}
|
|
579
|
+
return p;
|
|
580
|
+
});
|
|
581
|
+
this._updateStore();
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Download all of the templates resources
|
|
585
|
+
*
|
|
586
|
+
*/
|
|
587
|
+
_downloadAll() {
|
|
588
|
+
this.resourceFilePaths.forEach((resource) => {
|
|
589
|
+
this._download(resource.url, resource.filename);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Download the current resource
|
|
594
|
+
*
|
|
595
|
+
* @param url the resource url
|
|
596
|
+
* @param name the resource name
|
|
597
|
+
*/
|
|
598
|
+
_download(url, name) {
|
|
599
|
+
// files that have been added manually do not need to be requested from the item
|
|
600
|
+
if (url.startsWith("blob")) {
|
|
601
|
+
this.downloadFile(url, name);
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
const _url = `${url}?token=${this.authentication.token}`;
|
|
605
|
+
void this.fetchAndDownload(_url, name);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Dynamically creates an anchor and downloads the file
|
|
610
|
+
*
|
|
611
|
+
* @param url the url of the resource
|
|
612
|
+
* @param name the name of the resource
|
|
613
|
+
*/
|
|
614
|
+
downloadFile(url, name) {
|
|
615
|
+
const link = document.createElement("a");
|
|
616
|
+
link.href = url;
|
|
617
|
+
link.download = name;
|
|
618
|
+
link.target = "_blank";
|
|
619
|
+
link.click();
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Check if the template resources have any non-thumbnail resources
|
|
623
|
+
*
|
|
624
|
+
* @returns true if we have data resources and false if only thumbnail
|
|
625
|
+
*/
|
|
626
|
+
_hasValidResources() {
|
|
627
|
+
return this.resourceFilePaths.some(r => r.url.indexOf("_info_thumbnail") < 0);
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Fetches and downloads the resource from the solution
|
|
631
|
+
*
|
|
632
|
+
* @param url the url of the resource
|
|
633
|
+
* @param name the name of the resource
|
|
634
|
+
*/
|
|
635
|
+
async fetchAndDownload(url, name) {
|
|
636
|
+
const image = await fetch(url);
|
|
637
|
+
const b = await image.blob();
|
|
638
|
+
const bURL = URL.createObjectURL(b);
|
|
639
|
+
this.downloadFile(bURL, name);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Create an input element to support the uploading of the resource and upload the resource
|
|
643
|
+
*
|
|
644
|
+
* @param resource the resource to be updated
|
|
645
|
+
*/
|
|
646
|
+
_upload(resource) {
|
|
647
|
+
const _input = document.createElement("input");
|
|
648
|
+
_input.classList.add("display-none");
|
|
649
|
+
_input.onchange = this._updateResource.bind(this, resource);
|
|
650
|
+
_input.type = "file";
|
|
651
|
+
_input.click();
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Create an input element to support the uploading of a resource and add the new resource
|
|
655
|
+
*
|
|
656
|
+
*/
|
|
657
|
+
_addNewResource() {
|
|
658
|
+
const _input = document.createElement("input");
|
|
659
|
+
_input.classList.add("display-none");
|
|
660
|
+
_input.onchange = this._add.bind(this);
|
|
661
|
+
_input.type = "file";
|
|
662
|
+
_input.click();
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Replace the resource file path when update action is used
|
|
666
|
+
*
|
|
667
|
+
* @param resourcePath the resource to be updated
|
|
668
|
+
* @param event the input event that contains the file
|
|
669
|
+
*/
|
|
670
|
+
_updateResource(resourcePath, event) {
|
|
671
|
+
const files = event.target.files;
|
|
672
|
+
if (files && files[0]) {
|
|
673
|
+
resourcePath.blob = files[0];
|
|
674
|
+
resourcePath.updateType = EUpdateType.Update;
|
|
675
|
+
this._updateStore();
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Add the new resource to the resource file paths
|
|
680
|
+
*
|
|
681
|
+
* @param event the inputs event that contains the new file
|
|
682
|
+
*/
|
|
683
|
+
_add(event) {
|
|
684
|
+
const files = event.target.files;
|
|
685
|
+
if (files && files[0]) {
|
|
686
|
+
const url = URL.createObjectURL(files[0]);
|
|
687
|
+
const filename = files[0].name;
|
|
688
|
+
// Add the item if it's not already in the resource file paths list
|
|
689
|
+
if (!this.resourceFilePaths.some(r => r.filename === filename && r.url === url)) {
|
|
690
|
+
this.resourceFilePaths = [
|
|
691
|
+
...this.resourceFilePaths,
|
|
692
|
+
{
|
|
693
|
+
url,
|
|
694
|
+
type: EFileType.Data,
|
|
695
|
+
folder: undefined,
|
|
696
|
+
filename,
|
|
697
|
+
blob: files[0],
|
|
698
|
+
updateType: EUpdateType.Add
|
|
699
|
+
}
|
|
700
|
+
];
|
|
701
|
+
this._updateStore();
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Add or remove the value from the store
|
|
707
|
+
*/
|
|
708
|
+
_updateStore() {
|
|
709
|
+
const item = state.getItemInfo(this.itemId);
|
|
710
|
+
item.resourceFilePaths = this.resourceFilePaths;
|
|
711
|
+
state.setItemInfo(item);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Fetches the component's translations
|
|
715
|
+
*
|
|
716
|
+
* @protected
|
|
717
|
+
*/
|
|
718
|
+
async _getTranslations() {
|
|
719
|
+
const translations = await getLocaleComponentStrings(this.el);
|
|
720
|
+
this._translations = translations[0];
|
|
721
|
+
}
|
|
722
|
+
get el() { return getElement(this); }
|
|
723
|
+
static get watchers() { return {
|
|
724
|
+
"itemId": ["itemIdWatchHandler"]
|
|
725
|
+
}; }
|
|
726
|
+
};
|
|
727
|
+
SolutionResourceItem.style = solutionResourceItemCss;
|
|
728
|
+
|
|
172
729
|
/** @license
|
|
173
730
|
* Copyright 2022 Esri
|
|
174
731
|
*
|
|
@@ -21529,6 +22086,104 @@ const SolutionSpatialRef = class {
|
|
|
21529
22086
|
};
|
|
21530
22087
|
SolutionSpatialRef.style = solutionSpatialRefCss;
|
|
21531
22088
|
|
|
21532
|
-
|
|
22089
|
+
const solutionTemplateDataCss = ":host{display:flexbox}.solution-data-container{position:absolute;height:-moz-available;height:calc(100% - 48px);height:-webkit-fill-available;height:stretch;width:-moz-available;width:100%;width:-webkit-fill-available;width:stretch}.solution-data-child-container{display:flex;height:100%;width:100%;flex-direction:column;overflow-y:auto}.solution-data-editor-container{height:100%}.solution-data-child-container-collapsed{display:flex;height:100%;flex-direction:column;overflow:auto;width:50px}.inputBottomSeparation{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:1.5rem}.json-editor{margin:1rem;width:auto;width:-webkit-fill-available -moz-available}.collapse-btn{padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:0px}.org-vars{padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:0px}.sol-vars{padding-top:0px;padding-bottom:0px;padding-left:1rem;padding-right:1rem;min-height:45%}.padding-1{padding:1rem}.light{background-color:#F4F4F4}";
|
|
22090
|
+
|
|
22091
|
+
const SolutionTemplateData = class {
|
|
22092
|
+
//--------------------------------------------------------------------------
|
|
22093
|
+
//
|
|
22094
|
+
// Lifecycle
|
|
22095
|
+
//
|
|
22096
|
+
//--------------------------------------------------------------------------
|
|
22097
|
+
constructor(hostRef) {
|
|
22098
|
+
registerInstance(this, hostRef);
|
|
22099
|
+
this._initializing = false;
|
|
22100
|
+
this.instanceid = "";
|
|
22101
|
+
this.itemId = "";
|
|
22102
|
+
this.organizationVariables = "";
|
|
22103
|
+
this.solutionVariables = "";
|
|
22104
|
+
this.varsOpen = true;
|
|
22105
|
+
this._translations = undefined;
|
|
22106
|
+
this.value = "";
|
|
22107
|
+
window.addEventListener("solutionEditorContentChanged", (evt) => {
|
|
22108
|
+
if (this.itemId) {
|
|
22109
|
+
const { id, contents } = evt.detail;
|
|
22110
|
+
const [itemId, instanceId] = id.split("|");
|
|
22111
|
+
if (itemId == this.itemId && instanceId === this.instanceid) {
|
|
22112
|
+
if (!this._initializing && contents.length > 0) {
|
|
22113
|
+
const itemEdit = state.getItemInfo(itemId);
|
|
22114
|
+
if (instanceId === "data") {
|
|
22115
|
+
itemEdit.data = JSON.parse(contents);
|
|
22116
|
+
}
|
|
22117
|
+
else {
|
|
22118
|
+
itemEdit.properties = JSON.parse(contents);
|
|
22119
|
+
}
|
|
22120
|
+
state.setItemInfo(itemEdit);
|
|
22121
|
+
}
|
|
22122
|
+
this._initializing = false;
|
|
22123
|
+
}
|
|
22124
|
+
}
|
|
22125
|
+
});
|
|
22126
|
+
}
|
|
22127
|
+
itemIdWatchHandler() {
|
|
22128
|
+
this._initializing = true;
|
|
22129
|
+
this.value = JSON.stringify(this.instanceid === "data"
|
|
22130
|
+
? state.getItemInfo(this.itemId).data
|
|
22131
|
+
: state.getItemInfo(this.itemId).properties, null, 2);
|
|
22132
|
+
}
|
|
22133
|
+
/**
|
|
22134
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
22135
|
+
*/
|
|
22136
|
+
componentWillLoad() {
|
|
22137
|
+
return this._getTranslations();
|
|
22138
|
+
}
|
|
22139
|
+
/**
|
|
22140
|
+
* Renders the component.
|
|
22141
|
+
*/
|
|
22142
|
+
render() {
|
|
22143
|
+
return (h(Host, null, h("div", { class: "solution-data-container" }, h("calcite-shell", { class: "light var-container", dir: "ltr" }, h("calcite-panel", { class: "json-editor" }, h("div", { class: "solution-data-child-container calcite-match-height" }, h("json-editor", { class: "solution-data-editor-container", instanceid: this.itemId + "|" + this.instanceid, value: this.value }))), h("calcite-shell-panel", { "height-scale": "l", position: "end", slot: "contextual-panel", "width-scale": "xs" }, h("div", { class: this.varsOpen ? "solution-data-child-container" : "solution-data-child-container-collapsed" }, h("calcite-button", { appearance: "transparent", class: "collapse-btn", "icon-start": this.varsOpen ? "chevrons-right" : "chevrons-left", id: "collapse-vars", onClick: () => this._toggleVars(), scale: "s", title: this.varsOpen ? this._translations.collapse : this._translations.expand }), h("div", { class: this.varsOpen ? "org-vars" : "org-vars display-none", id: "orgVars" }, h("solution-organization-variables", { value: this.organizationVariables })), h("div", { class: this.varsOpen ? "sol-vars" : "sol-vars display-none", id: "solVars" }, h("solution-variables", { value: this.solutionVariables }))))))));
|
|
22144
|
+
}
|
|
22145
|
+
//--------------------------------------------------------------------------
|
|
22146
|
+
//
|
|
22147
|
+
// Event Listeners
|
|
22148
|
+
//
|
|
22149
|
+
//--------------------------------------------------------------------------
|
|
22150
|
+
//--------------------------------------------------------------------------
|
|
22151
|
+
//
|
|
22152
|
+
// Events
|
|
22153
|
+
//
|
|
22154
|
+
//--------------------------------------------------------------------------
|
|
22155
|
+
//--------------------------------------------------------------------------
|
|
22156
|
+
//
|
|
22157
|
+
// Public Methods (async)
|
|
22158
|
+
//
|
|
22159
|
+
//--------------------------------------------------------------------------
|
|
22160
|
+
//--------------------------------------------------------------------------
|
|
22161
|
+
//
|
|
22162
|
+
// Private Methods
|
|
22163
|
+
//
|
|
22164
|
+
//--------------------------------------------------------------------------
|
|
22165
|
+
/**
|
|
22166
|
+
* Toggle varsOpen prop to show/hide variable containers
|
|
22167
|
+
*/
|
|
22168
|
+
_toggleVars() {
|
|
22169
|
+
this.varsOpen = !this.varsOpen;
|
|
22170
|
+
}
|
|
22171
|
+
/**
|
|
22172
|
+
* Fetches the component's translations
|
|
22173
|
+
*
|
|
22174
|
+
* @protected
|
|
22175
|
+
*/
|
|
22176
|
+
async _getTranslations() {
|
|
22177
|
+
const translations = await getLocaleComponentStrings(this.el);
|
|
22178
|
+
this._translations = translations[0];
|
|
22179
|
+
}
|
|
22180
|
+
get el() { return getElement(this); }
|
|
22181
|
+
static get watchers() { return {
|
|
22182
|
+
"itemId": ["itemIdWatchHandler"]
|
|
22183
|
+
}; }
|
|
22184
|
+
};
|
|
22185
|
+
SolutionTemplateData.style = solutionTemplateDataCss;
|
|
22186
|
+
|
|
22187
|
+
export { SolutionContents as solution_contents, SolutionItem as solution_item, SolutionItemDetails as solution_item_details, SolutionItemSharing as solution_item_sharing, SolutionResourceItem as solution_resource_item, SolutionSpatialRef as solution_spatial_ref, SolutionTemplateData as solution_template_data };
|
|
21533
22188
|
|
|
21534
|
-
//# sourceMappingURL=p-
|
|
22189
|
+
//# sourceMappingURL=p-5b20090f.entry.js.map
|