shineout 2.0.0-rc.8 → 2.0.0-rc.9
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/Datum/Tree.d.ts +1 -1
- package/css/Datum/Tree.js +1 -1
- package/css/Image/Image.js +5 -2
- package/css/Image/Props.d.ts +8 -0
- package/css/Table/Table.js +33 -3
- package/css/index.js +1 -1
- package/dist/shineout.js +1051 -625
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/esm/Datum/Tree.d.ts +1 -1
- package/esm/Datum/Tree.js +1 -1
- package/esm/Image/Image.js +5 -2
- package/esm/Image/Props.d.ts +8 -0
- package/esm/Table/Table.js +34 -3
- package/esm/index.js +1 -1
- package/lib/Datum/Tree.d.ts +1 -1
- package/lib/Datum/Tree.js +1 -1
- package/lib/Image/Image.js +5 -2
- package/lib/Image/Props.d.ts +8 -0
- package/lib/Table/Table.js +33 -3
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/css/Datum/Tree.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export default class<Item> {
|
|
|
68
68
|
getPath(id: KeygenResult): TreePathType;
|
|
69
69
|
getChecked(id: KeygenResult): boolean | "indeterminate";
|
|
70
70
|
getKey(data: Item, id?: KeygenResult, index?: number): KeygenResult;
|
|
71
|
-
initValue(ids?: KeygenResult[], forceCheck?: boolean):
|
|
71
|
+
initValue(ids?: KeygenResult[], forceCheck?: boolean): CheckedStatus | undefined;
|
|
72
72
|
initData(data: Item[], path: KeygenResult[], disabled?: boolean, index?: number[]): KeygenResult[];
|
|
73
73
|
setData(data?: Item[], dispatch?: boolean): void;
|
|
74
74
|
subscribe(name: string, fn: Function): void;
|
package/css/Datum/Tree.js
CHANGED
package/css/Image/Image.js
CHANGED
|
@@ -211,7 +211,9 @@ function (_PureComponent) {
|
|
|
211
211
|
_proto.renderType = function renderType(src) {
|
|
212
212
|
var _this$props4 = this.props,
|
|
213
213
|
title = _this$props4.title,
|
|
214
|
-
fit = _this$props4.fit
|
|
214
|
+
fit = _this$props4.fit,
|
|
215
|
+
_this$props4$noImgDra = _this$props4.noImgDrag,
|
|
216
|
+
noImgDrag = _this$props4$noImgDra === void 0 ? false : _this$props4$noImgDra;
|
|
215
217
|
return fit === 'fill' || fit === 'fit' ? _react.default.createElement("div", {
|
|
216
218
|
className: (0, _styles.imageClass)('inner'),
|
|
217
219
|
title: title,
|
|
@@ -223,7 +225,8 @@ function (_PureComponent) {
|
|
|
223
225
|
title: title
|
|
224
226
|
}, _react.default.createElement("img", {
|
|
225
227
|
alt: "",
|
|
226
|
-
src: src
|
|
228
|
+
src: src,
|
|
229
|
+
draggable: !noImgDrag
|
|
227
230
|
}));
|
|
228
231
|
};
|
|
229
232
|
|
package/css/Image/Props.d.ts
CHANGED
|
@@ -130,6 +130,14 @@ export interface ImageProps extends StandardProps {
|
|
|
130
130
|
* default: -
|
|
131
131
|
*/
|
|
132
132
|
title?: string;
|
|
133
|
+
/**
|
|
134
|
+
* The original property of html
|
|
135
|
+
*
|
|
136
|
+
* 是否禁止 img 元素原生 draggable 属性
|
|
137
|
+
*
|
|
138
|
+
* default: false
|
|
139
|
+
*/
|
|
140
|
+
noImgDrag?: boolean;
|
|
133
141
|
}
|
|
134
142
|
export interface ImageGroupProps extends StandardProps {
|
|
135
143
|
/**
|
package/css/Table/Table.js
CHANGED
|
@@ -83,9 +83,11 @@ function (_Component) {
|
|
|
83
83
|
|
|
84
84
|
_this = _Component.call(this, props) || this;
|
|
85
85
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "table", void 0);
|
|
86
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "visibleObserver", void 0);
|
|
86
87
|
_this.state = {
|
|
87
88
|
scrollLeft: 0,
|
|
88
|
-
scrollRight: 0
|
|
89
|
+
scrollRight: 0,
|
|
90
|
+
inView: false
|
|
89
91
|
};
|
|
90
92
|
_this.bindTable = _this.bindTable.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
91
93
|
return _this;
|
|
@@ -93,6 +95,22 @@ function (_Component) {
|
|
|
93
95
|
|
|
94
96
|
var _proto = Table.prototype;
|
|
95
97
|
|
|
98
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
|
|
101
|
+
if (this.props.sticky && this.table && global.IntersectionObserver) {
|
|
102
|
+
var observer = new IntersectionObserver(function (entries) {
|
|
103
|
+
var entry = entries[0];
|
|
104
|
+
|
|
105
|
+
_this2.setState({
|
|
106
|
+
inView: entry.intersectionRatio > 0
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
observer.observe(this.table);
|
|
110
|
+
this.visibleObserver = observer;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
96
114
|
_proto.componentDidUpdate = function componentDidUpdate(preProps) {
|
|
97
115
|
var _this$props = this.props,
|
|
98
116
|
datum = _this$props.datum,
|
|
@@ -105,6 +123,13 @@ function (_Component) {
|
|
|
105
123
|
}
|
|
106
124
|
};
|
|
107
125
|
|
|
126
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
127
|
+
if (this.visibleObserver) {
|
|
128
|
+
this.visibleObserver.disconnect();
|
|
129
|
+
this.visibleObserver = null;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
108
133
|
_proto.getRowsInView = function getRowsInView() {
|
|
109
134
|
var _this$props2 = this.props,
|
|
110
135
|
_this$props2$rowsInVi = _this$props2.rowsInView,
|
|
@@ -116,6 +141,10 @@ function (_Component) {
|
|
|
116
141
|
return parseInt(String(rowsInView), 10);
|
|
117
142
|
};
|
|
118
143
|
|
|
144
|
+
_proto.getShouldSticky = function getShouldSticky() {
|
|
145
|
+
return this.props.sticky && this.state.inView;
|
|
146
|
+
};
|
|
147
|
+
|
|
119
148
|
_proto.bindTable = function bindTable(el) {
|
|
120
149
|
var bindWrapper = this.props.bindWrapper;
|
|
121
150
|
this.table = el;
|
|
@@ -144,7 +173,7 @@ function (_Component) {
|
|
|
144
173
|
var _this$state = this.state,
|
|
145
174
|
scrollLeft = _this$state.scrollLeft,
|
|
146
175
|
scrollRight = _this$state.scrollRight;
|
|
147
|
-
var className = (0, _classnames.default)((0, _styles.tableClass)('_', size, hover && 'hover', bordered && 'bordered', fixed && 'fixed', scrollLeft > 0 && 'left-float', scrollRight < 0 && 'right-float', "vertical-" + verticalAlign, columnResizable && 'resize',
|
|
176
|
+
var className = (0, _classnames.default)((0, _styles.tableClass)('_', size, hover && 'hover', bordered && 'bordered', fixed && 'fixed', scrollLeft > 0 && 'left-float', scrollRight < 0 && 'right-float', "vertical-" + verticalAlign, columnResizable && 'resize', this.getShouldSticky() && 'sticky', (0, _config.isRTL)() && 'rtl'), this.props.className);
|
|
148
177
|
var props = (0, _objectSpread2.default)({}, others, {
|
|
149
178
|
children: children,
|
|
150
179
|
fixed: fixed,
|
|
@@ -172,7 +201,8 @@ function (_Component) {
|
|
|
172
201
|
ref: this.bindTable,
|
|
173
202
|
style: newStyle
|
|
174
203
|
}, events), _react.default.createElement(RenderTable, (0, _extends2.default)({}, props, {
|
|
175
|
-
bordered: bordered
|
|
204
|
+
bordered: bordered,
|
|
205
|
+
sticky: this.getShouldSticky()
|
|
176
206
|
})), loading && _react.default.createElement("div", {
|
|
177
207
|
className: (0, _styles.tableClass)('loading')
|
|
178
208
|
}, typeof loading === 'boolean' ? _react.default.createElement(_Spin.default, {
|