@teamias/rex-design 0.0.4 → 0.0.6
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/dist/components/action-buttons/action-buttons.js +4 -4
- 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/dist/components/icons/icons.js +8 -8
- package/dist/locales/en-US.json +16 -7
- package/dist/locales/zh-CN.json +9 -0
- package/package.json +3 -2
|
@@ -145,8 +145,8 @@ export var ActionButtons = function ActionButtons(_ref) {
|
|
|
145
145
|
size: 4,
|
|
146
146
|
children: inlineLabelRender(_objectSpread(_objectSpread({}, item), {}, {
|
|
147
147
|
label: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : formatMessage({
|
|
148
|
-
id: '
|
|
149
|
-
defaultMessage: '
|
|
148
|
+
id: 'rex.components.action-buttons.item-label-fallback',
|
|
149
|
+
defaultMessage: '未配置按钮标签'
|
|
150
150
|
})
|
|
151
151
|
}))
|
|
152
152
|
}));
|
|
@@ -177,8 +177,8 @@ export var ActionButtons = function ActionButtons(_ref) {
|
|
|
177
177
|
size: 4,
|
|
178
178
|
children: inlineLabelRender(_objectSpread(_objectSpread({}, groupItem), {}, {
|
|
179
179
|
label: (_groupItem$label = groupItem.label) !== null && _groupItem$label !== void 0 ? _groupItem$label : formatMessage({
|
|
180
|
-
id: '
|
|
181
|
-
defaultMessage: '
|
|
180
|
+
id: 'rex.components.action-buttons.group-label-fallback',
|
|
181
|
+
defaultMessage: '未配置分组标签'
|
|
182
182
|
})
|
|
183
183
|
}))
|
|
184
184
|
})
|
|
@@ -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
|
}
|
|
@@ -86,8 +86,8 @@ var Icons = function Icons(_ref) {
|
|
|
86
86
|
state.errorText = '';
|
|
87
87
|
setError = function setError() {
|
|
88
88
|
state.errorText = "".concat(formatMessage({
|
|
89
|
-
id: '
|
|
90
|
-
defaultMessage: '
|
|
89
|
+
id: 'rex.components.icons.loader-error',
|
|
90
|
+
defaultMessage: '图标加载失败'
|
|
91
91
|
}), ": ").concat(type, "-").concat(name);
|
|
92
92
|
state.content = /*#__PURE__*/_jsx(WarningOutlined, {
|
|
93
93
|
style: {
|
|
@@ -110,8 +110,8 @@ var Icons = function Icons(_ref) {
|
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
throw new Error("@ant-design/icons ".concat(formatMessage({
|
|
113
|
-
id: '
|
|
114
|
-
defaultMessage: '
|
|
113
|
+
id: 'rex.components.icons.not-found',
|
|
114
|
+
defaultMessage: '图标未找到'
|
|
115
115
|
})));
|
|
116
116
|
case 9:
|
|
117
117
|
state.content = /*#__PURE__*/createElement(data[name]);
|
|
@@ -127,8 +127,8 @@ var Icons = function Icons(_ref) {
|
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
throw new Error("iconify ".concat(formatMessage({
|
|
130
|
-
id: '
|
|
131
|
-
defaultMessage: '
|
|
130
|
+
id: 'rex.components.icons.not-found',
|
|
131
|
+
defaultMessage: '图标未找到'
|
|
132
132
|
})));
|
|
133
133
|
case 15:
|
|
134
134
|
_name$split = name.split(':'), _name$split2 = _slicedToArray(_name$split, 2), iconLib = _name$split2[0], icon = _name$split2[1];
|
|
@@ -208,8 +208,8 @@ var Icons = function Icons(_ref) {
|
|
|
208
208
|
break;
|
|
209
209
|
case 44:
|
|
210
210
|
throw new Error(formatMessage({
|
|
211
|
-
id: '
|
|
212
|
-
defaultMessage: '
|
|
211
|
+
id: 'rex.components.icons.type-not-matched',
|
|
212
|
+
defaultMessage: '图标类型不支持'
|
|
213
213
|
}));
|
|
214
214
|
case 45:
|
|
215
215
|
update();
|
package/dist/locales/en-US.json
CHANGED
|
@@ -10,18 +10,27 @@
|
|
|
10
10
|
},
|
|
11
11
|
"base-form": {
|
|
12
12
|
"placeholder": {
|
|
13
|
+
"input": "Please enter",
|
|
14
|
+
"select": "Please select",
|
|
13
15
|
"date-range": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
+
"start": "Start time",
|
|
17
|
+
"end": "End time"
|
|
16
18
|
},
|
|
17
|
-
"input": "Please enter",
|
|
18
19
|
"input-number-range": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
}
|
|
22
|
-
"select": "Please select"
|
|
20
|
+
"min": "Minimum value",
|
|
21
|
+
"max": "Maximum value"
|
|
22
|
+
}
|
|
23
23
|
},
|
|
24
24
|
"value-type-match-error": "Not matched"
|
|
25
|
+
},
|
|
26
|
+
"action-buttons": {
|
|
27
|
+
"item-label-fallback": "Unconfigured button label",
|
|
28
|
+
"group-label-fallback": "Unconfigured group label"
|
|
29
|
+
},
|
|
30
|
+
"icons": {
|
|
31
|
+
"loader-error": "Icon loading failed",
|
|
32
|
+
"not-found": "Icon not found",
|
|
33
|
+
"type-not-matched": "Icon type not supported"
|
|
25
34
|
}
|
|
26
35
|
},
|
|
27
36
|
"context": {},
|
package/dist/locales/zh-CN.json
CHANGED
|
@@ -22,6 +22,15 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"value-type-match-error": "匹配不到"
|
|
25
|
+
},
|
|
26
|
+
"action-buttons": {
|
|
27
|
+
"item-label-fallback": "未配置按钮标签",
|
|
28
|
+
"group-label-fallback": "未配置分组标签"
|
|
29
|
+
},
|
|
30
|
+
"icons": {
|
|
31
|
+
"loader-error": "图标加载失败",
|
|
32
|
+
"not-found": "图标未找到",
|
|
33
|
+
"type-not-matched": "图标类型不支持"
|
|
25
34
|
}
|
|
26
35
|
},
|
|
27
36
|
"context": {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
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",
|