@ctablex/core
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -1,3 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { ComponentProps } from 'react'; | ||
@@ -7,2 +5,3 @@ import { ComponentType } from 'react'; | ||
import { ElementType } from 'react'; | ||
import { JSX as JSX_2 } from 'react/jsx-runtime'; | ||
import { PropsWithChildren } from 'react'; | ||
@@ -14,3 +13,5 @@ import { ReactElement } from 'react'; | ||
export declare function ArrayOutput<V>(props: ArrayOutputProps<V>): JSX.Element; | ||
export declare function ArrayOutput<V>( | ||
props: ArrayOutputProps<V>, | ||
): JSX_2.Element; | ||
@@ -29,3 +30,3 @@ declare interface ArrayOutputOwnProps<V> { | ||
A extends Accessor<any, any> = Accessor<any, any>, | ||
>(props: CellProps<C, A>): JSX.Element; | ||
>(props: CellProps<C, A>): JSX_2.Element; | ||
@@ -46,3 +47,3 @@ declare interface CellOwnProps< | ||
export declare function Children(props: ChildrenProps): JSX.Element; | ||
export declare function Children(props: ChildrenProps): JSX_2.Element; | ||
@@ -57,3 +58,3 @@ declare type ChildrenContextType = ReactNode; | ||
props: ChildrenProviderProps, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -71,3 +72,3 @@ declare interface ChildrenProviderOwnProps { | ||
A extends Accessor<any, any> = Accessor<any, any>, | ||
>(props: ColumnProps<C, H, A>): JSX.Element; | ||
>(props: ColumnProps<C, H, A>): JSX_2.Element; | ||
@@ -93,3 +94,3 @@ declare interface ColumnOwnProps< | ||
export declare function Columns(props: ColumnsProps): JSX.Element | null; | ||
export declare function Columns(props: ColumnsProps): JSX_2.Element | null; | ||
@@ -112,3 +113,3 @@ export declare namespace Columns { | ||
props: ColumnsProviderProps, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -122,3 +123,3 @@ declare interface ColumnsProviderOwnProps { | ||
export declare interface ColumnsType<D extends object = {}> { | ||
export declare interface ColumnsType { | ||
__COLUMNS__: true; | ||
@@ -133,3 +134,3 @@ } | ||
props: ContentProviderProps<V>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -146,3 +147,3 @@ declare interface ContentProviderOwnProps<V> { | ||
props: ContentValueProps<D, C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -165,3 +166,3 @@ declare interface ContentValueOwnProps<D, C> { | ||
props: CurrentValueProviderProps<V>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -178,3 +179,3 @@ export declare type CurrentValueProviderProps<V> = PropsWithChildren< | ||
props: DataProviderProps<D>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -189,3 +190,3 @@ declare interface DataProviderOwnProps<D> { | ||
export declare function DataTable<D>(props: DataTableProps<D>): JSX.Element; | ||
export declare function DataTable<D>(props: DataTableProps<D>): JSX_2.Element; | ||
@@ -198,19 +199,16 @@ declare interface DataTableOwnProps<D> { | ||
export declare function DefaultContent<D>( | ||
props: DefaultContentProps<D>, | ||
): JSX.Element; | ||
export declare function DefaultContent( | ||
props: DefaultContentProps, | ||
): JSX_2.Element; | ||
declare interface DefaultContentOwnProps<D> {} | ||
declare interface DefaultContentOwnProps {} | ||
export declare type DefaultContentProps<D> = PropsWithChildren< | ||
DefaultContentOwnProps<D> | ||
>; | ||
export declare type DefaultContentProps = | ||
PropsWithChildren<DefaultContentOwnProps>; | ||
export declare const defaultTableComponents: TableComponents; | ||
export declare function findColumns<D extends object = {}>( | ||
children: ReactNode, | ||
): ReactNode; | ||
export declare function findColumns(children: ReactNode): ReactNode; | ||
export declare function getValue<D, C>(data: D, accessor: null): null; | ||
export declare function getValue<D>(data: D, accessor: null): null; | ||
@@ -226,3 +224,3 @@ export declare function getValue<D, C>(data: D, accessor: Accessor<D, C>): C; | ||
props: HeaderCellProps<C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -239,3 +237,3 @@ declare interface HeaderCellOwnProps<C extends ComponentType> { | ||
props: HeaderRowProps<C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -255,3 +253,3 @@ declare interface HeaderRowOwnProps<C extends ComponentType> { | ||
export declare function IndexProvider(props: IndexProviderProps): JSX.Element; | ||
export declare function IndexProvider(props: IndexProviderProps): JSX_2.Element; | ||
@@ -265,5 +263,3 @@ declare interface IndexProviderOwnProps { | ||
export declare function isColumnsType<D extends object = {}>( | ||
type: any, | ||
): type is ColumnsType<D>; | ||
export declare function isColumnsType(type: any): type is ColumnsType; | ||
@@ -276,3 +272,3 @@ declare interface ItemProviderOwnProps<V> { | ||
props: RowProps<D, C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -285,3 +281,3 @@ export declare type RowData<V> = V; | ||
props: RowDataProviderProps<V>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -306,3 +302,3 @@ declare interface RowDataProviderOwnProps<V> { | ||
export declare function Rows<D>(props: RowsProps<D>): JSX.Element; | ||
export declare function Rows<D>(props: RowsProps<D>): JSX_2.Element; | ||
@@ -318,9 +314,9 @@ declare interface RowsOwnProps<D> { | ||
props: TableProps<C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
export declare function TableBody<D, C extends ComponentType = ComponentType>( | ||
props: TableBodyProps<D, C>, | ||
): JSX.Element; | ||
export declare function TableBody<C extends ComponentType = ComponentType>( | ||
props: TableBodyProps<C>, | ||
): JSX_2.Element; | ||
declare interface TableBodyOwnProps<D, C extends ComponentType> { | ||
declare interface TableBodyOwnProps<C extends ComponentType> { | ||
TbodyProps?: Partial<ComponentProps<C>>; | ||
@@ -330,6 +326,5 @@ tbodyEl?: ReactElement; | ||
export declare type TableBodyProps< | ||
D, | ||
C extends ComponentType, | ||
> = PropsWithChildren<TableBodyOwnProps<D, C>>; | ||
export declare type TableBodyProps<C extends ComponentType> = PropsWithChildren< | ||
TableBodyOwnProps<C> | ||
>; | ||
@@ -349,3 +344,3 @@ export declare interface TableComponents { | ||
props: TableComponentsProviderProps, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -372,3 +367,3 @@ declare interface TableComponentsProviderOwnProps { | ||
props: TableElementsProviderProps, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -384,3 +379,3 @@ declare interface TableElementsProviderOwnProps { | ||
props: TableHeaderProps<C>, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -406,3 +401,3 @@ declare interface TableHeaderOwnProps<C extends ComponentType> { | ||
props: TablePartProviderProps, | ||
): JSX.Element; | ||
): JSX_2.Element; | ||
@@ -424,3 +419,3 @@ declare interface TablePartProviderOwnProps { | ||
export declare function UseColumns(props: UseColumnsProps): JSX.Element; | ||
export declare function UseColumns(props: UseColumnsProps): JSX_2.Element; | ||
@@ -437,3 +432,3 @@ export declare function useColumns(): ColumnsNode; | ||
export declare function useContentValue<D, C>(accessor: null): null; | ||
export declare function useContentValue(accessor: null): null; | ||
@@ -440,0 +435,0 @@ export declare function useContentValue<D, C>(accessor: Accessor<D, C>): C; |
105
package.json
{ | ||
"name": "@ctablex/core", | ||
"description": "Flexible and powerful react table", | ||
"version": "0.4.1", | ||
"license": "MIT", | ||
"main": "lib/ctablex.js", | ||
"unpkg": "dist/ctablex.js", | ||
"module": "es/ctablex.js", | ||
"typings": "./index.d.ts", | ||
"version": "0.5.0", | ||
"files": [ | ||
"src", | ||
"dist", | ||
"lib", | ||
"es", | ||
"src", | ||
"index.d.ts", | ||
"tsdoc-metadata.json" | ||
], | ||
"keywords": [ | ||
"react", | ||
"table", | ||
"ctablex", | ||
"react-table", | ||
"datagrid" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
"license": "MIT", | ||
"type": "module", | ||
"typings": "./index.d.ts", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ctablex/core" | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
"prepare": "husky install", | ||
"build": "libton-script build", | ||
"build:doc": "libton-script doc", | ||
"toc": "markdown-toc -i README.md", | ||
"test": "libton-script test --coverage --verbose", | ||
"lint": "libton-script lint && eslint --max-warnings=0 examples/**/*.{ts,tsx}", | ||
"format": "libton-script format", | ||
"format:check": "libton-script format --check", | ||
"validate": "libton-script lint && libton-script format --check && libton-script test --coverage --verbose", | ||
"prepublishOnly": "yarn validate && yarn build", | ||
"release": "standard-version" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^12.1.1", | ||
"@commitlint/config-conventional": "^12.1.1", | ||
"@testing-library/jest-dom": "^5.11.10", | ||
"@testing-library/react": "^11.2.6", | ||
"@types/jest": "26.0.22", | ||
"@types/react": "^17.0.3", | ||
"@types/testing-library__jest-dom": "^5.9.5", | ||
"husky": "^6.0.0", | ||
"libton-script": "^0.12.8", | ||
"lint-staged": "10.5.4", | ||
"@changesets/cli": "^2.27.7", | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@microsoft/api-extractor": "^7", | ||
"@testing-library/dom": "^10", | ||
"@testing-library/jest-dom": "^6", | ||
"@testing-library/react": "^16", | ||
"@testing-library/user-event": "^14", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"@vitejs/plugin-react": "^4", | ||
"@vitest/coverage-istanbul": "^2", | ||
"eslint": "^8", | ||
"eslint-config-react-app": "^7", | ||
"husky": "^9", | ||
"jsdom": "^24", | ||
"lint-staged": "^15", | ||
"markdown-toc": "^1.2.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"standard-version": "^9.2.0" | ||
"prettier": "^3", | ||
"react": "^18", | ||
"react-dom": "^18", | ||
"typescript": "^5", | ||
"vite": "^5", | ||
"vite-plugin-dts": "^3", | ||
"vitest": "^2" | ||
}, | ||
"peerDependencies": { | ||
"@types/react": "^16.9.38", | ||
"react": "^16.9.0" | ||
"react": "^17", | ||
"react-dom": "^17" | ||
}, | ||
"scripts": { | ||
"pre-commit": "tsc && lint-staged && pnpm lint", | ||
"lint": "eslint --max-warnings=0 src/**/*.{ts,tsx}", | ||
"toc": "markdown-toc -i README.md", | ||
"format": "prettier --write '**/*.{js,jsx,ts,tsx,json,yml,css,scss,md}'", | ||
"format:check": "prettier --check '**/*.{js,jsx,ts,tsx,json,yml,css,scss,md}'", | ||
"test": "vitest --run --coverage", | ||
"test:watch": "vitest", | ||
"build:dts": "api-extractor run --local --verbose && prettier --write index.d.ts", | ||
"build": "tsc && vite build && pnpm build:dts" | ||
} | ||
} | ||
} |
@@ -5,3 +5,3 @@ # ctablex | ||
[![NPM downloads](https://badgen.net/npm/dm/@ctablex/core)](https://npmjs.com/package/@ctablex/core) | ||
[![codecov](https://codecov.io/gh/ctablex/core/branch/master/graph/badge.svg)](https://codecov.io/gh/ctablex/core) | ||
[![codecov](https://codecov.io/gh/ctablex/core/branch/main/graph/badge.svg)](https://codecov.io/gh/ctablex/core) | ||
@@ -14,2 +14,6 @@ Featureable, flexible and powerful react table. `ctablex` will not hold you back and let you customize table UI and behavior. `ctablex` name is the combination of `table` and `ctx` (context). | ||
- [Usage](#usage) | ||
- [The `Table` component](#the-table-component) | ||
- [The `Columns` component](#the-columns-component) | ||
- [Changelog](#changelog) | ||
- [License](#license) | ||
@@ -68,3 +72,3 @@ <!-- tocstop --> | ||
[live demo](https://codesandbox.io/s/github/ctablex/core/tree/master/examples/basic?file=/src/BasicTable.tsx), [source code](https://github.com/ctablex/core/tree/master/examples/basic) | ||
[live demo](https://codesandbox.io/s/github/ctablex/core/tree/main/examples/basic?file=/src/BasicTable.tsx), [source code](https://github.com/ctablex/core/tree/main/examples/basic) | ||
@@ -133,6 +137,6 @@ ### The `Table` component | ||
Please read the changelog [here](https://github.com/ctablex/core/blob/master/CHANGELOG.md). | ||
Please read the changelog [here](https://github.com/ctablex/core/blob/main/CHANGELOG.md). | ||
## License | ||
This project is licensed under the terms of the [Apache License 2.0](https://github.com/ctablex/core/blob/master/LICENSE). | ||
This project is licensed under the terms of the [Apache License 2.0](https://github.com/ctablex/core/blob/main/LICENSE). |
@@ -1,9 +0,7 @@ | ||
export interface ColumnsType<D extends object = {}> { | ||
export interface ColumnsType { | ||
__COLUMNS__: true; | ||
} | ||
export function isColumnsType<D extends object = {}>( | ||
type: any, | ||
): type is ColumnsType<D> { | ||
export function isColumnsType(type: any): type is ColumnsType { | ||
return Boolean(type && type.__COLUMNS__); | ||
} |
@@ -5,3 +5,3 @@ import { useRowData } from '../row/RowDataContext'; | ||
export function useContentValue<D, C>(accessor: null): null; | ||
export function useContentValue(accessor: null): null; | ||
export function useContentValue<D, C>(accessor: Accessor<D, C>): C; | ||
@@ -8,0 +8,0 @@ export function useContentValue<D, C>( |
@@ -70,1 +70,41 @@ export { DataTable } from './data/DataTable'; | ||
export { withDefaultChildren } from './children/with-default-children'; | ||
export type { | ||
TableComponents, | ||
TableComponentsProviderProps, | ||
} from './TableComponentsContext'; | ||
export type { | ||
CurrentValue, | ||
CurrentValueProviderProps, | ||
} from './array/CurrentValueContext'; | ||
export type { Index, IndexProviderProps } from './array/IndexContext'; | ||
export type { Content, ContentProviderProps } from './content/ContentContext'; | ||
export type { | ||
ColumnsNode, | ||
ColumnsProviderProps, | ||
} from './column/ColumnsContext'; | ||
export type { ColumnsType } from './column/ColumnsType'; | ||
export type { Data, DataProviderProps } from './data/DataContext'; | ||
export type { RowData, RowDataProviderProps } from './row/RowDataContext'; | ||
export type { | ||
TablePart, | ||
TablePartType, | ||
TablePartProviderProps, | ||
} from './table/TablePartContext'; | ||
export type { Accessor } from './utils/accessor'; | ||
export type { ArrayOutputProps } from './array/ArrayOutput'; | ||
export type { CellProps } from './cell/Cell'; | ||
export type { ColumnProps } from './column/Column'; | ||
export type { ColumnsProps } from './column/Columns'; | ||
export type { UseColumnsProps } from './column/UseColumns'; | ||
export type { ContentValueProps } from './content/ContentValue'; | ||
export type { DataTableProps } from './data/DataTable'; | ||
export type { DefaultContentProps } from './content/DefaultContent'; | ||
export type { HeaderCellProps } from './header/HeaderCell'; | ||
export type { HeaderRowProps } from './header/HeaderRow'; | ||
export type { RowProps } from './row/Row'; | ||
export type { RowsProps } from './row/Rows'; | ||
export type { TableBodyProps } from './table/TableBody'; | ||
export type { TableHeaderProps } from './header/TableHeader'; | ||
export type { TableProps } from './table/Table'; |
@@ -13,3 +13,3 @@ import React, { ReactElement } from 'react'; | ||
} | ||
/* istanbul ignore else */ | ||
/* istanbul ignore else -- @preserve */ | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -16,0 +16,0 @@ const key = `${names.prop},${names.el}`; |
import { Accessor } from './accessor'; | ||
import { path } from './path'; | ||
export function getValue<D, C>(data: D, accessor: null): null; | ||
export function getValue<D>(data: D, accessor: null): null; | ||
export function getValue<D, C>(data: D, accessor: Accessor<D, C>): C; | ||
@@ -6,0 +6,0 @@ export function getValue<D, C>( |
@@ -0,1 +1,2 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { path } from './path'; | ||
@@ -2,0 +3,0 @@ |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
139
Yes
130534
26
48
3038
7