pixel-react-excel-sheet 1.0.11 → 1.0.13
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/.yarn/install-state.gz +0 -0
- package/lib/1fb4472b34e4fe07.css +1 -0
- package/lib/components/Accordion/Accordion.d.ts +1 -1
- package/lib/components/Accordion/types.d.ts +12 -0
- package/lib/components/AddVariables/AddVariables.d.ts +5 -0
- package/lib/components/AddVariables/index.d.ts +1 -0
- package/lib/components/AddVariables/types.d.ts +35 -0
- package/lib/components/AppHeader/types.d.ts +2 -0
- package/lib/components/AttachImage/AttachImage.d.ts +1 -6
- package/lib/components/AttachImage/types.d.ts +8 -0
- package/lib/components/Avatar/types.d.ts +9 -1
- package/lib/components/Charts/BarChart/BarChart.d.ts +1 -0
- package/lib/components/Charts/DashboardDonutChart/types.d.ts +6 -0
- package/lib/components/Checkbox/types.d.ts +4 -0
- package/lib/components/Comment/Comments.d.ts +4 -0
- package/lib/components/Comment/comment/Comment.d.ts +11 -0
- package/lib/components/Comment/comment/useNode.d.ts +7 -0
- package/lib/components/Comment/index.d.ts +1 -0
- package/lib/components/Comment/type.d.ts +25 -0
- package/lib/components/CreateVariable/CreateVariableSlider.d.ts +5 -0
- package/lib/components/CreateVariable/index.d.ts +1 -0
- package/lib/components/CreateVariable/types.d.ts +56 -0
- package/lib/components/Drawer/Types.d.ts +13 -0
- package/lib/components/Editor/constants.d.ts +1 -1
- package/lib/components/Editor/types.d.ts +10 -2
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +8 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +2 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +13 -6
- package/lib/components/FileDropzone/RadioFilePreview.d.ts +4 -0
- package/lib/components/FileDropzone/types.d.ts +61 -0
- package/lib/components/IconButton/IconButton.d.ts +1 -2
- package/lib/components/IconButton/types.d.ts +1 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +3 -2
- package/lib/components/MiniModal/types.d.ts +7 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/PhoneInput/PhoneInput.d.ts +6 -0
- package/lib/components/PhoneInput/index.d.ts +1 -0
- package/lib/components/PhoneInput/types.d.ts +10 -0
- package/lib/components/PopUpModal/types.d.ts +1 -0
- package/lib/components/Search/Search.d.ts +1 -1
- package/lib/components/Search/types.d.ts +4 -0
- package/lib/components/Select/components/types.d.ts +1 -0
- package/lib/components/Select/types.d.ts +2 -0
- package/lib/components/Table/Types.d.ts +1 -1
- package/lib/components/TableTree/Components/TableBody.d.ts +4 -0
- package/lib/components/TableTree/Components/TableCell.d.ts +4 -0
- package/lib/components/TableTree/Components/TableHead.d.ts +4 -0
- package/lib/components/TableTree/Components/TableRow.d.ts +4 -0
- package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +38 -5
- package/lib/components/TableWithAccordion/TableWithAccordion.d.ts +5 -0
- package/lib/components/TableWithAccordion/data.d.ts +8 -0
- package/lib/components/TableWithAccordion/index.d.ts +1 -0
- package/lib/components/TableWithAccordion/types.d.ts +67 -0
- package/lib/components/Tabs/types.d.ts +1 -0
- package/lib/index.d.ts +395 -39
- package/lib/index.esm.js +3859 -1017
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3866 -1016
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/FormatString/FormatString.d.ts +1 -0
- package/lib/utils/checkDuplicates/checkDuplicates.d.ts +1 -0
- package/package.json +2 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +15 -0
- package/src/assets/Themes/BaseTheme.scss +16 -0
- package/src/assets/Themes/DarkTheme.scss +71 -42
- package/src/assets/icons/add_file.svg +4 -17
- package/src/assets/icons/add_variable.svg +11 -0
- package/src/assets/icons/authorization.svg +4 -0
- package/src/assets/icons/authorization_icon.svg +1 -0
- package/src/assets/icons/backward.svg +10 -0
- package/src/assets/icons/capture_icon.svg +3 -0
- package/src/assets/icons/depends_on_script.svg +7 -0
- package/src/assets/icons/download_file_icon.svg +2 -9
- package/src/assets/icons/email_group.svg +3 -0
- package/src/assets/icons/executions_icon.svg +3 -0
- package/src/assets/icons/forward.svg +3 -0
- package/src/assets/icons/labels.svg +8 -0
- package/src/assets/icons/machine_disable_icon.svg +18 -0
- package/src/assets/icons/machine_enable_icon.svg +10 -0
- package/src/assets/icons/parameters.svg +3 -0
- package/src/assets/icons/pre_post_condition.svg +8 -0
- package/src/assets/icons/program_element.svg +8 -0
- package/src/assets/icons/project_status_icon.svg +10 -0
- package/src/assets/icons/refresh_icon.svg +4 -0
- package/src/assets/icons/rotate_icon.svg +10 -0
- package/src/assets/icons/suites_icon.svg +3 -0
- package/src/assets/icons/swipe_icon.svg +9 -0
- package/src/assets/icons/tap_icon.svg +4 -0
- package/src/assets/icons/test_data.svg +5 -0
- package/src/assets/icons/test_data_set.svg +7 -0
- package/src/assets/icons/variable_set.svg +5 -0
- package/src/assets/icons/window_maximize.svg +1 -2
- package/src/assets/icons/window_restore.svg +4 -0
- package/src/assets/styles/_colors.scss +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +4 -0
- package/src/components/Accordion/Accordion.tsx +7 -1
- package/src/components/Accordion/types.ts +12 -0
- package/src/components/AddVariables/AddVariables.scss +14 -0
- package/src/components/AddVariables/AddVariables.stories.tsx +44 -0
- package/src/components/AddVariables/AddVariables.tsx +113 -0
- package/src/components/AddVariables/index.ts +1 -0
- package/src/components/AddVariables/types.ts +36 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +1 -1
- package/src/components/AppHeader/AppHeader.scss +40 -1
- package/src/components/AppHeader/AppHeader.stories.tsx +133 -5
- package/src/components/AppHeader/AppHeader.tsx +111 -112
- package/src/components/AppHeader/types.ts +10 -9
- package/src/components/AttachImage/AttachImage.stories.tsx +2 -0
- package/src/components/AttachImage/AttachImage.tsx +5 -9
- package/src/components/AttachImage/types.ts +25 -18
- package/src/components/Avatar/Avatar.scss +4 -0
- package/src/components/Avatar/Avatar.stories.tsx +38 -18
- package/src/components/Avatar/Avatar.tsx +19 -3
- package/src/components/Avatar/types.ts +9 -1
- package/src/components/Charts/BarChart/BarChart.scss +4 -1
- package/src/components/Charts/BarChart/BarChart.tsx +23 -9
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.scss +10 -3
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.tsx +2 -1
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +54 -25
- package/src/components/Charts/DashboardDonutChart/types.ts +7 -1
- package/src/components/Charts/DonutChart/DonutChart.tsx +8 -3
- package/src/components/Charts/LineChart/LineChart.scss +13 -9
- package/src/components/Charts/LineChart/LineChart.tsx +6 -2
- package/src/components/Charts/RadialChart/RadialChart.scss +4 -0
- package/src/components/Charts/RadialChart/RadialChart.tsx +51 -45
- package/src/components/Checkbox/Checkbox.scss +57 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +91 -15
- package/src/components/Checkbox/Checkbox.tsx +4 -1
- package/src/components/Checkbox/types.ts +4 -0
- package/src/components/Comment/Comments.scss +166 -0
- package/src/components/Comment/Comments.stories.tsx +212 -0
- package/src/components/Comment/Comments.tsx +51 -0
- package/src/components/Comment/comment/Comment.tsx +206 -0
- package/src/components/Comment/comment/useNode.ts +51 -0
- package/src/components/Comment/index.ts +1 -0
- package/src/components/Comment/type.ts +36 -0
- package/src/components/CreateVariable/CreateVariableSlider.scss +18 -0
- package/src/components/CreateVariable/CreateVariableSlider.stories.tsx +66 -0
- package/src/components/CreateVariable/CreateVariableSlider.tsx +95 -0
- package/src/components/CreateVariable/index.ts +1 -0
- package/src/components/CreateVariable/types.ts +58 -0
- package/src/components/DatePicker/DatePicker.scss +11 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +19 -0
- package/src/components/DatePicker/DatePicker.tsx +73 -22
- package/src/components/Drawer/Drawer.scss +3 -2
- package/src/components/Drawer/Drawer.stories.tsx +0 -1
- package/src/components/Drawer/Drawer.tsx +4 -1
- package/src/components/Drawer/Types.ts +13 -0
- package/src/components/Editor/Editor.stories.tsx +2 -2
- package/src/components/Editor/Editor.tsx +4 -2
- package/src/components/Editor/VariableDropdown.scss +8 -2
- package/src/components/Editor/VariableDropdown.tsx +15 -7
- package/src/components/Editor/constants.ts +1 -1
- package/src/components/Editor/types.ts +12 -2
- package/src/components/Excel/ExcelFile/ExcelFile.scss +0 -1
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +41 -25
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.tsx +12 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +2 -34
- package/src/components/Excel/ExcelFile/ExcelFileComponents/FloatingRect.tsx +26 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +24 -22
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +1 -3
- package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +13 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +53 -26
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +81 -14
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +17 -6
- package/src/components/Excel/ExcelFile.stories.tsx +4 -4
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +36 -19
- package/src/components/Excel/dataConversion.ts +43 -20
- package/src/components/FieldSet/FieldSet.scss +2 -1
- package/src/components/FieldSet/FieldSet.stories.tsx +2 -1
- package/src/components/FileDropzone/Dropzone.tsx +76 -28
- package/src/components/FileDropzone/FileDropzone.scss +30 -3
- package/src/components/FileDropzone/FileDropzone.stories.tsx +125 -4
- package/src/components/FileDropzone/FileDropzone.tsx +46 -13
- package/src/components/FileDropzone/RadioFilePreview.tsx +76 -0
- package/src/components/FileDropzone/types.ts +73 -0
- package/src/components/Icon/iconList.ts +47 -2
- package/src/components/IconButton/IconButton.scss +11 -11
- package/src/components/IconButton/IconButton.stories.tsx +1 -0
- package/src/components/IconButton/IconButton.tsx +6 -8
- package/src/components/IconButton/types.ts +2 -1
- package/src/components/IconRadioGroup/IconRadioGroup.scss +2 -1
- package/src/components/Input/Input.scss +137 -125
- package/src/components/Input/Input.tsx +110 -93
- package/src/components/InputWithDropdown/InputWithDropdown.scss +9 -2
- package/src/components/InputWithDropdown/types.ts +3 -3
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +1 -1
- package/src/components/MenuOption/MenuOption.stories.tsx +4 -3
- package/src/components/MenuOption/MenuOption.tsx +1 -1
- package/src/components/MenuOption/types.ts +4 -2
- package/src/components/MiniModal/MiniModal.scss +0 -4
- package/src/components/MiniModal/MiniModal.stories.tsx +3 -2
- package/src/components/MiniModal/MiniModal.tsx +28 -10
- package/src/components/MiniModal/types.ts +7 -0
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/ModulesChip/ModuleChip.scss +21 -8
- package/src/components/ModulesChip/ModuleChip.stories.tsx +2 -2
- package/src/components/ModulesChip/ModuleChip.tsx +6 -9
- package/src/components/MultiSelect/Dropdown.tsx +12 -5
- package/src/components/MultiSelect/MultiSelect.scss +29 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +31 -14
- package/src/components/MultiSelect/MultiSelect.tsx +32 -21
- package/src/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/src/components/PhoneInput/PhoneInput.stories.tsx +95 -0
- package/src/components/PhoneInput/PhoneInput.tsx +90 -0
- package/src/components/PhoneInput/index.ts +1 -0
- package/src/components/PhoneInput/phoneInput.scss +3 -0
- package/src/components/PhoneInput/types.ts +10 -0
- package/src/components/PopUpModal/PopUpModal.stories.tsx +14 -13
- package/src/components/PopUpModal/PopUpModal.tsx +2 -1
- package/src/components/PopUpModal/types.ts +14 -13
- package/src/components/Search/Search.stories.tsx +28 -9
- package/src/components/Search/Search.tsx +32 -29
- package/src/components/Search/types.ts +4 -0
- package/src/components/Select/Select.scss +20 -0
- package/src/components/Select/Select.stories.tsx +50 -1
- package/src/components/Select/Select.tsx +34 -7
- package/src/components/Select/components/Dropdown.scss +9 -0
- package/src/components/Select/components/Dropdown.tsx +20 -6
- package/src/components/Select/components/types.ts +1 -0
- package/src/components/Select/types.ts +12 -2
- package/src/components/Table/Table.scss +6 -5
- package/src/components/Table/Types.ts +1 -1
- package/src/components/TableTree/Components/TableBody.tsx +35 -0
- package/src/components/TableTree/Components/TableCell.tsx +59 -0
- package/src/components/TableTree/Components/TableHead.tsx +39 -0
- package/src/components/TableTree/Components/TableRow.tsx +37 -0
- package/src/components/TableTree/TableTree.scss +8 -5
- package/src/components/TableTree/TableTree.tsx +16 -46
- package/src/components/TableTree/Utils/getAllChildIds.ts +12 -0
- package/src/components/TableTree/Utils/renderSpaces.ts +0 -0
- package/src/components/TableTree/types.ts +43 -5
- package/src/components/TableWithAccordion/TableWithAccordion.scss +54 -0
- package/src/components/TableWithAccordion/TableWithAccordion.stories.tsx +94 -0
- package/src/components/TableWithAccordion/TableWithAccordion.tsx +174 -0
- package/src/components/TableWithAccordion/data.ts +37 -0
- package/src/components/TableWithAccordion/index.ts +1 -0
- package/src/components/TableWithAccordion/types.ts +70 -0
- package/src/components/Tabs/Tabs.scss +58 -5
- package/src/components/Tabs/Tabs.stories.tsx +31 -12
- package/src/components/Tabs/Tabs.tsx +27 -18
- package/src/components/Tabs/types.ts +1 -1
- package/src/components/TextArea/Textarea.stories.tsx +1 -1
- package/src/hooks/useFileDropzone.tsx +2 -1
- package/src/index.ts +18 -1
- package/src/utils/FormatString/FormatString.stories.tsx +58 -0
- package/src/utils/FormatString/FormatString.tsx +41 -0
- package/src/utils/checkDuplicates/CheckDuplicates.stories.tsx +40 -0
- package/src/utils/checkDuplicates/checkDuplicates.ts +13 -0
|
@@ -4,24 +4,26 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
|
|
7
|
-
.ff-excel-toolbar{
|
|
7
|
+
.ff-excel-toolbar-container{
|
|
8
8
|
position: static;
|
|
9
9
|
top: 0;
|
|
10
|
+
background-color:var( --excel-toolbar-bg);
|
|
11
|
+
padding: 4px 8px;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
.ff-spreadsheet {
|
|
15
|
+
--background-color: var(--drawer-footer-bg);
|
|
16
|
+
--text-color: var(--text-color);
|
|
17
|
+
--readonly-text-color: var(--toggle-strip-active);
|
|
18
|
+
--outline-color: var(--toggle-strip-active);
|
|
19
|
+
--outline-background-color: var(--overlay-bg);
|
|
20
|
+
--border-color: var(--excel-sheet-border);
|
|
21
|
+
--header-background-color: var(--pop-up-background-blur);
|
|
22
|
+
--elevation: var(--brand-color);
|
|
21
23
|
|
|
22
24
|
position: relative;
|
|
23
25
|
overflow: scroll;
|
|
24
|
-
|
|
26
|
+
height: 465px;
|
|
25
27
|
background: var(--background-color);
|
|
26
28
|
color: var(--text-color);
|
|
27
29
|
scrollbar-width: none;
|
|
@@ -59,17 +61,17 @@
|
|
|
59
61
|
z-index: 0;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
.ff-spreadsheet-active-cell .select_dot {
|
|
65
|
+
background-color: var(--elevation);
|
|
66
|
+
height: 10px;
|
|
67
|
+
width: 10px;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
position: absolute;
|
|
70
|
+
bottom: -5px;
|
|
71
|
+
right: -5px;
|
|
72
|
+
cursor: crosshair;
|
|
73
|
+
z-index: 1000;
|
|
74
|
+
}
|
|
73
75
|
|
|
74
76
|
.ff-spreadsheet-cell--readonly {
|
|
75
77
|
color: var(--readonly-text-color);
|
|
@@ -443,9 +443,7 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
|
443
443
|
const rootNode = React.useMemo(
|
|
444
444
|
() => (
|
|
445
445
|
<div className="ff-excel">
|
|
446
|
-
<div className="ff-excel-toolbar">
|
|
447
|
-
|
|
448
|
-
|
|
446
|
+
<div className="ff-excel-toolbar-container">
|
|
449
447
|
<ExcelToolBar
|
|
450
448
|
onBold={onBold}
|
|
451
449
|
onItalic={onItalic}
|
|
@@ -46,11 +46,23 @@ export const DELETE_ROW = 'DELETE_ROW';
|
|
|
46
46
|
export const DELETE_COLUMN = 'DELETE_COLUMN';
|
|
47
47
|
export const SET_ROW_HEIGHT = 'SET_ROW_HEIGHT';
|
|
48
48
|
export const SET_COLUMN_POSITION = 'SET_COLUMN_POSITION';
|
|
49
|
+
export const SET_AUTO_FILL = 'SET_AUTO_FILL';
|
|
49
50
|
|
|
50
51
|
export type BaseAction<T extends string> = {
|
|
51
52
|
type: T;
|
|
52
53
|
};
|
|
53
54
|
|
|
55
|
+
export type SetAutoFill = BaseAction<typeof SET_AUTO_FILL> & {
|
|
56
|
+
payload: { autofill: boolean };
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function autoFill(autofill: boolean): SetAutoFill {
|
|
60
|
+
return {
|
|
61
|
+
type: SET_AUTO_FILL,
|
|
62
|
+
payload: { autofill },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
export type SetRowHeight = BaseAction<typeof SET_ROW_HEIGHT> & {
|
|
55
67
|
payload: { row: number; height: number };
|
|
56
68
|
};
|
|
@@ -545,4 +557,5 @@ export type Action =
|
|
|
545
557
|
| DeleteColumn
|
|
546
558
|
| SetRowHeight
|
|
547
559
|
| SetColumnPosition
|
|
560
|
+
| SetAutoFill
|
|
548
561
|
| BlurAction;
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
blur,
|
|
27
27
|
clear,
|
|
28
28
|
commit,
|
|
29
|
+
dragEndAutoFill,
|
|
30
|
+
dragEndFormatePainter,
|
|
29
31
|
edit,
|
|
30
32
|
getKeyDownHandler,
|
|
31
33
|
isActiveReadOnly,
|
|
@@ -41,6 +43,7 @@ export const INITIAL_STATE: Types.StoreState = {
|
|
|
41
43
|
lastChanged: null,
|
|
42
44
|
hasPasted: false,
|
|
43
45
|
cut: false,
|
|
46
|
+
autoFill: { open: false, cellValue: { value: '', style: {} } },
|
|
44
47
|
dragging: false,
|
|
45
48
|
model: new Model(createFormulaParser, []),
|
|
46
49
|
selected: new EmptySelection(),
|
|
@@ -56,6 +59,23 @@ export default function reducer(
|
|
|
56
59
|
action: Actions.Action
|
|
57
60
|
): Types.StoreState {
|
|
58
61
|
switch (action.type) {
|
|
62
|
+
case Actions.SET_AUTO_FILL: {
|
|
63
|
+
const { autofill } = action.payload;
|
|
64
|
+
const activeCell = state.active;
|
|
65
|
+
let currentCell: Types.CellBase<any> = { value: '', style: {} };
|
|
66
|
+
if (activeCell) {
|
|
67
|
+
currentCell =
|
|
68
|
+
Matrix.get(
|
|
69
|
+
{ row: activeCell.row, column: activeCell.column },
|
|
70
|
+
state.model.data
|
|
71
|
+
) || currentCell;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
...state,
|
|
75
|
+
autoFill: { open: autofill, cellValue: currentCell },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
59
79
|
case Actions.ADD_ROW_TOP: {
|
|
60
80
|
let { selectedRow, selectedColumn, model } = state;
|
|
61
81
|
if (checkEmpty(selectedRow)) {
|
|
@@ -610,41 +630,48 @@ export default function reducer(
|
|
|
610
630
|
|
|
611
631
|
case Actions.DRAG_END: {
|
|
612
632
|
const selectedRange = state.selected.toRange(state.model.data);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (
|
|
633
|
+
const activeCell = state.active;
|
|
634
|
+
let updatedData = state.model.data;
|
|
635
|
+
if (state.formattedStyle.open) {
|
|
636
|
+
updatedData = dragEndFormatePainter(
|
|
637
|
+
state.model.data,
|
|
638
|
+
selectedRange as PointRange,
|
|
639
|
+
state.formattedStyle
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
if (state.autoFill.open) {
|
|
643
|
+
updatedData = dragEndAutoFill(
|
|
644
|
+
state.model.data,
|
|
645
|
+
selectedRange as PointRange,
|
|
646
|
+
state.autoFill.cellValue,
|
|
647
|
+
activeCell
|
|
648
|
+
);
|
|
649
|
+
let { start, end } = selectedRange as PointRange;
|
|
650
|
+
const rowCount = start.row - end.row;
|
|
651
|
+
const columnCount = start.column - end.column;
|
|
652
|
+
let startPoint = { row: 0, column: 0 };
|
|
653
|
+
let endPoint = { row: 0, column: 0 };
|
|
654
|
+
|
|
655
|
+
if (rowCount > columnCount) {
|
|
656
|
+
startPoint = { row: activeCell?.row ?? 0, column: start.column };
|
|
657
|
+
endPoint = { row: activeCell?.row ?? 0, column: end.column };
|
|
658
|
+
} else {
|
|
659
|
+
startPoint = { row: start.row, column: activeCell?.column ?? 0 };
|
|
660
|
+
endPoint = { row: end.row, column: activeCell?.column ?? 0 };
|
|
661
|
+
}
|
|
616
662
|
return {
|
|
617
663
|
...state,
|
|
618
664
|
dragging: false,
|
|
665
|
+
autoFill: { open: false, cellValue: { value: '', style: {} } },
|
|
619
666
|
formattedStyle: { open: false, style: undefined },
|
|
667
|
+
model: new Model(state.model.createFormulaParser, updatedData),
|
|
668
|
+
selected: new RangeSelection(new PointRange(startPoint, endPoint)),
|
|
620
669
|
};
|
|
621
670
|
}
|
|
622
|
-
|
|
623
|
-
const { start, end } = selectedRange;
|
|
624
|
-
|
|
625
|
-
let updatedData = currentData;
|
|
626
|
-
|
|
627
|
-
for (let row = start.row; row <= end.row; row++) {
|
|
628
|
-
for (let col = start.column; col <= end.column; col++) {
|
|
629
|
-
const currentCell = Matrix.get({ row, column: col }, updatedData);
|
|
630
|
-
if (!currentCell) {
|
|
631
|
-
continue;
|
|
632
|
-
}
|
|
633
|
-
const updatedCell = {
|
|
634
|
-
...currentCell,
|
|
635
|
-
style: state.formattedStyle.style,
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
updatedData = Matrix.set(
|
|
639
|
-
{ row, column: col },
|
|
640
|
-
updatedCell,
|
|
641
|
-
updatedData
|
|
642
|
-
);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
671
|
return {
|
|
646
672
|
...state,
|
|
647
673
|
dragging: false,
|
|
674
|
+
autoFill: { open: false, cellValue: { value: '', style: {} } },
|
|
648
675
|
formattedStyle: { open: false, style: undefined },
|
|
649
676
|
model: new Model(state.model.createFormulaParser, updatedData),
|
|
650
677
|
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export function applyBoldToCells(
|
|
14
14
|
currentData: Matrix.Matrix<Types.CellBase<any>>,
|
|
15
|
-
selectedRange: PointRange
|
|
15
|
+
selectedRange: PointRange
|
|
16
16
|
): Matrix.Matrix<Types.CellBase<any>> {
|
|
17
17
|
if (!selectedRange) {
|
|
18
18
|
return currentData;
|
|
@@ -217,10 +217,10 @@ export function applyBorderToCells(
|
|
|
217
217
|
case 'border-none':
|
|
218
218
|
updatedCell.style = {
|
|
219
219
|
...currentCell.style,
|
|
220
|
-
borderRight: `1px solid var(--
|
|
221
|
-
borderLeft: `1px solid var(--
|
|
222
|
-
borderTop: `1px solid var(--
|
|
223
|
-
borderBottom: `1px solid var(--
|
|
220
|
+
borderRight: `1px solid var(--excel-sheet-border)`,
|
|
221
|
+
borderLeft: `1px solid var(--excel-sheet-border)`,
|
|
222
|
+
borderTop: `1px solid var(--excel-sheet-border)`,
|
|
223
|
+
borderBottom: `1px solid var(--excel-sheet-border)`,
|
|
224
224
|
};
|
|
225
225
|
break;
|
|
226
226
|
case 'border-right':
|
|
@@ -333,8 +333,7 @@ export function applyUnderlineToCells(
|
|
|
333
333
|
...currentCell,
|
|
334
334
|
style: {
|
|
335
335
|
...currentCell.style,
|
|
336
|
-
textDecoration: 'none',
|
|
337
|
-
textDecorationStyle: 'solid' as TextDecorationStyle,
|
|
336
|
+
textDecoration: 'none solid',
|
|
338
337
|
},
|
|
339
338
|
};
|
|
340
339
|
} else {
|
|
@@ -342,11 +341,8 @@ export function applyUnderlineToCells(
|
|
|
342
341
|
...currentCell,
|
|
343
342
|
style: {
|
|
344
343
|
...currentCell.style,
|
|
345
|
-
textDecoration:
|
|
346
|
-
|
|
347
|
-
value === 'double_border'
|
|
348
|
-
? 'double'
|
|
349
|
-
: ('none' as TextDecorationStyle),
|
|
344
|
+
textDecoration:
|
|
345
|
+
value === 'double_border' ? 'underline double' : value,
|
|
350
346
|
},
|
|
351
347
|
};
|
|
352
348
|
}
|
|
@@ -480,6 +476,79 @@ export function applyFormatePainter(
|
|
|
480
476
|
return undefined;
|
|
481
477
|
}
|
|
482
478
|
|
|
479
|
+
export function dragEndFormatePainter(
|
|
480
|
+
currentData: Matrix.Matrix<Types.CellBase<any>>,
|
|
481
|
+
selectedRange: PointRange | null,
|
|
482
|
+
formattedStyle: Types.formattedStyle
|
|
483
|
+
): Matrix.Matrix<Types.CellBase<any>> {
|
|
484
|
+
if (!selectedRange || !formattedStyle.open) {
|
|
485
|
+
return currentData;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const { start, end } = selectedRange;
|
|
489
|
+
let updatedData = currentData;
|
|
490
|
+
|
|
491
|
+
for (let row = start.row; row <= end.row; row++) {
|
|
492
|
+
for (let col = start.column; col <= end.column; col++) {
|
|
493
|
+
const currentCell = Matrix.get({ row, column: col }, updatedData);
|
|
494
|
+
if (!currentCell) {
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
const updatedCell = {
|
|
498
|
+
...currentCell,
|
|
499
|
+
style: formattedStyle.style,
|
|
500
|
+
};
|
|
501
|
+
updatedData = Matrix.set({ row, column: col }, updatedCell, updatedData);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return updatedData;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export function dragEndAutoFill(
|
|
508
|
+
currentData: Matrix.Matrix<Types.CellBase<any>>,
|
|
509
|
+
selectedRange: PointRange | null,
|
|
510
|
+
cellValue: Types.CellBase,
|
|
511
|
+
activeCell: Point.Point | null
|
|
512
|
+
): Matrix.Matrix<Types.CellBase<any>> {
|
|
513
|
+
if (!selectedRange) {
|
|
514
|
+
return currentData;
|
|
515
|
+
}
|
|
516
|
+
const { start, end } = selectedRange;
|
|
517
|
+
const rowCount = start.row - end.row;
|
|
518
|
+
const columnCount = start.column - end.column;
|
|
519
|
+
let startPoint = { row: 0, column: 0 };
|
|
520
|
+
let endPoint = { row: 0, column: 0 };
|
|
521
|
+
|
|
522
|
+
if (rowCount > columnCount) {
|
|
523
|
+
startPoint = { row: activeCell?.row ?? 0, column: start.column };
|
|
524
|
+
endPoint = { row: activeCell?.row ?? 0, column: end.column };
|
|
525
|
+
} else {
|
|
526
|
+
startPoint = { row: start.row, column: activeCell?.column ?? 0 };
|
|
527
|
+
endPoint = { row: end.row, column: activeCell?.column ?? 0 };
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
let updatedData = currentData;
|
|
531
|
+
|
|
532
|
+
for (let row = startPoint.row; row <= endPoint.row; row++) {
|
|
533
|
+
for (let col = startPoint.column; col <= endPoint.column; col++) {
|
|
534
|
+
const currentCell = Matrix.get({ row, column: col }, updatedData);
|
|
535
|
+
|
|
536
|
+
if (!currentCell) {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
const updatedCell = {
|
|
541
|
+
...currentCell,
|
|
542
|
+
style: cellValue.style,
|
|
543
|
+
value: cellValue.value,
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
updatedData = Matrix.set({ row, column: col }, updatedCell, updatedData);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return updatedData;
|
|
550
|
+
}
|
|
551
|
+
|
|
483
552
|
export function edit(state: Types.StoreState): Types.StoreState {
|
|
484
553
|
if (isActiveReadOnly(state)) {
|
|
485
554
|
return state;
|
|
@@ -567,8 +636,6 @@ function convertPtToPx(pt: number): string {
|
|
|
567
636
|
|
|
568
637
|
// Key Bindings
|
|
569
638
|
|
|
570
|
-
type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
|
|
571
|
-
|
|
572
639
|
type TextAlign = 'left' | 'center' | 'right';
|
|
573
640
|
|
|
574
641
|
export type KeyDownHandler = (
|
|
@@ -55,19 +55,30 @@ export type StoreState<Cell extends CellBase = CellBase> = {
|
|
|
55
55
|
copied: PointRange | null;
|
|
56
56
|
hasPasted: boolean;
|
|
57
57
|
cut: boolean;
|
|
58
|
+
autoFill: { open: boolean; cellValue: Cell };
|
|
58
59
|
active: Point | null;
|
|
59
60
|
mode: Mode;
|
|
60
|
-
rowDimensions:
|
|
61
|
-
columnDimensions:
|
|
62
|
-
number,
|
|
63
|
-
Pick<Dimensions, 'width' | 'left'> | undefined
|
|
64
|
-
>;
|
|
61
|
+
rowDimensions: rowDimensions;
|
|
62
|
+
columnDimensions: columnDimensions;
|
|
65
63
|
dragging: boolean;
|
|
66
64
|
lastChanged: Point | null;
|
|
67
65
|
lastCommit: null | CellChange<Cell>[];
|
|
68
66
|
selectedRow: null | number;
|
|
69
67
|
selectedColumn: null | number;
|
|
70
|
-
formattedStyle:
|
|
68
|
+
formattedStyle: formattedStyle;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type rowDimensions = Record<
|
|
72
|
+
number,
|
|
73
|
+
Pick<Dimensions, 'height' | 'top'> | undefined
|
|
74
|
+
>;
|
|
75
|
+
export type columnDimensions = Record<
|
|
76
|
+
number,
|
|
77
|
+
Pick<Dimensions, 'width' | 'left'> | undefined
|
|
78
|
+
>;
|
|
79
|
+
export type formattedStyle = {
|
|
80
|
+
open: boolean;
|
|
81
|
+
style: undefined | React.CSSProperties;
|
|
71
82
|
};
|
|
72
83
|
|
|
73
84
|
export type CellChange<Cell extends CellBase = CellBase> = {
|
|
@@ -115,10 +115,10 @@ export const Default: Story = {
|
|
|
115
115
|
backgroundColor: 'C6E7FF', // Sample data from backend without #
|
|
116
116
|
borderColor: 'F2F2F2', // Sample data from backend without #
|
|
117
117
|
border: {
|
|
118
|
-
top: '
|
|
119
|
-
bottom: '
|
|
120
|
-
left: '
|
|
121
|
-
right: '
|
|
118
|
+
top: 'THIN',
|
|
119
|
+
bottom: 'THIN',
|
|
120
|
+
left: 'THIN',
|
|
121
|
+
right: 'THIN',
|
|
122
122
|
},
|
|
123
123
|
alignment: {
|
|
124
124
|
horizontal: 'GENERAL',
|
|
@@ -51,22 +51,27 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
51
51
|
const data = useSelector((state) => state.model.data);
|
|
52
52
|
const formattedStyle = useSelector((state) => state.formattedStyle.open);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
// Default style to Excel
|
|
55
|
+
const basicStyle: React.CSSProperties = {
|
|
56
|
+
color: 'var(--input-hover-border-color)',
|
|
57
|
+
backgroundColor: 'var(--drawer-footer-bg)',
|
|
58
|
+
borderColor: 'var(--excel-sheet-border)',
|
|
59
|
+
textDecoration: 'none solid',
|
|
60
|
+
borderRight: `1px solid var(--excel-sheet-border)`,
|
|
61
|
+
borderLeft: `1px solid var(--excel-sheet-border)`,
|
|
62
|
+
borderTop: `1px solid var(--excel-sheet-border)`,
|
|
63
|
+
borderBottom: `1px solid var(--excel-sheet-border)`,
|
|
64
|
+
fontSize: '15px',
|
|
65
|
+
fontWeight: 'normal',
|
|
66
|
+
fontStyle: 'normal',
|
|
67
|
+
fontFamily: 'Times New Roman',
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const [cellStyle, setCellStyle] = useState(cell?.style || basicStyle);
|
|
61
72
|
|
|
62
73
|
useEffect(() => {
|
|
63
|
-
setCellStyle(
|
|
64
|
-
cell?.style || {
|
|
65
|
-
color: 'var(--text-color)',
|
|
66
|
-
backgroundColor: 'var(--drawer-footer-bg)',
|
|
67
|
-
borderColor: 'var(--toggle-strip-color)',
|
|
68
|
-
}
|
|
69
|
-
);
|
|
74
|
+
setCellStyle(cell?.style || basicStyle);
|
|
70
75
|
}, [cell]);
|
|
71
76
|
|
|
72
77
|
useEffect(() => {
|
|
@@ -79,8 +84,6 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
79
84
|
}, [cell]);
|
|
80
85
|
|
|
81
86
|
const styleBackend = convertStyleToBackend(cellStyle);
|
|
82
|
-
|
|
83
|
-
|
|
84
87
|
const [border, setBorder] = useState<string>('border-none');
|
|
85
88
|
const [underLine, setUnderLine] = useState<string>('underline');
|
|
86
89
|
const [selectedFontFamily, setSelectedFontFamily] = useState<{
|
|
@@ -93,7 +96,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
93
96
|
const [colorContainer, setColorPicker] = useState<ColorContainer>({
|
|
94
97
|
color: 'var(--error-light)',
|
|
95
98
|
backgroundColor: 'var(--error-light)',
|
|
96
|
-
borderColor: 'var(--
|
|
99
|
+
borderColor: 'var(--input-hover-border-color)',
|
|
97
100
|
});
|
|
98
101
|
|
|
99
102
|
const borderTypeIcon = [
|
|
@@ -124,6 +127,18 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
124
127
|
label: 'Arial',
|
|
125
128
|
value: 'Arial',
|
|
126
129
|
},
|
|
130
|
+
{
|
|
131
|
+
label: 'fantasy',
|
|
132
|
+
value: 'fantasy',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: 'cursive',
|
|
136
|
+
value: 'cursive',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
label: 'Poppins',
|
|
140
|
+
value: 'Poppins',
|
|
141
|
+
},
|
|
127
142
|
{
|
|
128
143
|
label: 'Courier New',
|
|
129
144
|
value: '"Courier New"',
|
|
@@ -283,7 +298,9 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
283
298
|
<Tooltip placement="top" title={'Underline Type'}>
|
|
284
299
|
<div className="ff-excel-toolbar-icon-underline">
|
|
285
300
|
<Icon
|
|
286
|
-
variant={
|
|
301
|
+
variant={
|
|
302
|
+
cellStyle.textDecoration === underLine ? 'dark' : 'light'
|
|
303
|
+
}
|
|
287
304
|
hoverEffect
|
|
288
305
|
disabled={toolbar === 'disable'}
|
|
289
306
|
onClick={() => setUnderlineType(data, underLine, true)}
|
|
@@ -308,7 +325,7 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
|
|
|
308
325
|
<div className="ff-excel-toolbar-icon">
|
|
309
326
|
<Tooltip placement="top" title={'Format Painter'}>
|
|
310
327
|
<Icon
|
|
311
|
-
|
|
328
|
+
variant={formattedStyle ? 'dark' : 'light'}
|
|
312
329
|
hoverEffect
|
|
313
330
|
disabled={toolbar === 'disable'}
|
|
314
331
|
onClick={() => {
|
|
@@ -54,7 +54,7 @@ const getTextAlignmentBack = (
|
|
|
54
54
|
|
|
55
55
|
export const getTextDecorationBack = (
|
|
56
56
|
textDecoration: string
|
|
57
|
-
): 'solid' | 'dotted' | 'dashed' | 'wavy' | 'NONE' => {
|
|
57
|
+
): 'solid' | 'dotted' | 'dashed' | 'wavy' | 'NONE' => {
|
|
58
58
|
switch (textDecoration.toLowerCase()) {
|
|
59
59
|
case 'solid':
|
|
60
60
|
return 'solid';
|
|
@@ -74,6 +74,40 @@ export const getTextDecorationBack = (
|
|
|
74
74
|
export function convertStyleToFrontend(
|
|
75
75
|
backendStyle: BackendStyle
|
|
76
76
|
): React.CSSProperties {
|
|
77
|
+
|
|
78
|
+
const { border } = backendStyle;
|
|
79
|
+
|
|
80
|
+
let borderTop = '';
|
|
81
|
+
let borderRight = '';
|
|
82
|
+
let borderBottom = '';
|
|
83
|
+
let borderLeft = '';
|
|
84
|
+
|
|
85
|
+
if (border.top !== 'NONE') {
|
|
86
|
+
borderTop =
|
|
87
|
+
border.top === 'THIN'
|
|
88
|
+
? '2px solid var(--input-hover-border-color)'
|
|
89
|
+
: '1px solid var(--excel-sheet-border)';
|
|
90
|
+
}
|
|
91
|
+
if (border.right !== 'NONE') {
|
|
92
|
+
borderRight =
|
|
93
|
+
border.right === 'THIN'
|
|
94
|
+
? '2px solid var(--input-hover-border-color)'
|
|
95
|
+
: '1px solid var(--excel-sheet-border)';
|
|
96
|
+
}
|
|
97
|
+
if (border.bottom !== 'NONE') {
|
|
98
|
+
borderBottom =
|
|
99
|
+
border.bottom === 'THIN'
|
|
100
|
+
? '2px solid var(--input-hover-border-color)'
|
|
101
|
+
: '1px solid var(--excel-sheet-border)';
|
|
102
|
+
}
|
|
103
|
+
if (border.left !== 'NONE') {
|
|
104
|
+
borderLeft =
|
|
105
|
+
border.left === 'THIN'
|
|
106
|
+
? '2px solid var(--input-hover-border-color)'
|
|
107
|
+
: '1px solid var(--excel-sheet-border)';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Return the converted styles
|
|
77
111
|
return {
|
|
78
112
|
fontSize: `${backendStyle.size}px`,
|
|
79
113
|
fontFamily: backendStyle.name,
|
|
@@ -81,24 +115,13 @@ export function convertStyleToFrontend(
|
|
|
81
115
|
backgroundColor: `#${backendStyle.backgroundColor}`,
|
|
82
116
|
fontWeight: backendStyle.bold ? 'bold' : 'normal',
|
|
83
117
|
fontStyle: backendStyle.italic ? 'italic' : 'normal',
|
|
84
|
-
textDecoration: backendStyle.underline
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
backendStyle.border.right === 'NONE'
|
|
92
|
-
? 'none'
|
|
93
|
-
: `1px solid ${backendStyle.borderColor}`,
|
|
94
|
-
borderBottom:
|
|
95
|
-
backendStyle.border.bottom === 'NONE'
|
|
96
|
-
? 'none'
|
|
97
|
-
: `1px solid ${backendStyle.borderColor}`,
|
|
98
|
-
borderLeft:
|
|
99
|
-
backendStyle.border.left === 'NONE'
|
|
100
|
-
? 'none'
|
|
101
|
-
: `1px solid ${backendStyle.borderColor}`,
|
|
118
|
+
textDecoration: backendStyle.underline
|
|
119
|
+
? `underline ${getTextDecoration(backendStyle.underline)}`
|
|
120
|
+
: 'none',
|
|
121
|
+
borderTop: borderTop,
|
|
122
|
+
borderRight: borderRight,
|
|
123
|
+
borderBottom: borderBottom,
|
|
124
|
+
borderLeft: borderLeft,
|
|
102
125
|
textAlign: getTextAlignment(backendStyle.alignment.horizontal),
|
|
103
126
|
};
|
|
104
127
|
}
|
|
@@ -133,7 +156,7 @@ export const convertStyleToBackend = (
|
|
|
133
156
|
size: parseInt(frontendStyle.fontSize?.toString() || '11', 10),
|
|
134
157
|
bold: frontendStyle.fontWeight === 'bold',
|
|
135
158
|
italic: frontendStyle.fontStyle === 'italic',
|
|
136
|
-
underline:
|
|
159
|
+
underline: 'solid',
|
|
137
160
|
color: frontendStyle.color?.replace('#', '') || '000000',
|
|
138
161
|
backgroundColor:
|
|
139
162
|
frontendStyle.backgroundColor?.replace('#', '') || 'FFFFFF',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import FieldSet from './FieldSet';
|
|
4
|
+
import Typography from '../Typography';
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof FieldSet> = {
|
|
6
7
|
title: 'Components/FieldSet',
|
|
@@ -17,7 +18,7 @@ const defaultArgs = {
|
|
|
17
18
|
legendName: 'Default Legend',
|
|
18
19
|
height: '200px',
|
|
19
20
|
width: '300px',
|
|
20
|
-
children: 'Default content inside the FieldSet.'
|
|
21
|
+
children: <Typography>'Default content inside the FieldSet.'</Typography>,
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
export const Default: Story = {
|