@teamias/rex-pro 0.0.8 → 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/dist/components/filter-form/v1/demo/CustomFilterForm.d.ts +2 -0
- package/dist/components/filter-form/v1/demo/CustomFilterForm.js +334 -0
- package/dist/components/filter-form/v1/filter-form.js +95 -7
- package/dist/components/rex-pro-table/v1/demo/BasicRexProTable.js +11 -3
- package/dist/components/rex-pro-table/v1/rex-pro-table.js +7 -2
- package/dist/components/rex-pro-table/v1/types.d.ts +5 -2
- package/dist/index.d.ts +1 -0
- package/dist/locales/zh-CN.json +2 -1
- package/package.json +1 -1
|
@@ -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,7 +20,7 @@ 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";
|
|
@@ -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
|
|
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 =
|
|
149
|
+
state.fields = combinedFields;
|
|
150
|
+
state.customFields = customFields;
|
|
133
151
|
state.currentInit = false;
|
|
134
152
|
update();
|
|
135
153
|
} else {
|
|
136
|
-
handlerSelectStyle(
|
|
137
|
-
state.fields =
|
|
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
|
}
|
|
@@ -655,7 +655,8 @@ export default (function () {
|
|
|
655
655
|
}, {
|
|
656
656
|
title: '供应商',
|
|
657
657
|
dataIndex: 'factory',
|
|
658
|
-
key: 'factory'
|
|
658
|
+
key: 'factory',
|
|
659
|
+
sorter: 'factory'
|
|
659
660
|
}, {
|
|
660
661
|
title: 'ASIN',
|
|
661
662
|
dataIndex: 'asin',
|
|
@@ -1071,14 +1072,21 @@ export default (function () {
|
|
|
1071
1072
|
}
|
|
1072
1073
|
},
|
|
1073
1074
|
request: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1075
|
+
var _len2,
|
|
1076
|
+
args,
|
|
1077
|
+
_key2,
|
|
1078
|
+
_args2 = arguments;
|
|
1074
1079
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1075
1080
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1076
1081
|
case 0:
|
|
1077
|
-
|
|
1082
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1083
|
+
args[_key2] = _args2[_key2];
|
|
1084
|
+
}
|
|
1085
|
+
console.log('调用次', args);
|
|
1078
1086
|
state.selectKeys = [];
|
|
1079
1087
|
update({});
|
|
1080
1088
|
return _context2.abrupt("return", JSON.parse(JSON.stringify(tableData)));
|
|
1081
|
-
case
|
|
1089
|
+
case 5:
|
|
1082
1090
|
case "end":
|
|
1083
1091
|
return _context2.stop();
|
|
1084
1092
|
}
|
|
@@ -13,12 +13,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
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; }
|
|
14
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import { FilterForm } from "../../filter-form";
|
|
16
17
|
import { ProForm } from '@ant-design/pro-components';
|
|
17
18
|
import { BaseListTable, BaseTable, useRequestFieldsConfig, useRexProConfigProvider, useStateData } from '@teamias/rex-design';
|
|
18
19
|
import { Card, Pagination, Skeleton, Space } from 'antd';
|
|
19
20
|
import { cloneDeep } from 'lodash';
|
|
20
21
|
import React, { useImperativeHandle, useRef } from 'react';
|
|
21
|
-
import { FilterForm } from "../../filter-form";
|
|
22
22
|
import { ActionButtons } from "./components/ActionButtons";
|
|
23
23
|
import { TableActionButtonGroup, ToolbarBox, Wrapper } from "./style";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -321,7 +321,12 @@ var InlineRexProTable = function InlineRexProTable(_ref) {
|
|
|
321
321
|
customEmptyText: state.customEmptyText,
|
|
322
322
|
loading: state.loading,
|
|
323
323
|
pagination: false,
|
|
324
|
-
extraColumns: extraColumns
|
|
324
|
+
extraColumns: extraColumns,
|
|
325
|
+
onChange: function onChange(pagination, filters, sorter) {
|
|
326
|
+
state.params.sort = JSON.parse(JSON.stringify(sorter || {}));
|
|
327
|
+
state.params.filter = JSON.parse(JSON.stringify(filters || {}));
|
|
328
|
+
action.getList(1);
|
|
329
|
+
}
|
|
325
330
|
})), (_state$dataSource = state.dataSource) !== null && _state$dataSource !== void 0 && _state$dataSource.length && !hidePagination ? /*#__PURE__*/_jsx(Pagination, {
|
|
326
331
|
style: {
|
|
327
332
|
marginTop: 10
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { FilterForm, IFilterFormProps } from "../../filter-form";
|
|
1
2
|
import { BaseListTable, BaseTable, RequestFieldsContainer, TButtonFilterItem } from '@teamias/rex-design';
|
|
2
3
|
import { Button, DrawerProps, DropDownProps, FormInstance, GetProps, ModalProps } from 'antd';
|
|
3
4
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
4
5
|
import { MutableRefObject, ReactNode } from 'react';
|
|
5
|
-
import { FilterForm, IFilterFormProps } from "../../filter-form";
|
|
6
6
|
/** 组件props */
|
|
7
7
|
export interface IRexProTableProps<TF extends Record<string, unknown>, TT extends Record<string, unknown>> {
|
|
8
8
|
toolbar?: {
|
|
@@ -156,7 +156,10 @@ export type TRexProTableRequestParams<T> = {
|
|
|
156
156
|
page_size: number;
|
|
157
157
|
current: number;
|
|
158
158
|
};
|
|
159
|
-
sort:
|
|
159
|
+
sort: {
|
|
160
|
+
field?: string;
|
|
161
|
+
order?: 'ascend' | 'descend';
|
|
162
|
+
};
|
|
160
163
|
filter: unknown;
|
|
161
164
|
};
|
|
162
165
|
/** 接口回调 */
|
package/dist/index.d.ts
CHANGED
package/dist/locales/zh-CN.json
CHANGED