d2coreui 23.0.15 → 23.0.17
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/components/codemirror/SyntaxHighlighter.js.map +1 -0
- package/components/color/colorSwatch.d.ts +13 -18
- package/components/color/colorSwatch.js.map +1 -0
- package/{lib/esm/components → components}/date/dateRangeInput.js +1 -1
- package/components/date/dateRangeInput.js.map +1 -0
- package/{lib/esm/components → components}/date/dateTimeInput.js +1 -1
- package/components/date/dateTimeInput.js.map +1 -0
- package/{lib/esm/components → components}/date/durationInput.js +2 -2
- package/components/date/durationInput.js.map +1 -0
- package/{lib/esm/components → components}/grid/cell/cellEditorUtils.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +78 -9
- package/components/grid/cell/rangeSelector.js +527 -674
- package/components/grid/columnUtils.js.map +1 -0
- package/{lib/esm/components → components}/grid/export/contextMenu.js +4 -4
- package/components/grid/export/progressPopup.js.map +1 -0
- package/{lib/esm/components → components}/grid/export/worker/clipboardExport.js.map +1 -1
- package/{lib/esm/components → components}/grid/export/worker/csvExport.js.map +1 -1
- package/{lib/esm/components → components}/grid/export/worker/txtExport.js.map +1 -1
- package/components/icons/ant-design-double-right-outline.svg +5 -5
- package/components/icons/ant-design_close-outline.svg +5 -5
- package/components/icons/undoIcon.js.map +1 -0
- package/components/input/draftUtils.js.map +1 -0
- package/components/input/draftail.d.ts +1 -186
- package/components/input/draftail.js +2 -1
- package/{lib/esm/components → components}/input/draftail.js.map +1 -1
- package/components/input/mask/inputMaskCore.js.map +1 -0
- package/components/input/mask/pattern.js.map +1 -0
- package/components/input/passwordInput.js.map +1 -0
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -0
- package/components/input/textarea/getRanges.js.map +1 -0
- package/{lib/esm/components → components}/input/textarea/getType.js.map +1 -1
- package/{lib/esm/components → components}/input/textarea/highlighedContents.js.map +1 -1
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -0
- package/{lib/esm/components → components}/keyboard/keyboardUtils.js.map +1 -1
- package/components/platformSpecific.js.map +1 -0
- package/{lib/esm/components → components}/text/impl/innerSize.js.map +1 -1
- package/components/text/impl/series.js.map +1 -0
- package/{lib/esm/components → components}/text/impl/shallowEqual.js.map +1 -1
- package/{lib/esm/components → components}/text/impl/uniqueId.js.map +1 -1
- package/components/text/impl/whilst.js.map +1 -0
- package/i18n/components.cs.json +101 -101
- package/i18n/components.sk.json +101 -101
- package/i18n/components.uk.json +101 -101
- package/i18n/componentsLocaleHolder.js +29 -24
- package/i18n/componentsLocaleHolder.js.map +1 -0
- package/package.json +1 -1
- package/style/ag-grid/_ag-theme-antd-vars.scss +194 -194
- package/style/ag-grid/ag-theme-antd.scss +87 -87
- package/style/ag-grid/aggrid-adaptations.css +42 -42
- package/style/ag-grid/aggrid.scss +11 -11
- package/style/flexLayout/flexLayout.scss +130 -130
- package/style/flexLayout/flexLayoutBase.scss +623 -623
- package/style/flexLayout/new/_base.scss +616 -616
- package/style/flexLayout/new/flexLayoutBase.scss +621 -621
- package/style/flexLayout/new/light.scss +107 -107
- package/style/flexLayout/old/_base.scss +551 -551
- package/style/flexLayout/old/light.scss +16 -16
- package/style/form/niceFormItem.css +38 -38
- package/style/loading.css +31 -31
- package/style/splitPane/splitPane.css +48 -48
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/clipboard/clipboardUtils.ts +0 -53
- package/components/codemirror/SyntaxHighlighter.tsx +0 -58
- package/components/collapse/expandable.tsx +0 -48
- package/components/color/colorPicker.tsx +0 -121
- package/components/color/colorSwatch.jsx +0 -87
- package/components/color/colorUtils.ts +0 -60
- package/components/date/dateRangeInput.tsx +0 -468
- package/components/date/dateRangeInputAdvancedPanel.tsx +0 -238
- package/components/date/dateRangeInputConfirm.tsx +0 -200
- package/components/date/dateTimeInput.tsx +0 -633
- package/components/date/durationInput.tsx +0 -375
- package/components/form/NiceFormItem.tsx +0 -32
- package/components/grid/cell/beanAccessor.ts +0 -17
- package/components/grid/cell/cellEditorUtils.ts +0 -12
- package/components/grid/cell/customEnumCellEditor.tsx +0 -130
- package/components/grid/cell/dataGridCellEditorComponent.tsx +0 -61
- package/components/grid/cell/dateCellEditor.tsx +0 -83
- package/components/grid/cell/durationCellEditor.tsx +0 -105
- package/components/grid/cell/hexaOctetStringCellEditor.tsx +0 -101
- package/components/grid/cell/hexaValueCellEditor.tsx +0 -92
- package/components/grid/cell/numberCellEditor.tsx +0 -115
- package/components/grid/cell/simpleStatusTextCellEditor.tsx +0 -168
- package/components/grid/cell/statusTextCellEditor.tsx +0 -198
- package/components/grid/cell/tableDefaultRowStyleRules.ts +0 -51
- package/components/grid/cell/textCellEditor.tsx +0 -94
- package/components/grid/cell/withAgGridHooks.tsx +0 -15
- package/components/grid/columnUtils.ts +0 -29
- package/components/grid/config/columnTransfer.tsx +0 -258
- package/components/grid/config/dataGridEditor.tsx +0 -328
- package/components/grid/config/rowHeightCalculator.tsx +0 -29
- package/components/grid/config/rowStylePicker.tsx +0 -196
- package/components/grid/dataGrid.tsx +0 -2183
- package/components/grid/detail/detailHeaderPanel.tsx +0 -59
- package/components/grid/export/contextMenu.tsx +0 -154
- package/components/grid/export/progressPopup.tsx +0 -106
- package/components/grid/export/worker/clipboardExport.ts +0 -10
- package/components/grid/export/worker/csvExport.ts +0 -10
- package/components/grid/export/worker/pdfExport.ts +0 -98
- package/components/grid/export/worker/txtExport.ts +0 -21
- package/components/grid/extendedDataGrid.tsx +0 -974
- package/components/grid/filter/customColumnFilter.tsx +0 -14
- package/components/grid/filter/dataGridColumnFilter.tsx +0 -70
- package/components/grid/filter/dateColumnFilter.tsx +0 -34
- package/components/grid/filter/textColumnFilter.tsx +0 -37
- package/components/grid/filter/wildcardQuickFilterEngine.ts +0 -50
- package/components/grid/header/simpleHeader.tsx +0 -270
- package/components/grid/panel/dataGridPagination.tsx +0 -123
- package/components/grid/panel/loadingOverlay.tsx +0 -14
- package/components/grid/panel/noRecordsOverlay.tsx +0 -16
- package/components/grid/panel/tablePagination.tsx +0 -77
- package/components/icons/dropdownArrow.tsx +0 -67
- package/components/icons/undoIcon.tsx +0 -16
- package/components/input/autoCompleteInput.tsx +0 -174
- package/components/input/draftUtils.tsx +0 -62
- package/components/input/hexaFormattedInput.tsx +0 -64
- package/components/input/mask/helpers.ts +0 -154
- package/components/input/mask/inputMaskCore.ts +0 -452
- package/components/input/mask/pattern.ts +0 -122
- package/components/input/maskedInput.tsx +0 -275
- package/components/input/passwordInput.tsx +0 -62
- package/components/input/simpleAutoComplete.tsx +0 -60
- package/components/input/textarea/extractSpansOfClasses.tsx +0 -125
- package/components/input/textarea/getRanges.ts +0 -82
- package/components/input/textarea/getType.ts +0 -23
- package/components/input/textarea/highlighedContents.tsx +0 -20
- package/components/input/textarea/highlightedTextarea.css +0 -61
- package/components/input/textarea/mentionsWithHighlighting.tsx +0 -95
- package/components/keyboard/keyboardUtils.ts +0 -42
- package/components/modal/draggableModalProvider.tsx +0 -37
- package/components/modal/impl/clamp.ts +0 -4
- package/components/modal/impl/draggableModal.tsx +0 -36
- package/components/modal/impl/draggableModalContext.ts +0 -14
- package/components/modal/impl/draggableModalInner.tsx +0 -114
- package/components/modal/impl/draggableModalReducer.ts +0 -285
- package/components/modal/impl/getWindowSize.ts +0 -6
- package/components/modal/impl/index.ts +0 -5
- package/components/modal/impl/resizeHandle.tsx +0 -12
- package/components/modal/impl/useDrag.ts +0 -57
- package/components/modal/impl/usePrevious.ts +0 -11
- package/components/modal/impl/useResize.ts +0 -79
- package/components/modal/modalDialog.tsx +0 -172
- package/components/picker/enumValuePicker.tsx +0 -48
- package/components/platformSpecific.ts +0 -39
- package/components/scrollTo/dom-scroll-into-view.d.ts +0 -1
- package/components/scrollTo/onlyText.ts +0 -36
- package/components/scrollTo/scrollTo.tsx +0 -324
- package/components/style/withCss.tsx +0 -14
- package/components/style/withInputNumberCss.tsx +0 -18
- package/components/svg.d.ts +0 -1
- package/components/table/dragSortingTable.tsx +0 -123
- package/components/text/impl/innerSize.ts +0 -15
- package/components/text/impl/series.ts +0 -37
- package/components/text/impl/shallowEqual.ts +0 -19
- package/components/text/impl/uniqueId.ts +0 -5
- package/components/text/impl/whilst.ts +0 -25
- package/components/text/textFit.tsx +0 -229
- package/i18n/componentsLocaleLoader.d.ts +0 -9
- package/lib/esm/components/codemirror/SyntaxHighlighter.js.map +0 -1
- package/lib/esm/components/color/colorSwatch.d.ts +0 -13
- package/lib/esm/components/color/colorSwatch.js.map +0 -1
- package/lib/esm/components/date/dateRangeInput.js.map +0 -1
- package/lib/esm/components/date/dateTimeInput.js.map +0 -1
- package/lib/esm/components/date/durationInput.js.map +0 -1
- package/lib/esm/components/grid/cell/rangeSelector.d.ts +0 -78
- package/lib/esm/components/grid/cell/rangeSelector.js +0 -527
- package/lib/esm/components/grid/columnUtils.js.map +0 -1
- package/lib/esm/components/grid/export/progressPopup.js.map +0 -1
- package/lib/esm/components/icons/undoIcon.js.map +0 -1
- package/lib/esm/components/input/draftUtils.js.map +0 -1
- package/lib/esm/components/input/draftail.d.ts +0 -1
- package/lib/esm/components/input/draftail.js +0 -2
- package/lib/esm/components/input/mask/inputMaskCore.js.map +0 -1
- package/lib/esm/components/input/mask/pattern.js.map +0 -1
- package/lib/esm/components/input/passwordInput.js.map +0 -1
- package/lib/esm/components/input/textarea/extractSpansOfClasses.js.map +0 -1
- package/lib/esm/components/input/textarea/getRanges.js.map +0 -1
- package/lib/esm/components/input/textarea/mentionsWithHighlighting.js.map +0 -1
- package/lib/esm/components/platformSpecific.js.map +0 -1
- package/lib/esm/components/text/impl/series.js.map +0 -1
- package/lib/esm/components/text/impl/whilst.js.map +0 -1
- package/lib/esm/i18n/components.cs.json +0 -101
- package/lib/esm/i18n/components.sk.json +0 -101
- package/lib/esm/i18n/components.uk.json +0 -101
- package/lib/esm/i18n/componentsLocaleHolder.js +0 -29
- package/lib/esm/i18n/componentsLocaleHolder.js.map +0 -1
- package/lib/esm/package.json +0 -70
- package/lib/esm/tsconfig.build.json +0 -24
- package/lib/esm/tsconfig.json +0 -11
- /package/{lib/esm/components → components}/clipboard/clipboardUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/clipboard/clipboardUtils.js +0 -0
- /package/{lib/esm/components → components}/clipboard/clipboardUtils.js.map +0 -0
- /package/{lib/esm/components → components}/codemirror/SyntaxHighlighter.d.ts +0 -0
- /package/{lib/esm/components → components}/codemirror/SyntaxHighlighter.js +0 -0
- /package/{lib/esm/components → components}/collapse/expandable.d.ts +0 -0
- /package/{lib/esm/components → components}/collapse/expandable.js +0 -0
- /package/{lib/esm/components → components}/collapse/expandable.js.map +0 -0
- /package/{lib/esm/components → components}/color/colorPicker.d.ts +0 -0
- /package/{lib/esm/components → components}/color/colorPicker.js +0 -0
- /package/{lib/esm/components → components}/color/colorPicker.js.map +0 -0
- /package/{lib/esm/components → components}/color/colorSwatch.js +0 -0
- /package/{lib/esm/components → components}/color/colorUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/color/colorUtils.js +0 -0
- /package/{lib/esm/components → components}/color/colorUtils.js.map +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInput.d.ts +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputAdvancedPanel.d.ts +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputAdvancedPanel.js +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputAdvancedPanel.js.map +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputConfirm.d.ts +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputConfirm.js +0 -0
- /package/{lib/esm/components → components}/date/dateRangeInputConfirm.js.map +0 -0
- /package/{lib/esm/components → components}/date/dateTimeInput.d.ts +0 -0
- /package/{lib/esm/components → components}/date/durationInput.d.ts +0 -0
- /package/{lib/esm/components → components}/form/NiceFormItem.d.ts +0 -0
- /package/{lib/esm/components → components}/form/NiceFormItem.js +0 -0
- /package/{lib/esm/components → components}/form/NiceFormItem.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/beanAccessor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/beanAccessor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/beanAccessor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/cellEditorUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/cellEditorUtils.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/customEnumCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/customEnumCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/customEnumCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/dataGridCellEditorComponent.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/dataGridCellEditorComponent.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/dataGridCellEditorComponent.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/dateCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/dateCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/dateCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/durationCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/durationCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/durationCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaOctetStringCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaOctetStringCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaOctetStringCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaValueCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaValueCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/hexaValueCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/numberCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/numberCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/numberCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/rangeSelector.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/simpleStatusTextCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/simpleStatusTextCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/simpleStatusTextCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/statusTextCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/statusTextCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/statusTextCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/tableDefaultRowStyleRules.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/tableDefaultRowStyleRules.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/tableDefaultRowStyleRules.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/textCellEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/textCellEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/textCellEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/cell/withAgGridHooks.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/cell/withAgGridHooks.js +0 -0
- /package/{lib/esm/components → components}/grid/cell/withAgGridHooks.js.map +0 -0
- /package/{lib/esm/components → components}/grid/columnUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/columnUtils.js +0 -0
- /package/{lib/esm/components → components}/grid/config/columnTransfer.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/config/columnTransfer.js +0 -0
- /package/{lib/esm/components → components}/grid/config/columnTransfer.js.map +0 -0
- /package/{lib/esm/components → components}/grid/config/dataGridEditor.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/config/dataGridEditor.js +0 -0
- /package/{lib/esm/components → components}/grid/config/dataGridEditor.js.map +0 -0
- /package/{lib/esm/components → components}/grid/config/rowHeightCalculator.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/config/rowHeightCalculator.js +0 -0
- /package/{lib/esm/components → components}/grid/config/rowHeightCalculator.js.map +0 -0
- /package/{lib/esm/components → components}/grid/config/rowStylePicker.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/config/rowStylePicker.js +0 -0
- /package/{lib/esm/components → components}/grid/config/rowStylePicker.js.map +0 -0
- /package/{lib/esm/components → components}/grid/dataGrid.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/dataGrid.js +0 -0
- /package/{lib/esm/components → components}/grid/dataGrid.js.map +0 -0
- /package/{lib/esm/components → components}/grid/detail/detailHeaderPanel.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/detail/detailHeaderPanel.js +0 -0
- /package/{lib/esm/components → components}/grid/detail/detailHeaderPanel.js.map +0 -0
- /package/{lib/esm/components → components}/grid/export/contextMenu.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/contextMenu.js.map +0 -0
- /package/{lib/esm/components → components}/grid/export/progressPopup.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/progressPopup.js +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/clipboardExport.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/clipboardExport.js +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/csvExport.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/csvExport.js +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/pdfExport.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/pdfExport.js +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/pdfExport.js.map +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/txtExport.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/export/worker/txtExport.js +0 -0
- /package/{lib/esm/components → components}/grid/extendedDataGrid.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/extendedDataGrid.js +0 -0
- /package/{lib/esm/components → components}/grid/extendedDataGrid.js.map +0 -0
- /package/{lib/esm/components → components}/grid/filter/customColumnFilter.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/filter/customColumnFilter.js +0 -0
- /package/{lib/esm/components → components}/grid/filter/customColumnFilter.js.map +0 -0
- /package/{lib/esm/components → components}/grid/filter/dataGridColumnFilter.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/filter/dataGridColumnFilter.js +0 -0
- /package/{lib/esm/components → components}/grid/filter/dataGridColumnFilter.js.map +0 -0
- /package/{lib/esm/components → components}/grid/filter/dateColumnFilter.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/filter/dateColumnFilter.js +0 -0
- /package/{lib/esm/components → components}/grid/filter/dateColumnFilter.js.map +0 -0
- /package/{lib/esm/components → components}/grid/filter/textColumnFilter.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/filter/textColumnFilter.js +0 -0
- /package/{lib/esm/components → components}/grid/filter/textColumnFilter.js.map +0 -0
- /package/{lib/esm/components → components}/grid/filter/wildcardQuickFilterEngine.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/filter/wildcardQuickFilterEngine.js +0 -0
- /package/{lib/esm/components → components}/grid/filter/wildcardQuickFilterEngine.js.map +0 -0
- /package/{lib/esm/components → components}/grid/header/simpleHeader.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/header/simpleHeader.js +0 -0
- /package/{lib/esm/components → components}/grid/header/simpleHeader.js.map +0 -0
- /package/{lib/esm/components → components}/grid/panel/dataGridPagination.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/panel/dataGridPagination.js +0 -0
- /package/{lib/esm/components → components}/grid/panel/dataGridPagination.js.map +0 -0
- /package/{lib/esm/components → components}/grid/panel/loadingOverlay.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/panel/loadingOverlay.js +0 -0
- /package/{lib/esm/components → components}/grid/panel/loadingOverlay.js.map +0 -0
- /package/{lib/esm/components → components}/grid/panel/noRecordsOverlay.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/panel/noRecordsOverlay.js +0 -0
- /package/{lib/esm/components → components}/grid/panel/noRecordsOverlay.js.map +0 -0
- /package/{lib/esm/components → components}/grid/panel/tablePagination.d.ts +0 -0
- /package/{lib/esm/components → components}/grid/panel/tablePagination.js +0 -0
- /package/{lib/esm/components → components}/grid/panel/tablePagination.js.map +0 -0
- /package/{lib/esm/components → components}/icons/dropdownArrow.d.ts +0 -0
- /package/{lib/esm/components → components}/icons/dropdownArrow.js +0 -0
- /package/{lib/esm/components → components}/icons/dropdownArrow.js.map +0 -0
- /package/{lib/esm/components → components}/icons/undoIcon.d.ts +0 -0
- /package/{lib/esm/components → components}/icons/undoIcon.js +0 -0
- /package/{lib/esm/components → components}/input/autoCompleteInput.d.ts +0 -0
- /package/{lib/esm/components → components}/input/autoCompleteInput.js +0 -0
- /package/{lib/esm/components → components}/input/autoCompleteInput.js.map +0 -0
- /package/{lib/esm/components → components}/input/draftUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/input/draftUtils.js +0 -0
- /package/{lib/esm/components → components}/input/hexaFormattedInput.d.ts +0 -0
- /package/{lib/esm/components → components}/input/hexaFormattedInput.js +0 -0
- /package/{lib/esm/components → components}/input/hexaFormattedInput.js.map +0 -0
- /package/{lib/esm/components → components}/input/mask/helpers.d.ts +0 -0
- /package/{lib/esm/components → components}/input/mask/helpers.js +0 -0
- /package/{lib/esm/components → components}/input/mask/helpers.js.map +0 -0
- /package/{lib/esm/components → components}/input/mask/inputMaskCore.d.ts +0 -0
- /package/{lib/esm/components → components}/input/mask/inputMaskCore.js +0 -0
- /package/{lib/esm/components → components}/input/mask/pattern.d.ts +0 -0
- /package/{lib/esm/components → components}/input/mask/pattern.js +0 -0
- /package/{lib/esm/components → components}/input/maskedInput.d.ts +0 -0
- /package/{lib/esm/components → components}/input/maskedInput.js +0 -0
- /package/{lib/esm/components → components}/input/maskedInput.js.map +0 -0
- /package/{lib/esm/components → components}/input/passwordInput.d.ts +0 -0
- /package/{lib/esm/components → components}/input/passwordInput.js +0 -0
- /package/{lib/esm/components → components}/input/simpleAutoComplete.d.ts +0 -0
- /package/{lib/esm/components → components}/input/simpleAutoComplete.js +0 -0
- /package/{lib/esm/components → components}/input/simpleAutoComplete.js.map +0 -0
- /package/{lib/esm/components → components}/input/textarea/extractSpansOfClasses.d.ts +0 -0
- /package/{lib/esm/components → components}/input/textarea/extractSpansOfClasses.js +0 -0
- /package/{lib/esm/components → components}/input/textarea/getRanges.d.ts +0 -0
- /package/{lib/esm/components → components}/input/textarea/getRanges.js +0 -0
- /package/{lib/esm/components → components}/input/textarea/getType.d.ts +0 -0
- /package/{lib/esm/components → components}/input/textarea/getType.js +0 -0
- /package/{lib/esm/components → components}/input/textarea/highlighedContents.d.ts +0 -0
- /package/{lib/esm/components → components}/input/textarea/highlighedContents.js +0 -0
- /package/{lib/esm/components → components}/input/textarea/mentionsWithHighlighting.d.ts +0 -0
- /package/{lib/esm/components → components}/input/textarea/mentionsWithHighlighting.js +0 -0
- /package/{lib/esm/components → components}/keyboard/keyboardUtils.d.ts +0 -0
- /package/{lib/esm/components → components}/keyboard/keyboardUtils.js +0 -0
- /package/{lib/esm/components → components}/modal/draggableModalProvider.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/draggableModalProvider.js +0 -0
- /package/{lib/esm/components → components}/modal/draggableModalProvider.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/clamp.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/clamp.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/clamp.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModal.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModal.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModal.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalContext.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalContext.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalContext.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalInner.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalInner.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalInner.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalReducer.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalReducer.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/draggableModalReducer.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/getWindowSize.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/getWindowSize.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/getWindowSize.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/index.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/index.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/index.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/resizeHandle.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/resizeHandle.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/resizeHandle.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/useDrag.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/useDrag.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/useDrag.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/usePrevious.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/usePrevious.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/usePrevious.js.map +0 -0
- /package/{lib/esm/components → components}/modal/impl/useResize.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/impl/useResize.js +0 -0
- /package/{lib/esm/components → components}/modal/impl/useResize.js.map +0 -0
- /package/{lib/esm/components → components}/modal/modalDialog.d.ts +0 -0
- /package/{lib/esm/components → components}/modal/modalDialog.js +0 -0
- /package/{lib/esm/components → components}/modal/modalDialog.js.map +0 -0
- /package/{lib/esm/components → components}/picker/enumValuePicker.d.ts +0 -0
- /package/{lib/esm/components → components}/picker/enumValuePicker.js +0 -0
- /package/{lib/esm/components → components}/picker/enumValuePicker.js.map +0 -0
- /package/{lib/esm/components → components}/platformSpecific.d.ts +0 -0
- /package/{lib/esm/components → components}/platformSpecific.js +0 -0
- /package/{lib/esm/components → components}/scrollTo/onlyText.d.ts +0 -0
- /package/{lib/esm/components → components}/scrollTo/onlyText.js +0 -0
- /package/{lib/esm/components → components}/scrollTo/onlyText.js.map +0 -0
- /package/{lib/esm/components → components}/scrollTo/scrollTo.d.ts +0 -0
- /package/{lib/esm/components → components}/scrollTo/scrollTo.js +0 -0
- /package/{lib/esm/components → components}/scrollTo/scrollTo.js.map +0 -0
- /package/{lib/esm/components → components}/style/withCss.d.ts +0 -0
- /package/{lib/esm/components → components}/style/withCss.js +0 -0
- /package/{lib/esm/components → components}/style/withCss.js.map +0 -0
- /package/{lib/esm/components → components}/style/withInputNumberCss.d.ts +0 -0
- /package/{lib/esm/components → components}/style/withInputNumberCss.js +0 -0
- /package/{lib/esm/components → components}/style/withInputNumberCss.js.map +0 -0
- /package/{lib/esm/components → components}/table/dragSortingTable.d.ts +0 -0
- /package/{lib/esm/components → components}/table/dragSortingTable.js +0 -0
- /package/{lib/esm/components → components}/table/dragSortingTable.js.map +0 -0
- /package/{lib/esm/components → components}/text/impl/innerSize.d.ts +0 -0
- /package/{lib/esm/components → components}/text/impl/innerSize.js +0 -0
- /package/{lib/esm/components → components}/text/impl/series.d.ts +0 -0
- /package/{lib/esm/components → components}/text/impl/series.js +0 -0
- /package/{lib/esm/components → components}/text/impl/shallowEqual.d.ts +0 -0
- /package/{lib/esm/components → components}/text/impl/shallowEqual.js +0 -0
- /package/{lib/esm/components → components}/text/impl/uniqueId.d.ts +0 -0
- /package/{lib/esm/components → components}/text/impl/uniqueId.js +0 -0
- /package/{lib/esm/components → components}/text/impl/whilst.d.ts +0 -0
- /package/{lib/esm/components → components}/text/impl/whilst.js +0 -0
- /package/{lib/esm/components → components}/text/textFit.d.ts +0 -0
- /package/{lib/esm/components → components}/text/textFit.js +0 -0
- /package/{lib/esm/components → components}/text/textFit.js.map +0 -0
- /package/{lib/esm/i18n → i18n}/componentsLocaleHolder.d.ts +0 -0
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
import {DEFAULT_PLACEHOLDER_CHAR, FormatCharacters, mergeFormatCharacters} from './helpers';
|
|
2
|
-
import {Pattern} from './pattern';
|
|
3
|
-
|
|
4
|
-
type SelectionObject = { start: number; end: number };
|
|
5
|
-
|
|
6
|
-
type Options = {
|
|
7
|
-
formatCharacters: FormatCharacters;
|
|
8
|
-
pattern: string;
|
|
9
|
-
isRevealingMask: boolean;
|
|
10
|
-
placeholderChar: string;
|
|
11
|
-
selection: SelectionObject;
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class InputMask {
|
|
16
|
-
static Pattern = Pattern;
|
|
17
|
-
|
|
18
|
-
formatCharacters!: FormatCharacters;
|
|
19
|
-
pattern!: Pattern;
|
|
20
|
-
isRevealingMask!: boolean;
|
|
21
|
-
placeholderChar!: string;
|
|
22
|
-
selection!: SelectionObject;
|
|
23
|
-
value!: string[];
|
|
24
|
-
emptyValue = '';
|
|
25
|
-
|
|
26
|
-
_history: {
|
|
27
|
-
value: string;
|
|
28
|
-
selection: SelectionObject;
|
|
29
|
-
lastOp: string | null;
|
|
30
|
-
startUndo?: boolean;
|
|
31
|
-
}[] = [];
|
|
32
|
-
|
|
33
|
-
_historyIndex: null | number = null;
|
|
34
|
-
_lastOp: null | string = null;
|
|
35
|
-
_lastSelection: null | SelectionObject = null;
|
|
36
|
-
|
|
37
|
-
constructor(options: Partial<Options>) {
|
|
38
|
-
const mergedOptions: Options = {
|
|
39
|
-
...{
|
|
40
|
-
isRevealingMask: false,
|
|
41
|
-
placeholderChar: DEFAULT_PLACEHOLDER_CHAR,
|
|
42
|
-
selection: {start: 0, end: 0},
|
|
43
|
-
value: ''
|
|
44
|
-
},
|
|
45
|
-
...options
|
|
46
|
-
} as Options;
|
|
47
|
-
|
|
48
|
-
if (!mergedOptions.pattern) {
|
|
49
|
-
throw new Error('InputMask: you must provide a pattern.');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
typeof mergedOptions.placeholderChar !== 'string' ||
|
|
54
|
-
mergedOptions.placeholderChar.length > 1
|
|
55
|
-
) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
'InputMask: placeholderChar should be a single character or an empty string.'
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.placeholderChar = mergedOptions.placeholderChar;
|
|
62
|
-
this.formatCharacters = mergeFormatCharacters(
|
|
63
|
-
mergedOptions.formatCharacters
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
this.setPattern(mergedOptions.pattern, {
|
|
67
|
-
value: mergedOptions.value,
|
|
68
|
-
selection: mergedOptions.selection,
|
|
69
|
-
isRevealingMask: mergedOptions.isRevealingMask
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
setPattern(patternSource: string, options: Partial<Options>) {
|
|
74
|
-
const merged = {
|
|
75
|
-
selection: {start: 0, end: 0},
|
|
76
|
-
value: '',
|
|
77
|
-
...options
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
this.pattern = new Pattern(
|
|
81
|
-
patternSource,
|
|
82
|
-
this.formatCharacters,
|
|
83
|
-
this.placeholderChar,
|
|
84
|
-
merged.isRevealingMask
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
this.setValue(merged.value);
|
|
88
|
-
|
|
89
|
-
this.emptyValue = this.pattern.formatValue([]).join('');
|
|
90
|
-
this.selection = merged.selection;
|
|
91
|
-
this._resetHistory();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setValue(value?: string) {
|
|
95
|
-
if (value == null) {
|
|
96
|
-
value = '';
|
|
97
|
-
}
|
|
98
|
-
this.value = this.pattern.formatValue((value || '').split(''));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
_resetHistory() {
|
|
102
|
-
this._history = [];
|
|
103
|
-
this._historyIndex = null;
|
|
104
|
-
this._lastOp = null;
|
|
105
|
-
this._lastSelection = {...this.selection};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
getValue(): string {
|
|
109
|
-
if (this.pattern.isRevealingMask) {
|
|
110
|
-
this.value = this.pattern.formatValue(
|
|
111
|
-
(this.getRawValue() || '').split('')
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
return (this.value || []).join('');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
getRawValue(): string {
|
|
118
|
-
var rawValue = [];
|
|
119
|
-
for (var i = 0; i < this.value.length; i++) {
|
|
120
|
-
if (this.pattern._editableIndices[i] === true) {
|
|
121
|
-
rawValue.push(this.value[i]);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return rawValue.join('');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Applies a single character of input based on the current selection.
|
|
129
|
-
* @param {string} char
|
|
130
|
-
* @return {boolean} true if a change has been made to value or selection as a
|
|
131
|
-
* result of the input, false otherwise.
|
|
132
|
-
*/
|
|
133
|
-
input(char: string) {
|
|
134
|
-
// Ignore additional input if the cursor's at the end of the pattern
|
|
135
|
-
if (
|
|
136
|
-
this.selection.start === this.selection.end &&
|
|
137
|
-
this.selection.start === this.pattern.length
|
|
138
|
-
) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const selectionBefore = copy(this.selection);
|
|
143
|
-
const valueBefore = this.getValue();
|
|
144
|
-
|
|
145
|
-
let inputIndex = this.selection.start;
|
|
146
|
-
|
|
147
|
-
// If the cursor or selection is prior to the first editable character, make
|
|
148
|
-
// sure any input given is applied to it.
|
|
149
|
-
if (this.pattern.firstEditableIndex && inputIndex < this.pattern.firstEditableIndex) {
|
|
150
|
-
inputIndex = this.pattern.firstEditableIndex;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Bail out or add the character to input
|
|
154
|
-
if (this.pattern.isEditableIndex(inputIndex)) {
|
|
155
|
-
if (!this.pattern.isValidAtIndex(char, inputIndex)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
this.value[inputIndex] = this.pattern.transform(char, inputIndex);
|
|
159
|
-
} else {
|
|
160
|
-
console.log('not editable');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// If multiple characters were selected, blank the remainder out based on the
|
|
164
|
-
// pattern.
|
|
165
|
-
let end = this.selection.end - 1;
|
|
166
|
-
while (end > inputIndex) {
|
|
167
|
-
if (this.pattern.isEditableIndex(end)) {
|
|
168
|
-
this.value[end] = this.placeholderChar;
|
|
169
|
-
}
|
|
170
|
-
end--;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Advance the cursor to the next character
|
|
174
|
-
this.selection.start = this.selection.end = inputIndex + 1;
|
|
175
|
-
|
|
176
|
-
// Skip over any subsequent static characters
|
|
177
|
-
while (
|
|
178
|
-
this.pattern.length > this.selection.start &&
|
|
179
|
-
!this.pattern.isEditableIndex(this.selection.start)
|
|
180
|
-
) {
|
|
181
|
-
this.selection.start++;
|
|
182
|
-
this.selection.end++;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// History
|
|
186
|
-
if (this._historyIndex != null) {
|
|
187
|
-
// Took more input after undoing, so blow any subsequent history away
|
|
188
|
-
this._history.splice(
|
|
189
|
-
this._historyIndex,
|
|
190
|
-
this._history.length - this._historyIndex
|
|
191
|
-
);
|
|
192
|
-
this._historyIndex = null;
|
|
193
|
-
}
|
|
194
|
-
if (
|
|
195
|
-
this._lastOp !== 'input' ||
|
|
196
|
-
selectionBefore.start !== selectionBefore.end ||
|
|
197
|
-
(this._lastSelection !== null &&
|
|
198
|
-
selectionBefore.start !== this._lastSelection.start)
|
|
199
|
-
) {
|
|
200
|
-
this._history.push({
|
|
201
|
-
value: valueBefore,
|
|
202
|
-
selection: selectionBefore,
|
|
203
|
-
lastOp: this._lastOp
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
this._lastOp = 'input';
|
|
207
|
-
this._lastSelection = copy(this.selection);
|
|
208
|
-
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Attempts to delete from the value based on the current cursor position or
|
|
214
|
-
* selection.
|
|
215
|
-
* @return {boolean} true if the value or selection changed as the result of
|
|
216
|
-
* backspacing, false otherwise.
|
|
217
|
-
*/
|
|
218
|
-
backspace() {
|
|
219
|
-
// If the cursor is at the start there's nothing to do
|
|
220
|
-
if (this.selection.start === 0 && this.selection.end === 0) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
var selectionBefore = {...this.selection};
|
|
225
|
-
var valueBefore = this.getValue();
|
|
226
|
-
|
|
227
|
-
// No range selected - work on the character preceding the cursor
|
|
228
|
-
if (this.selection.start === this.selection.end) {
|
|
229
|
-
if (this.pattern.isEditableIndex(this.selection.start - 1)) {
|
|
230
|
-
if (this.pattern.isRevealingMask) {
|
|
231
|
-
this.value.splice(this.selection.start - 1);
|
|
232
|
-
} else {
|
|
233
|
-
this.value[this.selection.start - 1] = this.placeholderChar;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
this.selection.start--;
|
|
237
|
-
this.selection.end--;
|
|
238
|
-
}
|
|
239
|
-
// Range selected - delete characters and leave the cursor at the start of the selection
|
|
240
|
-
else {
|
|
241
|
-
var end = this.selection.end - 1;
|
|
242
|
-
while (end >= this.selection.start) {
|
|
243
|
-
if (this.pattern.isEditableIndex(end)) {
|
|
244
|
-
this.value[end] = this.placeholderChar;
|
|
245
|
-
}
|
|
246
|
-
end--;
|
|
247
|
-
}
|
|
248
|
-
this.selection.end = this.selection.start;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// History
|
|
252
|
-
if (this._historyIndex != null) {
|
|
253
|
-
// Took more input after undoing, so blow any subsequent history away
|
|
254
|
-
this._history.splice(
|
|
255
|
-
this._historyIndex,
|
|
256
|
-
this._history.length - this._historyIndex
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
if (
|
|
260
|
-
this._lastOp !== 'backspace' ||
|
|
261
|
-
selectionBefore.start !== selectionBefore.end ||
|
|
262
|
-
(this._lastSelection !== null &&
|
|
263
|
-
selectionBefore.start !== this._lastSelection.start)
|
|
264
|
-
) {
|
|
265
|
-
this._history.push({
|
|
266
|
-
value: valueBefore,
|
|
267
|
-
selection: selectionBefore,
|
|
268
|
-
lastOp: this._lastOp
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
this._lastOp = 'backspace';
|
|
272
|
-
this._lastSelection = {...this.selection};
|
|
273
|
-
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Attempts to paste a string of input at the current cursor position or over
|
|
279
|
-
* the top of the current selection.
|
|
280
|
-
* Invalid content at any position will cause the paste to be rejected, and it
|
|
281
|
-
* may contain static parts of the mask's pattern.
|
|
282
|
-
* @param {string} input
|
|
283
|
-
* @return {boolean} true if the paste was successful, false otherwise.
|
|
284
|
-
*/
|
|
285
|
-
paste(input: string) {
|
|
286
|
-
// This is necessary because we're just calling input() with each character
|
|
287
|
-
// and rolling back if any were invalid, rather than checking up-front.
|
|
288
|
-
var initialState = {
|
|
289
|
-
value: this.value.slice(),
|
|
290
|
-
selection: {...this.selection},
|
|
291
|
-
_lastOp: this._lastOp,
|
|
292
|
-
_history: this._history.slice(),
|
|
293
|
-
_historyIndex: this._historyIndex,
|
|
294
|
-
_lastSelection: {...this._lastSelection}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// If there are static characters at the start of the pattern and the cursor
|
|
298
|
-
// or selection is within them, the static characters must match for a valid
|
|
299
|
-
// paste.
|
|
300
|
-
if (this.selection.start < this.pattern.firstEditableIndex!) {
|
|
301
|
-
for (
|
|
302
|
-
var i = 0, l = this.pattern.firstEditableIndex! - this.selection.start;
|
|
303
|
-
i < l;
|
|
304
|
-
i++
|
|
305
|
-
) {
|
|
306
|
-
if (input.charAt(i) !== this.pattern.pattern[i]) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Continue as if the selection and input started from the editable part of
|
|
312
|
-
// the pattern.
|
|
313
|
-
input = input.substring(
|
|
314
|
-
this.pattern.firstEditableIndex! - this.selection.start
|
|
315
|
-
);
|
|
316
|
-
this.selection.start = this.pattern.firstEditableIndex!;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
for (
|
|
320
|
-
i = 0, l = input.length;
|
|
321
|
-
i < l && this.selection.start <= this.pattern.lastEditableIndex!;
|
|
322
|
-
i++
|
|
323
|
-
) {
|
|
324
|
-
var valid = this.input(input.charAt(i));
|
|
325
|
-
// Allow static parts of the pattern to appear in pasted input - they will
|
|
326
|
-
// already have been stepped over by input(), so verify that the value
|
|
327
|
-
// deemed invalid by input() was the expected static character.
|
|
328
|
-
if (!valid) {
|
|
329
|
-
if (this.selection.start > 0) {
|
|
330
|
-
// XXX This only allows for one static character to be skipped
|
|
331
|
-
var patternIndex = this.selection.start - 1;
|
|
332
|
-
if (
|
|
333
|
-
!this.pattern.isEditableIndex(patternIndex) &&
|
|
334
|
-
input.charAt(i) === this.pattern.pattern[patternIndex]
|
|
335
|
-
) {
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
Object.keys(initialState).forEach(key => {
|
|
341
|
-
// @ts-ignore
|
|
342
|
-
this[key] = initialState[key];
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
undo() {
|
|
353
|
-
// If there is no history, or nothing more on the history stack, we can't undo
|
|
354
|
-
if (this._history.length === 0 || this._historyIndex === 0) {
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var historyItem;
|
|
359
|
-
if (this._historyIndex == null) {
|
|
360
|
-
// Not currently undoing, set up the initial history index
|
|
361
|
-
this._historyIndex = this._history.length - 1;
|
|
362
|
-
historyItem = this._history[this._historyIndex];
|
|
363
|
-
// Add a new history entry if anything has changed since the last one, so we
|
|
364
|
-
// can redo back to the initial state we started undoing from.
|
|
365
|
-
var value = this.getValue();
|
|
366
|
-
if (
|
|
367
|
-
historyItem.value !== value ||
|
|
368
|
-
historyItem.selection.start !== this.selection.start ||
|
|
369
|
-
historyItem.selection.end !== this.selection.end
|
|
370
|
-
) {
|
|
371
|
-
this._history.push({
|
|
372
|
-
value: value,
|
|
373
|
-
selection: {...this.selection},
|
|
374
|
-
lastOp: this._lastOp,
|
|
375
|
-
startUndo: true
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
historyItem = this._history[--this._historyIndex];
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
this.value = historyItem.value.split('');
|
|
383
|
-
this.selection = historyItem.selection;
|
|
384
|
-
this._lastOp = historyItem.lastOp;
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
redo() {
|
|
389
|
-
if (this._history.length === 0 || this._historyIndex == null) {
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
var historyItem = this._history[++this._historyIndex];
|
|
393
|
-
// If this is the last history item, we're done redoing
|
|
394
|
-
if (this._historyIndex === this._history.length - 1) {
|
|
395
|
-
this._historyIndex = null;
|
|
396
|
-
// If the last history item was only added to start undoing, remove it
|
|
397
|
-
if (historyItem.startUndo) {
|
|
398
|
-
this._history.pop();
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
this.value = historyItem.value.split('');
|
|
402
|
-
this.selection = historyItem.selection;
|
|
403
|
-
this._lastOp = historyItem.lastOp;
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
setSelection(selection: SelectionObject) {
|
|
408
|
-
this.selection = {...selection};
|
|
409
|
-
|
|
410
|
-
if (this.selection.start === this.selection.end) {
|
|
411
|
-
if (this.selection.start < this.pattern.firstEditableIndex!) {
|
|
412
|
-
this.selection!.start = this.selection!.end = this.pattern
|
|
413
|
-
.firstEditableIndex as number;
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
// Set selection to the first editable, non-placeholder character before the selection
|
|
417
|
-
// OR to the beginning of the pattern
|
|
418
|
-
var index = this.selection.start;
|
|
419
|
-
while (index >= this.pattern.firstEditableIndex!) {
|
|
420
|
-
if (
|
|
421
|
-
(this.pattern.isEditableIndex(index - 1) &&
|
|
422
|
-
this.value[index - 1] !== this.placeholderChar) ||
|
|
423
|
-
index === this.pattern.firstEditableIndex
|
|
424
|
-
) {
|
|
425
|
-
this.selection.start = this.selection.end = index;
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
index--;
|
|
429
|
-
}
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function extend(dest: any, src: any) {
|
|
437
|
-
if (src) {
|
|
438
|
-
let props = Object.keys(src);
|
|
439
|
-
|
|
440
|
-
for (var i = 0, l = props.length; i < l; i++) {
|
|
441
|
-
dest[props[i]] = src[props[i]];
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
return dest;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function copy<T = any>(obj: T): T {
|
|
449
|
-
return extend({}, obj);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
export default InputMask;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {DEFAULT_FORMAT_CHARACTERS, DEFAULT_PLACEHOLDER_CHAR, ESCAPE_CHAR, FormatCharacters,} from './helpers';
|
|
2
|
-
|
|
3
|
-
export class Pattern {
|
|
4
|
-
placeholderChar: string;
|
|
5
|
-
formatCharacters: FormatCharacters;
|
|
6
|
-
source: string;
|
|
7
|
-
|
|
8
|
-
/** Pattern characters after escape characters have been processed. */
|
|
9
|
-
pattern = [];
|
|
10
|
-
|
|
11
|
-
/** Length of the pattern after escape characters have been processed. */
|
|
12
|
-
length = 0;
|
|
13
|
-
|
|
14
|
-
/** Index of the first editable character. */
|
|
15
|
-
firstEditableIndex: null | number = null;
|
|
16
|
-
|
|
17
|
-
/** Index of the last editable character. */
|
|
18
|
-
lastEditableIndex: null | number = null;
|
|
19
|
-
|
|
20
|
-
/** Lookup for indices of editable characters in the pattern. */
|
|
21
|
-
_editableIndices: { [key: number]: boolean } = {};
|
|
22
|
-
|
|
23
|
-
/** If true, only the pattern before the last valid value character shows. */
|
|
24
|
-
isRevealingMask: boolean;
|
|
25
|
-
|
|
26
|
-
constructor(
|
|
27
|
-
source: string,
|
|
28
|
-
formatCharacters: FormatCharacters,
|
|
29
|
-
placeholderChar: string,
|
|
30
|
-
isRevealingMask = false,
|
|
31
|
-
) {
|
|
32
|
-
/** Placeholder character */
|
|
33
|
-
this.placeholderChar = placeholderChar || DEFAULT_PLACEHOLDER_CHAR;
|
|
34
|
-
/** Format character definitions. */
|
|
35
|
-
this.formatCharacters = formatCharacters || DEFAULT_FORMAT_CHARACTERS;
|
|
36
|
-
/** Pattern definition string with escape characters. */
|
|
37
|
-
this.source = source;
|
|
38
|
-
|
|
39
|
-
this.isRevealingMask = isRevealingMask;
|
|
40
|
-
|
|
41
|
-
this._parse();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_parse() {
|
|
45
|
-
var sourceChars = this.source.split('');
|
|
46
|
-
var patternIndex = 0;
|
|
47
|
-
var pattern: string[] = [];
|
|
48
|
-
|
|
49
|
-
for (var i = 0, l = sourceChars.length; i < l; i++) {
|
|
50
|
-
var char = sourceChars[i];
|
|
51
|
-
if (char === ESCAPE_CHAR) {
|
|
52
|
-
if (i === l - 1) {
|
|
53
|
-
throw new Error('InputMask: pattern ends with a raw ' + ESCAPE_CHAR);
|
|
54
|
-
}
|
|
55
|
-
char = sourceChars[++i];
|
|
56
|
-
} else if (char in this.formatCharacters) {
|
|
57
|
-
if (this.firstEditableIndex === null) {
|
|
58
|
-
this.firstEditableIndex = patternIndex;
|
|
59
|
-
}
|
|
60
|
-
this.lastEditableIndex = patternIndex;
|
|
61
|
-
this._editableIndices[patternIndex] = true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
pattern.push(char);
|
|
65
|
-
patternIndex++;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (this.firstEditableIndex === null) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
'InputMask: pattern "' + this.source + '" does not contain any editable characters.',
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
this.pattern = pattern;
|
|
76
|
-
this.length = pattern.length;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
formatValue(value: string[]): string[] {
|
|
80
|
-
var valueBuffer = new Array(this.length);
|
|
81
|
-
var valueIndex = 0;
|
|
82
|
-
|
|
83
|
-
for (var i = 0, l = this.length; i < l; i++) {
|
|
84
|
-
if (this.isEditableIndex(i)) {
|
|
85
|
-
if (
|
|
86
|
-
this.isRevealingMask &&
|
|
87
|
-
value.length <= valueIndex &&
|
|
88
|
-
!this.isValidAtIndex(value[valueIndex], i)
|
|
89
|
-
) {
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
valueBuffer[i] =
|
|
93
|
-
value.length > valueIndex && this.isValidAtIndex(value[valueIndex], i)
|
|
94
|
-
? this.transform(value[valueIndex], i)
|
|
95
|
-
: this.placeholderChar;
|
|
96
|
-
valueIndex++;
|
|
97
|
-
} else {
|
|
98
|
-
valueBuffer[i] = this.pattern[i];
|
|
99
|
-
// Also allow the value to contain static values from the pattern by
|
|
100
|
-
// advancing its index.
|
|
101
|
-
if (value.length > valueIndex && value[valueIndex] === this.pattern[i]) {
|
|
102
|
-
valueIndex++;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return valueBuffer;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
isEditableIndex(index: number) {
|
|
111
|
-
return !!this._editableIndices[index];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
isValidAtIndex(char: string, index: number) {
|
|
115
|
-
return this.formatCharacters[this.pattern[index]].validate(char);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
transform(char: string, index: number) {
|
|
119
|
-
var format = this.formatCharacters[this.pattern[index]];
|
|
120
|
-
return typeof format.transform == 'function' ? format.transform(char) : char;
|
|
121
|
-
}
|
|
122
|
-
}
|