pixel-react 1.2.6 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.yarn/install-state.gz +0 -0
- package/lib/components/Drawer/Types.d.ts +29 -17
- package/lib/components/{ExcelFile → Excel}/ExcelFile/ExcelFile.d.ts +1 -0
- package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.d.ts +39 -10
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.d.ts +4 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.d.ts +40 -0
- package/lib/components/{ExcelFile → Excel}/ExcelToolBar/ExcelToolBar.d.ts +7 -3
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +4 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
- package/lib/components/Select/Select.stories.d.ts +1 -0
- package/lib/components/Toastify/Toastify.d.ts +5 -4
- package/lib/components/Toastify/types.d.ts +1 -0
- package/lib/index.d.ts +76 -24
- package/lib/index.esm.js +1467 -1038
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1468 -1038
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/getSequentialPayload/getSequentialPayload.d.ts +2 -0
- package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +10 -0
- package/lib/utils/getSequentialPayload/types.d.ts +30 -0
- package/package.json +3 -3
- package/src/assets/Themes/BaseTheme.scss +4 -0
- package/src/assets/icons/maximize_icon.svg +5 -0
- package/src/assets/styles/_fonts.scss +1 -1
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +15 -6
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +0 -5
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +20 -10
- package/src/components/Drawer/Drawer.scss +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +8 -9
- package/src/components/Drawer/Drawer.tsx +8 -5
- package/src/components/Drawer/Types.ts +27 -14
- package/src/components/Excel/ExcelFile/ExcelFile.scss +62 -0
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +312 -0
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ActiveCell.tsx +2 -2
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Cell.tsx +3 -3
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ColumnIndicator.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/CornerIndicator.tsx +2 -2
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataEditor.tsx +1 -1
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataViewer.tsx +3 -3
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/FloatingRect.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/RowIndicator.tsx +4 -4
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.scss +26 -24
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.tsx +13 -45
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.tsx +1 -1
- package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.ts +88 -20
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +495 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +758 -0
- package/src/components/{ExcelFile → Excel}/ExcelFile.stories.tsx +45 -0
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.scss +36 -0
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +346 -0
- package/src/components/Form/Form.scss +54 -35
- package/src/components/Form/Form.stories.tsx +264 -225
- package/src/components/Form/Forms.tsx +5 -1
- package/src/components/Icon/iconList.ts +2 -1
- package/src/components/Input/Input.tsx +0 -1
- package/src/components/MenuOption/MenuOption.scss +0 -1
- package/src/components/MenuOption/MenuOption.stories.tsx +3 -0
- package/src/components/MenuOption/MenuOption.tsx +5 -4
- package/src/components/MenuOption/types.ts +4 -0
- package/src/components/ModulesChip/ModuleChip.scss +2 -2
- package/src/components/ModulesChip/ModuleChip.tsx +4 -4
- package/src/components/MultiSelect/Dropdown.tsx +5 -2
- package/src/components/MultiSelect/MultiSelect.scss +16 -11
- package/src/components/MultiSelect/MultiSelect.stories.tsx +17 -13
- package/src/components/MultiSelect/MultiSelect.tsx +49 -26
- package/src/components/MultiSelect/MultiSelectTypes.ts +2 -1
- package/src/components/Select/Select.stories.tsx +161 -18
- package/src/components/Select/Select.tsx +41 -33
- package/src/components/Table/Table.scss +6 -5
- package/src/components/Table/Table.stories.tsx +0 -9
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/TableTree/TableTree.scss +1 -1
- package/src/components/TableTree/TableTree.tsx +3 -1
- package/src/components/Toastify/Toastify.stories.tsx +29 -10
- package/src/components/Toastify/Toastify.tsx +42 -16
- package/src/components/Toastify/types.ts +2 -0
- package/src/components/Tooltip/Tooltip.scss +1 -1
- package/src/index.ts +4 -2
- package/src/utils/getSequentialPayload/getSequentialPayload.stories.tsx +75 -0
- package/src/utils/getSequentialPayload/getSequentialPayload.ts +29 -0
- package/src/utils/getSequentialPayload/types.ts +35 -0
- package/lib/components/AddButton/AddButton.d.ts +0 -5
- package/lib/components/AddButton/AddButton.stories.d.ts +0 -6
- package/lib/components/AddButton/index.d.ts +0 -1
- package/lib/components/AddButton/types.d.ts +0 -4
- package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +0 -14
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +0 -27
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -12
- package/lib/components/ExcelFile/ImportExcelStyles.d.ts +0 -24
- package/lib/utils/find/findAndInsert.d.ts +0 -7
- package/lib/utils/find/findAndInsert.stories.d.ts +0 -7
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +0 -952
- package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -24
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +0 -162
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.scss +0 -16
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +0 -68
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -19
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +0 -291
- package/src/fonts/Montserrat/Montserrat-Medium.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Black.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Italic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Light.ttf +0 -0
- package/src/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Thin.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
- /package/lib/components/{ExcelFile → Excel}/ColorBarSelector/ColorBarSelector.d.ts +0 -0
- /package/lib/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ActiveCell.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Cell.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/ColumnIndicator.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/CornerIndicator.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataEditor.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/DataViewer.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/FloatingRect.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/HeaderRow.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/RowIndicator.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Selected.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Spreadsheet.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/areModelsEqual.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/engine.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/formula.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/index.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-graph.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-hash.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-set.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point-range.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/selection.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/types.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-dispatch.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-selector.d.ts +0 -0
- /package/lib/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/util.d.ts +0 -0
- /package/lib/components/{ExcelFile → Excel}/ExcelFile.stories.d.ts +0 -0
- /package/lib/components/{ExcelFile → Excel}/Types.d.ts +0 -0
- /package/lib/components/{ExcelFile → Excel}/index.d.ts +0 -0
- /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.scss +0 -0
- /package/src/components/{ExcelFile/ColorBarselector → Excel/ColorBarSelector}/ColorBarSelector.tsx +0 -0
- /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.scss +0 -0
- /package/src/components/{ExcelFile → Excel}/ContextMenu/ContextMenu.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Copied.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/HeaderRow.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Row.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Selected.tsx +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/areModelsEqual.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/context.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/engine.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/formula.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/index.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-graph.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-hash.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/engine/point-set.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/index.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/matrix.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point-range.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/point.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/selection.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/types.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/typings/fast-formula-parser.d.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-dispatch.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/use-selector.ts +0 -0
- /package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/util.ts +0 -0
- /package/src/components/{ExcelFile → Excel}/Types.ts +0 -0
- /package/src/components/{ExcelFile → Excel}/index.ts +0 -0
@@ -5,7 +5,7 @@ import * as Actions from './actions';
|
|
5
5
|
import * as Matrix from './matrix';
|
6
6
|
import * as Point from './point';
|
7
7
|
import { Selection } from './selection';
|
8
|
-
import reducer, { INITIAL_STATE
|
8
|
+
import reducer, { INITIAL_STATE } from './reducer';
|
9
9
|
import context from './context';
|
10
10
|
import { Model, createFormulaParser } from './engine';
|
11
11
|
import {
|
@@ -15,7 +15,6 @@ import {
|
|
15
15
|
calculateSpreadsheetSize,
|
16
16
|
getCSV,
|
17
17
|
shouldHandleClipboardEvent,
|
18
|
-
isFocusedWithin,
|
19
18
|
} from './util';
|
20
19
|
|
21
20
|
import DefaultTable from './Table';
|
@@ -38,6 +37,7 @@ import Selected from './Selected';
|
|
38
37
|
import Copied from './Copied';
|
39
38
|
import './Spreadsheet.scss';
|
40
39
|
import ExcelToolBar from '../../ExcelToolBar/ExcelToolBar';
|
40
|
+
import { hasKeyDownHandler } from './reducerFunctions';
|
41
41
|
|
42
42
|
/** The Spreadsheet component props */
|
43
43
|
export type Props<CellType extends Types.CellBase> = {
|
@@ -121,20 +121,12 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
121
121
|
className,
|
122
122
|
columnLabels,
|
123
123
|
rowLabels,
|
124
|
-
// hideColumnIndicators,
|
125
|
-
// hideRowIndicators,
|
126
124
|
onKeyDown,
|
127
125
|
Table = DefaultTable,
|
128
126
|
Row = DefaultRow,
|
129
127
|
HeaderRow = DefaultHeaderRow,
|
130
128
|
DataEditor = DefaultDataEditor,
|
131
129
|
DataViewer = DefaultDataViewer,
|
132
|
-
// onChange = () => {},
|
133
|
-
// onModeChange = () => {},
|
134
|
-
onSelect = () => {},
|
135
|
-
onActivate = () => {},
|
136
|
-
// onBlur = () => {},
|
137
|
-
// onCellCommit = () => {},
|
138
130
|
onEvaluatedDataChange = () => {},
|
139
131
|
} = props;
|
140
132
|
type State = Types.StoreState<CellType>;
|
@@ -178,7 +170,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
178
170
|
const copy = useAction(Actions.copy);
|
179
171
|
const paste = useAction(Actions.paste);
|
180
172
|
const onKeyDownAction = useAction(Actions.keyDown);
|
181
|
-
const onKeyPress = useAction(Actions.keyPress);
|
182
173
|
const onDragStart = useAction(Actions.dragStart);
|
183
174
|
const onDragEnd = useAction(Actions.dragEnd);
|
184
175
|
const setData = useAction(Actions.setData);
|
@@ -186,27 +177,15 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
186
177
|
const setSelection = useAction(Actions.setSelection);
|
187
178
|
const onBold = useAction(Actions.bold);
|
188
179
|
const onItalic = useAction(Actions.italic);
|
189
|
-
const
|
180
|
+
const setUnderlineType = useAction(Actions.underlineType);
|
181
|
+
const setTextAlign = useAction(Actions.textAlign);
|
182
|
+
const setFontSize = useAction(Actions.fontSize);
|
183
|
+
const setFontFamily = useAction(Actions.fontFamily);
|
184
|
+
const setBorderType = useAction(Actions.borderType);
|
190
185
|
const setColor = useAction(Actions.color);
|
191
186
|
const setBackgroundColor = useAction(Actions.backgroundStyle);
|
192
187
|
const setFormatePainter = useAction(Actions.formatePainter);
|
193
188
|
|
194
|
-
const prevActiveRef = React.useRef<Point.Point | null>(state.active);
|
195
|
-
React.useEffect(() => {
|
196
|
-
if (state.active !== prevActiveRef.current) {
|
197
|
-
if (state.active) {
|
198
|
-
onActivate(state.active);
|
199
|
-
} else {
|
200
|
-
const root = rootRef.current;
|
201
|
-
if (root && isFocusedWithin(root) && document.activeElement) {
|
202
|
-
(document.activeElement as HTMLElement).blur();
|
203
|
-
}
|
204
|
-
}
|
205
|
-
}
|
206
|
-
|
207
|
-
prevActiveRef.current = state.active;
|
208
|
-
}, [onActivate, state.active]);
|
209
|
-
|
210
189
|
const prevEvaluatedDataRef = React.useRef<Matrix.Matrix<CellType>>(
|
211
190
|
state.model.evaluatedData
|
212
191
|
);
|
@@ -218,18 +197,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
218
197
|
prevEvaluatedDataRef.current = state.model.evaluatedData;
|
219
198
|
}, [state?.model?.evaluatedData, onEvaluatedDataChange]);
|
220
199
|
|
221
|
-
const prevSelectedRef = React.useRef<Selection>(state.selected);
|
222
|
-
React.useEffect(() => {
|
223
|
-
if (!state.selected.equals(prevSelectedRef.current)) {
|
224
|
-
// Call on select only if the selection change internal
|
225
|
-
if (!props.selected || !state.selected.equals(props.selected)) {
|
226
|
-
onSelect(state.selected);
|
227
|
-
}
|
228
|
-
}
|
229
|
-
|
230
|
-
prevSelectedRef.current = state.selected;
|
231
|
-
}, [state.selected, onSelect, props.selected]);
|
232
|
-
|
233
200
|
// Update selection when props.selected changes
|
234
201
|
const prevSelectedPropRef = React.useRef<Selection | undefined>(
|
235
202
|
props.selected
|
@@ -256,7 +223,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
256
223
|
prevDataPropRef.current = props.data;
|
257
224
|
}, [props.data, setData]);
|
258
225
|
|
259
|
-
// Update createFormulaParser when props.createFormulaParser changes
|
260
226
|
const prevCreateFormulaParserPropRef = React.useRef<
|
261
227
|
Types.CreateFormulaParser | undefined
|
262
228
|
>(props.createFormulaParser);
|
@@ -466,15 +432,18 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
466
432
|
data={props.data}
|
467
433
|
onBold={onBold}
|
468
434
|
onItalic={onItalic}
|
469
|
-
|
435
|
+
setUnderlineType={setUnderlineType}
|
470
436
|
setColor={setColor}
|
437
|
+
setBorderType={setBorderType}
|
438
|
+
setFontSize={setFontSize}
|
439
|
+
setFontFamily={setFontFamily}
|
440
|
+
setTextAlign={setTextAlign}
|
471
441
|
setBackgroundColor={setBackgroundColor}
|
472
442
|
setFormatePainter={setFormatePainter}
|
473
443
|
/>
|
474
444
|
<div
|
475
445
|
ref={rootRef}
|
476
|
-
className={classNames('
|
477
|
-
onKeyPress={onKeyPress}
|
446
|
+
className={classNames('ff-spreadsheet', className)}
|
478
447
|
onKeyDown={handleKeyDown}
|
479
448
|
onMouseMove={handleMouseMove}
|
480
449
|
>
|
@@ -487,7 +456,6 @@ const Spreadsheet = <CellType extends Types.CellBase>(
|
|
487
456
|
),
|
488
457
|
[
|
489
458
|
className,
|
490
|
-
onKeyPress,
|
491
459
|
handleKeyDown,
|
492
460
|
handleMouseMove,
|
493
461
|
tableNode,
|
package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/Table.tsx
RENAMED
@@ -9,7 +9,7 @@ const Table: Types.TableComponent = ({
|
|
9
9
|
const columnCount = columns + (hideColumnIndicators ? 0 : 1);
|
10
10
|
const columnNodes = range(columnCount).map((i) => <col key={i} />);
|
11
11
|
return (
|
12
|
-
<table className="
|
12
|
+
<table className="ff-spreadsheet-table">
|
13
13
|
<colgroup>{columnNodes}</colgroup>
|
14
14
|
<tbody>{children}</tbody>
|
15
15
|
</table>
|
package/src/components/{ExcelFile/ExcelFile/Excel → Excel/ExcelFile/ExcelFileComponents}/actions.ts
RENAMED
@@ -32,7 +32,11 @@ export const DRAG_END = 'DRAG_END';
|
|
32
32
|
export const COMMIT = 'COMMIT';
|
33
33
|
export const BOLD = 'BOLD';
|
34
34
|
export const ITALIC = 'ITALIC';
|
35
|
-
export const
|
35
|
+
export const UNDERLINE_TYPE = 'UNDERLINE_TYPE';
|
36
|
+
export const FONT_FAMILY = 'FONT_FAMILY';
|
37
|
+
export const FONT_SIZE = 'FONT_SIZE';
|
38
|
+
export const TEXT_ALIGN = 'TEXT_ALIGN';
|
39
|
+
export const BORDER_TYPE = 'BORDER_TYPE';
|
36
40
|
export const COLOR = 'COLOR';
|
37
41
|
export const BACKGROUND_COLOR = 'BACKGROUND_COLOR';
|
38
42
|
export const FORMATE_PAINTER = 'FORMATE_PAINTER';
|
@@ -53,6 +57,7 @@ export function bold(data: Matrix<CellBase>): BoldStyle {
|
|
53
57
|
payload: { data },
|
54
58
|
};
|
55
59
|
}
|
60
|
+
|
56
61
|
export type ItalicStyle = BaseAction<typeof ITALIC> & {
|
57
62
|
payload: {
|
58
63
|
data: Matrix<CellBase>;
|
@@ -65,18 +70,90 @@ export function italic(data: Matrix<CellBase>): ItalicStyle {
|
|
65
70
|
payload: { data },
|
66
71
|
};
|
67
72
|
}
|
68
|
-
|
73
|
+
|
74
|
+
export type BorderType = BaseAction<typeof BORDER_TYPE> & {
|
69
75
|
payload: {
|
70
76
|
data: Matrix<CellBase>;
|
77
|
+
value: string;
|
78
|
+
color: string;
|
71
79
|
};
|
72
80
|
};
|
73
81
|
|
74
|
-
export function
|
82
|
+
export function borderType(
|
83
|
+
data: Matrix<CellBase>,
|
84
|
+
value: string,
|
85
|
+
color: string
|
86
|
+
): BorderType {
|
75
87
|
return {
|
76
|
-
type:
|
77
|
-
payload: { data },
|
88
|
+
type: BORDER_TYPE,
|
89
|
+
payload: { data, value, color },
|
90
|
+
};
|
91
|
+
}
|
92
|
+
|
93
|
+
export type UnderlineTypeStyle = BaseAction<typeof UNDERLINE_TYPE> & {
|
94
|
+
payload: {
|
95
|
+
data: Matrix<CellBase>;
|
96
|
+
value: string;
|
97
|
+
active: boolean;
|
98
|
+
};
|
99
|
+
};
|
100
|
+
|
101
|
+
export function underlineType(
|
102
|
+
data: Matrix<CellBase>,
|
103
|
+
value: string,
|
104
|
+
active: boolean
|
105
|
+
): UnderlineTypeStyle {
|
106
|
+
return {
|
107
|
+
type: UNDERLINE_TYPE,
|
108
|
+
payload: { data, value, active },
|
78
109
|
};
|
79
110
|
}
|
111
|
+
|
112
|
+
export type FontSize = BaseAction<typeof FONT_SIZE> & {
|
113
|
+
payload: {
|
114
|
+
data: Matrix<CellBase>;
|
115
|
+
value: string;
|
116
|
+
};
|
117
|
+
};
|
118
|
+
|
119
|
+
export function fontSize(data: Matrix<CellBase>, value: string): FontSize {
|
120
|
+
return {
|
121
|
+
type: FONT_SIZE,
|
122
|
+
payload: { data, value },
|
123
|
+
};
|
124
|
+
}
|
125
|
+
|
126
|
+
export type FontFamily = BaseAction<typeof FONT_FAMILY> & {
|
127
|
+
payload: {
|
128
|
+
data: Matrix<CellBase>;
|
129
|
+
value: string;
|
130
|
+
};
|
131
|
+
};
|
132
|
+
|
133
|
+
export function fontFamily(data: Matrix<CellBase>, value: string): FontFamily {
|
134
|
+
return {
|
135
|
+
type: FONT_FAMILY,
|
136
|
+
payload: { data, value },
|
137
|
+
};
|
138
|
+
}
|
139
|
+
|
140
|
+
export type TextAlignType = BaseAction<typeof TEXT_ALIGN> & {
|
141
|
+
payload: {
|
142
|
+
data: Matrix<CellBase>;
|
143
|
+
value: string;
|
144
|
+
};
|
145
|
+
};
|
146
|
+
|
147
|
+
export function textAlign(
|
148
|
+
data: Matrix<CellBase>,
|
149
|
+
value: string
|
150
|
+
): TextAlignType {
|
151
|
+
return {
|
152
|
+
type: TEXT_ALIGN,
|
153
|
+
payload: { data, value },
|
154
|
+
};
|
155
|
+
}
|
156
|
+
|
80
157
|
export type ColorStyle = BaseAction<typeof COLOR> & {
|
81
158
|
payload: {
|
82
159
|
data: Matrix<CellBase>;
|
@@ -90,6 +167,7 @@ export function color(data: Matrix<CellBase>, value: string): ColorStyle {
|
|
90
167
|
payload: { data, value },
|
91
168
|
};
|
92
169
|
}
|
170
|
+
|
93
171
|
export type BackgroundStyle = BaseAction<typeof BACKGROUND_COLOR> & {
|
94
172
|
payload: {
|
95
173
|
data: Matrix<CellBase>;
|
@@ -274,19 +352,6 @@ export function paste(data: string): PasteAction {
|
|
274
352
|
};
|
275
353
|
}
|
276
354
|
|
277
|
-
export type KeyPressAction = BaseAction<typeof KEY_PRESS> & {
|
278
|
-
payload: {
|
279
|
-
event: React.KeyboardEvent;
|
280
|
-
};
|
281
|
-
};
|
282
|
-
|
283
|
-
export function keyPress(event: React.KeyboardEvent): KeyPressAction {
|
284
|
-
return {
|
285
|
-
type: KEY_PRESS,
|
286
|
-
payload: { event },
|
287
|
-
};
|
288
|
-
}
|
289
|
-
|
290
355
|
export type KeyDownAction = BaseAction<typeof KEY_DOWN> & {
|
291
356
|
payload: {
|
292
357
|
event: React.KeyboardEvent;
|
@@ -373,7 +438,6 @@ export type Action =
|
|
373
438
|
| SetCellDataAction
|
374
439
|
| SetCellDimensionsAction
|
375
440
|
| PasteAction
|
376
|
-
| KeyPressAction
|
377
441
|
| KeyDownAction
|
378
442
|
| DragStartAction
|
379
443
|
| DragEndAction
|
@@ -383,7 +447,11 @@ export type Action =
|
|
383
447
|
| EditAction
|
384
448
|
| ViewAction
|
385
449
|
| ClearAction
|
386
|
-
|
|
450
|
+
| UnderlineTypeStyle
|
451
|
+
| FontSize
|
452
|
+
| FontFamily
|
453
|
+
| TextAlignType
|
454
|
+
| BorderType
|
387
455
|
| ItalicStyle
|
388
456
|
| BoldStyle
|
389
457
|
| ColorStyle
|