-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit da0a5be
Showing
96 changed files
with
12,724 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
quote_type = single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/* | ||
dist/* | ||
lib/* | ||
*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* @Author: bucai<[email protected]> | ||
* @Date: 2021-08-17 20:17:34 | ||
* @LastEditors: bucai<[email protected]> | ||
* @LastEditTime: 2021-08-18 16:47:20 | ||
* @Description: | ||
*/ | ||
module.exports = { | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
tsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:vue/vue3-recommended', | ||
], | ||
rules: { | ||
'no-console': 1, | ||
// js/ts | ||
'eol-last': 'error', | ||
'no-trailing-spaces': 'error', | ||
'comma-style': ['error', 'last'], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'no-multi-spaces': 'error', | ||
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], | ||
camelcase: ['error', { properties: 'never' }], | ||
semi: ['error', 'never'], | ||
indent: ['error', 2, { SwitchCase: 1 }], | ||
'object-curly-spacing': ['error', 'always'], | ||
'arrow-parens': ['error', 'as-needed'], | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: 'none', | ||
requireLast: false, | ||
}, | ||
singleline: { | ||
delimiter: 'semi', | ||
requireLast: true, | ||
}, | ||
}, | ||
], | ||
// vue | ||
'vue/no-v-html': 'off', | ||
'vue/singleline-html-element-content-newline': 'off', | ||
'vue/html-self-closing': ['error', { | ||
html: { | ||
void: 'never', | ||
normal: 'never', | ||
component: 'always', | ||
}, | ||
}], | ||
'vue/max-attributes-per-line': ['error', { | ||
singleline: 3, | ||
multiline: 1, | ||
}], | ||
'vue/require-default-prop': 'off', | ||
'vue/html-closing-bracket-spacing': 'error', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.DS_Store | ||
node_modules | ||
dist | ||
lib | ||
es | ||
website-dist | ||
coverage | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* @Author: bucai<[email protected]> | ||
* @Date: 2021-08-18 16:24:25 | ||
* @LastEditors: bucai<[email protected]> | ||
* @LastEditTime: 2021-08-18 16:24:25 | ||
* @Description: | ||
*/ | ||
module.exports = { | ||
semi: false, | ||
trailingComma: 'all', | ||
singleQuote: true, | ||
printWidth: 80, | ||
tabWidth: 2, | ||
endOfLine: 'auto', | ||
overrides: [ | ||
{ | ||
files: '*.scss', | ||
options: { | ||
parser: 'scss', | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# cding-table | ||
|
||
This is an element-Puls table component that can be configured to perform complex operations on the table. | ||
|
||
<p> | ||
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/notbucai/cding-table"> | ||
<img alt="GitHub issues" src="https://img.shields.io/github/issues/notbucai/cding-table"> | ||
<img alt="GitHub" src="https://img.shields.io/github/license/notbucai/cding-table"> | ||
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/notbucai/cding-table"> | ||
</p> | ||
|
||
## 🤪 Installing | ||
|
||
### NPM | ||
|
||
```bash | ||
$ npm install cding-table | ||
``` | ||
|
||
### Yarn | ||
|
||
```bash | ||
$ yarn add cding-table | ||
``` | ||
|
||
## 😵 Usage | ||
|
||
```javascript | ||
// 导入 cding-table | ||
import { TableData } from 'cding-table' | ||
|
||
const columns = [ | ||
{ | ||
prop: 'id', | ||
}, { | ||
prop: 'name', | ||
label: '片名', | ||
}, { | ||
prop: 'release', | ||
label: '发行日期', | ||
}, | ||
{ | ||
prop: 'director', | ||
label: '导演', | ||
}, | ||
{ | ||
prop: 'runtime', | ||
label: '时长(分)', | ||
}, | ||
]; | ||
|
||
async function loadMethod ({ page, sort }) { | ||
return new Promise(r => { | ||
setTimeout(() => { | ||
r(1) | ||
}, 300) | ||
}).then(() => { | ||
return { | ||
total: 100, | ||
list: [ | ||
{ | ||
id: 1, | ||
name: 'Toy Story', | ||
release: '1995-11-22', | ||
director: 'John Lasseter', | ||
runtime: 80, | ||
}, | ||
{ | ||
id: 2, | ||
name: "A Bug's Life", | ||
release: '1998-11-25', | ||
director: 'John Lasseter', | ||
runtime: 95, | ||
}, | ||
] | ||
} | ||
}) | ||
} | ||
// 使用 | ||
<table-data :columns="columns" :load-method="loadMethod" /> | ||
``` | ||
|
||
## 🌚 Options | ||
|
||
> 注意:Options 暂时不做二级对象的合并只做替换,如果需要修改子对象请完整替换。 | ||
```ts | ||
type Options = { | ||
stripe?: boolean | ||
height?: string | number | ||
maxHeight?: string | number | ||
size?: string | ||
width?: string | number | ||
fit?: boolean | ||
border?: boolean | ||
rowKey?: string | ((row: T) => string) | ||
showHeader?: boolean | ||
showSummary?: boolean | ||
sumText?: string | ||
summaryMethod?: SummaryMethod<T> | ||
rowClassName?: ColumnCls<T> | ||
rowStyle?: ColumnStyle<T> | ||
cellClassName?: CellCls<T> | ||
cellStyle?: CellStyle<T> | ||
headerRowClassName?: ColumnCls<T> | ||
headerRowStyle?: ColumnStyle<T> | ||
headerCellClassName?: CellCls<T> | ||
headerCellStyle?: CellStyle<T> | ||
highlightCurrentRow?: boolean | ||
currentRowKey?: string | number | ||
emptyText?: string | ||
expandRowKeys?: any[] | ||
defaultExpandAll?: boolean | ||
defaultSort?: Sort | ||
tooltipEffect?: string | ||
spanMethod?: (data: { | ||
row: T | ||
rowIndex: number | ||
column: TableColumnCtx<T> | ||
columnIndex: number | ||
}) => | ||
| number[] | ||
| { | ||
rowspan: number | ||
colspan: number | ||
} | ||
selectOnIndeterminate?: boolean | ||
indent?: number | ||
treeProps?: { | ||
hasChildren?: string | ||
children?: string | ||
} | ||
lazy?: boolean | ||
load?: (row: T, treeNode: TreeNode, resolve: (data: T[]) => void) => void | ||
className?: string | ||
style?: CSSProperties | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = { | ||
presets: [ | ||
// [ | ||
// '@babel/env', | ||
// { | ||
// // loose: true, | ||
// modules: false, | ||
// }, | ||
// ], | ||
[ | ||
'@vue/cli-plugin-babel/preset', | ||
{ | ||
useBuiltIns: false, | ||
}, | ||
], | ||
'@babel/typescript', | ||
], | ||
plugins: [ | ||
'@vue/babel-plugin-jsx', | ||
// '@babel/proposal-class-properties', | ||
// '@babel/transform-runtime', | ||
// [ | ||
// 'import', | ||
// { | ||
// libraryName: 'element-plus', | ||
// customStyleName: name => { | ||
// name = name.slice(3) | ||
// return `element-plus/packages/theme-chalk/src/${name}.scss` | ||
// }, | ||
// }, | ||
// ], | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* @Author: bucai<[email protected]> | ||
* @Date: 2021-08-18 09:36:07 | ||
* @LastEditors: bucai<[email protected]> | ||
* @LastEditTime: 2021-08-27 09:58:37 | ||
* @Description: | ||
*/ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve' | ||
import path from 'path' | ||
// import commonjs from '@rollup/plugin-commonjs' | ||
import { terser } from 'rollup-plugin-terser' | ||
import { eslint } from "rollup-plugin-eslint" | ||
import babel from '@rollup/plugin-babel' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import pkg from '../package.json' | ||
import scss from 'rollup-plugin-scss'; | ||
|
||
const deps = Object.keys(pkg.dependencies) | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
import vue from 'rollup-plugin-vue'; | ||
const prettier = require('rollup-plugin-prettier'); | ||
|
||
|
||
export default [ | ||
{ | ||
input: path.resolve(__dirname, '../src/index.ts'), | ||
output: { | ||
format: 'es', | ||
file: 'lib/index.js', | ||
}, | ||
rootDir: 'src', | ||
plugins: [ | ||
eslint(), | ||
prettier(), | ||
babel({ babelHelpers: "bundled", extensions:[".ts", ".js", ".tsx", '.jsx'] }), // babelHelpers是bable的最佳实践方案 extensions编译的扩展文件 | ||
// terser(), | ||
nodeResolve(), | ||
// commonjs(), | ||
scss(), | ||
vue({ | ||
target: 'browser', | ||
css: false, | ||
exposeFilename: false, | ||
}), | ||
typescript({ | ||
tsconfigOverride: { | ||
'include': [ | ||
'src/**/*', | ||
'typings/vue-shim.d.ts', | ||
], | ||
'exclude': [ | ||
'node_modules', | ||
'src/**/__tests__/*', | ||
'src/__tests__/*', | ||
], | ||
}, | ||
abortOnError: false, | ||
}), | ||
], | ||
external (id) { | ||
return /^vue/.test(id) | ||
|| deps.some(k => new RegExp('^' + k).test(id)) | ||
}, | ||
}, | ||
] |
Oops, something went wrong.