@sheinx/base 3.1.0-rc.2 → 3.1.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/LICENSE +21 -0
- package/cjs/button/button-group.d.ts.map +1 -1
- package/cjs/button/button-group.js +3 -0
- package/cjs/button/button.d.ts.map +1 -1
- package/cjs/button/button.js +5 -1
- package/cjs/card/card-header.d.ts.map +1 -1
- package/cjs/card/card-header.js +3 -0
- package/cjs/carousel/carousel.d.ts.map +1 -1
- package/cjs/carousel/carousel.js +6 -4
- package/cjs/cascader/cascader.d.ts.map +1 -1
- package/cjs/cascader/cascader.js +9 -7
- package/cjs/cascader/list.d.ts.map +1 -1
- package/cjs/cascader/list.js +3 -1
- package/cjs/cascader/list.type.d.ts +1 -1
- package/cjs/cascader/list.type.d.ts.map +1 -1
- package/cjs/cascader/node.d.ts.map +1 -1
- package/cjs/cascader/node.js +9 -10
- package/cjs/collapse/collapse-item.d.ts.map +1 -1
- package/cjs/collapse/collapse-item.js +5 -1
- package/cjs/common/use-tip.d.ts.map +1 -1
- package/cjs/common/use-tip.js +4 -1
- package/cjs/date-picker/date-picker.d.ts.map +1 -1
- package/cjs/date-picker/date-picker.js +7 -3
- package/cjs/date-picker/date-picker.type.d.ts +1 -0
- package/cjs/date-picker/date-picker.type.d.ts.map +1 -1
- package/cjs/date-picker/day.d.ts.map +1 -1
- package/cjs/date-picker/day.js +10 -1
- package/cjs/date-picker/month.d.ts.map +1 -1
- package/cjs/date-picker/month.js +8 -1
- package/cjs/date-picker/picker.js +4 -3
- package/cjs/date-picker/picker.type.d.ts +1 -0
- package/cjs/date-picker/picker.type.d.ts.map +1 -1
- package/cjs/date-picker/quarter.d.ts.map +1 -1
- package/cjs/date-picker/quarter.js +7 -1
- package/cjs/date-picker/result.d.ts +1 -1
- package/cjs/date-picker/result.d.ts.map +1 -1
- package/cjs/date-picker/result.js +19 -17
- package/cjs/date-picker/time.d.ts.map +1 -1
- package/cjs/date-picker/time.js +7 -4
- package/cjs/date-picker/year.d.ts.map +1 -1
- package/cjs/date-picker/year.js +7 -1
- package/cjs/dropdown/Item.d.ts.map +1 -1
- package/cjs/dropdown/Item.js +5 -3
- package/cjs/dropdown/dropdown.type.d.ts +1 -0
- package/cjs/dropdown/dropdown.type.d.ts.map +1 -1
- package/cjs/dropdown/dropdownIn.d.ts.map +1 -1
- package/cjs/dropdown/dropdownIn.js +30 -18
- package/cjs/form/form-item.d.ts.map +1 -1
- package/cjs/image/image-gallery.d.ts.map +1 -1
- package/cjs/image/image-gallery.js +6 -1
- package/cjs/input/input-group.d.ts.map +1 -1
- package/cjs/input/input-group.js +3 -0
- package/cjs/input/simple-input.d.ts.map +1 -1
- package/cjs/input/simple-input.js +3 -0
- package/cjs/input/use-input-common.d.ts.map +1 -1
- package/cjs/input/use-input-common.js +2 -1
- package/cjs/list/list.d.ts.map +1 -1
- package/cjs/list/list.js +4 -4
- package/cjs/menu/item.d.ts.map +1 -1
- package/cjs/menu/item.js +6 -0
- package/cjs/menu/scrollbar.d.ts.map +1 -1
- package/cjs/menu/scrollbar.js +1 -0
- package/cjs/pagination/pagination-buttons.d.ts.map +1 -1
- package/cjs/pagination/pagination-buttons.js +5 -4
- package/cjs/pagination/pagination-next.d.ts.map +1 -1
- package/cjs/pagination/pagination-next.js +6 -6
- package/cjs/pagination/pagination-prev.d.ts.map +1 -1
- package/cjs/pagination/pagination-prev.js +6 -6
- package/cjs/pagination/pagination.type.d.ts +0 -1
- package/cjs/pagination/pagination.type.d.ts.map +1 -1
- package/cjs/popover/popover.d.ts.map +1 -1
- package/cjs/popover/popover.js +3 -0
- package/cjs/rate/rate.d.ts.map +1 -1
- package/cjs/rate/rate.js +3 -0
- package/cjs/select/list-option.d.ts.map +1 -1
- package/cjs/select/list-option.js +4 -0
- package/cjs/select/result-input.d.ts.map +1 -1
- package/cjs/select/result-input.js +1 -4
- package/cjs/select/result.d.ts.map +1 -1
- package/cjs/select/result.js +44 -47
- package/cjs/select/result.type.d.ts +1 -0
- package/cjs/select/result.type.d.ts.map +1 -1
- package/cjs/select/select.d.ts.map +1 -1
- package/cjs/select/select.js +16 -23
- package/cjs/slider/slider.d.ts.map +1 -1
- package/cjs/slider/slider.js +9 -2
- package/cjs/steps/step.arrow.d.ts.map +1 -1
- package/cjs/steps/step.arrow.js +4 -0
- package/cjs/steps/step.d.ts.map +1 -1
- package/cjs/steps/step.default.d.ts.map +1 -1
- package/cjs/steps/step.default.js +6 -1
- package/cjs/steps/step.dot.d.ts.map +1 -1
- package/cjs/steps/step.dot.js +6 -1
- package/cjs/steps/step.js +3 -0
- package/cjs/switch/switch.d.ts.map +1 -1
- package/cjs/switch/switch.js +3 -0
- package/cjs/table/table.d.ts.map +1 -1
- package/cjs/table/table.js +71 -124
- package/cjs/table/table.type.d.ts +1 -0
- package/cjs/table/table.type.d.ts.map +1 -1
- package/cjs/table/thead.d.ts.map +1 -1
- package/cjs/table/thead.js +10 -3
- package/cjs/table/tr.d.ts.map +1 -1
- package/cjs/table/tr.js +13 -10
- package/cjs/tabs/tab.d.ts.map +1 -1
- package/cjs/tabs/tab.js +4 -0
- package/cjs/tabs/tabs-header.d.ts.map +1 -1
- package/cjs/tabs/tabs-header.js +47 -23
- package/cjs/tabs/tabs.d.ts.map +1 -1
- package/cjs/textarea/textarea.d.ts.map +1 -1
- package/cjs/textarea/textarea.js +1 -0
- package/cjs/textarea/use-auto-size.d.ts.map +1 -1
- package/cjs/textarea/use-auto-size.js +1 -0
- package/cjs/tooltip/tooltip.d.ts.map +1 -1
- package/cjs/tooltip/tooltip.js +3 -0
- package/cjs/transfer/transfer.d.ts.map +1 -1
- package/cjs/transfer/transfer.js +5 -2
- package/cjs/tree/tree-checkbox.d.ts.map +1 -1
- package/cjs/tree/tree-checkbox.js +8 -1
- package/cjs/tree/tree-content.d.ts.map +1 -1
- package/cjs/tree/tree-content.js +24 -4
- package/cjs/tree/tree-content.type.d.ts +1 -1
- package/cjs/tree/tree-content.type.d.ts.map +1 -1
- package/cjs/tree/tree-context.d.ts +3 -3
- package/cjs/tree/tree-context.d.ts.map +1 -1
- package/cjs/tree/tree-node.d.ts.map +1 -1
- package/cjs/tree/tree-node.js +3 -0
- package/cjs/tree/tree.d.ts.map +1 -1
- package/cjs/tree/tree.js +4 -13
- package/cjs/tree-select/tree-select.d.ts.map +1 -1
- package/cjs/tree-select/tree-select.js +109 -72
- package/cjs/tree-select/tree-select.type.d.ts +6 -0
- package/cjs/tree-select/tree-select.type.d.ts.map +1 -1
- package/cjs/upload/button.d.ts.map +1 -1
- package/cjs/upload/button.js +4 -3
- package/cjs/upload/result.d.ts.map +1 -1
- package/cjs/upload/result.js +3 -0
- package/cjs/virtual-scroll/scroll.d.ts.map +1 -1
- package/cjs/virtual-scroll/scroll.js +28 -14
- package/cjs/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
- package/cjs/virtual-scroll/virtual-scroll-list.js +2 -0
- package/esm/button/button-group.d.ts.map +1 -1
- package/esm/button/button-group.js +3 -0
- package/esm/button/button.d.ts.map +1 -1
- package/esm/button/button.js +5 -1
- package/esm/card/card-header.d.ts.map +1 -1
- package/esm/card/card-header.js +3 -0
- package/esm/carousel/carousel.d.ts.map +1 -1
- package/esm/carousel/carousel.js +6 -4
- package/esm/cascader/cascader.d.ts.map +1 -1
- package/esm/cascader/cascader.js +9 -7
- package/esm/cascader/list.d.ts.map +1 -1
- package/esm/cascader/list.js +3 -1
- package/esm/cascader/list.type.d.ts +1 -1
- package/esm/cascader/list.type.d.ts.map +1 -1
- package/esm/cascader/node.d.ts.map +1 -1
- package/esm/cascader/node.js +9 -10
- package/esm/collapse/collapse-item.d.ts.map +1 -1
- package/esm/collapse/collapse-item.js +5 -1
- package/esm/common/use-tip.d.ts.map +1 -1
- package/esm/common/use-tip.js +4 -1
- package/esm/date-picker/date-picker.d.ts.map +1 -1
- package/esm/date-picker/date-picker.js +9 -4
- package/esm/date-picker/date-picker.type.d.ts +1 -0
- package/esm/date-picker/date-picker.type.d.ts.map +1 -1
- package/esm/date-picker/day.d.ts.map +1 -1
- package/esm/date-picker/day.js +10 -1
- package/esm/date-picker/month.d.ts.map +1 -1
- package/esm/date-picker/month.js +8 -1
- package/esm/date-picker/picker.js +4 -3
- package/esm/date-picker/picker.type.d.ts +1 -0
- package/esm/date-picker/picker.type.d.ts.map +1 -1
- package/esm/date-picker/quarter.d.ts.map +1 -1
- package/esm/date-picker/quarter.js +7 -1
- package/esm/date-picker/result.d.ts +1 -1
- package/esm/date-picker/result.d.ts.map +1 -1
- package/esm/date-picker/result.js +6 -4
- package/esm/date-picker/time.d.ts.map +1 -1
- package/esm/date-picker/time.js +5 -2
- package/esm/date-picker/year.d.ts.map +1 -1
- package/esm/date-picker/year.js +7 -1
- package/esm/dropdown/Item.d.ts.map +1 -1
- package/esm/dropdown/Item.js +5 -3
- package/esm/dropdown/dropdown.type.d.ts +1 -0
- package/esm/dropdown/dropdown.type.d.ts.map +1 -1
- package/esm/dropdown/dropdownIn.d.ts.map +1 -1
- package/esm/dropdown/dropdownIn.js +30 -18
- package/esm/form/form-item.d.ts.map +1 -1
- package/esm/image/image-gallery.d.ts.map +1 -1
- package/esm/image/image-gallery.js +6 -1
- package/esm/input/input-group.d.ts.map +1 -1
- package/esm/input/input-group.js +3 -0
- package/esm/input/simple-input.d.ts.map +1 -1
- package/esm/input/simple-input.js +3 -0
- package/esm/input/use-input-common.d.ts.map +1 -1
- package/esm/input/use-input-common.js +3 -2
- package/esm/list/list.d.ts.map +1 -1
- package/esm/list/list.js +4 -4
- package/esm/menu/item.d.ts.map +1 -1
- package/esm/menu/item.js +6 -0
- package/esm/menu/scrollbar.d.ts.map +1 -1
- package/esm/menu/scrollbar.js +1 -0
- package/esm/pagination/pagination-buttons.d.ts.map +1 -1
- package/esm/pagination/pagination-buttons.js +5 -4
- package/esm/pagination/pagination-next.d.ts.map +1 -1
- package/esm/pagination/pagination-next.js +6 -6
- package/esm/pagination/pagination-prev.d.ts.map +1 -1
- package/esm/pagination/pagination-prev.js +6 -6
- package/esm/pagination/pagination.type.d.ts +0 -1
- package/esm/pagination/pagination.type.d.ts.map +1 -1
- package/esm/popover/popover.d.ts.map +1 -1
- package/esm/popover/popover.js +3 -0
- package/esm/rate/rate.d.ts.map +1 -1
- package/esm/rate/rate.js +3 -0
- package/esm/select/list-option.d.ts.map +1 -1
- package/esm/select/list-option.js +4 -0
- package/esm/select/result-input.d.ts.map +1 -1
- package/esm/select/result-input.js +1 -4
- package/esm/select/result.d.ts.map +1 -1
- package/esm/select/result.js +45 -48
- package/esm/select/result.type.d.ts +1 -0
- package/esm/select/result.type.d.ts.map +1 -1
- package/esm/select/select.d.ts.map +1 -1
- package/esm/select/select.js +16 -23
- package/esm/slider/slider.d.ts.map +1 -1
- package/esm/slider/slider.js +9 -2
- package/esm/steps/step.arrow.d.ts.map +1 -1
- package/esm/steps/step.arrow.js +4 -0
- package/esm/steps/step.d.ts.map +1 -1
- package/esm/steps/step.default.d.ts.map +1 -1
- package/esm/steps/step.default.js +6 -1
- package/esm/steps/step.dot.d.ts.map +1 -1
- package/esm/steps/step.dot.js +6 -1
- package/esm/steps/step.js +3 -0
- package/esm/switch/switch.d.ts.map +1 -1
- package/esm/switch/switch.js +3 -0
- package/esm/table/table.d.ts.map +1 -1
- package/esm/table/table.js +72 -125
- package/esm/table/table.type.d.ts +1 -0
- package/esm/table/table.type.d.ts.map +1 -1
- package/esm/table/thead.d.ts.map +1 -1
- package/esm/table/thead.js +10 -3
- package/esm/table/tr.d.ts.map +1 -1
- package/esm/table/tr.js +13 -10
- package/esm/tabs/tab.d.ts.map +1 -1
- package/esm/tabs/tab.js +4 -0
- package/esm/tabs/tabs-header.d.ts.map +1 -1
- package/esm/tabs/tabs-header.js +47 -23
- package/esm/tabs/tabs.d.ts.map +1 -1
- package/esm/textarea/textarea.d.ts.map +1 -1
- package/esm/textarea/textarea.js +1 -0
- package/esm/textarea/use-auto-size.d.ts.map +1 -1
- package/esm/textarea/use-auto-size.js +1 -0
- package/esm/tooltip/tooltip.d.ts.map +1 -1
- package/esm/tooltip/tooltip.js +3 -0
- package/esm/transfer/transfer.d.ts.map +1 -1
- package/esm/transfer/transfer.js +5 -2
- package/esm/tree/tree-checkbox.d.ts.map +1 -1
- package/esm/tree/tree-checkbox.js +8 -1
- package/esm/tree/tree-content.d.ts.map +1 -1
- package/esm/tree/tree-content.js +25 -5
- package/esm/tree/tree-content.type.d.ts +1 -1
- package/esm/tree/tree-content.type.d.ts.map +1 -1
- package/esm/tree/tree-context.d.ts +3 -3
- package/esm/tree/tree-context.d.ts.map +1 -1
- package/esm/tree/tree-node.d.ts.map +1 -1
- package/esm/tree/tree-node.js +3 -0
- package/esm/tree/tree.d.ts.map +1 -1
- package/esm/tree/tree.js +5 -14
- package/esm/tree-select/tree-select.d.ts.map +1 -1
- package/esm/tree-select/tree-select.js +110 -73
- package/esm/tree-select/tree-select.type.d.ts +6 -0
- package/esm/tree-select/tree-select.type.d.ts.map +1 -1
- package/esm/upload/button.d.ts.map +1 -1
- package/esm/upload/button.js +4 -3
- package/esm/upload/result.d.ts.map +1 -1
- package/esm/upload/result.js +3 -0
- package/esm/virtual-scroll/scroll.d.ts.map +1 -1
- package/esm/virtual-scroll/scroll.js +28 -14
- package/esm/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
- package/esm/virtual-scroll/virtual-scroll-list.js +2 -0
- package/package.json +9 -4
- package/cjs/table/temp/01-base.d.ts +0 -4
- package/cjs/table/temp/01-base.d.ts.map +0 -1
- package/cjs/table/temp/01-base.js +0 -199
- package/esm/table/temp/01-base.d.ts +0 -4
- package/esm/table/temp/01-base.d.ts.map +0 -1
- package/esm/table/temp/01-base.js +0 -194
package/esm/table/tr.js
CHANGED
|
@@ -10,6 +10,7 @@ import classNames from 'classnames';
|
|
|
10
10
|
import Icons from "../icons";
|
|
11
11
|
import Checkbox from "../checkbox";
|
|
12
12
|
import Radio from "../radio";
|
|
13
|
+
import { useConfig } from "../config";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -19,6 +20,8 @@ var Tr = function Tr(props) {
|
|
|
19
20
|
var tableClasses = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$table = _props$jssStyle.table) === null || _props$jssStyle$table === void 0 ? void 0 : _props$jssStyle$table.call(_props$jssStyle);
|
|
20
21
|
var trRef = useRef(null);
|
|
21
22
|
var expandRef = useRef(null);
|
|
23
|
+
var config = useConfig();
|
|
24
|
+
var isRtl = config.direction === 'rtl';
|
|
22
25
|
var getFixedStyle = function getFixedStyle(fixed, index, colSpan) {
|
|
23
26
|
if (!props.isScrollX) return;
|
|
24
27
|
if (fixed === 'left') {
|
|
@@ -38,7 +41,7 @@ var Tr = function Tr(props) {
|
|
|
38
41
|
if (fixed === 'right') {
|
|
39
42
|
if (props.fixRightNum !== undefined) {
|
|
40
43
|
return {
|
|
41
|
-
transform: "translate3d(
|
|
44
|
+
transform: "translate3d(".concat(0 - props.fixRightNum, "px, 0, 0)")
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
var right = props.colgroup.slice(index + 1 + colSpan).reduce(function (a, b) {
|
|
@@ -68,13 +71,11 @@ var Tr = function Tr(props) {
|
|
|
68
71
|
var className = tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.expandWrapper;
|
|
69
72
|
var children = props.rawData[props.treeColumnsName];
|
|
70
73
|
var isExpanded = props.treeFunc.isTreeExpanded(props.rawData, props.rowIndex);
|
|
74
|
+
var dirName = isRtl ? 'Right' : 'Left';
|
|
71
75
|
if (!children || children.length === 0 && !props.treeEmptyExpand) {
|
|
72
76
|
return /*#__PURE__*/_jsx("span", {
|
|
73
77
|
className: className,
|
|
74
|
-
style: {
|
|
75
|
-
marginLeft: level * treeIndent,
|
|
76
|
-
paddingLeft: props.isEmptyTree ? 0 : 22
|
|
77
|
-
},
|
|
78
|
+
style: _defineProperty(_defineProperty({}, "margin".concat(dirName), level * treeIndent), "padding".concat(dirName), props.isEmptyTree ? 0 : 22),
|
|
78
79
|
children: content
|
|
79
80
|
});
|
|
80
81
|
}
|
|
@@ -184,6 +185,7 @@ var Tr = function Tr(props) {
|
|
|
184
185
|
},
|
|
185
186
|
className: classNames(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.isCellHover(props.rowIndex, data[i].rowSpan) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover)),
|
|
186
187
|
style: getTdStyle(col, data[i].colSpan),
|
|
188
|
+
dir: config.direction,
|
|
187
189
|
children: renderContent(col, data[i].data)
|
|
188
190
|
}, col.key);
|
|
189
191
|
tds.push(td);
|
|
@@ -205,6 +207,7 @@ var Tr = function Tr(props) {
|
|
|
205
207
|
className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowExpand,
|
|
206
208
|
ref: expandRef,
|
|
207
209
|
children: /*#__PURE__*/_jsx("td", {
|
|
210
|
+
dir: config.direction,
|
|
208
211
|
className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder,
|
|
209
212
|
colSpan: props.columns.length,
|
|
210
213
|
style: {
|
|
@@ -219,20 +222,20 @@ var Tr = function Tr(props) {
|
|
|
219
222
|
var handleRowClick = usePersistFn(function (e) {
|
|
220
223
|
var target = e.target;
|
|
221
224
|
var _props$rowClickAttr = props.rowClickAttr,
|
|
222
|
-
rowClickAttr = _props$rowClickAttr === void 0 ?
|
|
225
|
+
rowClickAttr = _props$rowClickAttr === void 0 ? '*' : _props$rowClickAttr,
|
|
223
226
|
onRowClick = props.onRowClick;
|
|
224
227
|
if (onRowClick && rowClickAttr) {
|
|
225
228
|
if (rowClickAttr === true || rowClickAttr === '*') {
|
|
226
|
-
onRowClick(props.rawData, props.rowIndex);
|
|
229
|
+
onRowClick(props.rawData, props.rowIndex, rowClickAttr);
|
|
227
230
|
} else {
|
|
228
231
|
var arrts = Array.isArray(rowClickAttr) ? rowClickAttr : [rowClickAttr].filter(function (item) {
|
|
229
232
|
return typeof item === 'string';
|
|
230
233
|
});
|
|
231
|
-
var
|
|
234
|
+
var attIndex = arrts.findIndex(function (attr) {
|
|
232
235
|
return attr === '*' || target.hasAttribute(attr);
|
|
233
236
|
});
|
|
234
|
-
if (
|
|
235
|
-
onRowClick(props.rawData, props.rowIndex);
|
|
237
|
+
if (attIndex > -1) {
|
|
238
|
+
onRowClick(props.rawData, props.rowIndex, arrts[attIndex]);
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
}
|
package/esm/tabs/tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;;AAqGtC,wBAAqC"}
|
package/esm/tabs/tab.js
CHANGED
|
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import Button from "../button";
|
|
10
|
+
import { useConfig } from "../config";
|
|
10
11
|
import { useTabsContext, util } from '@sheinx/hooks';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -24,6 +25,7 @@ var Tab = function Tab(props, ref) {
|
|
|
24
25
|
onChange = _useTabsContext.onChange,
|
|
25
26
|
activeBackground = _useTabsContext.activeBackground,
|
|
26
27
|
inactiveBackground = _useTabsContext.inactiveBackground;
|
|
28
|
+
var config = useConfig();
|
|
27
29
|
var tabsStyle = (jssStyle === null || jssStyle === void 0 || (_jssStyle$tabs = jssStyle.tabs) === null || _jssStyle$tabs === void 0 ? void 0 : _jssStyle$tabs.call(jssStyle)) || {};
|
|
28
30
|
var buttonStyle = (jssStyle === null || jssStyle === void 0 ? void 0 : jssStyle.button) || {};
|
|
29
31
|
var tabClass = classNames(tabsStyle.tab, {});
|
|
@@ -81,9 +83,11 @@ var Tab = function Tab(props, ref) {
|
|
|
81
83
|
disabled: disabled,
|
|
82
84
|
type: isActive ? 'primary' : 'secondary',
|
|
83
85
|
onClick: handleClick,
|
|
86
|
+
dir: config.direction,
|
|
84
87
|
children: tab
|
|
85
88
|
}));
|
|
86
89
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
90
|
+
dir: config.direction,
|
|
87
91
|
className: tabClass
|
|
88
92
|
}, getStateProps()), {}, {
|
|
89
93
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"tabs-header.d.ts","sourceRoot":"","sources":["tabs-header.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAwBrD,QAAA,MAAM,UAAU,UAAW,eAAe,gBAkPzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/esm/tabs/tabs-header.js
CHANGED
|
@@ -16,8 +16,23 @@ import { useTabsContext, useTransform, util } from '@sheinx/hooks';
|
|
|
16
16
|
import Tab from "./tab";
|
|
17
17
|
import Icon from "../icons";
|
|
18
18
|
import Button from "../button";
|
|
19
|
+
import { useConfig } from "../config";
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
var getRectDiff = function getRectDiff(node, pNode) {
|
|
23
|
+
var nodeRect = node.getBoundingClientRect();
|
|
24
|
+
var pNodeRect = pNode.getBoundingClientRect();
|
|
25
|
+
return {
|
|
26
|
+
left: nodeRect.left - pNodeRect.left,
|
|
27
|
+
right: nodeRect.right - pNodeRect.right,
|
|
28
|
+
top: nodeRect.top - pNodeRect.top,
|
|
29
|
+
bottom: nodeRect.bottom - pNodeRect.bottom,
|
|
30
|
+
width: nodeRect.width,
|
|
31
|
+
height: nodeRect.height,
|
|
32
|
+
parentWidth: pNodeRect.width,
|
|
33
|
+
parentHeight: pNodeRect.height
|
|
34
|
+
};
|
|
35
|
+
};
|
|
21
36
|
var TabsHeader = function TabsHeader(props) {
|
|
22
37
|
var _jssStyle$tabs;
|
|
23
38
|
var tabs = props.tabs,
|
|
@@ -41,6 +56,8 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
41
56
|
isVertical = _useTabsContext.isVertical,
|
|
42
57
|
onCollapsible = _useTabsContext.onCollapsible,
|
|
43
58
|
active = _useTabsContext.active;
|
|
59
|
+
var config = useConfig();
|
|
60
|
+
var isRtl = config.direction === 'rtl';
|
|
44
61
|
useEffect(function () {
|
|
45
62
|
if (sticky && headerRef.current && scrollRef.current && !loaded) {
|
|
46
63
|
setLoaded(true);
|
|
@@ -49,8 +66,9 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
49
66
|
var _useTransform = useTransform({
|
|
50
67
|
autoScroll: true,
|
|
51
68
|
direction: isVertical ? 'Y' : 'X',
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
containerRef: headerRef,
|
|
70
|
+
targetRef: scrollRef,
|
|
71
|
+
isRtl: config.direction === 'rtl'
|
|
54
72
|
}),
|
|
55
73
|
delta = _useTransform.delta,
|
|
56
74
|
atStart = _useTransform.atStart,
|
|
@@ -58,20 +76,20 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
58
76
|
transformStyle = _useTransform.style,
|
|
59
77
|
shouldScroll = _useTransform.shouldScroll,
|
|
60
78
|
handleTransform = _useTransform.handleTransform,
|
|
61
|
-
setTransform = _useTransform.setTransform
|
|
62
|
-
getRectDiff = _useTransform.getRectDiff;
|
|
79
|
+
setTransform = _useTransform.setTransform;
|
|
63
80
|
var headerStyle = (jssStyle === null || jssStyle === void 0 || (_jssStyle$tabs = jssStyle.tabs) === null || _jssStyle$tabs === void 0 ? void 0 : _jssStyle$tabs.call(jssStyle)) || {};
|
|
64
81
|
var headerClass = classNames(headerStyle.header, {});
|
|
65
82
|
var headerWrapperClass = classNames(headerStyle.headerWrapper, {});
|
|
66
83
|
var buttonStyle = (jssStyle === null || jssStyle === void 0 ? void 0 : jssStyle.button) || {};
|
|
67
|
-
var calculateOffset = function calculateOffset(
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
var calculateOffset = function calculateOffset(currentScrollOffsetStartValue, width, currentOffsetStartValue, currentOffsetEndOther, parentWidth) {
|
|
85
|
+
var single = isRtl && !isVertical ? -1 : 1;
|
|
86
|
+
if (currentOffsetStartValue * single < 0) {
|
|
87
|
+
return currentScrollOffsetStartValue;
|
|
88
|
+
}
|
|
89
|
+
if (currentOffsetEndOther * single > 0) {
|
|
90
|
+
return currentScrollOffsetStartValue + single * (width - parentWidth);
|
|
73
91
|
}
|
|
74
|
-
return
|
|
92
|
+
return undefined;
|
|
75
93
|
};
|
|
76
94
|
useEffect(function () {
|
|
77
95
|
if (!shouldScroll) return;
|
|
@@ -79,30 +97,33 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
79
97
|
var currentTab = tabRef.current[active];
|
|
80
98
|
if (!currentTab || !headerRef.current || !scrollRef.current) return 0;
|
|
81
99
|
var currentOffest = getRectDiff(currentTab, headerRef.current);
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
var currentScrollOffset = getRectDiff(currentTab, scrollRef.current);
|
|
101
|
+
// vertical
|
|
102
|
+
if (['left-top', 'right-top', 'left-bottom', 'right-bottom'].includes(getPosition)) {
|
|
103
|
+
return calculateOffset(currentScrollOffset.top, currentScrollOffset.height, currentOffest.top, currentOffest.bottom, currentOffest.parentHeight);
|
|
85
104
|
}
|
|
86
|
-
if (
|
|
87
|
-
return calculateOffset(
|
|
105
|
+
if (isRtl) {
|
|
106
|
+
return calculateOffset(currentScrollOffset.right, currentScrollOffset.width, currentOffest.right, currentOffest.left, currentOffest.parentWidth);
|
|
88
107
|
}
|
|
89
|
-
|
|
90
|
-
return -calculateOffset(scrollOffest.bottom, currentOffest.top, currentOffest.bottom);
|
|
91
|
-
}
|
|
92
|
-
return calculateOffset(-scrollOffest.left, currentOffest.left, currentOffest.right, false);
|
|
108
|
+
return calculateOffset(currentScrollOffset.left, currentScrollOffset.width, currentOffest.left, currentOffest.right, currentOffest.parentWidth);
|
|
93
109
|
};
|
|
94
|
-
|
|
110
|
+
var offset = getActiveTabOffest();
|
|
111
|
+
if (offset !== undefined) {
|
|
112
|
+
setTransform(offset);
|
|
113
|
+
}
|
|
95
114
|
}, [active, tabRef.current, headerRef.current, scrollRef.current, shouldScroll]);
|
|
96
115
|
var getDataProps = function getDataProps(options) {
|
|
97
116
|
return util.getDataAttribute(_objectSpread({}, options));
|
|
98
117
|
};
|
|
99
118
|
var handlePrev = function handlePrev() {
|
|
100
119
|
if (!headerRef.current) return;
|
|
101
|
-
|
|
120
|
+
var single = isRtl && !isVertical ? -1 : 1;
|
|
121
|
+
setTransform(delta - headerRef.current.clientWidth * single);
|
|
102
122
|
};
|
|
103
123
|
var handleNext = function handleNext() {
|
|
104
124
|
if (!headerRef.current) return;
|
|
105
|
-
|
|
125
|
+
var single = isRtl && !isVertical ? -1 : 1;
|
|
126
|
+
setTransform(delta + headerRef.current.clientWidth * single);
|
|
106
127
|
};
|
|
107
128
|
var renderTab = function renderTab() {
|
|
108
129
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -147,6 +168,7 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
147
168
|
state: atStart ? 'disabled' : ''
|
|
148
169
|
})), {}, {
|
|
149
170
|
onClick: handlePrev,
|
|
171
|
+
dir: config.direction,
|
|
150
172
|
children: shape === 'card' ? Icon.tabs.Pre : /*#__PURE__*/_jsx("span", {
|
|
151
173
|
className: headerStyle.iconInner,
|
|
152
174
|
children: Icon.tabs.Pre
|
|
@@ -160,6 +182,7 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
160
182
|
state: atEnd ? 'disabled' : ''
|
|
161
183
|
})), {}, {
|
|
162
184
|
onClick: handleNext,
|
|
185
|
+
dir: config.direction,
|
|
163
186
|
children: shape === 'card' ? Icon.tabs.Next : /*#__PURE__*/_jsx("span", {
|
|
164
187
|
className: headerStyle.iconInner,
|
|
165
188
|
children: Icon.tabs.Next
|
|
@@ -190,6 +213,7 @@ var TabsHeader = function TabsHeader(props) {
|
|
|
190
213
|
position: props.getPosition,
|
|
191
214
|
shape: shape
|
|
192
215
|
})), {}, {
|
|
216
|
+
dir: config.direction,
|
|
193
217
|
children: [!hideSplit && shape !== 'card' && renderHr(), collapsible && renderCollapsibleButton(), shouldScroll && renderPrevButton(), renderTab(), shouldScroll && renderNextButton(), extra && renderExtra()]
|
|
194
218
|
}));
|
|
195
219
|
};
|
package/esm/tabs/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["tabs.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,QAAA,MAAM,IAAI;YAAW,SAAS;;
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["tabs.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,QAAA,MAAM,IAAI;YAAW,SAAS;;CAuP7B,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;AA8LhD,wBAAoC"}
|
package/esm/textarea/textarea.js
CHANGED
|
@@ -135,6 +135,7 @@ var Textarea = function Textarea(props0) {
|
|
|
135
135
|
style: {
|
|
136
136
|
minWidth: 'auto'
|
|
137
137
|
},
|
|
138
|
+
dir: config.direction,
|
|
138
139
|
className: classNames(textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.info, !!isError && (textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.infoError)),
|
|
139
140
|
children: text
|
|
140
141
|
}, 'info');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-auto-size.d.ts","sourceRoot":"","sources":["use-auto-size.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;0BAKI,eAAe;;
|
|
1
|
+
{"version":3,"file":"use-auto-size.d.ts","sourceRoot":"","sources":["use-auto-size.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,WAAW;;;;;0BAKI,eAAe;;WAoBT,MAAM,YAAY,gBAyB5C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -25,6 +25,7 @@ var useAutoSize = function useAutoSize(props) {
|
|
|
25
25
|
if (!shadowRef.current) return;
|
|
26
26
|
var v = value || '';
|
|
27
27
|
if (shadowRef.current.value !== v) shadowRef.current.value = v;
|
|
28
|
+
if (shadowRef.current.scrollHeight === 0) return;
|
|
28
29
|
setHeight(shadowRef.current.scrollHeight);
|
|
29
30
|
};
|
|
30
31
|
React.useEffect(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["tooltip.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["tooltip.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,QAAA,MAAM,OAAO,UAAW,YAAY,uBA0FnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/esm/tooltip/tooltip.js
CHANGED
|
@@ -8,6 +8,7 @@ import { usePopup, util } from '@sheinx/hooks';
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import React, { cloneElement, isValidElement } from 'react';
|
|
10
10
|
import AbsoluteList from "../absolute-list";
|
|
11
|
+
import { useConfig } from "../config";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -28,6 +29,7 @@ var Tooltip = function Tooltip(props) {
|
|
|
28
29
|
_props$position = props.position,
|
|
29
30
|
popsitionProps = _props$position === void 0 ? 'bottom' : _props$position;
|
|
30
31
|
var tooltipClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$tooltip = jssStyle.tooltip) === null || _jssStyle$tooltip === void 0 ? void 0 : _jssStyle$tooltip.call(jssStyle);
|
|
32
|
+
var config = useConfig();
|
|
31
33
|
var childrenProps = /*#__PURE__*/isValidElement(children) ? children === null || children === void 0 ? void 0 : children.props : {};
|
|
32
34
|
var _usePopup = usePopup({
|
|
33
35
|
position: popsitionProps,
|
|
@@ -84,6 +86,7 @@ var Tooltip = function Tooltip(props) {
|
|
|
84
86
|
})), {}, {
|
|
85
87
|
ref: popupRef,
|
|
86
88
|
onMouseLeave: events.onMouseLeave,
|
|
89
|
+
dir: config.direction,
|
|
87
90
|
children: /*#__PURE__*/_jsx("div", {
|
|
88
91
|
style: style,
|
|
89
92
|
className: classNames(tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.content),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["transfer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAiC,YAAY,EAAQ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["transfer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAiC,YAAY,EAAQ,MAAM,eAAe,CAAC;AAMlF,QAAA,MAAM,QAAQ,gGAuLb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/esm/transfer/transfer.js
CHANGED
|
@@ -8,6 +8,7 @@ import { useTransfer, util } from '@sheinx/hooks';
|
|
|
8
8
|
import TransferList from "./transfer-list";
|
|
9
9
|
import TransferOperate from "./transfer-operate";
|
|
10
10
|
import Icon from "../icons";
|
|
11
|
+
import { useConfig } from "../config";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
var Transfer = function Transfer(props) {
|
|
@@ -52,6 +53,8 @@ var Transfer = function Transfer(props) {
|
|
|
52
53
|
onFilterProp = props.onFilter,
|
|
53
54
|
onChangeProp = props.onChange,
|
|
54
55
|
onSelectChangeProp = props.onSelectChange;
|
|
56
|
+
var config = useConfig();
|
|
57
|
+
var isRtl = config.direction === 'rtl';
|
|
55
58
|
var _useTransfer = useTransfer({
|
|
56
59
|
data: data,
|
|
57
60
|
keygen: keygen,
|
|
@@ -98,7 +101,7 @@ var Transfer = function Transfer(props) {
|
|
|
98
101
|
operation: sourceOperation,
|
|
99
102
|
listDatum: sourceDatum,
|
|
100
103
|
value: sourceSelectedKeys,
|
|
101
|
-
children: operationIcon && !sourceOperation && Icon.transfer.Add
|
|
104
|
+
children: operationIcon && !sourceOperation && (isRtl ? Icon.transfer.Remove : Icon.transfer.Add)
|
|
102
105
|
}), /*#__PURE__*/_jsx(TransferOperate, {
|
|
103
106
|
size: size,
|
|
104
107
|
listType: "target",
|
|
@@ -108,7 +111,7 @@ var Transfer = function Transfer(props) {
|
|
|
108
111
|
operation: targetOperation,
|
|
109
112
|
listDatum: targetDatum,
|
|
110
113
|
value: targetSelectedKeys,
|
|
111
|
-
children: operationIcon && !targetOperation && Icon.transfer.Remove
|
|
114
|
+
children: operationIcon && !targetOperation && (isRtl ? Icon.transfer.Add : Icon.transfer.Remove)
|
|
112
115
|
})]
|
|
113
116
|
});
|
|
114
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-checkbox.d.ts","sourceRoot":"","sources":["tree-checkbox.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"tree-checkbox.d.ts","sourceRoot":"","sources":["tree-checkbox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,QAAA,MAAM,YAAY,gFA8BjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { Checkbox } from "../checkbox";
|
|
2
3
|
import { useTreeContext } from "./tree-context";
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -10,7 +11,8 @@ var TreeCheckbox = function TreeCheckbox(props) {
|
|
|
10
11
|
var _useTreeContext = useTreeContext(),
|
|
11
12
|
getValue = _useTreeContext.getValue,
|
|
12
13
|
set = _useTreeContext.set,
|
|
13
|
-
getChecked = _useTreeContext.getChecked
|
|
14
|
+
getChecked = _useTreeContext.getChecked,
|
|
15
|
+
unBindUpdate = _useTreeContext.unBindUpdate;
|
|
14
16
|
var handleChange = function handleChange(_, checked) {
|
|
15
17
|
set(id, checked ? 1 : 0);
|
|
16
18
|
if (onChange) {
|
|
@@ -18,6 +20,11 @@ var TreeCheckbox = function TreeCheckbox(props) {
|
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
var checked = getChecked(id);
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
return function () {
|
|
25
|
+
unBindUpdate(id);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
21
28
|
return /*#__PURE__*/_jsx(Checkbox
|
|
22
29
|
//@ts-ignore
|
|
23
30
|
, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-content.d.ts","sourceRoot":"","sources":["tree-content.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"tree-content.d.ts","sourceRoot":"","sources":["tree-content.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAmB,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD,QAAA,MAAM,WAAW,mGA+MhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/esm/tree/tree-content.js
CHANGED
|
@@ -5,11 +5,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { util } from '@sheinx/hooks';
|
|
8
|
+
import { util, useRender } from '@sheinx/hooks';
|
|
9
9
|
import Checkbox from "./tree-checkbox";
|
|
10
10
|
import { useTreeContext } from "./tree-context";
|
|
11
11
|
import Icons from "../icons";
|
|
12
12
|
import Spin from "../spin";
|
|
13
|
+
import { useConfig } from "../config";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
var NodeContent = function NodeContent(props) {
|
|
@@ -36,9 +37,13 @@ var NodeContent = function NodeContent(props) {
|
|
|
36
37
|
onToggle = props.onToggle,
|
|
37
38
|
onDragOver = props.onDragOver,
|
|
38
39
|
onNodeClick = props.onNodeClick;
|
|
40
|
+
var forceUpdate = useRender();
|
|
39
41
|
var _useTreeContext = useTreeContext(),
|
|
40
|
-
isDisabled = _useTreeContext.isDisabled
|
|
42
|
+
isDisabled = _useTreeContext.isDisabled,
|
|
43
|
+
bindUpdate = _useTreeContext.bindUpdate;
|
|
44
|
+
var config = useConfig();
|
|
41
45
|
var disabled = isDisabled(id);
|
|
46
|
+
bindUpdate(id, forceUpdate);
|
|
42
47
|
var contentStyle = (jssStyle === null || jssStyle === void 0 ? void 0 : jssStyle.tree()) || {};
|
|
43
48
|
var rootClass = classNames(contentStyle.contentWrapper, _defineProperty(_defineProperty({}, contentStyle.childnode, data[childrenKey] && data[childrenKey].length > 0), contentStyle.inlineContent, inlineNode));
|
|
44
49
|
var contentClass = classNames(contentStyle.content, util.isString(contentClassProp) && contentClassProp, util.isFunc(contentClassProp) && contentClassProp(data));
|
|
@@ -59,8 +64,15 @@ var NodeContent = function NodeContent(props) {
|
|
|
59
64
|
var handleIndicatorClick = function handleIndicatorClick() {
|
|
60
65
|
onToggle === null || onToggle === void 0 || onToggle(id);
|
|
61
66
|
if (data[childrenKey] !== undefined) return;
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
if (loader) {
|
|
68
|
+
setFetching(true);
|
|
69
|
+
var result = loader(id, data);
|
|
70
|
+
if (util.isPromise(result)) {
|
|
71
|
+
result.then(function () {
|
|
72
|
+
return setFetching(false);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
64
76
|
};
|
|
65
77
|
var handleNodeClick = function handleNodeClick() {
|
|
66
78
|
if (disabled) return;
|
|
@@ -79,6 +91,7 @@ var NodeContent = function NodeContent(props) {
|
|
|
79
91
|
className: contentStyle.iconWrapper,
|
|
80
92
|
"data-expanded": expanded,
|
|
81
93
|
"data-icon": hasExpandIcons,
|
|
94
|
+
dir: config.direction,
|
|
82
95
|
children: /*#__PURE__*/_jsx(Spin, {
|
|
83
96
|
size: 12,
|
|
84
97
|
jssStyle: jssStyle
|
|
@@ -94,9 +107,11 @@ var NodeContent = function NodeContent(props) {
|
|
|
94
107
|
className: contentStyle.iconWrapper,
|
|
95
108
|
"data-expanded": expanded,
|
|
96
109
|
"data-icon": hasExpandIcons,
|
|
110
|
+
dir: config.direction,
|
|
97
111
|
children: /*#__PURE__*/_jsx("span", {
|
|
98
112
|
className: classNames(contentStyle.icon, iconClass),
|
|
99
113
|
onClick: handleIndicatorClick,
|
|
114
|
+
dir: config.direction,
|
|
100
115
|
children: util.isFunc(icon) ? icon(data) : icon
|
|
101
116
|
})
|
|
102
117
|
});
|
|
@@ -105,9 +120,11 @@ var NodeContent = function NodeContent(props) {
|
|
|
105
120
|
className: contentStyle.iconWrapper,
|
|
106
121
|
"data-expanded": expanded,
|
|
107
122
|
"data-icon": hasExpandIcons,
|
|
123
|
+
dir: config.direction,
|
|
108
124
|
children: /*#__PURE__*/_jsx("span", {
|
|
109
125
|
className: classNames(contentStyle.icon, iconClass),
|
|
110
126
|
onClick: handleIndicatorClick,
|
|
127
|
+
dir: config.direction,
|
|
111
128
|
children: util.isFunc(icon) ? icon(data) : hasExpandIcons ? icon : Icons.tree.Expand
|
|
112
129
|
})
|
|
113
130
|
});
|
|
@@ -115,7 +132,7 @@ var NodeContent = function NodeContent(props) {
|
|
|
115
132
|
if (children && children.length > 0) return indicator;
|
|
116
133
|
if (Array.isArray(children) || children === null) return null;
|
|
117
134
|
if (fetching && !children) return renderLoading();
|
|
118
|
-
if (loader &&
|
|
135
|
+
if (loader && children === undefined) return indicator;
|
|
119
136
|
return null;
|
|
120
137
|
};
|
|
121
138
|
var renderCheckbox = function renderCheckbox() {
|
|
@@ -142,11 +159,14 @@ var NodeContent = function NodeContent(props) {
|
|
|
142
159
|
return /*#__PURE__*/_jsxs("div", {
|
|
143
160
|
className: rootClass,
|
|
144
161
|
onDragOver: onDragOver,
|
|
162
|
+
dir: config.direction,
|
|
145
163
|
children: [renderIndicator(), /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread(_objectSpread({
|
|
164
|
+
dir: config.direction,
|
|
146
165
|
ref: bindContent,
|
|
147
166
|
className: contentClass
|
|
148
167
|
}, contentDataProps()), contentEvent), {}, {
|
|
149
168
|
children: [onChange && renderCheckbox(), /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
169
|
+
dir: config.direction,
|
|
150
170
|
className: textClass,
|
|
151
171
|
onDoubleClick: handleNodeExpand
|
|
152
172
|
}, textEvent), {}, {
|
|
@@ -25,7 +25,7 @@ export interface TreeContextProps<DataItem, Value extends KeygenResult[]> extend
|
|
|
25
25
|
fetching: boolean;
|
|
26
26
|
inlineNode?: boolean;
|
|
27
27
|
highlight?: boolean;
|
|
28
|
-
loader?: (key: KeygenResult, data: DataItem) => void
|
|
28
|
+
loader?: (key: KeygenResult, data: DataItem) => void | Promise<any>;
|
|
29
29
|
setFetching: (value: boolean) => void;
|
|
30
30
|
onToggle?: (id: KeygenResult, expanded?: boolean) => void;
|
|
31
31
|
onFetch: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-content.type.d.ts","sourceRoot":"","sources":["tree-content.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,gBAAgB,CAAC,QAAQ,EAAE,KAAK,SAAS,YAAY,EAAE,CACtE,SAAQ,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;IACrF,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,EAAE,EAAE,YAAY,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;IACvE,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,KAAK;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3F,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"tree-content.type.d.ts","sourceRoot":"","sources":["tree-content.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,gBAAgB,CAAC,QAAQ,EAAE,KAAK,SAAS,YAAY,EAAE,CACtE,SAAQ,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;IACrF,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,EAAE,EAAE,YAAY,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;IACvE,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,KAAK;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3F,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACpE,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,CAAC;IACxD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const TreeContext: React.Context<
|
|
2
|
+
import { TreeProviderProps } from './tree-context.type';
|
|
3
|
+
export declare const TreeContext: React.Context<import("../../../hooks/src/components/use-tree/use-tree.type").TreeDatum<any>>;
|
|
4
4
|
export declare const Provider: <DataItem>(props: TreeProviderProps<DataItem>) => JSX.Element;
|
|
5
|
-
export declare const useTreeContext: () =>
|
|
5
|
+
export declare const useTreeContext: () => import("../../../hooks/src/components/use-tree/use-tree.type").TreeDatum<any>;
|
|
6
6
|
//# sourceMappingURL=tree-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-context.d.ts","sourceRoot":"","sources":["tree-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"tree-context.d.ts","sourceRoot":"","sources":["tree-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE1E,eAAO,MAAM,WAAW,8FAA0E,CAAC;AAEnG,eAAO,MAAM,QAAQ,+DAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,qFAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-node.d.ts","sourceRoot":"","sources":["tree-node.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAiC,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tree-node.d.ts","sourceRoot":"","sources":["tree-node.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAiC,YAAY,EAAE,MAAM,eAAe,CAAC;AAkB5E,QAAA,MAAM,IAAI,gGAgST,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/esm/tree/tree-node.js
CHANGED
|
@@ -9,6 +9,7 @@ import classNames from 'classnames';
|
|
|
9
9
|
import TreeContent from "./tree-content";
|
|
10
10
|
import { useTreeContext } from "./tree-context";
|
|
11
11
|
import { useTreeNode, util } from '@sheinx/hooks';
|
|
12
|
+
import { useConfig } from "../config";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
var placeElement = null;
|
|
@@ -63,6 +64,7 @@ var Node = function Node(props) {
|
|
|
63
64
|
onDragEnd = props.onDragEnd,
|
|
64
65
|
List = props.listComponent;
|
|
65
66
|
initPlaceElement();
|
|
67
|
+
var config = useConfig();
|
|
66
68
|
var element = useRef(null);
|
|
67
69
|
var content = useRef(null);
|
|
68
70
|
var dragImage = useRef(null);
|
|
@@ -238,6 +240,7 @@ var Node = function Node(props) {
|
|
|
238
240
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, getDropProps()), {}, {
|
|
239
241
|
ref: element,
|
|
240
242
|
className: rootClass,
|
|
243
|
+
dir: config.direction,
|
|
241
244
|
children: [/*#__PURE__*/_jsx(TreeContent, {
|
|
242
245
|
jssStyle: jssStyle,
|
|
243
246
|
isControlled: isControlled,
|
package/esm/tree/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["tree.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAA4B,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,QAAA,MAAM,IAAI,4FA8NT,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/esm/tree/tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "dragHoverExpand", "active", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart"];
|
|
2
|
+
var _excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "dragHoverExpand", "active", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart", "datum"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -15,7 +15,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
15
15
|
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; }
|
|
16
16
|
import { useEffect } from 'react';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
|
-
import { useTree, util
|
|
18
|
+
import { useTree, util } from '@sheinx/hooks';
|
|
19
19
|
import RootTree from "./tree-root";
|
|
20
20
|
import { Provider } from "./tree-context";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -66,8 +66,8 @@ var Tree = function Tree(props) {
|
|
|
66
66
|
onDragLeave = props.onDragLeave,
|
|
67
67
|
onDragOver = props.onDragOver,
|
|
68
68
|
onDragStart = props.onDragStart,
|
|
69
|
+
propsDatum = props.datum,
|
|
69
70
|
rest = _objectWithoutProperties(props, _excluded);
|
|
70
|
-
var prevData = usePrevious(data);
|
|
71
71
|
var _useTree = useTree({
|
|
72
72
|
mode: mode,
|
|
73
73
|
value: value,
|
|
@@ -83,7 +83,8 @@ var Tree = function Tree(props) {
|
|
|
83
83
|
defaultExpanded: defaultExpanded,
|
|
84
84
|
childrenKey: childrenKey,
|
|
85
85
|
keygen: keygen,
|
|
86
|
-
onExpand: onExpandProp
|
|
86
|
+
onExpand: onExpandProp,
|
|
87
|
+
datum: propsDatum
|
|
87
88
|
}),
|
|
88
89
|
datum = _useTree.datum,
|
|
89
90
|
expanded = _useTree.expanded,
|
|
@@ -184,16 +185,6 @@ var Tree = function Tree(props) {
|
|
|
184
185
|
useEffect(function () {
|
|
185
186
|
handleUpdateExpanded(expanded);
|
|
186
187
|
}, [expanded]);
|
|
187
|
-
useEffect(function () {
|
|
188
|
-
if (!prevData) return;
|
|
189
|
-
if (prevData !== data && dataUpdate) {
|
|
190
|
-
datum.setData(data);
|
|
191
|
-
}
|
|
192
|
-
}, [data]);
|
|
193
|
-
useEffect(function () {
|
|
194
|
-
if (!value) return;
|
|
195
|
-
datum.setValue(value);
|
|
196
|
-
}, [value]);
|
|
197
188
|
useEffect(function () {
|
|
198
189
|
if (getDatum) getDatum(datum);
|
|
199
190
|
}, []);
|