@teamix/pro 1.2.7 → 1.2.8
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/212.js +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +350 -199
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.js +2 -1
- package/es/card/index.d.ts +12 -3
- package/es/card/index.js +11 -8
- package/es/card/index.scss +52 -2
- package/es/card/selectable.d.ts +13 -0
- package/es/card/selectable.js +45 -0
- package/es/form/Filter/index.js +5 -5
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -4
- package/es/info/components/tableInfo/index.js +10 -6
- package/es/nocode/configurators/Card.js +31 -8
- package/es/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/es/sidebar/components/sidebar-container/index.js +77 -0
- package/es/sidebar/components/sidebar-container/index.scss +18 -0
- package/es/sidebar/components/tree/index.d.ts +4 -0
- package/es/sidebar/components/tree/index.js +95 -0
- package/es/sidebar/index.d.ts +5 -0
- package/es/sidebar/index.js +66 -0
- package/es/sidebar/index.scss +3 -0
- package/es/sidebar/typing.d.ts +51 -0
- package/es/sidebar/typing.js +1 -0
- package/es/table/index.js +11 -2
- package/es/table/index.scss +1 -0
- package/es/table/typing.d.ts +2 -0
- package/lib/actions/index.js +2 -1
- package/lib/card/index.d.ts +12 -3
- package/lib/card/index.js +15 -11
- package/lib/card/index.scss +52 -2
- package/lib/card/selectable.d.ts +13 -0
- package/lib/card/selectable.js +60 -0
- package/lib/form/Filter/index.js +5 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/info/components/tableInfo/index.js +10 -6
- package/lib/nocode/configurators/Card.js +31 -8
- package/lib/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/lib/sidebar/components/sidebar-container/index.js +93 -0
- package/lib/sidebar/components/sidebar-container/index.scss +18 -0
- package/lib/sidebar/components/tree/index.d.ts +4 -0
- package/lib/sidebar/components/tree/index.js +112 -0
- package/lib/sidebar/index.d.ts +5 -0
- package/lib/sidebar/index.js +87 -0
- package/lib/sidebar/index.scss +3 -0
- package/lib/sidebar/typing.d.ts +51 -0
- package/lib/sidebar/typing.js +5 -0
- package/lib/table/index.js +11 -2
- package/lib/table/index.scss +1 -0
- package/lib/table/typing.d.ts +2 -0
- package/package.json +1 -1
package/es/actions/index.js
CHANGED
@@ -222,7 +222,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
222
222
|
others = _objectWithoutProperties(props, _excluded4);
|
223
223
|
|
224
224
|
return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
|
225
|
-
popupTriggerType: "
|
225
|
+
popupTriggerType: "click",
|
226
|
+
autoWidth: false,
|
226
227
|
menuProps: {
|
227
228
|
mode: 'popup',
|
228
229
|
triggerType: 'hover'
|
package/es/card/index.d.ts
CHANGED
@@ -23,11 +23,11 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
|
|
23
23
|
image?: string;
|
24
24
|
/** 卡片标题下方是否有分割线 */
|
25
25
|
divider?: boolean;
|
26
|
-
/** 卡片是否有边框 */
|
27
|
-
bordered?: boolean;
|
28
26
|
/**
|
29
|
-
* @deprecated
|
27
|
+
* @deprecated 建议使用 borderColor = 'none' 代替
|
30
28
|
*/
|
29
|
+
bordered?: boolean;
|
30
|
+
/** 卡片在 hover 时拥有阴影效果 */
|
31
31
|
hoveredShadow?: boolean;
|
32
32
|
/** 卡片是否为紧凑模式,紧凑模式下卡片没有内边距和边框 */
|
33
33
|
compacted?: boolean;
|
@@ -35,6 +35,8 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
|
|
35
35
|
centered?: boolean;
|
36
36
|
/** 加载中状态 */
|
37
37
|
loading?: boolean;
|
38
|
+
/** 边框颜色 */
|
39
|
+
borderColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent' | 'none';
|
38
40
|
/** 背景色 */
|
39
41
|
backgroundColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent';
|
40
42
|
/** 内容区栅格排列 flex 方向,仅仅在卡片嵌套模式下生效 */
|
@@ -77,6 +79,13 @@ export declare const ProCard: {
|
|
77
79
|
(props: React.HTMLAttributes<HTMLElement>): JSX.Element;
|
78
80
|
isProCardDivider: boolean;
|
79
81
|
};
|
82
|
+
Selectable: {
|
83
|
+
(props: import("./selectable").ProCardSelectableProps): JSX.Element;
|
84
|
+
defaultProps: {
|
85
|
+
hoveredShadow: boolean;
|
86
|
+
};
|
87
|
+
isProCard: boolean;
|
88
|
+
};
|
80
89
|
isProCard: boolean;
|
81
90
|
};
|
82
91
|
export default ProCard;
|
package/es/card/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["context"],
|
2
|
-
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "description", "extra", "actions", "style", "className", "image", "divider", "bordered", "compacted", "centered", "loading", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
2
|
+
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
3
3
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
5
|
|
@@ -32,6 +32,7 @@ import { ProSkeletonRaw } from '../skeleton';
|
|
32
32
|
import { ProActionGroup } from '../actions';
|
33
33
|
import { formatSpacing, getColClassAndStyle } from './utils';
|
34
34
|
import ProCardDivider from './divider';
|
35
|
+
import ProCardSelectable from './selectable';
|
35
36
|
import './index.scss';
|
36
37
|
export * from './card-container';
|
37
38
|
var cls = baseClass('teamix-pro-card');
|
@@ -66,7 +67,7 @@ var getFlexDirectionClassName = function getFlexDirectionClassName(direction, sp
|
|
66
67
|
};
|
67
68
|
|
68
69
|
export var ProCard = function ProCard(props) {
|
69
|
-
var _classnames;
|
70
|
+
var _classnames, _classnames2;
|
70
71
|
|
71
72
|
var children = props.children,
|
72
73
|
title = props.title,
|
@@ -79,11 +80,13 @@ export var ProCard = function ProCard(props) {
|
|
79
80
|
style = props.style,
|
80
81
|
className = props.className,
|
81
82
|
image = props.image,
|
83
|
+
hoveredShadow = props.hoveredShadow,
|
82
84
|
divider = props.divider,
|
83
85
|
bordered = props.bordered,
|
84
86
|
compacted = props.compacted,
|
85
87
|
centered = props.centered,
|
86
88
|
loading = props.loading,
|
89
|
+
borderColor = props.borderColor,
|
87
90
|
backgroundColor = props.backgroundColor,
|
88
91
|
contentClassName = props.contentClassName,
|
89
92
|
contentStyle = props.contentStyle,
|
@@ -169,13 +172,12 @@ export var ProCard = function ProCard(props) {
|
|
169
172
|
|
170
173
|
return element;
|
171
174
|
});
|
172
|
-
var cardClassName = classnames(cls(), className, backgroundColor, {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
var cardContentClassName = classnames(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames = {
|
175
|
+
var cardClassName = classnames(cls(), className, backgroundColor, (_classnames = {
|
176
|
+
'border-none': !bordered
|
177
|
+
}, _defineProperty(_classnames, "border-".concat(borderColor), borderColor), _defineProperty(_classnames, "compacted", compacted), _defineProperty(_classnames, "hoverable", hoveredShadow), _classnames));
|
178
|
+
var cardContentClassName = classnames(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames2 = {
|
177
179
|
'contain-pro-card': containProCard
|
178
|
-
}, _defineProperty(
|
180
|
+
}, _defineProperty(_classnames2, "split-".concat(split), split), _defineProperty(_classnames2, 'flex-wrap', wrap), _defineProperty(_classnames2, "centered", centered), _classnames2));
|
179
181
|
var cardContentMargin = containProCard && !split ? {
|
180
182
|
marginRight: -horizonal,
|
181
183
|
marginLeft: -horizonal,
|
@@ -243,5 +245,6 @@ ProCard.defaultProps = {
|
|
243
245
|
direction: 'row'
|
244
246
|
};
|
245
247
|
ProCard.Divider = ProCardDivider;
|
248
|
+
ProCard.Selectable = ProCardSelectable;
|
246
249
|
ProCard.isProCard = true;
|
247
250
|
export default ProCard;
|
package/es/card/index.scss
CHANGED
@@ -166,8 +166,10 @@
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
-
&.
|
170
|
-
|
169
|
+
&.hoverable {
|
170
|
+
&:hover {
|
171
|
+
box-shadow: var(--shadow-3, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
|
172
|
+
}
|
171
173
|
}
|
172
174
|
|
173
175
|
&.compacted {
|
@@ -183,6 +185,54 @@
|
|
183
185
|
}
|
184
186
|
}
|
185
187
|
|
188
|
+
&.border {
|
189
|
+
&-blue {
|
190
|
+
border-color: var(--color-notice-5);
|
191
|
+
}
|
192
|
+
|
193
|
+
&-orange {
|
194
|
+
border-color: var(--color-warning-5);
|
195
|
+
}
|
196
|
+
|
197
|
+
&-yellow {
|
198
|
+
border-color: var(--color-help-5);
|
199
|
+
}
|
200
|
+
|
201
|
+
&-red {
|
202
|
+
border-color: var(--color-error-5);
|
203
|
+
}
|
204
|
+
|
205
|
+
&-green {
|
206
|
+
border-color: var(--color-success-5);
|
207
|
+
}
|
208
|
+
|
209
|
+
&-grey {
|
210
|
+
border-color: var(--color-line1-1);
|
211
|
+
}
|
212
|
+
|
213
|
+
&-transparent {
|
214
|
+
border-color: transparent;
|
215
|
+
}
|
216
|
+
|
217
|
+
&-none {
|
218
|
+
border: none;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
&-selectable {
|
223
|
+
cursor: pointer;
|
224
|
+
|
225
|
+
&-icon {
|
226
|
+
&-selected {
|
227
|
+
color: var(--color-notice-5);
|
228
|
+
}
|
229
|
+
|
230
|
+
&-unselected {
|
231
|
+
color: var(--color-line1-1);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
186
236
|
&.blue {
|
187
237
|
background-color: var(--color-notice-1);
|
188
238
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ProCardProps } from './index';
|
2
|
+
export interface ProCardSelectableProps extends Omit<ProCardProps, 'onSelect'> {
|
3
|
+
selected?: boolean;
|
4
|
+
onSelect?: (selected: boolean) => void;
|
5
|
+
}
|
6
|
+
declare const ProCardSelectable: {
|
7
|
+
(props: ProCardSelectableProps): JSX.Element;
|
8
|
+
defaultProps: {
|
9
|
+
hoveredShadow: boolean;
|
10
|
+
};
|
11
|
+
isProCard: boolean;
|
12
|
+
};
|
13
|
+
export default ProCardSelectable;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var _excluded = ["selected", "onSelect", "className", "onClick"];
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
import React from 'react';
|
14
|
+
import classnames from 'classnames';
|
15
|
+
import TeamixIcon from '@teamix/icon';
|
16
|
+
import { baseClass } from '@teamix/utils';
|
17
|
+
import { ProCard } from './index';
|
18
|
+
var cls = baseClass('teamix-pro-card-selectable');
|
19
|
+
|
20
|
+
var ProCardSelectable = function ProCardSelectable(props) {
|
21
|
+
var selected = props.selected,
|
22
|
+
onSelect = props.onSelect,
|
23
|
+
className = props.className,
|
24
|
+
_onClick = props.onClick,
|
25
|
+
others = _objectWithoutProperties(props, _excluded);
|
26
|
+
|
27
|
+
return /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
28
|
+
className: classnames(cls(), className),
|
29
|
+
borderColor: selected ? 'blue' : 'grey',
|
30
|
+
extra: /*#__PURE__*/React.createElement(TeamixIcon, {
|
31
|
+
className: cls('icon', selected ? 'icon-selected' : 'icon-unselected'),
|
32
|
+
type: selected ? 'success-fill' : 'circle-line'
|
33
|
+
}),
|
34
|
+
onClick: function onClick(e) {
|
35
|
+
_onClick && _onClick(e);
|
36
|
+
onSelect && onSelect(!selected);
|
37
|
+
}
|
38
|
+
}, others));
|
39
|
+
};
|
40
|
+
|
41
|
+
ProCardSelectable.defaultProps = {
|
42
|
+
hoveredShadow: true
|
43
|
+
};
|
44
|
+
ProCardSelectable.isProCard = true;
|
45
|
+
export default ProCardSelectable;
|
package/es/form/Filter/index.js
CHANGED
@@ -29,7 +29,6 @@ import { usePrefixCls, getMessage } from '@teamix/utils';
|
|
29
29
|
import { createForm } from '@formily/core';
|
30
30
|
import ProForm from '../ProForm';
|
31
31
|
import { mergeArrayValue } from '../utils';
|
32
|
-
var searchText = getMessage('search');
|
33
32
|
|
34
33
|
var getEventProps = function getEventProps(triggerType, onFilter) {
|
35
34
|
var keydownEvent = {
|
@@ -177,7 +176,8 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
177
176
|
onResetValidateSuccess: onReset,
|
178
177
|
style: _objectSpread({}, triggerType === 'submit' ? {} : {
|
179
178
|
marginRight: -16
|
180
|
-
})
|
179
|
+
}),
|
180
|
+
children: getMessage('reset')
|
181
181
|
}
|
182
182
|
}, {
|
183
183
|
component: 'Submit',
|
@@ -186,9 +186,9 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
186
186
|
marginRight: -8
|
187
187
|
} : {
|
188
188
|
display: 'none'
|
189
|
-
})
|
190
|
-
|
191
|
-
|
189
|
+
}),
|
190
|
+
children: getMessage('search')
|
191
|
+
}
|
192
192
|
}]
|
193
193
|
}]
|
194
194
|
}])
|
package/es/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.7";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -9,7 +9,8 @@ import ProPageContainer from './page-container';
|
|
9
9
|
import ProPageHeader from './page-header';
|
10
10
|
import ProTable from './table';
|
11
11
|
import ProSkeleton from './skeleton';
|
12
|
-
import utils from './utils';
|
12
|
+
import utils from './utils'; // import ProSidebar from './sidebar'
|
13
|
+
|
13
14
|
import * as nocode from './nocode';
|
14
15
|
import * as templates from './templates';
|
15
16
|
import TeamixIcon from '@teamix/icon'; // 设置图标源
|
@@ -24,7 +25,9 @@ export * from './nocode';
|
|
24
25
|
export * from './page-container';
|
25
26
|
export * from './page-header';
|
26
27
|
export * from './skeleton';
|
27
|
-
export * from './table';
|
28
|
-
|
28
|
+
export * from './table'; // export * from './sidebar';
|
29
|
+
|
30
|
+
var version = '1.2.7';
|
29
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
30
|
-
ProPageContainer, ProPageHeader, ProSkeleton, ProTable,
|
32
|
+
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
33
|
+
hooks, nocode, templates, utils };
|
@@ -38,8 +38,9 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
38
38
|
_layout$labelGutter = layout.labelGutter,
|
39
39
|
labelGutter = _layout$labelGutter === void 0 ? '80px' : _layout$labelGutter;
|
40
40
|
|
41
|
-
var
|
42
|
-
|
41
|
+
var getNewColumns = function getNewColumns() {
|
42
|
+
// 需要 fill 填充 否则有可能不执行
|
43
|
+
return _toConsumableArray(new Array(colNum)).fill(1).map(function (_, index) {
|
43
44
|
return [{
|
44
45
|
dataIndex: "label_".concat(index),
|
45
46
|
align: 'left',
|
@@ -84,9 +85,7 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
84
85
|
var needCol = 1 + ((_columnsItem$colSpan = columnsItem === null || columnsItem === void 0 ? void 0 : columnsItem.colSpan) !== null && _columnsItem$colSpan !== void 0 ? _columnsItem$colSpan : 1); // 如果剩余的col能满足下一组数据那么就放在这一组
|
85
86
|
|
86
87
|
if (needCol <= col) {
|
87
|
-
|
88
|
-
|
89
|
-
col = col - 1 - ((_columnsItem$colSpan2 = columnsItem === null || columnsItem === void 0 ? void 0 : columnsItem.colSpan) !== null && _columnsItem$colSpan2 !== void 0 ? _columnsItem$colSpan2 : 1);
|
88
|
+
col = col - needCol;
|
90
89
|
filterColumns.push(columnsItem);
|
91
90
|
} else {
|
92
91
|
var _filterColumns$0$colS;
|
@@ -99,6 +98,11 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
99
98
|
col = 0;
|
100
99
|
}
|
101
100
|
}
|
101
|
+
|
102
|
+
if (columnsCopy.length === 0) {
|
103
|
+
// 如果剩余仍有列数并且已经没有columns分配了
|
104
|
+
col = 0;
|
105
|
+
}
|
102
106
|
}
|
103
107
|
|
104
108
|
var itemData = filterColumns.map(function (item, index) {
|
@@ -165,7 +169,7 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
165
169
|
return /*#__PURE__*/React.createElement(Table.StickyLock, {
|
166
170
|
className: "teamix-pro-info-table",
|
167
171
|
cellProps: setCellProps,
|
168
|
-
columns:
|
172
|
+
columns: getNewColumns(),
|
169
173
|
hasHeader: false,
|
170
174
|
hasBorder: true,
|
171
175
|
dataSource: newDataSource
|
@@ -1,9 +1,7 @@
|
|
1
1
|
var initialValues = {
|
2
2
|
title: '卡片标题',
|
3
3
|
children: '卡片内容卡片内容卡片内容',
|
4
|
-
extra: '操作'
|
5
|
-
bordered: true,
|
6
|
-
hoveredShadow: true
|
4
|
+
extra: '操作'
|
7
5
|
};
|
8
6
|
var schema = [{
|
9
7
|
component: 'FormTab',
|
@@ -54,10 +52,6 @@ var schema = [{
|
|
54
52
|
children: [{
|
55
53
|
title: '整体样式',
|
56
54
|
children: [{
|
57
|
-
name: 'bordered',
|
58
|
-
title: '边框',
|
59
|
-
component: 'Switch'
|
60
|
-
}, {
|
61
55
|
name: 'divider',
|
62
56
|
title: '头部分割线',
|
63
57
|
component: 'Switch'
|
@@ -72,7 +66,36 @@ var schema = [{
|
|
72
66
|
label: '蓝色',
|
73
67
|
value: 'blue'
|
74
68
|
}, {
|
75
|
-
label: '
|
69
|
+
label: '绿色',
|
70
|
+
value: 'green'
|
71
|
+
}, {
|
72
|
+
label: '红色',
|
73
|
+
value: 'red'
|
74
|
+
}, {
|
75
|
+
label: '橙色',
|
76
|
+
value: 'orange'
|
77
|
+
}, {
|
78
|
+
label: '黄色',
|
79
|
+
value: 'yellow'
|
80
|
+
}, {
|
81
|
+
label: '灰色',
|
82
|
+
value: 'grey'
|
83
|
+
}, {
|
84
|
+
label: '透明',
|
85
|
+
value: 'transparent'
|
86
|
+
}]
|
87
|
+
}, {
|
88
|
+
name: 'borderColor',
|
89
|
+
title: '边框色',
|
90
|
+
component: 'Select',
|
91
|
+
dataSource: [{
|
92
|
+
label: '无边框',
|
93
|
+
value: 'none'
|
94
|
+
}, {
|
95
|
+
label: '蓝色',
|
96
|
+
value: 'blue'
|
97
|
+
}, {
|
98
|
+
label: '绿色',
|
76
99
|
value: 'green'
|
77
100
|
}, {
|
78
101
|
label: '红色',
|
@@ -0,0 +1,77 @@
|
|
1
|
+
var _excluded = ["children", "searchPlaceholder", "showSearch", "searchProps", "customSearch", "searchOnChange", "message", "messageProps", "customMessage"];
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
import { Message } from '@alicloudfe/components';
|
14
|
+
import { ProCard } from '../../../card';
|
15
|
+
import ProField from '@teamix/pro-field';
|
16
|
+
import { baseClass } from '@teamix/utils';
|
17
|
+
import React from 'react';
|
18
|
+
import './index.scss';
|
19
|
+
var cls = baseClass('teamix-pro-sidebar-container');
|
20
|
+
|
21
|
+
var ProSidebarContainer = function ProSidebarContainer(props) {
|
22
|
+
var children = props.children,
|
23
|
+
searchPlaceholder = props.searchPlaceholder,
|
24
|
+
_props$showSearch = props.showSearch,
|
25
|
+
showSearch = _props$showSearch === void 0 ? true : _props$showSearch,
|
26
|
+
_props$searchProps = props.searchProps,
|
27
|
+
searchProps = _props$searchProps === void 0 ? {} : _props$searchProps,
|
28
|
+
customSearch = props.customSearch,
|
29
|
+
searchOnChange = props.searchOnChange,
|
30
|
+
message = props.message,
|
31
|
+
_props$messageProps = props.messageProps,
|
32
|
+
messageProps = _props$messageProps === void 0 ? {} : _props$messageProps,
|
33
|
+
customMessage = props.customMessage,
|
34
|
+
others = _objectWithoutProperties(props, _excluded); // 渲染搜索区域
|
35
|
+
|
36
|
+
|
37
|
+
var renderSearch = function renderSearch() {
|
38
|
+
if (customSearch || showSearch) {
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
40
|
+
className: cls('search')
|
41
|
+
}, !!customSearch && customSearch, showSearch && /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
42
|
+
mode: "edit",
|
43
|
+
type: "text",
|
44
|
+
placeholder: searchPlaceholder,
|
45
|
+
innerBeforeIcon: "search-line",
|
46
|
+
onChange: searchOnChange
|
47
|
+
}, searchProps)));
|
48
|
+
}
|
49
|
+
|
50
|
+
return null;
|
51
|
+
}; // 渲染通知区域
|
52
|
+
|
53
|
+
|
54
|
+
var renderNotice = function renderNotice() {
|
55
|
+
if (message || customMessage) {
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
57
|
+
className: cls('notice')
|
58
|
+
}, message && /*#__PURE__*/React.createElement(Message, _objectSpread({
|
59
|
+
type: "notice",
|
60
|
+
closeable: true
|
61
|
+
}, messageProps), message), !!customMessage && customMessage);
|
62
|
+
}
|
63
|
+
|
64
|
+
return null;
|
65
|
+
};
|
66
|
+
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
68
|
+
className: cls()
|
69
|
+
}, /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
70
|
+
bordered: false,
|
71
|
+
compacted: true
|
72
|
+
}, others), renderSearch(), renderNotice(), /*#__PURE__*/React.createElement("div", {
|
73
|
+
className: cls('context')
|
74
|
+
}, children)));
|
75
|
+
};
|
76
|
+
|
77
|
+
export default ProSidebarContainer;
|
@@ -0,0 +1,95 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
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."); }
|
12
|
+
|
13
|
+
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); }
|
14
|
+
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
import { Tree } from '@alicloudfe/components';
|
22
|
+
import { baseClass } from '@teamix/utils';
|
23
|
+
import React, { useEffect, useState } from 'react';
|
24
|
+
var cls = baseClass('teamix-pro-sidebar-tree');
|
25
|
+
|
26
|
+
var ProSidebarTree = function ProSidebarTree(props) {
|
27
|
+
var dataSourceProp = props.dataSource,
|
28
|
+
searchKey = props.searchKey; // 自动展开父节点。过滤时用
|
29
|
+
|
30
|
+
var _useState = useState(),
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
32
|
+
matchedKeys = _useState2[0],
|
33
|
+
setMatchedKeys = _useState2[1];
|
34
|
+
|
35
|
+
var _useState3 = useState(),
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
37
|
+
expandedKeys = _useState4[0],
|
38
|
+
setExpandedKeys = _useState4[1];
|
39
|
+
|
40
|
+
var _useState5 = useState(dataSourceProp !== null && dataSourceProp !== void 0 ? dataSourceProp : []),
|
41
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
42
|
+
dataSource = _useState6[0],
|
43
|
+
setDataSource = _useState6[1];
|
44
|
+
|
45
|
+
useEffect(function () {
|
46
|
+
filterDataSource(searchKey !== null && searchKey !== void 0 ? searchKey : '');
|
47
|
+
}, [searchKey]); // 过滤
|
48
|
+
|
49
|
+
var filterDataSource = function filterDataSource(value) {
|
50
|
+
value = value.trim();
|
51
|
+
var matchedKeys = [];
|
52
|
+
|
53
|
+
if (!value) {
|
54
|
+
matchedKeys = [];
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
58
|
+
var loop = function loop(data) {
|
59
|
+
return data.forEach(function (item) {
|
60
|
+
if (item.label.indexOf(value) > -1) {
|
61
|
+
matchedKeys.push(item.key);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (item.children && item.children.length) {
|
65
|
+
loop(item.children);
|
66
|
+
}
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
loop(dataSource);
|
71
|
+
setExpandedKeys(_toConsumableArray(matchedKeys));
|
72
|
+
setMatchedKeys(matchedKeys);
|
73
|
+
};
|
74
|
+
|
75
|
+
var filterTreeNode = function filterTreeNode(node) {
|
76
|
+
return matchedKeys && matchedKeys.indexOf(node.props.eventKey) > -1;
|
77
|
+
};
|
78
|
+
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
80
|
+
className: cls()
|
81
|
+
}, /*#__PURE__*/React.createElement(Tree, {
|
82
|
+
draggable: true,
|
83
|
+
defaultExpandAll: true,
|
84
|
+
isLabelBlock: true,
|
85
|
+
isNodeBlock: {
|
86
|
+
defaultPaddingLeft: 8,
|
87
|
+
indent: 16
|
88
|
+
},
|
89
|
+
dataSource: dataSource,
|
90
|
+
filterTreeNode: filterTreeNode,
|
91
|
+
expandedKeys: expandedKeys
|
92
|
+
}));
|
93
|
+
};
|
94
|
+
|
95
|
+
export default ProSidebarTree;
|