q2-tecton-elements 1.60.3 → 1.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-report.json +16580 -15448
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-group_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/q2-badge.cjs.entry.js +82 -0
- package/dist/cjs/q2-badge.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-badge.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-btn.q2-loading.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-btn_2.cjs.entry.js +432 -0
- package/dist/cjs/q2-btn_2.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-data-table.cjs.entry.js +1 -1
- package/dist/cjs/q2-data-table.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-data-table.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-file-picker.cjs.entry.js +15 -3
- package/dist/cjs/q2-file-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-file-picker.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-grid-area.cjs.entry.js +2 -2
- package/dist/cjs/q2-grid-area.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-grid-area.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +715 -0
- package/dist/cjs/q2-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-icon.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-input.cjs.entry.js +3556 -0
- package/dist/cjs/q2-input.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-input.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-legend.cjs.entry.js +1 -1
- package/dist/cjs/q2-legend.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-legend.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-link.q2-list.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-link_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-link_2.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-meter.cjs.entry.js +109 -0
- package/dist/cjs/q2-meter.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-meter.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-modal.cjs.entry.js +2 -2
- package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
- package/dist/cjs/q2-pagination.cjs.entry.js +23 -10
- package/dist/cjs/q2-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-pagination.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-pill.cjs.entry.js +36 -12
- package/dist/cjs/q2-pill.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-pill.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-relative-time.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +2 -2
- package/dist/cjs/q2-select.cjs.entry.js +6 -3
- package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-select.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +280 -0
- package/dist/cjs/q2-tab-container.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-tab-container.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-tab-pane.cjs.entry.js +34 -0
- package/dist/cjs/q2-tab-pane.cjs.entry.js.map +1 -0
- package/dist/cjs/q2-tab-pane.entry.cjs.js.map +1 -0
- package/dist/cjs/q2-tag.cjs.entry.js +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/{sanitize-html-string-BtI99lfg.js → sanitize-html-string-DPqrzfM9.js} +61 -27
- package/dist/cjs/sanitize-html-string-DPqrzfM9.js.map +1 -0
- package/dist/cjs/sprites-DZZE7UFT.js +22 -0
- package/dist/cjs/sprites-DZZE7UFT.js.map +1 -0
- package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/q2-data-table/q2-data-table.css +23 -2
- package/dist/collection/components/q2-file-picker/q2-file-picker.css +5 -0
- package/dist/collection/components/q2-file-picker/q2-file-picker.js +33 -2
- package/dist/collection/components/q2-file-picker/q2-file-picker.js.map +1 -1
- package/dist/collection/components/q2-grid-area/q2-grid-area.js +15 -15
- package/dist/collection/components/q2-grid-area/q2-grid-area.js.map +1 -1
- package/dist/collection/components/q2-icon/assets/brand.symbol.svg +1 -1
- package/dist/collection/components/q2-icon/assets/standard.symbol.svg +1 -1
- package/dist/collection/components/q2-legend/q2-legend.css +7 -7
- package/dist/collection/components/q2-link/q2-link.css +3 -3
- package/dist/collection/components/q2-meter/q2-meter.css +230 -0
- package/dist/collection/components/q2-meter/q2-meter.js +384 -0
- package/dist/collection/components/q2-meter/q2-meter.js.map +1 -0
- package/dist/collection/components/q2-modal/q2-modal.js +1 -1
- package/dist/collection/components/q2-optgroup/q2-optgroup.js +1 -1
- package/dist/collection/components/q2-pagination/q2-pagination.js +29 -15
- package/dist/collection/components/q2-pagination/q2-pagination.js.map +1 -1
- package/dist/collection/components/q2-pill/q2-pill.css +10 -4
- package/dist/collection/components/q2-pill/q2-pill.js +35 -11
- package/dist/collection/components/q2-pill/q2-pill.js.map +1 -1
- package/dist/collection/components/q2-relative-time/q2-relative-time.js +1 -1
- package/dist/collection/components/q2-resize-observer/q2-resize-observer.js +1 -1
- package/dist/collection/components/q2-section/q2-section.js +2 -2
- package/dist/collection/components/q2-select/q2-select.js +6 -3
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/collection/components/q2-stepper/q2-stepper.js +1 -1
- package/dist/collection/components/q2-stepper-vertical/q2-stepper-vertical.js +1 -1
- package/dist/collection/components/q2-tab-container/q2-tab-container.js +1 -1
- package/dist/collection/components/q2-tab-pane/q2-tab-pane.js +1 -1
- package/dist/collection/components/q2-tag/q2-tag.js +1 -1
- package/dist/collection/components/tecton-tab-pane/tecton-tab-pane.js +2 -2
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/q2-data-table.js +1 -1
- package/dist/components/q2-data-table.js.map +1 -1
- package/dist/components/q2-file-picker.js +16 -3
- package/dist/components/q2-file-picker.js.map +1 -1
- package/dist/components/q2-grid-area.js +8 -8
- package/dist/components/q2-grid-area.js.map +1 -1
- package/dist/components/q2-legend2.js +1 -1
- package/dist/components/q2-legend2.js.map +1 -1
- package/dist/components/q2-link2.js +1 -1
- package/dist/components/q2-link2.js.map +1 -1
- package/dist/components/q2-meter.d.ts +11 -0
- package/dist/components/q2-meter.js +145 -0
- package/dist/components/q2-meter.js.map +1 -0
- package/dist/components/q2-modal.js +1 -1
- package/dist/components/q2-optgroup2.js +1 -1
- package/dist/components/q2-pagination.js +24 -11
- package/dist/components/q2-pagination.js.map +1 -1
- package/dist/components/q2-pill.js +36 -12
- package/dist/components/q2-pill.js.map +1 -1
- package/dist/components/q2-relative-time.js +1 -1
- package/dist/components/q2-resize-observer2.js +1 -1
- package/dist/components/q2-section.js +2 -2
- package/dist/components/q2-select2.js +6 -3
- package/dist/components/q2-select2.js.map +1 -1
- package/dist/components/q2-stepper-vertical.js +1 -1
- package/dist/components/q2-stepper.js +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tab-pane.js +1 -1
- package/dist/components/q2-tag.js +1 -1
- package/dist/components/q2-tooltip.js +1 -127
- package/dist/components/q2-tooltip.js.map +1 -1
- package/dist/components/q2-tooltip2.js +132 -0
- package/dist/components/q2-tooltip2.js.map +1 -0
- package/dist/components/sanitize-html-string.js +59 -25
- package/dist/components/sanitize-html-string.js.map +1 -1
- package/dist/components/tecton-tab-pane.js +2 -2
- package/dist/esm/{index-xCuy-dFb.js → index-LNnzUeDP.js} +3 -3
- package/dist/esm/{index-xCuy-dFb.js.map → index-LNnzUeDP.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-group_2.entry.js +2 -2
- package/dist/esm/q2-action-sheet.entry.js +2 -2
- package/dist/esm/q2-badge.entry.js +80 -0
- package/dist/esm/q2-badge.entry.js.map +1 -0
- package/dist/esm/q2-btn.q2-loading.entry.js.map +1 -0
- package/dist/esm/q2-btn_2.entry.js +429 -0
- package/dist/esm/q2-btn_2.entry.js.map +1 -0
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +1 -1
- package/dist/esm/q2-chart-bar.entry.js +1 -1
- package/dist/esm/q2-chart-donut.entry.js +1 -1
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-context.entry.js +1 -1
- package/dist/esm/q2-data-table.entry.js +2 -2
- package/dist/esm/q2-data-table.entry.js.map +1 -1
- package/dist/esm/q2-detail.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-file-picker.entry.js +16 -4
- package/dist/esm/q2-file-picker.entry.js.map +1 -1
- package/dist/esm/q2-grid-area.entry.js +2 -2
- package/dist/esm/q2-grid-area.entry.js.map +1 -1
- package/dist/esm/q2-icon.entry.js +713 -0
- package/dist/esm/q2-icon.entry.js.map +1 -0
- package/dist/esm/q2-input.entry.js +3554 -0
- package/dist/esm/q2-input.entry.js.map +1 -0
- package/dist/esm/q2-item.entry.js +1 -1
- package/dist/esm/q2-legend.entry.js +1 -1
- package/dist/esm/q2-legend.entry.js.map +1 -1
- package/dist/esm/q2-link.q2-list.entry.js.map +1 -1
- package/dist/esm/q2-link_2.entry.js +2 -2
- package/dist/esm/q2-link_2.entry.js.map +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +1 -1
- package/dist/esm/q2-meter.entry.js +107 -0
- package/dist/esm/q2-meter.entry.js.map +1 -0
- package/dist/esm/q2-modal.entry.js +3 -3
- package/dist/esm/q2-month-picker.entry.js +1 -1
- package/dist/esm/q2-optgroup.entry.js +2 -2
- package/dist/esm/q2-option-list_2.entry.js +1 -1
- package/dist/esm/q2-option.entry.js +1 -1
- package/dist/esm/q2-pagination.entry.js +24 -11
- package/dist/esm/q2-pagination.entry.js.map +1 -1
- package/dist/esm/q2-pill.entry.js +37 -13
- package/dist/esm/q2-pill.entry.js.map +1 -1
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-relative-time.entry.js +2 -2
- package/dist/esm/q2-section.entry.js +3 -3
- package/dist/esm/q2-select.entry.js +7 -4
- package/dist/esm/q2-select.entry.js.map +1 -1
- package/dist/esm/q2-stepper-pane.entry.js +1 -1
- package/dist/esm/q2-stepper-vertical.entry.js +2 -2
- package/dist/esm/q2-stepper.entry.js +2 -2
- package/dist/esm/q2-tab-container.entry.js +278 -0
- package/dist/esm/q2-tab-container.entry.js.map +1 -0
- package/dist/esm/q2-tab-pane.entry.js +32 -0
- package/dist/esm/q2-tab-pane.entry.js.map +1 -0
- package/dist/esm/q2-tag.entry.js +2 -2
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/esm/q2-tooltip.entry.js +1 -1
- package/dist/esm/{sanitize-html-string-DL0kgllh.js → sanitize-html-string-DOVERJq5.js} +61 -27
- package/dist/esm/sanitize-html-string-DOVERJq5.js.map +1 -0
- package/dist/esm/sprites-jG2RmiwF.js +20 -0
- package/dist/esm/sprites-jG2RmiwF.js.map +1 -0
- package/dist/esm/tecton-tab-pane.entry.js +2 -2
- package/dist/q2-tecton-elements/assets/brand.symbol.svg +1 -1
- package/dist/q2-tecton-elements/assets/standard.symbol.svg +1 -1
- package/dist/q2-tecton-elements/{index-xCuy-dFb.js → index-LNnzUeDP.js} +3 -3
- package/dist/q2-tecton-elements/{index-xCuy-dFb.js.map → index-LNnzUeDP.js.map} +1 -1
- package/dist/q2-tecton-elements/q2-action-group_2.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-action-sheet.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-badge.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-badge.entry.js +84 -0
- package/dist/q2-tecton-elements/q2-badge.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-btn.q2-loading.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-btn_2.entry.js +453 -0
- package/dist/q2-tecton-elements/q2-btn_2.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-calendar.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-card.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-carousel-pane.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-carousel.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-chart-area.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-chart-bar.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-chart-donut.entry.js +9 -9
- package/dist/q2-tecton-elements/q2-checkbox-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-checkbox.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-context.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-data-table.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-data-table.entry.js +109 -109
- package/dist/q2-tecton-elements/q2-data-table.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-detail.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-dropdown.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-editable-field.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-file-picker.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-file-picker.entry.js +112 -93
- package/dist/q2-tecton-elements/q2-file-picker.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-grid-area.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-grid-area.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-grid-area.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-icon.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-icon.entry.js +870 -0
- package/dist/q2-tecton-elements/q2-icon.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-input.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-input.entry.js +3883 -0
- package/dist/q2-tecton-elements/q2-input.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-item.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-legend.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-legend.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-legend.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-link.q2-list.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-link_2.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-link_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-loc.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-message.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-meter.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-meter.entry.js +176 -0
- package/dist/q2-tecton-elements/q2-meter.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-modal.entry.js +24 -24
- package/dist/q2-tecton-elements/q2-month-picker.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-optgroup.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js +15 -15
- package/dist/q2-tecton-elements/q2-option.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-pagination.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-pagination.entry.js +43 -33
- package/dist/q2-tecton-elements/q2-pagination.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-pill.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-pill.entry.js +57 -36
- package/dist/q2-tecton-elements/q2-pill.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-radio-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-radio.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-relative-time.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-section.entry.js +21 -21
- package/dist/q2-tecton-elements/q2-select.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-select.entry.js +7 -4
- package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-stepper-pane.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js +19 -19
- package/dist/q2-tecton-elements/q2-stepper.entry.js +13 -13
- package/dist/q2-tecton-elements/q2-tab-container.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-tab-container.entry.js +348 -0
- package/dist/q2-tecton-elements/q2-tab-container.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-tab-pane.entry.esm.js.map +1 -0
- package/dist/q2-tecton-elements/q2-tab-pane.entry.js +44 -0
- package/dist/q2-tecton-elements/q2-tab-pane.entry.js.map +1 -0
- package/dist/q2-tecton-elements/q2-tag.entry.js +57 -57
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-textarea.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-tooltip.entry.js +1 -1
- package/dist/q2-tecton-elements/{sanitize-html-string-DL0kgllh.js → sanitize-html-string-DOVERJq5.js} +314 -282
- package/dist/q2-tecton-elements/sanitize-html-string-DOVERJq5.js.map +1 -0
- package/dist/q2-tecton-elements/sprites-jG2RmiwF.js +18 -0
- package/dist/q2-tecton-elements/sprites-jG2RmiwF.js.map +1 -0
- package/dist/q2-tecton-elements/tecton-tab-pane.entry.js +6 -6
- package/dist/types/components/q2-file-picker/q2-file-picker.d.ts +5 -0
- package/dist/types/components/q2-grid-area/q2-grid-area.d.ts +6 -6
- package/dist/types/components/q2-meter/q2-meter.d.ts +70 -0
- package/dist/types/components/q2-pagination/q2-pagination.d.ts +2 -1
- package/dist/types/components/q2-pill/q2-pill.d.ts +8 -1
- package/dist/types/components.d.ts +147 -4
- package/package.json +3 -3
- package/dist/cjs/q2-badge.q2-btn.q2-icon.q2-input.q2-loading.q2-tab-container.q2-tab-pane.entry.cjs.js.map +0 -1
- package/dist/cjs/q2-badge_7.cjs.entry.js +0 -5074
- package/dist/cjs/q2-badge_7.cjs.entry.js.map +0 -1
- package/dist/cjs/sanitize-html-string-BtI99lfg.js.map +0 -1
- package/dist/esm/q2-badge.q2-btn.q2-icon.q2-input.q2-loading.q2-tab-container.q2-tab-pane.entry.js.map +0 -1
- package/dist/esm/q2-badge_7.entry.js +0 -5066
- package/dist/esm/q2-badge_7.entry.js.map +0 -1
- package/dist/esm/sanitize-html-string-DL0kgllh.js.map +0 -1
- package/dist/q2-tecton-elements/q2-badge.q2-btn.q2-icon.q2-input.q2-loading.q2-tab-container.q2-tab-pane.entry.esm.js.map +0 -1
- package/dist/q2-tecton-elements/q2-badge_7.entry.js +0 -5659
- package/dist/q2-tecton-elements/q2-badge_7.entry.js.map +0 -1
- package/dist/q2-tecton-elements/sanitize-html-string-DL0kgllh.js.map +0 -1
|
@@ -0,0 +1,3556 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BYXz4owL.js');
|
|
4
|
+
var index$1 = require('./index-BuXzB2ML.js');
|
|
5
|
+
|
|
6
|
+
function formatNumber(val = '', options = {
|
|
7
|
+
prefix: '',
|
|
8
|
+
suffix: '',
|
|
9
|
+
decimals: 0,
|
|
10
|
+
decimalSeparator: '.',
|
|
11
|
+
thousandsSeparator: '',
|
|
12
|
+
allowDecimal: false,
|
|
13
|
+
allowNegative: true,
|
|
14
|
+
}, explicit = false) {
|
|
15
|
+
const isNegative = val[0] === '-';
|
|
16
|
+
let value = val;
|
|
17
|
+
const allowDecimal = !!options.allowDecimal && !!options.decimals;
|
|
18
|
+
if (explicit) {
|
|
19
|
+
const parsedValue = value.replace(/[^\d.]/g, '');
|
|
20
|
+
value = (parsedValue && Number(parsedValue).toFixed(allowDecimal ? options.decimals : 0)) || '';
|
|
21
|
+
}
|
|
22
|
+
value = value.replace(/[^\d]/g, '');
|
|
23
|
+
let { integerString, decimalString } = splitValue(value, allowDecimal, options.decimals);
|
|
24
|
+
// define decimalString
|
|
25
|
+
let decimalSeparator = options.decimalSeparator;
|
|
26
|
+
if (!allowDecimal) {
|
|
27
|
+
decimalSeparator = '';
|
|
28
|
+
decimalString = '';
|
|
29
|
+
}
|
|
30
|
+
// define negative
|
|
31
|
+
const negativeSymbol = options.allowNegative && isNegative ? '-' : '';
|
|
32
|
+
value = `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}`;
|
|
33
|
+
// format integerString
|
|
34
|
+
integerString = integerString.replace(/\B(?=(\d{3})+(?!\d))/g, options.thousandsSeparator);
|
|
35
|
+
const formattedValue = negativeSymbol || integerString ? `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}` : '';
|
|
36
|
+
const fullyFormattedValue = negativeSymbol || integerString
|
|
37
|
+
? `${negativeSymbol}${options.prefix}${integerString}${decimalSeparator}${decimalString}${options.suffix}`
|
|
38
|
+
: '';
|
|
39
|
+
let formattingCharacterCount = formattedValue.length - value.length;
|
|
40
|
+
if (decimalSeparator) {
|
|
41
|
+
formattingCharacterCount = formattingCharacterCount + options.decimalSeparator.length;
|
|
42
|
+
}
|
|
43
|
+
const prefix = options.prefix || options.suffix;
|
|
44
|
+
const maxlength = Number.MAX_SAFE_INTEGER.toString().length + formattingCharacterCount + decimalString.length;
|
|
45
|
+
const unformattedValue = `${integerString.replace(/[^0-9]/g, '')}${decimalString}`.replace(/^0+/, '');
|
|
46
|
+
return {
|
|
47
|
+
value,
|
|
48
|
+
formattedValue,
|
|
49
|
+
fullyFormattedValue,
|
|
50
|
+
prefix,
|
|
51
|
+
suffix: '',
|
|
52
|
+
formattingCharacterCount,
|
|
53
|
+
maxlength,
|
|
54
|
+
unformattedValue,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function splitValue(value, allowDecimal = false, decimals) {
|
|
58
|
+
if (!allowDecimal) {
|
|
59
|
+
return {
|
|
60
|
+
integerString: value,
|
|
61
|
+
decimalString: '',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const splitIndex = value.length - decimals;
|
|
65
|
+
let integerString = value.substring(0, splitIndex).padStart(1, '0');
|
|
66
|
+
if (integerString.length > 1 && integerString[0] === '0') {
|
|
67
|
+
integerString = integerString.substring(1);
|
|
68
|
+
}
|
|
69
|
+
const decimalString = value.substring(splitIndex).padStart(decimals, '0');
|
|
70
|
+
return {
|
|
71
|
+
integerString,
|
|
72
|
+
decimalString,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatValue(value = '', mask = '', options) {
|
|
77
|
+
const prefix = (options && options.prefix) || '';
|
|
78
|
+
const suffix = (options && options.suffix) || '';
|
|
79
|
+
if (!value || !mask) {
|
|
80
|
+
const fullyFormattedValue = `${prefix}${value}${suffix}`;
|
|
81
|
+
return {
|
|
82
|
+
value,
|
|
83
|
+
formattedValue: value,
|
|
84
|
+
fullyFormattedValue,
|
|
85
|
+
prefix: prefix.trim() || suffix.trim(),
|
|
86
|
+
formattingCharacterCount: 0,
|
|
87
|
+
unformattedValue: value,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const { unformattedValue, formattedValue, formattingCharacterCount } = generateMask(value, mask);
|
|
91
|
+
const fullyFormattedValue = `${prefix}${formattedValue}${suffix}`;
|
|
92
|
+
const maxlength = mask.length;
|
|
93
|
+
const minFormattedLength = getMinimumFormattedLength(mask, prefix, suffix);
|
|
94
|
+
return {
|
|
95
|
+
value: unformattedValue,
|
|
96
|
+
formattedValue,
|
|
97
|
+
fullyFormattedValue,
|
|
98
|
+
prefix: prefix.trim() || suffix.trim(),
|
|
99
|
+
formattingCharacterCount,
|
|
100
|
+
maxlength,
|
|
101
|
+
minFormattedLength,
|
|
102
|
+
unformattedValue,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const optionalValidatingChars = ['?'];
|
|
106
|
+
function isOptionalValidatingChar(character) {
|
|
107
|
+
return optionalValidatingChars.includes(character);
|
|
108
|
+
}
|
|
109
|
+
const knownValidatingChars = ['#', '@', '*', ...optionalValidatingChars];
|
|
110
|
+
function isKnownValidatingChar(character) {
|
|
111
|
+
return knownValidatingChars.includes(character);
|
|
112
|
+
}
|
|
113
|
+
function getStaticFormattingChars(mask) {
|
|
114
|
+
const knownChars = knownValidatingChars.join('|');
|
|
115
|
+
const formattingChars = mask.replace(new RegExp(`[${knownChars}]`, 'g'), '').split('');
|
|
116
|
+
return new Set(formattingChars);
|
|
117
|
+
}
|
|
118
|
+
function isStaticFormattingChar(character, formattingChars) {
|
|
119
|
+
return formattingChars.has(character);
|
|
120
|
+
}
|
|
121
|
+
function getValidatedChar(char, matcher) {
|
|
122
|
+
switch (matcher) {
|
|
123
|
+
case '#':
|
|
124
|
+
char = char.replace(/[^\d]/g, '');
|
|
125
|
+
break;
|
|
126
|
+
case '@':
|
|
127
|
+
char = char.toUpperCase().replace(/[^A-Z]+/g, ''); // allows only upper case
|
|
128
|
+
break;
|
|
129
|
+
case '*':
|
|
130
|
+
char = char.toUpperCase().replace(/[^\dA-Z]+/g, '');
|
|
131
|
+
break;
|
|
132
|
+
case '?':
|
|
133
|
+
char = char.replace(/[^\d]/g, '');
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
return char;
|
|
137
|
+
}
|
|
138
|
+
return char;
|
|
139
|
+
}
|
|
140
|
+
function generateMask(value, mask) {
|
|
141
|
+
const maskArray = mask.split('');
|
|
142
|
+
const formattingChars = getStaticFormattingChars(mask);
|
|
143
|
+
let currentValueIndex = 0;
|
|
144
|
+
let formattingCharacterCount = 0;
|
|
145
|
+
let unformattedValue = '';
|
|
146
|
+
const formattedValue = maskArray.reduce((acc, character) => {
|
|
147
|
+
if (currentValueIndex >= value.length) {
|
|
148
|
+
return acc;
|
|
149
|
+
}
|
|
150
|
+
if (isOptionalValidatingChar(character) && isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
|
|
151
|
+
return acc;
|
|
152
|
+
}
|
|
153
|
+
if (isKnownValidatingChar(character)) {
|
|
154
|
+
// Step value index if formatting character pushed out of place by user input
|
|
155
|
+
currentValueIndex = getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
|
|
156
|
+
if (currentValueIndex >= value.length) {
|
|
157
|
+
return acc;
|
|
158
|
+
}
|
|
159
|
+
const validChar = getValidatedChar(value[currentValueIndex], character);
|
|
160
|
+
acc += validChar;
|
|
161
|
+
unformattedValue += validChar;
|
|
162
|
+
currentValueIndex++;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Static formatting characters added directly to formatted string
|
|
166
|
+
acc += character;
|
|
167
|
+
formattingCharacterCount++;
|
|
168
|
+
if (character === value[currentValueIndex]) {
|
|
169
|
+
// Continue to walk value if next value at this index matches formatting character
|
|
170
|
+
currentValueIndex++;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return acc;
|
|
174
|
+
}, '');
|
|
175
|
+
return {
|
|
176
|
+
unformattedValue,
|
|
177
|
+
formattedValue,
|
|
178
|
+
formattingCharacterCount,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars) {
|
|
182
|
+
if (isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
|
|
183
|
+
currentValueIndex++;
|
|
184
|
+
return getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
|
|
185
|
+
}
|
|
186
|
+
return currentValueIndex;
|
|
187
|
+
}
|
|
188
|
+
function getMinimumFormattedLength(mask, prefix, suffix) {
|
|
189
|
+
return (mask.replace(new RegExp(`[${optionalValidatingChars.join('|')}]`, 'g'), '').length +
|
|
190
|
+
prefix.length +
|
|
191
|
+
suffix.length);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// decimal data source: http://www.iso.org/iso/home/standards/currency_codes.htm 09/Nov/2016
|
|
195
|
+
const currencyFormats = {
|
|
196
|
+
AED: {
|
|
197
|
+
prefix: '',
|
|
198
|
+
suffix: 'د.إ',
|
|
199
|
+
decimals: 2,
|
|
200
|
+
decimalSeparator: '.',
|
|
201
|
+
thousandsSeparator: ',',
|
|
202
|
+
}, // '9,999.99د.إ'
|
|
203
|
+
AFN: {
|
|
204
|
+
prefix: '¤',
|
|
205
|
+
suffix: '',
|
|
206
|
+
decimals: 2,
|
|
207
|
+
decimalSeparator: '.',
|
|
208
|
+
thousandsSeparator: ',',
|
|
209
|
+
}, // '¤9,999.99'
|
|
210
|
+
ALL: {
|
|
211
|
+
prefix: 'L',
|
|
212
|
+
suffix: '',
|
|
213
|
+
decimals: 2,
|
|
214
|
+
decimalSeparator: '.',
|
|
215
|
+
thousandsSeparator: ',',
|
|
216
|
+
}, // 'L9,999.99'
|
|
217
|
+
AMD: {
|
|
218
|
+
prefix: 'դր.',
|
|
219
|
+
suffix: '',
|
|
220
|
+
decimals: 2,
|
|
221
|
+
decimalSeparator: '.',
|
|
222
|
+
thousandsSeparator: ',',
|
|
223
|
+
}, // 'դր.9,999.99'
|
|
224
|
+
ANG: {
|
|
225
|
+
prefix: 'ƒ',
|
|
226
|
+
suffix: '',
|
|
227
|
+
decimals: 2,
|
|
228
|
+
decimalSeparator: '.',
|
|
229
|
+
thousandsSeparator: ',',
|
|
230
|
+
}, // 'ƒ9,999.99'
|
|
231
|
+
AOA: {
|
|
232
|
+
prefix: 'Kz',
|
|
233
|
+
suffix: '',
|
|
234
|
+
decimals: 2,
|
|
235
|
+
decimalSeparator: '.',
|
|
236
|
+
thousandsSeparator: ',',
|
|
237
|
+
}, // 'Kz9,999.99'
|
|
238
|
+
ARS: {
|
|
239
|
+
prefix: '$',
|
|
240
|
+
suffix: '',
|
|
241
|
+
decimals: 2,
|
|
242
|
+
decimalSeparator: '.',
|
|
243
|
+
thousandsSeparator: ',',
|
|
244
|
+
}, // '$9,999.99'
|
|
245
|
+
AUD: {
|
|
246
|
+
prefix: '$',
|
|
247
|
+
suffix: '',
|
|
248
|
+
decimals: 2,
|
|
249
|
+
decimalSeparator: '.',
|
|
250
|
+
thousandsSeparator: ',',
|
|
251
|
+
}, // '$9,999.99'
|
|
252
|
+
AWG: {
|
|
253
|
+
prefix: 'ƒ',
|
|
254
|
+
suffix: '',
|
|
255
|
+
decimals: 2,
|
|
256
|
+
decimalSeparator: '.',
|
|
257
|
+
thousandsSeparator: ',',
|
|
258
|
+
}, // 'ƒ9,999.99'
|
|
259
|
+
AZN: {
|
|
260
|
+
prefix: '¤',
|
|
261
|
+
suffix: '',
|
|
262
|
+
decimals: 2,
|
|
263
|
+
decimalSeparator: '.',
|
|
264
|
+
thousandsSeparator: ',',
|
|
265
|
+
}, // '¤9,999.99'
|
|
266
|
+
BAM: {
|
|
267
|
+
prefix: 'КМ',
|
|
268
|
+
suffix: '',
|
|
269
|
+
decimals: 2,
|
|
270
|
+
decimalSeparator: '.',
|
|
271
|
+
thousandsSeparator: ',',
|
|
272
|
+
}, // 'КМ9,999.99'
|
|
273
|
+
BBD: {
|
|
274
|
+
prefix: '$',
|
|
275
|
+
suffix: '',
|
|
276
|
+
decimals: 2,
|
|
277
|
+
decimalSeparator: '.',
|
|
278
|
+
thousandsSeparator: ',',
|
|
279
|
+
}, // '$9,999.99'
|
|
280
|
+
BDT: {
|
|
281
|
+
prefix: '৳',
|
|
282
|
+
suffix: '',
|
|
283
|
+
decimals: 2,
|
|
284
|
+
decimalSeparator: '.',
|
|
285
|
+
thousandsSeparator: ',',
|
|
286
|
+
}, // '৳9,999.99'
|
|
287
|
+
BGN: {
|
|
288
|
+
prefix: '৳',
|
|
289
|
+
suffix: '',
|
|
290
|
+
decimals: 2,
|
|
291
|
+
decimalSeparator: '.',
|
|
292
|
+
thousandsSeparator: ',',
|
|
293
|
+
}, // '৳9,999.99'
|
|
294
|
+
BHD: {
|
|
295
|
+
prefix: '',
|
|
296
|
+
suffix: 'ب.د',
|
|
297
|
+
decimals: 3,
|
|
298
|
+
decimalSeparator: '.',
|
|
299
|
+
thousandsSeparator: ',',
|
|
300
|
+
}, // '9,999.999ب.د'
|
|
301
|
+
BIF: {
|
|
302
|
+
prefix: 'Fr',
|
|
303
|
+
suffix: '',
|
|
304
|
+
decimals: 0,
|
|
305
|
+
decimalSeparator: '.',
|
|
306
|
+
thousandsSeparator: ',',
|
|
307
|
+
}, // 'Fr9,999'
|
|
308
|
+
BMD: {
|
|
309
|
+
prefix: '$',
|
|
310
|
+
suffix: '',
|
|
311
|
+
decimals: 2,
|
|
312
|
+
decimalSeparator: '.',
|
|
313
|
+
thousandsSeparator: ',',
|
|
314
|
+
}, // '$9,999.99'
|
|
315
|
+
BND: {
|
|
316
|
+
prefix: '$',
|
|
317
|
+
suffix: '',
|
|
318
|
+
decimals: 2,
|
|
319
|
+
decimalSeparator: '.',
|
|
320
|
+
thousandsSeparator: ',',
|
|
321
|
+
}, // '$9,999.99'
|
|
322
|
+
BOB: {
|
|
323
|
+
prefix: 'Bs.',
|
|
324
|
+
suffix: '',
|
|
325
|
+
decimals: 2,
|
|
326
|
+
decimalSeparator: '.',
|
|
327
|
+
thousandsSeparator: ',',
|
|
328
|
+
}, // 'Bs.9,999.99'
|
|
329
|
+
BRL: {
|
|
330
|
+
prefix: 'R$',
|
|
331
|
+
suffix: '',
|
|
332
|
+
decimals: 2,
|
|
333
|
+
decimalSeparator: '.',
|
|
334
|
+
thousandsSeparator: ',',
|
|
335
|
+
}, // 'R$9,999.99'
|
|
336
|
+
BSD: {
|
|
337
|
+
prefix: '$',
|
|
338
|
+
suffix: '',
|
|
339
|
+
decimals: 2,
|
|
340
|
+
decimalSeparator: '.',
|
|
341
|
+
thousandsSeparator: ',',
|
|
342
|
+
}, // '$9,999.99'
|
|
343
|
+
BTN: {
|
|
344
|
+
prefix: '¤',
|
|
345
|
+
suffix: '',
|
|
346
|
+
decimals: 2,
|
|
347
|
+
decimalSeparator: '.',
|
|
348
|
+
thousandsSeparator: ',',
|
|
349
|
+
}, // '¤9,999.99'
|
|
350
|
+
BWP: {
|
|
351
|
+
prefix: 'P',
|
|
352
|
+
suffix: '',
|
|
353
|
+
decimals: 2,
|
|
354
|
+
decimalSeparator: '.',
|
|
355
|
+
thousandsSeparator: ',',
|
|
356
|
+
}, // 'P9,999.99'
|
|
357
|
+
BYN: {
|
|
358
|
+
prefix: 'Br',
|
|
359
|
+
suffix: '',
|
|
360
|
+
decimals: 0,
|
|
361
|
+
decimalSeparator: '.',
|
|
362
|
+
thousandsSeparator: ',',
|
|
363
|
+
}, // 'Br9,999'
|
|
364
|
+
BZD: {
|
|
365
|
+
prefix: '$',
|
|
366
|
+
suffix: '',
|
|
367
|
+
decimals: 2,
|
|
368
|
+
decimalSeparator: '.',
|
|
369
|
+
thousandsSeparator: ',',
|
|
370
|
+
}, // '$9,999.99'
|
|
371
|
+
CAD: {
|
|
372
|
+
prefix: '$',
|
|
373
|
+
suffix: '',
|
|
374
|
+
decimals: 2,
|
|
375
|
+
decimalSeparator: '.',
|
|
376
|
+
thousandsSeparator: ',',
|
|
377
|
+
}, // '$9,999.99'
|
|
378
|
+
CDF: {
|
|
379
|
+
prefix: 'Fr',
|
|
380
|
+
suffix: '',
|
|
381
|
+
decimals: 2,
|
|
382
|
+
decimalSeparator: '.',
|
|
383
|
+
thousandsSeparator: ',',
|
|
384
|
+
}, // 'Fr9,999.99'
|
|
385
|
+
CHF: {
|
|
386
|
+
prefix: 'Fr',
|
|
387
|
+
suffix: '',
|
|
388
|
+
decimals: 2,
|
|
389
|
+
decimalSeparator: '.',
|
|
390
|
+
thousandsSeparator: ',',
|
|
391
|
+
}, // 'Fr9,999.99'
|
|
392
|
+
CLF: {
|
|
393
|
+
prefix: 'Fr',
|
|
394
|
+
suffix: '',
|
|
395
|
+
decimals: 4,
|
|
396
|
+
decimalSeparator: '.',
|
|
397
|
+
thousandsSeparator: ',',
|
|
398
|
+
}, // 'Fr9.999.9999'
|
|
399
|
+
CLP: {
|
|
400
|
+
prefix: '$',
|
|
401
|
+
suffix: '',
|
|
402
|
+
decimals: 0,
|
|
403
|
+
decimalSeparator: '.',
|
|
404
|
+
thousandsSeparator: ',',
|
|
405
|
+
}, // '$9,999'
|
|
406
|
+
CNY: {
|
|
407
|
+
prefix: '¥',
|
|
408
|
+
suffix: '',
|
|
409
|
+
decimals: 2,
|
|
410
|
+
decimalSeparator: '.',
|
|
411
|
+
thousandsSeparator: ',',
|
|
412
|
+
}, // '¥9,999.99'
|
|
413
|
+
COP: {
|
|
414
|
+
prefix: '$',
|
|
415
|
+
suffix: '',
|
|
416
|
+
decimals: 2,
|
|
417
|
+
decimalSeparator: '.',
|
|
418
|
+
thousandsSeparator: ',',
|
|
419
|
+
}, // '$9,999.99'
|
|
420
|
+
CRC: {
|
|
421
|
+
prefix: '₡',
|
|
422
|
+
suffix: '',
|
|
423
|
+
decimals: 2,
|
|
424
|
+
decimalSeparator: '.',
|
|
425
|
+
thousandsSeparator: ',',
|
|
426
|
+
}, // '₡9,999.99'
|
|
427
|
+
CUC: {
|
|
428
|
+
prefix: '$',
|
|
429
|
+
suffix: '',
|
|
430
|
+
decimals: 2,
|
|
431
|
+
decimalSeparator: '.',
|
|
432
|
+
thousandsSeparator: ',',
|
|
433
|
+
}, // '$9,999.99'
|
|
434
|
+
CUP: {
|
|
435
|
+
prefix: '$',
|
|
436
|
+
suffix: '',
|
|
437
|
+
decimals: 2,
|
|
438
|
+
decimalSeparator: '.',
|
|
439
|
+
thousandsSeparator: ',',
|
|
440
|
+
}, // '$9,999.99'
|
|
441
|
+
CVE: {
|
|
442
|
+
prefix: '$',
|
|
443
|
+
suffix: '',
|
|
444
|
+
decimals: 0,
|
|
445
|
+
decimalSeparator: '.',
|
|
446
|
+
thousandsSeparator: ',',
|
|
447
|
+
}, // '$9,999'
|
|
448
|
+
CZK: {
|
|
449
|
+
prefix: 'Kč',
|
|
450
|
+
suffix: '',
|
|
451
|
+
decimals: 2,
|
|
452
|
+
decimalSeparator: '.',
|
|
453
|
+
thousandsSeparator: ',',
|
|
454
|
+
}, // 'Kč9,999.99'
|
|
455
|
+
DJF: {
|
|
456
|
+
prefix: 'Fr',
|
|
457
|
+
suffix: '',
|
|
458
|
+
decimals: 0,
|
|
459
|
+
decimalSeparator: '.',
|
|
460
|
+
thousandsSeparator: ',',
|
|
461
|
+
}, // 'Fr9,999'
|
|
462
|
+
DKK: {
|
|
463
|
+
prefix: 'kr',
|
|
464
|
+
suffix: '',
|
|
465
|
+
decimals: 2,
|
|
466
|
+
decimalSeparator: '.',
|
|
467
|
+
thousandsSeparator: ',',
|
|
468
|
+
}, // 'kr9,999.99'
|
|
469
|
+
DOP: {
|
|
470
|
+
prefix: '$',
|
|
471
|
+
suffix: '',
|
|
472
|
+
decimals: 2,
|
|
473
|
+
decimalSeparator: '.',
|
|
474
|
+
thousandsSeparator: ',',
|
|
475
|
+
}, // '$9,999.99'
|
|
476
|
+
DZD: {
|
|
477
|
+
prefix: '',
|
|
478
|
+
suffix: 'د.ج',
|
|
479
|
+
decimals: 2,
|
|
480
|
+
decimalSeparator: '.',
|
|
481
|
+
thousandsSeparator: ',',
|
|
482
|
+
}, // '9,999.99د.ج'
|
|
483
|
+
EEK: {
|
|
484
|
+
prefix: 'KR',
|
|
485
|
+
suffix: '',
|
|
486
|
+
decimals: 2,
|
|
487
|
+
decimalSeparator: '.',
|
|
488
|
+
thousandsSeparator: ',',
|
|
489
|
+
}, // 'KR9,999.99'
|
|
490
|
+
EGP: {
|
|
491
|
+
prefix: '£',
|
|
492
|
+
suffix: '',
|
|
493
|
+
decimals: 2,
|
|
494
|
+
decimalSeparator: '.',
|
|
495
|
+
thousandsSeparator: ',',
|
|
496
|
+
}, // '£9,999.99'
|
|
497
|
+
ERN: {
|
|
498
|
+
prefix: 'Nfk',
|
|
499
|
+
suffix: '',
|
|
500
|
+
decimals: 2,
|
|
501
|
+
decimalSeparator: '.',
|
|
502
|
+
thousandsSeparator: ',',
|
|
503
|
+
}, // 'Nfk9,999.99'
|
|
504
|
+
ETB: {
|
|
505
|
+
prefix: '¤',
|
|
506
|
+
suffix: '',
|
|
507
|
+
decimals: 2,
|
|
508
|
+
decimalSeparator: '.',
|
|
509
|
+
thousandsSeparator: ',',
|
|
510
|
+
}, // '¤9,999.99'
|
|
511
|
+
EUR: {
|
|
512
|
+
prefix: '€',
|
|
513
|
+
suffix: '',
|
|
514
|
+
decimals: 2,
|
|
515
|
+
decimalSeparator: '.',
|
|
516
|
+
thousandsSeparator: ',',
|
|
517
|
+
}, // '€9,999.99'
|
|
518
|
+
FJD: {
|
|
519
|
+
prefix: '$',
|
|
520
|
+
suffix: '',
|
|
521
|
+
decimals: 2,
|
|
522
|
+
decimalSeparator: '.',
|
|
523
|
+
thousandsSeparator: ',',
|
|
524
|
+
}, // '$9,999.99'
|
|
525
|
+
FKP: {
|
|
526
|
+
prefix: '£',
|
|
527
|
+
suffix: '',
|
|
528
|
+
decimals: 2,
|
|
529
|
+
decimalSeparator: '.',
|
|
530
|
+
thousandsSeparator: ',',
|
|
531
|
+
}, // '£9,999.99'
|
|
532
|
+
GBP: {
|
|
533
|
+
prefix: '£',
|
|
534
|
+
suffix: '',
|
|
535
|
+
decimals: 2,
|
|
536
|
+
decimalSeparator: '.',
|
|
537
|
+
thousandsSeparator: ',',
|
|
538
|
+
}, // '£9,999.99'
|
|
539
|
+
GEL: {
|
|
540
|
+
prefix: 'ლ',
|
|
541
|
+
suffix: '',
|
|
542
|
+
decimals: 2,
|
|
543
|
+
decimalSeparator: '.',
|
|
544
|
+
thousandsSeparator: ',',
|
|
545
|
+
}, // 'ლ9,999.99'
|
|
546
|
+
GHS: {
|
|
547
|
+
prefix: '¤',
|
|
548
|
+
suffix: '',
|
|
549
|
+
decimals: 2,
|
|
550
|
+
decimalSeparator: '.',
|
|
551
|
+
thousandsSeparator: ',',
|
|
552
|
+
}, // '¤9,999.99'
|
|
553
|
+
GIP: {
|
|
554
|
+
prefix: '£',
|
|
555
|
+
suffix: '',
|
|
556
|
+
decimals: 2,
|
|
557
|
+
decimalSeparator: '.',
|
|
558
|
+
thousandsSeparator: ',',
|
|
559
|
+
}, // '£9,999.99'
|
|
560
|
+
GMD: {
|
|
561
|
+
prefix: 'D',
|
|
562
|
+
suffix: '',
|
|
563
|
+
decimals: 2,
|
|
564
|
+
decimalSeparator: '.',
|
|
565
|
+
thousandsSeparator: ',',
|
|
566
|
+
}, // 'D9,999.99'
|
|
567
|
+
GNF: {
|
|
568
|
+
prefix: 'Fr',
|
|
569
|
+
suffix: '',
|
|
570
|
+
decimals: 0,
|
|
571
|
+
decimalSeparator: '.',
|
|
572
|
+
thousandsSeparator: ',',
|
|
573
|
+
}, // 'Fr9,999'
|
|
574
|
+
GTQ: {
|
|
575
|
+
prefix: 'Q',
|
|
576
|
+
suffix: '',
|
|
577
|
+
decimals: 2,
|
|
578
|
+
decimalSeparator: '.',
|
|
579
|
+
thousandsSeparator: ',',
|
|
580
|
+
}, // 'Q9,999.99'
|
|
581
|
+
GYD: {
|
|
582
|
+
prefix: '$',
|
|
583
|
+
suffix: '',
|
|
584
|
+
decimals: 2,
|
|
585
|
+
decimalSeparator: '.',
|
|
586
|
+
thousandsSeparator: ',',
|
|
587
|
+
}, // '$9,999.99'
|
|
588
|
+
HKD: {
|
|
589
|
+
prefix: '$',
|
|
590
|
+
suffix: '',
|
|
591
|
+
decimals: 2,
|
|
592
|
+
decimalSeparator: '.',
|
|
593
|
+
thousandsSeparator: ',',
|
|
594
|
+
}, // '$9,999.9'
|
|
595
|
+
HNL: {
|
|
596
|
+
prefix: 'L',
|
|
597
|
+
suffix: '',
|
|
598
|
+
decimals: 2,
|
|
599
|
+
decimalSeparator: '.',
|
|
600
|
+
thousandsSeparator: ',',
|
|
601
|
+
}, // 'L9,999.99'
|
|
602
|
+
HRK: {
|
|
603
|
+
prefix: 'kn',
|
|
604
|
+
suffix: '',
|
|
605
|
+
decimals: 2,
|
|
606
|
+
decimalSeparator: '.',
|
|
607
|
+
thousandsSeparator: ',',
|
|
608
|
+
}, // 'kn9,999.99'
|
|
609
|
+
HTG: {
|
|
610
|
+
prefix: 'G',
|
|
611
|
+
suffix: '',
|
|
612
|
+
decimals: 2,
|
|
613
|
+
decimalSeparator: '.',
|
|
614
|
+
thousandsSeparator: ',',
|
|
615
|
+
}, // 'G9,999.99'
|
|
616
|
+
HUF: {
|
|
617
|
+
prefix: 'Ft',
|
|
618
|
+
suffix: '',
|
|
619
|
+
decimals: 2,
|
|
620
|
+
decimalSeparator: '.',
|
|
621
|
+
thousandsSeparator: ',',
|
|
622
|
+
}, // 'Ft9,999.99'
|
|
623
|
+
IDR: {
|
|
624
|
+
prefix: 'Rs',
|
|
625
|
+
suffix: '',
|
|
626
|
+
decimals: 2,
|
|
627
|
+
decimalSeparator: '.',
|
|
628
|
+
thousandsSeparator: ',',
|
|
629
|
+
}, // 'Rs9,999.99'
|
|
630
|
+
ILS: {
|
|
631
|
+
prefix: '₪',
|
|
632
|
+
suffix: '',
|
|
633
|
+
decimals: 2,
|
|
634
|
+
decimalSeparator: '.',
|
|
635
|
+
thousandsSeparator: ',',
|
|
636
|
+
}, // '₪9,999.99'
|
|
637
|
+
INR: {
|
|
638
|
+
prefix: '₨',
|
|
639
|
+
suffix: '',
|
|
640
|
+
decimals: 2,
|
|
641
|
+
decimalSeparator: '.',
|
|
642
|
+
thousandsSeparator: ',',
|
|
643
|
+
}, // '₨9,999.99'
|
|
644
|
+
IQD: {
|
|
645
|
+
prefix: '',
|
|
646
|
+
suffix: 'ع.د',
|
|
647
|
+
decimals: 3,
|
|
648
|
+
decimalSeparator: '.',
|
|
649
|
+
thousandsSeparator: ',',
|
|
650
|
+
}, // '9,999.999ع.د'
|
|
651
|
+
IRR: {
|
|
652
|
+
prefix: '¤',
|
|
653
|
+
suffix: '',
|
|
654
|
+
decimals: 2,
|
|
655
|
+
decimalSeparator: '.',
|
|
656
|
+
thousandsSeparator: ',',
|
|
657
|
+
}, // '¤9,999.99'
|
|
658
|
+
ISK: {
|
|
659
|
+
prefix: 'kr',
|
|
660
|
+
suffix: '',
|
|
661
|
+
decimals: 0,
|
|
662
|
+
decimalSeparator: '.',
|
|
663
|
+
thousandsSeparator: ',',
|
|
664
|
+
}, // 'kr9,999'
|
|
665
|
+
JMD: {
|
|
666
|
+
prefix: '$',
|
|
667
|
+
suffix: '',
|
|
668
|
+
decimals: 2,
|
|
669
|
+
decimalSeparator: '.',
|
|
670
|
+
thousandsSeparator: ',',
|
|
671
|
+
}, // '$9,999.99'
|
|
672
|
+
JOD: {
|
|
673
|
+
prefix: '',
|
|
674
|
+
suffix: 'د.ا',
|
|
675
|
+
decimals: 3,
|
|
676
|
+
decimalSeparator: '.',
|
|
677
|
+
thousandsSeparator: ',',
|
|
678
|
+
}, // '9,999.99د.ا'
|
|
679
|
+
JPY: {
|
|
680
|
+
prefix: '¥',
|
|
681
|
+
suffix: '',
|
|
682
|
+
decimals: 0,
|
|
683
|
+
decimalSeparator: '.',
|
|
684
|
+
thousandsSeparator: ',',
|
|
685
|
+
}, // '¥9,999'
|
|
686
|
+
KES: {
|
|
687
|
+
prefix: 'Sh',
|
|
688
|
+
suffix: '',
|
|
689
|
+
decimals: 2,
|
|
690
|
+
decimalSeparator: '.',
|
|
691
|
+
thousandsSeparator: ',',
|
|
692
|
+
}, // 'Sh9,999.99'
|
|
693
|
+
KGS: {
|
|
694
|
+
prefix: '¤',
|
|
695
|
+
suffix: '',
|
|
696
|
+
decimals: 2,
|
|
697
|
+
decimalSeparator: '.',
|
|
698
|
+
thousandsSeparator: ',',
|
|
699
|
+
}, // '¤9,999.99'
|
|
700
|
+
KHR: {
|
|
701
|
+
prefix: '¤',
|
|
702
|
+
suffix: '',
|
|
703
|
+
decimals: 2,
|
|
704
|
+
decimalSeparator: '.',
|
|
705
|
+
thousandsSeparator: ',',
|
|
706
|
+
}, // '¤9,999.99'
|
|
707
|
+
KMF: {
|
|
708
|
+
prefix: 'Fr',
|
|
709
|
+
suffix: '',
|
|
710
|
+
decimals: 0,
|
|
711
|
+
decimalSeparator: '.',
|
|
712
|
+
thousandsSeparator: ',',
|
|
713
|
+
}, // 'Fr9,999'
|
|
714
|
+
KPW: {
|
|
715
|
+
prefix: '₩',
|
|
716
|
+
suffix: '',
|
|
717
|
+
decimals: 2,
|
|
718
|
+
decimalSeparator: '.',
|
|
719
|
+
thousandsSeparator: ',',
|
|
720
|
+
}, // '₩9,999.99'
|
|
721
|
+
KRW: {
|
|
722
|
+
prefix: '₩',
|
|
723
|
+
suffix: '',
|
|
724
|
+
decimals: 0,
|
|
725
|
+
decimalSeparator: '.',
|
|
726
|
+
thousandsSeparator: ',',
|
|
727
|
+
}, // '₩9,999.99'
|
|
728
|
+
KWD: {
|
|
729
|
+
prefix: 'د.ك',
|
|
730
|
+
suffix: '',
|
|
731
|
+
decimals: 3,
|
|
732
|
+
decimalSeparator: '.',
|
|
733
|
+
thousandsSeparator: ',',
|
|
734
|
+
}, // '9,999.999د.ك'
|
|
735
|
+
KYD: {
|
|
736
|
+
prefix: '$',
|
|
737
|
+
suffix: '',
|
|
738
|
+
decimals: 2,
|
|
739
|
+
decimalSeparator: '.',
|
|
740
|
+
thousandsSeparator: ',',
|
|
741
|
+
}, // '$9,999.99'
|
|
742
|
+
KZT: {
|
|
743
|
+
prefix: '〒',
|
|
744
|
+
suffix: '',
|
|
745
|
+
decimals: 2,
|
|
746
|
+
decimalSeparator: '.',
|
|
747
|
+
thousandsSeparator: ',',
|
|
748
|
+
}, // '〒9,999.99'
|
|
749
|
+
LAK: {
|
|
750
|
+
prefix: '₭',
|
|
751
|
+
suffix: '',
|
|
752
|
+
decimals: 2,
|
|
753
|
+
decimalSeparator: '.',
|
|
754
|
+
thousandsSeparator: ',',
|
|
755
|
+
}, // '₭9,999.99'
|
|
756
|
+
LBP: {
|
|
757
|
+
prefix: '',
|
|
758
|
+
suffix: 'ل.ل',
|
|
759
|
+
decimals: 2,
|
|
760
|
+
decimalSeparator: '.',
|
|
761
|
+
thousandsSeparator: ',',
|
|
762
|
+
}, // 'ل.ل9,999.99'
|
|
763
|
+
LKR: {
|
|
764
|
+
prefix: 'Rs',
|
|
765
|
+
suffix: '',
|
|
766
|
+
decimals: 2,
|
|
767
|
+
decimalSeparator: '.',
|
|
768
|
+
thousandsSeparator: ',',
|
|
769
|
+
}, // 'Rs9,999.99'
|
|
770
|
+
LRD: {
|
|
771
|
+
prefix: '$',
|
|
772
|
+
suffix: '',
|
|
773
|
+
decimals: 2,
|
|
774
|
+
decimalSeparator: '.',
|
|
775
|
+
thousandsSeparator: ',',
|
|
776
|
+
}, // '$9,999.99'
|
|
777
|
+
LSL: {
|
|
778
|
+
prefix: 'L',
|
|
779
|
+
suffix: '',
|
|
780
|
+
decimals: 2,
|
|
781
|
+
decimalSeparator: '.',
|
|
782
|
+
thousandsSeparator: ',',
|
|
783
|
+
}, // 'L9,999.99'
|
|
784
|
+
LTL: {
|
|
785
|
+
prefix: 'Lt',
|
|
786
|
+
suffix: '',
|
|
787
|
+
decimals: 2,
|
|
788
|
+
decimalSeparator: '.',
|
|
789
|
+
thousandsSeparator: ',',
|
|
790
|
+
}, // 'Lt9,999.99'
|
|
791
|
+
LVL: {
|
|
792
|
+
prefix: 'Ls',
|
|
793
|
+
suffix: '',
|
|
794
|
+
decimals: 2,
|
|
795
|
+
decimalSeparator: '.',
|
|
796
|
+
thousandsSeparator: ',',
|
|
797
|
+
}, // 'Ls9,999.99'
|
|
798
|
+
LYD: {
|
|
799
|
+
prefix: '',
|
|
800
|
+
suffix: 'ل.د',
|
|
801
|
+
decimals: 3,
|
|
802
|
+
decimalSeparator: '.',
|
|
803
|
+
thousandsSeparator: ',',
|
|
804
|
+
}, // '9,999.999ل.د'
|
|
805
|
+
MAD: {
|
|
806
|
+
prefix: '',
|
|
807
|
+
suffix: 'د.م.',
|
|
808
|
+
decimals: 2,
|
|
809
|
+
decimalSeparator: '.',
|
|
810
|
+
thousandsSeparator: ',',
|
|
811
|
+
}, // '9,999.99د.م.'
|
|
812
|
+
MDL: {
|
|
813
|
+
prefix: 'L',
|
|
814
|
+
suffix: '',
|
|
815
|
+
decimals: 2,
|
|
816
|
+
decimalSeparator: '.',
|
|
817
|
+
thousandsSeparator: ',',
|
|
818
|
+
}, // 'L9,999.99'
|
|
819
|
+
MGA: {
|
|
820
|
+
prefix: '¤',
|
|
821
|
+
suffix: '',
|
|
822
|
+
decimals: 1,
|
|
823
|
+
decimalSeparator: '.',
|
|
824
|
+
thousandsSeparator: ',',
|
|
825
|
+
}, // '¤9,999.9'
|
|
826
|
+
MKD: {
|
|
827
|
+
prefix: 'ден',
|
|
828
|
+
suffix: '',
|
|
829
|
+
decimals: 2,
|
|
830
|
+
decimalSeparator: '.',
|
|
831
|
+
thousandsSeparator: ',',
|
|
832
|
+
}, // 'ден9,999.99'
|
|
833
|
+
MMK: {
|
|
834
|
+
prefix: 'K',
|
|
835
|
+
suffix: '',
|
|
836
|
+
decimals: 2,
|
|
837
|
+
decimalSeparator: '.',
|
|
838
|
+
thousandsSeparator: ',',
|
|
839
|
+
}, // 'K9,999.99'
|
|
840
|
+
MNT: {
|
|
841
|
+
prefix: '₮',
|
|
842
|
+
suffix: '',
|
|
843
|
+
decimals: 2,
|
|
844
|
+
decimalSeparator: '.',
|
|
845
|
+
thousandsSeparator: ',',
|
|
846
|
+
}, // '₮9,999.99'
|
|
847
|
+
MOP: {
|
|
848
|
+
prefix: 'P',
|
|
849
|
+
suffix: '',
|
|
850
|
+
decimals: 2,
|
|
851
|
+
decimalSeparator: '.',
|
|
852
|
+
thousandsSeparator: ',',
|
|
853
|
+
}, // 'P9,999.99'
|
|
854
|
+
MRU: {
|
|
855
|
+
prefix: 'UM',
|
|
856
|
+
suffix: '',
|
|
857
|
+
decimals: 1,
|
|
858
|
+
decimalSeparator: '.',
|
|
859
|
+
thousandsSeparator: ',',
|
|
860
|
+
}, // 'UM9,999.9'
|
|
861
|
+
MUR: {
|
|
862
|
+
prefix: '₨',
|
|
863
|
+
suffix: '',
|
|
864
|
+
decimals: 2,
|
|
865
|
+
decimalSeparator: '.',
|
|
866
|
+
thousandsSeparator: ',',
|
|
867
|
+
}, // '₨9,999.99'
|
|
868
|
+
MVR: {
|
|
869
|
+
prefix: '¤',
|
|
870
|
+
suffix: '',
|
|
871
|
+
decimals: 2,
|
|
872
|
+
decimalSeparator: '.',
|
|
873
|
+
thousandsSeparator: ',',
|
|
874
|
+
}, // '¤9,999.99'
|
|
875
|
+
MWK: {
|
|
876
|
+
prefix: 'MK',
|
|
877
|
+
suffix: '',
|
|
878
|
+
decimals: 2,
|
|
879
|
+
decimalSeparator: '.',
|
|
880
|
+
thousandsSeparator: ',',
|
|
881
|
+
}, // 'MK9,999.99'
|
|
882
|
+
MXN: {
|
|
883
|
+
prefix: '$',
|
|
884
|
+
suffix: '',
|
|
885
|
+
decimals: 2,
|
|
886
|
+
decimalSeparator: '.',
|
|
887
|
+
thousandsSeparator: ',',
|
|
888
|
+
}, // '$9,999.99'
|
|
889
|
+
MYR: {
|
|
890
|
+
prefix: 'RM',
|
|
891
|
+
suffix: '',
|
|
892
|
+
decimals: 2,
|
|
893
|
+
decimalSeparator: '.',
|
|
894
|
+
thousandsSeparator: ',',
|
|
895
|
+
}, // 'RM9,999.99'
|
|
896
|
+
MZN: {
|
|
897
|
+
prefix: 'MTn',
|
|
898
|
+
suffix: '',
|
|
899
|
+
decimals: 2,
|
|
900
|
+
decimalSeparator: '.',
|
|
901
|
+
thousandsSeparator: ',',
|
|
902
|
+
}, // 'MTn9,999.99'
|
|
903
|
+
NAD: {
|
|
904
|
+
prefix: '$',
|
|
905
|
+
suffix: '',
|
|
906
|
+
decimals: 2,
|
|
907
|
+
decimalSeparator: '.',
|
|
908
|
+
thousandsSeparator: ',',
|
|
909
|
+
}, // '$9,999.99'
|
|
910
|
+
NGN: {
|
|
911
|
+
prefix: '₦',
|
|
912
|
+
suffix: '',
|
|
913
|
+
decimals: 2,
|
|
914
|
+
decimalSeparator: '.',
|
|
915
|
+
thousandsSeparator: ',',
|
|
916
|
+
}, // '₦9,999.99'
|
|
917
|
+
NIO: {
|
|
918
|
+
prefix: 'C$',
|
|
919
|
+
suffix: '',
|
|
920
|
+
decimals: 2,
|
|
921
|
+
decimalSeparator: '.',
|
|
922
|
+
thousandsSeparator: ',',
|
|
923
|
+
}, // 'C$9,999.99'
|
|
924
|
+
NOK: {
|
|
925
|
+
prefix: 'kr',
|
|
926
|
+
suffix: '',
|
|
927
|
+
decimals: 2,
|
|
928
|
+
decimalSeparator: '.',
|
|
929
|
+
thousandsSeparator: ',',
|
|
930
|
+
}, // 'kr9,999.99'
|
|
931
|
+
NPR: {
|
|
932
|
+
prefix: '₨',
|
|
933
|
+
suffix: '',
|
|
934
|
+
decimals: 2,
|
|
935
|
+
decimalSeparator: '.',
|
|
936
|
+
thousandsSeparator: ',',
|
|
937
|
+
}, // '₨9,999.99'
|
|
938
|
+
NZD: {
|
|
939
|
+
prefix: '$',
|
|
940
|
+
suffix: '',
|
|
941
|
+
decimals: 2,
|
|
942
|
+
decimalSeparator: '.',
|
|
943
|
+
thousandsSeparator: ',',
|
|
944
|
+
}, // '$9,999.99'
|
|
945
|
+
OMR: {
|
|
946
|
+
prefix: '',
|
|
947
|
+
suffix: 'ر.ع.',
|
|
948
|
+
decimals: 3,
|
|
949
|
+
decimalSeparator: '.',
|
|
950
|
+
thousandsSeparator: ',',
|
|
951
|
+
}, // '9,999.999ر.ع.'
|
|
952
|
+
PAB: {
|
|
953
|
+
prefix: 'B/.',
|
|
954
|
+
suffix: '',
|
|
955
|
+
decimals: 2,
|
|
956
|
+
decimalSeparator: '.',
|
|
957
|
+
thousandsSeparator: ',',
|
|
958
|
+
}, // 'B/.9,999.99'
|
|
959
|
+
PEN: {
|
|
960
|
+
prefix: 'S/.',
|
|
961
|
+
suffix: '',
|
|
962
|
+
decimals: 2,
|
|
963
|
+
decimalSeparator: '.',
|
|
964
|
+
thousandsSeparator: ',',
|
|
965
|
+
}, // 'S/.9,999.99'
|
|
966
|
+
PGK: {
|
|
967
|
+
prefix: 'K',
|
|
968
|
+
suffix: '',
|
|
969
|
+
decimals: 2,
|
|
970
|
+
decimalSeparator: '.',
|
|
971
|
+
thousandsSeparator: ',',
|
|
972
|
+
}, // 'K9,999.99'
|
|
973
|
+
PHP: {
|
|
974
|
+
prefix: 'p',
|
|
975
|
+
suffix: '',
|
|
976
|
+
decimals: 2,
|
|
977
|
+
decimalSeparator: '.',
|
|
978
|
+
thousandsSeparator: ',',
|
|
979
|
+
}, // 'p9,999.99'
|
|
980
|
+
PKR: {
|
|
981
|
+
prefix: '₨',
|
|
982
|
+
suffix: '',
|
|
983
|
+
decimals: 2,
|
|
984
|
+
decimalSeparator: '.',
|
|
985
|
+
thousandsSeparator: ',',
|
|
986
|
+
}, // '₨9,999.99'
|
|
987
|
+
PLN: {
|
|
988
|
+
prefix: 'zł',
|
|
989
|
+
suffix: '',
|
|
990
|
+
decimals: 2,
|
|
991
|
+
decimalSeparator: '.',
|
|
992
|
+
thousandsSeparator: ',',
|
|
993
|
+
}, // 'zł9,999.99'
|
|
994
|
+
PYG: {
|
|
995
|
+
prefix: '¤',
|
|
996
|
+
suffix: '',
|
|
997
|
+
decimals: 0,
|
|
998
|
+
decimalSeparator: '.',
|
|
999
|
+
thousandsSeparator: ',',
|
|
1000
|
+
}, // '¤9,999'
|
|
1001
|
+
QAR: {
|
|
1002
|
+
prefix: '',
|
|
1003
|
+
suffix: 'ر.ق',
|
|
1004
|
+
decimals: 2,
|
|
1005
|
+
decimalSeparator: '.',
|
|
1006
|
+
thousandsSeparator: ',',
|
|
1007
|
+
}, // '9,999.99ر.ق'
|
|
1008
|
+
RON: {
|
|
1009
|
+
prefix: 'L',
|
|
1010
|
+
suffix: '',
|
|
1011
|
+
decimals: 2,
|
|
1012
|
+
decimalSeparator: '.',
|
|
1013
|
+
thousandsSeparator: ',',
|
|
1014
|
+
}, // 'L9,999.99'
|
|
1015
|
+
RSD: {
|
|
1016
|
+
prefix: 'дин.',
|
|
1017
|
+
suffix: '',
|
|
1018
|
+
decimals: 2,
|
|
1019
|
+
decimalSeparator: '.',
|
|
1020
|
+
thousandsSeparator: ',',
|
|
1021
|
+
}, // 'дин.9,999.99'
|
|
1022
|
+
RUB: {
|
|
1023
|
+
prefix: 'руб.',
|
|
1024
|
+
suffix: '',
|
|
1025
|
+
decimals: 2,
|
|
1026
|
+
decimalSeparator: '.',
|
|
1027
|
+
thousandsSeparator: ',',
|
|
1028
|
+
}, // 'руб.9,999.99'
|
|
1029
|
+
RWF: {
|
|
1030
|
+
prefix: 'Fr',
|
|
1031
|
+
suffix: '',
|
|
1032
|
+
decimals: 0,
|
|
1033
|
+
decimalSeparator: '.',
|
|
1034
|
+
thousandsSeparator: ',',
|
|
1035
|
+
}, // 'Fr9,999'
|
|
1036
|
+
SAR: {
|
|
1037
|
+
prefix: '',
|
|
1038
|
+
suffix: 'ر.س',
|
|
1039
|
+
decimals: 2,
|
|
1040
|
+
decimalSeparator: '.',
|
|
1041
|
+
thousandsSeparator: ',',
|
|
1042
|
+
}, // '9,999.99ر.س'
|
|
1043
|
+
SBD: {
|
|
1044
|
+
prefix: '$',
|
|
1045
|
+
suffix: '',
|
|
1046
|
+
decimals: 2,
|
|
1047
|
+
decimalSeparator: '.',
|
|
1048
|
+
thousandsSeparator: ',',
|
|
1049
|
+
}, // '$9,999.99'
|
|
1050
|
+
SCR: {
|
|
1051
|
+
prefix: '₨',
|
|
1052
|
+
suffix: '',
|
|
1053
|
+
decimals: 2,
|
|
1054
|
+
decimalSeparator: '.',
|
|
1055
|
+
thousandsSeparator: ',',
|
|
1056
|
+
}, // '₨9,999.99'
|
|
1057
|
+
SDG: {
|
|
1058
|
+
prefix: '£',
|
|
1059
|
+
suffix: '',
|
|
1060
|
+
decimals: 2,
|
|
1061
|
+
decimalSeparator: '.',
|
|
1062
|
+
thousandsSeparator: ',',
|
|
1063
|
+
}, // '£9,999.99'
|
|
1064
|
+
SEK: {
|
|
1065
|
+
prefix: 'kr',
|
|
1066
|
+
suffix: '',
|
|
1067
|
+
decimals: 2,
|
|
1068
|
+
decimalSeparator: '.',
|
|
1069
|
+
thousandsSeparator: ',',
|
|
1070
|
+
}, // 'kr9,999.99'
|
|
1071
|
+
SGD: {
|
|
1072
|
+
prefix: '$',
|
|
1073
|
+
suffix: '',
|
|
1074
|
+
decimals: 2,
|
|
1075
|
+
decimalSeparator: '.',
|
|
1076
|
+
thousandsSeparator: ',',
|
|
1077
|
+
}, // '$9,999.99'
|
|
1078
|
+
SHP: {
|
|
1079
|
+
prefix: '£',
|
|
1080
|
+
suffix: '',
|
|
1081
|
+
decimals: 2,
|
|
1082
|
+
decimalSeparator: '.',
|
|
1083
|
+
thousandsSeparator: ',',
|
|
1084
|
+
}, // '£9,999.99'
|
|
1085
|
+
SKK: {
|
|
1086
|
+
prefix: 'Sk',
|
|
1087
|
+
suffix: '',
|
|
1088
|
+
decimals: 2,
|
|
1089
|
+
decimalSeparator: '.',
|
|
1090
|
+
thousandsSeparator: ',',
|
|
1091
|
+
}, // 'Sk9,999.99'
|
|
1092
|
+
SLL: {
|
|
1093
|
+
prefix: 'Le',
|
|
1094
|
+
suffix: '',
|
|
1095
|
+
decimals: 2,
|
|
1096
|
+
decimalSeparator: '.',
|
|
1097
|
+
thousandsSeparator: ',',
|
|
1098
|
+
}, // 'Le9,999.99'
|
|
1099
|
+
SOS: {
|
|
1100
|
+
prefix: 'Sh',
|
|
1101
|
+
suffix: '',
|
|
1102
|
+
decimals: 2,
|
|
1103
|
+
decimalSeparator: '.',
|
|
1104
|
+
thousandsSeparator: ',',
|
|
1105
|
+
}, // 'Sh9,999.99'
|
|
1106
|
+
SRD: {
|
|
1107
|
+
prefix: '$',
|
|
1108
|
+
suffix: '',
|
|
1109
|
+
decimals: 2,
|
|
1110
|
+
decimalSeparator: '.',
|
|
1111
|
+
thousandsSeparator: ',',
|
|
1112
|
+
}, // '$9,999.99'
|
|
1113
|
+
STN: {
|
|
1114
|
+
prefix: 'Db',
|
|
1115
|
+
suffix: '',
|
|
1116
|
+
decimals: 2,
|
|
1117
|
+
decimalSeparator: '.',
|
|
1118
|
+
thousandsSeparator: ',',
|
|
1119
|
+
}, // 'Db9,999.99'
|
|
1120
|
+
SVC: {
|
|
1121
|
+
prefix: '₡',
|
|
1122
|
+
suffix: '',
|
|
1123
|
+
decimals: 2,
|
|
1124
|
+
decimalSeparator: '.',
|
|
1125
|
+
thousandsSeparator: ',',
|
|
1126
|
+
}, // '₡9,999.99'
|
|
1127
|
+
SYP: {
|
|
1128
|
+
prefix: '£',
|
|
1129
|
+
suffix: '',
|
|
1130
|
+
decimals: 2,
|
|
1131
|
+
decimalSeparator: '.',
|
|
1132
|
+
thousandsSeparator: ',',
|
|
1133
|
+
}, // '£9,999.99'
|
|
1134
|
+
SZL: {
|
|
1135
|
+
prefix: 'L',
|
|
1136
|
+
suffix: '',
|
|
1137
|
+
decimals: 2,
|
|
1138
|
+
decimalSeparator: '.',
|
|
1139
|
+
thousandsSeparator: ',',
|
|
1140
|
+
}, // 'L9,999.99'
|
|
1141
|
+
THB: {
|
|
1142
|
+
prefix: '฿',
|
|
1143
|
+
suffix: '',
|
|
1144
|
+
decimals: 2,
|
|
1145
|
+
decimalSeparator: '.',
|
|
1146
|
+
thousandsSeparator: ',',
|
|
1147
|
+
}, // '฿9,999.99'
|
|
1148
|
+
TJS: {
|
|
1149
|
+
prefix: 'ЅМ',
|
|
1150
|
+
suffix: '',
|
|
1151
|
+
decimals: 2,
|
|
1152
|
+
decimalSeparator: '.',
|
|
1153
|
+
thousandsSeparator: ',',
|
|
1154
|
+
}, // 'ЅМ9,999.99'
|
|
1155
|
+
TMM: {
|
|
1156
|
+
prefix: 'm',
|
|
1157
|
+
suffix: '',
|
|
1158
|
+
decimals: 2,
|
|
1159
|
+
decimalSeparator: '.',
|
|
1160
|
+
thousandsSeparator: ',',
|
|
1161
|
+
}, // 'm9,999.99'
|
|
1162
|
+
TND: {
|
|
1163
|
+
prefix: '',
|
|
1164
|
+
suffix: 'د.ت',
|
|
1165
|
+
decimals: 3,
|
|
1166
|
+
decimalSeparator: '.',
|
|
1167
|
+
thousandsSeparator: ',',
|
|
1168
|
+
}, // '9,999.999د.ت'
|
|
1169
|
+
TOP: {
|
|
1170
|
+
prefix: 'T$',
|
|
1171
|
+
suffix: '',
|
|
1172
|
+
decimals: 2,
|
|
1173
|
+
decimalSeparator: '.',
|
|
1174
|
+
thousandsSeparator: ',',
|
|
1175
|
+
}, // 'T$9,999.99'
|
|
1176
|
+
TRY: {
|
|
1177
|
+
prefix: 'YTL',
|
|
1178
|
+
suffix: '',
|
|
1179
|
+
decimals: 2,
|
|
1180
|
+
decimalSeparator: '.',
|
|
1181
|
+
thousandsSeparator: ',',
|
|
1182
|
+
}, // 'YTL9,999.99'
|
|
1183
|
+
TTD: {
|
|
1184
|
+
prefix: '$',
|
|
1185
|
+
suffix: '',
|
|
1186
|
+
decimals: 2,
|
|
1187
|
+
decimalSeparator: '.',
|
|
1188
|
+
thousandsSeparator: ',',
|
|
1189
|
+
}, // '$9,999.99'
|
|
1190
|
+
TWD: {
|
|
1191
|
+
prefix: '$',
|
|
1192
|
+
suffix: '',
|
|
1193
|
+
decimals: 2,
|
|
1194
|
+
decimalSeparator: '.',
|
|
1195
|
+
thousandsSeparator: ',',
|
|
1196
|
+
}, // '$9,999.99'
|
|
1197
|
+
TZS: {
|
|
1198
|
+
prefix: 'Sh',
|
|
1199
|
+
suffix: '',
|
|
1200
|
+
decimals: 2,
|
|
1201
|
+
decimalSeparator: '.',
|
|
1202
|
+
thousandsSeparator: ',',
|
|
1203
|
+
}, // 'Sh9,999.99'
|
|
1204
|
+
UAH: {
|
|
1205
|
+
prefix: '¤',
|
|
1206
|
+
suffix: '',
|
|
1207
|
+
decimals: 2,
|
|
1208
|
+
decimalSeparator: '.',
|
|
1209
|
+
thousandsSeparator: ',',
|
|
1210
|
+
}, // '¤9,999.99'
|
|
1211
|
+
UGX: {
|
|
1212
|
+
prefix: 'Sh',
|
|
1213
|
+
suffix: '',
|
|
1214
|
+
decimals: 0,
|
|
1215
|
+
decimalSeparator: '.',
|
|
1216
|
+
thousandsSeparator: ',',
|
|
1217
|
+
}, // 'Sh9,999'
|
|
1218
|
+
USD: {
|
|
1219
|
+
prefix: '$',
|
|
1220
|
+
suffix: '',
|
|
1221
|
+
decimals: 2,
|
|
1222
|
+
decimalSeparator: '.',
|
|
1223
|
+
thousandsSeparator: ',',
|
|
1224
|
+
}, // '$9,999.99'
|
|
1225
|
+
UYU: {
|
|
1226
|
+
prefix: '$',
|
|
1227
|
+
suffix: '',
|
|
1228
|
+
decimals: 0,
|
|
1229
|
+
decimalSeparator: '.',
|
|
1230
|
+
thousandsSeparator: ',',
|
|
1231
|
+
}, // '$9,999'
|
|
1232
|
+
UZS: {
|
|
1233
|
+
prefix: '¤',
|
|
1234
|
+
suffix: '',
|
|
1235
|
+
decimals: 2,
|
|
1236
|
+
decimalSeparator: '.',
|
|
1237
|
+
thousandsSeparator: ',',
|
|
1238
|
+
}, // '¤9,999.99'
|
|
1239
|
+
VEF: {
|
|
1240
|
+
prefix: 'Bs F',
|
|
1241
|
+
suffix: '',
|
|
1242
|
+
decimals: 2,
|
|
1243
|
+
decimalSeparator: '.',
|
|
1244
|
+
thousandsSeparator: ',',
|
|
1245
|
+
}, // 'Bs F9,999.99'
|
|
1246
|
+
VND: {
|
|
1247
|
+
prefix: '₫',
|
|
1248
|
+
suffix: '',
|
|
1249
|
+
decimals: 0,
|
|
1250
|
+
decimalSeparator: '.',
|
|
1251
|
+
thousandsSeparator: ',',
|
|
1252
|
+
}, // '₫9,999'
|
|
1253
|
+
VUV: {
|
|
1254
|
+
prefix: 'Vt',
|
|
1255
|
+
suffix: '',
|
|
1256
|
+
decimals: 0,
|
|
1257
|
+
decimalSeparator: '.',
|
|
1258
|
+
thousandsSeparator: ',',
|
|
1259
|
+
}, // 'Vt9,999'
|
|
1260
|
+
WST: {
|
|
1261
|
+
prefix: 'T',
|
|
1262
|
+
suffix: '',
|
|
1263
|
+
decimals: 2,
|
|
1264
|
+
decimalSeparator: '.',
|
|
1265
|
+
thousandsSeparator: ',',
|
|
1266
|
+
}, // 'T9,999.99'
|
|
1267
|
+
XAF: {
|
|
1268
|
+
prefix: 'Fr',
|
|
1269
|
+
suffix: '',
|
|
1270
|
+
decimals: 0,
|
|
1271
|
+
decimalSeparator: '.',
|
|
1272
|
+
thousandsSeparator: ',',
|
|
1273
|
+
}, // 'Fr9,999'
|
|
1274
|
+
XCD: {
|
|
1275
|
+
prefix: '$',
|
|
1276
|
+
suffix: '',
|
|
1277
|
+
decimals: 2,
|
|
1278
|
+
decimalSeparator: '.',
|
|
1279
|
+
thousandsSeparator: ',',
|
|
1280
|
+
}, // '$9,999.99'
|
|
1281
|
+
XOF: {
|
|
1282
|
+
prefix: 'Fr',
|
|
1283
|
+
suffix: '',
|
|
1284
|
+
decimals: 0,
|
|
1285
|
+
decimalSeparator: '.',
|
|
1286
|
+
thousandsSeparator: ',',
|
|
1287
|
+
}, // 'Fr9,999'
|
|
1288
|
+
XPF: {
|
|
1289
|
+
prefix: 'Fr',
|
|
1290
|
+
suffix: '',
|
|
1291
|
+
decimals: 0,
|
|
1292
|
+
decimalSeparator: '.',
|
|
1293
|
+
thousandsSeparator: ',',
|
|
1294
|
+
}, // 'Fr9,999'
|
|
1295
|
+
YER: {
|
|
1296
|
+
prefix: '¤',
|
|
1297
|
+
suffix: '',
|
|
1298
|
+
decimals: 2,
|
|
1299
|
+
decimalSeparator: '.',
|
|
1300
|
+
thousandsSeparator: ',',
|
|
1301
|
+
}, // '¤9,999.99'
|
|
1302
|
+
ZAR: {
|
|
1303
|
+
prefix: 'R',
|
|
1304
|
+
suffix: '',
|
|
1305
|
+
decimals: 2,
|
|
1306
|
+
decimalSeparator: '.',
|
|
1307
|
+
thousandsSeparator: ',',
|
|
1308
|
+
}, // 'R9,999.99'
|
|
1309
|
+
ZMW: {
|
|
1310
|
+
prefix: 'ZK',
|
|
1311
|
+
suffix: '',
|
|
1312
|
+
decimals: 2,
|
|
1313
|
+
decimalSeparator: '.',
|
|
1314
|
+
thousandsSeparator: ',',
|
|
1315
|
+
}, // 'ZK9,999.99'
|
|
1316
|
+
ZWD: {
|
|
1317
|
+
prefix: '$',
|
|
1318
|
+
suffix: '',
|
|
1319
|
+
decimals: 2,
|
|
1320
|
+
decimalSeparator: '.',
|
|
1321
|
+
thousandsSeparator: ',',
|
|
1322
|
+
}, // '$9,999.99'
|
|
1323
|
+
};
|
|
1324
|
+
function formatCurrency(value, currencyCode = 'USD', explicit = false) {
|
|
1325
|
+
let processedCurrencyCode = currencyCode || '';
|
|
1326
|
+
let allowDecimal = true;
|
|
1327
|
+
if (processedCurrencyCode.includes('-integer')) {
|
|
1328
|
+
processedCurrencyCode = processedCurrencyCode.split('-integer')[0];
|
|
1329
|
+
allowDecimal = false;
|
|
1330
|
+
}
|
|
1331
|
+
const currencyFormat = currencyFormats[processedCurrencyCode];
|
|
1332
|
+
if (!currencyFormat) {
|
|
1333
|
+
return formatValue(value);
|
|
1334
|
+
}
|
|
1335
|
+
const options = Object.assign(Object.assign({}, currencyFormat), { allowDecimal: allowDecimal && currencyFormat.decimals > 0, allowNegative: false });
|
|
1336
|
+
return formatNumber(value, options, explicit);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
const phoneNumberFormats = {
|
|
1340
|
+
AF: {
|
|
1341
|
+
mask: '(##) #######',
|
|
1342
|
+
prefix: '+93 ',
|
|
1343
|
+
},
|
|
1344
|
+
AL: {
|
|
1345
|
+
mask: '#######',
|
|
1346
|
+
prefix: '+355 ',
|
|
1347
|
+
},
|
|
1348
|
+
DZ: {
|
|
1349
|
+
mask: '(##) ###-###',
|
|
1350
|
+
prefix: '+213 ',
|
|
1351
|
+
},
|
|
1352
|
+
// AS
|
|
1353
|
+
AD: {
|
|
1354
|
+
mask: '(#) #####',
|
|
1355
|
+
prefix: '+376 ',
|
|
1356
|
+
},
|
|
1357
|
+
AO: {
|
|
1358
|
+
mask: '#########',
|
|
1359
|
+
prefix: '+244 ',
|
|
1360
|
+
},
|
|
1361
|
+
AI: {
|
|
1362
|
+
mask: '(###) ###-####',
|
|
1363
|
+
prefix: '+1 ',
|
|
1364
|
+
},
|
|
1365
|
+
AG: {
|
|
1366
|
+
mask: '(###) ###-####',
|
|
1367
|
+
prefix: '+1 ',
|
|
1368
|
+
},
|
|
1369
|
+
AR: {
|
|
1370
|
+
mask: '##########',
|
|
1371
|
+
prefix: '+54 ',
|
|
1372
|
+
},
|
|
1373
|
+
AM: {
|
|
1374
|
+
mask: '########',
|
|
1375
|
+
prefix: '+375 ',
|
|
1376
|
+
},
|
|
1377
|
+
AQ: {
|
|
1378
|
+
mask: '##-####',
|
|
1379
|
+
prefix: '+672 ',
|
|
1380
|
+
},
|
|
1381
|
+
AW: {
|
|
1382
|
+
mask: '###-####',
|
|
1383
|
+
prefix: '+297 ',
|
|
1384
|
+
},
|
|
1385
|
+
AU: {
|
|
1386
|
+
mask: '(##) ####-####',
|
|
1387
|
+
prefix: '+61 ',
|
|
1388
|
+
},
|
|
1389
|
+
/* AT: {
|
|
1390
|
+
mask:'####?????????',
|
|
1391
|
+
prefix: ''
|
|
1392
|
+
}, */
|
|
1393
|
+
AT: {
|
|
1394
|
+
mask: '#############',
|
|
1395
|
+
prefix: '+43 ',
|
|
1396
|
+
},
|
|
1397
|
+
/* AZ: {
|
|
1398
|
+
mask:'########?',
|
|
1399
|
+
prefix: ''
|
|
1400
|
+
}, */
|
|
1401
|
+
AZ: {
|
|
1402
|
+
mask: '#########',
|
|
1403
|
+
prefix: '+994 ',
|
|
1404
|
+
},
|
|
1405
|
+
BS: {
|
|
1406
|
+
mask: '(###) ###-####',
|
|
1407
|
+
prefix: '+1 ',
|
|
1408
|
+
},
|
|
1409
|
+
BH: {
|
|
1410
|
+
mask: '####-####',
|
|
1411
|
+
prefix: '+973 ',
|
|
1412
|
+
},
|
|
1413
|
+
/* BD: {
|
|
1414
|
+
mask:'#######??',
|
|
1415
|
+
prefix: ''
|
|
1416
|
+
}, */
|
|
1417
|
+
BD: {
|
|
1418
|
+
mask: '#########',
|
|
1419
|
+
prefix: '+880 ',
|
|
1420
|
+
},
|
|
1421
|
+
BB: {
|
|
1422
|
+
mask: '(###) ###-####',
|
|
1423
|
+
prefix: '+1 ',
|
|
1424
|
+
},
|
|
1425
|
+
BY: {
|
|
1426
|
+
mask: '#########',
|
|
1427
|
+
prefix: '+375 ',
|
|
1428
|
+
},
|
|
1429
|
+
BE: {
|
|
1430
|
+
mask: '########??',
|
|
1431
|
+
prefix: '+32 ',
|
|
1432
|
+
},
|
|
1433
|
+
BZ: {
|
|
1434
|
+
mask: '#######',
|
|
1435
|
+
prefix: '+501 ',
|
|
1436
|
+
},
|
|
1437
|
+
BJ: {
|
|
1438
|
+
mask: '(##) ###-###',
|
|
1439
|
+
prefix: '+229 ',
|
|
1440
|
+
},
|
|
1441
|
+
BM: {
|
|
1442
|
+
mask: '(###) ###-####',
|
|
1443
|
+
prefix: '+1 ',
|
|
1444
|
+
},
|
|
1445
|
+
BT: {
|
|
1446
|
+
mask: '(#) ###-###',
|
|
1447
|
+
prefix: '+975 ',
|
|
1448
|
+
},
|
|
1449
|
+
BO: {
|
|
1450
|
+
mask: '(#) ###-####',
|
|
1451
|
+
prefix: '+591 ',
|
|
1452
|
+
},
|
|
1453
|
+
BA: {
|
|
1454
|
+
mask: '(##) ##-##-##',
|
|
1455
|
+
prefix: '+387 ',
|
|
1456
|
+
},
|
|
1457
|
+
/* BW: {
|
|
1458
|
+
mask:'#######?',
|
|
1459
|
+
prefix: ''
|
|
1460
|
+
}, */
|
|
1461
|
+
BW: {
|
|
1462
|
+
mask: '########',
|
|
1463
|
+
prefix: '+267 ',
|
|
1464
|
+
},
|
|
1465
|
+
BR: {
|
|
1466
|
+
mask: '(##) ####-####',
|
|
1467
|
+
prefix: '+55 ',
|
|
1468
|
+
},
|
|
1469
|
+
BN: {
|
|
1470
|
+
mask: '###-####',
|
|
1471
|
+
prefix: '+673 ',
|
|
1472
|
+
},
|
|
1473
|
+
BG: {
|
|
1474
|
+
mask: '#######?',
|
|
1475
|
+
prefix: '+359 ',
|
|
1476
|
+
},
|
|
1477
|
+
BF: {
|
|
1478
|
+
mask: '##-##-##-##',
|
|
1479
|
+
prefix: '+226 ',
|
|
1480
|
+
},
|
|
1481
|
+
BI: {
|
|
1482
|
+
mask: '####-####',
|
|
1483
|
+
prefix: '+257 ',
|
|
1484
|
+
},
|
|
1485
|
+
KH: {
|
|
1486
|
+
mask: '(##) ######',
|
|
1487
|
+
prefix: '+855 ',
|
|
1488
|
+
},
|
|
1489
|
+
CM: {
|
|
1490
|
+
mask: '####-####',
|
|
1491
|
+
prefix: '+237 ',
|
|
1492
|
+
},
|
|
1493
|
+
CA: {
|
|
1494
|
+
mask: '(###) ###-####',
|
|
1495
|
+
prefix: '+1 ',
|
|
1496
|
+
},
|
|
1497
|
+
CV: {
|
|
1498
|
+
mask: '###-####',
|
|
1499
|
+
prefix: '+238 ',
|
|
1500
|
+
},
|
|
1501
|
+
KY: {
|
|
1502
|
+
mask: '(###) ###-####',
|
|
1503
|
+
prefix: '+1 ',
|
|
1504
|
+
},
|
|
1505
|
+
CF: {
|
|
1506
|
+
mask: '###-###',
|
|
1507
|
+
prefix: '+236 ',
|
|
1508
|
+
},
|
|
1509
|
+
TD: {
|
|
1510
|
+
mask: '###-##-##',
|
|
1511
|
+
prefix: '+235 ',
|
|
1512
|
+
},
|
|
1513
|
+
/* CL: {
|
|
1514
|
+
mask:'########?',
|
|
1515
|
+
prefix: ''
|
|
1516
|
+
}, */
|
|
1517
|
+
CL: {
|
|
1518
|
+
mask: '#########',
|
|
1519
|
+
prefix: '+56 ',
|
|
1520
|
+
},
|
|
1521
|
+
/* CN: {
|
|
1522
|
+
mask:'########???',
|
|
1523
|
+
prefix: ''
|
|
1524
|
+
}, */
|
|
1525
|
+
CN: {
|
|
1526
|
+
mask: '###########',
|
|
1527
|
+
prefix: '+86 ',
|
|
1528
|
+
},
|
|
1529
|
+
/* CO: {
|
|
1530
|
+
mask:'########??',
|
|
1531
|
+
prefix: ''
|
|
1532
|
+
}, */
|
|
1533
|
+
CO: {
|
|
1534
|
+
mask: '##########',
|
|
1535
|
+
prefix: '57 ',
|
|
1536
|
+
},
|
|
1537
|
+
KM: {
|
|
1538
|
+
mask: '###-####',
|
|
1539
|
+
prefix: '+269 ',
|
|
1540
|
+
},
|
|
1541
|
+
CD: {
|
|
1542
|
+
mask: '###-####',
|
|
1543
|
+
prefix: '+243 ',
|
|
1544
|
+
},
|
|
1545
|
+
CG: {
|
|
1546
|
+
mask: '###-####',
|
|
1547
|
+
prefix: '+242 ',
|
|
1548
|
+
},
|
|
1549
|
+
// CK
|
|
1550
|
+
CR: {
|
|
1551
|
+
mask: '####-####',
|
|
1552
|
+
prefix: '+506 ',
|
|
1553
|
+
},
|
|
1554
|
+
CI: {
|
|
1555
|
+
mask: '####-####',
|
|
1556
|
+
prefix: '+225 ',
|
|
1557
|
+
},
|
|
1558
|
+
HR: {
|
|
1559
|
+
mask: '########?',
|
|
1560
|
+
prefix: '+385 ',
|
|
1561
|
+
},
|
|
1562
|
+
/* CU: {
|
|
1563
|
+
mask:'#####?ID:?????',
|
|
1564
|
+
prefix: ''
|
|
1565
|
+
}, */
|
|
1566
|
+
CU: {
|
|
1567
|
+
mask: '###########',
|
|
1568
|
+
prefix: '+53 ',
|
|
1569
|
+
},
|
|
1570
|
+
CY: {
|
|
1571
|
+
mask: '####-####',
|
|
1572
|
+
prefix: '+357 ',
|
|
1573
|
+
},
|
|
1574
|
+
CZ: {
|
|
1575
|
+
mask: '#########',
|
|
1576
|
+
prefix: '+420 ',
|
|
1577
|
+
},
|
|
1578
|
+
DK: {
|
|
1579
|
+
mask: '####-####',
|
|
1580
|
+
prefix: '+45 ',
|
|
1581
|
+
},
|
|
1582
|
+
DJ: {
|
|
1583
|
+
mask: '##-##-##-##',
|
|
1584
|
+
prefix: '+253 ',
|
|
1585
|
+
},
|
|
1586
|
+
DM: {
|
|
1587
|
+
mask: '(###) ###-####',
|
|
1588
|
+
prefix: '+1 ',
|
|
1589
|
+
},
|
|
1590
|
+
DO: {
|
|
1591
|
+
mask: '(###) ###-####',
|
|
1592
|
+
prefix: '+1 ',
|
|
1593
|
+
},
|
|
1594
|
+
TL: {
|
|
1595
|
+
mask: '###-####',
|
|
1596
|
+
prefix: '+670 ',
|
|
1597
|
+
},
|
|
1598
|
+
EC: {
|
|
1599
|
+
mask: '(##) ###-####',
|
|
1600
|
+
prefix: '+593 ',
|
|
1601
|
+
},
|
|
1602
|
+
/* EG: {
|
|
1603
|
+
mask:'########??',
|
|
1604
|
+
prefix: ''
|
|
1605
|
+
}, */
|
|
1606
|
+
EG: {
|
|
1607
|
+
mask: '##########',
|
|
1608
|
+
prefix: '+20 ',
|
|
1609
|
+
},
|
|
1610
|
+
SV: {
|
|
1611
|
+
mask: '####-####',
|
|
1612
|
+
prefix: '+503 ',
|
|
1613
|
+
},
|
|
1614
|
+
GQ: {
|
|
1615
|
+
mask: '##-####',
|
|
1616
|
+
prefix: '+240 ',
|
|
1617
|
+
},
|
|
1618
|
+
// ER:
|
|
1619
|
+
EE: {
|
|
1620
|
+
mask: '#######?',
|
|
1621
|
+
prefix: '+372 ',
|
|
1622
|
+
},
|
|
1623
|
+
ET: {
|
|
1624
|
+
mask: '(##) ###-####',
|
|
1625
|
+
prefix: '+251 ',
|
|
1626
|
+
},
|
|
1627
|
+
FK: {
|
|
1628
|
+
mask: '#####',
|
|
1629
|
+
prefix: '+500 ',
|
|
1630
|
+
},
|
|
1631
|
+
FO: {
|
|
1632
|
+
mask: '######',
|
|
1633
|
+
prefix: '+298 ',
|
|
1634
|
+
},
|
|
1635
|
+
FJ: {
|
|
1636
|
+
mask: '###-####',
|
|
1637
|
+
prefix: '+679 ',
|
|
1638
|
+
},
|
|
1639
|
+
/* FI: {
|
|
1640
|
+
mask:'#####???????',
|
|
1641
|
+
prefix: ''
|
|
1642
|
+
}, */
|
|
1643
|
+
FI: {
|
|
1644
|
+
mask: '############',
|
|
1645
|
+
prefix: '+358 ',
|
|
1646
|
+
},
|
|
1647
|
+
FR: {
|
|
1648
|
+
mask: '#########',
|
|
1649
|
+
prefix: '+33 ',
|
|
1650
|
+
},
|
|
1651
|
+
/* GF: {
|
|
1652
|
+
mask:'#########?',
|
|
1653
|
+
prefix: ''
|
|
1654
|
+
}, */
|
|
1655
|
+
GF: {
|
|
1656
|
+
mask: '##########',
|
|
1657
|
+
prefix: '+594 ',
|
|
1658
|
+
},
|
|
1659
|
+
PF: {
|
|
1660
|
+
mask: '######',
|
|
1661
|
+
prefix: '+689 ',
|
|
1662
|
+
},
|
|
1663
|
+
GA: {
|
|
1664
|
+
mask: '######?',
|
|
1665
|
+
prefix: '+241 ',
|
|
1666
|
+
},
|
|
1667
|
+
GM: {
|
|
1668
|
+
mask: '###-####',
|
|
1669
|
+
prefix: '+220 ',
|
|
1670
|
+
},
|
|
1671
|
+
GE: {
|
|
1672
|
+
mask: '########?',
|
|
1673
|
+
prefix: '+995 ',
|
|
1674
|
+
},
|
|
1675
|
+
/* DE: {
|
|
1676
|
+
mask:'######?????',
|
|
1677
|
+
prefix: ''
|
|
1678
|
+
}, */
|
|
1679
|
+
DE: {
|
|
1680
|
+
mask: '###########',
|
|
1681
|
+
prefix: '+49 ',
|
|
1682
|
+
},
|
|
1683
|
+
/* GH: {
|
|
1684
|
+
mask:'########?',
|
|
1685
|
+
prefix: ''
|
|
1686
|
+
}, */
|
|
1687
|
+
GH: {
|
|
1688
|
+
mask: '#########',
|
|
1689
|
+
prefix: '+233 ',
|
|
1690
|
+
},
|
|
1691
|
+
GI: {
|
|
1692
|
+
mask: '####-####',
|
|
1693
|
+
prefix: '+350 ',
|
|
1694
|
+
},
|
|
1695
|
+
GR: {
|
|
1696
|
+
mask: '##########',
|
|
1697
|
+
prefix: '+30 ',
|
|
1698
|
+
},
|
|
1699
|
+
GL: {
|
|
1700
|
+
mask: '###-###',
|
|
1701
|
+
prefix: '+299 ',
|
|
1702
|
+
},
|
|
1703
|
+
GD: {
|
|
1704
|
+
mask: '(###) ###-####',
|
|
1705
|
+
prefix: '+1 ',
|
|
1706
|
+
},
|
|
1707
|
+
GP: {
|
|
1708
|
+
mask: '##########',
|
|
1709
|
+
prefix: '+590 ',
|
|
1710
|
+
},
|
|
1711
|
+
GU: {
|
|
1712
|
+
mask: '(###) ###-####',
|
|
1713
|
+
prefix: '+1 ',
|
|
1714
|
+
},
|
|
1715
|
+
GT: {
|
|
1716
|
+
mask: '####-####',
|
|
1717
|
+
prefix: '+502 ',
|
|
1718
|
+
},
|
|
1719
|
+
GN: {
|
|
1720
|
+
mask: '####-####',
|
|
1721
|
+
prefix: '+224 ',
|
|
1722
|
+
},
|
|
1723
|
+
GW: {
|
|
1724
|
+
mask: '###-####',
|
|
1725
|
+
prefix: '+245 ',
|
|
1726
|
+
},
|
|
1727
|
+
GY: {
|
|
1728
|
+
mask: '(###) ####',
|
|
1729
|
+
prefix: '+592 ',
|
|
1730
|
+
},
|
|
1731
|
+
HK: {
|
|
1732
|
+
mask: '####-####',
|
|
1733
|
+
prefix: '+852 ',
|
|
1734
|
+
},
|
|
1735
|
+
HN: {
|
|
1736
|
+
mask: '########',
|
|
1737
|
+
prefix: '+504 ',
|
|
1738
|
+
},
|
|
1739
|
+
HT: {
|
|
1740
|
+
mask: '####-####',
|
|
1741
|
+
prefix: '+509 ',
|
|
1742
|
+
},
|
|
1743
|
+
HU: {
|
|
1744
|
+
mask: '########??',
|
|
1745
|
+
prefix: '+36 ',
|
|
1746
|
+
},
|
|
1747
|
+
/* IS: {
|
|
1748
|
+
mask:'#######??',
|
|
1749
|
+
prefix: ''
|
|
1750
|
+
}, */
|
|
1751
|
+
IS: {
|
|
1752
|
+
mask: '#########',
|
|
1753
|
+
prefix: '+354 ',
|
|
1754
|
+
},
|
|
1755
|
+
IN: {
|
|
1756
|
+
mask: '##########',
|
|
1757
|
+
prefix: '+91 ',
|
|
1758
|
+
},
|
|
1759
|
+
/* ID: {
|
|
1760
|
+
mask:'#######???',
|
|
1761
|
+
prefix: ''
|
|
1762
|
+
}, */
|
|
1763
|
+
ID: {
|
|
1764
|
+
mask: '#######??????', // allows 7 ~ 13 digits
|
|
1765
|
+
prefix: '+62 ',
|
|
1766
|
+
},
|
|
1767
|
+
IR: {
|
|
1768
|
+
mask: '##########',
|
|
1769
|
+
prefix: '+98 ',
|
|
1770
|
+
},
|
|
1771
|
+
/* IQ: {
|
|
1772
|
+
mask:'########??',
|
|
1773
|
+
prefix: ''
|
|
1774
|
+
}, */
|
|
1775
|
+
IQ: {
|
|
1776
|
+
mask: '##########',
|
|
1777
|
+
prefix: '+964 ',
|
|
1778
|
+
},
|
|
1779
|
+
/* IE: {
|
|
1780
|
+
mask:'#######??',
|
|
1781
|
+
prefix: ''
|
|
1782
|
+
}, */
|
|
1783
|
+
IE: {
|
|
1784
|
+
mask: '#########',
|
|
1785
|
+
prefix: '+353 ',
|
|
1786
|
+
},
|
|
1787
|
+
/* IL: {
|
|
1788
|
+
mask:'########?',
|
|
1789
|
+
prefix: ''
|
|
1790
|
+
}, */
|
|
1791
|
+
IL: {
|
|
1792
|
+
mask: '#########',
|
|
1793
|
+
prefix: '+972 ',
|
|
1794
|
+
},
|
|
1795
|
+
/* IT: {
|
|
1796
|
+
mask:'######????',
|
|
1797
|
+
prefix: ''
|
|
1798
|
+
}, */
|
|
1799
|
+
IT: {
|
|
1800
|
+
mask: '##########',
|
|
1801
|
+
prefix: '+39 ',
|
|
1802
|
+
},
|
|
1803
|
+
JM: {
|
|
1804
|
+
mask: '(###) ###-####',
|
|
1805
|
+
prefix: '+1 ',
|
|
1806
|
+
},
|
|
1807
|
+
JP: {
|
|
1808
|
+
mask: '#########??',
|
|
1809
|
+
prefix: '+81 ',
|
|
1810
|
+
},
|
|
1811
|
+
/* JO: {
|
|
1812
|
+
mask:'#######??',
|
|
1813
|
+
prefix: ''
|
|
1814
|
+
}, */
|
|
1815
|
+
JO: {
|
|
1816
|
+
mask: '#########',
|
|
1817
|
+
prefix: '+962 ',
|
|
1818
|
+
},
|
|
1819
|
+
KZ: {
|
|
1820
|
+
mask: '(###) ####-###',
|
|
1821
|
+
prefix: '+7 ',
|
|
1822
|
+
},
|
|
1823
|
+
/* KE: {
|
|
1824
|
+
mask:'######????',
|
|
1825
|
+
prefix: ''
|
|
1826
|
+
}, */
|
|
1827
|
+
KE: {
|
|
1828
|
+
mask: '##########',
|
|
1829
|
+
prefix: '+254 ',
|
|
1830
|
+
},
|
|
1831
|
+
KI: {
|
|
1832
|
+
mask: '##-###',
|
|
1833
|
+
prefix: '+686 ',
|
|
1834
|
+
},
|
|
1835
|
+
// kp
|
|
1836
|
+
/* KR: {
|
|
1837
|
+
mask:'####??????',
|
|
1838
|
+
prefix: ''
|
|
1839
|
+
}, */
|
|
1840
|
+
KR: {
|
|
1841
|
+
mask: '##########',
|
|
1842
|
+
prefix: '+82 ',
|
|
1843
|
+
},
|
|
1844
|
+
KW: {
|
|
1845
|
+
mask: '####-####',
|
|
1846
|
+
prefix: '+965 ',
|
|
1847
|
+
},
|
|
1848
|
+
KG: {
|
|
1849
|
+
mask: '#########',
|
|
1850
|
+
prefix: '+996 ',
|
|
1851
|
+
},
|
|
1852
|
+
LA: {
|
|
1853
|
+
mask: '########?',
|
|
1854
|
+
prefix: '+856 ',
|
|
1855
|
+
},
|
|
1856
|
+
LV: {
|
|
1857
|
+
mask: '####-####',
|
|
1858
|
+
prefix: '+371 ',
|
|
1859
|
+
},
|
|
1860
|
+
LB: {
|
|
1861
|
+
mask: '#######?',
|
|
1862
|
+
prefix: '+961 ',
|
|
1863
|
+
},
|
|
1864
|
+
LS: {
|
|
1865
|
+
mask: '##-###-###',
|
|
1866
|
+
prefix: '+266 ',
|
|
1867
|
+
},
|
|
1868
|
+
// LR
|
|
1869
|
+
/* LY: {
|
|
1870
|
+
mask:'########?',
|
|
1871
|
+
prefix: ''
|
|
1872
|
+
}, */
|
|
1873
|
+
LY: {
|
|
1874
|
+
mask: '########?',
|
|
1875
|
+
prefix: '+218 ',
|
|
1876
|
+
},
|
|
1877
|
+
LI: {
|
|
1878
|
+
mask: '###-####',
|
|
1879
|
+
prefix: '+423 ',
|
|
1880
|
+
},
|
|
1881
|
+
LT: {
|
|
1882
|
+
mask: '########',
|
|
1883
|
+
prefix: '+370 ',
|
|
1884
|
+
},
|
|
1885
|
+
/* LU: {
|
|
1886
|
+
mask:'#####??????',
|
|
1887
|
+
prefix: '+352 '
|
|
1888
|
+
}, */
|
|
1889
|
+
LU: {
|
|
1890
|
+
mask: '###########',
|
|
1891
|
+
prefix: '+352 ',
|
|
1892
|
+
},
|
|
1893
|
+
MO: {
|
|
1894
|
+
mask: '####-####',
|
|
1895
|
+
prefix: '+853 ',
|
|
1896
|
+
},
|
|
1897
|
+
MK: {
|
|
1898
|
+
mask: '########',
|
|
1899
|
+
prefix: '+389 ',
|
|
1900
|
+
},
|
|
1901
|
+
MG: {
|
|
1902
|
+
mask: '##-##-###-##',
|
|
1903
|
+
prefix: '+261 ',
|
|
1904
|
+
},
|
|
1905
|
+
/* MW: {
|
|
1906
|
+
mask:'#######??',
|
|
1907
|
+
prefix: '+265 '
|
|
1908
|
+
}, */
|
|
1909
|
+
MW: {
|
|
1910
|
+
mask: '#########',
|
|
1911
|
+
prefix: '+265 ',
|
|
1912
|
+
},
|
|
1913
|
+
/* MY: {
|
|
1914
|
+
mask:'#######???',
|
|
1915
|
+
prefix: '+60 '
|
|
1916
|
+
}, */
|
|
1917
|
+
MY: {
|
|
1918
|
+
mask: '##########',
|
|
1919
|
+
prefix: '+60 ',
|
|
1920
|
+
},
|
|
1921
|
+
MV: {
|
|
1922
|
+
mask: '###-####',
|
|
1923
|
+
prefix: '+960 ',
|
|
1924
|
+
},
|
|
1925
|
+
ML: {
|
|
1926
|
+
mask: '####-####',
|
|
1927
|
+
prefix: '+223 ',
|
|
1928
|
+
},
|
|
1929
|
+
MT: {
|
|
1930
|
+
mask: '##-##-##-##',
|
|
1931
|
+
prefix: '+356 ',
|
|
1932
|
+
},
|
|
1933
|
+
MH: {
|
|
1934
|
+
mask: '###-####',
|
|
1935
|
+
prefix: '+692 ',
|
|
1936
|
+
},
|
|
1937
|
+
MQ: {
|
|
1938
|
+
mask: '###-######',
|
|
1939
|
+
prefix: '+596 ',
|
|
1940
|
+
},
|
|
1941
|
+
// MR
|
|
1942
|
+
MU: {
|
|
1943
|
+
mask: '###-####',
|
|
1944
|
+
prefix: '+230 ',
|
|
1945
|
+
},
|
|
1946
|
+
// YT
|
|
1947
|
+
MX: {
|
|
1948
|
+
mask: '(###) ###-####',
|
|
1949
|
+
prefix: '+52 ',
|
|
1950
|
+
},
|
|
1951
|
+
// FM
|
|
1952
|
+
MD: {
|
|
1953
|
+
mask: '########',
|
|
1954
|
+
prefix: '+373 ',
|
|
1955
|
+
},
|
|
1956
|
+
MC: {
|
|
1957
|
+
mask: '####-####',
|
|
1958
|
+
prefix: '+377 ',
|
|
1959
|
+
},
|
|
1960
|
+
/* MN: {
|
|
1961
|
+
mask:'######?????',
|
|
1962
|
+
prefix: '+976 '
|
|
1963
|
+
}, */
|
|
1964
|
+
MN: {
|
|
1965
|
+
mask: '###########',
|
|
1966
|
+
prefix: '+976 ',
|
|
1967
|
+
},
|
|
1968
|
+
MS: {
|
|
1969
|
+
mask: '(###) ###-####',
|
|
1970
|
+
prefix: '+1 ',
|
|
1971
|
+
},
|
|
1972
|
+
MA: {
|
|
1973
|
+
mask: '#########?', // allows 9 ~ 10 digits
|
|
1974
|
+
prefix: '+212 ',
|
|
1975
|
+
},
|
|
1976
|
+
/* MZ: {
|
|
1977
|
+
mask:'########?',
|
|
1978
|
+
prefix: '+258 '
|
|
1979
|
+
}, */
|
|
1980
|
+
MZ: {
|
|
1981
|
+
mask: '#########',
|
|
1982
|
+
prefix: '+258 ',
|
|
1983
|
+
},
|
|
1984
|
+
/* MM: {
|
|
1985
|
+
mask:'#######?',
|
|
1986
|
+
prefix: '+95 '
|
|
1987
|
+
}, */
|
|
1988
|
+
MM: {
|
|
1989
|
+
mask: '########',
|
|
1990
|
+
prefix: '+95 ',
|
|
1991
|
+
},
|
|
1992
|
+
/* NA: {
|
|
1993
|
+
mask:'######????',
|
|
1994
|
+
prefix: '+264 '
|
|
1995
|
+
}, */
|
|
1996
|
+
NA: {
|
|
1997
|
+
mask: '##########',
|
|
1998
|
+
prefix: '+264 ',
|
|
1999
|
+
},
|
|
2000
|
+
// NR
|
|
2001
|
+
/* NP: {
|
|
2002
|
+
mask:'########??',
|
|
2003
|
+
prefix: '+977 '
|
|
2004
|
+
}, */
|
|
2005
|
+
NP: {
|
|
2006
|
+
mask: '##########',
|
|
2007
|
+
prefix: '+977 ',
|
|
2008
|
+
},
|
|
2009
|
+
NL: {
|
|
2010
|
+
mask: '#########',
|
|
2011
|
+
prefix: '+31 ',
|
|
2012
|
+
},
|
|
2013
|
+
/* AN: {
|
|
2014
|
+
mask:'#######?',
|
|
2015
|
+
prefix: '+599 '
|
|
2016
|
+
}, */
|
|
2017
|
+
AN: {
|
|
2018
|
+
mask: '########',
|
|
2019
|
+
prefix: '+599 ',
|
|
2020
|
+
},
|
|
2021
|
+
NC: {
|
|
2022
|
+
mask: '###-###',
|
|
2023
|
+
prefix: '+687 ',
|
|
2024
|
+
},
|
|
2025
|
+
/* NZ: {
|
|
2026
|
+
mask:'########??',
|
|
2027
|
+
prefix: '+64 '
|
|
2028
|
+
}, */
|
|
2029
|
+
NZ: {
|
|
2030
|
+
mask: '##########',
|
|
2031
|
+
prefix: '+64 ',
|
|
2032
|
+
},
|
|
2033
|
+
NI: {
|
|
2034
|
+
mask: '####-####',
|
|
2035
|
+
prefix: '+505 ',
|
|
2036
|
+
},
|
|
2037
|
+
NE: {
|
|
2038
|
+
mask: '##-###-###',
|
|
2039
|
+
prefix: '+227 ',
|
|
2040
|
+
},
|
|
2041
|
+
/* NG: {
|
|
2042
|
+
mask:'########??',
|
|
2043
|
+
prefix: '+234 '
|
|
2044
|
+
}, */
|
|
2045
|
+
NG: {
|
|
2046
|
+
mask: '##########',
|
|
2047
|
+
prefix: '+234 ',
|
|
2048
|
+
},
|
|
2049
|
+
// NU
|
|
2050
|
+
MP: {
|
|
2051
|
+
mask: '(###) ###-####',
|
|
2052
|
+
prefix: '+1 ',
|
|
2053
|
+
},
|
|
2054
|
+
NO: {
|
|
2055
|
+
mask: '####-####',
|
|
2056
|
+
prefix: '+47 ',
|
|
2057
|
+
},
|
|
2058
|
+
OM: {
|
|
2059
|
+
mask: '####-####',
|
|
2060
|
+
prefix: '+968 ',
|
|
2061
|
+
},
|
|
2062
|
+
/* PK: {
|
|
2063
|
+
mask:'#########?',
|
|
2064
|
+
prefix: '+92 '
|
|
2065
|
+
}, */
|
|
2066
|
+
PK: {
|
|
2067
|
+
mask: '##########',
|
|
2068
|
+
prefix: '+92 ',
|
|
2069
|
+
},
|
|
2070
|
+
PW: {
|
|
2071
|
+
mask: '###-####',
|
|
2072
|
+
prefix: '+680 ',
|
|
2073
|
+
},
|
|
2074
|
+
/* PA: {
|
|
2075
|
+
mask:'#######?',
|
|
2076
|
+
prefix: '+507 '
|
|
2077
|
+
}, */
|
|
2078
|
+
PA: {
|
|
2079
|
+
mask: '########',
|
|
2080
|
+
prefix: '+507 ',
|
|
2081
|
+
},
|
|
2082
|
+
/* PG: {
|
|
2083
|
+
mask:'#######?',
|
|
2084
|
+
prefix: '+675 '
|
|
2085
|
+
}, */
|
|
2086
|
+
PG: {
|
|
2087
|
+
mask: '########',
|
|
2088
|
+
prefix: '+675 ',
|
|
2089
|
+
},
|
|
2090
|
+
// PY
|
|
2091
|
+
/* PE: {
|
|
2092
|
+
mask:'#######????',
|
|
2093
|
+
prefix: '+51 '
|
|
2094
|
+
}, */
|
|
2095
|
+
PE: {
|
|
2096
|
+
mask: '###########',
|
|
2097
|
+
prefix: '+51 ',
|
|
2098
|
+
},
|
|
2099
|
+
/* PH: {
|
|
2100
|
+
mask:'########??',
|
|
2101
|
+
prefix: '+63 '
|
|
2102
|
+
}, */
|
|
2103
|
+
PH: {
|
|
2104
|
+
mask: '##########',
|
|
2105
|
+
prefix: '+63 ',
|
|
2106
|
+
},
|
|
2107
|
+
PL: {
|
|
2108
|
+
mask: '#########',
|
|
2109
|
+
prefix: '+48 ',
|
|
2110
|
+
},
|
|
2111
|
+
PT: {
|
|
2112
|
+
mask: '#-####-####',
|
|
2113
|
+
prefix: '+351 ',
|
|
2114
|
+
},
|
|
2115
|
+
PR: {
|
|
2116
|
+
mask: '(###) ###-####',
|
|
2117
|
+
prefix: '+1 ',
|
|
2118
|
+
},
|
|
2119
|
+
QA: {
|
|
2120
|
+
mask: '###-####',
|
|
2121
|
+
prefix: '+974 ',
|
|
2122
|
+
},
|
|
2123
|
+
RE: {
|
|
2124
|
+
mask: '###-###-###',
|
|
2125
|
+
prefix: '+262 ',
|
|
2126
|
+
},
|
|
2127
|
+
RO: {
|
|
2128
|
+
mask: '#########',
|
|
2129
|
+
prefix: '+40 ',
|
|
2130
|
+
},
|
|
2131
|
+
RU: {
|
|
2132
|
+
mask: '##########',
|
|
2133
|
+
prefix: '+7 ',
|
|
2134
|
+
},
|
|
2135
|
+
RW: {
|
|
2136
|
+
mask: '###-###-###',
|
|
2137
|
+
prefix: '+250 ',
|
|
2138
|
+
},
|
|
2139
|
+
SH: {
|
|
2140
|
+
mask: '#-###',
|
|
2141
|
+
prefix: '+290 ',
|
|
2142
|
+
},
|
|
2143
|
+
// PM
|
|
2144
|
+
KN: {
|
|
2145
|
+
mask: '(###) ###-####',
|
|
2146
|
+
prefix: '+1 ',
|
|
2147
|
+
},
|
|
2148
|
+
LC: {
|
|
2149
|
+
mask: '(###) ###-####',
|
|
2150
|
+
prefix: '+1 ',
|
|
2151
|
+
},
|
|
2152
|
+
VC: {
|
|
2153
|
+
mask: '(###) ###-####',
|
|
2154
|
+
prefix: '+1 ',
|
|
2155
|
+
},
|
|
2156
|
+
// WS
|
|
2157
|
+
// SM
|
|
2158
|
+
ST: {
|
|
2159
|
+
mask: '##-####',
|
|
2160
|
+
prefix: '+239 ',
|
|
2161
|
+
},
|
|
2162
|
+
/* SA: {
|
|
2163
|
+
mask:'########?',
|
|
2164
|
+
prefix: '+966 '
|
|
2165
|
+
}, */
|
|
2166
|
+
SA: {
|
|
2167
|
+
mask: '#########',
|
|
2168
|
+
prefix: '+966 ',
|
|
2169
|
+
},
|
|
2170
|
+
SN: {
|
|
2171
|
+
mask: '##-###-####',
|
|
2172
|
+
prefix: '+221 ',
|
|
2173
|
+
},
|
|
2174
|
+
SC: {
|
|
2175
|
+
mask: '###-###',
|
|
2176
|
+
prefix: '+248 ',
|
|
2177
|
+
},
|
|
2178
|
+
SL: {
|
|
2179
|
+
mask: '(##) ###-###',
|
|
2180
|
+
prefix: '+232 ',
|
|
2181
|
+
},
|
|
2182
|
+
SG: {
|
|
2183
|
+
mask: '####-####',
|
|
2184
|
+
prefix: '+65 ',
|
|
2185
|
+
},
|
|
2186
|
+
SK: {
|
|
2187
|
+
mask: '#########',
|
|
2188
|
+
prefix: '+421 ',
|
|
2189
|
+
},
|
|
2190
|
+
SI: {
|
|
2191
|
+
mask: '########',
|
|
2192
|
+
prefix: '+386 ',
|
|
2193
|
+
},
|
|
2194
|
+
SB: {
|
|
2195
|
+
mask: '##-###',
|
|
2196
|
+
prefix: '+677 ',
|
|
2197
|
+
},
|
|
2198
|
+
// SO
|
|
2199
|
+
ZA: {
|
|
2200
|
+
mask: '(##) ###-####',
|
|
2201
|
+
prefix: '+27 ',
|
|
2202
|
+
},
|
|
2203
|
+
ES: {
|
|
2204
|
+
mask: '###-###-###',
|
|
2205
|
+
prefix: '+34 ',
|
|
2206
|
+
},
|
|
2207
|
+
LK: {
|
|
2208
|
+
mask: '(##) ###-####',
|
|
2209
|
+
prefix: '+94 ',
|
|
2210
|
+
},
|
|
2211
|
+
SD: {
|
|
2212
|
+
mask: '##-###-####',
|
|
2213
|
+
prefix: '+249 ',
|
|
2214
|
+
},
|
|
2215
|
+
SR: {
|
|
2216
|
+
mask: '######?',
|
|
2217
|
+
prefix: '+597 ',
|
|
2218
|
+
},
|
|
2219
|
+
SZ: {
|
|
2220
|
+
mask: '###-####',
|
|
2221
|
+
prefix: '+268 ',
|
|
2222
|
+
},
|
|
2223
|
+
/* SE: {
|
|
2224
|
+
mask:'######?????',
|
|
2225
|
+
prefix: '+46 '
|
|
2226
|
+
}, */
|
|
2227
|
+
SE: {
|
|
2228
|
+
mask: '###########',
|
|
2229
|
+
prefix: '+46 ',
|
|
2230
|
+
},
|
|
2231
|
+
CH: {
|
|
2232
|
+
mask: '(##) ###-####',
|
|
2233
|
+
prefix: '+41 ',
|
|
2234
|
+
},
|
|
2235
|
+
/* SY: {
|
|
2236
|
+
mask:'########?',
|
|
2237
|
+
prefix: '+963 '
|
|
2238
|
+
}, */
|
|
2239
|
+
SY: {
|
|
2240
|
+
mask: '#########',
|
|
2241
|
+
prefix: '+963 ',
|
|
2242
|
+
},
|
|
2243
|
+
TJ: {
|
|
2244
|
+
mask: '#########',
|
|
2245
|
+
prefix: '+992 ',
|
|
2246
|
+
},
|
|
2247
|
+
TZ: {
|
|
2248
|
+
mask: '#########',
|
|
2249
|
+
prefix: '+255 ',
|
|
2250
|
+
},
|
|
2251
|
+
/* TH: {
|
|
2252
|
+
mask:'########?',
|
|
2253
|
+
prefix: '+66 '
|
|
2254
|
+
}, */
|
|
2255
|
+
TH: {
|
|
2256
|
+
mask: '#########',
|
|
2257
|
+
prefix: '+66 ',
|
|
2258
|
+
},
|
|
2259
|
+
TG: {
|
|
2260
|
+
mask: '###-####',
|
|
2261
|
+
prefix: '+228 ',
|
|
2262
|
+
},
|
|
2263
|
+
// TK
|
|
2264
|
+
// TO
|
|
2265
|
+
TT: {
|
|
2266
|
+
mask: '(###) ###-####',
|
|
2267
|
+
prefix: '+1 ',
|
|
2268
|
+
},
|
|
2269
|
+
TN: {
|
|
2270
|
+
mask: '##-###-###',
|
|
2271
|
+
prefix: '+216 ',
|
|
2272
|
+
},
|
|
2273
|
+
TR: {
|
|
2274
|
+
mask: '(###) ###-####',
|
|
2275
|
+
prefix: '+90 ',
|
|
2276
|
+
},
|
|
2277
|
+
TM: {
|
|
2278
|
+
mask: '########',
|
|
2279
|
+
prefix: '+993 ',
|
|
2280
|
+
},
|
|
2281
|
+
TC: {
|
|
2282
|
+
mask: '(###) ###-####',
|
|
2283
|
+
prefix: '+1 ',
|
|
2284
|
+
},
|
|
2285
|
+
// TV
|
|
2286
|
+
UG: {
|
|
2287
|
+
mask: '#########',
|
|
2288
|
+
prefix: '+256 ',
|
|
2289
|
+
},
|
|
2290
|
+
UA: {
|
|
2291
|
+
mask: '(##) ###-####',
|
|
2292
|
+
prefix: '+380 ',
|
|
2293
|
+
},
|
|
2294
|
+
/* AE: {
|
|
2295
|
+
mask:'########?',
|
|
2296
|
+
prefix: '+971 '
|
|
2297
|
+
}, */
|
|
2298
|
+
AE: {
|
|
2299
|
+
mask: '#########',
|
|
2300
|
+
prefix: '+971 ',
|
|
2301
|
+
},
|
|
2302
|
+
/* GB: {
|
|
2303
|
+
mask:'##########???',
|
|
2304
|
+
prefix: '+44 '
|
|
2305
|
+
}, */
|
|
2306
|
+
GB: {
|
|
2307
|
+
mask: '#########????',
|
|
2308
|
+
prefix: '+44 ',
|
|
2309
|
+
},
|
|
2310
|
+
UY: {
|
|
2311
|
+
mask: '########?',
|
|
2312
|
+
prefix: '+598 ',
|
|
2313
|
+
},
|
|
2314
|
+
UZ: {
|
|
2315
|
+
mask: '(##) ###-####',
|
|
2316
|
+
prefix: '+998 ',
|
|
2317
|
+
},
|
|
2318
|
+
// VU
|
|
2319
|
+
// VA
|
|
2320
|
+
VE: {
|
|
2321
|
+
mask: '(###) ###-####',
|
|
2322
|
+
prefix: '+58 ',
|
|
2323
|
+
},
|
|
2324
|
+
VN: {
|
|
2325
|
+
mask: '#######????',
|
|
2326
|
+
prefix: '+84 ',
|
|
2327
|
+
},
|
|
2328
|
+
VG: {
|
|
2329
|
+
mask: '(###) ###-####',
|
|
2330
|
+
prefix: '+1 ',
|
|
2331
|
+
},
|
|
2332
|
+
VI: {
|
|
2333
|
+
mask: '(###) ###-####',
|
|
2334
|
+
prefix: '+1 ',
|
|
2335
|
+
},
|
|
2336
|
+
// WF
|
|
2337
|
+
/* YE: {
|
|
2338
|
+
mask:'#######??',
|
|
2339
|
+
prefix: '+967 '
|
|
2340
|
+
}, */
|
|
2341
|
+
YE: {
|
|
2342
|
+
mask: '#########',
|
|
2343
|
+
prefix: '+967 ',
|
|
2344
|
+
},
|
|
2345
|
+
// YU
|
|
2346
|
+
ZM: {
|
|
2347
|
+
mask: '#########',
|
|
2348
|
+
prefix: '+260 ',
|
|
2349
|
+
},
|
|
2350
|
+
/* ZW: {
|
|
2351
|
+
mask:'####?????',
|
|
2352
|
+
prefix: '+263 '
|
|
2353
|
+
}, */
|
|
2354
|
+
ZW: {
|
|
2355
|
+
mask: '#########',
|
|
2356
|
+
prefix: '+263 ',
|
|
2357
|
+
},
|
|
2358
|
+
AC: {
|
|
2359
|
+
mask: '####',
|
|
2360
|
+
prefix: '+247 ',
|
|
2361
|
+
},
|
|
2362
|
+
ME: {
|
|
2363
|
+
mask: '(##) ###-###?',
|
|
2364
|
+
prefix: '+382 ',
|
|
2365
|
+
},
|
|
2366
|
+
/* PS: {
|
|
2367
|
+
mask:'########?',
|
|
2368
|
+
prefix: '+970 '
|
|
2369
|
+
}, */
|
|
2370
|
+
PS: {
|
|
2371
|
+
mask: '#########',
|
|
2372
|
+
prefix: '+970 ',
|
|
2373
|
+
},
|
|
2374
|
+
/* RS: {
|
|
2375
|
+
mask:'#######??',
|
|
2376
|
+
prefix: '+381 '
|
|
2377
|
+
}, */
|
|
2378
|
+
RS: {
|
|
2379
|
+
mask: '#########',
|
|
2380
|
+
prefix: '+381 ',
|
|
2381
|
+
},
|
|
2382
|
+
/* TW: {
|
|
2383
|
+
mask:'########?',
|
|
2384
|
+
prefix: '+886 '
|
|
2385
|
+
}, */
|
|
2386
|
+
TW: {
|
|
2387
|
+
mask: '#########',
|
|
2388
|
+
prefix: '+886 ',
|
|
2389
|
+
},
|
|
2390
|
+
CW: {
|
|
2391
|
+
mask: '#-###-####',
|
|
2392
|
+
prefix: '+599 ',
|
|
2393
|
+
},
|
|
2394
|
+
US: {
|
|
2395
|
+
mask: '(###) ###-####',
|
|
2396
|
+
prefix: '',
|
|
2397
|
+
},
|
|
2398
|
+
};
|
|
2399
|
+
function formatPhoneNumber(value, isoCode = 'US') {
|
|
2400
|
+
const { mask, prefix } = phoneNumberFormats[isoCode] || phoneNumberFormats.US;
|
|
2401
|
+
const options = {
|
|
2402
|
+
prefix,
|
|
2403
|
+
};
|
|
2404
|
+
const val = value || '';
|
|
2405
|
+
// Brazil need edge case handle, mobile: (xx) xxxxx-xxxx, land phone: (xx) xxxx-xxxx
|
|
2406
|
+
if (isoCode === 'BR' && val.replace(/[^0-9]/g, '').length === 11) {
|
|
2407
|
+
return formatValue(val, '(##) #####-####', options);
|
|
2408
|
+
}
|
|
2409
|
+
else {
|
|
2410
|
+
return formatValue(val, mask, options);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
function formatSSN(value) {
|
|
2415
|
+
return formatValue(value, '###-##-####');
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
function formatTIN(value) {
|
|
2419
|
+
return formatValue(value, '##-#######');
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
function formatAlphanumeric(value) {
|
|
2423
|
+
const val = (value || '').replace(/[^\da-zA-Z]/g, '');
|
|
2424
|
+
return formatValue(val);
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
function formatAlpha(value, modifier) {
|
|
2428
|
+
let val = value || '';
|
|
2429
|
+
if (modifier === 'spaced') {
|
|
2430
|
+
val = val.replace(/[^a-zA-Z ]/g, '');
|
|
2431
|
+
}
|
|
2432
|
+
else {
|
|
2433
|
+
val = val.replace(/[^a-zA-Z]/g, '');
|
|
2434
|
+
}
|
|
2435
|
+
return formatValue(val);
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
function getNumberFormat(formatOptions) {
|
|
2439
|
+
const numberFormat = {
|
|
2440
|
+
prefix: '',
|
|
2441
|
+
suffix: '',
|
|
2442
|
+
decimals: 0,
|
|
2443
|
+
decimalSeparator: '.',
|
|
2444
|
+
thousandsSeparator: '',
|
|
2445
|
+
allowDecimal: false,
|
|
2446
|
+
allowNegative: true,
|
|
2447
|
+
};
|
|
2448
|
+
const formatParts = formatOptions.split('-');
|
|
2449
|
+
// handle deprecated formats
|
|
2450
|
+
if (formatParts[0] === 'delimited') {
|
|
2451
|
+
// `delimited` - to be replaced by `integer-delimited`
|
|
2452
|
+
numberFormat.thousandsSeparator = ',';
|
|
2453
|
+
}
|
|
2454
|
+
else if (formatParts[0].match(/^[0-9]+dec$/)) {
|
|
2455
|
+
// `Ndec` - to be replaced by `Ndecimal`
|
|
2456
|
+
numberFormat.decimals = Number(formatParts[0].replace('dec', ''));
|
|
2457
|
+
numberFormat.allowDecimal = true;
|
|
2458
|
+
numberFormat.thousandsSeparator = ',';
|
|
2459
|
+
}
|
|
2460
|
+
else {
|
|
2461
|
+
// determine number type
|
|
2462
|
+
if (formatParts[0].includes('decimal')) {
|
|
2463
|
+
numberFormat.decimals = Number(formatParts[0].replace('decimal', ''));
|
|
2464
|
+
numberFormat.allowDecimal = true;
|
|
2465
|
+
}
|
|
2466
|
+
else if (formatParts[0] !== 'integer') {
|
|
2467
|
+
// Ignore any formats that don't start with Ndecimal or integer
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
// determine if negative numbers are allowed
|
|
2471
|
+
if (formatParts.includes('positive')) {
|
|
2472
|
+
numberFormat.allowNegative = false;
|
|
2473
|
+
}
|
|
2474
|
+
// determine if number is delimited
|
|
2475
|
+
if (formatParts.includes('delimited')) {
|
|
2476
|
+
numberFormat.thousandsSeparator = ',';
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
return numberFormat;
|
|
2480
|
+
}
|
|
2481
|
+
function formatNumeric(value = '', modifier = '', explicit = false) {
|
|
2482
|
+
const numberFormat = getNumberFormat(modifier);
|
|
2483
|
+
if (!numberFormat) {
|
|
2484
|
+
const val = (value || '').replace(/[^\d.,-]/g, '');
|
|
2485
|
+
return formatValue(val);
|
|
2486
|
+
}
|
|
2487
|
+
return formatNumber(value, numberFormat, explicit);
|
|
2488
|
+
}
|
|
2489
|
+
function formatPercentage(value = '', modifier = '', explicit = false) {
|
|
2490
|
+
const numberFormat = getNumberFormat(modifier);
|
|
2491
|
+
if (!numberFormat) {
|
|
2492
|
+
const val = (value || '').replace(/[^\d.,-]/g, '');
|
|
2493
|
+
return formatValue(val, undefined, { suffix: '%' });
|
|
2494
|
+
}
|
|
2495
|
+
numberFormat.suffix = '%';
|
|
2496
|
+
return formatNumber(value, numberFormat, explicit);
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
const postalCodeFormats = {
|
|
2500
|
+
AF: '####',
|
|
2501
|
+
AL: '####',
|
|
2502
|
+
DZ: '#####',
|
|
2503
|
+
AC: 'ASCN 1ZZ',
|
|
2504
|
+
AD: 'AD###', // pre
|
|
2505
|
+
AR: '####',
|
|
2506
|
+
'AR+': '@####@@@',
|
|
2507
|
+
AI: 'AI-2640',
|
|
2508
|
+
AM: '####',
|
|
2509
|
+
AS: '#####',
|
|
2510
|
+
'AS+4': '#####-####',
|
|
2511
|
+
AU: '####',
|
|
2512
|
+
AT: '####',
|
|
2513
|
+
AZ: 'AZ ####', // pre
|
|
2514
|
+
BH: '###?',
|
|
2515
|
+
BD: '####',
|
|
2516
|
+
BB: 'BB#####', // pre
|
|
2517
|
+
BY: '######',
|
|
2518
|
+
BE: '####',
|
|
2519
|
+
BM: '@@ **',
|
|
2520
|
+
BT: '#####',
|
|
2521
|
+
BA: '######',
|
|
2522
|
+
BR: '#####',
|
|
2523
|
+
'BR+3': '#####-###',
|
|
2524
|
+
VG: 'VG####', // pre
|
|
2525
|
+
BN: '@@####',
|
|
2526
|
+
BG: '####',
|
|
2527
|
+
KH: '#####',
|
|
2528
|
+
KY: 'KY#-####', // pre
|
|
2529
|
+
CA: '@#@ #@#',
|
|
2530
|
+
CL: '###-####',
|
|
2531
|
+
CN: '######',
|
|
2532
|
+
CX: '####',
|
|
2533
|
+
CC: '####',
|
|
2534
|
+
CO: '######',
|
|
2535
|
+
CR: '#####',
|
|
2536
|
+
'CR+4': '#####-####',
|
|
2537
|
+
CV: '####',
|
|
2538
|
+
HR: '#####',
|
|
2539
|
+
CU: '#####',
|
|
2540
|
+
CY: '####',
|
|
2541
|
+
CZ: '### ##',
|
|
2542
|
+
DK: '####',
|
|
2543
|
+
DO: '#####',
|
|
2544
|
+
EC: '######',
|
|
2545
|
+
SV: '####',
|
|
2546
|
+
EG: '#####',
|
|
2547
|
+
EE: '#####',
|
|
2548
|
+
ET: '####',
|
|
2549
|
+
FK: 'FIQQ 1ZZ',
|
|
2550
|
+
FO: '###',
|
|
2551
|
+
FI: '#####',
|
|
2552
|
+
FR: '#####',
|
|
2553
|
+
GF: '973##', // pre?
|
|
2554
|
+
PF: '987##', // pre?
|
|
2555
|
+
GI: 'GX11 1AA',
|
|
2556
|
+
GE: '####',
|
|
2557
|
+
DE: '#####',
|
|
2558
|
+
GR: '### ##',
|
|
2559
|
+
GL: '####',
|
|
2560
|
+
GP: '971##', // pre?
|
|
2561
|
+
GU: '#####',
|
|
2562
|
+
'GU+4': '#####-####',
|
|
2563
|
+
GT: '#####',
|
|
2564
|
+
GG: 'GY#? #@@',
|
|
2565
|
+
GN: '###',
|
|
2566
|
+
GS: 'SIQQ 1ZZ',
|
|
2567
|
+
GW: '####',
|
|
2568
|
+
HT: '####',
|
|
2569
|
+
HN: '@@####',
|
|
2570
|
+
'HN-': '#####',
|
|
2571
|
+
HU: '####',
|
|
2572
|
+
IS: '###',
|
|
2573
|
+
IN: '### ###',
|
|
2574
|
+
ID: '#####',
|
|
2575
|
+
IE: '*** ****',
|
|
2576
|
+
IR: '##########',
|
|
2577
|
+
IQ: '#####',
|
|
2578
|
+
IM: 'IM#? #@@', // pre
|
|
2579
|
+
IL: '#######',
|
|
2580
|
+
IT: '#####',
|
|
2581
|
+
JM: '##',
|
|
2582
|
+
JP: '###-####',
|
|
2583
|
+
JE: 'JE#? #@@', // pre
|
|
2584
|
+
JO: '#####',
|
|
2585
|
+
KZ: '######',
|
|
2586
|
+
KE: '#####',
|
|
2587
|
+
KR: '#####',
|
|
2588
|
+
KN: 'KN####',
|
|
2589
|
+
XK: '#####',
|
|
2590
|
+
KW: '#####',
|
|
2591
|
+
KG: '######',
|
|
2592
|
+
LA: '#####',
|
|
2593
|
+
LV: 'LV-####', // pre
|
|
2594
|
+
LB: '####? ????', // also 00000
|
|
2595
|
+
LS: '###',
|
|
2596
|
+
LR: '####',
|
|
2597
|
+
LI: '####',
|
|
2598
|
+
LT: '#####', // pre-
|
|
2599
|
+
LU: '####',
|
|
2600
|
+
MK: '####',
|
|
2601
|
+
MG: '###',
|
|
2602
|
+
MY: '#####',
|
|
2603
|
+
MV: '#####',
|
|
2604
|
+
MT: '@@@ ####',
|
|
2605
|
+
MH: '#####',
|
|
2606
|
+
'MH+4': '#####-####',
|
|
2607
|
+
MU: '#####',
|
|
2608
|
+
MQ: '972##', // pre?
|
|
2609
|
+
MW: '######',
|
|
2610
|
+
YT: '976##', // pre?
|
|
2611
|
+
MX: '#####',
|
|
2612
|
+
FM: '#####',
|
|
2613
|
+
'FM+4': '#####-####',
|
|
2614
|
+
MD: '####', // pre
|
|
2615
|
+
MC: '980##', // pre?
|
|
2616
|
+
MN: '#####',
|
|
2617
|
+
ME: '#####',
|
|
2618
|
+
MA: '#####',
|
|
2619
|
+
MZ: '####',
|
|
2620
|
+
MM: '#####',
|
|
2621
|
+
NA: '#####',
|
|
2622
|
+
NP: '#####',
|
|
2623
|
+
NC: '988##', // pre?
|
|
2624
|
+
NZ: '####',
|
|
2625
|
+
NI: '#####',
|
|
2626
|
+
NE: '####',
|
|
2627
|
+
NG: '######',
|
|
2628
|
+
NF: '####',
|
|
2629
|
+
MP: '#####',
|
|
2630
|
+
NO: '####',
|
|
2631
|
+
OM: '###',
|
|
2632
|
+
PK: '#####',
|
|
2633
|
+
PW: '#####',
|
|
2634
|
+
'PW+4': '#####-####',
|
|
2635
|
+
PS: '###',
|
|
2636
|
+
PA: '####',
|
|
2637
|
+
PG: '###',
|
|
2638
|
+
PY: '####',
|
|
2639
|
+
PE: '#####',
|
|
2640
|
+
'PE+': '####', // pre
|
|
2641
|
+
PH: '####',
|
|
2642
|
+
PL: '##-###',
|
|
2643
|
+
PT: '####',
|
|
2644
|
+
'PT+3': '####-###',
|
|
2645
|
+
PR: '#####',
|
|
2646
|
+
'PR+4': '#####-####',
|
|
2647
|
+
RE: '974##', // pre?
|
|
2648
|
+
PM: '975##',
|
|
2649
|
+
PN: 'PCRN 1ZZ',
|
|
2650
|
+
RO: '######',
|
|
2651
|
+
RU: '######',
|
|
2652
|
+
LC: 'LC## ###', // pre
|
|
2653
|
+
VC: '####', // pre
|
|
2654
|
+
WS: '####', // pre
|
|
2655
|
+
SM: '4879#', // pre?
|
|
2656
|
+
SA: '#####',
|
|
2657
|
+
'SA+4': '#####-####',
|
|
2658
|
+
SN: '#####',
|
|
2659
|
+
RS: '#####',
|
|
2660
|
+
SG: '######',
|
|
2661
|
+
SH: '@@@@ 1ZZ',
|
|
2662
|
+
SK: '### ##',
|
|
2663
|
+
SI: '####', // pre?
|
|
2664
|
+
SO: '@@ #####',
|
|
2665
|
+
ZA: '####',
|
|
2666
|
+
ES: '#####',
|
|
2667
|
+
LK: '#####',
|
|
2668
|
+
SD: '#####',
|
|
2669
|
+
SZ: '@###',
|
|
2670
|
+
SE: '### ##',
|
|
2671
|
+
CH: '####',
|
|
2672
|
+
SJ: '####',
|
|
2673
|
+
TW: '###',
|
|
2674
|
+
'TW+2': '###-##?',
|
|
2675
|
+
TJ: '######',
|
|
2676
|
+
TZ: '#####',
|
|
2677
|
+
TH: '#####',
|
|
2678
|
+
TT: '######',
|
|
2679
|
+
TN: '####',
|
|
2680
|
+
TR: '#####',
|
|
2681
|
+
TM: '######',
|
|
2682
|
+
UA: '#####',
|
|
2683
|
+
UY: '#####',
|
|
2684
|
+
VI: '#####',
|
|
2685
|
+
'VI+4': '#####-####',
|
|
2686
|
+
UZ: '######',
|
|
2687
|
+
VE: '####',
|
|
2688
|
+
'VE-': '####-@',
|
|
2689
|
+
VN: '#####?',
|
|
2690
|
+
YU: '#####',
|
|
2691
|
+
WF: '986##', // pre?
|
|
2692
|
+
ZM: '#####',
|
|
2693
|
+
US: '#####',
|
|
2694
|
+
'US+4': '#####-####',
|
|
2695
|
+
};
|
|
2696
|
+
function formatPostalCode(value, modifier = 'US') {
|
|
2697
|
+
const mask = postalCodeFormats[modifier];
|
|
2698
|
+
if (!mask) {
|
|
2699
|
+
return formatAlphanumeric(value);
|
|
2700
|
+
}
|
|
2701
|
+
return formatValue(value, mask);
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
const dateFormats = {
|
|
2705
|
+
'MM/DD/YYYY': '##/##/####',
|
|
2706
|
+
'M/D/YYYY': '#?/#?/####',
|
|
2707
|
+
'MM/DD/YY': '##/##/##',
|
|
2708
|
+
'M/D/YY': '#?/#?/##',
|
|
2709
|
+
'MM/YY': '##/##',
|
|
2710
|
+
'M/YY': '#?/##',
|
|
2711
|
+
'DD/MM/YYYY': '##/##/####',
|
|
2712
|
+
'D/M/YYYY': '#?/#?/####',
|
|
2713
|
+
'DD/MM/YY': '##/##/##',
|
|
2714
|
+
'D/M/YY': '#?/#?/##',
|
|
2715
|
+
'MM-DD-YYYY': '##-##-####',
|
|
2716
|
+
'M-D-YYYY': '#?-#?-####',
|
|
2717
|
+
'MM-DD-YY': '##-##-##',
|
|
2718
|
+
'M-D-YY': '#?-#?-##',
|
|
2719
|
+
'MM-YY': '##-##',
|
|
2720
|
+
'M-YY': '#?-##',
|
|
2721
|
+
'DD-MM-YYYY': '##-##-####',
|
|
2722
|
+
'D-M-YYYY': '#?-#?-####',
|
|
2723
|
+
'DD-MM-YY': '##-##-##',
|
|
2724
|
+
'D-M-YY': '#?-#?-##',
|
|
2725
|
+
};
|
|
2726
|
+
function formatDate(value, format = 'MM/DD/YYYY') {
|
|
2727
|
+
const mask = dateFormats[format === null || format === void 0 ? void 0 : format.toUpperCase()] || dateFormats['MM/DD/YYYY'];
|
|
2728
|
+
const formattedValueObject = formatValue(value, mask);
|
|
2729
|
+
return Object.assign(Object.assign({}, formattedValueObject), { value: formattedValueObject.formattedValue });
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
function format(value) {
|
|
2733
|
+
// have a initial generic mask which then converts to specific mask
|
|
2734
|
+
const detectedType = formatCreditCard.detectCreditCardTypeFromValue(value);
|
|
2735
|
+
const formattedValueObject = creditCardFormatters[detectedType](value);
|
|
2736
|
+
if (value.length < 2 && detectedType === 'unknown') {
|
|
2737
|
+
formattedValueObject.leftIcon = 'card';
|
|
2738
|
+
}
|
|
2739
|
+
return formattedValueObject;
|
|
2740
|
+
}
|
|
2741
|
+
const unknownFormatter = function unknownFn(value) {
|
|
2742
|
+
const valueObject = formatValue(value, '#### #### #### ####');
|
|
2743
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'unknown', leftIcon: 'card-unknown', leftIconMuted: value.length < 16 });
|
|
2744
|
+
};
|
|
2745
|
+
const amexFormatter = function amexFn(value) {
|
|
2746
|
+
const valueObject = formatValue(value, '#### ###### #####');
|
|
2747
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'amex', leftIcon: 'card-amex-color', leftIconMuted: value.length < 15 });
|
|
2748
|
+
};
|
|
2749
|
+
const discoverFormatter = function discoverFn(value) {
|
|
2750
|
+
const valueObject = formatValue(value, '#### #### #### ####');
|
|
2751
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'discover', leftIcon: 'card-discover-color', leftIconMuted: value.length < 16 });
|
|
2752
|
+
};
|
|
2753
|
+
const masterCardFormatter = function masterCardFn(value) {
|
|
2754
|
+
const valueObject = formatValue(value, '#### #### #### ####');
|
|
2755
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'masterCard', leftIcon: 'card-mastercard-color', leftIconMuted: value.length < 16 });
|
|
2756
|
+
};
|
|
2757
|
+
const visaFormatter = function visaFn(value) {
|
|
2758
|
+
const valueObject = formatValue(value, '#### #### #### ####');
|
|
2759
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'visa', leftIcon: 'card-visa-color', leftIconMuted: value.length < 16 });
|
|
2760
|
+
};
|
|
2761
|
+
const dinersClubInternationalFormatter = function dinersClub(value) {
|
|
2762
|
+
const valueObject = formatValue(value, '#### ###### ####');
|
|
2763
|
+
return Object.assign(Object.assign({}, valueObject), { type: 'dinersClub', leftIcon: 'card-dinersclub-color', leftIconMuted: value.length < 14 });
|
|
2764
|
+
};
|
|
2765
|
+
const creditCardFormatters = {
|
|
2766
|
+
discover: discoverFormatter,
|
|
2767
|
+
amex: amexFormatter,
|
|
2768
|
+
masterCard: masterCardFormatter,
|
|
2769
|
+
visa: visaFormatter,
|
|
2770
|
+
dinersClub: dinersClubInternationalFormatter,
|
|
2771
|
+
unknown: unknownFormatter,
|
|
2772
|
+
};
|
|
2773
|
+
/* tslint:disable:cyclomatic-complexity */
|
|
2774
|
+
function detectCreditCardTypeFromValue(value) {
|
|
2775
|
+
// use value and some algorithm from the internet to detect and return card type based on string
|
|
2776
|
+
// return string 'unknown' if algorithm cannot detect or returns a type that is not one of our 5 supported types
|
|
2777
|
+
const firstInt = parseInt(value.charAt(0));
|
|
2778
|
+
const secondInt = parseInt(value.charAt(1));
|
|
2779
|
+
switch (firstInt) {
|
|
2780
|
+
case 2:
|
|
2781
|
+
if (secondInt > 1 && secondInt < 8) {
|
|
2782
|
+
if (value.length >= 4) {
|
|
2783
|
+
const firstfour = parseInt(value.substr(0, 4));
|
|
2784
|
+
if (firstfour >= 2221 && firstfour < 2721) {
|
|
2785
|
+
return 'masterCard';
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
else {
|
|
2789
|
+
return 'masterCard';
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
break;
|
|
2793
|
+
case 3:
|
|
2794
|
+
if (secondInt === 4 || secondInt === 7) {
|
|
2795
|
+
return 'amex';
|
|
2796
|
+
}
|
|
2797
|
+
if (secondInt === 0) {
|
|
2798
|
+
if (value.length > 2) {
|
|
2799
|
+
const thirdInt = parseInt(value.charAt(2));
|
|
2800
|
+
if (thirdInt < 6 || thirdInt === 9) {
|
|
2801
|
+
return 'dinersClub';
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
else {
|
|
2805
|
+
return 'dinersClub';
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
if (secondInt === 6 || secondInt === 8 || secondInt === 9) {
|
|
2809
|
+
return 'dinersClub';
|
|
2810
|
+
}
|
|
2811
|
+
break;
|
|
2812
|
+
case 4:
|
|
2813
|
+
return 'visa';
|
|
2814
|
+
case 5:
|
|
2815
|
+
if (secondInt > 0 && secondInt < 6) {
|
|
2816
|
+
return 'masterCard';
|
|
2817
|
+
}
|
|
2818
|
+
break;
|
|
2819
|
+
case 6:
|
|
2820
|
+
if (secondInt === 0) {
|
|
2821
|
+
if (value.length > 3) {
|
|
2822
|
+
const firstfour = value.substr(0, 4);
|
|
2823
|
+
if (firstfour === '6011') {
|
|
2824
|
+
return 'discover';
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
else {
|
|
2828
|
+
return 'discover';
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
if (secondInt === 4) {
|
|
2832
|
+
if (value.length > 2) {
|
|
2833
|
+
const firstthree = parseInt(value.substr(0, 3));
|
|
2834
|
+
if (firstthree > 643) {
|
|
2835
|
+
return 'discover';
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
else {
|
|
2839
|
+
return 'discover';
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
if (secondInt === 5) {
|
|
2843
|
+
return 'discover';
|
|
2844
|
+
}
|
|
2845
|
+
if (secondInt === 2) {
|
|
2846
|
+
if (value.length > 5) {
|
|
2847
|
+
const firstsix = parseInt(value.substr(0, 6));
|
|
2848
|
+
if (firstsix >= 622126 && firstsix <= 622925) {
|
|
2849
|
+
return 'discover';
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
else {
|
|
2853
|
+
return 'discover';
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
break;
|
|
2857
|
+
default:
|
|
2858
|
+
return 'unknown';
|
|
2859
|
+
}
|
|
2860
|
+
return 'unknown';
|
|
2861
|
+
}
|
|
2862
|
+
/* tslint:enable:cyclomatic-complexity */
|
|
2863
|
+
const formatCreditCard = {
|
|
2864
|
+
detectCreditCardTypeFromValue,
|
|
2865
|
+
format,
|
|
2866
|
+
amexFormatter,
|
|
2867
|
+
dinersClubInternationalFormatter,
|
|
2868
|
+
discoverFormatter,
|
|
2869
|
+
masterCardFormatter,
|
|
2870
|
+
visaFormatter,
|
|
2871
|
+
unknownFormatter,
|
|
2872
|
+
};
|
|
2873
|
+
|
|
2874
|
+
const q2InputCss = "*{box-sizing:border-box}*:active{outline:none}*:focus-visible{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{--comp-default-input-margin:var(--tct-input-margin-top, var(--t-input-margin-top, var(--app-scale-5x, 25px))) 0 var(--tct-input-margin-bottom, var(--t-input-margin-bottom, var(--app-scale-5x, 25px)));display:block;margin:var(--tct-input-margin, var(--comp-default-input-margin));font-size:var(--tct-input-font-size, var(--t-input-font-size, var(--app-font-size, inherit)))}:host([hidden]){display:none}.field-container,.input-container{position:relative}.field-container{--comp-input-tween:var(--tct-input-tween, var(--t-input-tween, var(--tct-tween-2, var(--app-tween-2, 0.4s ease))))}.field-container.is-small .btn-clear{--tct-btn-icon-width:20px;--tct-icon-size:17px}.input-label{--comp-label-padding:var(--tct-input-label-padding, 0 var(--tct-input-label-padding-right, var(--t-input-label-padding-right, 0)) 0 var(--tct-input-label-padding-left, var(--t-input-label-padding-left, 0)));display:block;padding:var(--comp-label-padding);color:var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit));font-size:var(--tct-input-label-font-size, var(--t-input-label-font-size, inherit));font-weight:var(--tct-input-label-font-weight, var(--t-input-label-font-weight, 600));text-transform:var(--tct-input-label-text-transform, var(--t-input-label-text-transform, none));letter-spacing:var(--tct-input-label-letter-spacing, var(--t-input-label-letter-spacing, inherit));transition:color var(--comp-input-tween)}.optional-tag{--comp-label-optional-margin:var(--tct-input-label-optional-margin, 0 0 0 var(--tct-input-label-optional-margin-left, var(--t-input-label-optional-margin-left, var(--tct-scale-1, var(--app-scale-1x, 5px)))));margin:var(--comp-label-optional-margin);color:var(--tct-input-label-optional-font-color, var(--t-input-label-optional-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77)))));font-size:var(--tct-input-label-optional-font-size, var(--t-input-label-optional-font-size, var(--app-font-size-small, 12px)));font-weight:var(--tct-input-label-optional-font-weight, var(--t-input-label-optional-font-weight, 400));line-height:1em}.count-tag{color:var(--tct-input-count-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77))));font-size:var(--tct-input-count-font-size, var(--app-font-size-small, 12px));font-weight:var(--tct-input-count-font-weight, 400);text-align:right;width:var(--tct-input-count-width, auto)}.label-wrapper{--comp-label-margin:var(--tct-input-label-margin, var(--tct-input-label-margin-top, var(--t-input-label-margin-top, 0)) 0 var(--tct-input-label-margin-bottom, var(--t-input-label-margin-bottom, var(--tct-scale-1, var(--app-scale-1x, 5px)))));display:flex;gap:var(--tct-input-label-gap, var(--app-scale-2x, 10px));justify-content:space-between;align-items:end;margin:var(--comp-label-margin);line-height:var(--tct-input-label-line-height, var(--t-input-label-line-height, inherit))}.label-wrapper:has(label.sr){margin:0}.input-container{--comp-input-background:var(--tct-input-background, var(--tct-input-bg, var(--t-input-bg, var(--t-gray-14, #fcfcfd))));--comp-input-backdrop-filter:var(--tct-input-backdrop-filter, none);--comp-input-horizontal-gap:var(--tct-input-horizontal-gap, var(--t-input-horizontal-gap, 0));--comp-input-border-top-left-radius:var(--tct-input-border-top-left-radius, var(--t-input-border-top-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 4px))));--comp-input-border-top-right-radius:var(--tct-input-border-top-right-radius, var(--t-input-border-top-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 4px))));--comp-input-border-bottom-right-radius:var(--tct-input-border-bottom-right-radius, var(--t-input-border-bottom-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 4px))));--comp-input-border-bottom-left-radius:var(--tct-input-border-bottom-left-radius, var(--t-input-border-bottom-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 4px))));--comp-input-border-radius:var(--comp-input-border-top-left-radius) var(--comp-input-border-top-right-radius)\n var(--comp-input-border-bottom-right-radius) var(--comp-input-border-bottom-left-radius);--comp-input-border-width:var(--tct-input-border-top-width, 1px) var(--tct-input-border-right-width, 1px)\n var(--tct-input-border-bottom-width, 1px) var(--tct-input-border-left-width, 1px);--comp-input-border-color:var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #404040)));--comp-input-prefix-clearance:calc(3 * var(--tct-input-prefix-font-size, 14px) + var(--tct-scale-1, 5px));--comp-input-icon-clearance:34px;--comp-input-min-height:var(--tct-input-min-height, var(--t-input-min-height, 44px));--comp-input-max-height:var(--tct-input-max-height, var(--t-input-max-height));--comp-input-hover-ring-color:var(--tct-input-hover-ring-color, var(--t-input-hover-ring-color));--comp-input-hover-ring:0 0 0 2px var(--t-base), 0 0 0 4px var(--comp-input-hover-ring-color), var(--tct-input-hover-box-shadow, var(--t-input-hover-box-shadow, 0 0 transparent));background:var(--comp-input-background);backdrop-filter:var(--comp-input-backdrop-filter);display:flex;align-items:center;gap:var(--tct-input-container-gap, var(--app-scale-2x, 10px));padding-inline:var(--tct-input-container-padding-inline);border-width:var(--comp-input-border-width);border-style:solid;border-color:var(--comp-input-border-color);border-radius:var(--comp-input-border-radius);box-shadow:var(--tct-input-box-shadow, var(--t-input-box-shadow, none));transition:background var(--comp-input-tween), backdrop-filter var(--comp-input-tween), border-width var(--comp-input-tween), border-color var(--comp-input-tween), box-shadow var(--comp-input-tween)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed;opacity:var(--tct-input-disabled-opacity, var(--t-input-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))));backdrop-filter:var(--tct-input-disabled-backdrop-filter, var(--comp-input-backdrop-filter))}.has-error .input-container{border-color:var(--tct-input-error-border-color, var(--const-stoplight-alert, #d20a0a));backdrop-filter:var(--tct-input-error-backdrop-filter, var(--comp-input-backdrop-filter));background:var(--tct-input-error-background, var(--comp-input-background));box-shadow:var(--tct-input-error-box-shadow, var(--comp-input-hover-ring))}.input-container:hover{border-color:var(--tct-input-hover-border-color, var(--comp-input-border-color));background:var(--tct-input-hover-background, var(--comp-input-background));backdrop-filter:var(--tct-input-hover-backdrop-filter, var(--comp-input-backdrop-filter));box-shadow:var(--tct-input-hover-box-shadow, var(--comp-input-hover-ring))}.has-error .input-container:hover{border-color:var(--tct-input-error-hover-border-color, var(--tct-input-error-border-color, var(--const-stoplight-alert, #d20a0a)));backdrop-filter:var(--tct-input-error-hover-backdrop-filter, var(--tct-input-error-backdrop-filter, var(--tct-input-hover-backdrop-filter, var(--comp-input-backdrop-filter))));background:var(--tct-input-error-hover-background, var(--tct-input-error-background, var(--comp-input-background)));box-shadow:var(--tct-input-error-hover-box-shadow, var(--tct-input-error-box-shadow, var(--comp-input-hover-ring)))}.has-focus .input-container{border-color:var(--tct-input-focus-border-color, var(--t-input-focus-border-color, var(--comp-input-border-color)));background:var(--tct-input-focus-background, var(--comp-input-background));backdrop-filter:var(--tct-input-focus-backdrop-filter, var(--comp-input-backdrop-filter));box-shadow:var(--tct-input-focus-box-shadow, var(--const-double-focus-ring))}.has-focus.has-error .input-container,.has-focus.has-error .input-container:hover{border-color:var(--tct-input-error-focus-border-color, var(--tct-input-error-border-color, var(--const-stoplight-alert, #d20a0a)));backdrop-filter:var(--tct-input-error-focus-backdrop-filter, var(--tct-input-error-backdrop-filter, var(--tct-input-focus-backdrop-filter, var(--comp-input-backdrop-filter))));background:var(--tct-input-error-focus-background, var(--tct-input-error-background, var(--comp-input-background)));box-shadow:var(--tct-input-error-focus-box-shadow, var(--tct-input-error-box-shadow, var(--const-double-focus-ring)))}.input-container:has(.input-field:is(:-webkit-autofill,:autofill)){background:var(--tct-input-autofill-background, #faffbc);color:var(--tct-input-autofill-font-color, var(--t-text, inherit))}.input-container:has(.input-field:is(:-webkit-autofill,:autofill)) .input-field{box-shadow:0 0 0 1000px var(--tct-input-autofill-background, #faffbc) inset;color:var(--tct-input-autofill-font-color, var(--t-text, inherit));-webkit-text-fill-color:var(--tct-input-autofill-font-color, var(--t-text, inherit))}.input-field{flex:1;border:0;-webkit-appearance:none;appearance:none;box-sizing:border-box;min-height:var(--comp-input-min-height);max-height:var(--comp-input-max-height);overflow-y:hidden;height:var(--tct-input-height, var(--t-input-height, 44px));width:100%;padding:var(--tct-input-padding, 0);background:transparent;color:var(--tct-input-font-color, var(--t-input-font-color, var(--t-text, inherit)));display:inline-block;text-align:var(--tct-input-align, \"start\");font-weight:var(--tct-input-font-weight, var(--t-input-font-weight, 400));letter-spacing:var(--tct-input-letter-spacing, var(--t-input-letter-spacing, inherit));}.input-field:focus{outline:none;box-shadow:none}.input-field::-webkit-outer-spin-button,.input-field::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.input-field[type=number]{-moz-appearance:textfield}.input-field::-ms-reveal,.input-field::-ms-clear{display:none}.input-field[type=search]::-webkit-search-decoration,.input-field[type=search]::-webkit-search-cancel-button,.input-field[type=search]::-webkit-search-results-button,.input-field[type=search]::-webkit-search-results-decoration{display:none}.input-field[disabled]:not([disabled=false]){cursor:not-allowed}.right-aligned .input-field{text-align:right}.input-field:is(input){flex:1}.input-field:is(button){display:inline-flex;align-items:center}.has-custom-display .input-field:is(button){height:auto;padding:0}.input-field:is(button) span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.custom-display-container{max-width:100%}.has-custom-display .custom-display-container{--comp-default-padding:var(--app-scale-2x, 10px) var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);padding:var(--tct-input-padding, var(--t-input-padding, var(--comp-default-padding)));width:100%}.input-field::placeholder,.placeholder-text{color:var(--tct-input-placeholder-font-color, var(--t-input-placeholder-font-color, var(--t-textA, var(--app-gray-d1, rgba(77, 77, 77, 0.77)))))}.pseudo-input-container{min-width:0;flex:1}.input-icons-container-left,.input-icons-container-right{--tct-btn-icon-hover-background:var(--tct-input-btn-hover-background);--tct-btn-hover-background:var(--tct-input-btn-hover-background);display:flex;flex-direction:row;align-items:center;gap:var(--comp-input-horizontal-gap)}.input-icons-container-left>div:not(.vertical-separator),.input-icons-container-right>div:not(.vertical-separator){min-width:var(--tct-input-icon-container-icon-min-width, 44px);display:flex;justify-content:center;align-items:center;font-size:var(--tct-input-icon-container-font-size, inherit)}.input-icons-container-left:empty,.input-icons-container-right:empty{display:var(--tct-input-icon-container-empty-display, block)}.input-icons-container-left{padding-left:var(--comp-input-horizontal-gap)}.input-icons-container-right{padding-right:var(--comp-input-horizontal-gap);--comp-visibility-toggle-padding:0px var(--app-scale-2x, 10px)}.input-icons-container-right .btn-visibility-toggle{--tct-btn-height:var(--comp-input-min-height);--tct-btn-padding-inline:var(--tct-input-visibility-toggle-padding, var(--app-scale-2x, 10px));--tct-btn-font-weight:var(--tct-input-visibility-toggle-font-weight, 400);color:var(--tct-input-visibility-toggle-font-color, var(--t-primary, #0079c1));font-size:var(--tct-input-visibility-toggle-font-size, var(--app-font-size-small, 12px))}q2-icon{margin-top:calc(var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) / 2);pointer-events:none;color:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-a11y-gray-color, var(--t-textA, var(--app-gray, #747474)))));--tct-icon-stroke-primary:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-a11y-gray-color, var(--t-textA, var(--app-gray, #747474)))))}.icon-left-muted{opacity:0.5}.input-prefix,.input-suffix{min-height:var(--comp-input-min-height);max-height:var(--comp-input-max-height);height:var(--tct-input-height, var(--t-input-height, 44px));font-size:var(--tct-input-prefix-font-size, var(--t-input-prefix-font-size, inherit));font-weight:var(--tct-input-prefix-font-weight, 400);color:var(--tct-input-prefix-font-color, var(--t-input-prefix-font-color, inherit));background:var(--tct-input-prefix-background, var(--tct-input-prefix-bg, var(--t-input-prefix-bg, var(--tct-input-background, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, #f2f2f2))))))));transition:color var(--comp-input-tween), background var(--comp-input-tween)}.input-prefix{border-top-left-radius:calc(\n var(--comp-input-border-top-left-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );border-bottom-left-radius:calc(\n var(--comp-input-border-bottom-left-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );pointer-events:none;}.input-suffix{border-top-right-radius:calc(\n var(--comp-input-border-top-right-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n );border-bottom-right-radius:calc(\n var(--comp-input-border-bottom-right-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n )}.icon-error{color:var(--tct-stoplight-error, var(--const-stoplight-alert, #d20a0a));--tct-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #d20a0a))}.messages-container{height:0px;overflow:hidden;background:var(--tct-message-background, var(--tct-message-bg, var(--t-message-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2)))))));box-shadow:var(--tct-input-message-box-shadow, var(--t-input-message-box-shadow, var(--tct-box-shadow-1, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14)))));transition:height var(--tct-input-messages-tween, var(--t-input-messages-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));margin-top:var(--tct-input-messages-margin-top, 2px);z-index:var(--tct-input-messages-z-index, 5);position:absolute;width:100%;color:var(--tct-input-messages-font-color, var(--t-input-messages-font-color, inherit));border-radius:var(--tct-message-border-radius, --app-border-radius-1, inherit)}.has-error label{color:var(--tct-input-error-label-font-color, var(--t-input-error-label-font-color, var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit))))}.has-error:not(.has-focus) .input-prefix,.has-error:not(.has-focus) .input-suffix{color:var(--tct-input-error-prefix-font-color, var(--t-input-error-prefix-font-color, inherit));background:var(--tct-input-error-prefix-background, var(--tct-input-error-prefix-bg, var(--t-input-error-prefix-bg, var(--tct-input-background, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))))))))}.icon-left{width:26px;height:26px}.vertical-separator{height:calc(var(--comp-input-min-height) - 2px);border-right-width:var(--tct-input-prefix-border-width, 1px);border-right-style:solid;border-right-color:var(--tct-input-prefix-border-color, var(--t-input-prefix-border-color, var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #404040)))))}";
|
|
2875
|
+
|
|
2876
|
+
const inputTypeMap = {
|
|
2877
|
+
text: 'text',
|
|
2878
|
+
tel: 'tel',
|
|
2879
|
+
number: 'number',
|
|
2880
|
+
password: 'text',
|
|
2881
|
+
search: 'search',
|
|
2882
|
+
url: 'url',
|
|
2883
|
+
email: 'email',
|
|
2884
|
+
currency: 'text',
|
|
2885
|
+
phone: 'tel',
|
|
2886
|
+
ssn: 'text',
|
|
2887
|
+
alphanumeric: 'text',
|
|
2888
|
+
alpha: 'text',
|
|
2889
|
+
numeric: 'text',
|
|
2890
|
+
percentage: 'text',
|
|
2891
|
+
postal: 'text',
|
|
2892
|
+
date: 'text',
|
|
2893
|
+
'credit-card': 'text',
|
|
2894
|
+
};
|
|
2895
|
+
const Q2Input = class {
|
|
2896
|
+
constructor(hostRef) {
|
|
2897
|
+
index.registerInstance(this, hostRef);
|
|
2898
|
+
this.change = index.createEvent(this, "change", 7);
|
|
2899
|
+
this.clear = index.createEvent(this, "clear", 7);
|
|
2900
|
+
this.formatted = index.createEvent(this, "formatted", 7);
|
|
2901
|
+
this.input = index.createEvent(this, "input", 7);
|
|
2902
|
+
this.invalid = index.createEvent(this, "invalid", 7);
|
|
2903
|
+
// #region Own Properties
|
|
2904
|
+
this.guid = index$1.createGuid();
|
|
2905
|
+
this.isClickEvent = false;
|
|
2906
|
+
this.isMobile = index$1.isMobile();
|
|
2907
|
+
this.scheduledAfterRender = [];
|
|
2908
|
+
// #endregion
|
|
2909
|
+
// #region State Properties
|
|
2910
|
+
this.checkSlotCount = 0;
|
|
2911
|
+
this.isSmall = false;
|
|
2912
|
+
// #endregion
|
|
2913
|
+
// #region Public Property API
|
|
2914
|
+
/**
|
|
2915
|
+
* Sets readonly to true on the input without adding the "read only" label.
|
|
2916
|
+
*
|
|
2917
|
+
* Can be used to prevent user input while still presenting the necessary information for assistive technology.
|
|
2918
|
+
* @private
|
|
2919
|
+
*/
|
|
2920
|
+
this._preventEntry = undefined;
|
|
2921
|
+
/**
|
|
2922
|
+
* Allows for correct semantics of q2-input element when aria-expanded.
|
|
2923
|
+
* @private
|
|
2924
|
+
* Defaults to undefined
|
|
2925
|
+
* Will assign role to combobox when used inside q2-select and q2-calendar.
|
|
2926
|
+
*/
|
|
2927
|
+
this._role = undefined;
|
|
2928
|
+
/** Indicates the field cannot be focused or interacted with. */
|
|
2929
|
+
this.disabled = false;
|
|
2930
|
+
/**
|
|
2931
|
+
* Displays a toggle button at the end of the input field which shows or hides the actual value.
|
|
2932
|
+
* @info
|
|
2933
|
+
* Only applicable when `type` is `text`, `password`, or `ssn`.
|
|
2934
|
+
*/
|
|
2935
|
+
this.showVisibilityToggle = false;
|
|
2936
|
+
/** Specifies the field's expected [input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types), and provides the optimal keyboard on mobile devices. */
|
|
2937
|
+
this.type = 'text';
|
|
2938
|
+
/**
|
|
2939
|
+
* Sets textSelectedForDeletion to true if the user has selected text for deletion
|
|
2940
|
+
* This is used to prevent other logic from running when text is deleted
|
|
2941
|
+
*/
|
|
2942
|
+
this.handleCurrencyKeydown = (event) => {
|
|
2943
|
+
if (!['Backspace', 'Delete'].includes(event.key))
|
|
2944
|
+
return;
|
|
2945
|
+
const inputElement = this.inputField;
|
|
2946
|
+
this.textSelectedForDeletion = inputElement.selectionStart !== inputElement.selectionEnd;
|
|
2947
|
+
};
|
|
2948
|
+
this.handleValueAndCursor = () => {
|
|
2949
|
+
// ORDER IMPORTANT: calculate cursor position -> set value -> set cursor position
|
|
2950
|
+
const cursorPosition = this.calculateCursorPositionOnInput();
|
|
2951
|
+
// when type=number: returns only valid decimal on input event, should not update itself (e.g. typing "1." )
|
|
2952
|
+
if (this.type !== 'number')
|
|
2953
|
+
this.inputField.value = this.formattedValueObject.formattedValue;
|
|
2954
|
+
this.input.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
|
|
2955
|
+
if (!this.formattedValueObject.value) {
|
|
2956
|
+
this.clear.emit();
|
|
2957
|
+
}
|
|
2958
|
+
this.setCursorPosition(cursorPosition);
|
|
2959
|
+
};
|
|
2960
|
+
this.initMutationObserver = () => {
|
|
2961
|
+
if (!('MutationObserver' in window))
|
|
2962
|
+
return;
|
|
2963
|
+
const observer = new MutationObserver(this.onMutationObserved);
|
|
2964
|
+
observer.observe(this.hostElement, { childList: true });
|
|
2965
|
+
this.mutationObserver = observer;
|
|
2966
|
+
};
|
|
2967
|
+
this.onClearInput = () => {
|
|
2968
|
+
const eventDetail = {
|
|
2969
|
+
value: '',
|
|
2970
|
+
formattedValue: '',
|
|
2971
|
+
minFormattedLength: this.formattedValueObject.minFormattedLength,
|
|
2972
|
+
};
|
|
2973
|
+
this.input.emit(eventDetail);
|
|
2974
|
+
this.change.emit(eventDetail);
|
|
2975
|
+
this.clear.emit();
|
|
2976
|
+
this.inputField.focus();
|
|
2977
|
+
};
|
|
2978
|
+
this.onInputBlur = () => {
|
|
2979
|
+
this.hasFocus = false;
|
|
2980
|
+
index$1.setMessageHeight(this);
|
|
2981
|
+
if (this.valueOnFocus !== this.formattedValueObject.value) {
|
|
2982
|
+
this.valueOnFocus = this.formattedValueObject.value;
|
|
2983
|
+
this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
this.onInputClick = () => {
|
|
2987
|
+
if (this.shouldCursorStayAtEnd)
|
|
2988
|
+
this.placeCursorAtEnd();
|
|
2989
|
+
};
|
|
2990
|
+
this.onInputFocus = () => {
|
|
2991
|
+
if (this.inputField.tagName === 'INPUT') {
|
|
2992
|
+
this.scheduledAfterRender.push(() => {
|
|
2993
|
+
if (this.isClickEvent && this.shouldCursorStartAtEnd) {
|
|
2994
|
+
this.placeCursorAtEnd();
|
|
2995
|
+
}
|
|
2996
|
+
else {
|
|
2997
|
+
this.setCursorPosition(this.calculateCursorPositionOnFocus());
|
|
2998
|
+
}
|
|
2999
|
+
this.isClickEvent = false;
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
3002
|
+
this.hasFocus = true;
|
|
3003
|
+
index$1.setMessageHeight(this);
|
|
3004
|
+
this.valueOnFocus = this.value;
|
|
3005
|
+
};
|
|
3006
|
+
this.onInputInput = (event) => {
|
|
3007
|
+
event.stopPropagation();
|
|
3008
|
+
if (this.type === 'currency')
|
|
3009
|
+
this.handleCurrencyDeletion(event);
|
|
3010
|
+
const newFormattedValue = this.getFormattedValue(event.target.value, false);
|
|
3011
|
+
this.handleDataInput(newFormattedValue);
|
|
3012
|
+
this.validateInput();
|
|
3013
|
+
};
|
|
3014
|
+
this.onInputKeydown = (event) => {
|
|
3015
|
+
const keysThatMoveCursor = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'];
|
|
3016
|
+
const { key } = event;
|
|
3017
|
+
if (this.type === 'currency')
|
|
3018
|
+
this.handleCurrencyKeydown(event);
|
|
3019
|
+
if (this.shouldCursorStayAtEnd && keysThatMoveCursor.includes(key))
|
|
3020
|
+
event.preventDefault();
|
|
3021
|
+
if (key === 'Enter' && this.valueOnFocus !== this.formattedValueObject.value) {
|
|
3022
|
+
this.valueOnFocus = this.formattedValueObject.value;
|
|
3023
|
+
this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
|
|
3024
|
+
}
|
|
3025
|
+
};
|
|
3026
|
+
this.onInputMousedown = () => {
|
|
3027
|
+
this.isClickEvent = true;
|
|
3028
|
+
};
|
|
3029
|
+
this.onInputPaste = (event) => {
|
|
3030
|
+
if (this.type === 'currency') {
|
|
3031
|
+
const clipboardData = event.clipboardData.getData('text');
|
|
3032
|
+
const newFormattedValue = this.getFormattedValue(clipboardData, true);
|
|
3033
|
+
event.preventDefault();
|
|
3034
|
+
this.handleDataInput(newFormattedValue);
|
|
3035
|
+
}
|
|
3036
|
+
};
|
|
3037
|
+
this.onMutationObserved = () => {
|
|
3038
|
+
// Updating checkSlotCount to force re-render when slot content changes
|
|
3039
|
+
this.checkSlotCount = this.checkSlotCount + 1;
|
|
3040
|
+
};
|
|
3041
|
+
this.onRefocusInput = () => {
|
|
3042
|
+
if (this.showMessages) {
|
|
3043
|
+
this.inputField.focus();
|
|
3044
|
+
index$1.setMessageHeight(this);
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
this.onToggleVisibility = () => {
|
|
3048
|
+
this.hostElement.dispatchEvent(new FocusEvent('focus'));
|
|
3049
|
+
this.textHidden = !this.textHidden;
|
|
3050
|
+
};
|
|
3051
|
+
this.validateInput = () => {
|
|
3052
|
+
var _a, _b, _c;
|
|
3053
|
+
this.validity = (_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.validity;
|
|
3054
|
+
if (((_b = this.validity) === null || _b === void 0 ? void 0 : _b.valid) === false) {
|
|
3055
|
+
this.invalid.emit();
|
|
3056
|
+
}
|
|
3057
|
+
return !!((_c = this.validity) === null || _c === void 0 ? void 0 : _c.valid);
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
// #endregion
|
|
3061
|
+
// #region Component Lifecycle Events
|
|
3062
|
+
disconnectedCallback() {
|
|
3063
|
+
var _a;
|
|
3064
|
+
this.manageClearableResizeObserver();
|
|
3065
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
3066
|
+
this.mutationObserver = null;
|
|
3067
|
+
}
|
|
3068
|
+
componentWillLoad() {
|
|
3069
|
+
if (isNaN(this.maxlength)) {
|
|
3070
|
+
this.maxlength = undefined;
|
|
3071
|
+
}
|
|
3072
|
+
this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
|
|
3073
|
+
Object.defineProperty(this.hostElement, 'formattedValue', {
|
|
3074
|
+
get: () => { var _a, _b; return (_b = (_a = this.formattedValueObject) === null || _a === void 0 ? void 0 : _a.formattedValue) !== null && _b !== void 0 ? _b : ''; },
|
|
3075
|
+
});
|
|
3076
|
+
index$1.handleAriaLabel(this);
|
|
3077
|
+
if (this.textHidden === undefined) {
|
|
3078
|
+
this.textHidden = this.type === 'password';
|
|
3079
|
+
}
|
|
3080
|
+
this.manageClearableResizeObserver(this.clearable);
|
|
3081
|
+
}
|
|
3082
|
+
componentDidLoad() {
|
|
3083
|
+
index$1.overrideFocus(this.hostElement);
|
|
3084
|
+
if (!this.pseudo)
|
|
3085
|
+
this.inputField.value = this.formattedValueObject.formattedValue;
|
|
3086
|
+
if (!!this.autofocus)
|
|
3087
|
+
this.inputField.focus();
|
|
3088
|
+
this.initMutationObserver();
|
|
3089
|
+
}
|
|
3090
|
+
componentDidRender() {
|
|
3091
|
+
this.scheduledAfterRender.forEach(fn => fn());
|
|
3092
|
+
this.scheduledAfterRender = [];
|
|
3093
|
+
}
|
|
3094
|
+
// #endregion
|
|
3095
|
+
// #region Listeners
|
|
3096
|
+
onHostElementChange(event) {
|
|
3097
|
+
if (!(event instanceof CustomEvent)) {
|
|
3098
|
+
event.stopPropagation();
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
if (event.target === this.hostElement && !this.hostElement.onchange) {
|
|
3102
|
+
this.value = event.detail.value;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
onHostElementFocus(event) {
|
|
3106
|
+
if (!index$1.isEventFromElement(event, this.hostElement))
|
|
3107
|
+
return;
|
|
3108
|
+
this.inputField.focus();
|
|
3109
|
+
}
|
|
3110
|
+
// #endregion
|
|
3111
|
+
// #region Public Methods API
|
|
3112
|
+
/**
|
|
3113
|
+
* Emulates firing checkValidity on `<input>`, emits `invalid` event if validation failed.
|
|
3114
|
+
*/
|
|
3115
|
+
async checkValidity() {
|
|
3116
|
+
this.inputRef.checkValidity();
|
|
3117
|
+
return this.validateInput();
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* Emulates clicking the clear button when the input is clearable.
|
|
3121
|
+
*
|
|
3122
|
+
* @warning
|
|
3123
|
+
* Only applicable when the input is clearable.
|
|
3124
|
+
*
|
|
3125
|
+
* @testOnly
|
|
3126
|
+
*/
|
|
3127
|
+
async clearValue() {
|
|
3128
|
+
if (!this.clearable)
|
|
3129
|
+
return;
|
|
3130
|
+
this.onClearInput();
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* Emulates focusing the `<input>`, entering the provided value, and emitting an `input` event.
|
|
3134
|
+
*
|
|
3135
|
+
* This method leaves the focus on the `<input>` and as a result does not trigger the `change` event. If you want
|
|
3136
|
+
* to trigger the` change` event, move the focus to another element after calling this method.
|
|
3137
|
+
*
|
|
3138
|
+
* @testOnly
|
|
3139
|
+
*/
|
|
3140
|
+
setValue(value) {
|
|
3141
|
+
const { inputField } = this;
|
|
3142
|
+
inputField.focus();
|
|
3143
|
+
inputField.dispatchEvent(new FocusEvent('focus'));
|
|
3144
|
+
inputField.value = value;
|
|
3145
|
+
inputField.dispatchEvent(new InputEvent('input'));
|
|
3146
|
+
}
|
|
3147
|
+
// #endregion
|
|
3148
|
+
// #region Watchers
|
|
3149
|
+
ariaLabelObserver() {
|
|
3150
|
+
index$1.handleAriaLabel(this);
|
|
3151
|
+
}
|
|
3152
|
+
manageClearableResizeObserver(clearable) {
|
|
3153
|
+
var _a;
|
|
3154
|
+
if ('ResizeObserver' in window === false)
|
|
3155
|
+
return;
|
|
3156
|
+
const isSmallThreshold = 190;
|
|
3157
|
+
if (clearable) {
|
|
3158
|
+
if (this.resizeObserver)
|
|
3159
|
+
return;
|
|
3160
|
+
if (typeof ResizeObserver === 'undefined')
|
|
3161
|
+
return;
|
|
3162
|
+
this.resizeObserver = new ResizeObserver(([entry]) => {
|
|
3163
|
+
this.isSmall = isSmallThreshold > entry.contentRect.width;
|
|
3164
|
+
});
|
|
3165
|
+
this.resizeObserver.observe(this.hostElement);
|
|
3166
|
+
}
|
|
3167
|
+
else {
|
|
3168
|
+
this.isSmall = false;
|
|
3169
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.hostElement);
|
|
3170
|
+
this.resizeObserver = null;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
errorsObserver() {
|
|
3174
|
+
this.hasFocus && this.scheduledAfterRender.push(() => index$1.setMessageHeight(this));
|
|
3175
|
+
}
|
|
3176
|
+
formatModifierObserver() {
|
|
3177
|
+
this.formatAndUpdateValueFromProp();
|
|
3178
|
+
}
|
|
3179
|
+
formattedValueObjectObserver() {
|
|
3180
|
+
this.formatted.emit(this.formattedValueObject);
|
|
3181
|
+
}
|
|
3182
|
+
hintsObserver() {
|
|
3183
|
+
this.hasFocus && this.scheduledAfterRender.push(() => index$1.setMessageHeight(this));
|
|
3184
|
+
}
|
|
3185
|
+
typeObserver() {
|
|
3186
|
+
this.formatAndUpdateValueFromProp();
|
|
3187
|
+
}
|
|
3188
|
+
valueObserver() {
|
|
3189
|
+
this.formatAndUpdateValueFromProp();
|
|
3190
|
+
}
|
|
3191
|
+
// #endregion
|
|
3192
|
+
// #region Local Methods
|
|
3193
|
+
get ariaAttributes() {
|
|
3194
|
+
return {
|
|
3195
|
+
ariaActivedescendant: index$1.getAriaValueFromProp(this.ariaActivedescendant),
|
|
3196
|
+
ariaControls: index$1.getAriaValueFromProp(this.ariaControls),
|
|
3197
|
+
ariaExpanded: index$1.getAriaValueFromProp(this.ariaExpanded, ['true', 'false']),
|
|
3198
|
+
ariaHaspopup: index$1.getAriaValueFromProp(this.ariaHaspopup, [
|
|
3199
|
+
'true',
|
|
3200
|
+
'false',
|
|
3201
|
+
'menu',
|
|
3202
|
+
'listbox',
|
|
3203
|
+
'tree',
|
|
3204
|
+
'grid',
|
|
3205
|
+
'dialog',
|
|
3206
|
+
]),
|
|
3207
|
+
ariaOwns: index$1.getAriaValueFromProp(this.ariaOwns),
|
|
3208
|
+
};
|
|
3209
|
+
}
|
|
3210
|
+
get canSetSelection() {
|
|
3211
|
+
// email and number type don't support setSelectionRange
|
|
3212
|
+
return !['email', 'number'].includes(this.computedType);
|
|
3213
|
+
}
|
|
3214
|
+
get clearClasses() {
|
|
3215
|
+
var _a;
|
|
3216
|
+
const classes = ['btn-clear'];
|
|
3217
|
+
if (!this.clearable || !(((_a = this.inputField) === null || _a === void 0 ? void 0 : _a.value) || this.value)) {
|
|
3218
|
+
classes.push('hidden');
|
|
3219
|
+
}
|
|
3220
|
+
return classes;
|
|
3221
|
+
}
|
|
3222
|
+
get computedAutocomplete() {
|
|
3223
|
+
// force off for currency type
|
|
3224
|
+
if (this.type === 'currency')
|
|
3225
|
+
return 'transaction-amount';
|
|
3226
|
+
return this.autocomplete || 'off';
|
|
3227
|
+
}
|
|
3228
|
+
get computedClassForIconLeft() {
|
|
3229
|
+
let className = 'icon-left';
|
|
3230
|
+
if (this.formattedValueObject.leftIconMuted) {
|
|
3231
|
+
className += ' icon-left-muted';
|
|
3232
|
+
}
|
|
3233
|
+
return className;
|
|
3234
|
+
}
|
|
3235
|
+
get computedIconLeft() {
|
|
3236
|
+
if (this.formattedValueObject.prefix) {
|
|
3237
|
+
return;
|
|
3238
|
+
}
|
|
3239
|
+
if (this.type === 'search') {
|
|
3240
|
+
return 'search';
|
|
3241
|
+
}
|
|
3242
|
+
if (this.formattedValueObject.leftIcon) {
|
|
3243
|
+
return this.formattedValueObject.leftIcon;
|
|
3244
|
+
}
|
|
3245
|
+
return this.iconLeft;
|
|
3246
|
+
}
|
|
3247
|
+
get computedType() {
|
|
3248
|
+
if (['password', 'text', 'ssn'].includes(this.type) && this.textHidden) {
|
|
3249
|
+
return 'password';
|
|
3250
|
+
}
|
|
3251
|
+
else {
|
|
3252
|
+
return (this.type && inputTypeMap[this.type]) || 'text';
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
get hasCustomDisplaySlot() {
|
|
3256
|
+
return index$1.hasSlotContent(this.hostElement, 'custom-display');
|
|
3257
|
+
}
|
|
3258
|
+
get hasError() {
|
|
3259
|
+
return Array.isArray(this.errors) && this.errors.length > 0;
|
|
3260
|
+
}
|
|
3261
|
+
get hasInputLeftSlot() {
|
|
3262
|
+
return index$1.hasSlotContent(this.hostElement, 'input-left');
|
|
3263
|
+
}
|
|
3264
|
+
get hasInputRightSlot() {
|
|
3265
|
+
return index$1.hasSlotContent(this.hostElement, 'input-right');
|
|
3266
|
+
}
|
|
3267
|
+
get inputDescribedBy() {
|
|
3268
|
+
return this.showMessages ? `${this.inputId}-description` : undefined;
|
|
3269
|
+
}
|
|
3270
|
+
get inputField() {
|
|
3271
|
+
return this.hostElement.shadowRoot.querySelector('.input-field');
|
|
3272
|
+
}
|
|
3273
|
+
get inputId() {
|
|
3274
|
+
return `input-guid-${this.guid}`;
|
|
3275
|
+
}
|
|
3276
|
+
get inputMode() {
|
|
3277
|
+
const inputModeMap = {
|
|
3278
|
+
currency: 'numeric',
|
|
3279
|
+
ssn: 'numeric',
|
|
3280
|
+
tin: 'numeric',
|
|
3281
|
+
numeric: 'decimal',
|
|
3282
|
+
percentage: 'decimal',
|
|
3283
|
+
date: 'numeric',
|
|
3284
|
+
'credit-card': 'numeric',
|
|
3285
|
+
};
|
|
3286
|
+
return (this.type && inputModeMap[this.type]) || undefined;
|
|
3287
|
+
}
|
|
3288
|
+
get isMaskedType() {
|
|
3289
|
+
const maskedTypes = [
|
|
3290
|
+
'currency',
|
|
3291
|
+
'phone',
|
|
3292
|
+
'ssn',
|
|
3293
|
+
'tin',
|
|
3294
|
+
'alphanumeric',
|
|
3295
|
+
'alpha',
|
|
3296
|
+
'numeric',
|
|
3297
|
+
'percentage',
|
|
3298
|
+
'postal',
|
|
3299
|
+
'date',
|
|
3300
|
+
'credit-card',
|
|
3301
|
+
];
|
|
3302
|
+
return maskedTypes.includes(this.type);
|
|
3303
|
+
}
|
|
3304
|
+
get messages() {
|
|
3305
|
+
return ((this.errors && this.errors.length > 0 && this.errors) ||
|
|
3306
|
+
(this.hints && this.hints.length > 0 && this.hints) ||
|
|
3307
|
+
[]);
|
|
3308
|
+
}
|
|
3309
|
+
get shouldCursorStartAtEnd() {
|
|
3310
|
+
return this.type === 'currency';
|
|
3311
|
+
}
|
|
3312
|
+
get shouldCursorStayAtEnd() {
|
|
3313
|
+
return this.isMobile && this.type === 'currency';
|
|
3314
|
+
}
|
|
3315
|
+
get showIconSeparator() {
|
|
3316
|
+
return this.type === 'credit-card' || !!this.formattedValueObject.prefix;
|
|
3317
|
+
}
|
|
3318
|
+
get showMessages() {
|
|
3319
|
+
return this.messages.length > 0 && !this.hideMessages;
|
|
3320
|
+
}
|
|
3321
|
+
get stringValue() {
|
|
3322
|
+
const notCoercable = Object.prototype.toString.call(this.value) === '[object Object]';
|
|
3323
|
+
return notCoercable ? '' : (this.value && String(this.value)) || '';
|
|
3324
|
+
}
|
|
3325
|
+
get visibilityToggleAriaLabel() {
|
|
3326
|
+
return `tecton.element.input.toggleAriaLabel.${this.textHidden ? 'show' : 'hide'}`;
|
|
3327
|
+
}
|
|
3328
|
+
get visibilityToggleText() {
|
|
3329
|
+
return index$1.loc(`tecton.element.input.toggle.${this.textHidden ? 'show' : 'hide'}`);
|
|
3330
|
+
}
|
|
3331
|
+
get wrapperClasses() {
|
|
3332
|
+
const classNames = ['field-container'];
|
|
3333
|
+
if (this.hasError)
|
|
3334
|
+
classNames.push('has-error');
|
|
3335
|
+
if (!!this.value)
|
|
3336
|
+
classNames.push('has-value');
|
|
3337
|
+
if (this.clearable && !!this.value)
|
|
3338
|
+
classNames.push('has-clear');
|
|
3339
|
+
if (this.hasFocus)
|
|
3340
|
+
classNames.push('has-focus');
|
|
3341
|
+
if (this.isSmall)
|
|
3342
|
+
classNames.push('is-small');
|
|
3343
|
+
if (this.formattedValueObject.prefix)
|
|
3344
|
+
classNames.push('has-prefix');
|
|
3345
|
+
if (this.computedIconLeft)
|
|
3346
|
+
classNames.push('has-icon-left');
|
|
3347
|
+
if (this.showIconSeparator)
|
|
3348
|
+
classNames.push('has-icon-separator');
|
|
3349
|
+
if (this.formattedValueObject.suffix)
|
|
3350
|
+
classNames.push('has-suffix');
|
|
3351
|
+
if (!this.formattedValueObject.suffix && this.iconRight)
|
|
3352
|
+
classNames.push('has-icon-right');
|
|
3353
|
+
if (this.type === 'currency')
|
|
3354
|
+
classNames.push('right-aligned');
|
|
3355
|
+
else
|
|
3356
|
+
classNames.push('left-aligned');
|
|
3357
|
+
if (this.hasCustomDisplaySlot)
|
|
3358
|
+
classNames.push('has-custom-display');
|
|
3359
|
+
return classNames.join(' ');
|
|
3360
|
+
}
|
|
3361
|
+
calculateCursorPositionOnFocus() {
|
|
3362
|
+
var _a, _b, _c;
|
|
3363
|
+
const { inputField } = this;
|
|
3364
|
+
const valueLength = (_b = (_a = inputField === null || inputField === void 0 ? void 0 : inputField.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
3365
|
+
const startingPosition = (_c = inputField === null || inputField === void 0 ? void 0 : inputField.selectionStart) !== null && _c !== void 0 ? _c : valueLength;
|
|
3366
|
+
return {
|
|
3367
|
+
startingPosition,
|
|
3368
|
+
valueLength,
|
|
3369
|
+
previousValueLength: valueLength,
|
|
3370
|
+
hasSelection: window.getSelection().toString().length > 0,
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
calculateCursorPositionOnInput() {
|
|
3374
|
+
const input = this.inputField;
|
|
3375
|
+
const formattedLength = this.formattedValueObject.formattedValue.length;
|
|
3376
|
+
const currentValueLength = input.value.length;
|
|
3377
|
+
const defaultPosition = this.type === 'currency' ? formattedLength : 0;
|
|
3378
|
+
return {
|
|
3379
|
+
startingPosition: (input && input.selectionStart) || defaultPosition,
|
|
3380
|
+
valueLength: formattedLength,
|
|
3381
|
+
previousValueLength: input && currentValueLength,
|
|
3382
|
+
hasSelection: false,
|
|
3383
|
+
};
|
|
3384
|
+
}
|
|
3385
|
+
formatAndUpdateValueFromProp() {
|
|
3386
|
+
this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
|
|
3387
|
+
if (!this.pseudo) {
|
|
3388
|
+
const setValue = () => {
|
|
3389
|
+
this.inputField.value = this.formattedValueObject.formattedValue;
|
|
3390
|
+
};
|
|
3391
|
+
this.inputField ? setValue() : this.scheduledAfterRender.push(() => setValue());
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
getFormattedValue(value, valueChangedFromProperty) {
|
|
3395
|
+
const formattingFunctions = {
|
|
3396
|
+
currency: formatCurrency,
|
|
3397
|
+
phone: formatPhoneNumber,
|
|
3398
|
+
ssn: formatSSN,
|
|
3399
|
+
tin: formatTIN,
|
|
3400
|
+
alphanumeric: formatAlphanumeric,
|
|
3401
|
+
alpha: formatAlpha,
|
|
3402
|
+
numeric: formatNumeric,
|
|
3403
|
+
percentage: formatPercentage,
|
|
3404
|
+
postal: formatPostalCode,
|
|
3405
|
+
date: formatDate,
|
|
3406
|
+
'credit-card': formatCreditCard.format,
|
|
3407
|
+
};
|
|
3408
|
+
if (formattingFunctions[this.type]) {
|
|
3409
|
+
return formattingFunctions[this.type](value, this.formatModifier, valueChangedFromProperty);
|
|
3410
|
+
}
|
|
3411
|
+
return {
|
|
3412
|
+
value,
|
|
3413
|
+
formattedValue: value,
|
|
3414
|
+
fullyFormattedValue: value,
|
|
3415
|
+
formattingCharacterCount: 0,
|
|
3416
|
+
unformattedValue: value,
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
handleCurrencyDeletion(event) {
|
|
3420
|
+
// Don't do anything if text was selected for deletion
|
|
3421
|
+
if (this.textSelectedForDeletion) {
|
|
3422
|
+
this.textSelectedForDeletion = false;
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
// We only care about "Backspace" and "Delete" events
|
|
3426
|
+
if (!['deleteContentBackward', 'deleteContentForward'].includes(event.inputType))
|
|
3427
|
+
return;
|
|
3428
|
+
const input = event.target;
|
|
3429
|
+
const cursorPosition = input.selectionStart;
|
|
3430
|
+
const { formattedValue } = this.formattedValueObject;
|
|
3431
|
+
if (cursorPosition === null)
|
|
3432
|
+
return;
|
|
3433
|
+
let cursorMap;
|
|
3434
|
+
switch (event.inputType) {
|
|
3435
|
+
case 'deleteContentBackward':
|
|
3436
|
+
const valueBeforeCursor = formattedValue.substring(0, cursorPosition + 1);
|
|
3437
|
+
const isPrevCharAlphaNum = /[a-zA-Z0-9]$/.test(valueBeforeCursor);
|
|
3438
|
+
cursorMap = {
|
|
3439
|
+
leftIndex: isPrevCharAlphaNum ? cursorPosition : cursorPosition - 1,
|
|
3440
|
+
rightIndex: isPrevCharAlphaNum ? cursorPosition + 1 : cursorPosition,
|
|
3441
|
+
afterCursorOffset: 0,
|
|
3442
|
+
newCursorOffset: 1,
|
|
3443
|
+
};
|
|
3444
|
+
break;
|
|
3445
|
+
case 'deleteContentForward':
|
|
3446
|
+
const valueAfterCursor = formattedValue.substring(cursorPosition);
|
|
3447
|
+
const isNextCharAlphaNum = /^[a-zA-Z0-9]/.test(valueAfterCursor);
|
|
3448
|
+
cursorMap = {
|
|
3449
|
+
leftIndex: isNextCharAlphaNum ? cursorPosition : cursorPosition + 1,
|
|
3450
|
+
rightIndex: isNextCharAlphaNum ? cursorPosition + 1 : cursorPosition + 2,
|
|
3451
|
+
afterCursorOffset: 1,
|
|
3452
|
+
newCursorOffset: 0,
|
|
3453
|
+
};
|
|
3454
|
+
break;
|
|
3455
|
+
default:
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
// Ensure the cursor doesn't move with a newly formatted value
|
|
3459
|
+
const newValue = [
|
|
3460
|
+
formattedValue.substring(0, cursorMap.leftIndex),
|
|
3461
|
+
formattedValue.substring(cursorMap.rightIndex),
|
|
3462
|
+
].join('');
|
|
3463
|
+
const charactersAfterCursor = formattedValue.length - cursorPosition - cursorMap.afterCursorOffset;
|
|
3464
|
+
const newFormattedValue = this.getFormattedValue(newValue, false).formattedValue;
|
|
3465
|
+
const newCursorPosition = Math.max(newFormattedValue.length - charactersAfterCursor + cursorMap.newCursorOffset, 0);
|
|
3466
|
+
input.value = newFormattedValue;
|
|
3467
|
+
input.setSelectionRange(newCursorPosition, newCursorPosition);
|
|
3468
|
+
// This handles a runtime issue when a character is deleted from the beginning of the input
|
|
3469
|
+
if (newCursorPosition === 0) {
|
|
3470
|
+
index$1.nextPaint(() => input.setSelectionRange(newCursorPosition, newCursorPosition));
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
handleDataInput(newFormattedValue) {
|
|
3474
|
+
if (this.maxlength === undefined ||
|
|
3475
|
+
newFormattedValue.unformattedValue.length <= this.maxlength ||
|
|
3476
|
+
newFormattedValue.unformattedValue.length <= this.formattedValueObject.unformattedValue.length) {
|
|
3477
|
+
this.formattedValueObject = newFormattedValue;
|
|
3478
|
+
}
|
|
3479
|
+
else if (this.maxlength) {
|
|
3480
|
+
newFormattedValue = this.getFormattedValue(newFormattedValue.unformattedValue.substring(0, this.maxlength), false);
|
|
3481
|
+
this.formattedValueObject = newFormattedValue;
|
|
3482
|
+
}
|
|
3483
|
+
this.handleValueAndCursor();
|
|
3484
|
+
}
|
|
3485
|
+
placeCursorAtEnd() {
|
|
3486
|
+
const { inputField } = this;
|
|
3487
|
+
inputField.selectionStart = inputField.selectionEnd = inputField.value.length;
|
|
3488
|
+
}
|
|
3489
|
+
setCursorPosition(cursorData) {
|
|
3490
|
+
if (this.canSetSelection && !cursorData.hasSelection) {
|
|
3491
|
+
const input = this.inputField;
|
|
3492
|
+
const { valueLength, previousValueLength, startingPosition } = cursorData;
|
|
3493
|
+
if (this.type === 'currency') {
|
|
3494
|
+
if (previousValueLength - valueLength === 1) {
|
|
3495
|
+
input.setSelectionRange(startingPosition - 1, startingPosition - 1);
|
|
3496
|
+
}
|
|
3497
|
+
else {
|
|
3498
|
+
const difference = previousValueLength - valueLength;
|
|
3499
|
+
input.setSelectionRange(startingPosition - difference, startingPosition - difference);
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
if (this.type !== 'currency') {
|
|
3503
|
+
const difference = valueLength - previousValueLength;
|
|
3504
|
+
// Never allow the cursor to move in reverse
|
|
3505
|
+
const newPosition = startingPosition + (difference > 0 ? difference : 0);
|
|
3506
|
+
input.setSelectionRange(newPosition, newPosition);
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
// #endregion
|
|
3511
|
+
// #region Render Methods
|
|
3512
|
+
renderCountDOM() {
|
|
3513
|
+
if (!this.showCount)
|
|
3514
|
+
return;
|
|
3515
|
+
const { maxlength, formattedValueObject } = this;
|
|
3516
|
+
return (index.h("div", { class: "count-tag" }, formattedValueObject.unformattedValue.length, maxlength && `/${maxlength}`));
|
|
3517
|
+
}
|
|
3518
|
+
renderInputContainerDOM() {
|
|
3519
|
+
const { hasInputLeftSlot, hasInputRightSlot } = this;
|
|
3520
|
+
return (index.h("div", { class: "input-container", tabindex: -1, "test-id": "inputContainer" }, index.h("div", { class: "input-icons-container-left" }, this.formattedValueObject.prefix && (index.h("div", { class: "input-prefix" }, this.formattedValueObject.prefix)), this.computedIconLeft && (index.h("div", null, index.h("q2-icon", { type: this.computedIconLeft, class: this.computedClassForIconLeft }))), hasInputLeftSlot && index.h("slot", { name: "input-left" }), this.showIconSeparator && index.h("div", { class: "vertical-separator" }), this.hasError && this.type === 'currency' && (index.h("div", { "test-id": "divIconError", onClick: this.onRefocusInput }, index.h("q2-icon", { type: "error", class: "icon-error", "test-id": "iconError" })))), this.pseudo ? this.renderPseudoInputDOM() : this.renderStandardInputDOM(), index.h("div", { class: "input-icons-container-right" }, index.h("q2-btn", { class: this.clearClasses.join(' '), label: index$1.loc('tecton.element.input.clear', [this.label]), hideLabel: true, "test-id": "clearButton", onClick: this.onClearInput, onKeyDown: e => e.stopPropagation() }, index.h("q2-icon", { type: "close", class: "icon-clear" })), ['password', 'text', 'ssn', 'tin'].includes(this.type) && this.showVisibilityToggle && (index.h("q2-btn", { class: "btn-visibility-toggle", "test-id": "toggleVisibilityButton", onClick: this.onToggleVisibility, label: index$1.loc(this.visibilityToggleAriaLabel, { label: this.label }), "hide-label": true }, this.visibilityToggleText)), this.formattedValueObject.suffix && (index.h("span", { class: "input-suffix" }, this.formattedValueObject.suffix)), this.badgeValue && (index.h("q2-badge", { size: "large", theme: this.badgeTheme }, this.badgeValue)), this.hasError && this.type !== 'currency' && (index.h("div", { "test-id": "divIconError", onClick: this.onRefocusInput }, index.h("q2-icon", { type: "error", class: "icon-error", "test-id": "iconError" }))), this.iconRight && !this.formattedValueObject.suffix && (index.h("div", null, index.h("q2-icon", { type: this.iconRight, class: "icon-right" }))), hasInputRightSlot && index.h("slot", { name: "input-right" }))));
|
|
3521
|
+
}
|
|
3522
|
+
renderPseudoInputDOM() {
|
|
3523
|
+
const showPlaceholder = !this.value && !!this.placeholder;
|
|
3524
|
+
const { ariaOwns, ariaHaspopup, ariaExpanded, ariaActivedescendant } = this.ariaAttributes;
|
|
3525
|
+
return (index.h("div", { class: "pseudo-input-container" }, index.h("button", { class: "input-field", type: "button", id: this.inputId, "aria-describedby": this.inputDescribedBy, "aria-invalid": `${this.hasError}`, "aria-owns": ariaOwns, "aria-haspopup": ariaHaspopup, "aria-expanded": ariaExpanded, "aria-activedescendant": ariaActivedescendant, role: (this.role && `${this.role}`) || 'textbox', disabled: !!this.disabled, "test-id": "q2InputInnerClearButton", onFocus: this.onInputFocus, onBlur: this.onInputBlur }, index.h("div", { class: "custom-display-container" }, index.h("slot", { name: "custom-display" }, index.h("span", { class: showPlaceholder ? 'placeholder-text' : '' }, showPlaceholder ? index$1.loc(this.placeholder) : index$1.loc(this.value)))))));
|
|
3526
|
+
}
|
|
3527
|
+
renderStandardInputDOM() {
|
|
3528
|
+
const { hasCustomDisplaySlot } = this;
|
|
3529
|
+
const inputClasses = ['input-field'];
|
|
3530
|
+
const { ariaOwns, ariaHaspopup, ariaActivedescendant } = this.ariaAttributes;
|
|
3531
|
+
if (hasCustomDisplaySlot)
|
|
3532
|
+
inputClasses.push('sr');
|
|
3533
|
+
return (index.h(index.Fragment, null, hasCustomDisplaySlot && (index.h("div", { class: "custom-display-container" }, index.h("slot", { name: "custom-display" }))), index.h("input", { ref: el => (this.inputRef = el), class: inputClasses.join(' '), id: this.inputId, type: this.computedType, size: this.formattedValueObject.prefix ? 10 : undefined, maxlength: ['date', 'currency'].includes(this.type) ? undefined : this.maxlength || undefined, max: this.max, min: this.min, step: this.step, "aria-current": this.current || undefined, "aria-describedby": this.inputDescribedBy, "aria-required": `${!this.optional}`, "aria-invalid": `${this.hasError}`, "aria-owns": ariaOwns, "aria-haspopup": ariaHaspopup, "aria-activedescendant": ariaActivedescendant, autocomplete: this.computedAutocomplete, autocapitalize: this.autocapitalize, autocorrect: this.autocorrect === 'on' ? 'on' : 'off', autofocus: this.autofocus, placeholder: (this.placeholder && index$1.loc(this.placeholder)) || undefined, "test-id": "inputField", readonly: this.readonly || this._preventEntry, disabled: !!this.disabled, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onClick: this.onInputClick, onKeyDown: this.onInputKeydown, onMouseDown: this.onInputMousedown, onInput: this.onInputInput, onPaste: this.onInputPaste, inputmode: this.inputMode, pattern: this.pattern || undefined })));
|
|
3534
|
+
}
|
|
3535
|
+
render() {
|
|
3536
|
+
const { ariaControls, ariaExpanded } = this.ariaAttributes;
|
|
3537
|
+
return (index.h(index.Host, { key: 'ac1668b4b57fe26794243fdac33d3cb9ba74d7c7', role: this._role, "aria-controls": ariaControls, "aria-expanded": ariaExpanded }, index.h("div", { key: 'aaa97e165fdda3dfb95326bcdc635e8ad56a791a', class: this.wrapperClasses }, index.h("div", { key: '7c8fe4e94bc2e0b22465b794aaa773ebb53ec83f', class: "label-wrapper" }, index$1.renderLabel(this), this.renderCountDOM()), this.renderInputContainerDOM(), index$1.renderMessages(this))));
|
|
3538
|
+
}
|
|
3539
|
+
get hostElement() { return index.getElement(this); }
|
|
3540
|
+
static get watchers() { return {
|
|
3541
|
+
"ariaLabel": ["ariaLabelObserver"],
|
|
3542
|
+
"clearable": ["manageClearableResizeObserver"],
|
|
3543
|
+
"errors": ["errorsObserver"],
|
|
3544
|
+
"formatModifier": ["formatModifierObserver"],
|
|
3545
|
+
"formattedValueObject": ["formattedValueObjectObserver"],
|
|
3546
|
+
"hints": ["hintsObserver"],
|
|
3547
|
+
"type": ["typeObserver"],
|
|
3548
|
+
"value": ["valueObserver"]
|
|
3549
|
+
}; }
|
|
3550
|
+
};
|
|
3551
|
+
Q2Input.style = q2InputCss;
|
|
3552
|
+
|
|
3553
|
+
exports.q2_input = Q2Input;
|
|
3554
|
+
//# sourceMappingURL=q2-input.entry.cjs.js.map
|
|
3555
|
+
|
|
3556
|
+
//# sourceMappingURL=q2-input.cjs.entry.js.map
|