shineout 3.0.9 → 3.0.10

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
@@ -476,5 +476,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
476
476
  // 此文件由脚本自动生成,请勿直接修改。
477
477
  // This file was generated automatically by a script. Please do not modify it directly.
478
478
  var _default = exports.default = {
479
- version: '3.0.9'
479
+ version: '3.0.10'
480
480
  };
package/dist/shineout.js CHANGED
@@ -12019,7 +12019,7 @@ var handleStyle = function handleStyle(style) {
12019
12019
  };
12020
12020
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12021
12021
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12022
- /* harmony default export */ var version = ('3.0.9');
12022
+ /* harmony default export */ var version = ('3.0.10');
12023
12023
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12024
12024
 
12025
12025
 
@@ -17029,6 +17029,7 @@ var datePickerStyle = objectSpread2_default()(objectSpread2_default()({
17029
17029
  resultText: {
17030
17030
  lineHeight: src.lineHeightDynamic,
17031
17031
  position: 'relative',
17032
+ zIndex: 0,
17032
17033
  flex: '1',
17033
17034
  minWidth: 0,
17034
17035
  '&::before': {
@@ -17037,7 +17038,25 @@ var datePickerStyle = objectSpread2_default()(objectSpread2_default()({
17037
17038
  }
17038
17039
  },
17039
17040
  resultTextPadding: {
17041
+ position: 'relative',
17042
+ zIndex: 2,
17043
+ '& > input': {
17044
+ color: 'inherit',
17045
+ padding: '0',
17046
+ border: '0',
17047
+ outline: '0',
17048
+ fontSize: 'inherit',
17049
+ lineHeight: src.lineHeightDynamic,
17050
+ backgroundColor: 'transparent',
17051
+ width: '100%',
17052
+ '&::placeholder': {
17053
+ color: src.datePickerPlaceholderColor
17054
+ }
17055
+ }
17056
+ },
17057
+ resultTextBg: {
17040
17058
  position: 'absolute',
17059
+ zIndex: 1,
17041
17060
  padding: "0 ".concat(src.datePickerResultTextPaddingX),
17042
17061
  left: "calc(-1 * ".concat(src.datePickerResultTextPaddingX, ")"),
17043
17062
  right: "calc(-1 * ".concat(src.datePickerResultTextPaddingX, ")"),
@@ -17059,7 +17078,7 @@ var datePickerStyle = objectSpread2_default()(objectSpread2_default()({
17059
17078
  }
17060
17079
  },
17061
17080
  resultTextActive: {
17062
- '& $resultTextPadding': {
17081
+ '& $resultTextBg': {
17063
17082
  backgroundColor: src.datePickerResultTextActiveBackgroundColor
17064
17083
  }
17065
17084
  },
@@ -33666,6 +33685,7 @@ var useFilter = function useFilter(props) {
33666
33685
 
33667
33686
 
33668
33687
 
33688
+
33669
33689
  var MODE = {
33670
33690
  /**
33671
33691
  * 返回全选数据,包含父节点和子节点
@@ -33720,6 +33740,7 @@ var useTree = function useTree(props) {
33720
33740
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
33721
33741
  pathMap: new Map(),
33722
33742
  dataMap: new Map(),
33743
+ forceUpdateMap: new Map(),
33723
33744
  valueMap: new Map(),
33724
33745
  updateMap: new Map(),
33725
33746
  unmatchedValueMap: new Map(),
@@ -33731,6 +33752,14 @@ var useTree = function useTree(props) {
33731
33752
  }),
33732
33753
  context = _useRef.current;
33733
33754
 
33755
+ // 注册刷新方法
33756
+ var bindUpdate = usePersistFn(function (id, update) {
33757
+ context.forceUpdateMap.set(id, update);
33758
+ });
33759
+ var unBindUpdate = usePersistFn(function (id) {
33760
+ context.forceUpdateMap.delete(id);
33761
+ });
33762
+
33734
33763
  // 注册节点
33735
33764
  var bindNode = function bindNode(id, update) {
33736
33765
  context.updateMap.set(id, update);
@@ -33846,6 +33875,8 @@ var useTree = function useTree(props) {
33846
33875
  };
33847
33876
  var setValueMap = function setValueMap(id, checked) {
33848
33877
  context.valueMap.set(id, checked);
33878
+ var update = context.forceUpdateMap.get(id);
33879
+ if (update) update();
33849
33880
  };
33850
33881
  var setUnmatedValue = function setUnmatedValue() {
33851
33882
  context.unmatchedValueMap = new Map();
@@ -34052,6 +34083,8 @@ var useTree = function useTree(props) {
34052
34083
  isDisabled: isDisabled,
34053
34084
  bindNode: bindNode,
34054
34085
  getDataById: getDataById,
34086
+ bindUpdate: bindUpdate,
34087
+ unBindUpdate: unBindUpdate,
34055
34088
  pathMap: context.pathMap,
34056
34089
  dataMap: context.dataMap,
34057
34090
  valueMap: context.valueMap,
@@ -34540,9 +34573,9 @@ var Result = function Result(props) {
34540
34573
  var renderItem = function renderItem(info) {
34541
34574
  var dis = info.index === 1 ? disabledRight : disabledLeft;
34542
34575
  var className = classnames_default()(styles === null || styles === void 0 ? void 0 : styles.resultText, info.target && (styles === null || styles === void 0 ? void 0 : styles.placeholder), dis && (styles === null || styles === void 0 ? void 0 : styles.resultTextDisabled), info.index === activeIndex && (styles === null || styles === void 0 ? void 0 : styles.resultTextActive));
34543
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34576
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
34544
34577
  className: className,
34545
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34578
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
34546
34579
  className: styles === null || styles === void 0 ? void 0 : styles.resultTextPadding,
34547
34580
  children: info.inputable ? /*#__PURE__*/(0,jsx_runtime.jsx)(result_Input, {
34548
34581
  onRef: function onRef(el) {
@@ -34577,7 +34610,9 @@ var Result = function Result(props) {
34577
34610
  className: styles === null || styles === void 0 ? void 0 : styles.placeholder,
34578
34611
  children: info.place
34579
34612
  })
34580
- })
34613
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34614
+ className: styles === null || styles === void 0 ? void 0 : styles.resultTextBg
34615
+ })]
34581
34616
  });
34582
34617
  };
34583
34618
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
@@ -34626,10 +34661,7 @@ var ResultInput = function ResultInput(props) {
34626
34661
  var bindInputRef = function bindInputRef(ref) {
34627
34662
  inputRef.current = ref;
34628
34663
  };
34629
- var handleBlur = function handleBlur(e) {
34630
- if (e.target.value === inputText) {
34631
- return;
34632
- }
34664
+ var handleBlur = function handleBlur() {
34633
34665
  if (trim) {
34634
34666
  return onInputBlur === null || onInputBlur === void 0 ? void 0 : onInputBlur(inputText === null || inputText === void 0 ? void 0 : inputText.trim());
34635
34667
  }
@@ -42502,6 +42534,7 @@ var useAutoSize = function useAutoSize(props) {
42502
42534
  if (!shadowRef.current) return;
42503
42535
  var v = value || '';
42504
42536
  if (shadowRef.current.value !== v) shadowRef.current.value = v;
42537
+ if (shadowRef.current.scrollHeight === 0) return;
42505
42538
  setHeight(shadowRef.current.scrollHeight);
42506
42539
  };
42507
42540
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
@@ -46412,6 +46445,7 @@ var ListOption = function ListOption(props) {
46412
46445
  onHover(index);
46413
46446
  };
46414
46447
  var handleClick = function handleClick() {
46448
+ if (datum.disabledCheck(data)) return;
46415
46449
  if (isChecked && multiple) {
46416
46450
  datum.remove(data);
46417
46451
  } else {
@@ -46652,6 +46686,7 @@ var useTreeContext = function useTreeContext() {
46652
46686
 
46653
46687
 
46654
46688
 
46689
+
46655
46690
  var TreeCheckbox = function TreeCheckbox(props) {
46656
46691
  var jssStyle = props.jssStyle,
46657
46692
  className = props.className,
@@ -46661,7 +46696,8 @@ var TreeCheckbox = function TreeCheckbox(props) {
46661
46696
  var _useTreeContext = useTreeContext(),
46662
46697
  getValue = _useTreeContext.getValue,
46663
46698
  set = _useTreeContext.set,
46664
- getChecked = _useTreeContext.getChecked;
46699
+ getChecked = _useTreeContext.getChecked,
46700
+ unBindUpdate = _useTreeContext.unBindUpdate;
46665
46701
  var handleChange = function handleChange(_, checked) {
46666
46702
  set(id, checked ? 1 : 0);
46667
46703
  if (onChange) {
@@ -46669,6 +46705,11 @@ var TreeCheckbox = function TreeCheckbox(props) {
46669
46705
  }
46670
46706
  };
46671
46707
  var checked = getChecked(id);
46708
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
46709
+ return function () {
46710
+ unBindUpdate(id);
46711
+ };
46712
+ }, []);
46672
46713
  return /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_checkbox_checkbox
46673
46714
  //@ts-ignore
46674
46715
  , {
@@ -46716,9 +46757,12 @@ var NodeContent = function NodeContent(props) {
46716
46757
  onToggle = props.onToggle,
46717
46758
  onDragOver = props.onDragOver,
46718
46759
  onNodeClick = props.onNodeClick;
46760
+ var forceUpdate = useRender();
46719
46761
  var _useTreeContext = useTreeContext(),
46720
- isDisabled = _useTreeContext.isDisabled;
46762
+ isDisabled = _useTreeContext.isDisabled,
46763
+ bindUpdate = _useTreeContext.bindUpdate;
46721
46764
  var disabled = isDisabled(id);
46765
+ bindUpdate(id, forceUpdate);
46722
46766
  var contentStyle = (jssStyle === null || jssStyle === void 0 ? void 0 : jssStyle.tree()) || {};
46723
46767
  var rootClass = classnames_default()(contentStyle.contentWrapper, defineProperty_default()(defineProperty_default()({}, contentStyle.childnode, data[childrenKey] && data[childrenKey].length > 0), contentStyle.inlineContent, inlineNode));
46724
46768
  var contentClass = classnames_default()(contentStyle.content, isString(contentClassProp) && contentClassProp, isFunc(contentClassProp) && contentClassProp(data));
@@ -48051,8 +48095,6 @@ function Select(props0) {
48051
48095
  _useState4 = slicedToArray_default()(_useState3, 2),
48052
48096
  focused = _useState4[0],
48053
48097
  setFocused = _useState4[1];
48054
- var isPreventBlur = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
48055
- var blurEvent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
48056
48098
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
48057
48099
  var optionListRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
48058
48100
  var _useFilter = use_filter({
@@ -48081,14 +48123,6 @@ function Select(props0) {
48081
48123
  rawData = _useFilter.rawData;
48082
48124
  var onCollapse = usePersistFn(function (collapse) {
48083
48125
  onCollapseProp === null || onCollapseProp === void 0 || onCollapseProp(collapse);
48084
- if (isPreventBlur.current) {
48085
- isPreventBlur.current = false;
48086
- return;
48087
- }
48088
- if (blurEvent.current && !collapse) {
48089
- blurEvent.current();
48090
- blurEvent.current = null;
48091
- }
48092
48126
  onClearCreatedData();
48093
48127
  });
48094
48128
  var renderMoreIcon = function renderMoreIcon() {
@@ -48272,12 +48306,12 @@ function Select(props0) {
48272
48306
  if (!onCreate) return;
48273
48307
  if (multiple && !text) return;
48274
48308
  // 防止点击 option 后触发 blur 事件,先把要做的事情存起来,后面再看要不要执行
48275
- blurEvent.current = function () {
48276
- if (createdData) {
48277
- handleChange(createdData);
48309
+ if (createdData) {
48310
+ if (!datum.check(createdData)) {
48311
+ datum.add(createdData);
48278
48312
  }
48279
48313
  onClearCreatedData();
48280
- };
48314
+ }
48281
48315
  };
48282
48316
  var handleFilter = function handleFilter(text, from) {
48283
48317
  var hideCreate = onCreate && hideCreateOption;
@@ -48294,7 +48328,6 @@ function Select(props0) {
48294
48328
  onFilter === null || onFilter === void 0 || onFilter(trim ? text.trim() : text, from);
48295
48329
  };
48296
48330
  var handleOptionClick = function handleOptionClick() {
48297
- isPreventBlur.current = true;
48298
48331
  if (multiple) return;
48299
48332
  // 单选结束后需要清除创建项
48300
48333
  onClearCreatedData();
@@ -53101,19 +53134,52 @@ var useTableLayout = function useTableLayout(props) {
53101
53134
  var getColgroup = use_persist_fn(function (fromDrag) {
53102
53135
  var _props$data, _target$current;
53103
53136
  var target = props !== null && props !== void 0 && (_props$data = props.data) !== null && _props$data !== void 0 && _props$data.length ? tbodyRef : theadRef;
53104
- var group = (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.querySelector('colgroup');
53105
- if (!group) return;
53106
- var cols = group.querySelectorAll('col');
53137
+ var tr = (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.querySelector('tr');
53138
+ if (!tr) return;
53139
+ var items = tr.children;
53107
53140
  var newCols = [];
53108
53141
  var sum = 0;
53109
- for (var i = 0, count = cols.length; i < count; i++) {
53110
- var _cols$i$getBoundingCl = cols[i].getBoundingClientRect(),
53111
- width = _cols$i$getBoundingCl.width;
53142
+ var _loop = function _loop() {
53143
+ var _items$i$getBoundingC = items[i].getBoundingClientRect(),
53144
+ width = _items$i$getBoundingC.width;
53112
53145
  sum += width;
53113
- newCols.push(width);
53146
+ var colspan = items[i].getAttribute('colspan');
53147
+ var dfWidth = props.columns.slice(i, i + (colspan ? parseInt(colspan, 10) : 1)).map(function (v) {
53148
+ return v.width;
53149
+ });
53150
+ var tempcols = [];
53151
+ var emptyNum = dfWidth.filter(function (v) {
53152
+ return v === undefined;
53153
+ }).length;
53154
+ if (dfWidth.length === 1) {
53155
+ // colspan = 1
53156
+ tempcols = [width];
53157
+ } else if (emptyNum === 0) {
53158
+ // 都有宽度按照比例分
53159
+ var all = dfWidth.reduce(function (a, b) {
53160
+ return a + b;
53161
+ }, 0);
53162
+ tempcols = dfWidth.map(function (v) {
53163
+ return v / all * width;
53164
+ });
53165
+ } else {
53166
+ // 多余的平分
53167
+ var _all = dfWidth.reduce(function (a, b) {
53168
+ return (a || 0) + (b || 0);
53169
+ }, 0);
53170
+ var rest = width - _all;
53171
+ var agv = rest > 0 ? rest / emptyNum : 0;
53172
+ tempcols = dfWidth.map(function (v) {
53173
+ return v ? v : agv;
53174
+ });
53175
+ }
53176
+ newCols = [].concat(toConsumableArray_default()(newCols), toConsumableArray_default()(tempcols));
53177
+ };
53178
+ for (var i = 0, count = items.length; i < count; i++) {
53179
+ _loop();
53114
53180
  }
53115
53181
  if (fromDrag && props.columnResizable) {
53116
- var widthArr = [].concat(newCols);
53182
+ var widthArr = toConsumableArray_default()(newCols);
53117
53183
  if (typeof props.width === 'number') {
53118
53184
  var maxWidth = Math.max(context.clientWidth, props.width + deltaXSum);
53119
53185
 
@@ -61268,7 +61334,7 @@ var upload_interface = __webpack_require__(4412);
61268
61334
 
61269
61335
 
61270
61336
  /* harmony default export */ var src_0 = ({
61271
- version: '3.0.9'
61337
+ version: '3.0.10'
61272
61338
  });
61273
61339
  }();
61274
61340
  /******/ return __webpack_exports__;