@sapudex/web-components 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.esm.js +1 -0
- package/cypress/fixtures/event-ribbon-links.ts +5 -0
- package/cypress/specs/Accordion.cy.tsx +1 -2
- package/cypress/specs/AccordionItem.cy.tsx +1 -1
- package/cypress/specs/Avatar.cy.tsx +1 -1
- package/cypress/specs/AvatarGroup.cy.tsx +1 -2
- package/cypress/specs/Badge.cy.tsx +1 -1
- package/cypress/specs/CountrySelector.cy.tsx +10 -4
- package/cypress/specs/EventRibbon.cy.tsx +110 -0
- package/cypress/specs/Footer.cy.tsx +1 -1
- package/cypress/specs/ListItem.cy.tsx +5 -5
- package/cypress/specs/PhoneNumberField.cy.tsx +4 -2
- package/cypress/specs/Review.cy.tsx +1 -3
- package/cypress/specs/ReviewItem.cy.tsx +1 -1
- package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +129 -131
- package/cypress/specs/SecondaryNavigationMobile.cy.tsx +27 -38
- package/cypress/specs/SelectBox.cy.tsx +93 -88
- package/cypress/specs/Slider.cy.tsx +5 -4
- package/cypress/specs/StatusBadge.cy.tsx +1 -1
- package/cypress/specs/StatusMessage.cy.tsx +1 -1
- package/cypress/specs/Switch.cy.tsx +1 -2
- package/cypress/specs/Table.cy.tsx +1 -9
- package/cypress/specs/Tag.cy.tsx +1 -1
- package/cypress/specs/TagGroup.cy.tsx +1 -2
- package/cypress/specs/TextField.cy.tsx +1 -1
- package/cypress/specs/Textarea.cy.tsx +1 -1
- package/cypress/specs/Toast.cy.tsx +1 -1
- package/cypress/specs/Tooltip.cy.tsx +1 -2
- package/cypress/specs/TruncatedText.cy.tsx +2 -1
- package/cypress/specs/Upload.cy.tsx +1 -2
- package/cypress/specs/UploadItem.cy.tsx +1 -1
- package/cypress/specs/Wizard.cy.tsx +7 -4
- package/cypress/support/component-imports.instrumented.ts +91 -0
- package/cypress/support/component-imports.src.ts +91 -0
- package/cypress/support/component.ts +1 -1
- package/cypress.config.ts +6 -0
- package/dist/AssetsVariables.js +4 -0
- package/dist/AssetsVariables.js.map +1 -1
- package/dist/Badge.d.ts +2 -2
- package/dist/Badge.js +4 -4
- package/dist/Badge.js.map +1 -1
- package/dist/Breadcrumbs.d.ts +1 -0
- package/dist/Breadcrumbs.js +11 -1
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/Button.d.ts +19 -1
- package/dist/Button.js +15 -1
- package/dist/Button.js.map +1 -1
- package/dist/Checkbox.d.ts +1 -0
- package/dist/Checkbox.js +3 -0
- package/dist/Checkbox.js.map +1 -1
- package/dist/ControlButton.d.ts +2 -1
- package/dist/ControlButton.js +2 -1
- package/dist/ControlButton.js.map +1 -1
- package/dist/CountrySelector.d.ts +2 -2
- package/dist/CountrySelector.js +3 -1
- package/dist/CountrySelector.js.map +1 -1
- package/dist/DatePicker.d.ts +2 -2
- package/dist/DatePicker.js +2 -1
- package/dist/DatePicker.js.map +1 -1
- package/dist/EventRibbon.d.ts +80 -0
- package/dist/EventRibbon.js +111 -0
- package/dist/EventRibbon.js.map +1 -0
- package/dist/EventRibbonTemplate.d.ts +2 -0
- package/dist/EventRibbonTemplate.js +7 -0
- package/dist/EventRibbonTemplate.js.map +1 -0
- package/dist/HeroBanner.d.ts +1 -1
- package/dist/InputGroup.d.ts +5 -2
- package/dist/InputGroup.js +6 -0
- package/dist/InputGroup.js.map +1 -1
- package/dist/ListItem.d.ts +3 -2
- package/dist/ListItem.js +2 -2
- package/dist/ListItem.js.map +1 -1
- package/dist/MastheadItem.js +1 -1
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadShell.d.ts +4 -1
- package/dist/MastheadShell.js +21 -5
- package/dist/MastheadShell.js.map +1 -1
- package/dist/MediaPlayer.d.ts +2 -1
- package/dist/MediaPlayer.js.map +1 -1
- package/dist/MediaPlayerYoutube.d.ts +2 -1
- package/dist/MediaPlayerYoutube.js.map +1 -1
- package/dist/Pagination.d.ts +18 -4
- package/dist/Pagination.js +33 -31
- package/dist/Pagination.js.map +1 -1
- package/dist/PhoneNumberField.d.ts +10 -7
- package/dist/PhoneNumberField.js +8 -2
- package/dist/PhoneNumberField.js.map +1 -1
- package/dist/ProgressBar.d.ts +2 -2
- package/dist/ProgressBar.js +6 -6
- package/dist/ProgressBar.js.map +1 -1
- package/dist/RadioButton.d.ts +2 -2
- package/dist/RadioButton.js +6 -6
- package/dist/RadioButton.js.map +1 -1
- package/dist/Search.d.ts +0 -1
- package/dist/Search.js +1 -3
- package/dist/Search.js.map +1 -1
- package/dist/SearchableListBase.d.ts +9 -0
- package/dist/SearchableListBase.js +10 -2
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +4 -1
- package/dist/SecondaryNavigation.js +38 -10
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/SecondaryNavigationItem.d.ts +10 -0
- package/dist/SecondaryNavigationItem.js +19 -0
- package/dist/SecondaryNavigationItem.js.map +1 -1
- package/dist/SecondaryNavigationItemBase.d.ts +1 -0
- package/dist/SecondaryNavigationItemBase.js +4 -0
- package/dist/SecondaryNavigationItemBase.js.map +1 -1
- package/dist/SecondaryNavigationSubItem.d.ts +0 -1
- package/dist/SecondaryNavigationSubItem.js +0 -4
- package/dist/SecondaryNavigationSubItem.js.map +1 -1
- package/dist/SegmentedButton.d.ts +1 -1
- package/dist/SegmentedButton.js +1 -1
- package/dist/SegmentedButton.js.map +1 -1
- package/dist/SegmentedButtonItem.d.ts +1 -1
- package/dist/SegmentedButtonItem.js +2 -2
- package/dist/SegmentedButtonItem.js.map +1 -1
- package/dist/StatusBadge.d.ts +8 -3
- package/dist/StatusBadge.js +9 -1
- package/dist/StatusBadge.js.map +1 -1
- package/dist/StepInput.d.ts +3 -3
- package/dist/StepInput.js.map +1 -1
- package/dist/TableCellBase.d.ts +2 -2
- package/dist/TableCellBase.js.map +1 -1
- package/dist/Tag.d.ts +2 -2
- package/dist/Tag.js +4 -4
- package/dist/Tag.js.map +1 -1
- package/dist/TextArea.d.ts +2 -2
- package/dist/TextArea.js +9 -9
- package/dist/TextArea.js.map +1 -1
- package/dist/TextField.d.ts +9 -2
- package/dist/TextField.js +8 -5
- package/dist/TextField.js.map +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Toast.js.map +1 -1
- package/dist/Upload.d.ts +1 -1
- package/dist/Upload.js +1 -1
- package/dist/Upload.js.map +1 -1
- package/dist/UploadItem.d.ts +3 -3
- package/dist/UploadItem.js +9 -9
- package/dist/UploadItem.js.map +1 -1
- package/dist/Wizard.d.ts +20 -1
- package/dist/Wizard.js +22 -9
- package/dist/Wizard.js.map +1 -1
- package/dist/WizardTemplate.js +1 -1
- package/dist/WizardTemplate.js.map +1 -1
- package/dist/assets/InputSuggestions-BgbbJ4tc.js +2 -0
- package/dist/assets/{ListItemStandardExpandableTextTemplate-CLBtdbBK.js → ListItemStandardExpandableTextTemplate-onAnn1Tj.js} +2 -2
- package/dist/assets/bundle.esm-CwUfibNQ.js +389 -0
- package/dist/assets/parameters-bundle.css-1GGBOW8m.js +2 -0
- package/dist/assets/parameters-bundle.css-A9eeRg2R.js +2 -0
- package/dist/assets/parameters-bundle.css-COBI_9-U.js +2 -0
- package/dist/assets/parameters-bundle.css-CgAoZ-Ir.js +2 -0
- package/dist/assets/parameters-bundle.css-DuFHHRNK.js +2 -0
- package/dist/assets/parameters-bundle.css-Pf68NO0T.js +2 -0
- package/dist/assets/parameters-bundle.css-aX_t_-9o.js +2 -0
- package/dist/assets/parameters-bundle.css-rNSryFKH.js +2 -0
- package/dist/css/themes/Breadcrumbs.css +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/DatePickerPopover.css +1 -1
- package/dist/css/themes/EventRibbon.css +1 -0
- package/dist/css/themes/ListItem.css +1 -1
- package/dist/css/themes/MastheadCountrySelector.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadShell.css +1 -1
- package/dist/css/themes/Modal.css +1 -1
- package/dist/css/themes/Pagination.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Search.css +1 -1
- package/dist/css/themes/SideNavigationItem.css +1 -1
- package/dist/css/themes/SideNavigationSubItem.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TextField.css +1 -1
- package/dist/custom-elements-internal.json +471 -37
- package/dist/custom-elements.json +442 -35
- package/dist/data/CountryListISO3166.d.ts +13 -4
- package/dist/data/CountryListISO3166.js +8 -0
- package/dist/data/CountryListISO3166.js.map +1 -1
- package/dist/generated/json-imports/Themes-node.d.ts +1 -0
- package/dist/generated/json-imports/Themes-node.js +19 -0
- package/dist/generated/json-imports/Themes-node.js.map +1 -0
- package/dist/generated/json-imports/i18n-node.d.ts +1 -0
- package/dist/generated/json-imports/i18n-node.js +82 -0
- package/dist/generated/json-imports/i18n-node.js.map +1 -0
- package/dist/generated/templates/BreadcrumbsPopoverTemplate.lit.js +1 -1
- package/dist/generated/templates/BreadcrumbsPopoverTemplate.lit.js.map +1 -1
- package/dist/generated/templates/BreadcrumbsTemplate.lit.js +1 -1
- package/dist/generated/templates/BreadcrumbsTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js +2 -2
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SearchTemplate.lit.js +3 -3
- package/dist/generated/templates/SearchTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js +2 -2
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/themes/Breadcrumbs.css.d.ts +1 -1
- package/dist/generated/themes/Breadcrumbs.css.js +1 -1
- package/dist/generated/themes/Breadcrumbs.css.js.map +1 -1
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/DatePickerPopover.css.d.ts +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js.map +1 -1
- package/dist/generated/themes/EventRibbon.css.d.ts +2 -0
- package/dist/generated/themes/EventRibbon.css.js +8 -0
- package/dist/generated/themes/EventRibbon.css.js.map +1 -0
- package/dist/generated/themes/ListItem.css.d.ts +1 -1
- package/dist/generated/themes/ListItem.css.js +1 -1
- package/dist/generated/themes/ListItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.d.ts +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
- package/dist/generated/themes/MastheadItem.css.js +1 -1
- package/dist/generated/themes/MastheadItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadShell.css.d.ts +1 -1
- package/dist/generated/themes/MastheadShell.css.js +1 -1
- package/dist/generated/themes/MastheadShell.css.js.map +1 -1
- package/dist/generated/themes/Modal.css.d.ts +1 -1
- package/dist/generated/themes/Modal.css.js +1 -1
- package/dist/generated/themes/Modal.css.js.map +1 -1
- package/dist/generated/themes/Pagination.css.d.ts +1 -1
- package/dist/generated/themes/Pagination.css.js +1 -1
- package/dist/generated/themes/Pagination.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Search.css.d.ts +1 -1
- package/dist/generated/themes/Search.css.js +1 -1
- package/dist/generated/themes/Search.css.js.map +1 -1
- package/dist/generated/themes/SideNavigationItem.css.d.ts +1 -1
- package/dist/generated/themes/SideNavigationItem.css.js +1 -1
- package/dist/generated/themes/SideNavigationItem.css.js.map +1 -1
- package/dist/generated/themes/SideNavigationSubItem.css.d.ts +1 -1
- package/dist/generated/themes/SideNavigationSubItem.css.js +1 -1
- package/dist/generated/themes/SideNavigationSubItem.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/TextField.css.d.ts +1 -1
- package/dist/generated/themes/TextField.css.js +1 -1
- package/dist/generated/themes/TextField.css.js.map +1 -1
- package/dist/types/ButtonAccessibleRole.d.ts +8 -0
- package/dist/types/ButtonAccessibleRole.js +10 -0
- package/dist/types/ButtonAccessibleRole.js.map +1 -0
- package/dist/types/{Button.d.ts → ButtonDesign.d.ts} +1 -15
- package/dist/types/ButtonDesign.js +16 -0
- package/dist/types/ButtonDesign.js.map +1 -0
- package/dist/types/ButtonSize.d.ts +6 -0
- package/dist/types/ButtonSize.js +8 -0
- package/dist/types/ButtonSize.js.map +1 -0
- package/dist/types/ControlButtonDesign.d.ts +10 -0
- package/dist/types/ControlButtonDesign.js +12 -0
- package/dist/types/ControlButtonDesign.js.map +1 -0
- package/dist/types/EventRibbon.d.ts +37 -0
- package/dist/types/EventRibbon.js +43 -0
- package/dist/types/EventRibbon.js.map +1 -0
- package/dist/types/ProgressBar.d.ts +1 -1
- package/dist/types/ProgressBar.js +1 -1
- package/dist/types/ProgressBar.js.map +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/common.js +1 -1
- package/dist/types/common.js.map +1 -1
- package/dist/vscode.html-custom-data.json +110 -10
- package/dist/web-types.json +159 -13
- package/filter-coverage.js +58 -0
- package/package.json +14 -9
- package/src/AssetsVariables.ts +4 -0
- package/src/Badge.ts +4 -4
- package/src/Breadcrumbs.hbs +7 -10
- package/src/Breadcrumbs.ts +14 -1
- package/src/BreadcrumbsPopover.hbs +3 -1
- package/src/Button.ts +21 -1
- package/src/Checkbox.ts +4 -0
- package/src/ControlButton.ts +2 -1
- package/src/CountrySelector.ts +5 -3
- package/src/DatePicker.ts +4 -3
- package/src/EventRibbon.ts +143 -0
- package/src/EventRibbonTemplate.tsx +18 -0
- package/src/InputGroup.ts +5 -2
- package/src/ListItem.ts +4 -4
- package/src/MastheadItem.ts +1 -1
- package/src/MastheadShell.ts +25 -5
- package/src/MediaPlayer.ts +3 -1
- package/src/MediaPlayerYoutube.ts +4 -2
- package/src/Pagination.hbs +7 -3
- package/src/Pagination.ts +49 -32
- package/src/PhoneNumberField.hbs +1 -1
- package/src/PhoneNumberField.ts +13 -5
- package/src/ProgressBar.ts +6 -6
- package/src/RadioButton.ts +6 -6
- package/src/Search.hbs +3 -2
- package/src/Search.ts +1 -3
- package/src/SearchableListBase.ts +18 -2
- package/src/SecondaryNavigation.hbs +1 -0
- package/src/SecondaryNavigation.ts +41 -12
- package/src/SecondaryNavigationItem.hbs +2 -1
- package/src/SecondaryNavigationItem.ts +31 -0
- package/src/SecondaryNavigationItemBase.ts +3 -0
- package/src/SecondaryNavigationSubItem.ts +0 -3
- package/src/SegmentedButton.ts +1 -1
- package/src/SegmentedButtonItem.ts +2 -2
- package/src/StatusBadge.ts +8 -3
- package/src/StepInput.ts +3 -3
- package/src/TableCellBase.ts +2 -2
- package/src/Tag.ts +4 -4
- package/src/TextArea.ts +9 -9
- package/src/TextField.ts +14 -5
- package/src/Toast.ts +1 -1
- package/src/Upload.ts +1 -1
- package/src/UploadItem.ts +9 -9
- package/src/Wizard.ts +39 -11
- package/src/WizardTemplate.tsx +5 -1
- package/src/data/CountryListISO3166.ts +10 -2
- package/src/generated/json-imports/Themes-node.ts +21 -0
- package/src/generated/json-imports/i18n-node.ts +85 -0
- package/src/generated/templates/BreadcrumbsPopoverTemplate.lit.ts +1 -1
- package/src/generated/templates/BreadcrumbsTemplate.lit.ts +1 -1
- package/src/generated/templates/PaginationTemplate.lit.ts +1 -1
- package/src/generated/templates/PhoneNumberFieldTemplate.lit.ts +1 -1
- package/src/generated/templates/SearchTemplate.lit.ts +3 -3
- package/src/generated/templates/SecondaryNavigationItemTemplate.lit.ts +2 -2
- package/src/generated/templates/SecondaryNavigationTemplate.lit.ts +1 -1
- package/src/generated/themes/Breadcrumbs.css.ts +1 -1
- package/src/generated/themes/Button.css.ts +1 -1
- package/src/generated/themes/DatePickerPopover.css.ts +1 -1
- package/src/generated/themes/EventRibbon.css.ts +9 -0
- package/src/generated/themes/ListItem.css.ts +1 -1
- package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadShell.css.ts +1 -1
- package/src/generated/themes/Modal.css.ts +1 -1
- package/src/generated/themes/Pagination.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Search.css.ts +1 -1
- package/src/generated/themes/SideNavigationItem.css.ts +1 -1
- package/src/generated/themes/SideNavigationSubItem.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/TextField.css.ts +1 -1
- package/src/themes/Breadcrumbs.css +3 -0
- package/src/themes/Button.css +71 -29
- package/src/themes/DatePickerPopover.css +64 -6
- package/src/themes/EventRibbon.css +411 -0
- package/src/themes/ListItem.css +4 -0
- package/src/themes/MastheadCountrySelector.css +8 -5
- package/src/themes/MastheadItem.css +12 -4
- package/src/themes/MastheadShell.css +5 -2
- package/src/themes/Modal.css +6 -1
- package/src/themes/Pagination.css +19 -0
- package/src/themes/Search.css +8 -1
- package/src/themes/SideNavigationItem.css +9 -1
- package/src/themes/SideNavigationSubItem.css +7 -0
- package/src/themes/TextField.css +2 -13
- package/src/types/ButtonAccessibleRole.ts +9 -0
- package/src/types/{Button.ts → ButtonDesign.ts} +1 -17
- package/src/types/ButtonSize.ts +7 -0
- package/src/types/ControlButtonDesign.ts +11 -0
- package/src/types/EventRibbon.ts +51 -0
- package/src/types/ProgressBar.ts +1 -1
- package/src/types/common.ts +1 -1
- package/swap-component-imports.js +18 -0
- package/dist/assets/InputSuggestions-CP3cBQsh.js +0 -2
- package/dist/assets/bundle.esm-jHcdiVfj.js +0 -380
- package/dist/assets/parameters-bundle.css-BU4Bi-ho.js +0 -2
- package/dist/assets/parameters-bundle.css-Beilb2gS.js +0 -2
- package/dist/assets/parameters-bundle.css-BzQMaZUt.js +0 -2
- package/dist/assets/parameters-bundle.css-Bzfv_Fox.js +0 -2
- package/dist/assets/parameters-bundle.css-CLwmjytB.js +0 -2
- package/dist/assets/parameters-bundle.css-CU3plTdF.js +0 -2
- package/dist/assets/parameters-bundle.css-DRX-o-Cb.js +0 -2
- package/dist/assets/parameters-bundle.css-DhFMZJhW.js +0 -2
- package/dist/css/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css +0 -1
- package/dist/generated/assets/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css.json +0 -1
- package/dist/generated/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css.d.ts +0 -2
- package/dist/generated/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css.js +0 -3
- package/dist/generated/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css.js.map +0 -1
- package/dist/types/Button.js +0 -33
- package/dist/types/Button.js.map +0 -1
- package/src/generated/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css.ts +0 -2
- package/src/themes/overrides/@ui5/webcomponents/sap_glow/parameters-bundle.css +0 -195
package/dist/TextField.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
2
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
|
-
import
|
|
3
|
+
import UDExValueState from "./types/common.js";
|
|
4
4
|
type AccInfo = {
|
|
5
5
|
ariaInvalid?: string;
|
|
6
6
|
ariaDescribedBy?: string;
|
|
@@ -115,7 +115,7 @@ declare class UDExTextField extends UI5Element {
|
|
|
115
115
|
* @default "Standard"
|
|
116
116
|
* @public
|
|
117
117
|
*/
|
|
118
|
-
valueState: `${
|
|
118
|
+
valueState: `${UDExValueState}`;
|
|
119
119
|
/**
|
|
120
120
|
* Defines supporting text under the input field.
|
|
121
121
|
*
|
|
@@ -137,6 +137,13 @@ declare class UDExTextField extends UI5Element {
|
|
|
137
137
|
* @public
|
|
138
138
|
*/
|
|
139
139
|
active: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Defines if dropdown associated with text-field trigger has opened dropdown. It indicates active state of control button.
|
|
142
|
+
*
|
|
143
|
+
* @default false
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
iconActive: boolean;
|
|
140
147
|
/**
|
|
141
148
|
* Defines the behaviour of autocomplete.
|
|
142
149
|
* @default "off"
|
package/dist/TextField.js
CHANGED
|
@@ -15,7 +15,7 @@ import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
|
15
15
|
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
16
16
|
import { VALUE_STATE_SUCCESS, VALUE_STATE_INFORMATION, VALUE_STATE_WARNING, VALUE_STATE_ERROR, READ_ONLY, } from "./generated/i18n/i18n-defaults.js";
|
|
17
17
|
import UDExControlButton from "./ControlButton.js";
|
|
18
|
-
import
|
|
18
|
+
import UDExValueState from "./types/common.js";
|
|
19
19
|
import UDExStatusMessage from "./StatusMessage.js";
|
|
20
20
|
// Template
|
|
21
21
|
import TextFieldTemplate from "./generated/templates/TextFieldTemplate.lit.js";
|
|
@@ -63,7 +63,7 @@ let UDExTextField = UDExTextField_1 = class UDExTextField extends UI5Element {
|
|
|
63
63
|
* @default "Standard"
|
|
64
64
|
* @public
|
|
65
65
|
*/
|
|
66
|
-
this.valueState =
|
|
66
|
+
this.valueState = UDExValueState.Standard;
|
|
67
67
|
/**
|
|
68
68
|
* Defines the behaviour of autocomplete.
|
|
69
69
|
* @default "off"
|
|
@@ -135,10 +135,10 @@ let UDExTextField = UDExTextField_1 = class UDExTextField extends UI5Element {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
get hasValueState() {
|
|
138
|
-
return this.valueState !==
|
|
138
|
+
return this.valueState !== UDExValueState.Standard;
|
|
139
139
|
}
|
|
140
140
|
get valueStateText() {
|
|
141
|
-
return this.valueState !==
|
|
141
|
+
return this.valueState !== UDExValueState.Standard ? this.valueStateTypeMappings[this.valueState] : undefined;
|
|
142
142
|
}
|
|
143
143
|
get readOnlyStateText() {
|
|
144
144
|
return UDExTextField_1.i18nBundle.getText(READ_ONLY);
|
|
@@ -157,7 +157,7 @@ let UDExTextField = UDExTextField_1 = class UDExTextField extends UI5Element {
|
|
|
157
157
|
}
|
|
158
158
|
get accInfo() {
|
|
159
159
|
return {
|
|
160
|
-
"ariaInvalid": this.valueState ===
|
|
160
|
+
"ariaInvalid": this.valueState === UDExValueState.Error ? "true" : undefined,
|
|
161
161
|
"ariaDescribedBy": this.ariaDescribedBy ? this.ariaDescribedBy : this.ariaDescribedById || undefined,
|
|
162
162
|
"ariaLabelledBy": this.accessibleNameRef || undefined,
|
|
163
163
|
"ariaLabel": this.accessibleName || undefined,
|
|
@@ -244,6 +244,9 @@ __decorate([
|
|
|
244
244
|
__decorate([
|
|
245
245
|
property({ type: Boolean })
|
|
246
246
|
], UDExTextField.prototype, "active", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: Boolean })
|
|
249
|
+
], UDExTextField.prototype, "iconActive", void 0);
|
|
247
250
|
__decorate([
|
|
248
251
|
property({ type: String })
|
|
249
252
|
], UDExTextField.prototype, "autocomplete", void 0);
|
package/dist/TextField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../src/TextField.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0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AO,EAAE,IAAI,EAAE,CAAC;IACnC;;;;OAIG;;IACF,KAAK,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEvC;;;;OAIG;;IACF,KAAK,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAC9B,aAAa,CA0XlB;AAED,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport Icon from \"@ui5/webcomponents/dist/Icon.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n VALUE_STATE_SUCCESS,\n VALUE_STATE_INFORMATION,\n VALUE_STATE_WARNING,\n VALUE_STATE_ERROR,\n READ_ONLY,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport UDExControlButton from \"./ControlButton.js\";\nimport ValueState from \"./types/common.js\";\nimport UDExStatusMessage from \"./StatusMessage.js\";\n\n// Template\nimport TextFieldTemplate from \"./generated/templates/TextFieldTemplate.lit.js\";\n\n// Styles\nimport TextFieldCss from \"./generated/themes/TextField.css.js\";\n\ntype AccInfo = {\n ariaInvalid?: string;\n ariaDescribedBy?: string;\n ariaLabelledBy?: string;\n ariaLabel?: string;\n ariaHasPopup?: string,\n}\n\nexport type UDExTextFieldKeydownEventDetail = {\n keyboardEvent: KeyboardEvent;\n}\n\n/**\n * @class\n *\n * @constructor\n * @extends UI5Element\n * @tagname udex-text-field\n * @public\n */\n@customElement({\n tag: \"udex-text-field\",\n renderer: litRender,\n styles: TextFieldCss,\n template: TextFieldTemplate,\n dependencies: [UDExControlButton, Icon, UDExStatusMessage],\n})\n\n/**\n * Fired when the value of the component changes at each keystroke.\n *\n * @public\n */\n@event(\"input\", { bubbles: true })\n/**\n * Fired when the input operation has finished by pressing Enter or on focusout.\n *\n * @public\n */\n@event(\"change\", { bubbles: true })\n/**\n * Fired event when the user clicks the icon.\n *\n * @private\n */\n@event(\"click-icon\", { bubbles: true })\n\n/**\n * Fired event when the key is pressed in the input.\n *\n * @private\n */\n@event(\"keydown\", { bubbles: true })\nclass UDExTextField extends UI5Element {\n eventDetails!: {\n \"keydown\": UDExTextFieldKeydownEventDetail,\n \"input\": void,\n \"change\": void,\n \"click-icon\": void,\n };\n _labelActiveClassName = \"udex-text-field__label_active\";\n\n /**\n * Defines whether the component is in disabled state.\n * <br><br>\n * <b>Note:</b> A disabled component is completely noninteractive.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n disabled!: boolean;\n\n /**\n * Defines the value of the component.\n * <br><br>\n * <b>Note:</b> The property is updated upon typing.\n *\n * @default \"\"\n * @formEvents input\n * @formProperty\n * @public\n */\n @property({ type: String })\n value: string = \"\";\n\n /**\n * Sets the maximum number of characters available in the input field.\n * <br><br>\n * <b>Note:</b> This property is not compatible with the ui5-input type InputType.Number. If the ui5-input type is set to Number, the maxlength value is ignored.\n *\n * @public\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * Defines label text for the input field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n label!: string;\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default \"\"\n * @public\n */\n @property()\n accessibleName!: string;\n\n /**\n * Receives id (or many ids) of the elements that label the component.\n * @default \"\"\n * @public\n */\n @property()\n accessibleNameRef: string = \"\";\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default \"\"\n * @public\n */\n @property()\n accessibleIconName: string = \"\";\n\n /**\n * Defines whether the component is read-only.\n * <br><br>\n * <b>Note:</b> A read-only component is not editable,\n * but still provides visual feedback upon user interaction.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n readonly!: boolean;\n\n /**\n * Defines whether the component is display-only.\n * <br><br>\n * <b>Note:</b> A display-only component is not editable,\n * but still provides visual feedback upon user interaction, input border is not visible.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n displayonly!: boolean;\n\n /**\n * Defines whether the component is required.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n required!: boolean;\n\n /**\n * Defines the value state of the component.\n *\n * @default \"Standard\"\n * @public\n */\n @property()\n valueState: `${ValueState}` = ValueState.Standard;\n\n /**\n * Defines supporting text under the input field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n supportingText!: string;\n\n /**\n * Defines the icon name in the text-field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n icon!: string;\n\n /**\n * Defines if the text-field is active\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n active!: boolean;\n\n /**\n * Defines the behaviour of autocomplete.\n * @default \"off\"\n * @public\n */\n @property({ type: String })\n autocomplete: string = \"off\";\n\n /**\n * Defines the inner stored show password button tooltip.\n *\n * @default \"\"\n * @private\n */\n\n @property({ type: String })\n showButtonTooltip: string = \"\";\n\n /**\n * Defines the inner stored class of the label.\n *\n * @default \"\"\n * @private\n */\n @property({ type: String, noAttribute: true })\n labelActiveClass: string = \"\";\n\n /**\n * Defines the inner stored value of the readonly attribute of the input.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isInputReadonly!: boolean;\n\n /**\n * Defines the inner stored value of the classes of the label.\n *\n * @default \"\"\n * @private\n */\n @property({ type: String, noAttribute: true })\n labelClasses: string = \"\";\n\n /**\n * Defines the inner stored value of the classes of the label.\n *\n * @default \"text\"\n * @private\n */\n @property({ type: String })\n type: \"Text\" | \"Email\" | \"Number\" | \"Password\" | \"Tel\" | \"URL\" | \"Search\" = \"Text\";\n\n /**\n * Defines direction of the input.\n *\n * @public\n */\n @property({ type: String, noAttribute: true })\n direction?: string;\n\n /**\n * Defines the max value for the \"number\" type of the input.\n */\n @property({ type: Number })\n max?: number;\n\n /**\n * Defines the min value for the \"number\" type of the input.\n */\n @property({ type: Number })\n min?: number;\n\n /**\n * Defines the step for the \"number\" type of the input.\n * @default undefined\n */\n @property({ type: Number })\n step?: number;\n\n /**\n * Allows setting the aria-describedby property on the internal input node.\n *\n * @default \"\"\n * @public\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * Defines the aria-has-popup attribute of the input.\n * @private\n */\n @property({ type: String })\n _ariaHasPopup?: string;\n\n /**\n * Defines is it the touch of the input field (only for mobile devices).\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _isTouched!: boolean;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n get valueStateTypeMappings(): Record<string, string> {\n return {\n \"Success\": UDExTextField.i18nBundle.getText(VALUE_STATE_SUCCESS),\n \"Standard\": UDExTextField.i18nBundle.getText(VALUE_STATE_INFORMATION),\n \"Error\": UDExTextField.i18nBundle.getText(VALUE_STATE_ERROR),\n \"Warning\": UDExTextField.i18nBundle.getText(VALUE_STATE_WARNING),\n };\n }\n\n get hasValueState(): boolean {\n return this.valueState !== ValueState.Standard;\n }\n\n get valueStateText(): string | undefined {\n return this.valueState !== ValueState.Standard ? this.valueStateTypeMappings[this.valueState] : undefined;\n }\n\n get readOnlyStateText(): string {\n return UDExTextField.i18nBundle.getText(READ_ONLY);\n }\n\n get ariaDescribedById(): string {\n return `${this.supportingTextId} ${this.valueStateTextId} ${this.readOnlyStateTextId}`.trim();\n }\n\n get supportingTextId(): string {\n return this.supportingText ? `${this._id}-supportingTextDesc` : \"\";\n }\n\n get valueStateTextId(): string {\n return this.hasValueState ? `${this._id}-valueStateDesc` : \"\";\n }\n\n get readOnlyStateTextId(): string {\n return this.readonly ? `${this._id}-stateReadOnlyDesc` : \"\";\n }\n\n get accInfo(): AccInfo {\n return {\n \"ariaInvalid\": this.valueState === ValueState.Error ? \"true\" : undefined,\n \"ariaDescribedBy\": this.ariaDescribedBy ? this.ariaDescribedBy : this.ariaDescribedById || undefined,\n \"ariaLabelledBy\": this.accessibleNameRef || undefined,\n \"ariaLabel\": this.accessibleName || undefined,\n \"ariaHasPopup\": this._ariaHasPopup || undefined,\n };\n }\n\n get inputRole(): string | undefined {\n return this.isAutoCompleteDisabled ? \"presentation\" : undefined;\n }\n\n get isAutoCompleteDisabled(): boolean {\n return this.autocomplete === \"off\" || this.autocomplete === \"new-password\";\n }\n\n handleKeydown(e: KeyboardEvent): void {\n e.stopPropagation();\n this.fireDecoratorEvent(\"keydown\", { keyboardEvent: e });\n }\n\n handleChange = (): void => {\n this.fireDecoratorEvent(\"change\");\n };\n\n handleInput = (inputEvent: InputEvent) => {\n this.value = (inputEvent.target as HTMLInputElement)?.value;\n };\n\n handleClick = (): void => {\n if (!isDesktop()) {\n this._isTouched = true;\n }\n };\n\n handleFocus = (): void => {\n if (!this.disabled && !this.readonly && !this.displayonly) {\n this.labelActiveClass = this._labelActiveClassName;\n this.active = true;\n }\n };\n\n handleBlur = (): void => {\n this.active = false;\n\n if (this.value) {\n this.labelActiveClass = this._labelActiveClassName;\n } else {\n this.labelActiveClass = \"\";\n }\n this._isTouched = false;\n };\n\n handleIconClick(): void {\n this.fireDecoratorEvent(\"click-icon\");\n }\n\n onBeforeRendering(): void {\n if ((this.value || this.active) && this.labelActiveClass === \"\") {\n this.labelActiveClass = this._labelActiveClassName;\n } else if (!this.active && !this.value && this.labelActiveClass.length) {\n this.labelActiveClass = \"\";\n }\n\n this.isInputReadonly = this.readonly || this.displayonly;\n\n this.labelClasses = `udex-text-field__label ${this.labelActiveClass}`;\n }\n\n onAfterRendering(): void {\n const directionStyles: string = window\n .getComputedStyle(this)\n .getPropertyValue(\"direction\");\n\n if (!directionStyles) {\n this.direction = \"ltr\";\n } else {\n this.direction = directionStyles;\n }\n }\n\n get readonlyNotDisabled(): boolean {\n return this.isInputReadonly && !this.disabled;\n }\n}\n\nUDExTextField.define();\n\nexport default UDExTextField;\n"]}
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../src/TextField.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,GACV,MAAM,mCAAmC,CAAC;AAC3C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAEnD,WAAW;AACX,OAAO,iBAAiB,MAAM,gDAAgD,CAAC;AAE/E,SAAS;AACT,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAc/D;;;;;;;GAOG;AAkCH,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAOE,0BAAqB,GAAG,+BAA+B,CAAC;QAaxD;;;;;;;;;WASG;QAED,UAAK,GAAW,EAAE,CAAC;QA8BrB;;;;WAIG;QAED,sBAAiB,GAAW,EAAE,CAAC;QAEjC;;;;;WAKG;QAED,uBAAkB,GAAW,EAAE,CAAC;QAmClC;;;;;WAKG;QAED,eAAU,GAAwB,cAAc,CAAC,QAAQ,CAAC;QAsC5D;;;;WAIG;QAED,iBAAY,GAAW,KAAK,CAAC;QAE/B;;;;;WAKG;QAGD,sBAAiB,GAAW,EAAE,CAAC;QAEjC;;;;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AS;QACnB,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,iBAAiB;QAC3B,YAAY,EAAE,CAAC,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,CAAC;KAC3D,CAAC;IAEF;;;;SAIK;;IACJ,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAClC;;;;SAIK;;IACJ,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACnC;;;;OAIG;;IACF,KAAK,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEvC;;;;OAIG;;IACF,KAAK,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAC9B,aAAa,CAmYlB;AAED,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport Icon from \"@ui5/webcomponents/dist/Icon.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n VALUE_STATE_SUCCESS,\n VALUE_STATE_INFORMATION,\n VALUE_STATE_WARNING,\n VALUE_STATE_ERROR,\n READ_ONLY,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport UDExControlButton from \"./ControlButton.js\";\nimport UDExValueState from \"./types/common.js\";\nimport UDExStatusMessage from \"./StatusMessage.js\";\n\n// Template\nimport TextFieldTemplate from \"./generated/templates/TextFieldTemplate.lit.js\";\n\n// Styles\nimport TextFieldCss from \"./generated/themes/TextField.css.js\";\n\ntype AccInfo = {\n ariaInvalid?: string;\n ariaDescribedBy?: string;\n ariaLabelledBy?: string;\n ariaLabel?: string;\n ariaHasPopup?: string,\n}\n\nexport type UDExTextFieldKeydownEventDetail = {\n keyboardEvent: KeyboardEvent;\n}\n\n/**\n * @class\n *\n * @constructor\n * @extends UI5Element\n * @tagname udex-text-field\n * @public\n */\n@customElement({\n tag: \"udex-text-field\",\n renderer: litRender,\n styles: TextFieldCss,\n template: TextFieldTemplate,\n dependencies: [UDExControlButton, Icon, UDExStatusMessage],\n})\n\n/**\n * Fired when the value of the component changes at each keystroke.\n *\n * @public\n */\n@event(\"input\", { bubbles: true })\n/**\n * Fired when the input operation has finished by pressing Enter or on focusout.\n *\n * @public\n */\n@event(\"change\", { bubbles: true })\n/**\n * Fired event when the user clicks the icon.\n *\n * @private\n */\n@event(\"click-icon\", { bubbles: true })\n\n/**\n * Fired event when the key is pressed in the input.\n *\n * @private\n */\n@event(\"keydown\", { bubbles: true })\nclass UDExTextField extends UI5Element {\n eventDetails!: {\n \"keydown\": UDExTextFieldKeydownEventDetail,\n \"input\": void,\n \"change\": void,\n \"click-icon\": void,\n };\n _labelActiveClassName = \"udex-text-field__label_active\";\n\n /**\n * Defines whether the component is in disabled state.\n * <br><br>\n * <b>Note:</b> A disabled component is completely noninteractive.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n disabled!: boolean;\n\n /**\n * Defines the value of the component.\n * <br><br>\n * <b>Note:</b> The property is updated upon typing.\n *\n * @default \"\"\n * @formEvents input\n * @formProperty\n * @public\n */\n @property({ type: String })\n value: string = \"\";\n\n /**\n * Sets the maximum number of characters available in the input field.\n * <br><br>\n * <b>Note:</b> This property is not compatible with the ui5-input type InputType.Number. If the ui5-input type is set to Number, the maxlength value is ignored.\n *\n * @public\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * Defines label text for the input field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n label!: string;\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default \"\"\n * @public\n */\n @property()\n accessibleName!: string;\n\n /**\n * Receives id (or many ids) of the elements that label the component.\n * @default \"\"\n * @public\n */\n @property()\n accessibleNameRef: string = \"\";\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default \"\"\n * @public\n */\n @property()\n accessibleIconName: string = \"\";\n\n /**\n * Defines whether the component is read-only.\n * <br><br>\n * <b>Note:</b> A read-only component is not editable,\n * but still provides visual feedback upon user interaction.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n readonly!: boolean;\n\n /**\n * Defines whether the component is display-only.\n * <br><br>\n * <b>Note:</b> A display-only component is not editable,\n * but still provides visual feedback upon user interaction, input border is not visible.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n displayonly!: boolean;\n\n /**\n * Defines whether the component is required.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n required!: boolean;\n\n /**\n * Defines the value state of the component.\n *\n * @default \"Standard\"\n * @public\n */\n @property()\n valueState: `${UDExValueState}` = UDExValueState.Standard;\n\n /**\n * Defines supporting text under the input field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n supportingText!: string;\n\n /**\n * Defines the icon name in the text-field.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n icon!: string;\n\n /**\n * Defines if the text-field is active\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n active!: boolean;\n\n /**\n * Defines if dropdown associated with text-field trigger has opened dropdown. It indicates active state of control button.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n iconActive!: boolean;\n\n /**\n * Defines the behaviour of autocomplete.\n * @default \"off\"\n * @public\n */\n @property({ type: String })\n autocomplete: string = \"off\";\n\n /**\n * Defines the inner stored show password button tooltip.\n *\n * @default \"\"\n * @private\n */\n\n @property({ type: String })\n showButtonTooltip: string = \"\";\n\n /**\n * Defines the inner stored class of the label.\n *\n * @default \"\"\n * @private\n */\n @property({ type: String, noAttribute: true })\n labelActiveClass: string = \"\";\n\n /**\n * Defines the inner stored value of the readonly attribute of the input.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isInputReadonly!: boolean;\n\n /**\n * Defines the inner stored value of the classes of the label.\n *\n * @default \"\"\n * @private\n */\n @property({ type: String, noAttribute: true })\n labelClasses: string = \"\";\n\n /**\n * Defines the inner stored value of the classes of the label.\n *\n * @default \"text\"\n * @private\n */\n @property({ type: String })\n type: \"Text\" | \"Email\" | \"Number\" | \"Password\" | \"Tel\" | \"URL\" | \"Search\" = \"Text\";\n\n /**\n * Defines direction of the input.\n *\n * @public\n */\n @property({ type: String, noAttribute: true })\n direction?: string;\n\n /**\n * Defines the max value for the \"number\" type of the input.\n */\n @property({ type: Number })\n max?: number;\n\n /**\n * Defines the min value for the \"number\" type of the input.\n */\n @property({ type: Number })\n min?: number;\n\n /**\n * Defines the step for the \"number\" type of the input.\n * @default undefined\n */\n @property({ type: Number })\n step?: number;\n\n /**\n * Allows setting the aria-describedby property on the internal input node.\n *\n * @default \"\"\n * @public\n */\n @property()\n ariaDescribedBy?: string;\n\n /**\n * Defines the aria-has-popup attribute of the input.\n * @private\n */\n @property({ type: String })\n _ariaHasPopup?: string;\n\n /**\n * Defines is it the touch of the input field (only for mobile devices).\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _isTouched!: boolean;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n get valueStateTypeMappings(): Record<string, string> {\n return {\n \"Success\": UDExTextField.i18nBundle.getText(VALUE_STATE_SUCCESS),\n \"Standard\": UDExTextField.i18nBundle.getText(VALUE_STATE_INFORMATION),\n \"Error\": UDExTextField.i18nBundle.getText(VALUE_STATE_ERROR),\n \"Warning\": UDExTextField.i18nBundle.getText(VALUE_STATE_WARNING),\n };\n }\n\n get hasValueState(): boolean {\n return this.valueState !== UDExValueState.Standard;\n }\n\n get valueStateText(): string | undefined {\n return this.valueState !== UDExValueState.Standard ? this.valueStateTypeMappings[this.valueState] : undefined;\n }\n\n get readOnlyStateText(): string {\n return UDExTextField.i18nBundle.getText(READ_ONLY);\n }\n\n get ariaDescribedById(): string {\n return `${this.supportingTextId} ${this.valueStateTextId} ${this.readOnlyStateTextId}`.trim();\n }\n\n get supportingTextId(): string {\n return this.supportingText ? `${this._id}-supportingTextDesc` : \"\";\n }\n\n get valueStateTextId(): string {\n return this.hasValueState ? `${this._id}-valueStateDesc` : \"\";\n }\n\n get readOnlyStateTextId(): string {\n return this.readonly ? `${this._id}-stateReadOnlyDesc` : \"\";\n }\n\n get accInfo(): AccInfo {\n return {\n \"ariaInvalid\": this.valueState === UDExValueState.Error ? \"true\" : undefined,\n \"ariaDescribedBy\": this.ariaDescribedBy ? this.ariaDescribedBy : this.ariaDescribedById || undefined,\n \"ariaLabelledBy\": this.accessibleNameRef || undefined,\n \"ariaLabel\": this.accessibleName || undefined,\n \"ariaHasPopup\": this._ariaHasPopup || undefined,\n };\n }\n\n get inputRole(): string | undefined {\n return this.isAutoCompleteDisabled ? \"presentation\" : undefined;\n }\n\n get isAutoCompleteDisabled(): boolean {\n return this.autocomplete === \"off\" || this.autocomplete === \"new-password\";\n }\n\n handleKeydown(e: KeyboardEvent): void {\n e.stopPropagation();\n this.fireDecoratorEvent(\"keydown\", { keyboardEvent: e });\n }\n\n handleChange = (): void => {\n this.fireDecoratorEvent(\"change\");\n };\n\n handleInput = (inputEvent: InputEvent) => {\n this.value = (inputEvent.target as HTMLInputElement)?.value;\n };\n\n handleClick = (): void => {\n if (!isDesktop()) {\n this._isTouched = true;\n }\n };\n\n handleFocus = (): void => {\n if (!this.disabled && !this.readonly && !this.displayonly) {\n this.labelActiveClass = this._labelActiveClassName;\n this.active = true;\n }\n };\n\n handleBlur = (): void => {\n this.active = false;\n\n if (this.value) {\n this.labelActiveClass = this._labelActiveClassName;\n } else {\n this.labelActiveClass = \"\";\n }\n this._isTouched = false;\n };\n\n handleIconClick(): void {\n this.fireDecoratorEvent(\"click-icon\");\n }\n\n onBeforeRendering(): void {\n if ((this.value || this.active) && this.labelActiveClass === \"\") {\n this.labelActiveClass = this._labelActiveClassName;\n } else if (!this.active && !this.value && this.labelActiveClass.length) {\n this.labelActiveClass = \"\";\n }\n\n this.isInputReadonly = this.readonly || this.displayonly;\n\n this.labelClasses = `udex-text-field__label ${this.labelActiveClass}`;\n }\n\n onAfterRendering(): void {\n const directionStyles: string = window\n .getComputedStyle(this)\n .getPropertyValue(\"direction\");\n\n if (!directionStyles) {\n this.direction = \"ltr\";\n } else {\n this.direction = directionStyles;\n }\n }\n\n get readonlyNotDisabled(): boolean {\n return this.isInputReadonly && !this.disabled;\n }\n}\n\nUDExTextField.define();\n\nexport default UDExTextField;\n"]}
|
package/dist/Toast.js
CHANGED
package/dist/Toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../src/Toast.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,KAAK,MAAM,kCAAkC,CAAC;AACrD,OAAO,IAAI,MAAM,iCAAiC,CAAC;AACnD,OAAO,8CAA8C,CAAC;AACtD,OAAO,wCAAwC,CAAC;AAChD,OAAO,wCAAwC,CAAC;AAChD,OAAO,0CAA0C,CAAC;AAClD,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,UAAU,MAAM,6CAA6C,CAAC;AACrE,OAAO,aAAa,MAAM,4CAA4C,CAAC;AAEvE,SAAS;AACT,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;IACnB,s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QACvB,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC;KACjC,CAAC;GACI,SAAS,CAqEd;AAED,SAAS,CAAC,MAAM,EAAE,CAAC;AAEnB,eAAe,SAAS,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport Toast from \"@ui5/webcomponents/dist/Toast.js\";\nimport Icon from \"@ui5/webcomponents/dist/Icon.js\";\nimport \"@ui5/webcomponents-icons/dist/sys-enter-2.js\";\nimport \"@ui5/webcomponents-icons/dist/error.js\";\nimport \"@ui5/webcomponents-icons/dist/alert.js\";\nimport \"@ui5/webcomponents-icons/dist/decline.js\";\nimport UDExButton from \"./Button.js\";\nimport IconDesign from \"@ui5/webcomponents/dist/types/IconDesign.js\";\nimport ToastTemplate from \"./generated/templates/ToastTemplate.lit.js\";\n\n// Styles\nimport ToastCss from \"./generated/themes/Toast.css.js\";\n\nexport enum UDExToastValueState {\n Action = \"Action\",\n Success = \"Success\",\n Warning = \"Warning\",\n Error = \"Error\"\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-toast</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Toast.js\";</code>\n *\n * @constructor\n * @extends Toast\n * @public\n */\n@customElement({\n tag: \"udex-toast\",\n renderer: litRender,\n styles: [Toast.styles, ToastCss],\n template: ToastTemplate,\n dependencies: [Icon, UDExButton],\n})\nclass UDExToast extends Toast {\n /**\n * Defines design state of component\n *\n * @public\n * @default \"Action\"\n */\n @property()\n valueState: `${UDExToastValueState}` = UDExToastValueState.Action;\n\n /**\n * Defines if close icon should be visible\n *\n * @public\n * @default false\n */\n @property({ type: Boolean })\n showCloseIcon!: boolean;\n\n /**\n * Indicates whether the component is open (visible).\n * @default false\n * @public\n * @since 2.0.0\n */\n @property({ type: Boolean })\n open = false;\n\n onEnterDOM(): void {\n super.onEnterDOM();\n if (isDesktop()) {\n this.setAttribute(\"desktop\", \"\");\n }\n }\n\n get withIcon(): boolean {\n return this.valueState !== UDExToastValueState.Action;\n }\n\n get iconName(): string {\n switch (this.valueState) {\n case UDExToastValueState.Success:\n return \"sys-enter-2\";\n case UDExToastValueState.Error:\n return \"error\";\n case UDExToastValueState.Warning:\n return \"alert\";\n default:\n return \"\";\n }\n }\n\n get iconDesign(): IconDesign {\n switch (this.valueState) {\n case UDExToastValueState.Success:\n return IconDesign.Positive;\n case UDExToastValueState.Error:\n return IconDesign.Negative;\n case UDExToastValueState.Warning:\n return IconDesign.Critical;\n default:\n return IconDesign.Default;\n }\n }\n\n closeToast() {\n this.open = false;\n this.fireDecoratorEvent(\"close\");\n }\n}\n\nUDExToast.define();\n\nexport default UDExToast;\n"]}
|
package/dist/Upload.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
|
2
2
|
import type { ResizeObserverCallback } from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
|
3
3
|
import type { FileUploaderChangeEventDetail } from "@ui5/webcomponents/dist/FileUploader.js";
|
|
4
4
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
5
|
-
import
|
|
5
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
6
6
|
import UDExUploadItem from "./UploadItem.js";
|
|
7
7
|
import type FileData from "./types/FileData.js";
|
|
8
8
|
type UDExUploadBaseEventDetail = {
|
package/dist/Upload.js
CHANGED
|
@@ -16,7 +16,7 @@ import FileUploader from "@ui5/webcomponents/dist/FileUploader.js";
|
|
|
16
16
|
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
17
17
|
import { UPLOAD_BUTTON_LABEL } from "./generated/i18n/i18n-defaults.js";
|
|
18
18
|
import UDExButton from "./Button.js";
|
|
19
|
-
import
|
|
19
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
20
20
|
import UDExList from "./List.js";
|
|
21
21
|
import UDExUploadItem from "./UploadItem.js";
|
|
22
22
|
import UploadTemplate from "./generated/templates/UploadTemplate.lit.js";
|
package/dist/Upload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.js","sourceRoot":"","sources":["../src/Upload.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAElE,OAAO,aAAa,MAAM,wDAAwD,CAAC;AACnF,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,YAAY,MAAM,yCAAyC,CAAC;AAEnE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAGzE,SAAS;AACT,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,uBAAuB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;AAczE;;;;;;;;;;;;;;;;GAgBG;AA4CH,IAAM,UAAU,kBAAh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,CAAC;KACnE,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE7C;;;;OAIG;;IACF,KAAK,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExC;;;;OAIG;;IACF,KAAK,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExC;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE3C;;;;OAIG;;IACF,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAE7B,UAAU,CAoQf;AAED,UAAU,CAAC,MAAM,EAAE,CAAC;AAEpB,eAAe,UAAU,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\n\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { slot } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport FileUploader from \"@ui5/webcomponents/dist/FileUploader.js\";\nimport type { FileUploaderChangeEventDetail } from \"@ui5/webcomponents/dist/FileUploader.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport { UPLOAD_BUTTON_LABEL } from \"./generated/i18n/i18n-defaults.js\";\nimport UDExButton from \"./Button.js\";\nimport { UDExButtonSize } from \"./types/Button.js\";\nimport UDExList from \"./List.js\";\nimport UDExUploadItem from \"./UploadItem.js\";\nimport UploadTemplate from \"./generated/templates/UploadTemplate.lit.js\";\nimport type FileData from \"./types/FileData.js\";\n\n// Styles\nimport UploadCss from \"./generated/themes/Upload.css.js\";\nimport { BreakpointUtils } from \"./utils/Breakpoints.js\";\n\nconst convertBytesToMegabytes = (bytes: number) => (bytes / 1024) / 1024;\n\ntype UDExUploadBaseEventDetail = {\n files: Array<FileData>\n}\n\ntype UDExUploadFileDeleteEventDetail = {\n file: UDExUploadItem,\n}\n\ntype UDExUploadFileChangeEventDetail = {\n files: Array<UDExUploadItem>\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-upload</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Upload.js\";</code>\n *\n * @constructor\n * @extends UI5Element\n * @public\n */\n@customElement({\n tag: \"udex-upload\",\n renderer: litRender,\n styles: UploadCss,\n template: UploadTemplate,\n dependencies: [FileUploader, UDExList, UDExButton, UDExUploadItem],\n})\n\n/**\n * Triggered when the uploaded file exceeds the maximum allowed size.\n *\n * @public\n */\n@event(\"file-size-exceed\", { bubbles: true })\n\n/**\n * Triggered when the user deletes the uploaded item.\n *\n * @public\n */\n@event(\"file-delete\", { bubbles: true })\n\n/**\n * Triggered when the user uploads the item.\n *\n * @public\n */\n@event(\"file-change\", { bubbles: true })\n\n/**\n * Triggered when the user attempts to upload a duplicate file.\n *\n * @public\n */\n@event(\"file-duplicate\", { bubbles: true })\n\n/**\n * Triggered when the user attempts to upload a file.\n *\n * @public\n */\n@event(\"change\", { bubbles: true })\n\nclass UDExUpload extends UI5Element {\n eventDetails!: {\n \"file-size-exceed\": UDExUploadBaseEventDetail,\n \"file-delete\": UDExUploadFileDeleteEventDetail,\n \"file-change\": UDExUploadFileChangeEventDetail,\n \"file-duplicate\": UDExUploadBaseEventDetail,\n \"change\": FileUploaderChangeEventDetail\n };\n /**\n * Defines the title of the upload.\n *\n * @public\n */\n @property({ type: String })\n uploadTitle!: string;\n\n /**\n * Defines an optional upporting message shown in 2 cases, both in single uplaod mode.\n * 1) When more than one file is uploaded and the button for uploading is clicked.\n * 2) When the button for uploading is disabled and a file has already been uploaded.\n *\n * @public\n */\n @property({ type: String })\n supportingText!: string;\n\n /**\n * Defines if uploader is required.\n *\n * @public\n */\n @property({ type: Boolean })\n required: boolean = false;\n\n /**\n * Defines if the button for uploading is disabled.\n *\n * @public\n */\n @property({ type: Boolean })\n disabled: boolean = false;\n\n /**\n * Defines if uploading multiple files is allowed.\n *\n * @public\n */\n @property({ type: Boolean })\n multiple!: boolean;\n\n /**\n * Defines the acceptable file formats for uploading.\n *\n * @public\n */\n @property({ type: String })\n accept!: string;\n\n /**\n * Defines the maximum allowed size of the file for uploading.\n *\n * @default undefined\n * @public\n */\n @property({ type: Number })\n maxFileSize!: number;\n\n /**\n * Defines the additional text below the title of the upload.\n *\n * @public\n */\n @property({ type: String })\n additionalText!: string;\n\n /**\n * Defines the text in the upload button.\n *\n * @public\n */\n @property({ type: String })\n uploadButtonText!: string;\n\n /**\n * Defines if a file is already uploaded when multiple is false.\n *\n * @private\n */\n @property({ type: Boolean })\n _filesFull: boolean = false;\n\n /**\n * Defines the uploaded files.\n *\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true })\n items!: Array<UDExUploadItem>;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Large\"\n * @private\n */\n @property({ type: String })\n _buttonSize: `${UDExButtonSize}` = UDExButtonSize.Large;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _uploadedFiles: FileData[] = [];\n _handleResizeBound: ResizeObserverCallback;\n\n constructor() {\n super();\n this._handleResizeBound = this._handleResize.bind(this);\n }\n\n onEnterDOM(): void {\n ResizeHandler.register(this, this._handleResizeBound);\n }\n\n onExitDOM(): void {\n ResizeHandler.deregister(this, this._handleResizeBound);\n }\n\n onAfterRendering(): void {\n if (this._filesFull) {\n this._filesFull = this.fileNumberExceeded;\n }\n }\n\n handleUploadClick(e: Event) {\n this._filesFull = this.fileNumberExceeded;\n if (this.fileNumberExceeded) {\n e.preventDefault();\n }\n }\n\n handleUploadFile(e: CustomEvent<FileUploaderChangeEventDetail>) {\n const { files } = e.target as HTMLInputElement;\n if (!files?.length || this.fileNumberExceeded) {\n e.stopPropagation();\n }\n\n const duplicateFiles = this._getDuplicateFiles(files!);\n if (duplicateFiles.length) {\n e.stopPropagation();\n this.fireDecoratorEvent(\"file-duplicate\", {\n files: duplicateFiles,\n });\n this.fileUploader.value = \"\";\n return;\n }\n\n const newFiles = Array.from(files!).map(file => ({\n fileName: file.name,\n fileSize: file.size,\n }));\n\n this._uploadedFiles = [...this._uploadedFiles, ...newFiles];\n\n const exceededFilesData = this.maxFileSize ? this._getExceededFiles(files!) : [];\n if (exceededFilesData.length) {\n e.stopPropagation();\n this.fireDecoratorEvent(\"file-size-exceed\", {\n files: exceededFilesData,\n });\n return;\n }\n\n this.fireEvent(\"change\", { files });\n }\n\n handleSelectionChange(e: CustomEvent) {\n const uploadedFiles = e.detail.listItems as UDExUploadItem[];\n this.fireDecoratorEvent(\"file-change\", { files: uploadedFiles });\n this.fileUploader.value = \"\";\n }\n\n _handleResize() {\n this._buttonSize = BreakpointUtils.isAtMost(\"S\") ? UDExButtonSize.Medium : UDExButtonSize.Large;\n }\n\n handleRemoveFile(e: CustomEvent) {\n const removedFile = e.target as UDExUploadItem;\n this.fireDecoratorEvent(\"file-delete\", { file: removedFile });\n this._uploadedFiles = this._uploadedFiles.filter(file => file.fileName !== removedFile.fileName);\n this.fileUploader.value = \"\";\n }\n\n _isDuplicateFile(file: string): boolean {\n return this._uploadedFiles.some(uploadedFile => uploadedFile.fileName === file);\n }\n\n _getExceededFiles(files: FileList): Array<FileData> {\n const filesArray = Array.from(files);\n const exceededFiles: Array<FileData> = [];\n\n for (let i = 0; i < filesArray.length; i++) {\n const fileSize = convertBytesToMegabytes(filesArray[i].size);\n if (fileSize > this.maxFileSize) {\n exceededFiles.push({\n fileName: filesArray[i].name,\n fileSize,\n });\n }\n }\n return exceededFiles;\n }\n\n _getDuplicateFiles(files: FileList): Array<FileData> {\n const filesArray = Array.from(files);\n const duplicateFiles: Array<FileData> = [];\n\n for (let i = 0; i < filesArray.length; i++) {\n const fileSize = convertBytesToMegabytes(filesArray[i].size);\n const { name } = filesArray[i];\n\n const potentialDuplicate: FileData = {\n fileSize,\n fileName: name,\n };\n\n if (this._isDuplicateFile(potentialDuplicate.fileName)) {\n duplicateFiles.push(potentialDuplicate);\n }\n }\n\n return duplicateFiles;\n }\n\n get showSupportingText(): boolean {\n return this.disabled || this._filesFull;\n }\n\n get supportingTextClasses(): string {\n if (this.disabled && !!this.supportingText) {\n return \"udex-upload__supporting-text\";\n }\n return \"udex-upload__supporting-error-text\";\n }\n\n get fileUploader(): HTMLInputElement {\n const uploader = this.shadowRoot!.querySelector<FileUploader>(\"[ui5-file-uploader]\")!;\n return uploader.shadowRoot!.querySelector(\"input\")!;\n }\n\n get uploadButtonAriaLabel(): string {\n return UDExUpload.i18nBundle.getText(UPLOAD_BUTTON_LABEL);\n }\n\n get listBusy(): boolean {\n return !this.items.length;\n }\n\n get fileNumberExceeded(): boolean {\n return !this.multiple && this.items.length >= 1;\n }\n}\n\nUDExUpload.define();\n\nexport default UDExUpload;\n"]}
|
|
1
|
+
{"version":3,"file":"Upload.js","sourceRoot":"","sources":["../src/Upload.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAElE,OAAO,aAAa,MAAM,wDAAwD,CAAC;AACnF,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,YAAY,MA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,MAAM,EAAE,CAAC;kDACD;AAQxB;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDACC;AAQ1B;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACE;AAQ5B;IADD,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;yCACb;AAS9B;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAC+B;AAGnD;IADN,IAAI,CAAC,yBAAyB,CAAC;oCACF;AA7G1B,UAAU;IA3Cf,aAAa,CAAC;QACb,GAAG,EAAE,aAAa;QAClB,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,cAAc;QACxB,YAAY,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,CAAC;KACnE,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE7C;;;;OAIG;;IACF,KAAK,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExC;;;;OAIG;;IACF,KAAK,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAExC;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE3C;;;;OAIG;;IACF,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAE7B,UAAU,CAoQf;AAED,UAAU,CAAC,MAAM,EAAE,CAAC;AAEpB,eAAe,UAAU,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\n\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { slot } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport FileUploader from \"@ui5/webcomponents/dist/FileUploader.js\";\nimport type { FileUploaderChangeEventDetail } from \"@ui5/webcomponents/dist/FileUploader.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport { UPLOAD_BUTTON_LABEL } from \"./generated/i18n/i18n-defaults.js\";\nimport UDExButton from \"./Button.js\";\nimport UDExButtonSize from \"./types/ButtonSize.js\";\nimport UDExList from \"./List.js\";\nimport UDExUploadItem from \"./UploadItem.js\";\nimport UploadTemplate from \"./generated/templates/UploadTemplate.lit.js\";\nimport type FileData from \"./types/FileData.js\";\n\n// Styles\nimport UploadCss from \"./generated/themes/Upload.css.js\";\nimport { BreakpointUtils } from \"./utils/Breakpoints.js\";\n\nconst convertBytesToMegabytes = (bytes: number) => (bytes / 1024) / 1024;\n\ntype UDExUploadBaseEventDetail = {\n files: Array<FileData>\n}\n\ntype UDExUploadFileDeleteEventDetail = {\n file: UDExUploadItem,\n}\n\ntype UDExUploadFileChangeEventDetail = {\n files: Array<UDExUploadItem>\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-upload</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Upload.js\";</code>\n *\n * @constructor\n * @extends UI5Element\n * @public\n */\n@customElement({\n tag: \"udex-upload\",\n renderer: litRender,\n styles: UploadCss,\n template: UploadTemplate,\n dependencies: [FileUploader, UDExList, UDExButton, UDExUploadItem],\n})\n\n/**\n * Triggered when the uploaded file exceeds the maximum allowed size.\n *\n * @public\n */\n@event(\"file-size-exceed\", { bubbles: true })\n\n/**\n * Triggered when the user deletes the uploaded item.\n *\n * @public\n */\n@event(\"file-delete\", { bubbles: true })\n\n/**\n * Triggered when the user uploads the item.\n *\n * @public\n */\n@event(\"file-change\", { bubbles: true })\n\n/**\n * Triggered when the user attempts to upload a duplicate file.\n *\n * @public\n */\n@event(\"file-duplicate\", { bubbles: true })\n\n/**\n * Triggered when the user attempts to upload a file.\n *\n * @public\n */\n@event(\"change\", { bubbles: true })\n\nclass UDExUpload extends UI5Element {\n eventDetails!: {\n \"file-size-exceed\": UDExUploadBaseEventDetail,\n \"file-delete\": UDExUploadFileDeleteEventDetail,\n \"file-change\": UDExUploadFileChangeEventDetail,\n \"file-duplicate\": UDExUploadBaseEventDetail,\n \"change\": FileUploaderChangeEventDetail\n };\n /**\n * Defines the title of the upload.\n *\n * @public\n */\n @property({ type: String })\n uploadTitle!: string;\n\n /**\n * Defines an optional upporting message shown in 2 cases, both in single uplaod mode.\n * 1) When more than one file is uploaded and the button for uploading is clicked.\n * 2) When the button for uploading is disabled and a file has already been uploaded.\n *\n * @public\n */\n @property({ type: String })\n supportingText!: string;\n\n /**\n * Defines if uploader is required.\n *\n * @public\n */\n @property({ type: Boolean })\n required: boolean = false;\n\n /**\n * Defines if the button for uploading is disabled.\n *\n * @public\n */\n @property({ type: Boolean })\n disabled: boolean = false;\n\n /**\n * Defines if uploading multiple files is allowed.\n *\n * @public\n */\n @property({ type: Boolean })\n multiple!: boolean;\n\n /**\n * Defines the acceptable file formats for uploading.\n *\n * @public\n */\n @property({ type: String })\n accept!: string;\n\n /**\n * Defines the maximum allowed size of the file for uploading.\n *\n * @default undefined\n * @public\n */\n @property({ type: Number })\n maxFileSize!: number;\n\n /**\n * Defines the additional text below the title of the upload.\n *\n * @public\n */\n @property({ type: String })\n additionalText!: string;\n\n /**\n * Defines the text in the upload button.\n *\n * @public\n */\n @property({ type: String })\n uploadButtonText!: string;\n\n /**\n * Defines if a file is already uploaded when multiple is false.\n *\n * @private\n */\n @property({ type: Boolean })\n _filesFull: boolean = false;\n\n /**\n * Defines the uploaded files.\n *\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true })\n items!: Array<UDExUploadItem>;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Large\"\n * @private\n */\n @property({ type: String })\n _buttonSize: `${UDExButtonSize}` = UDExButtonSize.Large;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _uploadedFiles: FileData[] = [];\n _handleResizeBound: ResizeObserverCallback;\n\n constructor() {\n super();\n this._handleResizeBound = this._handleResize.bind(this);\n }\n\n onEnterDOM(): void {\n ResizeHandler.register(this, this._handleResizeBound);\n }\n\n onExitDOM(): void {\n ResizeHandler.deregister(this, this._handleResizeBound);\n }\n\n onAfterRendering(): void {\n if (this._filesFull) {\n this._filesFull = this.fileNumberExceeded;\n }\n }\n\n handleUploadClick(e: Event) {\n this._filesFull = this.fileNumberExceeded;\n if (this.fileNumberExceeded) {\n e.preventDefault();\n }\n }\n\n handleUploadFile(e: CustomEvent<FileUploaderChangeEventDetail>) {\n const { files } = e.target as HTMLInputElement;\n if (!files?.length || this.fileNumberExceeded) {\n e.stopPropagation();\n }\n\n const duplicateFiles = this._getDuplicateFiles(files!);\n if (duplicateFiles.length) {\n e.stopPropagation();\n this.fireDecoratorEvent(\"file-duplicate\", {\n files: duplicateFiles,\n });\n this.fileUploader.value = \"\";\n return;\n }\n\n const newFiles = Array.from(files!).map(file => ({\n fileName: file.name,\n fileSize: file.size,\n }));\n\n this._uploadedFiles = [...this._uploadedFiles, ...newFiles];\n\n const exceededFilesData = this.maxFileSize ? this._getExceededFiles(files!) : [];\n if (exceededFilesData.length) {\n e.stopPropagation();\n this.fireDecoratorEvent(\"file-size-exceed\", {\n files: exceededFilesData,\n });\n return;\n }\n\n this.fireEvent(\"change\", { files });\n }\n\n handleSelectionChange(e: CustomEvent) {\n const uploadedFiles = e.detail.listItems as UDExUploadItem[];\n this.fireDecoratorEvent(\"file-change\", { files: uploadedFiles });\n this.fileUploader.value = \"\";\n }\n\n _handleResize() {\n this._buttonSize = BreakpointUtils.isAtMost(\"S\") ? UDExButtonSize.Medium : UDExButtonSize.Large;\n }\n\n handleRemoveFile(e: CustomEvent) {\n const removedFile = e.target as UDExUploadItem;\n this.fireDecoratorEvent(\"file-delete\", { file: removedFile });\n this._uploadedFiles = this._uploadedFiles.filter(file => file.fileName !== removedFile.fileName);\n this.fileUploader.value = \"\";\n }\n\n _isDuplicateFile(file: string): boolean {\n return this._uploadedFiles.some(uploadedFile => uploadedFile.fileName === file);\n }\n\n _getExceededFiles(files: FileList): Array<FileData> {\n const filesArray = Array.from(files);\n const exceededFiles: Array<FileData> = [];\n\n for (let i = 0; i < filesArray.length; i++) {\n const fileSize = convertBytesToMegabytes(filesArray[i].size);\n if (fileSize > this.maxFileSize) {\n exceededFiles.push({\n fileName: filesArray[i].name,\n fileSize,\n });\n }\n }\n return exceededFiles;\n }\n\n _getDuplicateFiles(files: FileList): Array<FileData> {\n const filesArray = Array.from(files);\n const duplicateFiles: Array<FileData> = [];\n\n for (let i = 0; i < filesArray.length; i++) {\n const fileSize = convertBytesToMegabytes(filesArray[i].size);\n const { name } = filesArray[i];\n\n const potentialDuplicate: FileData = {\n fileSize,\n fileName: name,\n };\n\n if (this._isDuplicateFile(potentialDuplicate.fileName)) {\n duplicateFiles.push(potentialDuplicate);\n }\n }\n\n return duplicateFiles;\n }\n\n get showSupportingText(): boolean {\n return this.disabled || this._filesFull;\n }\n\n get supportingTextClasses(): string {\n if (this.disabled && !!this.supportingText) {\n return \"udex-upload__supporting-text\";\n }\n return \"udex-upload__supporting-error-text\";\n }\n\n get fileUploader(): HTMLInputElement {\n const uploader = this.shadowRoot!.querySelector<FileUploader>(\"[ui5-file-uploader]\")!;\n return uploader.shadowRoot!.querySelector(\"input\")!;\n }\n\n get uploadButtonAriaLabel(): string {\n return UDExUpload.i18nBundle.getText(UPLOAD_BUTTON_LABEL);\n }\n\n get listBusy(): boolean {\n return !this.items.length;\n }\n\n get fileNumberExceeded(): boolean {\n return !this.multiple && this.items.length >= 1;\n }\n}\n\nUDExUpload.define();\n\nexport default UDExUpload;\n"]}
|
package/dist/UploadItem.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
|
|
|
3
3
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
4
4
|
import UDExListItem from "./ListItem.js";
|
|
5
5
|
import UDExLink from "./Link.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
7
|
+
import UDExFileUploadState from "./types/FileUploadState.js";
|
|
8
8
|
/**
|
|
9
9
|
* @class
|
|
10
10
|
*
|
|
@@ -53,7 +53,7 @@ declare class UDExUploadItem extends UDExListItem {
|
|
|
53
53
|
* @default "Uploaded"
|
|
54
54
|
* @public
|
|
55
55
|
*/
|
|
56
|
-
uploadState: `${
|
|
56
|
+
uploadState: `${UDExFileUploadState}`;
|
|
57
57
|
/**
|
|
58
58
|
* Slot for information about the uploaded file.
|
|
59
59
|
*
|
package/dist/UploadItem.js
CHANGED
|
@@ -19,11 +19,11 @@ import UDExListItem from "./ListItem.js";
|
|
|
19
19
|
import UDExProgressBar from "./ProgressBar.js";
|
|
20
20
|
import UDExLink from "./Link.js";
|
|
21
21
|
import UDExButton from "./Button.js";
|
|
22
|
-
import
|
|
22
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
23
23
|
import UploadItemTemplate from "./generated/templates/UploadItemTemplate.lit.js";
|
|
24
24
|
// Styles
|
|
25
25
|
import UploadItemCss from "./generated/themes/UploadItem.css.js";
|
|
26
|
-
import
|
|
26
|
+
import UDExFileUploadState from "./types/FileUploadState.js";
|
|
27
27
|
const BreakpointSizeS = 979;
|
|
28
28
|
const BreakpointSizeM = 1279;
|
|
29
29
|
/**
|
|
@@ -52,7 +52,7 @@ let UDExUploadItem = UDExUploadItem_1 = class UDExUploadItem extends UDExListIte
|
|
|
52
52
|
* @default "Uploaded"
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
this.uploadState =
|
|
55
|
+
this.uploadState = UDExFileUploadState.Uploaded;
|
|
56
56
|
this._handleResizeBound = this._handleResize.bind(this);
|
|
57
57
|
}
|
|
58
58
|
onEnterDOM() {
|
|
@@ -84,7 +84,7 @@ let UDExUploadItem = UDExUploadItem_1 = class UDExUploadItem extends UDExListIte
|
|
|
84
84
|
_handleResize() {
|
|
85
85
|
this._buttonSize = window.innerWidth <= BreakpointSizeS ? UDExButtonSize.Medium : UDExButtonSize.Large;
|
|
86
86
|
this._breakpointL = window.innerWidth > BreakpointSizeM;
|
|
87
|
-
this._breakpointM = !this._breakpointL ? true : !this._breakpointL && this.uploadState ===
|
|
87
|
+
this._breakpointM = !this._breakpointL ? true : !this._breakpointL && this.uploadState === UDExFileUploadState.Uploaded;
|
|
88
88
|
}
|
|
89
89
|
get fileLinkComponent() {
|
|
90
90
|
return this.shadowRoot.querySelector("[udex-link]");
|
|
@@ -93,25 +93,25 @@ let UDExUploadItem = UDExUploadItem_1 = class UDExUploadItem extends UDExListIte
|
|
|
93
93
|
return UDExUploadItem_1.i18nBundle.getText(REMOVE_FILE_TEXT);
|
|
94
94
|
}
|
|
95
95
|
get showUploadProgress() {
|
|
96
|
-
return this.uploadState ===
|
|
96
|
+
return this.uploadState === UDExFileUploadState.Error || this.uploadState === UDExFileUploadState.Uploading;
|
|
97
97
|
}
|
|
98
98
|
get uploadProgressState() {
|
|
99
|
-
if (this.uploadState ===
|
|
99
|
+
if (this.uploadState === UDExFileUploadState.Uploading) {
|
|
100
100
|
return ValueState.Information;
|
|
101
101
|
}
|
|
102
102
|
return ValueState.Negative;
|
|
103
103
|
}
|
|
104
104
|
get uploadStatus() {
|
|
105
|
-
if (this.uploadState ===
|
|
105
|
+
if (this.uploadState === UDExFileUploadState.Uploading) {
|
|
106
106
|
return `${UDExUploadItem_1.i18nBundle.getText(UPLOADING_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;
|
|
107
107
|
}
|
|
108
108
|
return `${UDExUploadItem_1.i18nBundle.getText(TERMINATED_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;
|
|
109
109
|
}
|
|
110
110
|
get fileInteractive() {
|
|
111
|
-
return this.uploadState ===
|
|
111
|
+
return this.uploadState === UDExFileUploadState.Uploaded;
|
|
112
112
|
}
|
|
113
113
|
get additionalInfoClasses() {
|
|
114
|
-
return `udex-upload-item__info ${this.uploadState ===
|
|
114
|
+
return `udex-upload-item__info ${this.uploadState === UDExFileUploadState.Error ? "udex-upload-item__error" : ""}`;
|
|
115
115
|
}
|
|
116
116
|
get uploadItemClasses() {
|
|
117
117
|
return this.uploadState === "Uploaded" ? "udex-upload-item__info-uploaded" : "";
|
package/dist/UploadItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItem.js","sourceRoot":"","sources":["../src/UploadItem.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAElE,OAAO,aAAa,MAAM,wDAAwD,CAAC;AACnF,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,UAAU,MAAM,kDAAkD,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAAE,0BAA0B,GACxD,MAAM,mCAAmC,CAAC;AAC3C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,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E1B,cAAc;IAfnB,aAAa,CAAC;QACb,GAAG,EAAE,kBAAkB;QACvB,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,CAAC;KACpE,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAErC,cAAc,CAiKnB;AAED,cAAc,CAAC,MAAM,EAAE,CAAC;AAExB,eAAe,cAAc,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { slot } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n REMOVE_FILE_TEXT,\n TERMINATED_FILE_STATUS_TEXT, UPLOADING_FILE_STATUS_TEXT,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport UDExListItem from \"./ListItem.js\";\nimport UDExProgressBar from \"./ProgressBar.js\";\nimport UDExLink from \"./Link.js\";\nimport UDExButton from \"./Button.js\";\nimport { UDExButtonSize } from \"./types/Button.js\";\nimport UploadItemTemplate from \"./generated/templates/UploadItemTemplate.lit.js\";\n\n// Styles\nimport UploadItemCss from \"./generated/themes/UploadItem.css.js\";\nimport FileUploadState from \"./types/FileUploadState.js\";\n\nconst BreakpointSizeS: number = 979;\nconst BreakpointSizeM: number = 1279;\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-upload-item</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/UploadItem.js\";</code>\n *\n * @constructor\n * @extends UDExListItemBase\n * @public\n */\n@customElement({\n tag: \"udex-upload-item\",\n renderer: litRender,\n styles: UploadItemCss,\n template: UploadItemTemplate,\n dependencies: [UDExLink, UDExListItem, UDExProgressBar, UDExButton],\n})\n\n/**\n * Triggered when the upload item is deleted.\n *\n * @public\n */\n@event(\"request-delete\", { bubbles: true })\n\nclass UDExUploadItem extends UDExListItem {\n eventDetails!: {\n \"request-delete\": void\n } & UDExListItem[\"eventDetails\"];\n /**\n * Defines the name of the uploaded file.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n fileName!: string;\n\n /**\n * Defines the link of the uploaded file.\n *\n * @default undefined\n * @public\n */\n @property({ type: String })\n fileLink?: string;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default 0\n * @public\n */\n @property({ type: Number })\n uploadPercentage!: number;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Uploaded\"\n * @public\n */\n @property()\n uploadState: `${FileUploadState}` = FileUploadState.Uploaded;\n\n /**\n * Slot for information about the uploaded file.\n *\n * @slot\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true }) uploadInfo!: Array<HTMLElement>;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Large\"\n * @private\n */\n @property()\n _buttonSize!: `${UDExButtonSize}`;\n\n /**\n * Defines if the screen is at the M breakpoint.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _breakpointM!: boolean;\n\n /**\n * Defines if the screen is at the L breakpoint.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _breakpointL!: boolean;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _handleResizeBound: ResizeObserverCallback;\n\n constructor() {\n super();\n this._handleResizeBound = this._handleResize.bind(this);\n }\n\n onEnterDOM(): void {\n ResizeHandler.register(this, this._handleResizeBound);\n this.fireDecoratorEvent(\"item-press\", {\n selected: false,\n item: this,\n });\n }\n\n onExitDOM(): void {\n ResizeHandler.deregister(this, this._handleResizeBound);\n }\n\n onAfterRendering(): void {\n const fileLink = this.fileLinkComponent;\n if (fileLink) {\n fileLink._setCustomAttributes([{ attribute: \"download\", value: \"true\" }]);\n }\n }\n\n handleButtonClick(e: Event) {\n e.stopImmediatePropagation();\n this.fireDecoratorEvent(\"request-delete\");\n }\n\n handleButtonKeydown(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n e.stopImmediatePropagation();\n this.fireDecoratorEvent(\"request-delete\");\n }\n }\n\n _handleResize() {\n this._buttonSize = window.innerWidth <= BreakpointSizeS ? UDExButtonSize.Medium : UDExButtonSize.Large;\n this._breakpointL = window.innerWidth > BreakpointSizeM;\n this._breakpointM = !this._breakpointL ? true : !this._breakpointL && this.uploadState === FileUploadState.Uploaded;\n }\n\n get fileLinkComponent(): UDExLink {\n return this.shadowRoot!.querySelector<UDExLink>(\"[udex-link]\")!;\n }\n\n get removeButtonAccessibleName(): string {\n return UDExUploadItem.i18nBundle.getText(REMOVE_FILE_TEXT);\n }\n\n get showUploadProgress(): boolean {\n return this.uploadState === FileUploadState.Error || this.uploadState === FileUploadState.Uploading;\n }\n\n get uploadProgressState(): ValueState {\n if (this.uploadState === FileUploadState.Uploading) {\n return ValueState.Information;\n }\n\n return ValueState.Negative;\n }\n\n get uploadStatus(): string {\n if (this.uploadState === FileUploadState.Uploading) {\n return `${UDExUploadItem.i18nBundle.getText(UPLOADING_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;\n }\n\n return `${UDExUploadItem.i18nBundle.getText(TERMINATED_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;\n }\n\n get fileInteractive(): boolean {\n return this.uploadState === FileUploadState.Uploaded;\n }\n\n get additionalInfoClasses(): string {\n return `udex-upload-item__info ${this.uploadState === FileUploadState.Error ? \"udex-upload-item__error\" : \"\"}`;\n }\n\n get uploadItemClasses(): string {\n return this.uploadState === \"Uploaded\" ? \"udex-upload-item__info-uploaded\" : \"\";\n }\n}\n\nUDExUploadItem.define();\n\nexport default UDExUploadItem;\n"]}
|
|
1
|
+
{"version":3,"file":"UploadItem.js","sourceRoot":"","sources":["../src/UploadItem.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAElE,OAAO,aAAa,MAAM,wDAAwD,CAAC;AACnF,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,UAAU,MAAM,kDAAkD,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAAE,0BAA0B,GACxD,MAAM,mCAAmC,CAAC;AAC3C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,kBAAkB,MAAM,iDAAiD,CAAC;AAEjF,SAAS;AACT,OAAO,aAAa,MAAM,sCAAsC,CAAC;AACjE,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAE7D,MAAM,eAAe,GAAW,GAAG,CAAC;AACpC,MAAM,eAAe,GAAW,IAAI,CAAC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AAc,CAAC,MAAM,EAAE,CAAC;AAExB,eAAe,cAAc,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { slot } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n REMOVE_FILE_TEXT,\n TERMINATED_FILE_STATUS_TEXT, UPLOADING_FILE_STATUS_TEXT,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport UDExListItem from \"./ListItem.js\";\nimport UDExProgressBar from \"./ProgressBar.js\";\nimport UDExLink from \"./Link.js\";\nimport UDExButton from \"./Button.js\";\nimport UDExButtonSize from \"./types/ButtonSize.js\";\nimport UploadItemTemplate from \"./generated/templates/UploadItemTemplate.lit.js\";\n\n// Styles\nimport UploadItemCss from \"./generated/themes/UploadItem.css.js\";\nimport UDExFileUploadState from \"./types/FileUploadState.js\";\n\nconst BreakpointSizeS: number = 979;\nconst BreakpointSizeM: number = 1279;\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-upload-item</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/UploadItem.js\";</code>\n *\n * @constructor\n * @extends UDExListItemBase\n * @public\n */\n@customElement({\n tag: \"udex-upload-item\",\n renderer: litRender,\n styles: UploadItemCss,\n template: UploadItemTemplate,\n dependencies: [UDExLink, UDExListItem, UDExProgressBar, UDExButton],\n})\n\n/**\n * Triggered when the upload item is deleted.\n *\n * @public\n */\n@event(\"request-delete\", { bubbles: true })\n\nclass UDExUploadItem extends UDExListItem {\n eventDetails!: {\n \"request-delete\": void\n } & UDExListItem[\"eventDetails\"];\n /**\n * Defines the name of the uploaded file.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n fileName!: string;\n\n /**\n * Defines the link of the uploaded file.\n *\n * @default undefined\n * @public\n */\n @property({ type: String })\n fileLink?: string;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default 0\n * @public\n */\n @property({ type: Number })\n uploadPercentage!: number;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Uploaded\"\n * @public\n */\n @property()\n uploadState: `${UDExFileUploadState}` = UDExFileUploadState.Uploaded;\n\n /**\n * Slot for information about the uploaded file.\n *\n * @slot\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true }) uploadInfo!: Array<HTMLElement>;\n\n /**\n * Defines the percentage of the upload.\n *\n * @default \"Large\"\n * @private\n */\n @property()\n _buttonSize!: `${UDExButtonSize}`;\n\n /**\n * Defines if the screen is at the M breakpoint.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _breakpointM!: boolean;\n\n /**\n * Defines if the screen is at the L breakpoint.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean })\n _breakpointL!: boolean;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _handleResizeBound: ResizeObserverCallback;\n\n constructor() {\n super();\n this._handleResizeBound = this._handleResize.bind(this);\n }\n\n onEnterDOM(): void {\n ResizeHandler.register(this, this._handleResizeBound);\n this.fireDecoratorEvent(\"item-press\", {\n selected: false,\n item: this,\n });\n }\n\n onExitDOM(): void {\n ResizeHandler.deregister(this, this._handleResizeBound);\n }\n\n onAfterRendering(): void {\n const fileLink = this.fileLinkComponent;\n if (fileLink) {\n fileLink._setCustomAttributes([{ attribute: \"download\", value: \"true\" }]);\n }\n }\n\n handleButtonClick(e: Event) {\n e.stopImmediatePropagation();\n this.fireDecoratorEvent(\"request-delete\");\n }\n\n handleButtonKeydown(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n e.stopImmediatePropagation();\n this.fireDecoratorEvent(\"request-delete\");\n }\n }\n\n _handleResize() {\n this._buttonSize = window.innerWidth <= BreakpointSizeS ? UDExButtonSize.Medium : UDExButtonSize.Large;\n this._breakpointL = window.innerWidth > BreakpointSizeM;\n this._breakpointM = !this._breakpointL ? true : !this._breakpointL && this.uploadState === UDExFileUploadState.Uploaded;\n }\n\n get fileLinkComponent(): UDExLink {\n return this.shadowRoot!.querySelector<UDExLink>(\"[udex-link]\")!;\n }\n\n get removeButtonAccessibleName(): string {\n return UDExUploadItem.i18nBundle.getText(REMOVE_FILE_TEXT);\n }\n\n get showUploadProgress(): boolean {\n return this.uploadState === UDExFileUploadState.Error || this.uploadState === UDExFileUploadState.Uploading;\n }\n\n get uploadProgressState(): ValueState {\n if (this.uploadState === UDExFileUploadState.Uploading) {\n return ValueState.Information;\n }\n\n return ValueState.Negative;\n }\n\n get uploadStatus(): string {\n if (this.uploadState === UDExFileUploadState.Uploading) {\n return `${UDExUploadItem.i18nBundle.getText(UPLOADING_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;\n }\n\n return `${UDExUploadItem.i18nBundle.getText(TERMINATED_FILE_STATUS_TEXT)} ${this.uploadPercentage}%`;\n }\n\n get fileInteractive(): boolean {\n return this.uploadState === UDExFileUploadState.Uploaded;\n }\n\n get additionalInfoClasses(): string {\n return `udex-upload-item__info ${this.uploadState === UDExFileUploadState.Error ? \"udex-upload-item__error\" : \"\"}`;\n }\n\n get uploadItemClasses(): string {\n return this.uploadState === \"Uploaded\" ? \"udex-upload-item__info-uploaded\" : \"\";\n }\n}\n\nUDExUploadItem.define();\n\nexport default UDExUploadItem;\n"]}
|
package/dist/Wizard.d.ts
CHANGED
|
@@ -54,6 +54,24 @@ declare class UDExWizard extends UI5Wizard {
|
|
|
54
54
|
* @public
|
|
55
55
|
*/
|
|
56
56
|
indeterminate: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Defines aria-label of the wizard, read by screen readers with the first step.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
accessibleName: string;
|
|
63
|
+
/**
|
|
64
|
+
* Defines the title of the current step.
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
_currentStepTitle?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Defines the subtitle of the current step.
|
|
71
|
+
*
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
_currentStepSubTitle?: string;
|
|
57
75
|
/**
|
|
58
76
|
* Defines the current breakpoint.
|
|
59
77
|
*
|
|
@@ -66,12 +84,13 @@ declare class UDExWizard extends UI5Wizard {
|
|
|
66
84
|
_calcCurrentBreakpoint: () => void;
|
|
67
85
|
onEnterDOM(): void;
|
|
68
86
|
onExitDOM(): void;
|
|
69
|
-
onAfterRendering(): void;
|
|
70
87
|
_adjustHeaderOverflow: () => void;
|
|
71
88
|
switchSelectionFromOldToNewStep: (selectedStep: UDExWizardStep, stepToSelect: UDExWizardStep, stepToSelectIndex: number) => void;
|
|
72
89
|
getLastEnabledStepIndex: () => number;
|
|
73
90
|
get stepsInfo(): StepInfo[];
|
|
74
91
|
private _handleResize;
|
|
92
|
+
onAfterRendering(): void;
|
|
93
|
+
get effectiveAccessibleName(): string;
|
|
75
94
|
get slottedSteps(): UDExWizardStep[];
|
|
76
95
|
get stepsInHeaderDOM(): UDExWizardTab[];
|
|
77
96
|
get _steps(): UDExWizardStep[];
|
package/dist/Wizard.js
CHANGED
|
@@ -89,9 +89,6 @@ let UDExWizard = class UDExWizard extends UI5Wizard {
|
|
|
89
89
|
onExitDOM() {
|
|
90
90
|
ResizeHandler.deregister(this, this._handleResizeBound);
|
|
91
91
|
}
|
|
92
|
-
onAfterRendering() {
|
|
93
|
-
this._calcCurrentBreakpoint();
|
|
94
|
-
}
|
|
95
92
|
get stepsInfo() {
|
|
96
93
|
const lastEnabledStepIndex = this.getLastEnabledStepIndex();
|
|
97
94
|
const stepsCount = this.stepsCount;
|
|
@@ -102,12 +99,9 @@ let UDExWizard = class UDExWizard extends UI5Wizard {
|
|
|
102
99
|
return this.steps.map((step, idx) => {
|
|
103
100
|
const pos = idx + 1;
|
|
104
101
|
const hideSeparator = idx === stepsCount - 1 && !this.indeterminate;
|
|
105
|
-
const
|
|
106
|
-
?
|
|
107
|
-
: this.
|
|
108
|
-
const ariaLabel = (step.titleText
|
|
109
|
-
? `${pos} ${step.titleText} ${stepStateText}`
|
|
110
|
-
: `${this.navStepDefaultHeading} ${pos} ${stepStateText}`).trim();
|
|
102
|
+
const ariaLabel = (`${idx === 0 ? this.effectiveAccessibleName : ""} ${step.titleText
|
|
103
|
+
? `${pos} ${step.titleText}`
|
|
104
|
+
: `${this.navStepDefaultHeading} ${pos}`}`).trim();
|
|
111
105
|
const isAfterCurrent = idx > selectedStepIndex;
|
|
112
106
|
accInfo = {
|
|
113
107
|
"ariaSetsize": stepsCount,
|
|
@@ -138,6 +132,16 @@ let UDExWizard = class UDExWizard extends UI5Wizard {
|
|
|
138
132
|
_handleResize() {
|
|
139
133
|
this._calcCurrentBreakpoint();
|
|
140
134
|
}
|
|
135
|
+
onAfterRendering() {
|
|
136
|
+
this.attachStepsResizeObserver();
|
|
137
|
+
this._calcCurrentBreakpoint();
|
|
138
|
+
this.previouslySelectedStepIndex = this.selectedStepIndex;
|
|
139
|
+
this._currentStepTitle = this._steps[this.selectedStepIndex].titleText;
|
|
140
|
+
this._currentStepSubTitle = this._steps[this.selectedStepIndex].subtitleText;
|
|
141
|
+
}
|
|
142
|
+
get effectiveAccessibleName() {
|
|
143
|
+
return this.accessibleName || this.ariaLabelText;
|
|
144
|
+
}
|
|
141
145
|
get slottedSteps() {
|
|
142
146
|
return this.getSlottedNodes("steps");
|
|
143
147
|
}
|
|
@@ -163,6 +167,15 @@ __decorate([
|
|
|
163
167
|
__decorate([
|
|
164
168
|
property({ type: Boolean })
|
|
165
169
|
], UDExWizard.prototype, "indeterminate", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
property({ type: String })
|
|
172
|
+
], UDExWizard.prototype, "accessibleName", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
property({ type: String })
|
|
175
|
+
], UDExWizard.prototype, "_currentStepTitle", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
property({ type: String })
|
|
178
|
+
], UDExWizard.prototype, "_currentStepSubTitle", void 0);
|
|
166
179
|
__decorate([
|
|
167
180
|
property()
|
|
168
181
|
], UDExWizard.prototype, "_breakpoint", void 0);
|