@foxy.io/elements 1.14.0-beta.6 → 1.14.0
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/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +17 -17
- package/dist/cdn/foxy-customer-portal.js +18 -15
- package/dist/cdn/foxy-customer.js +4 -4
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +2 -2
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -14
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/shared-07134f93.js +14 -0
- package/dist/cdn/{shared-691da586.js → shared-07abcd7b.js} +1 -1
- package/dist/cdn/{shared-6f7f752e.js → shared-322e60b1.js} +1 -1
- package/dist/cdn/shared-35dbd2c5.js +1 -0
- package/dist/cdn/{shared-1bafffd0.js → shared-5c8b531d.js} +1 -1
- package/dist/cdn/{shared-6ecbc785.js → shared-5f54e916.js} +1 -1
- package/dist/cdn/{shared-50c7a176.js → shared-7a42073a.js} +1 -1
- package/dist/cdn/{shared-c66e9946.js → shared-8a7bee0d.js} +1 -1
- package/dist/cdn/{shared-4d3c7828.js → shared-91e768be.js} +1 -1
- package/dist/cdn/shared-9a40309d.js +1 -0
- package/dist/cdn/{shared-7629a1a5.js → shared-b5147166.js} +1 -1
- package/dist/cdn/{shared-16e28f3b.js → shared-bc2bfe52.js} +1 -1
- package/dist/cdn/{shared-0ba88744.js → shared-ce1da35d.js} +1 -1
- package/dist/cdn/{shared-09feabf8.js → shared-d01d809a.js} +1 -1
- package/dist/cdn/{shared-8edee4e1.js → shared-d8ffb279.js} +7 -7
- package/dist/cdn/{shared-a6c047b1.js → shared-e5cbf291.js} +1 -1
- package/dist/cdn/shared-f1dc1c6c.js +1 -0
- package/dist/cdn/translations/shared/de.json +94 -0
- package/dist/cdn/translations/shared/en.json +83 -83
- package/dist/cdn/translations/shared/es.json +93 -0
- package/dist/elements/private/Checkbox/Checkbox.d.ts +3 -1
- package/dist/elements/private/Checkbox/Checkbox.js +43 -14
- package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
- package/dist/elements/private/Choice/Choice.js +7 -5
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.d.ts +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js +17 -8
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +11 -3
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +24 -2
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +89 -50
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/types.d.ts +14 -0
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
- package/dist/elements/public/ItemsForm/private/Picture.d.ts +1 -0
- package/dist/elements/public/ItemsForm/private/Picture.js +2 -0
- package/dist/elements/public/ItemsForm/private/Picture.js.map +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +12 -4
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +2 -4
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +29 -21
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +1 -1
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +53 -18
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +55 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +401 -185
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/types.d.ts +34 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.d.ts +23 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js +92 -52
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/types.d.ts +14 -0
- package/dist/elements/public/TemplateForm/types.js.map +1 -1
- package/dist/mixins/themeable.js +30 -14
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/mixins/translatable.js +1 -1
- package/dist/mixins/translatable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-3f35fa81.js +0 -1
- package/dist/cdn/shared-ace85f1b.js +0 -1
- package/dist/cdn/shared-d8852c42.js +0 -1
|
@@ -10,9 +10,31 @@ import { classMap } from "../../../utils/class-map.js";
|
|
|
10
10
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
11
11
|
const NS = 'email-template-form';
|
|
12
12
|
const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS))));
|
|
13
|
+
/**
|
|
14
|
+
* Form element for creating or editing email templates (`fx:email_template`).
|
|
15
|
+
*
|
|
16
|
+
* @slot description:before
|
|
17
|
+
* @slot description:after
|
|
18
|
+
*
|
|
19
|
+
* @slot content:before
|
|
20
|
+
* @slot content:after
|
|
21
|
+
*
|
|
22
|
+
* @slot timestamps:before
|
|
23
|
+
* @slot timestamps:after
|
|
24
|
+
*
|
|
25
|
+
* @slot create:before
|
|
26
|
+
* @slot create:after
|
|
27
|
+
*
|
|
28
|
+
* @slot delete:before
|
|
29
|
+
* @slot delete:after
|
|
30
|
+
*
|
|
31
|
+
* @element foxy-email-template-form
|
|
32
|
+
* @since 1.14.0
|
|
33
|
+
*/
|
|
13
34
|
export class EmailTemplateForm extends Base {
|
|
14
35
|
constructor() {
|
|
15
36
|
super(...arguments);
|
|
37
|
+
this.templates = {};
|
|
16
38
|
this.__cacheState = 'idle';
|
|
17
39
|
this.__contentChoice = 'default';
|
|
18
40
|
}
|
|
@@ -80,13 +102,17 @@ export class EmailTemplateForm extends Base {
|
|
|
80
102
|
}
|
|
81
103
|
__renderDescription() {
|
|
82
104
|
var _a, _b;
|
|
105
|
+
const scope = 'description';
|
|
83
106
|
return html `
|
|
84
107
|
<div>
|
|
85
|
-
${this.renderTemplateOrSlot(
|
|
108
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
86
109
|
|
|
87
110
|
<vaadin-text-field
|
|
111
|
+
data-testid=${scope}
|
|
88
112
|
class="w-full mb-s"
|
|
89
|
-
label=${this.t(
|
|
113
|
+
label=${this.t(scope)}
|
|
114
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}
|
|
115
|
+
?readonly=${this.readonlySelector.matches(scope)}
|
|
90
116
|
.value=${(_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : ''}
|
|
91
117
|
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
92
118
|
@input=${(evt) => {
|
|
@@ -95,26 +121,28 @@ export class EmailTemplateForm extends Base {
|
|
|
95
121
|
>
|
|
96
122
|
</vaadin-text-field>
|
|
97
123
|
|
|
98
|
-
${this.renderTemplateOrSlot(
|
|
124
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
99
125
|
</div>
|
|
100
126
|
`;
|
|
101
127
|
}
|
|
102
128
|
__renderContent() {
|
|
103
129
|
return html `
|
|
104
|
-
<div>
|
|
130
|
+
<div data-testid="content">
|
|
105
131
|
${this.renderTemplateOrSlot('content:before')}
|
|
106
132
|
|
|
107
133
|
<div class="space-y-l">
|
|
108
|
-
${this.
|
|
109
|
-
${this.
|
|
134
|
+
${this.__renderContentVariant('content_text_url', 'content_text', 'text_template')}
|
|
135
|
+
${this.__renderContentVariant('content_html_url', 'content_html', 'html_template')}
|
|
110
136
|
</div>
|
|
111
137
|
|
|
112
138
|
${this.renderTemplateOrSlot('content:after')}
|
|
113
139
|
</div>
|
|
114
140
|
`;
|
|
115
141
|
}
|
|
116
|
-
|
|
142
|
+
__renderContentVariant(urlPath, textPath, header) {
|
|
117
143
|
var _a;
|
|
144
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches('content', true);
|
|
145
|
+
const isReadonly = this.readonlySelector.matches('content', true);
|
|
118
146
|
const contentChoice = this.form[urlPath]
|
|
119
147
|
? 'url'
|
|
120
148
|
: this.form[textPath]
|
|
@@ -122,14 +150,21 @@ export class EmailTemplateForm extends Base {
|
|
|
122
150
|
: this.__contentChoice;
|
|
123
151
|
return html `
|
|
124
152
|
<x-group frame>
|
|
125
|
-
<foxy-i18n
|
|
153
|
+
<foxy-i18n
|
|
154
|
+
class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}
|
|
155
|
+
lang=${this.lang}
|
|
156
|
+
slot="header"
|
|
157
|
+
key=${header}
|
|
158
|
+
ns=${this.ns}
|
|
159
|
+
>
|
|
160
|
+
</foxy-i18n>
|
|
126
161
|
|
|
127
162
|
<x-choice
|
|
128
|
-
data-testid="
|
|
163
|
+
data-testid="${textPath.replace('_', '-')}-type"
|
|
129
164
|
.value=${contentChoice}
|
|
130
165
|
.items=${['default', 'url', 'clipboard']}
|
|
131
|
-
?readonly=${
|
|
132
|
-
?disabled=${
|
|
166
|
+
?readonly=${isReadonly}
|
|
167
|
+
?disabled=${isDisabled}
|
|
133
168
|
@change=${(evt) => {
|
|
134
169
|
if (evt instanceof ChoiceChangeEvent) {
|
|
135
170
|
this.edit({ [textPath]: '', [urlPath]: '' });
|
|
@@ -157,9 +192,12 @@ export class EmailTemplateForm extends Base {
|
|
|
157
192
|
<div slot="url" ?hidden=${contentChoice !== 'url'}>
|
|
158
193
|
<div class="flex items-center mt-0 mb-m">
|
|
159
194
|
<vaadin-text-field
|
|
160
|
-
data-testid="
|
|
195
|
+
data-testid="${textPath.replace('_', '-')}-url"
|
|
161
196
|
value=${ifDefined(this.form[urlPath])}
|
|
162
197
|
class="mr-s flex-grow"
|
|
198
|
+
?readonly=${isReadonly}
|
|
199
|
+
?disabled=${isDisabled}
|
|
200
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
163
201
|
@input=${(evt) => {
|
|
164
202
|
const value = evt.currentTarget.value;
|
|
165
203
|
this.edit({ [textPath]: '', [urlPath]: value });
|
|
@@ -167,50 +205,50 @@ export class EmailTemplateForm extends Base {
|
|
|
167
205
|
>
|
|
168
206
|
</vaadin-text-field>
|
|
169
207
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
208
|
+
<vaadin-button
|
|
209
|
+
data-testid="${textPath.replace('_', '-')}-cache"
|
|
210
|
+
class="relative"
|
|
211
|
+
?disabled=${isDisabled || this.__cacheState === 'busy'}
|
|
212
|
+
?hidden=${isReadonly || this.form[urlPath] !== ((_a = this.data) === null || _a === void 0 ? void 0 : _a[urlPath])}
|
|
213
|
+
@click=${this.__cache}
|
|
214
|
+
>
|
|
215
|
+
<foxy-i18n
|
|
216
|
+
class=${classMap({
|
|
217
|
+
'relative transition-opacity': true,
|
|
218
|
+
'opacity-0': this.__cacheState !== 'idle',
|
|
219
|
+
})}
|
|
220
|
+
lang=${this.lang}
|
|
221
|
+
key="cache"
|
|
222
|
+
ns=${this.ns}
|
|
223
|
+
>
|
|
224
|
+
</foxy-i18n>
|
|
187
225
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
`
|
|
205
|
-
: ''}
|
|
226
|
+
<div
|
|
227
|
+
class=${classMap({
|
|
228
|
+
'absolute inset-0 flex transition-opacity': true,
|
|
229
|
+
'opacity-0': this.__cacheState === 'idle',
|
|
230
|
+
})}
|
|
231
|
+
>
|
|
232
|
+
<foxy-spinner
|
|
233
|
+
layout="no-label"
|
|
234
|
+
class="m-auto"
|
|
235
|
+
state=${this.__cacheState === 'fail' ? 'error' : 'busy'}
|
|
236
|
+
lang=${this.lang}
|
|
237
|
+
ns=${this.ns}
|
|
238
|
+
>
|
|
239
|
+
</foxy-spinner>
|
|
240
|
+
</div>
|
|
241
|
+
</vaadin-button>
|
|
206
242
|
</div>
|
|
207
243
|
</div>
|
|
208
244
|
|
|
209
245
|
<div slot="clipboard" ?hidden=${contentChoice !== 'clipboard'}>
|
|
210
246
|
<vaadin-text-area
|
|
247
|
+
data-testid="${textPath.replace('_', '-')}-clipboard"
|
|
211
248
|
id="cached-content"
|
|
212
|
-
data-testid="content"
|
|
213
249
|
class="w-full mb-m"
|
|
250
|
+
?readonly=${isReadonly}
|
|
251
|
+
?disabled=${isDisabled}
|
|
214
252
|
.value=${this.form[textPath]}
|
|
215
253
|
@input=${(evt) => {
|
|
216
254
|
const value = evt.currentTarget.value;
|
|
@@ -224,9 +262,10 @@ export class EmailTemplateForm extends Base {
|
|
|
224
262
|
`;
|
|
225
263
|
}
|
|
226
264
|
__renderTimestamps() {
|
|
265
|
+
const scope = 'timestamps';
|
|
227
266
|
return html `
|
|
228
267
|
<div>
|
|
229
|
-
${this.renderTemplateOrSlot(
|
|
268
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
230
269
|
|
|
231
270
|
<x-property-table
|
|
232
271
|
data-testid="timestamps"
|
|
@@ -241,7 +280,7 @@ export class EmailTemplateForm extends Base {
|
|
|
241
280
|
>
|
|
242
281
|
</x-property-table>
|
|
243
282
|
|
|
244
|
-
${this.renderTemplateOrSlot(
|
|
283
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
245
284
|
</div>
|
|
246
285
|
`;
|
|
247
286
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailT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AC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { Data } from './types';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'email-template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('description:before')}\n\n <vaadin-text-field\n class=\"w-full mb-s\"\n label=${this.t('description')}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderContent() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('content:before')}\n\n <div class=\"space-y-l\">\n ${this.__renderTabContent('content_text_url', 'content_text', 'text_template')}\n ${this.__renderTabContent('content_html_url', 'content_html', 'html_template')}\n </div>\n\n ${this.renderTemplateOrSlot('content:after')}\n </div>\n `;\n }\n\n private __renderTabContent(\n urlPath: 'content_text_url' | 'content_html_url',\n textPath: 'content_text' | 'content_html',\n header: string\n ) {\n const contentChoice = this.form[urlPath]\n ? 'url'\n : this.form[textPath]\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <x-group frame>\n <foxy-i18n lang=${this.lang} slot=\"header\" key=${header} ns=${this.ns}></foxy-i18n>\n\n <x-choice\n data-testid=\"template-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${this.readonlySelector.matches('content', true)}\n ?disabled=${this.in('busy') || this.disabledSelector.matches('content', true)}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ [textPath]: '', [urlPath]: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"content_url\"\n value=${ifDefined(this.form[urlPath])}\n class=\"mr-s flex-grow\"\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ [textPath]: '', [urlPath]: value });\n }}\n >\n </vaadin-text-field>\n\n ${this.form[urlPath] === this.data?.[urlPath]\n ? html`\n <vaadin-button\n class=\"relative\"\n ?disabled=${this.__cacheState === 'busy'}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n `\n : ''}\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n id=\"cached-content\"\n data-testid=\"content\"\n class=\"w-full mb-m\"\n .value=${this.form[textPath]}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ [textPath]: value, [urlPath]: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n `;\n }\n\n private __renderTimestamps() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('timestamps:before')}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot('timestamps:after')}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,+BAA4B;AAEnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,gCAA6B;AACzD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SA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K,CAAC,OAAO;;QACnB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEtF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'email-template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @slot description:before\n * @slot description:after\n *\n * @slot content:before\n * @slot content:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot('content:before')}\n\n <div class=\"space-y-l\">\n ${this.__renderContentVariant('content_text_url', 'content_text', 'text_template')}\n ${this.__renderContentVariant('content_html_url', 'content_html', 'html_template')}\n </div>\n\n ${this.renderTemplateOrSlot('content:after')}\n </div>\n `;\n }\n\n private __renderContentVariant(\n urlPath: 'content_text_url' | 'content_html_url',\n textPath: 'content_text' | 'content_html',\n header: string\n ) {\n const isDisabled = !this.in('idle') || this.disabledSelector.matches('content', true);\n const isReadonly = this.readonlySelector.matches('content', true);\n const contentChoice = this.form[urlPath]\n ? 'url'\n : this.form[textPath]\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=${header}\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"${textPath.replace('_', '-')}-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ [textPath]: '', [urlPath]: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"${textPath.replace('_', '-')}-url\"\n value=${ifDefined(this.form[urlPath])}\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ [textPath]: '', [urlPath]: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"${textPath.replace('_', '-')}-cache\"\n class=\"relative\"\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n ?hidden=${isReadonly || this.form[urlPath] !== this.data?.[urlPath]}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n data-testid=\"${textPath.replace('_', '-')}-clipboard\"\n id=\"cached-content\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form[textPath]}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ [textPath]: value, [urlPath]: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import { EmailTemplateForm } from './EmailTemplateForm';
|
|
1
2
|
import { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
+
import { Renderer } from '../../../mixins/configurable';
|
|
2
4
|
import { Resource } from '@foxy.io/sdk/core';
|
|
3
5
|
export declare type Data = Resource<Rels.EmailTemplate>;
|
|
6
|
+
export declare type Templates = {
|
|
7
|
+
'description:before'?: Renderer<EmailTemplateForm>;
|
|
8
|
+
'description:after'?: Renderer<EmailTemplateForm>;
|
|
9
|
+
'content:before'?: Renderer<EmailTemplateForm>;
|
|
10
|
+
'content:after'?: Renderer<EmailTemplateForm>;
|
|
11
|
+
'timestamps:before'?: Renderer<EmailTemplateForm>;
|
|
12
|
+
'timestamps:after'?: Renderer<EmailTemplateForm>;
|
|
13
|
+
'create:before'?: Renderer<EmailTemplateForm>;
|
|
14
|
+
'create:after'?: Renderer<EmailTemplateForm>;
|
|
15
|
+
'delete:before'?: Renderer<EmailTemplateForm>;
|
|
16
|
+
'delete:after'?: Renderer<EmailTemplateForm>;
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { EmailTemplateForm } from './EmailTemplateForm';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n\nexport type Templates = {\n 'description:before'?: Renderer<EmailTemplateForm>;\n 'description:after'?: Renderer<EmailTemplateForm>;\n 'content:before'?: Renderer<EmailTemplateForm>;\n 'content:after'?: Renderer<EmailTemplateForm>;\n 'timestamps:before'?: Renderer<EmailTemplateForm>;\n 'timestamps:after'?: Renderer<EmailTemplateForm>;\n 'create:before'?: Renderer<EmailTemplateForm>;\n 'create:after'?: Renderer<EmailTemplateForm>;\n 'delete:before'?: Renderer<EmailTemplateForm>;\n 'delete:after'?: Renderer<EmailTemplateForm>;\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSResultArray, LitElement, PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import { PreviewItem } from './Preview';
|
|
3
3
|
export declare class Picture extends LitElement {
|
|
4
|
+
static readonly placeholder = "data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E";
|
|
4
5
|
static get properties(): PropertyDeclarations;
|
|
5
6
|
static get styles(): CSSResultArray;
|
|
6
7
|
quantity: number;
|
|
@@ -141,6 +141,7 @@ export class Picture extends LitElement {
|
|
|
141
141
|
const image = new Image();
|
|
142
142
|
image.src = this.image;
|
|
143
143
|
image.setAttribute('part', 'picture');
|
|
144
|
+
image.addEventListener('error', () => (image.src = Picture.placeholder));
|
|
144
145
|
this.__setImageState(image, state);
|
|
145
146
|
this.__container.insertBefore(image, refChild);
|
|
146
147
|
return image;
|
|
@@ -158,4 +159,5 @@ export class Picture extends LitElement {
|
|
|
158
159
|
image.className = [shared, states[state]].join(' ');
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
Picture.placeholder = 'data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';
|
|
161
163
|
//# sourceMappingURL=Picture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picture.js","sourceRoot":"","sources":["../../../../../src/elements/public/ItemsForm/private/Picture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,wCAAqC;AAEzD,IAAK,UAMJ;AAND,WAAK,UAAU;IACb,mDAAY,CAAA;IACZ,yDAAe,CAAA;IACf,iDAAW,CAAA;IACX,mDAAY,CAAA;IACZ,uDAAc,CAAA;AAChB,CAAC,EANI,UAAU,KAAV,UAAU,QAMd;AAED,MAAM,OAAO,OAAQ,SAAQ,UAAU;IAAvC;;QAgDS,aAAQ,GAAG,CAAC,CAAC;QAEb,UAAK,GAAG,EAAE,CAAC;IA+GpB,CAAC;IAhKQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACn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AAI,CAAC,KAAK,CAAC;QACvB,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,eAAe,CAAC,KAAuB,EAAE,KAAiB;QAChE,MAAM,MAAM,GACV,qGAAqG,CAAC;QAExG,MAAM,MAAM,GAAG;YACb,WAAW;YACX,yDAAyD;YACzD,UAAU;YACV,8BAA8B;YAC9B,6BAA6B;SAC9B,CAAC;QAEF,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC,SAAS;QAClC,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { PreviewItem } from './Preview';\nimport { Themeable } from '../../../../mixins/themeable';\n\nenum ImageState {\n Excluded = 0,\n BeforeEnter = 1,\n Default = 2,\n Previous = 3,\n BeforeExit = 4,\n}\n\nexport class Picture extends LitElement {\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n quantity: { attribute: false },\n image: { attribute: false },\n };\n }\n\n public static get styles(): CSSResultArray {\n return [\n Themeable.styles,\n css`\n .ease-out-back {\n transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .blur-1 {\n filter: blur(1px);\n }\n\n .blur-2 {\n filter: blur(2px);\n }\n\n .grayscale {\n filter: grayscale();\n }\n\n .rotate-12 {\n --tw-rotate: 12deg;\n }\n\n .-rotate-12 {\n --tw-rotate: -12deg;\n }\n\n .-rotate-24 {\n --tw-rotate: -24deg;\n }\n\n .translate-y-half {\n --tw-translate-y: 50%;\n }\n `,\n ];\n }\n\n public quantity = 0;\n\n public image = '';\n\n public set empty(newValue: boolean) {\n this.updateComplete.then(() => {\n if (newValue) {\n const [, ...bottomImages] = this.__stack;\n bottomImages.forEach(image => image.remove());\n } else if (this.quantity > 1 && this.__stack.length < 2) {\n this.__insertImage(ImageState.Previous, this.__stack[0]);\n }\n });\n }\n\n public set data({ quantity, image }: PreviewItem) {\n this.quantity = quantity;\n this.image = image;\n }\n\n public render(): TemplateResult {\n return html`<div id=\"image\" class=\"w-full h-full relative\"></div>`;\n }\n\n public firstUpdated(): void {\n const top = this.__insertImage(ImageState.Default);\n if (this.quantity > 1) this.__insertImage(ImageState.Previous, top);\n }\n\n public updated(changedProperties: Map<keyof Picture, unknown>): void {\n if (changedProperties.has('quantity')) {\n const oldValue = changedProperties.get('quantity') as number | undefined;\n if (oldValue !== undefined) this.quantity > oldValue ? this.__add() : this.__remove();\n }\n\n if (changedProperties.has('image')) {\n this.__stack.forEach(image => (image.src = this.image));\n }\n }\n\n private get __container() {\n return this.shadowRoot!.getElementById('image')!;\n }\n\n private get __stack() {\n const list = this.__container?.querySelectorAll(':not(.opacity-0)') ?? [];\n return [...list].reverse() as HTMLImageElement[];\n }\n\n private __add() {\n const [current, previous] = this.__stack;\n\n if (this.quantity > 1) {\n if (current) this.__setImageState(current, ImageState.Previous);\n\n if (previous) {\n this.__setImageState(previous, ImageState.BeforeExit);\n previous.ontransitionend = /* istanbul ignore next */ () => previous.remove();\n }\n\n this.__setImageState(this.__insertImage(ImageState.BeforeEnter), ImageState.Default);\n } else {\n if (current) this.__setImageState(current, ImageState.Default);\n }\n }\n\n private __remove() {\n const [current, previous] = this.__stack;\n let imageToRemove: HTMLImageElement;\n\n if (this.quantity > 0) {\n if (previous) this.__setImageState(previous, ImageState.Default);\n imageToRemove = current;\n } else {\n if (current) this.__setImageState(current, ImageState.Excluded);\n imageToRemove = previous;\n }\n\n if (imageToRemove) {\n this.__setImageState(imageToRemove, ImageState.BeforeEnter);\n imageToRemove.ontransitionend = /* istanbul ignore next */ () => imageToRemove!.remove();\n }\n\n if (this.quantity > 1) {\n const last = this.__insertImage(ImageState.BeforeExit, this.__container.firstElementChild);\n this.__setImageState(last, ImageState.Previous);\n }\n }\n\n private __insertImage(state: ImageState, refChild: Node | null = null) {\n const image = new Image();\n image.src = this.image;\n image.setAttribute('part', 'picture');\n this.__setImageState(image, state);\n this.__container.insertBefore(image, refChild);\n return image;\n }\n\n private __setImageState(image: HTMLImageElement, state: ImageState) {\n const shared =\n 'absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back';\n\n const states = [\n 'grayscale',\n 'shadow-m translate-y-half scale-110 rotate-12 opacity-0',\n 'shadow-m',\n 'blur-1 -rotate-12 opacity-25',\n 'blur-2 -rotate-24 opacity-0',\n ];\n\n void image.offsetHeight; // reflow\n image.className = [shared, states[state]].join(' ');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Picture.js","sourceRoot":"","sources":["../../../../../src/elements/public/ItemsForm/private/Picture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,wCAAqC;AAEzD,IAAK,UAMJ;AAND,WAAK,UAAU;IACb,mDAAY,CAAA;IACZ,yDAAe,CAAA;IACf,iDAAW,CAAA;IACX,mDAAY,CAAA;IACZ,uDAAc,CAAA;AAChB,CAAC,EANI,UAAU,KAAV,UAAU,QAMd;AAED,MAAM,OAAO,OAAQ,SAAQ,UAAU;IAAvC;;QAmDS,aAAQ,GAAG,CAAC,CAAC;QAEb,UAAK,GAAG,EAAE,CAAC;IAkHpB,CAAC;IAnKQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK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,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QAEzE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,eAAe,CAAC,KAAuB,EAAE,KAAiB;QAChE,MAAM,MAAM,GACV,qGAAqG,CAAC;QAExG,MAAM,MAAM,GAAG;YACb,WAAW;YACX,yDAAyD;YACzD,UAAU;YACV,8BAA8B;YAC9B,6BAA6B;SAC9B,CAAC;QAEF,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC,SAAS;QAClC,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;;AArKsB,mBAAW,GAChC,+wDAA+wD,CAAC","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { PreviewItem } from './Preview';\nimport { Themeable } from '../../../../mixins/themeable';\n\nenum ImageState {\n Excluded = 0,\n BeforeEnter = 1,\n Default = 2,\n Previous = 3,\n BeforeExit = 4,\n}\n\nexport class Picture extends LitElement {\n public static readonly placeholder =\n 'data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E';\n\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n quantity: { attribute: false },\n image: { attribute: false },\n };\n }\n\n public static get styles(): CSSResultArray {\n return [\n Themeable.styles,\n css`\n .ease-out-back {\n transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .blur-1 {\n filter: blur(1px);\n }\n\n .blur-2 {\n filter: blur(2px);\n }\n\n .grayscale {\n filter: grayscale();\n }\n\n .rotate-12 {\n --tw-rotate: 12deg;\n }\n\n .-rotate-12 {\n --tw-rotate: -12deg;\n }\n\n .-rotate-24 {\n --tw-rotate: -24deg;\n }\n\n .translate-y-half {\n --tw-translate-y: 50%;\n }\n `,\n ];\n }\n\n public quantity = 0;\n\n public image = '';\n\n public set empty(newValue: boolean) {\n this.updateComplete.then(() => {\n if (newValue) {\n const [, ...bottomImages] = this.__stack;\n bottomImages.forEach(image => image.remove());\n } else if (this.quantity > 1 && this.__stack.length < 2) {\n this.__insertImage(ImageState.Previous, this.__stack[0]);\n }\n });\n }\n\n public set data({ quantity, image }: PreviewItem) {\n this.quantity = quantity;\n this.image = image;\n }\n\n public render(): TemplateResult {\n return html`<div id=\"image\" class=\"w-full h-full relative\"></div>`;\n }\n\n public firstUpdated(): void {\n const top = this.__insertImage(ImageState.Default);\n if (this.quantity > 1) this.__insertImage(ImageState.Previous, top);\n }\n\n public updated(changedProperties: Map<keyof Picture, unknown>): void {\n if (changedProperties.has('quantity')) {\n const oldValue = changedProperties.get('quantity') as number | undefined;\n if (oldValue !== undefined) this.quantity > oldValue ? this.__add() : this.__remove();\n }\n\n if (changedProperties.has('image')) {\n this.__stack.forEach(image => (image.src = this.image));\n }\n }\n\n private get __container() {\n return this.shadowRoot!.getElementById('image')!;\n }\n\n private get __stack() {\n const list = this.__container?.querySelectorAll(':not(.opacity-0)') ?? [];\n return [...list].reverse() as HTMLImageElement[];\n }\n\n private __add() {\n const [current, previous] = this.__stack;\n\n if (this.quantity > 1) {\n if (current) this.__setImageState(current, ImageState.Previous);\n\n if (previous) {\n this.__setImageState(previous, ImageState.BeforeExit);\n previous.ontransitionend = /* istanbul ignore next */ () => previous.remove();\n }\n\n this.__setImageState(this.__insertImage(ImageState.BeforeEnter), ImageState.Default);\n } else {\n if (current) this.__setImageState(current, ImageState.Default);\n }\n }\n\n private __remove() {\n const [current, previous] = this.__stack;\n let imageToRemove: HTMLImageElement;\n\n if (this.quantity > 0) {\n if (previous) this.__setImageState(previous, ImageState.Default);\n imageToRemove = current;\n } else {\n if (current) this.__setImageState(current, ImageState.Excluded);\n imageToRemove = previous;\n }\n\n if (imageToRemove) {\n this.__setImageState(imageToRemove, ImageState.BeforeEnter);\n imageToRemove.ontransitionend = /* istanbul ignore next */ () => imageToRemove!.remove();\n }\n\n if (this.quantity > 1) {\n const last = this.__insertImage(ImageState.BeforeExit, this.__container.firstElementChild);\n this.__setImageState(last, ImageState.Previous);\n }\n }\n\n private __insertImage(state: ImageState, refChild: Node | null = null) {\n const image = new Image();\n\n image.src = this.image;\n image.setAttribute('part', 'picture');\n image.addEventListener('error', () => (image.src = Picture.placeholder));\n\n this.__setImageState(image, state);\n this.__container.insertBefore(image, refChild);\n return image;\n }\n\n private __setImageState(image: HTMLImageElement, state: ImageState) {\n const shared =\n 'absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back';\n\n const states = [\n 'grayscale',\n 'shadow-m translate-y-half scale-110 rotate-12 opacity-0',\n 'shadow-m',\n 'blur-1 -rotate-12 opacity-25',\n 'blur-2 -rotate-24 opacity-0',\n ];\n\n void image.offsetHeight; // reflow\n image.className = [shared, states[state]].join(' ');\n }\n}\n"]}
|
|
@@ -466,20 +466,28 @@ export class SubscriptionForm extends Base {
|
|
|
466
466
|
get __isNextTransactionDateVisible() {
|
|
467
467
|
if (this.hiddenSelector.matches('next-transaction-date', true))
|
|
468
468
|
return false;
|
|
469
|
-
if (this.settings === null)
|
|
470
|
-
return true;
|
|
471
469
|
if (this.data === null)
|
|
472
470
|
return false;
|
|
471
|
+
if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now())
|
|
472
|
+
return false;
|
|
473
|
+
if (this.data.is_active === false)
|
|
474
|
+
return false;
|
|
475
|
+
if (this.settings === null)
|
|
476
|
+
return true;
|
|
473
477
|
const rules = this.settings.subscriptions.allow_next_date_modification;
|
|
474
478
|
return !!getNextTransactionDateConstraints(this.data, rules);
|
|
475
479
|
}
|
|
476
480
|
get __isFrequencyVisible() {
|
|
477
481
|
if (this.hiddenSelector.matches('frequency', true))
|
|
478
482
|
return false;
|
|
479
|
-
if (this.settings === null)
|
|
480
|
-
return true;
|
|
481
483
|
if (this.data === null)
|
|
482
484
|
return false;
|
|
485
|
+
if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now())
|
|
486
|
+
return false;
|
|
487
|
+
if (this.data.is_active === false)
|
|
488
|
+
return false;
|
|
489
|
+
if (this.settings === null)
|
|
490
|
+
return true;
|
|
483
491
|
const allowedFrequencies = getAllowedFrequencies({
|
|
484
492
|
subscription: this.data,
|
|
485
493
|
settings: this.settings,
|