d2coreui 21.0.34 → 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 -27
- 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,74 +1,74 @@
|
|
|
1
|
-
import getType from './getType';
|
|
2
|
-
export default function getRanges(input, highlight) {
|
|
3
|
-
let type = getType(highlight);
|
|
4
|
-
switch (type) {
|
|
5
|
-
case 'array':
|
|
6
|
-
return getArrayRanges(input, highlight);
|
|
7
|
-
case 'function':
|
|
8
|
-
return getFunctionRanges(input, highlight);
|
|
9
|
-
case 'regexp':
|
|
10
|
-
return getRegExpRanges(input, highlight);
|
|
11
|
-
case 'string':
|
|
12
|
-
return getStringRanges(input, highlight);
|
|
13
|
-
case 'range':
|
|
14
|
-
return getRangeRanges(input, highlight);
|
|
15
|
-
case 'custom':
|
|
16
|
-
return getCustomRanges(input, highlight);
|
|
17
|
-
default:
|
|
18
|
-
if (!highlight) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
console.error('unrecognized highlight type');
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getArrayRanges(input, arr) {
|
|
28
|
-
let ranges = arr.map(getRanges.bind(null, input));
|
|
29
|
-
return Array.prototype.concat.apply([], ranges);
|
|
30
|
-
}
|
|
31
|
-
function getFunctionRanges(input, func) {
|
|
32
|
-
return getRanges(input, func(input));
|
|
33
|
-
}
|
|
34
|
-
function getRegExpRanges(input, regex) {
|
|
35
|
-
let ranges = [];
|
|
36
|
-
let match;
|
|
37
|
-
while (match = regex.exec(input), match !== null) {
|
|
38
|
-
ranges.push([match.index, match.index + match[0].length]);
|
|
39
|
-
if (!regex.global) {
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return ranges;
|
|
44
|
-
}
|
|
45
|
-
function getStringRanges(input, str) {
|
|
46
|
-
let ranges = [];
|
|
47
|
-
let inputLower = input.toLowerCase();
|
|
48
|
-
let strLower = str.toLowerCase();
|
|
49
|
-
let index = 0;
|
|
50
|
-
while (index = inputLower.indexOf(strLower, index), index !== -1) {
|
|
51
|
-
ranges.push([index, index + strLower.length]);
|
|
52
|
-
index += strLower.length;
|
|
53
|
-
}
|
|
54
|
-
return ranges;
|
|
55
|
-
}
|
|
56
|
-
function getRangeRanges(_input, range) {
|
|
57
|
-
return [range];
|
|
58
|
-
}
|
|
59
|
-
function getCustomRanges(input, custom) {
|
|
60
|
-
let ranges = getRanges(input, custom.highlight);
|
|
61
|
-
if (custom.className) {
|
|
62
|
-
ranges.forEach(function (range) {
|
|
63
|
-
let customRange = range;
|
|
64
|
-
if (customRange.className) {
|
|
65
|
-
customRange.className = custom.className + ' ' + customRange.className;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
customRange.className = custom.className;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return ranges;
|
|
73
|
-
}
|
|
1
|
+
import getType from './getType';
|
|
2
|
+
export default function getRanges(input, highlight) {
|
|
3
|
+
let type = getType(highlight);
|
|
4
|
+
switch (type) {
|
|
5
|
+
case 'array':
|
|
6
|
+
return getArrayRanges(input, highlight);
|
|
7
|
+
case 'function':
|
|
8
|
+
return getFunctionRanges(input, highlight);
|
|
9
|
+
case 'regexp':
|
|
10
|
+
return getRegExpRanges(input, highlight);
|
|
11
|
+
case 'string':
|
|
12
|
+
return getStringRanges(input, highlight);
|
|
13
|
+
case 'range':
|
|
14
|
+
return getRangeRanges(input, highlight);
|
|
15
|
+
case 'custom':
|
|
16
|
+
return getCustomRanges(input, highlight);
|
|
17
|
+
default:
|
|
18
|
+
if (!highlight) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.error('unrecognized highlight type');
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function getArrayRanges(input, arr) {
|
|
28
|
+
let ranges = arr.map(getRanges.bind(null, input));
|
|
29
|
+
return Array.prototype.concat.apply([], ranges);
|
|
30
|
+
}
|
|
31
|
+
function getFunctionRanges(input, func) {
|
|
32
|
+
return getRanges(input, func(input));
|
|
33
|
+
}
|
|
34
|
+
function getRegExpRanges(input, regex) {
|
|
35
|
+
let ranges = [];
|
|
36
|
+
let match;
|
|
37
|
+
while (match = regex.exec(input), match !== null) {
|
|
38
|
+
ranges.push([match.index, match.index + match[0].length]);
|
|
39
|
+
if (!regex.global) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return ranges;
|
|
44
|
+
}
|
|
45
|
+
function getStringRanges(input, str) {
|
|
46
|
+
let ranges = [];
|
|
47
|
+
let inputLower = input.toLowerCase();
|
|
48
|
+
let strLower = str.toLowerCase();
|
|
49
|
+
let index = 0;
|
|
50
|
+
while (index = inputLower.indexOf(strLower, index), index !== -1) {
|
|
51
|
+
ranges.push([index, index + strLower.length]);
|
|
52
|
+
index += strLower.length;
|
|
53
|
+
}
|
|
54
|
+
return ranges;
|
|
55
|
+
}
|
|
56
|
+
function getRangeRanges(_input, range) {
|
|
57
|
+
return [range];
|
|
58
|
+
}
|
|
59
|
+
function getCustomRanges(input, custom) {
|
|
60
|
+
let ranges = getRanges(input, custom.highlight);
|
|
61
|
+
if (custom.className) {
|
|
62
|
+
ranges.forEach(function (range) {
|
|
63
|
+
let customRange = range;
|
|
64
|
+
if (customRange.className) {
|
|
65
|
+
customRange.className = custom.className + ' ' + customRange.className;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
customRange.className = custom.className;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return ranges;
|
|
73
|
+
}
|
|
74
74
|
//# sourceMappingURL=getRanges.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRanges.js","sourceRoot":"","sources":["../../../../../components/input/textarea/getRanges.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAU,EAAE,SAAc;IACxD,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9B,QAAQ,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"getRanges.js","sourceRoot":"","sources":["../../../../../components/input/textarea/getRanges.ts"],"names":[],"mappings":"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","sourcesContent":["import getType from './getType';\n\nexport default function getRanges(input: any, highlight: any): number[][] {\n let type = getType(highlight);\n switch (type) {\n case 'array':\n return getArrayRanges(input, highlight);\n case 'function':\n return getFunctionRanges(input, highlight);\n case 'regexp':\n return getRegExpRanges(input, highlight);\n case 'string':\n return getStringRanges(input, highlight);\n case 'range':\n return getRangeRanges(input, highlight);\n case 'custom':\n return getCustomRanges(input, highlight);\n default:\n if (!highlight) {\n // do nothing for falsey values\n return [];\n } else {\n console.error('unrecognized highlight type');\n return [];\n }\n }\n}\n\nfunction getArrayRanges(input: any[], arr: any[]): number[][] {\n let ranges = arr.map(getRanges.bind(null, input));\n return Array.prototype.concat.apply([], ranges);\n}\n\nfunction getFunctionRanges(input: string, func: (input: string) => string): number[][] {\n return getRanges(input, func(input));\n}\n\nfunction getRegExpRanges(input: string, regex: RegExp) {\n let ranges = [];\n let match;\n while (match = regex.exec(input), match !== null) {\n ranges.push([match.index, match.index + match[0].length]);\n if (!regex.global) {\n // non-global regexes do not increase lastIndex, causing an infinite loop,\n // but we can just break manually after the first match\n break;\n }\n }\n return ranges;\n}\n\nfunction getStringRanges(input: string, str: string): number[][] {\n let ranges = [];\n let inputLower = input.toLowerCase();\n let strLower = str.toLowerCase();\n let index = 0;\n while (index = inputLower.indexOf(strLower, index), index !== -1) {\n ranges.push([index, index + strLower.length]);\n index += strLower.length;\n }\n return ranges;\n}\n\nfunction getRangeRanges(_input: string, range: number[]): number[][] {\n return [range];\n}\n\nfunction getCustomRanges(input: string, custom: { className?: string, highlight: any }): number[][] {\n let ranges = getRanges(input, custom.highlight);\n if (custom.className) {\n ranges.forEach(function (range) {\n // persist class name as a property of the array\n let customRange = range as any;\n if (customRange.className) {\n customRange.className = custom.className + ' ' + customRange.className;\n } else {\n customRange.className = custom.className;\n }\n });\n }\n return ranges;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function getType(instance: any): string;
|
|
1
|
+
export default function getType(instance: any): string;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export default function getType(instance) {
|
|
2
|
-
let type = typeof instance;
|
|
3
|
-
if (!instance) {
|
|
4
|
-
return 'falsey';
|
|
5
|
-
}
|
|
6
|
-
else if (Array.isArray(instance)) {
|
|
7
|
-
if (instance.length === 2 && typeof instance[0] === 'number' && typeof instance[1] === 'number') {
|
|
8
|
-
return 'range';
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
return 'array';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
else if (type === 'object') {
|
|
15
|
-
if (instance instanceof RegExp) {
|
|
16
|
-
return 'regexp';
|
|
17
|
-
}
|
|
18
|
-
else if (instance.hasOwnProperty('highlight')) {
|
|
19
|
-
return 'custom';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else if (type === 'function' || type === 'string') {
|
|
23
|
-
return type;
|
|
24
|
-
}
|
|
25
|
-
return 'other';
|
|
26
|
-
}
|
|
1
|
+
export default function getType(instance) {
|
|
2
|
+
let type = typeof instance;
|
|
3
|
+
if (!instance) {
|
|
4
|
+
return 'falsey';
|
|
5
|
+
}
|
|
6
|
+
else if (Array.isArray(instance)) {
|
|
7
|
+
if (instance.length === 2 && typeof instance[0] === 'number' && typeof instance[1] === 'number') {
|
|
8
|
+
return 'range';
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return 'array';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else if (type === 'object') {
|
|
15
|
+
if (instance instanceof RegExp) {
|
|
16
|
+
return 'regexp';
|
|
17
|
+
}
|
|
18
|
+
else if (instance.hasOwnProperty('highlight')) {
|
|
19
|
+
return 'custom';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (type === 'function' || type === 'string') {
|
|
23
|
+
return type;
|
|
24
|
+
}
|
|
25
|
+
return 'other';
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=getType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getType.js","sourceRoot":"","sources":["../../../../../components/input/textarea/getType.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,QAAY;IACxC,IAAI,IAAI,GAAG,OAAO,QAAQ,CAAC;IAC3B,IAAI,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"getType.js","sourceRoot":"","sources":["../../../../../components/input/textarea/getType.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,QAAY;IACxC,IAAI,IAAI,GAAG,OAAO,QAAQ,CAAC;IAC3B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,QAAQ,CAAC;IACpB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC9F,OAAO,OAAO,CAAC;QACnB,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC;QACnB,CAAC;IACL,CAAC;SAAM,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,IAAI,QAAQ,YAAY,MAAM,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC;QACpB,CAAC;aAAM,IAAI,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9C,OAAO,QAAQ,CAAC;QACpB,CAAC;IACL,CAAC;SAAM,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["// returns identifier strings that aren't necessarily \"real\" JavaScript types\nexport default function getType(instance:any):string {\n let type = typeof instance;\n if (!instance) {\n return 'falsey';\n } else if (Array.isArray(instance)) {\n if (instance.length === 2 && typeof instance[0] === 'number' && typeof instance[1] === 'number') {\n return 'range';\n } else {\n return 'array';\n }\n } else if (type === 'object') {\n if (instance instanceof RegExp) {\n return 'regexp';\n } else if (instance.hasOwnProperty('highlight')) {\n return 'custom';\n }\n } else if (type === 'function' || type === 'string') {\n return type;\n }\n\n return 'other';\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
declare const HighlighedContents: ({ value, highlight }: {
|
|
3
|
-
value: any;
|
|
4
|
-
highlight: any;
|
|
5
|
-
}) => JSX.Element;
|
|
6
|
-
export default HighlighedContents;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const HighlighedContents: ({ value, highlight }: {
|
|
3
|
+
value: any;
|
|
4
|
+
highlight: any;
|
|
5
|
+
}) => React.JSX.Element;
|
|
6
|
+
export default HighlighedContents;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import getRanges from './getRanges';
|
|
3
|
-
import extractSpansOfClasses from './extractSpansOfClasses';
|
|
4
|
-
const HighlighedContents = ({ value, highlight }) => {
|
|
5
|
-
let ranges = getRanges(value, highlight);
|
|
6
|
-
let parts = extractSpansOfClasses(value, ranges);
|
|
7
|
-
return (React.createElement("div", null,
|
|
8
|
-
React.createElement("div", { className: `highlight-highlights highlight-content` }, parts.map(part => part.render()))));
|
|
9
|
-
};
|
|
10
|
-
export default HighlighedContents;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getRanges from './getRanges';
|
|
3
|
+
import extractSpansOfClasses from './extractSpansOfClasses';
|
|
4
|
+
const HighlighedContents = ({ value, highlight }) => {
|
|
5
|
+
let ranges = getRanges(value, highlight);
|
|
6
|
+
let parts = extractSpansOfClasses(value, ranges);
|
|
7
|
+
return (React.createElement("div", null,
|
|
8
|
+
React.createElement("div", { className: `highlight-highlights highlight-content` }, parts.map(part => part.render()))));
|
|
9
|
+
};
|
|
10
|
+
export default HighlighedContents;
|
|
11
11
|
//# sourceMappingURL=highlighedContents.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import './highlightedTextarea.css';
|
|
3
|
-
import { MentionProps } from "antd/lib/mentions";
|
|
4
|
-
export interface HighlightItem {
|
|
5
|
-
highlight: HighlightType;
|
|
6
|
-
className: string;
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
interface MentionsWithHighlightingProps extends MentionProps {
|
|
11
|
-
highlight?: HighlightType;
|
|
12
|
-
containerStyle?: CSSProperties;
|
|
13
|
-
containerClassName?: string;
|
|
14
|
-
}
|
|
15
|
-
interface MentionsWithHighlightingState {
|
|
16
|
-
fakeValue: string;
|
|
17
|
-
}
|
|
18
|
-
export declare class MentionsWithHighlighting extends React.Component<MentionsWithHighlightingProps, MentionsWithHighlightingState> {
|
|
19
|
-
mentionsComponent: any | null;
|
|
20
|
-
backdropComponent: HTMLDivElement | null;
|
|
21
|
-
constructor(props: Readonly<MentionsWithHighlightingProps>);
|
|
22
|
-
handleScroll: () => void;
|
|
23
|
-
onChange: (value?: string
|
|
24
|
-
get textarea(): HTMLTextAreaElement | undefined;
|
|
25
|
-
render(): JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import './highlightedTextarea.css';
|
|
3
|
+
import { MentionProps } from "antd/lib/mentions";
|
|
4
|
+
export interface HighlightItem {
|
|
5
|
+
highlight: HighlightType;
|
|
6
|
+
className: string;
|
|
7
|
+
}
|
|
8
|
+
export type AssignHighlightFunction = (value: string) => HighlightType;
|
|
9
|
+
export type HighlightType = boolean | string | RegExp | [number, number] | HighlightType[] | AssignHighlightFunction | HighlightItem[];
|
|
10
|
+
interface MentionsWithHighlightingProps extends MentionProps {
|
|
11
|
+
highlight?: HighlightType;
|
|
12
|
+
containerStyle?: CSSProperties;
|
|
13
|
+
containerClassName?: string;
|
|
14
|
+
}
|
|
15
|
+
interface MentionsWithHighlightingState {
|
|
16
|
+
fakeValue: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class MentionsWithHighlighting extends React.Component<MentionsWithHighlightingProps, MentionsWithHighlightingState> {
|
|
19
|
+
mentionsComponent: any | null;
|
|
20
|
+
backdropComponent: HTMLDivElement | null;
|
|
21
|
+
constructor(props: Readonly<MentionsWithHighlightingProps>);
|
|
22
|
+
handleScroll: () => void;
|
|
23
|
+
onChange: (value?: string) => void;
|
|
24
|
+
get textarea(): HTMLTextAreaElement | undefined;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import './highlightedTextarea.css';
|
|
14
|
-
import HighlighedContents from './highlighedContents';
|
|
15
|
-
import { Mentions } from "antd";
|
|
16
|
-
export class MentionsWithHighlighting extends React.Component {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
var _a;
|
|
19
|
-
super(props);
|
|
20
|
-
this.mentionsComponent = null;
|
|
21
|
-
this.backdropComponent = null;
|
|
22
|
-
this.handleScroll = () => {
|
|
23
|
-
if (this.backdropComponent) {
|
|
24
|
-
if (this.mentionsComponent) {
|
|
25
|
-
const textArea = this.mentionsComponent.textarea;
|
|
26
|
-
this.backdropComponent.scrollTop = textArea.scrollTop;
|
|
27
|
-
this.backdropComponent.scrollLeft = textArea.scrollLeft;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
this.onChange = (value) => {
|
|
32
|
-
if (value == undefined) {
|
|
33
|
-
value = this.state.fakeValue;
|
|
34
|
-
}
|
|
35
|
-
this.setState({ fakeValue: value });
|
|
36
|
-
};
|
|
37
|
-
this.state = {
|
|
38
|
-
fakeValue: (_a = props.value) !== null && _a !== void 0 ? _a : ""
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
get textarea() {
|
|
42
|
-
var _a;
|
|
43
|
-
return (_a = this.mentionsComponent) === null || _a === void 0 ? void 0 : _a.textarea;
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
let _a = this.props, { value, onChange, highlight = {}, className = "", style = {}, containerStyle = {}, containerClassName = "", onScroll } = _a, restProps = __rest(_a, ["value", "onChange", "highlight", "className", "style", "containerStyle", "containerClassName", "onScroll"]);
|
|
47
|
-
className = `highlight-input ${!this.props.disabled ? "highlight-content" : ""} ${className}`;
|
|
48
|
-
containerClassName = `highlight-container ${containerClassName}`;
|
|
49
|
-
style.resize = "none";
|
|
50
|
-
style.wordWrap = "break-word";
|
|
51
|
-
return (React.createElement("div", { className: containerClassName, style: containerStyle },
|
|
52
|
-
React.createElement("div", { className: "highlight-backdrop", ref: (component) => {
|
|
53
|
-
this.backdropComponent = component;
|
|
54
|
-
} },
|
|
55
|
-
React.createElement(HighlighedContents, { value: value, highlight: highlight })),
|
|
56
|
-
React.createElement(Mentions, Object.assign({ value: value, onChange: onChange, style: Object.assign({}, style), className: className }, restProps, { onScroll: this.handleScroll, ref: (component) => {
|
|
57
|
-
this.mentionsComponent = component;
|
|
58
|
-
} }))));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import './highlightedTextarea.css';
|
|
14
|
+
import HighlighedContents from './highlighedContents';
|
|
15
|
+
import { Mentions } from "antd";
|
|
16
|
+
export class MentionsWithHighlighting extends React.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
var _a;
|
|
19
|
+
super(props);
|
|
20
|
+
this.mentionsComponent = null;
|
|
21
|
+
this.backdropComponent = null;
|
|
22
|
+
this.handleScroll = () => {
|
|
23
|
+
if (this.backdropComponent) {
|
|
24
|
+
if (this.mentionsComponent) {
|
|
25
|
+
const textArea = this.mentionsComponent.textarea;
|
|
26
|
+
this.backdropComponent.scrollTop = textArea.scrollTop;
|
|
27
|
+
this.backdropComponent.scrollLeft = textArea.scrollLeft;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.onChange = (value) => {
|
|
32
|
+
if (value == undefined) {
|
|
33
|
+
value = this.state.fakeValue;
|
|
34
|
+
}
|
|
35
|
+
this.setState({ fakeValue: value });
|
|
36
|
+
};
|
|
37
|
+
this.state = {
|
|
38
|
+
fakeValue: (_a = props.value) !== null && _a !== void 0 ? _a : ""
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
get textarea() {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = this.mentionsComponent) === null || _a === void 0 ? void 0 : _a.textarea;
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
let _a = this.props, { value, onChange, highlight = {}, className = "", style = {}, containerStyle = {}, containerClassName = "", onScroll } = _a, restProps = __rest(_a, ["value", "onChange", "highlight", "className", "style", "containerStyle", "containerClassName", "onScroll"]);
|
|
47
|
+
className = `highlight-input ${!this.props.disabled ? "highlight-content" : ""} ${className}`;
|
|
48
|
+
containerClassName = `highlight-container ${containerClassName}`;
|
|
49
|
+
style.resize = "none";
|
|
50
|
+
style.wordWrap = "break-word";
|
|
51
|
+
return (React.createElement("div", { className: containerClassName, style: containerStyle },
|
|
52
|
+
React.createElement("div", { className: "highlight-backdrop", ref: (component) => {
|
|
53
|
+
this.backdropComponent = component;
|
|
54
|
+
} },
|
|
55
|
+
React.createElement(HighlighedContents, { value: value, highlight: highlight })),
|
|
56
|
+
React.createElement(Mentions, Object.assign({ value: value, onChange: onChange, style: Object.assign({}, style), className: className }, restProps, { onScroll: this.handleScroll, ref: (component) => {
|
|
57
|
+
this.mentionsComponent = component;
|
|
58
|
+
} }))));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
61
|
//# sourceMappingURL=mentionsWithHighlighting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentionsWithHighlighting.js","sourceRoot":"","sources":["../../../../../components/input/textarea/mentionsWithHighlighting.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AA8B9B,MAAM,OAAO,wBAAyB,SAAQ,KAAK,CAAC,SAAuE;IAIvH,YAAY,KAA8C;;QACtD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJjB,sBAAiB,GAAe,IAAI,CAAC;QACrC,sBAAiB,GAA0B,IAAI,CAAC;QAShD,iBAAY,GAAG,GAAG,EAAE;YAChB,IAAI,IAAI,CAAC,iBAAiB,EAAE;
|
|
1
|
+
{"version":3,"file":"mentionsWithHighlighting.js","sourceRoot":"","sources":["../../../../../components/input/textarea/mentionsWithHighlighting.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AA8B9B,MAAM,OAAO,wBAAyB,SAAQ,KAAK,CAAC,SAAuE;IAIvH,YAAY,KAA8C;;QACtD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJjB,sBAAiB,GAAe,IAAI,CAAC;QACrC,sBAAiB,GAA0B,IAAI,CAAC;QAShD,iBAAY,GAAG,GAAG,EAAE;YAChB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBACzB,MAAM,QAAQ,GAAI,IAAI,CAAC,iBAAyB,CAAC,QAA+B,CAAA;oBAChF,IAAI,CAAC,iBAAiB,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;oBACtD,IAAI,CAAC,iBAAiB,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;gBAC5D,CAAC;YACL,CAAC;QACL,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;YAEzB,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;gBACrB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC,CAAC;QACtC,CAAC,CAAC;QArBE,IAAI,CAAC,KAAK,GAAG;YACT,SAAS,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,EAAE;SAC/B,CAAA;IACL,CAAC;IAoBD,IAAI,QAAQ;;QACR,OAAO,MAAC,IAAI,CAAC,iBAAyB,0CAAE,QAA+B,CAAC;IAC5E,CAAC;IAED,MAAM;QACF,IAAI,KAAsI,IAAI,CAAC,KAAK,EAAhJ,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,cAAc,GAAG,EAAE,EAAE,kBAAkB,GAAG,EAAE,EAAE,QAAQ,OAA4B,EAAvB,SAAS,cAAlI,4GAAmI,CAAa,CAAC;QAErJ,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAA,CAAC,CAAC,EAAE,IAAI,SAAS,EAAE,CAAC;QAC7F,kBAAkB,GAAG,uBAAuB,kBAAkB,EAAE,CAAC;QAGjE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;QAI9B,OAAO,CACH,6BAAK,SAAS,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc;YACrD,6BAAK,SAAS,EAAE,oBAAoB,EAAE,GAAG,EAAE,CAAC,SAAS,EAAC,EAAE;oBACpD,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;gBACvC,CAAC;gBACG,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,CACvD;YACN,oBAAC,QAAQ,kBAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,oBAAM,KAAK,GAAG,SAAS,EAAE,SAAS,IAAM,SAAS,IACxF,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE;oBAC5C,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAA;gBAChD,CAAC,IACU,CACT,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, {CSSProperties} from 'react';\nimport './highlightedTextarea.css';\nimport HighlighedContents from './highlighedContents';\nimport {MentionProps} from \"antd/lib/mentions\";\nimport {Mentions} from \"antd\";\n\nexport interface HighlightItem {\n highlight: HighlightType\n className: string\n}\n\nexport type AssignHighlightFunction = (value: string) => HighlightType;\nexport type HighlightType =\n boolean\n | string\n | RegExp\n | [number, number]\n | HighlightType[]\n | AssignHighlightFunction\n | HighlightItem[];\n\ninterface MentionsWithHighlightingProps extends MentionProps {\n highlight?: HighlightType\n containerStyle?: CSSProperties\n containerClassName?: string\n}\n\ninterface MentionsWithHighlightingState {\n fakeValue: string\n}\n\n/**\n * Merged antd Mentions component with code from https://github.com/bonafideduck/react-highlight-within-textarea\n */\nexport class MentionsWithHighlighting extends React.Component<MentionsWithHighlightingProps, MentionsWithHighlightingState> {\n mentionsComponent: any | null = null;\n backdropComponent: HTMLDivElement | null = null;\n\n constructor(props: Readonly<MentionsWithHighlightingProps>) {\n super(props);\n this.state = {\n fakeValue: props.value ?? \"\"\n }\n }\n\n handleScroll = () => {\n if (this.backdropComponent) {\n if (this.mentionsComponent) {\n const textArea = (this.mentionsComponent as any).textarea as HTMLTextAreaElement\n this.backdropComponent.scrollTop = textArea.scrollTop;\n this.backdropComponent.scrollLeft = textArea.scrollLeft;\n }\n }\n };\n\n onChange = (value?:string) => {\n // To properly work, value and onChange must be supplied. Give a hint for new users.\n if (value == undefined) {\n value = this.state.fakeValue;\n }\n this.setState({fakeValue: value});\n };\n\n get textarea() : HTMLTextAreaElement | undefined {\n return (this.mentionsComponent as any)?.textarea as HTMLTextAreaElement;\n }\n\n render() {\n let {value, onChange, highlight = {}, className = \"\", style = {}, containerStyle = {}, containerClassName = \"\", onScroll, ...restProps} = this.props;\n\n className = `highlight-input ${!this.props.disabled ? \"highlight-content\": \"\"} ${className}`;\n containerClassName = `highlight-container ${containerClassName}`;\n\n // Resizing is currently not supported\n style.resize = \"none\";\n style.wordWrap = \"break-word\";\n\n\n\n return (\n <div className={containerClassName} style={containerStyle}>\n <div className={\"highlight-backdrop\"} ref={(component)=> {\n this.backdropComponent = component;\n }}>\n <HighlighedContents value={value} highlight={highlight}/>\n </div>\n <Mentions value={value} onChange={onChange} style={{...style}} className={className} {...restProps}\n onScroll={this.handleScroll} ref={(component) => {\n this.mentionsComponent = component\n }}>\n </Mentions>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Key } from "ts-key-enum";
|
|
2
|
-
export default class KeyboardUtils {
|
|
3
|
-
static isKeyPressed(key: Key): boolean;
|
|
4
|
-
static isMouseDown(): boolean;
|
|
5
|
-
}
|
|
1
|
+
import { Key } from "ts-key-enum";
|
|
2
|
+
export default class KeyboardUtils {
|
|
3
|
+
static isKeyPressed(key: Key): boolean;
|
|
4
|
+
static isMouseDown(): boolean;
|
|
5
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
const pressedKeys = {};
|
|
2
|
-
let mouseDown = 0;
|
|
3
|
-
function keyDown(e) {
|
|
4
|
-
pressedKeys[e.key] = true;
|
|
5
|
-
}
|
|
6
|
-
function keyUp(e) {
|
|
7
|
-
pressedKeys[e.key] = false;
|
|
8
|
-
}
|
|
9
|
-
function reset() {
|
|
10
|
-
Object.keys(pressedKeys).forEach((key) => {
|
|
11
|
-
pressedKeys[key] = false;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function onMouseDown() {
|
|
15
|
-
mouseDown++;
|
|
16
|
-
}
|
|
17
|
-
function onMouseUp() {
|
|
18
|
-
mouseDown--;
|
|
19
|
-
}
|
|
20
|
-
window.addEventListener("keydown", keyDown);
|
|
21
|
-
window.addEventListener("keyup", keyUp);
|
|
22
|
-
window.addEventListener("blur", reset);
|
|
23
|
-
window.addEventListener("mousedown", onMouseDown);
|
|
24
|
-
window.addEventListener("mouseup", onMouseUp);
|
|
25
|
-
export default class KeyboardUtils {
|
|
26
|
-
static isKeyPressed(key) {
|
|
27
|
-
return !!pressedKeys[key];
|
|
28
|
-
}
|
|
29
|
-
static isMouseDown() {
|
|
30
|
-
return mouseDown > 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
const pressedKeys = {};
|
|
2
|
+
let mouseDown = 0;
|
|
3
|
+
function keyDown(e) {
|
|
4
|
+
pressedKeys[e.key] = true;
|
|
5
|
+
}
|
|
6
|
+
function keyUp(e) {
|
|
7
|
+
pressedKeys[e.key] = false;
|
|
8
|
+
}
|
|
9
|
+
function reset() {
|
|
10
|
+
Object.keys(pressedKeys).forEach((key) => {
|
|
11
|
+
pressedKeys[key] = false;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function onMouseDown() {
|
|
15
|
+
mouseDown++;
|
|
16
|
+
}
|
|
17
|
+
function onMouseUp() {
|
|
18
|
+
mouseDown--;
|
|
19
|
+
}
|
|
20
|
+
window.addEventListener("keydown", keyDown);
|
|
21
|
+
window.addEventListener("keyup", keyUp);
|
|
22
|
+
window.addEventListener("blur", reset);
|
|
23
|
+
window.addEventListener("mousedown", onMouseDown);
|
|
24
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
25
|
+
export default class KeyboardUtils {
|
|
26
|
+
static isKeyPressed(key) {
|
|
27
|
+
return !!pressedKeys[key];
|
|
28
|
+
}
|
|
29
|
+
static isMouseDown() {
|
|
30
|
+
return mouseDown > 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
33
|
//# sourceMappingURL=keyboardUtils.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const DraggableModalProvider: ({ children, }: {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}) => React.ReactElement;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const DraggableModalProvider: ({ children, }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}) => React.ReactElement;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useEffect, useReducer } from 'react';
|
|
3
|
-
import { DraggableModalContext } from 'd2coreui/components/modal/impl/draggableModalContext';
|
|
4
|
-
import { getWindowSize } from 'd2coreui/components/modal/impl/getWindowSize';
|
|
5
|
-
import { draggableModalReducer, initialModalsState } from 'd2coreui/components/modal/impl/draggableModalReducer';
|
|
6
|
-
export const DraggableModalProvider = ({ children, }) => {
|
|
7
|
-
const [state, dispatch] = useReducer(draggableModalReducer, initialModalsState);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (typeof window !== 'object') {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const onResize = () => dispatch({ type: 'windowResize', size: getWindowSize() });
|
|
13
|
-
window.addEventListener('resize', onResize);
|
|
14
|
-
onResize();
|
|
15
|
-
return () => window.removeEventListener('resize', onResize);
|
|
16
|
-
}, [dispatch]);
|
|
17
|
-
return (React.createElement(DraggableModalContext.Provider, { value: {
|
|
18
|
-
state,
|
|
19
|
-
dispatch,
|
|
20
|
-
} }, children));
|
|
21
|
-
};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useReducer } from 'react';
|
|
3
|
+
import { DraggableModalContext } from 'd2coreui/components/modal/impl/draggableModalContext';
|
|
4
|
+
import { getWindowSize } from 'd2coreui/components/modal/impl/getWindowSize';
|
|
5
|
+
import { draggableModalReducer, initialModalsState } from 'd2coreui/components/modal/impl/draggableModalReducer';
|
|
6
|
+
export const DraggableModalProvider = ({ children, }) => {
|
|
7
|
+
const [state, dispatch] = useReducer(draggableModalReducer, initialModalsState);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (typeof window !== 'object') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const onResize = () => dispatch({ type: 'windowResize', size: getWindowSize() });
|
|
13
|
+
window.addEventListener('resize', onResize);
|
|
14
|
+
onResize();
|
|
15
|
+
return () => window.removeEventListener('resize', onResize);
|
|
16
|
+
}, [dispatch]);
|
|
17
|
+
return (React.createElement(DraggableModalContext.Provider, { value: {
|
|
18
|
+
state,
|
|
19
|
+
dispatch,
|
|
20
|
+
} }, children));
|
|
21
|
+
};
|
|
22
22
|
//# sourceMappingURL=draggableModalProvider.js.map
|