@fileverse-dev/fortune-react 1.3.6 → 1.3.7-dateImport-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.
@@ -123,7 +123,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
123
123
  return to.concat(ar || Array.prototype.slice.call(from));
124
124
  };
125
125
  import React, { useContext, useCallback, useRef, useEffect, useState } from "react";
126
- import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart, api, getSheetIndex } from "@fileverse-dev/fortune-core";
126
+ import { toolbarItemClickHandler, handleTextBackground, handleTextColor, handleTextSize, normalizedCellAttr, getFlowdata, newComment, editComment, deleteComment, showHideComment, showHideAllComments, autoSelectionFormula, handleSum, locale, handleMerge, handleBorder, toolbarItemSelectedFunc, handleFreeze, insertImage, showImgChooser, updateFormat, handleSort, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, createFilter, clearFilter, applyLocation, insertDuneChart, api, getSheetIndex, is_date } from "@fileverse-dev/fortune-core";
127
127
  import _ from "lodash";
128
128
  import { IconButton, LucideIcon, Tooltip, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@fileverse/ui";
129
129
  import DataVerificationPortal from "./dataVerificationPortal";
@@ -719,6 +719,9 @@ var Toolbar = function Toolbar(_a) {
719
719
  currentFmt_1 = format.text;
720
720
  } else if (((_a = curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === null || _a === void 0 ? void 0 : _a.includes("#,##0")) || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0" || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0.00") {
721
721
  currentFmt_1 = "Number";
722
+ } else if (is_date(curr_2.fa)) {
723
+ var hasTime = curr_2.fa.includes("h") || curr_2.fa.includes("H") || curr_2.fa.includes("m") || curr_2.fa.includes("s");
724
+ currentFmt_1 = hasTime ? "Date time" : "Date";
722
725
  } else {
723
726
  currentFmt_1 = defaultFormat[defaultFormat.length - 1].text;
724
727
  }
@@ -25,7 +25,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
25
25
  }
26
26
  return to.concat(ar || Array.prototype.slice.call(from));
27
27
  };
28
- import { defaultContext, defaultSettings, initSheetIndex, handleGlobalKeyDown, getSheetIndex, handlePaste, filterPatch, patchToOp, inverseRowColOptions, ensureSheetIndex, insertRowCol, deleteRowCol, groupValuesRefresh, insertDuneChart, getFlowdata, api, handlePasteByClick } from "@fileverse-dev/fortune-core";
28
+ import { defaultContext, defaultSettings, initSheetIndex, handleGlobalKeyDown, getSheetIndex, handlePaste, filterPatch, patchToOp, inverseRowColOptions, ensureSheetIndex, insertRowCol, deleteRowCol, groupValuesRefresh, insertDuneChart, getFlowdata, api, handlePasteByClick, update } from "@fileverse-dev/fortune-core";
29
29
  import React, { useMemo, useState, useCallback, useEffect, useRef, useImperativeHandle } from "react";
30
30
  import "./index.css";
31
31
  import produce, { applyPatches, enablePatches, produceWithPatches } from "immer";
@@ -124,6 +124,12 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
124
124
  });
125
125
  celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
126
126
  expandedData_1[d.r][d.c] = d.v;
127
+ var cell = d.v;
128
+ if (cell && cell.ct && cell.ct.t === "d" && (cell.m === undefined || cell.m === null)) {
129
+ try {
130
+ cell.m = update(cell.ct.fa || "General", cell.v);
131
+ } catch (e) {}
132
+ }
127
133
  });
128
134
  draftCtx.luckysheetfile = produce(draftCtx.luckysheetfile, function (d) {
129
135
  d[index].data = expandedData_1;
@@ -728,6 +728,9 @@ var Toolbar = function Toolbar(_a) {
728
728
  currentFmt_1 = format.text;
729
729
  } else if (((_a = curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === null || _a === void 0 ? void 0 : _a.includes("#,##0")) || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0" || (curr_2 === null || curr_2 === void 0 ? void 0 : curr_2.fa) === "0.00") {
730
730
  currentFmt_1 = "Number";
731
+ } else if ((0, _fortuneCore.is_date)(curr_2.fa)) {
732
+ var hasTime = curr_2.fa.includes("h") || curr_2.fa.includes("H") || curr_2.fa.includes("m") || curr_2.fa.includes("s");
733
+ currentFmt_1 = hasTime ? "Date time" : "Date";
731
734
  } else {
732
735
  currentFmt_1 = defaultFormat[defaultFormat.length - 1].text;
733
736
  }
@@ -133,6 +133,12 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
133
133
  });
134
134
  celldata === null || celldata === void 0 ? void 0 : celldata.forEach(function (d) {
135
135
  expandedData_1[d.r][d.c] = d.v;
136
+ var cell = d.v;
137
+ if (cell && cell.ct && cell.ct.t === "d" && (cell.m === undefined || cell.m === null)) {
138
+ try {
139
+ cell.m = (0, _fortuneCore.update)(cell.ct.fa || "General", cell.v);
140
+ } catch (e) {}
141
+ }
136
142
  });
137
143
  draftCtx.luckysheetfile = (0, _immer.default)(draftCtx.luckysheetfile, function (d) {
138
144
  d[index].data = expandedData_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.6",
3
+ "version": "1.3.7-dateImport-1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.3.6",
19
+ "@fileverse-dev/fortune-core": "1.3.7-dateImport-1",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",