pixel-react 1.10.2 → 1.10.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.10.2",
4
+ "version": "1.10.3",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -13,6 +13,7 @@ export const AddModule = ({
13
13
  error?: string;
14
14
  value?: string;
15
15
  }) => {
16
+ console.log('🚀 ~ value:', value);
16
17
  const [text, setText] = useState(value);
17
18
  return (
18
19
  <>
@@ -21,6 +22,7 @@ export const AddModule = ({
21
22
  type="text"
22
23
  className="add-module-input"
23
24
  onChange={(e) => setText(e.target.value)}
25
+ value={text}
24
26
  />
25
27
  <Icon
26
28
  className="icons"
@@ -29,7 +31,7 @@ export const AddModule = ({
29
31
  />
30
32
  <Icon className="icons" name="close" onClick={onCancel} />
31
33
  </div>
32
- {error}
34
+ <small>{error}</small>
33
35
  </>
34
36
  );
35
37
  };
@@ -97,6 +97,7 @@ const TableCell = React.memo(
97
97
  onCancel={onAddCancel}
98
98
  onConfirm={onAddConfirm}
99
99
  error={node?.error || ''}
100
+ value={node.value}
100
101
  />
101
102
  ) : (
102
103
  <span className="tree-table-td-content-text">
@@ -16,7 +16,7 @@ const TreeTable: React.FC<TreeTableProps> = ({
16
16
  loadMore = () => {},
17
17
  tableBorder,
18
18
  height = 'auto',
19
- newNode = {},
19
+ newNode = { action: 'addInside', sourceId: 'PAG1013', value: 'newNode' },
20
20
  onAddConfirm = (_name) => {},
21
21
  onAddCancel = () => {},
22
22
  }) => {
@@ -5,9 +5,11 @@ export const addNewRow = (
5
5
  newNode: {
6
6
  action?: 'addAbove' | 'addBelow' | 'addInside';
7
7
  sourceId?: string;
8
+ error?: string;
9
+ value?: string;
8
10
  }
9
11
  ) => {
10
- const { sourceId, action } = newNode;
12
+ const { sourceId, action, value = '', error = '' } = newNode;
11
13
 
12
14
  if (!sourceId || !action) return treeData;
13
15
 
@@ -24,6 +26,8 @@ export const addNewRow = (
24
26
  sourceId: sourceNode.key,
25
27
  isNewNode: true,
26
28
  key: 'new-node',
29
+ value,
30
+ error,
27
31
  };
28
32
 
29
33
  switch (action) {
@@ -30,6 +30,8 @@ export interface TableBodyProps {
30
30
  newNode?: {
31
31
  sourceId?: string;
32
32
  action?: 'addAbove' | 'addBelow' | 'addInside';
33
+ value?: string;
34
+ error?: string;
33
35
  };
34
36
  onAddConfirm?: (_name: string) => void;
35
37
  onAddCancel?: () => void;
@@ -74,6 +76,8 @@ export interface TreeTableProps {
74
76
  newNode?: {
75
77
  sourceId?: string;
76
78
  action?: 'addAbove' | 'addBelow' | 'addInside';
79
+ value?: string;
80
+ error?: string;
77
81
  };
78
82
  onAddConfirm?: (_name: string) => void;
79
83
  onAddCancel?: () => void;