@teamias/rex-design 0.0.4 → 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.
@@ -1,2 +1,2 @@
1
- import { TButtonFilterItem } from "../types";
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(dynamicValue)) {
29
- // return targetValue.includes(dynamicValue);
30
- return dynamicValue.includes(targetValue);
34
+ if (Array.isArray(targetValue)) {
35
+ return targetValue.includes(dynamicValue);
31
36
  }
32
37
  if (typeof targetValue === 'string') {
33
- // return targetValue.includes(`${dynamicValue}`);
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 "antd";
2
- import { ReactNode } from "react";
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
  }
@@ -1,3 +1 @@
1
- ;
2
- ;
3
1
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/rex-design",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -80,7 +80,8 @@
80
80
  "prettier-plugin-packagejson": "^2.2.18",
81
81
  "react": "^18.0.0",
82
82
  "react-dom": "^18.0.0",
83
- "stylelint": "^14.9.1"
83
+ "stylelint": "^14.9.1",
84
+ "umi-plugin-upload-build": "^1.1.0"
84
85
  },
85
86
  "peerDependencies": {
86
87
  "@ant-design/icons": ">=5.0.0",