@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
|
@@ -7,8 +7,7 @@ function isString(str) {
|
|
|
7
7
|
|
|
8
8
|
/** Checks if value is object */
|
|
9
9
|
function isObject(obj) {
|
|
10
|
-
|
|
11
|
-
return typeof obj === 'object' && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === 'Object';
|
|
10
|
+
return typeof obj === 'object' && obj != null && obj?.constructor?.name === 'Object';
|
|
12
11
|
}
|
|
13
12
|
function pick(obj, keys) {
|
|
14
13
|
if (Array.isArray(keys)) return pick(obj, (_, k) => keys.includes(k));
|
|
@@ -96,6 +95,11 @@ class ActionDetails {
|
|
|
96
95
|
while (this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos)) {
|
|
97
96
|
--this.oldSelection.start;
|
|
98
97
|
}
|
|
98
|
+
|
|
99
|
+
// double check right part
|
|
100
|
+
while (this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end)) {
|
|
101
|
+
if (this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end) ++this.oldSelection.end;else ++this.cursorPos;
|
|
102
|
+
}
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
/** Start changing position */
|
|
@@ -179,6 +183,7 @@ function IMask(el, opts) {
|
|
|
179
183
|
// export function maskedClass<Mask extends typeof Masked> (mask: Mask): Mask;
|
|
180
184
|
// export function maskedClass(mask: RegExp): typeof MaskedRegExp;
|
|
181
185
|
// export function maskedClass(mask: (value: string, ...args: any[]) => boolean): typeof MaskedFunction;
|
|
186
|
+
|
|
182
187
|
/** Get Masked class by mask type */
|
|
183
188
|
function maskedClass(mask) /* TODO */{
|
|
184
189
|
if (mask == null) throw new Error('mask property should be defined');
|
|
@@ -259,7 +264,7 @@ function createMask(opts) {
|
|
|
259
264
|
if (IMask.Masked && opts instanceof IMask.Masked) return opts;
|
|
260
265
|
const nOpts = normalizeOpts(opts);
|
|
261
266
|
const MaskedClass = maskedClass(nOpts.mask);
|
|
262
|
-
if (!MaskedClass) throw new Error(
|
|
267
|
+
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.`);
|
|
263
268
|
if (nOpts.mask === MaskedClass) delete nOpts.mask;
|
|
264
269
|
if (nOpts._mask) {
|
|
265
270
|
nOpts.mask = nOpts._mask;
|
|
@@ -313,9 +318,11 @@ class MaskElement {
|
|
|
313
318
|
|
|
314
319
|
/** */
|
|
315
320
|
}
|
|
316
|
-
|
|
317
321
|
IMask.MaskElement = MaskElement;
|
|
318
322
|
|
|
323
|
+
const KEY_Z = 90;
|
|
324
|
+
const KEY_Y = 89;
|
|
325
|
+
|
|
319
326
|
/** Bridge between HTMLElement and {@link Masked} */
|
|
320
327
|
class HTMLMaskElement extends MaskElement {
|
|
321
328
|
/** HTMLElement to use mask on */
|
|
@@ -323,53 +330,73 @@ class HTMLMaskElement extends MaskElement {
|
|
|
323
330
|
constructor(input) {
|
|
324
331
|
super();
|
|
325
332
|
this.input = input;
|
|
326
|
-
this.
|
|
333
|
+
this._onKeydown = this._onKeydown.bind(this);
|
|
334
|
+
this._onInput = this._onInput.bind(this);
|
|
335
|
+
this._onBeforeinput = this._onBeforeinput.bind(this);
|
|
336
|
+
this._onCompositionEnd = this._onCompositionEnd.bind(this);
|
|
327
337
|
}
|
|
328
338
|
get rootElement() {
|
|
329
|
-
|
|
330
|
-
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;
|
|
339
|
+
return this.input.getRootNode?.() ?? document;
|
|
331
340
|
}
|
|
332
341
|
|
|
333
|
-
/**
|
|
334
|
-
Is element in focus
|
|
335
|
-
*/
|
|
342
|
+
/** Is element in focus */
|
|
336
343
|
get isActive() {
|
|
337
344
|
return this.input === this.rootElement.activeElement;
|
|
338
345
|
}
|
|
339
346
|
|
|
340
|
-
/**
|
|
341
|
-
Binds HTMLElement events to mask internal events
|
|
342
|
-
*/
|
|
347
|
+
/** Binds HTMLElement events to mask internal events */
|
|
343
348
|
bindEvents(handlers) {
|
|
344
|
-
|
|
349
|
+
this.input.addEventListener('keydown', this._onKeydown);
|
|
350
|
+
this.input.addEventListener('input', this._onInput);
|
|
351
|
+
this.input.addEventListener('beforeinput', this._onBeforeinput);
|
|
352
|
+
this.input.addEventListener('compositionend', this._onCompositionEnd);
|
|
353
|
+
this.input.addEventListener('drop', handlers.drop);
|
|
354
|
+
this.input.addEventListener('click', handlers.click);
|
|
355
|
+
this.input.addEventListener('focus', handlers.focus);
|
|
356
|
+
this.input.addEventListener('blur', handlers.commit);
|
|
357
|
+
this._handlers = handlers;
|
|
345
358
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
359
|
+
_onKeydown(e) {
|
|
360
|
+
if (this._handlers.redo && (e.keyCode === KEY_Z && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === KEY_Y && e.ctrlKey)) {
|
|
361
|
+
e.preventDefault();
|
|
362
|
+
return this._handlers.redo(e);
|
|
363
|
+
}
|
|
364
|
+
if (this._handlers.undo && e.keyCode === KEY_Z && (e.metaKey || e.ctrlKey)) {
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
return this._handlers.undo(e);
|
|
367
|
+
}
|
|
368
|
+
if (!e.isComposing) this._handlers.selectionChange(e);
|
|
352
369
|
}
|
|
353
|
-
|
|
354
|
-
if (this._handlers
|
|
355
|
-
|
|
356
|
-
|
|
370
|
+
_onBeforeinput(e) {
|
|
371
|
+
if (e.inputType === 'historyUndo' && this._handlers.undo) {
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
return this._handlers.undo(e);
|
|
357
374
|
}
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
this._handlers
|
|
375
|
+
if (e.inputType === 'historyRedo' && this._handlers.redo) {
|
|
376
|
+
e.preventDefault();
|
|
377
|
+
return this._handlers.redo(e);
|
|
361
378
|
}
|
|
362
379
|
}
|
|
380
|
+
_onCompositionEnd(e) {
|
|
381
|
+
this._handlers.input(e);
|
|
382
|
+
}
|
|
383
|
+
_onInput(e) {
|
|
384
|
+
if (!e.isComposing) this._handlers.input(e);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** Unbinds HTMLElement events to mask internal events */
|
|
388
|
+
unbindEvents() {
|
|
389
|
+
this.input.removeEventListener('keydown', this._onKeydown);
|
|
390
|
+
this.input.removeEventListener('input', this._onInput);
|
|
391
|
+
this.input.removeEventListener('beforeinput', this._onBeforeinput);
|
|
392
|
+
this.input.removeEventListener('compositionend', this._onCompositionEnd);
|
|
393
|
+
this.input.removeEventListener('drop', this._handlers.drop);
|
|
394
|
+
this.input.removeEventListener('click', this._handlers.click);
|
|
395
|
+
this.input.removeEventListener('focus', this._handlers.focus);
|
|
396
|
+
this.input.removeEventListener('blur', this._handlers.commit);
|
|
397
|
+
this._handlers = {};
|
|
398
|
+
}
|
|
363
399
|
}
|
|
364
|
-
/** Mapping between HTMLElement events and mask internal events */
|
|
365
|
-
HTMLMaskElement.EVENTS_MAP = {
|
|
366
|
-
selectionChange: 'keydown',
|
|
367
|
-
input: 'input',
|
|
368
|
-
drop: 'drop',
|
|
369
|
-
click: 'click',
|
|
370
|
-
focus: 'focus',
|
|
371
|
-
commit: 'blur'
|
|
372
|
-
};
|
|
373
400
|
IMask.HTMLMaskElement = HTMLMaskElement;
|
|
374
401
|
|
|
375
402
|
/** Bridge between InputElement and {@link Masked} */
|
|
@@ -379,7 +406,6 @@ class HTMLInputMaskElement extends HTMLMaskElement {
|
|
|
379
406
|
constructor(input) {
|
|
380
407
|
super(input);
|
|
381
408
|
this.input = input;
|
|
382
|
-
this._handlers = {};
|
|
383
409
|
}
|
|
384
410
|
|
|
385
411
|
/** Returns InputElement selection start */
|
|
@@ -454,6 +480,39 @@ class HTMLContenteditableMaskElement extends HTMLMaskElement {
|
|
|
454
480
|
}
|
|
455
481
|
IMask.HTMLContenteditableMaskElement = HTMLContenteditableMaskElement;
|
|
456
482
|
|
|
483
|
+
class InputHistory {
|
|
484
|
+
static MAX_LENGTH = 100;
|
|
485
|
+
states = [];
|
|
486
|
+
currentIndex = 0;
|
|
487
|
+
get currentState() {
|
|
488
|
+
return this.states[this.currentIndex];
|
|
489
|
+
}
|
|
490
|
+
get isEmpty() {
|
|
491
|
+
return this.states.length === 0;
|
|
492
|
+
}
|
|
493
|
+
push(state) {
|
|
494
|
+
// if current index points before the last element then remove the future
|
|
495
|
+
if (this.currentIndex < this.states.length - 1) this.states.length = this.currentIndex + 1;
|
|
496
|
+
this.states.push(state);
|
|
497
|
+
if (this.states.length > InputHistory.MAX_LENGTH) this.states.shift();
|
|
498
|
+
this.currentIndex = this.states.length - 1;
|
|
499
|
+
}
|
|
500
|
+
go(steps) {
|
|
501
|
+
this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1);
|
|
502
|
+
return this.currentState;
|
|
503
|
+
}
|
|
504
|
+
undo() {
|
|
505
|
+
return this.go(-1);
|
|
506
|
+
}
|
|
507
|
+
redo() {
|
|
508
|
+
return this.go(+1);
|
|
509
|
+
}
|
|
510
|
+
clear() {
|
|
511
|
+
this.states.length = 0;
|
|
512
|
+
this.currentIndex = 0;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
457
516
|
/** Listens to element events and controls changes between element and {@link Masked} */
|
|
458
517
|
class InputMask {
|
|
459
518
|
/**
|
|
@@ -468,12 +527,16 @@ class InputMask {
|
|
|
468
527
|
this._listeners = {};
|
|
469
528
|
this._value = '';
|
|
470
529
|
this._unmaskedValue = '';
|
|
530
|
+
this._rawInputValue = '';
|
|
531
|
+
this.history = new InputHistory();
|
|
471
532
|
this._saveSelection = this._saveSelection.bind(this);
|
|
472
533
|
this._onInput = this._onInput.bind(this);
|
|
473
534
|
this._onChange = this._onChange.bind(this);
|
|
474
535
|
this._onDrop = this._onDrop.bind(this);
|
|
475
536
|
this._onFocus = this._onFocus.bind(this);
|
|
476
537
|
this._onClick = this._onClick.bind(this);
|
|
538
|
+
this._onUndo = this._onUndo.bind(this);
|
|
539
|
+
this._onRedo = this._onRedo.bind(this);
|
|
477
540
|
this.alignCursor = this.alignCursor.bind(this);
|
|
478
541
|
this.alignCursorFriendly = this.alignCursorFriendly.bind(this);
|
|
479
542
|
this._bindEvents();
|
|
@@ -483,8 +546,7 @@ class InputMask {
|
|
|
483
546
|
this._onChange();
|
|
484
547
|
}
|
|
485
548
|
maskEquals(mask) {
|
|
486
|
-
|
|
487
|
-
return mask == null || ((_this$masked = this.masked) == null ? void 0 : _this$masked.maskEquals(mask));
|
|
549
|
+
return mask == null || this.masked?.maskEquals(mask);
|
|
488
550
|
}
|
|
489
551
|
|
|
490
552
|
/** Masked */
|
|
@@ -514,8 +576,7 @@ class InputMask {
|
|
|
514
576
|
set value(str) {
|
|
515
577
|
if (this.value === str) return;
|
|
516
578
|
this.masked.value = str;
|
|
517
|
-
this.updateControl();
|
|
518
|
-
this.alignCursor();
|
|
579
|
+
this.updateControl('auto');
|
|
519
580
|
}
|
|
520
581
|
|
|
521
582
|
/** Unmasked value */
|
|
@@ -525,6 +586,16 @@ class InputMask {
|
|
|
525
586
|
set unmaskedValue(str) {
|
|
526
587
|
if (this.unmaskedValue === str) return;
|
|
527
588
|
this.masked.unmaskedValue = str;
|
|
589
|
+
this.updateControl('auto');
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** Raw input value */
|
|
593
|
+
get rawInputValue() {
|
|
594
|
+
return this._rawInputValue;
|
|
595
|
+
}
|
|
596
|
+
set rawInputValue(str) {
|
|
597
|
+
if (this.rawInputValue === str) return;
|
|
598
|
+
this.masked.rawInputValue = str;
|
|
528
599
|
this.updateControl();
|
|
529
600
|
this.alignCursor();
|
|
530
601
|
}
|
|
@@ -536,8 +607,7 @@ class InputMask {
|
|
|
536
607
|
set typedValue(val) {
|
|
537
608
|
if (this.masked.typedValueEquals(val)) return;
|
|
538
609
|
this.masked.typedValue = val;
|
|
539
|
-
this.updateControl();
|
|
540
|
-
this.alignCursor();
|
|
610
|
+
this.updateControl('auto');
|
|
541
611
|
}
|
|
542
612
|
|
|
543
613
|
/** Display value */
|
|
@@ -553,7 +623,9 @@ class InputMask {
|
|
|
553
623
|
drop: this._onDrop,
|
|
554
624
|
click: this._onClick,
|
|
555
625
|
focus: this._onFocus,
|
|
556
|
-
commit: this._onChange
|
|
626
|
+
commit: this._onChange,
|
|
627
|
+
undo: this._onUndo,
|
|
628
|
+
redo: this._onRedo
|
|
557
629
|
});
|
|
558
630
|
}
|
|
559
631
|
|
|
@@ -590,7 +662,6 @@ class InputMask {
|
|
|
590
662
|
if (this.displayValue !== this.el.value) {
|
|
591
663
|
console.warn('Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.'); // eslint-disable-line no-console
|
|
592
664
|
}
|
|
593
|
-
|
|
594
665
|
this._selection = {
|
|
595
666
|
start: this.selectionStart,
|
|
596
667
|
end: this.cursorPos
|
|
@@ -604,15 +675,25 @@ class InputMask {
|
|
|
604
675
|
}
|
|
605
676
|
|
|
606
677
|
/** Syncronizes view from model value, fires change events */
|
|
607
|
-
updateControl() {
|
|
678
|
+
updateControl(cursorPos) {
|
|
608
679
|
const newUnmaskedValue = this.masked.unmaskedValue;
|
|
609
680
|
const newValue = this.masked.value;
|
|
681
|
+
const newRawInputValue = this.masked.rawInputValue;
|
|
610
682
|
const newDisplayValue = this.displayValue;
|
|
611
|
-
const isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue;
|
|
683
|
+
const isChanged = this.unmaskedValue !== newUnmaskedValue || this.value !== newValue || this._rawInputValue !== newRawInputValue;
|
|
612
684
|
this._unmaskedValue = newUnmaskedValue;
|
|
613
685
|
this._value = newValue;
|
|
686
|
+
this._rawInputValue = newRawInputValue;
|
|
614
687
|
if (this.el.value !== newDisplayValue) this.el.value = newDisplayValue;
|
|
688
|
+
if (cursorPos === 'auto') this.alignCursor();else if (cursorPos != null) this.cursorPos = cursorPos;
|
|
615
689
|
if (isChanged) this._fireChangeEvents();
|
|
690
|
+
if (!this._historyChanging && (isChanged || this.history.isEmpty)) this.history.push({
|
|
691
|
+
unmaskedValue: newUnmaskedValue,
|
|
692
|
+
selection: {
|
|
693
|
+
start: this.selectionStart,
|
|
694
|
+
end: this.cursorPos
|
|
695
|
+
}
|
|
696
|
+
});
|
|
616
697
|
}
|
|
617
698
|
|
|
618
699
|
/** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
|
|
@@ -620,9 +701,10 @@ class InputMask {
|
|
|
620
701
|
const {
|
|
621
702
|
mask,
|
|
622
703
|
...restOpts
|
|
623
|
-
} = opts;
|
|
704
|
+
} = opts; // TODO types, yes, mask is optional
|
|
705
|
+
|
|
624
706
|
const updateMask = !this.maskEquals(mask);
|
|
625
|
-
const updateOpts =
|
|
707
|
+
const updateOpts = this.masked.optionsIsChanged(restOpts);
|
|
626
708
|
if (updateMask) this.mask = mask;
|
|
627
709
|
if (updateOpts) this.masked.updateOptions(restOpts); // TODO
|
|
628
710
|
|
|
@@ -697,9 +779,6 @@ class InputMask {
|
|
|
697
779
|
_onInput(e) {
|
|
698
780
|
this._inputEvent = e;
|
|
699
781
|
this._abortUpdateCursor();
|
|
700
|
-
|
|
701
|
-
// fix strange IE behavior
|
|
702
|
-
if (!this._selection) return this.updateValue();
|
|
703
782
|
const details = new ActionDetails({
|
|
704
783
|
// new state
|
|
705
784
|
value: this.el.value,
|
|
@@ -719,8 +798,7 @@ class InputMask {
|
|
|
719
798
|
const removeDirection = oldRawValue === this.masked.rawInputValue ? details.removeDirection : DIRECTION.NONE;
|
|
720
799
|
let cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, removeDirection);
|
|
721
800
|
if (removeDirection !== DIRECTION.NONE) cursorPos = this.masked.nearestInputPos(cursorPos, DIRECTION.NONE);
|
|
722
|
-
this.updateControl();
|
|
723
|
-
this.updateCursor(cursorPos);
|
|
801
|
+
this.updateControl(cursorPos);
|
|
724
802
|
delete this._inputEvent;
|
|
725
803
|
}
|
|
726
804
|
|
|
@@ -749,6 +827,20 @@ class InputMask {
|
|
|
749
827
|
_onClick(ev) {
|
|
750
828
|
this.alignCursorFriendly();
|
|
751
829
|
}
|
|
830
|
+
_onUndo() {
|
|
831
|
+
this._applyHistoryState(this.history.undo());
|
|
832
|
+
}
|
|
833
|
+
_onRedo() {
|
|
834
|
+
this._applyHistoryState(this.history.redo());
|
|
835
|
+
}
|
|
836
|
+
_applyHistoryState(state) {
|
|
837
|
+
if (!state) return;
|
|
838
|
+
this._historyChanging = true;
|
|
839
|
+
this.unmaskedValue = state.unmaskedValue;
|
|
840
|
+
this.el.select(state.selection.start, state.selection.end);
|
|
841
|
+
this._saveSelection();
|
|
842
|
+
this._historyChanging = false;
|
|
843
|
+
}
|
|
752
844
|
|
|
753
845
|
/** Unbind view events and removes element reference */
|
|
754
846
|
destroy() {
|
|
@@ -859,6 +951,11 @@ class ContinuousTailDetails {
|
|
|
859
951
|
|
|
860
952
|
/** Provides common masking stuff */
|
|
861
953
|
class Masked {
|
|
954
|
+
static DEFAULTS = {
|
|
955
|
+
skipInvalid: true
|
|
956
|
+
};
|
|
957
|
+
static EMPTY_VALUES = [undefined, null, ''];
|
|
958
|
+
|
|
862
959
|
/** */
|
|
863
960
|
|
|
864
961
|
/** */
|
|
@@ -894,7 +991,7 @@ class Masked {
|
|
|
894
991
|
|
|
895
992
|
/** Sets and applies new options */
|
|
896
993
|
updateOptions(opts) {
|
|
897
|
-
if (!
|
|
994
|
+
if (!this.optionsIsChanged(opts)) return;
|
|
898
995
|
this.withValueRefresh(this._update.bind(this, opts));
|
|
899
996
|
}
|
|
900
997
|
|
|
@@ -1036,7 +1133,7 @@ class Masked {
|
|
|
1036
1133
|
const consistentState = this.state;
|
|
1037
1134
|
let details;
|
|
1038
1135
|
[ch, details] = this.doPrepareChar(ch, flags);
|
|
1039
|
-
details = details.aggregate(this._appendCharRaw(ch, flags));
|
|
1136
|
+
if (ch) details = details.aggregate(this._appendCharRaw(ch, flags));
|
|
1040
1137
|
if (details.inserted) {
|
|
1041
1138
|
let consistentTail;
|
|
1042
1139
|
let appended = this.doValidate(flags) !== false;
|
|
@@ -1045,18 +1142,22 @@ class Masked {
|
|
|
1045
1142
|
const beforeTailState = this.state;
|
|
1046
1143
|
if (this.overwrite === true) {
|
|
1047
1144
|
consistentTail = checkTail.state;
|
|
1048
|
-
|
|
1145
|
+
for (let i = 0; i < details.rawInserted.length; ++i) {
|
|
1146
|
+
checkTail.unshift(this.displayValue.length - details.tailShift);
|
|
1147
|
+
}
|
|
1049
1148
|
}
|
|
1050
1149
|
let tailDetails = this.appendTail(checkTail);
|
|
1051
|
-
appended = tailDetails.rawInserted === checkTail.toString();
|
|
1150
|
+
appended = tailDetails.rawInserted.length === checkTail.toString().length;
|
|
1052
1151
|
|
|
1053
1152
|
// not ok, try shift
|
|
1054
1153
|
if (!(appended && tailDetails.inserted) && this.overwrite === 'shift') {
|
|
1055
1154
|
this.state = beforeTailState;
|
|
1056
1155
|
consistentTail = checkTail.state;
|
|
1057
|
-
|
|
1156
|
+
for (let i = 0; i < details.rawInserted.length; ++i) {
|
|
1157
|
+
checkTail.shift();
|
|
1158
|
+
}
|
|
1058
1159
|
tailDetails = this.appendTail(checkTail);
|
|
1059
|
-
appended = tailDetails.rawInserted === checkTail.toString();
|
|
1160
|
+
appended = tailDetails.rawInserted.length === checkTail.toString().length;
|
|
1060
1161
|
}
|
|
1061
1162
|
|
|
1062
1163
|
// if ok, rollback state after tail
|
|
@@ -1087,7 +1188,7 @@ class Masked {
|
|
|
1087
1188
|
append(str, flags, tail) {
|
|
1088
1189
|
if (!isString(str)) throw new Error('value should be string');
|
|
1089
1190
|
const checkTail = isString(tail) ? new ContinuousTailDetails(String(tail)) : tail;
|
|
1090
|
-
if (flags
|
|
1191
|
+
if (flags?.tail) flags._beforeTailState = this.state;
|
|
1091
1192
|
let details;
|
|
1092
1193
|
[str, details] = this.doPrepare(str, flags);
|
|
1093
1194
|
for (let ci = 0; ci < str.length; ++ci) {
|
|
@@ -1095,7 +1196,7 @@ class Masked {
|
|
|
1095
1196
|
if (!d.rawInserted && !this.doSkipInvalid(str[ci], flags, checkTail)) break;
|
|
1096
1197
|
details.aggregate(d);
|
|
1097
1198
|
}
|
|
1098
|
-
if ((this.eager === true || this.eager === 'append') && flags
|
|
1199
|
+
if ((this.eager === true || this.eager === 'append') && flags?.input && str) {
|
|
1099
1200
|
details.aggregate(this._appendEager());
|
|
1100
1201
|
}
|
|
1101
1202
|
|
|
@@ -1106,7 +1207,6 @@ class Masked {
|
|
|
1106
1207
|
// but it causes bugs when one append calls another (when dynamic dispatch set rawInputValue)
|
|
1107
1208
|
// this._resetBeforeTailState();
|
|
1108
1209
|
}
|
|
1109
|
-
|
|
1110
1210
|
return details;
|
|
1111
1211
|
}
|
|
1112
1212
|
remove(fromPos, toPos) {
|
|
@@ -1131,6 +1231,7 @@ class Masked {
|
|
|
1131
1231
|
// append lost trailing chars at the end
|
|
1132
1232
|
if (this.value && this.value !== value && value.indexOf(this.value) === 0) {
|
|
1133
1233
|
this.append(value.slice(this.displayValue.length), {}, '');
|
|
1234
|
+
this.doCommit();
|
|
1134
1235
|
}
|
|
1135
1236
|
delete this._refreshing;
|
|
1136
1237
|
return ret;
|
|
@@ -1220,15 +1321,14 @@ class Masked {
|
|
|
1220
1321
|
maskEquals(mask) {
|
|
1221
1322
|
return this.mask === mask;
|
|
1222
1323
|
}
|
|
1324
|
+
optionsIsChanged(opts) {
|
|
1325
|
+
return !objectIncludes(this, opts);
|
|
1326
|
+
}
|
|
1223
1327
|
typedValueEquals(value) {
|
|
1224
1328
|
const tval = this.typedValue;
|
|
1225
1329
|
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);
|
|
1226
1330
|
}
|
|
1227
1331
|
}
|
|
1228
|
-
Masked.DEFAULTS = {
|
|
1229
|
-
skipInvalid: true
|
|
1230
|
-
};
|
|
1231
|
-
Masked.EMPTY_VALUES = [undefined, null, ''];
|
|
1232
1332
|
IMask.Masked = Masked;
|
|
1233
1333
|
|
|
1234
1334
|
class ChunksTailDetails {
|
|
@@ -1443,11 +1543,9 @@ class PatternCursor {
|
|
|
1443
1543
|
this.offset = this.block.displayValue.length; // TODO this is stupid type error, `block` depends on index that was changed above
|
|
1444
1544
|
}
|
|
1445
1545
|
}
|
|
1446
|
-
|
|
1447
1546
|
_pushLeft(fn) {
|
|
1448
1547
|
this.pushState();
|
|
1449
|
-
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset =
|
|
1450
|
-
var _this$block;
|
|
1548
|
+
for (this.bindBlock(); 0 <= this.index; --this.index, this.offset = this.block?.displayValue.length || 0) {
|
|
1451
1549
|
if (fn()) return this.ok = true;
|
|
1452
1550
|
}
|
|
1453
1551
|
return this.ok = false;
|
|
@@ -1657,6 +1755,13 @@ class PatternFixedDefinition {
|
|
|
1657
1755
|
}
|
|
1658
1756
|
|
|
1659
1757
|
class PatternInputDefinition {
|
|
1758
|
+
static DEFAULT_DEFINITIONS = {
|
|
1759
|
+
'0': /\d/,
|
|
1760
|
+
'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]/,
|
|
1761
|
+
// http://stackoverflow.com/a/22075070
|
|
1762
|
+
'*': /./
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1660
1765
|
/** */
|
|
1661
1766
|
|
|
1662
1767
|
/** */
|
|
@@ -1820,19 +1925,12 @@ class PatternInputDefinition {
|
|
|
1820
1925
|
this.isFilled = state.isFilled;
|
|
1821
1926
|
}
|
|
1822
1927
|
currentMaskFlags(flags) {
|
|
1823
|
-
var _flags$_beforeTailSta;
|
|
1824
1928
|
return {
|
|
1825
1929
|
...flags,
|
|
1826
|
-
_beforeTailState:
|
|
1930
|
+
_beforeTailState: flags?._beforeTailState?.masked || flags?._beforeTailState
|
|
1827
1931
|
};
|
|
1828
1932
|
}
|
|
1829
1933
|
}
|
|
1830
|
-
PatternInputDefinition.DEFAULT_DEFINITIONS = {
|
|
1831
|
-
'0': /\d/,
|
|
1832
|
-
'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]/,
|
|
1833
|
-
// http://stackoverflow.com/a/22075070
|
|
1834
|
-
'*': /./
|
|
1835
|
-
};
|
|
1836
1934
|
|
|
1837
1935
|
/** Masking by RegExp */
|
|
1838
1936
|
class MaskedRegExp extends Masked {
|
|
@@ -1857,6 +1955,15 @@ IMask.MaskedRegExp = MaskedRegExp;
|
|
|
1857
1955
|
|
|
1858
1956
|
/** Pattern mask */
|
|
1859
1957
|
class MaskedPattern extends Masked {
|
|
1958
|
+
static DEFAULTS = {
|
|
1959
|
+
lazy: true,
|
|
1960
|
+
placeholderChar: '_'
|
|
1961
|
+
};
|
|
1962
|
+
static STOP_CHAR = '`';
|
|
1963
|
+
static ESCAPE_CHAR = '\\';
|
|
1964
|
+
static InputDefinition = PatternInputDefinition;
|
|
1965
|
+
static FixedDefinition = PatternFixedDefinition;
|
|
1966
|
+
|
|
1860
1967
|
/** */
|
|
1861
1968
|
|
|
1862
1969
|
/** */
|
|
@@ -1877,7 +1984,7 @@ class MaskedPattern extends Masked {
|
|
|
1877
1984
|
super({
|
|
1878
1985
|
...MaskedPattern.DEFAULTS,
|
|
1879
1986
|
...opts,
|
|
1880
|
-
definitions: Object.assign({}, PatternInputDefinition.DEFAULT_DEFINITIONS, opts
|
|
1987
|
+
definitions: Object.assign({}, PatternInputDefinition.DEFAULT_DEFINITIONS, opts?.definitions)
|
|
1881
1988
|
});
|
|
1882
1989
|
}
|
|
1883
1990
|
updateOptions(opts) {
|
|
@@ -1909,17 +2016,20 @@ class MaskedPattern extends Masked {
|
|
|
1909
2016
|
if (bName) {
|
|
1910
2017
|
const {
|
|
1911
2018
|
expose,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2019
|
+
repeat,
|
|
2020
|
+
...bOpts
|
|
2021
|
+
} = normalizeOpts(this.blocks[bName]); // TODO type Opts<Arg & Extra>
|
|
2022
|
+
const blockOpts = {
|
|
1915
2023
|
lazy: this.lazy,
|
|
1916
2024
|
eager: this.eager,
|
|
1917
2025
|
placeholderChar: this.placeholderChar,
|
|
1918
2026
|
displayChar: this.displayChar,
|
|
1919
2027
|
overwrite: this.overwrite,
|
|
1920
|
-
...
|
|
2028
|
+
...bOpts,
|
|
2029
|
+
repeat,
|
|
1921
2030
|
parent: this
|
|
1922
|
-
}
|
|
2031
|
+
};
|
|
2032
|
+
const maskedBlock = repeat != null ? new IMask.RepeatBlock(blockOpts /* TODO */) : createMask(blockOpts);
|
|
1923
2033
|
if (maskedBlock) {
|
|
1924
2034
|
this._blocks.push(maskedBlock);
|
|
1925
2035
|
if (expose) this.exposeBlock = maskedBlock;
|
|
@@ -1975,6 +2085,10 @@ class MaskedPattern extends Masked {
|
|
|
1975
2085
|
};
|
|
1976
2086
|
}
|
|
1977
2087
|
set state(state) {
|
|
2088
|
+
if (!state) {
|
|
2089
|
+
this.reset();
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
1978
2092
|
const {
|
|
1979
2093
|
_blocks,
|
|
1980
2094
|
...maskedState
|
|
@@ -2044,9 +2158,8 @@ class MaskedPattern extends Masked {
|
|
|
2044
2158
|
return super.appendTail(tail).aggregate(this._appendPlaceholder());
|
|
2045
2159
|
}
|
|
2046
2160
|
_appendEager() {
|
|
2047
|
-
var _this$_mapPosToBlock;
|
|
2048
2161
|
const details = new ChangeDetails();
|
|
2049
|
-
let startBlockIndex =
|
|
2162
|
+
let startBlockIndex = this._mapPosToBlock(this.displayValue.length)?.index;
|
|
2050
2163
|
if (startBlockIndex == null) return details;
|
|
2051
2164
|
|
|
2052
2165
|
// TODO test if it works for nested pattern masks
|
|
@@ -2065,19 +2178,14 @@ class MaskedPattern extends Masked {
|
|
|
2065
2178
|
const blockIter = this._mapPosToBlock(this.displayValue.length);
|
|
2066
2179
|
const details = new ChangeDetails();
|
|
2067
2180
|
if (!blockIter) return details;
|
|
2068
|
-
for (let bi = blockIter.index
|
|
2069
|
-
var _flags$_beforeTailSta;
|
|
2070
|
-
const block = this._blocks[bi];
|
|
2071
|
-
if (!block) break;
|
|
2181
|
+
for (let bi = blockIter.index, block; block = this._blocks[bi]; ++bi) {
|
|
2072
2182
|
const blockDetails = block._appendChar(ch, {
|
|
2073
2183
|
...flags,
|
|
2074
|
-
_beforeTailState:
|
|
2184
|
+
_beforeTailState: flags._beforeTailState?._blocks?.[bi]
|
|
2075
2185
|
});
|
|
2076
|
-
const skip = blockDetails.skip;
|
|
2077
2186
|
details.aggregate(blockDetails);
|
|
2078
|
-
if (skip || blockDetails.rawInserted) break; // go next char
|
|
2187
|
+
if (blockDetails.skip || blockDetails.rawInserted) break; // go next char
|
|
2079
2188
|
}
|
|
2080
|
-
|
|
2081
2189
|
return details;
|
|
2082
2190
|
}
|
|
2083
2191
|
extractTail(fromPos, toPos) {
|
|
@@ -2134,8 +2242,7 @@ class MaskedPattern extends Masked {
|
|
|
2134
2242
|
const endBlockIndex = toBlockIndex != null ? toBlockIndex : this._blocks.length;
|
|
2135
2243
|
this._blocks.slice(startBlockIndex, endBlockIndex).forEach(b => {
|
|
2136
2244
|
if (!b.lazy || toBlockIndex != null) {
|
|
2137
|
-
|
|
2138
|
-
const bDetails = b._appendPlaceholder((_blocks2 = b._blocks) == null ? void 0 : _blocks2.length);
|
|
2245
|
+
const bDetails = b._appendPlaceholder(b._blocks?.length);
|
|
2139
2246
|
this._value += bDetails.inserted;
|
|
2140
2247
|
details.aggregate(bDetails);
|
|
2141
2248
|
}
|
|
@@ -2286,14 +2393,6 @@ class MaskedPattern extends Masked {
|
|
|
2286
2393
|
return indices.map(gi => this._blocks[gi]);
|
|
2287
2394
|
}
|
|
2288
2395
|
}
|
|
2289
|
-
MaskedPattern.DEFAULTS = {
|
|
2290
|
-
lazy: true,
|
|
2291
|
-
placeholderChar: '_'
|
|
2292
|
-
};
|
|
2293
|
-
MaskedPattern.STOP_CHAR = '`';
|
|
2294
|
-
MaskedPattern.ESCAPE_CHAR = '\\';
|
|
2295
|
-
MaskedPattern.InputDefinition = PatternInputDefinition;
|
|
2296
|
-
MaskedPattern.FixedDefinition = PatternFixedDefinition;
|
|
2297
2396
|
IMask.MaskedPattern = MaskedPattern;
|
|
2298
2397
|
|
|
2299
2398
|
/** Pattern which accepts ranges */
|
|
@@ -2315,7 +2414,6 @@ class MaskedRange extends MaskedPattern {
|
|
|
2315
2414
|
constructor(opts) {
|
|
2316
2415
|
super(opts); // mask will be created in _update
|
|
2317
2416
|
}
|
|
2318
|
-
|
|
2319
2417
|
updateOptions(opts) {
|
|
2320
2418
|
super.updateOptions(opts);
|
|
2321
2419
|
}
|
|
@@ -2359,7 +2457,10 @@ class MaskedRange extends MaskedPattern {
|
|
|
2359
2457
|
}
|
|
2360
2458
|
let details;
|
|
2361
2459
|
[ch, details] = super.doPrepareChar(ch.replace(/\D/g, ''), flags);
|
|
2362
|
-
if (!this.autofix || !ch)
|
|
2460
|
+
if (!this.autofix || !ch) {
|
|
2461
|
+
details.skip = !this.isComplete;
|
|
2462
|
+
return [ch, details];
|
|
2463
|
+
}
|
|
2363
2464
|
const fromStr = String(this.from).padStart(this.maxLength, '0');
|
|
2364
2465
|
const toStr = String(this.to).padStart(this.maxLength, '0');
|
|
2365
2466
|
const nextVal = this.value + ch;
|
|
@@ -2386,6 +2487,52 @@ IMask.MaskedRange = MaskedRange;
|
|
|
2386
2487
|
|
|
2387
2488
|
/** Date mask */
|
|
2388
2489
|
class MaskedDate extends MaskedPattern {
|
|
2490
|
+
static GET_DEFAULT_BLOCKS = () => ({
|
|
2491
|
+
d: {
|
|
2492
|
+
mask: MaskedRange,
|
|
2493
|
+
from: 1,
|
|
2494
|
+
to: 31,
|
|
2495
|
+
maxLength: 2
|
|
2496
|
+
},
|
|
2497
|
+
m: {
|
|
2498
|
+
mask: MaskedRange,
|
|
2499
|
+
from: 1,
|
|
2500
|
+
to: 12,
|
|
2501
|
+
maxLength: 2
|
|
2502
|
+
},
|
|
2503
|
+
Y: {
|
|
2504
|
+
mask: MaskedRange,
|
|
2505
|
+
from: 1900,
|
|
2506
|
+
to: 9999
|
|
2507
|
+
}
|
|
2508
|
+
});
|
|
2509
|
+
static DEFAULTS = {
|
|
2510
|
+
mask: Date,
|
|
2511
|
+
pattern: 'd{.}`m{.}`Y',
|
|
2512
|
+
format: (date, masked) => {
|
|
2513
|
+
if (!date) return '';
|
|
2514
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
2515
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
2516
|
+
const year = date.getFullYear();
|
|
2517
|
+
return [day, month, year].join('.');
|
|
2518
|
+
},
|
|
2519
|
+
parse: (str, masked) => {
|
|
2520
|
+
const [day, month, year] = str.split('.').map(Number);
|
|
2521
|
+
return new Date(year, month - 1, day);
|
|
2522
|
+
}
|
|
2523
|
+
};
|
|
2524
|
+
static extractPatternOptions(opts) {
|
|
2525
|
+
const {
|
|
2526
|
+
mask,
|
|
2527
|
+
pattern,
|
|
2528
|
+
...patternOpts
|
|
2529
|
+
} = opts;
|
|
2530
|
+
return {
|
|
2531
|
+
...patternOpts,
|
|
2532
|
+
mask: isString(mask) ? mask : pattern
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2389
2536
|
/** Pattern mask for date according to {@link MaskedDate#format} */
|
|
2390
2537
|
|
|
2391
2538
|
/** Start date */
|
|
@@ -2399,18 +2546,10 @@ class MaskedDate extends MaskedPattern {
|
|
|
2399
2546
|
/** Parse string to get typed value */
|
|
2400
2547
|
|
|
2401
2548
|
constructor(opts) {
|
|
2402
|
-
|
|
2403
|
-
mask,
|
|
2404
|
-
pattern,
|
|
2405
|
-
...patternOpts
|
|
2406
|
-
} = {
|
|
2549
|
+
super(MaskedDate.extractPatternOptions({
|
|
2407
2550
|
...MaskedDate.DEFAULTS,
|
|
2408
2551
|
...opts
|
|
2409
|
-
};
|
|
2410
|
-
super({
|
|
2411
|
-
...patternOpts,
|
|
2412
|
-
mask: isString(mask) ? mask : pattern
|
|
2413
|
-
});
|
|
2552
|
+
}));
|
|
2414
2553
|
}
|
|
2415
2554
|
updateOptions(opts) {
|
|
2416
2555
|
super.updateOptions(opts);
|
|
@@ -2476,45 +2615,16 @@ class MaskedDate extends MaskedPattern {
|
|
|
2476
2615
|
maskEquals(mask) {
|
|
2477
2616
|
return mask === Date || super.maskEquals(mask);
|
|
2478
2617
|
}
|
|
2479
|
-
|
|
2480
|
-
MaskedDate.
|
|
2481
|
-
d: {
|
|
2482
|
-
mask: MaskedRange,
|
|
2483
|
-
from: 1,
|
|
2484
|
-
to: 31,
|
|
2485
|
-
maxLength: 2
|
|
2486
|
-
},
|
|
2487
|
-
m: {
|
|
2488
|
-
mask: MaskedRange,
|
|
2489
|
-
from: 1,
|
|
2490
|
-
to: 12,
|
|
2491
|
-
maxLength: 2
|
|
2492
|
-
},
|
|
2493
|
-
Y: {
|
|
2494
|
-
mask: MaskedRange,
|
|
2495
|
-
from: 1900,
|
|
2496
|
-
to: 9999
|
|
2497
|
-
}
|
|
2498
|
-
});
|
|
2499
|
-
MaskedDate.DEFAULTS = {
|
|
2500
|
-
mask: Date,
|
|
2501
|
-
pattern: 'd{.}`m{.}`Y',
|
|
2502
|
-
format: (date, masked) => {
|
|
2503
|
-
if (!date) return '';
|
|
2504
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
2505
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
2506
|
-
const year = date.getFullYear();
|
|
2507
|
-
return [day, month, year].join('.');
|
|
2508
|
-
},
|
|
2509
|
-
parse: (str, masked) => {
|
|
2510
|
-
const [day, month, year] = str.split('.').map(Number);
|
|
2511
|
-
return new Date(year, month - 1, day);
|
|
2618
|
+
optionsIsChanged(opts) {
|
|
2619
|
+
return super.optionsIsChanged(MaskedDate.extractPatternOptions(opts));
|
|
2512
2620
|
}
|
|
2513
|
-
}
|
|
2621
|
+
}
|
|
2514
2622
|
IMask.MaskedDate = MaskedDate;
|
|
2515
2623
|
|
|
2516
2624
|
/** Dynamic mask for choosing appropriate mask in run-time */
|
|
2517
2625
|
class MaskedDynamic extends Masked {
|
|
2626
|
+
static DEFAULTS;
|
|
2627
|
+
|
|
2518
2628
|
/** Currently chosen mask */
|
|
2519
2629
|
|
|
2520
2630
|
/** Currently chosen mask */
|
|
@@ -2556,7 +2666,6 @@ class MaskedDynamic extends Masked {
|
|
|
2556
2666
|
// this.currentMask = this.doDispatch(''); // probably not needed but lets see
|
|
2557
2667
|
}
|
|
2558
2668
|
}
|
|
2559
|
-
|
|
2560
2669
|
_appendCharRaw(ch, flags) {
|
|
2561
2670
|
if (flags === void 0) {
|
|
2562
2671
|
flags = {};
|
|
@@ -2583,7 +2692,7 @@ class MaskedDynamic extends Masked {
|
|
|
2583
2692
|
const tailValue = inputValue.slice(insertValue.length);
|
|
2584
2693
|
const prevMask = this.currentMask;
|
|
2585
2694
|
const details = new ChangeDetails();
|
|
2586
|
-
const prevMaskState = prevMask
|
|
2695
|
+
const prevMaskState = prevMask?.state;
|
|
2587
2696
|
|
|
2588
2697
|
// clone flags to prevent overwriting `_beforeTailState`
|
|
2589
2698
|
this.currentMask = this.doDispatch(appended, {
|
|
@@ -2635,10 +2744,9 @@ class MaskedDynamic extends Masked {
|
|
|
2635
2744
|
return details.aggregate(this.currentMask ? this.currentMask.appendTail(tail) : super.appendTail(tail));
|
|
2636
2745
|
}
|
|
2637
2746
|
currentMaskFlags(flags) {
|
|
2638
|
-
var _flags$_beforeTailSta, _flags$_beforeTailSta2;
|
|
2639
2747
|
return {
|
|
2640
2748
|
...flags,
|
|
2641
|
-
_beforeTailState:
|
|
2749
|
+
_beforeTailState: flags._beforeTailState?.currentMaskRef === this.currentMask && flags._beforeTailState?.currentMask || flags._beforeTailState
|
|
2642
2750
|
};
|
|
2643
2751
|
}
|
|
2644
2752
|
doDispatch(appended, flags, tail) {
|
|
@@ -2678,8 +2786,7 @@ class MaskedDynamic extends Masked {
|
|
|
2678
2786
|
return [s, details];
|
|
2679
2787
|
}
|
|
2680
2788
|
reset() {
|
|
2681
|
-
|
|
2682
|
-
(_this$currentMask = this.currentMask) == null ? void 0 : _this$currentMask.reset();
|
|
2789
|
+
this.currentMask?.reset();
|
|
2683
2790
|
this.compiledMasks.forEach(m => m.reset());
|
|
2684
2791
|
}
|
|
2685
2792
|
get value() {
|
|
@@ -2725,12 +2832,10 @@ class MaskedDynamic extends Masked {
|
|
|
2725
2832
|
return this.currentMask ? this.currentMask.displayValue : '';
|
|
2726
2833
|
}
|
|
2727
2834
|
get isComplete() {
|
|
2728
|
-
|
|
2729
|
-
return Boolean((_this$currentMask2 = this.currentMask) == null ? void 0 : _this$currentMask2.isComplete);
|
|
2835
|
+
return Boolean(this.currentMask?.isComplete);
|
|
2730
2836
|
}
|
|
2731
2837
|
get isFilled() {
|
|
2732
|
-
|
|
2733
|
-
return Boolean((_this$currentMask3 = this.currentMask) == null ? void 0 : _this$currentMask3.isFilled);
|
|
2838
|
+
return Boolean(this.currentMask?.isFilled);
|
|
2734
2839
|
}
|
|
2735
2840
|
remove(fromPos, toPos) {
|
|
2736
2841
|
const details = new ChangeDetails();
|
|
@@ -2742,13 +2847,12 @@ class MaskedDynamic extends Masked {
|
|
|
2742
2847
|
return details;
|
|
2743
2848
|
}
|
|
2744
2849
|
get state() {
|
|
2745
|
-
var _this$currentMask4;
|
|
2746
2850
|
return {
|
|
2747
2851
|
...super.state,
|
|
2748
2852
|
_rawInputValue: this.rawInputValue,
|
|
2749
2853
|
compiledMasks: this.compiledMasks.map(m => m.state),
|
|
2750
2854
|
currentMaskRef: this.currentMask,
|
|
2751
|
-
currentMask:
|
|
2855
|
+
currentMask: this.currentMask?.state
|
|
2752
2856
|
};
|
|
2753
2857
|
}
|
|
2754
2858
|
set state(state) {
|
|
@@ -2807,11 +2911,9 @@ class MaskedDynamic extends Masked {
|
|
|
2807
2911
|
}) : super.maskEquals(mask);
|
|
2808
2912
|
}
|
|
2809
2913
|
typedValueEquals(value) {
|
|
2810
|
-
|
|
2811
|
-
return Boolean((_this$currentMask5 = this.currentMask) == null ? void 0 : _this$currentMask5.typedValueEquals(value));
|
|
2914
|
+
return Boolean(this.currentMask?.typedValueEquals(value));
|
|
2812
2915
|
}
|
|
2813
2916
|
}
|
|
2814
|
-
MaskedDynamic.DEFAULTS = void 0;
|
|
2815
2917
|
MaskedDynamic.DEFAULTS = {
|
|
2816
2918
|
dispatch: (appended, masked, flags, tail) => {
|
|
2817
2919
|
if (!masked.compiledMasks.length) return;
|
|
@@ -2850,7 +2952,6 @@ class MaskedEnum extends MaskedPattern {
|
|
|
2850
2952
|
constructor(opts) {
|
|
2851
2953
|
super(opts); // mask will be created in _update
|
|
2852
2954
|
}
|
|
2853
|
-
|
|
2854
2955
|
updateOptions(opts) {
|
|
2855
2956
|
super.updateOptions(opts);
|
|
2856
2957
|
}
|
|
@@ -2899,6 +3000,25 @@ IMask.MaskedFunction = MaskedFunction;
|
|
|
2899
3000
|
|
|
2900
3001
|
/** Number mask */
|
|
2901
3002
|
class MaskedNumber extends Masked {
|
|
3003
|
+
static UNMASKED_RADIX = '.';
|
|
3004
|
+
static EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
|
|
3005
|
+
static DEFAULTS = {
|
|
3006
|
+
mask: Number,
|
|
3007
|
+
radix: ',',
|
|
3008
|
+
thousandsSeparator: '',
|
|
3009
|
+
mapToRadix: [MaskedNumber.UNMASKED_RADIX],
|
|
3010
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
3011
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
3012
|
+
scale: 2,
|
|
3013
|
+
normalizeZeros: true,
|
|
3014
|
+
padFractionalZeros: false,
|
|
3015
|
+
parse: Number,
|
|
3016
|
+
format: n => n.toLocaleString('en-US', {
|
|
3017
|
+
useGrouping: false,
|
|
3018
|
+
maximumFractionDigits: 20
|
|
3019
|
+
})
|
|
3020
|
+
};
|
|
3021
|
+
|
|
2902
3022
|
/** Single char */
|
|
2903
3023
|
|
|
2904
3024
|
/** Single char */
|
|
@@ -2941,9 +3061,9 @@ class MaskedNumber extends Masked {
|
|
|
2941
3061
|
_updateRegExps() {
|
|
2942
3062
|
const start = '^' + (this.allowNegative ? '[+|\\-]?' : '');
|
|
2943
3063
|
const mid = '\\d*';
|
|
2944
|
-
const end = (this.scale ?
|
|
3064
|
+
const end = (this.scale ? `(${escapeRegExp(this.radix)}\\d{0,${this.scale}})?` : '') + '$';
|
|
2945
3065
|
this._numberRegExp = new RegExp(start + mid + end);
|
|
2946
|
-
this._mapToRadixRegExp = new RegExp(
|
|
3066
|
+
this._mapToRadixRegExp = new RegExp(`[${this.mapToRadix.map(escapeRegExp).join('')}]`, 'g');
|
|
2947
3067
|
this._thousandsSeparatorRegExp = new RegExp(escapeRegExp(this.thousandsSeparator), 'g');
|
|
2948
3068
|
}
|
|
2949
3069
|
_removeThousandsSeparators(value) {
|
|
@@ -3118,7 +3238,6 @@ class MaskedNumber extends Masked {
|
|
|
3118
3238
|
parts[1] = parts[1].replace(/0*$/, ''); // remove trailing zeros
|
|
3119
3239
|
if (!parts[1].length) parts.length = 1; // remove fractional
|
|
3120
3240
|
}
|
|
3121
|
-
|
|
3122
3241
|
return this._insertThousandsSeparators(parts.join(this.radix));
|
|
3123
3242
|
}
|
|
3124
3243
|
_padFractionalZeros(value) {
|
|
@@ -3155,17 +3274,9 @@ class MaskedNumber extends Masked {
|
|
|
3155
3274
|
set number(number) {
|
|
3156
3275
|
this.typedValue = number;
|
|
3157
3276
|
}
|
|
3158
|
-
|
|
3159
|
-
/**
|
|
3160
|
-
Is negative allowed
|
|
3161
|
-
*/
|
|
3162
3277
|
get allowNegative() {
|
|
3163
3278
|
return this.min != null && this.min < 0 || this.max != null && this.max < 0;
|
|
3164
3279
|
}
|
|
3165
|
-
|
|
3166
|
-
/**
|
|
3167
|
-
Is positive allowed
|
|
3168
|
-
*/
|
|
3169
3280
|
get allowPositive() {
|
|
3170
3281
|
return this.min != null && this.min > 0 || this.max != null && this.max > 0;
|
|
3171
3282
|
}
|
|
@@ -3175,24 +3286,6 @@ class MaskedNumber extends Masked {
|
|
|
3175
3286
|
return (super.typedValueEquals(value) || MaskedNumber.EMPTY_VALUES.includes(value) && MaskedNumber.EMPTY_VALUES.includes(this.typedValue)) && !(value === 0 && this.value === '');
|
|
3176
3287
|
}
|
|
3177
3288
|
}
|
|
3178
|
-
MaskedNumber.UNMASKED_RADIX = '.';
|
|
3179
|
-
MaskedNumber.EMPTY_VALUES = [...Masked.EMPTY_VALUES, 0];
|
|
3180
|
-
MaskedNumber.DEFAULTS = {
|
|
3181
|
-
mask: Number,
|
|
3182
|
-
radix: ',',
|
|
3183
|
-
thousandsSeparator: '',
|
|
3184
|
-
mapToRadix: [MaskedNumber.UNMASKED_RADIX],
|
|
3185
|
-
min: Number.MIN_SAFE_INTEGER,
|
|
3186
|
-
max: Number.MAX_SAFE_INTEGER,
|
|
3187
|
-
scale: 2,
|
|
3188
|
-
normalizeZeros: true,
|
|
3189
|
-
padFractionalZeros: false,
|
|
3190
|
-
parse: Number,
|
|
3191
|
-
format: n => n.toLocaleString('en-US', {
|
|
3192
|
-
useGrouping: false,
|
|
3193
|
-
maximumFractionDigits: 20
|
|
3194
|
-
})
|
|
3195
|
-
};
|
|
3196
3289
|
IMask.MaskedNumber = MaskedNumber;
|
|
3197
3290
|
|
|
3198
3291
|
/** Mask pipe source and destination types */
|
|
@@ -3224,6 +3317,124 @@ IMask.PIPE_TYPE = PIPE_TYPE;
|
|
|
3224
3317
|
IMask.createPipe = createPipe;
|
|
3225
3318
|
IMask.pipe = pipe;
|
|
3226
3319
|
|
|
3320
|
+
/** Pattern mask */
|
|
3321
|
+
class RepeatBlock extends MaskedPattern {
|
|
3322
|
+
get repeatFrom() {
|
|
3323
|
+
return (Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === Infinity ? 0 : this.repeat) ?? 0;
|
|
3324
|
+
}
|
|
3325
|
+
get repeatTo() {
|
|
3326
|
+
return (Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) ?? Infinity;
|
|
3327
|
+
}
|
|
3328
|
+
constructor(opts) {
|
|
3329
|
+
super(opts);
|
|
3330
|
+
}
|
|
3331
|
+
updateOptions(opts) {
|
|
3332
|
+
super.updateOptions(opts);
|
|
3333
|
+
}
|
|
3334
|
+
_update(opts) {
|
|
3335
|
+
const {
|
|
3336
|
+
repeat,
|
|
3337
|
+
...blockOpts
|
|
3338
|
+
} = normalizeOpts(opts); // TODO type
|
|
3339
|
+
this._blockOpts = Object.assign({}, this._blockOpts, blockOpts);
|
|
3340
|
+
const block = createMask(this._blockOpts);
|
|
3341
|
+
this.repeat = repeat ?? block.repeat ?? this.repeat ?? Infinity; // TODO type
|
|
3342
|
+
|
|
3343
|
+
super._update({
|
|
3344
|
+
mask: 'm'.repeat(Math.max(this.repeatTo === Infinity && this._blocks?.length || 0, this.repeatFrom)),
|
|
3345
|
+
blocks: {
|
|
3346
|
+
m: block
|
|
3347
|
+
},
|
|
3348
|
+
eager: block.eager,
|
|
3349
|
+
overwrite: block.overwrite,
|
|
3350
|
+
skipInvalid: block.skipInvalid,
|
|
3351
|
+
lazy: block.lazy,
|
|
3352
|
+
placeholderChar: block.placeholderChar,
|
|
3353
|
+
displayChar: block.displayChar
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
_allocateBlock(bi) {
|
|
3357
|
+
if (bi < this._blocks.length) return this._blocks[bi];
|
|
3358
|
+
if (this.repeatTo === Infinity || this._blocks.length < this.repeatTo) {
|
|
3359
|
+
this._blocks.push(createMask(this._blockOpts));
|
|
3360
|
+
this.mask += 'm';
|
|
3361
|
+
return this._blocks[this._blocks.length - 1];
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
_appendCharRaw(ch, flags) {
|
|
3365
|
+
if (flags === void 0) {
|
|
3366
|
+
flags = {};
|
|
3367
|
+
}
|
|
3368
|
+
const details = new ChangeDetails();
|
|
3369
|
+
for (let bi = this._mapPosToBlock(this.displayValue.length)?.index ?? Math.max(this._blocks.length - 1, 0), block, allocated;
|
|
3370
|
+
// try to get a block or
|
|
3371
|
+
// try to allocate a new block if not allocated already
|
|
3372
|
+
block = this._blocks[bi] ?? (allocated = !allocated && this._allocateBlock(bi)); ++bi) {
|
|
3373
|
+
const blockDetails = block._appendChar(ch, {
|
|
3374
|
+
...flags,
|
|
3375
|
+
_beforeTailState: flags._beforeTailState?._blocks?.[bi]
|
|
3376
|
+
});
|
|
3377
|
+
if (blockDetails.skip && allocated) {
|
|
3378
|
+
// remove the last allocated block and break
|
|
3379
|
+
this._blocks.pop();
|
|
3380
|
+
this.mask = this.mask.slice(1);
|
|
3381
|
+
break;
|
|
3382
|
+
}
|
|
3383
|
+
details.aggregate(blockDetails);
|
|
3384
|
+
if (blockDetails.skip || blockDetails.rawInserted) break; // go next char
|
|
3385
|
+
}
|
|
3386
|
+
return details;
|
|
3387
|
+
}
|
|
3388
|
+
_trimEmptyTail(fromPos, toPos) {
|
|
3389
|
+
if (fromPos === void 0) {
|
|
3390
|
+
fromPos = 0;
|
|
3391
|
+
}
|
|
3392
|
+
const firstBlockIndex = Math.max(this._mapPosToBlock(fromPos)?.index || 0, this.repeatFrom, 0);
|
|
3393
|
+
let lastBlockIndex;
|
|
3394
|
+
if (toPos != null) lastBlockIndex = this._mapPosToBlock(toPos)?.index;
|
|
3395
|
+
if (lastBlockIndex == null) lastBlockIndex = this._blocks.length - 1;
|
|
3396
|
+
let removeCount = 0;
|
|
3397
|
+
for (let blockIndex = lastBlockIndex; firstBlockIndex <= blockIndex; --blockIndex, ++removeCount) {
|
|
3398
|
+
if (this._blocks[blockIndex].unmaskedValue) break;
|
|
3399
|
+
}
|
|
3400
|
+
if (removeCount) {
|
|
3401
|
+
this._blocks.splice(lastBlockIndex - removeCount + 1, removeCount);
|
|
3402
|
+
this.mask = this.mask.slice(removeCount);
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
reset() {
|
|
3406
|
+
super.reset();
|
|
3407
|
+
this._trimEmptyTail();
|
|
3408
|
+
}
|
|
3409
|
+
remove(fromPos, toPos) {
|
|
3410
|
+
if (fromPos === void 0) {
|
|
3411
|
+
fromPos = 0;
|
|
3412
|
+
}
|
|
3413
|
+
if (toPos === void 0) {
|
|
3414
|
+
toPos = this.displayValue.length;
|
|
3415
|
+
}
|
|
3416
|
+
const removeDetails = super.remove(fromPos, toPos);
|
|
3417
|
+
this._trimEmptyTail(fromPos, toPos);
|
|
3418
|
+
return removeDetails;
|
|
3419
|
+
}
|
|
3420
|
+
totalInputPositions(fromPos, toPos) {
|
|
3421
|
+
if (fromPos === void 0) {
|
|
3422
|
+
fromPos = 0;
|
|
3423
|
+
}
|
|
3424
|
+
if (toPos == null && this.repeatTo === Infinity) return Infinity;
|
|
3425
|
+
return super.totalInputPositions(fromPos, toPos);
|
|
3426
|
+
}
|
|
3427
|
+
get state() {
|
|
3428
|
+
return super.state;
|
|
3429
|
+
}
|
|
3430
|
+
set state(state) {
|
|
3431
|
+
this._blocks.length = state._blocks.length;
|
|
3432
|
+
this.mask = this.mask.slice(0, this._blocks.length);
|
|
3433
|
+
super.state = state;
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
IMask.RepeatBlock = RepeatBlock;
|
|
3437
|
+
|
|
3227
3438
|
try {
|
|
3228
3439
|
globalThis.IMask = IMask;
|
|
3229
3440
|
} catch {}
|