@teamias/rex-pro 0.0.9 → 0.0.10

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) cloudovo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) cloudovo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,65 +1,65 @@
1
- # @teamias/rex-pro
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@teamias/rex-pro.svg?style=flat)](https://npmjs.org/package/@teamias/rex-pro)
4
- [![NPM downloads](http://img.shields.io/npm/dm/@teamias/rex-pro.svg?style=flat)](https://npmjs.org/package/@teamias/rex-pro)
5
-
6
- 用 dumi 开发的 react 库
7
-
8
- ## Usage
9
-
10
- ### 安装组件库
11
-
12
- ```bash
13
- # 安装组件库
14
- $ pnpm add @teamias/rex-pro
15
-
16
- ```
17
-
18
- ### 代码引用
19
-
20
- ```ts
21
- import { ActionButtons } from '@teamias/rex-pro';
22
- ```
23
-
24
- ## Options
25
-
26
- TODO
27
-
28
- ## Development
29
-
30
- ```bash
31
- # 安装依赖项
32
- $ pnpm install
33
-
34
- # 通过文档演示开发库
35
- $ pnpm start
36
-
37
- # 构建库源代码
38
- $ pnpm run build
39
-
40
- # 在监视模式下构建库源代码
41
- $ pnpm run build:watch
42
-
43
- # 生成文档
44
- $ pnpm run docs:build
45
-
46
- # 本地预览生产构建。
47
- $ pnpm run docs:preview
48
-
49
- # 检查项目的潜在问题
50
- $ pnpm run doctor
51
- ```
52
-
53
- ## Publish
54
-
55
- ```bash
56
- # 首次发包前,进行用户添加
57
- $ pnpm adduser
58
-
59
- # 发布新版本
60
- $ pnpm run deploy
61
- ```
62
-
63
- ## LICENSE
64
-
65
- MIT
1
+ # @teamias/rex-pro
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@teamias/rex-pro.svg?style=flat)](https://npmjs.org/package/@teamias/rex-pro)
4
+ [![NPM downloads](http://img.shields.io/npm/dm/@teamias/rex-pro.svg?style=flat)](https://npmjs.org/package/@teamias/rex-pro)
5
+
6
+ 用 dumi 开发的 react 库
7
+
8
+ ## Usage
9
+
10
+ ### 安装组件库
11
+
12
+ ```bash
13
+ # 安装组件库
14
+ $ pnpm add @teamias/rex-pro
15
+
16
+ ```
17
+
18
+ ### 代码引用
19
+
20
+ ```ts
21
+ import { ActionButtons } from '@teamias/rex-pro';
22
+ ```
23
+
24
+ ## Options
25
+
26
+ TODO
27
+
28
+ ## Development
29
+
30
+ ```bash
31
+ # 安装依赖项
32
+ $ pnpm install
33
+
34
+ # 通过文档演示开发库
35
+ $ pnpm start
36
+
37
+ # 构建库源代码
38
+ $ pnpm run build
39
+
40
+ # 在监视模式下构建库源代码
41
+ $ pnpm run build:watch
42
+
43
+ # 生成文档
44
+ $ pnpm run docs:build
45
+
46
+ # 本地预览生产构建。
47
+ $ pnpm run docs:preview
48
+
49
+ # 检查项目的潜在问题
50
+ $ pnpm run doctor
51
+ ```
52
+
53
+ ## Publish
54
+
55
+ ```bash
56
+ # 首次发包前,进行用户添加
57
+ $ pnpm adduser
58
+
59
+ # 发布新版本
60
+ $ pnpm run deploy
61
+ ```
62
+
63
+ ## LICENSE
64
+
65
+ MIT
@@ -13,11 +13,11 @@ import classNames from 'classnames';
13
13
  import { useMemo } from 'react';
14
14
  import { Card } from "./style";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
- /**
17
- * 平分列数
18
- * @param len
19
- * @param defaultCol
20
- * @returns number
16
+ /**
17
+ * 平分列数
18
+ * @param len
19
+ * @param defaultCol
20
+ * @returns number
21
21
  */
22
22
  var useSpan = function useSpan(len, defaultCol) {
23
23
  return useMemo(function () {
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,334 @@
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
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ import { BaseForm } from '@teamias/rex-design';
11
+ import { FilterForm } from "../filter-form";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export default (function () {
14
+ return /*#__PURE__*/_jsx(FilterForm, {
15
+ requestFields: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
16
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17
+ while (1) switch (_context.prev = _context.next) {
18
+ case 0:
19
+ return _context.abrupt("return", [{
20
+ label: '类目',
21
+ field: 'category_id',
22
+ valueType: 'selectDim',
23
+ multiple: true,
24
+ api: '/gms/category_search',
25
+ isCustom: true,
26
+ fieldProps: {
27
+ popupMatchSelectWidth: false,
28
+ maxTagCount: 1
29
+ }
30
+ }, {
31
+ label: '买手',
32
+ field: 'bm_staffing_id',
33
+ valueType: 'selectDim',
34
+ multiple: true,
35
+ api: '/gms/get_bm_users',
36
+ isCustom: true,
37
+ fieldProps: {
38
+ popupMatchSelectWidth: false,
39
+ maxTagCount: 1
40
+ }
41
+ }, {
42
+ label: '产品类型',
43
+ field: 'product_type',
44
+ valueType: 'select',
45
+ multiple: true,
46
+ isCustom: true,
47
+ fieldProps: {
48
+ popupMatchSelectWidth: false,
49
+ maxTagCount: 1
50
+ },
51
+ options: [{
52
+ label: '基础品',
53
+ value: 0
54
+ }, {
55
+ label: '组装品',
56
+ value: 1
57
+ }]
58
+ }, {
59
+ label: '成本区间',
60
+ field: 'avg_cost',
61
+ valueType: 'multipleComponents',
62
+ compact: true,
63
+ isCustom: true,
64
+ subItems: [{
65
+ valueType: 'select',
66
+ field: 'avg_cost',
67
+ defaultValue: 'avg_cost',
68
+ fieldProps: {
69
+ allowClear: false,
70
+ popupMatchSelectWidth: false,
71
+ maxTagCount: 1
72
+ },
73
+ itemWidth: '100px',
74
+ options: [{
75
+ label: '成本区间',
76
+ value: 'avg_cost'
77
+ }]
78
+ }, {
79
+ field: ['avg_cost_min', 'avg_cost_max'],
80
+ valueType: 'inputNumberRange',
81
+ itemWidth: '150px',
82
+ fieldProps: []
83
+ }]
84
+ }, {
85
+ label: '重量区间',
86
+ field: 'weight_gram',
87
+ valueType: 'multipleComponents',
88
+ compact: true,
89
+ isCustom: true,
90
+ subItems: [{
91
+ valueType: 'select',
92
+ field: 'weight_gram',
93
+ defaultValue: 'weight_gram',
94
+ options: [{
95
+ label: '重量区间',
96
+ value: 'weight_gram'
97
+ }]
98
+ }, {
99
+ field: ['weight_gram_min', 'weight_gram_max'],
100
+ valueType: 'inputNumberRange'
101
+ }]
102
+ }, {
103
+ label: 'DMS区间',
104
+ field: 'dms',
105
+ valueType: 'multipleComponents',
106
+ compact: true,
107
+ isCustom: true,
108
+ subItems: [{
109
+ valueType: 'select',
110
+ field: 'dms',
111
+ defaultValue: 'dms',
112
+ itemWidth: 'auto',
113
+ fieldProps: {
114
+ allowClear: false
115
+ },
116
+ options: [{
117
+ label: 'DMS区间',
118
+ value: 'dms'
119
+ }]
120
+ }, {
121
+ field: ['dms_min', 'dms_max'],
122
+ valueType: 'inputNumberRange',
123
+ formItemProps: {
124
+ style: {
125
+ flex: 1
126
+ }
127
+ }
128
+ }]
129
+ }, {
130
+ label: '实际库存',
131
+ field: 'goods_stock',
132
+ valueType: 'multipleComponents',
133
+ compact: true,
134
+ isCustom: true,
135
+ subItems: [{
136
+ valueType: 'select',
137
+ field: 'goods_stock',
138
+ defaultValue: 'goods_stock',
139
+ itemWidth: 'auto',
140
+ fieldProps: {
141
+ allowClear: false
142
+ },
143
+ options: [{
144
+ label: '实际库存',
145
+ value: 'goods_stock'
146
+ }]
147
+ }, {
148
+ field: ['goods_stock_min', 'goods_stock_max'],
149
+ valueType: 'inputNumberRange',
150
+ isCustom: true,
151
+ formItemProps: {
152
+ style: {
153
+ flex: 1
154
+ }
155
+ }
156
+ }]
157
+ }, {
158
+ label: '可用库存',
159
+ field: 'usable_stock',
160
+ valueType: 'multipleComponents',
161
+ compact: true,
162
+ isCustom: true,
163
+ subItems: [{
164
+ valueType: 'select',
165
+ field: 'usable_stock',
166
+ defaultValue: 'usable_stock',
167
+ itemWidth: 'auto',
168
+ fieldProps: {
169
+ allowClear: false
170
+ },
171
+ options: [{
172
+ label: '可用库存',
173
+ value: 'usable_stock'
174
+ }]
175
+ }, {
176
+ field: ['usable_stock_min', 'usable_stock_max'],
177
+ valueType: 'inputNumberRange',
178
+ formItemProps: {
179
+ style: {
180
+ flex: 1
181
+ }
182
+ }
183
+ }]
184
+ }, {
185
+ label: '缺货库存',
186
+ field: 'goods_lack',
187
+ valueType: 'multipleComponents',
188
+ compact: true,
189
+ subItems: [{
190
+ valueType: 'select',
191
+ field: 'goods_lack',
192
+ defaultValue: 'goods_lack',
193
+ itemWidth: 'auto',
194
+ fieldProps: {
195
+ allowClear: false
196
+ },
197
+ options: [{
198
+ label: '缺货库存',
199
+ value: 'goods_lack'
200
+ }]
201
+ }, {
202
+ field: ['goods_lack_min', 'goods_lack_max'],
203
+ valueType: 'inputNumberRange',
204
+ formItemProps: {
205
+ style: {
206
+ flex: 1
207
+ }
208
+ }
209
+ }]
210
+ }, {
211
+ label: '是否侵权',
212
+ field: 'is_tort',
213
+ valueType: 'select',
214
+ options: [{
215
+ label: '侵权',
216
+ value: 1
217
+ }, {
218
+ label: '不侵权',
219
+ value: 2
220
+ }]
221
+ }, {
222
+ valueType: 'multipleComponents',
223
+ label: 'multipleComponents',
224
+ compact: true,
225
+ subItems: [{
226
+ valueType: 'select',
227
+ field: 'sort_key',
228
+ defaultValue: 'default',
229
+ itemWidth: '100px',
230
+ options: [{
231
+ label: '默认排序',
232
+ value: 'default'
233
+ }, {
234
+ label: '按spu发布时间',
235
+ value: 'spu_completetime'
236
+ }, {
237
+ label: '按实际库存',
238
+ value: 'goods_stock'
239
+ }, {
240
+ label: '按可用库存',
241
+ value: 'usable_stock'
242
+ }, {
243
+ label: '按平均成本',
244
+ value: 'avg_cost'
245
+ }, {
246
+ label: '按30天售后率',
247
+ value: '30day_rma_rate'
248
+ }, {
249
+ label: '按60天售后率',
250
+ value: '60day_rma_rate'
251
+ }]
252
+ }, {
253
+ valueType: 'select',
254
+ field: 'sort_val',
255
+ defaultValue: 'desc',
256
+ itemWidth: '100px',
257
+ options: [{
258
+ label: '正序',
259
+ value: 'asc'
260
+ }, {
261
+ label: '倒序',
262
+ value: 'desc'
263
+ }]
264
+ }]
265
+ }, {
266
+ valueType: 'multipleComponents',
267
+ compact: true,
268
+ subItems: [{
269
+ valueType: 'select',
270
+ defaultValue: 'keywords',
271
+ field: 'keyword_type',
272
+ itemWidth: 'auto',
273
+ options: [{
274
+ label: '关键词(sku/spu/品名)',
275
+ value: 'keywords'
276
+ }, {
277
+ label: 'sku/spu',
278
+ value: 'sku_spu'
279
+ }, {
280
+ label: '商品名称(and)',
281
+ value: 'goods_name_and'
282
+ }, {
283
+ label: '商品名称(or)',
284
+ value: 'goods_name_or'
285
+ }, {
286
+ label: '海关编码',
287
+ value: 'foreign_code'
288
+ }]
289
+ }, {
290
+ valueType: 'input',
291
+ field: 'keyword_value',
292
+ itemWidth: '300px'
293
+ }]
294
+ }]);
295
+ case 1:
296
+ case "end":
297
+ return _context.stop();
298
+ }
299
+ }, _callee);
300
+ })),
301
+ onFinish: function onFinish(values) {
302
+ console.log(values);
303
+ },
304
+ children: function children(baseProps, _ref2) {
305
+ var displayType = _ref2.displayType,
306
+ handlerSelectStyle = _ref2.handlerSelectStyle;
307
+ var arr = [{
308
+ valueType: 'multipleComponents',
309
+ compact: true,
310
+ subItems: [{
311
+ valueType: 'select',
312
+ defaultValue: 'spu_completetime1111111',
313
+ field: 'time_type1111111',
314
+ itemWidth: 'auto',
315
+ fieldProps: {
316
+ allowClear: false
317
+ },
318
+ options: [{
319
+ label: '开品时间',
320
+ value: 'spu_completetime1111111'
321
+ }]
322
+ }, {
323
+ valueType: 'dateRange',
324
+ field: ['time_start1111111', 'time_end111111'],
325
+ itemWidth: '240px',
326
+ defaultValue: -14
327
+ }]
328
+ }];
329
+ return /*#__PURE__*/_jsx(BaseForm, _objectSpread(_objectSpread({}, baseProps), {}, {
330
+ fields: displayType === 'auto' ? handlerSelectStyle(arr) : arr
331
+ }));
332
+ }
333
+ });
334
+ });
@@ -1,5 +1,9 @@
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
2
  var _excluded = ["itemWidth", "displayType", "form", "formRef", "requestFields", "requestFieldsUrl", "requestFieldsParams", "fieldPropsFn", "requestOptions", "initialValues", "fieldsConfig", "actionRef", "onInit", "firstTriggerInitEvent", "children"];
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ 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."); }
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); }
3
7
  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; }
4
8
  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; }
5
9
  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; }
@@ -16,14 +20,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
20
  /* eslint-disable no-param-reassign */
17
21
  import { ProForm } from '@ant-design/pro-components';
18
22
  import { BaseForm, getFieldsDefaultValues, useRequestFields, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
19
- import { Button, Skeleton, Space } from 'antd';
23
+ import { Button, Dropdown, Skeleton, Space, Checkbox } from 'antd';
20
24
  import { cloneDeep } from 'lodash';
21
25
  import { useEffect, useImperativeHandle, useRef } from 'react';
22
26
  import { FilterFormAutoWidthStyle, FilterFormStyle } from "./style";
23
27
 
24
- /**
25
- * FilterForm 组件 - 支持多语言的筛选表单
26
- * @param T 表单数据类型
28
+ /**
29
+ * FilterForm 组件 - 支持多语言的筛选表单
30
+ * @param T 表单数据类型
27
31
  */
28
32
  import { jsx as _jsx } from "react/jsx-runtime";
29
33
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -66,7 +70,9 @@ export var FilterForm = function FilterForm(_ref) {
66
70
  initialValues: {},
67
71
  fetchLoading: false,
68
72
  fields: [],
69
- currentInit: true
73
+ currentInit: true,
74
+ customFields: [],
75
+ selectedCustomFields: []
70
76
  };
71
77
  }),
72
78
  state = _useStateData.state,
@@ -127,18 +133,89 @@ export var FilterForm = function FilterForm(_ref) {
127
133
  };
128
134
  useEffect(function () {
129
135
  if (loading) return;
130
- var newFields = cloneDeep(fields);
136
+ var allFields = cloneDeep(fields);
137
+
138
+ // 分离自定义字段和普通字段
139
+ var customFields = allFields.filter(function (field) {
140
+ return field.isCustom;
141
+ });
142
+ var normalFields = allFields.filter(function (field) {
143
+ return !field.isCustom;
144
+ });
145
+
146
+ // 合并普通字段和已选择的自定义字段
147
+ var combinedFields = [].concat(_toConsumableArray(normalFields), _toConsumableArray(state.selectedCustomFields));
131
148
  if (displayType === 'average') {
132
- state.fields = newFields;
149
+ state.fields = combinedFields;
150
+ state.customFields = customFields;
133
151
  state.currentInit = false;
134
152
  update();
135
153
  } else {
136
- handlerSelectStyle(newFields);
137
- state.fields = newFields;
154
+ handlerSelectStyle(combinedFields);
155
+ state.fields = combinedFields;
156
+ state.customFields = customFields;
138
157
  state.currentInit = false;
139
158
  update();
140
159
  }
141
- }, [fields]);
160
+ }, [fields, state.selectedCustomFields]);
161
+
162
+ // 创建下拉菜单内容
163
+ var getDropdownMenu = function getDropdownMenu() {
164
+ var _state$customFields;
165
+ // 使用 Map 来快速查找已选择的字段
166
+ var selectedFieldsMap = new Map(state.selectedCustomFields.map(function (field) {
167
+ return [field.field, field];
168
+ }));
169
+ var items = (_state$customFields = state.customFields) === null || _state$customFields === void 0 ? void 0 : _state$customFields.map(function (field) {
170
+ var isSelected = selectedFieldsMap.has(field.field);
171
+ return {
172
+ key: field.field,
173
+ label: /*#__PURE__*/_jsx("div", {
174
+ style: {
175
+ display: 'flex',
176
+ alignItems: 'center',
177
+ minWidth: 200
178
+ },
179
+ onClick: function onClick(e) {
180
+ e.stopPropagation();
181
+ handleToggleCustomField(field.field);
182
+ },
183
+ children: /*#__PURE__*/_jsx(Checkbox, {
184
+ checked: isSelected,
185
+ children: field.label
186
+ })
187
+ })
188
+ };
189
+ });
190
+ return {
191
+ items: items
192
+ };
193
+ };
194
+
195
+ // 切换自定义字段的显示状态
196
+ var handleToggleCustomField = function handleToggleCustomField(fieldKey) {
197
+ // 使用 Map 来快速查找已选择的字段
198
+ var selectedFieldsMap = new Map(state.selectedCustomFields.map(function (field) {
199
+ return [field.field, field];
200
+ }));
201
+ var customFieldsMap = new Map(state.customFields.map(function (field) {
202
+ return [field.field, field];
203
+ }));
204
+ var isSelected = selectedFieldsMap.has(fieldKey);
205
+ if (isSelected) {
206
+ // 移除字段
207
+ state.selectedCustomFields = state.selectedCustomFields.filter(function (field) {
208
+ return field.field !== fieldKey;
209
+ });
210
+ } else {
211
+ // 添加字段
212
+ var fieldToAdd = customFieldsMap.get(fieldKey);
213
+ if (fieldToAdd) {
214
+ state.selectedCustomFields = [].concat(_toConsumableArray(state.selectedCustomFields), [fieldToAdd]);
215
+ }
216
+ }
217
+ update();
218
+ };
142
219
  useImperativeHandle(actionRef, function () {
143
220
  return {
144
221
  getAllValues: function getAllValues() {
@@ -223,6 +300,17 @@ export var FilterForm = function FilterForm(_ref) {
223
300
  id: 'pro.components.filter-form.search',
224
301
  defaultMessage: '查询'
225
302
  })
303
+ }), state.customFields.length > 0 && /*#__PURE__*/_jsx(Dropdown, {
304
+ menu: getDropdownMenu(),
305
+ trigger: ['click'],
306
+ placement: "bottomLeft",
307
+ children: /*#__PURE__*/_jsx(Button, {
308
+ type: "primary",
309
+ children: formatMessage({
310
+ id: 'pro.components.filter-form.custom-filters',
311
+ defaultMessage: '自定义筛选条件'
312
+ })
313
+ })
226
314
  })]
227
315
  });
228
316
  }
@@ -46,8 +46,8 @@ export function ProDrawerTable(_ref) {
46
46
  onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
47
47
  }, [open]);
48
48
 
49
- /**
50
- * 暴露方法
49
+ /**
50
+ * 暴露方法
51
51
  */
52
52
  useImperativeHandle(action, function () {
53
53
  return _objectSpread({}, actionRef);
@@ -48,8 +48,8 @@ export function ProModalForm(_ref) {
48
48
  onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
49
49
  }, [open]);
50
50
 
51
- /**
52
- * 暴露方法
51
+ /**
52
+ * 暴露方法
53
53
  */
54
54
  useImperativeHandle(action, function () {
55
55
  return _objectSpread({}, actionRef);
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare const proLocales: {
22
22
  "filter-form": {
23
23
  reset: string;
24
24
  search: string;
25
+ "custom-filters": string;
25
26
  };
26
27
  };
27
28
  };
@@ -1,26 +1,26 @@
1
- {
2
- "pro": {
3
- "components": {
4
- "rex-pro-table": {
5
- "empty-text": "Please select relevant filter criteria to search",
6
- "column-action-title": "Actions",
7
- "pagination-total": "{total} entries in total",
8
- "action-buttons": {
9
- "please-check-data": "Please select data",
10
- "confirm-operation": "Confirm operation {label}",
11
- "confirm-execute": "Are you sure you want to proceed?",
12
- "item-label-missing": "Button label not configured",
13
- "group-label-missing": "Group label not configured"
14
- },
15
- "form": {
16
- "cancel": "Cancel",
17
- "confirm": "Confirm"
18
- }
19
- },
20
- "filter-form": {
21
- "reset": "Reset",
22
- "search": "Search"
23
- }
24
- }
25
- }
26
- }
1
+ {
2
+ "pro": {
3
+ "components": {
4
+ "rex-pro-table": {
5
+ "empty-text": "Please select relevant filter criteria to search",
6
+ "column-action-title": "Actions",
7
+ "pagination-total": "{total} entries in total",
8
+ "action-buttons": {
9
+ "please-check-data": "Please select data",
10
+ "confirm-operation": "Confirm operation {label}",
11
+ "confirm-execute": "Are you sure you want to proceed?",
12
+ "item-label-missing": "Button label not configured",
13
+ "group-label-missing": "Group label not configured"
14
+ },
15
+ "form": {
16
+ "cancel": "Cancel",
17
+ "confirm": "Confirm"
18
+ }
19
+ },
20
+ "filter-form": {
21
+ "reset": "Reset",
22
+ "search": "Search"
23
+ }
24
+ }
25
+ }
26
+ }
@@ -1,26 +1,27 @@
1
- {
2
- "pro": {
3
- "components": {
4
- "rex-pro-table": {
5
- "empty-text": "请选择相关筛选条件进行搜索",
6
- "column-action-title": "操作",
7
- "pagination-total": "共 {total} 条",
8
- "action-buttons": {
9
- "please-check-data": "请勾选数据",
10
- "confirm-operation": "确认操作{label}",
11
- "confirm-execute": "确认要执行此操作吗?",
12
- "item-label-missing": "未配置按钮标签",
13
- "group-label-missing": "未配置分组标签"
14
- },
15
- "form": {
16
- "cancel": "取消",
17
- "confirm": "确认"
18
- }
19
- },
20
- "filter-form": {
21
- "reset": "重置",
22
- "search": "查询"
23
- }
24
- }
25
- }
26
- }
1
+ {
2
+ "pro": {
3
+ "components": {
4
+ "rex-pro-table": {
5
+ "empty-text": "请选择相关筛选条件进行搜索",
6
+ "column-action-title": "操作",
7
+ "pagination-total": "共 {total} 条",
8
+ "action-buttons": {
9
+ "please-check-data": "请勾选数据",
10
+ "confirm-operation": "确认操作{label}",
11
+ "confirm-execute": "确认要执行此操作吗?",
12
+ "item-label-missing": "未配置按钮标签",
13
+ "group-label-missing": "未配置分组标签"
14
+ },
15
+ "form": {
16
+ "cancel": "取消",
17
+ "confirm": "确认"
18
+ }
19
+ },
20
+ "filter-form": {
21
+ "reset": "重置",
22
+ "search": "查询",
23
+ "custom-filters": "自定义筛选条件"
24
+ }
25
+ }
26
+ }
27
+ }
@@ -1,4 +1,4 @@
1
- declare module '*.svg' {
2
- const content: string;
3
- export default content;
4
- }
1
+ declare module '*.svg' {
2
+ const content: string;
3
+ export default content;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/rex-pro",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",