d2coreui 23.0.52 → 23.0.54
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/CHANGELOG.md +40 -0
- package/README.md +154 -0
- package/components/clipboard/clipboardUtils.d.ts +11 -0
- package/components/clipboard/clipboardUtils.js +16 -4
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +13 -0
- package/components/codemirror/SyntaxHighlighter.js +6 -1
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +10 -0
- package/components/collapse/expandable.js +4 -0
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +16 -0
- package/components/color/colorPicker.js +4 -0
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +16 -0
- package/components/color/colorSwatch.js +23 -2
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +9 -0
- package/components/color/colorUtils.js +15 -0
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +76 -0
- package/components/date/dateRangeInput.js +63 -12
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -0
- package/components/date/dateRangeInputAdvancedPanel.js +7 -0
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +18 -0
- package/components/date/dateRangeInputConfirm.js +12 -0
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +99 -0
- package/components/date/dateTimeInput.js +78 -6
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +37 -0
- package/components/date/durationInput.js +26 -3
- package/components/date/durationInput.js.map +1 -1
- package/components/date/savedIntervals.d.ts +63 -0
- package/components/date/savedIntervals.js +37 -0
- package/components/date/savedIntervals.js.map +1 -1
- package/components/date/savedIntervalsDialog.d.ts +13 -0
- package/components/date/savedIntervalsDialog.js +7 -2
- package/components/date/savedIntervalsDialog.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +9 -0
- package/components/form/NiceFormItem.js +4 -0
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +12 -0
- package/components/grid/cell/beanAccessor.js +8 -0
- package/components/grid/cell/beanAccessor.js.map +1 -1
- package/components/grid/cell/bigNumberCellEditor.d.ts +9 -0
- package/components/grid/cell/bigNumberCellEditor.js +19 -0
- package/components/grid/cell/bigNumberCellEditor.js.map +1 -1
- package/components/grid/cell/cellControl.d.ts +4 -0
- package/components/grid/cell/cellControl.js +14 -0
- package/components/grid/cell/cellControl.js.map +1 -1
- package/components/grid/cell/cellEditorUtils.d.ts +6 -0
- package/components/grid/cell/cellEditorUtils.js +6 -0
- package/components/grid/cell/cellEditorUtils.js.map +1 -1
- package/components/grid/cell/customEnumCellEditor.d.ts +6 -0
- package/components/grid/cell/customEnumCellEditor.js +10 -0
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +26 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +21 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -1
- package/components/grid/cell/dateCellEditor.d.ts +6 -0
- package/components/grid/cell/dateCellEditor.js +10 -0
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/dragListenerFeature.d.ts +6 -0
- package/components/grid/cell/dragListenerFeature.js +6 -0
- package/components/grid/cell/dragListenerFeature.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +6 -0
- package/components/grid/cell/durationCellEditor.js +14 -0
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +6 -0
- package/components/grid/cell/hexaOctetStringCellEditor.js +14 -0
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +6 -0
- package/components/grid/cell/hexaValueCellEditor.js +14 -0
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +6 -0
- package/components/grid/cell/numberCellEditor.js +15 -0
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +7 -0
- package/components/grid/cell/rangeSelector.js +59 -5
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +7 -0
- package/components/grid/cell/simpleStatusTextCellEditor.js +11 -0
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +7 -0
- package/components/grid/cell/statusTextCellEditor.js +17 -0
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +31 -0
- package/components/grid/cell/tableDefaultRowStyleRules.js +5 -0
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +6 -0
- package/components/grid/cell/textCellEditor.js +15 -0
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +8 -0
- package/components/grid/cell/withAgGridHooks.js +8 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -1
- package/components/grid/columnUtils.d.ts +10 -1
- package/components/grid/columnUtils.js +11 -0
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +18 -0
- package/components/grid/config/columnTransfer.js +45 -29
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +31 -0
- package/components/grid/config/dataGridEditor.js +14 -2
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +11 -0
- package/components/grid/config/rowHeightCalculator.js +11 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -1
- package/components/grid/config/rowStylePicker.d.ts +19 -0
- package/components/grid/config/rowStylePicker.js +12 -0
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +361 -12
- package/components/grid/dataGrid.js +201 -28
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +11 -0
- package/components/grid/detail/detailHeaderPanel.js +5 -0
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +31 -0
- package/components/grid/export/contextMenu.js +8 -0
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +21 -0
- package/components/grid/export/progressPopup.js +17 -0
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/pdfExport.js +5 -0
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +249 -4
- package/components/grid/extendedDataGrid.js +160 -19
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -0
- package/components/grid/filter/customColumnFilter.js +5 -0
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +19 -0
- package/components/grid/filter/dataGridColumnFilter.js +19 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -1
- package/components/grid/filter/dateColumnFilter.d.ts +6 -0
- package/components/grid/filter/dateColumnFilter.js +6 -0
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +6 -0
- package/components/grid/filter/textColumnFilter.js +6 -0
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +21 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +21 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -1
- package/components/grid/header/simpleHeader.d.ts +17 -0
- package/components/grid/header/simpleHeader.js +20 -0
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +10 -0
- package/components/grid/panel/dataGridPagination.js +5 -0
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +5 -0
- package/components/grid/panel/loadingOverlay.js +4 -0
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -0
- package/components/grid/panel/noRecordsOverlay.js +5 -0
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +4 -0
- package/components/grid/panel/tablePagination.js +4 -0
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +3 -0
- package/components/icons/dropdownArrow.js +2 -0
- package/components/icons/dropdownArrow.js.map +1 -1
- package/components/icons/undoIcon.d.ts +2 -0
- package/components/icons/undoIcon.js +2 -0
- package/components/icons/undoIcon.js.map +1 -1
- package/components/input/autoCompleteInput.d.ts +29 -0
- package/components/input/autoCompleteInput.js +7 -0
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +7 -0
- package/components/input/draftUtils.js +9 -0
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/hexaFormattedInput.d.ts +9 -0
- package/components/input/hexaFormattedInput.js +3 -0
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +27 -0
- package/components/input/mask/helpers.js +27 -0
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +80 -0
- package/components/input/mask/inputMaskCore.js +90 -0
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +24 -0
- package/components/input/mask/pattern.js +26 -0
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +53 -0
- package/components/input/maskedInput.js +44 -4
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +7 -0
- package/components/input/passwordInput.js +8 -0
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +6 -0
- package/components/input/simpleAutoComplete.js +6 -0
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +17 -0
- package/components/input/textarea/extractSpansOfClasses.js +26 -1
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +7 -0
- package/components/input/textarea/getRanges.js +11 -0
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +5 -0
- package/components/input/textarea/getType.js +5 -0
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +4 -0
- package/components/input/textarea/highlighedContents.js +5 -0
- package/components/input/textarea/highlighedContents.js.map +1 -1
- package/components/input/textarea/mentionsWithHighlighting.d.ts +25 -0
- package/components/input/textarea/mentionsWithHighlighting.js +14 -0
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +6 -0
- package/components/keyboard/keyboardUtils.js +6 -0
- package/components/keyboard/keyboardUtils.js.map +1 -1
- package/components/modal/draggableModalProvider.d.ts +6 -0
- package/components/modal/draggableModalProvider.js +7 -0
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.js +1 -0
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +1 -0
- package/components/modal/impl/draggableModal.js +6 -0
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.js +1 -0
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.js +12 -1
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +7 -1
- package/components/modal/impl/draggableModalReducer.js +6 -1
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/draggableModalStyles.d.ts +17 -0
- package/components/modal/impl/draggableModalStyles.js +31 -0
- package/components/modal/impl/draggableModalStyles.js.map +1 -1
- package/components/modal/impl/getWindowSize.js +1 -0
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.js +1 -0
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +1 -0
- package/components/modal/impl/resizeHandle.js +4 -1
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.js +1 -0
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.js +1 -0
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.js +1 -0
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +85 -0
- package/components/modal/modalDialog.js +80 -10
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +17 -0
- package/components/picker/enumValuePicker.js +4 -0
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +17 -0
- package/components/platformSpecific.js +16 -0
- package/components/platformSpecific.js.map +1 -1
- package/components/scrollTo/onlyText.d.ts +5 -0
- package/components/scrollTo/onlyText.js +5 -0
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +56 -0
- package/components/scrollTo/scrollTo.js +40 -3
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +15 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -1
- package/components/table/dragSortingTable.d.ts +15 -0
- package/components/table/dragSortingTable.js +12 -0
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.js +2 -0
- package/components/text/impl/innerSize.js.map +1 -1
- package/components/text/impl/series.d.ts +10 -0
- package/components/text/impl/series.js +10 -0
- package/components/text/impl/series.js.map +1 -1
- package/components/text/impl/shallowEqual.js +1 -0
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/whilst.d.ts +7 -0
- package/components/text/impl/whilst.js +7 -0
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +24 -0
- package/components/text/textFit.js +29 -1
- package/components/text/textFit.js.map +1 -1
- package/i18n/componentsLocaleHolder.d.ts +9 -0
- package/i18n/componentsLocaleHolder.js +9 -0
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +66 -65
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorSwatch.js","sourceRoot":"","sources":["../../../../components/color/colorSwatch.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,QAAQ,EAAE,EAAC,WAAW,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,0CAA0C,CAAA;AAE/D,SAAS,WAAW,CAAC,GAAG,EAAE,EAAE;IACxB,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"colorSwatch.js","sourceRoot":"","sources":["../../../../components/color/colorSwatch.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,QAAQ,EAAE,EAAC,WAAW,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,0CAA0C,CAAA;AAE/D,SAAS,WAAW,CAAC,GAAG,EAAE,EAAE;IACxB,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,mCAAmC;IACnC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnB,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,G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EAAE,EAAE,MAAM,EAAE,EAAE,EAAC;oBACnD,8BAAM,CAAC,EAAC,yDAAyD,GAAE,CACjE,CACJ;QACN,oBAAC,MAAM,IACH,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,WAAW,EACvB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACd,CACA,CACT,CAAA;AACL,CAAC;AAED,qEAAqE;AACrE,eAAe,WAAW,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import React from 'react'\r\nimport reactCSS, {handleHover} from 'reactcss'\r\nimport {Swatch} from 'react-color/lib/components/common/Swatch'\r\n\r\nfunction invertColor(hex, bw) {\r\n if (hex.indexOf('#') === 0) {\r\n hex = hex.slice(1);\r\n }\r\n // convert 3-digit hex to 6-digits.\r\n if (hex.length === 3) {\r\n hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\r\n }\r\n if (hex.length !== 6) {\r\n throw new Error('Invalid HEX color.');\r\n }\r\n var r = parseInt(hex.slice(0, 2), 16),\r\n g = parseInt(hex.slice(2, 4), 16),\r\n b = parseInt(hex.slice(4, 6), 16);\r\n if (bw) {\r\n // http://stackoverflow.com/a/3943023/112731\r\n return (r * 0.299 + g * 0.587 + b * 0.114) > 186\r\n ? '#000000'\r\n : '#FFFFFF';\r\n }\r\n // invert color components\r\n r = (255 - r).toString(16);\r\n g = (255 - g).toString(16);\r\n b = (255 - b).toString(16);\r\n // pad each with zeros and return\r\n return \"#\" + padZero(r) + padZero(g) + padZero(b);\r\n}\r\n\r\n/**\r\n * Single color square (based on react-color's `Swatch`) that can be marked as selected. The default export adds the\r\n * hover zoom; this named export is the bare component that receives `hover` from outside.\r\n *\r\n * Props:\r\n * - `color` - color of the swatch; must be a hex string (e.g. `\"#ff0000\"`) when `active` is set.\r\n * - `active` - marks the swatch as selected: it is enlarged and shows a check mark in black or white, whichever\r\n * contrasts better.\r\n * - `small` - renders a 15px swatch without the hover zoom instead of the default 22px one.\r\n * - `onClick(color, event)` - called on click or Enter key; receives the `color` prop value as passed (not a converted\r\n * react-color `ColorResult`).\r\n * - `onSwatchHover(color, event)` - called when the mouse enters the swatch; receives the `color` prop value as passed.\r\n * - `title` - tooltip of the swatch; defaults to the color value.\r\n * - `style` - style of the inner swatch element.\r\n * - `hover` - whether the swatch is hovered (enlarges it unless `small`); supplied by the default export.\r\n */\r\nexport function ColorSwatch({hover, color, onClick, onSwatchHover, style, title, active, small}) {\r\n const hoverSwatch = {\r\n transform: \"scale(1.5)\",\r\n position: 'relative',\r\n zIndex: '3',\r\n }\r\n const focusSwatch = {\r\n position: 'relative',\r\n zIndex: '2',\r\n transform: \"scale(1.2)\",\r\n boxShadow: '0 0 5px 2px rgba(0,0,0,0.25)',\r\n cursor:\"pointer\"\r\n }\r\n\r\n const styles = reactCSS({\r\n 'default': {\r\n swatch: {\r\n display: \"inline-block\",\r\n transform: \"scale(1)\",\r\n width: !!small ? '15px' : '22px',\r\n height: !!small ? '15px' : '22px',\r\n margin: '2px',\r\n marginTop: 0,\r\n marginBottom: 0,\r\n fontSize: '0',\r\n },\r\n },\r\n 'hover': {\r\n swatch: small ? {} : hoverSwatch,\r\n },\r\n }, {hover})\r\n\r\n\r\n return (\r\n <div style={styles.swatch}>\r\n {active &&\r\n <div style={{fill: invertColor(color, true), position: \"absolute\", left: 1, top: 1, zIndex: 10,}}>\r\n <svg viewBox=\"0 0 24 24\" style={{width: 20, height: 20}}>\r\n <path d=\"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z\"/>\r\n </svg>\r\n </div>}\r\n <Swatch\r\n color={color}\r\n onClick={onClick}\r\n onHover={onSwatchHover}\r\n focus={active}\r\n focusStyle={focusSwatch}\r\n style={style}\r\n title={title}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\n/** {@link ColorSwatch} that zooms on hover; see it for the props. */\r\nexport default handleHover(ColorSwatch)"]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/** Conversions between D2000 integer colors and CSS colors. D2000 encodes colors as `0xBBGGRR` integers. */
|
|
1
2
|
export default class ColorUtils {
|
|
3
|
+
/** Converts a D2000 color (`0xBBGGRR`) to a CSS `rgb(r,g,b)` string. */
|
|
2
4
|
static d2IntToRGB(num: number): string;
|
|
5
|
+
/** Converts a D2000 color (`0xBBGGRR`) to a CSS `#rrggbb` string. */
|
|
3
6
|
static d2IntToHex(num: number): string;
|
|
7
|
+
/** Converts a CSS `#rrggbb` string (6 hex digits with the leading `#`) to a D2000 color (`0xBBGGRR`). */
|
|
4
8
|
static hexToD2Int(hex: string): number;
|
|
5
9
|
private static padZero;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the inverse of a hex color (`#rrggbb` or `#rgb`, the `#` is optional) as `#rrggbb`.
|
|
12
|
+
* @param bw when `true`, returns `#000000` or `#FFFFFF`, whichever contrasts better with the color
|
|
13
|
+
* @throws Error when the color is not a valid 3- or 6-digit hex color
|
|
14
|
+
*/
|
|
6
15
|
static invertColor(hex: string, bw: boolean): string;
|
|
7
16
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
/** Conversions between D2000 integer colors and CSS colors. D2000 encodes colors as `0xBBGGRR` integers. */
|
|
1
2
|
export default class ColorUtils {
|
|
3
|
+
/** Converts a D2000 color (`0xBBGGRR`) to a CSS `rgb(r,g,b)` string. */
|
|
2
4
|
static d2IntToRGB(num) {
|
|
5
|
+
// d2000 posiela farbu vo formate bgr
|
|
3
6
|
const b = (num & 0xFF0000) >>> 16, g = (num & 0xFF00) >>> 8, r = num & 0xFF;
|
|
4
7
|
return "rgb(" + [r, g, b].join(",") + ")";
|
|
5
8
|
}
|
|
9
|
+
/** Converts a D2000 color (`0xBBGGRR`) to a CSS `#rrggbb` string. */
|
|
6
10
|
static d2IntToHex(num) {
|
|
11
|
+
// d2000 posiela farbu vo formate bgr
|
|
7
12
|
const b = (num & 0xFF0000) >>> 16, g = (num & 0xFF00) >>> 8, r = num & 0xFF;
|
|
8
13
|
return "#" + r.toString(16).padStart(2, '0') + g.toString(16).padStart(2, '0') + b.toString(16).padStart(2, '0');
|
|
9
14
|
}
|
|
15
|
+
/** Converts a CSS `#rrggbb` string (6 hex digits with the leading `#`) to a D2000 color (`0xBBGGRR`). */
|
|
10
16
|
static hexToD2Int(hex) {
|
|
11
17
|
const r = parseInt(hex.slice(1, 1 + 2), 16), g = (parseInt(hex.slice(3, 3 + 2), 16) << 8), b = (parseInt(hex.slice(5, 5 + 2), 16) << 16);
|
|
12
18
|
return r + g + b;
|
|
@@ -17,10 +23,16 @@ export default class ColorUtils {
|
|
|
17
23
|
}
|
|
18
24
|
return s;
|
|
19
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the inverse of a hex color (`#rrggbb` or `#rgb`, the `#` is optional) as `#rrggbb`.
|
|
28
|
+
* @param bw when `true`, returns `#000000` or `#FFFFFF`, whichever contrasts better with the color
|
|
29
|
+
* @throws Error when the color is not a valid 3- or 6-digit hex color
|
|
30
|
+
*/
|
|
20
31
|
static invertColor(hex, bw) {
|
|
21
32
|
if (hex.indexOf('#') === 0) {
|
|
22
33
|
hex = hex.slice(1);
|
|
23
34
|
}
|
|
35
|
+
// convert 3-digit hex to 6-digits.
|
|
24
36
|
if (hex.length === 3) {
|
|
25
37
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
26
38
|
}
|
|
@@ -31,13 +43,16 @@ export default class ColorUtils {
|
|
|
31
43
|
const g = parseInt(hex.slice(2, 4), 16);
|
|
32
44
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
33
45
|
if (bw) {
|
|
46
|
+
// http://stackoverflow.com/a/3943023/112731
|
|
34
47
|
return (r * 0.299 + g * 0.587 + b * 0.114) > 186
|
|
35
48
|
? '#000000'
|
|
36
49
|
: '#FFFFFF';
|
|
37
50
|
}
|
|
51
|
+
// invert color components
|
|
38
52
|
const rString = (255 - r).toString(16);
|
|
39
53
|
const gString = (255 - g).toString(16);
|
|
40
54
|
const bString = (255 - b).toString(16);
|
|
55
|
+
// pad each with zeros and return
|
|
41
56
|
return "#" + this.padZero(rString) + this.padZero(gString) + this.padZero(bString);
|
|
42
57
|
}
|
|
43
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorUtils.js","sourceRoot":"","sources":["../../../../components/color/colorUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,MAAM,CAAC,UAAU,CAAC,GAAW;
|
|
1
|
+
{"version":3,"file":"colorUtils.js","sourceRoot":"","sources":["../../../../components/color/colorUtils.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,wEAAwE;IACxE,MAAM,CAAC,UAAU,CAAC,GAAW;QACzB,qCAAqC;QACrC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,EAC7B,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;QACnB,OAAO,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC9C,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,UAAU,CAAC,GAAW;QACzB,qCAAqC;QACrC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,EAC7B,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;QACnB,OAAO,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ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ACvF,CAAC;CACJ","sourcesContent":["/** Conversions between D2000 integer colors and CSS colors. D2000 encodes colors as `0xBBGGRR` integers. */\r\nexport default class ColorUtils {\r\n /** Converts a D2000 color (`0xBBGGRR`) to a CSS `rgb(r,g,b)` string. */\r\n static d2IntToRGB(num: number): string {\r\n // d2000 posiela farbu vo formate bgr\r\n const b = (num & 0xFF0000) >>> 16,\r\n g = (num & 0xFF00) >>> 8,\r\n r = num & 0xFF;\r\n return \"rgb(\" + [r, g, b].join(\",\") + \")\";\r\n }\r\n\r\n /** Converts a D2000 color (`0xBBGGRR`) to a CSS `#rrggbb` string. */\r\n static d2IntToHex(num: number): string {\r\n // d2000 posiela farbu vo formate bgr\r\n const b = (num & 0xFF0000) >>> 16,\r\n g = (num & 0xFF00) >>> 8,\r\n r = num & 0xFF;\r\n return \"#\" + r.toString(16).padStart(2, '0') + g.toString(16).padStart(2, '0') + b.toString(16).padStart(2, '0');\r\n }\r\n\r\n /** Converts a CSS `#rrggbb` string (6 hex digits with the leading `#`) to a D2000 color (`0xBBGGRR`). */\r\n static hexToD2Int(hex: string): number {\r\n const r = parseInt(hex.slice(1, 1 + 2), 16),\r\n g = (parseInt(hex.slice(3, 3 + 2), 16) << 8),\r\n b = (parseInt(hex.slice(5, 5 + 2), 16) << 16);\r\n\r\n return r + g + b;\r\n }\r\n\r\n private static padZero(s: string, length: number = 2) {\r\n while (s.length < length) {\r\n s = '0' + s;\r\n }\r\n return s;\r\n }\r\n\r\n /**\r\n * Returns the inverse of a hex color (`#rrggbb` or `#rgb`, the `#` is optional) as `#rrggbb`.\r\n * @param bw when `true`, returns `#000000` or `#FFFFFF`, whichever contrasts better with the color\r\n * @throws Error when the color is not a valid 3- or 6-digit hex color\r\n */\r\n static invertColor(hex: string, bw: boolean) {\r\n if (hex.indexOf('#') === 0) {\r\n hex = hex.slice(1);\r\n }\r\n // convert 3-digit hex to 6-digits.\r\n if (hex.length === 3) {\r\n hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];\r\n }\r\n if (hex.length !== 6) {\r\n throw new Error('Invalid HEX color.');\r\n }\r\n const r = parseInt(hex.slice(0, 2), 16);\r\n const g = parseInt(hex.slice(2, 4), 16);\r\n const b = parseInt(hex.slice(4, 6), 16);\r\n if (bw) {\r\n // http://stackoverflow.com/a/3943023/112731\r\n return (r * 0.299 + g * 0.587 + b * 0.114) > 186\r\n ? '#000000'\r\n : '#FFFFFF';\r\n }\r\n // invert color components\r\n const rString = (255 - r).toString(16);\r\n const gString = (255 - g).toString(16);\r\n const bString = (255 - b).toString(16);\r\n // pad each with zeros and return\r\n return \"#\" + this.padZero(rString) + this.padZero(gString) + this.padZero(bString);\r\n }\r\n}"]}
|
|
@@ -5,30 +5,63 @@ import { SizeType } from "antd/lib/config-provider/SizeContext";
|
|
|
5
5
|
import { InputStatus } from "antd/es/_util/statusUtils";
|
|
6
6
|
import { Variant } from "antd/es/config-provider";
|
|
7
7
|
import { IntervalStorage, QuickRange, SavedInterval } from "./savedIntervals";
|
|
8
|
+
/** Layout of the {@link DateRangeInput} popup. */
|
|
8
9
|
export declare enum DateRangeInputMode {
|
|
10
|
+
/** Two month calendars (click a day or drag across days) plus the {@link DateRangeInputProps.ranges} presets. */
|
|
9
11
|
SIMPLE = 0,
|
|
12
|
+
/** Two date-time inputs plus buttons for interval begin/end, duration and time shift. */
|
|
10
13
|
ADVANCED = 1
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Props of {@link DateRangeInput}. Remaining HTML attributes are forwarded to the inner {@link DateTimeInput}s,
|
|
17
|
+
* except `style` and `className`, which apply to the root element.
|
|
18
|
+
*/
|
|
12
19
|
export interface DateRangeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
20
|
+
/** dayjs format of both bounds - see {@link DateTimeInput} `mask` for the supported tokens. */
|
|
13
21
|
mask: string;
|
|
22
|
+
/** Start of the range (controlled), in local time. */
|
|
14
23
|
fromValue: Dayjs | null;
|
|
24
|
+
/** End of the range (controlled), in local time. The component does not enforce `fromValue <= toValue`. */
|
|
15
25
|
toValue: Dayjs | null;
|
|
26
|
+
/**
|
|
27
|
+
* Called with both bounds whenever either one changes: typing in one of the inputs, picking or dragging
|
|
28
|
+
* days in the calendars (the time of day of the current bounds is kept - 00:00:00.000 / 23:59:59.999 when
|
|
29
|
+
* they are `null`), a preset from {@link DateRangeInputProps.ranges}, an advanced-mode button or a saved interval.
|
|
30
|
+
* Advanced-mode buttons and saved intervals clamp the result to {@link DateRangeInputProps.minDateTime}/{@link DateRangeInputProps.maxDateTime}.
|
|
31
|
+
*/
|
|
16
32
|
onChange?: (fromValue: Dayjs | null, toValue: Dayjs | null) => void;
|
|
33
|
+
/** Called with the raw text of a bound whose typed text is not a valid (or allowed) value. */
|
|
17
34
|
onInvalidValue?: (input: string) => void;
|
|
35
|
+
/** Disables both inputs and the popup. */
|
|
18
36
|
disabled?: boolean;
|
|
37
|
+
/** Earliest allowed value of both bounds (inclusive). */
|
|
19
38
|
minDateTime?: Dayjs;
|
|
39
|
+
/** Latest allowed value of both bounds (inclusive). */
|
|
20
40
|
maxDateTime?: Dayjs;
|
|
41
|
+
/** Allows a bound to be cleared by emptying its input; it is then reported as `null`. */
|
|
21
42
|
allowClear?: boolean;
|
|
43
|
+
/** Preset ranges shown as clickable tags in the {@link DateRangeInputMode.SIMPLE} popup; the key is the label, the function returns `[from, to]` when clicked. */
|
|
22
44
|
ranges?: {
|
|
23
45
|
[rangeName: string]: () => [Dayjs, Dayjs];
|
|
24
46
|
};
|
|
47
|
+
/** antd control size. */
|
|
25
48
|
size?: SizeType;
|
|
49
|
+
/** antd validation status of the whole range input. */
|
|
26
50
|
status?: InputStatus;
|
|
51
|
+
/** antd input variant of the whole range input; defaults to the `ConfigProvider` one. */
|
|
27
52
|
variant?: Variant;
|
|
53
|
+
/**
|
|
54
|
+
* Compact popup: always the advanced layout without the mode switch, the separator and the "Interval End"
|
|
55
|
+
* column; {@link DateRangeInputProps.defaultMode} is ignored.
|
|
56
|
+
*/
|
|
28
57
|
compact?: boolean;
|
|
58
|
+
/** Renders only the two inputs - no calendar icon and no popup. */
|
|
29
59
|
hidePopup?: boolean;
|
|
60
|
+
/** Renders only the popup content inline, without the inputs. */
|
|
30
61
|
renderAsCalendar?: boolean;
|
|
62
|
+
/** Placement of the popup relative to the input. */
|
|
31
63
|
placement?: TooltipPlacement;
|
|
64
|
+
/** Fine alignment of the popup (rc-trigger `align`), applied on top of {@link DateRangeInputProps.placement}. */
|
|
32
65
|
align?: {
|
|
33
66
|
points?: [string, string];
|
|
34
67
|
offset?: [number, number];
|
|
@@ -41,13 +74,32 @@ export interface DateRangeInputProps extends Omit<HTMLAttributes<HTMLDivElement>
|
|
|
41
74
|
useCssBottom?: boolean;
|
|
42
75
|
useCssTransform?: boolean;
|
|
43
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Initial popup mode (uncontrolled - read only on mount); the user switches it with the switch in the popup.
|
|
79
|
+
* @default DateRangeInputMode.SIMPLE
|
|
80
|
+
*/
|
|
44
81
|
defaultMode?: DateRangeInputMode;
|
|
82
|
+
/**
|
|
83
|
+
* Shows an icon opening a dropdown with: saving the current range to quick access (the latest
|
|
84
|
+
* `MAX_QUICK_RANGES` are kept), the quick-access ranges, the {@link SavedIntervalsDialog} and the
|
|
85
|
+
* saved relative intervals. Intervals are loaded when this becomes `true` and whenever {@link DateRangeInputProps.intervalStorage} changes.
|
|
86
|
+
*/
|
|
45
87
|
showCustomIntervals?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Where quick-access ranges and saved intervals are persisted - see {@link IntervalStorage}. Compared by
|
|
90
|
+
* reference, so pass a stable object: a new one reloads the intervals.
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
46
93
|
intervalStorage?: IntervalStorage;
|
|
94
|
+
/** Called when the user toggles the popup between {@link DateRangeInputMode.SIMPLE} and {@link DateRangeInputMode.ADVANCED}. */
|
|
47
95
|
onModeChange?(mode: DateRangeInputMode): void;
|
|
96
|
+
/** Called when the popup opens and when focus enters the inputs or the popup content. */
|
|
48
97
|
onFocus?(): void;
|
|
98
|
+
/** Called when the popup closes and when focus leaves the inputs or the popup content. */
|
|
49
99
|
onBlur?(): void;
|
|
100
|
+
/** Renders extra content (e.g. confirm buttons) at the right side of the popup footer. */
|
|
50
101
|
confirmButtonsRenderer?(): React.ReactNode;
|
|
102
|
+
/** Called when the popup opens or closes. */
|
|
51
103
|
onPopupVisibleChange?(visible: boolean): void;
|
|
52
104
|
}
|
|
53
105
|
interface DateRangeInputState {
|
|
@@ -61,6 +113,23 @@ interface DateRangeInputState {
|
|
|
61
113
|
intervalsLoading: boolean;
|
|
62
114
|
configDialogOpen: boolean;
|
|
63
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Controlled date-time range input: two masked {@link DateTimeInput}s in one antd-styled box with a popup
|
|
118
|
+
* that opens on right-click or via the calendar icon. The popup offers calendars and presets
|
|
119
|
+
* ({@link DateRangeInputMode.SIMPLE}) or interval shortcuts ({@link DateRangeInputMode.ADVANCED}).
|
|
120
|
+
* Every change is reported immediately; use `DateRangeInputConfirm` to apply changes only on confirmation.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const [range, setRange] = useState<[Dayjs | null, Dayjs | null]>([dayjs().startOf("day"), dayjs().endOf("day")]);
|
|
124
|
+
*
|
|
125
|
+
* <DateRangeInput
|
|
126
|
+
* mask={LocaleHolder.getDateTimeFormat(true, true)}
|
|
127
|
+
* fromValue={range[0]}
|
|
128
|
+
* toValue={range[1]}
|
|
129
|
+
* onChange={(from, to) => setRange([from, to])}
|
|
130
|
+
* ranges={DateTimeUtils.getRanges([DateTimeInterval.DAY_ACT, DateTimeInterval.WEEK_ACT])}
|
|
131
|
+
* />
|
|
132
|
+
*/
|
|
64
133
|
export default class DateRangeInput extends React.Component<DateRangeInputProps, DateRangeInputState> {
|
|
65
134
|
private storageProvider;
|
|
66
135
|
constructor(props: Readonly<DateRangeInputProps>);
|
|
@@ -71,14 +140,21 @@ export default class DateRangeInput extends React.Component<DateRangeInputProps,
|
|
|
71
140
|
private saveCurrentRangeToQuickAccess;
|
|
72
141
|
private buildIntervalMenu;
|
|
73
142
|
private onIntervalMenuClick;
|
|
143
|
+
/**
|
|
144
|
+
* Day whose month the left ("from") calendar shows: one month before `fromDate` when both bounds fall on the
|
|
145
|
+
* same day (so the two calendars show different months), otherwise `fromDate` (one month before today when `null`).
|
|
146
|
+
*/
|
|
74
147
|
getDefaultSelectedDateForFromPanel(fromDate: Dayjs | null, toDate: Dayjs | null): Dayjs;
|
|
75
148
|
private getFromValue;
|
|
76
149
|
private getToValue;
|
|
150
|
+
/** Closes the popup and calls {@link DateRangeInputProps.onPopupVisibleChange} with `false`. */
|
|
77
151
|
closePopup(): void;
|
|
78
152
|
private onChange;
|
|
79
153
|
private renderSimplePart;
|
|
80
154
|
private renderAdvancedPart;
|
|
155
|
+
/** Renders the popup content - the whole component with {@link DateRangeInputProps.renderAsCalendar}. */
|
|
81
156
|
renderPopup(): React.ReactElement;
|
|
157
|
+
/** Renders the two inputs with their icons and the saved-intervals dialog, without the popup. */
|
|
82
158
|
renderInput(): React.JSX.Element;
|
|
83
159
|
render(): any;
|
|
84
160
|
}
|
|
@@ -30,11 +30,17 @@ const useStyles = createStyles(({ token, css }, props) => {
|
|
|
30
30
|
middle: token.controlHeight,
|
|
31
31
|
large: token.controlHeightLG,
|
|
32
32
|
};
|
|
33
|
+
// mirrors antd input component tokens `paddingInline(SM|LG)`
|
|
33
34
|
const paddingInlineMap = {
|
|
34
35
|
small: token.controlPaddingHorizontalSM - token.lineWidth,
|
|
35
36
|
middle: token.paddingSM - token.lineWidth,
|
|
36
37
|
large: token.controlPaddingHorizontal - token.lineWidth,
|
|
37
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* One block per antd input variant, mirroring `antd/es/input/style/variants.js`.
|
|
41
|
+
* `.focused` stands for the open-popup state, which antd renders as active - not disabled.
|
|
42
|
+
*/
|
|
43
|
+
// genOutlinedStyle + genOutlinedStatusStyle
|
|
38
44
|
const outlined = css `
|
|
39
45
|
background-color: ${token.colorBgContainer};
|
|
40
46
|
border: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};
|
|
@@ -96,6 +102,8 @@ const useStyles = createStyles(({ token, css }, props) => {
|
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
`;
|
|
105
|
+
// genUnderlinedStyle - bottom border only, no radius, no focus shadow and, notably,
|
|
106
|
+
// no disabled background fill
|
|
99
107
|
const underlined = css `
|
|
100
108
|
background-color: ${token.colorBgContainer};
|
|
101
109
|
border-width: ${token.lineWidth}px 0;
|
|
@@ -145,6 +153,7 @@ const useStyles = createStyles(({ token, css }, props) => {
|
|
|
145
153
|
}
|
|
146
154
|
}
|
|
147
155
|
`;
|
|
156
|
+
// genFilledStyle + genFilledStatusStyle
|
|
148
157
|
const filled = css `
|
|
149
158
|
background: ${token.colorFillTertiary};
|
|
150
159
|
border: ${token.lineWidth}px ${token.lineType} transparent;
|
|
@@ -207,6 +216,7 @@ const useStyles = createStyles(({ token, css }, props) => {
|
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
`;
|
|
219
|
+
// genBorderlessStyle - only the text colour reacts to status, the affix is left alone
|
|
210
220
|
const borderless = css `
|
|
211
221
|
background: transparent;
|
|
212
222
|
border: none;
|
|
@@ -235,8 +245,11 @@ const useStyles = createStyles(({ token, css }, props) => {
|
|
|
235
245
|
}
|
|
236
246
|
`;
|
|
237
247
|
const variantStyles = { outlined, underlined, filled, borderless }[variant];
|
|
248
|
+
// underlined is the only variant antd renders without a radius
|
|
238
249
|
const hasRadius = variant !== "underlined";
|
|
250
|
+
// antd derives the height from padding + border, so a borderless input ends up 2 * lineWidth shorter
|
|
239
251
|
const height = heightMap[size] - (variant === "borderless" ? 2 * token.lineWidth : 0);
|
|
252
|
+
// antd colours prefix/suffix by status in every variant except borderless
|
|
240
253
|
const statusAffix = variant !== "borderless";
|
|
241
254
|
return {
|
|
242
255
|
baseLayout: css `
|
|
@@ -355,11 +368,50 @@ const usePopupStyles = createStyles(({ token, css }) => {
|
|
|
355
368
|
`,
|
|
356
369
|
};
|
|
357
370
|
});
|
|
371
|
+
/** Layout of the {@link DateRangeInput} popup. */
|
|
358
372
|
export var DateRangeInputMode;
|
|
359
373
|
(function (DateRangeInputMode) {
|
|
374
|
+
/** Two month calendars (click a day or drag across days) plus the {@link DateRangeInputProps.ranges} presets. */
|
|
360
375
|
DateRangeInputMode[DateRangeInputMode["SIMPLE"] = 0] = "SIMPLE";
|
|
376
|
+
/** Two date-time inputs plus buttons for interval begin/end, duration and time shift. */
|
|
361
377
|
DateRangeInputMode[DateRangeInputMode["ADVANCED"] = 1] = "ADVANCED";
|
|
362
378
|
})(DateRangeInputMode || (DateRangeInputMode = {}));
|
|
379
|
+
// a value within 1 minute before the end of a month (23:59, 23:59:59, 23:59:59.999) counts as the end of the month
|
|
380
|
+
const MONTH_END_TOLERANCE_MS = 60000;
|
|
381
|
+
// units whose length depends on the length of a month
|
|
382
|
+
const MONTH_BASED_UNITS = ["month", "months", "M", "year", "years", "y"];
|
|
383
|
+
/**
|
|
384
|
+
* Shifts the value by `amount` units of `unit`. If the value lies at the end of a month and is shifted by a month
|
|
385
|
+
* or a year, it stays at the end of the month after the shift (30.09. 23:59:59.999 - 1 month = 31.08. 23:59:59.999, not 30.08.).
|
|
386
|
+
* Other values are shifted normally (15.09. - 1 month = 15.08.).
|
|
387
|
+
*/
|
|
388
|
+
function shiftDateValue(value, amount, unit) {
|
|
389
|
+
if (MONTH_BASED_UNITS.includes(unit)) {
|
|
390
|
+
const nextMonthStart = value.endOf("month").add(1, "millisecond");
|
|
391
|
+
const gap = nextMonthStart.diff(value);
|
|
392
|
+
if (gap <= MONTH_END_TOLERANCE_MS) {
|
|
393
|
+
return nextMonthStart.add(amount, unit).subtract(gap, "millisecond");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return value.add(amount, unit);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Controlled date-time range input: two masked {@link DateTimeInput}s in one antd-styled box with a popup
|
|
400
|
+
* that opens on right-click or via the calendar icon. The popup offers calendars and presets
|
|
401
|
+
* ({@link DateRangeInputMode.SIMPLE}) or interval shortcuts ({@link DateRangeInputMode.ADVANCED}).
|
|
402
|
+
* Every change is reported immediately; use `DateRangeInputConfirm` to apply changes only on confirmation.
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* const [range, setRange] = useState<[Dayjs | null, Dayjs | null]>([dayjs().startOf("day"), dayjs().endOf("day")]);
|
|
406
|
+
*
|
|
407
|
+
* <DateRangeInput
|
|
408
|
+
* mask={LocaleHolder.getDateTimeFormat(true, true)}
|
|
409
|
+
* fromValue={range[0]}
|
|
410
|
+
* toValue={range[1]}
|
|
411
|
+
* onChange={(from, to) => setRange([from, to])}
|
|
412
|
+
* ranges={DateTimeUtils.getRanges([DateTimeInterval.DAY_ACT, DateTimeInterval.WEEK_ACT])}
|
|
413
|
+
* />
|
|
414
|
+
*/
|
|
363
415
|
export default class DateRangeInput extends React.Component {
|
|
364
416
|
constructor(props) {
|
|
365
417
|
var _a;
|
|
@@ -493,6 +545,10 @@ export default class DateRangeInput extends React.Component {
|
|
|
493
545
|
}
|
|
494
546
|
}
|
|
495
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* Day whose month the left ("from") calendar shows: one month before `fromDate` when both bounds fall on the
|
|
550
|
+
* same day (so the two calendars show different months), otherwise `fromDate` (one month before today when `null`).
|
|
551
|
+
*/
|
|
496
552
|
getDefaultSelectedDateForFromPanel(fromDate, toDate) {
|
|
497
553
|
if (!!fromDate && !!toDate && fromDate.isSame(toDate, "date")) {
|
|
498
554
|
return fromDate.clone().subtract(1, "month");
|
|
@@ -509,8 +565,10 @@ export default class DateRangeInput extends React.Component {
|
|
|
509
565
|
var _a, _b;
|
|
510
566
|
return ((_b = (_a = this.props.toValue) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : dayjs().endOf("day")).year(date.year()).month(date.month()).date(date.date());
|
|
511
567
|
}
|
|
568
|
+
/** Closes the popup and calls {@link DateRangeInputProps.onPopupVisibleChange} with `false`. */
|
|
512
569
|
closePopup() {
|
|
513
570
|
var _a, _b;
|
|
571
|
+
// close tooltip
|
|
514
572
|
this.setState({ popupKeyIndex: this.state.popupKeyIndex + 1, popupVisible: false });
|
|
515
573
|
(_b = (_a = this.props).onPopupVisibleChange) === null || _b === void 0 ? void 0 : _b.call(_a, false);
|
|
516
574
|
}
|
|
@@ -640,21 +698,12 @@ export default class DateRangeInput extends React.Component {
|
|
|
640
698
|
var _a, _b;
|
|
641
699
|
let fromValue = (_a = this.props.fromValue) !== null && _a !== void 0 ? _a : null;
|
|
642
700
|
let toValue = (_b = this.props.toValue) !== null && _b !== void 0 ? _b : null;
|
|
701
|
+
const amount = type === TimeShiftDirection.INCREMENT ? 1 : -1;
|
|
643
702
|
if (shiftBegin && fromValue) {
|
|
644
|
-
|
|
645
|
-
fromValue = fromValue.add(1, unitOfTime);
|
|
646
|
-
}
|
|
647
|
-
else if (type === TimeShiftDirection.DECREMENT) {
|
|
648
|
-
fromValue = fromValue.subtract(1, unitOfTime);
|
|
649
|
-
}
|
|
703
|
+
fromValue = shiftDateValue(fromValue, amount, unitOfTime);
|
|
650
704
|
}
|
|
651
705
|
if (shiftEnd && toValue) {
|
|
652
|
-
|
|
653
|
-
toValue = toValue.add(1, unitOfTime);
|
|
654
|
-
}
|
|
655
|
-
else if (type === TimeShiftDirection.DECREMENT) {
|
|
656
|
-
toValue = toValue.subtract(1, unitOfTime);
|
|
657
|
-
}
|
|
706
|
+
toValue = shiftDateValue(toValue, amount, unitOfTime);
|
|
658
707
|
}
|
|
659
708
|
this.onChange(fromValue, toValue);
|
|
660
709
|
}, onEndIntervalChange: unit => {
|
|
@@ -669,6 +718,7 @@ export default class DateRangeInput extends React.Component {
|
|
|
669
718
|
this.onChange(this.props.fromValue, to);
|
|
670
719
|
} }))));
|
|
671
720
|
}
|
|
721
|
+
/** Renders the popup content - the whole component with {@link DateRangeInputProps.renderAsCalendar}. */
|
|
672
722
|
renderPopup() {
|
|
673
723
|
var _a, _b;
|
|
674
724
|
return (React.createElement("div", { onFocus: this.props.onFocus, onBlur: this.props.onBlur },
|
|
@@ -685,6 +735,7 @@ export default class DateRangeInput extends React.Component {
|
|
|
685
735
|
}, checkedChildren: i18n("Advanced Mode"), unCheckedChildren: i18n("Simple Mode") })), (_b = (_a = this.props).confirmButtonsRenderer) === null || _b === void 0 ? void 0 :
|
|
686
736
|
_b.call(_a))));
|
|
687
737
|
}
|
|
738
|
+
/** Renders the two inputs with their icons and the saved-intervals dialog, without the popup. */
|
|
688
739
|
renderInput() {
|
|
689
740
|
const _a = this.props, { className, fromValue, toValue, onChange, style, allowClear, renderAsCalendar, hidePopup, align, disabled, defaultMode, onModeChange, confirmButtonsRenderer, onPopupVisibleChange, showCustomIntervals, intervalStorage, size, status, variant } = _a, props = __rest(_a, ["className", "fromValue", "toValue", "onChange", "style", "allowClear", "renderAsCalendar", "hidePopup", "align", "disabled", "defaultMode", "onModeChange", "confirmButtonsRenderer", "onPopupVisibleChange", "showCustomIntervals", "intervalStorage", "size", "status", "variant"]);
|
|
690
741
|
return (React.createElement("div", { style: Object.assign(Object.assign({}, style), { padding: 0, position: "relative" }), className: className, onFocus: this.props.onFocus, onBlur: this.props.onBlur },
|