lightning-base-components 1.21.2-alpha → 1.21.4-alpha
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/metadata/raptor.json +77 -1
- package/package.json +108 -15
- package/scopedImports/@salesforce-label-LightningDatatable.showActions.js +1 -1
- package/scopedImports/@salesforce-label-LightningForm.controllerFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.generalDependentFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.learnMore.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.okButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalCancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalSelect.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.currentStage.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.errorStage.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageComplete.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageNotStarted.js +1 -1
- package/scopedImports/@salesforce-label-LightningRichTextEditor.colorPicker.js +1 -0
- package/src/lightning/accordion/accordion-section.slds.css +3 -3
- package/src/lightning/accordion/accordion.slds.css +1 -2
- package/src/lightning/accordionSection/accordion-section.slds.css +3 -3
- package/src/lightning/accordionSection/accordionSection.js +3 -1
- package/src/lightning/accordionSection/button.slds.css +1 -1
- package/src/lightning/avatar/avatar.html +1 -0
- package/src/lightning/badge/badge.html +3 -3
- package/src/lightning/badge/badge.js +1 -0
- package/src/lightning/badge/badge.js-meta.xml +3 -0
- package/src/lightning/baseCombobox/base-combobox.slds.css +11 -6
- package/src/lightning/baseCombobox/baseCombobox.html +5 -2
- package/src/lightning/baseCombobox/baseCombobox.js +5 -18
- package/src/lightning/baseCombobox/baseCombobox.js-meta.xml +6 -0
- package/src/lightning/baseCombobox/input-text.slds.css +41 -68
- package/src/lightning/baseCombobox/keyboard.js +12 -4
- package/src/lightning/baseCombobox/listbox.slds.css +51 -99
- package/src/lightning/baseCombobox/spinner.slds.css +62 -62
- package/src/lightning/baseComboboxFormattedText/baseComboboxFormattedText.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/baseComboboxItem.js +10 -6
- package/src/lightning/baseComboboxItem/baseComboboxItem.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/listbox.slds.css +51 -99
- package/src/lightning/baseFormattedText/baseFormattedText.js +2 -2
- package/src/lightning/button/__docs__/button.md +2 -1
- package/src/lightning/button/button.js +5 -5
- package/src/lightning/button/button.slds.css +1 -1
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +1 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +1 -1
- package/src/lightning/buttonIcon/buttonIcon.html +1 -1
- package/src/lightning/buttonIcon/buttonIcon.js +18 -17
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +4 -2
- package/src/lightning/buttonIconStateful/button-icon.slds.css +1 -1
- package/src/lightning/buttonIconStateful/button.slds.css +1 -1
- package/src/lightning/buttonMenu/button-icon.slds.css +1 -1
- package/src/lightning/buttonMenu/button-menu.slds.css +8 -2
- package/src/lightning/buttonMenu/button.slds.css +1 -1
- package/src/lightning/buttonMenu/buttonMenu.css +5 -0
- package/src/lightning/buttonMenu/buttonMenu.js +2 -0
- package/src/lightning/buttonStateful/button-stateful.slds.css +6 -2
- package/src/lightning/buttonStateful/button.slds.css +1 -1
- package/src/lightning/buttonStateful/buttonStateful.js +4 -1
- package/src/lightning/calendar/calendar.js-meta.xml +6 -0
- package/src/lightning/calendar/calendar.slds.css +9 -2
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +22 -23
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +12 -0
- package/src/lightning/colorPickerCustom/input-text.slds.css +41 -68
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +9 -10
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +11 -1
- package/src/lightning/colorPickerPanel/popover.slds.css +0 -2
- package/src/lightning/combobox/combobox.html +1 -0
- package/src/lightning/combobox/combobox.slds.css +1 -2
- package/src/lightning/combobox/form-element.slds.css +54 -54
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.html +11 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.js +25 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/generateData.js +15 -0
- package/src/lightning/datatable/__examples__disabled/customDatatableWrapper/customDatatableWrapper.js +89 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +6 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +1 -16
- package/src/lightning/datatable/__examples__disabled/customDatatypeLink/customDatatypeLink.html +9 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +3 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +3 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeTable/customNumber.html +3 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumberEdit.html +2 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/deleteRow.html +3 -2
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/iconPill.html +1 -1
- package/src/lightning/datatable/{__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html → __examples__disabled/customNestedComponent/customNestedComponent.html} +2 -2
- package/src/lightning/datatable/__examples__disabled/customNestedComponent/customNestedComponent.js +12 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/customInput.html +4 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/myCustomTypeDatatable.js +17 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/nestedSimpleComponentParent.html +7 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.html +9 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.js +6 -0
- package/src/lightning/datatable/autoWidthStrategy.js +145 -217
- package/src/lightning/datatable/columnResizer.js +80 -190
- package/src/lightning/datatable/columnWidthManager.js +128 -243
- package/src/lightning/datatable/columns.js +192 -283
- package/src/lightning/datatable/datagrid.slds.css +187 -0
- package/src/lightning/datatable/datatable.js +647 -614
- package/src/lightning/datatable/errors.js +19 -28
- package/src/lightning/datatable/fixedWidthStrategy.js +27 -49
- package/src/lightning/datatable/headerActions.js +10 -42
- package/src/lightning/datatable/indexes.js +42 -0
- package/src/lightning/datatable/infiniteLoading.js +27 -46
- package/src/lightning/datatable/inlineEdit.js +311 -322
- package/src/lightning/datatable/keyboard.js +490 -510
- package/src/lightning/datatable/renderManager.js +10 -11
- package/src/lightning/datatable/resizeObserver.js +10 -67
- package/src/lightning/datatable/rowLevelActions.js +7 -6
- package/src/lightning/datatable/rowNumber.js +41 -79
- package/src/lightning/datatable/rowSelection.js +236 -291
- package/src/lightning/datatable/rowSelectionShared.js +26 -33
- package/src/lightning/datatable/rows.js +264 -476
- package/src/lightning/datatable/sort.js +27 -82
- package/src/lightning/datatable/templates/div/div.css +2 -57
- package/src/lightning/datatable/templates/div/div.html +25 -10
- package/src/lightning/datatable/templates/div/div.lbc.native.css +3 -0
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +80 -0
- package/src/lightning/datatable/templates/table/table.html +16 -5
- package/src/lightning/datatable/tree.js +17 -35
- package/src/lightning/datatable/types.js +10 -31
- package/src/lightning/datatable/utils.js +54 -29
- package/src/lightning/datatable/virtualization.js +2 -5
- package/src/lightning/datatable/widthManagerShared.js +24 -41
- package/src/lightning/datatable/wrapText.js +45 -77
- package/src/lightning/datepicker/datepicker.js +32 -9
- package/src/lightning/datepicker/datepicker.js-meta.xml +6 -0
- package/src/lightning/datepicker/form-element.slds.css +54 -54
- package/src/lightning/datepicker/input-text.slds.css +41 -68
- package/src/lightning/datetimepicker/datetimepicker.js-meta.xml +6 -0
- package/src/lightning/datetimepicker/form-element.slds.css +54 -54
- package/src/lightning/datetimepicker/input-text.slds.css +41 -68
- package/src/lightning/dualListbox/dual-listbox.slds.css +7 -2
- package/src/lightning/dualListbox/dualListbox.js +7 -8
- package/src/lightning/dualListbox/form-element.slds.css +54 -54
- package/src/lightning/dualListbox/listbox.slds.css +51 -99
- package/src/lightning/dynamicIcon/dynamic-icon-strength.slds.css +1 -2
- package/src/lightning/dynamicIcon/dynamic-icon-trend.slds.css +1 -2
- package/src/lightning/formattedDateTime/formattedDateTime.js +7 -62
- package/src/lightning/formattedDateTime/formattedDateTime.js-meta.xml +3 -0
- package/src/lightning/formattedLocation/formattedLocation.html +1 -3
- package/src/lightning/formattedLocation/formattedLocation.js +3 -25
- package/src/lightning/formattedLookup/events.js +2 -4
- package/src/lightning/formattedName/formattedName.js +3 -2
- package/src/lightning/formattedName/formattedName.js-meta.xml +3 -0
- package/src/lightning/formattedNumber/formattedNumber.js +5 -51
- package/src/lightning/formattedNumber/formattedNumber.js-meta.xml +3 -0
- package/src/lightning/formattedRichText/formattedRichText.js +5 -5
- package/src/lightning/formattedRichText/linkTextNodes.js +58 -0
- package/src/lightning/formattedRichText/richTextConfig.js +1 -0
- package/src/lightning/groupedCombobox/form-element.slds.css +54 -54
- package/src/lightning/groupedCombobox/grouped-combobox.slds.css +0 -2
- package/src/lightning/groupedCombobox/groupedCombobox.js-meta.xml +1 -1
- package/src/lightning/groupedCombobox/input-text.slds.css +41 -68
- package/src/lightning/helptext/button-icon.slds.css +1 -1
- package/src/lightning/helptext/form-element.slds.css +54 -54
- package/src/lightning/helptext/helptext.css +7 -0
- package/src/lightning/helptext/helptext.js +3 -4
- package/src/lightning/icon/icon.html +1 -1
- package/src/lightning/icon/icon.slds.css +12 -25
- package/src/lightning/input/form-element.slds.css +54 -54
- package/src/lightning/input/input.html +5 -0
- package/src/lightning/inputAddress/addressFormat.js +31 -4
- package/src/lightning/inputAddress/fieldsLayout.js +6 -0
- package/src/lightning/inputAddress/form-element.slds.css +54 -54
- package/src/lightning/inputAddress/input-address.slds.css +1 -2
- package/src/lightning/inputAddress/input-text.slds.css +41 -68
- package/src/lightning/inputAddress/inputAddress.html +19 -1
- package/src/lightning/inputAddress/inputAddress.js +75 -3
- package/src/lightning/inputAddress/inputAddress.js-meta.xml +3 -0
- package/src/lightning/inputLocation/form-element.slds.css +54 -54
- package/src/lightning/inputLocation/input-location.slds.css +1 -2
- package/src/lightning/inputLocation/input-text.slds.css +41 -68
- package/src/lightning/inputName/form-element.slds.css +54 -54
- package/src/lightning/inputName/input-text.slds.css +41 -68
- package/src/lightning/interactiveDialogBase/interactive-dialog-base.slds.css +0 -3
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.js-meta.xml +6 -0
- package/src/lightning/internationalizationLibrary/address/AddressFormat.js +553 -610
- package/src/lightning/lookupAddress/form-element.slds.css +54 -54
- package/src/lightning/lookupAddress/listbox.slds.css +51 -99
- package/src/lightning/lookupAddress/location.js +2 -0
- package/src/lightning/lookupAddress/lookup-address.slds.css +0 -2
- package/src/lightning/lookupAddress/lookupAddress.html +6 -1
- package/src/lightning/lookupAddress/lookupAddress.js +40 -10
- package/src/lightning/menuDivider/menu-divider.slds.css +0 -2
- package/src/lightning/menuItem/menu-item.slds.css +8 -2
- package/src/lightning/menuSubheader/menu-subheader.slds.css +1 -2
- package/src/lightning/modal/__docs__/modal.md +10 -1
- package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +3 -7
- package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +39 -133
- package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
- package/src/lightning/modal/modal.js +1 -1
- package/src/lightning/modalBase/modal-base.slds.css +3 -3
- package/src/lightning/modalBase/modalBase.html +15 -10
- package/src/lightning/modalBase/modalBase.js +131 -154
- package/src/lightning/modalBase/modalBase.js-meta.xml +6 -0
- package/src/lightning/modalBody/modal-body.slds.css +1 -2
- package/src/lightning/modalBody/modalBody.css +6 -0
- package/src/lightning/modalFooter/modal-footer.slds.css +2 -2
- package/src/lightning/modalFooter/modalFooter.js +0 -21
- package/src/lightning/modalHeader/modal-header.slds.css +1 -2
- package/src/lightning/modalHeader/modalHeader.html +16 -4
- package/src/lightning/modalHeader/modalHeader.js +61 -36
- package/src/lightning/overlay/overlay.js-meta.xml +6 -0
- package/src/lightning/pill/link.html +1 -0
- package/src/lightning/pill/pill.slds.css +32 -58
- package/src/lightning/pill/plain.html +1 -0
- package/src/lightning/pill/plainLink.html +1 -0
- package/src/lightning/pillContainer/button.slds.css +1 -1
- package/src/lightning/pillContainer/listbox.slds.css +51 -99
- package/src/lightning/pillContainer/pill-container.slds.css +6 -10
- package/src/lightning/pillContainer/pill.slds.css +32 -58
- package/src/lightning/popup/popover.slds.css +0 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +42 -0
- package/src/lightning/primitiveBubble/primitiveBubble.js-meta.xml +6 -0
- package/src/lightning/primitiveButton/primitiveButoon.js-meta.xml +6 -0
- package/src/lightning/primitiveCellCheckbox/checkbox.css +2 -0
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +16 -38
- package/src/lightning/primitiveCustomCell/primitiveCustomCell.js +26 -1
- package/src/lightning/primitiveDatatableCell/primitiveDatatableCell.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +13 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.css +1 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +19 -6
- package/src/lightning/primitiveHeaderFactory/selectableHeader.css +2 -0
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +3 -1
- package/src/lightning/primitiveIcon/icon.slds.css +12 -25
- package/src/lightning/primitiveIcon/primitiveIcon.js-meta.xml +6 -0
- package/src/lightning/primitiveIframe/primitiveIframe.js +3 -1
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +5 -2
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js-meta.xml +6 -0
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -4
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +5 -2
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js-meta.xml +6 -0
- package/src/lightning/primitiveInputColor/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputColor/input-color.slds.css +2 -3
- package/src/lightning/primitiveInputColor/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputColor/primitiveInputColor.js +5 -2
- package/src/lightning/primitiveInputColor/primitiveInputColor.js-meta.xml +6 -0
- package/src/lightning/primitiveInputFile/button.slds.css +1 -1
- package/src/lightning/primitiveInputFile/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputFile/input-file.slds.css +1 -4
- package/src/lightning/primitiveInputFile/primitiveInputFile.js +4 -2
- package/src/lightning/primitiveInputFile/primitiveInputFile.js-meta.xml +6 -0
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +4 -2
- package/src/lightning/primitiveInputSimple/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputSimple/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js-meta.xml +6 -0
- package/src/lightning/primitiveInputToggle/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputToggle/input-toggle.slds.css +50 -27
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +5 -2
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js-meta.xml +6 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.css +11 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +2 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +1 -0
- package/src/lightning/progressBar/progress-bar.slds.css +8 -10
- package/src/lightning/progressRing/progress-ring.slds.css +0 -23
- package/src/lightning/progressStep/base.html +5 -6
- package/src/lightning/progressStep/progressStep.js +15 -23
- package/src/lightning/prompt/__docs__/prompt.md +1 -1
- package/src/lightning/radioGroup/form-element.slds.css +54 -54
- package/src/lightning/radioGroup/radioGroup.html +1 -2
- package/src/lightning/radioGroup/radioGroup.js +1 -0
- package/src/lightning/routingService/routingService.js +31 -5
- package/src/lightning/select/form-element.slds.css +54 -54
- package/src/lightning/select/select.slds.css +4 -2
- package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +0 -2
- package/src/lightning/sldsCommon/sldsCommon.css +134 -98
- package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +1 -1
- package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +14 -13
- package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +95 -92
- package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +1 -1
- package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +77 -75
- package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +73 -73
- package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +552 -558
- package/src/lightning/sldsUtilsVisibility/sldsUtilsVisibility.css +5 -1
- package/src/lightning/spinner/spinner.slds.css +62 -62
- package/src/lightning/staticMap/staticMap.js +3 -2
- package/src/lightning/tab/tab.js +10 -5
- package/src/lightning/tab/tab.js-meta.xml +3 -0
- package/src/lightning/tab/tab.slds.css +14 -7
- package/src/lightning/tabBar/tab-bar.slds.css +16 -6
- package/src/lightning/tabBar/tabBar.js +10 -5
- package/src/lightning/tabset/__docs__/tabset.md +24 -1
- package/src/lightning/tabset/tabset.html +2 -0
- package/src/lightning/tabset/tabset.js +25 -38
- package/src/lightning/tabset/tabset.js-meta.xml +3 -0
- package/src/lightning/tabset/tabset.slds.css +0 -2
- package/src/lightning/textarea/form-element.slds.css +54 -54
- package/src/lightning/textarea/textarea.js +11 -2
- package/src/lightning/textarea/textarea.slds.css +22 -9
- package/src/lightning/timepicker/form-element.slds.css +54 -54
- package/src/lightning/timepicker/timepicker.js-meta.xml +6 -0
- package/src/lightning/timepicker/timepicker.slds.css +2 -2
- package/src/lightning/toast/__docs__/toast.md +20 -22
- package/src/lightning/toast/button-icon.slds.css +1 -1
- package/src/lightning/toast/icon.slds.css +12 -25
- package/src/lightning/toast/toast.js +15 -12
- package/src/lightning/toast/toast.slds.css +6 -18
- package/src/lightning/toastContainer/__docs__/toastContainer.md +3 -2
- package/src/lightning/toastContainer/toast.slds.css +6 -18
- package/src/lightning/toastContainer/toastContainer.js +25 -17
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +36 -24
- package/src/lightning/tree/tree.js +2 -0
- package/src/lightning/utils/classSet.js +9 -3
- package/src/lightning/utilsPrivate/formatUtils.js +158 -0
- package/src/lightning/utilsPrivate/textUtils.js +16 -0
- package/src/lightning/utilsPrivate/utilsPrivate.js +56 -15
- package/src/lightning/utilsPrivate/validationUtils.js +59 -0
- package/src/lightning/verticalNavigation/vertical-navigation.slds.css +14 -0
- package/src/lightning/verticalNavigation/verticalNavigation.css +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.js +66 -28
- package/src/lightning/verticalNavigation/verticalNavigation.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.css +2 -3
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js +29 -15
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.native.css +2 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemBadge/badge.slds.css +76 -0
- package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.css +2 -3
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.html +1 -1
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js +28 -15
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.css +2 -3
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js +29 -15
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.native.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationOverflow/button.slds.css +503 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-section.slds.css +17 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.css +2 -1
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.html +2 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js +18 -13
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +13 -15
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.js-meta.xml +3 -0
- package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.js +0 -158
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +0 -6
- package/src/lightning/datatable/__examples__/customDatatypeLink/customDatatypeLink.html +0 -9
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +0 -40
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumber.html +0 -3
- package/src/lightning/datatable/inlineEditShared.js +0 -26
- package/src/lightning/datatable/resizeSensor.js +0 -244
- package/src/lightning/formattedRichText/linkify.js +0 -43
- package/src/lightning/utilsPrivate/smartSetAttribute.js +0 -19
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customDatatypeTable.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customLink.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customName.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/orderingButtons.html +0 -0
|
@@ -4,15 +4,117 @@
|
|
|
4
4
|
// And add "export { address };" at the end.
|
|
5
5
|
|
|
6
6
|
/* eslint-disable */
|
|
7
|
-
|
|
7
|
+
function _toPrimitive(t, r) {
|
|
8
|
+
if ('object' != typeof t || !t) return t;
|
|
9
|
+
let e = t[Symbol.toPrimitive];
|
|
10
|
+
if (void 0 !== e) {
|
|
11
|
+
let i = e.call(t, r || 'default');
|
|
12
|
+
if ('object' != typeof i) return i;
|
|
13
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
14
|
+
}
|
|
15
|
+
return ('string' === r ? String : Number)(t);
|
|
16
|
+
}
|
|
17
|
+
function _toPropertyKey(t) {
|
|
18
|
+
let i = _toPrimitive(t, 'string');
|
|
19
|
+
return 'symbol' == typeof i ? i : String(i);
|
|
20
|
+
}
|
|
21
|
+
function _classCallCheck(instance, Constructor) {
|
|
22
|
+
if (!(instance instanceof Constructor)) {
|
|
23
|
+
throw new TypeError('Cannot call a class as a function');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function _defineProperties(target, props) {
|
|
27
|
+
for (let i = 0; i < props.length; i++) {
|
|
28
|
+
let descriptor = props[i];
|
|
29
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
30
|
+
descriptor.configurable = true;
|
|
31
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
32
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
36
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
37
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
38
|
+
Object.defineProperty(Constructor, 'prototype', {
|
|
39
|
+
writable: false,
|
|
40
|
+
});
|
|
41
|
+
return Constructor;
|
|
42
|
+
}
|
|
43
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
44
|
+
if (!o) return;
|
|
45
|
+
if (typeof o === 'string') return _arrayLikeToArray(o, minLen);
|
|
46
|
+
let n = Object.prototype.toString.call(o).slice(8, -1);
|
|
47
|
+
if (n === 'Object' && o.constructor) n = o.constructor.name;
|
|
48
|
+
if (n === 'Map' || n === 'Set') return Array.from(o);
|
|
49
|
+
if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
50
|
+
}
|
|
51
|
+
function _arrayLikeToArray(arr, len) {
|
|
52
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
53
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
54
|
+
return arr2;
|
|
55
|
+
}
|
|
56
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
57
|
+
let it = typeof Symbol !== 'undefined' && o[Symbol.iterator] || o['@@iterator'];
|
|
58
|
+
if (!it) {
|
|
59
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === 'number') {
|
|
60
|
+
if (it) o = it;
|
|
61
|
+
let i = 0;
|
|
62
|
+
let F = function() {};
|
|
63
|
+
return {
|
|
64
|
+
s: F,
|
|
65
|
+
n: function() {
|
|
66
|
+
if (i >= o.length) {
|
|
67
|
+
return {
|
|
68
|
+
done: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
done: false,
|
|
73
|
+
value: o[i++],
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
e: function(e) {
|
|
77
|
+
throw e;
|
|
78
|
+
},
|
|
79
|
+
f: F,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
83
|
+
}
|
|
84
|
+
let normalCompletion = true;
|
|
85
|
+
let didErr = false;
|
|
86
|
+
let err;
|
|
87
|
+
return {
|
|
88
|
+
s: function() {
|
|
89
|
+
it = it.call(o);
|
|
90
|
+
},
|
|
91
|
+
n: function() {
|
|
92
|
+
let step = it.next();
|
|
93
|
+
normalCompletion = step.done;
|
|
94
|
+
return step;
|
|
95
|
+
},
|
|
96
|
+
e: function(e) {
|
|
97
|
+
didErr = true;
|
|
98
|
+
err = e;
|
|
99
|
+
},
|
|
100
|
+
f: function() {
|
|
101
|
+
try {
|
|
102
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
103
|
+
} finally {
|
|
104
|
+
if (didErr) throw err;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
let data = {
|
|
8
110
|
AE: {
|
|
9
111
|
fmt: '%A%n%S%n%K',
|
|
10
|
-
require: '
|
|
112
|
+
require: 'ASK',
|
|
11
113
|
input: 'ASK',
|
|
12
114
|
},
|
|
13
115
|
AL: {
|
|
14
116
|
fmt: '%A%n%Z%n%C%n%K',
|
|
15
|
-
require: '
|
|
117
|
+
require: 'AZCK',
|
|
16
118
|
input: 'AZCK',
|
|
17
119
|
},
|
|
18
120
|
EC: {
|
|
@@ -26,12 +128,12 @@ var data = {
|
|
|
26
128
|
},
|
|
27
129
|
AM: {
|
|
28
130
|
fmt: '%A%n%Z%n%C%n%S%n%K',
|
|
29
|
-
require: '
|
|
131
|
+
require: 'AZK',
|
|
30
132
|
input: 'AZK',
|
|
31
133
|
},
|
|
32
134
|
AR: {
|
|
33
135
|
fmt: '%A%n%Z %C%n%S%n%K',
|
|
34
|
-
require: '
|
|
136
|
+
require: 'AZCSK',
|
|
35
137
|
input: 'AZCSK',
|
|
36
138
|
},
|
|
37
139
|
CL: {
|
|
@@ -48,7 +150,7 @@ var data = {
|
|
|
48
150
|
},
|
|
49
151
|
AT: {
|
|
50
152
|
fmt: '%A%n%Z %C%n%K',
|
|
51
|
-
require: '
|
|
153
|
+
require: 'AZCK',
|
|
52
154
|
input: 'AZCK',
|
|
53
155
|
},
|
|
54
156
|
BA: {
|
|
@@ -60,6 +162,9 @@ var data = {
|
|
|
60
162
|
CH: {
|
|
61
163
|
_ref: 'AT',
|
|
62
164
|
},
|
|
165
|
+
CY: {
|
|
166
|
+
_ref: 'AT',
|
|
167
|
+
},
|
|
63
168
|
DE: {
|
|
64
169
|
_ref: 'AT',
|
|
65
170
|
},
|
|
@@ -84,6 +189,9 @@ var data = {
|
|
|
84
189
|
GE: {
|
|
85
190
|
_ref: 'AT',
|
|
86
191
|
},
|
|
192
|
+
GL: {
|
|
193
|
+
_ref: 'AT',
|
|
194
|
+
},
|
|
87
195
|
GR: {
|
|
88
196
|
_ref: 'AT',
|
|
89
197
|
},
|
|
@@ -152,7 +260,7 @@ var data = {
|
|
|
152
260
|
},
|
|
153
261
|
AU: {
|
|
154
262
|
fmt: '%A%n%C %S %Z%n%K',
|
|
155
|
-
require: '
|
|
263
|
+
require: 'ACSZK',
|
|
156
264
|
input: 'ACSZK',
|
|
157
265
|
},
|
|
158
266
|
CA: {
|
|
@@ -160,12 +268,12 @@ var data = {
|
|
|
160
268
|
},
|
|
161
269
|
AZ: {
|
|
162
270
|
fmt: '%A%n%Z %C%n%K',
|
|
163
|
-
require: '
|
|
271
|
+
require: 'AZCK',
|
|
164
272
|
input: 'AZCK',
|
|
165
273
|
},
|
|
166
274
|
AF: {
|
|
167
275
|
fmt: '%A%n%C%n%Z%n%K',
|
|
168
|
-
require: '
|
|
276
|
+
require: 'ACZK',
|
|
169
277
|
input: 'ACZK',
|
|
170
278
|
},
|
|
171
279
|
FK: {
|
|
@@ -173,7 +281,7 @@ var data = {
|
|
|
173
281
|
},
|
|
174
282
|
GB: {
|
|
175
283
|
fmt: '%A%n%C%n%S%n%Z%n%K',
|
|
176
|
-
require: '
|
|
284
|
+
require: 'ACZK',
|
|
177
285
|
input: 'ACSZK',
|
|
178
286
|
},
|
|
179
287
|
KE: {
|
|
@@ -193,7 +301,7 @@ var data = {
|
|
|
193
301
|
},
|
|
194
302
|
US: {
|
|
195
303
|
fmt: '%A%n%C, %S %Z%n%K',
|
|
196
|
-
require: '
|
|
304
|
+
require: 'ACSZK',
|
|
197
305
|
input: 'ACSZK',
|
|
198
306
|
},
|
|
199
307
|
BB: {
|
|
@@ -207,7 +315,7 @@ var data = {
|
|
|
207
315
|
},
|
|
208
316
|
ES: {
|
|
209
317
|
fmt: '%A%n%Z %C %S%n%K',
|
|
210
|
-
require: '
|
|
318
|
+
require: 'AZCSK',
|
|
211
319
|
input: 'AZCSK',
|
|
212
320
|
},
|
|
213
321
|
IT: {
|
|
@@ -218,7 +326,7 @@ var data = {
|
|
|
218
326
|
},
|
|
219
327
|
ID: {
|
|
220
328
|
fmt: '%A%n%C%n%S %Z%n%K',
|
|
221
|
-
require: '
|
|
329
|
+
require: 'ACSZK',
|
|
222
330
|
input: 'ACSZK',
|
|
223
331
|
},
|
|
224
332
|
IE: {
|
|
@@ -232,12 +340,12 @@ var data = {
|
|
|
232
340
|
},
|
|
233
341
|
HU: {
|
|
234
342
|
fmt: '%C%n%A%n%Z%n%K',
|
|
235
|
-
require: '
|
|
343
|
+
require: 'CAZK',
|
|
236
344
|
input: 'CAZK',
|
|
237
345
|
},
|
|
238
346
|
BH: {
|
|
239
347
|
fmt: '%A%n%C %Z%n%K',
|
|
240
|
-
require: '
|
|
348
|
+
require: 'ACZK',
|
|
241
349
|
input: 'ACZK',
|
|
242
350
|
},
|
|
243
351
|
BM: {
|
|
@@ -272,37 +380,37 @@ var data = {
|
|
|
272
380
|
},
|
|
273
381
|
BD: {
|
|
274
382
|
fmt: '%A%n%C - %Z%n%K',
|
|
275
|
-
require: '
|
|
383
|
+
require: 'ACZK',
|
|
276
384
|
input: 'ACZK',
|
|
277
385
|
},
|
|
278
386
|
BR: {
|
|
279
387
|
fmt: '%A%n%C-%S%n%Z%n%K',
|
|
280
|
-
require: '
|
|
388
|
+
require: 'ACSZK',
|
|
281
389
|
input: 'ACSZK',
|
|
282
390
|
},
|
|
283
391
|
CN: {
|
|
284
392
|
fmt: '%K%n%S %C%n%A%n%Z',
|
|
285
|
-
require: '
|
|
393
|
+
require: 'KCAZ',
|
|
286
394
|
input: 'KSCAZ',
|
|
287
395
|
},
|
|
288
396
|
HK: {
|
|
289
397
|
fmt: '%K%S%C%n%A%n%Z',
|
|
290
|
-
require: '
|
|
398
|
+
require: 'KCA',
|
|
291
399
|
input: 'KSCAZ',
|
|
292
400
|
},
|
|
293
401
|
CO: {
|
|
294
402
|
fmt: '%A%n%C, %S, %Z%n%K',
|
|
295
|
-
require: '
|
|
403
|
+
require: 'ACSZK',
|
|
296
404
|
input: 'ACSZK',
|
|
297
405
|
},
|
|
298
406
|
CR: {
|
|
299
407
|
fmt: '%A%n%S, %C%n%Z%n%K',
|
|
300
|
-
require: '
|
|
408
|
+
require: 'ACSZK',
|
|
301
409
|
input: 'ASCZK',
|
|
302
410
|
},
|
|
303
411
|
EG: {
|
|
304
412
|
fmt: '%A%n%C%n%S%n%Z%n%K',
|
|
305
|
-
require: '
|
|
413
|
+
require: 'ACSZK',
|
|
306
414
|
input: 'ACSZK',
|
|
307
415
|
},
|
|
308
416
|
RU: {
|
|
@@ -313,17 +421,17 @@ var data = {
|
|
|
313
421
|
},
|
|
314
422
|
FI: {
|
|
315
423
|
fmt: '%A%n%Z %C%n%K',
|
|
316
|
-
require: '
|
|
424
|
+
require: 'AZCK',
|
|
317
425
|
input: 'AZCK',
|
|
318
426
|
},
|
|
319
427
|
GT: {
|
|
320
428
|
fmt: '%A%n%Z-%C%n%K',
|
|
321
|
-
require: '
|
|
429
|
+
require: 'AZCK',
|
|
322
430
|
input: 'AZCK',
|
|
323
431
|
},
|
|
324
432
|
HN: {
|
|
325
433
|
fmt: '%A%n%C, %S%n%Z%n%K',
|
|
326
|
-
require: '
|
|
434
|
+
require: 'ACSZK',
|
|
327
435
|
input: 'ACSZK',
|
|
328
436
|
},
|
|
329
437
|
IQ: {
|
|
@@ -331,17 +439,17 @@ var data = {
|
|
|
331
439
|
},
|
|
332
440
|
HR: {
|
|
333
441
|
fmt: '%A%n%Z %C%n%K',
|
|
334
|
-
require: '
|
|
442
|
+
require: 'AZCK',
|
|
335
443
|
input: 'AZCK',
|
|
336
444
|
},
|
|
337
445
|
HT: {
|
|
338
446
|
fmt: '%A%n%Z %C%n%K',
|
|
339
|
-
require: '
|
|
447
|
+
require: 'AZCK',
|
|
340
448
|
input: 'AZCK',
|
|
341
449
|
},
|
|
342
450
|
IN: {
|
|
343
451
|
fmt: '%A%n%C %Z%n%S%n%K',
|
|
344
|
-
require: '
|
|
452
|
+
require: 'ACZSK',
|
|
345
453
|
input: 'ACZSK',
|
|
346
454
|
},
|
|
347
455
|
NG: {
|
|
@@ -352,12 +460,12 @@ var data = {
|
|
|
352
460
|
},
|
|
353
461
|
IR: {
|
|
354
462
|
fmt: '%S%n%C%n%A%n%Z%n%K',
|
|
355
|
-
require: '
|
|
463
|
+
require: 'SCAZK',
|
|
356
464
|
input: 'SCAZK',
|
|
357
465
|
},
|
|
358
466
|
JM: {
|
|
359
467
|
fmt: '%A%n%C%n%S%n%K',
|
|
360
|
-
require: '
|
|
468
|
+
require: 'ACSK',
|
|
361
469
|
input: 'ACSK',
|
|
362
470
|
},
|
|
363
471
|
PA: {
|
|
@@ -370,44 +478,43 @@ var data = {
|
|
|
370
478
|
_ref: 'JM',
|
|
371
479
|
},
|
|
372
480
|
JP: {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
require: 'ZCA',
|
|
481
|
+
fmt: '%K%n〒%Z%n%S %C%n%A',
|
|
482
|
+
require: 'KZCA',
|
|
376
483
|
input: 'KZSCA',
|
|
377
484
|
},
|
|
378
485
|
EN_JP: {
|
|
379
486
|
fmt: '%A%n%C %S%n%Z %K',
|
|
380
|
-
require: '
|
|
487
|
+
require: 'ACSZK',
|
|
381
488
|
input: 'ACSZK',
|
|
382
489
|
},
|
|
383
490
|
KG: {
|
|
384
491
|
fmt: '%Z %C%n%A%n%S%n%K',
|
|
385
|
-
require: '
|
|
492
|
+
require: 'ZCAK',
|
|
386
493
|
input: 'ZCAK',
|
|
387
494
|
},
|
|
388
495
|
KR: {
|
|
389
496
|
fmt: '%S %C%n%A%n%Z%n%K',
|
|
390
|
-
require: '
|
|
497
|
+
require: 'SCAZK',
|
|
391
498
|
input: 'SCAZK',
|
|
392
499
|
},
|
|
393
500
|
KY: {
|
|
394
501
|
fmt: '%A%n%S %Z%n%K',
|
|
395
|
-
require: '
|
|
502
|
+
require: 'ASZK',
|
|
396
503
|
input: 'ASZK',
|
|
397
504
|
},
|
|
398
505
|
KZ: {
|
|
399
506
|
fmt: '%Z%n%S%n%C%n%A%n%K',
|
|
400
|
-
require: '
|
|
507
|
+
require: 'ZSCAK',
|
|
401
508
|
input: 'ZSCAK',
|
|
402
509
|
},
|
|
403
510
|
LT: {
|
|
404
511
|
fmt: '%A%n%Z %C%n%K',
|
|
405
|
-
require: '
|
|
512
|
+
require: 'AZCK',
|
|
406
513
|
input: 'AZCK',
|
|
407
514
|
},
|
|
408
515
|
LV: {
|
|
409
516
|
fmt: '%A%n%C, %Z%n%K',
|
|
410
|
-
require: '
|
|
517
|
+
require: 'ACZK',
|
|
411
518
|
input: 'ACZK',
|
|
412
519
|
},
|
|
413
520
|
MM: {
|
|
@@ -415,157 +522,169 @@ var data = {
|
|
|
415
522
|
},
|
|
416
523
|
MC: {
|
|
417
524
|
fmt: '%A%n%Z %C%n%K',
|
|
418
|
-
require: '
|
|
525
|
+
require: 'AZCK',
|
|
419
526
|
input: 'AZCK',
|
|
420
527
|
},
|
|
421
528
|
MD: {
|
|
422
529
|
fmt: '%A%n%Z %C%n%K',
|
|
423
|
-
require: '
|
|
530
|
+
require: 'AZCK',
|
|
424
531
|
input: 'AZCK',
|
|
425
532
|
},
|
|
426
533
|
MW: {
|
|
427
534
|
fmt: '%A%n%C%n%K',
|
|
428
|
-
require: '
|
|
535
|
+
require: 'ACK',
|
|
429
536
|
input: 'ACK',
|
|
430
537
|
},
|
|
431
538
|
MX: {
|
|
432
539
|
fmt: '%A%n%Z %C, %S%n%K',
|
|
433
|
-
require: '
|
|
540
|
+
require: 'AZCSK',
|
|
434
541
|
input: 'AZCSK',
|
|
435
542
|
},
|
|
436
543
|
NI: {
|
|
437
544
|
fmt: '%A%n%Z%n%C, %S%n%K',
|
|
438
|
-
require: '
|
|
545
|
+
require: 'AZCSK',
|
|
439
546
|
input: 'AZCSK',
|
|
440
547
|
},
|
|
441
548
|
PG: {
|
|
442
549
|
fmt: '%A%n%C %Z %S%n%K',
|
|
443
|
-
require: '
|
|
550
|
+
require: 'ACZSK',
|
|
444
551
|
input: 'ACZSK',
|
|
445
552
|
},
|
|
446
553
|
PH: {
|
|
447
554
|
fmt: '%A, %C%n%Z %S%n%K',
|
|
448
|
-
require: '
|
|
555
|
+
require: 'ACZSK',
|
|
449
556
|
input: 'ACZSK',
|
|
450
557
|
},
|
|
451
558
|
PK: {
|
|
452
559
|
fmt: '%A%n%C-%Z%n%K',
|
|
453
|
-
require: '
|
|
560
|
+
require: 'ACZK',
|
|
454
561
|
input: 'ACZK',
|
|
455
562
|
},
|
|
456
563
|
PR: {
|
|
457
564
|
fmt: '%A%n%C %Z%n%K',
|
|
458
|
-
require: '
|
|
565
|
+
require: 'ACZK',
|
|
459
566
|
input: 'ACZK',
|
|
460
567
|
},
|
|
461
568
|
SE: {
|
|
462
569
|
fmt: '%A%n%Z %C%n%K',
|
|
463
|
-
require: '
|
|
570
|
+
require: 'AZCK',
|
|
464
571
|
input: 'AZCK',
|
|
465
572
|
},
|
|
466
573
|
SG: {
|
|
467
574
|
fmt: '%A%n%C %Z%n%S%n%K',
|
|
468
|
-
require: '
|
|
575
|
+
require: 'AZK',
|
|
469
576
|
input: 'AZK',
|
|
470
577
|
},
|
|
471
578
|
SI: {
|
|
472
579
|
fmt: '%A%n%Z %C%n%K',
|
|
473
|
-
require: '
|
|
580
|
+
require: 'AZCK',
|
|
474
581
|
input: 'AZCK',
|
|
475
582
|
},
|
|
476
583
|
SV: {
|
|
477
584
|
fmt: '%A%n%Z-%C%n%S%n%K',
|
|
478
|
-
require: '
|
|
585
|
+
require: 'AZCSK',
|
|
479
586
|
input: 'AZCSK',
|
|
480
587
|
},
|
|
481
588
|
TR: {
|
|
482
589
|
fmt: '%A%n%Z %C/%S%n%K',
|
|
483
|
-
require: '
|
|
590
|
+
require: 'AZCK',
|
|
484
591
|
input: 'AZCK',
|
|
485
592
|
},
|
|
486
593
|
TW: {
|
|
487
594
|
fmt: '%K%n%Z%n%S %C%n%A',
|
|
488
|
-
require: '
|
|
595
|
+
require: 'KZSCA',
|
|
489
596
|
input: 'KZSCA',
|
|
490
597
|
},
|
|
491
598
|
VE: {
|
|
492
599
|
fmt: '%A%n%C %Z, %S%n%K',
|
|
493
|
-
require: '
|
|
600
|
+
require: 'ACZSK',
|
|
494
601
|
input: 'ACZSK',
|
|
495
602
|
},
|
|
496
603
|
};
|
|
497
|
-
|
|
498
|
-
var languageCodeToCountry = {
|
|
604
|
+
let languageCodeToCountry = {
|
|
499
605
|
languageCode: {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
606
|
+
'af': 'ZA',
|
|
607
|
+
'am': 'ET',
|
|
608
|
+
'ar': 'AE',
|
|
609
|
+
'bg': 'BG',
|
|
610
|
+
'bn': 'BD',
|
|
611
|
+
'bs': 'BA',
|
|
612
|
+
'ca': 'ES',
|
|
613
|
+
'cs': 'CZ',
|
|
614
|
+
'cy': 'GB',
|
|
615
|
+
'da': 'DK',
|
|
616
|
+
'de': 'DE',
|
|
617
|
+
'el': 'GR',
|
|
618
|
+
'es': 'ES',
|
|
619
|
+
'et': 'EE',
|
|
620
|
+
'eu': 'ES',
|
|
621
|
+
'fa': 'IR',
|
|
622
|
+
'fi': 'FI',
|
|
623
|
+
'fr': 'FR',
|
|
624
|
+
'ga': 'IE',
|
|
625
|
+
'gu': 'IN',
|
|
626
|
+
'haw': 'US',
|
|
627
|
+
'hi': 'IN',
|
|
628
|
+
'hmn': 'US',
|
|
629
|
+
'hr': 'HR',
|
|
630
|
+
'ht': 'HT',
|
|
631
|
+
'hu': 'HU',
|
|
632
|
+
'hy': 'AM',
|
|
633
|
+
'in': 'ID',
|
|
634
|
+
'is': 'IS',
|
|
635
|
+
'it': 'IT',
|
|
636
|
+
'iw': 'IL',
|
|
637
|
+
'ja': 'JP',
|
|
638
|
+
'ji': 'IL',
|
|
639
|
+
'ka': 'GE',
|
|
640
|
+
'kk': 'KZ',
|
|
641
|
+
'kl': 'GL',
|
|
642
|
+
'km': 'KH',
|
|
643
|
+
'kn': 'IN',
|
|
644
|
+
'ko': 'KR',
|
|
645
|
+
'lb': 'LU',
|
|
646
|
+
'lt': 'LT',
|
|
647
|
+
'lv': 'LV',
|
|
648
|
+
'mi': 'NZ',
|
|
649
|
+
'mk': 'MK',
|
|
650
|
+
'ml': 'IN',
|
|
651
|
+
'mr': 'IN',
|
|
652
|
+
'ms': 'MY',
|
|
653
|
+
'mt': 'MT',
|
|
654
|
+
'my': 'MM',
|
|
655
|
+
'nl': 'NL',
|
|
656
|
+
'no': 'NO',
|
|
657
|
+
'pa': 'IN',
|
|
658
|
+
'pl': 'PL',
|
|
659
|
+
'pt': 'PT',
|
|
660
|
+
'rm': 'CH',
|
|
661
|
+
'ro': 'RO',
|
|
662
|
+
'ru': 'RU',
|
|
663
|
+
'sh': 'RS',
|
|
664
|
+
'sk': 'SK',
|
|
665
|
+
'sl': 'SL',
|
|
666
|
+
'sm': 'WS',
|
|
667
|
+
'sq': 'AL',
|
|
668
|
+
'sr': 'RS',
|
|
669
|
+
'sv': 'SE',
|
|
670
|
+
'sw': 'ZA',
|
|
671
|
+
'ta': 'IN',
|
|
672
|
+
'te': 'IN',
|
|
673
|
+
'th': 'TH',
|
|
674
|
+
'tl': 'PH',
|
|
675
|
+
'tr': 'TR',
|
|
676
|
+
'uk': 'UA',
|
|
677
|
+
'ur': 'IN',
|
|
678
|
+
'vi': 'VN',
|
|
679
|
+
'xh': 'ZA',
|
|
680
|
+
'zh': 'CN',
|
|
681
|
+
'zu': 'ZA',
|
|
563
682
|
},
|
|
564
683
|
};
|
|
565
684
|
|
|
566
685
|
/**
|
|
567
|
-
|
|
568
|
-
|
|
686
|
+
* Define address format patterns.
|
|
687
|
+
*/
|
|
569
688
|
var AddressFormatPattern = Object.freeze({
|
|
570
689
|
/**
|
|
571
690
|
*
|
|
@@ -588,89 +707,65 @@ var AddressFormatPattern = Object.freeze({
|
|
|
588
707
|
n: Symbol('New Line'),
|
|
589
708
|
fromPlaceHolder: function fromPlaceHolder(placeHolder) {
|
|
590
709
|
switch (placeHolder) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
710
|
+
case 'A':
|
|
711
|
+
return AddressFormatPattern.A;
|
|
712
|
+
case 'C':
|
|
713
|
+
return AddressFormatPattern.C;
|
|
714
|
+
case 'S':
|
|
715
|
+
return AddressFormatPattern.S;
|
|
716
|
+
case 'K':
|
|
717
|
+
return AddressFormatPattern.K;
|
|
718
|
+
case 'Z':
|
|
719
|
+
return AddressFormatPattern.Z;
|
|
720
|
+
case 'n':
|
|
721
|
+
return AddressFormatPattern.n;
|
|
603
722
|
}
|
|
604
723
|
return null;
|
|
605
724
|
},
|
|
606
725
|
getPlaceHolder: function getPlaceHolder(pattern) {
|
|
607
726
|
switch (pattern) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
727
|
+
case AddressFormatPattern.A:
|
|
728
|
+
return 'A';
|
|
729
|
+
case AddressFormatPattern.C:
|
|
730
|
+
return 'C';
|
|
731
|
+
case AddressFormatPattern.S:
|
|
732
|
+
return 'S';
|
|
733
|
+
case AddressFormatPattern.K:
|
|
734
|
+
return 'K';
|
|
735
|
+
case AddressFormatPattern.Z:
|
|
736
|
+
return 'Z';
|
|
737
|
+
case AddressFormatPattern.n:
|
|
738
|
+
return 'n';
|
|
620
739
|
}
|
|
621
740
|
return null;
|
|
622
741
|
},
|
|
623
742
|
getData: function getData(pattern, data) {
|
|
624
743
|
if (data) {
|
|
625
744
|
switch (pattern) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
745
|
+
case AddressFormatPattern.A:
|
|
746
|
+
return data.address;
|
|
747
|
+
case AddressFormatPattern.C:
|
|
748
|
+
return data.city;
|
|
749
|
+
case AddressFormatPattern.S:
|
|
750
|
+
return data.state;
|
|
751
|
+
case AddressFormatPattern.K:
|
|
752
|
+
return data.country;
|
|
753
|
+
case AddressFormatPattern.Z:
|
|
754
|
+
return data.zipCode;
|
|
755
|
+
case AddressFormatPattern.n:
|
|
756
|
+
return data.newLine;
|
|
638
757
|
}
|
|
639
758
|
}
|
|
640
759
|
return null;
|
|
641
760
|
},
|
|
642
761
|
});
|
|
643
762
|
|
|
644
|
-
var classCallCheck = function(instance, Constructor) {
|
|
645
|
-
if (!(instance instanceof Constructor)) {
|
|
646
|
-
throw new TypeError('Cannot call a class as a function');
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
var createClass = (function() {
|
|
651
|
-
function defineProperties(target, props) {
|
|
652
|
-
for (var i = 0; i < props.length; i++) {
|
|
653
|
-
var descriptor = props[i];
|
|
654
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
655
|
-
descriptor.configurable = true;
|
|
656
|
-
if ('value' in descriptor) descriptor.writable = true;
|
|
657
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
return function(Constructor, protoProps, staticProps) {
|
|
662
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
663
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
|
664
|
-
return Constructor;
|
|
665
|
-
};
|
|
666
|
-
})();
|
|
667
|
-
|
|
668
763
|
/**
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
764
|
+
* Address token types enum
|
|
765
|
+
*
|
|
766
|
+
* @private
|
|
767
|
+
*/
|
|
768
|
+
let AddressTokenTypes = Object.freeze({
|
|
674
769
|
DATA: Symbol('data'),
|
|
675
770
|
STRING: Symbol('string'),
|
|
676
771
|
NEWLINE: Symbol('newline'),
|
|
@@ -678,12 +773,11 @@ var AddressTokenTypes = Object.freeze({
|
|
|
678
773
|
});
|
|
679
774
|
|
|
680
775
|
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
var AddressToken = (function() {
|
|
776
|
+
* AddressToken class
|
|
777
|
+
*
|
|
778
|
+
* @private
|
|
779
|
+
*/
|
|
780
|
+
let AddressToken = /* #__PURE__*/function() {
|
|
687
781
|
/**
|
|
688
782
|
*
|
|
689
783
|
* @param {AddressTokenTypes} type
|
|
@@ -691,8 +785,7 @@ var AddressToken = (function() {
|
|
|
691
785
|
* @param {*} pattern
|
|
692
786
|
*/
|
|
693
787
|
function AddressToken(type, string, pattern) {
|
|
694
|
-
|
|
695
|
-
|
|
788
|
+
_classCallCheck(this, AddressToken);
|
|
696
789
|
this.type = type;
|
|
697
790
|
this.string = string;
|
|
698
791
|
this.pattern = pattern;
|
|
@@ -704,52 +797,41 @@ var AddressToken = (function() {
|
|
|
704
797
|
* @param {string} string String
|
|
705
798
|
* @return {AddressToken} Address Token
|
|
706
799
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
{
|
|
710
|
-
|
|
711
|
-
value: function string(_string) {
|
|
712
|
-
return new AddressToken(AddressTokenTypes.STRING, _string);
|
|
713
|
-
},
|
|
714
|
-
/**
|
|
715
|
-
* Construct a data type token
|
|
716
|
-
*
|
|
717
|
-
* @param {pattern} pattern Address Format Pattern
|
|
718
|
-
* @return {AddressToken} Address Token
|
|
719
|
-
*/
|
|
800
|
+
_createClass(AddressToken, null, [{
|
|
801
|
+
key: 'string',
|
|
802
|
+
value: function string(_string) {
|
|
803
|
+
return new AddressToken(AddressTokenTypes.STRING, _string);
|
|
720
804
|
},
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
* Construct a new line type token
|
|
732
|
-
*
|
|
733
|
-
* @return {AddressToken} Address Token
|
|
734
|
-
*/
|
|
805
|
+
/**
|
|
806
|
+
* Construct a data type token
|
|
807
|
+
*
|
|
808
|
+
* @param {pattern} pattern Address Format Pattern
|
|
809
|
+
* @return {AddressToken} Address Token
|
|
810
|
+
*/
|
|
811
|
+
}, {
|
|
812
|
+
key: 'data',
|
|
813
|
+
value: function data(pattern) {
|
|
814
|
+
return new AddressToken(AddressTokenTypes.DATA, undefined, pattern);
|
|
735
815
|
},
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
816
|
+
/**
|
|
817
|
+
* Construct a new line type token
|
|
818
|
+
*
|
|
819
|
+
* @return {AddressToken} Address Token
|
|
820
|
+
*/
|
|
821
|
+
}, {
|
|
822
|
+
key: 'newLine',
|
|
823
|
+
value: function newLine() {
|
|
824
|
+
return new AddressToken(AddressTokenTypes.NEWLINE);
|
|
741
825
|
},
|
|
742
|
-
]);
|
|
826
|
+
}]);
|
|
743
827
|
return AddressToken;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
*/
|
|
751
|
-
|
|
752
|
-
var TokenizerState =
|
|
828
|
+
}();
|
|
829
|
+
/**
|
|
830
|
+
* TokenizerState class
|
|
831
|
+
*
|
|
832
|
+
* @private
|
|
833
|
+
*/
|
|
834
|
+
let TokenizerState = /* #__PURE__*/_createClass(
|
|
753
835
|
/**
|
|
754
836
|
* Constructor
|
|
755
837
|
*
|
|
@@ -757,82 +839,58 @@ var TokenizerState =
|
|
|
757
839
|
* @param {int} start
|
|
758
840
|
*/
|
|
759
841
|
function TokenizerState(pattern, start) {
|
|
760
|
-
|
|
761
|
-
|
|
842
|
+
_classCallCheck(this, TokenizerState);
|
|
762
843
|
this.pattern = pattern;
|
|
763
844
|
this.start = start;
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
*/
|
|
775
|
-
|
|
845
|
+
});
|
|
846
|
+
/**
|
|
847
|
+
* Tokenize string pattern to AddressToken array
|
|
848
|
+
*
|
|
849
|
+
* @param {TokenizerState} state
|
|
850
|
+
* @param {AddressToken[]} tokens
|
|
851
|
+
* @return {TokenizerState} Tokenizer state
|
|
852
|
+
*
|
|
853
|
+
* @private
|
|
854
|
+
*/
|
|
776
855
|
function tokenize(state, tokens) {
|
|
777
|
-
|
|
856
|
+
let nextIndex = state.start;
|
|
778
857
|
if (state.pattern) {
|
|
779
|
-
|
|
858
|
+
let len = state.pattern.length;
|
|
780
859
|
while (state.start < len) {
|
|
781
860
|
nextIndex = state.pattern.indexOf('%', nextIndex);
|
|
782
861
|
if (nextIndex >= 0 && nextIndex + 1 < len) {
|
|
783
|
-
|
|
784
|
-
nextIndex + 1,
|
|
785
|
-
nextIndex + 2
|
|
786
|
-
);
|
|
862
|
+
let placeHolder = state.pattern.substring(nextIndex + 1, nextIndex + 2);
|
|
787
863
|
switch (placeHolder) {
|
|
788
|
-
|
|
864
|
+
case 'n':
|
|
865
|
+
{
|
|
866
|
+
if (nextIndex - state.start > 0) {
|
|
867
|
+
tokens.push(AddressToken.string(state.pattern.substring(state.start, nextIndex)));
|
|
868
|
+
}
|
|
869
|
+
tokens.push(AddressToken.newLine());
|
|
870
|
+
state.start = nextIndex + 2;
|
|
871
|
+
nextIndex = state.start;
|
|
872
|
+
break;
|
|
873
|
+
}
|
|
874
|
+
default:
|
|
875
|
+
{
|
|
876
|
+
let p = AddressFormatPattern.fromPlaceHolder(placeHolder);
|
|
877
|
+
if (p) {
|
|
789
878
|
if (nextIndex - state.start > 0) {
|
|
790
|
-
tokens.push(
|
|
791
|
-
AddressToken.string(
|
|
792
|
-
state.pattern.substring(
|
|
793
|
-
state.start,
|
|
794
|
-
nextIndex
|
|
795
|
-
)
|
|
796
|
-
)
|
|
797
|
-
);
|
|
879
|
+
tokens.push(AddressToken.string(state.pattern.substring(state.start, nextIndex)));
|
|
798
880
|
}
|
|
799
|
-
tokens.push(AddressToken.
|
|
881
|
+
tokens.push(AddressToken.data(p));
|
|
882
|
+
state.start = nextIndex + 2;
|
|
883
|
+
nextIndex = state.start;
|
|
884
|
+
} else {
|
|
800
885
|
state.start = nextIndex + 2;
|
|
801
886
|
nextIndex = state.start;
|
|
802
|
-
break;
|
|
803
|
-
}
|
|
804
|
-
default: {
|
|
805
|
-
var p = AddressFormatPattern.fromPlaceHolder(
|
|
806
|
-
placeHolder
|
|
807
|
-
);
|
|
808
|
-
if (p) {
|
|
809
|
-
if (nextIndex - state.start > 0) {
|
|
810
|
-
tokens.push(
|
|
811
|
-
AddressToken.string(
|
|
812
|
-
state.pattern.substring(
|
|
813
|
-
state.start,
|
|
814
|
-
nextIndex
|
|
815
|
-
)
|
|
816
|
-
)
|
|
817
|
-
);
|
|
818
|
-
}
|
|
819
|
-
tokens.push(AddressToken.data(p));
|
|
820
|
-
state.start = nextIndex + 2;
|
|
821
|
-
nextIndex = state.start;
|
|
822
|
-
} else {
|
|
823
|
-
state.start = nextIndex + 2;
|
|
824
|
-
nextIndex = state.start;
|
|
825
|
-
}
|
|
826
|
-
break;
|
|
827
887
|
}
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
828
890
|
}
|
|
829
891
|
} else {
|
|
830
892
|
if (state.start < len) {
|
|
831
|
-
tokens.push(
|
|
832
|
-
AddressToken.string(
|
|
833
|
-
state.pattern.substring(state.start)
|
|
834
|
-
)
|
|
835
|
-
);
|
|
893
|
+
tokens.push(AddressToken.string(state.pattern.substring(state.start)));
|
|
836
894
|
}
|
|
837
895
|
state.start = len;
|
|
838
896
|
}
|
|
@@ -842,91 +900,61 @@ function tokenize(state, tokens) {
|
|
|
842
900
|
}
|
|
843
901
|
|
|
844
902
|
/**
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
function formatLineTokens(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
firstIndex,
|
|
861
|
-
lastIndex
|
|
862
|
-
) {
|
|
863
|
-
var parts = [];
|
|
864
|
-
for (var index = firstIndex; index <= lastIndex; index++) {
|
|
865
|
-
var token = tokens[index];
|
|
903
|
+
* Format line from tokens
|
|
904
|
+
*
|
|
905
|
+
* @param {*} tokens
|
|
906
|
+
* @param {*} data
|
|
907
|
+
* @param {*} ignoreEmptyLines
|
|
908
|
+
* @param {*} firstIndex
|
|
909
|
+
* @param {*} lastIndex
|
|
910
|
+
* @return {string} Formatted line
|
|
911
|
+
*
|
|
912
|
+
* @private
|
|
913
|
+
*/
|
|
914
|
+
function formatLineTokens(tokens, data, ignoreEmptyLines, firstIndex, lastIndex) {
|
|
915
|
+
let parts = [];
|
|
916
|
+
for (let index = firstIndex; index <= lastIndex; index++) {
|
|
917
|
+
let token = tokens[index];
|
|
866
918
|
if (!token) {
|
|
867
919
|
continue;
|
|
868
920
|
} else if (token.type == AddressTokenTypes.DATA) {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
for (
|
|
873
|
-
|
|
921
|
+
// Consume all subsequent data if available
|
|
922
|
+
let dataBuffer = '';
|
|
923
|
+
let lastDataIndex = index;
|
|
924
|
+
for (let dataIndex = index; dataIndex <= lastIndex; dataIndex++) {
|
|
925
|
+
let dataToken = tokens[dataIndex];
|
|
874
926
|
if (!dataToken || dataToken.type != AddressTokenTypes.DATA) {
|
|
875
927
|
break;
|
|
876
928
|
}
|
|
877
|
-
|
|
878
|
-
dataToken.pattern,
|
|
879
|
-
data
|
|
880
|
-
);
|
|
929
|
+
let fieldData = AddressFormatPattern.getData(dataToken.pattern, data);
|
|
881
930
|
if (fieldData) {
|
|
882
931
|
dataBuffer += fieldData;
|
|
883
932
|
lastDataIndex = dataIndex;
|
|
884
933
|
}
|
|
885
934
|
}
|
|
886
|
-
|
|
935
|
+
let hasData = dataBuffer && dataBuffer.length > 0;
|
|
887
936
|
// Output previous string only if there is data before it,
|
|
888
937
|
// or if it is the first on the line
|
|
889
|
-
|
|
938
|
+
let hasPreviousData = false;
|
|
890
939
|
if (index - 1 >= firstIndex) {
|
|
891
|
-
|
|
892
|
-
if (
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
for (
|
|
898
|
-
var prevIndex = index - 2;
|
|
899
|
-
prevIndex >= firstIndex;
|
|
900
|
-
prevIndex--
|
|
901
|
-
) {
|
|
902
|
-
var prevToken = tokens[prevIndex];
|
|
903
|
-
if (
|
|
904
|
-
prevToken &&
|
|
905
|
-
prevToken.type == AddressTokenTypes.DATA
|
|
906
|
-
) {
|
|
907
|
-
var _fieldData = AddressFormatPattern.getData(
|
|
908
|
-
prevToken.pattern,
|
|
909
|
-
data
|
|
910
|
-
);
|
|
940
|
+
let stringToken = tokens[index - 1];
|
|
941
|
+
if (stringToken && stringToken.type == AddressTokenTypes.STRING && stringToken.string) {
|
|
942
|
+
for (let prevIndex = index - 2; prevIndex >= firstIndex; prevIndex--) {
|
|
943
|
+
let prevToken = tokens[prevIndex];
|
|
944
|
+
if (prevToken && prevToken.type == AddressTokenTypes.DATA) {
|
|
945
|
+
let _fieldData = AddressFormatPattern.getData(prevToken.pattern, data);
|
|
911
946
|
if (_fieldData) {
|
|
912
947
|
hasPreviousData = true;
|
|
913
948
|
break;
|
|
914
949
|
}
|
|
915
|
-
} else if (
|
|
916
|
-
prevToken &&
|
|
917
|
-
prevToken.type == AddressTokenTypes.STRING
|
|
918
|
-
) {
|
|
950
|
+
} else if (prevToken && prevToken.type == AddressTokenTypes.STRING) {
|
|
919
951
|
// ie. for "%C, %S %Z" without S -> "City, 95100"
|
|
920
952
|
// Comment this if we want "City 95100" instead
|
|
921
953
|
// (use the separator between S Z instead of C S)
|
|
922
954
|
stringToken = prevToken;
|
|
923
955
|
}
|
|
924
956
|
}
|
|
925
|
-
if (
|
|
926
|
-
!ignoreEmptyLines ||
|
|
927
|
-
(hasPreviousData && hasData) ||
|
|
928
|
-
(index - 1 == firstIndex && hasData)
|
|
929
|
-
) {
|
|
957
|
+
if (!ignoreEmptyLines || hasPreviousData && hasData || index - 1 == firstIndex && hasData) {
|
|
930
958
|
parts.push(stringToken.string);
|
|
931
959
|
}
|
|
932
960
|
}
|
|
@@ -938,12 +966,8 @@ function formatLineTokens(
|
|
|
938
966
|
// Output next string only if it is the last
|
|
939
967
|
// and there is previous data before it
|
|
940
968
|
if (index + 1 == lastIndex) {
|
|
941
|
-
|
|
942
|
-
if (
|
|
943
|
-
_stringToken &&
|
|
944
|
-
_stringToken.type == AddressTokenTypes.STRING &&
|
|
945
|
-
_stringToken.string
|
|
946
|
-
) {
|
|
969
|
+
let _stringToken = tokens[index + 1];
|
|
970
|
+
if (_stringToken && _stringToken.type == AddressTokenTypes.STRING && _stringToken.string) {
|
|
947
971
|
if (!ignoreEmptyLines || hasData || hasPreviousData) {
|
|
948
972
|
parts.push(_stringToken.string);
|
|
949
973
|
}
|
|
@@ -951,68 +975,58 @@ function formatLineTokens(
|
|
|
951
975
|
// Consume the last string token
|
|
952
976
|
index = index + 1;
|
|
953
977
|
}
|
|
954
|
-
} else
|
|
955
|
-
// We should not get here
|
|
956
|
-
}
|
|
978
|
+
} else ;
|
|
957
979
|
}
|
|
958
980
|
return parts.join('').trim();
|
|
959
981
|
}
|
|
960
982
|
|
|
961
983
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
984
|
+
* Tokenize address format pattern.
|
|
985
|
+
*
|
|
986
|
+
* @param {AddressToken[]} tokens
|
|
987
|
+
* @param {*} data
|
|
988
|
+
* @param {string} lineBreak
|
|
989
|
+
* @param {boolean} ignoreEmptyLines
|
|
990
|
+
* @return {string} Formatted Address
|
|
991
|
+
*
|
|
992
|
+
* @private
|
|
993
|
+
*/
|
|
972
994
|
function formatTokens(tokens, data, lineBreak, ignoreEmptyLines) {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
for (
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
995
|
+
let lines = [];
|
|
996
|
+
let lineIndex = -1;
|
|
997
|
+
for (let index = 0; index < tokens.length; index++) {
|
|
998
|
+
let doFormat = false;
|
|
999
|
+
let endWithNewLine = false;
|
|
1000
|
+
let token = tokens[index];
|
|
979
1001
|
switch (token.type) {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1002
|
+
case AddressTokenTypes.NEWLINE:
|
|
1003
|
+
{
|
|
1004
|
+
if (lineIndex >= 0) {
|
|
1005
|
+
doFormat = true;
|
|
1006
|
+
endWithNewLine = true;
|
|
1007
|
+
} else if (!ignoreEmptyLines) {
|
|
1008
|
+
lines.push(''); // Empty line
|
|
1009
|
+
// If the pattern ends with a newline
|
|
1010
|
+
if (index + 1 == tokens.length) {
|
|
985
1011
|
lines.push(''); // Empty line
|
|
986
|
-
// If the pattern ends with a newline
|
|
987
|
-
if (index + 1 == tokens.length) {
|
|
988
|
-
lines.push(''); // Empty line
|
|
989
|
-
}
|
|
990
1012
|
}
|
|
991
|
-
break;
|
|
992
|
-
}
|
|
993
|
-
default: {
|
|
994
|
-
lineIndex = lineIndex < 0 ? index : lineIndex;
|
|
995
|
-
doFormat = index + 1 == tokens.length ? true : doFormat;
|
|
996
|
-
break;
|
|
997
1013
|
}
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
default:
|
|
1017
|
+
{
|
|
1018
|
+
lineIndex = lineIndex < 0 ? index : lineIndex;
|
|
1019
|
+
doFormat = index + 1 == tokens.length ? true : doFormat;
|
|
1020
|
+
break;
|
|
1021
|
+
}
|
|
998
1022
|
}
|
|
999
1023
|
if (doFormat) {
|
|
1000
|
-
|
|
1001
|
-
tokens,
|
|
1002
|
-
data,
|
|
1003
|
-
ignoreEmptyLines,
|
|
1004
|
-
lineIndex,
|
|
1005
|
-
endWithNewLine ? index - 1 : index
|
|
1006
|
-
);
|
|
1024
|
+
let line = formatLineTokens(tokens, data, ignoreEmptyLines, lineIndex, endWithNewLine ? index - 1 : index);
|
|
1007
1025
|
if (!ignoreEmptyLines || line) {
|
|
1008
1026
|
lines.push(line);
|
|
1009
1027
|
}
|
|
1010
1028
|
// If line ends with a newline, and it is the last line on pattern
|
|
1011
|
-
if (
|
|
1012
|
-
!ignoreEmptyLines &&
|
|
1013
|
-
endWithNewLine &&
|
|
1014
|
-
index + 1 == tokens.length
|
|
1015
|
-
) {
|
|
1029
|
+
if (!ignoreEmptyLines && endWithNewLine && index + 1 == tokens.length) {
|
|
1016
1030
|
lines.push('');
|
|
1017
1031
|
}
|
|
1018
1032
|
lineIndex = -1;
|
|
@@ -1022,29 +1036,28 @@ function formatTokens(tokens, data, lineBreak, ignoreEmptyLines) {
|
|
|
1022
1036
|
}
|
|
1023
1037
|
|
|
1024
1038
|
/**
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1039
|
+
* Format address data.
|
|
1040
|
+
*
|
|
1041
|
+
* @param {*} data Address data being processed.
|
|
1042
|
+
* @param {string} pattern Address format pattern.
|
|
1043
|
+
* @param {string} lineBreak Line break string to use
|
|
1044
|
+
* @param {boolean} ignoreEmptyLines Ignore lines that has no or empty data to replace.
|
|
1045
|
+
* @return {string} Formatted address.
|
|
1046
|
+
*/
|
|
1033
1047
|
function format(data, pattern, lineBreak, ignoreEmptyLines) {
|
|
1034
1048
|
// TODO: support escapeHtml to match Java class feature parity
|
|
1035
1049
|
ignoreEmptyLines = ignoreEmptyLines === false ? false : true; // Defaults to false
|
|
1036
1050
|
lineBreak = lineBreak || '\n'; // Defaults to <br/> or lf
|
|
1037
|
-
|
|
1051
|
+
let tokens = [];
|
|
1038
1052
|
tokenize(new TokenizerState(pattern, 0), tokens);
|
|
1039
1053
|
return formatTokens(tokens, data, lineBreak, ignoreEmptyLines);
|
|
1040
1054
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
var address = {
|
|
1055
|
+
let addressFormatter = {
|
|
1056
|
+
format: format,
|
|
1057
|
+
};
|
|
1058
|
+
let CJK_COUNTRIES = ['CN', 'HK', 'TW', 'JP', 'KR', 'KP'];
|
|
1059
|
+
let CJK_LANGUAGES = ['zh', 'ja', 'ko'];
|
|
1060
|
+
let address = {
|
|
1048
1061
|
/**
|
|
1049
1062
|
* Gets the globalization for the specified country code.
|
|
1050
1063
|
* A: Address Lines (2 or 3 lines address)
|
|
@@ -1058,21 +1071,17 @@ var address = {
|
|
|
1058
1071
|
* @param {string} countryCode Country Code
|
|
1059
1072
|
* @return {{fmt: string, input: string, require: string}} Format Data
|
|
1060
1073
|
*/
|
|
1061
|
-
getAddressInfoForCountry: function getAddressInfoForCountry(
|
|
1062
|
-
langCode,
|
|
1063
|
-
countryCode
|
|
1064
|
-
) {
|
|
1065
|
-
var code = this.getCountryFromLocale(langCode, countryCode);
|
|
1074
|
+
getAddressInfoForCountry: function getAddressInfoForCountry(langCode, countryCode) {
|
|
1075
|
+
let code = this.getCountryFromLocale(langCode, countryCode);
|
|
1066
1076
|
if (data[code]) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1077
|
+
// Double check.
|
|
1078
|
+
let cloneAddressRep = Object.freeze(Object.assign({}, data[code]));
|
|
1069
1079
|
return Object.freeze({
|
|
1070
1080
|
address: cloneAddressRep,
|
|
1071
1081
|
});
|
|
1072
1082
|
}
|
|
1073
1083
|
return {};
|
|
1074
1084
|
},
|
|
1075
|
-
|
|
1076
1085
|
/**
|
|
1077
1086
|
* Get the format pattern.
|
|
1078
1087
|
* A: Address Lines (2 or 3 lines address)
|
|
@@ -1087,14 +1096,13 @@ var address = {
|
|
|
1087
1096
|
* @return {string} Address Format Pattern
|
|
1088
1097
|
*/
|
|
1089
1098
|
getAddressFormat: function getAddressFormat(langCode, countryCode) {
|
|
1090
|
-
|
|
1099
|
+
let code = this.getCountryFromLocale(langCode, countryCode);
|
|
1091
1100
|
if (data[code]) {
|
|
1092
|
-
|
|
1101
|
+
// Double check.
|
|
1093
1102
|
return data[code].fmt;
|
|
1094
1103
|
}
|
|
1095
1104
|
return '';
|
|
1096
1105
|
},
|
|
1097
|
-
|
|
1098
1106
|
/**
|
|
1099
1107
|
* Get the input order pattern.
|
|
1100
1108
|
* A: Address Lines (2 or 3 lines address)
|
|
@@ -1112,23 +1120,17 @@ var address = {
|
|
|
1112
1120
|
// A special case to deal with en_HK locale. We want to use US like
|
|
1113
1121
|
// format for en_HK.
|
|
1114
1122
|
// See W-4718344
|
|
1115
|
-
if (
|
|
1116
|
-
langCode &&
|
|
1117
|
-
langCode.toLowerCase() == 'en' &&
|
|
1118
|
-
countryCode &&
|
|
1119
|
-
countryCode.toUpperCase() == 'HK'
|
|
1120
|
-
) {
|
|
1123
|
+
if (langCode && langCode.toLowerCase() == 'en' && countryCode && countryCode.toUpperCase() == 'HK') {
|
|
1121
1124
|
langCode = 'en';
|
|
1122
1125
|
countryCode = 'US';
|
|
1123
1126
|
}
|
|
1124
|
-
|
|
1127
|
+
let code = this.getCountryFromLocale(langCode, countryCode);
|
|
1125
1128
|
if (data[code]) {
|
|
1126
|
-
|
|
1129
|
+
// Double check.
|
|
1127
1130
|
return data[code].input;
|
|
1128
1131
|
}
|
|
1129
1132
|
return '';
|
|
1130
1133
|
},
|
|
1131
|
-
|
|
1132
1134
|
/**
|
|
1133
1135
|
* Get the input order pattern for all fields.
|
|
1134
1136
|
* A: Address Lines (2 or 3 lines address)
|
|
@@ -1142,26 +1144,19 @@ var address = {
|
|
|
1142
1144
|
* @param {string} countryCode Country Code
|
|
1143
1145
|
* @return {string} Input Order
|
|
1144
1146
|
*/
|
|
1145
|
-
getAddressInputOrderAllField: function getAddressInputOrderAllField(
|
|
1146
|
-
langCode,
|
|
1147
|
-
countryCode
|
|
1148
|
-
) {
|
|
1147
|
+
getAddressInputOrderAllField: function getAddressInputOrderAllField(langCode, countryCode) {
|
|
1149
1148
|
// A special case to deal with en_HK locale. We want to use US like
|
|
1150
1149
|
// format for en_HK.
|
|
1151
1150
|
// See W-4718344
|
|
1152
|
-
if (
|
|
1153
|
-
langCode &&
|
|
1154
|
-
langCode.toLowerCase() == 'en' &&
|
|
1155
|
-
countryCode &&
|
|
1156
|
-
countryCode.toUpperCase() == 'HK'
|
|
1157
|
-
) {
|
|
1151
|
+
if (langCode && langCode.toLowerCase() == 'en' && countryCode && countryCode.toUpperCase() == 'HK') {
|
|
1158
1152
|
langCode = 'en';
|
|
1159
1153
|
countryCode = 'US';
|
|
1160
1154
|
}
|
|
1161
|
-
|
|
1155
|
+
|
|
1156
|
+
// Double check.
|
|
1157
|
+
let code = this.getCountryFromLocale(langCode, countryCode);
|
|
1162
1158
|
if (data[code]) {
|
|
1163
|
-
|
|
1164
|
-
var input = data[code].input;
|
|
1159
|
+
let input = data[code].input;
|
|
1165
1160
|
|
|
1166
1161
|
// Add missing patterns.
|
|
1167
1162
|
if (input.indexOf('S') === -1) {
|
|
@@ -1173,12 +1168,10 @@ var address = {
|
|
|
1173
1168
|
if (input.indexOf('Z') === -1) {
|
|
1174
1169
|
input = input.replace('C', 'ZC');
|
|
1175
1170
|
}
|
|
1176
|
-
|
|
1177
1171
|
return input;
|
|
1178
1172
|
}
|
|
1179
1173
|
return '';
|
|
1180
1174
|
},
|
|
1181
|
-
|
|
1182
1175
|
/**
|
|
1183
1176
|
* Get required fields.
|
|
1184
1177
|
* A: Address Lines (2 or 3 lines address)
|
|
@@ -1192,18 +1185,14 @@ var address = {
|
|
|
1192
1185
|
* @param {string} countryCode Country Code
|
|
1193
1186
|
* @return {string} Required Fields
|
|
1194
1187
|
*/
|
|
1195
|
-
getAddressRequireFields: function getAddressRequireFields(
|
|
1196
|
-
langCode,
|
|
1197
|
-
countryCode
|
|
1198
|
-
) {
|
|
1199
|
-
var code = this.getCountryFromLocale(langCode, countryCode);
|
|
1188
|
+
getAddressRequireFields: function getAddressRequireFields(langCode, countryCode) {
|
|
1189
|
+
let code = this.getCountryFromLocale(langCode, countryCode);
|
|
1200
1190
|
if (data[code]) {
|
|
1201
|
-
|
|
1191
|
+
// Double check.
|
|
1202
1192
|
return data[code].require;
|
|
1203
1193
|
}
|
|
1204
1194
|
return '';
|
|
1205
1195
|
},
|
|
1206
|
-
|
|
1207
1196
|
/**
|
|
1208
1197
|
* Format a address values for given language code and country code with specified line break.
|
|
1209
1198
|
*
|
|
@@ -1213,16 +1202,11 @@ var address = {
|
|
|
1213
1202
|
* @param {string} lineBreak Line Break
|
|
1214
1203
|
* @return {string} Formatted Address
|
|
1215
1204
|
*/
|
|
1216
|
-
formatAddressAllFields: function formatAddressAllFields(
|
|
1217
|
-
langCode,
|
|
1218
|
-
countryCode,
|
|
1219
|
-
values,
|
|
1220
|
-
lineBreak
|
|
1221
|
-
) {
|
|
1222
|
-
var code = this.getCountryFromLocale(langCode, countryCode, values);
|
|
1205
|
+
formatAddressAllFields: function formatAddressAllFields(langCode, countryCode, values, lineBreak) {
|
|
1206
|
+
let code = this.getCountryFromLocale(langCode, countryCode, values);
|
|
1223
1207
|
if (data[code]) {
|
|
1224
|
-
|
|
1225
|
-
|
|
1208
|
+
// Double check.
|
|
1209
|
+
let pattern = data[code].fmt;
|
|
1226
1210
|
// Some countries don't have City, State or ZIP code. We don't want to
|
|
1227
1211
|
// lose those data from formatted string.
|
|
1228
1212
|
if (values.zipCode && pattern.indexOf('%Z') === -1) {
|
|
@@ -1238,7 +1222,6 @@ var address = {
|
|
|
1238
1222
|
}
|
|
1239
1223
|
return '';
|
|
1240
1224
|
},
|
|
1241
|
-
|
|
1242
1225
|
/**
|
|
1243
1226
|
* Format a address values for given language code and country code with specified line break.
|
|
1244
1227
|
*
|
|
@@ -1248,25 +1231,14 @@ var address = {
|
|
|
1248
1231
|
* @param {string} lineBreak Line Break
|
|
1249
1232
|
* @return {string} Formatted Address
|
|
1250
1233
|
*/
|
|
1251
|
-
formatAddress: function formatAddress(
|
|
1252
|
-
langCode,
|
|
1253
|
-
countryCode,
|
|
1254
|
-
values,
|
|
1255
|
-
lineBreak
|
|
1256
|
-
) {
|
|
1257
|
-
var code = this.getCountryFromLocale(langCode, countryCode, values);
|
|
1234
|
+
formatAddress: function formatAddress(langCode, countryCode, values, lineBreak) {
|
|
1235
|
+
let code = this.getCountryFromLocale(langCode, countryCode, values);
|
|
1258
1236
|
if (data[code]) {
|
|
1259
|
-
|
|
1260
|
-
return this.buildAddressLines(
|
|
1261
|
-
data[code].fmt,
|
|
1262
|
-
values,
|
|
1263
|
-
lineBreak,
|
|
1264
|
-
true
|
|
1265
|
-
);
|
|
1237
|
+
// Double check.
|
|
1238
|
+
return this.buildAddressLines(data[code].fmt, values, lineBreak, true);
|
|
1266
1239
|
}
|
|
1267
1240
|
return '';
|
|
1268
1241
|
},
|
|
1269
|
-
|
|
1270
1242
|
/**
|
|
1271
1243
|
* Creates an array of address lines given the format and the values to use.
|
|
1272
1244
|
*
|
|
@@ -1276,33 +1248,21 @@ var address = {
|
|
|
1276
1248
|
* @param {string} ignoreEmptyLines
|
|
1277
1249
|
* @return {string} the text for use in the address
|
|
1278
1250
|
*/
|
|
1279
|
-
buildAddressLines: function buildAddressLines(
|
|
1280
|
-
pattern,
|
|
1281
|
-
values,
|
|
1282
|
-
lineBreak,
|
|
1283
|
-
ignoreEmptyLines
|
|
1284
|
-
) {
|
|
1285
|
-
return addressFormatter.format(
|
|
1286
|
-
values,
|
|
1287
|
-
pattern,
|
|
1288
|
-
lineBreak,
|
|
1289
|
-
ignoreEmptyLines
|
|
1290
|
-
);
|
|
1251
|
+
buildAddressLines: function buildAddressLines(pattern, values, lineBreak, ignoreEmptyLines) {
|
|
1252
|
+
return addressFormatter.format(values, pattern, lineBreak, ignoreEmptyLines);
|
|
1291
1253
|
},
|
|
1292
|
-
|
|
1293
1254
|
/**
|
|
1294
1255
|
* Resolve the reference by tracing down the _ref value.
|
|
1295
1256
|
* @param {*} data Address Format Data
|
|
1296
1257
|
* @param {string} countryCode Country Code
|
|
1297
1258
|
* @return {*} Referenced Address Format Data
|
|
1298
1259
|
*/
|
|
1299
|
-
followReferences: function followReferences(data
|
|
1300
|
-
if (data
|
|
1301
|
-
return this.followReferences(data
|
|
1260
|
+
followReferences: function followReferences(data, countryCode) {
|
|
1261
|
+
if (data[countryCode] && data[countryCode]._ref) {
|
|
1262
|
+
return this.followReferences(data, data[countryCode]._ref);
|
|
1302
1263
|
}
|
|
1303
1264
|
return countryCode;
|
|
1304
1265
|
},
|
|
1305
|
-
|
|
1306
1266
|
/**
|
|
1307
1267
|
* Check strings for Han characters
|
|
1308
1268
|
*
|
|
@@ -1310,14 +1270,9 @@ var address = {
|
|
|
1310
1270
|
* @return {boolean} true if any of string values contain Han script character
|
|
1311
1271
|
*/
|
|
1312
1272
|
containsHanScript: function containsHanScript() {
|
|
1313
|
-
for (
|
|
1314
|
-
var _len = arguments.length, values = Array(_len), _key = 0;
|
|
1315
|
-
_key < _len;
|
|
1316
|
-
_key++
|
|
1317
|
-
) {
|
|
1273
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1318
1274
|
values[_key] = arguments[_key];
|
|
1319
1275
|
}
|
|
1320
|
-
|
|
1321
1276
|
if (!values || !Array.isArray(values)) return false;
|
|
1322
1277
|
return values.some(function(value) {
|
|
1323
1278
|
if (!value) return false;
|
|
@@ -1325,77 +1280,86 @@ var address = {
|
|
|
1325
1280
|
// Iterating a string returns a char that contains one codepoint.
|
|
1326
1281
|
// Surrogate pairs will be returned as a pair.
|
|
1327
1282
|
// Unicode block ranges: @see http://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
var _iteratorError = undefined;
|
|
1331
|
-
|
|
1283
|
+
let _iterator = _createForOfIteratorHelper(value);
|
|
1284
|
+
let _step;
|
|
1332
1285
|
try {
|
|
1333
|
-
for (
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1286
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1287
|
+
let singleChar = _step.value;
|
|
1288
|
+
let codePoint = singleChar.codePointAt(0); // Thank you ES2015
|
|
1289
|
+
if (0x2e80 <= codePoint && codePoint <= 0x2eff ||
|
|
1290
|
+
// CJK Radicals Supplement
|
|
1291
|
+
0x3300 <= codePoint && codePoint <= 0x33ff ||
|
|
1292
|
+
// CJK Compatibility
|
|
1293
|
+
0xfe30 <= codePoint && codePoint <= 0xfe4f ||
|
|
1294
|
+
// CJK Compatibility Forms
|
|
1295
|
+
0xf900 <= codePoint && codePoint <= 0xfaff ||
|
|
1296
|
+
// CJK Compatibility Ideographs
|
|
1297
|
+
0x2f800 <= codePoint && codePoint <= 0x2fa1f ||
|
|
1298
|
+
// CJK Compatibility Ideographs Supplement
|
|
1299
|
+
0x3000 <= codePoint && codePoint <= 0x303f ||
|
|
1300
|
+
// CJK Symbols and Punctuation
|
|
1301
|
+
0x4e00 <= codePoint && codePoint <= 0x9fff ||
|
|
1302
|
+
// CJK Unified Ideographs
|
|
1303
|
+
0x3400 <= codePoint && codePoint <= 0x4dbf ||
|
|
1304
|
+
// CJK Unified Ideographs Extension A
|
|
1305
|
+
0x20000 <= codePoint && codePoint <= 0x2a6df ||
|
|
1306
|
+
// CJK Unified Ideographs Extension B
|
|
1307
|
+
0x2a700 <= codePoint && codePoint <= 0x2b73f ||
|
|
1308
|
+
// CJK Unified Ideographs Extension C
|
|
1309
|
+
0x2b740 <= codePoint && codePoint <= 0x2b81f ||
|
|
1310
|
+
// CJK Unified Ideographs Extension D
|
|
1311
|
+
0x2b820 <= codePoint && codePoint <= 0x2ceaf ||
|
|
1312
|
+
// CJK Unified Ideographs Extension E // Not on core
|
|
1313
|
+
0x2ceb0 <= codePoint && codePoint <= 0x2ebef ||
|
|
1314
|
+
// CJK Unified Ideographs Extension F // Not on core
|
|
1315
|
+
0x3200 <= codePoint && codePoint <= 0x32ff ||
|
|
1316
|
+
// Enclosed CJK Letters and Months
|
|
1317
|
+
0x31c0 <= codePoint && codePoint <= 0x31ef ||
|
|
1318
|
+
// CJK Strokes
|
|
1319
|
+
// Chinese
|
|
1320
|
+
0x3100 <= codePoint && codePoint <= 0x312f ||
|
|
1321
|
+
// Bopomofo
|
|
1322
|
+
0x31a0 <= codePoint && codePoint <= 0x31bf ||
|
|
1323
|
+
// Bopomofo Extended
|
|
1324
|
+
0x2f00 <= codePoint && codePoint <= 0x2fdf ||
|
|
1325
|
+
// Kangxi Radicals
|
|
1326
|
+
0x2ff0 <= codePoint && codePoint <= 0x2fff ||
|
|
1327
|
+
// Ideographic Description Characters
|
|
1328
|
+
// Japanese
|
|
1329
|
+
0xff00 <= codePoint && codePoint <= 0xffef ||
|
|
1330
|
+
// Halfwidth and Fullwidth Forms
|
|
1331
|
+
0x3040 <= codePoint && codePoint <= 0x309f ||
|
|
1332
|
+
// Hiragana
|
|
1333
|
+
0x30a0 <= codePoint && codePoint <= 0x30ff ||
|
|
1334
|
+
// Katakana
|
|
1335
|
+
0x31f0 <= codePoint && codePoint <= 0x31ff ||
|
|
1336
|
+
// Katakana Phonetic Extensions
|
|
1337
|
+
0x1b000 <= codePoint && codePoint <= 0x1b0ff ||
|
|
1338
|
+
// Kana Supplement
|
|
1339
|
+
0x1b100 <= codePoint && codePoint <= 0x1b12f ||
|
|
1340
|
+
// Kana Extended-A // Not on core
|
|
1341
|
+
// Korean
|
|
1342
|
+
0x1100 <= codePoint && codePoint <= 0x11ff ||
|
|
1343
|
+
// Hangul Jamo
|
|
1344
|
+
0xac00 <= codePoint && codePoint <= 0xd7af ||
|
|
1345
|
+
// Hangul Syllables
|
|
1346
|
+
0x3130 <= codePoint && codePoint <= 0x318f ||
|
|
1347
|
+
// Hangul Compatibility Jamo
|
|
1348
|
+
0xa960 <= codePoint && codePoint <= 0xa97f ||
|
|
1349
|
+
// Hangul Jamo Extended-A
|
|
1350
|
+
0xd7b0 <= codePoint && codePoint <= 0xd7ff // Hangul Jamo Extended-B
|
|
1376
1351
|
) {
|
|
1377
1352
|
return true;
|
|
1378
1353
|
}
|
|
1379
1354
|
}
|
|
1380
1355
|
} catch (err) {
|
|
1381
|
-
|
|
1382
|
-
_iteratorError = err;
|
|
1356
|
+
_iterator.e(err);
|
|
1383
1357
|
} finally {
|
|
1384
|
-
|
|
1385
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
1386
|
-
_iterator.return();
|
|
1387
|
-
}
|
|
1388
|
-
} finally {
|
|
1389
|
-
if (_didIteratorError) {
|
|
1390
|
-
throw _iteratorError;
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1358
|
+
_iterator.f();
|
|
1393
1359
|
}
|
|
1394
|
-
|
|
1395
1360
|
return false;
|
|
1396
1361
|
});
|
|
1397
1362
|
},
|
|
1398
|
-
|
|
1399
1363
|
/**
|
|
1400
1364
|
* Returns the address code (country code) for given locale and data.
|
|
1401
1365
|
*
|
|
@@ -1404,57 +1368,36 @@ var address = {
|
|
|
1404
1368
|
* @param {*} values Address Data
|
|
1405
1369
|
* @return {string} Address Code
|
|
1406
1370
|
*/
|
|
1407
|
-
getCountryFromLocale: function getCountryFromLocale(
|
|
1408
|
-
langCode,
|
|
1409
|
-
countryCode,
|
|
1410
|
-
values
|
|
1411
|
-
) {
|
|
1371
|
+
getCountryFromLocale: function getCountryFromLocale(langCode, countryCode, values) {
|
|
1412
1372
|
if (values) {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
(countryCode &&
|
|
1417
|
-
CJK_COUNTRIES.indexOf(countryCode.toUpperCase()) >= 0);
|
|
1418
|
-
var isJA =
|
|
1419
|
-
(!countryCode && 'ja' == langCode.toLowerCase()) ||
|
|
1420
|
-
(countryCode && 'JP' == countryCode.toUpperCase());
|
|
1373
|
+
let isCJK = !countryCode && CJK_LANGUAGES.indexOf(langCode.toLowerCase()) >= 0 || countryCode && CJK_COUNTRIES.indexOf(countryCode.toUpperCase()) >= 0;
|
|
1374
|
+
let isJA = !countryCode && 'ja' == langCode.toLowerCase() || countryCode && 'JP' == countryCode.toUpperCase();
|
|
1375
|
+
|
|
1421
1376
|
// English format (ja_en_JP) is only used when all fields do not contain CJK characters
|
|
1422
|
-
if (
|
|
1423
|
-
!(
|
|
1424
|
-
isJA &&
|
|
1425
|
-
this.containsHanScript(
|
|
1426
|
-
values.address,
|
|
1427
|
-
values.city,
|
|
1428
|
-
values.state,
|
|
1429
|
-
values.country
|
|
1430
|
-
)
|
|
1431
|
-
) &&
|
|
1432
|
-
isCJK &&
|
|
1433
|
-
!this.containsHanScript(values.address)
|
|
1434
|
-
) {
|
|
1377
|
+
if (!(isJA && this.containsHanScript(values.address, values.city, values.state, values.country)) && isCJK && !this.containsHanScript(values.address)) {
|
|
1435
1378
|
return this.getCountryFromLocale(langCode, 'EN_' + countryCode);
|
|
1436
1379
|
}
|
|
1437
1380
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1381
|
+
let country = countryCode;
|
|
1382
|
+
// hack for 'uz_Latn_UZ'. caller may pass 'Latn' as countryCode. override with 'UZ' here.
|
|
1383
|
+
if (langCode == 'uz' && country && country.toLowerCase() == 'latn') {
|
|
1384
|
+
country = 'UZ';
|
|
1385
|
+
}
|
|
1440
1386
|
|
|
1441
1387
|
// Address format should be always associated to a COUNTRY.
|
|
1442
1388
|
// If country part is empty, we need to map language to a
|
|
1443
|
-
// certain country. For example, "de" -> "DE".
|
|
1444
|
-
if (!
|
|
1389
|
+
// certain country. For example, "de" -> "DE".da
|
|
1390
|
+
if (!country && languageCodeToCountry.languageCode[langCode]) {
|
|
1445
1391
|
country = languageCodeToCountry.languageCode[langCode];
|
|
1446
1392
|
}
|
|
1447
1393
|
|
|
1448
1394
|
// Trace the real data from country reference.
|
|
1449
1395
|
country = this.followReferences(data, country);
|
|
1450
|
-
|
|
1451
1396
|
if (!country || !data[country]) {
|
|
1452
1397
|
return 'US'; // Always fall back to US format.
|
|
1453
1398
|
}
|
|
1454
|
-
|
|
1455
1399
|
return country;
|
|
1456
1400
|
},
|
|
1457
|
-
|
|
1458
1401
|
/**
|
|
1459
1402
|
* Get fall back country code.
|
|
1460
1403
|
*
|