@revolist/react-datagrid 4.23.5 → 4.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -6
- package/dist/react-datagrid.js +15 -61
- package/dist/react-datagrid.umd.cjs +17 -62
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -44,17 +44,11 @@ export declare type EditorType = {
|
|
|
44
44
|
|
|
45
45
|
export declare interface ReactElement extends HTMLElement {
|
|
46
46
|
_root?: Root;
|
|
47
|
-
_renderedComponent?: RenderedComponent<any>;
|
|
48
|
-
_templateComponent?: ComponentType<any>;
|
|
49
|
-
_templateKey?: string;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
export declare interface RenderedComponent<T> {
|
|
53
|
-
el: ReactElement;
|
|
54
50
|
update: (newProps: T) => void;
|
|
55
51
|
destroy: () => void;
|
|
56
|
-
scheduleDestroy: () => void;
|
|
57
|
-
cancelDestroy: () => void;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
export declare const RevoGrid: ForwardRefExoticComponent<JSX_2.RevoGrid & Omit<HTMLAttributes<HTMLRevoGridElement>, "style"> & StyleReactProps & RefAttributes<HTMLRevoGridElement>>;
|
package/dist/react-datagrid.js
CHANGED
|
@@ -5,7 +5,6 @@ import { defineCustomElements } from "@revolist/revogrid/loader";
|
|
|
5
5
|
export * from "@revolist/revogrid/loader";
|
|
6
6
|
export * from "@revolist/revogrid";
|
|
7
7
|
import { createRoot } from "react-dom/client";
|
|
8
|
-
import { flushSync } from "react-dom";
|
|
9
8
|
import React, { createElement } from "react";
|
|
10
9
|
import { jsx } from "react/jsx-runtime";
|
|
11
10
|
const dashToPascalCase = (str) => str.toLowerCase().split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
|
|
@@ -169,85 +168,40 @@ const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFun
|
|
|
169
168
|
};
|
|
170
169
|
return createForwardRef(ReactComponent, displayName);
|
|
171
170
|
};
|
|
172
|
-
function TemplateConstructor(el, ReactComponent, initialProps, key
|
|
173
|
-
if (!el) {
|
|
174
|
-
lastEl == null ? void 0 : lastEl.scheduleDestroy();
|
|
175
|
-
return lastEl;
|
|
176
|
-
}
|
|
177
|
-
if (lastEl && lastEl.el !== el) {
|
|
178
|
-
lastEl.destroy();
|
|
179
|
-
}
|
|
180
|
-
if (!el._root) {
|
|
181
|
-
el._root = createRoot(el);
|
|
182
|
-
}
|
|
183
|
-
const renderedComponent = el._renderedComponent;
|
|
184
|
-
if (renderedComponent && el._templateComponent === ReactComponent && el._templateKey === key) {
|
|
185
|
-
renderedComponent.cancelDestroy();
|
|
186
|
-
renderedComponent.update(initialProps);
|
|
187
|
-
return renderedComponent;
|
|
188
|
-
}
|
|
189
|
-
renderedComponent == null ? void 0 : renderedComponent.destroy();
|
|
171
|
+
function TemplateConstructor(el, ReactComponent, initialProps, key) {
|
|
190
172
|
if (!el._root) {
|
|
191
173
|
el._root = createRoot(el);
|
|
192
174
|
}
|
|
193
|
-
const root = el._root;
|
|
194
|
-
let destroyFrame = null;
|
|
195
|
-
let destroyed = false;
|
|
196
175
|
const renderComponent = (props) => {
|
|
176
|
+
var _a;
|
|
197
177
|
const vNode = createElement(ReactComponent, { ...props, key });
|
|
198
|
-
|
|
199
|
-
root.render(vNode);
|
|
200
|
-
});
|
|
178
|
+
(_a = el._root) == null ? void 0 : _a.render(vNode);
|
|
201
179
|
};
|
|
202
180
|
renderComponent(initialProps);
|
|
203
181
|
const update = (newProps) => {
|
|
204
182
|
renderComponent(newProps);
|
|
205
183
|
};
|
|
206
184
|
const destroy = () => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
cancelAnimationFrame(destroyFrame);
|
|
211
|
-
destroyFrame = null;
|
|
212
|
-
}
|
|
213
|
-
root.unmount();
|
|
214
|
-
if (el._root === root) {
|
|
215
|
-
el._root = void 0;
|
|
216
|
-
el._renderedComponent = void 0;
|
|
217
|
-
el._templateComponent = void 0;
|
|
218
|
-
el._templateKey = void 0;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
const scheduleDestroy = () => {
|
|
222
|
-
if (destroyFrame !== null) return;
|
|
223
|
-
destroyFrame = requestAnimationFrame(() => {
|
|
224
|
-
destroyFrame = null;
|
|
225
|
-
if (el.isConnected && el._renderedComponent === component) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
destroy();
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
const cancelDestroy = () => {
|
|
232
|
-
if (destroyFrame === null) return;
|
|
233
|
-
cancelAnimationFrame(destroyFrame);
|
|
234
|
-
destroyFrame = null;
|
|
185
|
+
var _a;
|
|
186
|
+
(_a = el._root) == null ? void 0 : _a.unmount();
|
|
187
|
+
el._root = void 0;
|
|
235
188
|
};
|
|
236
|
-
|
|
237
|
-
el._renderedComponent = component;
|
|
238
|
-
el._templateComponent = ReactComponent;
|
|
239
|
-
el._templateKey = key;
|
|
240
|
-
return component;
|
|
189
|
+
return { update, destroy };
|
|
241
190
|
}
|
|
242
191
|
const Template = (ReactComponent, customProps) => {
|
|
243
192
|
return (h, p, addition) => {
|
|
244
|
-
const props = customProps ? { ...customProps, ...p
|
|
193
|
+
const props = customProps ? { ...customProps, ...p } : p;
|
|
194
|
+
props.addition = addition;
|
|
245
195
|
const key = `${p.prop}-${p.rowIndex || 0}`;
|
|
246
196
|
let lastEl = null;
|
|
247
197
|
return h("span", {
|
|
248
|
-
key,
|
|
249
198
|
ref: (el) => {
|
|
250
|
-
|
|
199
|
+
var _a;
|
|
200
|
+
if (!el) {
|
|
201
|
+
(_a = lastEl == null ? void 0 : lastEl.destroy) == null ? void 0 : _a.call(lastEl);
|
|
202
|
+
} else {
|
|
203
|
+
lastEl = TemplateConstructor(el, ReactComponent, props, key);
|
|
204
|
+
}
|
|
251
205
|
}
|
|
252
206
|
});
|
|
253
207
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@revolist/revogrid/loader"), require("@revolist/revogrid"), require("react-dom/client"), require("react
|
|
3
|
-
})(this, function(exports2, loader, revogrid, client,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@revolist/revogrid/loader"), require("@revolist/revogrid"), require("react-dom/client"), require("react"), require("react/jsx-runtime")) : typeof define === "function" && define.amd ? define(["exports", "@revolist/revogrid/loader", "@revolist/revogrid", "react-dom/client", "react", "react/jsx-runtime"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.ReactDatagrid = {}, global.RevogridLoader, global.Revogrid, global.ReactDOM, global.React, global.ReactJSXR));
|
|
3
|
+
})(this, function(exports2, loader, revogrid, client, React, jsxRuntime) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -166,85 +166,40 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
166
166
|
};
|
|
167
167
|
return createForwardRef(ReactComponent, displayName);
|
|
168
168
|
};
|
|
169
|
-
function TemplateConstructor(el, ReactComponent, initialProps, key
|
|
170
|
-
if (!el) {
|
|
171
|
-
lastEl == null ? void 0 : lastEl.scheduleDestroy();
|
|
172
|
-
return lastEl;
|
|
173
|
-
}
|
|
174
|
-
if (lastEl && lastEl.el !== el) {
|
|
175
|
-
lastEl.destroy();
|
|
176
|
-
}
|
|
177
|
-
if (!el._root) {
|
|
178
|
-
el._root = client.createRoot(el);
|
|
179
|
-
}
|
|
180
|
-
const renderedComponent = el._renderedComponent;
|
|
181
|
-
if (renderedComponent && el._templateComponent === ReactComponent && el._templateKey === key) {
|
|
182
|
-
renderedComponent.cancelDestroy();
|
|
183
|
-
renderedComponent.update(initialProps);
|
|
184
|
-
return renderedComponent;
|
|
185
|
-
}
|
|
186
|
-
renderedComponent == null ? void 0 : renderedComponent.destroy();
|
|
169
|
+
function TemplateConstructor(el, ReactComponent, initialProps, key) {
|
|
187
170
|
if (!el._root) {
|
|
188
171
|
el._root = client.createRoot(el);
|
|
189
172
|
}
|
|
190
|
-
const root = el._root;
|
|
191
|
-
let destroyFrame = null;
|
|
192
|
-
let destroyed = false;
|
|
193
173
|
const renderComponent = (props) => {
|
|
174
|
+
var _a;
|
|
194
175
|
const vNode = React.createElement(ReactComponent, { ...props, key });
|
|
195
|
-
|
|
196
|
-
root.render(vNode);
|
|
197
|
-
});
|
|
176
|
+
(_a = el._root) == null ? void 0 : _a.render(vNode);
|
|
198
177
|
};
|
|
199
178
|
renderComponent(initialProps);
|
|
200
179
|
const update = (newProps) => {
|
|
201
180
|
renderComponent(newProps);
|
|
202
181
|
};
|
|
203
182
|
const destroy = () => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
cancelAnimationFrame(destroyFrame);
|
|
208
|
-
destroyFrame = null;
|
|
209
|
-
}
|
|
210
|
-
root.unmount();
|
|
211
|
-
if (el._root === root) {
|
|
212
|
-
el._root = void 0;
|
|
213
|
-
el._renderedComponent = void 0;
|
|
214
|
-
el._templateComponent = void 0;
|
|
215
|
-
el._templateKey = void 0;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
const scheduleDestroy = () => {
|
|
219
|
-
if (destroyFrame !== null) return;
|
|
220
|
-
destroyFrame = requestAnimationFrame(() => {
|
|
221
|
-
destroyFrame = null;
|
|
222
|
-
if (el.isConnected && el._renderedComponent === component) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
destroy();
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
const cancelDestroy = () => {
|
|
229
|
-
if (destroyFrame === null) return;
|
|
230
|
-
cancelAnimationFrame(destroyFrame);
|
|
231
|
-
destroyFrame = null;
|
|
183
|
+
var _a;
|
|
184
|
+
(_a = el._root) == null ? void 0 : _a.unmount();
|
|
185
|
+
el._root = void 0;
|
|
232
186
|
};
|
|
233
|
-
|
|
234
|
-
el._renderedComponent = component;
|
|
235
|
-
el._templateComponent = ReactComponent;
|
|
236
|
-
el._templateKey = key;
|
|
237
|
-
return component;
|
|
187
|
+
return { update, destroy };
|
|
238
188
|
}
|
|
239
189
|
const Template = (ReactComponent, customProps) => {
|
|
240
190
|
return (h, p, addition) => {
|
|
241
|
-
const props = customProps ? { ...customProps, ...p
|
|
191
|
+
const props = customProps ? { ...customProps, ...p } : p;
|
|
192
|
+
props.addition = addition;
|
|
242
193
|
const key = `${p.prop}-${p.rowIndex || 0}`;
|
|
243
194
|
let lastEl = null;
|
|
244
195
|
return h("span", {
|
|
245
|
-
key,
|
|
246
196
|
ref: (el) => {
|
|
247
|
-
|
|
197
|
+
var _a;
|
|
198
|
+
if (!el) {
|
|
199
|
+
(_a = lastEl == null ? void 0 : lastEl.destroy) == null ? void 0 : _a.call(lastEl);
|
|
200
|
+
} else {
|
|
201
|
+
lastEl = TemplateConstructor(el, ReactComponent, props, key);
|
|
202
|
+
}
|
|
248
203
|
}
|
|
249
204
|
});
|
|
250
205
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolist/react-datagrid",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "4.23.
|
|
4
|
+
"version": "4.23.6",
|
|
5
5
|
"description": "React DataGrid Spreadsheet component with native cell render support",
|
|
6
6
|
"main": "./dist/react-datagrid.umd.cjs",
|
|
7
7
|
"module": "./dist/react-datagrid.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"homepage": "https://github.com/revolist/revogrid#readme",
|
|
65
65
|
"license": "MIT",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@revolist/revogrid": "4.23.
|
|
67
|
+
"@revolist/revogrid": "4.23.6"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@stencil/core": "^4.43.2",
|