neko-ui 2.1.2 → 2.2.0
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/README.md +1 -1
- package/lib/index.d.ts +9 -3
- package/lib/index.js +1 -1
- package/lib/pagination/index.d.ts +37 -0
- package/lib/pagination/styles.d.ts +1 -0
- package/lib/table/index.d.ts +85 -1
- package/lib/table/styles.d.ts +1 -0
- package/package.json +11 -8
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type JSXElement } from 'solid-js';
|
|
2
|
+
import type { BasicConfig } from '..';
|
|
3
|
+
declare function Pagination(_: PaginationProps): import("solid-js").JSX.Element;
|
|
4
|
+
/** API */
|
|
5
|
+
export interface PaginationProps {
|
|
6
|
+
/** 自定义类名 */
|
|
7
|
+
class?: string;
|
|
8
|
+
/** 自定义类名 */
|
|
9
|
+
css?: string;
|
|
10
|
+
/** 当前页数
|
|
11
|
+
* @default 1
|
|
12
|
+
*/
|
|
13
|
+
page?: number;
|
|
14
|
+
/** 每页显示的数据条目数量
|
|
15
|
+
* @default 20
|
|
16
|
+
*/
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
/** 总数
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
21
|
+
total?: number;
|
|
22
|
+
/** 尺寸
|
|
23
|
+
* @default 'normal'
|
|
24
|
+
*/
|
|
25
|
+
size?: BasicConfig['size'];
|
|
26
|
+
/** 用于显示数据总量和当前数据顺序;
|
|
27
|
+
* 支持直接赋值给 'totalText' 属性
|
|
28
|
+
* 或者通过[slot="total-text"]插槽
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
totalText?: ((total: number, range: [start: number, end: number]) => JSXElement) | false;
|
|
32
|
+
/** 值修改时的回调方法 */
|
|
33
|
+
onChange?(page: number, pageSize: number): void;
|
|
34
|
+
children?: JSXElement;
|
|
35
|
+
}
|
|
36
|
+
export type PaginationElement = CustomElement<PaginationProps>;
|
|
37
|
+
export default Pagination;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: string;
|
package/lib/table/index.d.ts
CHANGED
|
@@ -1,14 +1,98 @@
|
|
|
1
|
+
import { type JSXElement } from 'solid-js';
|
|
2
|
+
import type { BasicConfig, PaginationProps } from '..';
|
|
1
3
|
declare function Table(_: TableProps): import("solid-js").JSX.Element;
|
|
4
|
+
interface Column<T extends Record<string, Any>> extends Cell {
|
|
5
|
+
/** 自定义取值的 key */
|
|
6
|
+
key?: keyof T;
|
|
7
|
+
/** 原始 key */
|
|
8
|
+
originKey?: keyof T;
|
|
9
|
+
/** 单元格表头标题 */
|
|
10
|
+
label?: JSXElement;
|
|
11
|
+
/** 自定义渲染单元格 */
|
|
12
|
+
render?(item: T[keyof T], row: T, index: number): JSXElement;
|
|
13
|
+
/** 单元格横跨的列数 */
|
|
14
|
+
colspan?: number;
|
|
15
|
+
/** 单元格横跨的行数 */
|
|
16
|
+
rowspan?: number;
|
|
17
|
+
/** 设置为 'order' 时则当作序号行 */
|
|
18
|
+
type?: 'order';
|
|
19
|
+
/** 单元格宽 */
|
|
20
|
+
width?: number;
|
|
21
|
+
}
|
|
2
22
|
/** API
|
|
3
23
|
* @since 2.1.0
|
|
4
24
|
*/
|
|
5
|
-
export interface TableProps {
|
|
25
|
+
export interface TableProps<T extends Record<string, Any> = Record<string, Any>> extends Cell {
|
|
6
26
|
/** 自定义类名 */
|
|
7
27
|
class?: string;
|
|
8
28
|
/** 自定义类名 */
|
|
9
29
|
css?: string;
|
|
10
30
|
/** 加载中 */
|
|
11
31
|
loading?: boolean;
|
|
32
|
+
/** 单元格值为 null 或 undefined 时的回填
|
|
33
|
+
* @default '-'
|
|
34
|
+
*/
|
|
35
|
+
emptyVal?: string;
|
|
36
|
+
/** 单元格配置 */
|
|
37
|
+
columns: Record<string, Column<T> | string>;
|
|
38
|
+
/** 数据源 */
|
|
39
|
+
data: T[];
|
|
40
|
+
/** 表格标题, 支持直接赋值给 'title' 属性, 或者通过[slot="title"]插槽 */
|
|
41
|
+
title?: JSXElement | 'slot';
|
|
42
|
+
/** 汇总行 */
|
|
43
|
+
summary?: (keyof T)[];
|
|
44
|
+
/** 汇总行描述
|
|
45
|
+
* @default '合计'
|
|
46
|
+
*/
|
|
47
|
+
summaryText?: JSXElement;
|
|
48
|
+
/** 分页器
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
pagination?: PaginationProps | false;
|
|
52
|
+
/** 尺寸
|
|
53
|
+
* @default 'normal'
|
|
54
|
+
*/
|
|
55
|
+
size?: BasicConfig['size'];
|
|
56
|
+
children?: JSXElement;
|
|
57
|
+
}
|
|
58
|
+
/** 单元格布局排列 */
|
|
59
|
+
interface Cell {
|
|
60
|
+
/** 单元格内容的水平对齐方式
|
|
61
|
+
* @default 'left'
|
|
62
|
+
*/
|
|
63
|
+
align?: keyof typeof Align;
|
|
64
|
+
/** 规定根据哪个字符来进行文本对齐 */
|
|
65
|
+
char?: string;
|
|
66
|
+
/** 规定第一个对齐字符的偏移量 */
|
|
67
|
+
charoff?: number;
|
|
68
|
+
/** 单元格内容的垂直对齐方式
|
|
69
|
+
* @default 'middle'
|
|
70
|
+
*/
|
|
71
|
+
valign?: keyof typeof Valign;
|
|
72
|
+
}
|
|
73
|
+
/** 水平对齐方式 */
|
|
74
|
+
declare enum Align {
|
|
75
|
+
/** 左对齐 */
|
|
76
|
+
left = "left",
|
|
77
|
+
/** 右对齐 */
|
|
78
|
+
right = "right",
|
|
79
|
+
/** 居中对齐 */
|
|
80
|
+
center = "center",
|
|
81
|
+
/** 对行进行伸展,这样每行都可以有相等的长度 */
|
|
82
|
+
justify = "justify",
|
|
83
|
+
/** 将内容对准指定字符 */
|
|
84
|
+
char = "char"
|
|
85
|
+
}
|
|
86
|
+
/** 垂直对齐方式 */
|
|
87
|
+
declare enum Valign {
|
|
88
|
+
/** 上对齐 */
|
|
89
|
+
top = "top",
|
|
90
|
+
/** 居中对齐 */
|
|
91
|
+
middle = "middle",
|
|
92
|
+
/** 下对齐 */
|
|
93
|
+
bottom = "bottom",
|
|
94
|
+
/** 与基线对齐 */
|
|
95
|
+
baseline = "baseline"
|
|
12
96
|
}
|
|
13
97
|
export type TableElement = CustomElement<TableProps>;
|
|
14
98
|
export default Table;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: string;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neko-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Web Components UI Libraries",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "mo build library solid-js",
|
|
8
|
-
"changelog": "
|
|
8
|
+
"changelog": "mo changelog CHANGELOG.md && eslint --fix CHANGELOG.md && git add CHANGELOG.md",
|
|
9
9
|
"lint": "mo eslint components && mo eslint site && mo stylelint components && mo stylelint site && jest --coverage",
|
|
10
10
|
"precommit": "yarn lint && yarn changelog",
|
|
11
11
|
"prepare": "mo githooks pre-commit=\"yarn precommit\" commit-msg=\"npx --no -- commitlint --edit \\${1}\"",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "https://github.com/monako97/neko-ui"
|
|
25
25
|
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org"
|
|
29
|
+
},
|
|
26
30
|
"keywords": [
|
|
27
31
|
"web components",
|
|
28
32
|
"webcomponents",
|
|
@@ -34,29 +38,28 @@
|
|
|
34
38
|
"devDependencies": {
|
|
35
39
|
"@commitlint/cli": "17.6.6",
|
|
36
40
|
"@commitlint/config-conventional": "17.6.6",
|
|
37
|
-
"@moneko/cli": "2.0.0-beta.
|
|
41
|
+
"@moneko/cli": "2.0.0-beta.9",
|
|
38
42
|
"@moneko/common": "1.2.0",
|
|
39
|
-
"@moneko/core": "3.0.0-beta.
|
|
43
|
+
"@moneko/core": "3.0.0-beta.106",
|
|
40
44
|
"@moneko/css": "1.0.5",
|
|
41
45
|
"@moneko/postcss": "1.0.30",
|
|
42
|
-
"@moneko/solid-js": "1.
|
|
46
|
+
"@moneko/solid-js": "1.2.0",
|
|
43
47
|
"@solidjs/testing-library": "0.8.4",
|
|
44
48
|
"@swc/jest": "0.2.27",
|
|
45
49
|
"@testing-library/jest-dom": "5.17.0",
|
|
46
50
|
"@types/jest": "29.5.3",
|
|
47
51
|
"babel-loader": "9.1.3",
|
|
48
|
-
"conventional-changelog-cli": "3.0.0",
|
|
49
52
|
"dayjs": "1.11.9",
|
|
50
53
|
"eslint-config-neko": "1.1.2",
|
|
51
54
|
"husky": "8.0.3",
|
|
52
55
|
"jest": "29.6.1",
|
|
53
56
|
"jest-environment-jsdom": "29.6.1",
|
|
54
57
|
"marked-completed": "1.2.8",
|
|
55
|
-
"n-code-live": "1.0.
|
|
58
|
+
"n-code-live": "1.0.6",
|
|
56
59
|
"n-katex": "1.0.7",
|
|
57
60
|
"shadow-dom-testing-library": "1.11.0",
|
|
58
61
|
"solid-element": "1.7.1",
|
|
59
|
-
"solid-js": "1.7.
|
|
62
|
+
"solid-js": "1.7.11",
|
|
60
63
|
"stylelint-config-moneko": "1.0.17",
|
|
61
64
|
"ts-node": "10.9.1"
|
|
62
65
|
},
|