shineout 3.6.0-beta.14 → 3.6.0-beta.15

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.15'
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.15');
12134
12134
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12135
12135
 
12136
12136
 
@@ -37919,6 +37919,34 @@ var useTree = function useTree(props) {
37919
37919
  }
37920
37920
  return ids;
37921
37921
  };
37922
+ var initFlatData = function initFlatData(data, path) {
37923
+ var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
37924
+ var pid = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
37925
+ var result = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
37926
+ for (var i = 0; i < data.length; i++) {
37927
+ var item = data[i];
37928
+ var id = getKey(item, path[path.length - 1], i);
37929
+ var node = {
37930
+ id: id,
37931
+ level: level,
37932
+ data: item,
37933
+ pid: pid
37934
+ };
37935
+ if (defaultExpandAll) {
37936
+ result.push(node);
37937
+ } else {
37938
+ if (level === 1) {
37939
+ result.push(node);
37940
+ } else if (expanded && pid !== null && expanded.indexOf(pid) >= 0) {
37941
+ result.push(node);
37942
+ }
37943
+ }
37944
+ if (Array.isArray(item[childrenKey])) {
37945
+ initFlatData(item[childrenKey], [].concat(toConsumableArray_default()(path), [id]), level + 1, id, result);
37946
+ }
37947
+ }
37948
+ return result;
37949
+ };
37922
37950
  var initValue = function initValue(ids_outer, forceCheck) {
37923
37951
  var ids = ids_outer;
37924
37952
  if (!context.data || !context.value) {
@@ -38166,7 +38194,7 @@ var useTree = function useTree(props) {
38166
38194
  expanded: true
38167
38195
  }));
38168
38196
  });
38169
- var _getExpandVirtualData = getExpandVirtualData(context.data, expanded, getKey, childrenKey),
38197
+ var _getExpandVirtualData = getExpandVirtualData(props.tiledData || context.data, expanded, getKey, childrenKey),
38170
38198
  treeDataInfo = _getExpandVirtualData.treeDataInfo;
38171
38199
  if (!treeDataInfo) {
38172
38200
  return;
@@ -38196,6 +38224,12 @@ var useTree = function useTree(props) {
38196
38224
  if (props.datum) return;
38197
38225
  setValue(value);
38198
38226
  }, [value]);
38227
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
38228
+ if (!virtual) return;
38229
+ if (!props.tiledData) return;
38230
+ var tiledFlatData = initFlatData(props.tiledData, [], 1);
38231
+ setDataFlat(tiledFlatData);
38232
+ }, [props.tiledData]);
38199
38233
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
38200
38234
  setInited(true);
38201
38235
  }, []);
@@ -53930,7 +53964,7 @@ var TreeVirtual = function TreeVirtual(props) {
53930
53964
 
53931
53965
 
53932
53966
 
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"];
53967
+ 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
53968
 
53935
53969
 
53936
53970
 
@@ -53972,6 +54006,8 @@ var Tree = function Tree(props) {
53972
54006
  dragImageStyle = props.dragImageStyle,
53973
54007
  dragSibling = props.dragSibling,
53974
54008
  unmatch = props.unmatch,
54009
+ _props$ignoreSetFlat = props.ignoreSetFlat,
54010
+ ignoreSetFlat = _props$ignoreSetFlat === void 0 ? false : _props$ignoreSetFlat,
53975
54011
  dragHoverExpand = props.dragHoverExpand,
53976
54012
  propActive = props.active,
53977
54013
  propSetActive = props.setActive,
@@ -54081,10 +54117,10 @@ var Tree = function Tree(props) {
54081
54117
  newExpanded = expandedArr.filter(function (e) {
54082
54118
  return e !== id;
54083
54119
  });
54084
- if (virtual) datum.removeFlat(id);
54120
+ if (virtual && !ignoreSetFlat) datum.removeFlat(id);
54085
54121
  } else {
54086
54122
  newExpanded = [].concat(toConsumableArray_default()(expandedArr), [id]);
54087
- if (virtual) datum.insertFlat(id);
54123
+ if (virtual && !ignoreSetFlat) datum.insertFlat(id);
54088
54124
  }
54089
54125
  if (onExpand) onExpand(newExpanded);
54090
54126
  };
@@ -54156,6 +54192,7 @@ var Tree = function Tree(props) {
54156
54192
  onToggle: handleToggle
54157
54193
  }));
54158
54194
  }
54195
+ console.log('data', data);
54159
54196
  return /*#__PURE__*/(0,jsx_runtime.jsx)(tree_root, {
54160
54197
  rootStyle: rootStyle,
54161
54198
  isControlled: 'expanded' in props,
@@ -64854,8 +64891,9 @@ var TreeSelect = function TreeSelect(props0) {
64854
64891
  var _useTree = use_tree({
64855
64892
  mode: mode,
64856
64893
  value: value,
64857
- data: tiledData,
64894
+ data: data,
64858
64895
  unmatch: unmatch,
64896
+ tiledData: tiledData,
64859
64897
  virtual: virtual,
64860
64898
  disabled: disabled,
64861
64899
  active: multiple ? undefined : value[0],
@@ -65073,9 +65111,14 @@ var TreeSelect = function TreeSelect(props0) {
65073
65111
  if (from !== 'blur') {
65074
65112
  focusAndOpen();
65075
65113
  }
65076
- setVirtualExpanded([]);
65077
65114
  onTiledFilter === null || onTiledFilter === void 0 || onTiledFilter(trim ? text.trim() : text);
65078
65115
  };
65116
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
65117
+ if (virtual && expanded) {
65118
+ console.log(expanded);
65119
+ setVirtualExpanded(expanded);
65120
+ }
65121
+ }, [expanded]);
65079
65122
  var handleChange = function handleChange(item, id) {
65080
65123
  if (disabled === true || datum !== null && datum !== void 0 && datum.isDisabled(id)) return;
65081
65124
  var currentData = datum.getDataById(id);
@@ -65249,16 +65292,18 @@ var TreeSelect = function TreeSelect(props0) {
65249
65292
  virtual: virtual,
65250
65293
  childrenKey: props.childrenKey,
65251
65294
  line: line,
65295
+ ignoreSetFlat: true,
65252
65296
  mode: mode,
65253
65297
  height: height,
65254
65298
  data: tiledData,
65299
+ tiledData: tiledData,
65255
65300
  keygen: keygen,
65256
65301
  unmatch: unmatch,
65257
65302
  value: value,
65258
65303
  highlight: !multiple,
65259
65304
  loader: loader,
65260
65305
  onExpand: handleExpanded,
65261
- expanded: virtualExpanded.length > 0 ? virtualExpanded : controlExpanded || unControlExpanded,
65306
+ expanded: virtual ? virtualExpanded : controlExpanded || unControlExpanded,
65262
65307
  defaultExpandAll: defaultExpandAll,
65263
65308
  expandIcons: tiledExpandIcons,
65264
65309
  disabled: disabled,
@@ -68928,7 +68973,7 @@ var upload_interface = __webpack_require__(8821);
68928
68973
 
68929
68974
 
68930
68975
  /* harmony default export */ var src_0 = ({
68931
- version: '3.6.0-beta.14'
68976
+ version: '3.6.0-beta.15'
68932
68977
  });
68933
68978
  }();
68934
68979
  /******/ return __webpack_exports__;