@justifi/webcomponents 4.7.4 → 4.7.5
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/LICENSE +1 -1
- package/dist/cjs/{Api-548eaa62.js → Api-a06b996e.js} +35 -35
- package/dist/cjs/{Pagination-cae1dcbd.js → Pagination-0da8f095.js} +5 -5
- package/dist/cjs/Payout-7821eb61.js +183 -0
- package/dist/cjs/SubAccount-b9487cbb.js +107 -0
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +50 -50
- package/dist/cjs/business-form-schema-a2b87e77.js +148 -0
- package/dist/cjs/config-ff2dda66.js +15 -0
- package/dist/cjs/{form-1e732a9d.js → form-2ad3d374.js} +84 -84
- package/dist/cjs/form-control-datepart_2.cjs.entry.js +108 -108
- package/dist/cjs/form-control-monetary.cjs.entry.js +50 -50
- package/dist/cjs/form-control-number_3.cjs.entry.js +108 -108
- package/dist/cjs/helpers-b254d050.js +26 -0
- package/dist/cjs/{index-c5ace247.js → index-4286ac32.js} +189 -51
- package/dist/cjs/{index-5a880722.js → index-fc5339a5.js} +406 -195
- package/dist/cjs/{index.esm-91ec051e.js → index.esm-c08c2adc.js} +61 -30
- package/dist/cjs/justifi-additional-questions_6.cjs.entry.js +372 -372
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +56 -56
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js +79 -79
- package/dist/cjs/justifi-business-details.cjs.entry.js +61 -61
- package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +110 -110
- package/dist/cjs/justifi-business-form.cjs.entry.js +71 -71
- package/dist/cjs/justifi-business-list.cjs.entry.js +128 -128
- package/dist/cjs/justifi-card-form.cjs.entry.js +57 -57
- package/dist/cjs/justifi-details.cjs.entry.js +13 -13
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +125 -125
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +72 -72
- package/dist/cjs/justifi-payment-details.cjs.entry.js +53 -53
- package/dist/cjs/justifi-payment-form.cjs.entry.js +89 -89
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +171 -188
- package/dist/cjs/justifi-payments-list.cjs.entry.js +97 -98
- package/dist/cjs/justifi-payout-details.cjs.entry.js +54 -54
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +119 -119
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +135 -135
- package/dist/cjs/justifi-refund-form.cjs.entry.js +85 -85
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +62 -62
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +84 -84
- package/dist/cjs/justifi-table_2.cjs.entry.js +61 -61
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/select-input_2.cjs.entry.js +38 -38
- package/dist/cjs/state-options-96d05a98.js +246 -0
- package/dist/cjs/subaccount-account-details_4.cjs.entry.js +41 -41
- package/dist/cjs/subaccount-bank-details.cjs.entry.js +11 -11
- package/dist/cjs/subaccount-terms-details.cjs.entry.js +11 -11
- package/dist/cjs/{utils-13d069be.js → utils-36bf8b3e.js} +108 -108
- package/dist/cjs/utils-a2ee48ca.js +35 -0
- package/dist/cjs/webcomponents.cjs.js +3 -3
- package/dist/collection/api/Api.js +34 -34
- package/dist/collection/api/Business.js +39 -39
- package/dist/collection/api/Pagination.js +5 -5
- package/dist/collection/api/Payment.js +108 -108
- package/dist/collection/api/Payout.js +33 -33
- package/dist/collection/api/Proceed.js +33 -33
- package/dist/collection/api/SubAccount.js +78 -78
- package/dist/collection/api/mockData/MockOnboardingData.js +108 -108
- package/dist/collection/api/mockData/MockPayments.js +207 -207
- package/dist/collection/api/mockData/MockSubAccount.js +96 -96
- package/dist/collection/api/mockData/mockGrossVolumeReport.js +123 -123
- package/dist/collection/collection-manifest.json +4 -4
- package/dist/collection/components/bank-account-form/bank-account-form.js +260 -259
- package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js +10 -10
- package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js +38 -38
- package/dist/collection/components/billing-form/billing-form-schema.js +6 -6
- package/dist/collection/components/billing-form/billing-form.css +16 -12
- package/dist/collection/components/billing-form/billing-form.js +177 -179
- package/dist/collection/components/billing-form/state-options.js +240 -240
- package/dist/collection/components/billing-form/test/billing-form.spec.js +50 -50
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.css +23 -16
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +43 -43
- package/dist/collection/components/business-details/business-details.css +11 -4
- package/dist/collection/components/business-details/business-details.js +107 -107
- package/dist/collection/components/business-details/generic-info-details/generic-info-details.css +23 -16
- package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +43 -43
- package/dist/collection/components/business-details/legal-address-details/legal-address-details.css +23 -16
- package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +43 -43
- package/dist/collection/components/business-details/owner-details/owner-details.css +23 -16
- package/dist/collection/components/business-details/owner-details/owner-details.js +45 -45
- package/dist/collection/components/business-details/representative-details/representative-details.css +23 -16
- package/dist/collection/components/business-details/representative-details/representative-details.js +43 -43
- package/dist/collection/components/business-form/additional-questions/additional-questions.js +49 -49
- package/dist/collection/components/business-form/business-address/business-address-form-schema.js +8 -8
- package/dist/collection/components/business-form/business-address/business-address-form.css +16 -12
- package/dist/collection/components/business-form/business-address/business-address-form.js +93 -93
- package/dist/collection/components/business-form/business-address/test/business-address.e2e.js +6 -6
- package/dist/collection/components/business-form/business-address/test/business-address.spec.js +21 -21
- package/dist/collection/components/business-form/business-form-schema.js +137 -137
- package/dist/collection/components/business-form/business-form-stepped.css +23 -16
- package/dist/collection/components/business-form/business-form-stepped.js +203 -203
- package/dist/collection/components/business-form/business-form.css +23 -16
- package/dist/collection/components/business-form/business-form.js +111 -111
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.css +16 -12
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +57 -57
- package/dist/collection/components/business-form/business-owners/business-owners.css +23 -16
- package/dist/collection/components/business-form/business-owners/business-owners.js +117 -117
- package/dist/collection/components/business-form/business-representative/business-representative.css +16 -12
- package/dist/collection/components/business-form/business-representative/business-representative.js +65 -65
- package/dist/collection/components/business-form/helpers.js +19 -19
- package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +6 -6
- package/dist/collection/components/business-form/legal-address-form/legal-address-form.css +16 -12
- package/dist/collection/components/business-form/legal-address-form/legal-address-form.js +61 -61
- package/dist/collection/components/business-form/test/business-form.spec.js +35 -35
- package/dist/collection/components/business-list/business-list.css +3 -0
- package/dist/collection/components/business-list/business-list.js +160 -160
- package/dist/collection/components/business-list/business-list.stories.js +10 -10
- package/dist/collection/components/card-form/card-form.js +278 -277
- package/dist/collection/components/card-form/test/card-form.e2e.js +10 -10
- package/dist/collection/components/card-form/test/card-form.spec.js +45 -45
- package/dist/collection/components/details/details.css +38 -31
- package/dist/collection/components/details/details.js +42 -42
- package/dist/collection/components/form/form-control-datepart.js +224 -224
- package/dist/collection/components/form/form-control-monetary.js +177 -177
- package/dist/collection/components/form/form-control-number-masked.js +208 -208
- package/dist/collection/components/form/form-control-number.css +7 -2
- package/dist/collection/components/form/form-control-number.js +188 -188
- package/dist/collection/components/form/form-control-select.css +7 -2
- package/dist/collection/components/form/form-control-select.js +196 -196
- package/dist/collection/components/form/form-control-text.css +7 -2
- package/dist/collection/components/form/form-control-text.js +188 -188
- package/dist/collection/components/form/form.js +80 -80
- package/dist/collection/components/gross-payment-chart/chart-utils.js +52 -52
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.css +3 -0
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +125 -125
- package/dist/collection/components/gross-payment-chart/test/gross-payment-chart.spec.js +7 -7
- package/dist/collection/components/pagination-menu/pagination-menu.js +72 -72
- package/dist/collection/components/payment-balance-transactions/payment-balance-transactions.js +144 -144
- package/dist/collection/components/payment-balance-transactions/payment-balance-transactions.stories.js +10 -10
- package/dist/collection/components/payment-details/payment-details.css +38 -31
- package/dist/collection/components/payment-details/payment-details.js +106 -106
- package/dist/collection/components/payment-form/payment-form.css +16 -12
- package/dist/collection/components/payment-form/payment-form.js +319 -318
- package/dist/collection/components/payment-form/payment-method-selector.css +6 -2
- package/dist/collection/components/payment-form/payment-method-selector.js +90 -90
- package/dist/collection/components/payment-form/test/payment-form.e2e.js +9 -9
- package/dist/collection/components/payment-form/test/payment-form.spec.js +157 -157
- package/dist/collection/components/payment-method-form/get-computed-theme.js +47 -47
- package/dist/collection/components/payment-method-form/message-event-types.js +14 -14
- package/dist/collection/components/payment-method-form/payment-method-form.js +288 -262
- package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +16 -16
- package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js +43 -43
- package/dist/collection/components/payments-list/payments-list.css +3 -0
- package/dist/collection/components/payments-list/payments-list.js +177 -178
- package/dist/collection/components/payments-list/test/payments-list.spec.js +21 -21
- package/dist/collection/components/payout-details/payout-details.css +38 -31
- package/dist/collection/components/payout-details/payout-details.js +107 -107
- package/dist/collection/components/payouts-list/payouts-list.css +3 -0
- package/dist/collection/components/payouts-list/payouts-list.js +199 -199
- package/dist/collection/components/proceeds-list/proceeds-list.css +3 -0
- package/dist/collection/components/proceeds-list/proceeds-list.js +182 -182
- package/dist/collection/components/proceeds-list/proceeds-list.stories.js +12 -12
- package/dist/collection/components/refund-form/refund-form-schema.js +9 -9
- package/dist/collection/components/refund-form/refund-form.css +23 -16
- package/dist/collection/components/refund-form/refund-form.js +216 -216
- package/dist/collection/components/refund-form/refund-form.stories.js +27 -27
- package/dist/collection/components/select-input/select-input.css +7 -2
- package/dist/collection/components/select-input/select-input.js +139 -139
- package/dist/collection/components/select-input/test/select-input.spec.js +38 -38
- package/dist/collection/components/subaccount-details/subaccount-account-details/subaccount-account-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-account-details/subaccount-account-details.js +65 -65
- package/dist/collection/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.js +43 -43
- package/dist/collection/components/subaccount-details/subaccount-details.css +38 -31
- package/dist/collection/components/subaccount-details/subaccount-details.js +132 -132
- package/dist/collection/components/subaccount-details/subaccount-details.stories.js +9 -9
- package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.js +43 -44
- package/dist/collection/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.js +44 -43
- package/dist/collection/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.js +43 -43
- package/dist/collection/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.css +23 -16
- package/dist/collection/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.js +43 -43
- package/dist/collection/components/subaccount-details/test/subaccount-details.spec.js +7 -7
- package/dist/collection/components/subaccounts-list/subaccounts-list.js +164 -164
- package/dist/collection/components/subaccounts-list/subaccounts-list.stories.js +12 -12
- package/dist/collection/components/subaccounts-list/test/subaccounts-list.e2e.js +6 -6
- package/dist/collection/components/subaccounts-list/test/subaccounts-list.spec.js +21 -21
- package/dist/collection/components/table/table.css +38 -31
- package/dist/collection/components/table/table.js +224 -224
- package/dist/collection/components/table/test/table.spec.js +48 -48
- package/dist/collection/components/text-input/test/text-input.spec.js +31 -31
- package/dist/collection/components/text-input/text-input.css +7 -2
- package/dist/collection/components/text-input/text-input.js +122 -122
- package/dist/collection/utils/country-options.js +198 -198
- package/dist/collection/utils/phone-masks.js +1 -1
- package/dist/collection/utils/utils.js +107 -107
- package/dist/config.js +9 -9
- package/dist/docs.d.ts +401 -0
- package/dist/docs.json +6506 -0
- package/dist/esm/{Api-c65d3ed8.js → Api-0e88671c.js} +35 -35
- package/dist/esm/{Pagination-31f770d6.js → Pagination-afc8f96d.js} +5 -5
- package/dist/esm/Payout-c42e3877.js +179 -0
- package/dist/esm/SubAccount-b3ce8720.js +105 -0
- package/dist/esm/additional-questions-details_5.entry.js +50 -50
- package/dist/esm/business-form-schema-997c585c.js +144 -0
- package/dist/esm/config-476c7241.js +13 -0
- package/dist/esm/{form-32cf3d1e.js → form-5279c05a.js} +84 -84
- package/dist/esm/form-control-datepart_2.entry.js +108 -108
- package/dist/esm/form-control-monetary.entry.js +50 -50
- package/dist/esm/form-control-number_3.entry.js +108 -108
- package/dist/esm/helpers-d8a6a0f1.js +24 -0
- package/dist/esm/{index-5ed53c20.js → index-5eb05747.js} +406 -195
- package/dist/esm/{index-7471ed60.js → index-ff8194f9.js} +189 -51
- package/dist/esm/{index.esm-9397ffa0.js → index.esm-8ae36d07.js} +61 -30
- package/dist/esm/justifi-additional-questions_6.entry.js +372 -372
- package/dist/esm/justifi-bank-account-form.entry.js +56 -56
- package/dist/esm/justifi-billing-form_2.entry.js +79 -79
- package/dist/esm/justifi-business-details.entry.js +61 -61
- package/dist/esm/justifi-business-form-stepped.entry.js +110 -110
- package/dist/esm/justifi-business-form.entry.js +71 -71
- package/dist/esm/justifi-business-list.entry.js +128 -128
- package/dist/esm/justifi-card-form.entry.js +57 -57
- package/dist/esm/justifi-details.entry.js +13 -13
- package/dist/esm/justifi-gross-payment-chart.entry.js +125 -125
- package/dist/esm/justifi-payment-balance-transactions.entry.js +72 -72
- package/dist/esm/justifi-payment-details.entry.js +53 -53
- package/dist/esm/justifi-payment-form.entry.js +89 -89
- package/dist/esm/justifi-payment-method-form.entry.js +171 -188
- package/dist/esm/justifi-payments-list.entry.js +97 -98
- package/dist/esm/justifi-payout-details.entry.js +54 -54
- package/dist/esm/justifi-payouts-list.entry.js +119 -119
- package/dist/esm/justifi-proceeds-list.entry.js +135 -135
- package/dist/esm/justifi-refund-form.entry.js +85 -85
- package/dist/esm/justifi-subaccount-details.entry.js +62 -62
- package/dist/esm/justifi-subaccounts-list.entry.js +84 -84
- package/dist/esm/justifi-table_2.entry.js +61 -61
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/select-input_2.entry.js +38 -38
- package/dist/esm/state-options-fc1daf67.js +244 -0
- package/dist/esm/subaccount-account-details_4.entry.js +41 -41
- package/dist/esm/subaccount-bank-details.entry.js +11 -11
- package/dist/esm/subaccount-terms-details.entry.js +11 -11
- package/dist/esm/{utils-40b7002c.js → utils-26c7dd12.js} +108 -108
- package/dist/esm/utils-7c6bd149.js +27 -0
- package/dist/esm/webcomponents.js +4 -4
- package/{loader → dist/loader}/cdn.js +1 -1
- package/{loader → dist/loader}/index.cjs.js +1 -1
- package/{loader → dist/loader}/index.d.ts +1 -1
- package/dist/loader/index.es2017.js +3 -0
- package/{loader → dist/loader}/index.js +2 -2
- package/dist/{components → module}/Api.js +35 -35
- package/dist/{components → module}/Pagination.js +5 -5
- package/dist/module/Payout.js +179 -0
- package/dist/module/SubAccount.js +105 -0
- package/dist/{components → module}/additional-questions-details.d.ts +2 -2
- package/dist/module/additional-questions-details2.js +36 -0
- package/dist/module/additional-questions.js +50 -0
- package/dist/module/billing-form.js +113 -0
- package/dist/module/business-address-form.js +72 -0
- package/dist/module/business-generic-info.js +212 -0
- package/dist/module/business-owners.js +116 -0
- package/dist/module/business-representative.js +90 -0
- package/dist/module/config.js +13 -0
- package/dist/module/details.js +38 -0
- package/dist/{components → module}/form-control-datepart.d.ts +2 -2
- package/dist/module/form-control-datepart2.js +98 -0
- package/dist/{components → module}/form-control-monetary.d.ts +2 -2
- package/dist/module/form-control-monetary2.js +83 -0
- package/dist/{components → module}/form-control-number-masked.d.ts +2 -2
- package/dist/module/form-control-number-masked2.js +82 -0
- package/dist/{components → module}/form-control-number.d.ts +2 -2
- package/dist/module/form-control-number2.js +71 -0
- package/dist/{components → module}/form-control-select.d.ts +2 -2
- package/dist/module/form-control-select2.js +67 -0
- package/dist/{components → module}/form-control-text.d.ts +2 -2
- package/dist/module/form-control-text2.js +71 -0
- package/dist/{components → module}/form.js +84 -84
- package/dist/{components → module}/generic-info-details.d.ts +2 -2
- package/dist/module/generic-info-details2.js +37 -0
- package/dist/module/helpers.js +24 -0
- package/dist/{components → module}/index.esm.js +61 -30
- package/dist/{components → module}/index2.js +406 -195
- package/dist/{components → module}/justifi-additional-questions.d.ts +2 -2
- package/dist/{components → module}/justifi-bank-account-form.d.ts +2 -2
- package/dist/module/justifi-bank-account-form.js +96 -0
- package/dist/{components → module}/justifi-billing-form.d.ts +2 -2
- package/dist/{components → module}/justifi-business-address-form.d.ts +2 -2
- package/dist/{components → module}/justifi-business-details.d.ts +2 -2
- package/dist/module/justifi-business-details.js +130 -0
- package/dist/{components → module}/justifi-business-form-stepped.d.ts +2 -2
- package/dist/module/justifi-business-form-stepped.js +228 -0
- package/dist/{components → module}/justifi-business-form.d.ts +2 -2
- package/dist/{components/justifi-payment-details.js → module/justifi-business-form.js} +161 -79
- package/dist/{components → module}/justifi-business-generic-info.d.ts +2 -2
- package/dist/{components → module}/justifi-business-list.d.ts +2 -2
- package/dist/module/justifi-business-list.js +197 -0
- package/dist/{components → module}/justifi-business-owners.d.ts +2 -2
- package/dist/{components → module}/justifi-business-representative.d.ts +2 -2
- package/dist/{components → module}/justifi-card-form.d.ts +2 -2
- package/dist/module/justifi-card-form.js +98 -0
- package/dist/{components → module}/justifi-details.d.ts +2 -2
- package/dist/{components → module}/justifi-gross-payment-chart.d.ts +2 -2
- package/dist/{components → module}/justifi-gross-payment-chart.js +146 -142
- package/dist/{components → module}/justifi-legal-address-form.d.ts +2 -2
- package/dist/{components → module}/justifi-payment-balance-transactions.d.ts +2 -2
- package/dist/module/justifi-payment-balance-transactions.js +125 -0
- package/dist/{components → module}/justifi-payment-details.d.ts +2 -2
- package/dist/module/justifi-payment-details.js +98 -0
- package/dist/{components → module}/justifi-payment-form.d.ts +2 -2
- package/dist/module/justifi-payment-form.js +169 -0
- package/dist/{components → module}/justifi-payment-method-form.d.ts +2 -2
- package/dist/{components → module}/justifi-payment-method-selector.d.ts +2 -2
- package/dist/{components → module}/justifi-payments-list.d.ts +2 -2
- package/dist/module/justifi-payments-list.js +154 -0
- package/dist/{components → module}/justifi-payout-details.d.ts +2 -2
- package/dist/module/justifi-payout-details.js +99 -0
- package/dist/{components → module}/justifi-payouts-list.d.ts +2 -2
- package/dist/module/justifi-payouts-list.js +176 -0
- package/dist/{components → module}/justifi-proceeds-list.d.ts +2 -2
- package/dist/module/justifi-proceeds-list.js +199 -0
- package/dist/{components → module}/justifi-refund-form.d.ts +2 -2
- package/dist/module/justifi-refund-form.js +139 -0
- package/dist/{components → module}/justifi-subaccount-details.d.ts +2 -2
- package/dist/module/justifi-subaccount-details.js +134 -0
- package/dist/{components → module}/justifi-subaccounts-list.d.ts +2 -2
- package/dist/module/justifi-subaccounts-list.js +142 -0
- package/dist/{components → module}/justifi-table.d.ts +2 -2
- package/dist/{components → module}/legal-address-details.d.ts +2 -2
- package/dist/module/legal-address-details2.js +36 -0
- package/dist/module/legal-address-form.js +268 -0
- package/dist/{components → module}/owner-details.d.ts +2 -2
- package/dist/module/owner-details2.js +39 -0
- package/dist/{components → module}/pagination-menu.d.ts +2 -2
- package/dist/module/pagination-menu2.js +43 -0
- package/dist/{components → module}/payment-method-form.js +191 -207
- package/dist/module/payment-method-selector.js +44 -0
- package/dist/{components → module}/phone-masks.js +1 -1
- package/dist/{components → module}/representative-details.d.ts +2 -2
- package/dist/module/representative-details2.js +37 -0
- package/dist/{components → module}/select-input.d.ts +2 -2
- package/dist/module/select-input2.js +50 -0
- package/dist/module/state-options.js +244 -0
- package/dist/{components → module}/subaccount-account-details.d.ts +2 -2
- package/dist/module/subaccount-account-details2.js +38 -0
- package/dist/{components → module}/subaccount-bank-details.d.ts +2 -2
- package/dist/module/subaccount-bank-details.js +39 -0
- package/dist/{components → module}/subaccount-merchant-details.d.ts +2 -2
- package/dist/module/subaccount-merchant-details2.js +37 -0
- package/dist/{components → module}/subaccount-owners-details.d.ts +2 -2
- package/dist/module/subaccount-owners-details2.js +37 -0
- package/dist/{components → module}/subaccount-representative-details.d.ts +2 -2
- package/dist/module/subaccount-representative-details2.js +37 -0
- package/dist/{components → module}/subaccount-terms-details.d.ts +2 -2
- package/dist/{webcomponents/p-98e4eae3.entry.js → module/subaccount-terms-details.js} +39 -1
- package/dist/module/table.js +90 -0
- package/dist/{components → module}/text-input.d.ts +2 -2
- package/dist/module/text-input2.js +48 -0
- package/dist/module/utils.js +27 -0
- package/dist/{components → module}/utils2.js +108 -108
- package/dist/types/api/Api.d.ts +14 -14
- package/dist/types/api/Business.d.ts +120 -120
- package/dist/types/api/GrossVolume.d.ts +4 -4
- package/dist/types/api/Pagination.d.ts +12 -12
- package/dist/types/api/Payment.d.ts +134 -134
- package/dist/types/api/Payout.d.ts +51 -51
- package/dist/types/api/Proceed.d.ts +51 -51
- package/dist/types/api/SubAccount.d.ts +130 -130
- package/dist/types/api/mockData/MockOnboardingData.d.ts +5 -5
- package/dist/types/api/mockData/mockGrossVolumeReport.d.ts +5 -5
- package/dist/types/api/shared.d.ts +9 -9
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +58 -0
- package/dist/types/components/billing-form/billing-form-schema.d.ts +18 -18
- package/dist/types/components/billing-form/billing-form.d.ts +25 -25
- package/dist/types/components/billing-form/state-options.d.ts +2 -2
- package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
- package/dist/types/components/business-details/business-details.d.ts +13 -13
- package/dist/types/components/business-details/generic-info-details/generic-info-details.d.ts +2 -2
- package/dist/types/components/business-details/legal-address-details/legal-address-details.d.ts +2 -2
- package/dist/types/components/business-details/owner-details/owner-details.d.ts +2 -2
- package/dist/types/components/business-details/representative-details/representative-details.d.ts +2 -2
- package/dist/types/components/business-form/additional-questions/additional-questions.d.ts +7 -7
- package/dist/types/components/business-form/business-address/business-address-form-schema.d.ts +16 -16
- package/dist/types/components/business-form/business-address/business-address-form.d.ts +7 -7
- package/dist/types/components/business-form/business-form-schema.d.ts +102 -102
- package/dist/types/components/business-form/business-form-stepped.d.ts +23 -23
- package/dist/types/components/business-form/business-form.d.ts +11 -11
- package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +6 -6
- package/dist/types/components/business-form/business-owners/business-owners.d.ts +22 -22
- package/dist/types/components/business-form/business-representative/business-representative-schema.d.ts +13 -13
- package/dist/types/components/business-form/business-representative/business-representative.d.ts +8 -8
- package/dist/types/components/business-form/legal-address-form/legal-address-form-schema.d.ts +12 -12
- package/dist/types/components/business-form/legal-address-form/legal-address-form.d.ts +7 -7
- package/dist/types/components/business-list/business-list.d.ts +27 -27
- package/dist/types/components/business-list/business-list.stories.d.ts +3 -3
- package/dist/types/components/card-form/card-form.d.ts +68 -0
- package/dist/types/components/details/details.d.ts +2 -2
- package/dist/types/components/details/utils.d.ts +10 -10
- package/dist/types/components/form/form-control-datepart.d.ts +16 -16
- package/dist/types/components/form/form-control-monetary.d.ts +14 -14
- package/dist/types/components/form/form-control-number-masked.d.ts +16 -16
- package/dist/types/components/form/form-control-number.d.ts +15 -15
- package/dist/types/components/form/form-control-select.d.ts +17 -17
- package/dist/types/components/form/form-control-text.d.ts +15 -15
- package/dist/types/components/form/form.d.ts +18 -18
- package/dist/types/components/gross-payment-chart/chart-utils.d.ts +39 -39
- package/dist/types/components/gross-payment-chart/gross-payment-chart.d.ts +16 -16
- package/dist/types/components/pagination-menu/pagination-menu.d.ts +5 -5
- package/dist/types/components/payment-balance-transactions/payment-balance-transactions.d.ts +14 -14
- package/dist/types/components/payment-balance-transactions/payment-balance-transactions.stories.d.ts +3 -3
- package/dist/types/components/payment-details/payment-details.d.ts +9 -9
- package/dist/types/components/payment-form/payment-form.d.ts +22 -22
- package/dist/types/components/payment-form/payment-method-selector.d.ts +6 -6
- package/dist/types/components/payment-form/tokenize.d.ts +3 -3
- package/dist/types/components/payment-method-form/message-event-types.d.ts +14 -14
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +21 -22
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +40 -40
- package/dist/types/components/payment-method-form/theme.d.ts +45 -45
- package/dist/types/components/payments-list/payments-list.d.ts +14 -14
- package/dist/types/components/payout-details/payout-details.d.ts +9 -9
- package/dist/types/components/payouts-list/payouts-list.d.ts +15 -15
- package/dist/types/components/proceeds-list/proceeds-list.d.ts +15 -15
- package/dist/types/components/proceeds-list/proceeds-list.stories.d.ts +4 -4
- package/dist/types/components/refund-form/refund-form-schema.d.ts +4 -4
- package/dist/types/components/refund-form/refund-form.d.ts +54 -54
- package/dist/types/components/refund-form/refund-form.stories.d.ts +21 -21
- package/dist/types/components/select-input/select-input.d.ts +14 -14
- package/dist/types/components/subaccount-details/subaccount-account-details/subaccount-account-details.d.ts +3 -3
- package/dist/types/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.d.ts +2 -2
- package/dist/types/components/subaccount-details/subaccount-details.d.ts +13 -13
- package/dist/types/components/subaccount-details/subaccount-details.stories.d.ts +3 -3
- package/dist/types/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.d.ts +2 -2
- package/dist/types/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.d.ts +2 -2
- package/dist/types/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.d.ts +2 -2
- package/dist/types/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.d.ts +2 -2
- package/dist/types/components/subaccounts-list/subaccounts-list.d.ts +14 -14
- package/dist/types/components/subaccounts-list/subaccounts-list.stories.d.ts +4 -4
- package/dist/types/components/table/table.d.ts +19 -19
- package/dist/types/components/text-input/text-input.d.ts +10 -10
- package/dist/types/components.d.ts +228 -15
- package/dist/types/home/runner/work/web-component-library/web-component-library/packages/webcomponents/.stencil/config.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +32 -3
- package/dist/types/utils/country-options.d.ts +2 -2
- package/dist/types/utils/phone-masks.d.ts +1 -1
- package/dist/webcomponents/p-04817850.entry.js +1 -0
- package/dist/webcomponents/{p-b157f6ae.js → p-04c7f8f8.js} +1 -1
- package/dist/webcomponents/p-0a351e24.entry.js +1 -0
- package/dist/webcomponents/{p-ed8c9b88.entry.js → p-0ad353cc.entry.js} +1 -1
- package/dist/webcomponents/{p-cdd06952.entry.js → p-0f5206f0.entry.js} +1 -1
- package/dist/{components/subaccount-terms-details.js → webcomponents/p-173fb8ef.entry.js} +1 -38
- package/dist/webcomponents/p-1e2a98bf.js +1 -0
- package/dist/webcomponents/{p-86c23e1e.js → p-210677e3.js} +1 -1
- package/dist/webcomponents/p-22c2a11e.entry.js +1 -0
- package/dist/webcomponents/p-2cab231e.entry.js +1 -0
- package/dist/webcomponents/p-2ea68b03.entry.js +1 -0
- package/dist/{components/additional-questions-details2.js → webcomponents/p-33e74da7.entry.js} +1 -35
- package/dist/webcomponents/p-34430db2.entry.js +1 -0
- package/dist/webcomponents/p-377303af.entry.js +1 -0
- package/dist/webcomponents/{p-988191bf.js → p-3bef762a.js} +1 -1
- package/dist/webcomponents/p-42bc8e53.entry.js +1 -0
- package/dist/webcomponents/p-439a79c7.entry.js +1 -0
- package/dist/webcomponents/p-57efe345.entry.js +1 -0
- package/dist/webcomponents/p-59ecc2d7.entry.js +1 -0
- package/dist/webcomponents/p-650eb614.entry.js +1 -0
- package/dist/webcomponents/p-68427454.entry.js +1 -0
- package/dist/webcomponents/{p-59860ac8.js → p-78baff54.js} +1 -1
- package/dist/webcomponents/p-7d922421.entry.js +1 -0
- package/dist/webcomponents/{p-311250e2.entry.js → p-8302a5e2.entry.js} +1 -1
- package/dist/webcomponents/p-862f38cc.entry.js +1 -0
- package/dist/webcomponents/p-93579716.js +1 -0
- package/dist/webcomponents/p-b2dc938f.entry.js +1 -0
- package/dist/webcomponents/p-c8099443.entry.js +1 -0
- package/dist/webcomponents/p-c8916484.entry.js +1 -0
- package/dist/webcomponents/{p-c0f9f6a8.entry.js → p-cb5352a3.entry.js} +2 -2
- package/dist/webcomponents/p-cf656598.entry.js +1 -0
- package/dist/webcomponents/p-d84cd3a5.entry.js +1 -0
- package/dist/webcomponents/p-da00d9bf.js +2 -0
- package/dist/webcomponents/p-dd4e8fa1.entry.js +1 -0
- package/dist/webcomponents/p-df8f6a0f.entry.js +1 -0
- package/dist/webcomponents/p-e8f41c84.entry.js +1 -0
- package/dist/webcomponents/p-e9589e45.entry.js +1 -0
- package/dist/webcomponents/webcomponents.css +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +18 -41
- package/dist/cjs/Payout-f8240e9c.js +0 -183
- package/dist/cjs/SubAccount-f47c8522.js +0 -107
- package/dist/cjs/business-form-schema-fe831c30.js +0 -148
- package/dist/cjs/config-a156df17.js +0 -15
- package/dist/cjs/helpers-c505d861.js +0 -26
- package/dist/cjs/state-options-83b52cd1.js +0 -246
- package/dist/cjs/utils-a47b2e73.js +0 -35
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js +0 -132
- package/dist/collection/components/bank-account-form/example.js +0 -54
- package/dist/collection/components/billing-form/billing-form.stories.js +0 -61
- package/dist/collection/components/billing-form/example.js +0 -26
- package/dist/collection/components/business-details/business-details.stories.js +0 -23
- package/dist/collection/components/business-form/business-form-example.js +0 -12
- package/dist/collection/components/business-form/business-form-stepped-example.js +0 -12
- package/dist/collection/components/business-form/business-form-stepped.stories.js +0 -132
- package/dist/collection/components/business-form/business-form.stories.js +0 -127
- package/dist/collection/components/card-form/card-form.stories.js +0 -137
- package/dist/collection/components/card-form/example.js +0 -59
- package/dist/collection/components/gross-payment-chart/example.js +0 -12
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.stories.js +0 -22
- package/dist/collection/components/payment-details/example.js +0 -12
- package/dist/collection/components/payment-details/payment-details.stories.js +0 -47
- package/dist/collection/components/payment-form/example.js +0 -23
- package/dist/collection/components/payment-form/payment-form.stories.js +0 -129
- package/dist/collection/components/payments-list/example.js +0 -12
- package/dist/collection/components/payments-list/payments-list.stories.js +0 -88
- package/dist/collection/components/payout-details/example.js +0 -12
- package/dist/collection/components/payout-details/payout-details.stories.js +0 -47
- package/dist/collection/components/payouts-list/example.js +0 -12
- package/dist/collection/components/payouts-list/payouts-list.stories.js +0 -88
- package/dist/components/Payout.js +0 -179
- package/dist/components/SubAccount.js +0 -105
- package/dist/components/additional-questions.js +0 -49
- package/dist/components/billing-form.js +0 -112
- package/dist/components/business-address-form.js +0 -69
- package/dist/components/business-generic-info.js +0 -211
- package/dist/components/business-owners.js +0 -115
- package/dist/components/business-representative.js +0 -89
- package/dist/components/config.js +0 -13
- package/dist/components/details.js +0 -37
- package/dist/components/form-control-datepart2.js +0 -95
- package/dist/components/form-control-monetary2.js +0 -80
- package/dist/components/form-control-number-masked2.js +0 -79
- package/dist/components/form-control-number2.js +0 -68
- package/dist/components/form-control-select2.js +0 -64
- package/dist/components/form-control-text2.js +0 -68
- package/dist/components/generic-info-details2.js +0 -36
- package/dist/components/helpers.js +0 -24
- package/dist/components/justifi-bank-account-form.js +0 -95
- package/dist/components/justifi-business-details.js +0 -129
- package/dist/components/justifi-business-form-stepped.js +0 -227
- package/dist/components/justifi-business-form.js +0 -175
- package/dist/components/justifi-business-list.js +0 -192
- package/dist/components/justifi-card-form.js +0 -97
- package/dist/components/justifi-payment-balance-transactions.js +0 -122
- package/dist/components/justifi-payment-form.js +0 -168
- package/dist/components/justifi-payments-list.js +0 -149
- package/dist/components/justifi-payout-details.js +0 -95
- package/dist/components/justifi-payouts-list.js +0 -171
- package/dist/components/justifi-proceeds-list.js +0 -194
- package/dist/components/justifi-refund-form.js +0 -138
- package/dist/components/justifi-subaccount-details.js +0 -130
- package/dist/components/justifi-subaccounts-list.js +0 -137
- package/dist/components/legal-address-details2.js +0 -35
- package/dist/components/legal-address-form.js +0 -267
- package/dist/components/owner-details2.js +0 -38
- package/dist/components/pagination-menu2.js +0 -42
- package/dist/components/payment-method-selector.js +0 -43
- package/dist/components/representative-details2.js +0 -36
- package/dist/components/select-input2.js +0 -49
- package/dist/components/state-options.js +0 -244
- package/dist/components/subaccount-account-details2.js +0 -37
- package/dist/components/subaccount-bank-details.js +0 -38
- package/dist/components/subaccount-merchant-details2.js +0 -36
- package/dist/components/subaccount-owners-details2.js +0 -36
- package/dist/components/subaccount-representative-details2.js +0 -36
- package/dist/components/table.js +0 -89
- package/dist/components/text-input2.js +0 -47
- package/dist/components/utils.js +0 -27
- package/dist/esm/Payout-586f06a3.js +0 -179
- package/dist/esm/SubAccount-128190e9.js +0 -105
- package/dist/esm/business-form-schema-30a3eadd.js +0 -144
- package/dist/esm/config-ceb0f902.js +0 -13
- package/dist/esm/helpers-1d5ecdc8.js +0 -24
- package/dist/esm/state-options-ece00aa2.js +0 -244
- package/dist/esm/utils-d19c2778.js +0 -27
- package/dist/types/components/bank-account-form/bank-account-form.stories.d.ts +0 -23
- package/dist/types/components/billing-form/billing-form.stories.d.ts +0 -8
- package/dist/types/components/business-details/business-details.stories.d.ts +0 -7
- package/dist/types/components/business-form/business-form-stepped.stories.d.ts +0 -27
- package/dist/types/components/business-form/business-form.stories.d.ts +0 -27
- package/dist/types/components/card-form/card-form.stories.d.ts +0 -17
- package/dist/types/components/gross-payment-chart/gross-payment-chart.stories.d.ts +0 -7
- package/dist/types/components/payment-details/payment-details.stories.d.ts +0 -8
- package/dist/types/components/payment-form/payment-form.stories.d.ts +0 -8
- package/dist/types/components/payments-list/payments-list.stories.d.ts +0 -9
- package/dist/types/components/payout-details/payout-details.stories.d.ts +0 -8
- package/dist/types/components/payouts-list/payouts-list.stories.d.ts +0 -9
- package/dist/types/home/runner/work/web-component-library/web-component-library/stencil-library/.stencil/config.d.ts +0 -11
- package/dist/webcomponents/p-14f7229e.entry.js +0 -1
- package/dist/webcomponents/p-2c2cde2d.js +0 -1
- package/dist/webcomponents/p-3501b0e8.entry.js +0 -1
- package/dist/webcomponents/p-3ee831ac.entry.js +0 -1
- package/dist/webcomponents/p-3fc95638.entry.js +0 -1
- package/dist/webcomponents/p-4214dbb8.entry.js +0 -1
- package/dist/webcomponents/p-46d5f717.entry.js +0 -1
- package/dist/webcomponents/p-4852ce94.entry.js +0 -1
- package/dist/webcomponents/p-4ec00b55.entry.js +0 -1
- package/dist/webcomponents/p-4fb653a8.entry.js +0 -1
- package/dist/webcomponents/p-586c8a4f.entry.js +0 -1
- package/dist/webcomponents/p-5e6726a8.entry.js +0 -1
- package/dist/webcomponents/p-7bda12a5.entry.js +0 -1
- package/dist/webcomponents/p-8f37e3ee.js +0 -1
- package/dist/webcomponents/p-91757d9f.entry.js +0 -1
- package/dist/webcomponents/p-9e012e33.entry.js +0 -1
- package/dist/webcomponents/p-a1ef6b4c.entry.js +0 -1
- package/dist/webcomponents/p-af771964.entry.js +0 -1
- package/dist/webcomponents/p-b60a58f4.entry.js +0 -1
- package/dist/webcomponents/p-bb70152e.entry.js +0 -1
- package/dist/webcomponents/p-bc91044c.entry.js +0 -1
- package/dist/webcomponents/p-c29c587f.entry.js +0 -1
- package/dist/webcomponents/p-cbb60191.js +0 -2
- package/dist/webcomponents/p-d0e4eca5.entry.js +0 -1
- package/dist/webcomponents/p-d4b66d74.entry.js +0 -1
- package/dist/webcomponents/p-e7ef2455.entry.js +0 -1
- package/dist/webcomponents/p-f2f0aa6e.entry.js +0 -1
- package/dist/webcomponents/p-f4075186.entry.js +0 -1
- package/loader/index.es2017.js +0 -3
- /package/{loader → dist/loader}/package.json +0 -0
- /package/dist/{components → module}/additional-questions-details.js +0 -0
- /package/dist/{components → module}/form-control-datepart.js +0 -0
- /package/dist/{components → module}/form-control-monetary.js +0 -0
- /package/dist/{components → module}/form-control-number-masked.js +0 -0
- /package/dist/{components → module}/form-control-number.js +0 -0
- /package/dist/{components → module}/form-control-select.js +0 -0
- /package/dist/{components → module}/form-control-text.js +0 -0
- /package/dist/{components → module}/generic-info-details.js +0 -0
- /package/dist/{components → module}/index.d.ts +0 -0
- /package/dist/{components → module}/index.js +0 -0
- /package/dist/{components → module}/justifi-additional-questions.js +0 -0
- /package/dist/{components → module}/justifi-billing-form.js +0 -0
- /package/dist/{components → module}/justifi-business-address-form.js +0 -0
- /package/dist/{components → module}/justifi-business-generic-info.js +0 -0
- /package/dist/{components → module}/justifi-business-owners.js +0 -0
- /package/dist/{components → module}/justifi-business-representative.js +0 -0
- /package/dist/{components → module}/justifi-details.js +0 -0
- /package/dist/{components → module}/justifi-legal-address-form.js +0 -0
- /package/dist/{components → module}/justifi-payment-method-form.js +0 -0
- /package/dist/{components → module}/justifi-payment-method-selector.js +0 -0
- /package/dist/{components → module}/justifi-table.js +0 -0
- /package/dist/{components → module}/legal-address-details.js +0 -0
- /package/dist/{components → module}/owner-details.js +0 -0
- /package/dist/{components → module}/pagination-menu.js +0 -0
- /package/dist/{components → module}/representative-details.js +0 -0
- /package/dist/{components → module}/select-input.js +0 -0
- /package/dist/{components → module}/subaccount-account-details.js +0 -0
- /package/dist/{components → module}/subaccount-merchant-details.js +0 -0
- /package/dist/{components → module}/subaccount-owners-details.js +0 -0
- /package/dist/{components → module}/subaccount-representative-details.js +0 -0
- /package/dist/{components → module}/text-input.js +0 -0
- /package/dist/webcomponents/{p-0d5d02d7.js → p-56f6ce4c.js} +0 -0
- /package/dist/webcomponents/{p-e12ab547.js → p-71679a41.js} +0 -0
- /package/dist/webcomponents/{p-47bc59b5.js → p-8e2a88a8.js} +0 -0
- /package/dist/webcomponents/{p-d6b5793d.js → p-9a6e4749.js} +0 -0
- /package/dist/webcomponents/{p-526cb161.js → p-9b4b91ba.js} +0 -0
- /package/dist/webcomponents/{p-9b6dcac5.js → p-ae263544.js} +0 -0
- /package/dist/webcomponents/{p-7d58db66.js → p-bedada09.js} +0 -0
|
@@ -5,8 +5,7 @@ function isString(str) {
|
|
|
5
5
|
|
|
6
6
|
/** Checks if value is object */
|
|
7
7
|
function isObject(obj) {
|
|
8
|
-
|
|
9
|
-
return typeof obj === 'object' && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === 'Object';
|
|
8
|
+
return typeof obj === 'object' && obj != null && obj?.constructor?.name === 'Object';
|
|
10
9
|
}
|
|
11
10
|
function pick(obj, keys) {
|
|
12
11
|
if (Array.isArray(keys)) return pick(obj, (_, k) => keys.includes(k));
|
|
@@ -94,6 +93,11 @@ class ActionDetails {
|
|
|
94
93
|
while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {
|
|
95
94
|
--this.oldSelection.start;
|
|
96
95
|
}
|
|
96
|
+
|
|
97
|
+
// double check right part
|
|
98
|
+
while (this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end)) {
|
|
99
|
+
if (this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end) ++this.oldSelection.end;else ++this.cursorPos;
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
/** Start changing position */
|
|
@@ -177,6 +181,7 @@ function IMask(el, opts) {
|
|
|
177
181
|
// export function maskedClass<Mask extends typeof Masked> (mask: Mask): Mask;
|
|
178
182
|
// export function maskedClass(mask: RegExp): typeof MaskedRegExp;
|
|
179
183
|
// export function maskedClass(mask: (value: string, ...args: any[]) => boolean): typeof MaskedFunction;
|
|
184
|
+
|
|
180
185
|
/** Get Masked class by mask type */
|
|
181
186
|
function maskedClass(mask) /* TODO */{
|
|
182
187
|
if (mask == null) throw new Error('mask property should be defined');
|
|
@@ -257,7 +262,7 @@ function createMask(opts) {
|
|
|
257
262
|
if (IMask.Masked && opts instanceof IMask.Masked) return opts;
|
|
258
263
|
const nOpts = normalizeOpts(opts);
|
|
259
264
|
const MaskedClass = maskedClass(nOpts.mask);
|
|
260
|
-
if (!MaskedClass) throw new Error(
|
|
265
|
+
if (!MaskedClass) throw new Error(`Masked class is not found for provided mask ${nOpts.mask}, appropriate module needs to be imported manually before creating mask.`);
|
|
261
266
|
if (nOpts.mask === MaskedClass) delete nOpts.mask;
|
|
262
267
|
if (nOpts._mask) {
|
|
263
268
|
nOpts.mask = nOpts._mask;
|
|
@@ -311,9 +316,11 @@ class MaskElement {
|
|
|
311
316
|
|
|
312
317
|
/** */
|
|
313
318
|
}
|
|
314
|
-
|
|
315
319
|
IMask.MaskElement = MaskElement;
|
|
316
320
|
|
|
321
|
+
const KEY_Z = 90;
|
|
322
|
+
const KEY_Y = 89;
|
|
323
|
+
|
|
317
324
|
/** Bridge between HTMLElement and {@link Masked} */
|
|
318
325
|
class HTMLMaskElement extends MaskElement {
|
|
319
326
|
/** HTMLElement to use mask on */
|
|
@@ -321,53 +328,73 @@ class HTMLMaskElement extends MaskElement {
|
|
|
321
328
|
constructor(input) {
|
|
322
329
|
super();
|
|
323
330
|
this.input = input;
|
|
324
|
-
this.
|
|
331
|
+
this._onKeydown = this._onKeydown.bind(this);
|
|
332
|
+
this._onInput = this._onInput.bind(this);
|
|
333
|
+
this._onBeforeinput = this._onBeforeinput.bind(this);
|
|
334
|
+
this._onCompositionEnd = this._onCompositionEnd.bind(this);
|
|
325
335
|
}
|
|
326
336
|
get rootElement() {
|
|
327
|
-
|
|
328
|
-
return (_this$input$getRootNo = (_this$input$getRootNo2 = (_this$input = this.input).getRootNode) == null ? void 0 : _this$input$getRootNo2.call(_this$input)) != null ? _this$input$getRootNo : document;
|
|
337
|
+
return this.input.getRootNode?.() ?? document;
|
|
329
338
|
}
|
|
330
339
|
|
|
331
|
-
/**
|
|
332
|
-
Is element in focus
|
|
333
|
-
*/
|
|
340
|
+
/** Is element in focus */
|
|
334
341
|
get isActive() {
|
|
335
342
|
return this.input === this.rootElement.activeElement;
|
|
336
343
|
}
|
|
337
344
|
|
|
338
|
-
/**
|
|
339
|
-
Binds HTMLElement events to mask internal events
|
|
340
|
-
*/
|
|
345
|
+
/** Binds HTMLElement events to mask internal events */
|
|
341
346
|
bindEvents(handlers) {
|
|
342
|
-
|
|
347
|
+
this.input.addEventListener('keydown', this._onKeydown);
|
|
348
|
+
this.input.addEventListener('input', this._onInput);
|
|
349
|
+
this.input.addEventListener('beforeinput', this._onBeforeinput);
|
|
350
|
+
this.input.addEventListener('compositionend', this._onCompositionEnd);
|
|
351
|
+
this.input.addEventListener('drop', handlers.drop);
|
|
352
|
+
this.input.addEventListener('click', handlers.click);
|
|
353
|
+
this.input.addEventListener('focus', handlers.focus);
|
|
354
|
+
this.input.addEventListener('blur', handlers.commit);
|
|
355
|
+
this._handlers = handlers;
|
|
343
356
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
357
|
+
_onKeydown(e) {
|
|
358
|
+
if (this._handlers.redo && (e.keyCode === KEY_Z && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === KEY_Y && e.ctrlKey)) {
|
|
359
|
+
e.preventDefault();
|
|
360
|
+
return this._handlers.redo(e);
|
|
361
|
+
}
|
|
362
|
+
if (this._handlers.undo && e.keyCode === KEY_Z && (e.metaKey || e.ctrlKey)) {
|
|
363
|
+
e.preventDefault();
|
|
364
|
+
return this._handlers.undo(e);
|
|
365
|
+
}
|
|
366
|
+
if (!e.isComposing) this._handlers.selectionChange(e);
|
|
350
367
|
}
|
|
351
|
-
|
|
352
|
-
if (this._handlers
|
|
353
|
-
|
|
354
|
-
|
|
368
|
+
_onBeforeinput(e) {
|
|
369
|
+
if (e.inputType === 'historyUndo' && this._handlers.undo) {
|
|
370
|
+
e.preventDefault();
|
|
371
|
+
return this._handlers.undo(e);
|
|
355
372
|
}
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
this._handlers
|
|
373
|
+
if (e.inputType === 'historyRedo' && this._handlers.redo) {
|
|
374
|
+
e.preventDefault();
|
|
375
|
+
return this._handlers.redo(e);
|
|
359
376
|
}
|
|
360
377
|
}
|
|
378
|
+
_onCompositionEnd(e) {
|
|
379
|
+
this._handlers.input(e);
|
|
380
|
+
}
|
|
381
|
+
_onInput(e) {
|
|
382
|
+
if (!e.isComposing) this._handlers.input(e);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** Unbinds HTMLElement events to mask internal events */
|
|
386
|
+
unbindEvents() {
|
|
387
|
+
this.input.removeEventListener('keydown', this._onKeydown);
|
|
388
|
+
this.input.removeEventListener('input', this._onInput);
|
|
389
|
+
this.input.removeEventListener('beforeinput', this._onBeforeinput);
|
|
390
|
+
this.input.removeEventListener('compositionend', this._onCompositionEnd);
|
|
391
|
+
this.input.removeEventListener('drop', this._handlers.drop);
|
|
392
|
+
this.input.removeEventListener('click', this._handlers.click);
|
|
393
|
+
this.input.removeEventListener('focus', this._handlers.focus);
|
|
394
|
+
this.input.removeEventListener('blur', this._handlers.commit);
|
|
395
|
+
this._handlers = {};
|
|
396
|
+
}
|
|
361
397
|
}
|
|
362
|
-
/** Mapping between HTMLElement events and mask internal events */
|
|
363
|
-
HTMLMaskElement.EVENTS_MAP = {
|
|
364
|
-
selectionChange: 'keydown',
|
|
365
|
-
input: 'input',
|
|
366
|
-
drop: 'drop',
|
|
367
|
-
click: 'click',
|
|
368
|
-
focus: 'focus',
|
|
369
|
-
commit: 'blur'
|
|
370
|
-
};
|
|
371
398
|
IMask.HTMLMaskElement = HTMLMaskElement;
|
|
372
399
|
|
|
373
400
|
/** Bridge between InputElement and {@link Masked} */
|
|
@@ -377,7 +404,6 @@ class HTMLInputMaskElement extends HTMLMaskElement {
|
|
|
377
404
|
constructor(input) {
|
|
378
405
|
super(input);
|
|
379
406
|
this.input = input;
|
|
380
|
-
this._handlers = {};
|
|
381
407
|
}
|
|
382
408
|
|
|
383
409
|
/** Returns InputElement selection start */
|
|
@@ -452,6 +478,39 @@ class HTMLContenteditableMaskElement extends HTMLMaskElement {
|
|
|
452
478
|
}
|
|
453
479
|
IMask.HTMLContenteditableMaskElement = HTMLContenteditableMaskElement;
|
|
454
480
|
|
|
481
|
+
class InputHistory {
|
|
482
|
+
static MAX_LENGTH = 100;
|
|
483
|
+
states = [];
|
|
484
|
+
currentIndex = 0;
|
|
485
|
+
get currentState() {
|
|
486
|
+
return this.states[this.currentIndex];
|
|
487
|
+
}
|
|
488
|
+
get isEmpty() {
|
|
489
|
+
return this.states.length === 0;
|
|
490
|
+
}
|
|
491
|
+
push(state) {
|
|
492
|
+
// if current index points before the last element then remove the future
|
|
493
|
+
if (this.currentIndex < this.states.length - 1) this.states.length = this.currentIndex + 1;
|
|
494
|
+
this.states.push(state);
|
|
495
|
+
if (this.states.length > InputHistory.MAX_LENGTH) this.states.shift();
|
|
496
|
+
this.currentIndex = this.states.length - 1;
|
|
497
|
+
}
|
|
498
|
+
go(steps) {
|
|
499
|
+
this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1);
|
|
500
|
+
return this.currentState;
|
|
501
|
+
}
|
|
502
|
+
undo() {
|
|
503
|
+
return this.go(-1);
|
|
504
|
+
}
|
|
505
|
+
redo() {
|
|
506
|
+
return this.go(+1);
|
|
507
|
+
}
|
|
508
|
+
clear() {
|
|
509
|
+
this.states.length = 0;
|
|
510
|
+
this.currentIndex = 0;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
455
514
|
/** Listens to element events and controls changes between element and {@link Masked} */
|
|
456
515
|
class InputMask {
|
|
457
516
|
/**
|
|
@@ -466,12 +525,16 @@ class InputMask {
|
|
|
466
525
|
this._listeners = {};
|
|
467
526
|
this._value = '';
|
|
468
527
|
this._unmaskedValue = '';
|
|
528
|
+
this._rawInputValue = '';
|
|
529
|
+
this.history = new InputHistory();
|
|
469
530
|
this._saveSelection = this._saveSelection.bind(this);
|
|
470
531
|
this._onInput = this._onInput.bind(this);
|
|
471
532
|
this._onChange = this._onChange.bind(this);
|
|
472
533
|
this._onDrop = this._onDrop.bind(this);
|
|
473
534
|
this._onFocus = this._onFocus.bind(this);
|
|
474
535
|
this._onClick = this._onClick.bind(this);
|
|
536
|
+
this._onUndo = this._onUndo.bind(this);
|
|
537
|
+
this._onRedo = this._onRedo.bind(this);
|
|
475
538
|
this.alignCursor = this.alignCursor.bind(this);
|
|
476
539
|
this.alignCursorFriendly = this.alignCursorFriendly.bind(this);
|
|
477
540
|
this._bindEvents();
|
|
@@ -481,8 +544,7 @@ class InputMask {
|
|
|
481
544
|
this._onChange();
|
|
482
545
|
}
|
|
483
546
|
maskEquals(mask) {
|
|
484
|
-
|
|
485
|
-
return mask == null || ((_this$masked = this.masked) == null ? void 0 : _this$masked.maskEquals(mask));
|
|
547
|
+
return mask == null || this.masked?.maskEquals(mask);
|
|
486
548
|
}
|
|
487
549
|
|
|
488
550
|
/** Masked */
|
|
@@ -512,8 +574,7 @@ class InputMask {
|
|
|
512
574
|
set value(str) {
|
|
513
575
|
if (this.value === str) return;
|
|
514
576
|
this.masked.value = str;
|
|
515
|
-
this.updateControl();
|
|
516
|
-
this.alignCursor();
|
|
577
|
+
this.updateControl('auto');
|
|
517
578
|
}
|
|
518
579
|
|
|
519
580
|
/** Unmasked value */
|
|
@@ -523,6 +584,16 @@ class InputMask {
|
|
|
523
584
|
set unmaskedValue(str) {
|
|
524
585
|
if (this.unmaskedValue === str) return;
|
|
525
586
|
this.masked.unmaskedValue = str;
|
|
587
|
+
this.updateControl('auto');
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** Raw input value */
|
|
591
|
+
get rawInputValue() {
|
|
592
|
+
return this._rawInputValue;
|
|
593
|
+
}
|
|
594
|
+
set rawInputValue(str) {
|
|
595
|
+
if (this.rawInputValue === str) return;
|
|
596
|
+
this.masked.rawInputValue = str;
|
|
526
597
|
this.updateControl();
|
|
527
598
|
this.alignCursor();
|
|
528
599
|
}
|
|
@@ -534,8 +605,7 @@ class InputMask {
|
|
|
534
605
|
set typedValue(val) {
|
|
535
606
|
if (this.masked.typedValueEquals(val)) return;
|
|
536
607
|
this.masked.typedValue = val;
|
|
537
|
-
this.updateControl();
|
|
538
|
-
this.alignCursor();
|
|
608
|
+
this.updateControl('auto');
|
|
539
609
|
}
|
|
540
610
|
|
|
541
611
|
/** Display value */
|
|
@@ -551,7 +621,9 @@ class InputMask {
|
|
|
551
621
|
drop: this._onDrop,
|
|
552
622
|
click: this._onClick,
|
|
553
623
|
focus: this._onFocus,
|
|
554
|
-
commit: this._onChange
|
|
624
|
+
commit: this._onChange,
|
|
625
|
+
undo: this._onUndo,
|
|
626
|
+
redo: this._onRedo
|
|
555
627
|
});
|
|
556
628
|
}
|
|
557
629
|
|
|
@@ -588,7 +660,6 @@ class InputMask {
|
|
|
588
660
|
if (this.displayValue !== this.el.value) {
|
|
589
661
|
console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.'); // eslint-disable-line no-console
|
|
590
662
|
}
|
|
591
|
-
|
|
592
663
|
this._selection = {
|
|
593
664
|
start: this.selectionStart,
|
|
594
665
|
end: this.cursorPos
|
|
@@ -602,15 +673,25 @@ class InputMask {
|
|
|
602
673
|
}
|
|
603
674
|
|
|
604
675
|
/** Syncronizes view from model value, fires change events */
|
|
605
|
-
updateControl() {
|
|
676
|
+
updateControl(cursorPos) {
|
|
606
677
|
const newUnmaskedValue = this.masked.unmaskedValue;
|
|
607
678
|
const newValue = this.masked.value;
|
|
679
|
+
const newRawInputValue = this.masked.rawInputValue;
|
|
608
680
|
const newDisplayValue = this.displayValue;
|
|
609
|
-
const isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue;
|
|
681
|
+
const isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue || this._rawInputValue !== newRawInputValue;
|
|
610
682
|
this._unmaskedValue = newUnmaskedValue;
|
|
611
683
|
this._value = newValue;
|
|
684
|
+
this._rawInputValue = newRawInputValue;
|
|
612
685
|
if (this.el.value !== newDisplayValue) this.el.value = newDisplayValue;
|
|
686
|
+
if (cursorPos === 'auto') this.alignCursor();else if (cursorPos != null) this.cursorPos = cursorPos;
|
|
613
687
|
if (isChanged) this._fireChangeEvents();
|
|
688
|
+
if (!this._historyChanging && (isChanged || this.history.isEmpty)) this.history.push({
|
|
689
|
+
unmaskedValue: newUnmaskedValue,
|
|
690
|
+
selection: {
|
|
691
|
+
start: this.selectionStart,
|
|
692
|
+
end: this.cursorPos
|
|
693
|
+
}
|
|
694
|
+
});
|
|
614
695
|
}
|
|
615
696
|
|
|
616
697
|
/** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
|
|
@@ -618,9 +699,10 @@ class InputMask {
|
|
|
618
699
|
const {
|
|
619
700
|
mask,
|
|
620
701
|
...restOpts
|
|
621
|
-
} = opts;
|
|
702
|
+
} = opts; // TODO types, yes, mask is optional
|
|
703
|
+
|
|
622
704
|
const updateMask = !this.maskEquals(mask);
|
|
623
|
-
const updateOpts =
|
|
705
|
+
const updateOpts = this.masked.optionsIsChanged(restOpts);
|
|
624
706
|
if (updateMask) this.mask = mask;
|
|
625
707
|
if (updateOpts) this.masked.updateOptions(restOpts); // TODO
|
|
626
708
|
|
|
@@ -695,9 +777,6 @@ class InputMask {
|
|
|
695
777
|
_onInput(e) {
|
|
696
778
|
this._inputEvent = e;
|
|
697
779
|
this._abortUpdateCursor();
|
|
698
|
-
|
|
699
|
-
// fix strange IE behavior
|
|
700
|
-
if (!this._selection) return this.updateValue();
|
|
701
780
|
const details = new ActionDetails({
|
|
702
781
|
// new state
|
|
703
782
|
value: this.el.value,
|
|
@@ -717,8 +796,7 @@ class InputMask {
|
|
|
717
796
|
const removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE;
|
|
718
797
|
let cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection);
|
|
719
798
|
if (removeDirection !== DIRECTION.NONE) cursorPos = this.masked.nearestInputPos(cursorPos, DIRECTION.NONE);
|
|
720
|
-
this.updateControl();
|
|
721
|
-
this.updateCursor(cursorPos);
|
|
799
|
+
this.updateControl(cursorPos);
|
|
722
800
|
delete this._inputEvent;
|
|
723
801
|
}
|
|
724
802
|
|
|
@@ -747,6 +825,20 @@ class InputMask {
|
|
|
747
825
|
_onClick(ev) {
|
|
748
826
|
this.alignCursorFriendly();
|
|
749
827
|
}
|
|
828
|
+
_onUndo() {
|
|
829
|
+
this._applyHistoryState(this.history.undo());
|
|
830
|
+
}
|
|
831
|
+
_onRedo() {
|
|
832
|
+
this._applyHistoryState(this.history.redo());
|
|
833
|
+
}
|
|
834
|
+
_applyHistoryState(state) {
|
|
835
|
+
if (!state) return;
|
|
836
|
+
this._historyChanging = true;
|
|
837
|
+
this.unmaskedValue = state.unmaskedValue;
|
|
838
|
+
this.el.select(state.selection.start, state.selection.end);
|
|
839
|
+
this._saveSelection();
|
|
840
|
+
this._historyChanging = false;
|
|
841
|
+
}
|
|
750
842
|
|
|
751
843
|
/** Unbind view events and removes element reference */
|
|
752
844
|
destroy() {
|
|
@@ -857,6 +949,11 @@ class ContinuousTailDetails {
|
|
|
857
949
|
|
|
858
950
|
/** Provides common masking stuff */
|
|
859
951
|
class Masked {
|
|
952
|
+
static DEFAULTS = {
|
|
953
|
+
skipInvalid: true
|
|
954
|
+
};
|
|
955
|
+
static EMPTY_VALUES = [undefined, null, ''];
|
|
956
|
+
|
|
860
957
|
/** */
|
|
861
958
|
|
|
862
959
|
/** */
|
|
@@ -892,7 +989,7 @@ class Masked {
|
|
|
892
989
|
|
|
893
990
|
/** Sets and applies new options */
|
|
894
991
|
updateOptions(opts) {
|
|
895
|
-
if (!
|
|
992
|
+
if (!this.optionsIsChanged(opts)) return;
|
|
896
993
|
this.withValueRefresh(this._update.bind(this, opts));
|
|
897
994
|
}
|
|
898
995
|
|
|
@@ -1034,7 +1131,7 @@ class Masked {
|
|
|
1034
1131
|
const consistentState = this.state;
|
|
1035
1132
|
let details;
|
|
1036
1133
|
[ch, details] = this.doPrepareChar(ch, flags);
|
|
1037
|
-
details = details.aggregate(this._appendCharRaw(ch, flags));
|
|
1134
|
+
if (ch) details = details.aggregate(this._appendCharRaw(ch, flags));
|
|
1038
1135
|
if (details.inserted) {
|
|
1039
1136
|
let consistentTail;
|
|
1040
1137
|
let appended = this.doValidate(flags) !== false;
|
|
@@ -1043,18 +1140,22 @@ class Masked {
|
|
|
1043
1140
|
const beforeTailState = this.state;
|
|
1044
1141
|
if (this.overwrite === true) {
|
|
1045
1142
|
consistentTail = checkTail.state;
|
|
1046
|
-
|
|
1143
|
+
for (let i = 0; i < details.rawInserted.length; ++i) {
|
|
1144
|
+
checkTail.unshift(this.displayValue.length - details.tailShift);
|
|
1145
|
+
}
|
|
1047
1146
|
}
|
|
1048
1147
|
let tailDetails = this.appendTail(checkTail);
|
|
1049
|
-
appended = tailDetails.rawInserted === checkTail.toString();
|
|
1148
|
+
appended = tailDetails.rawInserted.length === checkTail.toString().length;
|
|
1050
1149
|
|
|
1051
1150
|
// not ok, try shift
|
|
1052
1151
|
if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') {
|
|
1053
1152
|
this.state = beforeTailState;
|
|
1054
1153
|
consistentTail = checkTail.state;
|
|
1055
|
-
|
|
1154
|
+
for (let i = 0; i < details.rawInserted.length; ++i) {
|
|
1155
|
+
checkTail.shift();
|
|
1156
|
+
}
|
|
1056
1157
|
tailDetails = this.appendTail(checkTail);
|
|
1057
|
-
appended = tailDetails.rawInserted === checkTail.toString();
|
|
1158
|
+
appended = tailDetails.rawInserted.length === checkTail.toString().length;
|
|
1058
1159
|
}
|
|
1059
1160
|
|
|
1060
1161
|
// if ok, rollback state after tail
|
|
@@ -1085,7 +1186,7 @@ class Masked {
|
|
|
1085
1186
|
append(str, flags, tail) {
|
|
1086
1187
|
if (!isString(str)) throw new Error('value should be string');
|
|
1087
1188
|
const checkTail = isString(tail) ? new ContinuousTailDetails(String(tail)) : tail;
|
|
1088
|
-
if (flags
|
|
1189
|
+
if (flags?.tail) flags._beforeTailState = this.state;
|
|
1089
1190
|
let details;
|
|
1090
1191
|
[str, details] = this.doPrepare(str, flags);
|
|
1091
1192
|
for (let ci = 0; ci < str.length; ++ci) {
|
|
@@ -1093,7 +1194,7 @@ class Masked {
|
|
|
1093
1194
|
if (!d.rawInserted && !this.doSkipInvalid(str[ci], flags, checkTail)) break;
|
|
1094
1195
|
details.aggregate(d);
|
|
1095
1196
|
}
|
|
1096
|
-
if ((this.eager === true || this.eager === 'append') && flags
|
|
1197
|
+
if ((this.eager === true || this.eager === 'append') && flags?.input && str) {
|
|
1097
1198
|
details.aggregate(this._appendEager());
|
|
1098
1199
|
}
|
|
1099
1200
|
|
|
@@ -1104,7 +1205,6 @@ class Masked {
|
|
|
1104
1205
|
// but it causes bugs when one append calls another (when dynamic dispatch set rawInputValue)
|
|
1105
1206
|
// this._resetBeforeTailState();
|
|
1106
1207
|
}
|
|
1107
|
-
|
|
1108
1208
|
return details;
|
|
1109
1209
|
}
|
|
1110
1210
|
remove(fromPos, toPos) {
|
|
@@ -1129,6 +1229,7 @@ class Masked {
|
|
|
1129
1229
|
// append lost trailing chars at the end
|
|
1130
1230
|
if (this.value && this.value !== value && value.indexOf(this.value) === 0) {
|
|
1131
1231
|
this.append(value.slice(this.displayValue.length), {}, '');
|
|
1232
|
+
this.doCommit();
|
|
1132
1233
|
}
|
|
1133
1234
|
delete this._refreshing;
|
|
1134
1235
|
return ret;
|
|
@@ -1218,15 +1319,14 @@ class Masked {
|
|
|
1218
1319
|
maskEquals(mask) {
|
|
1219
1320
|
return this.mask === mask;
|
|
1220
1321
|
}
|
|
1322
|
+
optionsIsChanged(opts) {
|
|
1323
|
+
return !objectIncludes(this, opts);
|
|
1324
|
+
}
|
|
1221
1325
|
typedValueEquals(value) {
|
|
1222
1326
|
const tval = this.typedValue;
|
|
1223
1327
|
return value === tval || Masked.EMPTY_VALUES.includes(value) && Masked.EMPTY_VALUES.includes(tval) || (this.format ? this.format(value, this) === this.format(this.typedValue, this) : false);
|
|
1224
1328
|
}
|
|
1225
1329
|
}
|
|
1226
|
-
Masked.DEFAULTS = {
|
|
1227
|
-
skipInvalid: true
|
|
1228
|
-
};
|
|
1229
|
-
Masked.EMPTY_VALUES = [undefined, null, ''];
|
|
1230
1330
|
IMask.Masked = Masked;
|
|
1231
1331
|
|
|
1232
1332
|
class ChunksTailDetails {
|
|
@@ -1441,11 +1541,9 @@ class PatternCursor {
|
|
|
1441
1541
|
this.offset = this.block.displayValue.length; // TODO this is stupid type error, `block` depends on index that was changed above
|
|
1442
1542
|
}
|
|
1443
1543
|
}
|
|
1444
|
-
|
|
1445
1544
|
_pushLeft(fn) {
|
|
1446
1545
|
this.pushState();
|
|
1447
|
-
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset =
|
|
1448
|
-
var _this$block;
|
|
1546
|
+
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = this.block?.displayValue.length || 0) {
|
|
1449
1547
|
if (fn()) return this.ok = true;
|
|
1450
1548
|
}
|
|
1451
1549
|
return this.ok = false;
|
|
@@ -1655,6 +1753,13 @@ class PatternFixedDefinition {
|
|
|
1655
1753
|
}
|
|
1656
1754
|
|
|
1657
1755
|
class PatternInputDefinition {
|
|
1756
|
+
static DEFAULT_DEFINITIONS = {
|
|
1757
|
+
'0': /\d/,
|
|
1758
|
+
'a': /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
1759
|
+
// http://stackoverflow.com/a/22075070
|
|
1760
|
+
'*': /./
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1658
1763
|
/** */
|
|
1659
1764
|
|
|
1660
1765
|
/** */
|
|
@@ -1818,19 +1923,12 @@ class PatternInputDefinition {
|
|
|
1818
1923
|
this.isFilled = state.isFilled;
|
|
1819
1924
|
}
|
|
1820
1925
|
currentMaskFlags(flags) {
|
|
1821
|
-
var _flags$_beforeTailSta;
|
|
1822
1926
|
return {
|
|
1823
1927
|
...flags,
|
|
1824
|
-
_beforeTailState:
|
|
1928
|
+
_beforeTailState: flags?._beforeTailState?.masked || flags?._beforeTailState
|
|
1825
1929
|
};
|
|
1826
1930
|
}
|
|
1827
1931
|
}
|
|
1828
|
-
PatternInputDefinition.DEFAULT_DEFINITIONS = {
|
|
1829
|
-
'0': /\d/,
|
|
1830
|
-
'a': /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
1831
|
-
// http://stackoverflow.com/a/22075070
|
|
1832
|
-
'*': /./
|
|
1833
|
-
};
|
|
1834
1932
|
|
|
1835
1933
|
/** Masking by RegExp */
|
|
1836
1934
|
class MaskedRegExp extends Masked {
|
|
@@ -1855,6 +1953,15 @@ IMask.MaskedRegExp = MaskedRegExp;
|
|
|
1855
1953
|
|
|
1856
1954
|
/** Pattern mask */
|
|
1857
1955
|
class MaskedPattern extends Masked {
|
|
1956
|
+
static DEFAULTS = {
|
|
1957
|
+
lazy: true,
|
|
1958
|
+
placeholderChar: '_'
|
|
1959
|
+
};
|
|
1960
|
+
static STOP_CHAR = '`';
|
|
1961
|
+
static ESCAPE_CHAR = '\\';
|
|
1962
|
+
static InputDefinition = PatternInputDefinition;
|
|
1963
|
+
static FixedDefinition = PatternFixedDefinition;
|
|
1964
|
+
|
|
1858
1965
|
/** */
|
|
1859
1966
|
|
|
1860
1967
|
/** */
|
|
@@ -1875,7 +1982,7 @@ class MaskedPattern extends Masked {
|
|
|
1875
1982
|
super({
|
|
1876
1983
|
...MaskedPattern.DEFAULTS,
|
|
1877
1984
|
...opts,
|
|
1878
|
-
definitions: Object.assign({}, PatternInputDefinition.DEFAULT_DEFINITIONS, opts
|
|
1985
|
+
definitions: Object.assign({}, PatternInputDefinition.DEFAULT_DEFINITIONS, opts?.definitions)
|
|
1879
1986
|
});
|
|
1880
1987
|
}
|
|
1881
1988
|
updateOptions(opts) {
|
|
@@ -1907,17 +2014,20 @@ class MaskedPattern extends Masked {
|
|
|
1907
2014
|
if (bName) {
|
|
1908
2015
|
const {
|
|
1909
2016
|
expose,
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2017
|
+
repeat,
|
|
2018
|
+
...bOpts
|
|
2019
|
+
} = normalizeOpts(this.blocks[bName]); // TODO type Opts<Arg & Extra>
|
|
2020
|
+
const blockOpts = {
|
|
1913
2021
|
lazy: this.lazy,
|
|
1914
2022
|
eager: this.eager,
|
|
1915
2023
|
placeholderChar: this.placeholderChar,
|
|
1916
2024
|
displayChar: this.displayChar,
|
|
1917
2025
|
overwrite: this.overwrite,
|
|
1918
|
-
...
|
|
2026
|
+
...bOpts,
|
|
2027
|
+
repeat,
|
|
1919
2028
|
parent: this
|
|
1920
|
-
}
|
|
2029
|
+
};
|
|
2030
|
+
const maskedBlock = repeat != null ? new IMask.RepeatBlock(blockOpts /* TODO */) : createMask(blockOpts);
|
|
1921
2031
|
if (maskedBlock) {
|
|
1922
2032
|
this._blocks.push(maskedBlock);
|
|
1923
2033
|
if (expose) this.exposeBlock = maskedBlock;
|
|
@@ -1973,6 +2083,10 @@ class MaskedPattern extends Masked {
|
|
|
1973
2083
|
};
|
|
1974
2084
|
}
|
|
1975
2085
|
set state(state) {
|
|
2086
|
+
if (!state) {
|
|
2087
|
+
this.reset();
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
1976
2090
|
const {
|
|
1977
2091
|
_blocks,
|
|
1978
2092
|
...maskedState
|
|
@@ -2042,9 +2156,8 @@ class MaskedPattern extends Masked {
|
|
|
2042
2156
|
return super.appendTail(tail).aggregate(this._appendPlaceholder());
|
|
2043
2157
|
}
|
|
2044
2158
|
_appendEager() {
|
|
2045
|
-
var _this$_mapPosToBlock;
|
|
2046
2159
|
const details = new ChangeDetails();
|
|
2047
|
-
let startBlockIndex =
|
|
2160
|
+
let startBlockIndex = this._mapPosToBlock(this.displayValue.length)?.index;
|
|
2048
2161
|
if (startBlockIndex == null) return details;
|
|
2049
2162
|
|
|
2050
2163
|
// TODO test if it works for nested pattern masks
|
|
@@ -2063,19 +2176,14 @@ class MaskedPattern extends Masked {
|
|
|
2063
2176
|
const blockIter = this._mapPosToBlock(this.displayValue.length);
|
|
2064
2177
|
const details = new ChangeDetails();
|
|
2065
2178
|
if (!blockIter) return details;
|
|
2066
|
-
for (let bi = blockIter.index
|
|
2067
|
-
var _flags$_beforeTailSta;
|
|
2068
|
-
const block = this._blocks[bi];
|
|
2069
|
-
if (!block) break;
|
|
2179
|
+
for (let bi = blockIter.index, block; block = this._blocks[bi]; ++bi) {
|
|
2070
2180
|
const blockDetails = block._appendChar(ch, {
|
|
2071
2181
|
...flags,
|
|
2072
|
-
_beforeTailState:
|
|
2182
|
+
_beforeTailState: flags._beforeTailState?._blocks?.[bi]
|
|
2073
2183
|
});
|
|
2074
|
-
const skip = blockDetails.skip;
|
|
2075
2184
|
details.aggregate(blockDetails);
|
|
2076
|
-
if (skip || blockDetails.rawInserted) break; // go next char
|
|
2185
|
+
if (blockDetails.skip || blockDetails.rawInserted) break; // go next char
|
|
2077
2186
|
}
|
|
2078
|
-
|
|
2079
2187
|
return details;
|
|
2080
2188
|
}
|
|
2081
2189
|
extractTail(fromPos, toPos) {
|
|
@@ -2132,8 +2240,7 @@ class MaskedPattern extends Masked {
|
|
|
2132
2240
|
const endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length;
|
|
2133
2241
|
this._blocks.slice(startBlockIndex, endBlockIndex).forEach(b => {
|
|
2134
2242
|
if (!b.lazy || toBlockIndex != null) {
|
|
2135
|
-
|
|
2136
|
-
const bDetails = b._appendPlaceholder((_blocks2 = b._blocks) == null ? void 0 : _blocks2.length);
|
|
2243
|
+
const bDetails = b._appendPlaceholder(b._blocks?.length);
|
|
2137
2244
|
this._value += bDetails.inserted;
|
|
2138
2245
|
details.aggregate(bDetails);
|
|
2139
2246
|
}
|
|
@@ -2284,14 +2391,6 @@ class MaskedPattern extends Masked {
|
|
|
2284
2391
|
return indices.map(gi => this._blocks[gi]);
|
|
2285
2392
|
}
|
|
2286
2393
|
}
|
|
2287
|
-
MaskedPattern.DEFAULTS = {
|
|
2288
|
-
lazy: true,
|
|
2289
|
-
placeholderChar: '_'
|
|
2290
|
-
};
|
|
2291
|
-
MaskedPattern.STOP_CHAR = '`';
|
|
2292
|
-
MaskedPattern.ESCAPE_CHAR = '\\';
|
|
2293
|
-
MaskedPattern.InputDefinition = PatternInputDefinition;
|
|
2294
|
-
MaskedPattern.FixedDefinition = PatternFixedDefinition;
|
|
2295
2394
|
IMask.MaskedPattern = MaskedPattern;
|
|
2296
2395
|
|
|
2297
2396
|
/** Pattern which accepts ranges */
|
|
@@ -2313,7 +2412,6 @@ class MaskedRange extends MaskedPattern {
|
|
|
2313
2412
|
constructor(opts) {
|
|
2314
2413
|
super(opts); // mask will be created in _update
|
|
2315
2414
|
}
|
|
2316
|
-
|
|
2317
2415
|
updateOptions(opts) {
|
|
2318
2416
|
super.updateOptions(opts);
|
|
2319
2417
|
}
|
|
@@ -2357,7 +2455,10 @@ class MaskedRange extends MaskedPattern {
|
|
|
2357
2455
|
}
|
|
2358
2456
|
let details;
|
|
2359
2457
|
[ch, details] = super.doPrepareChar(ch.replace(/\D/g, ''), flags);
|
|
2360
|
-
if (!this.autofix || !ch)
|
|
2458
|
+
if (!this.autofix || !ch) {
|
|
2459
|
+
details.skip = !this.isComplete;
|
|
2460
|
+
return [ch, details];
|
|
2461
|
+
}
|
|
2361
2462
|
const fromStr = String(this.from).padStart(this.maxLength, '0');
|
|
2362
2463
|
const toStr = String(this.to).padStart(this.maxLength, '0');
|
|
2363
2464
|
const nextVal = this.value + ch;
|
|
@@ -2384,6 +2485,52 @@ IMask.MaskedRange = MaskedRange;
|
|
|
2384
2485
|
|
|
2385
2486
|
/** Date mask */
|
|
2386
2487
|
class MaskedDate extends MaskedPattern {
|
|
2488
|
+
static GET_DEFAULT_BLOCKS = () => ({
|
|
2489
|
+
d: {
|
|
2490
|
+
mask: MaskedRange,
|
|
2491
|
+
from: 1,
|
|
2492
|
+
to: 31,
|
|
2493
|
+
maxLength: 2
|
|
2494
|
+
},
|
|
2495
|
+
m: {
|
|
2496
|
+
mask: MaskedRange,
|
|
2497
|
+
from: 1,
|
|
2498
|
+
to: 12,
|
|
2499
|
+
maxLength: 2
|
|
2500
|
+
},
|
|
2501
|
+
Y: {
|
|
2502
|
+
mask: MaskedRange,
|
|
2503
|
+
from: 1900,
|
|
2504
|
+
to: 9999
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2507
|
+
static DEFAULTS = {
|
|
2508
|
+
mask: Date,
|
|
2509
|
+
pattern: 'd{.}`m{.}`Y',
|
|
2510
|
+
format: (date, masked) => {
|
|
2511
|
+
if (!date) return '';
|
|
2512
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
2513
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
2514
|
+
const year = date.getFullYear();
|
|
2515
|
+
return [day, month, year].join('.');
|
|
2516
|
+
},
|
|
2517
|
+
parse: (str, masked) => {
|
|
2518
|
+
const [day, month, year] = str.split('.').map(Number);
|
|
2519
|
+
return new Date(year, month - 1, day);
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
static extractPatternOptions(opts) {
|
|
2523
|
+
const {
|
|
2524
|
+
mask,
|
|
2525
|
+
pattern,
|
|
2526
|
+
...patternOpts
|
|
2527
|
+
} = opts;
|
|
2528
|
+
return {
|
|
2529
|
+
...patternOpts,
|
|
2530
|
+
mask: isString(mask) ? mask : pattern
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2387
2534
|
/** Pattern mask for date according to {@link MaskedDate#format} */
|
|
2388
2535
|
|
|
2389
2536
|
/** Start date */
|
|
@@ -2397,18 +2544,10 @@ class MaskedDate extends MaskedPattern {
|
|
|
2397
2544
|
/** Parse string to get typed value */
|
|
2398
2545
|
|
|
2399
2546
|
constructor(opts) {
|
|
2400
|
-
|
|
2401
|
-
mask,
|
|
2402
|
-
pattern,
|
|
2403
|
-
...patternOpts
|
|
2404
|
-
} = {
|
|
2547
|
+
super(MaskedDate.extractPatternOptions({
|
|
2405
2548
|
...MaskedDate.DEFAULTS,
|
|
2406
2549
|
...opts
|
|
2407
|
-
};
|
|
2408
|
-
super({
|
|
2409
|
-
...patternOpts,
|
|
2410
|
-
mask: isString(mask) ? mask : pattern
|
|
2411
|
-
});
|
|
2550
|
+
}));
|
|
2412
2551
|
}
|
|
2413
2552
|
updateOptions(opts) {
|
|
2414
2553
|
super.updateOptions(opts);
|
|
@@ -2474,45 +2613,16 @@ class MaskedDate extends MaskedPattern {
|
|
|
2474
2613
|
maskEquals(mask) {
|
|
2475
2614
|
return mask === Date || super.maskEquals(mask);
|
|
2476
2615
|
}
|
|
2477
|
-
|
|
2478
|
-
MaskedDate.
|
|
2479
|
-
d: {
|
|
2480
|
-
mask: MaskedRange,
|
|
2481
|
-
from: 1,
|
|
2482
|
-
to: 31,
|
|
2483
|
-
maxLength: 2
|
|
2484
|
-
},
|
|
2485
|
-
m: {
|
|
2486
|
-
mask: MaskedRange,
|
|
2487
|
-
from: 1,
|
|
2488
|
-
to: 12,
|
|
2489
|
-
maxLength: 2
|
|
2490
|
-
},
|
|
2491
|
-
Y: {
|
|
2492
|
-
mask: MaskedRange,
|
|
2493
|
-
from: 1900,
|
|
2494
|
-
to: 9999
|
|
2495
|
-
}
|
|
2496
|
-
});
|
|
2497
|
-
MaskedDate.DEFAULTS = {
|
|
2498
|
-
mask: Date,
|
|
2499
|
-
pattern: 'd{.}`m{.}`Y',
|
|
2500
|
-
format: (date, masked) => {
|
|
2501
|
-
if (!date) return '';
|
|
2502
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
2503
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
2504
|
-
const year = date.getFullYear();
|
|
2505
|
-
return [day, month, year].join('.');
|
|
2506
|
-
},
|
|
2507
|
-
parse: (str, masked) => {
|
|
2508
|
-
const [day, month, year] = str.split('.').map(Number);
|
|
2509
|
-
return new Date(year, month - 1, day);
|
|
2616
|
+
optionsIsChanged(opts) {
|
|
2617
|
+
return super.optionsIsChanged(MaskedDate.extractPatternOptions(opts));
|
|
2510
2618
|
}
|
|
2511
|
-
}
|
|
2619
|
+
}
|
|
2512
2620
|
IMask.MaskedDate = MaskedDate;
|
|
2513
2621
|
|
|
2514
2622
|
/** Dynamic mask for choosing appropriate mask in run-time */
|
|
2515
2623
|
class MaskedDynamic extends Masked {
|
|
2624
|
+
static DEFAULTS;
|
|
2625
|
+
|
|
2516
2626
|
/** Currently chosen mask */
|
|
2517
2627
|
|
|
2518
2628
|
/** Currently chosen mask */
|
|
@@ -2554,7 +2664,6 @@ class MaskedDynamic extends Masked {
|
|
|
2554
2664
|
// this.currentMask = this.doDispatch(''); // probably not needed but lets see
|
|
2555
2665
|
}
|
|
2556
2666
|
}
|
|
2557
|
-
|
|
2558
2667
|
_appendCharRaw(ch, flags) {
|
|
2559
2668
|
if (flags === void 0) {
|
|
2560
2669
|
flags = {};
|
|
@@ -2581,7 +2690,7 @@ class MaskedDynamic extends Masked {
|
|
|
2581
2690
|
const tailValue = inputValue.slice(insertValue.length);
|
|
2582
2691
|
const prevMask = this.currentMask;
|
|
2583
2692
|
const details = new ChangeDetails();
|
|
2584
|
-
const prevMaskState = prevMask
|
|
2693
|
+
const prevMaskState = prevMask?.state;
|
|
2585
2694
|
|
|
2586
2695
|
// clone flags to prevent overwriting `_beforeTailState`
|
|
2587
2696
|
this.currentMask = this.doDispatch(appended, {
|
|
@@ -2633,10 +2742,9 @@ class MaskedDynamic extends Masked {
|
|
|
2633
2742
|
return details.aggregate(this.currentMask ? this.currentMask.appendTail(tail) : super.appendTail(tail));
|
|
2634
2743
|
}
|
|
2635
2744
|
currentMaskFlags(flags) {
|
|
2636
|
-
var _flags$_beforeTailSta, _flags$_beforeTailSta2;
|
|
2637
2745
|
return {
|
|
2638
2746
|
...flags,
|
|
2639
|
-
_beforeTailState:
|
|
2747
|
+
_beforeTailState: flags._beforeTailState?.currentMaskRef === this.currentMask && flags._beforeTailState?.currentMask || flags._beforeTailState
|
|
2640
2748
|
};
|
|
2641
2749
|
}
|
|
2642
2750
|
doDispatch(appended, flags, tail) {
|
|
@@ -2676,8 +2784,7 @@ class MaskedDynamic extends Masked {
|
|
|
2676
2784
|
return [s, details];
|
|
2677
2785
|
}
|
|
2678
2786
|
reset() {
|
|
2679
|
-
|
|
2680
|
-
(_this$currentMask = this.currentMask) == null ? void 0 : _this$currentMask.reset();
|
|
2787
|
+
this.currentMask?.reset();
|
|
2681
2788
|
this.compiledMasks.forEach(m => m.reset());
|
|
2682
2789
|
}
|
|
2683
2790
|
get value() {
|
|
@@ -2723,12 +2830,10 @@ class MaskedDynamic extends Masked {
|
|
|
2723
2830
|
return this.currentMask ? this.currentMask.displayValue : '';
|
|
2724
2831
|
}
|
|
2725
2832
|
get isComplete() {
|
|
2726
|
-
|
|
2727
|
-
return Boolean((_this$currentMask2 = this.currentMask) == null ? void 0 : _this$currentMask2.isComplete);
|
|
2833
|
+
return Boolean(this.currentMask?.isComplete);
|
|
2728
2834
|
}
|
|
2729
2835
|
get isFilled() {
|
|
2730
|
-
|
|
2731
|
-
return Boolean((_this$currentMask3 = this.currentMask) == null ? void 0 : _this$currentMask3.isFilled);
|
|
2836
|
+
return Boolean(this.currentMask?.isFilled);
|
|
2732
2837
|
}
|
|
2733
2838
|
remove(fromPos, toPos) {
|
|
2734
2839
|
const details = new ChangeDetails();
|
|
@@ -2740,13 +2845,12 @@ class MaskedDynamic extends Masked {
|
|
|
2740
2845
|
return details;
|
|
2741
2846
|
}
|
|
2742
2847
|
get state() {
|
|
2743
|
-
var _this$currentMask4;
|
|
2744
2848
|
return {
|
|
2745
2849
|
...super.state,
|
|
2746
2850
|
_rawInputValue: this.rawInputValue,
|
|
2747
2851
|
compiledMasks: this.compiledMasks.map(m => m.state),
|
|
2748
2852
|
currentMaskRef: this.currentMask,
|
|
2749
|
-
currentMask:
|
|
2853
|
+
currentMask: this.currentMask?.state
|
|
2750
2854
|
};
|
|
2751
2855
|
}
|
|
2752
2856
|
set state(state) {
|
|
@@ -2805,11 +2909,9 @@ class MaskedDynamic extends Masked {
|
|
|
2805
2909
|
}) : super.maskEquals(mask);
|
|
2806
2910
|
}
|
|
2807
2911
|
typedValueEquals(value) {
|
|
2808
|
-
|
|
2809
|
-
return Boolean((_this$currentMask5 = this.currentMask) == null ? void 0 : _this$currentMask5.typedValueEquals(value));
|
|
2912
|
+
return Boolean(this.currentMask?.typedValueEquals(value));
|
|
2810
2913
|
}
|
|
2811
2914
|
}
|
|
2812
|
-
MaskedDynamic.DEFAULTS = void 0;
|
|
2813
2915
|
MaskedDynamic.DEFAULTS = {
|
|
2814
2916
|
dispatch: (appended, masked, flags, tail) => {
|
|
2815
2917
|
if (!masked.compiledMasks.length) return;
|
|
@@ -2848,7 +2950,6 @@ class MaskedEnum extends MaskedPattern {
|
|
|
2848
2950
|
constructor(opts) {
|
|
2849
2951
|
super(opts); // mask will be created in _update
|
|
2850
2952
|
}
|
|
2851
|
-
|
|
2852
2953
|
updateOptions(opts) {
|
|
2853
2954
|
super.updateOptions(opts);
|
|
2854
2955
|
}
|
|
@@ -2897,6 +2998,25 @@ IMask.MaskedFunction = MaskedFunction;
|
|
|
2897
2998
|
|
|
2898
2999
|
/** Number mask */
|
|
2899
3000
|
class MaskedNumber extends Masked {
|
|
3001
|
+
static UNMASKED_RADIX = '.';
|
|
3002
|
+
static EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
|
|
3003
|
+
static DEFAULTS = {
|
|
3004
|
+
mask: Number,
|
|
3005
|
+
radix: ',',
|
|
3006
|
+
thousandsSeparator: '',
|
|
3007
|
+
mapToRadix: [MaskedNumber.UNMASKED_RADIX],
|
|
3008
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
3009
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
3010
|
+
scale: 2,
|
|
3011
|
+
normalizeZeros: true,
|
|
3012
|
+
padFractionalZeros: false,
|
|
3013
|
+
parse: Number,
|
|
3014
|
+
format: n => n.toLocaleString('en-US', {
|
|
3015
|
+
useGrouping: false,
|
|
3016
|
+
maximumFractionDigits: 20
|
|
3017
|
+
})
|
|
3018
|
+
};
|
|
3019
|
+
|
|
2900
3020
|
/** Single char */
|
|
2901
3021
|
|
|
2902
3022
|
/** Single char */
|
|
@@ -2939,9 +3059,9 @@ class MaskedNumber extends Masked {
|
|
|
2939
3059
|
_updateRegExps() {
|
|
2940
3060
|
const start = '^' + (this.allowNegative ? '[+|\\-]?' : '');
|
|
2941
3061
|
const mid = '\\d*';
|
|
2942
|
-
const end = (this.scale ?
|
|
3062
|
+
const end = (this.scale ? `(${escapeRegExp(this.radix)}\\d{0,${this.scale}})?` : '') + '$';
|
|
2943
3063
|
this._numberRegExp = new RegExp(start + mid + end);
|
|
2944
|
-
this._mapToRadixRegExp = new RegExp(
|
|
3064
|
+
this._mapToRadixRegExp = new RegExp(`[${this.mapToRadix.map(escapeRegExp).join('')}]`, 'g');
|
|
2945
3065
|
this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), 'g');
|
|
2946
3066
|
}
|
|
2947
3067
|
_removeThousandsSeparators(value) {
|
|
@@ -3116,7 +3236,6 @@ class MaskedNumber extends Masked {
|
|
|
3116
3236
|
parts[1] = parts[1].replace(/0*$/, ''); // remove trailing zeros
|
|
3117
3237
|
if (!parts[1].length) parts.length = 1; // remove fractional
|
|
3118
3238
|
}
|
|
3119
|
-
|
|
3120
3239
|
return this._insertThousandsSeparators(parts.join(this.radix));
|
|
3121
3240
|
}
|
|
3122
3241
|
_padFractionalZeros(value) {
|
|
@@ -3153,17 +3272,9 @@ class MaskedNumber extends Masked {
|
|
|
3153
3272
|
set number(number) {
|
|
3154
3273
|
this.typedValue = number;
|
|
3155
3274
|
}
|
|
3156
|
-
|
|
3157
|
-
/**
|
|
3158
|
-
Is negative allowed
|
|
3159
|
-
*/
|
|
3160
3275
|
get allowNegative() {
|
|
3161
3276
|
return this.min != null && this.min < 0 || this.max != null && this.max < 0;
|
|
3162
3277
|
}
|
|
3163
|
-
|
|
3164
|
-
/**
|
|
3165
|
-
Is positive allowed
|
|
3166
|
-
*/
|
|
3167
3278
|
get allowPositive() {
|
|
3168
3279
|
return this.min != null && this.min > 0 || this.max != null && this.max > 0;
|
|
3169
3280
|
}
|
|
@@ -3173,24 +3284,6 @@ class MaskedNumber extends Masked {
|
|
|
3173
3284
|
return (super.typedValueEquals(value) || MaskedNumber.EMPTY_VALUES.includes(value) && MaskedNumber.EMPTY_VALUES.includes(this.typedValue)) && !(value === 0 && this.value === '');
|
|
3174
3285
|
}
|
|
3175
3286
|
}
|
|
3176
|
-
MaskedNumber.UNMASKED_RADIX = '.';
|
|
3177
|
-
MaskedNumber.EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
|
|
3178
|
-
MaskedNumber.DEFAULTS = {
|
|
3179
|
-
mask: Number,
|
|
3180
|
-
radix: ',',
|
|
3181
|
-
thousandsSeparator: '',
|
|
3182
|
-
mapToRadix: [MaskedNumber.UNMASKED_RADIX],
|
|
3183
|
-
min: Number.MIN_SAFE_INTEGER,
|
|
3184
|
-
max: Number.MAX_SAFE_INTEGER,
|
|
3185
|
-
scale: 2,
|
|
3186
|
-
normalizeZeros: true,
|
|
3187
|
-
padFractionalZeros: false,
|
|
3188
|
-
parse: Number,
|
|
3189
|
-
format: n => n.toLocaleString('en-US', {
|
|
3190
|
-
useGrouping: false,
|
|
3191
|
-
maximumFractionDigits: 20
|
|
3192
|
-
})
|
|
3193
|
-
};
|
|
3194
3287
|
IMask.MaskedNumber = MaskedNumber;
|
|
3195
3288
|
|
|
3196
3289
|
/** Mask pipe source and destination types */
|
|
@@ -3222,6 +3315,124 @@ IMask.PIPE_TYPE = PIPE_TYPE;
|
|
|
3222
3315
|
IMask.createPipe = createPipe;
|
|
3223
3316
|
IMask.pipe = pipe;
|
|
3224
3317
|
|
|
3318
|
+
/** Pattern mask */
|
|
3319
|
+
class RepeatBlock extends MaskedPattern {
|
|
3320
|
+
get repeatFrom() {
|
|
3321
|
+
return (Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === Infinity ? 0 : this.repeat) ?? 0;
|
|
3322
|
+
}
|
|
3323
|
+
get repeatTo() {
|
|
3324
|
+
return (Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) ?? Infinity;
|
|
3325
|
+
}
|
|
3326
|
+
constructor(opts) {
|
|
3327
|
+
super(opts);
|
|
3328
|
+
}
|
|
3329
|
+
updateOptions(opts) {
|
|
3330
|
+
super.updateOptions(opts);
|
|
3331
|
+
}
|
|
3332
|
+
_update(opts) {
|
|
3333
|
+
const {
|
|
3334
|
+
repeat,
|
|
3335
|
+
...blockOpts
|
|
3336
|
+
} = normalizeOpts(opts); // TODO type
|
|
3337
|
+
this._blockOpts = Object.assign({}, this._blockOpts, blockOpts);
|
|
3338
|
+
const block = createMask(this._blockOpts);
|
|
3339
|
+
this.repeat = repeat ?? block.repeat ?? this.repeat ?? Infinity; // TODO type
|
|
3340
|
+
|
|
3341
|
+
super._update({
|
|
3342
|
+
mask: 'm'.repeat(Math.max(this.repeatTo === Infinity && this._blocks?.length || 0, this.repeatFrom)),
|
|
3343
|
+
blocks: {
|
|
3344
|
+
m: block
|
|
3345
|
+
},
|
|
3346
|
+
eager: block.eager,
|
|
3347
|
+
overwrite: block.overwrite,
|
|
3348
|
+
skipInvalid: block.skipInvalid,
|
|
3349
|
+
lazy: block.lazy,
|
|
3350
|
+
placeholderChar: block.placeholderChar,
|
|
3351
|
+
displayChar: block.displayChar
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
_allocateBlock(bi) {
|
|
3355
|
+
if (bi < this._blocks.length) return this._blocks[bi];
|
|
3356
|
+
if (this.repeatTo === Infinity || this._blocks.length < this.repeatTo) {
|
|
3357
|
+
this._blocks.push(createMask(this._blockOpts));
|
|
3358
|
+
this.mask += 'm';
|
|
3359
|
+
return this._blocks[this._blocks.length - 1];
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
_appendCharRaw(ch, flags) {
|
|
3363
|
+
if (flags === void 0) {
|
|
3364
|
+
flags = {};
|
|
3365
|
+
}
|
|
3366
|
+
const details = new ChangeDetails();
|
|
3367
|
+
for (let bi = this._mapPosToBlock(this.displayValue.length)?.index ?? Math.max(this._blocks.length - 1, 0), block, allocated;
|
|
3368
|
+
// try to get a block or
|
|
3369
|
+
// try to allocate a new block if not allocated already
|
|
3370
|
+
block = this._blocks[bi] ?? (allocated = !allocated && this._allocateBlock(bi)); ++bi) {
|
|
3371
|
+
const blockDetails = block._appendChar(ch, {
|
|
3372
|
+
...flags,
|
|
3373
|
+
_beforeTailState: flags._beforeTailState?._blocks?.[bi]
|
|
3374
|
+
});
|
|
3375
|
+
if (blockDetails.skip && allocated) {
|
|
3376
|
+
// remove the last allocated block and break
|
|
3377
|
+
this._blocks.pop();
|
|
3378
|
+
this.mask = this.mask.slice(1);
|
|
3379
|
+
break;
|
|
3380
|
+
}
|
|
3381
|
+
details.aggregate(blockDetails);
|
|
3382
|
+
if (blockDetails.skip || blockDetails.rawInserted) break; // go next char
|
|
3383
|
+
}
|
|
3384
|
+
return details;
|
|
3385
|
+
}
|
|
3386
|
+
_trimEmptyTail(fromPos, toPos) {
|
|
3387
|
+
if (fromPos === void 0) {
|
|
3388
|
+
fromPos = 0;
|
|
3389
|
+
}
|
|
3390
|
+
const firstBlockIndex = Math.max(this._mapPosToBlock(fromPos)?.index || 0, this.repeatFrom, 0);
|
|
3391
|
+
let lastBlockIndex;
|
|
3392
|
+
if (toPos != null) lastBlockIndex = this._mapPosToBlock(toPos)?.index;
|
|
3393
|
+
if (lastBlockIndex == null) lastBlockIndex = this._blocks.length - 1;
|
|
3394
|
+
let removeCount = 0;
|
|
3395
|
+
for (let blockIndex = lastBlockIndex; firstBlockIndex <= blockIndex; --blockIndex, ++removeCount) {
|
|
3396
|
+
if (this._blocks[blockIndex].unmaskedValue) break;
|
|
3397
|
+
}
|
|
3398
|
+
if (removeCount) {
|
|
3399
|
+
this._blocks.splice(lastBlockIndex - removeCount + 1, removeCount);
|
|
3400
|
+
this.mask = this.mask.slice(removeCount);
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
reset() {
|
|
3404
|
+
super.reset();
|
|
3405
|
+
this._trimEmptyTail();
|
|
3406
|
+
}
|
|
3407
|
+
remove(fromPos, toPos) {
|
|
3408
|
+
if (fromPos === void 0) {
|
|
3409
|
+
fromPos = 0;
|
|
3410
|
+
}
|
|
3411
|
+
if (toPos === void 0) {
|
|
3412
|
+
toPos = this.displayValue.length;
|
|
3413
|
+
}
|
|
3414
|
+
const removeDetails = super.remove(fromPos, toPos);
|
|
3415
|
+
this._trimEmptyTail(fromPos, toPos);
|
|
3416
|
+
return removeDetails;
|
|
3417
|
+
}
|
|
3418
|
+
totalInputPositions(fromPos, toPos) {
|
|
3419
|
+
if (fromPos === void 0) {
|
|
3420
|
+
fromPos = 0;
|
|
3421
|
+
}
|
|
3422
|
+
if (toPos == null && this.repeatTo === Infinity) return Infinity;
|
|
3423
|
+
return super.totalInputPositions(fromPos, toPos);
|
|
3424
|
+
}
|
|
3425
|
+
get state() {
|
|
3426
|
+
return super.state;
|
|
3427
|
+
}
|
|
3428
|
+
set state(state) {
|
|
3429
|
+
this._blocks.length = state._blocks.length;
|
|
3430
|
+
this.mask = this.mask.slice(0, this._blocks.length);
|
|
3431
|
+
super.state = state;
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
IMask.RepeatBlock = RepeatBlock;
|
|
3435
|
+
|
|
3225
3436
|
try {
|
|
3226
3437
|
globalThis.IMask = IMask;
|
|
3227
3438
|
} catch {}
|