@leankylin-sheet/react 7.0.48 → 7.0.49

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/dist/index.css CHANGED
@@ -3374,6 +3374,7 @@ label {
3374
3374
 
3375
3375
  .leankylin-fx-input-container {
3376
3376
  padding-left: 10px;
3377
+ /* 输入框在文本较多时会向下浮出显示,需要允许溢出 */
3377
3378
  overflow: visible;
3378
3379
  padding: 0;
3379
3380
  flex: 1;
@@ -3385,11 +3386,19 @@ label {
3385
3386
 
3386
3387
  .leankylin-fx-input {
3387
3388
  flex: 1;
3388
- height: 100%;
3389
- overflow: auto;
3389
+ /* 只占一行高度,不撑高公式栏;文本较多时向下浮出显示最多约 8 行 */
3390
+ align-self: flex-start;
3391
+ position: relative;
3392
+ /* 浮出部分需要盖住下方表格 */
3393
+ z-index: 1001;
3394
+ height: auto;
3395
+ min-height: 28px;
3396
+ max-height: min(174px, 35vh);
3397
+ overflow-y: auto;
3398
+ overflow-x: hidden;
3390
3399
  padding-left: 2px;
3391
3400
  font-size: 14px;
3392
- line-height: 14px;
3401
+ line-height: 21px;
3393
3402
  margin: 0;
3394
3403
  outline: none;
3395
3404
  cursor: text;
@@ -3399,11 +3408,18 @@ label {
3399
3408
  -webkit-nbsp-mode: space;
3400
3409
  -webkit-line-break: after-white-space;
3401
3410
  background-color: white;
3402
- padding-top: 6px;
3403
- padding-bottom: 6px;
3411
+ padding-top: 3px;
3412
+ padding-bottom: 3px;
3404
3413
  box-sizing: border-box;
3405
3414
  color: black;
3406
3415
  text-align: left;
3416
+ word-break: break-word;
3417
+ }
3418
+
3419
+ /* 文本超出一行、浮出显示时加上阴影,与表格内容区分开 */
3420
+ .leankylin-fx-input.leankylin-fx-input-expanded {
3421
+ border-radius: 0 0 2px 2px;
3422
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
3407
3423
  }
3408
3424
  .leankylin-fx-input[contenteditable="true"] {
3409
3425
  -webkit-user-modify: read-write-plaintext-only;
@@ -3374,6 +3374,7 @@ label {
3374
3374
 
3375
3375
  .leankylin-fx-input-container {
3376
3376
  padding-left: 10px;
3377
+ /* 输入框在文本较多时会向下浮出显示,需要允许溢出 */
3377
3378
  overflow: visible;
3378
3379
  padding: 0;
3379
3380
  flex: 1;
@@ -3385,11 +3386,19 @@ label {
3385
3386
 
3386
3387
  .leankylin-fx-input {
3387
3388
  flex: 1;
3388
- height: 100%;
3389
- overflow: auto;
3389
+ /* 只占一行高度,不撑高公式栏;文本较多时向下浮出显示最多约 8 行 */
3390
+ align-self: flex-start;
3391
+ position: relative;
3392
+ /* 浮出部分需要盖住下方表格 */
3393
+ z-index: 1001;
3394
+ height: auto;
3395
+ min-height: 28px;
3396
+ max-height: min(174px, 35vh);
3397
+ overflow-y: auto;
3398
+ overflow-x: hidden;
3390
3399
  padding-left: 2px;
3391
3400
  font-size: 14px;
3392
- line-height: 14px;
3401
+ line-height: 21px;
3393
3402
  margin: 0;
3394
3403
  outline: none;
3395
3404
  cursor: text;
@@ -3399,11 +3408,18 @@ label {
3399
3408
  -webkit-nbsp-mode: space;
3400
3409
  -webkit-line-break: after-white-space;
3401
3410
  background-color: white;
3402
- padding-top: 6px;
3403
- padding-bottom: 6px;
3411
+ padding-top: 3px;
3412
+ padding-bottom: 3px;
3404
3413
  box-sizing: border-box;
3405
3414
  color: black;
3406
3415
  text-align: left;
3416
+ word-break: break-word;
3417
+ }
3418
+
3419
+ /* 文本超出一行、浮出显示时加上阴影,与表格内容区分开 */
3420
+ .leankylin-fx-input.leankylin-fx-input-expanded {
3421
+ border-radius: 0 0 2px 2px;
3422
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
3407
3423
  }
3408
3424
  .leankylin-fx-input[contenteditable="true"] {
3409
3425
  -webkit-user-modify: read-write-plaintext-only;
package/dist/index.esm.js CHANGED
@@ -7997,7 +7997,6 @@ var FxEditor = function FxEditor() {
7997
7997
  focused = _useState2[0],
7998
7998
  setFocused = _useState2[1];
7999
7999
  var lastKeyDownEventRef = useRef();
8000
- var inputContainerRef = useRef(null);
8001
8000
  var _useState3 = useState(false),
8002
8001
  _useState4 = _slicedToArray(_useState3, 2),
8003
8002
  isHidenRC = _useState4[0],
@@ -8044,7 +8043,28 @@ var FxEditor = function FxEditor() {
8044
8043
  prevCellRef.current = undefined;
8045
8044
  refs.fxInput.current.innerHTML = "";
8046
8045
  }
8046
+ refs.fxInput.current.scrollTop = 0;
8047
8047
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
8048
+ var _useState5 = useState(28),
8049
+ _useState6 = _slicedToArray(_useState5, 2),
8050
+ inputBoxHeight = _useState6[0],
8051
+ setInputBoxHeight = _useState6[1];
8052
+ useEffect(function () {
8053
+ var input = refs.fxInput.current;
8054
+ if (!input) return undefined;
8055
+ var sync = function sync() {
8056
+ return setInputBoxHeight(input.offsetHeight);
8057
+ };
8058
+ sync();
8059
+ if (typeof ResizeObserver === "undefined") {
8060
+ return undefined;
8061
+ }
8062
+ var observer = new ResizeObserver(sync);
8063
+ observer.observe(input);
8064
+ return function () {
8065
+ return observer.disconnect();
8066
+ };
8067
+ }, [refs.fxInput]);
8048
8068
  var onFocus = useCallback(function () {
8049
8069
  var _context$luckysheet_s2, _context$luckysheet_s3;
8050
8070
  if (context.allowEdit === false) {
@@ -8162,13 +8182,12 @@ var FxEditor = function FxEditor() {
8162
8182
  width: 18,
8163
8183
  height: 18
8164
8184
  })), /*#__PURE__*/React.createElement("div", {
8165
- ref: inputContainerRef,
8166
8185
  className: "leankylin-fx-input-container"
8167
8186
  }, /*#__PURE__*/React.createElement(ContentEditable, {
8168
8187
  innerRef: function innerRef(e) {
8169
8188
  refs.fxInput.current = e;
8170
8189
  },
8171
- className: "leankylin-fx-input",
8190
+ className: "leankylin-fx-input".concat(inputBoxHeight > 28 ? " leankylin-fx-input-expanded" : ""),
8172
8191
  id: "luckysheet-functionbox-cell",
8173
8192
  "aria-autocomplete": "list",
8174
8193
  onFocus: onFocus,
@@ -8181,11 +8200,11 @@ var FxEditor = function FxEditor() {
8181
8200
  allowEdit: allowEdit
8182
8201
  }), settings === null || settings === void 0 ? void 0 : settings.fxContainer, /*#__PURE__*/React.createElement(CalcInfo, null), focused && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormulaSearch, {
8183
8202
  style: {
8184
- top: inputContainerRef.current.clientHeight
8203
+ top: inputBoxHeight
8185
8204
  }
8186
8205
  }), /*#__PURE__*/React.createElement(FormulaHint, {
8187
8206
  style: {
8188
- top: inputContainerRef.current.clientHeight
8207
+ top: inputBoxHeight
8189
8208
  }
8190
8209
  })))));
8191
8210
  };
package/dist/index.js CHANGED
@@ -8007,7 +8007,6 @@ var FxEditor = function FxEditor() {
8007
8007
  focused = _useState2[0],
8008
8008
  setFocused = _useState2[1];
8009
8009
  var lastKeyDownEventRef = React.useRef();
8010
- var inputContainerRef = React.useRef(null);
8011
8010
  var _useState3 = React.useState(false),
8012
8011
  _useState4 = _slicedToArray(_useState3, 2),
8013
8012
  isHidenRC = _useState4[0],
@@ -8054,7 +8053,28 @@ var FxEditor = function FxEditor() {
8054
8053
  prevCellRef.current = undefined;
8055
8054
  refs.fxInput.current.innerHTML = "";
8056
8055
  }
8056
+ refs.fxInput.current.scrollTop = 0;
8057
8057
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
8058
+ var _useState5 = React.useState(28),
8059
+ _useState6 = _slicedToArray(_useState5, 2),
8060
+ inputBoxHeight = _useState6[0],
8061
+ setInputBoxHeight = _useState6[1];
8062
+ React.useEffect(function () {
8063
+ var input = refs.fxInput.current;
8064
+ if (!input) return undefined;
8065
+ var sync = function sync() {
8066
+ return setInputBoxHeight(input.offsetHeight);
8067
+ };
8068
+ sync();
8069
+ if (typeof ResizeObserver === "undefined") {
8070
+ return undefined;
8071
+ }
8072
+ var observer = new ResizeObserver(sync);
8073
+ observer.observe(input);
8074
+ return function () {
8075
+ return observer.disconnect();
8076
+ };
8077
+ }, [refs.fxInput]);
8058
8078
  var onFocus = React.useCallback(function () {
8059
8079
  var _context$luckysheet_s2, _context$luckysheet_s3;
8060
8080
  if (context.allowEdit === false) {
@@ -8172,13 +8192,12 @@ var FxEditor = function FxEditor() {
8172
8192
  width: 18,
8173
8193
  height: 18
8174
8194
  })), /*#__PURE__*/React__default['default'].createElement("div", {
8175
- ref: inputContainerRef,
8176
8195
  className: "leankylin-fx-input-container"
8177
8196
  }, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
8178
8197
  innerRef: function innerRef(e) {
8179
8198
  refs.fxInput.current = e;
8180
8199
  },
8181
- className: "leankylin-fx-input",
8200
+ className: "leankylin-fx-input".concat(inputBoxHeight > 28 ? " leankylin-fx-input-expanded" : ""),
8182
8201
  id: "luckysheet-functionbox-cell",
8183
8202
  "aria-autocomplete": "list",
8184
8203
  onFocus: onFocus,
@@ -8191,11 +8210,11 @@ var FxEditor = function FxEditor() {
8191
8210
  allowEdit: allowEdit
8192
8211
  }), settings === null || settings === void 0 ? void 0 : settings.fxContainer, /*#__PURE__*/React__default['default'].createElement(CalcInfo, null), focused && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
8193
8212
  style: {
8194
- top: inputContainerRef.current.clientHeight
8213
+ top: inputBoxHeight
8195
8214
  }
8196
8215
  }), /*#__PURE__*/React__default['default'].createElement(FormulaHint, {
8197
8216
  style: {
8198
- top: inputContainerRef.current.clientHeight
8217
+ top: inputBoxHeight
8199
8218
  }
8200
8219
  })))));
8201
8220
  };
@@ -3374,6 +3374,7 @@ label {
3374
3374
 
3375
3375
  .leankylin-fx-input-container {
3376
3376
  padding-left: 10px;
3377
+ /* 输入框在文本较多时会向下浮出显示,需要允许溢出 */
3377
3378
  overflow: visible;
3378
3379
  padding: 0;
3379
3380
  flex: 1;
@@ -3385,11 +3386,19 @@ label {
3385
3386
 
3386
3387
  .leankylin-fx-input {
3387
3388
  flex: 1;
3388
- height: 100%;
3389
- overflow: auto;
3389
+ /* 只占一行高度,不撑高公式栏;文本较多时向下浮出显示最多约 8 行 */
3390
+ align-self: flex-start;
3391
+ position: relative;
3392
+ /* 浮出部分需要盖住下方表格 */
3393
+ z-index: 1001;
3394
+ height: auto;
3395
+ min-height: 28px;
3396
+ max-height: min(174px, 35vh);
3397
+ overflow-y: auto;
3398
+ overflow-x: hidden;
3390
3399
  padding-left: 2px;
3391
3400
  font-size: 14px;
3392
- line-height: 14px;
3401
+ line-height: 21px;
3393
3402
  margin: 0;
3394
3403
  outline: none;
3395
3404
  cursor: text;
@@ -3399,11 +3408,18 @@ label {
3399
3408
  -webkit-nbsp-mode: space;
3400
3409
  -webkit-line-break: after-white-space;
3401
3410
  background-color: white;
3402
- padding-top: 6px;
3403
- padding-bottom: 6px;
3411
+ padding-top: 3px;
3412
+ padding-bottom: 3px;
3404
3413
  box-sizing: border-box;
3405
3414
  color: black;
3406
3415
  text-align: left;
3416
+ word-break: break-word;
3417
+ }
3418
+
3419
+ /* 文本超出一行、浮出显示时加上阴影,与表格内容区分开 */
3420
+ .leankylin-fx-input.leankylin-fx-input-expanded {
3421
+ border-radius: 0 0 2px 2px;
3422
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
3407
3423
  }
3408
3424
  .leankylin-fx-input[contenteditable="true"] {
3409
3425
  -webkit-user-modify: read-write-plaintext-only;
package/dist/index.umd.js CHANGED
@@ -27081,7 +27081,6 @@
27081
27081
  focused = _useState2[0],
27082
27082
  setFocused = _useState2[1];
27083
27083
  var lastKeyDownEventRef = React.useRef();
27084
- var inputContainerRef = React.useRef(null);
27085
27084
  var _useState3 = React.useState(false),
27086
27085
  _useState4 = _slicedToArray(_useState3, 2),
27087
27086
  isHidenRC = _useState4[0],
@@ -27128,7 +27127,28 @@
27128
27127
  prevCellRef.current = undefined;
27129
27128
  refs.fxInput.current.innerHTML = "";
27130
27129
  }
27130
+ refs.fxInput.current.scrollTop = 0;
27131
27131
  }, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
27132
+ var _useState5 = React.useState(28),
27133
+ _useState6 = _slicedToArray(_useState5, 2),
27134
+ inputBoxHeight = _useState6[0],
27135
+ setInputBoxHeight = _useState6[1];
27136
+ React.useEffect(function () {
27137
+ var input = refs.fxInput.current;
27138
+ if (!input) return undefined;
27139
+ var sync = function sync() {
27140
+ return setInputBoxHeight(input.offsetHeight);
27141
+ };
27142
+ sync();
27143
+ if (typeof ResizeObserver === "undefined") {
27144
+ return undefined;
27145
+ }
27146
+ var observer = new ResizeObserver(sync);
27147
+ observer.observe(input);
27148
+ return function () {
27149
+ return observer.disconnect();
27150
+ };
27151
+ }, [refs.fxInput]);
27132
27152
  var onFocus = React.useCallback(function () {
27133
27153
  var _context$luckysheet_s2, _context$luckysheet_s3;
27134
27154
  if (context.allowEdit === false) {
@@ -27246,13 +27266,12 @@
27246
27266
  width: 18,
27247
27267
  height: 18
27248
27268
  })), /*#__PURE__*/React__default['default'].createElement("div", {
27249
- ref: inputContainerRef,
27250
27269
  className: "leankylin-fx-input-container"
27251
27270
  }, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
27252
27271
  innerRef: function innerRef(e) {
27253
27272
  refs.fxInput.current = e;
27254
27273
  },
27255
- className: "leankylin-fx-input",
27274
+ className: "leankylin-fx-input".concat(inputBoxHeight > 28 ? " leankylin-fx-input-expanded" : ""),
27256
27275
  id: "luckysheet-functionbox-cell",
27257
27276
  "aria-autocomplete": "list",
27258
27277
  onFocus: onFocus,
@@ -27265,11 +27284,11 @@
27265
27284
  allowEdit: allowEdit
27266
27285
  }), settings === null || settings === void 0 ? void 0 : settings.fxContainer, /*#__PURE__*/React__default['default'].createElement(CalcInfo, null), focused && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
27267
27286
  style: {
27268
- top: inputContainerRef.current.clientHeight
27287
+ top: inputBoxHeight
27269
27288
  }
27270
27289
  }), /*#__PURE__*/React__default['default'].createElement(FormulaHint, {
27271
27290
  style: {
27272
- top: inputContainerRef.current.clientHeight
27291
+ top: inputBoxHeight
27273
27292
  }
27274
27293
  })))));
27275
27294
  };