shineout 3.6.0-beta.14 → 3.6.0-beta.16

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/index.js CHANGED
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
514
514
  // 此文件由脚本自动生成,请勿直接修改。
515
515
  // This file was generated automatically by a script. Please do not modify it directly.
516
516
  var _default = exports.default = {
517
- version: '3.6.0-beta.14'
517
+ version: '3.6.0-beta.16'
518
518
  };
package/dist/shineout.js CHANGED
@@ -12130,7 +12130,7 @@ var handleStyle = function handleStyle(style) {
12130
12130
  };
12131
12131
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12132
12132
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12133
- /* harmony default export */ var version = ('3.6.0-beta.14');
12133
+ /* harmony default export */ var version = ('3.6.0-beta.16');
12134
12134
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12135
12135
 
12136
12136
 
@@ -29718,13 +29718,15 @@ function getClosestScrollContainer(element) {
29718
29718
  // 如果没有找到可滚动的祖先,返回 body 或 documentElement
29719
29719
  return document.scrollingElement || document.documentElement;
29720
29720
  }
29721
- function getClosestFixedContainer(element) {
29721
+ function getClosestPositionedContainer(element) {
29722
+ var positions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['fixed', 'absolute'];
29722
29723
  if (!element) {
29723
29724
  return null;
29724
29725
  }
29725
29726
  var isFixable = function isFixable(el) {
29726
29727
  var style = window.getComputedStyle(el);
29727
- return style.position === 'fixed';
29728
+ var position = style.position;
29729
+ return positions.includes(position);
29728
29730
  };
29729
29731
 
29730
29732
  // 遍历父元素
@@ -33724,7 +33726,6 @@ var getRect = function getRect(el) {
33724
33726
  if (el) {
33725
33727
  devUseWarning.error("the ".concat(el, " is not a element"));
33726
33728
  }
33727
- ;
33728
33729
  return {
33729
33730
  top: 0,
33730
33731
  bottom: winHeight
@@ -33780,13 +33781,14 @@ function getObserver(obj, id) {
33780
33781
  render = obj.render,
33781
33782
  offscreen = obj.offscreen,
33782
33783
  noRemove = obj.noRemove;
33783
- var fixedContainer = getClosestFixedContainer(element);
33784
+ var fixedContainer = getClosestPositionedContainer(element, ['fixed', 'absolute']);
33784
33785
  var observer = new IntersectionObserver(function (entries) {
33785
33786
  entries.forEach(function (en) {
33786
33787
  if (en.isIntersecting || en.intersectionRatio > 0) {
33787
33788
  render();
33788
33789
  if (!noRemove) removeStack(id);
33789
33790
  } else {
33791
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
33790
33792
  offscreen && offscreen();
33791
33793
  }
33792
33794
  });
@@ -37919,6 +37921,34 @@ var useTree = function useTree(props) {
37919
37921
  }
37920
37922
  return ids;
37921
37923
  };
37924
+ var initFlatData = function initFlatData(data, path) {
37925
+ var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
37926
+ var pid = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
37927
+ var result = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
37928
+ for (var i = 0; i < data.length; i++) {
37929
+ var item = data[i];
37930
+ var id = getKey(item, path[path.length - 1], i);
37931
+ var node = {
37932
+ id: id,
37933
+ level: level,
37934
+ data: item,
37935
+ pid: pid
37936
+ };
37937
+ if (defaultExpandAll) {
37938
+ result.push(node);
37939
+ } else {
37940
+ if (level === 1) {
37941
+ result.push(node);
37942
+ } else if (expanded && pid !== null && expanded.indexOf(pid) >= 0) {
37943
+ result.push(node);
37944
+ }
37945
+ }
37946
+ if (Array.isArray(item[childrenKey])) {
37947
+ initFlatData(item[childrenKey], [].concat(toConsumableArray_default()(path), [id]), level + 1, id, result);
37948
+ }
37949
+ }
37950
+ return result;
37951
+ };
37922
37952
  var initValue = function initValue(ids_outer, forceCheck) {
37923
37953
  var ids = ids_outer;
37924
37954
  if (!context.data || !context.value) {
@@ -38166,7 +38196,7 @@ var useTree = function useTree(props) {
38166
38196
  expanded: true
38167
38197
  }));
38168
38198
  });
38169
- var _getExpandVirtualData = getExpandVirtualData(context.data, expanded, getKey, childrenKey),
38199
+ var _getExpandVirtualData = getExpandVirtualData(props.tiledData || context.data, expanded, getKey, childrenKey),
38170
38200
  treeDataInfo = _getExpandVirtualData.treeDataInfo;
38171
38201
  if (!treeDataInfo) {
38172
38202
  return;
@@ -38196,6 +38226,12 @@ var useTree = function useTree(props) {
38196
38226
  if (props.datum) return;
38197
38227
  setValue(value);
38198
38228
  }, [value]);
38229
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
38230
+ if (!virtual) return;
38231
+ if (!props.tiledData) return;
38232
+ var tiledFlatData = initFlatData(props.tiledData, [], 1);
38233
+ setDataFlat(tiledFlatData);
38234
+ }, [props.tiledData]);
38199
38235
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
38200
38236
  setInited(true);
38201
38237
  }, []);
@@ -53930,7 +53966,7 @@ var TreeVirtual = function TreeVirtual(props) {
53930
53966
 
53931
53967
 
53932
53968
 
53933
- var tree_excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "virtual", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "rootStyle", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "dragHoverExpand", "active", "setActive", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart", "datum"];
53969
+ var tree_excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "virtual", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "rootStyle", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "ignoreSetFlat", "dragHoverExpand", "active", "setActive", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart", "datum"];
53934
53970
 
53935
53971
 
53936
53972
 
@@ -53972,6 +54008,8 @@ var Tree = function Tree(props) {
53972
54008
  dragImageStyle = props.dragImageStyle,
53973
54009
  dragSibling = props.dragSibling,
53974
54010
  unmatch = props.unmatch,
54011
+ _props$ignoreSetFlat = props.ignoreSetFlat,
54012
+ ignoreSetFlat = _props$ignoreSetFlat === void 0 ? false : _props$ignoreSetFlat,
53975
54013
  dragHoverExpand = props.dragHoverExpand,
53976
54014
  propActive = props.active,
53977
54015
  propSetActive = props.setActive,
@@ -54081,10 +54119,10 @@ var Tree = function Tree(props) {
54081
54119
  newExpanded = expandedArr.filter(function (e) {
54082
54120
  return e !== id;
54083
54121
  });
54084
- if (virtual) datum.removeFlat(id);
54122
+ if (virtual && !ignoreSetFlat) datum.removeFlat(id);
54085
54123
  } else {
54086
54124
  newExpanded = [].concat(toConsumableArray_default()(expandedArr), [id]);
54087
- if (virtual) datum.insertFlat(id);
54125
+ if (virtual && !ignoreSetFlat) datum.insertFlat(id);
54088
54126
  }
54089
54127
  if (onExpand) onExpand(newExpanded);
54090
54128
  };
@@ -54156,6 +54194,7 @@ var Tree = function Tree(props) {
54156
54194
  onToggle: handleToggle
54157
54195
  }));
54158
54196
  }
54197
+ console.log('data', data);
54159
54198
  return /*#__PURE__*/(0,jsx_runtime.jsx)(tree_root, {
54160
54199
  rootStyle: rootStyle,
54161
54200
  isControlled: 'expanded' in props,
@@ -64854,8 +64893,9 @@ var TreeSelect = function TreeSelect(props0) {
64854
64893
  var _useTree = use_tree({
64855
64894
  mode: mode,
64856
64895
  value: value,
64857
- data: tiledData,
64896
+ data: data,
64858
64897
  unmatch: unmatch,
64898
+ tiledData: tiledData,
64859
64899
  virtual: virtual,
64860
64900
  disabled: disabled,
64861
64901
  active: multiple ? undefined : value[0],
@@ -65073,9 +65113,14 @@ var TreeSelect = function TreeSelect(props0) {
65073
65113
  if (from !== 'blur') {
65074
65114
  focusAndOpen();
65075
65115
  }
65076
- setVirtualExpanded([]);
65077
65116
  onTiledFilter === null || onTiledFilter === void 0 || onTiledFilter(trim ? text.trim() : text);
65078
65117
  };
65118
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
65119
+ if (virtual && expanded) {
65120
+ console.log(expanded);
65121
+ setVirtualExpanded(expanded);
65122
+ }
65123
+ }, [expanded]);
65079
65124
  var handleChange = function handleChange(item, id) {
65080
65125
  if (disabled === true || datum !== null && datum !== void 0 && datum.isDisabled(id)) return;
65081
65126
  var currentData = datum.getDataById(id);
@@ -65249,16 +65294,18 @@ var TreeSelect = function TreeSelect(props0) {
65249
65294
  virtual: virtual,
65250
65295
  childrenKey: props.childrenKey,
65251
65296
  line: line,
65297
+ ignoreSetFlat: true,
65252
65298
  mode: mode,
65253
65299
  height: height,
65254
65300
  data: tiledData,
65301
+ tiledData: tiledData,
65255
65302
  keygen: keygen,
65256
65303
  unmatch: unmatch,
65257
65304
  value: value,
65258
65305
  highlight: !multiple,
65259
65306
  loader: loader,
65260
65307
  onExpand: handleExpanded,
65261
- expanded: virtualExpanded.length > 0 ? virtualExpanded : controlExpanded || unControlExpanded,
65308
+ expanded: virtual ? virtualExpanded : controlExpanded || unControlExpanded,
65262
65309
  defaultExpandAll: defaultExpandAll,
65263
65310
  expandIcons: tiledExpandIcons,
65264
65311
  disabled: disabled,
@@ -68928,7 +68975,7 @@ var upload_interface = __webpack_require__(8821);
68928
68975
 
68929
68976
 
68930
68977
  /* harmony default export */ var src_0 = ({
68931
- version: '3.6.0-beta.14'
68978
+ version: '3.6.0-beta.16'
68932
68979
  });
68933
68980
  }();
68934
68981
  /******/ return __webpack_exports__;