You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

simple-datatables

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-datatables - npm Package Compare versions

Comparing version

to
8.0.1

6

dist/dts/types.d.ts

@@ -56,3 +56,3 @@ interface elementNodeType {

*/
caseFirst?: string;
caseFirst?: "false" | "upper" | "lower";
/**When set to true the column(s) will not be visible and will be excluded from search results. */

@@ -339,3 +339,3 @@ hidden?: boolean;

numeric: boolean;
caseFirst: string;
caseFirst: "false" | "upper" | "lower";
tabIndex: false | number;

@@ -372,3 +372,3 @@ /**

numeric?: boolean;
caseFirst?: string;
caseFirst?: "false" | "upper" | "lower";
searchable?: boolean;

@@ -375,0 +375,0 @@ sensitivity?: string;

@@ -58,3 +58,3 @@ import { DiffDOM } from 'diff-dom';

*/
caseFirst?: string;
caseFirst?: "false" | "upper" | "lower";
/**When set to true the column(s) will not be visible and will be excluded from search results. */

@@ -341,3 +341,3 @@ hidden?: boolean;

numeric: boolean;
caseFirst: string;
caseFirst: "false" | "upper" | "lower";
tabIndex: false | number;

@@ -374,3 +374,3 @@ /**

numeric?: boolean;
caseFirst?: string;
caseFirst?: "false" | "upper" | "lower";
searchable?: boolean;

@@ -377,0 +377,0 @@ sensitivity?: string;

@@ -126,3 +126,3 @@ >Please note that the API is not finalised and may change so check back once in while.

Returns then number of pages.
Returns the number of pages.

@@ -129,0 +129,0 @@ ---

@@ -26,3 +26,3 @@ As of `v1.4.0`, the `rows` API is implemented and allows access to the table rows for quick manipulation.

As of `v1.4.5`, you can also pass a nested `array` of data for adding multiple rows at once:
**Note:** Only one row can be added at a time. If you want to add multiple rows simultaneously, do this instead:

@@ -38,6 +38,5 @@ ```javascript

datatable.rows.add(newRows);
datatable.insert({data: newRows})
```
```
---

@@ -44,0 +43,0 @@

@@ -235,2 +235,32 @@ ### Upgrading

* `dataTable.rows.add()` can no longer be used to add multiple rows. Use `dataTable.insert()` instead.
Instead of:
```js
...
let newRows = [
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
...
];
dataTable.rows.add(newRows);
```
do now:
```js
...
let newRows = [
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
["column1", "column2", "column3", "column4", ...],
...
];
dataTable.insert({data: newRows});
```
## From 4.0.x to 5.0:

@@ -237,0 +267,0 @@

{
"name": "simple-datatables",
"version": "8.0.0",
"version": "8.0.1",
"description": "A lightweight, dependency-free JavaScript HTML table plugin.",

@@ -10,2 +10,3 @@ "main": "dist/index.js",

"module": "dist/module.js",
"style": "dist/style.css",
"scripts": {

@@ -47,35 +48,33 @@ "test": "mocha",

"devDependencies": {
"@babel/core": "^7.20.12",
"@html-eslint/eslint-plugin": "^0.15.0",
"@html-eslint/parser": "^0.15.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.0",
"@babel/core": "^7.23.3",
"@html-eslint/eslint-plugin": "^0.20.0",
"@html-eslint/parser": "^0.20.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.3.0",
"@rollup/plugin-typescript": "^11.0.0",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/node": "^20.9.1",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"browserify": "^17.0.0",
"chromedriver": "*",
"eslint": "^8.31.0",
"eslint-plugin-htm": "^0.5.2",
"eslint": "^8.53.0",
"eslint-plugin-htm": "^0.6.0",
"eslint-plugin-html": "^7.1.0",
"express": "^4.18.2",
"get-port": "^6.1.2",
"get-port": "^7.0.0",
"mocha": "^10.2.0",
"mocha-each": "^2.0.1",
"pre-commit": "^1.2.2",
"rollup": "^3.9.1",
"rollup-plugin-dts": "^5.1.1",
"rollup-plugin-polyfill-node": "^0.11.0",
"selenium-webdriver": "^4.11.1",
"rollup": "^4.4.1",
"rollup-plugin-dts": "^6.1.0",
"selenium-webdriver": "^4.15.0",
"shx": "^0.3.4",
"tslib": "^2.4.1",
"typescript": "^4.9.4"
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"dayjs": "^1.11.7",
"diff-dom": "^5.0.6"
"dayjs": "^1.11.10",
"diff-dom": "^5.1.2"
}
}

@@ -21,3 +21,7 @@ import {

columnSelectors.forEach((selector: number) => {
if (!columns[selector]) {
if (columns[selector]) {
if (data.type) {
columns[selector].type = data.type
}
} else {
columns[selector] = {

@@ -24,0 +28,0 @@ type: data.type || defaultType,

@@ -245,7 +245,5 @@ import {

} else {
const inputs = (Array.from(this.modalDOM.querySelectorAll(`input.${this.options.classes.input}[type=text]`)) as HTMLInputElement[])
this.saveRow(inputs.map(input => input.value.trim()), this.data.row)
const values = (Array.from(this.modalDOM.querySelectorAll(`input.${this.options.classes.input}[type=text]`)) as HTMLInputElement[]).map(input => input.value.trim())
this.saveRow(values, this.data.row)
}
}

@@ -259,4 +257,4 @@ } else if (this.editing && this.data) {

} else if (this.editingRow) {
const inputs = (Array.from(this.dt.wrapperDOM.querySelectorAll(`input.${this.options.classes.input}[type=text]`)) as HTMLInputElement[])
this.saveRow(inputs.map(input => input.value.trim()), this.data.row)
const values = (Array.from(this.dt.wrapperDOM.querySelectorAll(`input.${this.options.classes.input}[type=text]`)) as HTMLInputElement[]).map(input => input.value.trim())
this.saveRow(values, this.data.row)
}

@@ -483,4 +481,2 @@ } else if (event.key === "Escape") {

const inputs = Array.from(form.querySelectorAll(`input.${this.options.classes.input}[type=text]`)) as HTMLInputElement[]
// Remove save button
inputs.pop()

@@ -499,3 +495,4 @@ // Close / save

// Save
this.saveRow(inputs.map((input: HTMLInputElement) => input.value.trim()), this.data.row)
const values = inputs.map((input: HTMLInputElement) => input.value.trim())
this.saveRow(values, this.data.row)
}

@@ -515,15 +512,14 @@ })

if (data) {
this.dt.data.data[this.data.rowIndex] = this.dt.data.data[this.data.rowIndex].map((oldCell, colIndex) => {
const columnSetting = this.dt.columns.settings[colIndex]
if (columnSetting.hidden || this.options.excludeColumns.includes(colIndex)) {
return oldCell
let valueCounter = 0
this.dt.data.data[this.data.rowIndex] = row.map((oldItem, colIndex) => {
if (this.options.excludeColumns.includes(colIndex) || this.dt.columns.settings[colIndex].hidden) {
return oldItem
}
const type = this.dt.columns.settings[colIndex].type || this.dt.options.type
const value = data[columnToVisibleIndex(colIndex, this.dt.columns.settings)]
const stringValue = value.trim()
const value = data[valueCounter++]
let cell
if (type === "number") {
cell = {data: parseFloat(stringValue)}
cell = {data: parseFloat(value)}
} else if (type === "boolean") {
if (["", "false", "0"].includes(stringValue)) {
if (["", "false", "0"].includes(value)) {
cell = {data: false,

@@ -538,8 +534,10 @@ text: "false",

} else if (type === "html") {
cell = {data: [
{nodeName: "#text",
data: value}
],
text: value,
order: value}
cell = {
data: [
{nodeName: "#text",
data: value}
],
text: value,
order: value
}
} else if (type === "string") {

@@ -555,2 +553,3 @@ cell = {data: value}

return cell
})

@@ -557,0 +556,0 @@ }

@@ -75,3 +75,3 @@ // Same definitions as in diff-dom

*/
caseFirst?: string,
caseFirst?: "false" | "upper" | "lower",

@@ -389,3 +389,3 @@ /**When set to true the column(s) will not be visible and will be excluded from search results. */

numeric: boolean;
caseFirst: string;
caseFirst: "false" | "upper" | "lower";

@@ -431,3 +431,3 @@ tabIndex: false | number;

numeric?: boolean,
caseFirst?: string,
caseFirst?: "false" | "upper" | "lower",
// for searching

@@ -434,0 +434,0 @@ searchable?: boolean,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet