pixel-react 1.4.3 → 1.4.4
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/components/AddResourceButton/type.d.ts +1 -1
- package/lib/components/Drawer/Types.d.ts +4 -0
- package/lib/components/Excel/ExcelContextMenu/ExcelContextMenu.d.ts +13 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +0 -13
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +29 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.d.ts +3 -9
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.d.ts +2 -10
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.d.ts +0 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +27 -2
- package/lib/components/Form/Forms.d.ts +4 -2
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +49 -15
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +4 -5
- package/lib/components/MultiSelect/dropdownTypes.d.ts +2 -0
- package/lib/components/RadioButton/RadioButton.d.ts +1 -0
- package/lib/components/RadioButton/radioButtonTypes.d.ts +3 -1
- package/lib/components/Select/components/types.d.ts +4 -2
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +10 -0
- package/lib/components/ToggleSwitch/index.d.ts +1 -0
- package/lib/index.d.ts +109 -23
- package/lib/index.esm.js +5711 -635
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5707 -629
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
- package/src/assets/Themes/BaseTheme.scss +17 -23
- package/src/assets/Themes/DarkTheme.scss +25 -38
- package/src/assets/icons/apk_file_type.svg +4 -0
- package/src/assets/icons/compressed_file_type.svg +4 -0
- package/src/assets/icons/csv_file_type.svg +4 -0
- package/src/assets/icons/excel_corner_menu.svg +3 -0
- package/src/assets/icons/formula_icon.svg +3 -0
- package/src/assets/icons/gif_file_type.svg +4 -0
- package/src/assets/icons/html_file_type.svg +4 -0
- package/src/assets/icons/ipk_file_type.svg +4 -0
- package/src/assets/icons/jpg_file_type.svg +4 -0
- package/src/assets/icons/json_file_type.svg +4 -0
- package/src/assets/icons/pdf_file_type.svg +4 -0
- package/src/assets/icons/png_file_type.svg +4 -0
- package/src/assets/icons/quick_run_setting_icon.svg +5 -0
- package/src/assets/icons/run_automation_scripts_icon.svg +33 -0
- package/src/assets/icons/run_manual_testcase_icon.svg +4 -0
- package/src/assets/icons/search.svg +2 -2
- package/src/assets/icons/txt_file_type.svg +4 -0
- package/src/assets/icons/xls_file_type.svg +4 -0
- package/src/assets/icons/xlsx_file_type.svg +4 -0
- package/src/assets/icons/xml_file_type.svg +4 -0
- package/src/components/AddResourceButton/AddButton.tsx +7 -7
- package/src/components/AddResourceButton/type.ts +1 -1
- package/src/components/AttachmentButton/AttachmentButton.scss +1 -1
- package/src/components/AttachmentButton/AttachmentButton.stories.tsx +1 -0
- package/src/components/Button/Button.scss +22 -20
- package/src/components/Button/Button.tsx +8 -1
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +2 -2
- package/src/components/Drawer/Drawer.scss +4 -3
- package/src/components/Drawer/Drawer.tsx +14 -18
- package/src/components/Drawer/Types.ts +4 -0
- package/src/components/Editor/Editor.tsx +9 -11
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.scss +39 -0
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +51 -0
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +7 -8
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +35 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +44 -7
- package/src/components/Excel/ExcelFile/ExcelFileComponents/CornerIndicator.tsx +8 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.tsx +45 -6
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +37 -2
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +69 -24
- package/src/components/Excel/ExcelFile/ExcelFileComponents/actions.ts +59 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/engine.ts +18 -65
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/formula.ts +5 -110
- package/src/components/Excel/ExcelFile/ExcelFileComponents/engine/point-graph.ts +0 -2
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +105 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +670 -673
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +38 -2
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +0 -4
- package/src/components/FileDropzone/FileDropzone.scss +4 -2
- package/src/components/FileDropzone/FileDropzone.tsx +1 -1
- package/src/components/FileDropzone/FilePreview.tsx +3 -1
- package/src/components/Form/Form.scss +2 -0
- package/src/components/Form/Form.stories.tsx +195 -6
- package/src/components/Form/Forms.tsx +15 -8
- package/src/components/Icon/iconList.ts +46 -0
- package/src/components/IconRadioGroup/IconRadioGroup.scss +3 -0
- package/src/components/IconRadioGroup/IconRadioGroup.tsx +20 -17
- package/src/components/Input/Input.scss +14 -15
- package/src/components/Input/Input.stories.tsx +2 -1
- package/src/components/InputWithDropdown/InputWithDropdown.scss +12 -13
- package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +3 -2
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +22 -19
- package/src/components/MenuOption/MenuOption.scss +11 -10
- package/src/components/MenuOption/MenuOption.stories.tsx +51 -232
- package/src/components/MenuOption/MenuOption.tsx +131 -52
- package/src/components/MenuOption/types.ts +55 -14
- package/src/components/MiniModal/MiniModal.stories.tsx +2 -3
- package/src/components/MultiSelect/Dropdown.tsx +11 -12
- package/src/components/MultiSelect/MultiSelect.scss +1 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +45 -10
- package/src/components/MultiSelect/MultiSelect.tsx +29 -13
- package/src/components/MultiSelect/MultiSelectTypes.ts +7 -5
- package/src/components/MultiSelect/dropdownTypes.ts +2 -0
- package/src/components/RadioButton/RadioButton.scss +3 -1
- package/src/components/RadioButton/RadioButton.tsx +3 -1
- package/src/components/RadioButton/radioButtonTypes.tsx +5 -1
- package/src/components/Search/Search.scss +25 -6
- package/src/components/Search/Search.tsx +45 -24
- package/src/components/Select/Select.scss +12 -12
- package/src/components/Select/Select.stories.tsx +2 -0
- package/src/components/Select/Select.tsx +11 -5
- package/src/components/Select/components/Dropdown.scss +2 -0
- package/src/components/Select/components/Dropdown.tsx +19 -4
- package/src/components/Select/components/types.ts +4 -2
- package/src/components/StatusButton/StatusButton.tsx +26 -20
- package/src/components/Table/Table.scss +1 -3
- package/src/components/Table/Table.stories.tsx +1 -0
- package/src/components/Table/Table.tsx +7 -3
- package/src/components/ToggleSwitch/ToggleSwitch.scss +59 -0
- package/src/components/ToggleSwitch/ToggleSwitch.stories.tsx +52 -0
- package/src/components/ToggleSwitch/ToggleSwitch.tsx +30 -0
- package/src/components/ToggleSwitch/index.ts +1 -0
- package/src/hooks/useFileDropzone.tsx +1 -0
- package/src/index.ts +4 -2
- package/src/components/Excel/ContextMenu/ContextMenu.scss +0 -99
- package/src/components/Excel/ContextMenu/ContextMenu.tsx +0 -103
@@ -1,15 +1,5 @@
|
|
1
|
-
import FormulaParser, {
|
2
|
-
CellRef,
|
3
|
-
DepParser,
|
4
|
-
FormulaError,
|
5
|
-
FormulaParserConfig,
|
6
|
-
Value,
|
7
|
-
} from 'fast-formula-parser';
|
8
|
-
import { PointRange } from '../point-range';
|
9
|
-
import { Point } from '../point';
|
10
1
|
import * as Matrix from '../matrix';
|
11
2
|
import { CellBase } from '../types';
|
12
|
-
import { PointSet } from './point-set';
|
13
3
|
|
14
4
|
export const FORMULA_VALUE_PREFIX = '=';
|
15
5
|
|
@@ -29,109 +19,14 @@ export function extractFormula(value: string): string {
|
|
29
19
|
|
30
20
|
export function createFormulaParser(
|
31
21
|
data: Matrix.Matrix<CellBase>,
|
32
|
-
|
33
|
-
|
34
|
-
return new FormulaParser({
|
35
|
-
...config,
|
36
|
-
onCell: (ref) => {
|
37
|
-
const point: Point = {
|
38
|
-
row: ref.row - 1,
|
39
|
-
column: ref.col - 1,
|
40
|
-
};
|
41
|
-
const cell = Matrix.get(point, data);
|
42
|
-
if (!isNaN(cell?.value as number)) return Number(cell?.value);
|
43
|
-
return cell?.value;
|
44
|
-
},
|
45
|
-
onRange: (ref) => {
|
46
|
-
const size = Matrix.getSize(data);
|
47
|
-
const start: Point = {
|
48
|
-
row: ref.from.row - 1,
|
49
|
-
column: ref.from.col - 1,
|
50
|
-
};
|
51
|
-
const end: Point = {
|
52
|
-
row: Math.min(ref.to.row - 1, size.rows - 1),
|
53
|
-
column: Math.min(ref.to.col - 1, size.columns - 1),
|
54
|
-
};
|
55
|
-
const dataSlice = Matrix.slice(start, end, data);
|
56
|
-
return Matrix.toArray(dataSlice, (cell) => {
|
57
|
-
if (!isNaN(cell?.value as number)) return Number(cell?.value);
|
58
|
-
return cell?.value;
|
59
|
-
});
|
60
|
-
},
|
61
|
-
});
|
22
|
+
) {
|
23
|
+
return data
|
62
24
|
}
|
63
25
|
|
64
|
-
|
65
|
-
|
66
|
-
/**
|
67
|
-
* For given formula returns the cell references
|
68
|
-
* @param formula - formula to get references for
|
69
|
-
*/
|
70
|
-
export function getReferences(
|
71
|
-
formula: string,
|
72
|
-
point: Point,
|
73
|
-
data: Matrix.Matrix<CellBase>
|
74
|
-
): PointSet {
|
75
|
-
const { rows, columns } = Matrix.getSize(data);
|
26
|
+
export function evaluate() {
|
76
27
|
try {
|
77
|
-
|
78
|
-
|
79
|
-
const references = PointSet.from(
|
80
|
-
dependencies.flatMap((reference) => {
|
81
|
-
const isRange = 'from' in reference;
|
82
|
-
if (isRange) {
|
83
|
-
const { from, to } = reference;
|
84
|
-
|
85
|
-
const normalizedFrom: Point = {
|
86
|
-
row: from.row - 1,
|
87
|
-
column: from.col - 1,
|
88
|
-
};
|
89
|
-
|
90
|
-
const normalizedTo: Point = {
|
91
|
-
row: Math.min(to.row - 1, rows - 1),
|
92
|
-
column: Math.min(to.col - 1, columns - 1),
|
93
|
-
};
|
94
|
-
|
95
|
-
const range = new PointRange(normalizedFrom, normalizedTo);
|
96
|
-
|
97
|
-
return Array.from(range);
|
98
|
-
}
|
99
|
-
return { row: reference.row - 1, column: reference.col - 1 };
|
100
|
-
})
|
101
|
-
);
|
102
|
-
|
103
|
-
return references;
|
28
|
+
return "";
|
104
29
|
} catch (error) {
|
105
|
-
if (error instanceof FormulaError) {
|
106
|
-
return PointSet.from([]);
|
107
|
-
} else {
|
108
|
-
throw error;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
export function evaluate(
|
114
|
-
formula: string,
|
115
|
-
point: Point,
|
116
|
-
formulaParser: FormulaParser
|
117
|
-
): Value {
|
118
|
-
try {
|
119
|
-
const position = convertPointToCellRef(point);
|
120
|
-
const returned = formulaParser.parse(formula, position);
|
121
|
-
return returned instanceof FormulaError ? returned.toString() : returned;
|
122
|
-
} catch (error) {
|
123
|
-
if (error instanceof FormulaError) {
|
124
|
-
return error.toString();
|
125
|
-
}
|
126
30
|
throw error;
|
127
31
|
}
|
128
|
-
}
|
129
|
-
|
130
|
-
function convertPointToCellRef(point: Point): CellRef {
|
131
|
-
return {
|
132
|
-
row: point.row + 1,
|
133
|
-
col: point.column + 1,
|
134
|
-
// TODO: fill once we support multiple sheets
|
135
|
-
sheet: 'Sheet1',
|
136
|
-
};
|
137
|
-
}
|
32
|
+
}
|
@@ -58,7 +58,6 @@ export class PointGraph {
|
|
58
58
|
return result;
|
59
59
|
}
|
60
60
|
|
61
|
-
/** Determine whether the graph has a circular dependency, starting from given start point */
|
62
61
|
hasCircularDependency(startPoint: Point): boolean {
|
63
62
|
let visited = PointSet.from([]);
|
64
63
|
const stack: Point[] = [startPoint];
|
@@ -96,7 +95,6 @@ export class PointGraph {
|
|
96
95
|
visitedHashes.add(key);
|
97
96
|
yield [point, values];
|
98
97
|
|
99
|
-
// Make sure to include values that are not included in the forwards map keys
|
100
98
|
for (const value of values) {
|
101
99
|
const hash = pointHash.toString(value);
|
102
100
|
if (!visitedHashes.has(hash) && !this.forwards.has(hash)) {
|
@@ -30,6 +30,7 @@ import {
|
|
30
30
|
isActiveReadOnly,
|
31
31
|
view,
|
32
32
|
} from './reducerFunctions';
|
33
|
+
import { checkEmpty } from '../../../../utils/checkEmpty/checkEmpty';
|
33
34
|
|
34
35
|
export const INITIAL_STATE: Types.StoreState = {
|
35
36
|
active: null,
|
@@ -44,6 +45,8 @@ export const INITIAL_STATE: Types.StoreState = {
|
|
44
45
|
selected: new EmptySelection(),
|
45
46
|
copied: null,
|
46
47
|
lastCommit: null,
|
48
|
+
selectedColumn: null,
|
49
|
+
selectedRow: null,
|
47
50
|
};
|
48
51
|
|
49
52
|
export default function reducer(
|
@@ -51,6 +54,104 @@ export default function reducer(
|
|
51
54
|
action: Actions.Action
|
52
55
|
): Types.StoreState {
|
53
56
|
switch (action.type) {
|
57
|
+
case Actions.ADD_ROW_TOP: {
|
58
|
+
let { selectedRow, selectedColumn, model } = state;
|
59
|
+
if (checkEmpty(selectedRow)) {
|
60
|
+
return state;
|
61
|
+
}
|
62
|
+
selectedRow = selectedRow as number;
|
63
|
+
let updatedData = [...model.data];
|
64
|
+
const newRow = Array(updatedData[0]?.length || 0).fill({
|
65
|
+
value: undefined,
|
66
|
+
});
|
67
|
+
updatedData.splice(selectedRow, 0, newRow);
|
68
|
+
const updatedModel = new Model(model.createFormulaParser, updatedData);
|
69
|
+
|
70
|
+
return {
|
71
|
+
...state,
|
72
|
+
model: updatedModel,
|
73
|
+
selectedRow: selectedRow,
|
74
|
+
selectedColumn: selectedColumn,
|
75
|
+
};
|
76
|
+
}
|
77
|
+
|
78
|
+
case Actions.ADD_COLUMN_LEFT: {
|
79
|
+
let { selectedRow, selectedColumn, model } = state;
|
80
|
+
if (checkEmpty(selectedColumn)) {
|
81
|
+
return state;
|
82
|
+
}
|
83
|
+
selectedColumn = selectedColumn as number;
|
84
|
+
let updatedData = [...model.data];
|
85
|
+
updatedData = updatedData.map((row) => {
|
86
|
+
const newCell = { value: undefined };
|
87
|
+
return [
|
88
|
+
...row.slice(0, selectedColumn),
|
89
|
+
newCell,
|
90
|
+
...row.slice(selectedColumn),
|
91
|
+
];
|
92
|
+
});
|
93
|
+
|
94
|
+
const updatedModel = new Model(model.createFormulaParser, updatedData);
|
95
|
+
|
96
|
+
return {
|
97
|
+
...state,
|
98
|
+
model: updatedModel,
|
99
|
+
selectedRow: selectedRow,
|
100
|
+
selectedColumn: selectedColumn - 1,
|
101
|
+
};
|
102
|
+
}
|
103
|
+
|
104
|
+
case Actions.DELETE_ROW: {
|
105
|
+
let { selectedRow, selectedColumn, model } = state;
|
106
|
+
if (checkEmpty(selectedRow)) {
|
107
|
+
return state;
|
108
|
+
}
|
109
|
+
selectedRow = selectedRow as number;
|
110
|
+
let updatedData = [...model.data];
|
111
|
+
|
112
|
+
updatedData.splice(selectedRow, 1);
|
113
|
+
|
114
|
+
const updatedModel = new Model(model.createFormulaParser, updatedData);
|
115
|
+
|
116
|
+
let newSelectedRow = selectedRow > 0 ? selectedRow - 1 : 0;
|
117
|
+
let newSelectedColumn = !checkEmpty(selectedColumn) ? selectedColumn : 0;
|
118
|
+
|
119
|
+
return {
|
120
|
+
...state,
|
121
|
+
model: updatedModel,
|
122
|
+
selectedRow: newSelectedRow,
|
123
|
+
selectedColumn: newSelectedColumn,
|
124
|
+
};
|
125
|
+
}
|
126
|
+
|
127
|
+
case Actions.DELETE_COLUMN: {
|
128
|
+
let { selectedRow, selectedColumn, model } = state;
|
129
|
+
|
130
|
+
if (checkEmpty(selectedColumn)) {
|
131
|
+
return state;
|
132
|
+
}
|
133
|
+
selectedColumn = selectedColumn as number;
|
134
|
+
|
135
|
+
let updatedData = [...model.data];
|
136
|
+
|
137
|
+
updatedData = updatedData.map((row) => {
|
138
|
+
row.splice(selectedColumn, 1);
|
139
|
+
return row;
|
140
|
+
});
|
141
|
+
|
142
|
+
const updatedModel = new Model(model.createFormulaParser, updatedData);
|
143
|
+
|
144
|
+
let newSelectedRow = !checkEmpty(selectedRow) ? selectedRow : 0;
|
145
|
+
let newSelectedColumn = selectedColumn > 0 ? selectedColumn - 1 : 0;
|
146
|
+
|
147
|
+
return {
|
148
|
+
...state,
|
149
|
+
model: updatedModel,
|
150
|
+
selectedRow: newSelectedRow,
|
151
|
+
selectedColumn: newSelectedColumn,
|
152
|
+
};
|
153
|
+
}
|
154
|
+
|
54
155
|
case Actions.BOLD: {
|
55
156
|
const selectedRange = state.selected.toRange(state.model.data);
|
56
157
|
const updatedData = applyBoldToCells(
|
@@ -215,13 +316,14 @@ export default function reducer(
|
|
215
316
|
: new EntireRowsSelection(row, row),
|
216
317
|
active: extend && active ? active : { ...Point.ORIGIN, row },
|
217
318
|
mode: 'view',
|
319
|
+
selectedColumn: null,
|
320
|
+
selectedRow: row,
|
218
321
|
};
|
219
322
|
}
|
220
323
|
|
221
324
|
case Actions.SELECT_ENTIRE_COLUMN: {
|
222
325
|
const { column, extend } = action.payload;
|
223
326
|
const { active } = state;
|
224
|
-
|
225
327
|
return {
|
226
328
|
...state,
|
227
329
|
selected:
|
@@ -230,6 +332,8 @@ export default function reducer(
|
|
230
332
|
: new EntireColumnsSelection(column, column),
|
231
333
|
active: extend && active ? active : { ...Point.ORIGIN, column },
|
232
334
|
mode: 'view',
|
335
|
+
selectedColumn: column,
|
336
|
+
selectedRow: null,
|
233
337
|
};
|
234
338
|
}
|
235
339
|
|