d2coreui 21.0.33 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/clipboard/clipboardUtils.d.ts +4 -3
- package/components/clipboard/clipboardUtils.js +47 -22
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
- package/components/codemirror/SyntaxHighlighter.js +45 -44
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +13 -12
- package/components/collapse/expandable.js +20 -20
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +20 -20
- package/components/color/colorPicker.js +53 -53
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +13 -12
- package/components/color/colorSwatch.js +62 -62
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +7 -7
- package/components/color/colorUtils.js +43 -43
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +66 -64
- package/components/date/dateRangeInput.js +292 -297
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
- package/components/date/dateRangeInputAdvancedPanel.js +130 -115
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +31 -29
- package/components/date/dateRangeInputConfirm.js +132 -121
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +72 -69
- package/components/date/dateTimeInput.js +440 -412
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +59 -56
- package/components/date/durationInput.js +269 -280
- package/components/date/durationInput.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +14 -14
- package/components/form/NiceFormItem.js +28 -31
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +9 -0
- package/components/grid/cell/beanAccessor.js +13 -0
- package/components/grid/cell/beanAccessor.js.map +1 -0
- package/components/grid/cell/cellEditorUtils.d.ts +4 -4
- package/components/grid/cell/cellEditorUtils.js +8 -8
- package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
- package/components/grid/cell/customEnumCellEditor.js +82 -91
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
- package/components/grid/cell/dateCellEditor.d.ts +4 -25
- package/components/grid/cell/dateCellEditor.js +53 -72
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +4 -24
- package/components/grid/cell/durationCellEditor.js +74 -97
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaValueCellEditor.js +65 -89
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +4 -27
- package/components/grid/cell/numberCellEditor.js +73 -95
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +78 -78
- package/components/grid/cell/rangeSelector.js +526 -518
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/statusTextCellEditor.js +136 -159
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
- package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +4 -21
- package/components/grid/cell/textCellEditor.js +63 -85
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +3 -0
- package/components/grid/cell/withAgGridHooks.js +15 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -0
- package/components/grid/columnUtils.d.ts +5 -5
- package/components/grid/columnUtils.js +26 -26
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +21 -22
- package/components/grid/config/columnTransfer.js +205 -201
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +41 -41
- package/components/grid/config/dataGridEditor.js +181 -160
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +8 -0
- package/components/grid/config/rowHeightCalculator.js +20 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -0
- package/components/grid/config/rowStylePicker.d.ts +27 -25
- package/components/grid/config/rowStylePicker.js +127 -109
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +218 -206
- package/components/grid/dataGrid.js +1629 -1538
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
- package/components/grid/detail/detailHeaderPanel.js +25 -25
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +18 -24
- package/components/grid/export/contextMenu.js +116 -113
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +29 -29
- package/components/grid/export/progressPopup.js +93 -93
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/clipboardExport.d.ts +1 -1
- package/components/grid/export/worker/clipboardExport.js +8 -8
- package/components/grid/export/worker/csvExport.d.ts +1 -1
- package/components/grid/export/worker/csvExport.js +8 -8
- package/components/grid/export/worker/pdfExport.d.ts +1 -1
- package/components/grid/export/worker/pdfExport.js +81 -81
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/export/worker/txtExport.d.ts +1 -1
- package/components/grid/export/worker/txtExport.js +19 -19
- package/components/grid/extendedDataGrid.d.ts +140 -140
- package/components/grid/extendedDataGrid.js +704 -695
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -21
- package/components/grid/filter/customColumnFilter.js +11 -82
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
- package/components/grid/filter/dataGridColumnFilter.js +49 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
- package/components/grid/filter/dateColumnFilter.d.ts +7 -11
- package/components/grid/filter/dateColumnFilter.js +22 -56
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +8 -20
- package/components/grid/filter/textColumnFilter.js +24 -76
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
- package/components/grid/header/simpleHeader.d.ts +17 -16
- package/components/grid/header/simpleHeader.js +230 -186
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +16 -16
- package/components/grid/panel/dataGridPagination.js +58 -58
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +6 -6
- package/components/grid/panel/loadingOverlay.js +10 -10
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
- package/components/grid/panel/noRecordsOverlay.js +10 -10
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +10 -10
- package/components/grid/panel/tablePagination.js +45 -45
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +8 -0
- package/components/icons/dropdownArrow.js +59 -0
- package/components/icons/dropdownArrow.js.map +1 -0
- package/components/icons/undoIcon.d.ts +8 -8
- package/components/icons/undoIcon.js +6 -6
- package/components/input/autoCompleteInput.d.ts +35 -35
- package/components/input/autoCompleteInput.js +122 -121
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +4 -4
- package/components/input/draftUtils.js +48 -48
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/draftail.d.ts +1 -1
- package/components/input/draftail.js +1 -1
- package/components/input/hexaFormattedInput.d.ts +16 -16
- package/components/input/hexaFormattedInput.js +54 -54
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +28 -28
- package/components/input/mask/helpers.js +112 -112
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +46 -46
- package/components/input/mask/inputMaskCore.js +278 -278
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +20 -20
- package/components/input/mask/pattern.js +78 -78
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +373 -351
- package/components/input/maskedInput.js +224 -224
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +9 -9
- package/components/input/passwordInput.js +55 -55
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +12 -12
- package/components/input/simpleAutoComplete.js +41 -43
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
- package/components/input/textarea/extractSpansOfClasses.js +96 -96
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +1 -1
- package/components/input/textarea/getRanges.js +73 -73
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +1 -1
- package/components/input/textarea/getType.js +26 -26
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +6 -6
- package/components/input/textarea/highlighedContents.js +10 -10
- package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
- package/components/input/textarea/mentionsWithHighlighting.js +60 -60
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +5 -5
- package/components/keyboard/keyboardUtils.js +32 -32
- package/components/modal/draggableModalProvider.d.ts +4 -4
- package/components/modal/draggableModalProvider.js +21 -21
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.d.ts +1 -1
- package/components/modal/impl/clamp.js +1 -1
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +12 -12
- package/components/modal/impl/draggableModal.js +17 -17
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.d.ts +9 -9
- package/components/modal/impl/draggableModalContext.js +2 -2
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.d.ts +15 -13
- package/components/modal/impl/draggableModalInner.js +57 -55
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +66 -62
- package/components/modal/impl/draggableModalReducer.js +77 -78
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/getWindowSize.d.ts +4 -4
- package/components/modal/impl/getWindowSize.js +4 -4
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.d.ts +3 -3
- package/components/modal/impl/index.js +3 -3
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +3 -3
- package/components/modal/impl/resizeHandle.js +4 -4
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.d.ts +5 -5
- package/components/modal/impl/useDrag.js +42 -42
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.d.ts +1 -1
- package/components/modal/impl/usePrevious.js +8 -8
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.d.ts +7 -7
- package/components/modal/impl/useResize.js +46 -46
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +49 -49
- package/components/modal/modalDialog.js +152 -152
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +16 -16
- package/components/picker/enumValuePicker.js +34 -34
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +10 -10
- package/components/platformSpecific.js +27 -27
- package/components/scrollTo/onlyText.d.ts +4 -4
- package/components/scrollTo/onlyText.js +30 -30
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +41 -39
- package/components/scrollTo/scrollTo.js +264 -264
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +9 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -0
- package/components/style/withInputNumberCss.d.ts +6 -0
- package/components/style/withInputNumberCss.js +13 -0
- package/components/style/withInputNumberCss.js.map +1 -0
- package/components/table/dragSortingTable.d.ts +13 -14
- package/components/table/dragSortingTable.js +96 -82
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.d.ts +2 -2
- package/components/text/impl/innerSize.js +12 -12
- package/components/text/impl/series.d.ts +1 -1
- package/components/text/impl/series.js +28 -28
- package/components/text/impl/shallowEqual.d.ts +1 -1
- package/components/text/impl/shallowEqual.js +18 -18
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/uniqueId.d.ts +1 -1
- package/components/text/impl/uniqueId.js +4 -4
- package/components/text/impl/whilst.d.ts +1 -1
- package/components/text/impl/whilst.js +19 -19
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +38 -38
- package/components/text/textFit.js +165 -168
- package/components/text/textFit.js.map +1 -1
- package/i18n/components.cs.json +101 -100
- package/i18n/components.sk.json +101 -100
- package/i18n/components.uk.json +101 -100
- package/i18n/componentsLocaleHolder.d.ts +3 -3
- package/i18n/componentsLocaleHolder.js +28 -28
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +71 -70
- package/style/index.less +274 -298
- package/style/modal/DraggableModal.css +43 -40
- package/style/modal/ResizeHandle.css +27 -19
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
- package/components/grid/cell/wildcardQuickFilter.js +0 -61
- package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
- package/components/table/dataTable.d.ts +0 -17
- package/components/table/dataTable.js +0 -79
- package/components/table/dataTable.js.map +0 -1
- package/style/antd/antd-tree-showline.css +0 -25
- package/style/antd/full-height-tabs.scss +0 -63
- package/style/draftail/draftail-editor.css +0 -179
- package/style/table/dragSortingTable.css +0 -7
|
@@ -1,110 +1,128 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BgColorsOutlined, BoldOutlined, FontColorsOutlined } from "@ant-design/icons";
|
|
3
|
-
import { Button, Divider, InputNumber } from "antd";
|
|
4
|
-
import i18n from "d2core/i18n/i18n";
|
|
5
|
-
import PlatformSpecific from "../../platformSpecific";
|
|
6
|
-
import ColorPicker from "../../color/colorPicker";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.
|
|
81
|
-
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
82
|
-
React.createElement(ColorPicker, { title: i18n("Background Color"), disabled: this.state.disableColorEdit, placement: "left", color: this.
|
|
83
|
-
this.onChange({
|
|
84
|
-
}, onResetColor: () => {
|
|
85
|
-
this.onChange({
|
|
86
|
-
}, badgeIcon: React.createElement(
|
|
87
|
-
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.
|
|
88
|
-
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
89
|
-
React.createElement(
|
|
90
|
-
this.onChange({
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
} }))
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BgColorsOutlined, BoldOutlined, FontColorsOutlined } from "@ant-design/icons";
|
|
3
|
+
import { Button, Divider, InputNumber } from "antd";
|
|
4
|
+
import i18n from "d2core/i18n/i18n";
|
|
5
|
+
import PlatformSpecific from "../../platformSpecific";
|
|
6
|
+
import ColorPicker from "../../color/colorPicker";
|
|
7
|
+
import { GRID_DEFAULT_ROW_HEIGHT_DELTA } from "./rowHeightCalculator";
|
|
8
|
+
export default class RowStylePicker extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.state = {
|
|
12
|
+
disableColorEdit: PlatformSpecific.INSTANCE.configurationChangesDisabled(),
|
|
13
|
+
};
|
|
14
|
+
this.onChange = this.onChange.bind(this);
|
|
15
|
+
}
|
|
16
|
+
onChange(style) {
|
|
17
|
+
const textColor = style.color;
|
|
18
|
+
const rowStyleRule = this.props.rowStyleRule;
|
|
19
|
+
if (textColor === null) {
|
|
20
|
+
delete rowStyleRule.style.color;
|
|
21
|
+
}
|
|
22
|
+
else if (typeof textColor === 'object') {
|
|
23
|
+
if (textColor.rgb.r === 0 && textColor.rgb.g === 0 && textColor.rgb.b === 0 && textColor.rgb.a === 0) {
|
|
24
|
+
delete rowStyleRule.style.color;
|
|
25
|
+
}
|
|
26
|
+
else if (textColor.rgb.a === 0 || textColor.rgb.a === 1) {
|
|
27
|
+
rowStyleRule.style.color = textColor.hex;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
rowStyleRule.style.color = textColor.rgb;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (textColor !== undefined) {
|
|
34
|
+
rowStyleRule.style.color = textColor;
|
|
35
|
+
}
|
|
36
|
+
const backgroundColor = style.backgroundColor;
|
|
37
|
+
if (backgroundColor === null) {
|
|
38
|
+
delete rowStyleRule.style.backgroundColor;
|
|
39
|
+
}
|
|
40
|
+
else if (typeof backgroundColor === 'object') {
|
|
41
|
+
if (backgroundColor.rgb.r === 0 && backgroundColor.rgb.g === 0 && backgroundColor.rgb.b === 0 && backgroundColor.rgb.a === 0) {
|
|
42
|
+
delete rowStyleRule.style.backgroundColor;
|
|
43
|
+
}
|
|
44
|
+
else if (backgroundColor.rgb.a === 0 || backgroundColor.rgb.a === 1) {
|
|
45
|
+
rowStyleRule.style.backgroundColor = backgroundColor.hex;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
rowStyleRule.style.backgroundColor = backgroundColor.rgb;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (backgroundColor !== undefined) {
|
|
52
|
+
rowStyleRule.style.backgroundColor = backgroundColor;
|
|
53
|
+
}
|
|
54
|
+
if (style.fontWeight === null) {
|
|
55
|
+
delete rowStyleRule.style.fontWeight;
|
|
56
|
+
}
|
|
57
|
+
else if (style.fontWeight !== undefined) {
|
|
58
|
+
rowStyleRule.style.fontWeight = style.fontWeight;
|
|
59
|
+
}
|
|
60
|
+
if (style.fontSize === null) {
|
|
61
|
+
delete rowStyleRule.style.fontSize;
|
|
62
|
+
}
|
|
63
|
+
else if (style.fontSize !== undefined) {
|
|
64
|
+
rowStyleRule.style.fontSize = style.fontSize;
|
|
65
|
+
}
|
|
66
|
+
if (style.rowHeightDelta === null) {
|
|
67
|
+
delete rowStyleRule.style.rowHeightDelta;
|
|
68
|
+
}
|
|
69
|
+
else if (style.rowHeightDelta !== undefined) {
|
|
70
|
+
rowStyleRule.style.rowHeightDelta = style.rowHeightDelta;
|
|
71
|
+
}
|
|
72
|
+
this.props.onChange(rowStyleRule);
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return React.createElement(React.Fragment, null,
|
|
76
|
+
this.props.rowStyleRule.divider &&
|
|
77
|
+
React.createElement(Divider, { style: { fontSize: 12 } }, i18n(this.props.rowStyleRule.divider)),
|
|
78
|
+
React.createElement("div", { style: { display: "flex" } },
|
|
79
|
+
React.createElement("div", { style: { flexGrow: 1 } }, i18n(this.props.rowStyleRule.name)),
|
|
80
|
+
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.color &&
|
|
81
|
+
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
82
|
+
React.createElement(ColorPicker, { title: i18n("Background Color"), disabled: this.state.disableColorEdit, placement: "left", color: this.getColor(), onChangeComplete: color => {
|
|
83
|
+
this.onChange({ color: color });
|
|
84
|
+
}, onResetColor: () => {
|
|
85
|
+
this.onChange({ color: null });
|
|
86
|
+
}, badgeIcon: React.createElement(FontColorsOutlined, null), transparentColorAllowed: true })),
|
|
87
|
+
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.backgroundColor &&
|
|
88
|
+
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
89
|
+
React.createElement(ColorPicker, { title: i18n("Background Color"), disabled: this.state.disableColorEdit, placement: "left", color: this.getBackgroundColor(), onChangeComplete: color => {
|
|
90
|
+
this.onChange({ backgroundColor: color });
|
|
91
|
+
}, onResetColor: () => {
|
|
92
|
+
this.onChange({ backgroundColor: null });
|
|
93
|
+
}, badgeIcon: React.createElement(BgColorsOutlined, null), transparentColorAllowed: true })),
|
|
94
|
+
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontWeight &&
|
|
95
|
+
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
96
|
+
React.createElement(Button, { icon: React.createElement(BoldOutlined, null), disabled: this.state.disableColorEdit, type: this.props.rowStyleRule.style.fontWeight === "bold" ? "primary" : "default", onClick: () => {
|
|
97
|
+
this.onChange({ fontWeight: this.props.rowStyleRule.style.fontWeight === "bold" ? null : "bold" });
|
|
98
|
+
} })),
|
|
99
|
+
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontSize &&
|
|
100
|
+
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
101
|
+
React.createElement(InputNumber, { style: { width: 70 }, className: "custom", min: 10, max: 50, value: this.getFontSize(), onChange: (fontSize) => {
|
|
102
|
+
if (fontSize && typeof fontSize === "number") {
|
|
103
|
+
this.onChange({ fontSize: fontSize });
|
|
104
|
+
}
|
|
105
|
+
} })),
|
|
106
|
+
this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.rowHeightDelta &&
|
|
107
|
+
React.createElement("div", { style: { marginBottom: 8, marginLeft: 16 } },
|
|
108
|
+
React.createElement(InputNumber, { style: { width: 70 }, min: 1, max: 28, value: this.getRowHeightDelta(), onChange: (rowHeightDelta) => {
|
|
109
|
+
if (rowHeightDelta && typeof rowHeightDelta === "number") {
|
|
110
|
+
this.onChange({ rowHeightDelta: rowHeightDelta });
|
|
111
|
+
}
|
|
112
|
+
} }))));
|
|
113
|
+
}
|
|
114
|
+
getColor() {
|
|
115
|
+
return this.props.rowStyleRule.style.color;
|
|
116
|
+
}
|
|
117
|
+
getBackgroundColor() {
|
|
118
|
+
return this.props.rowStyleRule.style.backgroundColor;
|
|
119
|
+
}
|
|
120
|
+
getFontSize() {
|
|
121
|
+
return this.props.rowStyleRule.style.fontSize;
|
|
122
|
+
}
|
|
123
|
+
getRowHeightDelta() {
|
|
124
|
+
var _a;
|
|
125
|
+
return (_a = this.props.rowStyleRule.style.rowHeightDelta) !== null && _a !== void 0 ? _a : GRID_DEFAULT_ROW_HEIGHT_DELTA;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
110
128
|
//# sourceMappingURL=rowStylePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowStylePicker.js","sourceRoot":"","sources":["../../../../../components/grid/config/rowStylePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAClD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAGpC,OAAO,gBAAgB,MAA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CAAC,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAC,CAAC,CAAA;4BACpG,CAAC,GACP,CACA;gBACL,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ;oBACpF,6BAAK,KAAK,EAAE,EAAC,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAC;wBACzC,oBAAC,WAAW,IACR,KAAK,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC,EAClB,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAE,EAAE,EACP,GAAG,EAAE,EAAE,EACP,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,EACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;gCACnB,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;oCAC1C,IAAI,CAAC,QAAQ,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;iCACvC;4BACL,CAAC,GACH,CACA,CACJ,CACP,CAAC;IACR,CAAC;IAEO,QAAQ;QAEZ,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC;IAC/C,CAAC;IAEO,kBAAkB;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,eAAe,CAAC;IACzD,CAAC;IAEO,WAAW;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAkB,CAAC;IAC5D,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {BgColorsOutlined, BoldOutlined, FontColorsOutlined} from \"@ant-design/icons\";\nimport {Button, Divider, InputNumber} from \"antd\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {ColorResult, RGBColor} from \"react-color\";\nimport {RowStyleRule} from \"d2coreui/components/grid/cell/tableDefaultRowStyleRules\";\nimport PlatformSpecific from \"../../platformSpecific\";\nimport ColorPicker from \"../../color/colorPicker\";\n\ninterface RowStylePickerProps {\n rowStyleRule: RowStyleRule\n onChange: (rowStyleRule: RowStyleRule) => void\n}\n\ninterface RowStylePickerState {\n disableColorEdit: boolean\n}\n\ninterface StyleChange {\n color?: ColorResult | null\n backgroundColor?: ColorResult | null\n fontWeight?: string | null\n fontSize?: number | null\n}\n\nexport default class RowStylePicker extends React.Component<RowStylePickerProps, RowStylePickerState> {\n\n constructor(props: Readonly<RowStylePickerProps>) {\n super(props);\n\n this.state = {\n disableColorEdit: PlatformSpecific.INSTANCE.configurationChangesDisabled(),\n }\n\n this.onChange = this.onChange.bind(this);\n }\n\n onChange(style: StyleChange): void {\n const textColor = style.color;\n const rowStyleRule = this.props.rowStyleRule;\n if (textColor === null) {\n delete rowStyleRule.style.color;\n } else if (typeof textColor === 'object') {\n if (textColor.rgb.r === 0 && textColor.rgb.g === 0 && textColor.rgb.b === 0 && textColor.rgb.a === 0) {\n delete rowStyleRule.style.color;\n } else if (textColor.rgb.a === 0 || textColor.rgb.a === 1) {\n rowStyleRule.style.color = textColor.hex;\n } else {\n rowStyleRule.style.color = textColor.rgb;\n }\n } else if (textColor !== undefined) {\n rowStyleRule.style.color = textColor;\n }\n\n const backgroundColor = style.backgroundColor;\n if (backgroundColor === null) {\n delete rowStyleRule.style.backgroundColor;\n } else if (typeof backgroundColor === 'object') {\n if (backgroundColor.rgb.r === 0 && backgroundColor.rgb.g === 0 && backgroundColor.rgb.b === 0 && backgroundColor.rgb.a === 0) {\n delete rowStyleRule.style.backgroundColor;\n } else if (backgroundColor.rgb.a === 0 || backgroundColor.rgb.a === 1) {\n rowStyleRule.style.backgroundColor = backgroundColor.hex;\n } else {\n rowStyleRule.style.backgroundColor = backgroundColor.rgb;\n }\n } else if (backgroundColor !== undefined) {\n rowStyleRule.style.backgroundColor = backgroundColor;\n }\n\n\n if (style.fontWeight === null) {\n delete rowStyleRule.style.fontWeight;\n } else if (style.fontWeight !== undefined) {\n rowStyleRule.style.fontWeight = style.fontWeight;\n }\n if (style.fontSize === null) {\n delete rowStyleRule.style.fontSize;\n } else if (style.fontSize !== undefined) {\n rowStyleRule.style.fontSize = style.fontSize;\n }\n this.props.onChange(rowStyleRule);\n }\n\n render() {\n return <>\n {this.props.rowStyleRule.divider &&\n <Divider style={{fontSize: 12}}>{i18n(this.props.rowStyleRule.divider)}</Divider>}\n <div style={{display: \"flex\"}}>\n <div style={{flexGrow: 1}}>\n {i18n(this.props.rowStyleRule.name)}\n </div>\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.color &&\n <div style={{marginBottom: 8, marginLeft: 16}}>\n <ColorPicker\n title={i18n(\"Background Color\")}\n disabled={this.state.disableColorEdit}\n placement=\"left\"\n color={this.getColor()}\n onChangeComplete={color => {\n this.onChange({color: color})\n }}\n onResetColor={() => {\n this.onChange({color: null})\n }}\n badgeIcon={<FontColorsOutlined/>}\n transparentColorAllowed\n />\n </div>\n }\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.backgroundColor &&\n <div style={{marginBottom: 8, marginLeft: 16}}>\n <ColorPicker\n title={i18n(\"Background Color\")}\n disabled={this.state.disableColorEdit}\n placement=\"left\"\n color={this.getBackgroundColor()}\n onChangeComplete={color => {\n this.onChange({backgroundColor: color})\n }}\n onResetColor={() => {\n this.onChange({backgroundColor: null})\n }}\n badgeIcon={<BgColorsOutlined/>}\n transparentColorAllowed\n />\n </div>\n }\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontWeight &&\n <div style={{marginBottom: 8, marginLeft: 16}}>\n <Button icon={<BoldOutlined/>}\n disabled={this.state.disableColorEdit}\n type={this.props.rowStyleRule.style.fontWeight === \"bold\" ? \"primary\" : \"default\"}\n onClick={() => {\n this.onChange({fontWeight: this.props.rowStyleRule.style.fontWeight === \"bold\" ? null : \"bold\"})\n }}\n />\n </div>}\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontSize &&\n <div style={{marginBottom: 8, marginLeft: 16}}>\n <InputNumber\n style={{width: 70}}\n className=\"custom\"\n min={10}\n max={50}\n value={this.getFontSize()}\n onChange={(fontSize) => {\n if (fontSize && typeof fontSize === \"number\") {\n this.onChange({fontSize: fontSize});\n }\n }}\n />\n </div>}\n </div>\n </>;\n }\n\n private getColor(): string | RGBColor | undefined {\n // @ts-ignore\n return this.props.rowStyleRule.style.color;\n }\n\n private getBackgroundColor(): string | RGBColor | undefined {\n // @ts-ignore\n return this.props.rowStyleRule.style.backgroundColor;\n }\n\n private getFontSize() : number {\n return this.props.rowStyleRule.style.fontSize as number;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"rowStylePicker.js","sourceRoot":"","sources":["../../../../../components/grid/config/rowStylePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAClD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAGpC,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAoBpE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,KAAK,CAAC,SAAmD;IAEjG,YAAY,KAAoC;QAC5C,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,4BAA4B,EAAE;SAC7E,CAAA;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC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AAC,EAAC,cAAc,EAAE,cAAc,EAAC,CAAC,CAAC;gCACpD,CAAC;4BACL,CAAC,GACH,CACA,CACR,CACP,CAAC;IACR,CAAC;IAEO,QAAQ;QAEZ,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC;IAC/C,CAAC;IAEO,kBAAkB;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,eAAe,CAAC;IACzD,CAAC;IAEO,WAAW;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAkB,CAAC;IAC5D,CAAC;IAEO,iBAAiB;;QACrB,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAwB,mCAAI,6BAA6B,CAAC;IACnG,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {BgColorsOutlined, BoldOutlined, FontColorsOutlined} from \"@ant-design/icons\";\r\nimport {Button, Divider, InputNumber} from \"antd\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {ColorResult, RGBColor} from \"react-color\";\r\nimport {RowStyleRule} from \"d2coreui/components/grid/cell/tableDefaultRowStyleRules\";\r\nimport PlatformSpecific from \"../../platformSpecific\";\r\nimport ColorPicker from \"../../color/colorPicker\";\r\nimport {GRID_DEFAULT_ROW_HEIGHT_DELTA} from \"./rowHeightCalculator\";\r\n\r\n\r\ninterface RowStylePickerProps {\r\n rowStyleRule: RowStyleRule\r\n onChange: (rowStyleRule: RowStyleRule) => void\r\n}\r\n\r\ninterface RowStylePickerState {\r\n disableColorEdit: boolean\r\n}\r\n\r\ninterface StyleChange {\r\n color?: ColorResult | null\r\n backgroundColor?: ColorResult | null\r\n fontWeight?: string | null\r\n fontSize?: number | null\r\n rowHeightDelta?: number | null\r\n}\r\n\r\nexport default class RowStylePicker extends React.Component<RowStylePickerProps, RowStylePickerState> {\r\n\r\n constructor(props: Readonly<RowStylePickerProps>) {\r\n super(props);\r\n\r\n this.state = {\r\n disableColorEdit: PlatformSpecific.INSTANCE.configurationChangesDisabled(),\r\n }\r\n\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n onChange(style: StyleChange): void {\r\n const textColor = style.color;\r\n const rowStyleRule = this.props.rowStyleRule;\r\n if (textColor === null) {\r\n delete rowStyleRule.style.color;\r\n } else if (typeof textColor === 'object') {\r\n if (textColor.rgb.r === 0 && textColor.rgb.g === 0 && textColor.rgb.b === 0 && textColor.rgb.a === 0) {\r\n delete rowStyleRule.style.color;\r\n } else if (textColor.rgb.a === 0 || textColor.rgb.a === 1) {\r\n rowStyleRule.style.color = textColor.hex;\r\n } else {\r\n rowStyleRule.style.color = textColor.rgb;\r\n }\r\n } else if (textColor !== undefined) {\r\n rowStyleRule.style.color = textColor;\r\n }\r\n\r\n const backgroundColor = style.backgroundColor;\r\n if (backgroundColor === null) {\r\n delete rowStyleRule.style.backgroundColor;\r\n } else if (typeof backgroundColor === 'object') {\r\n if (backgroundColor.rgb.r === 0 && backgroundColor.rgb.g === 0 && backgroundColor.rgb.b === 0 && backgroundColor.rgb.a === 0) {\r\n delete rowStyleRule.style.backgroundColor;\r\n } else if (backgroundColor.rgb.a === 0 || backgroundColor.rgb.a === 1) {\r\n rowStyleRule.style.backgroundColor = backgroundColor.hex;\r\n } else {\r\n rowStyleRule.style.backgroundColor = backgroundColor.rgb;\r\n }\r\n } else if (backgroundColor !== undefined) {\r\n rowStyleRule.style.backgroundColor = backgroundColor;\r\n }\r\n\r\n\r\n if (style.fontWeight === null) {\r\n delete rowStyleRule.style.fontWeight;\r\n } else if (style.fontWeight !== undefined) {\r\n rowStyleRule.style.fontWeight = style.fontWeight;\r\n }\r\n if (style.fontSize === null) {\r\n delete rowStyleRule.style.fontSize;\r\n } else if (style.fontSize !== undefined) {\r\n rowStyleRule.style.fontSize = style.fontSize;\r\n }\r\n if (style.rowHeightDelta === null) {\r\n delete rowStyleRule.style.rowHeightDelta;\r\n } else if (style.rowHeightDelta !== undefined) {\r\n rowStyleRule.style.rowHeightDelta = style.rowHeightDelta;\r\n }\r\n this.props.onChange(rowStyleRule);\r\n }\r\n\r\n render() {\r\n return <>\r\n {this.props.rowStyleRule.divider &&\r\n <Divider style={{fontSize: 12}}>{i18n(this.props.rowStyleRule.divider)}</Divider>}\r\n <div style={{display: \"flex\"}}>\r\n <div style={{flexGrow: 1}}>\r\n {i18n(this.props.rowStyleRule.name)}\r\n </div>\r\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.color &&\r\n <div style={{marginBottom: 8, marginLeft: 16}}>\r\n <ColorPicker\r\n title={i18n(\"Background Color\")}\r\n disabled={this.state.disableColorEdit}\r\n placement=\"left\"\r\n color={this.getColor()}\r\n onChangeComplete={color => {\r\n this.onChange({color: color})\r\n }}\r\n onResetColor={() => {\r\n this.onChange({color: null})\r\n }}\r\n badgeIcon={<FontColorsOutlined/>}\r\n transparentColorAllowed\r\n />\r\n </div>\r\n }\r\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.backgroundColor &&\r\n <div style={{marginBottom: 8, marginLeft: 16}}>\r\n <ColorPicker\r\n title={i18n(\"Background Color\")}\r\n disabled={this.state.disableColorEdit}\r\n placement=\"left\"\r\n color={this.getBackgroundColor()}\r\n onChangeComplete={color => {\r\n this.onChange({backgroundColor: color})\r\n }}\r\n onResetColor={() => {\r\n this.onChange({backgroundColor: null})\r\n }}\r\n badgeIcon={<BgColorsOutlined/>}\r\n transparentColorAllowed\r\n />\r\n </div>\r\n }\r\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontWeight &&\r\n <div style={{marginBottom: 8, marginLeft: 16}}>\r\n <Button icon={<BoldOutlined/>}\r\n disabled={this.state.disableColorEdit}\r\n type={this.props.rowStyleRule.style.fontWeight === \"bold\" ? \"primary\" : \"default\"}\r\n onClick={() => {\r\n this.onChange({fontWeight: this.props.rowStyleRule.style.fontWeight === \"bold\" ? null : \"bold\"})\r\n }}\r\n />\r\n </div>}\r\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.fontSize &&\r\n <div style={{marginBottom: 8, marginLeft: 16}}>\r\n <InputNumber\r\n style={{width: 70}}\r\n className=\"custom\"\r\n min={10}\r\n max={50}\r\n value={this.getFontSize()}\r\n onChange={(fontSize) => {\r\n if (fontSize && typeof fontSize === \"number\") {\r\n this.onChange({fontSize: fontSize});\r\n }\r\n }}\r\n />\r\n </div>}\r\n {this.props.rowStyleRule.styleEditor && this.props.rowStyleRule.styleEditor.rowHeightDelta &&\r\n <div style={{marginBottom: 8, marginLeft: 16}}>\r\n <InputNumber\r\n style={{width: 70}}\r\n min={1}\r\n max={28}\r\n value={this.getRowHeightDelta()}\r\n onChange={(rowHeightDelta) => {\r\n if (rowHeightDelta && typeof rowHeightDelta === \"number\") {\r\n this.onChange({rowHeightDelta: rowHeightDelta});\r\n }\r\n }}\r\n />\r\n </div>}\r\n </div>\r\n </>;\r\n }\r\n\r\n private getColor(): string | RGBColor | undefined {\r\n // @ts-ignore\r\n return this.props.rowStyleRule.style.color;\r\n }\r\n\r\n private getBackgroundColor(): string | RGBColor | undefined {\r\n // @ts-ignore\r\n return this.props.rowStyleRule.style.backgroundColor;\r\n }\r\n\r\n private getFontSize(): number {\r\n return this.props.rowStyleRule.style.fontSize as number;\r\n }\r\n\r\n private getRowHeightDelta(): number {\r\n return this.props.rowStyleRule.style.rowHeightDelta as number ?? GRID_DEFAULT_ROW_HEIGHT_DELTA;\r\n }\r\n}"]}
|