@teamias/rex-design 0.0.3 → 0.0.5
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 +31 -9
- package/dist/components/action-buttons/modules/handlerFilter.d.ts +1 -1
- package/dist/components/action-buttons/modules/handlerFilter.js +18 -12
- package/dist/components/action-buttons/types.d.ts +5 -3
- package/dist/components/action-buttons/types.js +0 -2
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
[](https://npmjs.org/package/@teamias/rex-design)
|
|
4
4
|
[](https://npmjs.org/package/@teamias/rex-design)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
用 dumi 开发的 react 库
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### 安装组件库
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 安装组件库
|
|
14
|
+
$ pnpm add @teamias/rex-design
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 代码引用
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { ActionButtons } from '@teamias/rex-design';
|
|
22
|
+
```
|
|
11
23
|
|
|
12
24
|
## Options
|
|
13
25
|
|
|
@@ -16,28 +28,38 @@ TODO
|
|
|
16
28
|
## Development
|
|
17
29
|
|
|
18
30
|
```bash
|
|
19
|
-
#
|
|
31
|
+
# 安装依赖项
|
|
20
32
|
$ pnpm install
|
|
21
33
|
|
|
22
|
-
#
|
|
34
|
+
# 通过文档演示开发库
|
|
23
35
|
$ pnpm start
|
|
24
36
|
|
|
25
|
-
#
|
|
37
|
+
# 构建库源代码
|
|
26
38
|
$ pnpm run build
|
|
27
39
|
|
|
28
|
-
#
|
|
40
|
+
# 在监视模式下构建库源代码
|
|
29
41
|
$ pnpm run build:watch
|
|
30
42
|
|
|
31
|
-
#
|
|
43
|
+
# 生成文档
|
|
32
44
|
$ pnpm run docs:build
|
|
33
45
|
|
|
34
|
-
#
|
|
46
|
+
# 本地预览生产构建。
|
|
35
47
|
$ pnpm run docs:preview
|
|
36
48
|
|
|
37
|
-
#
|
|
49
|
+
# 检查项目的潜在问题
|
|
38
50
|
$ pnpm run doctor
|
|
39
51
|
```
|
|
40
52
|
|
|
53
|
+
## Publish
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 首次发包前,进行用户添加
|
|
57
|
+
$ pnpm adduser
|
|
58
|
+
|
|
59
|
+
# 发布新版本
|
|
60
|
+
$ pnpm run deploy
|
|
61
|
+
```
|
|
62
|
+
|
|
41
63
|
## LICENSE
|
|
42
64
|
|
|
43
65
|
MIT
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TButtonFilterItem } from
|
|
1
|
+
import { TButtonFilterItem } from '../types';
|
|
2
2
|
export declare const handlerFilter: (data?: Record<string, unknown>, filter?: TButtonFilterItem[]) => boolean;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
export var handlerFilter = function handlerFilter(data, filter) {
|
|
3
9
|
// 没有过滤条件判断,返回true
|
|
4
10
|
if (!filter || !filter.length) return true;
|
|
@@ -25,24 +31,24 @@ export var handlerFilter = function handlerFilter(data, filter) {
|
|
|
25
31
|
case 'lt':
|
|
26
32
|
return +targetValue > +dynamicValue;
|
|
27
33
|
case 'in':
|
|
28
|
-
if (Array.isArray(
|
|
29
|
-
|
|
30
|
-
return dynamicValue.includes(targetValue);
|
|
34
|
+
if (Array.isArray(targetValue)) {
|
|
35
|
+
return targetValue.includes(dynamicValue);
|
|
31
36
|
}
|
|
32
37
|
if (typeof targetValue === 'string') {
|
|
33
|
-
|
|
34
|
-
return "".concat(dynamicValue).includes("".concat(targetValue));
|
|
38
|
+
return targetValue.includes("".concat(dynamicValue));
|
|
35
39
|
}
|
|
36
40
|
return false;
|
|
37
41
|
case 'notIn':
|
|
38
|
-
// if (Array.isArray(targetValue)) {
|
|
39
|
-
// return !targetValue.includes(dynamicValue);
|
|
40
|
-
// }
|
|
41
|
-
// else if (typeof targetValue === 'string') {
|
|
42
|
-
// return !targetValue.includes(`${dynamicValue}`);
|
|
43
|
-
// }
|
|
44
|
-
// return false;
|
|
45
42
|
return !judgeValue('in', targetValue, dynamicValue);
|
|
43
|
+
case 'int':
|
|
44
|
+
{
|
|
45
|
+
var set1 = new Set(Array.isArray(targetValue) ? targetValue : [targetValue]);
|
|
46
|
+
var set2 = new Set(Array.isArray(dynamicValue) ? dynamicValue : [dynamicValue]);
|
|
47
|
+
var intersection = new Set(_toConsumableArray(set1).filter(function (x) {
|
|
48
|
+
return set2.has(x);
|
|
49
|
+
}));
|
|
50
|
+
return intersection.size > 0;
|
|
51
|
+
}
|
|
46
52
|
case 'empty':
|
|
47
53
|
if (typeof dynamicValue === 'undefined' || dynamicValue === null) return true;
|
|
48
54
|
if (Array.isArray(dynamicValue)) return dynamicValue.length === 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Button, DropDownProps, GetProps } from
|
|
2
|
-
import { ReactNode } from
|
|
1
|
+
import { Button, DropDownProps, GetProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
export interface IActionButtonsProps {
|
|
4
4
|
/** 自定义渲染label */
|
|
5
5
|
labelRender?: (oldNode: ReactNode, item: IDropDownItem) => ReactNode;
|
|
@@ -91,6 +91,8 @@ export interface TButtonFilterItem {
|
|
|
91
91
|
* - notIn 不包含[支持数组 `!['qwe_asd'].includes('qwe_asd')`, 字符串 `!'qwe_asd'.includes('qwe_')`]
|
|
92
92
|
* - empty 空
|
|
93
93
|
* - notEmpty 非空
|
|
94
|
+
* - int 交集
|
|
95
|
+
* - diff 差集
|
|
94
96
|
*/
|
|
95
|
-
op: 'eq' | 'ne' | 'gt' | 'lt' | 'in' | 'notIn' | 'empty' | 'notEmpty';
|
|
97
|
+
op: 'eq' | 'ne' | 'gt' | 'lt' | 'in' | 'notIn' | 'empty' | 'notEmpty' | 'int';
|
|
96
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
"adduser": "npm adduser",
|
|
13
13
|
"build": "father build",
|
|
14
14
|
"build:watch": "father dev",
|
|
15
|
-
"deploy": "changeset && changeset version && npm publish",
|
|
15
|
+
"deploy": "changeset && changeset version && npm publish && npm run docs:deploy",
|
|
16
16
|
"dev": "dumi dev",
|
|
17
17
|
"docs:build": "dumi build",
|
|
18
|
+
"docs:deploy": "vercel --prod",
|
|
18
19
|
"docs:preview": "dumi preview",
|
|
19
20
|
"doctor": "father doctor",
|
|
20
21
|
"lint": "npm run lint:es",
|
|
@@ -22,7 +23,6 @@
|
|
|
22
23
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
23
24
|
"prepare": "husky install && dumi setup",
|
|
24
25
|
"prepublishOnly": "father doctor && npm run build",
|
|
25
|
-
"publish:first": "npm publish --access public",
|
|
26
26
|
"start": "npm run dev"
|
|
27
27
|
},
|
|
28
28
|
"commitlint": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@changesets/cli": "^2.29.5",
|
|
66
66
|
"@commitlint/cli": "^17.1.2",
|
|
67
67
|
"@commitlint/config-conventional": "^17.1.0",
|
|
68
|
+
"@teamias/umi-loader-source-plugin": "^0.0.6",
|
|
68
69
|
"@types/lodash": "^4.17.20",
|
|
69
70
|
"@types/react": "^18.0.0",
|
|
70
71
|
"@types/react-dom": "^18.0.0",
|
|
@@ -79,11 +80,16 @@
|
|
|
79
80
|
"prettier-plugin-packagejson": "^2.2.18",
|
|
80
81
|
"react": "^18.0.0",
|
|
81
82
|
"react-dom": "^18.0.0",
|
|
82
|
-
"stylelint": "^14.9.1"
|
|
83
|
+
"stylelint": "^14.9.1",
|
|
84
|
+
"umi-plugin-upload-build": "^1.1.0"
|
|
83
85
|
},
|
|
84
86
|
"peerDependencies": {
|
|
87
|
+
"@ant-design/icons": ">=5.0.0",
|
|
88
|
+
"@ant-design/pro-components": ">=2.0.0",
|
|
89
|
+
"antd": ">=5.0.0",
|
|
85
90
|
"react": ">=16.9.0",
|
|
86
|
-
"react-dom": ">=16.9.0"
|
|
91
|
+
"react-dom": ">=16.9.0",
|
|
92
|
+
"react-intl": ">=3.0.0"
|
|
87
93
|
},
|
|
88
94
|
"publishConfig": {
|
|
89
95
|
"access": "public"
|