@plasmicpkgs/plasmic-rich-components 1.0.75 → 1.0.77

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.
@@ -0,0 +1,10 @@
1
+ import { ManyRowsResult, TableSchema } from "@plasmicapp/data-sources";
2
+ export type QueryResult = Partial<ManyRowsResult<any>> & {
3
+ error?: any;
4
+ isLoading?: boolean;
5
+ };
6
+ export interface NormalizedData {
7
+ data: Record<string, unknown>[];
8
+ schema?: TableSchema;
9
+ }
10
+ export declare function normalizeData(rawData: unknown): NormalizedData | undefined;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { BaseColumnConfig, FieldfulProps } from "../field-mappings";
3
+ export interface RichDetailsProps extends FieldfulProps<DetailsColumnConfig> {
4
+ size?: "small" | "middle" | "default";
5
+ bordered?: boolean;
6
+ layout?: "horizontal" | "vertical";
7
+ column?: number;
8
+ }
9
+ export declare function RichDetails(props: RichDetailsProps): JSX.Element;
10
+ export type DetailsColumnConfig = BaseColumnConfig & {
11
+ span?: number;
12
+ };
@@ -0,0 +1,3 @@
1
+ import { Registerable } from "../utils";
2
+ export * from "./RichDetails";
3
+ export declare function registerRichDetails(loader?: Registerable): void;
@@ -1,12 +1,8 @@
1
- import { ManyRowsResult, TableSchema } from "@plasmicapp/data-sources";
1
+ import { TableSchema } from "@plasmicapp/data-sources";
2
2
  import type { SizeType } from "antd/es/config-provider/SizeContext";
3
3
  import type { GetRowKey } from "antd/es/table/interface";
4
4
  import React, { ReactNode } from "react";
5
- import { ColumnConfig, PartialColumnConfig } from "../field-mappings";
6
- export type QueryResult = Partial<ManyRowsResult<any>> & {
7
- error?: any;
8
- isLoading?: boolean;
9
- };
5
+ import { BaseColumnConfig, FieldfulProps, RowFunc } from "../field-mappings";
10
6
  export interface Action {
11
7
  type: "edit" | "view" | "delete" | "custom";
12
8
  label?: string;
@@ -15,8 +11,8 @@ export interface Action {
15
11
  export interface ControlContextData {
16
12
  data: unknown[];
17
13
  schema?: TableSchema;
18
- mergedFields: ColumnConfig[];
19
- minimalFullLengthFields: PartialColumnConfig[];
14
+ mergedFields: TableColumnConfig[];
15
+ minimalFullLengthFields: Partial<TableColumnConfig>[];
20
16
  }
21
17
  interface RowActionItem {
22
18
  type: "item";
@@ -29,10 +25,7 @@ interface RowActionMenu {
29
25
  children?: RowActionItem[];
30
26
  }
31
27
  type RowAction = RowActionItem | RowActionMenu;
32
- export interface RichTableProps {
33
- className?: string;
34
- data?: QueryResult;
35
- fields?: PartialColumnConfig[];
28
+ export interface RichTableProps extends FieldfulProps<TableColumnConfig> {
36
29
  defaultSize?: SizeType;
37
30
  pagination?: boolean;
38
31
  canSelectRows?: "none" | "click" | "single" | "multiple";
@@ -41,7 +34,6 @@ export interface RichTableProps {
41
34
  onRowClick?: (rowKey: string, row: any, event: React.MouseEvent) => void;
42
35
  rowKey?: string | GetRowKey<any>;
43
36
  rowActions?: RowAction[];
44
- setControlContextData?: (ctx: ControlContextData) => void;
45
37
  title?: ReactNode;
46
38
  addHref?: string;
47
39
  actions?: Action[];
@@ -58,4 +50,15 @@ export interface RichTableProps {
58
50
  export declare function RichTable(props: RichTableProps): JSX.Element | null;
59
51
  export declare function deriveRowKey(data: React.ComponentProps<typeof RichTable>["data"], rowKey: React.ComponentProps<typeof RichTable>["rowKey"]): string | GetRowKey<any> | undefined;
60
52
  export declare function deriveKeyOfRow(row: any, rowKey: React.ComponentProps<typeof RichTable>["rowKey"]): any;
53
+ interface StyleConfig {
54
+ styles: Record<string, any>;
55
+ align: "left" | "center" | "right";
56
+ freeze: "off" | "left" | "right";
57
+ }
58
+ export type TableColumnConfig = BaseColumnConfig & {
59
+ isEditableExpr: RowFunc<boolean>;
60
+ disableSorting: boolean;
61
+ sortByExpr?: RowFunc<any>;
62
+ formatting: StyleConfig;
63
+ };
61
64
  export {};
package/dist/utils.d.ts CHANGED
@@ -21,4 +21,6 @@ type ReactElt = {
21
21
  } | null;
22
22
  export declare function traverseReactEltTree(children: React.ReactNode, callback: (elt: ReactElt) => void): void;
23
23
  export declare function asArray<T>(x: T[] | T | undefined | null): T[];
24
+ export declare function ensureNumber(x: number | string): number;
25
+ export declare function isOneOf<T, U extends T>(elem: T, arr: readonly U[]): elem is U;
24
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicpkgs/plasmic-rich-components",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "Rich batteries-included general purpose components for business apps, admin panels, etc.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,8 +30,8 @@
30
30
  "devDependencies": {
31
31
  "@ant-design/icons": "^5.0.1",
32
32
  "@ant-design/pro-components": "^2.4.1",
33
- "@plasmicapp/data-sources": "0.1.83",
34
- "@plasmicapp/host": "1.0.141",
33
+ "@plasmicapp/data-sources": "0.1.85",
34
+ "@plasmicapp/host": "1.0.143",
35
35
  "@size-limit/preset-small-lib": "^4.11.0",
36
36
  "@types/node": "^14.0.26",
37
37
  "antd": "^5.4.0",
@@ -56,5 +56,5 @@
56
56
  "fast-stringify": "^2.0.0",
57
57
  "lodash": "^4.17.21"
58
58
  },
59
- "gitHead": "f4b49944c59dc226246be649860f0eb63cdcedf5"
59
+ "gitHead": "14ac7da363bb5d22b83752f6c4e67cd83797b7c3"
60
60
  }