@akinon/ai-modal-table 1.0.12 → 1.1.0-260521-2
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/dist/cjs/ai-table/components/__tests__/content.test.js +69 -0
- package/dist/cjs/ai-table/components/__tests__/content.test.tsx +91 -0
- package/dist/cjs/ai-table/constants/index.d.ts +1 -0
- package/dist/cjs/ai-table/constants/index.d.ts.map +1 -1
- package/dist/cjs/ai-table/constants/index.js +2 -1
- package/dist/cjs/ai-table/utils/render-edit-fields/__tests__/index.test.js +79 -0
- package/dist/cjs/ai-table/utils/render-edit-fields/__tests__/index.test.tsx +127 -0
- package/dist/cjs/ai-table/utils/render-edit-fields/index.d.ts.map +1 -1
- package/dist/cjs/ai-table/utils/render-edit-fields/index.js +11 -0
- package/dist/cjs/types/index.d.ts +6 -2
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/esm/ai-table/components/__tests__/content.test.js +69 -0
- package/dist/esm/ai-table/components/__tests__/content.test.tsx +91 -0
- package/dist/esm/ai-table/constants/index.d.ts +1 -0
- package/dist/esm/ai-table/constants/index.d.ts.map +1 -1
- package/dist/esm/ai-table/constants/index.js +2 -1
- package/dist/esm/ai-table/utils/render-edit-fields/__tests__/index.test.js +79 -0
- package/dist/esm/ai-table/utils/render-edit-fields/__tests__/index.test.tsx +127 -0
- package/dist/esm/ai-table/utils/render-edit-fields/index.d.ts.map +1 -1
- package/dist/esm/ai-table/utils/render-edit-fields/index.js +12 -1
- package/dist/esm/types/index.d.ts +6 -2
- package/dist/esm/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,10 @@ vitest_1.vi.mock('@akinon/ui-input', () => ({
|
|
|
30
30
|
Input: (_a) => {
|
|
31
31
|
var { onChange, value, className } = _a, props = __rest(_a, ["onChange", "value", "className"]);
|
|
32
32
|
return (react_2.default.createElement("input", Object.assign({ onChange: onChange, value: value, className: className, "data-testid": "edit-input" }, props)));
|
|
33
|
+
},
|
|
34
|
+
InputTextArea: (_a) => {
|
|
35
|
+
var { onChange, value, className, rows, style } = _a, props = __rest(_a, ["onChange", "value", "className", "rows", "style"]);
|
|
36
|
+
return (react_2.default.createElement("textarea", Object.assign({ onChange: onChange, value: value, className: className, rows: rows, style: style, "data-testid": "edit-textarea" }, props)));
|
|
33
37
|
}
|
|
34
38
|
}));
|
|
35
39
|
vitest_1.vi.mock('@akinon/ui-select', () => ({
|
|
@@ -1358,6 +1362,71 @@ vitest_1.vi.mock('../../i18n', () => ({
|
|
|
1358
1362
|
const inputs = react_1.screen.queryAllByTestId('edit-input');
|
|
1359
1363
|
(0, vitest_1.expect)(inputs.length).toBeGreaterThan(0);
|
|
1360
1364
|
});
|
|
1365
|
+
(0, vitest_1.it)('should render textarea for editable column when editDataIndexes has TEXTAREA config', async () => {
|
|
1366
|
+
const user = user_event_1.default.setup();
|
|
1367
|
+
const onEdit = vitest_1.vi.fn();
|
|
1368
|
+
renderComponent({
|
|
1369
|
+
data: [
|
|
1370
|
+
{
|
|
1371
|
+
pk: 1,
|
|
1372
|
+
name: 'Item 1',
|
|
1373
|
+
description: 'Some long description text',
|
|
1374
|
+
mappings: []
|
|
1375
|
+
}
|
|
1376
|
+
],
|
|
1377
|
+
columns: [
|
|
1378
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1379
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1380
|
+
],
|
|
1381
|
+
mapperConfig: undefined,
|
|
1382
|
+
onEdit,
|
|
1383
|
+
editDataIndexes: [
|
|
1384
|
+
'name',
|
|
1385
|
+
{ key: 'description', type: constants_1.EDIT_FIELD_TYPES.TEXTAREA }
|
|
1386
|
+
]
|
|
1387
|
+
});
|
|
1388
|
+
const editButton = react_1.screen.getByTestId('edit-button-1');
|
|
1389
|
+
await user.click(editButton);
|
|
1390
|
+
const inputs = react_1.screen.queryAllByTestId('edit-input');
|
|
1391
|
+
const textareas = react_1.screen.queryAllByTestId('edit-textarea');
|
|
1392
|
+
(0, vitest_1.expect)(inputs.length).toBeGreaterThan(0);
|
|
1393
|
+
(0, vitest_1.expect)(textareas.length).toBeGreaterThan(0);
|
|
1394
|
+
(0, vitest_1.expect)(textareas[0]).toHaveValue('Some long description text');
|
|
1395
|
+
(0, vitest_1.expect)(textareas[0]).toHaveAttribute('rows', '3');
|
|
1396
|
+
});
|
|
1397
|
+
(0, vitest_1.it)('should call onEdit when textarea value changes in edit mode', async () => {
|
|
1398
|
+
const user = user_event_1.default.setup();
|
|
1399
|
+
const onEdit = vitest_1.vi.fn();
|
|
1400
|
+
renderComponent({
|
|
1401
|
+
data: [
|
|
1402
|
+
{
|
|
1403
|
+
pk: 1,
|
|
1404
|
+
name: 'Item 1',
|
|
1405
|
+
description: 'Original description',
|
|
1406
|
+
mappings: []
|
|
1407
|
+
}
|
|
1408
|
+
],
|
|
1409
|
+
columns: [
|
|
1410
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1411
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1412
|
+
],
|
|
1413
|
+
mapperConfig: undefined,
|
|
1414
|
+
onEdit,
|
|
1415
|
+
editDataIndexes: [
|
|
1416
|
+
{ key: 'description', type: constants_1.EDIT_FIELD_TYPES.TEXTAREA }
|
|
1417
|
+
]
|
|
1418
|
+
});
|
|
1419
|
+
const editButton = react_1.screen.getByTestId('edit-button-1');
|
|
1420
|
+
await user.click(editButton);
|
|
1421
|
+
const textareas = react_1.screen.queryAllByTestId('edit-textarea');
|
|
1422
|
+
(0, vitest_1.expect)(textareas.length).toBeGreaterThan(0);
|
|
1423
|
+
react_1.fireEvent.change(textareas[0], {
|
|
1424
|
+
target: { value: 'Updated description' }
|
|
1425
|
+
});
|
|
1426
|
+
(0, vitest_1.expect)(onEdit).toHaveBeenCalledWith(1, {
|
|
1427
|
+
description: 'Updated description'
|
|
1428
|
+
});
|
|
1429
|
+
});
|
|
1361
1430
|
(0, vitest_1.it)('should render Select for editable column when editDataIndexes has SELECT config', async () => {
|
|
1362
1431
|
const user = user_event_1.default.setup();
|
|
1363
1432
|
const onEdit = vitest_1.vi.fn();
|
|
@@ -33,6 +33,24 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
33
33
|
data-testid="edit-input"
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
|
+
),
|
|
37
|
+
InputTextArea: ({
|
|
38
|
+
onChange,
|
|
39
|
+
value,
|
|
40
|
+
className,
|
|
41
|
+
rows,
|
|
42
|
+
style,
|
|
43
|
+
...props
|
|
44
|
+
}: any) => (
|
|
45
|
+
<textarea
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
value={value}
|
|
48
|
+
className={className}
|
|
49
|
+
rows={rows}
|
|
50
|
+
style={style}
|
|
51
|
+
data-testid="edit-textarea"
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
36
54
|
)
|
|
37
55
|
}));
|
|
38
56
|
|
|
@@ -1659,6 +1677,79 @@ describe('TableContent', () => {
|
|
|
1659
1677
|
expect(inputs.length).toBeGreaterThan(0);
|
|
1660
1678
|
});
|
|
1661
1679
|
|
|
1680
|
+
it('should render textarea for editable column when editDataIndexes has TEXTAREA config', async () => {
|
|
1681
|
+
const user = userEvent.setup();
|
|
1682
|
+
const onEdit = vi.fn();
|
|
1683
|
+
|
|
1684
|
+
renderComponent({
|
|
1685
|
+
data: [
|
|
1686
|
+
{
|
|
1687
|
+
pk: 1,
|
|
1688
|
+
name: 'Item 1',
|
|
1689
|
+
description: 'Some long description text',
|
|
1690
|
+
mappings: []
|
|
1691
|
+
}
|
|
1692
|
+
],
|
|
1693
|
+
columns: [
|
|
1694
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1695
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1696
|
+
],
|
|
1697
|
+
mapperConfig: undefined,
|
|
1698
|
+
onEdit,
|
|
1699
|
+
editDataIndexes: [
|
|
1700
|
+
'name',
|
|
1701
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1702
|
+
]
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1706
|
+
await user.click(editButton);
|
|
1707
|
+
|
|
1708
|
+
const inputs = screen.queryAllByTestId('edit-input');
|
|
1709
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1710
|
+
expect(inputs.length).toBeGreaterThan(0);
|
|
1711
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1712
|
+
expect(textareas[0]).toHaveValue('Some long description text');
|
|
1713
|
+
expect(textareas[0]).toHaveAttribute('rows', '3');
|
|
1714
|
+
});
|
|
1715
|
+
|
|
1716
|
+
it('should call onEdit when textarea value changes in edit mode', async () => {
|
|
1717
|
+
const user = userEvent.setup();
|
|
1718
|
+
const onEdit = vi.fn();
|
|
1719
|
+
|
|
1720
|
+
renderComponent({
|
|
1721
|
+
data: [
|
|
1722
|
+
{
|
|
1723
|
+
pk: 1,
|
|
1724
|
+
name: 'Item 1',
|
|
1725
|
+
description: 'Original description',
|
|
1726
|
+
mappings: []
|
|
1727
|
+
}
|
|
1728
|
+
],
|
|
1729
|
+
columns: [
|
|
1730
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1731
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1732
|
+
],
|
|
1733
|
+
mapperConfig: undefined,
|
|
1734
|
+
onEdit,
|
|
1735
|
+
editDataIndexes: [
|
|
1736
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1737
|
+
]
|
|
1738
|
+
});
|
|
1739
|
+
|
|
1740
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1741
|
+
await user.click(editButton);
|
|
1742
|
+
|
|
1743
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1744
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1745
|
+
fireEvent.change(textareas[0], {
|
|
1746
|
+
target: { value: 'Updated description' }
|
|
1747
|
+
});
|
|
1748
|
+
expect(onEdit).toHaveBeenCalledWith(1, {
|
|
1749
|
+
description: 'Updated description'
|
|
1750
|
+
});
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1662
1753
|
it('should render Select for editable column when editDataIndexes has SELECT config', async () => {
|
|
1663
1754
|
const user = userEvent.setup();
|
|
1664
1755
|
const onEdit = vi.fn();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-table/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,iBAAiB;;;GAG3B,CAAC;AAEJ,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,wBAAwB,MAAO,CAAC;AAE7C,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-table/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,iBAAiB;;;GAG3B,CAAC;AAEJ,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,wBAAwB,MAAO,CAAC;AAE7C,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC"}
|
|
@@ -22,6 +22,10 @@ vitest_1.vi.mock('@akinon/ui-input', () => ({
|
|
|
22
22
|
Input: (_a) => {
|
|
23
23
|
var { value, onChange, className } = _a, props = __rest(_a, ["value", "onChange", "className"]);
|
|
24
24
|
return (React.createElement("input", Object.assign({ "data-testid": "edit-input", value: value, onChange: onChange, className: className }, props)));
|
|
25
|
+
},
|
|
26
|
+
InputTextArea: (_a) => {
|
|
27
|
+
var { value, onChange, className, rows, style } = _a, props = __rest(_a, ["value", "onChange", "className", "rows", "style"]);
|
|
28
|
+
return (React.createElement("textarea", Object.assign({ "data-testid": "edit-textarea", value: value, onChange: onChange, className: className, rows: rows, style: style }, props)));
|
|
25
29
|
}
|
|
26
30
|
}));
|
|
27
31
|
vitest_1.vi.mock('@akinon/ui-select', () => ({
|
|
@@ -69,6 +73,15 @@ vitest_1.vi.mock('@akinon/ui-select', () => ({
|
|
|
69
73
|
attributes: { placeholder: 'Value' }
|
|
70
74
|
});
|
|
71
75
|
});
|
|
76
|
+
(0, vitest_1.it)('returns config object when dataIndex matches object key (TEXTAREA)', () => {
|
|
77
|
+
const textareaConfig = {
|
|
78
|
+
key: 'description',
|
|
79
|
+
type: constants_1.EDIT_FIELD_TYPES.TEXTAREA,
|
|
80
|
+
attributes: { placeholder: 'Enter description' }
|
|
81
|
+
};
|
|
82
|
+
const editDataIndexes = [textareaConfig];
|
|
83
|
+
(0, vitest_1.expect)((0, index_1.getEditFieldConfig)(editDataIndexes, 'description')).toEqual(textareaConfig);
|
|
84
|
+
});
|
|
72
85
|
(0, vitest_1.it)('returns config object when dataIndex matches object key (SELECT)', () => {
|
|
73
86
|
const selectConfig = {
|
|
74
87
|
key: 'status',
|
|
@@ -217,4 +230,70 @@ vitest_1.vi.mock('@akinon/ui-select', () => ({
|
|
|
217
230
|
(0, vitest_1.expect)(react_1.screen.getByTestId('edit-input')).toBeInTheDocument();
|
|
218
231
|
(0, vitest_1.expect)(react_1.screen.getByTestId('edit-input')).toHaveValue('fallback');
|
|
219
232
|
});
|
|
233
|
+
(0, vitest_1.it)('renders textarea for TEXTAREA config', () => {
|
|
234
|
+
const onChange = vitest_1.vi.fn();
|
|
235
|
+
(0, react_1.render)(React.createElement(React.Fragment, null, (0, index_1.renderEditField)({
|
|
236
|
+
config: { key: 'description', type: constants_1.EDIT_FIELD_TYPES.TEXTAREA },
|
|
237
|
+
value: 'some text',
|
|
238
|
+
onChange
|
|
239
|
+
})));
|
|
240
|
+
const textarea = react_1.screen.getByTestId('edit-textarea');
|
|
241
|
+
(0, vitest_1.expect)(textarea).toBeInTheDocument();
|
|
242
|
+
(0, vitest_1.expect)(textarea).toHaveValue('some text');
|
|
243
|
+
});
|
|
244
|
+
(0, vitest_1.it)('renders textarea with 3 rows by default', () => {
|
|
245
|
+
(0, react_1.render)(React.createElement(React.Fragment, null, (0, index_1.renderEditField)({
|
|
246
|
+
config: { key: 'description', type: constants_1.EDIT_FIELD_TYPES.TEXTAREA },
|
|
247
|
+
value: '',
|
|
248
|
+
onChange: vitest_1.vi.fn()
|
|
249
|
+
})));
|
|
250
|
+
(0, vitest_1.expect)(react_1.screen.getByTestId('edit-textarea')).toHaveAttribute('rows', '3');
|
|
251
|
+
});
|
|
252
|
+
(0, vitest_1.it)('calls onChange with textarea value when textarea changes', () => {
|
|
253
|
+
const onChange = vitest_1.vi.fn();
|
|
254
|
+
(0, react_1.render)(React.createElement(React.Fragment, null, (0, index_1.renderEditField)({
|
|
255
|
+
config: { key: 'description', type: constants_1.EDIT_FIELD_TYPES.TEXTAREA },
|
|
256
|
+
value: '',
|
|
257
|
+
onChange
|
|
258
|
+
})));
|
|
259
|
+
react_1.fireEvent.change(react_1.screen.getByTestId('edit-textarea'), {
|
|
260
|
+
target: { value: 'updated text' }
|
|
261
|
+
});
|
|
262
|
+
(0, vitest_1.expect)(onChange).toHaveBeenCalledWith('updated text');
|
|
263
|
+
});
|
|
264
|
+
(0, vitest_1.it)('passes attributes to textarea (className, placeholder)', () => {
|
|
265
|
+
(0, react_1.render)(React.createElement(React.Fragment, null, (0, index_1.renderEditField)({
|
|
266
|
+
config: {
|
|
267
|
+
key: 'description',
|
|
268
|
+
type: constants_1.EDIT_FIELD_TYPES.TEXTAREA,
|
|
269
|
+
attributes: {
|
|
270
|
+
className: 'custom-textarea',
|
|
271
|
+
placeholder: 'Enter description'
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
value: '',
|
|
275
|
+
onChange: vitest_1.vi.fn()
|
|
276
|
+
})));
|
|
277
|
+
const textarea = react_1.screen.getByTestId('edit-textarea');
|
|
278
|
+
(0, vitest_1.expect)(textarea).toHaveClass('custom-textarea');
|
|
279
|
+
(0, vitest_1.expect)(textarea).toHaveAttribute('placeholder', 'Enter description');
|
|
280
|
+
});
|
|
281
|
+
(0, vitest_1.it)('calls attributes.onChange and then onChange when both provided for textarea', async () => {
|
|
282
|
+
const user = user_event_1.default.setup();
|
|
283
|
+
const onAttributeChange = vitest_1.vi.fn();
|
|
284
|
+
const onChange = vitest_1.vi.fn();
|
|
285
|
+
(0, react_1.render)(React.createElement(React.Fragment, null, (0, index_1.renderEditField)({
|
|
286
|
+
config: {
|
|
287
|
+
key: 'description',
|
|
288
|
+
type: constants_1.EDIT_FIELD_TYPES.TEXTAREA,
|
|
289
|
+
attributes: { onChange: onAttributeChange }
|
|
290
|
+
},
|
|
291
|
+
value: '',
|
|
292
|
+
onChange
|
|
293
|
+
})));
|
|
294
|
+
const textarea = react_1.screen.getByTestId('edit-textarea');
|
|
295
|
+
await user.type(textarea, 'x');
|
|
296
|
+
(0, vitest_1.expect)(onAttributeChange).toHaveBeenCalled();
|
|
297
|
+
(0, vitest_1.expect)(onChange).toHaveBeenCalled();
|
|
298
|
+
});
|
|
220
299
|
});
|
|
@@ -25,6 +25,30 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
25
25
|
className={className}
|
|
26
26
|
{...props}
|
|
27
27
|
/>
|
|
28
|
+
),
|
|
29
|
+
InputTextArea: ({
|
|
30
|
+
value,
|
|
31
|
+
onChange,
|
|
32
|
+
className,
|
|
33
|
+
rows,
|
|
34
|
+
style,
|
|
35
|
+
...props
|
|
36
|
+
}: {
|
|
37
|
+
value: string;
|
|
38
|
+
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
39
|
+
className?: string;
|
|
40
|
+
rows?: number;
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
}) => (
|
|
43
|
+
<textarea
|
|
44
|
+
data-testid="edit-textarea"
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
className={className}
|
|
48
|
+
rows={rows}
|
|
49
|
+
style={style}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
28
52
|
)
|
|
29
53
|
}));
|
|
30
54
|
|
|
@@ -90,6 +114,18 @@ describe('getEditFieldConfig', () => {
|
|
|
90
114
|
});
|
|
91
115
|
});
|
|
92
116
|
|
|
117
|
+
it('returns config object when dataIndex matches object key (TEXTAREA)', () => {
|
|
118
|
+
const textareaConfig = {
|
|
119
|
+
key: 'description',
|
|
120
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
121
|
+
attributes: { placeholder: 'Enter description' }
|
|
122
|
+
};
|
|
123
|
+
const editDataIndexes = [textareaConfig];
|
|
124
|
+
expect(getEditFieldConfig(editDataIndexes, 'description')).toEqual(
|
|
125
|
+
textareaConfig
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
93
129
|
it('returns config object when dataIndex matches object key (SELECT)', () => {
|
|
94
130
|
const selectConfig = {
|
|
95
131
|
key: 'status',
|
|
@@ -280,4 +316,95 @@ describe('renderEditField', () => {
|
|
|
280
316
|
expect(screen.getByTestId('edit-input')).toBeInTheDocument();
|
|
281
317
|
expect(screen.getByTestId('edit-input')).toHaveValue('fallback');
|
|
282
318
|
});
|
|
319
|
+
|
|
320
|
+
it('renders textarea for TEXTAREA config', () => {
|
|
321
|
+
const onChange = vi.fn();
|
|
322
|
+
render(
|
|
323
|
+
<>
|
|
324
|
+
{renderEditField({
|
|
325
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
326
|
+
value: 'some text',
|
|
327
|
+
onChange
|
|
328
|
+
})}
|
|
329
|
+
</>
|
|
330
|
+
);
|
|
331
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
332
|
+
expect(textarea).toBeInTheDocument();
|
|
333
|
+
expect(textarea).toHaveValue('some text');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('renders textarea with 3 rows by default', () => {
|
|
337
|
+
render(
|
|
338
|
+
<>
|
|
339
|
+
{renderEditField({
|
|
340
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
341
|
+
value: '',
|
|
342
|
+
onChange: vi.fn()
|
|
343
|
+
})}
|
|
344
|
+
</>
|
|
345
|
+
);
|
|
346
|
+
expect(screen.getByTestId('edit-textarea')).toHaveAttribute('rows', '3');
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('calls onChange with textarea value when textarea changes', () => {
|
|
350
|
+
const onChange = vi.fn();
|
|
351
|
+
render(
|
|
352
|
+
<>
|
|
353
|
+
{renderEditField({
|
|
354
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
355
|
+
value: '',
|
|
356
|
+
onChange
|
|
357
|
+
})}
|
|
358
|
+
</>
|
|
359
|
+
);
|
|
360
|
+
fireEvent.change(screen.getByTestId('edit-textarea'), {
|
|
361
|
+
target: { value: 'updated text' }
|
|
362
|
+
});
|
|
363
|
+
expect(onChange).toHaveBeenCalledWith('updated text');
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('passes attributes to textarea (className, placeholder)', () => {
|
|
367
|
+
render(
|
|
368
|
+
<>
|
|
369
|
+
{renderEditField({
|
|
370
|
+
config: {
|
|
371
|
+
key: 'description',
|
|
372
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
373
|
+
attributes: {
|
|
374
|
+
className: 'custom-textarea',
|
|
375
|
+
placeholder: 'Enter description'
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
value: '',
|
|
379
|
+
onChange: vi.fn()
|
|
380
|
+
})}
|
|
381
|
+
</>
|
|
382
|
+
);
|
|
383
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
384
|
+
expect(textarea).toHaveClass('custom-textarea');
|
|
385
|
+
expect(textarea).toHaveAttribute('placeholder', 'Enter description');
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('calls attributes.onChange and then onChange when both provided for textarea', async () => {
|
|
389
|
+
const user = userEvent.setup();
|
|
390
|
+
const onAttributeChange = vi.fn();
|
|
391
|
+
const onChange = vi.fn();
|
|
392
|
+
render(
|
|
393
|
+
<>
|
|
394
|
+
{renderEditField({
|
|
395
|
+
config: {
|
|
396
|
+
key: 'description',
|
|
397
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
398
|
+
attributes: { onChange: onAttributeChange }
|
|
399
|
+
},
|
|
400
|
+
value: '',
|
|
401
|
+
onChange
|
|
402
|
+
})}
|
|
403
|
+
</>
|
|
404
|
+
);
|
|
405
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
406
|
+
await user.type(textarea, 'x');
|
|
407
|
+
expect(onAttributeChange).toHaveBeenCalled();
|
|
408
|
+
expect(onChange).toHaveBeenCalled();
|
|
409
|
+
});
|
|
283
410
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-table/utils/render-edit-fields/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-table/utils/render-edit-fields/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,kBAAkB,GAAG,CACxB,eAAe,EAAE,aAAa,EAAE,EAChC,SAAS,EAAE,MAAM,KACd,mBAAmB,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;AA6F1E,eAAO,MAAM,eAAe,EAAE,eAO7B,CAAC"}
|
|
@@ -44,6 +44,16 @@ const renderInputField = ({ config, value, onChange }) => {
|
|
|
44
44
|
const allClassNames = (0, classnames_1.default)('w-44 h-9', className);
|
|
45
45
|
return (React.createElement(ui_input_1.Input, Object.assign({ className: allClassNames, onChange: handleChange, value: value }, restAttributes)));
|
|
46
46
|
};
|
|
47
|
+
const renderTextareaField = ({ config, value, onChange }) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const _b = (_a = config.attributes) !== null && _a !== void 0 ? _a : {}, { onChange: onAttributeChange, className } = _b, restAttributes = __rest(_b, ["onChange", "className"]);
|
|
50
|
+
const handleChange = (e) => {
|
|
51
|
+
onAttributeChange === null || onAttributeChange === void 0 ? void 0 : onAttributeChange(e);
|
|
52
|
+
onChange(e.target.value);
|
|
53
|
+
};
|
|
54
|
+
const allClassNames = (0, classnames_1.default)('w-60 my-2', className);
|
|
55
|
+
return (React.createElement(ui_input_1.InputTextArea, Object.assign({ className: allClassNames, onChange: handleChange, value: value, rows: 3 }, restAttributes)));
|
|
56
|
+
};
|
|
47
57
|
const renderSelectField = ({ config, value, onChange }) => {
|
|
48
58
|
const _a = config.attributes, { onChange: onAttributeChange, rootClassName } = _a, restAttributes = __rest(_a, ["onChange", "rootClassName"]);
|
|
49
59
|
const handleChange = (selectedValue, option) => {
|
|
@@ -55,6 +65,7 @@ const renderSelectField = ({ config, value, onChange }) => {
|
|
|
55
65
|
};
|
|
56
66
|
const FIELD_RENDERERS = {
|
|
57
67
|
[constants_1.EDIT_FIELD_TYPES.INPUT]: renderInputField,
|
|
68
|
+
[constants_1.EDIT_FIELD_TYPES.TEXTAREA]: renderTextareaField,
|
|
58
69
|
[constants_1.EDIT_FIELD_TYPES.SELECT]: renderSelectField
|
|
59
70
|
};
|
|
60
71
|
const renderEditField = ({ config, value, onChange }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputProps } from '@akinon/ui-input';
|
|
1
|
+
import type { InputProps, TextAreaProps } from '@akinon/ui-input';
|
|
2
2
|
import type { ModalProps } from '@akinon/ui-modal';
|
|
3
3
|
import type { SelectProps } from '@akinon/ui-select';
|
|
4
4
|
import { EDIT_FIELD_TYPES, MAPPER_ITEM_TYPES } from '../ai-table/constants';
|
|
@@ -61,11 +61,15 @@ export type EditDataIndexInput = EditDataIndexBase & {
|
|
|
61
61
|
type: typeof EDIT_FIELD_TYPES.INPUT;
|
|
62
62
|
attributes?: InputProps;
|
|
63
63
|
};
|
|
64
|
+
export type EditDataIndexTextarea = EditDataIndexBase & {
|
|
65
|
+
type: typeof EDIT_FIELD_TYPES.TEXTAREA;
|
|
66
|
+
attributes?: TextAreaProps;
|
|
67
|
+
};
|
|
64
68
|
export type EditDataIndexSelect = EditDataIndexBase & {
|
|
65
69
|
type: typeof EDIT_FIELD_TYPES.SELECT;
|
|
66
70
|
attributes: SelectProps;
|
|
67
71
|
};
|
|
68
|
-
export type EditDataIndexConfig = EditDataIndexInput | EditDataIndexSelect;
|
|
72
|
+
export type EditDataIndexConfig = EditDataIndexInput | EditDataIndexTextarea | EditDataIndexSelect;
|
|
69
73
|
export type EditDataIndex = string | EditDataIndexConfig;
|
|
70
74
|
export interface TableBaseProps {
|
|
71
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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AE5B;;OAEG;IACH,eAAe,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY,EAAE,UAAU;IACjE;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -28,6 +28,10 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
28
28
|
Input: (_a) => {
|
|
29
29
|
var { onChange, value, className } = _a, props = __rest(_a, ["onChange", "value", "className"]);
|
|
30
30
|
return (React.createElement("input", Object.assign({ onChange: onChange, value: value, className: className, "data-testid": "edit-input" }, props)));
|
|
31
|
+
},
|
|
32
|
+
InputTextArea: (_a) => {
|
|
33
|
+
var { onChange, value, className, rows, style } = _a, props = __rest(_a, ["onChange", "value", "className", "rows", "style"]);
|
|
34
|
+
return (React.createElement("textarea", Object.assign({ onChange: onChange, value: value, className: className, rows: rows, style: style, "data-testid": "edit-textarea" }, props)));
|
|
31
35
|
}
|
|
32
36
|
}));
|
|
33
37
|
vi.mock('@akinon/ui-select', () => ({
|
|
@@ -1356,6 +1360,71 @@ describe('TableContent', () => {
|
|
|
1356
1360
|
const inputs = screen.queryAllByTestId('edit-input');
|
|
1357
1361
|
expect(inputs.length).toBeGreaterThan(0);
|
|
1358
1362
|
});
|
|
1363
|
+
it('should render textarea for editable column when editDataIndexes has TEXTAREA config', async () => {
|
|
1364
|
+
const user = userEvent.setup();
|
|
1365
|
+
const onEdit = vi.fn();
|
|
1366
|
+
renderComponent({
|
|
1367
|
+
data: [
|
|
1368
|
+
{
|
|
1369
|
+
pk: 1,
|
|
1370
|
+
name: 'Item 1',
|
|
1371
|
+
description: 'Some long description text',
|
|
1372
|
+
mappings: []
|
|
1373
|
+
}
|
|
1374
|
+
],
|
|
1375
|
+
columns: [
|
|
1376
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1377
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1378
|
+
],
|
|
1379
|
+
mapperConfig: undefined,
|
|
1380
|
+
onEdit,
|
|
1381
|
+
editDataIndexes: [
|
|
1382
|
+
'name',
|
|
1383
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1384
|
+
]
|
|
1385
|
+
});
|
|
1386
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1387
|
+
await user.click(editButton);
|
|
1388
|
+
const inputs = screen.queryAllByTestId('edit-input');
|
|
1389
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1390
|
+
expect(inputs.length).toBeGreaterThan(0);
|
|
1391
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1392
|
+
expect(textareas[0]).toHaveValue('Some long description text');
|
|
1393
|
+
expect(textareas[0]).toHaveAttribute('rows', '3');
|
|
1394
|
+
});
|
|
1395
|
+
it('should call onEdit when textarea value changes in edit mode', async () => {
|
|
1396
|
+
const user = userEvent.setup();
|
|
1397
|
+
const onEdit = vi.fn();
|
|
1398
|
+
renderComponent({
|
|
1399
|
+
data: [
|
|
1400
|
+
{
|
|
1401
|
+
pk: 1,
|
|
1402
|
+
name: 'Item 1',
|
|
1403
|
+
description: 'Original description',
|
|
1404
|
+
mappings: []
|
|
1405
|
+
}
|
|
1406
|
+
],
|
|
1407
|
+
columns: [
|
|
1408
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1409
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1410
|
+
],
|
|
1411
|
+
mapperConfig: undefined,
|
|
1412
|
+
onEdit,
|
|
1413
|
+
editDataIndexes: [
|
|
1414
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1415
|
+
]
|
|
1416
|
+
});
|
|
1417
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1418
|
+
await user.click(editButton);
|
|
1419
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1420
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1421
|
+
fireEvent.change(textareas[0], {
|
|
1422
|
+
target: { value: 'Updated description' }
|
|
1423
|
+
});
|
|
1424
|
+
expect(onEdit).toHaveBeenCalledWith(1, {
|
|
1425
|
+
description: 'Updated description'
|
|
1426
|
+
});
|
|
1427
|
+
});
|
|
1359
1428
|
it('should render Select for editable column when editDataIndexes has SELECT config', async () => {
|
|
1360
1429
|
const user = userEvent.setup();
|
|
1361
1430
|
const onEdit = vi.fn();
|
|
@@ -33,6 +33,24 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
33
33
|
data-testid="edit-input"
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
|
+
),
|
|
37
|
+
InputTextArea: ({
|
|
38
|
+
onChange,
|
|
39
|
+
value,
|
|
40
|
+
className,
|
|
41
|
+
rows,
|
|
42
|
+
style,
|
|
43
|
+
...props
|
|
44
|
+
}: any) => (
|
|
45
|
+
<textarea
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
value={value}
|
|
48
|
+
className={className}
|
|
49
|
+
rows={rows}
|
|
50
|
+
style={style}
|
|
51
|
+
data-testid="edit-textarea"
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
36
54
|
)
|
|
37
55
|
}));
|
|
38
56
|
|
|
@@ -1659,6 +1677,79 @@ describe('TableContent', () => {
|
|
|
1659
1677
|
expect(inputs.length).toBeGreaterThan(0);
|
|
1660
1678
|
});
|
|
1661
1679
|
|
|
1680
|
+
it('should render textarea for editable column when editDataIndexes has TEXTAREA config', async () => {
|
|
1681
|
+
const user = userEvent.setup();
|
|
1682
|
+
const onEdit = vi.fn();
|
|
1683
|
+
|
|
1684
|
+
renderComponent({
|
|
1685
|
+
data: [
|
|
1686
|
+
{
|
|
1687
|
+
pk: 1,
|
|
1688
|
+
name: 'Item 1',
|
|
1689
|
+
description: 'Some long description text',
|
|
1690
|
+
mappings: []
|
|
1691
|
+
}
|
|
1692
|
+
],
|
|
1693
|
+
columns: [
|
|
1694
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1695
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1696
|
+
],
|
|
1697
|
+
mapperConfig: undefined,
|
|
1698
|
+
onEdit,
|
|
1699
|
+
editDataIndexes: [
|
|
1700
|
+
'name',
|
|
1701
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1702
|
+
]
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1706
|
+
await user.click(editButton);
|
|
1707
|
+
|
|
1708
|
+
const inputs = screen.queryAllByTestId('edit-input');
|
|
1709
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1710
|
+
expect(inputs.length).toBeGreaterThan(0);
|
|
1711
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1712
|
+
expect(textareas[0]).toHaveValue('Some long description text');
|
|
1713
|
+
expect(textareas[0]).toHaveAttribute('rows', '3');
|
|
1714
|
+
});
|
|
1715
|
+
|
|
1716
|
+
it('should call onEdit when textarea value changes in edit mode', async () => {
|
|
1717
|
+
const user = userEvent.setup();
|
|
1718
|
+
const onEdit = vi.fn();
|
|
1719
|
+
|
|
1720
|
+
renderComponent({
|
|
1721
|
+
data: [
|
|
1722
|
+
{
|
|
1723
|
+
pk: 1,
|
|
1724
|
+
name: 'Item 1',
|
|
1725
|
+
description: 'Original description',
|
|
1726
|
+
mappings: []
|
|
1727
|
+
}
|
|
1728
|
+
],
|
|
1729
|
+
columns: [
|
|
1730
|
+
{ title: 'Name', dataIndex: 'name' },
|
|
1731
|
+
{ title: 'Description', dataIndex: 'description' }
|
|
1732
|
+
],
|
|
1733
|
+
mapperConfig: undefined,
|
|
1734
|
+
onEdit,
|
|
1735
|
+
editDataIndexes: [
|
|
1736
|
+
{ key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA }
|
|
1737
|
+
]
|
|
1738
|
+
});
|
|
1739
|
+
|
|
1740
|
+
const editButton = screen.getByTestId('edit-button-1');
|
|
1741
|
+
await user.click(editButton);
|
|
1742
|
+
|
|
1743
|
+
const textareas = screen.queryAllByTestId('edit-textarea');
|
|
1744
|
+
expect(textareas.length).toBeGreaterThan(0);
|
|
1745
|
+
fireEvent.change(textareas[0], {
|
|
1746
|
+
target: { value: 'Updated description' }
|
|
1747
|
+
});
|
|
1748
|
+
expect(onEdit).toHaveBeenCalledWith(1, {
|
|
1749
|
+
description: 'Updated description'
|
|
1750
|
+
});
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1662
1753
|
it('should render Select for editable column when editDataIndexes has SELECT config', async () => {
|
|
1663
1754
|
const user = userEvent.setup();
|
|
1664
1755
|
const onEdit = vi.fn();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-table/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,iBAAiB;;;GAG3B,CAAC;AAEJ,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,wBAAwB,MAAO,CAAC;AAE7C,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-table/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,iBAAiB;;;GAG3B,CAAC;AAEJ,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,eAAO,MAAM,wBAAwB,MAAO,CAAC;AAE7C,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC"}
|
|
@@ -20,6 +20,10 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
20
20
|
Input: (_a) => {
|
|
21
21
|
var { value, onChange, className } = _a, props = __rest(_a, ["value", "onChange", "className"]);
|
|
22
22
|
return (React.createElement("input", Object.assign({ "data-testid": "edit-input", value: value, onChange: onChange, className: className }, props)));
|
|
23
|
+
},
|
|
24
|
+
InputTextArea: (_a) => {
|
|
25
|
+
var { value, onChange, className, rows, style } = _a, props = __rest(_a, ["value", "onChange", "className", "rows", "style"]);
|
|
26
|
+
return (React.createElement("textarea", Object.assign({ "data-testid": "edit-textarea", value: value, onChange: onChange, className: className, rows: rows, style: style }, props)));
|
|
23
27
|
}
|
|
24
28
|
}));
|
|
25
29
|
vi.mock('@akinon/ui-select', () => ({
|
|
@@ -67,6 +71,15 @@ describe('getEditFieldConfig', () => {
|
|
|
67
71
|
attributes: { placeholder: 'Value' }
|
|
68
72
|
});
|
|
69
73
|
});
|
|
74
|
+
it('returns config object when dataIndex matches object key (TEXTAREA)', () => {
|
|
75
|
+
const textareaConfig = {
|
|
76
|
+
key: 'description',
|
|
77
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
78
|
+
attributes: { placeholder: 'Enter description' }
|
|
79
|
+
};
|
|
80
|
+
const editDataIndexes = [textareaConfig];
|
|
81
|
+
expect(getEditFieldConfig(editDataIndexes, 'description')).toEqual(textareaConfig);
|
|
82
|
+
});
|
|
70
83
|
it('returns config object when dataIndex matches object key (SELECT)', () => {
|
|
71
84
|
const selectConfig = {
|
|
72
85
|
key: 'status',
|
|
@@ -215,4 +228,70 @@ describe('renderEditField', () => {
|
|
|
215
228
|
expect(screen.getByTestId('edit-input')).toBeInTheDocument();
|
|
216
229
|
expect(screen.getByTestId('edit-input')).toHaveValue('fallback');
|
|
217
230
|
});
|
|
231
|
+
it('renders textarea for TEXTAREA config', () => {
|
|
232
|
+
const onChange = vi.fn();
|
|
233
|
+
render(React.createElement(React.Fragment, null, renderEditField({
|
|
234
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
235
|
+
value: 'some text',
|
|
236
|
+
onChange
|
|
237
|
+
})));
|
|
238
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
239
|
+
expect(textarea).toBeInTheDocument();
|
|
240
|
+
expect(textarea).toHaveValue('some text');
|
|
241
|
+
});
|
|
242
|
+
it('renders textarea with 3 rows by default', () => {
|
|
243
|
+
render(React.createElement(React.Fragment, null, renderEditField({
|
|
244
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
245
|
+
value: '',
|
|
246
|
+
onChange: vi.fn()
|
|
247
|
+
})));
|
|
248
|
+
expect(screen.getByTestId('edit-textarea')).toHaveAttribute('rows', '3');
|
|
249
|
+
});
|
|
250
|
+
it('calls onChange with textarea value when textarea changes', () => {
|
|
251
|
+
const onChange = vi.fn();
|
|
252
|
+
render(React.createElement(React.Fragment, null, renderEditField({
|
|
253
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
254
|
+
value: '',
|
|
255
|
+
onChange
|
|
256
|
+
})));
|
|
257
|
+
fireEvent.change(screen.getByTestId('edit-textarea'), {
|
|
258
|
+
target: { value: 'updated text' }
|
|
259
|
+
});
|
|
260
|
+
expect(onChange).toHaveBeenCalledWith('updated text');
|
|
261
|
+
});
|
|
262
|
+
it('passes attributes to textarea (className, placeholder)', () => {
|
|
263
|
+
render(React.createElement(React.Fragment, null, renderEditField({
|
|
264
|
+
config: {
|
|
265
|
+
key: 'description',
|
|
266
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
267
|
+
attributes: {
|
|
268
|
+
className: 'custom-textarea',
|
|
269
|
+
placeholder: 'Enter description'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
value: '',
|
|
273
|
+
onChange: vi.fn()
|
|
274
|
+
})));
|
|
275
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
276
|
+
expect(textarea).toHaveClass('custom-textarea');
|
|
277
|
+
expect(textarea).toHaveAttribute('placeholder', 'Enter description');
|
|
278
|
+
});
|
|
279
|
+
it('calls attributes.onChange and then onChange when both provided for textarea', async () => {
|
|
280
|
+
const user = userEvent.setup();
|
|
281
|
+
const onAttributeChange = vi.fn();
|
|
282
|
+
const onChange = vi.fn();
|
|
283
|
+
render(React.createElement(React.Fragment, null, renderEditField({
|
|
284
|
+
config: {
|
|
285
|
+
key: 'description',
|
|
286
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
287
|
+
attributes: { onChange: onAttributeChange }
|
|
288
|
+
},
|
|
289
|
+
value: '',
|
|
290
|
+
onChange
|
|
291
|
+
})));
|
|
292
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
293
|
+
await user.type(textarea, 'x');
|
|
294
|
+
expect(onAttributeChange).toHaveBeenCalled();
|
|
295
|
+
expect(onChange).toHaveBeenCalled();
|
|
296
|
+
});
|
|
218
297
|
});
|
|
@@ -25,6 +25,30 @@ vi.mock('@akinon/ui-input', () => ({
|
|
|
25
25
|
className={className}
|
|
26
26
|
{...props}
|
|
27
27
|
/>
|
|
28
|
+
),
|
|
29
|
+
InputTextArea: ({
|
|
30
|
+
value,
|
|
31
|
+
onChange,
|
|
32
|
+
className,
|
|
33
|
+
rows,
|
|
34
|
+
style,
|
|
35
|
+
...props
|
|
36
|
+
}: {
|
|
37
|
+
value: string;
|
|
38
|
+
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
39
|
+
className?: string;
|
|
40
|
+
rows?: number;
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
}) => (
|
|
43
|
+
<textarea
|
|
44
|
+
data-testid="edit-textarea"
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
className={className}
|
|
48
|
+
rows={rows}
|
|
49
|
+
style={style}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
28
52
|
)
|
|
29
53
|
}));
|
|
30
54
|
|
|
@@ -90,6 +114,18 @@ describe('getEditFieldConfig', () => {
|
|
|
90
114
|
});
|
|
91
115
|
});
|
|
92
116
|
|
|
117
|
+
it('returns config object when dataIndex matches object key (TEXTAREA)', () => {
|
|
118
|
+
const textareaConfig = {
|
|
119
|
+
key: 'description',
|
|
120
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
121
|
+
attributes: { placeholder: 'Enter description' }
|
|
122
|
+
};
|
|
123
|
+
const editDataIndexes = [textareaConfig];
|
|
124
|
+
expect(getEditFieldConfig(editDataIndexes, 'description')).toEqual(
|
|
125
|
+
textareaConfig
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
93
129
|
it('returns config object when dataIndex matches object key (SELECT)', () => {
|
|
94
130
|
const selectConfig = {
|
|
95
131
|
key: 'status',
|
|
@@ -280,4 +316,95 @@ describe('renderEditField', () => {
|
|
|
280
316
|
expect(screen.getByTestId('edit-input')).toBeInTheDocument();
|
|
281
317
|
expect(screen.getByTestId('edit-input')).toHaveValue('fallback');
|
|
282
318
|
});
|
|
319
|
+
|
|
320
|
+
it('renders textarea for TEXTAREA config', () => {
|
|
321
|
+
const onChange = vi.fn();
|
|
322
|
+
render(
|
|
323
|
+
<>
|
|
324
|
+
{renderEditField({
|
|
325
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
326
|
+
value: 'some text',
|
|
327
|
+
onChange
|
|
328
|
+
})}
|
|
329
|
+
</>
|
|
330
|
+
);
|
|
331
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
332
|
+
expect(textarea).toBeInTheDocument();
|
|
333
|
+
expect(textarea).toHaveValue('some text');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('renders textarea with 3 rows by default', () => {
|
|
337
|
+
render(
|
|
338
|
+
<>
|
|
339
|
+
{renderEditField({
|
|
340
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
341
|
+
value: '',
|
|
342
|
+
onChange: vi.fn()
|
|
343
|
+
})}
|
|
344
|
+
</>
|
|
345
|
+
);
|
|
346
|
+
expect(screen.getByTestId('edit-textarea')).toHaveAttribute('rows', '3');
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('calls onChange with textarea value when textarea changes', () => {
|
|
350
|
+
const onChange = vi.fn();
|
|
351
|
+
render(
|
|
352
|
+
<>
|
|
353
|
+
{renderEditField({
|
|
354
|
+
config: { key: 'description', type: EDIT_FIELD_TYPES.TEXTAREA },
|
|
355
|
+
value: '',
|
|
356
|
+
onChange
|
|
357
|
+
})}
|
|
358
|
+
</>
|
|
359
|
+
);
|
|
360
|
+
fireEvent.change(screen.getByTestId('edit-textarea'), {
|
|
361
|
+
target: { value: 'updated text' }
|
|
362
|
+
});
|
|
363
|
+
expect(onChange).toHaveBeenCalledWith('updated text');
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('passes attributes to textarea (className, placeholder)', () => {
|
|
367
|
+
render(
|
|
368
|
+
<>
|
|
369
|
+
{renderEditField({
|
|
370
|
+
config: {
|
|
371
|
+
key: 'description',
|
|
372
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
373
|
+
attributes: {
|
|
374
|
+
className: 'custom-textarea',
|
|
375
|
+
placeholder: 'Enter description'
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
value: '',
|
|
379
|
+
onChange: vi.fn()
|
|
380
|
+
})}
|
|
381
|
+
</>
|
|
382
|
+
);
|
|
383
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
384
|
+
expect(textarea).toHaveClass('custom-textarea');
|
|
385
|
+
expect(textarea).toHaveAttribute('placeholder', 'Enter description');
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('calls attributes.onChange and then onChange when both provided for textarea', async () => {
|
|
389
|
+
const user = userEvent.setup();
|
|
390
|
+
const onAttributeChange = vi.fn();
|
|
391
|
+
const onChange = vi.fn();
|
|
392
|
+
render(
|
|
393
|
+
<>
|
|
394
|
+
{renderEditField({
|
|
395
|
+
config: {
|
|
396
|
+
key: 'description',
|
|
397
|
+
type: EDIT_FIELD_TYPES.TEXTAREA,
|
|
398
|
+
attributes: { onChange: onAttributeChange }
|
|
399
|
+
},
|
|
400
|
+
value: '',
|
|
401
|
+
onChange
|
|
402
|
+
})}
|
|
403
|
+
</>
|
|
404
|
+
);
|
|
405
|
+
const textarea = screen.getByTestId('edit-textarea');
|
|
406
|
+
await user.type(textarea, 'x');
|
|
407
|
+
expect(onAttributeChange).toHaveBeenCalled();
|
|
408
|
+
expect(onChange).toHaveBeenCalled();
|
|
409
|
+
});
|
|
283
410
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-table/utils/render-edit-fields/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai-table/utils/render-edit-fields/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,kBAAkB,GAAG,CACxB,eAAe,EAAE,aAAa,EAAE,EAChC,SAAS,EAAE,MAAM,KACd,mBAAmB,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,kBAAkB,EAAE,kBAmBhC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;AA6F1E,eAAO,MAAM,eAAe,EAAE,eAO7B,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { Input } from '@akinon/ui-input';
|
|
12
|
+
import { Input, InputTextArea } from '@akinon/ui-input';
|
|
13
13
|
import { Select } from '@akinon/ui-select';
|
|
14
14
|
import cn from 'classnames';
|
|
15
15
|
import * as React from 'react';
|
|
@@ -40,6 +40,16 @@ const renderInputField = ({ config, value, onChange }) => {
|
|
|
40
40
|
const allClassNames = cn('w-44 h-9', className);
|
|
41
41
|
return (React.createElement(Input, Object.assign({ className: allClassNames, onChange: handleChange, value: value }, restAttributes)));
|
|
42
42
|
};
|
|
43
|
+
const renderTextareaField = ({ config, value, onChange }) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const _b = (_a = config.attributes) !== null && _a !== void 0 ? _a : {}, { onChange: onAttributeChange, className } = _b, restAttributes = __rest(_b, ["onChange", "className"]);
|
|
46
|
+
const handleChange = (e) => {
|
|
47
|
+
onAttributeChange === null || onAttributeChange === void 0 ? void 0 : onAttributeChange(e);
|
|
48
|
+
onChange(e.target.value);
|
|
49
|
+
};
|
|
50
|
+
const allClassNames = cn('w-60 my-2', className);
|
|
51
|
+
return (React.createElement(InputTextArea, Object.assign({ className: allClassNames, onChange: handleChange, value: value, rows: 3 }, restAttributes)));
|
|
52
|
+
};
|
|
43
53
|
const renderSelectField = ({ config, value, onChange }) => {
|
|
44
54
|
const _a = config.attributes, { onChange: onAttributeChange, rootClassName } = _a, restAttributes = __rest(_a, ["onChange", "rootClassName"]);
|
|
45
55
|
const handleChange = (selectedValue, option) => {
|
|
@@ -51,6 +61,7 @@ const renderSelectField = ({ config, value, onChange }) => {
|
|
|
51
61
|
};
|
|
52
62
|
const FIELD_RENDERERS = {
|
|
53
63
|
[EDIT_FIELD_TYPES.INPUT]: renderInputField,
|
|
64
|
+
[EDIT_FIELD_TYPES.TEXTAREA]: renderTextareaField,
|
|
54
65
|
[EDIT_FIELD_TYPES.SELECT]: renderSelectField
|
|
55
66
|
};
|
|
56
67
|
export const renderEditField = ({ config, value, onChange }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputProps } from '@akinon/ui-input';
|
|
1
|
+
import type { InputProps, TextAreaProps } from '@akinon/ui-input';
|
|
2
2
|
import type { ModalProps } from '@akinon/ui-modal';
|
|
3
3
|
import type { SelectProps } from '@akinon/ui-select';
|
|
4
4
|
import { EDIT_FIELD_TYPES, MAPPER_ITEM_TYPES } from '../ai-table/constants';
|
|
@@ -61,11 +61,15 @@ export type EditDataIndexInput = EditDataIndexBase & {
|
|
|
61
61
|
type: typeof EDIT_FIELD_TYPES.INPUT;
|
|
62
62
|
attributes?: InputProps;
|
|
63
63
|
};
|
|
64
|
+
export type EditDataIndexTextarea = EditDataIndexBase & {
|
|
65
|
+
type: typeof EDIT_FIELD_TYPES.TEXTAREA;
|
|
66
|
+
attributes?: TextAreaProps;
|
|
67
|
+
};
|
|
64
68
|
export type EditDataIndexSelect = EditDataIndexBase & {
|
|
65
69
|
type: typeof EDIT_FIELD_TYPES.SELECT;
|
|
66
70
|
attributes: SelectProps;
|
|
67
71
|
};
|
|
68
|
-
export type EditDataIndexConfig = EditDataIndexInput | EditDataIndexSelect;
|
|
72
|
+
export type EditDataIndexConfig = EditDataIndexInput | EditDataIndexTextarea | EditDataIndexSelect;
|
|
69
73
|
export type EditDataIndex = string | EditDataIndexConfig;
|
|
70
74
|
export interface TableBaseProps {
|
|
71
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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