shineout 3.0.9 → 3.0.10-fix.1

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-fix.1'
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-fix.1');
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
  },
@@ -30292,19 +30311,18 @@ function useInputAble(props) {
30292
30311
  var render = useRender(syncValue);
30293
30312
  var shouldUseState = delay || !control;
30294
30313
  var value = shouldUseState ? stateValue : valuePo;
30295
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
30296
- if (context.timer) {
30314
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
30315
+ if (delay && control && props.value !== stateValue) {
30316
+ changeStateValue(props.value);
30317
+ } else if (context.timer) {
30297
30318
  clearTimeout(context.timer);
30298
30319
  context.timer = null;
30299
30320
  }
30300
- if (delay && props.value !== stateValue) {
30301
- changeStateValue(props.value);
30302
- }
30303
- }, [props.value, delay]);
30321
+ }, [props.value, delay, control]);
30304
30322
  var forceDelayChange = use_persist_fn(function () {
30305
- if (context.timer && context.delayChange) {
30323
+ if (context.delayChange) context.delayChange();
30324
+ if (context.timer) {
30306
30325
  clearTimeout(context.timer);
30307
- context.delayChange();
30308
30326
  context.timer = null;
30309
30327
  context.delayChange = null;
30310
30328
  }
@@ -30325,15 +30343,15 @@ function useInputAble(props) {
30325
30343
  changeStateValue(vv);
30326
30344
  }
30327
30345
  if (!isFunc(onChange)) return;
30328
- context.delayChange = function () {
30329
- context.timer = null;
30330
- context.delayChange = null;
30331
- onChange.apply(void 0, [vv].concat(other));
30332
- render();
30333
- };
30334
30346
  if (!delay) {
30335
30347
  onChange.apply(void 0, [vv].concat(other));
30336
30348
  } else {
30349
+ context.delayChange = function () {
30350
+ context.timer = null;
30351
+ context.delayChange = null;
30352
+ onChange.apply(void 0, [vv].concat(other));
30353
+ render();
30354
+ };
30337
30355
  if (context.timer) clearTimeout(context.timer);
30338
30356
  context.timer = setTimeout(context.delayChange, delay);
30339
30357
  }
@@ -33666,6 +33684,7 @@ var useFilter = function useFilter(props) {
33666
33684
 
33667
33685
 
33668
33686
 
33687
+
33669
33688
  var MODE = {
33670
33689
  /**
33671
33690
  * 返回全选数据,包含父节点和子节点
@@ -33720,6 +33739,7 @@ var useTree = function useTree(props) {
33720
33739
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
33721
33740
  pathMap: new Map(),
33722
33741
  dataMap: new Map(),
33742
+ forceUpdateMap: new Map(),
33723
33743
  valueMap: new Map(),
33724
33744
  updateMap: new Map(),
33725
33745
  unmatchedValueMap: new Map(),
@@ -33731,6 +33751,14 @@ var useTree = function useTree(props) {
33731
33751
  }),
33732
33752
  context = _useRef.current;
33733
33753
 
33754
+ // 注册刷新方法
33755
+ var bindUpdate = usePersistFn(function (id, update) {
33756
+ context.forceUpdateMap.set(id, update);
33757
+ });
33758
+ var unBindUpdate = usePersistFn(function (id) {
33759
+ context.forceUpdateMap.delete(id);
33760
+ });
33761
+
33734
33762
  // 注册节点
33735
33763
  var bindNode = function bindNode(id, update) {
33736
33764
  context.updateMap.set(id, update);
@@ -33846,6 +33874,8 @@ var useTree = function useTree(props) {
33846
33874
  };
33847
33875
  var setValueMap = function setValueMap(id, checked) {
33848
33876
  context.valueMap.set(id, checked);
33877
+ var update = context.forceUpdateMap.get(id);
33878
+ if (update) update();
33849
33879
  };
33850
33880
  var setUnmatedValue = function setUnmatedValue() {
33851
33881
  context.unmatchedValueMap = new Map();
@@ -34052,6 +34082,8 @@ var useTree = function useTree(props) {
34052
34082
  isDisabled: isDisabled,
34053
34083
  bindNode: bindNode,
34054
34084
  getDataById: getDataById,
34085
+ bindUpdate: bindUpdate,
34086
+ unBindUpdate: unBindUpdate,
34055
34087
  pathMap: context.pathMap,
34056
34088
  dataMap: context.dataMap,
34057
34089
  valueMap: context.valueMap,
@@ -34540,9 +34572,9 @@ var Result = function Result(props) {
34540
34572
  var renderItem = function renderItem(info) {
34541
34573
  var dis = info.index === 1 ? disabledRight : disabledLeft;
34542
34574
  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", {
34575
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
34544
34576
  className: className,
34545
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34577
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
34546
34578
  className: styles === null || styles === void 0 ? void 0 : styles.resultTextPadding,
34547
34579
  children: info.inputable ? /*#__PURE__*/(0,jsx_runtime.jsx)(result_Input, {
34548
34580
  onRef: function onRef(el) {
@@ -34577,7 +34609,9 @@ var Result = function Result(props) {
34577
34609
  className: styles === null || styles === void 0 ? void 0 : styles.placeholder,
34578
34610
  children: info.place
34579
34611
  })
34580
- })
34612
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
34613
+ className: styles === null || styles === void 0 ? void 0 : styles.resultTextBg
34614
+ })]
34581
34615
  });
34582
34616
  };
34583
34617
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
@@ -34626,10 +34660,7 @@ var ResultInput = function ResultInput(props) {
34626
34660
  var bindInputRef = function bindInputRef(ref) {
34627
34661
  inputRef.current = ref;
34628
34662
  };
34629
- var handleBlur = function handleBlur(e) {
34630
- if (e.target.value === inputText) {
34631
- return;
34632
- }
34663
+ var handleBlur = function handleBlur() {
34633
34664
  if (trim) {
34634
34665
  return onInputBlur === null || onInputBlur === void 0 ? void 0 : onInputBlur(inputText === null || inputText === void 0 ? void 0 : inputText.trim());
34635
34666
  }
@@ -42502,6 +42533,7 @@ var useAutoSize = function useAutoSize(props) {
42502
42533
  if (!shadowRef.current) return;
42503
42534
  var v = value || '';
42504
42535
  if (shadowRef.current.value !== v) shadowRef.current.value = v;
42536
+ if (shadowRef.current.scrollHeight === 0) return;
42505
42537
  setHeight(shadowRef.current.scrollHeight);
42506
42538
  };
42507
42539
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
@@ -46412,6 +46444,7 @@ var ListOption = function ListOption(props) {
46412
46444
  onHover(index);
46413
46445
  };
46414
46446
  var handleClick = function handleClick() {
46447
+ if (datum.disabledCheck(data)) return;
46415
46448
  if (isChecked && multiple) {
46416
46449
  datum.remove(data);
46417
46450
  } else {
@@ -46652,6 +46685,7 @@ var useTreeContext = function useTreeContext() {
46652
46685
 
46653
46686
 
46654
46687
 
46688
+
46655
46689
  var TreeCheckbox = function TreeCheckbox(props) {
46656
46690
  var jssStyle = props.jssStyle,
46657
46691
  className = props.className,
@@ -46661,7 +46695,8 @@ var TreeCheckbox = function TreeCheckbox(props) {
46661
46695
  var _useTreeContext = useTreeContext(),
46662
46696
  getValue = _useTreeContext.getValue,
46663
46697
  set = _useTreeContext.set,
46664
- getChecked = _useTreeContext.getChecked;
46698
+ getChecked = _useTreeContext.getChecked,
46699
+ unBindUpdate = _useTreeContext.unBindUpdate;
46665
46700
  var handleChange = function handleChange(_, checked) {
46666
46701
  set(id, checked ? 1 : 0);
46667
46702
  if (onChange) {
@@ -46669,6 +46704,11 @@ var TreeCheckbox = function TreeCheckbox(props) {
46669
46704
  }
46670
46705
  };
46671
46706
  var checked = getChecked(id);
46707
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
46708
+ return function () {
46709
+ unBindUpdate(id);
46710
+ };
46711
+ }, []);
46672
46712
  return /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_checkbox_checkbox
46673
46713
  //@ts-ignore
46674
46714
  , {
@@ -46716,9 +46756,12 @@ var NodeContent = function NodeContent(props) {
46716
46756
  onToggle = props.onToggle,
46717
46757
  onDragOver = props.onDragOver,
46718
46758
  onNodeClick = props.onNodeClick;
46759
+ var forceUpdate = useRender();
46719
46760
  var _useTreeContext = useTreeContext(),
46720
- isDisabled = _useTreeContext.isDisabled;
46761
+ isDisabled = _useTreeContext.isDisabled,
46762
+ bindUpdate = _useTreeContext.bindUpdate;
46721
46763
  var disabled = isDisabled(id);
46764
+ bindUpdate(id, forceUpdate);
46722
46765
  var contentStyle = (jssStyle === null || jssStyle === void 0 ? void 0 : jssStyle.tree()) || {};
46723
46766
  var rootClass = classnames_default()(contentStyle.contentWrapper, defineProperty_default()(defineProperty_default()({}, contentStyle.childnode, data[childrenKey] && data[childrenKey].length > 0), contentStyle.inlineContent, inlineNode));
46724
46767
  var contentClass = classnames_default()(contentStyle.content, isString(contentClassProp) && contentClassProp, isFunc(contentClassProp) && contentClassProp(data));
@@ -48051,8 +48094,6 @@ function Select(props0) {
48051
48094
  _useState4 = slicedToArray_default()(_useState3, 2),
48052
48095
  focused = _useState4[0],
48053
48096
  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
48097
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
48057
48098
  var optionListRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
48058
48099
  var _useFilter = use_filter({
@@ -48081,14 +48122,6 @@ function Select(props0) {
48081
48122
  rawData = _useFilter.rawData;
48082
48123
  var onCollapse = usePersistFn(function (collapse) {
48083
48124
  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
48125
  onClearCreatedData();
48093
48126
  });
48094
48127
  var renderMoreIcon = function renderMoreIcon() {
@@ -48272,12 +48305,12 @@ function Select(props0) {
48272
48305
  if (!onCreate) return;
48273
48306
  if (multiple && !text) return;
48274
48307
  // 防止点击 option 后触发 blur 事件,先把要做的事情存起来,后面再看要不要执行
48275
- blurEvent.current = function () {
48276
- if (createdData) {
48277
- handleChange(createdData);
48308
+ if (createdData) {
48309
+ if (!datum.check(createdData)) {
48310
+ datum.add(createdData);
48278
48311
  }
48279
48312
  onClearCreatedData();
48280
- };
48313
+ }
48281
48314
  };
48282
48315
  var handleFilter = function handleFilter(text, from) {
48283
48316
  var hideCreate = onCreate && hideCreateOption;
@@ -48294,7 +48327,6 @@ function Select(props0) {
48294
48327
  onFilter === null || onFilter === void 0 || onFilter(trim ? text.trim() : text, from);
48295
48328
  };
48296
48329
  var handleOptionClick = function handleOptionClick() {
48297
- isPreventBlur.current = true;
48298
48330
  if (multiple) return;
48299
48331
  // 单选结束后需要清除创建项
48300
48332
  onClearCreatedData();
@@ -53101,19 +53133,52 @@ var useTableLayout = function useTableLayout(props) {
53101
53133
  var getColgroup = use_persist_fn(function (fromDrag) {
53102
53134
  var _props$data, _target$current;
53103
53135
  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');
53136
+ var tr = (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.querySelector('tr');
53137
+ if (!tr) return;
53138
+ var items = tr.children;
53107
53139
  var newCols = [];
53108
53140
  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;
53141
+ var _loop = function _loop() {
53142
+ var _items$i$getBoundingC = items[i].getBoundingClientRect(),
53143
+ width = _items$i$getBoundingC.width;
53112
53144
  sum += width;
53113
- newCols.push(width);
53145
+ var colspan = items[i].getAttribute('colspan');
53146
+ var dfWidth = props.columns.slice(i, i + (colspan ? parseInt(colspan, 10) : 1)).map(function (v) {
53147
+ return v.width;
53148
+ });
53149
+ var tempcols = [];
53150
+ var emptyNum = dfWidth.filter(function (v) {
53151
+ return v === undefined;
53152
+ }).length;
53153
+ if (dfWidth.length === 1) {
53154
+ // colspan = 1
53155
+ tempcols = [width];
53156
+ } else if (emptyNum === 0) {
53157
+ // 都有宽度按照比例分
53158
+ var all = dfWidth.reduce(function (a, b) {
53159
+ return a + b;
53160
+ }, 0);
53161
+ tempcols = dfWidth.map(function (v) {
53162
+ return v / all * width;
53163
+ });
53164
+ } else {
53165
+ // 多余的平分
53166
+ var _all = dfWidth.reduce(function (a, b) {
53167
+ return (a || 0) + (b || 0);
53168
+ }, 0);
53169
+ var rest = width - _all;
53170
+ var agv = rest > 0 ? rest / emptyNum : 0;
53171
+ tempcols = dfWidth.map(function (v) {
53172
+ return v ? v : agv;
53173
+ });
53174
+ }
53175
+ newCols = [].concat(toConsumableArray_default()(newCols), toConsumableArray_default()(tempcols));
53176
+ };
53177
+ for (var i = 0, count = items.length; i < count; i++) {
53178
+ _loop();
53114
53179
  }
53115
53180
  if (fromDrag && props.columnResizable) {
53116
- var widthArr = [].concat(newCols);
53181
+ var widthArr = toConsumableArray_default()(newCols);
53117
53182
  if (typeof props.width === 'number') {
53118
53183
  var maxWidth = Math.max(context.clientWidth, props.width + deltaXSum);
53119
53184
 
@@ -61268,7 +61333,7 @@ var upload_interface = __webpack_require__(4412);
61268
61333
 
61269
61334
 
61270
61335
  /* harmony default export */ var src_0 = ({
61271
- version: '3.0.9'
61336
+ version: '3.0.10-fix.1'
61272
61337
  });
61273
61338
  }();
61274
61339
  /******/ return __webpack_exports__;