You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a web component intended to wrap a textarea where people would enter CSV encoded text. By wrapping the textarea element we provide a fallback should JavaScript be unavailable.
5
+
6
+
## Overview
7
+
8
+
The `CSVTextarea` web component is designed to create an interactive table from CSV data, allowing users to edit the data directly in the table. It supports features like appending rows, cleaning up empty rows, and converting table data to and from CSV format.
9
+
10
+
## Key Features
11
+
12
+
-**CSV Parsing**: Automatically parses CSV data into a table format.
13
+
-**Editable Table**: Allows users to edit table cells directly.
14
+
-**Row Management**: Provides functionality to append rows and clean up empty rows.
15
+
-**Autocomplete**: Supports autocomplete for table cells using `<datalist>` elements.
16
+
-**Event Handling**: Dispatches custom events for cell changes and focus.
17
+
18
+
## Attributes
19
+
20
+
-**`column-headings`**: A comma-separated string of column headings for the table.
21
+
-**`id`**: Sets the ID of the component.
22
+
-**`class`**: Sets the class of the component.
23
+
-**`caption`**: Sets a caption for the table.
24
+
-**`text`**: Sets the initial text content of the table.
25
+
-**`placeholder`**: Sets the placeholder text for input fields in the table.
26
+
-**`css-href`**: Links to an external CSS file for styling.
27
+
-**`debug`**: Enables debug mode, which logs additional information to the console.
28
+
-**`title`**: Sets a title for the help icon.
29
+
-**`help-description`**: Sets a description for the help icon.
30
+
31
+
## Usage
32
+
33
+
1.**Include the Component**: Ensure the component's JavaScript file is included in your HTML.
34
+
35
+
2.**HTML Structure**: Use the `<csv-textarea>` tag and include a `<textarea>` with CSV data inside it.
36
+
37
+
## Example
38
+
39
+
Here's an example of how to use the `CSVTextarea` component in an HTML file:
-**Component Tag**: The `<csv-textarea>` tag is used to define the component.
64
+
-**Column Headings**: The `column-headings` attribute specifies the headings for the table columns.
65
+
-**Debug Mode**: The `debug` attribute enables debug mode, which logs additional information to the console.
66
+
-**Textarea**: The `<textarea>` inside the component contains the initial CSV data.
67
+
68
+
## Customization
69
+
70
+
-**Styling**: You can customize the styles by modifying the CSS in the `initializeComponent` method or by linking to an external CSS file using the `css-href` attribute.
71
+
-**Autocomplete**: Use `<datalist>` elements to provide autocomplete options for table cells.
72
+
-**Event Listeners**: Customize event listeners in the `setupEventListeners` method to handle specific interactions.
73
+
74
+
## Conclusion
75
+
76
+
The `CSVTextarea` component simplifies the creation of editable tables from CSV data, making it easier to manage and interact with tabular data in web applications. By following the usage guidelines and customizing as needed, you can integrate this component into your web projects seamlessly.
0 commit comments