@teamias/rex-pro 0.0.12 → 0.0.14
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/filter-form/v1/demo/CustomFilterForm.js +7 -1
- package/dist/components/filter-form/v1/filter-form.d.ts +5 -1
- package/dist/components/filter-form/v1/filter-form.js +19 -5
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +3 -1
- package/dist/components/rex-pro-input/index.d.ts +2 -0
- package/dist/components/rex-pro-input/index.js +1 -0
- package/dist/components/rex-pro-input/v1/demo/demo1.d.ts +2 -0
- package/dist/components/rex-pro-input/v1/demo/demo1.js +7 -0
- package/dist/components/rex-pro-input/v1/rex-pro-input.d.ts +3 -0
- package/dist/components/rex-pro-input/v1/rex-pro-input.js +11 -0
- package/dist/components/rex-pro-upload/index.d.ts +2 -0
- package/dist/components/rex-pro-upload/index.js +1 -0
- package/dist/components/rex-pro-upload/v1/demo/demo1.d.ts +2 -0
- package/dist/components/rex-pro-upload/v1/demo/demo1.js +31 -0
- package/dist/components/rex-pro-upload/v1/rex-pro-upload.d.ts +3 -0
- package/dist/components/rex-pro-upload/v1/rex-pro-upload.js +11 -0
- package/package.json +2 -2
|
@@ -17,6 +17,13 @@ export default (function () {
|
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
return _context.abrupt("return", [{
|
|
20
|
+
field: ['avg_cost_min', 'avg_cost_max'],
|
|
21
|
+
valueType: 'inputNumberRange',
|
|
22
|
+
itemWidth: '350px',
|
|
23
|
+
fieldProps: [],
|
|
24
|
+
label: '平均成本区间',
|
|
25
|
+
isCustom: true
|
|
26
|
+
}, {
|
|
20
27
|
label: '类目',
|
|
21
28
|
field: 'category_id',
|
|
22
29
|
valueType: 'selectDim',
|
|
@@ -57,7 +64,6 @@ export default (function () {
|
|
|
57
64
|
}]
|
|
58
65
|
}, {
|
|
59
66
|
label: '成本区间',
|
|
60
|
-
field: 'avg_cost',
|
|
61
67
|
valueType: 'multipleComponents',
|
|
62
68
|
compact: true,
|
|
63
69
|
isCustom: true,
|
|
@@ -43,7 +43,11 @@ export interface IFilterFormProps<T extends object = object> extends Omit<TRawPr
|
|
|
43
43
|
handlerSelectStyle: (fields: TFields) => TFields;
|
|
44
44
|
}) => ReactNode;
|
|
45
45
|
}
|
|
46
|
-
type
|
|
46
|
+
type TFieldItem = Exclude<IBaseFormProps['fields'], undefined>[number] & {
|
|
47
|
+
/** 是否作为 可控显隐 的表单项 */
|
|
48
|
+
isCustom?: boolean;
|
|
49
|
+
};
|
|
50
|
+
type TFields = TFieldItem[];
|
|
47
51
|
type TFieldProps = Exclude<IBaseFormProps['fieldProps'], undefined>;
|
|
48
52
|
type TRawProFormProps<T> = GetProps<typeof ProForm<T>>;
|
|
49
53
|
type TForm<T> = ReturnType<typeof ProForm.useForm<T>>[0];
|
|
@@ -149,6 +149,19 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
149
149
|
update();
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
/** 获取字段的唯一键 */
|
|
153
|
+
var getFiledKey = function getFiledKey(field) {
|
|
154
|
+
if (field.field) {
|
|
155
|
+
return (Array.isArray(field.field) ? field.field : [field.field]).join('-');
|
|
156
|
+
}
|
|
157
|
+
if ('subItems' in field && field.subItems) {
|
|
158
|
+
return field.subItems.map(function (sub) {
|
|
159
|
+
return getFiledKey(sub);
|
|
160
|
+
}).join('-');
|
|
161
|
+
}
|
|
162
|
+
return '';
|
|
163
|
+
};
|
|
164
|
+
|
|
152
165
|
// 创建下拉菜单内容
|
|
153
166
|
var getDropdownMenu = function getDropdownMenu() {
|
|
154
167
|
// 筛选出所有自定义字段
|
|
@@ -156,9 +169,10 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
156
169
|
return field.isCustom;
|
|
157
170
|
});
|
|
158
171
|
var items = customFields.map(function (field) {
|
|
159
|
-
var
|
|
172
|
+
var key = getFiledKey(field);
|
|
173
|
+
var isSelected = state.selectedCustomFieldKeys.has(key);
|
|
160
174
|
return {
|
|
161
|
-
key:
|
|
175
|
+
key: key,
|
|
162
176
|
label: /*#__PURE__*/_jsx("div", {
|
|
163
177
|
style: {
|
|
164
178
|
display: 'flex',
|
|
@@ -167,7 +181,7 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
167
181
|
},
|
|
168
182
|
onClick: function onClick(e) {
|
|
169
183
|
e.stopPropagation();
|
|
170
|
-
handleToggleCustomField(
|
|
184
|
+
handleToggleCustomField(key);
|
|
171
185
|
},
|
|
172
186
|
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
173
187
|
checked: isSelected,
|
|
@@ -189,7 +203,7 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
189
203
|
var currentCustomFieldKeys = new Set(allFields.filter(function (field) {
|
|
190
204
|
return field.isCustom;
|
|
191
205
|
}).map(function (field) {
|
|
192
|
-
return field
|
|
206
|
+
return getFiledKey(field);
|
|
193
207
|
}));
|
|
194
208
|
|
|
195
209
|
// 只保留仍然是自定义字段的选中项
|
|
@@ -209,7 +223,7 @@ export var FilterForm = function FilterForm(_ref) {
|
|
|
209
223
|
|
|
210
224
|
// 筛选出已选择的自定义字段
|
|
211
225
|
var selectedCustomFields = allFields.filter(function (field) {
|
|
212
|
-
return field.isCustom && state.selectedCustomFieldKeys.has(field
|
|
226
|
+
return field.isCustom && state.selectedCustomFieldKeys.has(getFiledKey(field));
|
|
213
227
|
});
|
|
214
228
|
|
|
215
229
|
// 合并普通字段和已选择的自定义字段
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RexProInput } from "./v1/rex-pro-input";
|
|
@@ -0,0 +1,11 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { BigInput } from '@teamias/rex-design';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export var RexProInput = function RexProInput(props) {
|
|
10
|
+
return /*#__PURE__*/_jsx(BigInput, _objectSpread({}, props));
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RexProUpload } from "./v1/rex-pro-upload";
|
|
@@ -0,0 +1,31 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { message } from 'antd';
|
|
8
|
+
import { RexProUpload } from "../rex-pro-upload";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export default (function () {
|
|
11
|
+
var props = {
|
|
12
|
+
name: 'file',
|
|
13
|
+
multiple: true,
|
|
14
|
+
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
|
|
15
|
+
onChange: function onChange(info) {
|
|
16
|
+
var status = info.file.status;
|
|
17
|
+
if (status !== 'uploading') {
|
|
18
|
+
console.log(info.file, info.fileList);
|
|
19
|
+
}
|
|
20
|
+
if (status === 'done') {
|
|
21
|
+
message.success("".concat(info.file.name, " file uploaded successfully."));
|
|
22
|
+
} else if (status === 'error') {
|
|
23
|
+
message.error("".concat(info.file.name, " file upload failed."));
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
onDrop: function onDrop(e) {
|
|
27
|
+
console.log('Dropped files', e.dataTransfer.files);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_jsx(RexProUpload, _objectSpread({}, props));
|
|
31
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { UploadPlus } from '@teamias/rex-design';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export var RexProUpload = function RexProUpload(props) {
|
|
10
|
+
return /*#__PURE__*/_jsx(UploadPlus, _objectSpread({}, props));
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-pro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@ant-design/icons": "^6.0.0",
|
|
53
53
|
"@ant-design/pro-components": "^2.8.10",
|
|
54
|
-
"@teamias/rex-design": "^0.0.
|
|
54
|
+
"@teamias/rex-design": "^0.0.24",
|
|
55
55
|
"ahooks": "^3.9.0",
|
|
56
56
|
"antd": "^5.26.7",
|
|
57
57
|
"classnames": "^2.5.1",
|