shineout 1.10.4 → 1.11.0-rc.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/css/AnimationList/LazyList.js +17 -6
- package/css/DataList/List.js +25 -5
- package/css/DataList/index.d.ts +9 -0
- package/css/Select/Select.js +2 -2
- package/css/Select/filter.js +7 -3
- package/css/Select/index.d.ts +1 -1
- package/css/Table/Td.js +10 -2
- package/css/Table/index.d.ts +13 -2
- package/css/TreeSelect/TreeSelect.js +1 -1
- package/css/TreeSelect/filter.js +7 -3
- package/css/TreeSelect/index.d.ts +2 -2
- package/css/TreeSelect/tiled.js +2 -2
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/dist/shineout.js +102 -54
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/AnimationList/LazyList.js +17 -6
- package/es/DataList/List.js +25 -5
- package/es/DataList/index.d.ts +9 -0
- package/es/Select/Select.js +2 -2
- package/es/Select/filter.js +7 -3
- package/es/Select/index.d.ts +1 -1
- package/es/Table/Td.js +9 -2
- package/es/Table/index.d.ts +13 -2
- package/es/TreeSelect/TreeSelect.js +1 -1
- package/es/TreeSelect/filter.js +7 -3
- package/es/TreeSelect/index.d.ts +2 -2
- package/es/TreeSelect/tiled.js +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/AnimationList/LazyList.js +17 -6
- package/lib/DataList/List.js +25 -5
- package/lib/DataList/index.d.ts +9 -0
- package/lib/Select/Select.js +2 -2
- package/lib/Select/filter.js +7 -3
- package/lib/Select/index.d.ts +1 -1
- package/lib/Table/Td.js +10 -2
- package/lib/Table/index.d.ts +13 -2
- package/lib/TreeSelect/TreeSelect.js +1 -1
- package/lib/TreeSelect/filter.js +7 -3
- package/lib/TreeSelect/index.d.ts +2 -2
- package/lib/TreeSelect/tiled.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -52,8 +52,10 @@ function (_PureComponent) {
|
|
|
52
52
|
_proto.getScrollHeight = function getScrollHeight() {
|
|
53
53
|
var _this$props = this.props,
|
|
54
54
|
lineHeight = _this$props.lineHeight,
|
|
55
|
-
data = _this$props.data
|
|
56
|
-
|
|
55
|
+
data = _this$props.data,
|
|
56
|
+
colNum = _this$props.colNum;
|
|
57
|
+
var rows = Math.ceil(data.length / colNum);
|
|
58
|
+
return rows * lineHeight;
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
_proto.resetScrollTop = function resetScrollTop() {
|
|
@@ -111,7 +113,8 @@ function (_PureComponent) {
|
|
|
111
113
|
data = _this$props3.data,
|
|
112
114
|
itemsInView = _this$props3.itemsInView,
|
|
113
115
|
renderItem = _this$props3.renderItem,
|
|
114
|
-
keygen = _this$props3.keygen
|
|
116
|
+
keygen = _this$props3.keygen,
|
|
117
|
+
colNum = _this$props3.colNum;
|
|
115
118
|
var _this$state = this.state,
|
|
116
119
|
currentIndex = _this$state.currentIndex,
|
|
117
120
|
fixed = _this$state.fixed;
|
|
@@ -119,11 +122,16 @@ function (_PureComponent) {
|
|
|
119
122
|
var ms = Object.assign({}, style, height && {
|
|
120
123
|
height: height
|
|
121
124
|
});
|
|
122
|
-
var items = data.slice(currentIndex, currentIndex + itemsInView).map(function (d, i) {
|
|
125
|
+
var items = data.slice(currentIndex * colNum, (currentIndex + itemsInView) * colNum).map(function (d, i) {
|
|
123
126
|
return _react.default.createElement(_react.Fragment, {
|
|
124
127
|
key: (0, _uid.getKey)(d, keygen, i)
|
|
125
128
|
}, renderItem(d, i));
|
|
126
129
|
});
|
|
130
|
+
var fr = Array(colNum).fill('1fr').join(' ');
|
|
131
|
+
var gridStyle = colNum > 1 ? {
|
|
132
|
+
display: 'grid',
|
|
133
|
+
gridTemplateColumns: fr
|
|
134
|
+
} : {};
|
|
127
135
|
return _react.default.createElement(_Scroll.default, {
|
|
128
136
|
stable: true,
|
|
129
137
|
className: className,
|
|
@@ -135,10 +143,12 @@ function (_PureComponent) {
|
|
|
135
143
|
}, _react.default.createElement("div", {
|
|
136
144
|
ref: function ref(el) {
|
|
137
145
|
_this2.optionInner = el;
|
|
138
|
-
}
|
|
146
|
+
},
|
|
147
|
+
style: gridStyle
|
|
139
148
|
}, _react.default.createElement("div", {
|
|
140
149
|
style: {
|
|
141
|
-
height: currentIndex * lineHeight
|
|
150
|
+
height: currentIndex * lineHeight,
|
|
151
|
+
gridColumnEnd: '-1'
|
|
142
152
|
}
|
|
143
153
|
}), items));
|
|
144
154
|
};
|
|
@@ -153,6 +163,7 @@ LazyList.defaultProps = {
|
|
|
153
163
|
};
|
|
154
164
|
LazyList.propTypes = {
|
|
155
165
|
data: _propTypes.default.array,
|
|
166
|
+
colNum: _propTypes.default.number,
|
|
156
167
|
itemsInView: _propTypes.default.number,
|
|
157
168
|
lineHeight: _propTypes.default.number,
|
|
158
169
|
height: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
package/css/DataList/List.js
CHANGED
|
@@ -134,18 +134,36 @@ function (_Component) {
|
|
|
134
134
|
fixed = _this$props2.fixed,
|
|
135
135
|
rowsInView = _this$props2.rowsInView,
|
|
136
136
|
lineHeight = _this$props2.lineHeight,
|
|
137
|
-
value = _this$props2.value
|
|
137
|
+
value = _this$props2.value,
|
|
138
|
+
colNum = _this$props2.colNum;
|
|
138
139
|
if (isEmpty) return _react.default.createElement("div", {
|
|
139
140
|
className: (0, _styles.listClass)('item', 'empty')
|
|
140
141
|
}, empty || (0, _locale.getLocale)('noData'));
|
|
141
|
-
|
|
142
|
+
|
|
143
|
+
if (!fixed) {
|
|
144
|
+
var items = data.map(this.renderItem);
|
|
145
|
+
|
|
146
|
+
if (colNum && colNum > 1) {
|
|
147
|
+
var frs = Array(colNum).fill('1fr').join(' ');
|
|
148
|
+
return _react.default.createElement("div", {
|
|
149
|
+
style: {
|
|
150
|
+
display: 'grid',
|
|
151
|
+
gridTemplateColumns: frs
|
|
152
|
+
}
|
|
153
|
+
}, items);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return items;
|
|
157
|
+
}
|
|
158
|
+
|
|
142
159
|
return _react.default.createElement(_LazyList.default, {
|
|
143
160
|
lineHeight: lineHeight,
|
|
144
161
|
data: data,
|
|
145
162
|
keygen: keygen,
|
|
146
163
|
renderItem: this.renderItem,
|
|
147
164
|
itemsInView: rowsInView,
|
|
148
|
-
force: value
|
|
165
|
+
force: value,
|
|
166
|
+
colNum: colNum
|
|
149
167
|
});
|
|
150
168
|
};
|
|
151
169
|
|
|
@@ -213,11 +231,13 @@ Index.propTypes = {
|
|
|
213
231
|
rowsInView: _propTypes.default.number,
|
|
214
232
|
height: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
215
233
|
lineHeight: _propTypes.default.number,
|
|
216
|
-
value: _propTypes.default.array
|
|
234
|
+
value: _propTypes.default.array,
|
|
235
|
+
colNum: _propTypes.default.number
|
|
217
236
|
};
|
|
218
237
|
Index.defaultProps = {
|
|
219
238
|
size: 'default',
|
|
220
|
-
loading: false
|
|
239
|
+
loading: false,
|
|
240
|
+
colNum: 1
|
|
221
241
|
};
|
|
222
242
|
Index.displayName = 'ShineoutList';
|
|
223
243
|
var _default = Index;
|
package/css/DataList/index.d.ts
CHANGED
package/css/Select/Select.js
CHANGED
|
@@ -106,7 +106,7 @@ function (_PureComponent) {
|
|
|
106
106
|
|
|
107
107
|
if (prevState.focus !== this.state.focus && !this.state.focus && onFilter) {
|
|
108
108
|
setTimeout(function () {
|
|
109
|
-
onFilter('');
|
|
109
|
+
onFilter('', 'blur');
|
|
110
110
|
}, 400);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
@@ -271,7 +271,7 @@ function (_PureComponent) {
|
|
|
271
271
|
}, 10);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
if (emptyAfterSelect && onFilter && filterText) onFilter('');
|
|
274
|
+
if (emptyAfterSelect && onFilter && filterText) onFilter('', 'select');
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
_proto.toInputTriggerCollapse = function toInputTriggerCollapse(text) {
|
package/css/Select/filter.js
CHANGED
|
@@ -133,9 +133,13 @@ var _default = function _default(Origin) {
|
|
|
133
133
|
return result;
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
_proto.handleFilter = function handleFilter(text) {
|
|
136
|
+
_proto.handleFilter = function handleFilter(text, from) {
|
|
137
137
|
var _this3 = this;
|
|
138
138
|
|
|
139
|
+
if (from === void 0) {
|
|
140
|
+
from = 'edit';
|
|
141
|
+
}
|
|
142
|
+
|
|
139
143
|
var _this$props5 = this.props,
|
|
140
144
|
filterDelay = _this$props5.filterDelay,
|
|
141
145
|
onFilter = _this$props5.onFilter,
|
|
@@ -148,7 +152,7 @@ var _default = function _default(Origin) {
|
|
|
148
152
|
innerData: undefined
|
|
149
153
|
});
|
|
150
154
|
if (this.timer) clearTimeout(this.timer);
|
|
151
|
-
if (onFilter) onFilter(text);
|
|
155
|
+
if (onFilter) onFilter(text, from);
|
|
152
156
|
return;
|
|
153
157
|
}
|
|
154
158
|
|
|
@@ -165,7 +169,7 @@ var _default = function _default(Origin) {
|
|
|
165
169
|
});
|
|
166
170
|
if (this.timer) clearTimeout(this.timer);
|
|
167
171
|
this.timer = setTimeout(function () {
|
|
168
|
-
var fn = onFilter(text);
|
|
172
|
+
var fn = onFilter(text, from);
|
|
169
173
|
|
|
170
174
|
if (typeof fn === 'function') {
|
|
171
175
|
_this3.setState({
|
package/css/Select/index.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ Pick<CommonProps, 'absolute' | 'clearable' | 'zIndex'>
|
|
|
195
195
|
*
|
|
196
196
|
* default: -
|
|
197
197
|
*/
|
|
198
|
-
onFilter?: (text: string) => (((data: Item) => boolean) | void);
|
|
198
|
+
onFilter?: (text: string, from: string) => (((data: Item) => boolean) | void);
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
201
|
* Merges selected values, valid only in multiselect mode
|
package/css/Table/Td.js
CHANGED
|
@@ -75,8 +75,10 @@ function (_PureComponent) {
|
|
|
75
75
|
datum = _this$props3.datum,
|
|
76
76
|
treeColumnsName = _this$props3.treeColumnsName,
|
|
77
77
|
treeCheckAll = _this$props3.treeCheckAll,
|
|
78
|
-
disabled = _this$props3.disabled
|
|
79
|
-
|
|
78
|
+
disabled = _this$props3.disabled,
|
|
79
|
+
render = _this$props3.render;
|
|
80
|
+
|
|
81
|
+
var checkbox = _react.default.createElement(_Checkbox.default, {
|
|
80
82
|
force: datum.check(data),
|
|
81
83
|
data: data,
|
|
82
84
|
index: index,
|
|
@@ -84,6 +86,12 @@ function (_PureComponent) {
|
|
|
84
86
|
disabled: disabled,
|
|
85
87
|
treeColumnsName: treeCheckAll && treeColumnsName
|
|
86
88
|
});
|
|
89
|
+
|
|
90
|
+
if (render && typeof render === 'function') {
|
|
91
|
+
return render(data, index, checkbox);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return checkbox;
|
|
87
95
|
};
|
|
88
96
|
|
|
89
97
|
_proto.renderExpand = function renderExpand(index) {
|
package/css/Table/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from 'react'
|
|
|
3
3
|
import { StickyProps } from '../Sticky'
|
|
4
4
|
import { PaginationProps } from '../Pagination'
|
|
5
5
|
import { ListItemStandardProps, StandardProps, RegularAttributes, keyType } from '../@types/common'
|
|
6
|
+
import { ReactComponentElement } from "react"
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
type ReactNode = React.ReactNode;
|
|
@@ -13,11 +14,11 @@ export type ColumnOrder = 'asc' | 'desc'
|
|
|
13
14
|
|
|
14
15
|
export type ColumnFix = 'left' | 'right'
|
|
15
16
|
|
|
16
|
-
export type ColumnType = 'expand' | 'row-expand'
|
|
17
|
+
export type ColumnType = 'expand' | 'row-expand'
|
|
17
18
|
|
|
18
19
|
export interface renderSorterParam {status?: 'asc' | 'desc', triggerAsc: () => void, triggerDesc: () => void}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
interface CommonColumn<T> {
|
|
21
22
|
/**
|
|
22
23
|
* cell align \['left', 'center', 'right'\]
|
|
23
24
|
*
|
|
@@ -181,6 +182,16 @@ export interface ColumnItem<T> {
|
|
|
181
182
|
className?: string;
|
|
182
183
|
}
|
|
183
184
|
|
|
185
|
+
type SomeColumn<T> = Omit<CommonColumn<T>, 'render' | 'type'>
|
|
186
|
+
|
|
187
|
+
export interface CheckColumn<T> extends SomeColumn<T>{
|
|
188
|
+
type: 'checkbox',
|
|
189
|
+
render?: (rowData: T, index: number, checkInstance: ReactComponentElement<any>) => any
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type ColumnItem<T> = CommonColumn<T> | CheckColumn<T>
|
|
193
|
+
|
|
194
|
+
|
|
184
195
|
export interface RowEvents {
|
|
185
196
|
[propName: string]: any
|
|
186
197
|
}
|
package/css/TreeSelect/filter.js
CHANGED
|
@@ -83,9 +83,13 @@ var _default = function _default(Origin) {
|
|
|
83
83
|
return result;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
_proto.handleFilter = function handleFilter(text) {
|
|
86
|
+
_proto.handleFilter = function handleFilter(text, from) {
|
|
87
87
|
var _this3 = this;
|
|
88
88
|
|
|
89
|
+
if (from === void 0) {
|
|
90
|
+
from = 'edit';
|
|
91
|
+
}
|
|
92
|
+
|
|
89
93
|
var _this$props2 = this.props,
|
|
90
94
|
filterDelay = _this$props2.filterDelay,
|
|
91
95
|
onFilter = _this$props2.onFilter; // not filter
|
|
@@ -97,7 +101,7 @@ var _default = function _default(Origin) {
|
|
|
97
101
|
innerData: undefined
|
|
98
102
|
});
|
|
99
103
|
if (this.timer) clearTimeout(this.timer);
|
|
100
|
-
if (onFilter) onFilter(text);
|
|
104
|
+
if (onFilter) onFilter(text, from);
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
|
|
@@ -107,7 +111,7 @@ var _default = function _default(Origin) {
|
|
|
107
111
|
});
|
|
108
112
|
if (this.timer) clearTimeout(this.timer);
|
|
109
113
|
this.timer = setTimeout(function () {
|
|
110
|
-
var fn = onFilter(text);
|
|
114
|
+
var fn = onFilter(text, from);
|
|
111
115
|
|
|
112
116
|
if (typeof fn === 'function') {
|
|
113
117
|
_this3.setState({
|
|
@@ -178,7 +178,7 @@ export interface TreeSelectProps<Value, Data> extends StandardProps,
|
|
|
178
178
|
*
|
|
179
179
|
* default: -
|
|
180
180
|
*/
|
|
181
|
-
onFilter?: (text: string) => (data: Data) => boolean;
|
|
181
|
+
onFilter?: (text: string, from: 'string') => (data: Data) => boolean;
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* In the advanced filter mode, you can switch between the filter results and the original data for the current level by pressing the button
|
|
@@ -187,7 +187,7 @@ export interface TreeSelectProps<Value, Data> extends StandardProps,
|
|
|
187
187
|
*
|
|
188
188
|
* default: -
|
|
189
189
|
*/
|
|
190
|
-
onAdvancedFilter?: (text: string) => (data: Data) => boolean;
|
|
190
|
+
onAdvancedFilter?: (text: string, form: string) => (data: Data) => boolean;
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
193
|
* When it is a string, return d[string]. When it is a function, return the result of the function.
|
package/css/TreeSelect/tiled.js
CHANGED
|
@@ -99,12 +99,12 @@ var _default = (0, _func.curry)(function (options, Origin) {
|
|
|
99
99
|
}, _react.default.createElement("span", null));
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
_proto.handleFilter = function handleFilter(text) {
|
|
102
|
+
_proto.handleFilter = function handleFilter(text, from) {
|
|
103
103
|
var onFilter = this.props.onFilter;
|
|
104
104
|
if (!text) this.setState({
|
|
105
105
|
tileds: []
|
|
106
106
|
});
|
|
107
|
-
if (onFilter) onFilter(text);
|
|
107
|
+
if (onFilter) onFilter(text, from);
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
_proto.handleToggle = function handleToggle(key, e) {
|
package/css/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Created by scripts/src-index.js.
|
|
2
2
|
import * as utils from './utils'
|
|
3
3
|
|
|
4
|
-
export default { utils, version: '1.
|
|
4
|
+
export default { utils, version: '1.11.0-rc.4' }
|
|
5
5
|
export { utils }
|
|
6
6
|
export { setLocale } from './locale'
|
|
7
7
|
export { color, style } from './utils/expose'
|