@plasmicpkgs/plasmic-rich-components 1.0.84 → 1.0.86

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,5 @@
1
+ import { PropType } from "@plasmicapp/host/registerComponent";
2
+ export declare function dataProp<T>(): PropType<T>;
3
+ export declare function commonProps<T>(): Record<string, PropType<T>>;
4
+ export declare function rowActionsProp<T>(): PropType<T>;
5
+ export declare function onRowClickProp<T>(): PropType<T>;
@@ -1,12 +1,7 @@
1
1
  import { TableFieldSchema, TableSchema } from "@plasmicapp/data-sources";
2
2
  import { PropType } from "@plasmicapp/host/registerComponent";
3
3
  import { QueryResult } from "./queries";
4
- export declare const tuple: <T extends any[]>(...args: T) => T;
5
- export interface HasId {
6
- id: string;
7
- }
8
- export declare function mkIdMap<T extends HasId>(xs: ReadonlyArray<T>): Map<string, T>;
9
- export declare const mkShortId: () => string;
4
+ import { ContextDependentConfig } from "@plasmicapp/host";
10
5
  export interface AutoSettings {
11
6
  dataType: "auto";
12
7
  }
@@ -89,7 +84,22 @@ export interface FieldfulProps<ColumnConfig extends BaseColumnConfig> {
89
84
  fields?: Partial<ColumnConfig>[];
90
85
  setControlContextData?: (ctx: ControlContextData<ColumnConfig>) => void;
91
86
  }
92
- export declare function buildFieldsPropType<ColumnConfig extends BaseColumnConfig, Props extends FieldfulProps<ColumnConfig>>(opts: {
87
+ export declare const NoneField = "||NoneField||";
88
+ export declare const CustomField = "";
89
+ interface FieldSubpropsOpts<ColumnConfig extends BaseColumnConfig> {
93
90
  fieldTypes?: Record<string, PropType<any>>;
94
- }): PropType<Props>;
91
+ canChangeField?: boolean;
92
+ canPickNoneField?: boolean;
93
+ noTitle?: boolean;
94
+ noDataType?: boolean;
95
+ hiddenFieldId?: (ps: Record<string, unknown>, ctx: ControlContextData<ColumnConfig>, extras: {
96
+ path: (string | number)[];
97
+ }) => boolean;
98
+ }
99
+ export declare function getFieldSubprops<ColumnConfig extends BaseColumnConfig>(opts: FieldSubpropsOpts<ColumnConfig>): Record<string, PropType<any>>;
100
+ export declare function buildFieldsPropType<ColumnConfig extends BaseColumnConfig, Props extends FieldfulProps<ColumnConfig>>({ advanced, displayName, minimalValue, ...opts }: {
101
+ advanced?: boolean;
102
+ displayName?: string;
103
+ minimalValue?: ContextDependentConfig<Props, any>;
104
+ } & FieldSubpropsOpts<ColumnConfig>): PropType<Props>;
95
105
  export {};
@@ -0,0 +1,27 @@
1
+ import { NormalizedData, QueryResult } from "./queries";
2
+ import { BaseColumnConfig } from "./field-mappings";
3
+ import React, { Key } from "react";
4
+ import type { GetRowKey, SorterResult } from "antd/es/table/interface";
5
+ export declare function useSortedFilteredData(data: NormalizedData | undefined, columns: BaseColumnConfig[]): {
6
+ finalData: Record<string, unknown>[] | undefined;
7
+ search: string;
8
+ setSearch: React.Dispatch<React.SetStateAction<string>>;
9
+ setSortState: React.Dispatch<React.SetStateAction<{
10
+ sorter: SorterResult<Record<string, any>>;
11
+ } | undefined>>;
12
+ };
13
+ interface RowActionItem {
14
+ type: "item";
15
+ label: string;
16
+ onClick: (rowKey: string, row: any) => void;
17
+ }
18
+ interface RowActionMenu {
19
+ type: "menu";
20
+ label: string;
21
+ children?: RowActionItem[];
22
+ }
23
+ export type RowAction = RowActionItem | RowActionMenu;
24
+ export declare function deriveRowKey(data: QueryResult | undefined, rowKey: string | GetRowKey<any> | undefined): string | GetRowKey<any> | undefined;
25
+ export declare function deriveKeyOfRow(row: any, rowKey: string | GetRowKey<any> | undefined): any;
26
+ export declare function renderActions(rowActions: RowAction[], row: any, data: NormalizedData | undefined, rowKey: string | ((record: any, index?: number) => Key) | undefined): JSX.Element[];
27
+ export {};
@@ -1,3 +1,6 @@
1
1
  import React from "react";
2
2
  import { BaseColumnConfig } from "./field-mappings";
3
- export declare function renderValue(value: any, record: any, cconfig: BaseColumnConfig): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
3
+ export declare function maybeRenderValue(record: any, cconfig: BaseColumnConfig | undefined): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
4
+ export declare function multiRenderValue(record: any, cconfigs: BaseColumnConfig[] | undefined): (string | JSX.Element)[] | undefined;
5
+ export declare function maybeRenderString(record: any, cconfig: BaseColumnConfig | undefined): string | undefined;
6
+ export declare function renderValue(record: any, cconfig: BaseColumnConfig): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,18 @@
1
1
  import { Registerable } from "./utils";
2
2
  export { RichLayout } from "./rich-layout";
3
+ export { RichList } from "./rich-list";
3
4
  export { RichTable, tableHelpers } from "./rich-table";
4
5
  export { RichDetails } from "./rich-details";
5
6
  export declare function registerAll(loader?: Registerable): void;
7
+ export { useSortedFilteredData } from "./field-react-utils";
8
+ export { isLikeImage } from "./utils";
9
+ export { renderActions } from "./field-react-utils";
10
+ export type { RowAction } from "./field-react-utils";
11
+ export { deriveRowKey } from "./field-react-utils";
12
+ export { deriveKeyOfRow } from "./field-react-utils";
13
+ export { isInteractable } from "./utils";
14
+ export { onRowClickProp } from "./common-prop-types";
15
+ export { rowActionsProp } from "./common-prop-types";
16
+ export { commonProps } from "./common-prop-types";
17
+ export { dataProp } from "./common-prop-types";
18
+ export { ensureArray } from "./utils";