@foxy.io/elements 1.30.0 → 1.31.0-beta.1

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.
Files changed (54) hide show
  1. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  2. package/dist/cdn/foxy-cart-form.js +1 -1
  3. package/dist/cdn/foxy-coupon-form.js +1 -1
  4. package/dist/cdn/foxy-customer-form.js +1 -1
  5. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  6. package/dist/cdn/foxy-customer-portal.js +1 -1
  7. package/dist/cdn/foxy-customer.js +1 -1
  8. package/dist/cdn/foxy-gift-card-form.js +1 -1
  9. package/dist/cdn/foxy-item-category-form.js +1 -1
  10. package/dist/cdn/foxy-item-form.js +1 -1
  11. package/dist/cdn/foxy-native-integration-form.js +1 -1
  12. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  13. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  14. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  15. package/dist/cdn/foxy-store-card.js +1 -1
  16. package/dist/cdn/foxy-store-form.js +1 -1
  17. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  18. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  19. package/dist/cdn/foxy-transaction.js +1 -1
  20. package/dist/cdn/foxy-webhook-form.js +1 -1
  21. package/dist/cdn/shared-1d4fdfa8.js +1 -0
  22. package/dist/cdn/shared-cc8b47c6.js +1 -0
  23. package/dist/cdn/shared-fcbf196e.js +1 -0
  24. package/dist/cdn/translations/store-card/en.json +3 -1
  25. package/dist/cdn/translations/store-shipping-method-form/en.json +157 -127
  26. package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.d.ts +2 -0
  27. package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js +56 -35
  28. package/dist/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.js.map +1 -1
  29. package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.d.ts +18 -0
  30. package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.js +2 -0
  31. package/dist/elements/internal/InternalAsyncResourceLinkListControl/types.js.map +1 -0
  32. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.d.ts +1 -0
  33. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js +4 -0
  34. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js.map +1 -1
  35. package/dist/elements/internal/InternalPasswordControl/index.d.ts +1 -0
  36. package/dist/elements/internal/InternalPasswordControl/index.js +1 -0
  37. package/dist/elements/internal/InternalPasswordControl/index.js.map +1 -1
  38. package/dist/elements/internal/InternalPasswordControl/vaadinStyles.d.ts +1 -0
  39. package/dist/elements/internal/InternalPasswordControl/vaadinStyles.js +73 -0
  40. package/dist/elements/internal/InternalPasswordControl/vaadinStyles.js.map +1 -0
  41. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +7 -5
  42. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
  43. package/dist/elements/public/StoreCard/StoreCard.js +13 -1
  44. package/dist/elements/public/StoreCard/StoreCard.js.map +1 -1
  45. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +4 -3
  46. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +79 -63
  47. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  48. package/dist/elements/public/StoreShippingMethodForm/index.d.ts +2 -1
  49. package/dist/elements/public/StoreShippingMethodForm/index.js +2 -1
  50. package/dist/elements/public/StoreShippingMethodForm/index.js.map +1 -1
  51. package/package.json +1 -1
  52. package/dist/cdn/shared-40c6b1f6.js +0 -1
  53. package/dist/cdn/shared-96a392d9.js +0 -1
  54. package/dist/cdn/shared-b980ba1d.js +0 -1
@@ -16,157 +16,187 @@
16
16
  "done": "Copied to clipboard"
17
17
  }
18
18
  },
19
- "shipping-method-uri": {
20
- "label": "Provider",
21
- "dialog": {
22
- "cancel": "Cancel",
23
- "close": "Close",
24
- "header": "Select a provider",
25
- "selection": {
26
- "label": "Providers",
27
- "helper_text": "",
28
- "pagination": {
29
- "first": "First",
30
- "last": "Last",
31
- "next": "Next",
32
- "pagination": "{{from}}-{{to}} out of {{total}}",
33
- "previous": "Previous",
34
- "card": {
35
- "image_alt": "Shipping method logo",
36
- "status_active": "Active",
37
- "status_inactive": "Inactive",
38
- "spinner": {
39
- "loading_busy": "Loading",
40
- "loading_empty": "No providers found",
41
- "loading_error": "Unknown error"
19
+ "general": {
20
+ "label": "",
21
+ "helper_text": "",
22
+ "shipping-method-uri": {
23
+ "label": "Provider",
24
+ "helper_text": "",
25
+ "v8n_required": "Please select a provider.",
26
+ "value": "{{ resource.name }}",
27
+ "placeholder": "Select",
28
+ "dialog": {
29
+ "cancel": "Cancel",
30
+ "close": "Close",
31
+ "header": "Select a provider",
32
+ "selection": {
33
+ "label": "",
34
+ "helper_text": "",
35
+ "pagination": {
36
+ "first": "First",
37
+ "last": "Last",
38
+ "next": "Next",
39
+ "pagination": "{{from}}-{{to}} out of {{total}}",
40
+ "previous": "Previous",
41
+ "card": {
42
+ "image_alt": "Shipping method logo",
43
+ "status_active": "Active",
44
+ "status_inactive": "Inactive",
45
+ "spinner": {
46
+ "loading_busy": "Loading",
47
+ "loading_empty": "No providers found",
48
+ "loading_error": "Unknown error"
49
+ }
42
50
  }
43
51
  }
44
52
  }
53
+ },
54
+ "card": {
55
+ "image_alt": "Shipping method logo",
56
+ "status_active": "Active",
57
+ "status_inactive": "Inactive",
58
+ "spinner": {
59
+ "loading_busy": "Loading",
60
+ "loading_empty": "Select a provider",
61
+ "loading_error": "Unknown error"
62
+ }
45
63
  }
46
64
  },
47
- "card": {
48
- "image_alt": "Shipping method logo",
49
- "status_active": "Active",
50
- "status_inactive": "Inactive",
51
- "spinner": {
52
- "loading_busy": "Loading",
53
- "loading_empty": "Select a provider",
54
- "loading_error": "Unknown error"
55
- }
56
- },
57
- "helper_text": "",
58
- "v8n_required": "Please select a provider."
59
- },
60
- "shipping-container-uri": {
61
- "label": "Container",
62
- "dialog": {
63
- "cancel": "Cancel",
64
- "close": "Close",
65
- "header": "Select a container",
66
- "selection": {
67
- "label": "Containers",
68
- "helper_text": "",
69
- "pagination": {
70
- "first": "First",
71
- "last": "Last",
72
- "next": "Next",
73
- "pagination": "{{from}}-{{to}} out of {{total}}",
74
- "previous": "Previous",
75
- "card": {
76
- "subtitle": "Code: {{ code }}",
77
- "spinner": {
78
- "loading_busy": "Loading",
79
- "loading_empty": "No containers found",
80
- "loading_error": "Unknown error"
65
+ "shipping-container-uri": {
66
+ "label": "Container",
67
+ "helper_text": "",
68
+ "v8n_required": "Please select a shipping container.",
69
+ "value": "{{ resource.name }}",
70
+ "placeholder": "Select",
71
+ "dialog": {
72
+ "cancel": "Cancel",
73
+ "close": "Close",
74
+ "header": "Select a container",
75
+ "selection": {
76
+ "label": "",
77
+ "helper_text": "",
78
+ "pagination": {
79
+ "first": "First",
80
+ "last": "Last",
81
+ "next": "Next",
82
+ "pagination": "{{from}}-{{to}} out of {{total}}",
83
+ "previous": "Previous",
84
+ "card": {
85
+ "subtitle": "Code: {{ code }}",
86
+ "spinner": {
87
+ "loading_busy": "Loading",
88
+ "loading_empty": "No containers found",
89
+ "loading_error": "Unknown error"
90
+ }
81
91
  }
82
92
  }
83
93
  }
94
+ },
95
+ "card": {
96
+ "subtitle": "Code: {{ code }}",
97
+ "spinner": {
98
+ "loading_busy": "Loading",
99
+ "loading_empty": "Select a container",
100
+ "loading_error": "Unknown error"
101
+ }
84
102
  }
85
103
  },
86
- "card": {
87
- "subtitle": "Code: {{ code }}",
88
- "spinner": {
89
- "loading_busy": "Loading",
90
- "loading_empty": "Select a container",
91
- "loading_error": "Unknown error"
92
- }
93
- },
94
- "helper_text": "",
95
- "v8n_required": "Please select a shipping container."
96
- },
97
- "shipping-drop-type-uri": {
98
- "label": "Drop type",
99
- "dialog": {
100
- "cancel": "Cancel",
101
- "close": "Close",
102
- "header": "Select a drop type",
103
- "selection": {
104
- "label": "Drop types",
105
- "helper_text": "",
106
- "pagination": {
107
- "first": "First",
108
- "last": "Last",
109
- "next": "Next",
110
- "pagination": "{{from}}-{{to}} out of {{total}}",
111
- "previous": "Previous",
112
- "card": {
113
- "subtitle": "Code: {{ code }}",
114
- "spinner": {
115
- "loading_busy": "Loading",
116
- "loading_empty": "No drop types found",
117
- "loading_error": "Unknown error"
104
+ "shipping-drop-type-uri": {
105
+ "label": "Drop type",
106
+ "helper_text": "",
107
+ "v8n_required": "Please select a drop type.",
108
+ "value": "{{ resource.name }}",
109
+ "placeholder": "Select",
110
+ "dialog": {
111
+ "cancel": "Cancel",
112
+ "close": "Close",
113
+ "header": "Select a drop type",
114
+ "selection": {
115
+ "label": "",
116
+ "helper_text": "",
117
+ "pagination": {
118
+ "first": "First",
119
+ "last": "Last",
120
+ "next": "Next",
121
+ "pagination": "{{from}}-{{to}} out of {{total}}",
122
+ "previous": "Previous",
123
+ "card": {
124
+ "subtitle": "Code: {{ code }}",
125
+ "spinner": {
126
+ "loading_busy": "Loading",
127
+ "loading_empty": "No drop types found",
128
+ "loading_error": "Unknown error"
129
+ }
118
130
  }
119
131
  }
120
132
  }
133
+ },
134
+ "card": {
135
+ "subtitle": "Code: {{ code }}",
136
+ "spinner": {
137
+ "loading_busy": "Loading",
138
+ "loading_empty": "Select a drop type",
139
+ "loading_error": "Unknown error"
140
+ }
121
141
  }
122
- },
123
- "card": {
124
- "subtitle": "Code: {{ code }}",
125
- "spinner": {
126
- "loading_busy": "Loading",
127
- "loading_empty": "Select a drop type",
128
- "loading_error": "Unknown error"
129
- }
130
- },
131
- "helper_text": "",
132
- "v8n_required": "Please select a drop type."
142
+ }
133
143
  },
134
144
  "destinations": {
135
145
  "label": "Destinations",
136
- "domestic": "Domestic",
137
- "international": "International",
138
- "helper_text": "Select which shipping rate requests to apply this shipping method to."
139
- },
140
- "authentication-key": {
141
- "label": "Authentication Key",
142
- "placeholder": "N/A",
143
- "helper_text": "If using account specific rates, enter your shipping account authentication key here, if applicable.",
144
- "v8n_too_long": "Authentication key must be 50 characters or less."
145
- },
146
- "meter-number": {
147
- "label": "Meter Number",
148
- "placeholder": "N/A",
149
- "helper_text": "If using account specific rates, enter your shipping account meter number here, if applicable.",
150
- "v8n_too_long": "Meter number must be 50 characters or less."
146
+ "helper_text": "",
147
+ "use-for-domestic": {
148
+ "label": "Use for domestic destinations",
149
+ "helper_text": "",
150
+ "checked": "Yes",
151
+ "unchecked": "No"
152
+ },
153
+ "use-for-international": {
154
+ "label": "Use for international destinations",
155
+ "helper_text": "",
156
+ "checked": "Yes",
157
+ "unchecked": "No"
158
+ }
151
159
  },
152
- "accountid": {
153
- "label": "Account ID",
154
- "placeholder": "N/A",
155
- "helper_text": "If using account specific rates, enter your shipping account id here.",
156
- "v8n_too_long": "Account ID must be 50 characters or less."
160
+ "account": {
161
+ "label": "Account",
162
+ "helper_text": "",
163
+ "use-custom-account": {
164
+ "label": "Use custom credentials",
165
+ "helper_text": "",
166
+ "checked": "Yes",
167
+ "unchecked": "No"
168
+ },
169
+ "authentication-key": {
170
+ "label": "Authentication Key",
171
+ "placeholder": "N/A",
172
+ "helper_text": "",
173
+ "v8n_too_long": "Authentication key must be 50 characters or less."
174
+ },
175
+ "meter-number": {
176
+ "label": "Meter Number",
177
+ "placeholder": "N/A",
178
+ "helper_text": "",
179
+ "v8n_too_long": "Meter number must be 50 characters or less."
180
+ },
181
+ "accountid": {
182
+ "label": "Account ID",
183
+ "placeholder": "N/A",
184
+ "helper_text": "",
185
+ "v8n_too_long": "Account ID must be 50 characters or less."
186
+ },
187
+ "password": {
188
+ "label": "Password",
189
+ "placeholder": "N/A",
190
+ "helper_text": "",
191
+ "v8n_too_long": "Password must be 50 characters or less."
192
+ }
157
193
  },
158
194
  "endpoint": {
159
195
  "label": "Endpoint URL",
160
196
  "placeholder": "https://example.com/rates",
161
- "helper_text": "Enter a URL that we'll poll for shipping rates.",
197
+ "helper_text": "",
162
198
  "v8n_required": "Please enter a valid endpoint URL."
163
199
  },
164
- "password": {
165
- "label": "Password",
166
- "placeholder": "N/A",
167
- "helper_text": "If using account specific rates, enter your shipping account password here.",
168
- "v8n_too_long": "Password must be 50 characters or less."
169
- },
170
200
  "custom-code": {
171
201
  "label": "Custom Code",
172
202
  "placeholder": "Paste your code here",
@@ -20,4 +20,6 @@ export declare class InternalAsyncResourceLinkListControl extends InternalEditab
20
20
  updated(changes: Map<keyof this, unknown>): void;
21
21
  private __insertLink;
22
22
  private __deleteLink;
23
+ private __renderLinkResourceLoaders;
24
+ private get __allLinks();
23
25
  }
@@ -1,6 +1,5 @@
1
1
  import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
2
2
  import { NucleonElement } from "../../public/NucleonElement/NucleonElement.js";
3
- import { getResourceId } from '@foxy.io/sdk/core';
4
3
  import { ifDefined } from 'lit-html/directives/if-defined';
5
4
  import { classMap } from "../../../utils/class-map.js";
6
5
  import { html } from 'lit-html';
@@ -30,57 +29,37 @@ export class InternalAsyncResourceLinkListControl extends InternalEditableContro
30
29
  </${item !== null && item !== void 0 ? item : 'foxy-null'}>\``);
31
30
  }, (...args) => args.join());
32
31
  this.__renderItem = ctx => {
33
- var _a, _b, _c, _d, _e;
32
+ var _a;
34
33
  const render = this.__getItemRenderer(this.item, !!ctx.data);
35
34
  const wrap = (content) => html `
36
35
  <div style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)">${content}</div>
37
36
  `;
38
37
  if (!ctx.href || ctx.href.startsWith('foxy://'))
39
38
  return wrap(render(ctx));
40
- let linkHref;
41
- const id = getResourceId((_b = (_a = ctx.data) === null || _a === void 0 ? void 0 : _a._links.self.href) !== null && _b !== void 0 ? _b : '');
42
- try {
43
- const url = new URL((_c = this.linksHref) !== null && _c !== void 0 ? _c : '');
44
- url.searchParams.set((_d = this.foreignKeyForId) !== null && _d !== void 0 ? _d : '', String(id !== null && id !== void 0 ? id : ''));
45
- url.searchParams.set('limit', '1');
46
- linkHref = url.toString();
47
- }
48
- catch (_f) {
49
- linkHref = undefined;
50
- }
51
- const content = html `
52
- <foxy-nucleon
53
- infer=""
54
- href=${ifDefined(linkHref)}
55
- id="link-${id}"
56
- @update=${() => this.requestUpdate()}
57
- >
58
- ${render(ctx)}
59
- </foxy-nucleon>
60
- `;
61
39
  if (this.readonly)
62
- return wrap(content);
63
- const nucleon = this.renderRoot.querySelector(`#link-${id}`);
64
- const checked = !!((_e = nucleon === null || nucleon === void 0 ? void 0 : nucleon.data) === null || _e === void 0 ? void 0 : _e.returned_items);
65
- const isDisabled = this.disabled || !(nucleon === null || nucleon === void 0 ? void 0 : nucleon.in('idle')) || this.__isFetching;
40
+ return wrap(render(ctx));
41
+ const foreignKeyForUri = this.foreignKeyForUri;
42
+ const linkResource = foreignKeyForUri
43
+ ? (_a = this.__allLinks) === null || _a === void 0 ? void 0 : _a.find(link => link[foreignKeyForUri] === ctx.href) : undefined;
44
+ const isDisabled = this.disabled || !this.__allLinks || this.__isFetching;
66
45
  return wrap(html `
67
46
  <vaadin-checkbox
68
47
  class="block"
69
48
  ?disabled=${isDisabled}
70
- ?checked=${checked}
49
+ ?checked=${!!linkResource}
71
50
  @change=${(evt) => {
72
- var _a, _b, _c, _d, _e, _f, _g, _h;
51
+ var _a, _b, _c;
73
52
  const target = evt.currentTarget;
74
53
  if (target.checked) {
75
54
  this.__insertLink((_b = (_a = ctx.data) === null || _a === void 0 ? void 0 : _a._links.self.href) !== null && _b !== void 0 ? _b : '');
76
55
  }
77
56
  else {
78
- this.__deleteLink((_h = (_g = (_f = (_d = (_c = nucleon === null || nucleon === void 0 ? void 0 : nucleon.data) === null || _c === void 0 ? void 0 : _c._embedded) === null || _d === void 0 ? void 0 : _d[(_e = this.embedKey) !== null && _e !== void 0 ? _e : '']) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g._links.self.href) !== null && _h !== void 0 ? _h : '');
57
+ this.__deleteLink((_c = linkResource === null || linkResource === void 0 ? void 0 : linkResource._links.self.href) !== null && _c !== void 0 ? _c : '');
79
58
  }
80
59
  }}
81
60
  >
82
61
  <div class="transition-opacity ${isDisabled ? 'opacity-50' : 'opacity-100'}">
83
- ${content}
62
+ ${render(ctx)}
84
63
  </div>
85
64
  </vaadin-checkbox>
86
65
  `);
@@ -123,10 +102,7 @@ export class InternalAsyncResourceLinkListControl extends InternalEditableContro
123
102
  catch (_b) {
124
103
  firstHref = undefined;
125
104
  }
126
- const nucleons = [
127
- ...this.renderRoot.querySelectorAll('foxy-nucleon'),
128
- ];
129
- const isStatusVisible = this.__isFetching || nucleons.some(n => !n.in('idle'));
105
+ const isStatusVisible = this.__isFetching || !this.__allLinks;
130
106
  return html `
131
107
  <div class="group">
132
108
  <div
@@ -174,6 +150,8 @@ export class InternalAsyncResourceLinkListControl extends InternalEditableContro
174
150
  >
175
151
  ${this._errorMessage}
176
152
  </div>
153
+
154
+ ${this.__renderLinkResourceLoaders()}
177
155
  </div>
178
156
  `;
179
157
  }
@@ -220,5 +198,48 @@ export class InternalAsyncResourceLinkListControl extends InternalEditableContro
220
198
  }
221
199
  this.__isFetching = false;
222
200
  }
201
+ __renderLinkResourceLoaders() {
202
+ var _a, _b, _c;
203
+ const maxApiLimit = 200;
204
+ const firstPage = this.renderRoot.querySelector('[data-link-page]');
205
+ const totalItems = Number((_b = (_a = firstPage === null || firstPage === void 0 ? void 0 : firstPage.data) === null || _a === void 0 ? void 0 : _a.total_items) !== null && _b !== void 0 ? _b : maxApiLimit); // sometimes total_items is a string in hAPI
206
+ const links = [];
207
+ try {
208
+ for (let i = 0; i < Math.max(1, Math.ceil(totalItems / maxApiLimit)); i++) {
209
+ const url = new URL((_c = this.linksHref) !== null && _c !== void 0 ? _c : '');
210
+ url.searchParams.set('offset', String(i * maxApiLimit));
211
+ url.searchParams.set('limit', String(maxApiLimit));
212
+ links.push(url.toString());
213
+ }
214
+ }
215
+ catch (_d) {
216
+ // Do nothing.
217
+ }
218
+ return links.map(href => html `
219
+ <foxy-nucleon
220
+ class="hidden"
221
+ data-link-page
222
+ infer=""
223
+ href=${href}
224
+ @update=${() => this.requestUpdate()}
225
+ >
226
+ </foxy-nucleon>
227
+ `);
228
+ }
229
+ get __allLinks() {
230
+ var _a, _b;
231
+ const embedKey = this.embedKey;
232
+ if (!embedKey)
233
+ return null;
234
+ const loaders = this.renderRoot.querySelectorAll('[data-link-page]');
235
+ const allLinks = [];
236
+ for (const loader of loaders) {
237
+ const embedded = (_b = (_a = loader.data) === null || _a === void 0 ? void 0 : _a._embedded) === null || _b === void 0 ? void 0 : _b[embedKey];
238
+ if (!embedded)
239
+ return null;
240
+ allLinks.push(...embedded);
241
+ }
242
+ return allLinks;
243
+ }
223
244
  }
224
245
  //# sourceMappingURL=InternalAsyncResourceLinkListControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalAsyncResourceLinkListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceLinkListControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,cAAc,EAAE,sDAAmD;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,MAAM,OAAO,oCAAqC,SAAQ,uBAAuB;IAAjF;;QA6BE,qBAAgB,GAAkB,IAAI,CAAC;QAEvC,oBAAe,GAAkB,IAAI,CAAC;QAEtC,iBAAY,GAAkB,IAAI,CAAC;QAEnC,gBAAW,GAA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EAAE,CAAC;oBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;oBAC7B,IAAI;iBACL,CAAC,CAAC;aACJ;SACF;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,OAAe;;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEhE,IAAI,QAAQ,CAAC,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,aAAC,IAAI,CAAC,OAAO,0CAAE,KAAK,mCAAI,EAAE,CAAC,CAAC;YAChE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAC,IAAI,CAAC,SAAS,mCAAI,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;SAChF;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations } from 'lit-element';\nimport type { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport type { TemplateResult } from 'lit-html';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport { getResourceId } from '@foxy.io/sdk/core';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\nimport { css } from 'lit-element';\n\nimport memoize from 'lodash-es/memoize';\n\nexport class InternalAsyncResourceLinkListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n foreignKeyForUri: { attribute: 'foreign-key-for-uri' },\n foreignKeyForId: { attribute: 'foreign-key-for-id' },\n ownKeyForUri: { attribute: 'own-key-for-uri' },\n optionsHref: { attribute: 'options-href' },\n linksHref: { attribute: 'links-href' },\n embedKey: { attribute: 'embed-key' },\n ownUri: { attribute: 'own-uri' },\n limit: { type: Number },\n item: {},\n __isFetching: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n vaadin-checkbox::part(label) {\n margin: 0 0 0 calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);\n align-self: center;\n }\n `,\n ];\n }\n\n foreignKeyForUri: string | null = null;\n\n foreignKeyForId: string | null = null;\n\n ownKeyForUri: string | null = null;\n\n optionsHref: string | null = null;\n\n linksHref: string | null = null;\n\n embedKey: string | null = null;\n\n ownUri: string | null = null;\n\n limit = 20;\n\n item: string | null = null;\n\n private readonly __getItemRenderer = memoize(\n (item: string | null, hasData: boolean) => {\n return new Function(\n 'ctx',\n `return ctx.html\\`\n <${item ?? 'foxy-null'}\n related=\\${JSON.stringify(ctx.related)}\n parent=\\${ctx.parent}\n infer=\"\"\n ${hasData ? '.data=${ctx.data}' : 'href=${ctx.href}'}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item ?? 'foxy-null'}>\\``\n ) as ItemRenderer;\n },\n (...args) => args.join()\n );\n\n private readonly __renderItem: ItemRenderer = ctx => {\n const render = this.__getItemRenderer(this.item, !!ctx.data);\n const wrap = (content: TemplateResult) => html`\n <div style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\">${content}</div>\n `;\n\n if (!ctx.href || ctx.href.startsWith('foxy://')) return wrap(render(ctx));\n let linkHref: string | undefined;\n const id = getResourceId(ctx.data?._links.self.href ?? '');\n\n try {\n const url = new URL(this.linksHref ?? '');\n url.searchParams.set(this.foreignKeyForId ?? '', String(id ?? ''));\n url.searchParams.set('limit', '1');\n linkHref = url.toString();\n } catch {\n linkHref = undefined;\n }\n\n const content = html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(linkHref)}\n id=\"link-${id}\"\n @update=${() => this.requestUpdate()}\n >\n ${render(ctx)}\n </foxy-nucleon>\n `;\n\n if (this.readonly) return wrap(content);\n\n const nucleon = this.renderRoot.querySelector(`#link-${id}`) as NucleonElement<any> | null;\n const checked = !!nucleon?.data?.returned_items;\n const isDisabled = this.disabled || !nucleon?.in('idle') || this.__isFetching;\n\n return wrap(html`\n <vaadin-checkbox\n class=\"block\"\n ?disabled=${isDisabled}\n ?checked=${checked}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n if (target.checked) {\n this.__insertLink(ctx.data?._links.self.href ?? '');\n } else {\n this.__deleteLink(\n nucleon?.data?._embedded?.[this.embedKey ?? '']?.[0]?._links.self.href ?? ''\n );\n }\n }}\n >\n <div class=\"transition-opacity ${isDisabled ? 'opacity-50' : 'opacity-100'}\">\n ${content}\n </div>\n </vaadin-checkbox>\n `);\n };\n\n private __isFetching = false;\n\n renderControl(): TemplateResult {\n let firstHref: string | undefined;\n\n try {\n const url = new URL(this.optionsHref ?? '');\n url.searchParams.set('limit', this.limit.toString());\n firstHref = url.toString();\n } catch {\n firstHref = undefined;\n }\n\n const nucleons = [\n ...(this.renderRoot.querySelectorAll('foxy-nucleon') as NodeListOf<NucleonElement<any>>),\n ];\n\n const isStatusVisible = this.__isFetching || nucleons.some(n => !n.in('idle'));\n\n return html`\n <div class=\"group\">\n <div\n class=${classMap({\n 'flex justify-between transition-colors mb-xs font-medium text-s': true,\n 'text-secondary': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n })}\n >\n <span>${this.label}</span>\n <foxy-i18n\n class=\"transition-opacity ${isStatusVisible ? 'opacity-100' : 'opacity-0'}\"\n infer=\"\"\n key=${this.__isFetching ? 'status_saving' : 'status_loading'}\n >\n </foxy-i18n>\n </div>\n\n <foxy-pagination first=${ifDefined(firstHref)} infer=\"pagination\">\n <foxy-collection-page\n infer=\"card\"\n class=${classMap({\n 'block transition-colors divide-y rounded overflow-hidden': true,\n 'divide-contrast-10 ring-1 ring-inset ring-contrast-10': true,\n })}\n .item=${this.__renderItem}\n >\n </foxy-collection-page>\n </foxy-pagination>\n\n <div\n class=${classMap({\n 'transition-colors mt-xs text-xs': true,\n 'text-secondary': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n })}\n ?hidden=${!this.helperText}\n >\n ${this.helperText}\n </div>\n\n <div\n class=\"mt-xs text-xs leading-xs text-error\"\n ?hidden=${!this._errorMessage || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </div>\n </div>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n if (changes.has('item')) this.__getItemRenderer.cache.clear?.();\n }\n\n private async __insertLink(foreignUri: string) {\n this.__isFetching = true;\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(this.linksHref ?? '', {\n method: 'POST',\n body: JSON.stringify({\n [this.foreignKeyForUri ?? '']: foreignUri,\n [this.ownKeyForUri ?? '']: this.ownUri,\n }),\n });\n\n if (response.ok) {\n const json = await response.json();\n const dataResponse = await api.fetch(json._links.self.href);\n\n if (dataResponse.ok) {\n const rumour = NucleonElement.Rumour(this.nucleon?.group ?? '');\n const data = await dataResponse.json();\n\n rumour.share({\n related: [this.linksHref ?? ''],\n source: json._links.self.href,\n data,\n });\n }\n }\n\n this.__isFetching = false;\n }\n\n private async __deleteLink(linkUri: string) {\n this.__isFetching = true;\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(linkUri, { method: 'DELETE' });\n\n if (response.ok) {\n const rumour = NucleonElement.Rumour(this.nucleon?.group ?? '');\n rumour.share({ related: [this.linksHref ?? ''], source: linkUri, data: null });\n }\n\n this.__isFetching = false;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalAsyncResourceLinkListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncResourceLinkListControl/InternalAsyncResourceL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;SACF;QAAC,WAAM;YACN,cAAc;SACf;QAED,OAAO,KAAK,CAAC,GAAG,CACd,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;;;;;iBAKD,IAAI;oBACD,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;OAGvC,CACF,CAAC;IACJ,CAAC;IAED,IAAY,UAAU;;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAG3B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAS,kBAAkB,CAAC,CAAC;QAC7E,MAAM,QAAQ,GAAU,EAAE,CAAC;QAE3B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,QAAQ,eAAG,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAG,QAAQ,CAAC,CAAC;YACpD,IAAI,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAC5B;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations } from 'lit-element';\nimport type { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport type { TemplateResult } from 'lit-html';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\nimport type { Collection } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\nimport { css } from 'lit-element';\n\nimport memoize from 'lodash-es/memoize';\n\nexport class InternalAsyncResourceLinkListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n foreignKeyForUri: { attribute: 'foreign-key-for-uri' },\n foreignKeyForId: { attribute: 'foreign-key-for-id' },\n ownKeyForUri: { attribute: 'own-key-for-uri' },\n optionsHref: { attribute: 'options-href' },\n linksHref: { attribute: 'links-href' },\n embedKey: { attribute: 'embed-key' },\n ownUri: { attribute: 'own-uri' },\n limit: { type: Number },\n item: {},\n __isFetching: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n vaadin-checkbox::part(label) {\n margin: 0 0 0 calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);\n align-self: center;\n }\n `,\n ];\n }\n\n foreignKeyForUri: string | null = null;\n\n foreignKeyForId: string | null = null;\n\n ownKeyForUri: string | null = null;\n\n optionsHref: string | null = null;\n\n linksHref: string | null = null;\n\n embedKey: string | null = null;\n\n ownUri: string | null = null;\n\n limit = 20;\n\n item: string | null = null;\n\n private readonly __getItemRenderer = memoize(\n (item: string | null, hasData: boolean) => {\n return new Function(\n 'ctx',\n `return ctx.html\\`\n <${item ?? 'foxy-null'}\n related=\\${JSON.stringify(ctx.related)}\n parent=\\${ctx.parent}\n infer=\"\"\n ${hasData ? '.data=${ctx.data}' : 'href=${ctx.href}'}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item ?? 'foxy-null'}>\\``\n ) as ItemRenderer;\n },\n (...args) => args.join()\n );\n\n private readonly __renderItem: ItemRenderer = ctx => {\n const render = this.__getItemRenderer(this.item, !!ctx.data);\n const wrap = (content: TemplateResult) => html`\n <div style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\">${content}</div>\n `;\n\n if (!ctx.href || ctx.href.startsWith('foxy://')) return wrap(render(ctx));\n if (this.readonly) return wrap(render(ctx));\n\n const foreignKeyForUri = this.foreignKeyForUri;\n const linkResource = foreignKeyForUri\n ? this.__allLinks?.find(link => link[foreignKeyForUri] === ctx.href)\n : undefined;\n\n const isDisabled = this.disabled || !this.__allLinks || this.__isFetching;\n\n return wrap(html`\n <vaadin-checkbox\n class=\"block\"\n ?disabled=${isDisabled}\n ?checked=${!!linkResource}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n if (target.checked) {\n this.__insertLink(ctx.data?._links.self.href ?? '');\n } else {\n this.__deleteLink(linkResource?._links.self.href ?? '');\n }\n }}\n >\n <div class=\"transition-opacity ${isDisabled ? 'opacity-50' : 'opacity-100'}\">\n ${render(ctx)}\n </div>\n </vaadin-checkbox>\n `);\n };\n\n private __isFetching = false;\n\n renderControl(): TemplateResult {\n let firstHref: string | undefined;\n\n try {\n const url = new URL(this.optionsHref ?? '');\n url.searchParams.set('limit', this.limit.toString());\n firstHref = url.toString();\n } catch {\n firstHref = undefined;\n }\n\n const isStatusVisible = this.__isFetching || !this.__allLinks;\n\n return html`\n <div class=\"group\">\n <div\n class=${classMap({\n 'flex justify-between transition-colors mb-xs font-medium text-s': true,\n 'text-secondary': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n })}\n >\n <span>${this.label}</span>\n <foxy-i18n\n class=\"transition-opacity ${isStatusVisible ? 'opacity-100' : 'opacity-0'}\"\n infer=\"\"\n key=${this.__isFetching ? 'status_saving' : 'status_loading'}\n >\n </foxy-i18n>\n </div>\n\n <foxy-pagination first=${ifDefined(firstHref)} infer=\"pagination\">\n <foxy-collection-page\n infer=\"card\"\n class=${classMap({\n 'block transition-colors divide-y rounded overflow-hidden': true,\n 'divide-contrast-10 ring-1 ring-inset ring-contrast-10': true,\n })}\n .item=${this.__renderItem}\n >\n </foxy-collection-page>\n </foxy-pagination>\n\n <div\n class=${classMap({\n 'transition-colors mt-xs text-xs': true,\n 'text-secondary': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n })}\n ?hidden=${!this.helperText}\n >\n ${this.helperText}\n </div>\n\n <div\n class=\"mt-xs text-xs leading-xs text-error\"\n ?hidden=${!this._errorMessage || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </div>\n\n ${this.__renderLinkResourceLoaders()}\n </div>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n if (changes.has('item')) this.__getItemRenderer.cache.clear?.();\n }\n\n private async __insertLink(foreignUri: string) {\n this.__isFetching = true;\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(this.linksHref ?? '', {\n method: 'POST',\n body: JSON.stringify({\n [this.foreignKeyForUri ?? '']: foreignUri,\n [this.ownKeyForUri ?? '']: this.ownUri,\n }),\n });\n\n if (response.ok) {\n const json = await response.json();\n const dataResponse = await api.fetch(json._links.self.href);\n\n if (dataResponse.ok) {\n const rumour = NucleonElement.Rumour(this.nucleon?.group ?? '');\n const data = await dataResponse.json();\n\n rumour.share({\n related: [this.linksHref ?? ''],\n source: json._links.self.href,\n data,\n });\n }\n }\n\n this.__isFetching = false;\n }\n\n private async __deleteLink(linkUri: string) {\n this.__isFetching = true;\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(linkUri, { method: 'DELETE' });\n\n if (response.ok) {\n const rumour = NucleonElement.Rumour(this.nucleon?.group ?? '');\n rumour.share({ related: [this.linksHref ?? ''], source: linkUri, data: null });\n }\n\n this.__isFetching = false;\n }\n\n private __renderLinkResourceLoaders() {\n const maxApiLimit = 200;\n const firstPage = this.renderRoot.querySelector<NucleonElement<Collection>>('[data-link-page]');\n const totalItems = Number(firstPage?.data?.total_items ?? maxApiLimit); // sometimes total_items is a string in hAPI\n const links: string[] = [];\n\n try {\n for (let i = 0; i < Math.max(1, Math.ceil(totalItems / maxApiLimit)); i++) {\n const url = new URL(this.linksHref ?? '');\n url.searchParams.set('offset', String(i * maxApiLimit));\n url.searchParams.set('limit', String(maxApiLimit));\n links.push(url.toString());\n }\n } catch {\n // Do nothing.\n }\n\n return links.map(\n href => html`\n <foxy-nucleon\n class=\"hidden\"\n data-link-page\n infer=\"\"\n href=${href}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `\n );\n }\n\n private get __allLinks() {\n const embedKey = this.embedKey;\n if (!embedKey) return null;\n\n type Loader = NucleonElement<Collection>;\n const loaders = this.renderRoot.querySelectorAll<Loader>('[data-link-page]');\n const allLinks: any[] = [];\n\n for (const loader of loaders) {\n const embedded = loader.data?._embedded?.[embedKey];\n if (!embedded) return null;\n allLinks.push(...embedded);\n }\n\n return allLinks;\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { Graph, Resource } from '@foxy.io/sdk/core';
2
+ import type { CollectionGraphLinks, CollectionGraphProps } from '@foxy.io/sdk/dist/types/core/defaults';
3
+ interface CollectionResourceItem extends Graph {
4
+ curie: string;
5
+ props: Record<string, unknown>;
6
+ links: {
7
+ self: CollectionResourceItem;
8
+ [key: string]: any;
9
+ };
10
+ }
11
+ interface CollectionResource extends Graph {
12
+ curie: string;
13
+ props: CollectionGraphProps;
14
+ links: CollectionGraphLinks<CollectionResource>;
15
+ child: CollectionResourceItem;
16
+ }
17
+ export declare type Collection = Resource<CollectionResource>;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncResourceLinkListControl/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph, Resource } from '@foxy.io/sdk/core';\n\nimport type {\n CollectionGraphLinks,\n CollectionGraphProps,\n} from '@foxy.io/sdk/dist/types/core/defaults';\n\ninterface CollectionResourceItem extends Graph {\n curie: string;\n props: Record<string, unknown>;\n links: { self: CollectionResourceItem; [key: string]: any };\n}\n\ninterface CollectionResource extends Graph {\n curie: string;\n props: CollectionGraphProps;\n links: CollectionGraphLinks<CollectionResource>;\n child: CollectionResourceItem;\n}\n\nexport type Collection = Resource<CollectionResource>;\n"]}
@@ -12,6 +12,7 @@ export declare class InternalPasswordControl extends InternalEditableControl {
12
12
  generatorOptions: null | GeneratorOptions;
13
13
  /** If true, renders the password generator button. */
14
14
  showGenerator: boolean;
15
+ layout: 'standalone' | 'summary-item' | null;
15
16
  renderControl(): TemplateResult;
16
17
  protected get _value(): string;
17
18
  protected set _value(newValue: string);
@@ -15,21 +15,25 @@ export class InternalPasswordControl extends InternalEditableControl {
15
15
  this.generatorOptions = null;
16
16
  /** If true, renders the password generator button. */
17
17
  this.showGenerator = false;
18
+ this.layout = null;
18
19
  }
19
20
  static get properties() {
20
21
  return {
21
22
  ...super.properties,
22
23
  generatorOptions: { type: Object, attribute: 'generator-options' },
23
24
  showGenerator: { type: Boolean, attribute: 'show-generator' },
25
+ layout: {},
24
26
  };
25
27
  }
26
28
  renderControl() {
29
+ var _a;
27
30
  return html `
28
31
  <vaadin-password-field
29
32
  error-message=${ifDefined(this._errorMessage)}
30
33
  helper-text=${this.helperText}
31
34
  placeholder=${this.placeholder}
32
35
  label=${this.label}
36
+ theme=${ifDefined((_a = this.layout) !== null && _a !== void 0 ? _a : void 0)}
33
37
  class="w-full"
34
38
  ?disabled=${this.disabled}
35
39
  ?readonly=${this.readonly}