@sanity/table 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -4
- package/README.md +6 -24
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +431 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -72
- package/lib/index.cjs +0 -432
- package/lib/index.cjs.map +0 -1
- package/lib/index.d.cts +0 -40
- package/lib/index.d.ts +0 -40
- package/lib/index.js +0 -437
- package/lib/index.js.map +0 -1
- package/sanity.json +0 -8
- package/src/components/TableComponent.tsx +0 -260
- package/src/components/TableIcon.tsx +0 -14
- package/src/components/TableInput.tsx +0 -78
- package/src/components/TableMenu.tsx +0 -144
- package/src/components/TablePreview.tsx +0 -58
- package/src/index.ts +0 -73
- package/v2-incompatible.js +0 -11
package/package.json
CHANGED
|
@@ -1,97 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Table schema type and input component for Sanity Studio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
7
7
|
"sanity-plugin"
|
|
8
8
|
],
|
|
9
|
-
"homepage": "https://github.com/sanity-io/table#readme",
|
|
9
|
+
"homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/@sanity/table#readme",
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/sanity-io/
|
|
11
|
+
"url": "https://github.com/sanity-io/plugins/issues"
|
|
12
12
|
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
15
|
-
"url": "git@github.com
|
|
17
|
+
"url": "git+ssh://git@github.com/sanity-io/plugins.git",
|
|
18
|
+
"directory": "plugins/@sanity/table"
|
|
16
19
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
20
23
|
"type": "module",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
21
25
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
"source": "./src/index.ts",
|
|
24
|
-
"import": "./lib/index.js",
|
|
25
|
-
"require": "./lib/index.cjs",
|
|
26
|
-
"default": "./lib/index.js"
|
|
27
|
-
},
|
|
26
|
+
".": "./dist/index.js",
|
|
28
27
|
"./package.json": "./package.json"
|
|
29
28
|
},
|
|
30
|
-
"main": "./lib/index.cjs",
|
|
31
|
-
"module": "./lib/index.js",
|
|
32
|
-
"types": "./lib/index.d.ts",
|
|
33
|
-
"files": [
|
|
34
|
-
"src",
|
|
35
|
-
"lib",
|
|
36
|
-
"v2-incompatible.js",
|
|
37
|
-
"sanity.json"
|
|
38
|
-
],
|
|
39
|
-
"scripts": {
|
|
40
|
-
"prebuild": "npm run clean && plugin-kit verify-package --silent && pkg-utils",
|
|
41
|
-
"build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
|
|
42
|
-
"clean": "rimraf lib",
|
|
43
|
-
"format": "eslint . --fix --cache && prettier --write .",
|
|
44
|
-
"link-watch": "plugin-kit link-watch",
|
|
45
|
-
"lint": "eslint src --cache && prettier --check src",
|
|
46
|
-
"prepare": "husky install",
|
|
47
|
-
"prepublishOnly": "npm run build",
|
|
48
|
-
"watch": "pkg-utils watch --strict"
|
|
49
|
-
},
|
|
50
|
-
"browserslist": "extends @sanity/browserslist-config",
|
|
51
29
|
"dependencies": {
|
|
52
|
-
"@sanity/icons": "^3.
|
|
53
|
-
"@sanity/
|
|
54
|
-
"@sanity/
|
|
30
|
+
"@sanity/icons": "^3.7.4",
|
|
31
|
+
"@sanity/ui": "^3.2.0",
|
|
32
|
+
"@sanity/uuid": "^3.0.2"
|
|
55
33
|
},
|
|
56
34
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"eslint-config-sanity": "^7.1.2",
|
|
69
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
70
|
-
"eslint-plugin-react": "^7.34.1",
|
|
71
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
72
|
-
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
73
|
-
"husky": "^8.0.2",
|
|
74
|
-
"lint-staged": "^13.0.3",
|
|
75
|
-
"prettier": "^2.7.1",
|
|
76
|
-
"prettier-plugin-packagejson": "^2.3.0",
|
|
77
|
-
"react": "^18",
|
|
78
|
-
"react-dom": "^18",
|
|
79
|
-
"rimraf": "^3.0.2",
|
|
80
|
-
"sanity": "^3.67.1",
|
|
81
|
-
"semantic-release": "^24.2.0",
|
|
82
|
-
"typescript": "^5.7.2"
|
|
35
|
+
"@sanity/pkg-utils": "^10.5.5",
|
|
36
|
+
"@types/node": "^24.13.2",
|
|
37
|
+
"@types/react": "^19.2.17",
|
|
38
|
+
"@types/react-dom": "^19.2.3",
|
|
39
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
40
|
+
"react": "^19.2.7",
|
|
41
|
+
"react-dom": "^19.2.7",
|
|
42
|
+
"sanity": "^6.0.0",
|
|
43
|
+
"styled-components": "^6.4.2",
|
|
44
|
+
"@repo/package.config": "0.0.0",
|
|
45
|
+
"@repo/tsconfig": "0.0.0"
|
|
83
46
|
},
|
|
84
47
|
"peerDependencies": {
|
|
85
|
-
"react": "^
|
|
86
|
-
"
|
|
48
|
+
"react": "^19.2",
|
|
49
|
+
"react-dom": "^19.2",
|
|
50
|
+
"sanity": "^5 || ^6.0.0-0"
|
|
87
51
|
},
|
|
88
52
|
"engines": {
|
|
89
|
-
"node": ">=
|
|
53
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
90
54
|
},
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
},
|
|
94
|
-
"overrides": {
|
|
95
|
-
"conventional-changelog-conventionalcommits": ">=8.0.0"
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "pkg build --strict --check --clean"
|
|
96
57
|
}
|
|
97
|
-
}
|
|
58
|
+
}
|
package/lib/index.cjs
DELETED
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react = require("react"), getRandomValues, rnds8 = new Uint8Array(16);
|
|
4
|
-
function rng() {
|
|
5
|
-
if (!getRandomValues && (getRandomValues = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !getRandomValues))
|
|
6
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
7
|
-
return getRandomValues(rnds8);
|
|
8
|
-
}
|
|
9
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
10
|
-
function validate(uuid) {
|
|
11
|
-
return typeof uuid == "string" && REGEX.test(uuid);
|
|
12
|
-
}
|
|
13
|
-
var byteToHex = [];
|
|
14
|
-
for (var i = 0; i < 256; ++i)
|
|
15
|
-
byteToHex.push((i + 256).toString(16).substr(1));
|
|
16
|
-
function stringify(arr) {
|
|
17
|
-
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
18
|
-
if (!validate(uuid))
|
|
19
|
-
throw TypeError("Stringified UUID is invalid");
|
|
20
|
-
return uuid;
|
|
21
|
-
}
|
|
22
|
-
function v4(options, buf, offset) {
|
|
23
|
-
options = options || {};
|
|
24
|
-
var rnds = options.random || (options.rng || rng)();
|
|
25
|
-
return rnds[6] = rnds[6] & 15 | 64, rnds[8] = rnds[8] & 63 | 128, stringify(rnds);
|
|
26
|
-
}
|
|
27
|
-
const TableInput = (props) => {
|
|
28
|
-
var _a2;
|
|
29
|
-
const updateCell = props.updateCell, renderRowCell = (rowIndex) => function(cell, cellIndex) {
|
|
30
|
-
return /* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31
|
-
ui.TextInput,
|
|
32
|
-
{
|
|
33
|
-
fontSize: 1,
|
|
34
|
-
padding: 3,
|
|
35
|
-
value: cell,
|
|
36
|
-
onChange: (e) => updateCell(e, rowIndex, cellIndex)
|
|
37
|
-
}
|
|
38
|
-
) }, `cell-${rowIndex}-${cellIndex}`);
|
|
39
|
-
}, renderRow = (row, rowIndex) => {
|
|
40
|
-
const renderCell = renderRowCell(rowIndex);
|
|
41
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
42
|
-
row.cells.map(renderCell),
|
|
43
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
-
ui.Button,
|
|
45
|
-
{
|
|
46
|
-
icon: icons.RemoveIcon,
|
|
47
|
-
padding: 2,
|
|
48
|
-
onClick: () => props.removeRow(rowIndex),
|
|
49
|
-
mode: "bleed"
|
|
50
|
-
}
|
|
51
|
-
) }) }, rowIndex)
|
|
52
|
-
] }, `row-${rowIndex}`);
|
|
53
|
-
};
|
|
54
|
-
return /* @__PURE__ */ jsxRuntime.jsx("table", { style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
55
|
-
props.rows.map(renderRow),
|
|
56
|
-
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: (((_a2 = props.rows[0]) == null ? void 0 : _a2.cells) || []).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 1, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
-
ui.Button,
|
|
58
|
-
{
|
|
59
|
-
icon: icons.RemoveIcon,
|
|
60
|
-
padding: 2,
|
|
61
|
-
onClick: () => props.removeColumn(i),
|
|
62
|
-
mode: "bleed"
|
|
63
|
-
}
|
|
64
|
-
) }) }, i)) })
|
|
65
|
-
] }) });
|
|
66
|
-
}, TableMenu = (props) => {
|
|
67
|
-
const { remove: handleRemove } = props, [dialog, setDialog] = react.useState(null), [count, setCount] = react.useState(""), updateCount = (e) => {
|
|
68
|
-
setCount(e.currentTarget.value);
|
|
69
|
-
}, addRows = () => {
|
|
70
|
-
setDialog({ type: "rows", callback: (c) => props.addRows(c) });
|
|
71
|
-
}, addRowAt = () => {
|
|
72
|
-
setDialog({ type: "rows", callback: (index) => props.addRowAt(index) });
|
|
73
|
-
}, addColumns = () => {
|
|
74
|
-
setDialog({
|
|
75
|
-
type: "columns",
|
|
76
|
-
callback: (c) => props.addColumns(c)
|
|
77
|
-
});
|
|
78
|
-
}, addColumnsAt = () => {
|
|
79
|
-
setDialog({ type: "columns", callback: (index) => props.addColumnAt(index) });
|
|
80
|
-
}, onConfirm = () => {
|
|
81
|
-
const parsedCount = parseInt(count != null ? count : "0", 10);
|
|
82
|
-
parsedCount < 100 && (setDialog(null), dialog == null || dialog.callback(parsedCount), setCount(void 0));
|
|
83
|
-
};
|
|
84
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
85
|
-
dialog && /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
-
ui.Dialog,
|
|
87
|
-
{
|
|
88
|
-
header: `Add ${dialog.type}`,
|
|
89
|
-
id: "dialog-add",
|
|
90
|
-
onClose: () => setDialog(null),
|
|
91
|
-
zOffset: 1e3,
|
|
92
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { padding: 4, children: [
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
-
ui.TextInput,
|
|
95
|
-
{
|
|
96
|
-
style: { textAlign: "left" },
|
|
97
|
-
fontSize: 2,
|
|
98
|
-
padding: 3,
|
|
99
|
-
type: "number",
|
|
100
|
-
value: count,
|
|
101
|
-
onChange: updateCount
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 1, style: { textAlign: "right" }, children: [
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
-
ui.Button,
|
|
107
|
-
{
|
|
108
|
-
text: "Cancel",
|
|
109
|
-
mode: "ghost",
|
|
110
|
-
onClick: () => setDialog(null)
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { text: "Confirm", tone: "critical", onClick: onConfirm })
|
|
114
|
-
] }) })
|
|
115
|
-
] })
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
-
ui.MenuButton,
|
|
120
|
-
{
|
|
121
|
-
button: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { icon: icons.ControlsIcon, fontSize: 1, padding: 2, mode: "ghost" }),
|
|
122
|
-
id: "menu-button-example",
|
|
123
|
-
menu: /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, { children: [
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
-
ui.MenuItem,
|
|
126
|
-
{
|
|
127
|
-
icon: icons.AddIcon,
|
|
128
|
-
fontSize: 1,
|
|
129
|
-
text: "Add Row(s)",
|
|
130
|
-
onClick: addRows
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
-
ui.MenuItem,
|
|
135
|
-
{
|
|
136
|
-
icon: icons.AddIcon,
|
|
137
|
-
fontSize: 1,
|
|
138
|
-
text: "Add Row At Index",
|
|
139
|
-
onClick: addRowAt
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
-
ui.MenuItem,
|
|
144
|
-
{
|
|
145
|
-
icon: icons.AddIcon,
|
|
146
|
-
fontSize: 1,
|
|
147
|
-
text: "Add Column(s)",
|
|
148
|
-
onClick: addColumns
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
152
|
-
ui.MenuItem,
|
|
153
|
-
{
|
|
154
|
-
icon: icons.AddIcon,
|
|
155
|
-
fontSize: 1,
|
|
156
|
-
text: "Add Column At Index",
|
|
157
|
-
onClick: addColumnsAt
|
|
158
|
-
}
|
|
159
|
-
),
|
|
160
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}),
|
|
161
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
162
|
-
ui.MenuItem,
|
|
163
|
-
{
|
|
164
|
-
icon: icons.WarningOutlineIcon,
|
|
165
|
-
fontSize: 1,
|
|
166
|
-
text: "Remove",
|
|
167
|
-
tone: "critical",
|
|
168
|
-
onClick: handleRemove
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
] }),
|
|
172
|
-
popover: { placement: props.placement }
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
] });
|
|
176
|
-
};
|
|
177
|
-
var __defProp = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
|
|
178
|
-
for (var prop in b || (b = {}))
|
|
179
|
-
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
180
|
-
if (__getOwnPropSymbols)
|
|
181
|
-
for (var prop of __getOwnPropSymbols(b))
|
|
182
|
-
__propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
183
|
-
return a;
|
|
184
|
-
}, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)), _a;
|
|
185
|
-
const deepClone = (_a = globalThis.structuredClone) != null ? _a : (data) => JSON.parse(JSON.stringify(data)), TableComponent = (props) => {
|
|
186
|
-
var _a2, _b, _c;
|
|
187
|
-
const { rowType = "tableRow", value, onChange } = props, [dialog, setDialog] = react.useState(null), updateValue = (v) => onChange(sanity.set(v)), resetValue = () => onChange(sanity.unset()), createTable = () => {
|
|
188
|
-
const newValue = {
|
|
189
|
-
rows: [
|
|
190
|
-
{
|
|
191
|
-
_type: rowType,
|
|
192
|
-
_key: v4(),
|
|
193
|
-
cells: ["", ""]
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
_type: rowType,
|
|
197
|
-
_key: v4(),
|
|
198
|
-
cells: ["", ""]
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
};
|
|
202
|
-
return updateValue(__spreadValues(__spreadValues({}, value), newValue));
|
|
203
|
-
}, confirmRemoveTable = () => {
|
|
204
|
-
setDialog({ type: "table", callback: removeTable });
|
|
205
|
-
}, removeTable = () => {
|
|
206
|
-
resetValue(), setDialog(null);
|
|
207
|
-
}, addRows = (count = 1) => {
|
|
208
|
-
var _a3;
|
|
209
|
-
if (!value)
|
|
210
|
-
return;
|
|
211
|
-
const newValue = deepClone(value), columnCount = (_a3 = value == null ? void 0 : value.rows[0].cells.length) != null ? _a3 : 0;
|
|
212
|
-
for (let i = 0; i < count; i++)
|
|
213
|
-
newValue.rows.push({
|
|
214
|
-
_type: rowType,
|
|
215
|
-
_key: v4(),
|
|
216
|
-
cells: Array(columnCount).fill("")
|
|
217
|
-
});
|
|
218
|
-
return updateValue(newValue);
|
|
219
|
-
}, addRowAt = (index = 0) => {
|
|
220
|
-
if (!value)
|
|
221
|
-
return;
|
|
222
|
-
const newValue = deepClone(value), columnCount = value.rows[0].cells.length;
|
|
223
|
-
return newValue.rows.splice(index, 0, {
|
|
224
|
-
_type: rowType,
|
|
225
|
-
_key: v4(),
|
|
226
|
-
cells: Array(columnCount).fill("")
|
|
227
|
-
}), updateValue(newValue);
|
|
228
|
-
}, removeRow = (index) => {
|
|
229
|
-
if (!value)
|
|
230
|
-
return;
|
|
231
|
-
const newValue = deepClone(value);
|
|
232
|
-
newValue.rows.splice(index, 1), updateValue(newValue), setDialog(null);
|
|
233
|
-
}, confirmRemoveRow = (index) => {
|
|
234
|
-
if (value)
|
|
235
|
-
return value.rows.length <= 1 ? confirmRemoveTable() : setDialog({ type: "row", callback: () => removeRow(index) });
|
|
236
|
-
}, confirmRemoveColumn = (index) => {
|
|
237
|
-
if (value)
|
|
238
|
-
return value.rows[0].cells.length <= 1 ? confirmRemoveTable() : setDialog({ type: "column", callback: () => removeColumn(index) });
|
|
239
|
-
}, addColumns = (count) => {
|
|
240
|
-
if (!value)
|
|
241
|
-
return;
|
|
242
|
-
const newValue = deepClone(value);
|
|
243
|
-
return newValue.rows.forEach((_, i) => {
|
|
244
|
-
for (let j = 0; j < count; j++)
|
|
245
|
-
newValue.rows[i].cells.push("");
|
|
246
|
-
}), updateValue(newValue);
|
|
247
|
-
}, addColumnAt = (index) => {
|
|
248
|
-
if (!value)
|
|
249
|
-
return;
|
|
250
|
-
const newValue = deepClone(value);
|
|
251
|
-
return newValue.rows.forEach((_, i) => {
|
|
252
|
-
newValue.rows[i].cells.splice(index, 0, "");
|
|
253
|
-
}), updateValue(newValue);
|
|
254
|
-
}, removeColumn = (index) => {
|
|
255
|
-
if (!value)
|
|
256
|
-
return;
|
|
257
|
-
const newValue = deepClone(value);
|
|
258
|
-
newValue.rows.forEach((row) => {
|
|
259
|
-
row.cells.splice(index, 1);
|
|
260
|
-
}), updateValue(newValue), setDialog(null);
|
|
261
|
-
}, updateCell = (e, rowIndex, cellIndex) => {
|
|
262
|
-
if (!value)
|
|
263
|
-
return;
|
|
264
|
-
const newValue = deepClone(value);
|
|
265
|
-
return newValue.rows[rowIndex].cells[cellIndex] = e.target.value, updateValue(newValue);
|
|
266
|
-
};
|
|
267
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
268
|
-
dialog && /* @__PURE__ */ jsxRuntime.jsx(
|
|
269
|
-
ui.Dialog,
|
|
270
|
-
{
|
|
271
|
-
header: `Remove ${dialog.type}`,
|
|
272
|
-
id: "dialog-remove",
|
|
273
|
-
onClose: () => setDialog(null),
|
|
274
|
-
zOffset: 1e3,
|
|
275
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { padding: 4, children: [
|
|
276
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
277
|
-
"Are you sure you want to remove this ",
|
|
278
|
-
dialog.type,
|
|
279
|
-
"?"
|
|
280
|
-
] }),
|
|
281
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 1, style: { textAlign: "right" }, children: [
|
|
282
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
283
|
-
ui.Button,
|
|
284
|
-
{
|
|
285
|
-
text: "Cancel",
|
|
286
|
-
mode: "ghost",
|
|
287
|
-
onClick: () => setDialog(null)
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
-
ui.Button,
|
|
292
|
-
{
|
|
293
|
-
text: "Confirm",
|
|
294
|
-
tone: "critical",
|
|
295
|
-
onClick: () => dialog.callback()
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] }) })
|
|
299
|
-
] })
|
|
300
|
-
}
|
|
301
|
-
),
|
|
302
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-end", children: ((_a2 = value == null ? void 0 : value.rows) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
303
|
-
TableMenu,
|
|
304
|
-
{
|
|
305
|
-
addColumns,
|
|
306
|
-
addColumnAt,
|
|
307
|
-
addRows,
|
|
308
|
-
addRowAt,
|
|
309
|
-
remove: confirmRemoveTable,
|
|
310
|
-
placement: "left"
|
|
311
|
-
}
|
|
312
|
-
) }) }),
|
|
313
|
-
((_b = value == null ? void 0 : value.rows) == null ? void 0 : _b.length) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
314
|
-
TableInput,
|
|
315
|
-
{
|
|
316
|
-
rows: value.rows,
|
|
317
|
-
removeRow: confirmRemoveRow,
|
|
318
|
-
removeColumn: confirmRemoveColumn,
|
|
319
|
-
updateCell
|
|
320
|
-
}
|
|
321
|
-
),
|
|
322
|
-
(!value || !((_c = value == null ? void 0 : value.rows) != null && _c.length)) && /* @__PURE__ */ jsxRuntime.jsx(ui.Inline, { space: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
-
ui.Button,
|
|
324
|
-
{
|
|
325
|
-
fontSize: 1,
|
|
326
|
-
padding: 3,
|
|
327
|
-
icon: icons.AddIcon,
|
|
328
|
-
text: "Create Table",
|
|
329
|
-
tone: "primary",
|
|
330
|
-
mode: "ghost",
|
|
331
|
-
onClick: createTable
|
|
332
|
-
}
|
|
333
|
-
) })
|
|
334
|
-
] });
|
|
335
|
-
};
|
|
336
|
-
function createTableComponent(rowType) {
|
|
337
|
-
return function(props) {
|
|
338
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TableComponent, __spreadProps(__spreadValues({}, props), { rowType }));
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
function TableIcon() {
|
|
342
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
-
"svg",
|
|
344
|
-
{
|
|
345
|
-
width: "1em",
|
|
346
|
-
height: "1em",
|
|
347
|
-
viewBox: "0 0 25 25",
|
|
348
|
-
fill: "none",
|
|
349
|
-
stroke: "currentColor",
|
|
350
|
-
strokeWidth: "1.2",
|
|
351
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 3h18v18H3zM21 9H3M21 15H3M12 3v18" })
|
|
352
|
-
}
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
const Table = ({ rows }) => {
|
|
356
|
-
const numCols = rows.length === 0 ? 0 : rows[0].cells.length;
|
|
357
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Grid, { columns: numCols, padding: 2, children: rows.map(
|
|
358
|
-
(row) => row.cells.map((cell, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
359
|
-
ui.Card,
|
|
360
|
-
{
|
|
361
|
-
padding: 2,
|
|
362
|
-
style: { outline: "1px solid #DFE2E9" },
|
|
363
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { style: { textOverflow: "elipsis" }, children: cell })
|
|
364
|
-
},
|
|
365
|
-
row._key + i
|
|
366
|
-
))
|
|
367
|
-
) });
|
|
368
|
-
}, TablePreview = (props) => {
|
|
369
|
-
var _a2;
|
|
370
|
-
const { schemaType, rows = [], title = "Title missing" } = props;
|
|
371
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
372
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 3, children: [
|
|
373
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 4, children: /* @__PURE__ */ jsxRuntime.jsx(TableIcon, {}) }) }),
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: (_a2 = schemaType == null ? void 0 : schemaType.title) != null ? _a2 : title }) })
|
|
375
|
-
] }) }),
|
|
376
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !0, children: "Empty Table" }) : /* @__PURE__ */ jsxRuntime.jsx(Table, { rows }) })
|
|
377
|
-
] });
|
|
378
|
-
}, table = sanity.definePlugin((config) => {
|
|
379
|
-
const tableRowSchema = sanity.defineType({
|
|
380
|
-
title: "Table Row",
|
|
381
|
-
name: (config == null ? void 0 : config.rowType) || "tableRow",
|
|
382
|
-
type: "object",
|
|
383
|
-
fields: [
|
|
384
|
-
{
|
|
385
|
-
name: "cells",
|
|
386
|
-
type: "array",
|
|
387
|
-
of: [{ type: "string" }]
|
|
388
|
-
}
|
|
389
|
-
]
|
|
390
|
-
}), tableSchema = sanity.defineType({
|
|
391
|
-
title: "Table",
|
|
392
|
-
name: "table",
|
|
393
|
-
type: "object",
|
|
394
|
-
fields: [
|
|
395
|
-
{
|
|
396
|
-
name: "rows",
|
|
397
|
-
type: "array",
|
|
398
|
-
of: [
|
|
399
|
-
{
|
|
400
|
-
type: tableRowSchema.name
|
|
401
|
-
}
|
|
402
|
-
]
|
|
403
|
-
}
|
|
404
|
-
],
|
|
405
|
-
components: {
|
|
406
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
407
|
-
input: createTableComponent(tableRowSchema.name),
|
|
408
|
-
preview: TablePreview
|
|
409
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
410
|
-
},
|
|
411
|
-
preview: {
|
|
412
|
-
select: {
|
|
413
|
-
rows: "rows",
|
|
414
|
-
title: "title"
|
|
415
|
-
},
|
|
416
|
-
prepare: ({ title, rows = [] }) => ({
|
|
417
|
-
title,
|
|
418
|
-
rows
|
|
419
|
-
})
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
return {
|
|
423
|
-
name: "table",
|
|
424
|
-
schema: {
|
|
425
|
-
types: [tableRowSchema, tableSchema]
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
});
|
|
429
|
-
exports.TableComponent = TableComponent;
|
|
430
|
-
exports.TablePreview = TablePreview;
|
|
431
|
-
exports.table = table;
|
|
432
|
-
//# sourceMappingURL=index.cjs.map
|
package/lib/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../node_modules/@sanity/uuid/node_modules/uuid/dist/esm-browser/rng.js","../node_modules/@sanity/uuid/node_modules/uuid/dist/esm-browser/regex.js","../node_modules/@sanity/uuid/node_modules/uuid/dist/esm-browser/validate.js","../node_modules/@sanity/uuid/node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/@sanity/uuid/node_modules/uuid/dist/esm-browser/v4.js","../src/components/TableInput.tsx","../src/components/TableMenu.tsx","../src/components/TableComponent.tsx","../src/components/TableIcon.tsx","../src/components/TablePreview.tsx","../src/index.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","import { RemoveIcon } from '@sanity/icons';\nimport { Box, Button, TextInput } from '@sanity/ui';\nimport type { FormEvent } from 'react';\n\nimport type { TableRow } from './TableComponent';\n\ninterface TableInputProps {\n rows: TableRow[];\n updateCell: (\n e: FormEvent<HTMLInputElement>,\n rowIndex: number,\n cellIndex: number\n ) => void;\n removeRow: (index: number) => void;\n removeColumn: (index: number) => void;\n}\n\nexport const TableInput = (props: TableInputProps) => {\n const updateCell = props.updateCell;\n\n const renderRowCell = (rowIndex: number) =>\n function RowCell(cell: string, cellIndex: number) {\n return (\n <td key={`cell-${rowIndex}-${cellIndex}`}>\n <TextInput\n fontSize={1}\n padding={3}\n value={cell}\n onChange={e => updateCell(e, rowIndex, cellIndex)}\n />\n </td>\n );\n };\n\n const renderRow = (row: TableRow, rowIndex: number) => {\n const renderCell = renderRowCell(rowIndex);\n\n return (\n <tr key={`row-${rowIndex}`}>\n {row.cells.map(renderCell)}\n {\n <td key={rowIndex}>\n <Box marginLeft={1} style={{ textAlign: 'center' }}>\n <Button\n icon={RemoveIcon}\n padding={2}\n onClick={() => props.removeRow(rowIndex)}\n mode=\"bleed\"\n />\n </Box>\n </td>\n }\n </tr>\n );\n };\n\n return (\n <table style={{ width: '100%' }}>\n <tbody>\n {props.rows.map(renderRow)}\n <tr>\n {(props.rows[0]?.cells || []).map((_, i) => (\n <td key={i}>\n <Box marginTop={1} style={{ textAlign: 'center' }}>\n <Button\n icon={RemoveIcon}\n padding={2}\n onClick={() => props.removeColumn(i)}\n mode=\"bleed\"\n />\n </Box>\n </td>\n ))}\n </tr>\n </tbody>\n </table>\n );\n};\n","import { AddIcon, ControlsIcon, WarningOutlineIcon } from '@sanity/icons';\nimport {\n Box,\n Button,\n Card,\n Dialog,\n Inline,\n Menu,\n MenuButton,\n MenuDivider,\n MenuItem,\n Placement,\n TextInput,\n} from '@sanity/ui';\nimport { type FormEventHandler, useState } from 'react';\n\ninterface TableMenuProps {\n addColumns: (count: number) => void;\n addColumnAt: (index: number) => void;\n addRows: (count: number) => void;\n addRowAt: (index: number) => void;\n remove: () => void;\n placement: Placement;\n}\n\nexport const TableMenu = (props: TableMenuProps) => {\n const { remove: handleRemove } = props;\n const [dialog, setDialog] = useState<{\n type: string;\n callback: (count: number) => void;\n } | null>(null);\n\n const [count, setCount] = useState<string | undefined>('');\n\n const updateCount: FormEventHandler<HTMLInputElement> = e => {\n setCount(e.currentTarget.value);\n };\n\n const addRows = () => {\n setDialog({ type: 'rows', callback: c => props.addRows(c) });\n };\n\n const addRowAt = () => {\n setDialog({ type: 'rows', callback: index => props.addRowAt(index) });\n };\n\n const addColumns = () => {\n setDialog({\n type: 'columns',\n callback: c => props.addColumns(c),\n });\n };\n\n const addColumnsAt = () => {\n setDialog({ type: 'columns', callback: index => props.addColumnAt(index) });\n };\n\n const onConfirm = () => {\n const parsedCount = parseInt(count ?? '0', 10);\n\n if (parsedCount < 100) {\n setDialog(null);\n dialog?.callback(parsedCount);\n setCount(undefined);\n }\n };\n\n return (\n <>\n {dialog && (\n <Dialog\n header={`Add ${dialog.type}`}\n id=\"dialog-add\"\n onClose={() => setDialog(null)}\n zOffset={1000}\n >\n <Card padding={4}>\n <TextInput\n style={{ textAlign: 'left' }}\n fontSize={2}\n padding={3}\n type=\"number\"\n value={count}\n onChange={updateCount}\n />\n <Box marginTop={4}>\n <Inline space={1} style={{ textAlign: 'right' }}>\n <Button\n text=\"Cancel\"\n mode=\"ghost\"\n onClick={() => setDialog(null)}\n />\n <Button text=\"Confirm\" tone=\"critical\" onClick={onConfirm} />\n </Inline>\n </Box>\n </Card>\n </Dialog>\n )}\n <MenuButton\n button={\n <Button icon={ControlsIcon} fontSize={1} padding={2} mode=\"ghost\" />\n }\n id=\"menu-button-example\"\n menu={\n <Menu>\n <MenuItem\n icon={AddIcon}\n fontSize={1}\n text=\"Add Row(s)\"\n onClick={addRows}\n />\n <MenuItem\n icon={AddIcon}\n fontSize={1}\n text=\"Add Row At Index\"\n onClick={addRowAt}\n />\n <MenuItem\n icon={AddIcon}\n fontSize={1}\n text=\"Add Column(s)\"\n onClick={addColumns}\n />\n <MenuItem\n icon={AddIcon}\n fontSize={1}\n text=\"Add Column At Index\"\n onClick={addColumnsAt}\n />\n <MenuDivider />\n <MenuItem\n icon={WarningOutlineIcon}\n fontSize={1}\n text=\"Remove\"\n tone=\"critical\"\n onClick={handleRemove}\n />\n </Menu>\n }\n popover={{ placement: props.placement }}\n />\n </>\n );\n};\n","/* eslint-disable consistent-return */\nimport { AddIcon } from '@sanity/icons';\nimport { Box, Button, Card, Dialog, Flex, Inline, Text } from '@sanity/ui';\nimport { uuid } from '@sanity/uuid';\nimport { type FormEvent, useState } from 'react';\nimport { type ObjectInputProps, set, unset } from 'sanity';\n\nimport { TableInput } from './TableInput';\nimport { TableMenu } from './TableMenu';\n\nconst deepClone: <T>(data: T) => T =\n globalThis.structuredClone ?? (data => JSON.parse(JSON.stringify(data)));\n\nexport interface TableValue {\n _type: 'table';\n rows: TableRow[];\n}\n\nexport type TableProps = ObjectInputProps<TableValue>;\n\nexport type TableRow = {\n _type: string;\n _key: string;\n cells: string[];\n};\n\n// TODO refactor deeplone stuff to use proper patches\n// TODO use callback all the things\n\nexport const TableComponent = (props: TableProps & { rowType?: string }) => {\n const { rowType = 'tableRow', value, onChange } = props;\n const [dialog, setDialog] = useState<{\n type: string;\n callback: () => void;\n } | null>(null);\n\n const updateValue = (v?: Omit<TableValue, '_type'>) => {\n return onChange(set(v));\n };\n\n const resetValue = () => {\n return onChange(unset());\n };\n\n const createTable = () => {\n const newValue: Omit<TableValue, '_type'> = {\n rows: [\n {\n _type: rowType,\n _key: uuid(),\n cells: ['', ''],\n },\n {\n _type: rowType,\n _key: uuid(),\n cells: ['', ''],\n },\n ],\n };\n return updateValue({ ...value, ...newValue });\n };\n\n const confirmRemoveTable = () => {\n setDialog({ type: 'table', callback: removeTable });\n };\n\n const removeTable = () => {\n resetValue();\n setDialog(null);\n };\n\n const addRows = (count = 1) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n // Calculate the column count from the first row\n const columnCount = value?.rows[0].cells.length ?? 0;\n for (let i = 0; i < count; i++) {\n // Add as many cells as we have columns\n newValue.rows.push({\n _type: rowType,\n _key: uuid(),\n cells: Array(columnCount).fill(''),\n });\n }\n // eslint-disable-next-line consistent-return\n return updateValue(newValue);\n };\n\n const addRowAt = (index = 0) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n // Calculate the column count from the first row\n const columnCount = value.rows[0].cells.length;\n\n newValue.rows.splice(index, 0, {\n _type: rowType,\n _key: uuid(),\n cells: Array(columnCount).fill(''),\n });\n\n // eslint-disable-next-line consistent-return\n return updateValue(newValue);\n };\n\n const removeRow = (index: number) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n newValue.rows.splice(index, 1);\n updateValue(newValue);\n setDialog(null);\n };\n\n const confirmRemoveRow = (index: number) => {\n if (!value) {\n return;\n }\n if (value.rows.length <= 1) return confirmRemoveTable();\n return setDialog({ type: 'row', callback: () => removeRow(index) });\n };\n\n const confirmRemoveColumn = (index: number) => {\n if (!value) {\n return;\n }\n if (value.rows[0].cells.length <= 1) return confirmRemoveTable();\n return setDialog({ type: 'column', callback: () => removeColumn(index) });\n };\n\n const addColumns = (count: number) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n // Add a cell to each of the rows\n newValue.rows.forEach((_, i) => {\n for (let j = 0; j < count; j++) {\n newValue.rows[i].cells.push('');\n }\n });\n return updateValue(newValue);\n };\n\n const addColumnAt = (index: number) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n\n newValue.rows.forEach((_, i) => {\n newValue.rows[i].cells.splice(index, 0, '');\n });\n\n return updateValue(newValue);\n };\n\n const removeColumn = (index: number) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n newValue.rows.forEach(row => {\n row.cells.splice(index, 1);\n });\n updateValue(newValue);\n setDialog(null);\n };\n\n const updateCell = (\n e: FormEvent<HTMLInputElement>,\n rowIndex: number,\n cellIndex: number\n ) => {\n if (!value) {\n return;\n }\n const newValue = deepClone(value);\n newValue.rows[rowIndex].cells[cellIndex] = (\n e.target as HTMLInputElement\n ).value;\n return updateValue(newValue);\n };\n\n return (\n <div>\n {dialog && (\n <Dialog\n header={`Remove ${dialog.type}`}\n id=\"dialog-remove\"\n onClose={() => setDialog(null)}\n zOffset={1000}\n >\n <Card padding={4}>\n <Text>Are you sure you want to remove this {dialog.type}?</Text>\n <Box marginTop={4}>\n <Inline space={1} style={{ textAlign: 'right' }}>\n <Button\n text=\"Cancel\"\n mode=\"ghost\"\n onClick={() => setDialog(null)}\n />\n <Button\n text=\"Confirm\"\n tone=\"critical\"\n onClick={() => dialog.callback()}\n />\n </Inline>\n </Box>\n </Card>\n </Dialog>\n )}\n <Box>\n <Flex justify=\"flex-end\">\n {value?.rows?.length && (\n <TableMenu\n addColumns={addColumns}\n addColumnAt={addColumnAt}\n addRows={addRows}\n addRowAt={addRowAt}\n remove={confirmRemoveTable}\n placement=\"left\"\n />\n )}\n </Flex>\n </Box>\n {value?.rows?.length && (\n <TableInput\n rows={value.rows}\n removeRow={confirmRemoveRow}\n removeColumn={confirmRemoveColumn}\n updateCell={updateCell}\n />\n )}\n {(!value || !value?.rows?.length) && (\n <Inline space={1}>\n <Button\n fontSize={1}\n padding={3}\n icon={AddIcon}\n text=\"Create Table\"\n tone=\"primary\"\n mode=\"ghost\"\n onClick={createTable}\n />\n </Inline>\n )}\n </div>\n );\n};\n\nexport function createTableComponent(rowType: string) {\n return function Table(props: TableProps) {\n return <TableComponent {...props} rowType={rowType} />;\n };\n}\n","export function TableIcon() {\n return (\n <svg\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 25 25\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.2\"\n >\n <path d=\"M3 3h18v18H3zM21 9H3M21 15H3M12 3v18\" />\n </svg>\n );\n}\n","import { Box, Card, Grid, Inline, Label, Text } from '@sanity/ui';\nimport type { PreviewProps } from 'sanity';\n\nimport type { TableRow } from './TableComponent';\nimport { TableIcon } from './TableIcon';\n\ninterface ValueProps {\n rows?: TableRow[];\n title?: string;\n}\n\nconst Table = ({ rows }: { rows: TableRow[] }) => {\n const numCols = rows.length === 0 ? 0 : rows[0].cells.length;\n\n return (\n <Grid columns={numCols} padding={2}>\n {rows.map(row =>\n row.cells.map((cell, i) => (\n <Card\n key={row._key + i}\n padding={2}\n style={{ outline: '1px solid #DFE2E9' }}\n >\n <Text style={{ textOverflow: 'elipsis' }}>{cell}</Text>\n </Card>\n ))\n )}\n </Grid>\n );\n};\n\nexport const TablePreview = (props: ValueProps & PreviewProps) => {\n const { schemaType, rows = [], title = 'Title missing' } = props;\n\n return (\n <>\n <Box padding={3}>\n <Inline space={3}>\n <Card>\n <Label size={4}>\n <TableIcon />\n </Label>\n </Card>\n <Card>\n <Text>{schemaType?.title ?? title}</Text>\n </Card>\n </Inline>\n </Box>\n <Box padding={2}>\n {rows.length === 0 ? (\n <Label muted>Empty Table</Label>\n ) : (\n <Table rows={rows} />\n )}\n </Box>\n </>\n );\n};\n","import { definePlugin, defineType } from 'sanity';\n\nimport {\n createTableComponent,\n TableComponent,\n} from './components/TableComponent';\nimport { TablePreview } from './components/TablePreview';\nexport type {\n TableProps,\n TableRow,\n TableValue,\n} from './components/TableComponent';\n\nexport { TableComponent, TablePreview };\n\nexport interface TableConfig {\n rowType?: string;\n}\n\nexport const table = definePlugin<TableConfig | void>(config => {\n const tableRowSchema = defineType({\n title: 'Table Row',\n name: config?.rowType || 'tableRow',\n type: 'object',\n fields: [\n {\n name: 'cells',\n type: 'array',\n of: [{ type: 'string' }],\n },\n ],\n });\n\n const tableSchema = defineType({\n title: 'Table',\n name: 'table',\n type: 'object',\n fields: [\n {\n name: 'rows',\n type: 'array',\n of: [\n {\n type: tableRowSchema.name,\n },\n ],\n },\n ],\n components: {\n /* eslint-disable @typescript-eslint/no-explicit-any */\n input: createTableComponent(tableRowSchema.name) as any,\n preview: TablePreview as any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n },\n preview: {\n select: {\n rows: 'rows',\n title: 'title',\n },\n prepare: ({ title, rows = [] }) => ({\n title,\n rows,\n }),\n },\n });\n\n return {\n name: 'table',\n schema: {\n types: [tableRowSchema, tableSchema],\n },\n };\n});\n"],"names":["_a","jsx","TextInput","Box","Button","RemoveIcon","useState","jsxs","Fragment","Dialog","Card","Inline","MenuButton","ControlsIcon","Menu","MenuItem","AddIcon","MenuDivider","WarningOutlineIcon","set","unset","uuid","Text","Flex","Grid","Label","definePlugin","defineType"],"mappings":";;mKAGI,iBACA,QAAQ,IAAI,WAAW,EAAE;AACd,SAAS,MAAM;AAE5B,MAAI,CAAC,oBAGH,kBAAkB,OAAO,SAAW,OAAe,OAAO,mBAAmB,OAAO,gBAAgB,KAAK,MAAM,KAAK,OAAO,WAAa,OAAe,OAAO,SAAS,mBAAoB,cAAc,SAAS,gBAAgB,KAAK,QAAQ,GAE3O,CAAC;AACH,UAAM,IAAI,MAAM,0GAA0G;AAI9H,SAAO,gBAAgB,KAAK;AAC9B;AClBA,IAAA,QAAe;ACEf,S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