@intable/react 0.0.16 → 0.0.17

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.js CHANGED
@@ -1,25 +1,26 @@
1
1
  import { createRoot, flushSync } from "./utils.js";
2
+ import { solidComponent } from "./utils2.js";
2
3
  import './style.css';/* empty css */
3
4
  import { createElement, useEffect, useRef } from "react";
4
5
  import "intable/wc";
5
6
  import { createComputed, onCleanup } from "solid-js";
6
7
  const Intable = (e) => {
7
- let a = useRef(null);
8
+ let o = useRef(null);
8
9
  return useEffect(() => {
9
- a.current && (a.current.options = {
10
+ o.current && (o.current.options = {
10
11
  class: e.className,
11
12
  ...e,
12
13
  renderer: component
13
14
  });
14
15
  }, [e]), createElement("wc-table", {
15
- ref: a,
16
+ ref: o,
16
17
  style: { display: "contents" }
17
18
  });
18
- }, component = (o) => (s) => {
19
- let c = document.createElement("div");
20
- c.style.display = "contents";
21
- let l = createRoot(c);
22
- return createComputed(() => flushSync(() => l.render(typeof o == "function" ? createElement(o, s) : o))), onCleanup(() => l.unmount()), c;
23
- };
19
+ }, component = (c) => solidComponent((s) => {
20
+ let l = document.createElement("div");
21
+ l.style.display = "contents";
22
+ let u = createRoot(l);
23
+ return createComputed(() => flushSync(() => u.render(typeof c == "function" ? createElement(c, s) : c))), onCleanup(() => u.unmount()), l;
24
+ });
24
25
  var src_default = Intable;
25
26
  export { Intable, component, src_default as default };
@@ -50,6 +50,11 @@ export interface Plugin {
50
50
  }
51
51
  export type Plugin$0 = Plugin | ((store: TableStore) => Plugin);
52
52
  export interface TableProps {
53
+ store?: {
54
+ value: TableStore;
55
+ } | {
56
+ current: TableStore;
57
+ } | ((store: TableStore) => void);
53
58
  columns?: TableColumn[];
54
59
  data?: any[];
55
60
  index?: boolean;
@@ -4,6 +4,7 @@ declare module '../index' {
4
4
  }
5
5
  interface TableStore {
6
6
  commands: Commands;
7
+ scrollToCell?: (x: number | object, y: number | object, opt?: ScrollIntoViewOptions) => void;
7
8
  }
8
9
  interface Plugin {
9
10
  commands?: (store: TableStore, commands: Partial<Commands>) => Partial<Commands> & Record<string, any>;
@@ -9,7 +9,11 @@ declare module '../index' {
9
9
  }
10
10
  interface TableStore {
11
11
  validateCell: (value: any, data: any, col: TableColumn) => Promise<void>;
12
+ validateRow: (data: any) => Promise<void>;
13
+ validate: () => Promise<void>;
12
14
  clearCellValidation: (data: any, col: TableColumn) => void;
15
+ clearRowValidation: (data: any) => void;
16
+ clearValidation: () => void;
13
17
  cellValidationErrors: {
14
18
  [row: Key]: {
15
19
  [col: Key]: string | null;
@@ -1,7 +1,7 @@
1
1
  import { type FC } from 'react';
2
- import { type TableProps } from 'intable';
3
2
  import '../../intable/src/wc';
4
3
  import 'intable/wc';
4
+ import { type TableProps } from 'intable';
5
5
  import './style.scss';
6
6
  export declare const Intable: FC<TableProps>;
7
7
  export declare const component: <T extends Record<string, any>>(Comp: FC<T>) => (props: T) => HTMLDivElement;
package/dist/utils2.js ADDED
@@ -0,0 +1,5 @@
1
+ import "solid-js/web";
2
+ function solidComponent(e) {
3
+ return e.__solid = 1, e;
4
+ }
5
+ export { solidComponent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intable/react",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "dayjs": "^1.11.20",
21
21
  "solid-js": "^1.9.9",
22
- "intable": "^0.0.16"
22
+ "intable": "^0.0.17"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",