@genesislcap/grid-tabulator 14.424.1 → 14.425.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.
Files changed (3) hide show
  1. package/dist/react.cjs +56 -14
  2. package/dist/react.mjs +56 -14
  3. package/package.json +13 -14
package/dist/react.cjs CHANGED
@@ -5,31 +5,73 @@
5
5
 
6
6
  'use strict';
7
7
 
8
- const { provideReactWrapper } = require('@microsoft/fast-react-wrapper');
9
8
  const React = require('react');
10
9
  const { GridTabulatorCell: GridTabulatorCellWC } = require('./esm/cell/cell.js');
11
10
  const { GridTabulatorColumn: GridTabulatorColumnWC } = require('./esm/column/column.js');
12
11
  const { GridTabulatorClientSideDatasource: GridTabulatorClientSideDatasourceWC } = require('./esm/datasource/client-side.datasource.js');
13
12
  const { GridTabulator: GridTabulatorWC } = require('./esm/grid-tabulator.js');
14
13
 
15
- const { wrap } = provideReactWrapper(React);
14
+ function _mergeRefs(...refs) {
15
+ return (value) => {
16
+ for (const ref of refs) {
17
+ if (typeof ref === 'function') ref(value);
18
+ else if (ref != null) ref.current = value;
19
+ }
20
+ };
21
+ }
16
22
 
17
- const GridTabulator = wrap(GridTabulatorWC, {
18
- events: {
19
- onGridReady: 'gridReady',
20
- },
23
+ const GridTabulator = React.forwardRef(function GridTabulator(props, ref) {
24
+ const { onGridReady, children, ...rest } = props;
25
+ const _innerRef = React.useRef(null);
26
+ const _onGridReadyRef = React.useRef(onGridReady);
27
+ _onGridReadyRef.current = onGridReady;
28
+ React.useLayoutEffect(() => {
29
+ const el = _innerRef.current;
30
+ if (!el) return;
31
+ const _onGridReadyFn = (e) => _onGridReadyRef.current?.(e);
32
+ el.addEventListener('gridReady', _onGridReadyFn);
33
+ return () => {
34
+ el.removeEventListener('gridReady', _onGridReadyFn);
35
+ };
36
+ }, []);
37
+ return React.createElement(customElements.getName(GridTabulatorWC) ?? '%%prefix%%-grid-tabulator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
21
38
  });
22
39
 
23
- const GridTabulatorCell = wrap(GridTabulatorCellWC);
40
+ const GridTabulatorCell = React.forwardRef(function GridTabulatorCell(props, ref) {
41
+ const { children, ...rest } = props;
42
+ return React.createElement(customElements.getName(GridTabulatorCellWC) ?? 'grid-tabulator-cell', { ...rest, ref }, children);
43
+ });
24
44
 
25
- const GridTabulatorColumn = wrap(GridTabulatorColumnWC);
45
+ const GridTabulatorColumn = React.forwardRef(function GridTabulatorColumn(props, ref) {
46
+ const { children, ...rest } = props;
47
+ return React.createElement(customElements.getName(GridTabulatorColumnWC) ?? 'grid-tabulator-column', { ...rest, ref }, children);
48
+ });
26
49
 
27
- const GridTabulatorClientSideDatasource = wrap(GridTabulatorClientSideDatasourceWC, {
28
- events: {
29
- onGridTabulatorError: 'gridTabulator:error',
30
- onDataInit: 'dataInit',
31
- onSizeChanged: 'sizeChanged',
32
- },
50
+ const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulatorClientSideDatasource(props, ref) {
51
+ const { onGridTabulatorError, onDataInit, onSizeChanged, children, ...rest } = props;
52
+ const _innerRef = React.useRef(null);
53
+ const _onGridTabulatorErrorRef = React.useRef(onGridTabulatorError);
54
+ _onGridTabulatorErrorRef.current = onGridTabulatorError;
55
+ const _onDataInitRef = React.useRef(onDataInit);
56
+ _onDataInitRef.current = onDataInit;
57
+ const _onSizeChangedRef = React.useRef(onSizeChanged);
58
+ _onSizeChangedRef.current = onSizeChanged;
59
+ React.useLayoutEffect(() => {
60
+ const el = _innerRef.current;
61
+ if (!el) return;
62
+ const _onGridTabulatorErrorFn = (e) => _onGridTabulatorErrorRef.current?.(e);
63
+ el.addEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
64
+ const _onDataInitFn = (e) => _onDataInitRef.current?.(e);
65
+ el.addEventListener('dataInit', _onDataInitFn);
66
+ const _onSizeChangedFn = (e) => _onSizeChangedRef.current?.(e);
67
+ el.addEventListener('sizeChanged', _onSizeChangedFn);
68
+ return () => {
69
+ el.removeEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
70
+ el.removeEventListener('dataInit', _onDataInitFn);
71
+ el.removeEventListener('sizeChanged', _onSizeChangedFn);
72
+ };
73
+ }, []);
74
+ return React.createElement(customElements.getName(GridTabulatorClientSideDatasourceWC) ?? 'grid-tabulator-client-side-datasource', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
33
75
  });
34
76
 
35
77
  module.exports = {
package/dist/react.mjs CHANGED
@@ -3,29 +3,71 @@
3
3
  * Generated from custom-elements manifest.
4
4
  */
5
5
 
6
- import { provideReactWrapper } from '@microsoft/fast-react-wrapper';
7
6
  import React from 'react';
8
7
  import { GridTabulatorCell as GridTabulatorCellWC } from './esm/cell/cell.js';
9
8
  import { GridTabulatorColumn as GridTabulatorColumnWC } from './esm/column/column.js';
10
9
  import { GridTabulatorClientSideDatasource as GridTabulatorClientSideDatasourceWC } from './esm/datasource/client-side.datasource.js';
11
10
  import { GridTabulator as GridTabulatorWC } from './esm/grid-tabulator.js';
12
11
 
13
- const { wrap } = provideReactWrapper(React);
12
+ function _mergeRefs(...refs) {
13
+ return (value) => {
14
+ for (const ref of refs) {
15
+ if (typeof ref === 'function') ref(value);
16
+ else if (ref != null) ref.current = value;
17
+ }
18
+ };
19
+ }
14
20
 
15
- export const GridTabulator = wrap(GridTabulatorWC, {
16
- events: {
17
- onGridReady: 'gridReady',
18
- },
21
+ export const GridTabulator = React.forwardRef(function GridTabulator(props, ref) {
22
+ const { onGridReady, children, ...rest } = props;
23
+ const _innerRef = React.useRef(null);
24
+ const _onGridReadyRef = React.useRef(onGridReady);
25
+ _onGridReadyRef.current = onGridReady;
26
+ React.useLayoutEffect(() => {
27
+ const el = _innerRef.current;
28
+ if (!el) return;
29
+ const _onGridReadyFn = (e) => _onGridReadyRef.current?.(e);
30
+ el.addEventListener('gridReady', _onGridReadyFn);
31
+ return () => {
32
+ el.removeEventListener('gridReady', _onGridReadyFn);
33
+ };
34
+ }, []);
35
+ return React.createElement(customElements.getName(GridTabulatorWC) ?? '%%prefix%%-grid-tabulator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
19
36
  });
20
37
 
21
- export const GridTabulatorCell = wrap(GridTabulatorCellWC);
38
+ export const GridTabulatorCell = React.forwardRef(function GridTabulatorCell(props, ref) {
39
+ const { children, ...rest } = props;
40
+ return React.createElement(customElements.getName(GridTabulatorCellWC) ?? 'grid-tabulator-cell', { ...rest, ref }, children);
41
+ });
22
42
 
23
- export const GridTabulatorColumn = wrap(GridTabulatorColumnWC);
43
+ export const GridTabulatorColumn = React.forwardRef(function GridTabulatorColumn(props, ref) {
44
+ const { children, ...rest } = props;
45
+ return React.createElement(customElements.getName(GridTabulatorColumnWC) ?? 'grid-tabulator-column', { ...rest, ref }, children);
46
+ });
24
47
 
25
- export const GridTabulatorClientSideDatasource = wrap(GridTabulatorClientSideDatasourceWC, {
26
- events: {
27
- onGridTabulatorError: 'gridTabulator:error',
28
- onDataInit: 'dataInit',
29
- onSizeChanged: 'sizeChanged',
30
- },
48
+ export const GridTabulatorClientSideDatasource = React.forwardRef(function GridTabulatorClientSideDatasource(props, ref) {
49
+ const { onGridTabulatorError, onDataInit, onSizeChanged, children, ...rest } = props;
50
+ const _innerRef = React.useRef(null);
51
+ const _onGridTabulatorErrorRef = React.useRef(onGridTabulatorError);
52
+ _onGridTabulatorErrorRef.current = onGridTabulatorError;
53
+ const _onDataInitRef = React.useRef(onDataInit);
54
+ _onDataInitRef.current = onDataInit;
55
+ const _onSizeChangedRef = React.useRef(onSizeChanged);
56
+ _onSizeChangedRef.current = onSizeChanged;
57
+ React.useLayoutEffect(() => {
58
+ const el = _innerRef.current;
59
+ if (!el) return;
60
+ const _onGridTabulatorErrorFn = (e) => _onGridTabulatorErrorRef.current?.(e);
61
+ el.addEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
62
+ const _onDataInitFn = (e) => _onDataInitRef.current?.(e);
63
+ el.addEventListener('dataInit', _onDataInitFn);
64
+ const _onSizeChangedFn = (e) => _onSizeChangedRef.current?.(e);
65
+ el.addEventListener('sizeChanged', _onSizeChangedFn);
66
+ return () => {
67
+ el.removeEventListener('gridTabulator:error', _onGridTabulatorErrorFn);
68
+ el.removeEventListener('dataInit', _onDataInitFn);
69
+ el.removeEventListener('sizeChanged', _onSizeChangedFn);
70
+ };
71
+ }, []);
72
+ return React.createElement(customElements.getName(GridTabulatorClientSideDatasourceWC) ?? 'grid-tabulator-client-side-datasource', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
31
73
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/grid-tabulator",
3
3
  "description": "Genesis Foundation Grid Tabulator",
4
- "version": "14.424.1",
4
+ "version": "14.425.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -41,20 +41,20 @@
41
41
  }
42
42
  },
43
43
  "devDependencies": {
44
- "@genesislcap/foundation-testing": "14.424.1",
45
- "@genesislcap/genx": "14.424.1",
46
- "@genesislcap/rollup-builder": "14.424.1",
47
- "@genesislcap/ts-builder": "14.424.1",
48
- "@genesislcap/uvu-playwright-builder": "14.424.1",
49
- "@genesislcap/vite-builder": "14.424.1",
50
- "@genesislcap/webpack-builder": "14.424.1",
44
+ "@genesislcap/foundation-testing": "14.425.0",
45
+ "@genesislcap/genx": "14.425.0",
46
+ "@genesislcap/rollup-builder": "14.425.0",
47
+ "@genesislcap/ts-builder": "14.425.0",
48
+ "@genesislcap/uvu-playwright-builder": "14.425.0",
49
+ "@genesislcap/vite-builder": "14.425.0",
50
+ "@genesislcap/webpack-builder": "14.425.0",
51
51
  "@types/tabulator-tables": "6.2.6"
52
52
  },
53
53
  "dependencies": {
54
- "@genesislcap/foundation-comms": "14.424.1",
55
- "@genesislcap/foundation-logger": "14.424.1",
56
- "@genesislcap/foundation-ui": "14.424.1",
57
- "@genesislcap/foundation-utils": "14.424.1",
54
+ "@genesislcap/foundation-comms": "14.425.0",
55
+ "@genesislcap/foundation-logger": "14.425.0",
56
+ "@genesislcap/foundation-ui": "14.425.0",
57
+ "@genesislcap/foundation-utils": "14.425.0",
58
58
  "@microsoft/fast-colors": "5.3.1",
59
59
  "@microsoft/fast-components": "2.30.6",
60
60
  "@microsoft/fast-element": "1.14.0",
@@ -64,7 +64,6 @@
64
64
  "rxjs": "^7.5.4"
65
65
  },
66
66
  "peerDependencies": {
67
- "@microsoft/fast-react-wrapper": ">=0.3.0",
68
67
  "tabulator-tables": "6.3.1"
69
68
  },
70
69
  "repository": {
@@ -87,5 +86,5 @@
87
86
  "require": "./dist/react.cjs"
88
87
  }
89
88
  },
90
- "gitHead": "04bb18a6f0b26506a9d87ab252ce9e2329219a5e"
89
+ "gitHead": "c49bb94fbc3a74e84f18c7445398af116e1a58bb"
91
90
  }