@teamix/pro 1.5.0-beta.1 → 1.5.0
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 +45535 -35222
- 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/card/index.js +2 -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/typing.d.ts +20 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -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/typing.d.ts +4 -0
- 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 +6 -3
- package/es/table/typing.d.ts +4 -1
- package/lib/card/index.js +2 -2
- 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/typing.d.ts +20 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -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/typing.d.ts +4 -0
- 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 +6 -3
- package/lib/table/typing.d.ts +4 -1
- package/package.json +1 -1
@@ -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/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
|
|
@@ -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);
|
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.5.0
|
31
|
+
declare const version = "1.5.0";
|
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.5.0
|
40
|
+
var version = '1.5.0';
|
40
41
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
41
42
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
@@ -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
|
|
@@ -131,21 +131,39 @@ var ProSidebarTree = function ProSidebarTree(props) {
|
|
131
131
|
}, [dataSourceProp]); // 监听展开全部事件
|
132
132
|
|
133
133
|
useUpdateEffect(function () {
|
134
|
+
onChangeExpandAll();
|
135
|
+
}, [expandAll]); // 监听展开层级事件
|
136
|
+
|
137
|
+
useUpdateEffect(function () {
|
138
|
+
onChangeExpandLevel();
|
139
|
+
}, [expandLevel]); // 监听 DataSource 变化事件
|
140
|
+
|
141
|
+
useEffect(function () {
|
142
|
+
onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(dataSource); // 更新层级状态
|
143
|
+
|
144
|
+
if (expandAll) {
|
145
|
+
onChangeExpandAll();
|
146
|
+
}
|
147
|
+
|
148
|
+
if (expandLevel > 1) {
|
149
|
+
onChangeExpandLevel();
|
150
|
+
}
|
151
|
+
}, [dataSource]); // 展开全部事件
|
152
|
+
|
153
|
+
var onChangeExpandAll = function onChangeExpandAll() {
|
134
154
|
if (expandAll) {
|
135
155
|
setExpandedKeys(getAllNodeKey(dataSource));
|
136
156
|
} else {
|
137
157
|
setExpandedKeys([]);
|
138
158
|
}
|
139
|
-
}
|
159
|
+
}; // 展开层级事件
|
140
160
|
|
141
|
-
|
161
|
+
|
162
|
+
var onChangeExpandLevel = function onChangeExpandLevel() {
|
142
163
|
var keys = getTreeLevelKey(dataSource, expandLevel - 1);
|
143
164
|
setExpandedKeys(keys);
|
144
|
-
}
|
165
|
+
}; // 绑定actionRef
|
145
166
|
|
146
|
-
useEffect(function () {
|
147
|
-
onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(dataSource);
|
148
|
-
}, [dataSource]); // 绑定actionRef
|
149
167
|
|
150
168
|
useActionType(actionRef, {
|
151
169
|
setTreeNode: function setTreeNode(treeNode) {
|
@@ -221,7 +221,7 @@ export function renderTreeNodeDependenceValue(data, onBeforeRenderNodeEvent, che
|
|
221
221
|
newProps = onBeforeRenderNodeEvent(item, checkedKeys, selectedKeys, allData !== null && allData !== void 0 ? allData : data);
|
222
222
|
}
|
223
223
|
|
224
|
-
var _getTreeNodeProps2 = getTreeNodeProps(
|
224
|
+
var _getTreeNodeProps2 = getTreeNodeProps(newProps),
|
225
225
|
nodeProps = _getTreeNodeProps2.nodeProps,
|
226
226
|
labelProps = _getTreeNodeProps2.labelProps;
|
227
227
|
|
package/es/sidebar/typing.d.ts
CHANGED
@@ -88,6 +88,8 @@ export declare type ProSidebarContainerProps = {
|
|
88
88
|
scrollArea?: 'all' | 'tree';
|
89
89
|
/** 是否显示展开全部 */
|
90
90
|
showExpandAll?: boolean;
|
91
|
+
/** 展开全部 状态 */
|
92
|
+
expandAllState?: boolean;
|
91
93
|
/** 是否显示展开层级 */
|
92
94
|
showExpandLevel?: boolean;
|
93
95
|
/** 展开全部变化回调 */
|
@@ -96,6 +98,8 @@ export declare type ProSidebarContainerProps = {
|
|
96
98
|
onExpandLevelChange?: (state: number) => void;
|
97
99
|
/** 展开层级 层级 */
|
98
100
|
expandLevel?: number;
|
101
|
+
/** 展开层级 当前所展示层级 */
|
102
|
+
expandLevelState?: number;
|
99
103
|
/** 列表 or tree */
|
100
104
|
isTree?: boolean;
|
101
105
|
} & ProCardProps;
|
@@ -265,6 +265,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
265
265
|
setTooltipVisible(false);
|
266
266
|
setDropdownVisible(state);
|
267
267
|
},
|
268
|
+
followTrigger: true,
|
269
|
+
cache: true,
|
268
270
|
triggerType: ['click'],
|
269
271
|
align: "tr br"
|
270
272
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -1,35 +1,16 @@
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
-
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
-
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
6
|
-
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
8
|
-
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
10
|
-
|
11
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
-
|
13
1
|
/**
|
14
2
|
* 全屏展示 Icon
|
15
3
|
*/
|
16
4
|
import { Button } from '@alicloudfe/components';
|
17
5
|
import TeamixIcon from '@teamix/icon';
|
18
6
|
import { usePrefixCls } from '@teamix/utils';
|
19
|
-
import React
|
7
|
+
import React from 'react';
|
20
8
|
import './index.scss';
|
21
9
|
var cls = usePrefixCls('teamix-pro-table-toolbar-icon');
|
22
10
|
|
23
11
|
var FullScreenIcon = function FullScreenIcon(props) {
|
24
|
-
var
|
25
|
-
|
26
|
-
var actionRef = props.actionRef;
|
27
|
-
|
28
|
-
var _useState = useState(false),
|
29
|
-
_useState2 = _slicedToArray(_useState, 2),
|
30
|
-
fullscreen = _useState2[0],
|
31
|
-
setFullscreen = _useState2[1]; // 点击全屏
|
32
|
-
|
12
|
+
var actionRef = props.actionRef,
|
13
|
+
fullScreenState = props.fullScreenState; // 点击全屏
|
33
14
|
|
34
15
|
var allScreenHandle = function allScreenHandle() {
|
35
16
|
setTimeout(function () {
|
@@ -37,48 +18,16 @@ var FullScreenIcon = function FullScreenIcon(props) {
|
|
37
18
|
|
38
19
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$fu = _actionRef$current.fullScreen) === null || _actionRef$current$fu === void 0 ? void 0 : _actionRef$current$fu.call(_actionRef$current);
|
39
20
|
}, 0);
|
40
|
-
};
|
41
|
-
|
42
|
-
|
43
|
-
useEffect(function () {
|
44
|
-
return function () {
|
45
|
-
var _actionRef$current2, _actionRef$current2$o;
|
46
|
-
|
47
|
-
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$o = _actionRef$current2.off) === null || _actionRef$current2$o === void 0 ? void 0 : _actionRef$current2$o.call(_actionRef$current2, 'fullscreenIcon');
|
48
|
-
};
|
49
|
-
}, []); // 监听全屏变化
|
21
|
+
};
|
50
22
|
|
51
|
-
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$o = _actionRef$current3.on) === null || _actionRef$current3$o === void 0 ? void 0 : _actionRef$current3$o.call(_actionRef$current3, function (state) {
|
52
|
-
// console.log('dataFilterForm', actionRef.current?.dataFilterForm);
|
53
|
-
setFullscreen(state); // actionRef.current?.dataFilterForm?.setValues(formValues);
|
54
|
-
}, 'fullScreenState', 'fullscreenIcon');
|
55
23
|
return /*#__PURE__*/React.createElement(Button, {
|
56
24
|
iconSize: "small",
|
57
25
|
className: cls(),
|
58
26
|
onClick: allScreenHandle
|
59
27
|
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
60
28
|
size: "small",
|
61
|
-
type:
|
62
|
-
}))
|
63
|
-
// trigger={
|
64
|
-
// <Button iconSize="small" className={cls()} onClick={allScreenHandle}>
|
65
|
-
// <TeamixIcon
|
66
|
-
// size="small"
|
67
|
-
// type={fullscreen ? 'close-line' : 'full-screen-line'}
|
68
|
-
// />
|
69
|
-
// </Button>
|
70
|
-
// }
|
71
|
-
// align={fullscreen ? 'b' : 't'}
|
72
|
-
// popupProps={{
|
73
|
-
// visible: visible,
|
74
|
-
// onVisibleChange: (state) => {
|
75
|
-
// setVisible(state);
|
76
|
-
// },
|
77
|
-
// }}
|
78
|
-
// >
|
79
|
-
// {getMessage('fullScreen')}
|
80
|
-
// </Balloon.Tooltip>
|
81
|
-
;
|
29
|
+
type: fullScreenState ? 'close-line' : 'full-screen-line'
|
30
|
+
}));
|
82
31
|
};
|
83
32
|
|
84
33
|
export default FullScreenIcon;
|