shineout 3.5.4-beta.2 → 3.5.4-beta.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/cjs/form/index.d.ts +2 -2
- package/cjs/form/index.js +1 -1
- package/cjs/index.js +1 -1
- package/dist/shineout.js +56 -25
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/form/index.d.ts +2 -2
- package/esm/form/index.js +2 -2
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/form/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import IForm from './form';
|
|
3
|
-
import { useFormRef as useForm,
|
|
3
|
+
import { useFormRef as useForm, useFormInstance } from '@sheinx/hooks';
|
|
4
4
|
type RefForm = typeof IForm;
|
|
5
5
|
declare const Button: ((props: import("./interface").SubmitProps) => JSX.Element) & {
|
|
6
6
|
displayName: string;
|
|
@@ -32,7 +32,7 @@ export interface FormComponent extends RefForm {
|
|
|
32
32
|
Reset: typeof Reset;
|
|
33
33
|
Flow: typeof FormFlow;
|
|
34
34
|
useForm: typeof useForm;
|
|
35
|
-
|
|
35
|
+
useFormInstance: typeof useFormInstance;
|
|
36
36
|
}
|
|
37
37
|
declare const FormComp: FormComponent;
|
|
38
38
|
export default FormComp;
|
package/cjs/form/index.js
CHANGED
|
@@ -36,5 +36,5 @@ FormComp.Submit = Submit;
|
|
|
36
36
|
FormComp.Reset = Reset;
|
|
37
37
|
FormComp.Flow = FormFlow;
|
|
38
38
|
FormComp.useForm = _hooks.useFormRef;
|
|
39
|
-
FormComp.
|
|
39
|
+
FormComp.useFormInstance = _hooks.useFormInstance;
|
|
40
40
|
var _default = exports.default = FormComp;
|
package/cjs/index.js
CHANGED
|
@@ -500,5 +500,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
500
500
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
501
501
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
502
502
|
var _default = exports.default = {
|
|
503
|
-
version: '3.5.4-beta.
|
|
503
|
+
version: '3.5.4-beta.4'
|
|
504
504
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12030,7 +12030,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12030
12030
|
};
|
|
12031
12031
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12032
12032
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12033
|
-
/* harmony default export */ var version = ('3.5.4-beta.
|
|
12033
|
+
/* harmony default export */ var version = ('3.5.4-beta.4');
|
|
12034
12034
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12035
12035
|
|
|
12036
12036
|
|
|
@@ -48036,7 +48036,7 @@ function useFormRef() {
|
|
|
48036
48036
|
};
|
|
48037
48037
|
return [ref.current, setFormRef];
|
|
48038
48038
|
}
|
|
48039
|
-
function
|
|
48039
|
+
function useFormInstance() {
|
|
48040
48040
|
var formCtx = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(FormContext);
|
|
48041
48041
|
return formCtx;
|
|
48042
48042
|
}
|
|
@@ -48132,10 +48132,25 @@ var Form = function Form(props) {
|
|
|
48132
48132
|
handleFormModalInfo();
|
|
48133
48133
|
}, [props.disabled, props.pending]);
|
|
48134
48134
|
var rootClass = classnames_default()([formClasses === null || formClasses === void 0 ? void 0 : formClasses.rootClass, formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapper, className, props.inline && (formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapperInline)]);
|
|
48135
|
-
|
|
48135
|
+
var formProps = getFormProps({
|
|
48136
48136
|
className: rootClass,
|
|
48137
48137
|
style: style
|
|
48138
|
+
});
|
|
48139
|
+
var formElRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
48140
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
48141
|
+
if (formElRef.current instanceof HTMLFormElement) {
|
|
48142
|
+
formElRef.current.addEventListener('submit', formProps.onSubmit);
|
|
48143
|
+
}
|
|
48144
|
+
return function () {
|
|
48145
|
+
if (formElRef.current instanceof HTMLFormElement) {
|
|
48146
|
+
formElRef.current.removeEventListener('submit', formProps.onSubmit);
|
|
48147
|
+
}
|
|
48148
|
+
};
|
|
48149
|
+
}, [formProps.onSubmit]);
|
|
48150
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)("form", objectSpread2_default()(objectSpread2_default()({}, removeProps(formProps, {
|
|
48151
|
+
onSubmit: true
|
|
48138
48152
|
})), {}, {
|
|
48153
|
+
ref: formElRef,
|
|
48139
48154
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, objectSpread2_default()(objectSpread2_default()({}, ProviderProps), {}, {
|
|
48140
48155
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormContext.Provider, {
|
|
48141
48156
|
value: formRefObj,
|
|
@@ -48691,6 +48706,11 @@ var FormButton = function FormButton(props) {
|
|
|
48691
48706
|
if (formFunc && props.htmlType === 'button') {
|
|
48692
48707
|
formFunc.submit();
|
|
48693
48708
|
}
|
|
48709
|
+
if (formFunc && props.htmlType === 'reset') {
|
|
48710
|
+
// 阻止默认的form reset,改用formFunc.reset。处理嵌套form的reset问题。
|
|
48711
|
+
e.preventDefault();
|
|
48712
|
+
formFunc.reset();
|
|
48713
|
+
}
|
|
48694
48714
|
if (props.onClick) {
|
|
48695
48715
|
props.onClick(e);
|
|
48696
48716
|
}
|
|
@@ -48763,7 +48783,7 @@ FormComp.Submit = form_Submit;
|
|
|
48763
48783
|
FormComp.Reset = form_Reset;
|
|
48764
48784
|
FormComp.Flow = form_FormFlow;
|
|
48765
48785
|
FormComp.useForm = useFormRef;
|
|
48766
|
-
FormComp.
|
|
48786
|
+
FormComp.useFormInstance = useFormInstance;
|
|
48767
48787
|
/* harmony default export */ var src_form_0 = (FormComp);
|
|
48768
48788
|
;// CONCATENATED MODULE: ../base/src/gap/support.ts
|
|
48769
48789
|
function support_flexGapSupport() {
|
|
@@ -58606,7 +58626,6 @@ function getMaxRowSpanLength(input) {
|
|
|
58606
58626
|
}
|
|
58607
58627
|
return Math.max.apply(Math, toConsumableArray_default()(Array.from(map.values())));
|
|
58608
58628
|
}
|
|
58609
|
-
var MAX_ROW_SPAN = 200;
|
|
58610
58629
|
var useTableVirtual = function useTableVirtual(props) {
|
|
58611
58630
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
58612
58631
|
_useState2 = slicedToArray_default()(_useState, 2),
|
|
@@ -58639,7 +58658,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
58639
58658
|
var totalLength = props.data.length;
|
|
58640
58659
|
var _loop = function _loop(i) {
|
|
58641
58660
|
var startIndex = i;
|
|
58642
|
-
var
|
|
58661
|
+
var _rowSpanInfo = rowSpanColumns.map(function (col) {
|
|
58643
58662
|
var rowSpan = col.rowSpan;
|
|
58644
58663
|
function getRowSpanCount(index, _count) {
|
|
58645
58664
|
var count = _count;
|
|
@@ -58655,7 +58674,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
58655
58674
|
var count = getRowSpanCount(i, 1);
|
|
58656
58675
|
return [startIndex, startIndex + count - 1];
|
|
58657
58676
|
});
|
|
58658
|
-
_rowSpanInfos.push(
|
|
58677
|
+
_rowSpanInfos.push(_rowSpanInfo);
|
|
58659
58678
|
};
|
|
58660
58679
|
for (var i = 0; i < totalLength; i++) {
|
|
58661
58680
|
_loop(i);
|
|
@@ -58681,10 +58700,12 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
58681
58700
|
});
|
|
58682
58701
|
return Math.min.apply(Math, toConsumableArray_default()(startIndexs));
|
|
58683
58702
|
});
|
|
58684
|
-
|
|
58685
|
-
|
|
58703
|
+
|
|
58704
|
+
// 根据data计算出实际需要的最大合并行数
|
|
58705
|
+
var _maxRowSpan = getMaxRowSpanLength(resultArr);
|
|
58706
|
+
return _maxRowSpan > 1 ? {
|
|
58686
58707
|
rowSpanIndexArray: resultArr,
|
|
58687
|
-
maxRowSpan:
|
|
58708
|
+
maxRowSpan: _maxRowSpan
|
|
58688
58709
|
} : null;
|
|
58689
58710
|
}, [props.data, props.columns]);
|
|
58690
58711
|
var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
@@ -58741,32 +58762,31 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
58741
58762
|
}
|
|
58742
58763
|
});
|
|
58743
58764
|
var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop) {
|
|
58765
|
+
var _props$scrollRef$curr;
|
|
58744
58766
|
if (props.disabled) return;
|
|
58745
58767
|
var sum = 0;
|
|
58746
58768
|
var currentIndex = 0;
|
|
58747
58769
|
var top = 0;
|
|
58748
58770
|
var maxIndex = Math.max(props.data.length - rowsInView, 0);
|
|
58749
|
-
var
|
|
58750
|
-
if (rowSpanInfo) {
|
|
58751
|
-
maxRowSpanLenth = Math.min(rowSpanInfo.rowSpanIndexArray.length,
|
|
58752
|
-
// 根据data计算出实际需要的最大合并行数(rowSpanInfo.maxRowSpan),当rowSpanInfo.maxRowSpan大于外部传的rowsInView时,使用rowSpanInfo.maxRowSpan
|
|
58753
|
-
Math.max(rowSpanInfo.maxRowSpan, props.rowsInView > MAX_ROW_SPAN ? props.rowsInView : props.rowsInView || MAX_ROW_SPAN));
|
|
58754
|
-
}
|
|
58771
|
+
var scrollContainerHeight = Math.max(((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientHeight) || 0, 200);
|
|
58755
58772
|
for (var i = 0; i <= maxIndex; i++) {
|
|
58756
58773
|
context.rowSpanRows = 0;
|
|
58757
58774
|
sum += context.cachedHeight[i] || props.rowHeight;
|
|
58758
58775
|
var rowSpanHeight = 0;
|
|
58759
58776
|
if (rowSpanInfo) {
|
|
58760
58777
|
var siblingsIndexs = [];
|
|
58761
|
-
for (var k = i; k <
|
|
58778
|
+
for (var k = i; k < rowSpanInfo.maxRowSpan + i; k++) {
|
|
58762
58779
|
if (rowSpanInfo.rowSpanIndexArray[k] <= i && k > i) {
|
|
58763
58780
|
siblingsIndexs.push(k);
|
|
58764
58781
|
}
|
|
58765
58782
|
}
|
|
58766
58783
|
for (var j = 0; j < siblingsIndexs.length; j++) {
|
|
58767
|
-
|
|
58768
|
-
|
|
58769
|
-
|
|
58784
|
+
// 在当前滚动容器滚动一屏上方销毁tr,不在可见区域内销毁重建,避免引起可见的单元格(合并的)内容闪烁
|
|
58785
|
+
if (rowSpanHeight < scrollContainerHeight) {
|
|
58786
|
+
var index = siblingsIndexs[j];
|
|
58787
|
+
context.rowSpanRows += 1;
|
|
58788
|
+
rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
|
|
58789
|
+
}
|
|
58770
58790
|
}
|
|
58771
58791
|
}
|
|
58772
58792
|
if (scrollTop < sum + rowSpanHeight || i === maxIndex) {
|
|
@@ -58940,6 +58960,10 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
58940
58960
|
}, [scrollHeight]);
|
|
58941
58961
|
var finalRowsInView = rowsInView + context.rowSpanRows + context.autoAddRows;
|
|
58942
58962
|
var renderData = props.disabled ? props.data : toConsumableArray_default()(props.data).slice(startIndex, startIndex + finalRowsInView);
|
|
58963
|
+
console.log('======================');
|
|
58964
|
+
console.log('startIndex: >>', startIndex);
|
|
58965
|
+
console.log('finalRowsInView: >>', finalRowsInView);
|
|
58966
|
+
console.log('======================');
|
|
58943
58967
|
return {
|
|
58944
58968
|
scrollHeight: scrollHeight,
|
|
58945
58969
|
startIndex: startIndex,
|
|
@@ -59974,23 +59998,30 @@ var Tr = function Tr(props) {
|
|
|
59974
59998
|
var col = cols[i];
|
|
59975
59999
|
if (data[i]) {
|
|
59976
60000
|
var last = cols[i + (data[i].colSpan || 1) - 1] || {};
|
|
60001
|
+
var isRowSpanTd = data[i].rowSpan > 1;
|
|
60002
|
+
var $tdContent = renderContent(col, data[i].data);
|
|
59977
60003
|
var td = /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
|
|
59978
60004
|
colSpan: data[i].colSpan,
|
|
59979
60005
|
rowSpan: data[i].rowSpan,
|
|
59980
|
-
onMouseEnter: props.hover && hasSiblingRowSpan ||
|
|
60006
|
+
onMouseEnter: props.hover && hasSiblingRowSpan || isRowSpanTd ? function () {
|
|
59981
60007
|
props.handleCellHover(props.rowIndex, data[i].rowSpan);
|
|
59982
60008
|
} : undefined,
|
|
59983
|
-
onMouseLeave: props.hover && hasSiblingRowSpan ||
|
|
60009
|
+
onMouseLeave: props.hover && hasSiblingRowSpan || isRowSpanTd ? function () {
|
|
59984
60010
|
props.handleCellHover(-1, 0);
|
|
59985
60011
|
} : undefined,
|
|
59986
|
-
className: classnames_default()(col.className, col.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), col.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), col.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), (col.lastFixed || col.firstFixed || last.lastFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), lastRowIndex === i && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), props.hoverIndex.has(props.rowIndex) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover),
|
|
60012
|
+
className: classnames_default()(col.className, col.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), col.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), col.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), (col.lastFixed || col.firstFixed || last.lastFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), lastRowIndex === i && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), props.hoverIndex.has(props.rowIndex) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover), isRowSpanTd && props.isCellHover(props.rowIndex, data[i].rowSpan) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover)),
|
|
59987
60013
|
style: getTdStyle(col, data[i].colSpan),
|
|
59988
60014
|
dir: config.direction,
|
|
59989
60015
|
"data-role": col.type === 'checkbox' ? 'checkbox' : undefined,
|
|
59990
60016
|
onClick: props.onCellClick ? function () {
|
|
59991
60017
|
return handleCellClick(data[i].data, i);
|
|
59992
60018
|
} : undefined,
|
|
59993
|
-
children:
|
|
60019
|
+
children: isRowSpanTd ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
60020
|
+
style: {
|
|
60021
|
+
height: 0
|
|
60022
|
+
},
|
|
60023
|
+
children: $tdContent
|
|
60024
|
+
}) : $tdContent
|
|
59994
60025
|
}, col.key);
|
|
59995
60026
|
tds.push(td);
|
|
59996
60027
|
if (data[i].colSpan) skip = data[i].colSpan - 1;
|
|
@@ -66970,7 +67001,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
66970
67001
|
|
|
66971
67002
|
|
|
66972
67003
|
/* harmony default export */ var src_0 = ({
|
|
66973
|
-
version: '3.5.4-beta.
|
|
67004
|
+
version: '3.5.4-beta.4'
|
|
66974
67005
|
});
|
|
66975
67006
|
}();
|
|
66976
67007
|
/******/ return __webpack_exports__;
|