@teamias/rex-design 0.1.2 → 0.1.4
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/base-form/core/core.js +7 -1
- package/dist/components/base-form/demo/Base.js +16 -16
- package/dist/components/base-form/demo/BaseFormBasicDepend.js +1 -1
- package/dist/components/base-form/demo/BaseFormBasicTest.js +1 -1
- package/dist/components/base-form/demo/BaseFormDescriptions.js +16 -16
- package/dist/components/base-form/demo/BaseProFormSelectDim.d.ts +2 -0
- package/dist/components/base-form/demo/BaseProFormSelectDim.js +253 -0
- package/dist/components/base-form/modules/renderComponentNode.js +69 -80
- package/dist/components/base-form/types/field-type.d.ts +2 -3
- package/dist/components/data-cell/data-cell.js +11 -4
- package/dist/components/data-cell/modules/cellItemMap.d.ts +9 -1
- package/dist/components/data-cell/modules/cellItemMap.js +77 -42
- package/dist/components/data-cell/types.d.ts +3 -1
- package/dist/context/rex-pro-config-provider/rex-pro-config-context.d.ts +5 -0
- package/package.json +2 -4
|
@@ -38,7 +38,7 @@ export var Core = function Core(props) {
|
|
|
38
38
|
dependenciesSearchCacheData = _useRef2.current;
|
|
39
39
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
40
40
|
children: [/*#__PURE__*/_jsx(BaseFormStyle, {}), outFields === null || outFields === void 0 ? void 0 : outFields.map(function (item, index) {
|
|
41
|
-
var _item$field;
|
|
41
|
+
var _item$field, _config$item$initialV, _config$item$params;
|
|
42
42
|
var fields = Array.isArray(item.field) ? item.field : [(_item$field = item.field) !== null && _item$field !== void 0 ? _item$field : "custom-dynamic-".concat(index)];
|
|
43
43
|
var keyStr = fields.join('-');
|
|
44
44
|
var itemProps = outFieldProps === null || outFieldProps === void 0 ? void 0 : outFieldProps[fields.join('-')];
|
|
@@ -86,6 +86,12 @@ export var Core = function Core(props) {
|
|
|
86
86
|
rawAllProps: rawAllProps,
|
|
87
87
|
formatMessage: formatMessage
|
|
88
88
|
});
|
|
89
|
+
|
|
90
|
+
// 统一字段
|
|
91
|
+
config.item.initialValue = (_config$item$initialV = config.item.initialValue) !== null && _config$item$initialV !== void 0 ? _config$item$initialV : config.item.defaultValue;
|
|
92
|
+
delete config.item.defaultValue;
|
|
93
|
+
config.item.params = (_config$item$params = config.item.params) !== null && _config$item$params !== void 0 ? _config$item$params : config.item.defaultParams;
|
|
94
|
+
delete config.item.defaultParams;
|
|
89
95
|
if (mergeItem.hidden) return;
|
|
90
96
|
if (operationPermission && !operationPermission(mergeItem.permissionKey)) return;
|
|
91
97
|
|
|
@@ -21,7 +21,7 @@ export default (function () {
|
|
|
21
21
|
subItems: [{
|
|
22
22
|
valueType: 'select',
|
|
23
23
|
field: 'avg_cost',
|
|
24
|
-
|
|
24
|
+
initialValue: 'avg_cost',
|
|
25
25
|
// "itemWidth": "150px",
|
|
26
26
|
fieldProps: {
|
|
27
27
|
allowClear: false,
|
|
@@ -48,7 +48,7 @@ export default (function () {
|
|
|
48
48
|
field: 'multipleComponents-input',
|
|
49
49
|
labelWidth: '100px',
|
|
50
50
|
// itemWidth: '20%',
|
|
51
|
-
|
|
51
|
+
initialValue: '2025-05-05',
|
|
52
52
|
formItemProps: {
|
|
53
53
|
style: {
|
|
54
54
|
background: '#000',
|
|
@@ -63,7 +63,7 @@ export default (function () {
|
|
|
63
63
|
valueType: 'treeSelect',
|
|
64
64
|
field: 'multipleComponents-treeSelect',
|
|
65
65
|
// itemWidth: '80%',
|
|
66
|
-
|
|
66
|
+
initialValue: 'light',
|
|
67
67
|
options: [{
|
|
68
68
|
label: 'Light',
|
|
69
69
|
value: 'light'
|
|
@@ -74,7 +74,7 @@ export default (function () {
|
|
|
74
74
|
}, {
|
|
75
75
|
valueType: 'datePicker',
|
|
76
76
|
field: 'multipleComponents-datePicker',
|
|
77
|
-
|
|
77
|
+
initialValue: '2025-05-05'
|
|
78
78
|
}, {
|
|
79
79
|
valueType: 'treeSelect',
|
|
80
80
|
field: 'multipleComponents-treeSelect2',
|
|
@@ -92,12 +92,12 @@ export default (function () {
|
|
|
92
92
|
// {
|
|
93
93
|
// valueType: 'inputNumberRangeV2',
|
|
94
94
|
// field: ['multipleComponents-min', 'multipleComponents-max'],
|
|
95
|
-
//
|
|
95
|
+
// initialValue: [2, 5],
|
|
96
96
|
// },
|
|
97
97
|
// {
|
|
98
98
|
// valueType: 'select',
|
|
99
99
|
// field: 'multipleComponents-select',
|
|
100
|
-
//
|
|
100
|
+
// initialValue: 'light',
|
|
101
101
|
// options: [
|
|
102
102
|
// {label: 'Light', value: 'light'},
|
|
103
103
|
// {label: 'Light2', value: 'light2'},
|
|
@@ -112,13 +112,13 @@ export default (function () {
|
|
|
112
112
|
valueType: 'input',
|
|
113
113
|
field: 'input',
|
|
114
114
|
label: 'input',
|
|
115
|
-
|
|
115
|
+
initialValue: 'input',
|
|
116
116
|
hidden: false
|
|
117
117
|
}, {
|
|
118
118
|
valueType: 'select',
|
|
119
119
|
field: 'select',
|
|
120
120
|
label: 'select',
|
|
121
|
-
|
|
121
|
+
initialValue: 'light',
|
|
122
122
|
options: [{
|
|
123
123
|
label: 'Light',
|
|
124
124
|
value: 'light'
|
|
@@ -131,7 +131,7 @@ export default (function () {
|
|
|
131
131
|
field: 'selectDim',
|
|
132
132
|
label: 'selectDim',
|
|
133
133
|
api: '/selectData',
|
|
134
|
-
|
|
134
|
+
params: {
|
|
135
135
|
a: 1,
|
|
136
136
|
b: 2
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ export default (function () {
|
|
|
139
139
|
valueType: 'dateRangeV2',
|
|
140
140
|
field: ['dateRangeV2-start', 'dateRangeV2-end'],
|
|
141
141
|
label: 'dateRangeV2',
|
|
142
|
-
|
|
142
|
+
initialValue: -29,
|
|
143
143
|
required: true,
|
|
144
144
|
fieldProps: {
|
|
145
145
|
showTime: true,
|
|
@@ -174,7 +174,7 @@ export default (function () {
|
|
|
174
174
|
valueType: 'checkbox',
|
|
175
175
|
field: 'checkbox',
|
|
176
176
|
label: 'checkbox',
|
|
177
|
-
|
|
177
|
+
initialValue: true
|
|
178
178
|
}, {
|
|
179
179
|
valueType: 'checkboxGroup',
|
|
180
180
|
field: 'checkboxGroup',
|
|
@@ -190,7 +190,7 @@ export default (function () {
|
|
|
190
190
|
valueType: 'radioGroup',
|
|
191
191
|
field: 'radioGroup',
|
|
192
192
|
label: 'radioGroup',
|
|
193
|
-
|
|
193
|
+
initialValue: 'light',
|
|
194
194
|
options: [{
|
|
195
195
|
label: 'Light',
|
|
196
196
|
value: 'light'
|
|
@@ -202,17 +202,17 @@ export default (function () {
|
|
|
202
202
|
valueType: 'inputNumber',
|
|
203
203
|
field: 'inputNumber',
|
|
204
204
|
label: 'inputNumber',
|
|
205
|
-
|
|
205
|
+
initialValue: 2
|
|
206
206
|
}, {
|
|
207
207
|
valueType: 'inputNumberRangeV2',
|
|
208
208
|
field: ['inputNumberRangeV2-min', 'inputNumberRangeV2-max'],
|
|
209
209
|
label: 'inputNumberRangeV2',
|
|
210
|
-
|
|
210
|
+
initialValue: [2, 5]
|
|
211
211
|
}, {
|
|
212
212
|
valueType: 'textArea',
|
|
213
213
|
field: 'textArea',
|
|
214
214
|
label: 'textArea',
|
|
215
|
-
|
|
215
|
+
initialValue: 'qweqwe'
|
|
216
216
|
}, {
|
|
217
217
|
valueType: 'switch',
|
|
218
218
|
field: 'switch',
|
|
@@ -221,7 +221,7 @@ export default (function () {
|
|
|
221
221
|
valueType: 'datePicker',
|
|
222
222
|
field: 'datePicker',
|
|
223
223
|
label: 'datePicker',
|
|
224
|
-
|
|
224
|
+
initialValue: '2025-05-05'
|
|
225
225
|
}];
|
|
226
226
|
var initialValues = getFieldsDefaultValues(fields);
|
|
227
227
|
// console.log(initialValues);
|
|
@@ -30,7 +30,7 @@ export default (function () {
|
|
|
30
30
|
subItems: [{
|
|
31
31
|
valueType: 'select',
|
|
32
32
|
field: 'avg_cost',
|
|
33
|
-
|
|
33
|
+
initialValue: 'avg_cost',
|
|
34
34
|
itemWidth: '150px',
|
|
35
35
|
fieldProps: {
|
|
36
36
|
allowClear: false,
|
|
@@ -59,7 +59,7 @@ export default (function () {
|
|
|
59
59
|
field: 'multipleComponents-input',
|
|
60
60
|
labelWidth: '100px',
|
|
61
61
|
// itemWidth: '20%',
|
|
62
|
-
|
|
62
|
+
initialValue: '2025-05-05',
|
|
63
63
|
fieldProps: {
|
|
64
64
|
prefix: /*#__PURE__*/_jsx(UserOutlined, {}),
|
|
65
65
|
disabled: true
|
|
@@ -68,7 +68,7 @@ export default (function () {
|
|
|
68
68
|
valueType: 'treeSelect',
|
|
69
69
|
field: 'multipleComponents-treeSelect',
|
|
70
70
|
// itemWidth: '80%',
|
|
71
|
-
|
|
71
|
+
initialValue: 'light',
|
|
72
72
|
options: [{
|
|
73
73
|
label: 'Light',
|
|
74
74
|
value: 'light'
|
|
@@ -79,7 +79,7 @@ export default (function () {
|
|
|
79
79
|
}, {
|
|
80
80
|
valueType: 'datePicker',
|
|
81
81
|
field: 'multipleComponents-datePicker',
|
|
82
|
-
|
|
82
|
+
initialValue: '2025-05-05',
|
|
83
83
|
dependenciesV2: [{
|
|
84
84
|
action: 'clear',
|
|
85
85
|
field: 'multipleComponents-treeSelect'
|
|
@@ -101,12 +101,12 @@ export default (function () {
|
|
|
101
101
|
// {
|
|
102
102
|
// valueType: 'inputNumberRangeV2',
|
|
103
103
|
// field: ['multipleComponents-min', 'multipleComponents-max'],
|
|
104
|
-
//
|
|
104
|
+
// initialValue: [2, 5],
|
|
105
105
|
// },
|
|
106
106
|
// {
|
|
107
107
|
// valueType: 'select',
|
|
108
108
|
// field: 'multipleComponents-select',
|
|
109
|
-
//
|
|
109
|
+
// initialValue: 'light',
|
|
110
110
|
// options: [
|
|
111
111
|
// {label: 'Light', value: 'light'},
|
|
112
112
|
// {label: 'Light2', value: 'light2'},
|
|
@@ -122,7 +122,7 @@ export default (function () {
|
|
|
122
122
|
valueType: 'input',
|
|
123
123
|
field: 'input',
|
|
124
124
|
label: 'input',
|
|
125
|
-
|
|
125
|
+
initialValue: 'input',
|
|
126
126
|
hidden: false,
|
|
127
127
|
rules: [{
|
|
128
128
|
required: true,
|
|
@@ -132,7 +132,7 @@ export default (function () {
|
|
|
132
132
|
valueType: 'select',
|
|
133
133
|
field: 'select',
|
|
134
134
|
label: 'select',
|
|
135
|
-
|
|
135
|
+
initialValue: 'light',
|
|
136
136
|
options: [{
|
|
137
137
|
label: 'Light',
|
|
138
138
|
value: 'light'
|
|
@@ -145,7 +145,7 @@ export default (function () {
|
|
|
145
145
|
field: 'selectDim',
|
|
146
146
|
label: 'selectDim',
|
|
147
147
|
api: '/selectData',
|
|
148
|
-
|
|
148
|
+
params: {
|
|
149
149
|
a: 1,
|
|
150
150
|
b: 2
|
|
151
151
|
}
|
|
@@ -153,7 +153,7 @@ export default (function () {
|
|
|
153
153
|
valueType: 'dateRangeV2',
|
|
154
154
|
field: ['dateRangeV2-start', 'dateRangeV2-end'],
|
|
155
155
|
label: 'dateRangeV2',
|
|
156
|
-
|
|
156
|
+
initialValue: -29,
|
|
157
157
|
required: true,
|
|
158
158
|
fieldProps: {
|
|
159
159
|
showTime: true,
|
|
@@ -199,7 +199,7 @@ export default (function () {
|
|
|
199
199
|
valueType: 'radioGroup',
|
|
200
200
|
field: 'radioGroup',
|
|
201
201
|
label: 'radioGroup',
|
|
202
|
-
|
|
202
|
+
initialValue: 'light',
|
|
203
203
|
options: [{
|
|
204
204
|
label: 'Light',
|
|
205
205
|
value: 'light'
|
|
@@ -211,17 +211,17 @@ export default (function () {
|
|
|
211
211
|
valueType: 'inputNumber',
|
|
212
212
|
field: 'inputNumber',
|
|
213
213
|
label: 'inputNumber',
|
|
214
|
-
|
|
214
|
+
initialValue: 2
|
|
215
215
|
}, {
|
|
216
216
|
valueType: 'inputNumberRangeV2',
|
|
217
217
|
field: ['inputNumberRangeV2-min', 'inputNumberRangeV2-max'],
|
|
218
218
|
label: 'inputNumberRangeV2',
|
|
219
|
-
|
|
219
|
+
initialValue: [2, 5]
|
|
220
220
|
}, {
|
|
221
221
|
valueType: 'textArea',
|
|
222
222
|
field: 'textArea',
|
|
223
223
|
label: 'textArea',
|
|
224
|
-
|
|
224
|
+
initialValue: 'qweqwe'
|
|
225
225
|
}, {
|
|
226
226
|
valueType: 'switch',
|
|
227
227
|
field: 'switch',
|
|
@@ -230,7 +230,7 @@ export default (function () {
|
|
|
230
230
|
valueType: 'datePicker',
|
|
231
231
|
field: 'datePicker',
|
|
232
232
|
label: 'datePicker',
|
|
233
|
-
|
|
233
|
+
initialValue: '2025-05-05',
|
|
234
234
|
dependenciesV2: [{
|
|
235
235
|
field: 'switch',
|
|
236
236
|
action: 'show',
|
|
@@ -241,7 +241,7 @@ export default (function () {
|
|
|
241
241
|
valueType: 'datePicker',
|
|
242
242
|
field: 'datePicker2',
|
|
243
243
|
label: 'datePicker2',
|
|
244
|
-
|
|
244
|
+
initialValue: '2025-05-05'
|
|
245
245
|
// dependenciesV2: [
|
|
246
246
|
// {
|
|
247
247
|
// field: 'switch',
|
|
@@ -0,0 +1,253 @@
|
|
|
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 _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; }
|
|
3
|
+
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); } }
|
|
4
|
+
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); }); }; }
|
|
5
|
+
import { RexProConfigProvider } from "../../../context";
|
|
6
|
+
import { ProForm } from '@ant-design/pro-components';
|
|
7
|
+
import { BaseForm } from "../../..";
|
|
8
|
+
import { createIntl } from 'react-intl';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
var options = [{
|
|
11
|
+
label: '总裁办公室',
|
|
12
|
+
value: 'dept_001'
|
|
13
|
+
}, {
|
|
14
|
+
label: '人力资源部',
|
|
15
|
+
value: 'dept_002'
|
|
16
|
+
}, {
|
|
17
|
+
label: '财务部',
|
|
18
|
+
value: 'dept_003'
|
|
19
|
+
}, {
|
|
20
|
+
label: '市场营销部',
|
|
21
|
+
value: 'dept_004'
|
|
22
|
+
}, {
|
|
23
|
+
label: '销售一部',
|
|
24
|
+
value: 'dept_005'
|
|
25
|
+
}, {
|
|
26
|
+
label: '销售二部',
|
|
27
|
+
value: 'dept_006'
|
|
28
|
+
}, {
|
|
29
|
+
label: '销售三部',
|
|
30
|
+
value: 'dept_007'
|
|
31
|
+
}, {
|
|
32
|
+
label: '客户服务部',
|
|
33
|
+
value: 'dept_008'
|
|
34
|
+
}, {
|
|
35
|
+
label: '技术研发部',
|
|
36
|
+
value: 'dept_009'
|
|
37
|
+
}, {
|
|
38
|
+
label: '产品设计部',
|
|
39
|
+
value: 'dept_010'
|
|
40
|
+
}, {
|
|
41
|
+
label: '前端开发组',
|
|
42
|
+
value: 'dept_011'
|
|
43
|
+
}, {
|
|
44
|
+
label: '后端开发组',
|
|
45
|
+
value: 'dept_012'
|
|
46
|
+
}, {
|
|
47
|
+
label: '移动开发组',
|
|
48
|
+
value: 'dept_013'
|
|
49
|
+
}, {
|
|
50
|
+
label: '测试部',
|
|
51
|
+
value: 'dept_014'
|
|
52
|
+
}, {
|
|
53
|
+
label: '运维部',
|
|
54
|
+
value: 'dept_015'
|
|
55
|
+
}, {
|
|
56
|
+
label: '数据分析部',
|
|
57
|
+
value: 'dept_016'
|
|
58
|
+
}, {
|
|
59
|
+
label: '信息安全部',
|
|
60
|
+
value: 'dept_017'
|
|
61
|
+
}, {
|
|
62
|
+
label: '项目管理部',
|
|
63
|
+
value: 'dept_018'
|
|
64
|
+
}, {
|
|
65
|
+
label: '质量管理部',
|
|
66
|
+
value: 'dept_019'
|
|
67
|
+
}, {
|
|
68
|
+
label: '采购部',
|
|
69
|
+
value: 'dept_020'
|
|
70
|
+
}, {
|
|
71
|
+
label: '供应链管理部',
|
|
72
|
+
value: 'dept_021'
|
|
73
|
+
}, {
|
|
74
|
+
label: '仓储物流部',
|
|
75
|
+
value: 'dept_022'
|
|
76
|
+
}, {
|
|
77
|
+
label: '生产制造部',
|
|
78
|
+
value: 'dept_023'
|
|
79
|
+
}, {
|
|
80
|
+
label: '设备管理部',
|
|
81
|
+
value: 'dept_024'
|
|
82
|
+
}, {
|
|
83
|
+
label: '品牌策划部',
|
|
84
|
+
value: 'dept_025'
|
|
85
|
+
}, {
|
|
86
|
+
label: '公共关系部',
|
|
87
|
+
value: 'dept_026'
|
|
88
|
+
}, {
|
|
89
|
+
label: '法务部',
|
|
90
|
+
value: 'dept_027'
|
|
91
|
+
}, {
|
|
92
|
+
label: '审计部',
|
|
93
|
+
value: 'dept_028'
|
|
94
|
+
}, {
|
|
95
|
+
label: '行政部',
|
|
96
|
+
value: 'dept_029'
|
|
97
|
+
}, {
|
|
98
|
+
label: '后勤保障部',
|
|
99
|
+
value: 'dept_030'
|
|
100
|
+
}, {
|
|
101
|
+
label: '国际业务部',
|
|
102
|
+
value: 'dept_031'
|
|
103
|
+
}, {
|
|
104
|
+
label: '华东区分公司',
|
|
105
|
+
value: 'dept_032'
|
|
106
|
+
}, {
|
|
107
|
+
label: '华南区分公司',
|
|
108
|
+
value: 'dept_033'
|
|
109
|
+
}, {
|
|
110
|
+
label: '华北区分公司',
|
|
111
|
+
value: 'dept_034'
|
|
112
|
+
}, {
|
|
113
|
+
label: '西南区分公司',
|
|
114
|
+
value: 'dept_035'
|
|
115
|
+
}, {
|
|
116
|
+
label: '东北区分公司',
|
|
117
|
+
value: 'dept_036'
|
|
118
|
+
}, {
|
|
119
|
+
label: '战略发展部',
|
|
120
|
+
value: 'dept_037'
|
|
121
|
+
}, {
|
|
122
|
+
label: '投资并购部',
|
|
123
|
+
value: 'dept_038'
|
|
124
|
+
}, {
|
|
125
|
+
label: '企业文化部',
|
|
126
|
+
value: 'dept_039'
|
|
127
|
+
}, {
|
|
128
|
+
label: '培训发展部',
|
|
129
|
+
value: 'dept_040'
|
|
130
|
+
}, {
|
|
131
|
+
label: '招聘管理部',
|
|
132
|
+
value: 'dept_041'
|
|
133
|
+
}, {
|
|
134
|
+
label: '薪酬绩效部',
|
|
135
|
+
value: 'dept_042'
|
|
136
|
+
}, {
|
|
137
|
+
label: '员工关系部',
|
|
138
|
+
value: 'dept_043'
|
|
139
|
+
}, {
|
|
140
|
+
label: '电商运营部',
|
|
141
|
+
value: 'dept_044'
|
|
142
|
+
}, {
|
|
143
|
+
label: '新媒体运营部',
|
|
144
|
+
value: 'dept_045'
|
|
145
|
+
}, {
|
|
146
|
+
label: '用户增长部',
|
|
147
|
+
value: 'dept_046'
|
|
148
|
+
}, {
|
|
149
|
+
label: '商务拓展部',
|
|
150
|
+
value: 'dept_047'
|
|
151
|
+
}, {
|
|
152
|
+
label: '渠道管理部',
|
|
153
|
+
value: 'dept_048'
|
|
154
|
+
}, {
|
|
155
|
+
label: '售后服务部',
|
|
156
|
+
value: 'dept_049'
|
|
157
|
+
}, {
|
|
158
|
+
label: '技术支持部',
|
|
159
|
+
value: 'dept_050'
|
|
160
|
+
}];
|
|
161
|
+
export default (function () {
|
|
162
|
+
return /*#__PURE__*/_jsx(RexProConfigProvider, {
|
|
163
|
+
value: {
|
|
164
|
+
intl: createIntl({
|
|
165
|
+
locale: 'en-US',
|
|
166
|
+
messages: {},
|
|
167
|
+
onError: function onError() {}
|
|
168
|
+
}),
|
|
169
|
+
apiClient: function () {
|
|
170
|
+
var _apiClient = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, params) {
|
|
171
|
+
var _ref, keyWords, customKey, id, searchValue;
|
|
172
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
173
|
+
while (1) switch (_context.prev = _context.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
_ref = params, keyWords = _ref.keyWords, customKey = _ref.customKey, id = _ref.id;
|
|
176
|
+
searchValue = keyWords !== null && keyWords !== void 0 ? keyWords : customKey;
|
|
177
|
+
fetch(api, {
|
|
178
|
+
method: 'post',
|
|
179
|
+
body: JSON.stringify(params)
|
|
180
|
+
});
|
|
181
|
+
if (!searchValue) {
|
|
182
|
+
_context.next = 5;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return _context.abrupt("return", options.filter(function (ii) {
|
|
186
|
+
return ii.label.includes(searchValue) || ii.value.includes(searchValue);
|
|
187
|
+
}));
|
|
188
|
+
case 5:
|
|
189
|
+
if (!id) {
|
|
190
|
+
_context.next = 7;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
return _context.abrupt("return", options.filter(function (ii) {
|
|
194
|
+
return ii.value === id;
|
|
195
|
+
}));
|
|
196
|
+
case 7:
|
|
197
|
+
return _context.abrupt("return", options.slice(0, 10));
|
|
198
|
+
case 8:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context.stop();
|
|
201
|
+
}
|
|
202
|
+
}, _callee);
|
|
203
|
+
}));
|
|
204
|
+
function apiClient(_x, _x2) {
|
|
205
|
+
return _apiClient.apply(this, arguments);
|
|
206
|
+
}
|
|
207
|
+
return apiClient;
|
|
208
|
+
}()
|
|
209
|
+
},
|
|
210
|
+
children: /*#__PURE__*/_jsx(ProForm
|
|
211
|
+
// initialValues={{}}
|
|
212
|
+
, {
|
|
213
|
+
layout: "horizontal",
|
|
214
|
+
onFinish: function onFinish(values) {
|
|
215
|
+
console.log(values);
|
|
216
|
+
},
|
|
217
|
+
children: /*#__PURE__*/_jsx(BaseForm, {
|
|
218
|
+
fields: [{
|
|
219
|
+
valueType: 'selectDim',
|
|
220
|
+
field: 'selectDim1',
|
|
221
|
+
label: '[模式 0]使用 selectDim1, keyWords 作为搜索条件key',
|
|
222
|
+
api: '/options-1'
|
|
223
|
+
// apiSearchKey: '',
|
|
224
|
+
// apiSearchValueKey: '',
|
|
225
|
+
}, {
|
|
226
|
+
valueType: 'selectDim',
|
|
227
|
+
field: 'selectDim2-1',
|
|
228
|
+
label: '[模式 1(apiSearchKey)]只使用 keyWords 作为搜索条件key',
|
|
229
|
+
api: '/options-2-1',
|
|
230
|
+
apiSearchKey: false
|
|
231
|
+
// apiSearchValueKey: '',
|
|
232
|
+
}, {
|
|
233
|
+
valueType: 'selectDim',
|
|
234
|
+
field: 'selectDim2-2',
|
|
235
|
+
label: '[模式 2(apiSearchKey)]使用 customKey, keyWords 作为搜索条件key',
|
|
236
|
+
api: '/options-2-2',
|
|
237
|
+
apiSearchKey: 'customKey'
|
|
238
|
+
// apiSearchValueKey: '',
|
|
239
|
+
}, {
|
|
240
|
+
valueType: 'selectDim',
|
|
241
|
+
field: 'selectDim3',
|
|
242
|
+
label: '用于数据回显, 使用 id 作为搜索条件key',
|
|
243
|
+
api: '/options-3',
|
|
244
|
+
params: {
|
|
245
|
+
otherData: '1231'
|
|
246
|
+
},
|
|
247
|
+
apiSearchValueKey: 'id',
|
|
248
|
+
initialValue: 'dept_044'
|
|
249
|
+
}]
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
var _excluded = ["valueType", "label", "
|
|
2
|
+
var _excluded = ["valueType", "label", "childWidths", "fieldProps", "formItemProps", "params"],
|
|
3
3
|
_excluded2 = ["formItemProps", "fieldProps"],
|
|
4
4
|
_excluded3 = ["formItemProps", "fieldProps", "name"],
|
|
5
5
|
_excluded4 = ["formItemProps", "fieldProps"],
|
|
@@ -72,13 +72,11 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
72
72
|
_outConfig$item = outConfig.item,
|
|
73
73
|
valueType = _outConfig$item.valueType,
|
|
74
74
|
label = _outConfig$item.label,
|
|
75
|
-
defaultValue = _outConfig$item.defaultValue,
|
|
76
75
|
_outConfig$item$child = _outConfig$item.childWidths,
|
|
77
76
|
childWidths = _outConfig$item$child === void 0 ? [] : _outConfig$item$child,
|
|
78
77
|
rawFieldProps = _outConfig$item.fieldProps,
|
|
79
78
|
rawFormItemProps = _outConfig$item.formItemProps,
|
|
80
79
|
params = _outConfig$item.params,
|
|
81
|
-
defaultParams = _outConfig$item.defaultParams,
|
|
82
80
|
otherProps = _objectWithoutProperties(_outConfig$item, _excluded),
|
|
83
81
|
requestOptions = outConfig.requestOptions,
|
|
84
82
|
itemWidth = outConfig.itemWidth,
|
|
@@ -305,26 +303,22 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
305
303
|
{
|
|
306
304
|
if (valueType === 'checkbox') {
|
|
307
305
|
return dynamicCom(ProFormCheckbox, {
|
|
308
|
-
name: splitKeyStr(keyStr)
|
|
309
|
-
initialValue: defaultValue
|
|
306
|
+
name: splitKeyStr(keyStr)
|
|
310
307
|
});
|
|
311
308
|
}
|
|
312
309
|
if (valueType === 'switch') {
|
|
313
310
|
return dynamicCom(ProFormSwitch, {
|
|
314
|
-
name: splitKeyStr(keyStr)
|
|
315
|
-
initialValue: defaultValue
|
|
311
|
+
name: splitKeyStr(keyStr)
|
|
316
312
|
});
|
|
317
313
|
}
|
|
318
314
|
if (valueType === 'datePicker') {
|
|
319
315
|
return dynamicCom(ProFormDatePicker, {
|
|
320
|
-
name: splitKeyStr(keyStr)
|
|
321
|
-
initialValue: defaultValue
|
|
316
|
+
name: splitKeyStr(keyStr)
|
|
322
317
|
});
|
|
323
318
|
}
|
|
324
319
|
if (valueType === 'input') {
|
|
325
320
|
return dynamicCom(ProFormText, {
|
|
326
|
-
name: splitKeyStr(keyStr)
|
|
327
|
-
initialValue: defaultValue
|
|
321
|
+
name: splitKeyStr(keyStr)
|
|
328
322
|
});
|
|
329
323
|
}
|
|
330
324
|
if (valueType === 'select') {
|
|
@@ -337,60 +331,71 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
337
331
|
debounceTime: 300,
|
|
338
332
|
name: splitKeyStr(keyStr),
|
|
339
333
|
options: item.api ? undefined : item.options,
|
|
340
|
-
params: item.api ? _objectSpread(_objectSpread(
|
|
341
|
-
initialValue: defaultValue,
|
|
334
|
+
params: item.api ? _objectSpread(_objectSpread({}, values), item.params) : undefined,
|
|
342
335
|
request: function () {
|
|
343
336
|
if (!item.api) return undefined;
|
|
344
337
|
var map = {};
|
|
345
|
-
return /*#__PURE__*/function () {
|
|
346
|
-
var _ref5
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
};
|
|
381
|
-
}
|
|
338
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
339
|
+
var _ref5,
|
|
340
|
+
keyWords,
|
|
341
|
+
params,
|
|
342
|
+
key,
|
|
343
|
+
res,
|
|
344
|
+
_args = arguments;
|
|
345
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
346
|
+
while (1) switch (_context.prev = _context.next) {
|
|
347
|
+
case 0:
|
|
348
|
+
_ref5 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, keyWords = _ref5.keyWords, params = _objectWithoutProperties(_ref5, _excluded7);
|
|
349
|
+
key = JSON.stringify(params);
|
|
350
|
+
if (!map[key]) {
|
|
351
|
+
_context.next = 4;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
return _context.abrupt("return", map[key]);
|
|
355
|
+
case 4:
|
|
356
|
+
_context.next = 6;
|
|
357
|
+
return requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, params, item);
|
|
358
|
+
case 6:
|
|
359
|
+
_context.t0 = _context.sent;
|
|
360
|
+
if (_context.t0) {
|
|
361
|
+
_context.next = 9;
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
_context.t0 = [];
|
|
365
|
+
case 9:
|
|
366
|
+
res = _context.t0;
|
|
367
|
+
map[key] = res;
|
|
368
|
+
return _context.abrupt("return", res);
|
|
369
|
+
case 12:
|
|
370
|
+
case "end":
|
|
371
|
+
return _context.stop();
|
|
372
|
+
}
|
|
373
|
+
}, _callee);
|
|
374
|
+
}));
|
|
382
375
|
}()
|
|
383
376
|
});
|
|
384
377
|
}
|
|
385
378
|
if (valueType === 'selectDim') {
|
|
386
|
-
var paramsProp = _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams);
|
|
387
|
-
// console.log(1111, params);
|
|
388
379
|
var keys = Array.isArray(splitKeyStr(keyStr)) ? splitKeyStr(keyStr) : [splitKeyStr(keyStr)];
|
|
380
|
+
// 用于标记是否已经初始化过
|
|
381
|
+
var initialized = false;
|
|
389
382
|
return /*#__PURE__*/_jsx(ProFormDependency, {
|
|
390
383
|
name: keys,
|
|
391
384
|
children: function children(dependData) {
|
|
392
385
|
// console.log(2222, dependData);
|
|
393
386
|
|
|
387
|
+
var paramsProp = _objectSpread(_objectSpread({}, values), item.params);
|
|
388
|
+
// 如果配置了 apiSearchValueKey,则将依赖数据 dependData[keyStr] 赋值到对应参数
|
|
389
|
+
if (typeof item.apiSearchValueKey === 'string') {
|
|
390
|
+
var currentValue = dependData[keyStr];
|
|
391
|
+
// 首次渲染且值为空时,使用初始值;后续使用表单实际值
|
|
392
|
+
if (!initialized && currentValue === undefined) {
|
|
393
|
+
paramsProp[item.apiSearchValueKey] = item.initialValue;
|
|
394
|
+
} else {
|
|
395
|
+
paramsProp[item.apiSearchValueKey] = currentValue;
|
|
396
|
+
}
|
|
397
|
+
initialized = true;
|
|
398
|
+
}
|
|
394
399
|
return dynamicCom(ProFormSelect, {
|
|
395
400
|
showSearch: true,
|
|
396
401
|
debounceTime: 300,
|
|
@@ -400,7 +405,6 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
400
405
|
mode: item.multiple ? 'multiple' : 'single',
|
|
401
406
|
params: paramsProp,
|
|
402
407
|
name: keys,
|
|
403
|
-
initialValue: defaultValue,
|
|
404
408
|
request: function () {
|
|
405
409
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
406
410
|
var _params$keyWords, keyWords, restParams, newParams;
|
|
@@ -409,12 +413,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
409
413
|
case 0:
|
|
410
414
|
// 拆分参数,keyWords 为搜索关键字,其余为接口参数
|
|
411
415
|
_params$keyWords = params.keyWords, keyWords = _params$keyWords === void 0 ? '' : _params$keyWords, restParams = _objectWithoutProperties(params, _excluded8);
|
|
412
|
-
newParams = restParams; //
|
|
413
|
-
if (typeof item.apiSearchValueKey === 'string') {
|
|
414
|
-
newParams[item.apiSearchValueKey] = dependData[keyStr] || undefined;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// 处理搜索关键字参数的传递方式
|
|
416
|
+
newParams = restParams; // 处理搜索关键字参数的传递方式
|
|
418
417
|
if (item.apiSearchKey === false) {
|
|
419
418
|
// 配置为 false,默认传 keyWords 字段
|
|
420
419
|
newParams.keyWords = keyWords || undefined;
|
|
@@ -429,13 +428,13 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
429
428
|
|
|
430
429
|
// 发起接口请求,返回选项数据
|
|
431
430
|
return _context2.abrupt("return", (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions(item.api, newParams, item)) || []);
|
|
432
|
-
case
|
|
431
|
+
case 4:
|
|
433
432
|
case "end":
|
|
434
433
|
return _context2.stop();
|
|
435
434
|
}
|
|
436
435
|
}, _callee2);
|
|
437
436
|
}));
|
|
438
|
-
function request(
|
|
437
|
+
function request(_x) {
|
|
439
438
|
return _request.apply(this, arguments);
|
|
440
439
|
}
|
|
441
440
|
return request;
|
|
@@ -472,8 +471,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
472
471
|
}), formatMessage({
|
|
473
472
|
id: 'rex.components.base-form.placeholder.date-range.end',
|
|
474
473
|
defaultMessage: '结束时间'
|
|
475
|
-
})]
|
|
476
|
-
initialValue: defaultValue
|
|
474
|
+
})]
|
|
477
475
|
});
|
|
478
476
|
}
|
|
479
477
|
if (valueType === 'cascader') {
|
|
@@ -489,8 +487,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
489
487
|
children: 'children'
|
|
490
488
|
}
|
|
491
489
|
},
|
|
492
|
-
|
|
493
|
-
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
490
|
+
params: item.api ? _objectSpread(_objectSpread({}, values), item.params) : undefined,
|
|
494
491
|
name: splitKeyStr(keyStr),
|
|
495
492
|
request: item.api ? ( /*#__PURE__*/function () {
|
|
496
493
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
@@ -504,7 +501,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
504
501
|
}
|
|
505
502
|
}, _callee3);
|
|
506
503
|
}));
|
|
507
|
-
return function (
|
|
504
|
+
return function (_x2) {
|
|
508
505
|
return _ref7.apply(this, arguments);
|
|
509
506
|
};
|
|
510
507
|
}()) : undefined
|
|
@@ -525,8 +522,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
525
522
|
},
|
|
526
523
|
treeNodeFilterProp: 'label'
|
|
527
524
|
},
|
|
528
|
-
|
|
529
|
-
params: item.api ? _objectSpread(_objectSpread(_objectSpread({}, values), item.params), item.defaultParams) : undefined,
|
|
525
|
+
params: item.api ? _objectSpread(_objectSpread({}, values), item.params) : undefined,
|
|
530
526
|
name: splitKeyStr(keyStr),
|
|
531
527
|
request: item.api ? ( /*#__PURE__*/function () {
|
|
532
528
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
@@ -540,7 +536,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
540
536
|
}
|
|
541
537
|
}, _callee4);
|
|
542
538
|
}));
|
|
543
|
-
return function (
|
|
539
|
+
return function (_x3) {
|
|
544
540
|
return _ref8.apply(this, arguments);
|
|
545
541
|
};
|
|
546
542
|
}()) : undefined
|
|
@@ -549,9 +545,8 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
549
545
|
if (valueType === 'checkboxGroup') {
|
|
550
546
|
return dynamicCom(ProFormCheckbox.Group, {
|
|
551
547
|
options: item.api ? undefined : item.options,
|
|
552
|
-
params: item.api ? _objectSpread(_objectSpread(
|
|
548
|
+
params: item.api ? _objectSpread(_objectSpread({}, values), item.params) : undefined,
|
|
553
549
|
layout: 'horizontal',
|
|
554
|
-
initialValue: defaultValue,
|
|
555
550
|
name: splitKeyStr(keyStr),
|
|
556
551
|
request: item.api ? ( /*#__PURE__*/function () {
|
|
557
552
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
@@ -565,7 +560,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
565
560
|
}
|
|
566
561
|
}, _callee5);
|
|
567
562
|
}));
|
|
568
|
-
return function (
|
|
563
|
+
return function (_x4) {
|
|
569
564
|
return _ref9.apply(this, arguments);
|
|
570
565
|
};
|
|
571
566
|
}()) : undefined
|
|
@@ -574,9 +569,8 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
574
569
|
if (valueType === 'radioGroup') {
|
|
575
570
|
return dynamicCom(ProFormRadio.Group, {
|
|
576
571
|
options: item.api ? undefined : item.options,
|
|
577
|
-
params: item.api ? _objectSpread(_objectSpread(
|
|
572
|
+
params: item.api ? _objectSpread(_objectSpread({}, values), item.params) : undefined,
|
|
578
573
|
layout: 'horizontal',
|
|
579
|
-
initialValue: defaultValue,
|
|
580
574
|
name: splitKeyStr(keyStr),
|
|
581
575
|
request: item.api ? ( /*#__PURE__*/function () {
|
|
582
576
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
@@ -590,7 +584,7 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
590
584
|
}
|
|
591
585
|
}, _callee6);
|
|
592
586
|
}));
|
|
593
|
-
return function (
|
|
587
|
+
return function (_x5) {
|
|
594
588
|
return _ref10.apply(this, arguments);
|
|
595
589
|
};
|
|
596
590
|
}()) : undefined
|
|
@@ -598,13 +592,11 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
598
592
|
}
|
|
599
593
|
if (valueType === 'inputNumber') {
|
|
600
594
|
return dynamicCom(ProFormDigit, {
|
|
601
|
-
initialValue: defaultValue,
|
|
602
595
|
name: splitKeyStr(keyStr)
|
|
603
596
|
});
|
|
604
597
|
}
|
|
605
598
|
if (valueType === 'inputNumberRange') {
|
|
606
599
|
return dynamicCom(ProFormDigitRange, {
|
|
607
|
-
initialValue: defaultValue,
|
|
608
600
|
name: keyStr,
|
|
609
601
|
transform: function transform(inrValues) {
|
|
610
602
|
return _defineProperty(_defineProperty({}, fields[0], inrValues[0]), fields[1], inrValues[1]);
|
|
@@ -620,7 +612,6 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
620
612
|
}
|
|
621
613
|
if (valueType === 'inputNumberRangeV2') {
|
|
622
614
|
return dynamicCom(ProFormDigitRangeV2, {
|
|
623
|
-
initialValue: defaultValue,
|
|
624
615
|
// name: keyStr as [string, string],
|
|
625
616
|
name: [splitKeyStr(fields[0]), splitKeyStr(fields[1])],
|
|
626
617
|
// transform: (inrValues: Array<number | undefined>) => ({
|
|
@@ -638,13 +629,11 @@ export var renderComponentNode = function renderComponentNode(outConfig, values,
|
|
|
638
629
|
}
|
|
639
630
|
if (valueType === 'textArea') {
|
|
640
631
|
return dynamicCom(ProFormTextArea, {
|
|
641
|
-
initialValue: defaultValue,
|
|
642
632
|
name: splitKeyStr(keyStr)
|
|
643
633
|
});
|
|
644
634
|
}
|
|
645
635
|
if (valueType === 'hidden') {
|
|
646
636
|
return dynamicCom(ProFormText, {
|
|
647
|
-
initialValue: defaultValue,
|
|
648
637
|
name: splitKeyStr(keyStr),
|
|
649
638
|
hidden: true
|
|
650
639
|
});
|
|
@@ -124,9 +124,8 @@ export interface IBaseFormFieldItem<T extends TValueType = TValueType> {
|
|
|
124
124
|
/** 提示信息 */
|
|
125
125
|
tooltip?: string;
|
|
126
126
|
/**
|
|
127
|
-
* 字段对应默认值
|
|
128
|
-
* -
|
|
129
|
-
* - 扩展,注入form.item 上
|
|
127
|
+
* @deprecated 字段对应默认值 * - 需要手动调用函数提取,再设置 * - 扩展,注入form.item 上
|
|
128
|
+
* - 推荐使用 form 的 initialValues 统一设置
|
|
130
129
|
*/
|
|
131
130
|
defaultValue?: string | string[] | boolean | number | number[];
|
|
132
131
|
/** 控制隐藏 */
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
+
import { useRexProConfigProvider } from "../../context";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { cellItemMap } from "./modules/cellItemMap";
|
|
3
4
|
import { Wrapper } from "./style";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
export var DataCell = function DataCell(_ref) {
|
|
6
7
|
var items = _ref.items,
|
|
7
|
-
onClick = _ref.onClick
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
onClick = _ref.onClick,
|
|
9
|
+
propSystemHistory = _ref.systemHistory;
|
|
10
|
+
var _useRexProConfigProvi = useRexProConfigProvider(),
|
|
11
|
+
contextSystemHistory = _useRexProConfigProvi.systemHistory;
|
|
12
|
+
var systemHistory = propSystemHistory !== null && propSystemHistory !== void 0 ? propSystemHistory : contextSystemHistory;
|
|
10
13
|
return items.map(function (item, index) {
|
|
11
14
|
var _cellItemMap$item$typ;
|
|
12
15
|
return /*#__PURE__*/_jsx(Wrapper, {
|
|
13
16
|
style: item.rootStyle,
|
|
14
17
|
className: "data-cell-row-item ".concat(item.type),
|
|
15
|
-
children: (_cellItemMap$item$typ = cellItemMap[item.type]) === null || _cellItemMap$item$typ === void 0 ? void 0 : _cellItemMap$item$typ.call(cellItemMap,
|
|
18
|
+
children: (_cellItemMap$item$typ = cellItemMap[item.type]) === null || _cellItemMap$item$typ === void 0 ? void 0 : _cellItemMap$item$typ.call(cellItemMap, {
|
|
19
|
+
item: item,
|
|
20
|
+
click: onClick,
|
|
21
|
+
systemHistory: systemHistory
|
|
22
|
+
})
|
|
16
23
|
}, index);
|
|
17
24
|
});
|
|
18
25
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { useRexProConfigProvider } from "../../..";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { IDataCellProps, TDataCellType, TGroupV2 } from '../types';
|
|
3
|
-
export declare const cellItemMap:
|
|
4
|
+
export declare const cellItemMap: TCellItemMap;
|
|
5
|
+
type TCellItemFnData = {
|
|
6
|
+
item: IDataCellProps['items'][number];
|
|
7
|
+
click?: (rawItem: IDataCellProps['items'][number], subItem?: Exclude<TGroupV2['props'], undefined>['items'][number]) => void;
|
|
8
|
+
systemHistory?: ReturnType<typeof useRexProConfigProvider>['systemHistory'];
|
|
9
|
+
};
|
|
10
|
+
type TCellItemMap = Record<TDataCellType, (data: TCellItemFnData) => React.ReactNode>;
|
|
11
|
+
export {};
|
|
@@ -14,7 +14,6 @@ import { EyeOutlined } from '@ant-design/icons';
|
|
|
14
14
|
import { downloadResourceFile, Icons, MediaViewer, showFileViewer } from "../../..";
|
|
15
15
|
import { Tag, Tooltip, Typography } from 'antd';
|
|
16
16
|
import React from 'react';
|
|
17
|
-
import { Navigate } from 'react-router';
|
|
18
17
|
import { DataCell } from "../data-cell";
|
|
19
18
|
import { DataCellRowText, DataCellRowTextLabel, DataCellRowTextValue } from "../style";
|
|
20
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -27,7 +26,7 @@ var isEmpty = function isEmpty(val) {
|
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
/** 动作块渲染 */
|
|
30
|
-
var actionRender = function actionRender(item, action, node, click) {
|
|
29
|
+
var actionRender = function actionRender(item, action, node, click, systemHistory) {
|
|
31
30
|
var tooltipBox = function tooltipBox(content) {
|
|
32
31
|
if (item.tooltip) {
|
|
33
32
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -70,12 +69,9 @@ var actionRender = function actionRender(item, action, node, click) {
|
|
|
70
69
|
onClick: function onClick(e) {
|
|
71
70
|
if (target !== '_blank') {
|
|
72
71
|
e.preventDefault();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
replace: false
|
|
77
|
-
});
|
|
78
|
-
} catch (error) {
|
|
72
|
+
if (systemHistory) {
|
|
73
|
+
systemHistory === null || systemHistory === void 0 || systemHistory.push(item.value || '');
|
|
74
|
+
} else {
|
|
79
75
|
window.location.href = item.value || '';
|
|
80
76
|
}
|
|
81
77
|
}
|
|
@@ -132,7 +128,10 @@ var actionRender = function actionRender(item, action, node, click) {
|
|
|
132
128
|
};
|
|
133
129
|
export var cellItemMap = {
|
|
134
130
|
/** 文本块 */
|
|
135
|
-
text: function text(
|
|
131
|
+
text: function text(_ref) {
|
|
132
|
+
var item = _ref.item,
|
|
133
|
+
click = _ref.click,
|
|
134
|
+
systemHistory = _ref.systemHistory;
|
|
136
135
|
var props = item.props;
|
|
137
136
|
if (!props) return undefined;
|
|
138
137
|
return !isEmpty(props.label) || !isEmpty(props.value) ? /*#__PURE__*/_jsxs(DataCellRowText, {
|
|
@@ -154,7 +153,11 @@ export var cellItemMap = {
|
|
|
154
153
|
return /*#__PURE__*/_jsx(DataCellRowTextValue, {
|
|
155
154
|
className: "data-cell-row-text-value",
|
|
156
155
|
style: props === null || props === void 0 ? void 0 : props.valueStyle,
|
|
157
|
-
children: cellItemMap[props.value.type](
|
|
156
|
+
children: cellItemMap[props.value.type]({
|
|
157
|
+
item: props.value,
|
|
158
|
+
click: click,
|
|
159
|
+
systemHistory: systemHistory
|
|
160
|
+
})
|
|
158
161
|
});
|
|
159
162
|
}
|
|
160
163
|
return /*#__PURE__*/_jsx(DataCellRowTextValue, {
|
|
@@ -172,7 +175,8 @@ export var cellItemMap = {
|
|
|
172
175
|
}) : undefined;
|
|
173
176
|
},
|
|
174
177
|
/** 图片块 */
|
|
175
|
-
img: function img(
|
|
178
|
+
img: function img(_ref2) {
|
|
179
|
+
var item = _ref2.item;
|
|
176
180
|
var props = item.props;
|
|
177
181
|
return /*#__PURE__*/_jsx(MediaViewer, _objectSpread({
|
|
178
182
|
src: props === null || props === void 0 ? void 0 : props.value,
|
|
@@ -180,11 +184,12 @@ export var cellItemMap = {
|
|
|
180
184
|
}, props));
|
|
181
185
|
},
|
|
182
186
|
/** 链接块 */
|
|
183
|
-
link: function link(
|
|
187
|
+
link: function link(_ref3) {
|
|
188
|
+
var item = _ref3.item,
|
|
189
|
+
click = _ref3.click,
|
|
190
|
+
systemHistory = _ref3.systemHistory;
|
|
184
191
|
var props = item.props;
|
|
185
192
|
if (!props) return undefined;
|
|
186
|
-
|
|
187
|
-
// return actionRender(props, props.action, props.label, () => click?.(item));
|
|
188
193
|
return /*#__PURE__*/_jsxs(DataCellRowText, {
|
|
189
194
|
className: "data-cell-row-text link",
|
|
190
195
|
children: [/*#__PURE__*/_jsx(DataCellRowTextValue, {
|
|
@@ -196,7 +201,7 @@ export var cellItemMap = {
|
|
|
196
201
|
},
|
|
197
202
|
children: actionRender(props, props.action, props.label, function () {
|
|
198
203
|
return click === null || click === void 0 ? void 0 : click(item);
|
|
199
|
-
})
|
|
204
|
+
}, systemHistory)
|
|
200
205
|
}), props.copyable ? /*#__PURE__*/_jsx(Typography.Paragraph, {
|
|
201
206
|
copyable: {
|
|
202
207
|
text: typeof props.copyable === 'string' ? props.copyable : "".concat(props.label)
|
|
@@ -205,7 +210,10 @@ export var cellItemMap = {
|
|
|
205
210
|
});
|
|
206
211
|
},
|
|
207
212
|
/** 链接组 */
|
|
208
|
-
'link-group': function linkGroup(
|
|
213
|
+
'link-group': function linkGroup(_ref4) {
|
|
214
|
+
var item = _ref4.item,
|
|
215
|
+
click = _ref4.click,
|
|
216
|
+
systemHistory = _ref4.systemHistory;
|
|
209
217
|
var props = item.props;
|
|
210
218
|
if (!props) return undefined;
|
|
211
219
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -219,9 +227,13 @@ export var cellItemMap = {
|
|
|
219
227
|
display: 'inline-flex'
|
|
220
228
|
},
|
|
221
229
|
children: [cellItemMap.link({
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
230
|
+
item: {
|
|
231
|
+
props: child,
|
|
232
|
+
type: 'link'
|
|
233
|
+
},
|
|
234
|
+
click: click,
|
|
235
|
+
systemHistory: systemHistory
|
|
236
|
+
}), (props === null || props === void 0 ? void 0 : props.items.length) - 1 === index ? '' : /*#__PURE__*/_jsx("span", {
|
|
225
237
|
style: {
|
|
226
238
|
paddingInline: 2
|
|
227
239
|
},
|
|
@@ -232,7 +244,9 @@ export var cellItemMap = {
|
|
|
232
244
|
});
|
|
233
245
|
},
|
|
234
246
|
/** tag块 */
|
|
235
|
-
tag: function tag(
|
|
247
|
+
tag: function tag(_ref5) {
|
|
248
|
+
var item = _ref5.item,
|
|
249
|
+
click = _ref5.click;
|
|
236
250
|
var props = item.props;
|
|
237
251
|
if (!props) return undefined;
|
|
238
252
|
var color = function () {
|
|
@@ -264,8 +278,12 @@ export var cellItemMap = {
|
|
|
264
278
|
}) : '']
|
|
265
279
|
})) : undefined;
|
|
266
280
|
},
|
|
267
|
-
|
|
281
|
+
/** 图标块 */
|
|
282
|
+
icon: function icon(_ref6) {
|
|
268
283
|
var _props$action;
|
|
284
|
+
var item = _ref6.item,
|
|
285
|
+
click = _ref6.click,
|
|
286
|
+
systemHistory = _ref6.systemHistory;
|
|
269
287
|
var props = item.props;
|
|
270
288
|
if (!props) return undefined;
|
|
271
289
|
return actionRender(props, (_props$action = props.action) !== null && _props$action !== void 0 ? _props$action : 'default', /*#__PURE__*/_jsx(Icons, {
|
|
@@ -273,32 +291,39 @@ export var cellItemMap = {
|
|
|
273
291
|
name: props.value
|
|
274
292
|
}), function () {
|
|
275
293
|
return click === null || click === void 0 ? void 0 : click(item);
|
|
276
|
-
});
|
|
294
|
+
}, systemHistory);
|
|
277
295
|
},
|
|
278
296
|
/** 块组 */
|
|
279
|
-
group: function group(
|
|
297
|
+
group: function group(_ref7) {
|
|
298
|
+
var item = _ref7.item,
|
|
299
|
+
click = _ref7.click,
|
|
300
|
+
systemHistory = _ref7.systemHistory;
|
|
280
301
|
var props = item.props;
|
|
281
302
|
if (!props) return undefined;
|
|
282
303
|
return /*#__PURE__*/_jsx("div", {
|
|
283
304
|
style: props.style,
|
|
284
305
|
children: /*#__PURE__*/_jsx(DataCell, {
|
|
285
306
|
items: props.items,
|
|
286
|
-
onClick: click
|
|
307
|
+
onClick: click,
|
|
308
|
+
systemHistory: systemHistory
|
|
287
309
|
})
|
|
288
310
|
});
|
|
289
311
|
},
|
|
290
|
-
|
|
312
|
+
/** 块组v2 */
|
|
313
|
+
'group-v2': function groupV2(_ref8) {
|
|
291
314
|
var _props$items;
|
|
315
|
+
var item = _ref8.item,
|
|
316
|
+
click = _ref8.click,
|
|
317
|
+
systemHistory = _ref8.systemHistory;
|
|
292
318
|
var props = item.props;
|
|
293
319
|
if (!props) return undefined;
|
|
294
|
-
// itemsSeparator itemsStyle itemsDirection itemsGap
|
|
295
|
-
// ellipsis tooltip copyable action urlTarget url style
|
|
296
320
|
var renderItem = function renderItem(subItem, index) {
|
|
297
321
|
var count = 0;
|
|
298
322
|
if (subItem.type === 'group-v2') {
|
|
299
323
|
return /*#__PURE__*/_jsx(DataCell, {
|
|
300
324
|
items: [subItem],
|
|
301
|
-
onClick: click
|
|
325
|
+
onClick: click,
|
|
326
|
+
systemHistory: systemHistory
|
|
302
327
|
}, "renderItem-".concat(index, "-").concat(count++));
|
|
303
328
|
}
|
|
304
329
|
var ellipsis = subItem.ellipsis,
|
|
@@ -312,9 +337,7 @@ export var cellItemMap = {
|
|
|
312
337
|
other = _objectWithoutProperties(subItem, _excluded);
|
|
313
338
|
var renderBox = function renderBox(content) {
|
|
314
339
|
var afterContent = /*#__PURE__*/_jsx(DataCellRowTextValue, {
|
|
315
|
-
className: "data-cell-group-v2-value-item"
|
|
316
|
-
// title={typeof content === 'string' ? content : ''}
|
|
317
|
-
,
|
|
340
|
+
className: "data-cell-group-v2-value-item",
|
|
318
341
|
ellipsis: ellipsis,
|
|
319
342
|
children: content
|
|
320
343
|
}, "renderItem-".concat(index, "-").concat(count++));
|
|
@@ -341,12 +364,24 @@ export var cellItemMap = {
|
|
|
341
364
|
});
|
|
342
365
|
}
|
|
343
366
|
if (action === 'url') {
|
|
367
|
+
var target = urlTarget !== null && urlTarget !== void 0 ? urlTarget : '_blank';
|
|
344
368
|
return /*#__PURE__*/_jsx("a", {
|
|
345
|
-
href: url,
|
|
346
|
-
target:
|
|
369
|
+
href: target === '_blank' ? url : 'void',
|
|
370
|
+
target: target,
|
|
371
|
+
rel: "noreferrer",
|
|
347
372
|
style: _objectSpread({
|
|
348
373
|
display: 'inline-flex'
|
|
349
374
|
}, style),
|
|
375
|
+
onClick: function onClick(e) {
|
|
376
|
+
if (target !== '_blank') {
|
|
377
|
+
e.preventDefault();
|
|
378
|
+
try {
|
|
379
|
+
systemHistory === null || systemHistory === void 0 || systemHistory.push(url || '');
|
|
380
|
+
} catch (_unused) {
|
|
381
|
+
window.location.href = url || '';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
350
385
|
children: afterContent
|
|
351
386
|
}, "renderItem-".concat(index, "-").concat(count++));
|
|
352
387
|
}
|
|
@@ -400,18 +435,18 @@ export var cellItemMap = {
|
|
|
400
435
|
return renderBox(subItem.value);
|
|
401
436
|
case 'img':
|
|
402
437
|
{
|
|
403
|
-
var
|
|
404
|
-
mediaViewerType =
|
|
405
|
-
otherProps = _objectWithoutProperties(
|
|
438
|
+
var _ref9 = other,
|
|
439
|
+
mediaViewerType = _ref9.mediaViewerType,
|
|
440
|
+
otherProps = _objectWithoutProperties(_ref9, _excluded2);
|
|
406
441
|
return renderBox( /*#__PURE__*/_jsx(MediaViewer, _objectSpread({
|
|
407
442
|
type: mediaViewerType
|
|
408
443
|
}, otherProps)));
|
|
409
444
|
}
|
|
410
445
|
case 'tag':
|
|
411
446
|
{
|
|
412
|
-
var
|
|
413
|
-
value =
|
|
414
|
-
_otherProps = _objectWithoutProperties(
|
|
447
|
+
var _ref10 = other,
|
|
448
|
+
value = _ref10.value,
|
|
449
|
+
_otherProps = _objectWithoutProperties(_ref10, _excluded3);
|
|
415
450
|
var color = function () {
|
|
416
451
|
if (subItem.color !== null && _typeof(subItem.color) === 'object') {
|
|
417
452
|
var _subItem$color, _subItem$color$toHexS;
|
|
@@ -429,9 +464,9 @@ export var cellItemMap = {
|
|
|
429
464
|
}
|
|
430
465
|
case 'icon':
|
|
431
466
|
{
|
|
432
|
-
var
|
|
433
|
-
iconsType =
|
|
434
|
-
_otherProps2 = _objectWithoutProperties(
|
|
467
|
+
var _ref11 = other,
|
|
468
|
+
iconsType = _ref11.iconsType,
|
|
469
|
+
_otherProps2 = _objectWithoutProperties(_ref11, _excluded4);
|
|
435
470
|
return renderBox( /*#__PURE__*/_jsx(Icons, _objectSpread({
|
|
436
471
|
type: iconsType
|
|
437
472
|
}, _otherProps2)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Icons, MediaViewer } from "../..";
|
|
1
|
+
import { Icons, MediaViewer, useRexProConfigProvider } from "../..";
|
|
2
2
|
import { GetProps, Tag } from 'antd';
|
|
3
3
|
import { HTMLAttributeAnchorTarget } from 'react';
|
|
4
4
|
/** 组件props */
|
|
@@ -7,6 +7,8 @@ export interface IDataCellProps {
|
|
|
7
7
|
items: Array<TGroupV2 | IDataCellItem<TDataCellType>>;
|
|
8
8
|
/** 点击回调 */
|
|
9
9
|
onClick?: (item: IDataCellItem, subItem?: Exclude<TGroupV2['props'], undefined>['items'][number]) => void;
|
|
10
|
+
/** 系统路由历史对象,用于内部跳转 */
|
|
11
|
+
systemHistory?: ReturnType<typeof useRexProConfigProvider>['systemHistory'];
|
|
10
12
|
}
|
|
11
13
|
export interface IDataCellItem<T extends TDataCellType = TDataCellType> {
|
|
12
14
|
/** 组件类型 */
|
|
@@ -19,6 +19,11 @@ export interface RexProConfigContextType {
|
|
|
19
19
|
}>;
|
|
20
20
|
};
|
|
21
21
|
}>>;
|
|
22
|
+
/** 系统路由,外部传入 */
|
|
23
|
+
systemHistory?: History & {
|
|
24
|
+
push: (to: string, state?: unknown) => void;
|
|
25
|
+
replace: (to: string, state?: unknown) => void;
|
|
26
|
+
};
|
|
22
27
|
/** 支持一些自定义属性 */
|
|
23
28
|
[key: string]: unknown | undefined;
|
|
24
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamias/rex-design",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"react-dom": "^18.3.1",
|
|
81
81
|
"react-intl": "^7.1.11",
|
|
82
82
|
"react-quick-pinch-zoom": "^5.1.1",
|
|
83
|
-
"react-router": "6",
|
|
84
83
|
"styled-components": "^6.1.19"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
@@ -110,8 +109,7 @@
|
|
|
110
109
|
"antd": ">=5.0.0",
|
|
111
110
|
"react": ">=16.9.0",
|
|
112
111
|
"react-dom": ">=16.9.0",
|
|
113
|
-
"react-intl": ">=3.0.0"
|
|
114
|
-
"react-router": ">=6.0.0"
|
|
112
|
+
"react-intl": ">=3.0.0"
|
|
115
113
|
},
|
|
116
114
|
"publishConfig": {
|
|
117
115
|
"access": "public"
|