Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(sheets): data-validation ref-range & optimize package orignize (#1784)

zhangwa47547418716
diff --git a/docs/tldr/ref-range/delete-range-move-other.tldr b/docs/tldr/ref-range/delete-range-move-other.tldr
new file mode 100644
index 0000000000..a8a22e5dd8
--- /dev/null
+++ b/docs/tldr/ref-range/delete-range-move-other.tldr
@@ -0,0 +1,634 @@
+{
+ "tldrawFileFormatVersion": 1,
+ "schema": {
+ "schemaVersion": 1,
+ "storeVersion": 4,
+ "recordVersions": {
+ "asset": {
+ "version": 1,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "image": 3,
+ "video": 3,
+ "bookmark": 1
+ }
+ },
+ "camera": {
+ "version": 1
+ },
+ "document": {
+ "version": 2
+ },
+ "instance": {
+ "version": 24
+ },
+ "instance_page_state": {
+ "version": 5
+ },
+ "page": {
+ "version": 1
+ },
+ "shape": {
+ "version": 3,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "group": 0,
+ "text": 1,
+ "bookmark": 2,
+ "draw": 1,
+ "geo": 8,
+ "note": 5,
+ "line": 4,
+ "frame": 0,
+ "arrow": 3,
+ "highlight": 0,
+ "embed": 4,
+ "image": 3,
+ "video": 2
+ }
+ },
+ "instance_presence": {
+ "version": 5
+ },
+ "pointer": {
+ "version": 1
+ }
+ }
+ },
+ "records": [
+ {
+ "gridSize": 10,
+ "name": "",
+ "meta": {},
+ "id": "document:document",
+ "typeName": "document"
+ },
+ {
+ "id": "pointer:pointer",
+ "typeName": "pointer",
+ "x": 783.5026017162536,
+ "y": 457.5455634395281,
+ "lastActivityTimestamp": 1712492251467,
+ "meta": {}
+ },
+ {
+ "meta": {},
+ "id": "page:page",
+ "name": "Page 1",
+ "index": "a1",
+ "typeName": "page"
+ },
+ {
+ "x": -61.666664216253594,
+ "y": 17.49999930461251,
+ "z": 1,
+ "meta": {},
+ "id": "camera:page:page",
+ "typeName": "camera"
+ },
+ {
+ "editingShapeId": null,
+ "croppingShapeId": null,
+ "selectedShapeIds": [
+ "shape:NuDq3OtA6YXplZkvFH0VW",
+ "shape:lRJ8Rao0PE2SXXh7GBfpR",
+ "shape:sYS6jISnhOXWHXu_pcfTL",
+ "shape:yXoCMFfvOgod-F5gpgxWg",
+ "shape:-6z3WUiXJg8-s1M1O5OBT",
+ "shape:n8reRvSltdS8fWoW_S6Pe",
+ "shape:4fjIFqy2-YWVcedp2xUwT",
+ "shape:yreVzk07y5QjUX2vv4HhE",
+ "shape:Q-MRA9c4-1NEBAaNSlNIN",
+ "shape:eeU13ncMBu2f7GUYymKrf",
+ "shape:A3vESTBPDWb4E8QgY7Jmr",
+ "shape:RajK2iJ_pkbQzqtNpqfT0",
+ "shape:tuuFvVAg9iB-9XqfTXZpk",
+ "shape:O5NT_JV7uY04CLkQy8ky5",
+ "shape:DReHYeZJcP-IZdT3E1wNe",
+ "shape:Wm_ZP7XeR8vaQT-4GXR60",
+ "shape:x3hBc55qV-SZ1LxWcEcPl"
+ ],
+ "hoveredShapeId": null,
+ "erasingShapeIds": [],
+ "hintingShapeIds": [],
+ "focusedGroupId": null,
+ "meta": {},
+ "id": "instance_page_state:page:page",
+ "pageId": "page:page",
+ "typeName": "instance_page_state"
+ },
+ {
+ "followingUserId": null,
+ "opacityForNextShape": 1,
+ "stylesForNextShape": {
+ "tldraw:geo": "rectangle",
+ "tldraw:size": "s",
+ "tldraw:color": "light-blue"
+ },
+ "brush": {
+ "x": 188.3984299633239,
+ "y": 62.17447731892265,
+ "w": 595.1041717529297,
+ "h": 395.37108612060547
+ },
+ "scribbles": [],
+ "cursor": {
+ "type": "default",
+ "rotation": 0
+ },
+ "isFocusMode": false,
+ "exportBackground": true,
+ "isDebugMode": false,
+ "isToolLocked": false,
+ "screenBounds": {
+ "x": 0,
+ "y": 0,
+ "w": 908.3333129882812,
+ "h": 602.5
+ },
+ "insets": [
+ false,
+ true,
+ true,
+ false
+ ],
+ "zoomBrush": null,
+ "isGridMode": false,
+ "isPenMode": false,
+ "chatMessage": "",
+ "isChatting": false,
+ "highlightedUserIds": [],
+ "canMoveCamera": true,
+ "isFocused": true,
+ "devicePixelRatio": 2.4000000953674316,
+ "isCoarsePointer": false,
+ "isHoveringCanvas": true,
+ "openMenus": [],
+ "isChangingStyle": false,
+ "isReadonly": false,
+ "meta": {},
+ "duplicateProps": null,
+ "id": "instance:instance",
+ "currentPageId": "page:page",
+ "typeName": "instance"
+ },
+ {
+ "x": 247.62368774414062,
+ "y": 125.703125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:NuDq3OtA6YXplZkvFH0VW",
+ "type": "geo",
+ "props": {
+ "w": 178.82485961914062,
+ "h": 142.32745361328125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a1",
+ "typeName": "shape"
+ },
+ {
+ "x": 247.9036407470703,
+ "y": 269.8893127441406,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:lRJ8Rao0PE2SXXh7GBfpR",
+ "type": "geo",
+ "props": {
+ "w": 179.2057342529297,
+ "h": 140.43295288085938,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a2",
+ "typeName": "shape"
+ },
+ {
+ "x": 375.7421875,
+ "y": 225.49478149414062,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:sYS6jISnhOXWHXu_pcfTL",
+ "type": "geo",
+ "props": {
+ "w": 50.751953125,
+ "h": 41.953125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a3",
+ "typeName": "shape"
+ },
+ {
+ "x": 354.72003173828125,
+ "y": 196.5755157470703,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:yXoCMFfvOgod-F5gpgxWg",
+ "type": "geo",
+ "props": {
+ "w": 73.09246826171875,
+ "h": 127.86131286621094,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a4",
+ "typeName": "shape"
+ },
+ {
+ "x": 251.77862548828125,
+ "y": 127.67578125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:-6z3WUiXJg8-s1M1O5OBT",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a5",
+ "typeName": "shape"
+ },
+ {
+ "x": 249.76040649414062,
+ "y": 267.3046875,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:n8reRvSltdS8fWoW_S6Pe",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a6",
+ "typeName": "shape"
+ },
+ {
+ "x": 374.5390625,
+ "y": 221.77734375,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:4fjIFqy2-YWVcedp2xUwT",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a7",
+ "typeName": "shape"
+ },
+ {
+ "x": 444.6549232668349,
+ "y": 267.26560488674374,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:yreVzk07y5QjUX2vv4HhE",
+ "type": "arrow",
+ "parentId": "page:page",
+ "index": "a8",
+ "props": {
+ "dash": "draw",
+ "size": "xl",
+ "fill": "none",
+ "color": "black",
+ "labelColor": "black",
+ "bend": 0,
+ "start": {
+ "type": "point",
+ "x": 0,
+ "y": 0
+ },
+ "end": {
+ "type": "point",
+ "x": 72.431640625,
+ "y": 2.1484375
+ },
+ "arrowheadStart": "none",
+ "arrowheadEnd": "arrow",
+ "text": "",
+ "labelPosition": 0.5,
+ "font": "draw"
+ },
+ "typeName": "shape"
+ },
+ {
+ "x": 534.0527038574219,
+ "y": 124.814453125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Q-MRA9c4-1NEBAaNSlNIN",
+ "type": "geo",
+ "props": {
+ "w": 179.08200073242188,
+ "h": 72.373046875,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a9",
+ "typeName": "shape"
+ },
+ {
+ "x": 534.3326568603516,
+ "y": 269.0006408691406,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:eeU13ncMBu2f7GUYymKrf",
+ "type": "geo",
+ "props": {
+ "w": 106.71549987792969,
+ "h": 151.04495239257812,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aA",
+ "typeName": "shape"
+ },
+ {
+ "x": 641.1490478515625,
+ "y": 195.6868438720703,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:A3vESTBPDWb4E8QgY7Jmr",
+ "type": "geo",
+ "props": {
+ "w": 73.09246826171875,
+ "h": 127.86131286621094,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aC",
+ "typeName": "shape"
+ },
+ {
+ "x": 538.2076416015625,
+ "y": 126.787109375,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:RajK2iJ_pkbQzqtNpqfT0",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aD",
+ "typeName": "shape"
+ },
+ {
+ "x": 536.1894226074219,
+ "y": 266.416015625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:tuuFvVAg9iB-9XqfTXZpk",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aE",
+ "typeName": "shape"
+ },
+ {
+ "x": 534.6614540285536,
+ "y": 196.63410464260312,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:O5NT_JV7uY04CLkQy8ky5",
+ "type": "geo",
+ "props": {
+ "w": 105.90814208984374,
+ "h": 72.44140625,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aG",
+ "typeName": "shape"
+ },
+ {
+ "x": 641.2890175051161,
+ "y": 197.5260418984625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:DReHYeZJcP-IZdT3E1wNe",
+ "type": "geo",
+ "props": {
+ "w": 73.44403076171875,
+ "h": 70.21157836914062,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aH",
+ "typeName": "shape"
+ },
+ {
+ "x": 533.5103920168349,
+ "y": 195.4882763955328,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Wm_ZP7XeR8vaQT-4GXR60",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aI",
+ "typeName": "shape"
+ },
+ {
+ "x": 645.2259071535536,
+ "y": 195.2115887734625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:x3hBc55qV-SZ1LxWcEcPl",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aJ",
+ "typeName": "shape"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/tldr/ref-range/insert-range-move-other.tldr b/docs/tldr/ref-range/insert-range-move-other.tldr
new file mode 100644
index 0000000000..de012d5d2e
--- /dev/null
+++ b/docs/tldr/ref-range/insert-range-move-other.tldr
@@ -0,0 +1,715 @@
+{
+ "tldrawFileFormatVersion": 1,
+ "schema": {
+ "schemaVersion": 1,
+ "storeVersion": 4,
+ "recordVersions": {
+ "asset": {
+ "version": 1,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "image": 3,
+ "video": 3,
+ "bookmark": 1
+ }
+ },
+ "camera": {
+ "version": 1
+ },
+ "document": {
+ "version": 2
+ },
+ "instance": {
+ "version": 24
+ },
+ "instance_page_state": {
+ "version": 5
+ },
+ "page": {
+ "version": 1
+ },
+ "shape": {
+ "version": 3,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "group": 0,
+ "text": 1,
+ "bookmark": 2,
+ "draw": 1,
+ "geo": 8,
+ "note": 5,
+ "line": 4,
+ "frame": 0,
+ "arrow": 3,
+ "highlight": 0,
+ "embed": 4,
+ "image": 3,
+ "video": 2
+ }
+ },
+ "instance_presence": {
+ "version": 5
+ },
+ "pointer": {
+ "version": 1
+ }
+ }
+ },
+ "records": [
+ {
+ "gridSize": 10,
+ "name": "",
+ "meta": {},
+ "id": "document:document",
+ "typeName": "document"
+ },
+ {
+ "id": "pointer:pointer",
+ "typeName": "pointer",
+ "x": 754.9478708108269,
+ "y": 432.87760141823037,
+ "lastActivityTimestamp": 1712492341185,
+ "meta": {}
+ },
+ {
+ "meta": {},
+ "id": "page:page",
+ "name": "Page 1",
+ "index": "a1",
+ "typeName": "page"
+ },
+ {
+ "x": -129.9999948342644,
+ "y": -69.16666391823034,
+ "z": 1,
+ "meta": {},
+ "id": "camera:page:page",
+ "typeName": "camera"
+ },
+ {
+ "editingShapeId": null,
+ "croppingShapeId": null,
+ "selectedShapeIds": [],
+ "hoveredShapeId": null,
+ "erasingShapeIds": [],
+ "hintingShapeIds": [],
+ "focusedGroupId": null,
+ "meta": {},
+ "id": "instance_page_state:page:page",
+ "pageId": "page:page",
+ "typeName": "instance_page_state"
+ },
+ {
+ "followingUserId": null,
+ "opacityForNextShape": 1,
+ "stylesForNextShape": {
+ "tldraw:color": "light-blue",
+ "tldraw:geo": "rectangle",
+ "tldraw:size": "s"
+ },
+ "brush": null,
+ "scribbles": [],
+ "cursor": {
+ "type": "default",
+ "rotation": 0
+ },
+ "isFocusMode": false,
+ "exportBackground": true,
+ "isDebugMode": false,
+ "isToolLocked": false,
+ "screenBounds": {
+ "x": 0,
+ "y": 0,
+ "w": 908.3333129882812,
+ "h": 602.5
+ },
+ "insets": [
+ false,
+ true,
+ true,
+ false
+ ],
+ "zoomBrush": null,
+ "isGridMode": false,
+ "isPenMode": false,
+ "chatMessage": "",
+ "isChatting": false,
+ "highlightedUserIds": [],
+ "canMoveCamera": true,
+ "isFocused": true,
+ "devicePixelRatio": 2.4000000953674316,
+ "isCoarsePointer": false,
+ "isHoveringCanvas": true,
+ "openMenus": [],
+ "isChangingStyle": false,
+ "isReadonly": false,
+ "meta": {},
+ "duplicateProps": null,
+ "id": "instance:instance",
+ "currentPageId": "page:page",
+ "typeName": "instance"
+ },
+ {
+ "x": 247.62368774414062,
+ "y": 125.703125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:mmPoVopnA6ljcdfSYV59a",
+ "type": "geo",
+ "props": {
+ "w": 178.82485961914062,
+ "h": 142.32745361328125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a1",
+ "typeName": "shape"
+ },
+ {
+ "x": 247.9036407470703,
+ "y": 269.8893127441406,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:eIcKsf7fIzKEDf8ohaqHg",
+ "type": "geo",
+ "props": {
+ "w": 177.9850311279297,
+ "h": 127.77670288085938,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a2",
+ "typeName": "shape"
+ },
+ {
+ "x": 375.7421875,
+ "y": 225.49478149414062,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:3APps3g9p0w1NE_41YT1Q",
+ "type": "geo",
+ "props": {
+ "w": 50.751953125,
+ "h": 41.953125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a3",
+ "typeName": "shape"
+ },
+ {
+ "x": 354.72003173828125,
+ "y": 196.5755157470703,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qNFcjE6S1pY0inD9H4ng5",
+ "type": "geo",
+ "props": {
+ "w": 73.09246826171875,
+ "h": 127.86131286621094,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a4",
+ "typeName": "shape"
+ },
+ {
+ "x": 251.77862548828125,
+ "y": 127.67578125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:NlhysTac33RgFW0D84gFG",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a5",
+ "typeName": "shape"
+ },
+ {
+ "x": 249.76040649414062,
+ "y": 267.3046875,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:VZt11K02f8Jf8K6vGnnbs",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a6",
+ "typeName": "shape"
+ },
+ {
+ "x": 374.5390625,
+ "y": 221.77734375,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:AGviKyccFrcgBseTWEUvQ",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a7",
+ "typeName": "shape"
+ },
+ {
+ "x": 444.6549232668349,
+ "y": 267.26560488674374,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:wbS5ruNc-IW0DGNG473HE",
+ "type": "arrow",
+ "parentId": "page:page",
+ "index": "a8",
+ "props": {
+ "dash": "draw",
+ "size": "xl",
+ "fill": "none",
+ "color": "black",
+ "labelColor": "black",
+ "bend": 0,
+ "start": {
+ "type": "point",
+ "x": 0,
+ "y": 0
+ },
+ "end": {
+ "type": "point",
+ "x": 72.431640625,
+ "y": 2.1484375
+ },
+ "arrowheadStart": "none",
+ "arrowheadEnd": "arrow",
+ "text": "",
+ "labelPosition": 0.5,
+ "font": "draw"
+ },
+ "typeName": "shape"
+ },
+ {
+ "x": 534.0527038574219,
+ "y": 124.814453125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:anZpGYIScPMNgS6qnraRI",
+ "type": "geo",
+ "props": {
+ "w": 179.08200073242188,
+ "h": 72.373046875,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a9",
+ "typeName": "shape"
+ },
+ {
+ "x": 534.3326568603516,
+ "y": 269.0006408691406,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:g3Ow6Eabc74-0TpSaZ5ml",
+ "type": "geo",
+ "props": {
+ "w": 106.46482849121094,
+ "h": 125.9505615234375,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aA",
+ "typeName": "shape"
+ },
+ {
+ "x": 641.1490478515625,
+ "y": 195.6868438720703,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:yB6c6qLpGVgUWHY5GWdVP",
+ "type": "geo",
+ "props": {
+ "w": 73.09246826171875,
+ "h": 127.86131286621094,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aB",
+ "typeName": "shape"
+ },
+ {
+ "x": 538.2076416015625,
+ "y": 126.787109375,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Vau4D_HwAk-Nq6wVAxDHQ",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aC",
+ "typeName": "shape"
+ },
+ {
+ "x": 536.1894226074219,
+ "y": 266.416015625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:NszqQRZNQqB_SfSv4ul8V",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aD",
+ "typeName": "shape"
+ },
+ {
+ "x": 534.6614540285536,
+ "y": 196.63410464260312,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qSHE5B2jyduHjYW8lGcUe",
+ "type": "geo",
+ "props": {
+ "w": 105.90814208984374,
+ "h": 72.44140625,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aE",
+ "typeName": "shape"
+ },
+ {
+ "x": 641.2922523683974,
+ "y": 323.8736981484625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:M0kdP5q8uV1YxTBfYohmU",
+ "type": "geo",
+ "props": {
+ "w": 73.44403076171875,
+ "h": 70.21157836914062,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aF",
+ "typeName": "shape"
+ },
+ {
+ "x": 533.5103920168349,
+ "y": 195.4882763955328,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:PfQgIf7GFHeJhklUQ-fgL",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aG",
+ "typeName": "shape"
+ },
+ {
+ "x": 645.5221107668349,
+ "y": 323.0599011513922,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:S2nneJa6uMFkx8l4_wJg0",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aH",
+ "typeName": "shape"
+ },
+ {
+ "x": 641.2304635842644,
+ "y": 396.33463266823037,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:6MLqK6YXKOUXZ2TMz24_c",
+ "type": "geo",
+ "props": {
+ "w": 75.24737548828125,
+ "h": 109.94464111328125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aI",
+ "typeName": "shape"
+ },
+ {
+ "x": 643.6633859475456,
+ "y": 395.60221079323037,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:EkEWMdwXKZVTrWMKfNgNT",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aJ",
+ "typeName": "shape"
+ },
+ {
+ "x": 663.5969848632812,
+ "y": 350.98631286621094,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qNJm7SiL5BR0PiMzU2q88",
+ "type": "geo",
+ "props": {
+ "w": 50.751953125,
+ "h": 41.953125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aK",
+ "typeName": "shape"
+ },
+ {
+ "x": 663.9986520608269,
+ "y": 349.095039162371,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:DBeP4hqxqXQy3RhfTXkGt",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aL",
+ "typeName": "shape"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/tldr/ref-range/move-range-other.tldr b/docs/tldr/ref-range/move-range-other.tldr
new file mode 100644
index 0000000000..c03697fce2
--- /dev/null
+++ b/docs/tldr/ref-range/move-range-other.tldr
@@ -0,0 +1,987 @@
+{
+ "tldrawFileFormatVersion": 1,
+ "schema": {
+ "schemaVersion": 1,
+ "storeVersion": 4,
+ "recordVersions": {
+ "asset": {
+ "version": 1,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "image": 3,
+ "video": 3,
+ "bookmark": 1
+ }
+ },
+ "camera": {
+ "version": 1
+ },
+ "document": {
+ "version": 2
+ },
+ "instance": {
+ "version": 24
+ },
+ "instance_page_state": {
+ "version": 5
+ },
+ "page": {
+ "version": 1
+ },
+ "shape": {
+ "version": 3,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "group": 0,
+ "text": 1,
+ "bookmark": 2,
+ "draw": 1,
+ "geo": 8,
+ "note": 5,
+ "line": 4,
+ "frame": 0,
+ "arrow": 3,
+ "highlight": 0,
+ "embed": 4,
+ "image": 3,
+ "video": 2
+ }
+ },
+ "instance_presence": {
+ "version": 5
+ },
+ "pointer": {
+ "version": 1
+ }
+ }
+ },
+ "records": [
+ {
+ "gridSize": 10,
+ "name": "",
+ "meta": {},
+ "id": "document:document",
+ "typeName": "document"
+ },
+ {
+ "id": "pointer:pointer",
+ "typeName": "pointer",
+ "x": 421.8819878759555,
+ "y": 1106.349397374137,
+ "lastActivityTimestamp": 1712490939341,
+ "meta": {}
+ },
+ {
+ "meta": {},
+ "id": "page:page",
+ "name": "Page 1",
+ "index": "a1",
+ "typeName": "page"
+ },
+ {
+ "x": 374.8665834686408,
+ "y": -91.09704365731895,
+ "z": 0.5871192680004972,
+ "meta": {},
+ "id": "camera:page:page",
+ "typeName": "camera"
+ },
+ {
+ "editingShapeId": null,
+ "croppingShapeId": null,
+ "selectedShapeIds": [],
+ "hoveredShapeId": null,
+ "erasingShapeIds": [],
+ "hintingShapeIds": [],
+ "focusedGroupId": null,
+ "meta": {},
+ "id": "instance_page_state:page:page",
+ "pageId": "page:page",
+ "typeName": "instance_page_state"
+ },
+ {
+ "followingUserId": null,
+ "opacityForNextShape": 1,
+ "stylesForNextShape": {
+ "tldraw:color": "light-blue",
+ "tldraw:geo": "rectangle",
+ "tldraw:size": "s",
+ "tldraw:dash": "dashed"
+ },
+ "brush": null,
+ "scribbles": [],
+ "cursor": {
+ "type": "default",
+ "rotation": 0
+ },
+ "isFocusMode": false,
+ "exportBackground": true,
+ "isDebugMode": false,
+ "isToolLocked": false,
+ "screenBounds": {
+ "x": 0,
+ "y": 0,
+ "w": 958.3333129882812,
+ "h": 602.5
+ },
+ "insets": [
+ false,
+ true,
+ true,
+ false
+ ],
+ "zoomBrush": null,
+ "isGridMode": false,
+ "isPenMode": false,
+ "chatMessage": "",
+ "isChatting": false,
+ "highlightedUserIds": [],
+ "canMoveCamera": true,
+ "isFocused": true,
+ "devicePixelRatio": 2.4000000953674316,
+ "isCoarsePointer": false,
+ "isHoveringCanvas": false,
+ "openMenus": [],
+ "isChangingStyle": false,
+ "isReadonly": false,
+ "meta": {},
+ "duplicateProps": null,
+ "id": "instance:instance",
+ "currentPageId": "page:page",
+ "typeName": "instance"
+ },
+ {
+ "x": 36.62252443180677,
+ "y": 176.13338185011935,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Z7xkMeeNXDzNin2Lw3W4B",
+ "type": "geo",
+ "props": {
+ "w": 309.417660085907,
+ "h": 129.1754945779055,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a1",
+ "typeName": "shape"
+ },
+ {
+ "x": 561.796875,
+ "y": 158.87890625,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:HXtCy6rMZ1V_Ti7WAx8fS",
+ "type": "geo",
+ "props": {
+ "w": 302.83203125,
+ "h": 137.01171875,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a2",
+ "typeName": "shape"
+ },
+ {
+ "x": 142.80624866569656,
+ "y": 196.2152141803311,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:WnvWq34NHMyf6CKwBOvYH",
+ "type": "geo",
+ "props": {
+ "w": 62.37890625,
+ "h": 61.6953125,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "5",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a4",
+ "typeName": "shape"
+ },
+ {
+ "x": -33.453125,
+ "y": 140.28018818537623,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:RQ6pvlUHxkfHIwE2VblAj",
+ "type": "geo",
+ "props": {
+ "w": 434.5127179371963,
+ "h": 359.604832486845,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a6",
+ "typeName": "shape"
+ },
+ {
+ "x": 153.91418558699297,
+ "y": 469.72340478018043,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qqMcpCBEVRurWJwUo1jsC",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 17.80338478088379,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a7",
+ "typeName": "shape"
+ },
+ {
+ "x": 670.328125,
+ "y": 206.125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:RWzgXvy0T1kpUTQS6j8h8",
+ "type": "geo",
+ "props": {
+ "w": 101.7578125,
+ "h": 61.6953125,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "6",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aA",
+ "typeName": "shape"
+ },
+ {
+ "x": 504.3515625,
+ "y": 133.2734375,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:_EEHxCoV1f0GCpdnd9c13",
+ "type": "geo",
+ "props": {
+ "w": 438.6465149490318,
+ "h": 365.84093880847024,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aB",
+ "typeName": "shape"
+ },
+ {
+ "x": 735.7846767987926,
+ "y": 463.3469788073762,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:LpDTkDTmnOrQRjRWIsVuT",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 18.54557228088379,
+ "text": "4",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aC",
+ "typeName": "shape"
+ },
+ {
+ "x": -176.70483075582942,
+ "y": 80.13551038325613,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:aZ1fOq7m3B3bJRqVCADtw",
+ "type": "geo",
+ "props": {
+ "w": 1160.1568202167912,
+ "h": 511.1298111516582,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aD",
+ "typeName": "shape"
+ },
+ {
+ "x": 416.3944036995879,
+ "y": 562.9777716706179,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:kg-0xEoFEL72VyabbD_lu",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aE",
+ "typeName": "shape"
+ },
+ {
+ "x": 232.16000398280585,
+ "y": 188.0785920544024,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:-tf6EyMBUgH6oUE5g_und",
+ "type": "geo",
+ "props": {
+ "w": 401.86133470949346,
+ "h": 358.1623468320988,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aF",
+ "typeName": "shape"
+ },
+ {
+ "x": 436.47888907043784,
+ "y": 508.79678364274645,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:gDvMZAb4Rf6GA5eA76xfo",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 20.57773056511335,
+ "text": "2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1.155832490190769
+ },
+ "parentId": "page:page",
+ "index": "aG",
+ "typeName": "shape"
+ },
+ {
+ "x": 160.4110698891767,
+ "y": 648.9019921690615,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:6UXQihpNfMNAcH4XUhm_B",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 799.125,
+ "text": "5 被迁移到镜像位置\n6 被清除\n3 的 o区域迁移到镜像位置,其余的部分拆分成多个小的range (=3-o+o')\n4 o'区域被清除 (=4-o')\n7 的7.4迁移到镜像的8.4\n8 的8.4 被清除\n2.1 迁移到2.1‘,2.2被清除",
+ "font": "draw",
+ "align": "start",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aH",
+ "typeName": "shape"
+ },
+ {
+ "x": -27.381971286011108,
+ "y": 111.44075153624149,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:FX3hwp2fAi5auYGmtUwyN",
+ "type": "geo",
+ "props": {
+ "w": 62.82253446711813,
+ "h": 61.69400978088379,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "7.1",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aJ",
+ "typeName": "shape"
+ },
+ {
+ "x": 77.38466666973028,
+ "y": 296.55130999429696,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qLW3-92vPvSEaJq3XKgZf",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 16,
+ "text": "o",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aU",
+ "typeName": "shape"
+ },
+ {
+ "x": 650.487335065217,
+ "y": 296.3863891776495,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:llNh-FmikyNSyn2dX2gwS",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 20.661457061767578,
+ "text": "o'",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aV",
+ "typeName": "shape"
+ },
+ {
+ "x": 36.34216398634031,
+ "y": 111.38823822359635,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:WktGMRojfOh09ytX4Vrgt",
+ "type": "geo",
+ "props": {
+ "w": 59.90364456176758,
+ "h": 60.867081405132986,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "7.2",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aW",
+ "typeName": "shape"
+ },
+ {
+ "x": -24.7408753522907,
+ "y": 174.86916476534546,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:1IVPDNlZbNdJF7k3eZWhx",
+ "type": "geo",
+ "props": {
+ "w": 60.60792809050062,
+ "h": 67.14085015453615,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "7.3",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aX",
+ "typeName": "shape"
+ },
+ {
+ "x": 37.17118520224808,
+ "y": 174.99903612020003,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:WyJJjUEveJC3Cnt0K3VDC",
+ "type": "geo",
+ "props": {
+ "w": 61.44487981334692,
+ "h": 64.25095219066625,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "7.4",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aY",
+ "typeName": "shape"
+ },
+ {
+ "x": -27.96773690185489,
+ "y": 104.62874708300444,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:7gAf9ldUffUmi9Tryow7T",
+ "type": "geo",
+ "props": {
+ "w": 126.69101573829815,
+ "h": 136.92114401932835,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aZ",
+ "typeName": "shape"
+ },
+ {
+ "x": 15.710536373735692,
+ "y": 77.98792281791688,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:i-4t1QKTI7I-KRkqt9Eqt",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 17.7578125,
+ "text": "7",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aa",
+ "typeName": "shape"
+ },
+ {
+ "x": 502.11456401846743,
+ "y": 90.34457305135983,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:4oMV0zdRJ7Hitpb-Zmk-C",
+ "type": "geo",
+ "props": {
+ "w": 59.9345346046502,
+ "h": 65.2026964715675,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "8.1",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ab",
+ "typeName": "shape"
+ },
+ {
+ "x": 563.4845548665834,
+ "y": 88.04600059623392,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:ooQN7A-VB4tFD2_Mm_vVg",
+ "type": "geo",
+ "props": {
+ "w": 61.264898001174515,
+ "h": 67.68059026946725,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "8.2",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ac",
+ "typeName": "shape"
+ },
+ {
+ "x": 497.8270649955389,
+ "y": 157.28167297114751,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:_wQcHqRyFbN7UN3aDt5AH",
+ "type": "geo",
+ "props": {
+ "w": 61.56793884418107,
+ "h": 67.01377969102066,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "8.3",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ad",
+ "typeName": "shape"
+ },
+ {
+ "x": 499.17465397838816,
+ "y": 87.0412552888065,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:3pHgX6adpLkidrJ_UFmgl",
+ "type": "geo",
+ "props": {
+ "w": 126.69101573829815,
+ "h": 136.92114401932835,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "m",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ae",
+ "typeName": "shape"
+ },
+ {
+ "x": 542.8301411135369,
+ "y": 60.40043102371894,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:IaSDq4wgW9naMxfYTlLl7",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "m",
+ "w": 17.80338478088379,
+ "text": "8",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "af",
+ "typeName": "shape"
+ },
+ {
+ "x": 562.4121211816865,
+ "y": 159.39077441911633,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:JdYLLwDGRsi8wp32-PN6X",
+ "type": "geo",
+ "props": {
+ "w": 63.16826544555806,
+ "h": 63.103088964583435,
+ "geo": "rectangle",
+ "color": "violet",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "8.4",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ag",
+ "typeName": "shape"
+ },
+ {
+ "x": 276.7467140331292,
+ "y": 218.34524188697964,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Usl50hONQS9BSzS5zSgCS",
+ "type": "text",
+ "props": {
+ "color": "black",
+ "size": "s",
+ "w": 24.118488311767578,
+ "text": "2.1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "ah",
+ "typeName": "shape"
+ },
+ {
+ "x": 763.3710549959251,
+ "y": 189.08828302066794,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:AsZwMCjgc1bzNYQFpN4B6",
+ "type": "geo",
+ "props": {
+ "w": 97.78611008717803,
+ "h": 104.810848254783,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "dashed",
+ "size": "s",
+ "font": "draw",
+ "text": "2.1‘",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ai",
+ "typeName": "shape"
+ },
+ {
+ "x": 579.4879858872264,
+ "y": 239.6245375565262,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:Og45Ay_n74-R9Y7qJyQqF",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 30.55729103088379,
+ "text": "2.2",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aj",
+ "typeName": "shape"
+ },
+ {
+ "x": 561.0568077085461,
+ "y": 189.38767917334172,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:S_F8i-VlBd3Mzo5BGmGnY",
+ "type": "geo",
+ "props": {
+ "w": 70.1862549615455,
+ "h": 104.17878971024942,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "dashed",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "ak",
+ "typeName": "shape"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/tldr/ref-range/move-rows-cols-other.tldr b/docs/tldr/ref-range/move-rows-cols-other.tldr
new file mode 100644
index 0000000000..adb25ee234
--- /dev/null
+++ b/docs/tldr/ref-range/move-rows-cols-other.tldr
@@ -0,0 +1,785 @@
+{
+ "tldrawFileFormatVersion": 1,
+ "schema": {
+ "schemaVersion": 1,
+ "storeVersion": 4,
+ "recordVersions": {
+ "asset": {
+ "version": 1,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "image": 3,
+ "video": 3,
+ "bookmark": 1
+ }
+ },
+ "camera": {
+ "version": 1
+ },
+ "document": {
+ "version": 2
+ },
+ "instance": {
+ "version": 24
+ },
+ "instance_page_state": {
+ "version": 5
+ },
+ "page": {
+ "version": 1
+ },
+ "shape": {
+ "version": 3,
+ "subTypeKey": "type",
+ "subTypeVersions": {
+ "group": 0,
+ "text": 1,
+ "bookmark": 2,
+ "draw": 1,
+ "geo": 8,
+ "note": 5,
+ "line": 4,
+ "frame": 0,
+ "arrow": 3,
+ "highlight": 0,
+ "embed": 4,
+ "image": 3,
+ "video": 2
+ }
+ },
+ "instance_presence": {
+ "version": 5
+ },
+ "pointer": {
+ "version": 1
+ }
+ }
+ },
+ "records": [
+ {
+ "gridSize": 10,
+ "name": "",
+ "meta": {},
+ "id": "document:document",
+ "typeName": "document"
+ },
+ {
+ "id": "pointer:pointer",
+ "typeName": "pointer",
+ "x": 1255.3905494482942,
+ "y": 167.71229914279735,
+ "lastActivityTimestamp": 1712497349510,
+ "meta": {}
+ },
+ {
+ "meta": {},
+ "id": "page:page",
+ "name": "Page 1",
+ "index": "a1",
+ "typeName": "page"
+ },
+ {
+ "x": -674.531795241653,
+ "y": 22.109098806580008,
+ "z": 0.8913257676681506,
+ "meta": {},
+ "id": "camera:page:page",
+ "typeName": "camera"
+ },
+ {
+ "editingShapeId": null,
+ "croppingShapeId": null,
+ "selectedShapeIds": [],
+ "hoveredShapeId": null,
+ "erasingShapeIds": [],
+ "hintingShapeIds": [],
+ "focusedGroupId": null,
+ "meta": {},
+ "id": "instance_page_state:page:page",
+ "pageId": "page:page",
+ "typeName": "instance_page_state"
+ },
+ {
+ "followingUserId": null,
+ "opacityForNextShape": 1,
+ "stylesForNextShape": {
+ "tldraw:geo": "rectangle",
+ "tldraw:color": "light-blue",
+ "tldraw:size": "s"
+ },
+ "brush": null,
+ "scribbles": [],
+ "cursor": {
+ "type": "default",
+ "rotation": 0
+ },
+ "isFocusMode": false,
+ "exportBackground": true,
+ "isDebugMode": false,
+ "isToolLocked": false,
+ "screenBounds": {
+ "x": 0,
+ "y": 0,
+ "w": 908.3333129882812,
+ "h": 602.5
+ },
+ "insets": [
+ false,
+ true,
+ true,
+ false
+ ],
+ "zoomBrush": null,
+ "isGridMode": false,
+ "isPenMode": false,
+ "chatMessage": "",
+ "isChatting": false,
+ "highlightedUserIds": [],
+ "canMoveCamera": true,
+ "isFocused": true,
+ "devicePixelRatio": 2.4000000953674316,
+ "isCoarsePointer": false,
+ "isHoveringCanvas": true,
+ "openMenus": [],
+ "isChangingStyle": false,
+ "isReadonly": false,
+ "meta": {},
+ "duplicateProps": null,
+ "id": "instance:instance",
+ "currentPageId": "page:page",
+ "typeName": "instance"
+ },
+ {
+ "x": 166.2044219970703,
+ "y": 11.871749877929688,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:34yHP5cqUyj1sUzXYvGG_",
+ "type": "geo",
+ "props": {
+ "w": 57.05731201171876,
+ "h": 539.8860626220703,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a1",
+ "typeName": "shape"
+ },
+ {
+ "x": 105.42317199707031,
+ "y": 112.09635162353516,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:S0lUSLL7krS7mJ6Ke2Jt1",
+ "type": "geo",
+ "props": {
+ "w": 181.1490936279297,
+ "h": 78.40169525146484,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a2",
+ "typeName": "shape"
+ },
+ {
+ "x": 171.39928478199744,
+ "y": 250.23697756122317,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:hZ2vPygFFYyLnhcuBemCv",
+ "type": "geo",
+ "props": {
+ "w": 48.88801956176758,
+ "h": 66.14581298828125,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "5",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a3",
+ "typeName": "shape"
+ },
+ {
+ "x": 67.22004699707031,
+ "y": 60.592445373535156,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:HluOJgiOyqopIqXDF5S9R",
+ "type": "geo",
+ "props": {
+ "w": 247.7897186279297,
+ "h": 463.42122650146484,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a4",
+ "typeName": "shape"
+ },
+ {
+ "x": 515.6966094970703,
+ "y": 5.9798126220703125,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:EFGA1-V22biG3ATmjL6Cn",
+ "type": "geo",
+ "props": {
+ "w": 57.91015625,
+ "h": 554.8632659912108,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a5",
+ "typeName": "shape"
+ },
+ {
+ "x": 416.7122344970703,
+ "y": 61.37042999267578,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:QabyY2x9yG9CXCbImwk65",
+ "type": "geo",
+ "props": {
+ "w": 247.7897186279297,
+ "h": 463.42122650146484,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "a8",
+ "typeName": "shape"
+ },
+ {
+ "x": 83.52343314223816,
+ "y": 67.49348390102391,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:mvJKUtoBmicgrdwEQld72",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "a9",
+ "typeName": "shape"
+ },
+ {
+ "x": 115.18614605047046,
+ "y": 117.47362519973734,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:iUViMjV9iCWSVEVPyueNQ",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aB",
+ "typeName": "shape"
+ },
+ {
+ "x": 1002.4517246923492,
+ "y": 4.889925326311641,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:DRUWAUHqsFDK-Geg5wgdo",
+ "type": "geo",
+ "props": {
+ "w": 57.05731201171876,
+ "h": 539.8860626220703,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aD",
+ "typeName": "shape"
+ },
+ {
+ "x": 941.6704746923492,
+ "y": 105.11452707191711,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:A9xIt9L9jNGc0oweLZPnW",
+ "type": "geo",
+ "props": {
+ "w": 60.26514566415449,
+ "h": 74.1340945400321,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aE",
+ "typeName": "shape"
+ },
+ {
+ "x": 903.4673496923492,
+ "y": 53.61062082191711,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:2uCxXh6cnNAxnZyb_KuDH",
+ "type": "geo",
+ "props": {
+ "w": 99.36425064789591,
+ "h": 461.26928683828396,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aG",
+ "typeName": "shape"
+ },
+ {
+ "x": 1351.9439121923492,
+ "y": -1.0020119295477343,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:YX46lpEXwsP_hDEfdMsD9",
+ "type": "geo",
+ "props": {
+ "w": 57.91015625,
+ "h": 554.8632659912108,
+ "geo": "rectangle",
+ "color": "black",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aH",
+ "typeName": "shape"
+ },
+ {
+ "x": 1356.7978541724624,
+ "y": 244.31275517707417,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:8Svx_N7tJ-qYJ0llQp1IU",
+ "type": "geo",
+ "props": {
+ "w": 48.88801956176758,
+ "h": 65.26476272972224,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "5",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aJ",
+ "typeName": "shape"
+ },
+ {
+ "x": 919.7707358375171,
+ "y": 60.51165934940586,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:6s2XH02MusvP6oFWgMQcb",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aL",
+ "typeName": "shape"
+ },
+ {
+ "x": 951.4334487457494,
+ "y": 110.4918006481193,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:GnvsePN4zv2AJZm61LBQz",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aN",
+ "typeName": "shape"
+ },
+ {
+ "x": 701.2647232635863,
+ "y": 263.38123474876966,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:bWvcwdw9py4Vu5H4zO4T_",
+ "type": "arrow",
+ "parentId": "page:page",
+ "index": "aP",
+ "props": {
+ "dash": "draw",
+ "size": "xl",
+ "fill": "none",
+ "color": "light-blue",
+ "labelColor": "black",
+ "bend": 0,
+ "start": {
+ "type": "point",
+ "x": 0,
+ "y": 0
+ },
+ "end": {
+ "type": "point",
+ "x": 133.3045156202329,
+ "y": -0.21178503374801494
+ },
+ "arrowheadStart": "none",
+ "arrowheadEnd": "arrow",
+ "text": "",
+ "labelPosition": 0.5,
+ "font": "draw"
+ },
+ "typeName": "shape"
+ },
+ {
+ "x": 1059.4133089551478,
+ "y": 105.57886256417618,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:oCQTPmRoVscXxrOwK5pK7",
+ "type": "geo",
+ "props": {
+ "w": 56.05233069734595,
+ "h": 71.63415732885807,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aQ",
+ "typeName": "shape"
+ },
+ {
+ "x": 1357.016832647147,
+ "y": 103.64725591791213,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:N9IB_pAyKkgHU9d8pg-N9",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aR",
+ "typeName": "shape"
+ },
+ {
+ "x": 1060.1204957350876,
+ "y": 53.31898405311833,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:sYztnUSygK7T27htroeVd",
+ "type": "geo",
+ "props": {
+ "w": 99.36425064789591,
+ "h": 461.26928683828396,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aW",
+ "typeName": "shape"
+ },
+ {
+ "x": 1066.5314514261336,
+ "y": 55.051774724258536,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:YTzysZoy6xyaBVXBeK8IS",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "1",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aX",
+ "typeName": "shape"
+ },
+ {
+ "x": 1059.4133089551478,
+ "y": 105.57886256417618,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:h32QlyTDcBmBR6nKNU5Fy",
+ "type": "geo",
+ "props": {
+ "w": 56.05233069734595,
+ "h": 71.63415732885807,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aY",
+ "typeName": "shape"
+ },
+ {
+ "x": 1352.9496098313912,
+ "y": 103.66690984048108,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:qa04yggT2SX3P5k3GYmhJ",
+ "type": "geo",
+ "props": {
+ "w": 56.05233069734595,
+ "h": 71.63415732885807,
+ "geo": "rectangle",
+ "color": "light-blue",
+ "labelColor": "black",
+ "fill": "none",
+ "dash": "draw",
+ "size": "s",
+ "font": "draw",
+ "text": "",
+ "align": "middle",
+ "verticalAlign": "middle",
+ "growY": 0,
+ "url": ""
+ },
+ "parentId": "page:page",
+ "index": "aZ",
+ "typeName": "shape"
+ },
+ {
+ "x": 1059.790925494965,
+ "y": 106.88667183369284,
+ "rotation": 0,
+ "isLocked": false,
+ "opacity": 1,
+ "meta": {},
+ "id": "shape:9wqvv0_37l2RzNsssd5yo",
+ "type": "text",
+ "props": {
+ "color": "light-blue",
+ "size": "s",
+ "w": 16,
+ "text": "3",
+ "font": "draw",
+ "align": "middle",
+ "autoSize": true,
+ "scale": 1
+ },
+ "parentId": "page:page",
+ "index": "aa",
+ "typeName": "shape"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sheets-data-validation/src/commands/mutations/formula.mutation.ts b/packages/data-validation/src/commands/mutations/formula.mutation.ts
similarity index 100%
rename from packages/sheets-data-validation/src/commands/mutations/formula.mutation.ts
rename to packages/data-validation/src/commands/mutations/formula.mutation.ts
diff --git a/packages/sheets-data-validation/src/controllers/dv-resource.controller.ts b/packages/data-validation/src/controllers/dv-resource.controller.ts
similarity index 81%
rename from packages/sheets-data-validation/src/controllers/dv-resource.controller.ts
rename to packages/data-validation/src/controllers/dv-resource.controller.ts
index aa3cd1df7d..1fd0c7283f 100644
--- a/packages/sheets-data-validation/src/controllers/dv-resource.controller.ts
+++ b/packages/data-validation/src/controllers/dv-resource.controller.ts
@@ -16,39 +16,24 @@
import type { ISheetDataValidationRule, Workbook } from '@univerjs/core';
import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';
-import { DataValidationModel } from '@univerjs/data-validation';
-import { Inject, Injector } from '@wendellhu/redi';
-import { DATA_VALIDATION_PLUGIN_NAME } from '../common/const';
-import { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
+import { Inject } from '@wendellhu/redi';
+import { DataValidationModel } from '../models/data-validation-model';
type DataValidationJSON = Record<string, ISheetDataValidationRule[]>;
+const DATA_VALIDATION_PLUGIN_NAME = 'SHEET_DATA_VALIDATION';
+
@OnLifecycle(LifecycleStages.Ready, DataValidationResourceController)
export class DataValidationResourceController extends Disposable {
constructor(
@IResourceManagerService private readonly _resourceManagerService: IResourceManagerService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
- @Inject(Injector) private readonly _injector: Injector
+ @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel
) {
super();
- this._initDataValidationDataSource();
this._initSnapshot();
}
- private _createSheetDataValidationManager(unitId: string, subUnitId: string) {
- return new SheetDataValidationManager(
- unitId,
- subUnitId,
- [],
- this._injector
- );
- }
-
- private _initDataValidationDataSource() {
- this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
- }
-
private _initSnapshot() {
const toJson = (unitID: string) => {
const map = this._dataValidationModel.getUnitRules(unitID);
diff --git a/packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts b/packages/data-validation/src/controllers/dv-sheet.controller.ts
similarity index 91%
rename from packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts
rename to packages/data-validation/src/controllers/dv-sheet.controller.ts
index 2b8628778a..e892e6c009 100644
--- a/packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts
+++ b/packages/data-validation/src/controllers/dv-sheet.controller.ts
@@ -15,19 +15,19 @@
*/
import { Disposable, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
-import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams } from '@univerjs/data-validation';
-import { AddDataValidationMutation, DataValidationModel, RemoveDataValidationMutation } from '@univerjs/data-validation';
import type { IRemoveSheetCommandParams } from '@univerjs/sheets';
import { RemoveSheetCommand, SheetInterceptorService } from '@univerjs/sheets';
-import { Inject, Injector } from '@wendellhu/redi';
+import { Inject } from '@wendellhu/redi';
+import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams } from '../commands/mutations/data-validation.mutation';
+import { AddDataValidationMutation, RemoveDataValidationMutation } from '../commands/mutations/data-validation.mutation';
+import { DataValidationModel } from '../models/data-validation-model';
@OnLifecycle(LifecycleStages.Ready, DataValidationSheetController)
export class DataValidationSheetController extends Disposable {
constructor(
@Inject(SheetInterceptorService) private _sheetInterceptorService: SheetInterceptorService,
@Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
- @Inject(Injector) private _injector: Injector
+ @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel
) {
super();
this._initSheetChange();
diff --git a/packages/data-validation/src/index.ts b/packages/data-validation/src/index.ts
index 5a99074639..b32726f548 100644
--- a/packages/data-validation/src/index.ts
+++ b/packages/data-validation/src/index.ts
@@ -65,3 +65,6 @@ export { DataValidationManager } from './models/data-validation-manager';
export type { IFormulaValidResult } from './validators/base-data-validator';
export { removeDataValidationUndoFactory } from './commands/commands/data-validation.command';
export { TWO_FORMULA_OPERATOR_COUNT } from './types/const/two-formula-operators';
+export { DataValidationResourceController } from './controllers/dv-resource.controller';
+export { DataValidationSheetController } from './controllers/dv-sheet.controller';
+export { DataValidationFormulaMarkDirty, type IDataValidationFormulaMarkDirtyParams } from './commands/mutations/formula.mutation';
diff --git a/packages/data-validation/src/models/data-validation-model.ts b/packages/data-validation/src/models/data-validation-model.ts
index f4e31ac590..a2c42bc9fd 100644
--- a/packages/data-validation/src/models/data-validation-model.ts
+++ b/packages/data-validation/src/models/data-validation-model.ts
@@ -17,7 +17,7 @@
import { type CellValue, type DataValidationStatus, Disposable, type IDataValidationRule, ILogService, type Nullable } from '@univerjs/core';
import { debounceTime, Subject } from 'rxjs';
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
-import type { DataValidationManager } from './data-validation-manager';
+import { DataValidationManager } from './data-validation-manager';
type ManagerCreator<T extends IDataValidationRule> = (unitId: string, subUnitId: string) => DataValidationManager<T>;
type RuleChangeType = 'update' | 'add' | 'remove';
@@ -38,7 +38,7 @@ export interface IValidStatusChange {
export class DataValidationModel<T extends IDataValidationRule = IDataValidationRule> extends Disposable {
private readonly _model = new Map<string, Map<string, DataValidationManager<T>>>();
- private _managerCreator: ManagerCreator<T>;
+ private _managerCreator: ManagerCreator<T> = (unitId: string, subUnitId: string) => new DataValidationManager<T>(unitId, subUnitId, []);
private readonly _ruleChange$ = new Subject<IRuleChange<T>>();
private readonly _validStatusChange$ = new Subject<IValidStatusChange>();
diff --git a/packages/data-validation/src/plugin.ts b/packages/data-validation/src/plugin.ts
index 8fcf9d2ee5..429652ccbc 100644
--- a/packages/data-validation/src/plugin.ts
+++ b/packages/data-validation/src/plugin.ts
@@ -21,11 +21,15 @@ import { DataValidatorRegistryService } from './services/data-validator-registry
import { DataValidationModel } from './models/data-validation-model';
import { AddDataValidationCommand, RemoveAllDataValidationCommand, RemoveDataValidationCommand, UpdateDataValidationOptionsCommand, UpdateDataValidationSettingCommand } from './commands/commands/data-validation.command';
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from './commands/mutations/data-validation.mutation';
+import { DataValidationResourceController } from './controllers/dv-resource.controller';
+import { DataValidationSheetController } from './controllers/dv-sheet.controller';
+import { DataValidationFormulaMarkDirty } from './commands/mutations/formula.mutation.ts';
const PLUGIN_NAME = 'data-validation';
export class UniverDataValidationPlugin extends Plugin {
constructor(
+ _config: unknown,
@Inject(Injector) protected _injector: Injector,
@ICommandService private _commandService: ICommandService
) {
@@ -36,10 +40,11 @@ export class UniverDataValidationPlugin extends Plugin {
([
// model
[DataValidationModel],
-
// service
[DataValidatorRegistryService],
+ [DataValidationResourceController],
+ [DataValidationSheetController],
] as Dependency[]).forEach(
(d) => {
injector.add(d);
@@ -55,6 +60,7 @@ export class UniverDataValidationPlugin extends Plugin {
RemoveDataValidationCommand,
// mutation
+ DataValidationFormulaMarkDirty,
AddDataValidationMutation,
UpdateDataValidationMutation,
RemoveDataValidationMutation,
diff --git a/packages/data-validation/src/types/const/operator-text-map.ts b/packages/data-validation/src/types/const/operator-text-map.ts
index 82622a5c48..3b50c50a62 100644
--- a/packages/data-validation/src/types/const/operator-text-map.ts
+++ b/packages/data-validation/src/types/const/operator-text-map.ts
@@ -48,3 +48,14 @@ export const OperatorErrorTitleMap: Record<DataValidationOperator, string> = {
[DataValidationOperator.NOT_BETWEEN]: 'dataValidation.errorMsg.notBetween',
[DataValidationOperator.NOT_EQUAL]: 'dataValidation.errorMsg.notEqual',
};
+
+export const TextLengthErrorTitleMap: Record<DataValidationOperator, string> = {
+ [DataValidationOperator.BETWEEN]: 'dataValidation.textLength.errorMsg.between',
+ [DataValidationOperator.EQUAL]: 'dataValidation.textLength.errorMsg.equal',
+ [DataValidationOperator.GREATER_THAN]: 'dataValidation.textLength.errorMsg.greaterThan',
+ [DataValidationOperator.GREATER_THAN_OR_EQUAL]: 'dataValidation.textLength.errorMsg.greaterThanOrEqual',
+ [DataValidationOperator.LESS_THAN]: 'dataValidation.textLength.errorMsg.lessThan',
+ [DataValidationOperator.LESS_THAN_OR_EQUAL]: 'dataValidation.textLength.errorMsg.lessThanOrEqual',
+ [DataValidationOperator.NOT_BETWEEN]: 'dataValidation.textLength.errorMsg.notBetween',
+ [DataValidationOperator.NOT_EQUAL]: 'dataValidation.textLength.errorMsg.notEqual',
+};
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index 4759eeb74f..6e68ebfb0f 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -14,6 +14,21 @@
* limitations under the License.
*/
+import dayjs from 'dayjs';
+import advancedFormat from 'dayjs/plugin/advancedFormat';
+import customParseFormat from 'dayjs/plugin/customParseFormat';
+import localeData from 'dayjs/plugin/localeData';
+import weekday from 'dayjs/plugin/weekday';
+import weekOfYear from 'dayjs/plugin/weekOfYear';
+import weekYear from 'dayjs/plugin/weekYear';
+
+dayjs.extend(customParseFormat);
+dayjs.extend(advancedFormat);
+dayjs.extend(weekday);
+dayjs.extend(localeData);
+dayjs.extend(weekOfYear);
+dayjs.extend(weekYear);
+
export { Avatar, type IAvatarProps } from './components/avatar';
export { Button, type ButtonSize, type ButtonType, type IButtonProps } from './components/button';
export { CascaderList, type ICascaderListProps } from './components/cascader-list';
diff --git a/packages/sheets-data-validation/src/controllers/dv-model.controller.ts b/packages/sheets-data-validation/src/controllers/dv-model.controller.ts
new file mode 100644
index 0000000000..d3bf04191d
--- /dev/null
+++ b/packages/sheets-data-validation/src/controllers/dv-model.controller.ts
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Disposable, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
+import { DataValidationModel } from '@univerjs/data-validation';
+import { Inject, Injector } from '@wendellhu/redi';
+import { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
+
+@OnLifecycle(LifecycleStages.Starting, DataValidationModelController)
+export class DataValidationModelController extends Disposable {
+ constructor(
+ @IResourceManagerService private readonly _resourceManagerService: IResourceManagerService,
+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
+ @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(Injector) private readonly _injector: Injector
+ ) {
+ super();
+ this._initDataValidationDataSource();
+ }
+
+ private _createSheetDataValidationManager(unitId: string, subUnitId: string) {
+ return new SheetDataValidationManager(
+ unitId,
+ subUnitId,
+ [],
+ this._injector
+ );
+ }
+
+ private _initDataValidationDataSource() {
+ this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
+ }
+}
diff --git a/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts b/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
index baca9aef13..c67541700a 100644
--- a/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
@@ -18,7 +18,7 @@ import type { IRange, ISheetDataValidationRule } from '@univerjs/core';
import { DataValidationType, Disposable, DisposableCollection, ICommandService, isRangesEqual, IUniverInstanceService, LifecycleStages, OnLifecycle, Range, Rectangle, toDisposable } from '@univerjs/core';
import type { EffectRefRangeParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
-import { handleDefaultRangeChangeWithEffectRefCommands, handleOtherDefaultRangeChangeWithEffectRefCommands, RefRangeService, SetRangeValuesMutation } from '@univerjs/sheets';
+import { handleCommonDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommands, RefRangeService, SetRangeValuesMutation } from '@univerjs/sheets';
import { Inject, Injector } from '@wendellhu/redi';
import { merge, Observable } from 'rxjs';
import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';
@@ -54,6 +54,12 @@ export class DataValidationRefRangeController extends Disposable {
return `${unitID}_${subUnitId}_${ruleId}`;
}
+ registerRule = (unitId: string, subUnitId: string, rule: ISheetDataValidationRule) => {
+ this.register(unitId, subUnitId, rule);
+ this.registerFormula(unitId, subUnitId, rule);
+ this.registerRange(unitId, subUnitId, rule);
+ };
+
registerFormula(unitId: string, subUnitId: string, rule: ISheetDataValidationRule) {
const ruleId = rule.uid;
const id = this._getIdWithUnitId(unitId, subUnitId, ruleId);
@@ -148,7 +154,7 @@ export class DataValidationRefRangeController extends Disposable {
const handleRangeChange = (commandInfo: EffectRefRangeParams) => {
const oldRanges = [...rule.ranges];
const resultRangesOrigin = oldRanges.map((range) => {
- return handleOtherDefaultRangeChangeWithEffectRefCommands(range, commandInfo) as IRange | IRange[];
+ return handleCommonDefaultRangeChangeWithEffectRefCommands(range, commandInfo) as IRange | IRange[];
}).filter((range) => !!range);
const resultRanges = resultRangesOrigin.flat();
@@ -191,11 +197,11 @@ export class DataValidationRefRangeController extends Disposable {
}
};
const disposeList: (() => void)[] = [];
+
rule.ranges.forEach((range) => {
- const disposable = this._refRangeService.registerRefRange(range, handleRangeChange);
+ const disposable = this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId);
disposeList.push(() => disposable.dispose());
});
-
const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid);
const current = this._disposableMap.get(id) ?? new Set();
current.add(() => disposeList.forEach((dispose) => dispose()));
@@ -356,17 +362,10 @@ export class DataValidationRefRangeController extends Disposable {
toDisposable(
this._dataValidationModel.ruleChange$.subscribe((option) => {
const { unitId, subUnitId, rule } = option;
- const workbook = this._univerInstanceService.getCurrentUniverSheetInstance();
- const worksheet = workbook.getActiveSheet();
- if (option.unitId !== workbook.getUnitId() || option.subUnitId !== worksheet.getSheetId()) {
- return;
- }
switch (option.type) {
case 'add': {
const rule = option.rule!;
- this.register(option.unitId, option.subUnitId, rule);
- this.registerFormula(option.unitId, option.subUnitId, rule);
- this.registerRange(option.unitId, option.subUnitId, rule);
+ this.registerRule(option.unitId, option.subUnitId, rule);
break;
}
case 'remove': {
@@ -378,9 +377,8 @@ export class DataValidationRefRangeController extends Disposable {
const rule = option.rule!;
const disposeSet = this._disposableMap.get(this._getIdWithUnitId(unitId, subUnitId, rule!.uid));
disposeSet && disposeSet.forEach((dispose) => dispose());
- this.register(option.unitId, option.subUnitId, rule);
- this.registerFormula(option.unitId, option.subUnitId, rule);
- this.registerRange(option.unitId, option.subUnitId, rule);
+ this.registerRule(option.unitId, option.subUnitId, rule);
+ break;
}
}
})));
diff --git a/packages/sheets-data-validation/src/index.ts b/packages/sheets-data-validation/src/index.ts
index a1c15c7196..033708efd4 100644
--- a/packages/sheets-data-validation/src/index.ts
+++ b/packages/sheets-data-validation/src/index.ts
@@ -27,12 +27,9 @@ export { DataValidationFormulaService } from './services/dv-formula.service';
export { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
export { RegisterOtherFormulaService } from './services/register-formula.service';
export { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
-export { DataValidationFormulaMarkDirty } from './commands/mutations/formula.mutation';
export { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
export { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
-export { DataValidationSheetController } from './controllers/dv-sheet.controller';
export { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
-export { DataValidationResourceController } from './controllers/dv-resource.controller';
export { HideDataValidationDropdown, ShowDataValidationDropdown } from './commands/operations/data-validation.operation';
export { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
export { enUS, zhCN } from './locale';
diff --git a/packages/sheets-data-validation/src/locale/en-US.ts b/packages/sheets-data-validation/src/locale/en-US.ts
index daa7807b81..05d1f431cd 100644
--- a/packages/sheets-data-validation/src/locale/en-US.ts
+++ b/packages/sheets-data-validation/src/locale/en-US.ts
@@ -126,6 +126,16 @@ const locale: typeof zhCN = {
},
textLength: {
title: 'Text length',
+ errorMsg: {
+ between: 'Text length must be between {FORMULA1} and {FORMULA2}',
+ greaterThan: 'Text length must be after {FORMULA1}',
+ greaterThanOrEqual: 'Text length must be on or after {FORMULA1}',
+ lessThan: 'Text length must be before {FORMULA1}',
+ lessThanOrEqual: 'Text length must be on or before {FORMULA1}',
+ equal: 'Text length must be {FORMULA1}',
+ notEqual: 'Text length must be not {FORMULA1}',
+ notBetween: 'Text length must be not between {FORMULA1}',
+ },
},
decimal: {
title: 'Number',
diff --git a/packages/sheets-data-validation/src/locale/zh-CN.ts b/packages/sheets-data-validation/src/locale/zh-CN.ts
index 055c3dfe3e..8b255ee882 100644
--- a/packages/sheets-data-validation/src/locale/zh-CN.ts
+++ b/packages/sheets-data-validation/src/locale/zh-CN.ts
@@ -127,6 +127,16 @@ const locale = {
},
textLength: {
title: '文本长度',
+ errorMsg: {
+ between: '文本长度必须介于 {FORMULA1} 和 {FORMULA2} 之间',
+ greaterThan: '文本长度必须大于 {FORMULA1}',
+ greaterThanOrEqual: '文本长度必须大于或等于 {FORMULA1}',
+ lessThan: '文本长度必须小于 {FORMULA1}',
+ lessThanOrEqual: '文本长度必须小于或等于 {FORMULA1}',
+ equal: '文本长度必须等于 {FORMULA1}',
+ notEqual: '文本长度必须不等于 {FORMULA1}',
+ notBetween: '文本长度必须在 {FORMULA1} 和 {FORMULA2} 范围之外',
+ },
},
decimal: {
title: '数字',
diff --git a/packages/sheets-data-validation/src/plugin.ts b/packages/sheets-data-validation/src/plugin.ts
index af3dcc549d..796736280f 100644
--- a/packages/sheets-data-validation/src/plugin.ts
+++ b/packages/sheets-data-validation/src/plugin.ts
@@ -26,13 +26,11 @@ import { DataValidationFormulaService } from './services/dv-formula.service';
import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
import { RegisterOtherFormulaService } from './services/register-formula.service';
import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
-import { DataValidationFormulaMarkDirty } from './commands/mutations/formula.mutation';
import { enUS, zhCN } from './locale';
import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
import { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
-import { DataValidationSheetController } from './controllers/dv-sheet.controller';
import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
-import { DataValidationResourceController } from './controllers/dv-resource.controller';
+import { DataValidationModelController } from './controllers/dv-model.controller';
import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';
import { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation } from './commands/operations/data-validation.operation';
import { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
@@ -40,6 +38,7 @@ import { DataValidationPanelService } from './services/data-validation-panel.ser
export class UniverSheetsDataValidationPlugin extends Plugin {
constructor(
+ _config: unknown,
@Inject(Injector) protected _injector: Injector,
@ICommandService private readonly _commandService: ICommandService,
@Inject(LocaleService) private readonly _localeService: LocaleService
@@ -58,13 +57,12 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
[DataValidationDropdownManagerService],
// controller
- [DataValidationResourceController],
+ [DataValidationModelController],
[DataValidationController],
[DataValidationRenderController],
[DataValidationAlertController],
[DataValidationRefRangeController],
[DataValidationAutoFillController],
- [DataValidationSheetController],
[DataValidationCopyPasteController],
[DataValidationRejectInputController],
] as Dependency[]).forEach((dep) => {
@@ -75,7 +73,6 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
AddSheetDataValidationCommand,
AddSheetDataValidationAndOpenCommand,
UpdateSheetDataValidationRangeCommand,
- DataValidationFormulaMarkDirty,
// operation
ShowDataValidationDropdown,
diff --git a/packages/sheets-data-validation/src/services/register-formula.service.ts b/packages/sheets-data-validation/src/services/register-formula.service.ts
index a20616c124..407b6b2a68 100644
--- a/packages/sheets-data-validation/src/services/register-formula.service.ts
+++ b/packages/sheets-data-validation/src/services/register-formula.service.ts
@@ -19,8 +19,8 @@ import { Disposable, ICommandService, Tools } from '@univerjs/core';
import type { IRemoveOtherFormulaMutationParams, ISetFormulaCalculationResultMutation, ISetOtherFormulaMutationParams } from '@univerjs/engine-formula';
import { IActiveDirtyManagerService, RemoveOtherFormulaMutation, SetFormulaCalculationResultMutation, SetOtherFormulaMutation } from '@univerjs/engine-formula';
import { bufferTime, filter, map, Subject } from 'rxjs';
-import type { IDataValidationFormulaMarkDirtyParams } from '../commands/mutations/formula.mutation';
-import { DataValidationFormulaMarkDirty } from '../commands/mutations/formula.mutation';
+import type { IDataValidationFormulaMarkDirtyParams } from '@univerjs/data-validation';
+import { DataValidationFormulaMarkDirty } from '@univerjs/data-validation';
import { FormulaResultStatus, type IDataValidationFormulaResult } from './formula-common';
export class RegisterOtherFormulaService extends Disposable {
diff --git a/packages/sheets-data-validation/src/validators/text-length-validator.ts b/packages/sheets-data-validation/src/validators/text-length-validator.ts
index c666e7db55..df1ba5403a 100644
--- a/packages/sheets-data-validation/src/validators/text-length-validator.ts
+++ b/packages/sheets-data-validation/src/validators/text-length-validator.ts
@@ -18,10 +18,14 @@ import { DataValidationOperator, DataValidationType, isFormulaString, Tools } fr
import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
import { BaseDataValidator } from '@univerjs/data-validation';
+import { TextLengthErrorTitleMap } from '@univerjs/data-validation/types/const/operator-text-map.js';
import { BASE_FORMULA_INPUT_NAME } from '../views/formula-input';
import { TWO_FORMULA_OPERATOR_COUNT } from '../types/const/two-formula-operators';
import { DataValidationFormulaService } from '../services/dv-formula.service';
+const FORMULA1 = '{FORMULA1}';
+const FORMULA2 = '{FORMULA2}';
+
export class TextLengthValidator extends BaseDataValidator<number> {
id: string = DataValidationType.TEXT_LENGTH;
title: string = 'dataValidation.textLength.title';
@@ -188,4 +192,13 @@ export class TextLengthValidator extends BaseDataValidator<number> {
return cellValue <= formula1;
}
+
+ override generateRuleErrorMessage(rule: IDataValidationRuleBase) {
+ if (!rule.operator) {
+ return this.titleStr;
+ }
+
+ const errorMsg = this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, rule.formula1 ?? '').replace(FORMULA2, rule.formula2 ?? '');
+ return `${errorMsg}`;
+ }
}
diff --git a/packages/sheets-data-validation/src/views/item/index.module.less b/packages/sheets-data-validation/src/views/item/index.module.less
index 5e12154d66..99352f1316 100644
--- a/packages/sheets-data-validation/src/views/item/index.module.less
+++ b/packages/sheets-data-validation/src/views/item/index.module.less
@@ -13,10 +13,12 @@
cursor: pointer;
position: relative;
border-radius: 6px;
+ width: 287px;
+ overflow: hidden;
}
&-container:hover {
- background-color: #f5f5f5;
+ background-color: rgba(var(--grey-50));
}
&-title {
@@ -24,12 +26,16 @@
color: rgba(var(--color-black));
line-height: 22px;
font-weight: 500;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
&-content {
- color: #7a7a7a;
+ color: rgba(var(--text-color-secondary));
font-size: var(--font-size-xs);
line-height: 18px;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
&-icon {
@@ -45,6 +51,6 @@
}
&-icon:hover {
- background: #e5e5e5;
+ background: rgba(var(--grey-200));
}
}
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index 21c117b9e0..d65503cf5a 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -278,7 +278,7 @@ export {
rotateRange,
runRefRangeMutations,
handleDefaultRangeChangeWithEffectRefCommands,
- handleOtherDefaultRangeChangeWithEffectRefCommands,
+ handleCommonDefaultRangeChangeWithEffectRefCommands,
} from './services/ref-range/util';
export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
diff --git a/packages/sheets/src/services/ref-range/__tests__/util.spec.ts b/packages/sheets/src/services/ref-range/__tests__/util.spec.ts
index 3f7da2b796..923255021e 100644
--- a/packages/sheets/src/services/ref-range/__tests__/util.spec.ts
+++ b/packages/sheets/src/services/ref-range/__tests__/util.spec.ts
@@ -20,18 +20,28 @@ import { beforeEach, describe, expect, it } from 'vitest';
import { EffectRefRangId } from '../type';
import {
handleDeleteRangeMoveLeft,
+ handleDeleteRangeMoveLeftCommon,
handleDeleteRangeMoveUp,
+ handleDeleteRangeMoveUpCommon,
handleInsertCol,
handleInsertRangeMoveDown,
+ handleInsertRangeMoveDownCommon,
handleInsertRangeMoveRight,
+ handleInsertRangeMoveRightCommon,
handleInsertRow,
handleIRemoveCol,
handleIRemoveRow,
handleMoveRange,
+ handleMoveRangeCommon,
handleMoveRows,
+ handleMoveRowsCommon,
runRefRangeMutations,
} from '../util';
+const countRange = ([a, b, c, d]: readonly [number, number, number, number]) => (a * 1000 + b * 100 + c * 10 + d);
+
+const formatRanges = (ranges: IRange[]) => ranges.map((range) => [range.startRow, range.endRow, range.startColumn, range.endColumn] as const).sort((prev, aft) => countRange(prev) - countRange(aft));
+
describe('test ref-range move', () => {
describe('handleMoveRows', () => {
// see docs/tldr/handMoveRowsCols.tldr
@@ -177,6 +187,103 @@ describe('test ref-range move', () => {
});
});
});
+ describe('handleMoveRowsCommon', () => {
+ // see docs/tldr/handMoveRowsCols.tldr
+ const startCol = 0;
+ const endCol = 999;
+ let fromRange: IRange;
+ let toRange: IRange;
+
+ describe('formRange is top of toRange', () => {
+ beforeEach(() => {
+ fromRange = { startRow: 5, endRow: 10, startColumn: startCol, endColumn: endCol };
+ toRange = { startRow: 15, endRow: 20, startColumn: startCol, endColumn: endCol };
+ });
+
+ it('contain', () => {
+ const targetRange2_1: IRange = {
+ startRow: 6,
+ endRow: 9,
+ startColumn: 0,
+ endColumn: 2,
+ };
+ const targetRange2_2: IRange = {
+ startRow: 16,
+ endRow: 19,
+ startColumn: 0,
+ endColumn: 2,
+ };
+
+ const resRange2_1 = handleMoveRowsCommon(
+ { id: EffectRefRangId.MoveRowsCommandId, params: { toRange, fromRange } },
+ targetRange2_1
+ );
+ const resRange2_2 = handleMoveRowsCommon(
+ { id: EffectRefRangId.MoveRowsCommandId, params: { toRange, fromRange } },
+ targetRange2_2
+ );
+ expect(resRange2_1[0].startRow).toEqual(10);
+ expect(resRange2_1[0].endRow).toEqual(13);
+
+ expect(formatRanges(resRange2_2)).toEqual(formatRanges([targetRange2_2]));
+ });
+
+ it('intersect', () => {
+ const targetRange1_1: IRange = {
+ startRow: 2,
+ endRow: 12,
+ startColumn: 0,
+ endColumn: 10,
+ };
+ const targetRange1_2: IRange = {
+ startRow: 12,
+ endRow: 22,
+ startColumn: 0,
+ endColumn: 10,
+ };
+
+ const resRange1_1 = handleMoveRowsCommon(
+ { id: EffectRefRangId.MoveRowsCommandId, params: { toRange, fromRange } },
+ targetRange1_1
+ );
+ const resRange1_2 = handleMoveRowsCommon(
+ { id: EffectRefRangId.MoveRowsCommandId, params: { toRange, fromRange } },
+ targetRange1_2
+ );
+
+ expect(resRange1_1).toEqual(
+ [
+ {
+ endColumn: 10,
+ endRow: 14,
+ startColumn: 0,
+ startRow: 9,
+ },
+ {
+ endColumn: 10,
+ endRow: 6,
+ startColumn: 0,
+ startRow: 2,
+ },
+ ]
+ );
+ expect(resRange1_2).toEqual([
+ {
+ endColumn: 10,
+ endRow: 22,
+ startColumn: 0,
+ startRow: 15,
+ },
+ {
+ endColumn: 10,
+ endRow: 8,
+ startColumn: 0,
+ startRow: 6,
+ },
+ ]);
+ });
+ });
+ });
describe('handleInsertRangeMoveDown', () => {
let range: IRange;
beforeEach(() => {
@@ -219,6 +326,76 @@ describe('test ref-range move', () => {
expect(result).toEqual({ ...targetRange, startRow: 18, endRow: 19 });
});
});
+
+ describe('handleInsertRangeMoveDownCommon', () => {
+ let range: IRange;
+ beforeEach(() => {
+ range = { startRow: 2, endRow: 2, startColumn: 0, endColumn: 5 };
+ });
+
+ it('intersects', () => {
+ const target = {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 0,
+ endColumn: 5,
+ };
+
+ const res = handleInsertRangeMoveDownCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.InsertRangeMoveDownCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 3,
+ endRow: 6,
+ startColumn: 0,
+ endColumn: 5,
+ },
+ {
+ startRow: 0,
+ endRow: 1,
+ startColumn: 0,
+ endColumn: 5,
+ },
+ ])
+ );
+ });
+
+ it('no-intersects', () => {
+ const target = {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 6,
+ endColumn: 10,
+ };
+
+ const res = handleInsertRangeMoveDownCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.InsertRangeMoveDownCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 6,
+ endColumn: 10,
+ },
+ ])
+ );
+ });
+ });
+
describe('handleInsertRangeMoveRight', () => {
let range: IRange;
beforeEach(() => {
@@ -261,6 +438,76 @@ describe('test ref-range move', () => {
expect(result).toEqual(targetRange);
});
});
+
+ describe('handleInsertRangeMoveRightCommon', () => {
+ let range: IRange;
+ beforeEach(() => {
+ range = { startColumn: 2, endColumn: 2, startRow: 0, endRow: 5 };
+ });
+
+ it('intersects', () => {
+ const target = {
+ startColumn: 0,
+ endColumn: 5,
+ startRow: 0,
+ endRow: 5,
+ };
+
+ const res = handleInsertRangeMoveRightCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.InsertRangeMoveRightCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startColumn: 3,
+ endColumn: 6,
+ startRow: 0,
+ endRow: 5,
+ },
+ {
+ startColumn: 0,
+ endColumn: 1,
+ startRow: 0,
+ endRow: 5,
+ },
+ ])
+ );
+ });
+
+ it('no-intersects', () => {
+ const target = {
+ startColumn: 0,
+ endColumn: 5,
+ startRow: 6,
+ endRow: 10,
+ };
+
+ const res = handleInsertRangeMoveRightCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.InsertRangeMoveRightCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startColumn: 0,
+ endColumn: 5,
+ startRow: 6,
+ endRow: 10,
+ },
+ ])
+ );
+ });
+ });
+
describe('handleDeleteRangeMoveLeft', () => {
let range: IRange;
beforeEach(() => {
@@ -315,6 +562,132 @@ describe('test ref-range move', () => {
expect(result).toEqual(targetRange);
});
});
+
+ describe('handleDeleteRangeMoveLeftCommon', () => {
+ let range: IRange;
+ beforeEach(() => {
+ range = { startColumn: 2, endColumn: 2, startRow: 0, endRow: 5 };
+ });
+
+ it('intersects', () => {
+ const target = {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 0,
+ endColumn: 5,
+ };
+
+ const res = handleDeleteRangeMoveLeftCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.DeleteRangeMoveLeftCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 0,
+ endColumn: 4,
+ },
+ ])
+ );
+ });
+
+ it('no-intersects', () => {
+ const target = {
+ startRow: 6,
+ endRow: 10,
+ startColumn: 0,
+ endColumn: 5,
+ };
+
+ const res = handleDeleteRangeMoveLeftCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.DeleteRangeMoveLeftCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 6,
+ endRow: 10,
+ startColumn: 0,
+ endColumn: 5,
+ },
+ ])
+ );
+ });
+ });
+
+ describe('handleDeleteRangeMoveUpCommon', () => {
+ let range: IRange;
+ beforeEach(() => {
+ range = { startRow: 2, endRow: 2, startColumn: 0, endColumn: 5 };
+ });
+
+ it('intersects', () => {
+ const target = {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 0,
+ endColumn: 5,
+ };
+
+ const res = handleDeleteRangeMoveUpCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.DeleteRangeMoveUpCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 0,
+ endRow: 4,
+ startColumn: 0,
+ endColumn: 5,
+ },
+ ])
+ );
+ });
+
+ it('no-intersects', () => {
+ const target = {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 6,
+ endColumn: 10,
+ };
+
+ const res = handleDeleteRangeMoveUpCommon(
+ {
+ params: { range },
+ id: EffectRefRangId.DeleteRangeMoveUpCommandId,
+ },
+ target
+ );
+
+ expect(formatRanges(res)).toEqual(
+ formatRanges([
+ {
+ startRow: 0,
+ endRow: 5,
+ startColumn: 6,
+ endColumn: 10,
+ },
+ ])
+ );
+ });
+ });
describe('handleDeleteRangeMoveUp', () => {
let range: IRange;
beforeEach(() => {
@@ -370,6 +743,7 @@ describe('test ref-range move', () => {
expect(result).toEqual(null);
});
});
+
describe('handleInsertCol', () => {
let range: IRange;
beforeEach(() => {
@@ -613,6 +987,78 @@ describe('test ref-range move', () => {
});
});
});
+
+ describe('handleMoveRangeCommon', () => {
+ describe('intersects', () => {
+ let toRange: IRange;
+ let fromRange: IRange;
+ beforeEach(() => {
+ toRange = { startRow: 4, endColumn: 7, startColumn: 4, endRow: 7 };
+ fromRange = { startRow: 0, endColumn: 3, startColumn: 0, endRow: 3 };
+ });
+
+ it('should work', () => {
+ const range1 = {
+ startRow: 0,
+ endColumn: 5,
+ startColumn: 0,
+ endRow: 5,
+ };
+ const range2 = {
+ startRow: 6,
+ endColumn: 10,
+ startColumn: 6,
+ endRow: 10,
+ };
+ const res1 = handleMoveRangeCommon(
+ { id: EffectRefRangId.MoveRangeCommandId, params: { toRange, fromRange } },
+ range1
+ );
+
+ const res2 = handleMoveRangeCommon(
+ { id: EffectRefRangId.MoveRangeCommandId, params: { toRange, fromRange } },
+ range2
+ );
+
+ expect(formatRanges(res1)).toEqual(
+ formatRanges(
+ [{
+ endColumn: 7,
+ endRow: 5,
+ startColumn: 0,
+ startRow: 4,
+ }, {
+ endColumn: 5,
+ endRow: 3,
+ startColumn: 4,
+ startRow: 0,
+ }, {
+ endColumn: 7,
+ endRow: 7,
+ startColumn: 4,
+ startRow: 6,
+ }]
+ )
+ );
+ expect(formatRanges(res2)).toEqual(
+ formatRanges(
+ [{
+ endColumn: 10,
+ endRow: 10,
+ startColumn: 8,
+ startRow: 6,
+ },
+ {
+ endColumn: 7,
+ endRow: 10,
+ startColumn: 6,
+ startRow: 8,
+ }]
+ )
+ );
+ });
+ });
+ });
describe('handleIRemoveCol', () => {
let range: IRange;
describe('the range contain targetRange', () => {
diff --git a/packages/sheets/src/services/ref-range/util.ts b/packages/sheets/src/services/ref-range/util.ts
index 7c4980db04..d7384354cd 100644
--- a/packages/sheets/src/services/ref-range/util.ts
+++ b/packages/sheets/src/services/ref-range/util.ts
@@ -214,10 +214,10 @@ export const handleMoveRows = (params: IMoveRowsCommand, targetRange: IRange): I
];
};
-export const handleMoveRowsOther = (params: IMoveRowsCommand, targetRange: IRange) => {
+export const handleMoveRowsCommon = (params: IMoveRowsCommand, targetRange: IRange) => {
const { fromRange, toRange } = params.params || {};
if (!fromRange || !toRange) {
- return null;
+ return [targetRange];
}
const { startRow: fromRow } = fromRange;
@@ -233,7 +233,8 @@ export const handleMoveRowsOther = (params: IMoveRowsCommand, targetRange: IRang
matrix.moveRows(fromRow, count, toRow);
- return queryObjectMatrix(matrix, (value) => value === 1);
+ const res = queryObjectMatrix(matrix, (value) => value === 1);
+ return res;
};
export const handleMoveCols = (params: IMoveColsCommand, targetRange: IRange): IOperator[] => {
@@ -265,10 +266,10 @@ export const handleMoveCols = (params: IMoveColsCommand, targetRange: IRange): I
];
};
-export const handleMoveColsOther = (params: IMoveColsCommand, targetRange: IRange) => {
+export const handleMoveColsCommon = (params: IMoveColsCommand, targetRange: IRange) => {
const { fromRange, toRange } = params.params || {};
if (!fromRange || !toRange) {
- return null;
+ return [targetRange];
}
const { startColumn: fromCol } = fromRange;
@@ -317,21 +318,22 @@ export const handleMoveRange = (param: IMoveRangeCommand, targetRange: IRange) =
return operators;
};
-const handleMoveRangeOther = (param: IMoveRangeCommand, targetRange: IRange) => {
+export const handleMoveRangeCommon = (param: IMoveRangeCommand, targetRange: IRange) => {
const toRange = param.params?.toRange;
const fromRange = param.params?.fromRange;
+ // illegal
if (!toRange || !fromRange) {
- return null;
+ return [targetRange];
}
- if (Rectangle.contains(toRange, targetRange)) {
- return null;
+ if (!Rectangle.intersects(fromRange, targetRange) && !Rectangle.intersects(toRange, targetRange)) {
+ return [targetRange];
}
if (Rectangle.contains(fromRange, targetRange)) {
const relativeRange = Rectangle.getRelativeRange(targetRange, fromRange);
const positionRange = Rectangle.getPositionRange(relativeRange, toRange);
- return positionRange;
+ return [positionRange];
}
const matrix = new ObjectMatrix();
@@ -349,22 +351,21 @@ const handleMoveRangeOther = (param: IMoveRangeCommand, targetRange: IRange) =>
fromMatrix.setValue(row, col, 1);
}
});
+
const columnOffset = toRange.startColumn - fromRange.startColumn;
const rowOffset = toRange.startRow - fromRange.startRow;
- const relativeToRange = {
+ const loopToRange = {
startColumn: toRange.startColumn - columnOffset,
endColumn: toRange.endColumn - columnOffset,
startRow: toRange.startRow - rowOffset,
endRow: toRange.endRow - rowOffset,
};
- const loopToRange = Rectangle.getIntersects(relativeToRange, targetRange);
-
loopToRange && Range.foreach(loopToRange, (row, col) => {
const targetRow = row + rowOffset;
const targetCol = col + columnOffset;
- matrix.setValue(targetRow, targetCol, fromMatrix.getValue(row, col));
+ matrix.setValue(targetRow, targetCol, fromMatrix.getValue(row, col) ?? 0);
});
const res = queryObjectMatrix(matrix, (value) => value === 1);
@@ -543,6 +544,40 @@ export const handleInsertRangeMoveDown = (param: IInsertRangeMoveDownCommand, ta
return operators;
};
+export const handleInsertRangeMoveDownCommon = (param: IInsertRangeMoveDownCommand, targetRange: IRange) => {
+ const range = param.params?.range;
+ if (!range) {
+ return [targetRange];
+ }
+
+ const moveCount = range.endRow - range.startRow + 1;
+ const bottomRange: IRange = {
+ ...range,
+ startRow: range.startRow,
+ endRow: Number.POSITIVE_INFINITY,
+ };
+
+ const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
+ const targetMoveRange = Rectangle.getIntersects(bottomRange, targetRange);
+
+ if (!targetMoveRange) {
+ return [targetRange];
+ }
+
+ const matrix = new ObjectMatrix<number>();
+ noMoveRanges.forEach((noMoveRange) => {
+ Range.foreach(noMoveRange, (row, col) => {
+ matrix.setValue(row, col, 1);
+ });
+ });
+
+ targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
+ matrix.setValue(row + moveCount, col, 1);
+ });
+
+ return queryObjectMatrix(matrix, (v) => v === 1);
+};
+
export const handleInsertRangeMoveRight = (param: IInsertRangeMoveRightCommand, targetRange: IRange) => {
const range = param.params?.range;
if (!range) {
@@ -559,6 +594,40 @@ export const handleInsertRangeMoveRight = (param: IInsertRangeMoveRightCommand,
return operators;
};
+export const handleInsertRangeMoveRightCommon = (param: IInsertRangeMoveRightCommand, targetRange: IRange) => {
+ const range = param.params?.range;
+ if (!range) {
+ return [targetRange];
+ }
+
+ const moveCount = range.endColumn - range.startColumn + 1;
+ const bottomRange: IRange = {
+ ...range,
+ startColumn: range.startColumn,
+ endColumn: Number.POSITIVE_INFINITY,
+ };
+
+ const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
+ const targetMoveRange = Rectangle.getIntersects(bottomRange, targetRange);
+
+ if (!targetMoveRange) {
+ return [targetRange];
+ }
+
+ const matrix = new ObjectMatrix<number>();
+ noMoveRanges.forEach((noMoveRange) => {
+ Range.foreach(noMoveRange, (row, col) => {
+ matrix.setValue(row, col, 1);
+ });
+ });
+
+ targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
+ matrix.setValue(row, col + moveCount, 1);
+ });
+
+ return queryObjectMatrix(matrix, (v) => v === 1);
+};
+
export const handleDeleteRangeMoveLeft = (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => {
const range = param.params?.range;
if (!range) {
@@ -579,6 +648,49 @@ export const handleDeleteRangeMoveLeft = (param: IDeleteRangeMoveLeftCommand, ta
return operators;
};
+export const handleDeleteRangeMoveLeftCommon = (param: IDeleteRangeMoveLeftCommand, targetRange: IRange) => {
+ const range = param.params?.range;
+ if (!range) {
+ return [targetRange];
+ }
+
+ const rightRange: IRange = {
+ startRow: range.startRow,
+ endRow: range.endRow,
+ startColumn: range.startColumn,
+ endColumn: Number.POSITIVE_INFINITY,
+ };
+
+ const moveCount = range.endColumn - range.startColumn + 1;
+ // this range need delete
+ const targetDeleteRange = Rectangle.getIntersects(range, targetRange);
+
+ const noMoveRanges = Rectangle.subtract(targetRange, rightRange);
+ const targetMoveRange = Rectangle.getIntersects(rightRange, targetRange);
+
+ if (!targetDeleteRange && !targetMoveRange) {
+ return [targetRange];
+ }
+
+ const matrix = new ObjectMatrix<number>();
+
+ targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
+ matrix.setValue(row, col - moveCount, 1);
+ });
+
+ targetDeleteRange && Range.foreach(targetDeleteRange, (row, col) => {
+ matrix.setValue(row, col - moveCount, 0);
+ });
+
+ noMoveRanges.forEach((noMoveRange) => {
+ Range.foreach(noMoveRange, (row, col) => {
+ matrix.setValue(row, col, 1);
+ });
+ });
+
+ return queryObjectMatrix(matrix, (v) => v === 1);
+};
+
export const handleDeleteRangeMoveUp = (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => {
const range = param.params?.range;
if (!range) {
@@ -599,6 +711,48 @@ export const handleDeleteRangeMoveUp = (param: IDeleteRangeMoveUpCommand, target
return operators;
};
+export const handleDeleteRangeMoveUpCommon = (param: IDeleteRangeMoveUpCommand, targetRange: IRange) => {
+ const range = param.params?.range;
+ if (!range) {
+ return [targetRange];
+ }
+
+ const bottomRange: IRange = {
+ ...range,
+ startRow: range.startRow,
+ endRow: Number.POSITIVE_INFINITY,
+ };
+
+ const moveCount = range.endRow - range.startRow + 1;
+ // this range need delete
+ const targetDeleteRange = Rectangle.getIntersects(range, targetRange);
+
+ const noMoveRanges = Rectangle.subtract(targetRange, bottomRange);
+ const targetMoveRange = Rectangle.getIntersects(bottomRange, targetRange);
+
+ if (!targetDeleteRange && !targetMoveRange) {
+ return [targetRange];
+ }
+
+ const matrix = new ObjectMatrix<number>();
+
+ targetMoveRange && Range.foreach(targetMoveRange, (row, col) => {
+ matrix.setValue(row - moveCount, col, 1);
+ });
+
+ targetDeleteRange && Range.foreach(targetDeleteRange, (row, col) => {
+ matrix.setValue(row - moveCount, col, 0);
+ });
+
+ noMoveRanges.forEach((noMoveRange) => {
+ Range.foreach(noMoveRange, (row, col) => {
+ matrix.setValue(row, col, 1);
+ });
+ });
+
+ return queryObjectMatrix(matrix, (v) => v === 1);
+};
+
export const runRefRangeMutations = (operators: IOperator[], range: IRange) => {
let result: Nullable<IRange> = { ...range };
operators.forEach((operator) => {
@@ -689,25 +843,20 @@ export const handleDefaultRangeChangeWithEffectRefCommands = (range: IRange, com
return resultRange;
};
-export const handleOtherDefaultRangeChangeWithEffectRefCommands = (range: IRange, commandInfo: ICommandInfo) => {
+export const handleCommonDefaultRangeChangeWithEffectRefCommands = (range: IRange, commandInfo: ICommandInfo) => {
let operator: IOperator[] = [];
switch (commandInfo.id) {
case EffectRefRangId.DeleteRangeMoveLeftCommandId: {
- operator = handleDeleteRangeMoveLeft(commandInfo as IDeleteRangeMoveLeftCommand, range);
- break;
+ return handleDeleteRangeMoveLeftCommon(commandInfo as IDeleteRangeMoveLeftCommand, range);
}
case EffectRefRangId.DeleteRangeMoveUpCommandId: {
- operator = handleDeleteRangeMoveUp(commandInfo as IDeleteRangeMoveUpCommand, range);
- break;
+ return handleDeleteRangeMoveUpCommon(commandInfo as IDeleteRangeMoveUpCommand, range);
}
-
case EffectRefRangId.InsertRangeMoveDownCommandId: {
- operator = handleInsertRangeMoveDown(commandInfo as IInsertRangeMoveDownCommand, range);
- break;
+ return handleInsertRangeMoveDownCommon(commandInfo as IInsertRangeMoveDownCommand, range);
}
case EffectRefRangId.InsertRangeMoveRightCommandId: {
- operator = handleInsertRangeMoveRight(commandInfo as IInsertRangeMoveRightCommand, range);
- break;
+ return handleInsertRangeMoveRightCommon(commandInfo as IInsertRangeMoveRightCommand, range);
}
case EffectRefRangId.InsertColCommandId: {
operator = handleInsertCol(commandInfo as IInsertColCommand, range);
@@ -718,13 +867,13 @@ export const handleOtherDefaultRangeChangeWithEffectRefCommands = (range: IRange
break;
}
case EffectRefRangId.MoveColsCommandId: {
- return handleMoveColsOther(commandInfo as IMoveColsCommand, range);
+ return handleMoveColsCommon(commandInfo as IMoveColsCommand, range);
}
case EffectRefRangId.MoveRangeCommandId: {
- return handleMoveRangeOther(commandInfo as IMoveRangeCommand, range);
+ return handleMoveRangeCommon(commandInfo as IMoveRangeCommand, range);
}
case EffectRefRangId.MoveRowsCommandId: {
- return handleMoveRowsOther(commandInfo as IMoveRowsCommand, range);
+ return handleMoveRowsCommon(commandInfo as IMoveRowsCommand, range);
}
case EffectRefRangId.RemoveColCommandId: {
operator = handleIRemoveCol(commandInfo as IRemoveRowColCommand, range);