pixel-react-excel-sheet 1.0.39 → 1.0.41

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.
Files changed (43) hide show
  1. package/lib/components/Excel/Types.d.ts +1 -1
  2. package/lib/components/TableTree/data.d.ts +0 -40
  3. package/lib/index.d.ts +4 -1
  4. package/lib/index.esm.js +414 -37
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +415 -36
  7. package/lib/index.js.map +1 -1
  8. package/lib/tsconfig.tsbuildinfo +1 -1
  9. package/lib/utils/indexDBStore/indexDB.d.ts +2 -0
  10. package/package.json +2 -1
  11. package/src/assets/icons/clear_history.svg +6 -0
  12. package/src/assets/icons/code.svg +4 -0
  13. package/src/assets/icons/code_colored.svg +4 -0
  14. package/src/assets/icons/csharp.svg +9 -0
  15. package/src/assets/icons/cypress.svg +9 -0
  16. package/src/assets/icons/delete_filled.svg +12 -0
  17. package/src/assets/icons/design_link.svg +7 -0
  18. package/src/assets/icons/disable_icon.svg +3 -0
  19. package/src/assets/icons/enable_icon.svg +3 -0
  20. package/src/assets/icons/file_colored.svg +5 -0
  21. package/src/assets/icons/java.svg +4 -0
  22. package/src/assets/icons/javascript.svg +11 -0
  23. package/src/assets/icons/jira_colored.svg +15 -0
  24. package/src/assets/icons/mic.svg +4 -0
  25. package/src/assets/icons/mic_filled.svg +28 -0
  26. package/src/assets/icons/playwright.svg +9 -0
  27. package/src/assets/icons/python.svg +19 -0
  28. package/src/assets/icons/regenerate.svg +4 -0
  29. package/src/assets/icons/right_arrow_filled_icon.svg +5 -0
  30. package/src/assets/icons/screenshot.svg +7 -0
  31. package/src/components/Button/Button.tsx +2 -0
  32. package/src/components/Excel/ExcelFile/ExcelFile.tsx +4 -2
  33. package/src/components/Excel/ExcelFile.stories.tsx +8 -4
  34. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +51 -17
  35. package/src/components/Excel/Types.ts +1 -1
  36. package/src/components/Excel/dataConversion.ts +8 -10
  37. package/src/components/Icon/iconList.ts +44 -3
  38. package/src/components/TableTree/Components/TableBody.tsx +1 -1
  39. package/src/components/TableTree/Components/TableCell.tsx +26 -12
  40. package/src/components/TableTree/TableTree.tsx +18 -15
  41. package/src/components/TableTree/data.ts +0 -31
  42. package/src/index.ts +3 -0
  43. package/src/utils/indexDBStore/indexDB.ts +37 -0
@@ -34,7 +34,8 @@ export const Default: Story = {
34
34
  [
35
35
  {
36
36
  value: 'Test Sample Data 1',
37
- style: {
37
+ styles: {
38
+ //TODO remove 's' for Style
38
39
  name: 'Arial',
39
40
  size: 11,
40
41
  bold: true,
@@ -57,7 +58,8 @@ export const Default: Story = {
57
58
  },
58
59
  {
59
60
  value: 'Test Data 2',
60
- style: {
61
+ styles: {
62
+ //TODO remove 's' for Style
61
63
  name: 'Arial',
62
64
  size: 12,
63
65
  bold: true,
@@ -82,7 +84,8 @@ export const Default: Story = {
82
84
  [
83
85
  {
84
86
  value: 'Test Data 3',
85
- style: {
87
+ styles: {
88
+ //TODO remove 's' for Style
86
89
  name: 'Arial',
87
90
  size: 11,
88
91
  bold: false,
@@ -105,7 +108,8 @@ export const Default: Story = {
105
108
  },
106
109
  {
107
110
  value: 'Test Sample Data 4',
108
- style: {
111
+ styles: {
112
+ //TODO remove 's' for Style
109
113
  name: 'Arial',
110
114
  size: 11,
111
115
  bold: false,
@@ -151,39 +151,73 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
151
151
  label: 'Courier New',
152
152
  value: '"Courier New"',
153
153
  },
154
- ];
155
-
156
- const fontSize = [
157
154
  {
158
- label: '5',
159
- value: '5',
155
+ label: 'Verdana',
156
+ value: 'Verdana',
157
+ },
158
+ {
159
+ label: 'Tahoma',
160
+ value: 'Tahoma',
161
+ },
162
+ {
163
+ label: 'Trebuchet MS',
164
+ value: '"Trebuchet MS"',
165
+ },
166
+ {
167
+ label: 'Comic Sans MS',
168
+ value: '"Comic Sans MS"',
169
+ },
170
+ {
171
+ label: 'Impact',
172
+ value: 'Impact',
160
173
  },
161
174
  {
162
- label: '9',
163
- value: '9',
175
+ label: 'Arial Black',
176
+ value: '"Arial Black"',
164
177
  },
165
178
  {
166
- label: '11',
167
- value: '11',
179
+ label: 'Lucida Console',
180
+ value: '"Lucida Console"',
168
181
  },
169
182
  {
170
- label: '12',
171
- value: '12',
183
+ label: 'Lucida Sans Unicode',
184
+ value: '"Lucida Sans Unicode"',
172
185
  },
173
186
  {
174
- label: '14',
175
- value: '14',
187
+ label: 'Courier',
188
+ value: 'Courier',
176
189
  },
177
190
  {
178
- label: '16',
179
- value: '16',
191
+ label: 'Arial Rounded MT Bold',
192
+ value: '"Arial Rounded MT Bold"',
180
193
  },
181
194
  {
182
- label: '18',
183
- value: '18',
195
+ label: 'Georgia',
196
+ value: 'Georgia',
184
197
  },
198
+ {
199
+ label: 'sans-serif',
200
+ value: 'sans-serif',
201
+ },
202
+ {
203
+ label: 'serif',
204
+ value: 'serif',
205
+ },
206
+ {
207
+ label: 'monospace',
208
+ value: 'monospace',
209
+ },
210
+ ];
211
+
212
+ const fontSizeList = [
213
+ 5, 6, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 32, 36, 40, 48, 56, 72,
185
214
  ];
186
215
 
216
+ const fontSize = fontSizeList.map((fontSize) => ({
217
+ label: fontSize,
218
+ value: fontSize,
219
+ }));
220
+
187
221
  const getTextColor = (color: string) => {
188
222
  setColorPicker((prev) => ({ ...prev, color: color }));
189
223
  };
@@ -31,7 +31,7 @@ interface WorkData {
31
31
  value: string;
32
32
 
33
33
  /** Styling options for the cell */
34
- style: BackendStyle;
34
+ styles: BackendStyle; //TODO remove 's' for Style
35
35
  type?: boolean;
36
36
  }
37
37
 
@@ -74,7 +74,6 @@ export const getTextDecorationBack = (
74
74
  export function convertStyleToFrontend(
75
75
  backendStyle: BackendStyle
76
76
  ): React.CSSProperties {
77
-
78
77
  const { border } = backendStyle;
79
78
 
80
79
  let borderTop = '';
@@ -82,32 +81,31 @@ export function convertStyleToFrontend(
82
81
  let borderBottom = '';
83
82
  let borderLeft = '';
84
83
 
85
- if (border.top !== 'NONE') {
84
+ if (border.top !== 'THIN') {
86
85
  borderTop =
87
- border.top === 'THIN'
86
+ border.top === 'MEDIUM'
88
87
  ? '2px solid var(--input-hover-border-color)'
89
88
  : '1px solid var(--excel-sheet-border)';
90
89
  }
91
- if (border.right !== 'NONE') {
90
+ if (border.right !== 'THIN') {
92
91
  borderRight =
93
- border.right === 'THIN'
92
+ border.right === 'MEDIUM'
94
93
  ? '2px solid var(--input-hover-border-color)'
95
94
  : '1px solid var(--excel-sheet-border)';
96
95
  }
97
- if (border.bottom !== 'NONE') {
96
+ if (border.bottom !== 'THIN') {
98
97
  borderBottom =
99
- border.bottom === 'THIN'
98
+ border.bottom === 'MEDIUM'
100
99
  ? '2px solid var(--input-hover-border-color)'
101
100
  : '1px solid var(--excel-sheet-border)';
102
101
  }
103
- if (border.left !== 'NONE') {
102
+ if (border.left !== 'THIN') {
104
103
  borderLeft =
105
- border.left === 'THIN'
104
+ border.left === 'MEDIUM'
106
105
  ? '2px solid var(--input-hover-border-color)'
107
106
  : '1px solid var(--excel-sheet-border)';
108
107
  }
109
108
 
110
- // Return the converted styles
111
109
  return {
112
110
  fontSize: `${backendStyle.size}px`,
113
111
  fontFamily: backendStyle.name,
@@ -250,7 +250,7 @@ import variableSet from '../../assets/icons/variable_set.svg?react';
250
250
 
251
251
  import machineEnableIcon from '../../assets/icons/machine_enable_icon.svg?react';
252
252
  import machineDisableIcon from '../../assets/icons/machine_disable_icon.svg?react';
253
- import suitesIcon from '../../assets/icons/suites_icon.svg?react';
253
+ import suitesIcon from '../../assets/icons/suites_icon.svg?react';
254
254
  import executionsIcon from '../../assets/icons/executions_icon.svg?react';
255
255
  import ImportIcon from '../../assets/icons/import_icon.svg?react';
256
256
  import Settings from '../../assets/icons/settings.svg?react';
@@ -259,6 +259,27 @@ import ExternalUser from '../../assets/icons/external_user.svg?react';
259
259
  import SingleUser from '../../assets/icons/single_user.svg?react';
260
260
  import GroupUser from '../../assets/icons/group_user.svg?react';
261
261
  import TestFreshersLogo from '../../assets/icons/test_freshers_logo.svg?react';
262
+ import DisableIcon from '../../assets/icons/disable_icon.svg?react';
263
+ import EnableIcon from '../../assets/icons/enable_icon.svg?react';
264
+
265
+ import ClearHistory from '../../assets/icons/clear_history.svg?react';
266
+ import Csharp from '../../assets/icons/csharp.svg?react';
267
+ import Cypress from '../../assets/icons/cypress.svg?react';
268
+ import Java from '../../assets/icons/java.svg?react';
269
+ import JavaScript from '../../assets/icons/javascript.svg?react';
270
+ import PlayWright from '../../assets/icons/playwright.svg?react';
271
+ import Python from '../../assets/icons/python.svg?react';
272
+ import Code from '../../assets/icons/code.svg?react';
273
+ import Regenerate from '../../assets/icons/regenerate.svg?react';
274
+ import Mic from '../../assets/icons/mic.svg?react';
275
+ import MicActive from '../../assets/icons/mic_filled.svg?react';
276
+ import RightArrowFilled from '../../assets/icons/right_arrow_filled_icon.svg?react';
277
+ import CodeColored from '../../assets/icons/code_colored.svg?react';
278
+ import DesignLink from '../../assets/icons/design_link.svg?react';
279
+ import FileColored from '../../assets/icons/file_colored.svg?react';
280
+ import JiraColored from '../../assets/icons/jira_colored.svg?react';
281
+ import Screenshot from '../../assets/icons/screenshot.svg?react';
282
+ import DeleteFilled from '../../assets/icons/delete_filled.svg?react';
262
283
 
263
284
  Components['success'] = ToastSuccessIcon;
264
285
  Components['alert'] = Alert;
@@ -508,10 +529,30 @@ Components['executions_icon'] = executionsIcon;
508
529
  Components['suites_icon'] = suitesIcon;
509
530
  Components['import_icon'] = ImportIcon;
510
531
  Components['settings'] = Settings;
511
- Components['test_freshers_logo']=TestFreshersLogo;
512
- Components['unfollow_icon']=UnfollowIcon
532
+ Components['test_freshers_logo'] = TestFreshersLogo;
533
+ Components['unfollow_icon'] = UnfollowIcon;
513
534
  Components['external_user'] = ExternalUser;
514
535
  Components['single_user'] = SingleUser;
515
536
  Components['group_user'] = GroupUser;
537
+ Components['disable_icon'] = DisableIcon;
538
+ Components['enable_icon'] = EnableIcon;
539
+ Components['clear_history'] = ClearHistory;
540
+ Components['csharp'] = Csharp;
541
+ Components['cypress'] = Cypress;
542
+ Components['java'] = Java;
543
+ Components['javascript'] = JavaScript;
544
+ Components['playwright'] = PlayWright;
545
+ Components['python'] = Python;
546
+ Components['code'] = Code;
547
+ Components['regenerate'] = Regenerate;
548
+ Components['mic'] = Mic;
549
+ Components['mic_filled'] = MicActive;
550
+ Components['right_arrow_filled_icon'] = RightArrowFilled;
551
+ Components['code_colored'] = CodeColored;
552
+ Components['design_link'] = DesignLink;
553
+ Components['file_colored'] = FileColored;
554
+ Components['jira_colored'] = JiraColored;
555
+ Components['screenshot'] = Screenshot;
556
+ Components['delete_filled'] = DeleteFilled;
516
557
 
517
558
  export default Components;
@@ -12,7 +12,7 @@ const TableBody = React.memo(
12
12
  onToggleExpand,
13
13
  onCheckBoxChange,
14
14
  }: TableBodyProps) => (
15
- <tbody className='ff-table-tree-body'>
15
+ <tbody className="ff-table-tree-body">
16
16
  <tr id="ff-table-tree-first-node" />
17
17
  {flattenedTreeData?.map(
18
18
  ({ node, level, parentSiblings = [], isLast = false }) => {
@@ -4,23 +4,37 @@ import RadioButton from '../../RadioButton';
4
4
  import { TableCellProps } from '../types';
5
5
  import Arrow from '../../../assets/icons/arrows_down_icon.svg?react';
6
6
  import React from 'react';
7
+ import { checkEmpty } from '../../../utils/checkEmpty/checkEmpty';
7
8
 
8
9
  const renderSpaces = (
9
10
  level: number,
10
11
  parentSiblings: boolean[],
11
12
  isLast?: boolean | undefined
12
- ) => (
13
- <div className="tree-table-space-container">
14
- {parentSiblings.reverse().map((line, i) => (
15
- <span
16
- key={i}
17
- className={`tree-table-space-block ${!line ? 'no-lines' : ''} ${
18
- isLast && i === level - 1 ? 'last-node' : ''
19
- }`}
20
- />
21
- ))}
22
- </div>
23
- );
13
+ ) => {
14
+ let siblingsArray = parentSiblings;
15
+ let isLastNode = isLast;
16
+ if (checkEmpty(parentSiblings)) {
17
+ isLastNode = false;
18
+
19
+ if (!isNaN(level)) {
20
+ siblingsArray = Array(level).fill(true);
21
+ }
22
+ }
23
+
24
+ parentSiblings;
25
+ return (
26
+ <div className="tree-table-space-container">
27
+ {siblingsArray.reverse().map((line, i) => (
28
+ <span
29
+ key={i}
30
+ className={`tree-table-space-block ${!line ? 'no-lines' : ''} ${
31
+ isLastNode && i === level - 1 ? 'last-node' : ''
32
+ }`}
33
+ />
34
+ ))}
35
+ </div>
36
+ );
37
+ };
24
38
 
25
39
  const TableCell = React.memo(
26
40
  ({
@@ -16,23 +16,26 @@ const TreeTable: React.FC<TreeTableProps> = ({
16
16
  onExpand,
17
17
  loadMore = () => {},
18
18
  }) => {
19
- useIntersectionObserver(['ff-table-tree-last-node'], {
20
- root: null,
21
- rootMargin: '0px',
22
- threshold: 0.1,
23
- onIntersect: (entry) => {
24
- if (entry.isIntersecting) {
25
- if (functionCheck(loadMore)) {
26
- let direction = 'up';
27
- if (entry.target.id === 'ff-table-tree-last-node') {
28
- direction = 'down';
19
+ useIntersectionObserver(
20
+ ['ff-table-tree-last-node', 'ff-table-tree-first-node'],
21
+ {
22
+ root: null,
23
+ rootMargin: '0px',
24
+ threshold: 0.1,
25
+ onIntersect: (entry) => {
26
+ if (entry.isIntersecting) {
27
+ if (functionCheck(loadMore)) {
28
+ let direction = 'up';
29
+ if (entry.target.id === 'ff-table-tree-last-node') {
30
+ direction = 'down';
31
+ }
32
+ loadMore(direction);
29
33
  }
30
- loadMore(direction);
34
+ console.log('Element in view:', entry.target.id);
31
35
  }
32
- console.log('Element in view:', entry.target.id);
33
- }
34
- },
35
- });
36
+ },
37
+ }
38
+ );
36
39
 
37
40
  const handleToggleExpand = useCallback(
38
41
  (node: any) => onExpand?.(true, node?.id),
@@ -31,37 +31,6 @@ const data = [
31
31
  isLast: true,
32
32
  parentSiblings: [true],
33
33
  },
34
- {
35
- node: {
36
- subModuleCount: 15,
37
- title: 'mod1',
38
- scriptCount: 0,
39
- path: '/Root',
40
- expanded: true,
41
- modifiedOn: '19-12-2023 15:32',
42
- children: false,
43
- lastExecutionOrder: 3,
44
- imported: false,
45
- modifiedBy: '--',
46
- moduleCountWithScript: 1,
47
- state: 'NEW',
48
- key: 'MOD1001',
49
- ver: 1,
50
- hierarchy: 0,
51
- assigneeCount: 0,
52
- searchKey: '/MOD1001111110000000000',
53
- modifiedByUname: '--',
54
- executionOrder: 0,
55
- createdByUname: 'Shivaprasad',
56
- folder: true,
57
- moduleLevelScriptCount: 0,
58
- name: 'Root Module',
59
- parentId: 'MOD1001', // Root has no parent
60
- id: 'MOD1002', // Unique ID
61
- },
62
- parentSiblings: [true, false],
63
- lines: 1,
64
- },
65
34
  {
66
35
  node: {
67
36
  subModuleCount: 10,
package/src/index.ts CHANGED
@@ -162,6 +162,7 @@ import {
162
162
  ELEMENTS_WHITE_SPACE_REGEX,
163
163
  PARAMETER_ALPHANUMERIC_REGEX,
164
164
  } from './validations/regex';
165
+ import { getFromIndexedDB, saveToIndexedDB } from './utils/indexDBStore/indexDB';
165
166
 
166
167
  export {
167
168
  Button,
@@ -270,6 +271,8 @@ export {
270
271
  FormatString,
271
272
  hasDuplicateFile,
272
273
  useKeyboardActions,
274
+ saveToIndexedDB,
275
+ getFromIndexedDB,
273
276
 
274
277
  EMAIL_REGEX,
275
278
  URL_REGEX,
@@ -0,0 +1,37 @@
1
+ import { openDB, DBSchema } from 'idb';
2
+
3
+ // Define the database schema
4
+ interface MyDB extends DBSchema {
5
+ items: {
6
+ key: string; // Key for each item
7
+ value: string; // Stored value, encoded as a string
8
+ };
9
+ }
10
+
11
+ // Open the database
12
+ const dbPromise = openDB<MyDB>('my-database', 1, {
13
+ upgrade(db) {
14
+ if (!db.objectStoreNames.contains('items')) {
15
+ db.createObjectStore('items');
16
+ }
17
+ },
18
+ });
19
+
20
+ // Encoding utility
21
+ const encode = (data: string): string => btoa(unescape(encodeURIComponent(data))); // Example: Base64 encoding
22
+ // Decoding utility
23
+ const decode = (data: string): string => decodeURIComponent(escape(atob(data)));
24
+
25
+ // Save data to IndexedDB
26
+ export const saveToIndexedDB = async (key: string, value: string): Promise<void> => {
27
+ const db = await dbPromise;
28
+ const encodedValue = encode(value);
29
+ await db.put('items', encodedValue, key);
30
+ };
31
+
32
+ // Get data from IndexedDB
33
+ export const getFromIndexedDB = async (key: string): Promise<string | null> => {
34
+ const db = await dbPromise;
35
+ const encodedValue = await db.get('items', key);
36
+ return encodedValue ? decode(encodedValue) : null;
37
+ };