@teamix/pro 1.4.24 → 1.4.27
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/pro.css +1 -1
- package/dist/pro.js +46014 -34835
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +11 -0
- package/es/actions/dialog.d.ts +2 -0
- package/es/actions/dialog.js +3 -2
- package/es/card/index.js +2 -2
- package/es/form/Filter/AdvancedFilter.js +8 -2
- package/es/form/Filter/layout.scss +1 -1
- package/es/form/ProForm/addCascadeEffect.d.ts +2 -0
- package/es/form/ProForm/addCascadeEffect.js +225 -0
- package/es/form/ProForm/index.js +8 -5
- package/es/form/ProForm/index.scss +33 -0
- package/es/form/index.d.ts +3 -0
- package/es/form/typing.d.ts +20 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -1
- package/es/info/components/InfoValueItem/index.js +15 -4
- package/es/info/typing.d.ts +4 -1
- package/es/sidebar/components/sidebar-container/index.js +18 -2
- package/es/sidebar/components/sidebar-container/index.scss +21 -14
- package/es/sidebar/components/tree/index.js +24 -6
- package/es/sidebar/components/tree-node/index.js +1 -1
- package/es/sidebar/components/tree-node/index.scss +6 -0
- package/es/sidebar/typing.d.ts +4 -0
- package/es/table/components/Layout/index.scss +1 -1
- package/es/table/components/Pagination/index.js +1 -2
- package/es/table/components/ToolBar/DensityIcon.js +1 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +2 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +6 -57
- package/es/table/components/ToolBar/index.d.ts +1 -1
- package/es/table/components/ToolBar/index.js +99 -16
- package/es/table/components/ToolBar/index.scss +22 -2
- package/es/table/index.js +20 -4
- package/es/table/index.scss +1 -1
- package/es/table/typing.d.ts +4 -1
- package/lib/actions/dialog.d.ts +2 -0
- package/lib/actions/dialog.js +3 -2
- package/lib/card/index.js +2 -2
- package/lib/form/Filter/AdvancedFilter.js +7 -1
- package/lib/form/Filter/layout.scss +1 -1
- package/lib/form/ProForm/addCascadeEffect.d.ts +2 -0
- package/lib/form/ProForm/addCascadeEffect.js +235 -0
- package/lib/form/ProForm/index.js +9 -5
- package/lib/form/ProForm/index.scss +33 -0
- package/lib/form/index.d.ts +3 -0
- package/lib/form/typing.d.ts +20 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/info/components/InfoValueItem/index.js +15 -4
- package/lib/info/typing.d.ts +4 -1
- package/lib/sidebar/components/sidebar-container/index.js +18 -2
- package/lib/sidebar/components/sidebar-container/index.scss +21 -14
- package/lib/sidebar/components/tree/index.js +24 -6
- package/lib/sidebar/components/tree-node/index.js +1 -1
- package/lib/sidebar/components/tree-node/index.scss +6 -0
- package/lib/sidebar/typing.d.ts +4 -0
- package/lib/table/components/Layout/index.scss +1 -1
- package/lib/table/components/Pagination/index.js +1 -2
- package/lib/table/components/ToolBar/DensityIcon.js +1 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +2 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +9 -63
- package/lib/table/components/ToolBar/index.d.ts +1 -1
- package/lib/table/components/ToolBar/index.js +109 -16
- package/lib/table/components/ToolBar/index.scss +22 -2
- package/lib/table/index.js +20 -4
- package/lib/table/index.scss +1 -1
- package/lib/table/typing.d.ts +4 -1
- package/package.json +2 -2
@@ -30,6 +30,17 @@ object-assign
|
|
30
30
|
* (c) Sindre Sorhus; MIT License
|
31
31
|
*/
|
32
32
|
|
33
|
+
/*! js-cookie v3.0.1 | MIT */
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @license
|
37
|
+
* Lodash <https://lodash.com/>
|
38
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
39
|
+
* Released under MIT license <https://lodash.com/license>
|
40
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
41
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
42
|
+
*/
|
43
|
+
|
33
44
|
/** @license React v16.13.1
|
34
45
|
* react-is.production.min.js
|
35
46
|
*
|
package/es/actions/dialog.d.ts
CHANGED
@@ -31,6 +31,8 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
31
31
|
onCancel?: any;
|
32
32
|
/** 隐藏footer区域 */
|
33
33
|
hideFooter?: boolean;
|
34
|
+
/** 支持通过传函数自定义底部按钮 */
|
35
|
+
footer?: any;
|
34
36
|
}
|
35
37
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
36
38
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
package/es/actions/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel", "hideFooter"],
|
2
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "footer", "className"];
|
3
3
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
|
@@ -121,6 +121,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
121
121
|
message = _getTargetValue.message,
|
122
122
|
footerDescription = _getTargetValue.footerDescription,
|
123
123
|
footerAlign = _getTargetValue.footerAlign,
|
124
|
+
footer = _getTargetValue.footer,
|
124
125
|
className = _getTargetValue.className,
|
125
126
|
containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
126
127
|
|
@@ -244,7 +245,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
244
245
|
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
245
246
|
}, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", classnames('teamix-pro-action-dialog', {
|
246
247
|
'has-footer-description': !!footerDescription
|
247
|
-
})), _objectSpread2), containerProps), containerOtherProps); // TODO Drawer 基础组件未支持此配置,日后支持,并修改onOk、onCancel写法
|
248
|
+
})), _defineProperty(_objectSpread2, "footer", addContextForReactNode(footer, dialogContext)), _objectSpread2), containerProps), containerOtherProps); // TODO Drawer 基础组件未支持此配置,日后支持,并修改onOk、onCancel写法
|
248
249
|
|
249
250
|
|
250
251
|
if ((!dialogType || dialogType === 'dialog') && hideFooter) {
|
package/es/card/index.js
CHANGED
@@ -221,9 +221,9 @@ export var ProCard = function ProCard(props) {
|
|
221
221
|
});
|
222
222
|
var width = widthList.reduce(function (acc, cur) {
|
223
223
|
return acc + cur;
|
224
|
-
}, 0) + widthList.length * 8; // 无法取出精准宽度,减去1作为阈值
|
224
|
+
}, 0) + widthList.length * 8; // 无法取出精准宽度,减去1作为阈值 10为右padding
|
225
225
|
|
226
|
-
setHeaderWithoutTitleWidth(width - 1);
|
226
|
+
setHeaderWithoutTitleWidth(width - 1 + 10);
|
227
227
|
}
|
228
228
|
};
|
229
229
|
|
@@ -22,7 +22,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
22
22
|
|
23
23
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
24
24
|
|
25
|
-
import React, { memo, useMemo } from 'react';
|
25
|
+
import React, { memo, useEffect, useMemo } from 'react';
|
26
26
|
import { usePrefixCls, getMessage, cls, isBool } from '@teamix/utils';
|
27
27
|
import ProForm from '../ProForm';
|
28
28
|
import { mergeArrayValue } from '../utils';
|
@@ -47,7 +47,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
47
47
|
var prefixCls = usePrefixCls('teamix-pro-form-query-filter-advanced');
|
48
48
|
var gridSchema = useMemo(function () {
|
49
49
|
return [{
|
50
|
-
name: '
|
50
|
+
name: 'AdvancedFilterFormGrid',
|
51
51
|
component: 'FormGrid',
|
52
52
|
props: _objectSpread({
|
53
53
|
breakpoints: [480, 720, 990, 1200, Infinity],
|
@@ -67,6 +67,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
67
67
|
align: 'right'
|
68
68
|
},
|
69
69
|
children: [{
|
70
|
+
name: 'AdvancedFilterReset',
|
70
71
|
component: 'Reset',
|
71
72
|
props: {
|
72
73
|
onResetValidateSuccess: onReset,
|
@@ -86,6 +87,11 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
86
87
|
}])
|
87
88
|
}];
|
88
89
|
}, [schema, onReset]);
|
90
|
+
useEffect(function () {
|
91
|
+
var _otherProps$form;
|
92
|
+
|
93
|
+
otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$form = otherProps.form) === null || _otherProps$form === void 0 ? void 0 : _otherProps$form.clearFormGraph('AdvancedFilterReset');
|
94
|
+
}, [onReset]);
|
89
95
|
var getTeamixLayout = useMemo(function () {
|
90
96
|
return breakpoints === true ? {
|
91
97
|
breakpoints: [990],
|
@@ -0,0 +1,225 @@
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2
|
+
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
+
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
|
7
|
+
import { onFieldReact, onFieldValueChange } from '@formily/core';
|
8
|
+
var OP_MAPS = {
|
9
|
+
'*': function _() {
|
10
|
+
return true;
|
11
|
+
},
|
12
|
+
'=': function _(l, r) {
|
13
|
+
return l === r;
|
14
|
+
},
|
15
|
+
'==': function _(l, r) {
|
16
|
+
return l === r;
|
17
|
+
},
|
18
|
+
'!': function _(l, r) {
|
19
|
+
return l !== r;
|
20
|
+
},
|
21
|
+
'!=': function _(l, r) {
|
22
|
+
return l != r;
|
23
|
+
},
|
24
|
+
'>': function _(l, r) {
|
25
|
+
return l > r;
|
26
|
+
},
|
27
|
+
'<': function _(l, r) {
|
28
|
+
return l < r;
|
29
|
+
},
|
30
|
+
'>=': function _(l, r) {
|
31
|
+
return l >= r;
|
32
|
+
},
|
33
|
+
'<=': function _(l, r) {
|
34
|
+
return l <= r;
|
35
|
+
},
|
36
|
+
ied: function ied(l, r) {
|
37
|
+
if (Array.isArray(l) || typeof l === 'string' && r) {
|
38
|
+
return l.includes(r);
|
39
|
+
} else {
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
},
|
43
|
+
eed: function eed(l, r) {
|
44
|
+
if (Array.isArray(l) || typeof l === 'string' && r) {
|
45
|
+
return !l.includes(r);
|
46
|
+
} else {
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
},
|
50
|
+
i: function i(l, r) {
|
51
|
+
if (Array.isArray(r) || typeof r === 'string' && l) {
|
52
|
+
return r.includes(l);
|
53
|
+
} else {
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
},
|
57
|
+
e: function e(l, r) {
|
58
|
+
if (Array.isArray(r) || typeof r === 'string' && l) {
|
59
|
+
return !r.includes(l);
|
60
|
+
} else {
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
},
|
64
|
+
isEmpty: function isEmpty(l, r) {
|
65
|
+
return l === null || l === undefined || l === '' || Array.isArray(l) && l.length === 0;
|
66
|
+
},
|
67
|
+
notEmpty: function notEmpty(l, r) {
|
68
|
+
return l !== null && l !== undefined && l !== '' && (!Array.isArray(l) || l.length !== 0);
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
var getParsedValue = function getParsedValue(value, scope) {
|
73
|
+
if (typeof value === 'string' && value.startsWith('${') && value.endsWith('}')) {
|
74
|
+
return scope.$form.getValuesIn(value.slice(2, value.length - 1));
|
75
|
+
} else if (typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}')) {
|
76
|
+
var code = value.slice(2, value.length - 2);
|
77
|
+
|
78
|
+
try {
|
79
|
+
return new Function("with(this){ return ".concat(code, " }")).call(scope);
|
80
|
+
} catch (e) {
|
81
|
+
return undefined;
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
return value;
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
var bingo = function bingo(bingoItem, scope) {
|
89
|
+
var _bingoItem$when = bingoItem.when,
|
90
|
+
when = _bingoItem$when === void 0 ? [] : _bingoItem$when,
|
91
|
+
_bingoItem$logic = bingoItem.logic,
|
92
|
+
logic = _bingoItem$logic === void 0 ? '&&' : _bingoItem$logic;
|
93
|
+
var result = logic === '&&';
|
94
|
+
when.forEach(function (_ref) {
|
95
|
+
var left = _ref.left,
|
96
|
+
op = _ref.op,
|
97
|
+
right = _ref.right;
|
98
|
+
var leftValue = scope.$form.getValuesIn(left);
|
99
|
+
var rightValue = getParsedValue(right, scope);
|
100
|
+
var itemResult = OP_MAPS[op](leftValue, rightValue);
|
101
|
+
|
102
|
+
if (logic === '&&') {
|
103
|
+
result = result && itemResult;
|
104
|
+
} else {
|
105
|
+
result = result || itemResult;
|
106
|
+
}
|
107
|
+
});
|
108
|
+
return result;
|
109
|
+
};
|
110
|
+
|
111
|
+
var loopAddFieldEffect = function loopAddFieldEffect(schema, form, scope) {
|
112
|
+
if (Array.isArray(schema)) {
|
113
|
+
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item) {
|
114
|
+
if (item.name) {
|
115
|
+
var _item$cascade, _item$onChange;
|
116
|
+
|
117
|
+
(_item$cascade = item.cascade) === null || _item$cascade === void 0 ? void 0 : _item$cascade.forEach(function (cascade) {
|
118
|
+
onFieldReact(item.name, function (field) {
|
119
|
+
var contextScope = _objectSpread(_objectSpread({}, scope), {}, {
|
120
|
+
$form: form,
|
121
|
+
$self: field,
|
122
|
+
$values: form.values
|
123
|
+
});
|
124
|
+
|
125
|
+
var _cascade$state = cascade.state,
|
126
|
+
state = _cascade$state === void 0 ? {} : _cascade$state,
|
127
|
+
_cascade$props = cascade.props,
|
128
|
+
props = _cascade$props === void 0 ? {} : _cascade$props,
|
129
|
+
dataSourceFilter = cascade.dataSourceFilter,
|
130
|
+
dataSourceHide = cascade.dataSourceHide;
|
131
|
+
|
132
|
+
if (bingo(cascade, contextScope)) {
|
133
|
+
if (dataSourceFilter || dataSourceHide) {
|
134
|
+
var sourceDataSource = field.getState()._sourceDataSource;
|
135
|
+
|
136
|
+
if (!sourceDataSource) {
|
137
|
+
var dataSource = field.getState().dataSource;
|
138
|
+
field.setState({
|
139
|
+
_sourceDataSource: dataSource
|
140
|
+
});
|
141
|
+
sourceDataSource = dataSource;
|
142
|
+
}
|
143
|
+
|
144
|
+
if (sourceDataSource) {
|
145
|
+
var nextDataSource = sourceDataSource.filter(function (item) {
|
146
|
+
if (Array.isArray(dataSourceFilter)) {
|
147
|
+
return dataSourceFilter.includes(item.value);
|
148
|
+
}
|
149
|
+
|
150
|
+
if (Array.isArray(dataSourceHide)) {
|
151
|
+
return !dataSourceFilter.includes(item.value);
|
152
|
+
}
|
153
|
+
});
|
154
|
+
field.setDataSource(nextDataSource);
|
155
|
+
var value = field.getState().value;
|
156
|
+
|
157
|
+
if (!nextDataSource.some(function (item) {
|
158
|
+
return item.value === value;
|
159
|
+
})) {
|
160
|
+
field.setValue(undefined);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
var nextState = {};
|
166
|
+
Object.keys(state).forEach(function (stateKey) {
|
167
|
+
nextState[stateKey] = getParsedValue(state[stateKey], contextScope);
|
168
|
+
});
|
169
|
+
field.setState(nextState);
|
170
|
+
var nextProps = {};
|
171
|
+
Object.keys(props).forEach(function (propsKey) {
|
172
|
+
nextProps[propsKey] = getParsedValue(props[propsKey], contextScope);
|
173
|
+
});
|
174
|
+
field.setComponentProps(nextProps);
|
175
|
+
} else {
|
176
|
+
var formState = form.getState();
|
177
|
+
|
178
|
+
if (dataSourceFilter || dataSourceHide) {
|
179
|
+
var _sourceDataSource = field.getState()._sourceDataSource;
|
180
|
+
|
181
|
+
_sourceDataSource && field.setDataSource(_sourceDataSource);
|
182
|
+
}
|
183
|
+
|
184
|
+
var _nextState = {};
|
185
|
+
Object.keys(state).forEach(function (stateKey) {
|
186
|
+
_nextState[stateKey] = stateKey in item ? item[stateKey] : formState[stateKey];
|
187
|
+
});
|
188
|
+
field.setState(_nextState);
|
189
|
+
var _nextProps = {};
|
190
|
+
Object.keys(props).forEach(function (propsKey) {
|
191
|
+
_nextProps[propsKey] = item.props ? item.props[propsKey] : undefined;
|
192
|
+
});
|
193
|
+
field.setComponentProps(_nextProps);
|
194
|
+
}
|
195
|
+
});
|
196
|
+
});
|
197
|
+
(_item$onChange = item.onChange) === null || _item$onChange === void 0 ? void 0 : _item$onChange.forEach(function (onChange) {
|
198
|
+
onFieldValueChange(item.name, function (field) {
|
199
|
+
var contextScope = _objectSpread(_objectSpread({}, scope), {}, {
|
200
|
+
$form: form,
|
201
|
+
$self: field,
|
202
|
+
$values: form.values
|
203
|
+
});
|
204
|
+
|
205
|
+
var values = onChange.values;
|
206
|
+
|
207
|
+
if (bingo(onChange, contextScope)) {
|
208
|
+
Object.keys(values).forEach(function (valuesKey) {
|
209
|
+
form.setValuesIn(valuesKey, getParsedValue(values[valuesKey], contextScope));
|
210
|
+
});
|
211
|
+
}
|
212
|
+
});
|
213
|
+
});
|
214
|
+
} else if (item.children) {
|
215
|
+
loopAddFieldEffect(item.children, form, scope);
|
216
|
+
}
|
217
|
+
});
|
218
|
+
}
|
219
|
+
};
|
220
|
+
|
221
|
+
export default (function (form, schema, scope) {
|
222
|
+
form.addEffects('cascade', function () {
|
223
|
+
loopAddFieldEffect(schema, form, scope);
|
224
|
+
});
|
225
|
+
});
|
package/es/form/ProForm/index.js
CHANGED
@@ -17,6 +17,7 @@ import { toJS } from '@formily/reactive';
|
|
17
17
|
import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
18
18
|
import { Affix } from '@alicloudfe/components';
|
19
19
|
import ProFieldComponents from '../Components/ProField';
|
20
|
+
import addCascadeEffect from './addCascadeEffect';
|
20
21
|
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
21
22
|
import FormGroup from '../Components/FormGroup';
|
22
23
|
import LightFilter from '../Components/LightFilter';
|
@@ -80,17 +81,19 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
80
81
|
globalComponents = _ref2.components,
|
81
82
|
globalScope = _ref2.scope;
|
82
83
|
|
84
|
+
var mergedScope = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context), globalScope), scope), {}, {
|
85
|
+
context: context
|
86
|
+
});
|
87
|
+
|
83
88
|
var form = useMemo(function () {
|
84
|
-
|
89
|
+
var nextForm = outerForm || createForm({
|
85
90
|
validateFirst: validateFirst
|
86
91
|
});
|
92
|
+
addCascadeEffect(nextForm, schema, mergedScope);
|
93
|
+
return nextForm;
|
87
94
|
}, [outerForm]);
|
88
95
|
var prefixCls = usePrefixCls('teamix-pro-form'); // 由于Actions需要,解构context供使用。原context键名的上下文继续保留。
|
89
96
|
|
90
|
-
var mergedScope = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context), globalScope), scope), {}, {
|
91
|
-
context: context
|
92
|
-
});
|
93
|
-
|
94
97
|
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
|
95
98
|
|
96
99
|
var onAutoSubmit = useAutoSubmit(onSubmit, context);
|
@@ -376,3 +376,36 @@
|
|
376
376
|
}
|
377
377
|
}
|
378
378
|
}
|
379
|
+
|
380
|
+
// inset 内嵌模式描述文案和校验样式修改
|
381
|
+
.#{$form-item-cls}-inset {
|
382
|
+
// 描述+校验
|
383
|
+
&.#{$form-item-cls}-feedback-has-text.#{$form-item-cls}-extra-wrap {
|
384
|
+
margin-bottom: 42px;
|
385
|
+
.#{$form-item-cls}-error-help {
|
386
|
+
position: absolute;
|
387
|
+
left: 0px;
|
388
|
+
}
|
389
|
+
.#{$form-item-cls}-extra {
|
390
|
+
position: absolute;
|
391
|
+
bottom: -40px;
|
392
|
+
left: 0px;
|
393
|
+
}
|
394
|
+
}
|
395
|
+
// 描述
|
396
|
+
&.#{$form-item-cls}-extra-wrap {
|
397
|
+
margin-bottom: 40px;
|
398
|
+
.#{$form-item-cls}-extra {
|
399
|
+
position: absolute;
|
400
|
+
left: 0px;
|
401
|
+
}
|
402
|
+
}
|
403
|
+
// 校验
|
404
|
+
&.#{$form-item-cls}-feedback-has-text {
|
405
|
+
margin-bottom: 40px;
|
406
|
+
.#{$form-item-cls}-error-help {
|
407
|
+
position: absolute;
|
408
|
+
left: 0px;
|
409
|
+
}
|
410
|
+
}
|
411
|
+
}
|
package/es/form/index.d.ts
CHANGED
@@ -32,6 +32,8 @@ declare const formilyReact: {
|
|
32
32
|
};
|
33
33
|
RecursionField: originalFormilyReact.ReactFC<originalFormilyReact.IRecursionFieldProps>;
|
34
34
|
ExpressionScope: originalFormilyReact.ReactFC<originalFormilyReact.IExpressionScopeProps>;
|
35
|
+
RecordsScope: originalFormilyReact.ReactFC<originalFormilyReact.IRecordsScopeProps>;
|
36
|
+
RecordScope: originalFormilyReact.ReactFC<originalFormilyReact.IRecordScopeProps>;
|
35
37
|
createSchemaField<Components extends originalFormilyReact.SchemaReactComponents>(options?: originalFormilyReact.ISchemaFieldReactFactoryOptions<Components> | undefined): {
|
36
38
|
<Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
|
37
39
|
displayName: string;
|
@@ -98,6 +100,7 @@ declare const formilyReact: {
|
|
98
100
|
useParentForm: () => import("@formily/core").Form<any> | import("@formily/core").ObjectField<any, any>;
|
99
101
|
useFieldSchema: () => originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>;
|
100
102
|
useFormEffects: (effects?: ((form: import("@formily/core").Form<any>) => void) | undefined) => void;
|
103
|
+
useExpressionScope: () => any;
|
101
104
|
};
|
102
105
|
import { customComponent } from './ProForm/customComponent';
|
103
106
|
export { formilyReact, customComponent };
|
package/es/form/typing.d.ts
CHANGED
@@ -34,6 +34,24 @@ export interface ProFormRequestConfig extends Omit<ProFormCommonRequestConfig, '
|
|
34
34
|
extraConfig?: AnyObject;
|
35
35
|
onComplete?: (res?: any, field?: any, context?: any) => any;
|
36
36
|
}
|
37
|
+
export interface CascadeWhen {
|
38
|
+
left: string;
|
39
|
+
op: string;
|
40
|
+
right: any;
|
41
|
+
}
|
42
|
+
export interface Cascade {
|
43
|
+
when: CascadeWhen[];
|
44
|
+
logic?: '||' | '&&';
|
45
|
+
props?: any;
|
46
|
+
state?: any;
|
47
|
+
dataSourceFilter?: any[];
|
48
|
+
dataSourceHide?: any[];
|
49
|
+
}
|
50
|
+
export interface OnChange {
|
51
|
+
when: CascadeWhen[];
|
52
|
+
logic?: '||' | '&&';
|
53
|
+
values: any;
|
54
|
+
}
|
37
55
|
export interface ProFormSchemaItem {
|
38
56
|
type?: string;
|
39
57
|
name?: string;
|
@@ -61,6 +79,8 @@ export interface ProFormSchemaItem {
|
|
61
79
|
default?: any;
|
62
80
|
request?: ProFormRequestConfig | ProFormRequestConfig[];
|
63
81
|
data?: AnyObject;
|
82
|
+
cascade?: Cascade[];
|
83
|
+
onChange?: OnChange[];
|
64
84
|
}
|
65
85
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
66
86
|
interface AutoLayout {
|
package/es/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.4.
|
31
|
+
declare const version = "1.4.27";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -18,6 +18,7 @@ import * as nocode from './nocode';
|
|
18
18
|
import * as templates from './templates';
|
19
19
|
import TeamixIcon from '@teamix/icon';
|
20
20
|
import './global.scss'; // 设置图标源
|
21
|
+
// @ts-ignore
|
21
22
|
|
22
23
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
23
24
|
TeamixIcon.setConfig(utils.getTeamixIconConfig());
|
@@ -36,6 +37,6 @@ export * from './table';
|
|
36
37
|
export * from './sidebar';
|
37
38
|
export * from './utils';
|
38
39
|
export * from './timeline';
|
39
|
-
var version = '1.4.
|
40
|
+
var version = '1.4.27';
|
40
41
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
41
42
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
@@ -67,7 +67,18 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
67
67
|
successMessage = _infoItem$successMess === void 0 ? 'success' : _infoItem$successMess,
|
68
68
|
actions = infoItem.actions,
|
69
69
|
extra = infoItem.extra,
|
70
|
-
valueType = infoItem.valueType
|
70
|
+
valueType = infoItem.valueType,
|
71
|
+
_infoItem$editProForm = infoItem.editProFormProps,
|
72
|
+
editProFormProps = _infoItem$editProForm === void 0 ? {} : _infoItem$editProForm; // 获取配置
|
73
|
+
|
74
|
+
var getInfoItemProps = function getInfoItemProps(prop) {
|
75
|
+
if (typeof prop === 'function') {
|
76
|
+
return prop === null || prop === void 0 ? void 0 : prop(value, record);
|
77
|
+
}
|
78
|
+
|
79
|
+
return prop;
|
80
|
+
}; // 获取处理过的 render
|
81
|
+
|
71
82
|
|
72
83
|
var getRender = function getRender() {
|
73
84
|
var _processRenderFunctio;
|
@@ -225,10 +236,10 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
225
236
|
}; // 重写编辑逻辑替代field原有逻辑
|
226
237
|
|
227
238
|
|
228
|
-
if (isEdit) {
|
239
|
+
if (getInfoItemProps(isEdit)) {
|
229
240
|
// 渲染表单
|
230
241
|
var renderContent = function renderContent() {
|
231
|
-
return /*#__PURE__*/React.createElement(ProForm, {
|
242
|
+
return /*#__PURE__*/React.createElement(ProForm, _objectSpread({
|
232
243
|
schema: [{
|
233
244
|
name: dataIndex,
|
234
245
|
component: 'Input',
|
@@ -236,7 +247,7 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
236
247
|
default: value
|
237
248
|
}],
|
238
249
|
form: dataFilterForm
|
239
|
-
});
|
250
|
+
}, getInfoItemProps(editProFormProps)));
|
240
251
|
}; // 表单提交
|
241
252
|
|
242
253
|
|
package/es/info/typing.d.ts
CHANGED
@@ -4,6 +4,7 @@ import { Method } from 'axios';
|
|
4
4
|
import React from 'react';
|
5
5
|
import { CommonRequestConfig } from '@teamix/utils';
|
6
6
|
import { ProCardProps } from '../card';
|
7
|
+
import { ProFormProps } from '../form';
|
7
8
|
/** 列record函数 */
|
8
9
|
declare type ProInfoCellFunProp = (value: any, record: any) => any;
|
9
10
|
declare type FieldRenderProps = keyof ProFieldRenderProps;
|
@@ -77,7 +78,7 @@ export interface ProInfoColumnsProps {
|
|
77
78
|
/** 合并行 */
|
78
79
|
colSpan?: number;
|
79
80
|
/** 是否可被编辑 */
|
80
|
-
isEdit?: boolean;
|
81
|
+
isEdit?: boolean | ProInfoCellFunProp;
|
81
82
|
/** 点击确定的回调函数 */
|
82
83
|
editOnOk?: (form: any, e: React.MouseEvent) => void | Promise<any>;
|
83
84
|
/** 点击取消的回调函数 */
|
@@ -88,6 +89,8 @@ export interface ProInfoColumnsProps {
|
|
88
89
|
editMethod?: Method;
|
89
90
|
/** 如需自定义调用参数格式,则可以设定此值在请求前对 params 进行自定义,如果返回false则可以阻止请求 */
|
90
91
|
editFormatParams?: (params: any, record: any) => typeof params;
|
92
|
+
/** edit ProForm 配置 */
|
93
|
+
editProFormProps?: ProFormProps | ProInfoCellFunProp;
|
91
94
|
/** 编辑请求成功提示文案 */
|
92
95
|
successMessage?: string;
|
93
96
|
/** 列 actions 配置 */
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage", "scrollArea", "showExpandAll", "showExpandLevel", "onExpandAllChange", "onExpandLevelChange", "expandLevel", "isTree"];
|
1
|
+
var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage", "scrollArea", "showExpandAll", "showExpandLevel", "onExpandAllChange", "onExpandLevelChange", "expandLevel", "expandLevelState", "expandAllState", "isTree"];
|
2
2
|
|
3
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
4
4
|
|
@@ -59,6 +59,10 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
|
|
59
59
|
onExpandLevelChange = props.onExpandLevelChange,
|
60
60
|
_props$expandLevel = props.expandLevel,
|
61
61
|
expandLevel = _props$expandLevel === void 0 ? 1 : _props$expandLevel,
|
62
|
+
_props$expandLevelSta = props.expandLevelState,
|
63
|
+
expandLevelStateProp = _props$expandLevelSta === void 0 ? 1 : _props$expandLevelSta,
|
64
|
+
_props$expandAllState = props.expandAllState,
|
65
|
+
expandAllStateProp = _props$expandAllState === void 0 ? false : _props$expandAllState,
|
62
66
|
isTree = props.isTree,
|
63
67
|
others = _objectWithoutProperties(props, _excluded);
|
64
68
|
|
@@ -92,7 +96,19 @@ var ProSidebarContainer = function ProSidebarContainer(props) {
|
|
92
96
|
setTreeHeight("calc(100% - ".concat(remainHeight, "px + 16px)"));
|
93
97
|
}
|
94
98
|
}
|
95
|
-
}, []);
|
99
|
+
}, []);
|
100
|
+
useEffect(function () {
|
101
|
+
setExpandLevelState(expandLevelStateProp);
|
102
|
+
setTimeout(function () {
|
103
|
+
onExpandLevelChange === null || onExpandLevelChange === void 0 ? void 0 : onExpandLevelChange(expandLevelStateProp);
|
104
|
+
});
|
105
|
+
}, [expandLevelStateProp]);
|
106
|
+
useEffect(function () {
|
107
|
+
setExpandAllState(expandAllStateProp);
|
108
|
+
setTimeout(function () {
|
109
|
+
onExpandAllChange === null || onExpandAllChange === void 0 ? void 0 : onExpandAllChange(expandAllStateProp);
|
110
|
+
});
|
111
|
+
}, [expandAllStateProp]); // 渲染搜索区域
|
96
112
|
|
97
113
|
var renderSearch = function renderSearch() {
|
98
114
|
if (customSearch || showSearch) {
|
@@ -1,12 +1,13 @@
|
|
1
1
|
.teamix-pro-sidebar-container {
|
2
2
|
min-width: 180px;
|
3
|
-
|
3
|
+
|
4
|
+
.teamix-pro-card.compacted > .next-card-header {
|
4
5
|
padding: 16px 0px;
|
5
6
|
margin: 0;
|
6
|
-
|
7
|
+
|
7
8
|
}
|
8
9
|
|
9
|
-
.next-card .next-card-header-extra{
|
10
|
+
.next-card .next-card-header-extra {
|
10
11
|
margin-top: 2px;
|
11
12
|
}
|
12
13
|
|
@@ -27,38 +28,44 @@
|
|
27
28
|
}
|
28
29
|
|
29
30
|
|
30
|
-
&.teamix-pro-sidebar-container &-context{
|
31
|
-
overflow-y: hidden;
|
32
|
-
|
33
|
-
&:hover{
|
31
|
+
&.teamix-pro-sidebar-container &-context {
|
32
|
+
//overflow-y: hidden;
|
33
|
+
|
34
|
+
&:hover {
|
34
35
|
overflow-y: auto;
|
35
36
|
}
|
37
|
+
|
38
|
+
.next-tree-switcher.next-noop-line.next-noop-line-noroot {
|
39
|
+
flex-shrink: 0;
|
40
|
+
}
|
41
|
+
|
36
42
|
}
|
37
43
|
|
38
44
|
|
39
|
-
&-not-is-tree{
|
45
|
+
&-not-is-tree {
|
40
46
|
|
41
|
-
.teamix-pro-card.compacted
|
47
|
+
.teamix-pro-card.compacted > .next-card-header {
|
42
48
|
padding: 16px 8px;
|
43
49
|
margin: 0;
|
44
50
|
}
|
45
|
-
|
51
|
+
|
52
|
+
.teamix-pro-sidebar-container-context {
|
46
53
|
padding: 0;
|
47
54
|
}
|
48
55
|
|
49
|
-
.teamix-pro-sidebar-container-search{
|
56
|
+
.teamix-pro-sidebar-container-search {
|
50
57
|
padding: 0 8px;
|
51
58
|
}
|
52
59
|
|
53
|
-
.teamix-pro-sidebar-container-search-has-message{
|
60
|
+
.teamix-pro-sidebar-container-search-has-message {
|
54
61
|
padding: 0 8px;
|
55
62
|
}
|
56
63
|
|
57
|
-
.teamix-pro-sidebar-container-notice{
|
64
|
+
.teamix-pro-sidebar-container-notice {
|
58
65
|
padding: 0 8px;
|
59
66
|
}
|
60
67
|
|
61
|
-
.teamix-pro-sidebar-container-fold{
|
68
|
+
.teamix-pro-sidebar-container-fold {
|
62
69
|
padding: 0 8px;
|
63
70
|
}
|
64
71
|
|