@gridsheet/react-core 1.4.0-alpha.16 → 1.4.0-alpha.18

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.
@@ -111,6 +111,7 @@ const Cell = React__default.memo(({ y, x, operationStyle }) => {
111
111
  return false;
112
112
  }
113
113
  }
114
+ dispatch(setEditingCell(""));
114
115
  dispatch(setContextMenuPosition({ y: -1, x: -1 }));
115
116
  input.focus();
116
117
  if (e.shiftKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.js","sources":["../../components/Cell.tsx"],"sourcesContent":["import React from 'react';\nimport { x2c, y2r } from '../lib/converters';\nimport { zoneToArea, among, zoneShape, areaToZone, areaToRange } from '../lib/structs';\nimport {\n choose,\n select,\n drag,\n write,\n setEditorRect,\n setContextMenuPosition,\n setAutofillDraggingTo,\n updateTable,\n setEditingCell,\n setInputting,\n} from '../store/actions';\n\nimport { DUMMY_IMG } from '../constants';\n\nimport { Context } from '../store';\nimport { FormulaError } from '../formula/evaluator';\nimport { Autofill } from '../lib/autofill';\nimport { insertRef, isRefInsertable } from '../lib/input';\nimport { useSheetContext } from './SheetProvider';\n\ntype Props = {\n y: number;\n x: number;\n operationStyle?: React.CSSProperties;\n};\n\nexport const Cell: React.FC<Props> = React.memo(({ y, x, operationStyle }) => {\n const rowId = y2r(y);\n const colId = x2c(x);\n const address = `${colId}${rowId}`;\n const { store, dispatch } = React.useContext(Context);\n const isFirstPointed = React.useRef(true);\n\n const [sheetProvided, sheetContext] = useSheetContext();\n\n const cellRef = React.useRef<HTMLTableCellElement | null>(null);\n const {\n table,\n editingCell,\n choosing,\n selectingZone,\n leftHeaderSelecting,\n topHeaderSelecting,\n editorRef,\n showAddress,\n autofillDraggingTo,\n lastEdited,\n } = store;\n\n // Whether the focus is on another sheet\n const differentSheetFocused = sheetProvided && sheetContext?.lastFocusedRef !== store.lastFocusedRef;\n\n const lastFocusedRef = sheetContext?.lastFocusedRef || store.lastFocusedRef;\n\n const selectingArea = zoneToArea(selectingZone); // (top, left) -> (bottom, right)\n\n const editing = editingCell === address;\n const xEditing = !sheetProvided || sheetContext?.editingCell === sheetContext?.choosingCell;\n const pointed = choosing.y === y && choosing.x === x;\n const _setEditorRect = React.useCallback(() => {\n const rect = cellRef.current!.getBoundingClientRect();\n dispatch(\n setEditorRect({\n y: rect.y,\n x: rect.x,\n height: rect.height,\n width: rect.width,\n }),\n );\n }, []);\n\n React.useEffect(() => {\n // Avoid setting coordinates on the initial render to account for shifts caused by redrawing due to virtualization.\n if (pointed && !isFirstPointed.current) {\n _setEditorRect();\n if (!editing) {\n dispatch(setInputting(table.stringify({ y, x })));\n }\n return;\n }\n isFirstPointed.current = false;\n }, [pointed, editing]);\n const cell = table.getByPoint({ y, x });\n const writeCell = (value: string) => {\n if (lastEdited !== value) {\n dispatch(write(value));\n return;\n }\n };\n\n let errorMessage = '';\n let rendered;\n try {\n rendered = table.render({ y, x }, writeCell);\n } catch (e: any) {\n if (e instanceof FormulaError) {\n errorMessage = e.message;\n rendered = e.code;\n } else {\n errorMessage = e.message;\n rendered = '#UNKNOWN';\n console.error(e);\n }\n // TODO: debug flag\n }\n const lastInput = lastFocusedRef.current;\n const input = editorRef.current;\n if (!input) {\n return null;\n }\n\n return (\n <td\n key={x}\n ref={cellRef}\n data-x={x}\n data-y={y}\n data-address={address}\n className={`gs-cell ${among(selectingArea, { y, x }) ? 'gs-selecting' : ''} ${pointed ? 'gs-choosing' : ''} ${\n editing ? 'gs-editing' : ''\n }`}\n style={{\n ...cell?.style,\n ...operationStyle,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n dispatch(setContextMenuPosition({ y: e.clientY, x: e.clientX }));\n return false;\n }}\n onClick={(e) => {\n if (autofillDraggingTo) {\n return false;\n }\n\n const fullAddress = `${table.sheetPrefix(!differentSheetFocused)}${address}`;\n const editing = !!(sheetContext?.editingCell || editingCell);\n if (editing) {\n const inserted = insertRef(lastInput, fullAddress);\n if (inserted) {\n return false;\n }\n }\n\n dispatch(setContextMenuPosition({ y: -1, x: -1 }));\n input.focus();\n if (e.shiftKey) {\n dispatch(drag({ y, x }));\n return;\n } else {\n dispatch(choose({ y, x }));\n dispatch(select({ startY: y, startX: x, endY: -1, endX: -1 }));\n _setEditorRect();\n }\n const valueString = table.stringify({ y, x });\n dispatch(setInputting(valueString));\n }}\n onDoubleClick={(e) => {\n e.preventDefault();\n setEditingCell(address);\n const dblclick = document.createEvent('MouseEvents');\n dblclick.initEvent('dblclick', true, true);\n input.dispatchEvent(dblclick);\n return false;\n }}\n draggable\n onDragStart={(e) => {\n if (autofillDraggingTo) {\n return false;\n }\n e.dataTransfer.setDragImage(DUMMY_IMG, 0, 0);\n dispatch(select({ startY: y, startX: x, endY: y, endX: x }));\n const insertable = isRefInsertable(lastInput);\n if (insertable && xEditing) {\n return true;\n } else if (insertable != null) {\n writeCell(input.value);\n }\n dispatch(choose({ y, x }));\n input.focus();\n dispatch(setInputting(''));\n }}\n onDragEnd={() => {\n if (autofillDraggingTo) {\n if (autofillDraggingTo.x !== x || autofillDraggingTo.y !== y) {\n const autofill = new Autofill(store, autofillDraggingTo);\n dispatch(updateTable(autofill.applied));\n dispatch(select(areaToZone(autofill.wholeArea)));\n input.focus();\n }\n dispatch(setAutofillDraggingTo(null));\n return false;\n }\n const { height: h, width: w } = zoneShape(selectingZone);\n if (h + w === 0) {\n dispatch(select({ startY: -1, startX: -1, endY: -1, endX: -1 }));\n }\n if (isRefInsertable(lastInput)) {\n dispatch(select({ startY: -1, startX: -1, endY: -1, endX: -1 }));\n }\n lastFocusedRef.current?.focus();\n }}\n onDragEnter={() => {\n if (autofillDraggingTo) {\n if (!among(selectingArea, { x, y })) {\n dispatch(setAutofillDraggingTo({ x, y }));\n }\n return false;\n }\n if (leftHeaderSelecting) {\n dispatch(drag({ y: table.getNumRows(), x }));\n return false;\n }\n if (topHeaderSelecting) {\n dispatch(drag({ y, x: table.getNumCols() }));\n return false;\n }\n dispatch(drag({ y, x }));\n\n const newArea = zoneToArea({ ...selectingZone, endY: y, endX: x });\n const fullRange = `${table.sheetPrefix(!differentSheetFocused)}${areaToRange(newArea)}`;\n insertRef(lastInput, fullRange);\n sheetContext?.forceRender?.(); // Force drawing because the formula is not reflected in largeInput\n return true;\n }}\n >\n <div className={`gs-cell-inner-wrap`}>\n <div\n className={'gs-cell-inner'}\n style={{\n ...cell?.style,\n justifyContent: cell?.justifyContent || 'left',\n alignItems: cell?.alignItems || 'start',\n }}\n >\n {errorMessage && <div className=\"gs-formula-error-triangle\" title={errorMessage} />}\n {showAddress && <div className=\"gs-cell-label\">{address}</div>}\n <div className=\"gs-cell-rendered\">{rendered}</div>\n </div>\n {((!editing && pointed && selectingArea.bottom === -1) ||\n (selectingArea.bottom === y && selectingArea.right === x)) && (\n <div\n className=\"gs-autofill-drag\"\n draggable\n onDragStart={(e) => {\n e.dataTransfer.setDragImage(DUMMY_IMG, 0, 0);\n dispatch(setAutofillDraggingTo({ x, y }));\n e.stopPropagation();\n }}\n ></div>\n )}\n </div>\n </td>\n );\n});\n"],"names":["React","editing"],"mappings":";;;;;;;;;;;AA8Ba,MAAA,OAAwBA,eAAM,KAAK,CAAC,EAAE,GAAG,GAAG,qBAAqB;AACtE,QAAA,QAAQ,IAAI,CAAC;AACb,QAAA,QAAQ,IAAI,CAAC;AACnB,QAAM,UAAU,GAAG,KAAK,GAAG,KAAK;AAChC,QAAM,EAAE,OAAO,SAAA,IAAaA,eAAM,WAAW,OAAO;AAC9C,QAAA,iBAAiBA,eAAM,OAAO,IAAI;AAExC,QAAM,CAAC,eAAe,YAAY,IAAI,gBAAgB;AAEhD,QAAA,UAAUA,eAAM,OAAoC,IAAI;AACxD,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAGJ,QAAM,wBAAwB,kBAAiB,6CAAc,oBAAmB,MAAM;AA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SACG,CAAC,WAAW,WAAW,cAAc,WAAW,MAChD,cAAc,WAAW,KAAK,cAAc,UAAU,MACvD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,WAAS;AAAA,YACT,aAAa,CAAC,MAAM;AAClB,gBAAE,aAAa,aAAa,WAAW,GAAG,CAAC;AAC3C,uBAAS,sBAAsB,EAAE,GAAG,EAAG,CAAA,CAAC;AACxC,gBAAE,gBAAgB;AAAA,YAAA;AAAA,UACpB;AAAA,QAAA;AAAA,MACD,EAEL,CAAA;AAAA,IAAA;AAAA,IA1IK;AAAA,EA2IP;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Cell.js","sources":["../../components/Cell.tsx"],"sourcesContent":["import React from 'react';\nimport { x2c, y2r } from '../lib/converters';\nimport { zoneToArea, among, zoneShape, areaToZone, areaToRange } from '../lib/structs';\nimport {\n choose,\n select,\n drag,\n write,\n setEditorRect,\n setContextMenuPosition,\n setAutofillDraggingTo,\n updateTable,\n setEditingCell,\n setInputting,\n} from '../store/actions';\n\nimport { DUMMY_IMG } from '../constants';\n\nimport { Context } from '../store';\nimport { FormulaError } from '../formula/evaluator';\nimport { Autofill } from '../lib/autofill';\nimport { insertRef, isRefInsertable } from '../lib/input';\nimport { useSheetContext } from './SheetProvider';\n\ntype Props = {\n y: number;\n x: number;\n operationStyle?: React.CSSProperties;\n};\n\nexport const Cell: React.FC<Props> = React.memo(({ y, x, operationStyle }) => {\n const rowId = y2r(y);\n const colId = x2c(x);\n const address = `${colId}${rowId}`;\n const { store, dispatch } = React.useContext(Context);\n const isFirstPointed = React.useRef(true);\n\n const [sheetProvided, sheetContext] = useSheetContext();\n\n const cellRef = React.useRef<HTMLTableCellElement | null>(null);\n const {\n table,\n editingCell,\n choosing,\n selectingZone,\n leftHeaderSelecting,\n topHeaderSelecting,\n editorRef,\n showAddress,\n autofillDraggingTo,\n lastEdited,\n } = store;\n\n // Whether the focus is on another sheet\n const differentSheetFocused = sheetProvided && sheetContext?.lastFocusedRef !== store.lastFocusedRef;\n\n const lastFocusedRef = sheetContext?.lastFocusedRef || store.lastFocusedRef;\n\n const selectingArea = zoneToArea(selectingZone); // (top, left) -> (bottom, right)\n\n const editing = editingCell === address;\n const xEditing = !sheetProvided || sheetContext?.editingCell === sheetContext?.choosingCell;\n const pointed = choosing.y === y && choosing.x === x;\n const _setEditorRect = React.useCallback(() => {\n const rect = cellRef.current!.getBoundingClientRect();\n dispatch(\n setEditorRect({\n y: rect.y,\n x: rect.x,\n height: rect.height,\n width: rect.width,\n }),\n );\n }, []);\n\n React.useEffect(() => {\n // Avoid setting coordinates on the initial render to account for shifts caused by redrawing due to virtualization.\n if (pointed && !isFirstPointed.current) {\n _setEditorRect();\n if (!editing) {\n dispatch(setInputting(table.stringify({ y, x })));\n }\n return;\n }\n isFirstPointed.current = false;\n }, [pointed, editing]);\n const cell = table.getByPoint({ y, x });\n const writeCell = (value: string) => {\n if (lastEdited !== value) {\n dispatch(write(value));\n return;\n }\n };\n\n let errorMessage = '';\n let rendered;\n try {\n rendered = table.render({ y, x }, writeCell);\n } catch (e: any) {\n if (e instanceof FormulaError) {\n errorMessage = e.message;\n rendered = e.code;\n } else {\n errorMessage = e.message;\n rendered = '#UNKNOWN';\n console.error(e);\n }\n // TODO: debug flag\n }\n const lastInput = lastFocusedRef.current;\n const input = editorRef.current;\n if (!input) {\n return null;\n }\n\n return (\n <td\n key={x}\n ref={cellRef}\n data-x={x}\n data-y={y}\n data-address={address}\n className={`gs-cell ${among(selectingArea, { y, x }) ? 'gs-selecting' : ''} ${pointed ? 'gs-choosing' : ''} ${\n editing ? 'gs-editing' : ''\n }`}\n style={{\n ...cell?.style,\n ...operationStyle,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n dispatch(setContextMenuPosition({ y: e.clientY, x: e.clientX }));\n return false;\n }}\n onClick={(e) => {\n if (autofillDraggingTo) {\n return false;\n }\n\n const fullAddress = `${table.sheetPrefix(!differentSheetFocused)}${address}`;\n const editing = !!(sheetContext?.editingCell || editingCell);\n if (editing) {\n const inserted = insertRef(lastInput, fullAddress);\n if (inserted) {\n return false;\n }\n }\n dispatch(setEditingCell(''));\n dispatch(setContextMenuPosition({ y: -1, x: -1 }));\n input.focus();\n if (e.shiftKey) {\n dispatch(drag({ y, x }));\n return;\n } else {\n dispatch(choose({ y, x }));\n dispatch(select({ startY: y, startX: x, endY: -1, endX: -1 }));\n _setEditorRect();\n }\n const valueString = table.stringify({ y, x });\n dispatch(setInputting(valueString));\n }}\n onDoubleClick={(e) => {\n e.preventDefault();\n setEditingCell(address);\n const dblclick = document.createEvent('MouseEvents');\n dblclick.initEvent('dblclick', true, true);\n input.dispatchEvent(dblclick);\n return false;\n }}\n draggable\n onDragStart={(e) => {\n if (autofillDraggingTo) {\n return false;\n }\n e.dataTransfer.setDragImage(DUMMY_IMG, 0, 0);\n dispatch(select({ startY: y, startX: x, endY: y, endX: x }));\n const insertable = isRefInsertable(lastInput);\n if (insertable && xEditing) {\n return true;\n } else if (insertable != null) {\n writeCell(input.value);\n }\n dispatch(choose({ y, x }));\n input.focus();\n dispatch(setInputting(''));\n }}\n onDragEnd={() => {\n if (autofillDraggingTo) {\n if (autofillDraggingTo.x !== x || autofillDraggingTo.y !== y) {\n const autofill = new Autofill(store, autofillDraggingTo);\n dispatch(updateTable(autofill.applied));\n dispatch(select(areaToZone(autofill.wholeArea)));\n input.focus();\n }\n dispatch(setAutofillDraggingTo(null));\n return false;\n }\n const { height: h, width: w } = zoneShape(selectingZone);\n if (h + w === 0) {\n dispatch(select({ startY: -1, startX: -1, endY: -1, endX: -1 }));\n }\n if (isRefInsertable(lastInput)) {\n dispatch(select({ startY: -1, startX: -1, endY: -1, endX: -1 }));\n }\n lastFocusedRef.current?.focus();\n }}\n onDragEnter={() => {\n if (autofillDraggingTo) {\n if (!among(selectingArea, { x, y })) {\n dispatch(setAutofillDraggingTo({ x, y }));\n }\n return false;\n }\n if (leftHeaderSelecting) {\n dispatch(drag({ y: table.getNumRows(), x }));\n return false;\n }\n if (topHeaderSelecting) {\n dispatch(drag({ y, x: table.getNumCols() }));\n return false;\n }\n dispatch(drag({ y, x }));\n\n const newArea = zoneToArea({ ...selectingZone, endY: y, endX: x });\n const fullRange = `${table.sheetPrefix(!differentSheetFocused)}${areaToRange(newArea)}`;\n insertRef(lastInput, fullRange);\n sheetContext?.forceRender?.(); // Force drawing because the formula is not reflected in largeInput\n return true;\n }}\n >\n <div className={`gs-cell-inner-wrap`}>\n <div\n className={'gs-cell-inner'}\n style={{\n ...cell?.style,\n justifyContent: cell?.justifyContent || 'left',\n alignItems: cell?.alignItems || 'start',\n }}\n >\n {errorMessage && <div className=\"gs-formula-error-triangle\" title={errorMessage} />}\n {showAddress && <div className=\"gs-cell-label\">{address}</div>}\n <div className=\"gs-cell-rendered\">{rendered}</div>\n </div>\n {((!editing && pointed && selectingArea.bottom === -1) ||\n (selectingArea.bottom === y && selectingArea.right === x)) && (\n <div\n className=\"gs-autofill-drag\"\n draggable\n onDragStart={(e) => {\n e.dataTransfer.setDragImage(DUMMY_IMG, 0, 0);\n dispatch(setAutofillDraggingTo({ x, y }));\n e.stopPropagation();\n }}\n ></div>\n )}\n </div>\n </td>\n );\n});\n"],"names":["React","editing"],"mappings":";;;;;;;;;;;AA8Ba,MAAA,OAAwBA,eAAM,KAAK,CAAC,EAAE,GAAG,GAAG,qBAAqB;AACtE,QAAA,QAAQ,IAAI,CAAC;AACb,QAAA,QAAQ,IAAI,CAAC;AACnB,QAAM,UAAU,GAAG,KAAK,GAAG,KAAK;AAChC,QAAM,EAAE,OAAO,SAAA,IAAaA,eAAM,WAAW,OAAO;AAC9C,QAAA,iBAAiBA,eAAM,OAAO,IAAI;AAExC,QAAM,CAAC,eAAe,YAAY,IAAI,gBAAgB;AAEhD,QAAA,UAAUA,eAAM,OAAoC,IAAI;AACxD,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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AAiB,UAAQ,SAAA;AAAA,cACvD,oBAAA,OAAA,EAAI,WAAU,oBAAoB,UAAS,SAAA,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC9C;AAAA,SACG,CAAC,WAAW,WAAW,cAAc,WAAW,MAChD,cAAc,WAAW,KAAK,cAAc,UAAU,MACvD;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,WAAS;AAAA,YACT,aAAa,CAAC,MAAM;AAClB,gBAAE,aAAa,aAAa,WAAW,GAAG,CAAC;AAC3C,uBAAS,sBAAsB,EAAE,GAAG,EAAG,CAAA,CAAC;AACxC,gBAAE,gBAAgB;AAAA,YAAA;AAAA,UACpB;AAAA,QAAA;AAAA,MACD,EAEL,CAAA;AAAA,IAAA;AAAA,IA1IK;AAAA,EA2IP;AAEJ,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../lib/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMpD,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,KAAG,QAuBvC,CAAC"}
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../lib/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMpD,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,KAAG,QAgCvC,CAAC"}
@@ -11,8 +11,16 @@ const clip = (store) => {
11
11
  const input = editorRef.current;
12
12
  const trimmed = table.trim(area);
13
13
  const tsv = table2tsv(trimmed);
14
+ const html = table2html(trimmed);
14
15
  if (navigator.clipboard) {
15
- navigator.clipboard.writeText(tsv);
16
+ const tsvBlob = new Blob([tsv], { type: "text/plain" });
17
+ const htmlBlob = new Blob([html], { type: "text/html" });
18
+ navigator.clipboard.write([
19
+ new ClipboardItem({
20
+ "text/plain": tsvBlob,
21
+ "text/html": htmlBlob
22
+ })
23
+ ]);
16
24
  } else if (input != null) {
17
25
  input.value = tsv;
18
26
  input.focus();
@@ -42,6 +50,22 @@ const table2tsv = (table) => {
42
50
  });
43
51
  return lines.join("\n");
44
52
  };
53
+ const table2html = (table) => {
54
+ const lines = [];
55
+ const matrix = solveTable({ table, raise: false });
56
+ matrix.forEach((row, i) => {
57
+ const y = table.top + i;
58
+ const cols = [];
59
+ row.forEach((col, j) => {
60
+ const x = table.left + j;
61
+ const value = table.stringify({ y, x }, col);
62
+ const valueEscaped = value.replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("'", "&apos;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
63
+ cols.push(`<td>${valueEscaped}</td>`);
64
+ });
65
+ lines.push(`<tr>${cols.join("")}</tr>`);
66
+ });
67
+ return `<table>${lines.join("")}</table>`;
68
+ };
45
69
  export {
46
70
  clip
47
71
  };
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sources":["../../lib/clipboard.ts"],"sourcesContent":["import type { StoreType, AreaType } from '../types';\n\nimport { zoneToArea } from './structs';\nimport { solveTable } from '../formula/solver';\nimport { Table } from './table';\n\nexport const clip = (store: StoreType): AreaType => {\n const { selectingZone, choosing, editorRef, table } = store;\n const { y, x } = choosing;\n const selectingArea = zoneToArea(selectingZone);\n let area = selectingArea;\n if (area.left === -1) {\n area = { top: y, left: x, bottom: y, right: x };\n }\n const input = editorRef.current;\n const trimmed = table.trim(area);\n const tsv = table2tsv(trimmed);\n\n if (navigator.clipboard) {\n navigator.clipboard.writeText(tsv);\n } else if (input != null) {\n input.value = tsv;\n input.focus();\n input.select();\n document.execCommand('copy');\n input.value = '';\n input.blur();\n }\n return area;\n};\n\nconst table2tsv = (table: Table): string => {\n const lines: string[] = [];\n const matrix = solveTable({ table, raise: false });\n matrix.forEach((row, i) => {\n const y = table.top + i;\n const cols: string[] = [];\n row.forEach((col, j) => {\n const x = table.left + j;\n const value = table.stringify({ y, x }, col);\n if (value.indexOf('\\n') !== -1) {\n cols.push(`\"${value.replace(/\"/g, '\"\"')}\"`);\n } else {\n cols.push(value);\n }\n });\n lines.push(cols.join('\\t'));\n });\n return lines.join('\\n');\n};\n"],"names":[],"mappings":";;AAMa,MAAA,OAAO,CAAC,UAA+B;AAClD,QAAM,EAAE,eAAe,UAAU,WAAW,MAAU,IAAA;AAChD,QAAA,EAAE,GAAG,EAAA,IAAM;AACX,QAAA,gBAAgB,WAAW,aAAa;AAC9C,MAAI,OAAO;AACP,MAAA,KAAK,SAAS,IAAI;AACb,WAAA,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EAAA;AAEhD,QAAM,QAAQ,UAAU;AAClB,QAAA,UAAU,MAAM,KAAK,IAAI;AACzB,QAAA,MAAM,UAAU,OAAO;AAE7B,MAAI,UAAU,WAAW;AACb,cAAA,UAAU,UAAU,GAAG;AAAA,EAAA,WACxB,SAAS,MAAM;AACxB,UAAM,QAAQ;AACd,UAAM,MAAM;AACZ,UAAM,OAAO;AACb,aAAS,YAAY,MAAM;AAC3B,UAAM,QAAQ;AACd,UAAM,KAAK;AAAA,EAAA;AAEN,SAAA;AACT;AAEA,MAAM,YAAY,CAAC,UAAyB;AAC1C,QAAM,QAAkB,CAAC;AACzB,QAAM,SAAS,WAAW,EAAE,OAAO,OAAO,OAAO;AAC1C,SAAA,QAAQ,CAAC,KAAK,MAAM;AACnB,UAAA,IAAI,MAAM,MAAM;AACtB,UAAM,OAAiB,CAAC;AACpB,QAAA,QAAQ,CAAC,KAAK,MAAM;AAChB,YAAA,IAAI,MAAM,OAAO;AACvB,YAAM,QAAQ,MAAM,UAAU,EAAE,GAAG,KAAK,GAAG;AAC3C,UAAI,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC9B,aAAK,KAAK,IAAI,MAAM,QAAQ,MAAM,IAAI,CAAC,GAAG;AAAA,MAAA,OACrC;AACL,aAAK,KAAK,KAAK;AAAA,MAAA;AAAA,IACjB,CACD;AACD,UAAM,KAAK,KAAK,KAAK,GAAI,CAAC;AAAA,EAAA,CAC3B;AACM,SAAA,MAAM,KAAK,IAAI;AACxB;"}
1
+ {"version":3,"file":"clipboard.js","sources":["../../lib/clipboard.ts"],"sourcesContent":["import type { StoreType, AreaType } from '../types';\n\nimport { zoneToArea } from './structs';\nimport { solveTable } from '../formula/solver';\nimport { Table } from './table';\n\nexport const clip = (store: StoreType): AreaType => {\n const { selectingZone, choosing, editorRef, table } = store;\n const { y, x } = choosing;\n const selectingArea = zoneToArea(selectingZone);\n let area = selectingArea;\n if (area.left === -1) {\n area = { top: y, left: x, bottom: y, right: x };\n }\n const input = editorRef.current;\n const trimmed = table.trim(area);\n const tsv = table2tsv(trimmed);\n const html = table2html(trimmed);\n\n if (navigator.clipboard) {\n const tsvBlob = new Blob([tsv], { type: 'text/plain' });\n const htmlBlob = new Blob([html], { type: 'text/html' });\n\n navigator.clipboard.write([\n new ClipboardItem({\n 'text/plain': tsvBlob,\n 'text/html': htmlBlob,\n }),\n ]);\n } else if (input != null) {\n input.value = tsv;\n input.focus();\n input.select();\n document.execCommand('copy');\n input.value = '';\n input.blur();\n }\n return area;\n};\n\nconst table2tsv = (table: Table): string => {\n const lines: string[] = [];\n const matrix = solveTable({ table, raise: false });\n matrix.forEach((row, i) => {\n const y = table.top + i;\n const cols: string[] = [];\n row.forEach((col, j) => {\n const x = table.left + j;\n const value = table.stringify({ y, x }, col);\n if (value.indexOf('\\n') !== -1) {\n cols.push(`\"${value.replace(/\"/g, '\"\"')}\"`);\n } else {\n cols.push(value);\n }\n });\n lines.push(cols.join('\\t'));\n });\n return lines.join('\\n');\n};\n\nconst table2html = (table: Table): string => {\n const lines: string[] = [];\n const matrix = solveTable({ table, raise: false });\n matrix.forEach((row, i) => {\n const y = table.top + i;\n const cols: string[] = [];\n row.forEach((col, j) => {\n const x = table.left + j;\n const value = table.stringify({ y, x }, col);\n const valueEscaped = value\n .replaceAll('&', '&amp;')\n .replaceAll('\"', '&quot;')\n .replaceAll(\"'\", '&apos;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n cols.push(`<td>${valueEscaped}</td>`);\n });\n lines.push(`<tr>${cols.join('')}</tr>`);\n });\n return `<table>${lines.join('')}</table>`;\n};\n"],"names":[],"mappings":";;AAMa,MAAA,OAAO,CAAC,UAA+B;AAClD,QAAM,EAAE,eAAe,UAAU,WAAW,MAAU,IAAA;AAChD,QAAA,EAAE,GAAG,EAAA,IAAM;AACX,QAAA,gBAAgB,WAAW,aAAa;AAC9C,MAAI,OAAO;AACP,MAAA,KAAK,SAAS,IAAI;AACb,WAAA,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EAAA;AAEhD,QAAM,QAAQ,UAAU;AAClB,QAAA,UAAU,MAAM,KAAK,IAAI;AACzB,QAAA,MAAM,UAAU,OAAO;AACvB,QAAA,OAAO,WAAW,OAAO;AAE/B,MAAI,UAAU,WAAW;AACjB,UAAA,UAAU,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,MAAM,cAAc;AAChD,UAAA,WAAW,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,aAAa;AAEvD,cAAU,UAAU,MAAM;AAAA,MACxB,IAAI,cAAc;AAAA,QAChB,cAAc;AAAA,QACd,aAAa;AAAA,MACd,CAAA;AAAA,IAAA,CACF;AAAA,EAAA,WACQ,SAAS,MAAM;AACxB,UAAM,QAAQ;AACd,UAAM,MAAM;AACZ,UAAM,OAAO;AACb,aAAS,YAAY,MAAM;AAC3B,UAAM,QAAQ;AACd,UAAM,KAAK;AAAA,EAAA;AAEN,SAAA;AACT;AAEA,MAAM,YAAY,CAAC,UAAyB;AAC1C,QAAM,QAAkB,CAAC;AACzB,QAAM,SAAS,WAAW,EAAE,OAAO,OAAO,OAAO;AAC1C,SAAA,QAAQ,CAAC,KAAK,MAAM;AACnB,UAAA,IAAI,MAAM,MAAM;AACtB,UAAM,OAAiB,CAAC;AACpB,QAAA,QAAQ,CAAC,KAAK,MAAM;AAChB,YAAA,IAAI,MAAM,OAAO;AACvB,YAAM,QAAQ,MAAM,UAAU,EAAE,GAAG,KAAK,GAAG;AAC3C,UAAI,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC9B,aAAK,KAAK,IAAI,MAAM,QAAQ,MAAM,IAAI,CAAC,GAAG;AAAA,MAAA,OACrC;AACL,aAAK,KAAK,KAAK;AAAA,MAAA;AAAA,IACjB,CACD;AACD,UAAM,KAAK,KAAK,KAAK,GAAI,CAAC;AAAA,EAAA,CAC3B;AACM,SAAA,MAAM,KAAK,IAAI;AACxB;AAEA,MAAM,aAAa,CAAC,UAAyB;AAC3C,QAAM,QAAkB,CAAC;AACzB,QAAM,SAAS,WAAW,EAAE,OAAO,OAAO,OAAO;AAC1C,SAAA,QAAQ,CAAC,KAAK,MAAM;AACnB,UAAA,IAAI,MAAM,MAAM;AACtB,UAAM,OAAiB,CAAC;AACpB,QAAA,QAAQ,CAAC,KAAK,MAAM;AAChB,YAAA,IAAI,MAAM,OAAO;AACvB,YAAM,QAAQ,MAAM,UAAU,EAAE,GAAG,KAAK,GAAG;AACrC,YAAA,eAAe,MAClB,WAAW,KAAK,OAAO,EACvB,WAAW,KAAK,QAAQ,EACxB,WAAW,KAAK,QAAQ,EACxB,WAAW,KAAK,MAAM,EACtB,WAAW,KAAK,MAAM;AACpB,WAAA,KAAK,OAAO,YAAY,OAAO;AAAA,IAAA,CACrC;AACD,UAAM,KAAK,OAAO,KAAK,KAAK,EAAE,CAAC,OAAO;AAAA,EAAA,CACvC;AACD,SAAO,UAAU,MAAM,KAAK,EAAE,CAAC;AACjC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsheet/react-core",
3
- "version": "1.4.0-alpha.16",
3
+ "version": "1.4.0-alpha.18",
4
4
  "description": "Spreadsheet component for React",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",