@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
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
10
|
const index = require('./index-a86078a0.js');
|
|
11
|
-
const solutionStore = require('./solution-store-
|
|
11
|
+
const solutionStore = require('./solution-store-09b3fc53.js');
|
|
12
12
|
const locale = require('./locale-746a095d.js');
|
|
13
|
-
require('./interfaces-ab603e16.js');
|
|
13
|
+
const interfaces = require('./interfaces-ab603e16.js');
|
|
14
14
|
require('./index-d7f9770d.js');
|
|
15
15
|
require('./_commonjsHelpers-6aafa5de.js');
|
|
16
16
|
|
|
@@ -99,7 +99,6 @@ const SolutionItem = class {
|
|
|
99
99
|
this._translations = undefined;
|
|
100
100
|
}
|
|
101
101
|
itemIdWatchHandler() {
|
|
102
|
-
console.log("update item; id " + this.itemId); //???
|
|
103
102
|
const itemEdit = solutionStore.state.getItemInfo(this.itemId);
|
|
104
103
|
this.itemType = itemEdit.type;
|
|
105
104
|
}
|
|
@@ -118,7 +117,6 @@ const SolutionItem = class {
|
|
|
118
117
|
* Renders the component.
|
|
119
118
|
*/
|
|
120
119
|
render() {
|
|
121
|
-
console.log("render item " + this.itemId); //???
|
|
122
120
|
return (index.h(index.Host, null, index.h("div", { class: "configuration-container" }, index.h("div", { class: "configuration" }, this._showGroupTabs(this.itemType === "Group"), this._showItemTabs(this.itemType !== "Group")))));
|
|
123
121
|
}
|
|
124
122
|
//--------------------------------------------------------------------------
|
|
@@ -173,6 +171,565 @@ const SolutionItem = class {
|
|
|
173
171
|
};
|
|
174
172
|
SolutionItem.style = solutionItemCss;
|
|
175
173
|
|
|
174
|
+
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}";
|
|
175
|
+
|
|
176
|
+
const SolutionItemDetails = class {
|
|
177
|
+
constructor(hostRef) {
|
|
178
|
+
index.registerInstance(this, hostRef);
|
|
179
|
+
this.itemId = "";
|
|
180
|
+
this.itemDetails = {
|
|
181
|
+
accessInformation: "",
|
|
182
|
+
description: "",
|
|
183
|
+
licenseInfo: "",
|
|
184
|
+
snippet: "",
|
|
185
|
+
tags: [],
|
|
186
|
+
title: ""
|
|
187
|
+
};
|
|
188
|
+
this.itemEdit = undefined;
|
|
189
|
+
this._translations = undefined;
|
|
190
|
+
this.thumbnail = undefined;
|
|
191
|
+
this.thumbnailContainer = undefined;
|
|
192
|
+
}
|
|
193
|
+
//--------------------------------------------------------------------------
|
|
194
|
+
//
|
|
195
|
+
// Lifecycle
|
|
196
|
+
//
|
|
197
|
+
//--------------------------------------------------------------------------
|
|
198
|
+
/**
|
|
199
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
200
|
+
*/
|
|
201
|
+
async componentWillLoad() {
|
|
202
|
+
return this._getTranslations();
|
|
203
|
+
}
|
|
204
|
+
async componentWillRender() {
|
|
205
|
+
this.itemEdit = solutionStore.state.getItemInfo(this.itemId);
|
|
206
|
+
if (this.itemEdit) {
|
|
207
|
+
this.itemDetails = this.itemEdit.item;
|
|
208
|
+
this.itemType = this.itemDetails.type;
|
|
209
|
+
}
|
|
210
|
+
return Promise.resolve();
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Renders the component.
|
|
214
|
+
*/
|
|
215
|
+
render() {
|
|
216
|
+
return (index.h(index.Host, null, index.h("div", { class: "parent-container" }, index.h("div", { class: "inputBottomSeparation" }, index.h("calcite-input", { id: "item-title", value: this.itemDetails.title })), index.h("div", { class: "inputBottomSeparation" }, index.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" }), index.h("button", { class: "font-size--3 btn-link inline-block trailer-quarter", onClick: () => this._getThumbnail() }, index.h("svg", { class: "icon-inline icon-inline--on-left", height: "16", viewBox: "0 0 16 16", width: "16" }, index.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), index.h("div", { class: "flex" }, index.h("div", { class: "img-container", ref: (el) => (this.thumbnailContainer = el) }, index.h("img", { class: "scale-down", height: "133", id: "item-thumbnail", ref: (el) => (this.thumbnail = el), width: "200" })), index.h("div", { class: "snippet-count-container" }, index.h("calcite-input", { id: "item-snippet", maxlength: 250, type: "textarea", value: this.itemDetails.snippet }), index.h("label", { class: "font-size--3", id: "item-snippet-count", ref: (el) => (this.itemSnippetCount = el) })))), index.h("calcite-label", null, this._translations.description, index.h("label", { id: "item-description-label" }, index.h("calcite-input", { id: "item-description", type: "textarea", value: this.itemDetails.description }))), index.h("calcite-label", null, this._translations.tags, index.h("label", { id: "item-tags-label" }, index.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" ? index.h("calcite-label", null, this._translations.credits, index.h("label", { id: "item-credits-label" }, index.h("calcite-input", { id: "item-credits", value: this.itemDetails.accessInformation }))) : null, this.itemType !== "Group" ? index.h("calcite-label", null, index.h("label", { id: "item-terms-label" }, this._translations.termsOfUse, index.h("calcite-input", { id: "item-terms", type: "textarea", value: this.itemDetails.licenseInfo }))) : null)));
|
|
217
|
+
}
|
|
218
|
+
componentDidRender() {
|
|
219
|
+
this._loadThumb();
|
|
220
|
+
}
|
|
221
|
+
//--------------------------------------------------------------------------
|
|
222
|
+
//
|
|
223
|
+
// Event Listeners
|
|
224
|
+
//
|
|
225
|
+
//--------------------------------------------------------------------------
|
|
226
|
+
/**
|
|
227
|
+
* Updates the component's value with changes to the input fields.
|
|
228
|
+
*/
|
|
229
|
+
inputReceivedHandler(event) {
|
|
230
|
+
switch (event.target.id) {
|
|
231
|
+
case "item-title":
|
|
232
|
+
this.itemDetails.title = event.target.value;
|
|
233
|
+
this._updateStore();
|
|
234
|
+
break;
|
|
235
|
+
case "item-snippet":
|
|
236
|
+
if (event.target.value.length > 250) {
|
|
237
|
+
event.target.value = event.target.value.substring(0, 250);
|
|
238
|
+
}
|
|
239
|
+
this.itemDetails.snippet = event.target.value;
|
|
240
|
+
this._updateLengthLabel(this.itemDetails.snippet);
|
|
241
|
+
this._updateStore();
|
|
242
|
+
break;
|
|
243
|
+
case "item-description":
|
|
244
|
+
this.itemDetails.description = event.target.value;
|
|
245
|
+
this._updateStore();
|
|
246
|
+
break;
|
|
247
|
+
case "item-tags":
|
|
248
|
+
this.itemDetails.tags = event.target.value;
|
|
249
|
+
this._updateStore();
|
|
250
|
+
break;
|
|
251
|
+
case "item-credits":
|
|
252
|
+
this.itemDetails.accessInformation = event.target.value;
|
|
253
|
+
this._updateStore();
|
|
254
|
+
break;
|
|
255
|
+
case "item-terms":
|
|
256
|
+
this.itemDetails.licenseInfo = event.target.value;
|
|
257
|
+
this._updateStore();
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//--------------------------------------------------------------------------
|
|
262
|
+
//
|
|
263
|
+
// Events
|
|
264
|
+
//
|
|
265
|
+
//--------------------------------------------------------------------------
|
|
266
|
+
//--------------------------------------------------------------------------
|
|
267
|
+
//
|
|
268
|
+
// Public Methods (async)
|
|
269
|
+
//
|
|
270
|
+
//--------------------------------------------------------------------------
|
|
271
|
+
//--------------------------------------------------------------------------
|
|
272
|
+
//
|
|
273
|
+
// Private Methods
|
|
274
|
+
//
|
|
275
|
+
//--------------------------------------------------------------------------
|
|
276
|
+
/**
|
|
277
|
+
* Opens image file browse dialog.
|
|
278
|
+
*
|
|
279
|
+
*/
|
|
280
|
+
_getThumbnail() {
|
|
281
|
+
this.browseForThumbnail.click();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Load the templates thumbnail
|
|
285
|
+
*
|
|
286
|
+
*/
|
|
287
|
+
_loadThumb() {
|
|
288
|
+
var _a;
|
|
289
|
+
if (this.thumbnail && ((_a = this.itemEdit) === null || _a === void 0 ? void 0 : _a.thumbnail)) {
|
|
290
|
+
// Show the thumbnail
|
|
291
|
+
this.thumbnail.src = URL.createObjectURL(this.itemEdit.thumbnail);
|
|
292
|
+
this.thumbnailContainer.classList.remove("empty-box");
|
|
293
|
+
this.thumbnail.classList.remove("display-none");
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// Replace the thumbnail with an empty box
|
|
297
|
+
this.thumbnailContainer.classList.add("empty-box");
|
|
298
|
+
this.thumbnail.classList.add("display-none");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Updates the length label to reflect the current number of characters
|
|
303
|
+
* relative to the max number of characters supported.
|
|
304
|
+
*
|
|
305
|
+
* @param phrase the current phrase from the control
|
|
306
|
+
*/
|
|
307
|
+
_updateLengthLabel(phrase) {
|
|
308
|
+
this.itemSnippetCount.innerText =
|
|
309
|
+
this._translations.snippetCountPattern.replace("{{n}}", phrase.length.toString());
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Add or remove the value from the store
|
|
313
|
+
*/
|
|
314
|
+
_updateStore() {
|
|
315
|
+
this.itemEdit = solutionStore.state.getItemInfo(this.itemId);
|
|
316
|
+
this.itemEdit.item = this.itemDetails;
|
|
317
|
+
solutionStore.state.setItemInfo(this.itemEdit);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Gets and displays image result from browse and updates the item in the store.
|
|
321
|
+
*
|
|
322
|
+
* @param event The input controls event that contains the new file
|
|
323
|
+
* @param updateStore boolean that controls if the new value is written to the store
|
|
324
|
+
* should be false on the initial load but true the rest of the time
|
|
325
|
+
*/
|
|
326
|
+
_updateThumbnail(event) {
|
|
327
|
+
const files = event.target.files;
|
|
328
|
+
if (files && files[0]) {
|
|
329
|
+
if (this.thumbnail) {
|
|
330
|
+
// Update UI
|
|
331
|
+
this.thumbnail.src = URL.createObjectURL(files[0]);
|
|
332
|
+
// Update info in store
|
|
333
|
+
this.itemEdit = solutionStore.state.getItemInfo(this.itemId);
|
|
334
|
+
this.itemEdit.thumbnail = files[0];
|
|
335
|
+
solutionStore.state.replaceItemThumbnail(this.itemEdit);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Fetches the component's translations
|
|
341
|
+
*
|
|
342
|
+
* @protected
|
|
343
|
+
*/
|
|
344
|
+
async _getTranslations() {
|
|
345
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
346
|
+
this._translations = translations[0];
|
|
347
|
+
}
|
|
348
|
+
get el() { return index.getElement(this); }
|
|
349
|
+
};
|
|
350
|
+
SolutionItemDetails.style = solutionItemDetailsCss;
|
|
351
|
+
|
|
352
|
+
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}";
|
|
353
|
+
|
|
354
|
+
const SolutionItemSharing = class {
|
|
355
|
+
constructor(hostRef) {
|
|
356
|
+
index.registerInstance(this, hostRef);
|
|
357
|
+
this.groupId = "";
|
|
358
|
+
this._translations = undefined;
|
|
359
|
+
this.sharing = [];
|
|
360
|
+
}
|
|
361
|
+
itemIdWatchHandler() {
|
|
362
|
+
const itemEdit = solutionStore.state.getItemInfo(this.groupId);
|
|
363
|
+
this.sharing = itemEdit.groupDetails;
|
|
364
|
+
}
|
|
365
|
+
//--------------------------------------------------------------------------
|
|
366
|
+
//
|
|
367
|
+
// Lifecycle
|
|
368
|
+
//
|
|
369
|
+
//--------------------------------------------------------------------------
|
|
370
|
+
/**
|
|
371
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
372
|
+
*/
|
|
373
|
+
async componentWillLoad() {
|
|
374
|
+
return this._getTranslations();
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Renders the component.
|
|
378
|
+
*/
|
|
379
|
+
render() {
|
|
380
|
+
return (index.h(index.Host, null, index.h("div", { class: "container-border" }, index.h("calcite-label", null, this._translations.groupInfo), this._renderItems(this.sharing))));
|
|
381
|
+
}
|
|
382
|
+
//--------------------------------------------------------------------------
|
|
383
|
+
//
|
|
384
|
+
// Event Listeners
|
|
385
|
+
//
|
|
386
|
+
//--------------------------------------------------------------------------
|
|
387
|
+
//--------------------------------------------------------------------------
|
|
388
|
+
//
|
|
389
|
+
// Events
|
|
390
|
+
//
|
|
391
|
+
//--------------------------------------------------------------------------
|
|
392
|
+
//--------------------------------------------------------------------------
|
|
393
|
+
//
|
|
394
|
+
// Public Methods (async)
|
|
395
|
+
//
|
|
396
|
+
//--------------------------------------------------------------------------
|
|
397
|
+
async getShareInfo() {
|
|
398
|
+
return this.sharing;
|
|
399
|
+
}
|
|
400
|
+
//--------------------------------------------------------------------------
|
|
401
|
+
//
|
|
402
|
+
// Private Methods
|
|
403
|
+
//
|
|
404
|
+
//--------------------------------------------------------------------------
|
|
405
|
+
/**
|
|
406
|
+
* Render share options based on the list of share details
|
|
407
|
+
*
|
|
408
|
+
* @param objs list of IItemShare objects that are used to expose and store share info for the solutions items
|
|
409
|
+
*/
|
|
410
|
+
_renderItems(objs) {
|
|
411
|
+
return objs && objs.length > 0
|
|
412
|
+
? objs.map(item => {
|
|
413
|
+
return (index.h("calcite-label", { layout: "inline" }, index.h("calcite-switch", { id: item.id, name: "setting", onCalciteSwitchChange: (event) => this._updateItem(event), scale: "m", switched: item.shareItem, value: "enabled" }), index.h("solution-item-icon", { type: item.type, typeKeywords: item.typeKeywords }), index.h("span", { class: "icon-text", title: item.title }, item.title)));
|
|
414
|
+
})
|
|
415
|
+
: null;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Update the items share prop based on the switch state
|
|
419
|
+
*
|
|
420
|
+
* @param event onCalciteSwitchChange event
|
|
421
|
+
*/
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
423
|
+
_updateItem(event) {
|
|
424
|
+
const id = event.target.id;
|
|
425
|
+
this.sharing = this.sharing.map((itemShare) => {
|
|
426
|
+
if (itemShare.id === id) {
|
|
427
|
+
// update the item
|
|
428
|
+
itemShare.shareItem = event.detail.switched;
|
|
429
|
+
// update the item in the store
|
|
430
|
+
const itemEdit = solutionStore.state.getItemInfo(id);
|
|
431
|
+
if (itemShare.shareItem) {
|
|
432
|
+
// Add the group to the item if it's not already there
|
|
433
|
+
if (!itemEdit.groups) {
|
|
434
|
+
itemEdit.groups = [this.groupId];
|
|
435
|
+
}
|
|
436
|
+
else if (itemEdit.groups.indexOf(this.groupId) < 0) {
|
|
437
|
+
itemEdit.groups.push(this.groupId);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
// Remove the group from the item if it's there
|
|
442
|
+
if (itemEdit.groups) {
|
|
443
|
+
const i = itemEdit.groups.indexOf(this.groupId);
|
|
444
|
+
if (i > -1) {
|
|
445
|
+
itemEdit.groups.splice(i, 1);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
solutionStore.state.setItemInfo(itemEdit);
|
|
450
|
+
}
|
|
451
|
+
return itemShare;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Fetches the component's translations
|
|
456
|
+
*
|
|
457
|
+
* @protected
|
|
458
|
+
*/
|
|
459
|
+
async _getTranslations() {
|
|
460
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
461
|
+
this._translations = translations[0];
|
|
462
|
+
}
|
|
463
|
+
get el() { return index.getElement(this); }
|
|
464
|
+
static get watchers() { return {
|
|
465
|
+
"groupId": ["itemIdWatchHandler"]
|
|
466
|
+
}; }
|
|
467
|
+
};
|
|
468
|
+
SolutionItemSharing.style = solutionItemSharingCss;
|
|
469
|
+
|
|
470
|
+
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}";
|
|
471
|
+
|
|
472
|
+
const SolutionResourceItem = class {
|
|
473
|
+
constructor(hostRef) {
|
|
474
|
+
index.registerInstance(this, hostRef);
|
|
475
|
+
this._removedResources = {};
|
|
476
|
+
this.authentication = undefined;
|
|
477
|
+
this.itemId = "";
|
|
478
|
+
this.resourceFilePaths = [];
|
|
479
|
+
this.resources = [];
|
|
480
|
+
this._translations = undefined;
|
|
481
|
+
}
|
|
482
|
+
itemIdWatchHandler() {
|
|
483
|
+
const item = solutionStore.state.getItemInfo(this.itemId);
|
|
484
|
+
this.resourceFilePaths = item.resourceFilePaths;
|
|
485
|
+
this.resources = item.resources.map(
|
|
486
|
+
// False linting error
|
|
487
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
488
|
+
(path) => path.substring(path.lastIndexOf("/") + 1));
|
|
489
|
+
}
|
|
490
|
+
//--------------------------------------------------------------------------
|
|
491
|
+
//
|
|
492
|
+
// Lifecycle
|
|
493
|
+
//
|
|
494
|
+
//--------------------------------------------------------------------------
|
|
495
|
+
/**
|
|
496
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
497
|
+
*/
|
|
498
|
+
componentWillLoad() {
|
|
499
|
+
return this._getTranslations();
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Renders the component.
|
|
503
|
+
*/
|
|
504
|
+
render() {
|
|
505
|
+
const hasValidResources = this._hasValidResources();
|
|
506
|
+
return (index.h(index.Host, null, index.h("div", { class: "resource-item" }, index.h("div", { class: "margin-bottom-1" }, index.h("calcite-button", { appearance: "solid", class: "resource-button", color: "blue", onClick: () => this._addNewResource() }, this._translations.addResource), index.h("calcite-button", { appearance: "solid", color: "blue", disabled: !hasValidResources, onClick: () => this._downloadAll() }, this._translations.downloadAll)), index.h("div", { class: "resources-container", style: { display: hasValidResources ? "inherit" : "none" } }, this._renderResourceList()))));
|
|
507
|
+
}
|
|
508
|
+
//--------------------------------------------------------------------------
|
|
509
|
+
//
|
|
510
|
+
// Event Listeners
|
|
511
|
+
//
|
|
512
|
+
//--------------------------------------------------------------------------
|
|
513
|
+
//--------------------------------------------------------------------------
|
|
514
|
+
//
|
|
515
|
+
// Events
|
|
516
|
+
//
|
|
517
|
+
//--------------------------------------------------------------------------
|
|
518
|
+
//--------------------------------------------------------------------------
|
|
519
|
+
//
|
|
520
|
+
// Public Methods (async)
|
|
521
|
+
//
|
|
522
|
+
//--------------------------------------------------------------------------
|
|
523
|
+
//--------------------------------------------------------------------------
|
|
524
|
+
//
|
|
525
|
+
// Private Methods
|
|
526
|
+
//
|
|
527
|
+
//--------------------------------------------------------------------------
|
|
528
|
+
/**
|
|
529
|
+
* Render resources while avoiding thumbnail resoures that are managed by solution-item
|
|
530
|
+
*
|
|
531
|
+
*/
|
|
532
|
+
_renderResourceList() {
|
|
533
|
+
return (index.h("calcite-value-list", { multiple: true }, this.resourceFilePaths.reduce((prev, cur) => {
|
|
534
|
+
if (cur.type !== solutionStore.EFileType.Thumbnail) {
|
|
535
|
+
prev.push(this._renderResource(cur));
|
|
536
|
+
}
|
|
537
|
+
return prev;
|
|
538
|
+
}, [])));
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Render the resource and supporting actions for download/update/delete/(reset..if deleted)
|
|
542
|
+
*
|
|
543
|
+
* @param resource the filename and url used to interact with the resource
|
|
544
|
+
*/
|
|
545
|
+
_renderResource(resource) {
|
|
546
|
+
const resettable = resource.updateType === interfaces.EUpdateType.Remove;
|
|
547
|
+
const fullname = resource.folder ? resource.folder + "/" + resource.filename : resource.filename;
|
|
548
|
+
return (index.h("calcite-value-list-item", { class: resettable ? "disabled" : "", label: fullname, nonInteractive: true, value: resource.url }, index.h("calcite-action-group", { "expand-disabled": "true", layout: "horizontal", slot: "actions-end" }, index.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 }), index.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 }), index.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 ? index.h("calcite-action", { icon: "reset", label: this._translations.reset, onClick: () => this._reset(resource.filename), scale: "m", text: this._translations.reset, title: this._translations.reset }) : index.h("div", { class: "display-none" }))));
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Adds the name to the deleted array so it will be skipped while rendering
|
|
552
|
+
* but still exist if the user chooses to reset
|
|
553
|
+
*
|
|
554
|
+
* @param resource the resource to be updated
|
|
555
|
+
*/
|
|
556
|
+
_delete(resource) {
|
|
557
|
+
resource.updateType = interfaces.EUpdateType.Remove;
|
|
558
|
+
this.resourceFilePaths = [...this.resourceFilePaths]; // to trigger refresh
|
|
559
|
+
this._updateStore();
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Remove the name from the deleted array so it will again be rendered
|
|
563
|
+
*
|
|
564
|
+
* @param name the name to be added to the deleted array
|
|
565
|
+
*/
|
|
566
|
+
_reset(name) {
|
|
567
|
+
// need to make sure I know if this reset is from the source or a new one
|
|
568
|
+
// Because the item's `resources` array is not updated until (and if) the solution is saved,
|
|
569
|
+
// we can use it for the reset info
|
|
570
|
+
this.resources.some(resourceName => resourceName === name) ?
|
|
571
|
+
// Undo removing an existing resource
|
|
572
|
+
this.resourceFilePaths = this.resourceFilePaths.map(p => {
|
|
573
|
+
if (p.filename === name) {
|
|
574
|
+
p.updateType = interfaces.EUpdateType.None;
|
|
575
|
+
}
|
|
576
|
+
return p;
|
|
577
|
+
}) :
|
|
578
|
+
// Undo cancelling the adding of a resource
|
|
579
|
+
this.resourceFilePaths = this.resourceFilePaths.map(p => {
|
|
580
|
+
if (p.filename === name) {
|
|
581
|
+
p.updateType = interfaces.EUpdateType.Add;
|
|
582
|
+
}
|
|
583
|
+
return p;
|
|
584
|
+
});
|
|
585
|
+
this._updateStore();
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Download all of the templates resources
|
|
589
|
+
*
|
|
590
|
+
*/
|
|
591
|
+
_downloadAll() {
|
|
592
|
+
this.resourceFilePaths.forEach((resource) => {
|
|
593
|
+
this._download(resource.url, resource.filename);
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Download the current resource
|
|
598
|
+
*
|
|
599
|
+
* @param url the resource url
|
|
600
|
+
* @param name the resource name
|
|
601
|
+
*/
|
|
602
|
+
_download(url, name) {
|
|
603
|
+
// files that have been added manually do not need to be requested from the item
|
|
604
|
+
if (url.startsWith("blob")) {
|
|
605
|
+
this.downloadFile(url, name);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
const _url = `${url}?token=${this.authentication.token}`;
|
|
609
|
+
void this.fetchAndDownload(_url, name);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Dynamically creates an anchor and downloads the file
|
|
614
|
+
*
|
|
615
|
+
* @param url the url of the resource
|
|
616
|
+
* @param name the name of the resource
|
|
617
|
+
*/
|
|
618
|
+
downloadFile(url, name) {
|
|
619
|
+
const link = document.createElement("a");
|
|
620
|
+
link.href = url;
|
|
621
|
+
link.download = name;
|
|
622
|
+
link.target = "_blank";
|
|
623
|
+
link.click();
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Check if the template resources have any non-thumbnail resources
|
|
627
|
+
*
|
|
628
|
+
* @returns true if we have data resources and false if only thumbnail
|
|
629
|
+
*/
|
|
630
|
+
_hasValidResources() {
|
|
631
|
+
return this.resourceFilePaths.some(r => r.url.indexOf("_info_thumbnail") < 0);
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Fetches and downloads the resource from the solution
|
|
635
|
+
*
|
|
636
|
+
* @param url the url of the resource
|
|
637
|
+
* @param name the name of the resource
|
|
638
|
+
*/
|
|
639
|
+
async fetchAndDownload(url, name) {
|
|
640
|
+
const image = await fetch(url);
|
|
641
|
+
const b = await image.blob();
|
|
642
|
+
const bURL = URL.createObjectURL(b);
|
|
643
|
+
this.downloadFile(bURL, name);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Create an input element to support the uploading of the resource and upload the resource
|
|
647
|
+
*
|
|
648
|
+
* @param resource the resource to be updated
|
|
649
|
+
*/
|
|
650
|
+
_upload(resource) {
|
|
651
|
+
const _input = document.createElement("input");
|
|
652
|
+
_input.classList.add("display-none");
|
|
653
|
+
_input.onchange = this._updateResource.bind(this, resource);
|
|
654
|
+
_input.type = "file";
|
|
655
|
+
_input.click();
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Create an input element to support the uploading of a resource and add the new resource
|
|
659
|
+
*
|
|
660
|
+
*/
|
|
661
|
+
_addNewResource() {
|
|
662
|
+
const _input = document.createElement("input");
|
|
663
|
+
_input.classList.add("display-none");
|
|
664
|
+
_input.onchange = this._add.bind(this);
|
|
665
|
+
_input.type = "file";
|
|
666
|
+
_input.click();
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Replace the resource file path when update action is used
|
|
670
|
+
*
|
|
671
|
+
* @param resourcePath the resource to be updated
|
|
672
|
+
* @param event the input event that contains the file
|
|
673
|
+
*/
|
|
674
|
+
_updateResource(resourcePath, event) {
|
|
675
|
+
const files = event.target.files;
|
|
676
|
+
if (files && files[0]) {
|
|
677
|
+
resourcePath.blob = files[0];
|
|
678
|
+
resourcePath.updateType = interfaces.EUpdateType.Update;
|
|
679
|
+
this._updateStore();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Add the new resource to the resource file paths
|
|
684
|
+
*
|
|
685
|
+
* @param event the inputs event that contains the new file
|
|
686
|
+
*/
|
|
687
|
+
_add(event) {
|
|
688
|
+
const files = event.target.files;
|
|
689
|
+
if (files && files[0]) {
|
|
690
|
+
const url = URL.createObjectURL(files[0]);
|
|
691
|
+
const filename = files[0].name;
|
|
692
|
+
// Add the item if it's not already in the resource file paths list
|
|
693
|
+
if (!this.resourceFilePaths.some(r => r.filename === filename && r.url === url)) {
|
|
694
|
+
this.resourceFilePaths = [
|
|
695
|
+
...this.resourceFilePaths,
|
|
696
|
+
{
|
|
697
|
+
url,
|
|
698
|
+
type: solutionStore.EFileType.Data,
|
|
699
|
+
folder: undefined,
|
|
700
|
+
filename,
|
|
701
|
+
blob: files[0],
|
|
702
|
+
updateType: interfaces.EUpdateType.Add
|
|
703
|
+
}
|
|
704
|
+
];
|
|
705
|
+
this._updateStore();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Add or remove the value from the store
|
|
711
|
+
*/
|
|
712
|
+
_updateStore() {
|
|
713
|
+
const item = solutionStore.state.getItemInfo(this.itemId);
|
|
714
|
+
item.resourceFilePaths = this.resourceFilePaths;
|
|
715
|
+
solutionStore.state.setItemInfo(item);
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Fetches the component's translations
|
|
719
|
+
*
|
|
720
|
+
* @protected
|
|
721
|
+
*/
|
|
722
|
+
async _getTranslations() {
|
|
723
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
724
|
+
this._translations = translations[0];
|
|
725
|
+
}
|
|
726
|
+
get el() { return index.getElement(this); }
|
|
727
|
+
static get watchers() { return {
|
|
728
|
+
"itemId": ["itemIdWatchHandler"]
|
|
729
|
+
}; }
|
|
730
|
+
};
|
|
731
|
+
SolutionResourceItem.style = solutionResourceItemCss;
|
|
732
|
+
|
|
176
733
|
/** @license
|
|
177
734
|
* Copyright 2022 Esri
|
|
178
735
|
*
|
|
@@ -21533,8 +22090,110 @@ const SolutionSpatialRef = class {
|
|
|
21533
22090
|
};
|
|
21534
22091
|
SolutionSpatialRef.style = solutionSpatialRefCss;
|
|
21535
22092
|
|
|
22093
|
+
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}";
|
|
22094
|
+
|
|
22095
|
+
const SolutionTemplateData = class {
|
|
22096
|
+
//--------------------------------------------------------------------------
|
|
22097
|
+
//
|
|
22098
|
+
// Lifecycle
|
|
22099
|
+
//
|
|
22100
|
+
//--------------------------------------------------------------------------
|
|
22101
|
+
constructor(hostRef) {
|
|
22102
|
+
index.registerInstance(this, hostRef);
|
|
22103
|
+
this._initializing = false;
|
|
22104
|
+
this.instanceid = "";
|
|
22105
|
+
this.itemId = "";
|
|
22106
|
+
this.organizationVariables = "";
|
|
22107
|
+
this.solutionVariables = "";
|
|
22108
|
+
this.varsOpen = true;
|
|
22109
|
+
this._translations = undefined;
|
|
22110
|
+
this.value = "";
|
|
22111
|
+
window.addEventListener("solutionEditorContentChanged", (evt) => {
|
|
22112
|
+
if (this.itemId) {
|
|
22113
|
+
const { id, contents } = evt.detail;
|
|
22114
|
+
const [itemId, instanceId] = id.split("|");
|
|
22115
|
+
if (itemId == this.itemId && instanceId === this.instanceid) {
|
|
22116
|
+
if (!this._initializing && contents.length > 0) {
|
|
22117
|
+
const itemEdit = solutionStore.state.getItemInfo(itemId);
|
|
22118
|
+
if (instanceId === "data") {
|
|
22119
|
+
itemEdit.data = JSON.parse(contents);
|
|
22120
|
+
}
|
|
22121
|
+
else {
|
|
22122
|
+
itemEdit.properties = JSON.parse(contents);
|
|
22123
|
+
}
|
|
22124
|
+
solutionStore.state.setItemInfo(itemEdit);
|
|
22125
|
+
}
|
|
22126
|
+
this._initializing = false;
|
|
22127
|
+
}
|
|
22128
|
+
}
|
|
22129
|
+
});
|
|
22130
|
+
}
|
|
22131
|
+
itemIdWatchHandler() {
|
|
22132
|
+
this._initializing = true;
|
|
22133
|
+
this.value = JSON.stringify(this.instanceid === "data"
|
|
22134
|
+
? solutionStore.state.getItemInfo(this.itemId).data
|
|
22135
|
+
: solutionStore.state.getItemInfo(this.itemId).properties, null, 2);
|
|
22136
|
+
}
|
|
22137
|
+
/**
|
|
22138
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
22139
|
+
*/
|
|
22140
|
+
componentWillLoad() {
|
|
22141
|
+
return this._getTranslations();
|
|
22142
|
+
}
|
|
22143
|
+
/**
|
|
22144
|
+
* Renders the component.
|
|
22145
|
+
*/
|
|
22146
|
+
render() {
|
|
22147
|
+
return (index.h(index.Host, null, index.h("div", { class: "solution-data-container" }, index.h("calcite-shell", { class: "light var-container", dir: "ltr" }, index.h("calcite-panel", { class: "json-editor" }, index.h("div", { class: "solution-data-child-container calcite-match-height" }, index.h("json-editor", { class: "solution-data-editor-container", instanceid: this.itemId + "|" + this.instanceid, value: this.value }))), index.h("calcite-shell-panel", { "height-scale": "l", position: "end", slot: "contextual-panel", "width-scale": "xs" }, index.h("div", { class: this.varsOpen ? "solution-data-child-container" : "solution-data-child-container-collapsed" }, index.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 }), index.h("div", { class: this.varsOpen ? "org-vars" : "org-vars display-none", id: "orgVars" }, index.h("solution-organization-variables", { value: this.organizationVariables })), index.h("div", { class: this.varsOpen ? "sol-vars" : "sol-vars display-none", id: "solVars" }, index.h("solution-variables", { value: this.solutionVariables }))))))));
|
|
22148
|
+
}
|
|
22149
|
+
//--------------------------------------------------------------------------
|
|
22150
|
+
//
|
|
22151
|
+
// Event Listeners
|
|
22152
|
+
//
|
|
22153
|
+
//--------------------------------------------------------------------------
|
|
22154
|
+
//--------------------------------------------------------------------------
|
|
22155
|
+
//
|
|
22156
|
+
// Events
|
|
22157
|
+
//
|
|
22158
|
+
//--------------------------------------------------------------------------
|
|
22159
|
+
//--------------------------------------------------------------------------
|
|
22160
|
+
//
|
|
22161
|
+
// Public Methods (async)
|
|
22162
|
+
//
|
|
22163
|
+
//--------------------------------------------------------------------------
|
|
22164
|
+
//--------------------------------------------------------------------------
|
|
22165
|
+
//
|
|
22166
|
+
// Private Methods
|
|
22167
|
+
//
|
|
22168
|
+
//--------------------------------------------------------------------------
|
|
22169
|
+
/**
|
|
22170
|
+
* Toggle varsOpen prop to show/hide variable containers
|
|
22171
|
+
*/
|
|
22172
|
+
_toggleVars() {
|
|
22173
|
+
this.varsOpen = !this.varsOpen;
|
|
22174
|
+
}
|
|
22175
|
+
/**
|
|
22176
|
+
* Fetches the component's translations
|
|
22177
|
+
*
|
|
22178
|
+
* @protected
|
|
22179
|
+
*/
|
|
22180
|
+
async _getTranslations() {
|
|
22181
|
+
const translations = await locale.getLocaleComponentStrings(this.el);
|
|
22182
|
+
this._translations = translations[0];
|
|
22183
|
+
}
|
|
22184
|
+
get el() { return index.getElement(this); }
|
|
22185
|
+
static get watchers() { return {
|
|
22186
|
+
"itemId": ["itemIdWatchHandler"]
|
|
22187
|
+
}; }
|
|
22188
|
+
};
|
|
22189
|
+
SolutionTemplateData.style = solutionTemplateDataCss;
|
|
22190
|
+
|
|
21536
22191
|
exports.solution_contents = SolutionContents;
|
|
21537
22192
|
exports.solution_item = SolutionItem;
|
|
22193
|
+
exports.solution_item_details = SolutionItemDetails;
|
|
22194
|
+
exports.solution_item_sharing = SolutionItemSharing;
|
|
22195
|
+
exports.solution_resource_item = SolutionResourceItem;
|
|
21538
22196
|
exports.solution_spatial_ref = SolutionSpatialRef;
|
|
22197
|
+
exports.solution_template_data = SolutionTemplateData;
|
|
21539
22198
|
|
|
21540
|
-
//# sourceMappingURL=solution-
|
|
22199
|
+
//# sourceMappingURL=solution-contents_7.cjs.entry.js.map
|