@plasmicpkgs/plasmic-rich-components 1.0.85 → 1.0.87

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,58 @@
1
+ import type { GetRowKey } from "antd/es/table/interface";
2
+ import React, { ReactNode } from "react";
3
+ import { BaseColumnConfig, FieldfulProps, RowFunc } from "../field-mappings";
4
+ export interface Action {
5
+ type: "edit" | "view" | "delete" | "custom";
6
+ label?: string;
7
+ moreMenu?: boolean;
8
+ }
9
+ interface RowActionItem {
10
+ type: "item";
11
+ label: string;
12
+ onClick: (rowKey: string, row: any) => void;
13
+ }
14
+ interface RowActionMenu {
15
+ type: "menu";
16
+ label: string;
17
+ children?: RowActionItem[];
18
+ }
19
+ type RowAction = RowActionItem | RowActionMenu;
20
+ export interface RichListProps extends FieldfulProps<ListColumnConfig> {
21
+ size?: "default" | "large" | "small";
22
+ header?: ReactNode;
23
+ footer?: ReactNode;
24
+ bordered?: boolean;
25
+ pagination?: boolean;
26
+ rowKey?: string | GetRowKey<any>;
27
+ rowActions?: RowAction[];
28
+ onRowClick?: (rowKey: string, row: any, event: React.MouseEvent) => void;
29
+ pageSize?: number;
30
+ hideSearch?: boolean;
31
+ linkTo?: ListColumnConfig;
32
+ image?: ListColumnConfig;
33
+ title?: ListColumnConfig[];
34
+ subtitle?: ListColumnConfig[];
35
+ beforeTitle?: ListColumnConfig[];
36
+ afterTitle?: ListColumnConfig[];
37
+ content?: ListColumnConfig[];
38
+ type?: "grid" | "list";
39
+ }
40
+ export declare function RichList(props: RichListProps): JSX.Element;
41
+ interface StyleConfig {
42
+ styles: Record<string, any>;
43
+ align: "left" | "center" | "right";
44
+ freeze: "off" | "left" | "right";
45
+ }
46
+ declare const roles: readonly ["linkTo", "content", "title", "subtitle", "beforeTitle", "afterTitle", "image", "unset"];
47
+ export type Role = typeof roles[number];
48
+ export type ListColumnConfig = BaseColumnConfig & {
49
+ isEditableExpr: RowFunc<boolean>;
50
+ disableSorting: boolean;
51
+ sortByExpr?: RowFunc<any>;
52
+ formatting: StyleConfig;
53
+ /**
54
+ * The default inferred role, not the actual user-set role.
55
+ */
56
+ role: undefined | Role | "unset";
57
+ };
58
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Registerable } from "../utils";
2
+ import { RichList } from "./RichList";
3
+ export * from "./RichList";
4
+ export default RichList;
5
+ export declare function registerRichList(loader?: Registerable): void;
@@ -1,30 +1,13 @@
1
- import { TableSchema } from "@plasmicapp/data-sources";
2
1
  import type { SizeType } from "antd/es/config-provider/SizeContext";
3
2
  import type { GetRowKey } from "antd/es/table/interface";
4
3
  import React, { ReactNode } from "react";
5
4
  import { BaseColumnConfig, FieldfulProps, RowFunc } from "../field-mappings";
5
+ import { RowAction } from "../field-react-utils";
6
6
  export interface Action {
7
7
  type: "edit" | "view" | "delete" | "custom";
8
8
  label?: string;
9
9
  moreMenu?: boolean;
10
10
  }
11
- export interface ControlContextData {
12
- data: unknown[];
13
- schema?: TableSchema;
14
- mergedFields: TableColumnConfig[];
15
- minimalFullLengthFields: Partial<TableColumnConfig>[];
16
- }
17
- interface RowActionItem {
18
- type: "item";
19
- label: string;
20
- onClick: (rowKey: string, row: any) => void;
21
- }
22
- interface RowActionMenu {
23
- type: "menu";
24
- label: string;
25
- children?: RowActionItem[];
26
- }
27
- type RowAction = RowActionItem | RowActionMenu;
28
11
  export interface RichTableProps extends FieldfulProps<TableColumnConfig> {
29
12
  defaultSize?: SizeType;
30
13
  pagination?: boolean;
@@ -48,8 +31,6 @@ export interface RichTableProps extends FieldfulProps<TableColumnConfig> {
48
31
  themeResetClassName?: string;
49
32
  }
50
33
  export declare function RichTable(props: RichTableProps): JSX.Element | null;
51
- export declare function deriveRowKey(data: React.ComponentProps<typeof RichTable>["data"], rowKey: React.ComponentProps<typeof RichTable>["rowKey"]): string | GetRowKey<any> | undefined;
52
- export declare function deriveKeyOfRow(row: any, rowKey: React.ComponentProps<typeof RichTable>["rowKey"]): any;
53
34
  interface StyleConfig {
54
35
  styles: Record<string, any>;
55
36
  align: "left" | "center" | "right";
package/dist/utils.d.ts CHANGED
@@ -22,5 +22,20 @@ type ReactElt = {
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
24
  export declare function ensureNumber(x: number | string): number;
25
+ export declare function ensure<T>(x: T | null | undefined): T;
25
26
  export declare function isOneOf<T, U extends T>(elem: T, arr: readonly U[]): elem is U;
27
+ export declare function maybe<T, U>(x: T | undefined | null, f: (y: T) => U): U | undefined;
28
+ export declare function isLikeImage(value: unknown): false | RegExpMatchArray | null;
29
+ export declare function isInteractable(target: HTMLElement): boolean;
30
+ export declare function ensureArray<T>(xs: T | T[]): T[];
31
+ export declare const tuple: <T extends any[]>(...args: T) => T;
32
+ export interface HasId {
33
+ id: string;
34
+ }
35
+ export declare function mkIdMap<T extends HasId>(xs: ReadonlyArray<T>): Map<string, T>;
36
+ export declare const mkShortId: () => string;
37
+ export declare function withoutNils<T>(xs: Array<T | undefined | null>): T[];
38
+ export type Falsey = null | undefined | false | "" | 0 | 0n;
39
+ export type Truthy<T> = T extends Falsey ? never : T;
40
+ export declare function withoutFalsey<T>(xs: Array<T | Falsey>): T[];
26
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicpkgs/plasmic-rich-components",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
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.86",
34
- "@plasmicapp/host": "1.0.144",
33
+ "@plasmicapp/data-sources": "0.1.87",
34
+ "@plasmicapp/host": "1.0.145",
35
35
  "@size-limit/preset-small-lib": "^4.11.0",
36
36
  "@types/node": "^14.0.26",
37
37
  "antd": "^5.4.0",
@@ -57,5 +57,5 @@
57
57
  "lodash": "^4.17.21",
58
58
  "tinycolor2": "^1.6.0"
59
59
  },
60
- "gitHead": "4377138ae58e24383f5384af9e5068db06d97653"
60
+ "gitHead": "fa865641d9193b8b0b6cf7f073688d9801d2e59c"
61
61
  }