@foxy.io/elements 1.36.0 → 1.37.0-beta.2
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-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-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-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-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-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.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-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.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-experimental-add-to-cart-builder.js +2 -2
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.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-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +2 -2
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- 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 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-01bb183b.js → shared-00b50480.js} +1 -1
- package/dist/cdn/{shared-c1ade7a9.js → shared-00cd0e86.js} +1 -1
- package/dist/cdn/shared-0564def4.js +1 -0
- package/dist/cdn/{shared-e622d8cf.js → shared-05ed8288.js} +1 -1
- package/dist/cdn/{shared-7ce74b42.js → shared-0782fee5.js} +5 -5
- package/dist/cdn/{shared-93774efe.js → shared-0c61b5ce.js} +1 -1
- package/dist/cdn/{shared-cc76a917.js → shared-0d757c1c.js} +1 -1
- package/dist/cdn/{shared-0d8e7067.js → shared-1036a0cd.js} +1 -1
- package/dist/cdn/{shared-61ef8001.js → shared-1563cd85.js} +1 -1
- package/dist/cdn/{shared-6a45a781.js → shared-15ded782.js} +2 -2
- package/dist/cdn/{shared-2879b67f.js → shared-188a9c2e.js} +1 -1
- package/dist/cdn/{shared-c5cf889e.js → shared-1c6a1571.js} +1 -1
- package/dist/cdn/{shared-b927be75.js → shared-1eeddc24.js} +1 -1
- package/dist/cdn/{shared-48970bb4.js → shared-1fcf3749.js} +1 -1
- package/dist/cdn/{shared-1482d5dd.js → shared-256fe764.js} +1 -1
- package/dist/cdn/{shared-0053cf93.js → shared-31b98ac2.js} +1 -1
- package/dist/cdn/{shared-cd652fd0.js → shared-355ef444.js} +1 -1
- package/dist/cdn/{shared-fea2714e.js → shared-4215bff2.js} +1 -1
- package/dist/cdn/{shared-d2340faa.js → shared-421b13a8.js} +1 -1
- package/dist/cdn/{shared-89d09114.js → shared-4558cdb4.js} +1 -1
- package/dist/cdn/shared-47962c3f.js +1 -0
- package/dist/cdn/{shared-2503aefc.js → shared-56f7db6f.js} +1 -1
- package/dist/cdn/{shared-0b00883f.js → shared-5cea7ef0.js} +1 -1
- package/dist/cdn/{shared-9d7ae4aa.js → shared-6042ee79.js} +1 -1
- package/dist/cdn/{shared-6d11190a.js → shared-6524d421.js} +1 -1
- package/dist/cdn/{shared-7cb8722a.js → shared-6660c6df.js} +1 -1
- package/dist/cdn/{shared-9092b247.js → shared-673fb8a1.js} +1 -1
- package/dist/cdn/{shared-528b3bdb.js → shared-6aa8f7ee.js} +1 -1
- package/dist/cdn/{shared-8521017c.js → shared-70bd1896.js} +1 -1
- package/dist/cdn/{shared-76dcc864.js → shared-75908858.js} +1 -1
- package/dist/cdn/{shared-901b41cf.js → shared-7ab454fb.js} +1 -1
- package/dist/cdn/{shared-f20eefdd.js → shared-82614ac9.js} +1 -1
- package/dist/cdn/{shared-40e4854e.js → shared-8f6400d9.js} +1 -1
- package/dist/cdn/{shared-c52295d5.js → shared-944dc1e2.js} +1 -1
- package/dist/cdn/{shared-03355bd1.js → shared-95339d7a.js} +1 -1
- package/dist/cdn/{shared-4c90701b.js → shared-a208ae8c.js} +1 -1
- package/dist/cdn/{shared-2e8361e1.js → shared-a3f1420c.js} +1 -1
- package/dist/cdn/{shared-d279baa5.js → shared-a63c89a1.js} +1 -1
- package/dist/cdn/{shared-2d11750b.js → shared-a72df5aa.js} +1 -1
- package/dist/cdn/{shared-cbd1fab7.js → shared-ae4d5fd6.js} +1 -1
- package/dist/cdn/{shared-8676e5c0.js → shared-b15d45b1.js} +1 -1
- package/dist/cdn/{shared-133fc37b.js → shared-b293a928.js} +1 -1
- package/dist/cdn/{shared-10b54c49.js → shared-b4b9735c.js} +1 -1
- package/dist/cdn/{shared-5f43aa36.js → shared-b7889b37.js} +1 -1
- package/dist/cdn/{shared-4e8a5b95.js → shared-bb43f0ad.js} +1 -1
- package/dist/cdn/{shared-f316780a.js → shared-c05984d1.js} +1 -1
- package/dist/cdn/{shared-86aa139c.js → shared-c1a3e4fd.js} +1 -1
- package/dist/cdn/{shared-5f1a4329.js → shared-c267f04c.js} +1 -1
- package/dist/cdn/{shared-3aaf64e6.js → shared-c2ca5bee.js} +1 -1
- package/dist/cdn/{shared-6b76afc2.js → shared-c3fd2e9c.js} +1 -1
- package/dist/cdn/{shared-cf28d2c8.js → shared-c5fa5c92.js} +1 -1
- package/dist/cdn/{shared-f92b9842.js → shared-c6ce69fc.js} +1 -1
- package/dist/cdn/{shared-4cf87721.js → shared-cb2a2e33.js} +1 -1
- package/dist/cdn/{shared-e0d1856d.js → shared-cf8e2611.js} +1 -1
- package/dist/cdn/{shared-60150977.js → shared-df76d498.js} +1 -1
- package/dist/cdn/{shared-85475a4e.js → shared-e0488d44.js} +1 -1
- package/dist/cdn/{shared-1a49f70b.js → shared-e14bc410.js} +1 -1
- package/dist/cdn/{shared-43e551f2.js → shared-e1b97b27.js} +1 -1
- package/dist/cdn/{shared-25893d83.js → shared-e4159eb9.js} +1 -1
- package/dist/cdn/{shared-4666b6aa.js → shared-e7b48aaa.js} +4 -4
- package/dist/cdn/shared-edb68eb7.js +1 -0
- package/dist/cdn/{shared-231687fd.js → shared-ef11a60b.js} +1 -1
- package/dist/cdn/{shared-0b1b1c14.js → shared-f0afd1ee.js} +1 -1
- package/dist/cdn/{shared-22dd6cbe.js → shared-fda02728.js} +1 -1
- package/dist/cdn/{shared-f72d82a9.js → shared-fefaece7.js} +2 -2
- package/dist/cdn/translations/admin-subscription-form/en.json +3 -0
- package/dist/cdn/translations/experimental-add-to-cart-builder/en.json +4 -1
- package/dist/cdn/translations/gift-card-code-form/en.json +1 -0
- package/dist/cdn/translations/gift-card-form/en.json +1 -0
- package/dist/cdn/translations/transaction/en.json +3 -0
- package/dist/cdn/translations/user-invitation-form/en.json +3 -3
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +11 -1
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +244 -168
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js +1 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +20 -10
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js +2 -2
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js.map +1 -1
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -0
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +6 -2
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +4 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +15 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js +1 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/index.d.ts +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.d.ts +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +15 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js +3 -2
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js +8 -2
- package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormAsyncAction/InternalUserInvitationFormAsyncAction.js.map +1 -1
- package/dist/mixins/themeable.js +0 -4
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-1c07cd7f.js +0 -1
- package/dist/cdn/shared-42bb9e8e.js +0 -1
- package/dist/cdn/shared-d784b79a.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAsyncListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncListControl/InternalAsyncListControl.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IAArE;;QA+BE,oGAAoG;QACpG,2BAAsB,GAAG,KAAK,CAAC;QAE/B,kGAAkG;QAClG,yBAAoB,GAAG,KAAK,CAAC;QAE7B,iEAAiE;QACjE,mBAAc,GAAkB,IAAI,CAAC;QAErC,oEAAoE;QACpE,gBAAW,GAAG,EAAkB,CAAC;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;;;sBAQH,IAAI,KAAK,CACC;oBACpB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAA;;oBAEL,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,GAAG,CAAC;;eAEhB;aACR,CAAC;SACH;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { CollectionPage, NucleonElement } from '../../public/index';\nimport type { BulkAction, SwipeAction } from './types';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { HALJSONResource } from '../../public/NucleonElement/types';\nimport type { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\nimport type { FormDialog } from '../../index';\nimport type { Option } from '../../public/QueryBuilder/types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { render } from 'lit-html';\nimport { html } from 'lit-element';\n\nexport class InternalAsyncListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n keepDialogOpenOnDelete: { type: Boolean, attribute: 'keep-dialog-open-on-delete' },\n keepDialogOpenOnPost: { type: Boolean, attribute: 'keep-dialog-open-on-post' },\n hideDeleteButton: { type: Boolean, attribute: 'hide-delete-button' },\n hideCreateButton: { type: Boolean, attribute: 'hide-create-button' },\n createPageHref: { attribute: 'create-page-href' },\n getPageHref: { attribute: false },\n related: { type: Array },\n first: {},\n limit: { type: Number },\n form: {},\n formProps: { type: Object, attribute: 'form-props' },\n item: {},\n itemProps: { type: Object, attribute: 'item-props' },\n wide: { type: Boolean },\n alert: { type: Boolean },\n actions: { attribute: false },\n bulkActions: { attribute: false },\n filters: { type: Array },\n __filter: { attribute: false },\n __selection: { attribute: false },\n __isSelecting: { attribute: false },\n __notification: { attribute: false },\n __isFilterVisible: { attribute: false },\n __activeBulkAction: { attribute: false },\n };\n }\n\n /** If true, FormDialog won't automatically close after the associated form deletes the resource. */\n keepDialogOpenOnDelete = false;\n\n /** If true, FormDialog won't automatically close after the associated form creates a resource. */\n keepDialogOpenOnPost = false;\n\n /** If provided, renders Create button as a link to this page. */\n createPageHref: string | null = null;\n\n /** Bulk actions that appear when one or more items are selected. */\n bulkActions = [] as BulkAction[];\n\n /** Same as the `related` property of `NucleonElement`. */\n related = [] as string[];\n\n /** Swipe actions. */\n actions = [] as SwipeAction[];\n\n /** Query parameters to apply to the `first` URL. */\n filters = [] as Option[];\n\n /** Limit query parameter to apply to the `first` URL. */\n limit = 20;\n\n /** URI of the first page of the hAPI collection to display. */\n first: string | null = null;\n\n /** Same as the `form` property of `FormDialog`. If set, will open a dialog on item click. */\n form: FormDialog['form'] = null;\n\n /** Props to pass through to the form rendered by `FormDialog`. */\n formProps: Record<string, unknown> = {};\n\n /** Same as the `item` property of `CollectionPage`. */\n item: CollectionPage<any>['item'] = null;\n\n /** Props to pass through to the `CollectionPage` rendering items. */\n itemProps: Record<string, unknown> = {};\n\n /** Same as the `wide` property of `FormDialog`. */\n wide = false;\n\n /** Same as the `alert` property of `FormDialog`. */\n alert = false;\n\n /** Hides Delete Swipe Action if true. */\n hideDeleteButton = false;\n\n /** Hides Create button if true. */\n hideCreateButton = false;\n\n /** If set, renders list items as <a> tags. */\n getPageHref: ((itemHref: string, item: unknown) => string | null) | null = null;\n\n private __deletionConfimationCallback: (() => void) | null = null;\n\n private __cachedCardRenderer: {\n item: InternalAsyncListControl['item'];\n render: ItemRenderer;\n } | null = null;\n\n private __activeBulkAction: BulkAction | null = null;\n\n private __isFilterVisible = false;\n\n private __notification: { key: string; theme?: string } | null = null;\n\n private __isSelecting = false;\n\n private __selection: HALJSONResource[] = [];\n\n private __itemRenderer: ItemRenderer = ctx => {\n if (!ctx.data) return this.__cardRenderer(ctx);\n\n if (this.__isSelecting) {\n return html`\n <vaadin-checkbox\n class=\"block w-full\"\n style=\"padding-left: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n data-async-list-control\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n ?checked=${this.__selection.find(v => v._links.self.href === ctx.data!._links.self.href)}\n @change=${(evt: CustomEvent) => {\n if ((evt.currentTarget as CheckboxElement).checked) {\n this.__selection = [...this.__selection, ctx.data!];\n } else {\n this.__selection = this.__selection.filter(\n v => v._links.self.href !== ctx.data!._links.self.href\n );\n }\n }}\n >\n ${this.__cardRenderer(ctx)}\n </vaadin-checkbox>\n `;\n }\n\n const href = this.getPageHref?.(ctx.href, ctx.data);\n if (typeof href !== 'string' && !this.form) return this.__cardRenderer(ctx);\n\n const isDisabled = this.disabledSelector.matches('card', true);\n const card = this.__cardRenderer(ctx);\n let clickableItem: TemplateResult;\n\n const wrapperClass = classMap({\n 'rounded-t': !ctx.previous,\n 'rounded-b': !ctx.next,\n 'focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50': true,\n 'text-left w-full block transition-colors': true,\n 'hover-bg-contrast-5': !isDisabled,\n });\n\n if (this.getPageHref) {\n if (isDisabled) {\n clickableItem = html`<div class=${wrapperClass}>${card}</div>`;\n } else {\n const href = this.getPageHref(ctx.href, ctx.data);\n clickableItem = html`<a class=${wrapperClass} href=${href}>${card}</a>`;\n }\n } else {\n const handleClick = (evt: Event) => {\n const clickEvent = new CustomEvent<string>('itemclick', {\n cancelable: true,\n composed: true,\n bubbles: true,\n detail: ctx.href,\n });\n\n if (this.dispatchEvent(clickEvent)) {\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.__dialog;\n\n dialog.header = 'header_update';\n dialog.href = ctx.href;\n dialog.show(button);\n }\n };\n\n clickableItem = html`\n <button ?disabled=${isDisabled} class=${wrapperClass} @click=${handleClick}>${card}</button>\n `;\n }\n\n if ((this.hideDeleteButton && !this.actions.length) || this.readonly) return clickableItem;\n\n return html`\n <foxy-swipe-actions class=\"block\">\n ${clickableItem}\n ${this.actions.map(action => {\n return html`\n <vaadin-button\n data-testclass=\"action\"\n theme=${action.theme}\n class=\"h-full rounded-none relative\"\n slot=\"action\"\n ?disabled=${this.disabled}\n @click=${() => action.onClick(ctx.data!)}\n >\n <foxy-i18n\n class=${classMap({\n 'transition-opacity': true,\n 'opacity-0': action.state !== 'idle',\n })}\n infer=\"\"\n key=${action.text}\n >\n </foxy-i18n>\n <div\n class=${classMap({\n 'absolute inset-0 flex items-center justify-center transition-opacity': true,\n 'opacity-0': action.state === 'idle',\n })}\n >\n <foxy-spinner layout=\"no-label\" infer=\"spinner\" state=${action.state}>\n </foxy-spinner>\n </div>\n </vaadin-button>\n `;\n })}\n ${this.hideDeleteButton\n ? ''\n : html`\n <vaadin-button\n theme=\"primary error\"\n class=\"h-full rounded-none\"\n slot=\"action\"\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as HTMLElement;\n const confirm = this.renderRoot.querySelector(\n '#confirm'\n ) as InternalConfirmDialog;\n\n confirm.show(button);\n\n this.__deletionConfimationCallback = () => {\n const cardButton = button.parentElement!.firstElementChild!;\n const card = cardButton.querySelector<NucleonElement<any>>('[href]');\n\n card?.delete();\n this.__deletionConfimationCallback = null;\n };\n }}\n >\n <foxy-i18n infer=\"\" key=\"delete_button_text\"></foxy-i18n>\n </vaadin-button>\n `}\n </foxy-swipe-actions>\n `;\n };\n\n private __filter = '';\n\n renderControl(): TemplateResult {\n let first: string | undefined;\n\n try {\n const url = new URL(this.first ?? '');\n const filter = new URLSearchParams(this.__filter);\n\n url.searchParams.set('limit', String(this.limit));\n filter.forEach((value, key) => url.searchParams.set(key, value));\n first = url.toString();\n } catch {\n first = undefined;\n }\n\n return html`\n ${this.form && !this.__isSelecting\n ? html`\n <foxy-form-dialog\n parent=${ifDefined(this.first ?? void 0)}\n infer=\"dialog\"\n id=\"form\"\n ?wide=${this.wide}\n ?alert=${this.alert}\n ?keep-open-on-post=${this.keepDialogOpenOnPost}\n ?keep-open-on-delete=${this.keepDialogOpenOnDelete}\n .related=${this.related}\n .props=${this.formProps}\n .form=${this.form as any}\n >\n </foxy-form-dialog>\n `\n : ''}\n ${this.hideDeleteButton || this.readonly || this.__isSelecting\n ? ''\n : html`\n <foxy-internal-confirm-dialog\n message=\"delete_message\"\n confirm=\"delete_confirm\"\n cancel=\"delete_cancel\"\n header=\"delete_header\"\n theme=\"error\"\n infer=\"\"\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.__deletionConfimationCallback?.();\n }}\n >\n </foxy-internal-confirm-dialog>\n `}\n <div class=\"flex gap-m items-center justify-between text-l font-medium\">\n <span class=\"text-body mr-auto\">\n ${this.label && this.label !== 'label' ? this.label : ''}\n </span>\n\n ${this.filters.length > 0 && !this.__isSelecting\n ? html`\n <foxy-internal-async-list-control-filter-overlay\n .noVerticalOverlap=${true}\n .positionTarget=${this.renderRoot.querySelector('#filters')}\n .model=${{\n options: this.filters,\n value: this.__filter,\n lang: this.lang,\n ns: this.ns,\n }}\n ?opened=${this.__isFilterVisible}\n @vaadin-overlay-close=${() => (this.__isFilterVisible = false)}\n @search=${(evt: CustomEvent<string | undefined>) => {\n this.__filter = evt.detail ?? '';\n }}\n >\n </foxy-internal-async-list-control-filter-overlay>\n\n <vaadin-button\n theme=\"tertiary-inline contrast\"\n id=\"filters\"\n ?disabled=${this.disabled}\n @click=${() => (this.__isFilterVisible = !this.__isFilterVisible)}\n >\n <foxy-i18n infer=\"pagination\" key=\"search_button_text\"></foxy-i18n>\n </vaadin-button>\n `\n : ''}\n ${this.bulkActions.length > 0 && this.first\n ? html`\n ${this.__selection.length > 0\n ? this.bulkActions.map(action => {\n const nPrefix = `${action.name}_bulk_action_notification`;\n const cPrefix = `${action.name}_bulk_action_caption`;\n const isActive = this.__activeBulkAction?.name === action.name;\n\n return html`\n <vaadin-button\n data-testclass=\"bulk-action\"\n theme=\"tertiary-inline\"\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n @click=${async () => {\n this.__activeBulkAction = action;\n\n try {\n await action.onClick(this.__selection);\n this.__selection = [];\n this.__isSelecting = false;\n this.__notification = { key: `${nPrefix}_done`, theme: 'success' };\n } catch {\n this.__notification = { key: `${nPrefix}_fail`, theme: 'error' };\n } finally {\n this.__activeBulkAction = null;\n this.renderRoot.querySelector('vaadin-notification')?.open();\n }\n }}\n >\n <foxy-i18n\n infer=\"pagination\"\n key=\"${cPrefix}_${isActive ? 'busy' : 'idle'}\"\n .options=${{ count: this.__selection.length }}\n >\n </foxy-i18n>\n </vaadin-button>\n `;\n })\n : ''}\n <vaadin-button\n theme=\"tertiary-inline contrast\"\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n @click=${() => {\n this.__isSelecting = !this.__isSelecting;\n this.__selection = [];\n }}\n >\n <foxy-i18n\n infer=\"pagination\"\n key=${this.__isSelecting ? 'cancel_button_text' : 'select_button_text'}\n >\n </foxy-i18n>\n </vaadin-button>\n `\n : ''}\n ${(!this.form && !this.createPageHref) ||\n this.readonly ||\n this.hideCreateButton ||\n this.__isSelecting\n ? ''\n : this.createPageHref && !this.disabled\n ? html`\n <a\n class=\"rounded-s text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.createPageHref}\n >\n <foxy-i18n\n class=\"transition-opacity group-hover-opacity-80\"\n infer=\"\"\n key=\"create_button_text\"\n >\n </foxy-i18n>\n </a>\n `\n : html`\n <vaadin-button\n theme=\"tertiary-inline\"\n ?disabled=${this.disabled}\n @click=${(evt: Event) => {\n evt.preventDefault();\n evt.stopPropagation();\n\n const dialog = this.__dialog;\n const button = evt.currentTarget as HTMLButtonElement;\n\n dialog.header = 'header_create';\n dialog.href = '';\n dialog.show(button);\n }}\n >\n <foxy-i18n infer=\"pagination\" key=\"create_button_text\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n\n <div\n class=\"text-secondary text-s\"\n ?hidden=${!this.helperText || this.helperText === 'helper_text'}\n >\n ${this.helperText}\n </div>\n\n <foxy-pagination first=${ifDefined(first)} infer=\"pagination\">\n <foxy-collection-page\n class=${classMap({\n 'block divide-y divide-contrast-5 bg-contrast-5 rounded overflow-hidden': true,\n 'mt-s':\n (!!this.label && this.label !== 'label') ||\n (!!this.helperText && this.helperText !== 'helper_text'),\n })}\n infer=\"card\"\n .related=${this.related}\n .props=${this.itemProps}\n .item=${this.__itemRenderer}\n >\n </foxy-collection-page>\n </foxy-pagination>\n\n <div\n class=\"mt-s text-s leading-xs text-error\"\n ?hidden=${!this._errorMessage || this.disabled || this.readonly || this.__isSelecting}\n >\n ${this._errorMessage}\n </div>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=${ifDefined(this.__notification?.theme)}\n .renderer=${(root: HTMLElement) => {\n if (!root.firstElementChild) root.innerHTML = '<span></span>';\n\n const theme = this.__notification?.theme;\n const layout = html`\n <foxy-i18n\n style=\"color: var(--lumo-${theme ? `${theme}-contrast` : 'body-text'}-color)\"\n lang=${this.lang}\n key=${this.__notification?.key}\n ns=\"${this.ns} pagination\"\n >\n </foxy-i18n>\n `;\n\n render(layout, root.firstElementChild!);\n }}\n >\n </vaadin-notification>\n `;\n }\n\n private get __dialog() {\n return this.renderRoot.querySelector('#form') as FormDialog;\n }\n\n private get __cardRenderer() {\n const item = this.item;\n\n if (this.__cachedCardRenderer?.item !== item) {\n this.__cachedCardRenderer = {\n item: item,\n render:\n typeof item === 'string'\n ? (new Function(\n 'ctx',\n `return ctx.html\\`\n <${item}\n related=\\${JSON.stringify(ctx.related)}\n parent=\\${ctx.parent}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n infer=\"\"\n href=\\${ctx.href}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item}>\\``\n ) as ItemRenderer)\n : ctx => html`\n <div style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\">\n ${item?.(ctx)}\n </div>\n `,\n };\n }\n\n return this.__cachedCardRenderer.render;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalAsyncListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncListControl/InternalAsyncListControl.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IAArE;;QAmCE,oGAAoG;QACpG,2BAAsB,GAAG,KAAK,CAAC;QAE/B,kGAAkG;QAClG,yBAAoB,GAAG,KAAK,CAAC;QAE7B,iEAAiE;QACjE,mBAAc,GAAkB,IAAI,CAAC;QAErC,oEAAoE;QACpE,gBAAW,GAAG,EAAkB,CAAC;QAEjC,0DAA0D;QAC1D,YAAO,GAAG,EAAc,CAAC;QAEzB,mEAAmE;QACnE,WAAM,GAAqB,IAAI,CAAC;QAEhC,qBAAqB;QACrB,YAAO,GAAG,EAAmB,CAAC;QAE9B,oDAAoD;QACpD,YAAO,GAAG,EAAc,CAAC;QAEzB,yDAAyD;QACzD,UAAK,GAAG,EAAE,CAAC;QAEX,+DAA+D;QAC/D,UAAK,GAAkB,IAAI,CAAC;QAE5B,6FAA6F;QAC7F,SAAI,GAAuB,IAAI,CAAC;QAEhC,kEAAkE;QAClE,cAAS,GAA4B,EAAE,CAAC;QAExC,uDAAuD;QACvD,SAAI,GAAgC,IAAI,CAAC;QAEzC,qEAAqE;QACrE,cAAS,GAA4B,EAAE,CAAC;QAExC,mDAAmD;QACnD,SAAI,GAAG,KAAK,CAAC;QAEb,0EAA0E;QAC1E,kBAAa,GAAG,KAAK,CAAC;QAEtB,+DAA+D;QAC/D,SAAI,GAAG,KAAK,CAAC;QAEb,oDAAoD;QACpD,UA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;gBAEC,SAAS,CAAC,KAAK,CAAC;;gBAEhB,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;;;kBAGxD,QAAQ,CAAC;YACf,kCAAkC,EAAE,IAAI;YACxC,SAAS,EAAE,CAAC,SAAS;YACrB,MAAM,EACJ,CAAC,SAAS;gBACV,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,UAAU,KAAK,aAAa,CAAC,CAAC;SACrF,CAAC;;;qBAGS,IAAI,CAAC,OAAO;mBACd,IAAI,CAAC,SAAS;kBACf,IAAI,CAAC,cAAc;oBACjB,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,aAAoC,CAAC;YACtD,IAAI,CAAC,YAAY,GAAG,QAAQ,aAAC,IAAI,CAAC,IAAI,0CAAE,WAAW,mCAAI,CAAC,CAAC,CAAC;QAC5D,CAAC;;;;KAIN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { CollectionPage, NucleonElement } from '../../public/index';\nimport type { BulkAction, SwipeAction } from './types';\nimport type { InternalSummaryControl } from '../InternalSummaryControl/InternalSummaryControl';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { HALJSONResource } from '../../public/NucleonElement/types';\nimport type { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\nimport type { UpdateEvent } from '../../public/NucleonElement/UpdateEvent';\nimport type { FormDialog } from '../../index';\nimport type { Option } from '../../public/QueryBuilder/types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { render } from 'lit-html';\nimport { html } from 'lit-element';\n\nexport class InternalAsyncListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n keepDialogOpenOnDelete: { type: Boolean, attribute: 'keep-dialog-open-on-delete' },\n keepDialogOpenOnPost: { type: Boolean, attribute: 'keep-dialog-open-on-post' },\n hideDeleteButton: { type: Boolean, attribute: 'hide-delete-button' },\n hideCreateButton: { type: Boolean, attribute: 'hide-create-button' },\n createPageHref: { attribute: 'create-page-href' },\n getPageHref: { attribute: false },\n related: { type: Array },\n layout: {},\n first: {},\n limit: { type: Number },\n form: {},\n formProps: { type: Object, attribute: 'form-props' },\n item: {},\n itemProps: { type: Object, attribute: 'item-props' },\n wide: { type: Boolean },\n open: { type: Boolean },\n hideWhenEmpty: { type: Boolean, attribute: 'hide-when-empty' },\n alert: { type: Boolean },\n actions: { attribute: false },\n bulkActions: { attribute: false },\n filters: { type: Array },\n __filter: { attribute: false },\n __selection: { attribute: false },\n __totalItems: { attribute: false },\n __isSelecting: { attribute: false },\n __notification: { attribute: false },\n __isFilterVisible: { attribute: false },\n __activeBulkAction: { attribute: false },\n };\n }\n\n /** If true, FormDialog won't automatically close after the associated form deletes the resource. */\n keepDialogOpenOnDelete = false;\n\n /** If true, FormDialog won't automatically close after the associated form creates a resource. */\n keepDialogOpenOnPost = false;\n\n /** If provided, renders Create button as a link to this page. */\n createPageHref: string | null = null;\n\n /** Bulk actions that appear when one or more items are selected. */\n bulkActions = [] as BulkAction[];\n\n /** Same as the `related` property of `NucleonElement`. */\n related = [] as string[];\n\n /** When set to `details`, makes the entire control collapsible. */\n layout: 'details' | null = null;\n\n /** Swipe actions. */\n actions = [] as SwipeAction[];\n\n /** Query parameters to apply to the `first` URL. */\n filters = [] as Option[];\n\n /** Limit query parameter to apply to the `first` URL. */\n limit = 20;\n\n /** URI of the first page of the hAPI collection to display. */\n first: string | null = null;\n\n /** Same as the `form` property of `FormDialog`. If set, will open a dialog on item click. */\n form: FormDialog['form'] = null;\n\n /** Props to pass through to the form rendered by `FormDialog`. */\n formProps: Record<string, unknown> = {};\n\n /** Same as the `item` property of `CollectionPage`. */\n item: CollectionPage<any>['item'] = null;\n\n /** Props to pass through to the `CollectionPage` rendering items. */\n itemProps: Record<string, unknown> = {};\n\n /** Same as the `wide` property of `FormDialog`. */\n wide = false;\n\n /** Visually hides the control when the collection is empty or loading. */\n hideWhenEmpty = false;\n\n /** Same as the `open` property of `InternalSummaryControl`. */\n open = false;\n\n /** Same as the `alert` property of `FormDialog`. */\n alert = false;\n\n /** Hides Delete Swipe Action if true. */\n hideDeleteButton = false;\n\n /** Hides Create button if true. */\n hideCreateButton = false;\n\n /** If set, renders list items as <a> tags. */\n getPageHref: ((itemHref: string, item: unknown) => string | null) | null = null;\n\n private __deletionConfimationCallback: (() => void) | null = null;\n\n private __cachedCardRenderer: {\n item: InternalAsyncListControl['item'];\n render: ItemRenderer;\n } | null = null;\n\n private __activeBulkAction: BulkAction | null = null;\n\n private __isFilterVisible = false;\n\n private __notification: { key: string; theme?: string } | null = null;\n\n private __isSelecting = false;\n\n private __totalItems = 0;\n\n private __selection: HALJSONResource[] = [];\n\n private __itemRenderer: ItemRenderer = ctx => {\n const item = this.__cardRenderer(ctx);\n const readonlyItem = html`<div class=\"bg-contrast-5\">${item}</div>`;\n\n if (!ctx.data) return readonlyItem;\n\n if (this.__isSelecting) {\n return html`\n <vaadin-checkbox\n class=${classMap({ 'block w-full': true, 'bg-contrast-5': this.layout === 'details' })}\n style=\"padding-left: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n data-async-list-control\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n ?checked=${this.__selection.find(v => v._links.self.href === ctx.data!._links.self.href)}\n @change=${(evt: CustomEvent) => {\n if ((evt.currentTarget as CheckboxElement).checked) {\n this.__selection = [...this.__selection, ctx.data!];\n } else {\n this.__selection = this.__selection.filter(\n v => v._links.self.href !== ctx.data!._links.self.href\n );\n }\n }}\n >\n ${this.__cardRenderer(ctx)}\n </vaadin-checkbox>\n `;\n }\n\n const href = this.getPageHref?.(ctx.href, ctx.data);\n if (typeof href !== 'string' && !this.form) return readonlyItem;\n\n const isDisabled = this.disabledSelector.matches('card', true);\n const card = this.__cardRenderer(ctx);\n let clickableItem: TemplateResult;\n\n const wrapperClass = classMap({\n 'rounded-t': this.layout !== 'details' && !ctx.previous,\n 'rounded-b': !ctx.next,\n 'focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50': true,\n 'text-left w-full block bg-contrast-5 transition-colors': true,\n 'hover-bg-contrast-10': !isDisabled,\n });\n\n if (this.getPageHref) {\n if (isDisabled) {\n clickableItem = html`<div class=${wrapperClass}>${card}</div>`;\n } else {\n const href = this.getPageHref(ctx.href, ctx.data);\n clickableItem = html`<a class=${wrapperClass} href=${href}>${card}</a>`;\n }\n } else {\n const handleClick = (evt: Event) => {\n const clickEvent = new CustomEvent<string>('itemclick', {\n cancelable: true,\n composed: true,\n bubbles: true,\n detail: ctx.href,\n });\n\n if (this.dispatchEvent(clickEvent)) {\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.__dialog;\n\n dialog.header = 'header_update';\n dialog.href = ctx.href;\n dialog.show(button);\n }\n };\n\n clickableItem = html`\n <button ?disabled=${isDisabled} class=${wrapperClass} @click=${handleClick}>${card}</button>\n `;\n }\n\n if ((this.hideDeleteButton && !this.actions.length) || this.readonly) return clickableItem;\n\n return html`\n <foxy-swipe-actions class=\"block\">\n ${clickableItem}\n ${this.actions.map(action => {\n return html`\n <vaadin-button\n data-testclass=\"action\"\n theme=${action.theme}\n class=\"h-full rounded-none relative\"\n slot=\"action\"\n ?disabled=${this.disabled}\n @click=${() => action.onClick(ctx.data!)}\n >\n <foxy-i18n\n class=${classMap({\n 'transition-opacity': true,\n 'opacity-0': action.state !== 'idle',\n })}\n infer=\"\"\n key=${action.text}\n >\n </foxy-i18n>\n <div\n class=${classMap({\n 'absolute inset-0 flex items-center justify-center transition-opacity': true,\n 'opacity-0': action.state === 'idle',\n })}\n >\n <foxy-spinner layout=\"no-label\" infer=\"spinner\" state=${action.state}>\n </foxy-spinner>\n </div>\n </vaadin-button>\n `;\n })}\n ${this.hideDeleteButton\n ? ''\n : html`\n <vaadin-button\n theme=\"primary error\"\n class=\"h-full rounded-none\"\n slot=\"action\"\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as HTMLElement;\n const confirm = this.renderRoot.querySelector(\n '#confirm'\n ) as InternalConfirmDialog;\n\n confirm.show(button);\n\n this.__deletionConfimationCallback = () => {\n const cardButton = button.parentElement!.firstElementChild!;\n const card = cardButton.querySelector<NucleonElement<any>>('[href]');\n\n card?.delete();\n this.__deletionConfimationCallback = null;\n };\n }}\n >\n <foxy-i18n infer=\"\" key=\"delete_button_text\"></foxy-i18n>\n </vaadin-button>\n `}\n </foxy-swipe-actions>\n `;\n };\n\n private __filter = '';\n\n render(): TemplateResult {\n const hidden = this.hideWhenEmpty && !this.__totalItems;\n return html`<div class=${classMap({ hidden })}>${super.render()}</div>`;\n }\n\n renderControl(): TemplateResult {\n const actions = this.__renderActions();\n const content = this.__renderContent();\n\n return html`\n ${this.form && !this.__isSelecting\n ? html`\n <foxy-form-dialog\n parent=${ifDefined(this.first ?? void 0)}\n infer=\"dialog\"\n id=\"form\"\n ?wide=${this.wide}\n ?alert=${this.alert}\n ?keep-open-on-post=${this.keepDialogOpenOnPost}\n ?keep-open-on-delete=${this.keepDialogOpenOnDelete}\n .related=${this.related}\n .props=${this.formProps}\n .form=${this.form as any}\n >\n </foxy-form-dialog>\n `\n : ''}\n ${this.hideDeleteButton || this.readonly || this.__isSelecting\n ? ''\n : html`\n <foxy-internal-confirm-dialog\n message=\"delete_message\"\n confirm=\"delete_confirm\"\n cancel=\"delete_cancel\"\n header=\"delete_header\"\n theme=\"error\"\n infer=\"\"\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.__deletionConfimationCallback?.();\n }}\n >\n </foxy-internal-confirm-dialog>\n `}\n ${this.layout === 'details'\n ? html`\n <foxy-internal-summary-control\n layout=\"details\"\n count=${ifDefined(this.open ? void 0 : `${this.__totalItems}`)}\n infer=\"\"\n ?open=${this.open}\n @toggle=${(evt: CustomEvent) => {\n const summary = evt.currentTarget as InternalSummaryControl;\n this.open = summary.open;\n if (!evt.composed && !evt.bubbles) this.dispatchEvent(new CustomEvent('toggle'));\n }}\n >\n ${actions.length\n ? html`\n <div class=\"flex gap-s\">\n <foxy-i18n\n infer=\"\"\n class=\"mr-auto text-tertiary\"\n key=\"total_items\"\n .options=${{ count: this.__totalItems }}\n >\n </foxy-i18n>\n ${actions}\n </div>\n `\n : ''}\n <div class=\"p-0 bg-transparent\">${content}</div>\n </foxy-internal-summary-control>\n `\n : html`\n <div class=\"flex gap-s items-center justify-between font-medium\">\n <span class=\"text-body mr-auto text-l\">\n ${this.label && this.label !== 'label' ? this.label : ''}\n </span>\n ${actions}\n </div>\n\n <div\n class=\"text-secondary text-s\"\n ?hidden=${!this.helperText || this.helperText === 'helper_text'}\n >\n ${this.helperText}\n </div>\n\n ${content}\n `}\n\n <div\n class=\"mt-s text-s leading-xs text-error\"\n ?hidden=${!this._errorMessage || this.disabled || this.readonly || this.__isSelecting}\n >\n ${this._errorMessage}\n </div>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=${ifDefined(this.__notification?.theme)}\n .renderer=${(root: HTMLElement) => {\n if (!root.firstElementChild) root.innerHTML = '<span></span>';\n\n const theme = this.__notification?.theme;\n const layout = html`\n <foxy-i18n\n style=\"color: var(--lumo-${theme ? `${theme}-contrast` : 'body-text'}-color)\"\n lang=${this.lang}\n key=${this.__notification?.key}\n ns=\"${this.ns} pagination\"\n >\n </foxy-i18n>\n `;\n\n render(layout, root.firstElementChild!);\n }}\n >\n </vaadin-notification>\n `;\n }\n\n private get __cardRenderer() {\n const item = this.item;\n\n if (this.__cachedCardRenderer?.item !== item) {\n this.__cachedCardRenderer = {\n item: item,\n render:\n typeof item === 'string'\n ? (new Function(\n 'ctx',\n `return ctx.html\\`\n <${item}\n related=\\${JSON.stringify(ctx.related)}\n parent=\\${ctx.parent}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n infer=\"\"\n href=\\${ctx.href}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item}>\\``\n ) as ItemRenderer)\n : ctx => html`\n <div style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\">\n ${item?.(ctx)}\n </div>\n `,\n };\n }\n\n return this.__cachedCardRenderer.render;\n }\n\n private get __dialog() {\n return this.renderRoot.querySelector('#form') as FormDialog;\n }\n\n private __renderActions() {\n return [\n this.filters.length > 0 && !this.__isSelecting\n ? html`\n <foxy-internal-async-list-control-filter-overlay\n .noVerticalOverlap=${true}\n .positionTarget=${this.renderRoot.querySelector('#filters')}\n .model=${{\n options: this.filters,\n value: this.__filter,\n lang: this.lang,\n ns: this.ns,\n }}\n ?opened=${this.__isFilterVisible}\n @vaadin-overlay-close=${() => (this.__isFilterVisible = false)}\n @search=${(evt: CustomEvent<string | undefined>) => {\n this.__filter = evt.detail ?? '';\n }}\n >\n </foxy-internal-async-list-control-filter-overlay>\n\n <vaadin-button\n theme=\"tertiary-inline contrast\"\n id=\"filters\"\n ?disabled=${this.disabled}\n @click=${() => (this.__isFilterVisible = !this.__isFilterVisible)}\n >\n <foxy-i18n infer=\"pagination\" key=\"search_button_text\"></foxy-i18n>\n </vaadin-button>\n `\n : '',\n\n this.bulkActions.length > 0 && this.first\n ? html`\n ${this.__selection.length > 0\n ? this.bulkActions.map(action => {\n const nPrefix = `${action.name}_bulk_action_notification`;\n const cPrefix = `${action.name}_bulk_action_caption`;\n const isActive = this.__activeBulkAction?.name === action.name;\n\n return html`\n <vaadin-button\n data-testclass=\"bulk-action\"\n theme=\"tertiary-inline\"\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n @click=${async () => {\n this.__activeBulkAction = action;\n\n try {\n await action.onClick(this.__selection);\n this.__selection = [];\n this.__isSelecting = false;\n this.__notification = { key: `${nPrefix}_done`, theme: 'success' };\n } catch {\n this.__notification = { key: `${nPrefix}_fail`, theme: 'error' };\n } finally {\n this.__activeBulkAction = null;\n this.renderRoot.querySelector('vaadin-notification')?.open();\n }\n }}\n >\n <foxy-i18n\n infer=\"pagination\"\n key=\"${cPrefix}_${isActive ? 'busy' : 'idle'}\"\n .options=${{ count: this.__selection.length }}\n >\n </foxy-i18n>\n </vaadin-button>\n `;\n })\n : ''}\n <vaadin-button\n theme=\"tertiary-inline contrast\"\n ?disabled=${this.disabled || !!this.__activeBulkAction}\n @click=${() => {\n this.__isSelecting = !this.__isSelecting;\n this.__selection = [];\n }}\n >\n <foxy-i18n\n infer=\"pagination\"\n key=${this.__isSelecting ? 'cancel_button_text' : 'select_button_text'}\n >\n </foxy-i18n>\n </vaadin-button>\n `\n : '',\n\n (!this.form && !this.createPageHref) ||\n this.readonly ||\n this.hideCreateButton ||\n this.__isSelecting\n ? ''\n : this.createPageHref && !this.disabled\n ? html`\n <a\n class=\"rounded-s text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.createPageHref}\n >\n <foxy-i18n\n class=\"transition-opacity group-hover-opacity-80\"\n infer=\"\"\n key=\"create_button_text\"\n >\n </foxy-i18n>\n </a>\n `\n : html`\n <vaadin-button\n theme=\"tertiary-inline\"\n ?disabled=${this.disabled}\n @click=${(evt: Event) => {\n evt.preventDefault();\n evt.stopPropagation();\n\n const dialog = this.__dialog;\n const button = evt.currentTarget as HTMLButtonElement;\n\n dialog.header = 'header_create';\n dialog.href = '';\n dialog.show(button);\n }}\n >\n <foxy-i18n infer=\"pagination\" key=\"create_button_text\"></foxy-i18n>\n </vaadin-button>\n `,\n ].filter(v => !!v);\n }\n\n private __renderContent() {\n const helperText = this.helperText;\n const isDetails = this.layout === 'details';\n const label = this.label;\n\n let first: string | undefined;\n\n try {\n const url = new URL(this.first ?? '');\n const filter = new URLSearchParams(this.__filter);\n\n url.searchParams.set('limit', String(this.limit));\n filter.forEach((value, key) => url.searchParams.set(key, value));\n first = url.toString();\n } catch {\n first = undefined;\n }\n\n return html`\n <foxy-pagination\n first=${ifDefined(first)}\n infer=\"pagination\"\n class=${classMap({ hidden: isDetails && this.__totalItems === 0 })}\n >\n <foxy-collection-page\n class=${classMap({\n 'grid grid-cols-1 overflow-hidden': true,\n 'rounded': !isDetails,\n 'mt-s':\n !isDetails &&\n ((!!label && label !== 'label') || (!!helperText && helperText !== 'helper_text')),\n })}\n style=\"gap: 1px\"\n infer=\"card\"\n .related=${this.related}\n .props=${this.itemProps}\n .item=${this.__itemRenderer}\n @update=${(evt: UpdateEvent) => {\n const page = evt.currentTarget as CollectionPage<any>;\n this.__totalItems = parseInt(page.data?.total_items ?? 0);\n }}\n >\n </foxy-collection-page>\n </foxy-pagination>\n `;\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import '@vaadin/vaadin-notification';
|
|
|
2
2
|
import '@vaadin/vaadin-checkbox';
|
|
3
3
|
import '@vaadin/vaadin-overlay';
|
|
4
4
|
import '@vaadin/vaadin-button';
|
|
5
|
+
import '../../internal/InternalSummaryControl/index';
|
|
5
6
|
import '../../public/CollectionPage/index';
|
|
6
7
|
import '../../public/SwipeActions/index';
|
|
7
8
|
import '../../public/FormDialog/index';
|
|
@@ -2,6 +2,7 @@ import '@vaadin/vaadin-notification';
|
|
|
2
2
|
import '@vaadin/vaadin-checkbox';
|
|
3
3
|
import '@vaadin/vaadin-overlay';
|
|
4
4
|
import '@vaadin/vaadin-button';
|
|
5
|
+
import "../../internal/InternalSummaryControl/index.js";
|
|
5
6
|
import "../../public/CollectionPage/index.js";
|
|
6
7
|
import "../../public/SwipeActions/index.js";
|
|
7
8
|
import "../../public/FormDialog/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncListControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,wBAAwB,CAAC;AAChC,OAAO,uBAAuB,CAAC;AAE/B,8CAA2C;AAC3C,4CAAyC;AACzC,0CAAuC;AACvC,0CAAuC;AACvC,oCAAiC;AAEjC,6CAA0C;AAC1C,2CAAwC;AAExC,qBAAkB;AAElB,OAAO,EAAE,qCAAqC,IAAI,OAAO,EAAE,mDAAgD;AAC3G,OAAO,EAAE,wBAAwB,IAAI,OAAO,EAAE,sCAAmC;AAEjF,cAAc,CAAC,MAAM,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;AACnE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAE3C,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-notification';\nimport '@vaadin/vaadin-checkbox';\nimport '@vaadin/vaadin-overlay';\nimport '@vaadin/vaadin-button';\n\nimport '../../public/CollectionPage/index';\nimport '../../public/SwipeActions/index';\nimport '../../public/FormDialog/index';\nimport '../../public/Pagination/index';\nimport '../../public/I18n/index';\n\nimport '../InternalEditableControl/index';\nimport '../InternalConfirmDialog/index';\n\nimport './styles';\n\nimport { InternalAsyncListControlFilterOverlay as Overlay } from './InternalAsyncListControlFilterOverlay';\nimport { InternalAsyncListControl as Control } from './InternalAsyncListControl';\n\ncustomElements.define('foxy-internal-async-list-control', Control);\ncustomElements.define(Overlay.is, Overlay);\n\nexport { Control as InternalAsyncListControl };\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncListControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,wBAAwB,CAAC;AAChC,OAAO,uBAAuB,CAAC;AAE/B,wDAAqD;AAErD,8CAA2C;AAC3C,4CAAyC;AACzC,0CAAuC;AACvC,0CAAuC;AACvC,oCAAiC;AAEjC,6CAA0C;AAC1C,2CAAwC;AAExC,qBAAkB;AAElB,OAAO,EAAE,qCAAqC,IAAI,OAAO,EAAE,mDAAgD;AAC3G,OAAO,EAAE,wBAAwB,IAAI,OAAO,EAAE,sCAAmC;AAEjF,cAAc,CAAC,MAAM,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;AACnE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAE3C,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-notification';\nimport '@vaadin/vaadin-checkbox';\nimport '@vaadin/vaadin-overlay';\nimport '@vaadin/vaadin-button';\n\nimport '../../internal/InternalSummaryControl/index';\n\nimport '../../public/CollectionPage/index';\nimport '../../public/SwipeActions/index';\nimport '../../public/FormDialog/index';\nimport '../../public/Pagination/index';\nimport '../../public/I18n/index';\n\nimport '../InternalEditableControl/index';\nimport '../InternalConfirmDialog/index';\n\nimport './styles';\n\nimport { InternalAsyncListControlFilterOverlay as Overlay } from './InternalAsyncListControlFilterOverlay';\nimport { InternalAsyncListControl as Control } from './InternalAsyncListControl';\n\ncustomElements.define('foxy-internal-async-list-control', Control);\ncustomElements.define(Overlay.is, Overlay);\n\nexport { Control as InternalAsyncListControl };\n"]}
|
|
@@ -89,8 +89,9 @@ export class InternalEditableControl extends InternalControl {
|
|
|
89
89
|
return typeof this.__placeholder === 'string' ? this.__placeholder : this.t('placeholder');
|
|
90
90
|
}
|
|
91
91
|
set placeholder(newValue) {
|
|
92
|
-
|
|
92
|
+
const oldValue = this.__placeholder;
|
|
93
93
|
this.__placeholder = newValue;
|
|
94
|
+
this.requestUpdate('placeholder', oldValue);
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
97
|
* Translated helper text for this control. You can set your own helper text
|
|
@@ -101,8 +102,9 @@ export class InternalEditableControl extends InternalControl {
|
|
|
101
102
|
return typeof this.__helperText === 'string' ? this.__helperText : this.t('helper_text');
|
|
102
103
|
}
|
|
103
104
|
set helperText(newValue) {
|
|
104
|
-
|
|
105
|
+
const oldValue = this.__helperText;
|
|
105
106
|
this.__helperText = newValue;
|
|
107
|
+
this.requestUpdate('helperText', oldValue);
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* A prefix for all v8n errors related to this control. You can set your own v8n prefix
|
|
@@ -117,8 +119,9 @@ export class InternalEditableControl extends InternalControl {
|
|
|
117
119
|
return '';
|
|
118
120
|
}
|
|
119
121
|
set v8nPrefix(newValue) {
|
|
120
|
-
|
|
122
|
+
const oldValue = this.__v8nPrefix;
|
|
121
123
|
this.__v8nPrefix = newValue;
|
|
124
|
+
this.requestUpdate('v8nPrefix', oldValue);
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
127
|
* Name of the property to bind to inferred from the control name by converting it to snake_case.
|
|
@@ -133,8 +136,9 @@ export class InternalEditableControl extends InternalControl {
|
|
|
133
136
|
return '';
|
|
134
137
|
}
|
|
135
138
|
set property(newValue) {
|
|
136
|
-
|
|
139
|
+
const oldValue = this.__property;
|
|
137
140
|
this.__property = newValue;
|
|
141
|
+
this.requestUpdate('property', oldValue);
|
|
138
142
|
}
|
|
139
143
|
/**
|
|
140
144
|
* Translated label for this control. You can set your own label if the default key in the inferred
|
|
@@ -144,33 +148,39 @@ export class InternalEditableControl extends InternalControl {
|
|
|
144
148
|
return typeof this.__label === 'string' ? this.__label : this.t('label');
|
|
145
149
|
}
|
|
146
150
|
set label(newValue) {
|
|
147
|
-
|
|
151
|
+
const oldValue = this.__label;
|
|
148
152
|
this.__label = newValue;
|
|
153
|
+
this.requestUpdate('label', oldValue);
|
|
149
154
|
}
|
|
150
155
|
/** Restores the default placeholder translation. */
|
|
151
156
|
resetPlaceholder() {
|
|
152
|
-
|
|
157
|
+
const oldValue = this.__placeholder;
|
|
153
158
|
this.__placeholder = null;
|
|
159
|
+
this.requestUpdate('placeholder', oldValue);
|
|
154
160
|
}
|
|
155
161
|
/** Restores the default helper text translation. */
|
|
156
162
|
resetHelperText() {
|
|
157
|
-
|
|
163
|
+
const oldValue = this.__helperText;
|
|
158
164
|
this.__helperText = null;
|
|
165
|
+
this.requestUpdate('helperText', oldValue);
|
|
159
166
|
}
|
|
160
167
|
/** Restores the default v8n prefix for errors. */
|
|
161
168
|
resetV8nPrefix() {
|
|
162
|
-
|
|
169
|
+
const oldValue = this.__v8nPrefix;
|
|
163
170
|
this.__v8nPrefix = null;
|
|
171
|
+
this.requestUpdate('v8nPrefix', oldValue);
|
|
164
172
|
}
|
|
165
173
|
/** Restores the default property name. */
|
|
166
174
|
resetProperty() {
|
|
167
|
-
|
|
175
|
+
const oldValue = this.__property;
|
|
168
176
|
this.__property = null;
|
|
177
|
+
this.requestUpdate('property', oldValue);
|
|
169
178
|
}
|
|
170
179
|
/** Restores the default label translation. */
|
|
171
180
|
resetLabel() {
|
|
172
|
-
|
|
181
|
+
const oldValue = this.__label;
|
|
173
182
|
this.__label = null;
|
|
183
|
+
this.requestUpdate('label', oldValue);
|
|
174
184
|
}
|
|
175
185
|
reportValidity() {
|
|
176
186
|
const walker = this.ownerDocument.createTreeWalker(this.renderRoot, NodeFilter.SHOW_ELEMENT);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalEditableControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableControl/InternalEditableControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AAErE,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAA5D;;QAkBE,uBAAkB,GAAwD,IAAI,CAAC;QAE/E,iBAAY,GAAkB,IAAI,CAAC;QAEnC,aAAQ,GAAkB,IAAI,CAAC;QAE/B,aAAQ,GAAG,GAAY,E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AAS,CAAC;IACxF,CAAC;IAED,qFAAqF;IACrF,IAAc,cAAc;QAC1B,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\n\nimport debounce from 'lodash-es/debounce';\nimport { get, set } from 'lodash-es';\n\n/**\n * An internal base class for controls that have editing functionality, e.g. a text field.\n * Instances of this class will provide shortcuts for translatable placeholder, label, helper\n * text and more. Unlike a regular control, editable control can not only read from a NucleonElement\n * instance up the DOM tree, but also send changes to it and trigger validation process.\n *\n * @element foxy-internal-editable-control\n * @since 1.17.0\n */\nexport class InternalEditableControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n checkValidityAsync: { attribute: false },\n jsonTemplate: { attribute: 'json-template' },\n placeholder: { type: String, noAccessor: true },\n helperText: { type: String, attribute: 'helper-text', noAccessor: true },\n v8nPrefix: { type: String, attribute: 'v8n-prefix', noAccessor: true },\n jsonPath: { attribute: 'json-path' },\n getValue: { attribute: false },\n setValue: { attribute: false },\n property: { type: String, noAccessor: true },\n label: { type: String, noAccessor: true },\n __asyncError: { attribute: false },\n };\n }\n\n checkValidityAsync: ((value: unknown) => Promise<true | string>) | null = null;\n\n jsonTemplate: string | null = null;\n\n jsonPath: string | null = null;\n\n getValue = (): unknown => {\n const value = get(this.nucleon?.form, this.property);\n if (this.jsonPath) return get(JSON.parse(value ?? this.jsonTemplate), this.jsonPath);\n return value;\n };\n\n setValue = (newValue: unknown): void => {\n const [formProperty, ...nestedPath] = this.property.split('.');\n\n if (nestedPath.length) {\n const nestedForm = this.nucleon?.form[formProperty] ?? {};\n\n if (this.jsonPath) {\n const json = JSON.parse(this.nucleon?.form[formProperty] ?? this.jsonTemplate);\n set(json, this.jsonPath, newValue);\n set(nestedForm, nestedPath, JSON.stringify(json));\n } else {\n set(nestedForm, nestedPath, newValue);\n }\n\n this.nucleon?.edit({ [formProperty]: nestedForm });\n } else {\n if (this.jsonPath) {\n const json = JSON.parse(this.nucleon?.form[formProperty] ?? this.jsonTemplate);\n set(json, this.jsonPath, newValue);\n this.nucleon?.edit({ [formProperty]: JSON.stringify(json) });\n } else {\n this.nucleon?.edit({ [formProperty]: newValue });\n }\n }\n };\n\n private __debouncedCheckValidityAsync = debounce(async (newValue: unknown) => {\n const validOrError = await this.checkValidityAsync?.(newValue);\n if (this._value !== newValue) return;\n this.__asyncError = validOrError === true ? null : validOrError ?? null;\n }, 300);\n\n private __previousValue: unknown | null = null;\n\n private __placeholder: string | null = null;\n\n private __helperText: string | null = null;\n\n private __asyncError: string | null = null;\n\n private __v8nPrefix: string | null = null;\n\n private __property: string | null = null;\n\n private __label: string | null = null;\n\n /**\n * Translated placeholder text for this control. You can set your own placeholder text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetPlaceholder()`\n * to restore the default translation.\n */\n get placeholder(): string {\n return typeof this.__placeholder === 'string' ? this.__placeholder : this.t('placeholder');\n }\n\n set placeholder(newValue: string) {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = newValue;\n }\n\n /**\n * Translated helper text for this control. You can set your own helper text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetHelperText()`\n * to restore the default translation.\n */\n get helperText(): string {\n return typeof this.__helperText === 'string' ? this.__helperText : this.t('helper_text');\n }\n\n set helperText(newValue: string) {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = newValue;\n }\n\n /**\n * A prefix for all v8n errors related to this control. You can set your own v8n prefix\n * if the default one doesn't work for you. Use `.resetV8nPrefix()`\n * to restore the default v8n prefix.\n */\n get v8nPrefix(): string {\n if (typeof this.__v8nPrefix === 'string') return this.__v8nPrefix;\n if (typeof this.infer === 'string') return `${this.infer}:`;\n return '';\n }\n\n set v8nPrefix(newValue: string) {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = newValue;\n }\n\n /**\n * Name of the property to bind to inferred from the control name by converting it to snake_case.\n * You can set your own property name if the default inference method produces an incorrect result.\n * Use `.resetProperty()` to restore the default property name.\n */\n get property(): string {\n if (typeof this.__property === 'string') return this.__property;\n if (typeof this.infer === 'string') return this.infer.replace(/-/g, '_');\n return '';\n }\n\n set property(newValue: string) {\n this.requestUpdate('property', this.__property);\n this.__property = newValue;\n }\n\n /**\n * Translated label for this control. You can set your own label if the default key in the inferred\n * namespace doesn't work for you. Use `.resetLabel()` to restore the default translation.\n */\n get label(): string {\n return typeof this.__label === 'string' ? this.__label : this.t('label');\n }\n\n set label(newValue: string) {\n this.requestUpdate('label', this.__label);\n this.__label = newValue;\n }\n\n /** Restores the default placeholder translation. */\n resetPlaceholder(): void {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = null;\n }\n\n /** Restores the default helper text translation. */\n resetHelperText(): void {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = null;\n }\n\n /** Restores the default v8n prefix for errors. */\n resetV8nPrefix(): void {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = null;\n }\n\n /** Restores the default property name. */\n resetProperty(): void {\n this.requestUpdate('property', this.__property);\n this.__property = null;\n }\n\n /** Restores the default label translation. */\n resetLabel(): void {\n this.requestUpdate('label', this.__label);\n this.__label = null;\n }\n\n reportValidity(): void {\n const walker = this.ownerDocument.createTreeWalker(this.renderRoot, NodeFilter.SHOW_ELEMENT);\n\n do {\n type Input = Node & Record<string, () => unknown>;\n\n const node = walker.currentNode as Input;\n const methods = ['reportValidity', 'validate'];\n\n for (const method of methods) {\n if (method in node) {\n try {\n node[method]();\n break;\n } catch {\n continue;\n }\n }\n }\n } while (walker.nextNode());\n }\n\n /**\n * A shortcut to get the inferred value from the NucleonElement instance\n * up the DOM tree. If no such value or instance exists, returns `undefined`.\n * Assigning a value to this property will dispatch a cancelable `change` event\n * with the new value in the detail and write changes to the NucleonElement instance if permitted.\n */\n protected get _value(): unknown | undefined {\n return this.getValue();\n }\n\n protected set _value(newValue: unknown | undefined) {\n this.__previousValue = this._value;\n this.__asyncError = null;\n if (!this._error && this.__previousValue !== newValue) {\n this.__debouncedCheckValidityAsync(newValue);\n }\n\n const event = new CustomEvent('change', { cancelable: true, detail: newValue });\n const useDefaultAction = this.dispatchEvent(event);\n if (useDefaultAction) this.setValue(newValue);\n }\n\n /** A shortcut returning the first v8n error associated with this control. */\n protected get _error(): string | undefined {\n const syncError = this.nucleon?.errors.find(v => v.startsWith(this.v8nPrefix));\n return syncError ?? this.__asyncError ?? void 0;\n }\n\n /** A shortcut returning the localized text of the first v8n error associated with this control. */\n protected get _errorMessage(): string | undefined {\n return this._error ? this.t(this._error.substring(this.v8nPrefix.length)) : undefined;\n }\n\n /** A helper returning a `.checkValidity()` function for use with Vaadin elements. */\n protected get _checkValidity(): () => boolean {\n return () => !this._error;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalEditableControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableControl/InternalEditableControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AAErE,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAA5D;;QAkBE,uBAAkB,GAAwD,IAAI,CAAC;QAE/E,iBAAY,GAAkB,IAAI,CAAC;QAEnC,aAAQ,GAAkB,IAAI,CAAC;QAE/B,aAAQ,GAAG,GAAY,EAAE;;YACvB,MAAM,KAAK,GAAG,GAAG,OAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrD,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,YAAY,CAAC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M,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,CAAC;IAED,qFAAqF;IACrF,IAAc,cAAc;QAC1B,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\n\nimport debounce from 'lodash-es/debounce';\nimport { get, set } from 'lodash-es';\n\n/**\n * An internal base class for controls that have editing functionality, e.g. a text field.\n * Instances of this class will provide shortcuts for translatable placeholder, label, helper\n * text and more. Unlike a regular control, editable control can not only read from a NucleonElement\n * instance up the DOM tree, but also send changes to it and trigger validation process.\n *\n * @element foxy-internal-editable-control\n * @since 1.17.0\n */\nexport class InternalEditableControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n checkValidityAsync: { attribute: false },\n jsonTemplate: { attribute: 'json-template' },\n placeholder: { type: String, noAccessor: true },\n helperText: { type: String, attribute: 'helper-text', noAccessor: true },\n v8nPrefix: { type: String, attribute: 'v8n-prefix', noAccessor: true },\n jsonPath: { attribute: 'json-path' },\n getValue: { attribute: false },\n setValue: { attribute: false },\n property: { type: String, noAccessor: true },\n label: { type: String, noAccessor: true },\n __asyncError: { attribute: false },\n };\n }\n\n checkValidityAsync: ((value: unknown) => Promise<true | string>) | null = null;\n\n jsonTemplate: string | null = null;\n\n jsonPath: string | null = null;\n\n getValue = (): unknown => {\n const value = get(this.nucleon?.form, this.property);\n if (this.jsonPath) return get(JSON.parse(value ?? this.jsonTemplate), this.jsonPath);\n return value;\n };\n\n setValue = (newValue: unknown): void => {\n const [formProperty, ...nestedPath] = this.property.split('.');\n\n if (nestedPath.length) {\n const nestedForm = this.nucleon?.form[formProperty] ?? {};\n\n if (this.jsonPath) {\n const json = JSON.parse(this.nucleon?.form[formProperty] ?? this.jsonTemplate);\n set(json, this.jsonPath, newValue);\n set(nestedForm, nestedPath, JSON.stringify(json));\n } else {\n set(nestedForm, nestedPath, newValue);\n }\n\n this.nucleon?.edit({ [formProperty]: nestedForm });\n } else {\n if (this.jsonPath) {\n const json = JSON.parse(this.nucleon?.form[formProperty] ?? this.jsonTemplate);\n set(json, this.jsonPath, newValue);\n this.nucleon?.edit({ [formProperty]: JSON.stringify(json) });\n } else {\n this.nucleon?.edit({ [formProperty]: newValue });\n }\n }\n };\n\n private __debouncedCheckValidityAsync = debounce(async (newValue: unknown) => {\n const validOrError = await this.checkValidityAsync?.(newValue);\n if (this._value !== newValue) return;\n this.__asyncError = validOrError === true ? null : validOrError ?? null;\n }, 300);\n\n private __previousValue: unknown | null = null;\n\n private __placeholder: string | null = null;\n\n private __helperText: string | null = null;\n\n private __asyncError: string | null = null;\n\n private __v8nPrefix: string | null = null;\n\n private __property: string | null = null;\n\n private __label: string | null = null;\n\n /**\n * Translated placeholder text for this control. You can set your own placeholder text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetPlaceholder()`\n * to restore the default translation.\n */\n get placeholder(): string {\n return typeof this.__placeholder === 'string' ? this.__placeholder : this.t('placeholder');\n }\n\n set placeholder(newValue: string) {\n const oldValue = this.__placeholder;\n this.__placeholder = newValue;\n this.requestUpdate('placeholder', oldValue);\n }\n\n /**\n * Translated helper text for this control. You can set your own helper text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetHelperText()`\n * to restore the default translation.\n */\n get helperText(): string {\n return typeof this.__helperText === 'string' ? this.__helperText : this.t('helper_text');\n }\n\n set helperText(newValue: string) {\n const oldValue = this.__helperText;\n this.__helperText = newValue;\n this.requestUpdate('helperText', oldValue);\n }\n\n /**\n * A prefix for all v8n errors related to this control. You can set your own v8n prefix\n * if the default one doesn't work for you. Use `.resetV8nPrefix()`\n * to restore the default v8n prefix.\n */\n get v8nPrefix(): string {\n if (typeof this.__v8nPrefix === 'string') return this.__v8nPrefix;\n if (typeof this.infer === 'string') return `${this.infer}:`;\n return '';\n }\n\n set v8nPrefix(newValue: string) {\n const oldValue = this.__v8nPrefix;\n this.__v8nPrefix = newValue;\n this.requestUpdate('v8nPrefix', oldValue);\n }\n\n /**\n * Name of the property to bind to inferred from the control name by converting it to snake_case.\n * You can set your own property name if the default inference method produces an incorrect result.\n * Use `.resetProperty()` to restore the default property name.\n */\n get property(): string {\n if (typeof this.__property === 'string') return this.__property;\n if (typeof this.infer === 'string') return this.infer.replace(/-/g, '_');\n return '';\n }\n\n set property(newValue: string) {\n const oldValue = this.__property;\n this.__property = newValue;\n this.requestUpdate('property', oldValue);\n }\n\n /**\n * Translated label for this control. You can set your own label if the default key in the inferred\n * namespace doesn't work for you. Use `.resetLabel()` to restore the default translation.\n */\n get label(): string {\n return typeof this.__label === 'string' ? this.__label : this.t('label');\n }\n\n set label(newValue: string) {\n const oldValue = this.__label;\n this.__label = newValue;\n this.requestUpdate('label', oldValue);\n }\n\n /** Restores the default placeholder translation. */\n resetPlaceholder(): void {\n const oldValue = this.__placeholder;\n this.__placeholder = null;\n this.requestUpdate('placeholder', oldValue);\n }\n\n /** Restores the default helper text translation. */\n resetHelperText(): void {\n const oldValue = this.__helperText;\n this.__helperText = null;\n this.requestUpdate('helperText', oldValue);\n }\n\n /** Restores the default v8n prefix for errors. */\n resetV8nPrefix(): void {\n const oldValue = this.__v8nPrefix;\n this.__v8nPrefix = null;\n this.requestUpdate('v8nPrefix', oldValue);\n }\n\n /** Restores the default property name. */\n resetProperty(): void {\n const oldValue = this.__property;\n this.__property = null;\n this.requestUpdate('property', oldValue);\n }\n\n /** Restores the default label translation. */\n resetLabel(): void {\n const oldValue = this.__label;\n this.__label = null;\n this.requestUpdate('label', oldValue);\n }\n\n reportValidity(): void {\n const walker = this.ownerDocument.createTreeWalker(this.renderRoot, NodeFilter.SHOW_ELEMENT);\n\n do {\n type Input = Node & Record<string, () => unknown>;\n\n const node = walker.currentNode as Input;\n const methods = ['reportValidity', 'validate'];\n\n for (const method of methods) {\n if (method in node) {\n try {\n node[method]();\n break;\n } catch {\n continue;\n }\n }\n }\n } while (walker.nextNode());\n }\n\n /**\n * A shortcut to get the inferred value from the NucleonElement instance\n * up the DOM tree. If no such value or instance exists, returns `undefined`.\n * Assigning a value to this property will dispatch a cancelable `change` event\n * with the new value in the detail and write changes to the NucleonElement instance if permitted.\n */\n protected get _value(): unknown | undefined {\n return this.getValue();\n }\n\n protected set _value(newValue: unknown | undefined) {\n this.__previousValue = this._value;\n this.__asyncError = null;\n if (!this._error && this.__previousValue !== newValue) {\n this.__debouncedCheckValidityAsync(newValue);\n }\n\n const event = new CustomEvent('change', { cancelable: true, detail: newValue });\n const useDefaultAction = this.dispatchEvent(event);\n if (useDefaultAction) this.setValue(newValue);\n }\n\n /** A shortcut returning the first v8n error associated with this control. */\n protected get _error(): string | undefined {\n const syncError = this.nucleon?.errors.find(v => v.startsWith(this.v8nPrefix));\n return syncError ?? this.__asyncError ?? void 0;\n }\n\n /** A shortcut returning the localized text of the first v8n error associated with this control. */\n protected get _errorMessage(): string | undefined {\n return this._error ? this.t(this._error.substring(this.v8nPrefix.length)) : undefined;\n }\n\n /** A helper returning a `.checkValidity()` function for use with Vaadin elements. */\n protected get _checkValidity(): () => boolean {\n return () => !this._error;\n }\n}\n"]}
|
package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js
CHANGED
|
@@ -164,11 +164,11 @@ export class InternalResourcePickerControl extends InternalEditableControl {
|
|
|
164
164
|
<div class="block group">
|
|
165
165
|
<div
|
|
166
166
|
class=${classMap({
|
|
167
|
-
'flex items-center gap-
|
|
167
|
+
'flex items-center gap-s transition-colors font-medium': true,
|
|
168
168
|
'text-disabled': this.disabled,
|
|
169
169
|
})}
|
|
170
170
|
>
|
|
171
|
-
<span class="mr-auto">${this.label}</span>
|
|
171
|
+
<span class="mr-auto text-l">${this.label}</span>
|
|
172
172
|
${selectionUrl
|
|
173
173
|
? html `
|
|
174
174
|
<a
|
package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalResourcePickerControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,kDAA+C;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,MAAM,OAAO,6BAA8B,SAAQ,uBAAuB;IAA1E;;QAiBE,2BAAsB,GAA0B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3E,qBAAgB,GAAG,KAAK,CAAC;QAEzB,gBAAW,GAAG,QAAQ,CAAC,mCAAmC,CAAC,CAAC;QAE5D,eAAU,GAAsC,IAAI,CAAC;QAErD,cAAS,GAA4B,EAAE,CAAC;QAExC,YAAO,GAAa,EAAE,CAAC;QAEvB,WAAM,GAAyC,IAAI,CAAC;QAEpD,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;QAE3B,SAAI,GAAiC,IAAI,CAAC;QAEzB,sBAAiB,GAAG,OAAO,CAAC,CAAC,IAAmB,EAAE,EAAE;YACnE,OAAO,IAAI,QAAQ,CACjB,KAAK,EACL;WACK,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,W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AAK,UAAU,IAAI,CAAC,WAAW,SAAS,IAAI,MAAM,KAAK,MAAM,EAAE;YACpE,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;SAC9D;QAED,IAAI,GAAG,KAAK,UAAU,IAAI,CAAC,WAAW,QAAQ,IAAI,MAAM,KAAK,KAAK,EAAE;YAClE,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;SAChD;IACH,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAAgB;QAC3C,MAAM,IAAI,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAA0B,CAAC;QACrE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,WAAW,QAAQ,EAAE,EAAE;YAC9D,OAAO,EAAE,oBAAoB;SAC9B,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,WAAW,QAAQ,EAAE,EAAE;YAC9D,OAAO,EAAE,oBAAoB;SAC9B,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { HALJSONResource } from '../../public/NucleonElement/types';\nimport type { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport type { FormRenderer } from '../../public/FormDialog/types';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\nimport type { FormDialog } from '../../public/FormDialog/FormDialog';\nimport type { Option } from '../../public/QueryBuilder/types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { getResourceId } from '@foxy.io/sdk/core';\nimport { FetchEvent } from '../../public/NucleonElement/FetchEvent';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\nimport { uniqueId } from 'lodash-es';\nimport { spread } from '@open-wc/lit-helpers';\n\nimport memoize from 'lodash-es/memoize';\n\ntype DisplayValueOptionsCb = (resource: HALJSONResource) => Record<string, unknown>;\n\nexport class InternalResourcePickerControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getDisplayValueOptions: { attribute: false },\n showCopyIdButton: { type: Boolean, attribute: 'show-copy-id-button' },\n virtualHost: {},\n getItemUrl: { attribute: false },\n formProps: { type: Object },\n filters: { type: Array },\n layout: {},\n first: {},\n item: {},\n form: {},\n };\n }\n\n getDisplayValueOptions: DisplayValueOptionsCb = resource => ({ resource });\n\n showCopyIdButton = false;\n\n virtualHost = uniqueId('internal-resource-picker-control-');\n\n getItemUrl: ((href: string) => string) | null = null;\n\n formProps: Record<string, unknown> = {};\n\n filters: Option[] = [];\n\n layout: 'summary-item' | 'standalone' | null = null;\n\n first: string | null = null;\n\n item: string | null = null;\n\n form: string | null | FormRenderer = null;\n\n private readonly __getItemRenderer = memoize((item: string | null) => {\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=\"card\"\n href=$\\{ctx.href}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item ?? 'foxy-null'}>\\``\n ) as ItemRenderer;\n });\n\n renderControl(): TemplateResult {\n const dialogProps = {\n ...this.formProps,\n '.selectionProps': { '.filters': this.filters, '.first': this.first, '.item': this.item },\n };\n\n return html`\n <foxy-form-dialog\n parent=\"foxy://${this.virtualHost}/select\"\n header=\"header\"\n infer=\"dialog\"\n alert\n .props=${dialogProps}\n .form=${this.form ?? 'foxy-internal-resource-picker-control-form'}\n @fetch=${this.__handleFetchEvent}\n >\n </foxy-form-dialog>\n\n ${this.layout === 'summary-item'\n ? this.__renderSummaryItemLayout()\n : this.__renderStandaloneLayout()}\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 __clear(): void {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }\n\n private __renderSummaryItemLayout() {\n const resource = this.renderRoot.querySelector<NucleonElement<any>>('#value');\n const onClick = (evt: Event) => {\n if (this.disabled || this.readonly) return;\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.renderRoot.querySelector('foxy-form-dialog') as FormDialog;\n\n dialog.href = '';\n dialog.show(button);\n };\n\n return html`\n <div class=\"flex items-start leading-xs gap-m\">\n <div class=\"flex-1\">\n <div class=\"text-m text-body whitespace-nowrap\">${this.label}</div>\n <div class=\"text-s text-secondary\">${this.helperText}</div>\n <div class=\"text-s text-error\" ?hidden=${this.disabled || this.readonly}>\n ${this._errorMessage}\n </div>\n </div>\n\n <div class=\"flex items-center gap-xs\">\n <button\n aria-label=${this.t('select')}\n class=${classMap({\n 'text-right min-w-0 transition-colors transition-opacity': true,\n 'rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'cursor-pointer text-body hover-opacity-80': !this.disabled && !this.readonly,\n 'font-medium': !this.readonly,\n })}\n ?disabled=${this.disabled || this.readonly}\n @click=${onClick}\n >\n <div class=\"truncate min-w-0\">\n ${this._value\n ? html`\n <foxy-i18n\n infer=\"\"\n key=\"value\"\n .options=${resource?.data\n ? this.getDisplayValueOptions(resource.data)\n : { context: resource?.in('fail') ? 'fail' : 'busy' }}\n >\n </foxy-i18n>\n `\n : this.placeholder}\n </div>\n </button>\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${this.__clear}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n </div>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this._value || void 0)}\n id=\"value\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private __renderStandaloneLayout() {\n const selectionUrl = typeof this._value === 'string' ? this.getItemUrl?.(this._value) : void 0;\n const selectionId = typeof this._value === 'string' ? getResourceId(this._value) : void 0;\n\n return html`\n <div class=\"block group\">\n <div\n class=${classMap({\n 'flex items-center gap-m transition-colors font-medium text-l': true,\n 'text-disabled': this.disabled,\n })}\n >\n <span class=\"mr-auto\">${this.label}</span>\n ${selectionUrl\n ? html`\n <a\n class=\"text-body rounded transition-opacity hover-opacity-90 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${selectionUrl}\n >\n <foxy-i18n infer=\"\" key=\"view\"></foxy-i18n>\n </a>\n `\n : ''}\n ${this.showCopyIdButton && selectionId !== null\n ? html`\n <foxy-copy-to-clipboard\n layout=\"text\"\n theme=\"contrast tertiary-inline\"\n infer=\"copy-id\"\n text=${selectionId}\n >\n </foxy-copy-to-clipboard>\n `\n : ''}\n ${this.readonly || !this._value\n ? ''\n : html`\n <vaadin-button\n theme=\"error tertiary-inline\"\n ?disabled=${this.disabled}\n @click=${this.__clear}\n >\n <foxy-i18n infer=\"\" key=\"clear\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n\n <div class=\"text-secondary text-s\" ?hidden=${!this.helperText}>${this.helperText}</div>\n\n <button\n class=${classMap({\n 'block w-full bg-contrast-5 rounded text-left transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer hover-bg-contrast-10': !this.disabled && !this.readonly,\n 'cursor-default': this.disabled || this.readonly,\n 'mt-s': !!this.label || !!this.helperText,\n })}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n ?disabled=${this.disabled || this.readonly}\n @click=${(evt: MouseEvent) => {\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.renderRoot.querySelector('foxy-form-dialog') as FormDialog;\n\n dialog.href = '';\n dialog.show(button);\n }}\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-50': this.disabled })}>\n ${this.__getItemRenderer(this.item)({\n html,\n data: null,\n href: (this._value as string | undefined) || '',\n related: [],\n parent: '',\n props: {},\n spread: spread,\n simplifyNsLoading: this.simplifyNsLoading,\n disabled: this.disabled,\n disabledControls: this.disabledControls,\n readonly: this.readonly,\n readonlyControls: this.readonlyControls,\n hidden: this.hidden,\n hiddenControls: this.hiddenControls,\n templates: this.templates,\n previous: null,\n next: null,\n group: this.nucleon?.group ?? '',\n lang: this.lang,\n ns: this.ns,\n })}\n </div>\n </button>\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 private __handleFetchEvent(event: Event) {\n if (!(event instanceof FetchEvent)) return;\n if (event.defaultPrevented) return;\n\n const { url, method } = event.request;\n\n if (url === `foxy://${this.virtualHost}/select` && method === 'POST') {\n return event.respondWith(this.__handleSelect(event.request));\n }\n\n if (url === `foxy://${this.virtualHost}/empty` && method === 'GET') {\n return event.respondWith(this.__handleEmpty());\n }\n }\n\n private async __handleSelect(request: Request): Promise<Response> {\n const body = (await request.clone().json()) as { selection: string };\n this._value = body.selection;\n return new Response(\n JSON.stringify({\n _links: { self: { href: `foxy://${this.virtualHost}/empty` } },\n message: 'Resource selected.',\n })\n );\n }\n\n private async __handleEmpty(): Promise<Response> {\n return new Response(\n JSON.stringify({\n _links: { self: { href: `foxy://${this.virtualHost}/empty` } },\n message: 'Resource selected.',\n })\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalResourcePickerControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,kDAA+C;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,MAAM,OAAO,6BAA8B,SAAQ,uBAAuB;IAA1E;;QAiBE,2BAAsB,GAA0B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3E,qBAAgB,GAAG,KAAK,CAAC;QAEzB,gBAAW,GAAG,QAAQ,CAAC,mCAAmC,CAAC,CAAC;QAE5D,eAAU,GAAsC,IAAI,CAAC;QAErD,cAAS,GAA4B,EAAE,CAAC;QAExC,YAAO,GAAa,EAAE,CAAC;QAEvB,WAAM,GAAyC,IAAI,CAAC;QAEpD,U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import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { HALJSONResource } from '../../public/NucleonElement/types';\nimport type { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport type { FormRenderer } from '../../public/FormDialog/types';\nimport type { ItemRenderer } from '../../public/CollectionPage/types';\nimport type { FormDialog } from '../../public/FormDialog/FormDialog';\nimport type { Option } from '../../public/QueryBuilder/types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { getResourceId } from '@foxy.io/sdk/core';\nimport { FetchEvent } from '../../public/NucleonElement/FetchEvent';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\nimport { uniqueId } from 'lodash-es';\nimport { spread } from '@open-wc/lit-helpers';\n\nimport memoize from 'lodash-es/memoize';\n\ntype DisplayValueOptionsCb = (resource: HALJSONResource) => Record<string, unknown>;\n\nexport class InternalResourcePickerControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getDisplayValueOptions: { attribute: false },\n showCopyIdButton: { type: Boolean, attribute: 'show-copy-id-button' },\n virtualHost: {},\n getItemUrl: { attribute: false },\n formProps: { type: Object },\n filters: { type: Array },\n layout: {},\n first: {},\n item: {},\n form: {},\n };\n }\n\n getDisplayValueOptions: DisplayValueOptionsCb = resource => ({ resource });\n\n showCopyIdButton = false;\n\n virtualHost = uniqueId('internal-resource-picker-control-');\n\n getItemUrl: ((href: string) => string) | null = null;\n\n formProps: Record<string, unknown> = {};\n\n filters: Option[] = [];\n\n layout: 'summary-item' | 'standalone' | null = null;\n\n first: string | null = null;\n\n item: string | null = null;\n\n form: string | null | FormRenderer = null;\n\n private readonly __getItemRenderer = memoize((item: string | null) => {\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=\"card\"\n href=$\\{ctx.href}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${item ?? 'foxy-null'}>\\``\n ) as ItemRenderer;\n });\n\n renderControl(): TemplateResult {\n const dialogProps = {\n ...this.formProps,\n '.selectionProps': { '.filters': this.filters, '.first': this.first, '.item': this.item },\n };\n\n return html`\n <foxy-form-dialog\n parent=\"foxy://${this.virtualHost}/select\"\n header=\"header\"\n infer=\"dialog\"\n alert\n .props=${dialogProps}\n .form=${this.form ?? 'foxy-internal-resource-picker-control-form'}\n @fetch=${this.__handleFetchEvent}\n >\n </foxy-form-dialog>\n\n ${this.layout === 'summary-item'\n ? this.__renderSummaryItemLayout()\n : this.__renderStandaloneLayout()}\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 __clear(): void {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }\n\n private __renderSummaryItemLayout() {\n const resource = this.renderRoot.querySelector<NucleonElement<any>>('#value');\n const onClick = (evt: Event) => {\n if (this.disabled || this.readonly) return;\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.renderRoot.querySelector('foxy-form-dialog') as FormDialog;\n\n dialog.href = '';\n dialog.show(button);\n };\n\n return html`\n <div class=\"flex items-start leading-xs gap-m\">\n <div class=\"flex-1\">\n <div class=\"text-m text-body whitespace-nowrap\">${this.label}</div>\n <div class=\"text-s text-secondary\">${this.helperText}</div>\n <div class=\"text-s text-error\" ?hidden=${this.disabled || this.readonly}>\n ${this._errorMessage}\n </div>\n </div>\n\n <div class=\"flex items-center gap-xs\">\n <button\n aria-label=${this.t('select')}\n class=${classMap({\n 'text-right min-w-0 transition-colors transition-opacity': true,\n 'rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'cursor-pointer text-body hover-opacity-80': !this.disabled && !this.readonly,\n 'font-medium': !this.readonly,\n })}\n ?disabled=${this.disabled || this.readonly}\n @click=${onClick}\n >\n <div class=\"truncate min-w-0\">\n ${this._value\n ? html`\n <foxy-i18n\n infer=\"\"\n key=\"value\"\n .options=${resource?.data\n ? this.getDisplayValueOptions(resource.data)\n : { context: resource?.in('fail') ? 'fail' : 'busy' }}\n >\n </foxy-i18n>\n `\n : this.placeholder}\n </div>\n </button>\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${this.__clear}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n </div>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this._value || void 0)}\n id=\"value\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private __renderStandaloneLayout() {\n const selectionUrl = typeof this._value === 'string' ? this.getItemUrl?.(this._value) : void 0;\n const selectionId = typeof this._value === 'string' ? getResourceId(this._value) : void 0;\n\n return html`\n <div class=\"block group\">\n <div\n class=${classMap({\n 'flex items-center gap-s transition-colors font-medium': true,\n 'text-disabled': this.disabled,\n })}\n >\n <span class=\"mr-auto text-l\">${this.label}</span>\n ${selectionUrl\n ? html`\n <a\n class=\"text-body rounded transition-opacity hover-opacity-90 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${selectionUrl}\n >\n <foxy-i18n infer=\"\" key=\"view\"></foxy-i18n>\n </a>\n `\n : ''}\n ${this.showCopyIdButton && selectionId !== null\n ? html`\n <foxy-copy-to-clipboard\n layout=\"text\"\n theme=\"contrast tertiary-inline\"\n infer=\"copy-id\"\n text=${selectionId}\n >\n </foxy-copy-to-clipboard>\n `\n : ''}\n ${this.readonly || !this._value\n ? ''\n : html`\n <vaadin-button\n theme=\"error tertiary-inline\"\n ?disabled=${this.disabled}\n @click=${this.__clear}\n >\n <foxy-i18n infer=\"\" key=\"clear\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n\n <div class=\"text-secondary text-s\" ?hidden=${!this.helperText}>${this.helperText}</div>\n\n <button\n class=${classMap({\n 'block w-full bg-contrast-5 rounded text-left transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer hover-bg-contrast-10': !this.disabled && !this.readonly,\n 'cursor-default': this.disabled || this.readonly,\n 'mt-s': !!this.label || !!this.helperText,\n })}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n ?disabled=${this.disabled || this.readonly}\n @click=${(evt: MouseEvent) => {\n const button = evt.currentTarget as HTMLButtonElement;\n const dialog = this.renderRoot.querySelector('foxy-form-dialog') as FormDialog;\n\n dialog.href = '';\n dialog.show(button);\n }}\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-50': this.disabled })}>\n ${this.__getItemRenderer(this.item)({\n html,\n data: null,\n href: (this._value as string | undefined) || '',\n related: [],\n parent: '',\n props: {},\n spread: spread,\n simplifyNsLoading: this.simplifyNsLoading,\n disabled: this.disabled,\n disabledControls: this.disabledControls,\n readonly: this.readonly,\n readonlyControls: this.readonlyControls,\n hidden: this.hidden,\n hiddenControls: this.hiddenControls,\n templates: this.templates,\n previous: null,\n next: null,\n group: this.nucleon?.group ?? '',\n lang: this.lang,\n ns: this.ns,\n })}\n </div>\n </button>\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 private __handleFetchEvent(event: Event) {\n if (!(event instanceof FetchEvent)) return;\n if (event.defaultPrevented) return;\n\n const { url, method } = event.request;\n\n if (url === `foxy://${this.virtualHost}/select` && method === 'POST') {\n return event.respondWith(this.__handleSelect(event.request));\n }\n\n if (url === `foxy://${this.virtualHost}/empty` && method === 'GET') {\n return event.respondWith(this.__handleEmpty());\n }\n }\n\n private async __handleSelect(request: Request): Promise<Response> {\n const body = (await request.clone().json()) as { selection: string };\n this._value = body.selection;\n return new Response(\n JSON.stringify({\n _links: { self: { href: `foxy://${this.virtualHost}/empty` } },\n message: 'Resource selected.',\n })\n );\n }\n\n private async __handleEmpty(): Promise<Response> {\n return new Response(\n JSON.stringify({\n _links: { self: { href: `foxy://${this.virtualHost}/empty` } },\n message: 'Resource selected.',\n })\n );\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@ export declare class InternalSummaryControl extends InternalEditableControl {
|
|
|
5
5
|
static get properties(): PropertyDeclarations;
|
|
6
6
|
static get styles(): CSSResultArray;
|
|
7
7
|
layout: null | 'section' | 'details';
|
|
8
|
+
count: number | null;
|
|
8
9
|
open: boolean;
|
|
9
10
|
renderLightDom(): void;
|
|
10
11
|
renderControl(): TemplateResult;
|
|
@@ -5,12 +5,14 @@ export class InternalSummaryControl extends InternalEditableControl {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.layout = null;
|
|
8
|
+
this.count = null;
|
|
8
9
|
this.open = false;
|
|
9
10
|
}
|
|
10
11
|
static get properties() {
|
|
11
12
|
return {
|
|
12
13
|
...super.properties,
|
|
13
14
|
layout: {},
|
|
15
|
+
count: { type: Number },
|
|
14
16
|
open: { type: Boolean },
|
|
15
17
|
};
|
|
16
18
|
}
|
|
@@ -44,7 +46,7 @@ details[open] summary > div{
|
|
|
44
46
|
@toggle=${(evt) => {
|
|
45
47
|
const details = evt.currentTarget;
|
|
46
48
|
this.open = details.open;
|
|
47
|
-
if (!evt.composed)
|
|
49
|
+
if (!evt.composed && !evt.bubbles)
|
|
48
50
|
this.dispatchEvent(new CustomEvent('toggle'));
|
|
49
51
|
}}
|
|
50
52
|
>
|
|
@@ -58,7 +60,9 @@ details[open] summary > div{
|
|
|
58
60
|
class="font-medium uppercase text-s tracking-wider flex items-center justify-between gap-s"
|
|
59
61
|
?hidden=${!this.label}
|
|
60
62
|
>
|
|
61
|
-
<span
|
|
63
|
+
<span>
|
|
64
|
+
${this.label}${typeof this.count === 'number' ? ` (${this.count})` : ''}
|
|
65
|
+
</span>
|
|
62
66
|
<span
|
|
63
67
|
class="flex items-center justify-center transition-colors text-tertiary group-hover-text-body"
|
|
64
68
|
style="transform: scale(1.35)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSummaryControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSummaryControl/InternalSummaryControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;
|
|
1
|
+
{"version":3,"file":"InternalSummaryControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSummaryControl/InternalSummaryControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;QA8BE,WAAM,GAAiC,IAAI,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAG,KAAK,CAAC;IA0Df,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,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;mDAChC,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;;;;;KAKjF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations } from 'lit-element';\nimport { svg, TemplateResult } from 'lit-html';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css } from 'lit-element';\n\nexport class InternalSummaryControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n layout: {},\n count: { type: Number },\n open: { type: Boolean },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n :host(:not([layout='section'])) slot::slotted(*) {\n background-color: var(--lumo-contrast-5pct);\n padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);\n }\n\n details summary > div {\n border-radius: var(--lumo-border-radius);\n }\n\n details[open] summary > div {\n border-radius: var(--lumo-border-radius) var(--lumo-border-radius) 0 0;\n }\n `,\n ];\n }\n\n layout: null | 'section' | 'details' = null;\n\n count: number | null = null;\n\n open = false;\n\n renderLightDom(): void {\n return;\n }\n\n renderControl(): TemplateResult {\n if (this.layout === 'details') {\n return html`\n <details\n class=\"rounded overflow-hidden\"\n ?open=${this.open}\n @toggle=${(evt: Event) => {\n const details = evt.currentTarget as HTMLDetailsElement;\n this.open = details.open;\n if (!evt.composed && !evt.bubbles) this.dispatchEvent(new CustomEvent('toggle'));\n }}\n >\n <summary class=\"select-none cursor-pointer focus-outline-none group\">\n <div\n class=\"leading-s bg-contrast-5 group-focus-ring-2 group-focus-ring-inset group-focus-ring-primary-50\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n ?hidden=${!this.label && !this.helperText}\n >\n <p\n class=\"font-medium uppercase text-s tracking-wider flex items-center justify-between gap-s\"\n ?hidden=${!this.label}\n >\n <span>\n ${this.label}${typeof this.count === 'number' ? ` (${this.count})` : ''}\n </span>\n <span\n class=\"flex items-center justify-center transition-colors text-tertiary group-hover-text-body\"\n style=\"transform: scale(1.35)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1.2em; height: 1.2em\"><path fill-rule=\"evenodd\" d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </span>\n </p>\n <p class=\"text-s text-secondary\" ?hidden=${!this.helperText}>${this.helperText}</p>\n </div>\n </summary>\n <div class=\"overflow-hidden grid\" style=\"gap: 1px\">\n <slot></slot>\n </div>\n </details>\n `;\n }\n\n return html`\n <div class=\"leading-s mb-s\" ?hidden=${!this.label && !this.helperText}>\n <p class=\"font-medium text-body text-l\" ?hidden=${!this.label}>${this.label}</p>\n <p class=\"text-s text-secondary\" ?hidden=${!this.helperText}>${this.helperText}</p>\n </div>\n <div class=\"rounded overflow-hidden grid\" style=\"gap: 1px\">\n <slot></slot>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TemplateResult } from 'lit-element';
|
|
1
|
+
import type { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import type { Data } from './types';
|
|
3
3
|
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
4
4
|
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
@@ -12,6 +12,9 @@ declare const Base: typeof InternalForm & import("lit-element").Constructor<impo
|
|
|
12
12
|
* @since 1.14.0
|
|
13
13
|
*/
|
|
14
14
|
export declare class EmailTemplateForm extends Base<Data> {
|
|
15
|
+
static get properties(): PropertyDeclarations;
|
|
16
|
+
/** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */
|
|
17
|
+
defaultSubject: string | null;
|
|
15
18
|
private readonly __templateLanguageOptions;
|
|
16
19
|
private readonly __toggleGetValue;
|
|
17
20
|
private readonly __toggleSetValue;
|
|
@@ -14,6 +14,8 @@ const Base = TranslatableMixin(InternalForm, NS);
|
|
|
14
14
|
export class EmailTemplateForm extends Base {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
+
/** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */
|
|
18
|
+
this.defaultSubject = null;
|
|
17
19
|
this.__templateLanguageOptions = [
|
|
18
20
|
{ rawLabel: 'Nunjucks', value: 'nunjucks' },
|
|
19
21
|
{ rawLabel: 'Handlebars', value: 'handlebars' },
|
|
@@ -23,7 +25,19 @@ export class EmailTemplateForm extends Base {
|
|
|
23
25
|
];
|
|
24
26
|
this.__toggleGetValue = () => !!this.form.subject;
|
|
25
27
|
this.__toggleSetValue = (newValue) => {
|
|
26
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
if (newValue) {
|
|
30
|
+
this.edit({ subject: (_a = this.defaultSubject) !== null && _a !== void 0 ? _a : this.t('general.subject.default_value') });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.edit({ subject: '' });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get properties() {
|
|
38
|
+
return {
|
|
39
|
+
...super.properties,
|
|
40
|
+
defaultSubject: { attribute: 'default-subject' },
|
|
27
41
|
};
|
|
28
42
|
}
|
|
29
43
|
get readonlySelector() {
|