pixel-react 1.1.7 → 1.1.9
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/AttachmentButton/AttachmentButton.d.ts +5 -0
- package/lib/components/AttachmentButton/AttachmentButton.stories.d.ts +9 -0
- package/lib/components/AttachmentButton/index.d.ts +1 -0
- package/lib/components/AttachmentButton/types.d.ts +8 -0
- package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +14 -0
- package/lib/components/ExcelFile/ColorBarSelector/ColorBarSelector.d.ts +8 -0
- package/lib/components/ExcelFile/ContextMenu/ContextMenu.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +7 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Cell.d.ts +4 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +10 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +5 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +81 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +130 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/areModelsEqual.d.ts +1 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +8 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +17 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +21 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +24 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +13 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +67 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +22 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/point.d.ts +11 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +27 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +95 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +215 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +45 -0
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +3 -0
- package/lib/components/ExcelFile/ExcelFile.stories.d.ts +6 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +15 -0
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +3 -0
- package/lib/components/ExcelFile/ImportExcelStyles.d.ts +24 -0
- package/lib/components/ExcelFile/Types.d.ts +176 -0
- package/lib/components/ExcelFile/index.d.ts +1 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.d.ts +5 -0
- package/lib/components/IconRadioGroup/IconRadioGroup.stories.d.ts +7 -0
- package/lib/components/IconRadioGroup/index.d.ts +1 -0
- package/lib/components/IconRadioGroup/type.d.ts +41 -0
- package/lib/components/RadioButton/radioButtonTypes.d.ts +15 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +2 -1
- package/lib/components/RadioGroup/radioGroupTypes.d.ts +15 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/types.d.ts +4 -0
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/Table/Types.d.ts +8 -0
- package/lib/components/TableTree/TableTree.d.ts +1 -0
- package/lib/index.d.ts +71 -3
- package/lib/index.esm.js +408 -151
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +409 -150
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/assets/Themes/BaseTheme.scss +11 -0
- package/src/assets/Themes/DarkTheme.scss +10 -0
- package/src/assets/icons/add_file.svg +14 -0
- package/src/assets/icons/all_borders.svg +3 -0
- package/src/assets/icons/bold.svg +3 -0
- package/src/assets/icons/border_bottom.svg +3 -0
- package/src/assets/icons/border_left.svg +3 -0
- package/src/assets/icons/border_right.svg +3 -0
- package/src/assets/icons/border_top.svg +3 -0
- package/src/assets/icons/clone_icon.svg +3 -0
- package/src/assets/icons/double_underline.svg +5 -0
- package/src/assets/icons/fill_color.svg +7 -0
- package/src/assets/icons/formate_painter.svg +5 -0
- package/src/assets/icons/full_access_icon.svg +4 -0
- package/src/assets/icons/history_icon.svg +19 -0
- package/src/assets/icons/italic.svg +3 -0
- package/src/assets/icons/jira.svg +3 -0
- package/src/assets/icons/linked_defects.svg +11 -0
- package/src/assets/icons/move_icon.svg +5 -0
- package/src/assets/icons/nlp_help_icon.svg +3 -0
- package/src/assets/icons/no_access_icon.svg +4 -0
- package/src/assets/icons/no_border.svg +3 -0
- package/src/assets/icons/notification_icon.svg +3 -0
- package/src/assets/icons/strike_through.svg +3 -0
- package/src/assets/icons/text_align_center.svg +3 -0
- package/src/assets/icons/text_align_left.svg +3 -0
- package/src/assets/icons/text_align_right.svg +3 -0
- package/src/assets/icons/text_color.svg +3 -0
- package/src/assets/icons/underline.svg +4 -0
- package/src/assets/icons/update_icon.svg +3 -0
- package/src/assets/icons/view_access_icon.svg +4 -0
- package/src/components/AppHeader/AppHeader.scss +65 -4
- package/src/components/AppHeader/AppHeader.stories.tsx +1 -0
- package/src/components/AppHeader/AppHeader.tsx +7 -5
- package/src/components/AttachmentButton/AttachmentButton.scss +9 -0
- package/src/components/AttachmentButton/AttachmentButton.stories.tsx +76 -0
- package/src/components/AttachmentButton/AttachmentButton.tsx +113 -0
- package/src/components/AttachmentButton/index.ts +1 -0
- package/src/components/AttachmentButton/types.ts +8 -0
- package/src/components/Drawer/Drawer.scss +0 -1
- package/src/components/ExcelFile/ChangeExcelStyles.tsx +78 -0
- package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +13 -0
- package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.tsx +43 -0
- package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +102 -0
- package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +104 -0
- package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +131 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +201 -0
- package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +123 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +25 -0
- package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +49 -0
- package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +37 -0
- package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +46 -0
- package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +31 -0
- package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +5 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +5 -0
- package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +102 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +32 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.css +144 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +494 -0
- package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +19 -0
- package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +302 -0
- package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +18 -0
- package/src/components/ExcelFile/ExcelFile/Excel/context.ts +12 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +200 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +137 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +154 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +10 -0
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +69 -0
- package/src/components/ExcelFile/ExcelFile/Excel/index.ts +48 -0
- package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +388 -0
- package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +82 -0
- package/src/components/ExcelFile/ExcelFile/Excel/point.ts +15 -0
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +682 -0
- package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +257 -0
- package/src/components/ExcelFile/ExcelFile/Excel/types.ts +269 -0
- package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +58 -0
- package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +8 -0
- package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +9 -0
- package/src/components/ExcelFile/ExcelFile/Excel/util.ts +173 -0
- package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +27 -0
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +520 -0
- package/src/components/ExcelFile/ExcelFile.stories.tsx +132 -0
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.scss +16 -0
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +79 -0
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +22 -0
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +271 -0
- package/src/components/ExcelFile/ImportExcelStyles.tsx +86 -0
- package/src/components/ExcelFile/Types.ts +241 -0
- package/src/components/ExcelFile/index.ts +1 -0
- package/src/components/Icon/Icons.scss +2 -3
- package/src/components/Icon/iconList.ts +59 -1
- package/src/components/IconRadioGroup/IconRadioGroup.scss +60 -0
- package/src/components/IconRadioGroup/IconRadioGroup.stories.tsx +108 -0
- package/src/components/IconRadioGroup/IconRadioGroup.tsx +72 -0
- package/src/components/IconRadioGroup/index.ts +1 -0
- package/src/components/IconRadioGroup/type.ts +50 -0
- package/src/components/Modal/modal.scss +1 -1
- package/src/components/MultiSelect/MultiSelect.scss +2 -2
- package/src/components/RadioButton/RadioButton.scss +74 -68
- package/src/components/RadioButton/RadioButton.tsx +22 -15
- package/src/components/RadioButton/radioButtonTypes.tsx +18 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +42 -1
- package/src/components/RadioGroup/RadioGroup.tsx +3 -0
- package/src/components/RadioGroup/radioGroupTypes.tsx +18 -0
- package/src/components/Select/Select.scss +1 -2
- package/src/components/Select/Select.tsx +3 -2
- package/src/components/Select/types.ts +5 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.scss +5 -5
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +1 -1
- package/src/components/Table/Table.scss +1 -0
- package/src/components/Table/Table.tsx +28 -13
- package/src/components/Table/Types.ts +8 -0
- package/src/components/TableTree/TableTree.scss +18 -2
- package/src/components/TableTree/TableTree.stories.tsx +9 -51
- package/src/components/TableTree/TableTree.tsx +15 -2
- package/src/index.ts +4 -0
@@ -0,0 +1,173 @@
|
|
1
|
+
import * as Types from "./types";
|
2
|
+
import * as Matrix from "./matrix";
|
3
|
+
import * as Point from "./point";
|
4
|
+
import { PointRange } from "./point-range";
|
5
|
+
import { Selection } from "./selection";
|
6
|
+
|
7
|
+
export { createEmpty as createEmptyMatrix } from "./matrix";
|
8
|
+
|
9
|
+
export const PLAIN_TEXT_MIME = "text/plain";
|
10
|
+
export const FOCUS_WITHIN_SELECTOR = ":focus-within";
|
11
|
+
|
12
|
+
/** Move the cursor of given input element to the input's end */
|
13
|
+
export function moveCursorToEnd(el: HTMLInputElement): void {
|
14
|
+
el.selectionStart = el.selectionEnd = el.value.length;
|
15
|
+
}
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. A step of -1 is used if a negative start is specified without an end or step. If end is not specified, it's set to start with start then set to 0.
|
19
|
+
* @param end - an integer number specifying at which position to stop (not included).
|
20
|
+
* @param start - An integer number specifying at which position to start.
|
21
|
+
* @param step - An integer number specifying the incrementation
|
22
|
+
*/
|
23
|
+
export function range(end: number, start = 0, step = 1): number[] {
|
24
|
+
const array = [];
|
25
|
+
if (Math.sign(end - start) === -1) {
|
26
|
+
for (let element = start; element > end; element -= step) {
|
27
|
+
array.push(element);
|
28
|
+
}
|
29
|
+
return array;
|
30
|
+
}
|
31
|
+
for (let element = start; element < end; element += step) {
|
32
|
+
array.push(element);
|
33
|
+
}
|
34
|
+
return array;
|
35
|
+
}
|
36
|
+
|
37
|
+
/** Return whether given point is active */
|
38
|
+
export function isActive(
|
39
|
+
active: Types.StoreState["active"],
|
40
|
+
point: Point.Point
|
41
|
+
): boolean {
|
42
|
+
return Boolean(active && Point.isEqual(point, active));
|
43
|
+
}
|
44
|
+
|
45
|
+
/** Get the offset values of given element */
|
46
|
+
export function getOffsetRect(element: HTMLElement): Types.Dimensions {
|
47
|
+
return {
|
48
|
+
width: element.offsetWidth,
|
49
|
+
height: element.offsetHeight,
|
50
|
+
left: element.offsetLeft,
|
51
|
+
top: element.offsetTop,
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
/** Write given data to clipboard with given event */
|
56
|
+
export function writeTextToClipboard(
|
57
|
+
event: ClipboardEvent,
|
58
|
+
data: string
|
59
|
+
): void {
|
60
|
+
event.clipboardData?.setData(PLAIN_TEXT_MIME, data);
|
61
|
+
}
|
62
|
+
|
63
|
+
/** Read text from given clipboard event */
|
64
|
+
export function readTextFromClipboard(event: ClipboardEvent): string {
|
65
|
+
// @ts-ignore
|
66
|
+
if (window.clipboardData && window.clipboardData.getData) {
|
67
|
+
// @ts-ignore
|
68
|
+
return window.clipboardData.getData("Text");
|
69
|
+
}
|
70
|
+
if (event.clipboardData && event.clipboardData.getData) {
|
71
|
+
return event.clipboardData.getData(PLAIN_TEXT_MIME);
|
72
|
+
}
|
73
|
+
return "";
|
74
|
+
}
|
75
|
+
|
76
|
+
/** Get the dimensions of cell at point from state */
|
77
|
+
export function getCellDimensions(
|
78
|
+
point: Point.Point,
|
79
|
+
rowDimensions: Types.StoreState["rowDimensions"] | undefined,
|
80
|
+
columnDimensions: Types.StoreState["columnDimensions"] | undefined
|
81
|
+
): Types.Dimensions | undefined {
|
82
|
+
const cellRowDimensions = rowDimensions && rowDimensions[point.row];
|
83
|
+
const cellColumnDimensions =
|
84
|
+
columnDimensions && columnDimensions[point.column];
|
85
|
+
return (
|
86
|
+
cellRowDimensions &&
|
87
|
+
cellColumnDimensions && {
|
88
|
+
...cellRowDimensions,
|
89
|
+
...cellColumnDimensions,
|
90
|
+
}
|
91
|
+
);
|
92
|
+
}
|
93
|
+
|
94
|
+
/** Get the dimensions of a range of cells */
|
95
|
+
export function getRangeDimensions(
|
96
|
+
rowDimensions: Types.StoreState["rowDimensions"],
|
97
|
+
columnDimensions: Types.StoreState["columnDimensions"],
|
98
|
+
range: PointRange
|
99
|
+
): Types.Dimensions | undefined {
|
100
|
+
const startDimensions = getCellDimensions(
|
101
|
+
range.start,
|
102
|
+
rowDimensions,
|
103
|
+
columnDimensions
|
104
|
+
);
|
105
|
+
const endDimensions = getCellDimensions(
|
106
|
+
range.end,
|
107
|
+
rowDimensions,
|
108
|
+
columnDimensions
|
109
|
+
);
|
110
|
+
return (
|
111
|
+
startDimensions &&
|
112
|
+
endDimensions && {
|
113
|
+
width: endDimensions.left + endDimensions.width - startDimensions.left,
|
114
|
+
height: endDimensions.top + endDimensions.height - startDimensions.top,
|
115
|
+
top: startDimensions.top,
|
116
|
+
left: startDimensions.left,
|
117
|
+
}
|
118
|
+
);
|
119
|
+
}
|
120
|
+
|
121
|
+
/** Get the dimensions of selected */
|
122
|
+
export function getSelectedDimensions(
|
123
|
+
rowDimensions: Types.StoreState["rowDimensions"],
|
124
|
+
columnDimensions: Types.StoreState["columnDimensions"],
|
125
|
+
data: Matrix.Matrix<unknown>,
|
126
|
+
selected: Selection
|
127
|
+
): Types.Dimensions | undefined {
|
128
|
+
const range = selected.toRange(data);
|
129
|
+
return range
|
130
|
+
? getRangeDimensions(rowDimensions, columnDimensions, range)
|
131
|
+
: undefined;
|
132
|
+
}
|
133
|
+
|
134
|
+
/** Get given data as CSV */
|
135
|
+
export function getCSV(data: Matrix.Matrix<Types.CellBase>): string {
|
136
|
+
const valueMatrix = Matrix.map((cell) => cell?.value || "", data);
|
137
|
+
return Matrix.join(valueMatrix);
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Calculate the rows and columns counts of a spreadsheet
|
142
|
+
* @param data - the spreadsheet's data
|
143
|
+
* @param rowLabels - the spreadsheet's row labels (if defined)
|
144
|
+
* @param columnLabels - the spreadsheet's column labels (if defined)
|
145
|
+
* @returns the rows and columns counts of a spreadsheet
|
146
|
+
*/
|
147
|
+
export function calculateSpreadsheetSize(
|
148
|
+
data: Matrix.Matrix<unknown>,
|
149
|
+
rowLabels?: string[],
|
150
|
+
columnLabels?: string[]
|
151
|
+
): Matrix.Size {
|
152
|
+
const { columns, rows } = Matrix.getSize(data);
|
153
|
+
return {
|
154
|
+
rows: rowLabels ? Math.max(rows, rowLabels.length) : rows,
|
155
|
+
columns: columnLabels ? Math.max(columns, columnLabels.length) : columns,
|
156
|
+
};
|
157
|
+
}
|
158
|
+
|
159
|
+
/** Should spreadsheet handle clipboard event */
|
160
|
+
export function shouldHandleClipboardEvent(
|
161
|
+
root: Element | null,
|
162
|
+
mode: Types.Mode
|
163
|
+
): boolean {
|
164
|
+
return root !== null && mode === "view" && isFocusedWithin(root);
|
165
|
+
}
|
166
|
+
|
167
|
+
export function isFocusedWithin(element: Element): boolean {
|
168
|
+
return element.matches(FOCUS_WITHIN_SELECTOR);
|
169
|
+
}
|
170
|
+
|
171
|
+
export function hasLineBreaker(value: unknown) {
|
172
|
+
return typeof value === "string" && value.includes("\n");
|
173
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@import '../../../assets/styles/colors';
|
2
|
+
@import '../../../assets/styles/rsfonts';
|
3
|
+
|
4
|
+
.excel-page {
|
5
|
+
width: 100%;
|
6
|
+
display: flex;
|
7
|
+
flex-direction: column;
|
8
|
+
align-items: center;
|
9
|
+
|
10
|
+
.excel-book {
|
11
|
+
position: relative;
|
12
|
+
width: 100%;
|
13
|
+
.excel-sheet {
|
14
|
+
overflow: scroll;
|
15
|
+
&::-webkit-scrollbar {
|
16
|
+
height: 8px;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
.menu-list {
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
24
|
+
.menu-title {
|
25
|
+
padding-left: 5px;
|
26
|
+
}
|
27
|
+
}
|