shineout 3.7.0-beta.29 → 3.7.0-beta.30

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
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.7.0-beta.29'
525
+ version: '3.7.0-beta.30'
526
526
  };
package/dist/shineout.js CHANGED
@@ -7174,7 +7174,8 @@ var config = {
7174
7174
  tree: {
7175
7175
  LineExpand: icons.Expand,
7176
7176
  LineCollapse: icons.Shrink,
7177
- Expand: icons.ArrowDownFill
7177
+ Expand: icons.ArrowDownFill,
7178
+ Leaf: icons.File
7178
7179
  },
7179
7180
  treeSelect: {
7180
7181
  More: icons.More,
@@ -12226,7 +12227,7 @@ var handleStyle = function handleStyle(style) {
12226
12227
  };
12227
12228
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12228
12229
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12229
- /* harmony default export */ var version = ('3.7.0-beta.29');
12230
+ /* harmony default export */ var version = ('3.7.0-beta.30');
12230
12231
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12231
12232
 
12232
12233
 
@@ -28159,6 +28160,19 @@ var treeStyle = {
28159
28160
  }
28160
28161
  },
28161
28162
  line: {
28163
+ '&$virtual $node': {
28164
+ '&::before, &::after': {
28165
+ display: 'none'
28166
+ }
28167
+ },
28168
+ '&$virtual $leaf $contentWrapper': {
28169
+ marginLeft: 12
28170
+ },
28171
+ '&$virtual $leaf $contentWrapper, &$virtual $childnode$contentWrapper': {
28172
+ '&::after': {
28173
+ display: 'none'
28174
+ }
28175
+ },
28162
28176
  '& $node': {
28163
28177
  '&[dir=ltr]::before': {
28164
28178
  left: 0
@@ -28233,8 +28247,10 @@ var treeStyle = {
28233
28247
  }
28234
28248
  }
28235
28249
  },
28236
- '&$sizeSmall $contentWrapper::after': {
28237
- display: 'none'
28250
+ '&$sizeSmall': {
28251
+ '& $contentWrapper::after': {
28252
+ display: 'none'
28253
+ }
28238
28254
  },
28239
28255
  '&$sizeLarge': {
28240
28256
  '& $node:last-child::before': {
@@ -28248,7 +28264,10 @@ var treeStyle = {
28248
28264
  right: -32
28249
28265
  }
28250
28266
  },
28251
- '& $childnode, & $leaf': {
28267
+ '&:not($virtual) $childnode, &:not($virtual) $leaf': {
28268
+ marginLeft: 20
28269
+ },
28270
+ '': {
28252
28271
  marginLeft: 20
28253
28272
  },
28254
28273
  '& $node': {
@@ -28335,6 +28354,16 @@ var treeStyle = {
28335
28354
  }
28336
28355
  }
28337
28356
  },
28357
+ lineIndent: {
28358
+ position: 'absolute',
28359
+ top: 0,
28360
+ width: 1,
28361
+ height: '100%',
28362
+ background: src.treeLineBackgroundColor,
28363
+ '$sizeLarge &': {
28364
+ transform: 'translateX(-4px)'
28365
+ }
28366
+ },
28338
28367
  root: {
28339
28368
  '& > $node': {
28340
28369
  paddingLeft: 12,
@@ -38562,9 +38591,10 @@ var useTree = function useTree(props) {
38562
38591
  };
38563
38592
  }
38564
38593
  if (virtual) {
38594
+ var _context$dataFlatStat;
38565
38595
  return {
38566
38596
  active: isActive,
38567
- expanded: context.dataFlatStatusMap.get(id).expanded
38597
+ expanded: !!((_context$dataFlatStat = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat !== void 0 && _context$dataFlatStat.expanded)
38568
38598
  };
38569
38599
  }
38570
38600
  return {
@@ -38575,11 +38605,12 @@ var useTree = function useTree(props) {
38575
38605
 
38576
38606
  // 注册节点
38577
38607
  var bindVirtualNode = function bindVirtualNode(id, update) {
38608
+ var _context$dataFlatStat2;
38578
38609
  context.updateMap.set(id, update);
38579
38610
  var isActive = activeProp === id;
38580
38611
  return {
38581
38612
  active: isActive,
38582
- expanded: context.dataFlatStatusMap.get(id).expanded
38613
+ expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
38583
38614
  };
38584
38615
  };
38585
38616
  var get = function get(id) {
@@ -38951,7 +38982,7 @@ var useTree = function useTree(props) {
38951
38982
  var appendChildrenExpanded = function appendChildrenExpanded(child, level, pid, insertData) {
38952
38983
  if (!child) return;
38953
38984
  child.forEach(function (item, i) {
38954
- var _context$dataFlatStat;
38985
+ var _context$dataFlatStat3;
38955
38986
  var childId = getKey(item, pid, i);
38956
38987
  var node = {
38957
38988
  id: childId,
@@ -38960,7 +38991,7 @@ var useTree = function useTree(props) {
38960
38991
  pid: pid
38961
38992
  };
38962
38993
  insertData.push(node);
38963
- if ((_context$dataFlatStat = context.dataFlatStatusMap.get(childId)) !== null && _context$dataFlatStat !== void 0 && _context$dataFlatStat.expanded && item[childrenKey]) {
38994
+ if ((_context$dataFlatStat3 = context.dataFlatStatusMap.get(childId)) !== null && _context$dataFlatStat3 !== void 0 && _context$dataFlatStat3.expanded && item[childrenKey]) {
38964
38995
  appendChildrenExpanded(item[childrenKey], level + 1, childId, insertData);
38965
38996
  }
38966
38997
  });
@@ -39043,6 +39074,16 @@ var useTree = function useTree(props) {
39043
39074
  var getFlatData = function getFlatData() {
39044
39075
  return context.dataFlat;
39045
39076
  };
39077
+ var updateExpanded = usePersistFn(function (expanded) {
39078
+ var tempExpandMap = new Set(expanded);
39079
+ if (!expanded) return;
39080
+ if (virtual) {
39081
+ expandedFlat(expanded);
39082
+ }
39083
+ context.updateMap.forEach(function (update, id) {
39084
+ update('expanded', tempExpandMap.has(id));
39085
+ });
39086
+ });
39046
39087
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
39047
39088
  if (defaultExpandAll) {
39048
39089
  var nextExpanded = [];
@@ -39058,8 +39099,13 @@ var useTree = function useTree(props) {
39058
39099
  if (props.datum) return;
39059
39100
  if (!dataUpdate) return;
39060
39101
  setData(data);
39102
+ var nextExpanded = props.expanded || props.defaultExpanded || [];
39103
+ if (!shallowEqual(nextExpanded, expanded)) {
39104
+ onExpand(nextExpanded);
39105
+ updateExpanded(nextExpanded);
39106
+ }
39061
39107
  updateInnerCheckStatus();
39062
- }, [data]);
39108
+ }, [props.data]);
39063
39109
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
39064
39110
  if (props.datum) return;
39065
39111
  setValue(value);
@@ -39084,16 +39130,17 @@ var useTree = function useTree(props) {
39084
39130
  getChecked: getChecked,
39085
39131
  getKey: getKey,
39086
39132
  getFlatData: getFlatData,
39133
+ getDataById: getDataById,
39087
39134
  getDataByValues: getDataByValues,
39088
39135
  setValue: setValue,
39089
39136
  setData: setData,
39090
39137
  isDisabled: isDisabled,
39138
+ isUnMatched: isUnMatched,
39091
39139
  bindNode: bindNode,
39092
39140
  bindVirtualNode: bindVirtualNode,
39093
- getDataById: getDataById,
39094
39141
  bindUpdate: bindUpdate,
39095
39142
  unBindUpdate: unBindUpdate,
39096
- isUnMatched: isUnMatched,
39143
+ updateExpanded: updateExpanded,
39097
39144
  childrenKey: childrenKey,
39098
39145
  data: data,
39099
39146
  dataFlat: dataFlat,
@@ -42495,10 +42542,14 @@ function useFormControl(props) {
42495
42542
  if (isArray(name)) {
42496
42543
  var dv = isArray(defaultValue) ? defaultValue : [];
42497
42544
  name.forEach(function (n, index) {
42498
- controlFunc.bind(n, dv[index], validateField, update);
42545
+ var v = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(n);
42546
+ var bindedValue = v === undefined ? dv[index] : v;
42547
+ controlFunc.bind(n, context.mounted ? bindedValue : dv[index], validateField, update);
42499
42548
  });
42500
42549
  } else {
42501
- controlFunc.bind(name, defaultValue, validateField, update);
42550
+ var v = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
42551
+ var bindedValue = v === undefined ? defaultValue : v;
42552
+ controlFunc.bind(name, context.mounted ? bindedValue : defaultValue, validateField, update);
42502
42553
  }
42503
42554
  if (context.mounted) {
42504
42555
  devUseWarning.warn('Please avoid modifying the name property after the component has mounted, as this may result in unintended behavior or errors.');
@@ -49926,7 +49977,7 @@ var useForm = function useForm(props) {
49926
49977
  if (errors.length > 0) {
49927
49978
  var errorFields = [];
49928
49979
  for (var _key in context.errors) {
49929
- if (context.errors[_key]) {
49980
+ if (context.errors[_key] && context.names.has(_key)) {
49930
49981
  var _context$errors$_key;
49931
49982
  errorFields.push({
49932
49983
  name: _key,
@@ -50242,7 +50293,6 @@ var useForm = function useForm(props) {
50242
50293
  }
50243
50294
  if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
50244
50295
  context.names.delete(n);
50245
- delete context.errors[n];
50246
50296
  delete context.defaultValues[n];
50247
50297
  }
50248
50298
  var finalReserveAble = (_props$reserveAble = props.reserveAble) !== null && _props$reserveAble !== void 0 ? _props$reserveAble : reserveAble;
@@ -53864,7 +53914,8 @@ var NodeContent = function NodeContent(props) {
53864
53914
  var _useTreeContext = useTreeContext(),
53865
53915
  isDisabled = _useTreeContext.isDisabled,
53866
53916
  bindUpdate = _useTreeContext.bindUpdate,
53867
- size = _useTreeContext.size;
53917
+ size = _useTreeContext.size,
53918
+ leafIcon = _useTreeContext.leafIcon;
53868
53919
  var config = useConfig();
53869
53920
  var disabled = isDisabled(id);
53870
53921
  bindUpdate(id, forceUpdate);
@@ -53984,6 +54035,25 @@ var NodeContent = function NodeContent(props) {
53984
54035
  if (Array.isArray(children) || children === null) return null;
53985
54036
  if (fetching && !children) return renderLoading();
53986
54037
  if (loader && children === undefined) return indicator;
54038
+ if (leafIcon) {
54039
+ var $iconContent = null;
54040
+ if (leafIcon === true) {
54041
+ $iconContent = icons_config.tree.Leaf;
54042
+ } else if (isFunc(leafIcon)) {
54043
+ $iconContent = leafIcon(data);
54044
+ } else {
54045
+ $iconContent = leafIcon;
54046
+ }
54047
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
54048
+ className: contentStyle.iconWrapper,
54049
+ dir: config.direction,
54050
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
54051
+ className: classnames_default()(contentStyle.icon, iconClass),
54052
+ dir: config.direction,
54053
+ children: $iconContent
54054
+ })
54055
+ });
54056
+ }
53987
54057
  return null;
53988
54058
  };
53989
54059
  var renderCheckbox = function renderCheckbox() {
@@ -54461,6 +54531,7 @@ var useTreeVirtualNode = function useTreeVirtualNode(props) {
54461
54531
 
54462
54532
 
54463
54533
 
54534
+
54464
54535
  var tree_virtual_node_placeElement = null;
54465
54536
  var VirtualNode = function VirtualNode(props) {
54466
54537
  var jssStyle = props.jssStyle,
@@ -54529,14 +54600,27 @@ var VirtualNode = function VirtualNode(props) {
54529
54600
  if (onToggle) onToggle(id, nextExpanded);
54530
54601
  };
54531
54602
  var indent = size === "large" ? 32 : 24;
54532
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
54603
+ var $indents;
54604
+ if (line) {
54605
+ $indents = Array.from({
54606
+ length: level - 1
54607
+ }).map(function (_, index) {
54608
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
54609
+ className: contentStyle.lineIndent,
54610
+ style: {
54611
+ left: (index + 1) * indent
54612
+ }
54613
+ }, index);
54614
+ });
54615
+ }
54616
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
54533
54617
  ref: element,
54534
54618
  className: rootClass,
54535
54619
  dir: config.direction,
54536
54620
  style: {
54537
54621
  paddingLeft: level * indent
54538
54622
  },
54539
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(tree_content, {
54623
+ children: [$indents, /*#__PURE__*/(0,jsx_runtime.jsx)(tree_content, {
54540
54624
  virtual: true,
54541
54625
  jssStyle: jssStyle,
54542
54626
  isControlled: isControlled,
@@ -54567,7 +54651,7 @@ var VirtualNode = function VirtualNode(props) {
54567
54651
  onNodeClick: onNodeClick,
54568
54652
  onToggle: handleToggle,
54569
54653
  actionOnClick: actionOnClick
54570
- })
54654
+ })]
54571
54655
  });
54572
54656
  };
54573
54657
  /* harmony default export */ var tree_virtual_node = (VirtualNode);
@@ -54839,7 +54923,7 @@ var TreeVirtual = function TreeVirtual(props) {
54839
54923
 
54840
54924
 
54841
54925
 
54842
- 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", "rowsInView", "actionOnClick", "tiledData"];
54926
+ 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", "rowsInView", "actionOnClick", "tiledData", "height"];
54843
54927
 
54844
54928
 
54845
54929
 
@@ -54905,6 +54989,7 @@ var Tree = function Tree(props) {
54905
54989
  rowsInView = _props$rowsInView === void 0 ? 20 : _props$rowsInView,
54906
54990
  actionOnClick = props.actionOnClick,
54907
54991
  tiledData = props.tiledData,
54992
+ height = props.height,
54908
54993
  rest = objectWithoutProperties_default()(props, tree_excluded);
54909
54994
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(propActive),
54910
54995
  _useState2 = slicedToArray_default()(_useState, 2),
@@ -54960,16 +55045,6 @@ var Tree = function Tree(props) {
54960
55045
  }
54961
55046
  return props.height || styleHeight;
54962
55047
  };
54963
- var handleUpdateExpanded = function handleUpdateExpanded(expanded) {
54964
- var tempExpandMap = new Set(expanded);
54965
- if (!expanded) return;
54966
- if (virtual) {
54967
- datum.expandedFlat(expanded);
54968
- }
54969
- datum.updateMap.forEach(function (update, id) {
54970
- update('expanded', tempExpandMap.has(id));
54971
- });
54972
- };
54973
55048
  var handleUpdateActive = function handleUpdateActive(active, item) {
54974
55049
  setActive(active);
54975
55050
  if (active !== props.active) {
@@ -55118,7 +55193,7 @@ var Tree = function Tree(props) {
55118
55193
  return;
55119
55194
  }
55120
55195
  if (!props.expanded) return;
55121
- handleUpdateExpanded(expanded);
55196
+ datum.updateExpanded(expanded);
55122
55197
  }, [expanded]);
55123
55198
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
55124
55199
  // if (!active) return;
@@ -55137,7 +55212,8 @@ var Tree = function Tree(props) {
55137
55212
  }, rest), {}, {
55138
55213
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(tree_context_Provider, {
55139
55214
  value: objectSpread2_default()(objectSpread2_default()({}, datum), {}, {
55140
- size: props.size
55215
+ size: props.size,
55216
+ leafIcon: props.leafIcon
55141
55217
  }),
55142
55218
  children: renderList()
55143
55219
  })
@@ -70940,7 +71016,7 @@ var upload_interface = __webpack_require__(8821);
70940
71016
 
70941
71017
 
70942
71018
  /* harmony default export */ var src_0 = ({
70943
- version: '3.7.0-beta.29'
71019
+ version: '3.7.0-beta.30'
70944
71020
  });
70945
71021
  }();
70946
71022
  /******/ return __webpack_exports__;