@teselagen/ui 0.8.6-beta.23 → 0.8.6-beta.25

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 (66) hide show
  1. package/DataTable/EditabelCell.d.ts +7 -0
  2. package/DataTable/defaultProps.d.ts +43 -0
  3. package/DataTable/utils/computePresets.d.ts +1 -0
  4. package/DataTable/utils/convertSchema.d.ts +22 -2
  5. package/DataTable/utils/formatPasteData.d.ts +11 -5
  6. package/DataTable/utils/getAllRows.d.ts +4 -1
  7. package/DataTable/utils/getCellCopyText.d.ts +1 -1
  8. package/DataTable/utils/getCellInfo.d.ts +20 -15
  9. package/DataTable/utils/getFieldPathToField.d.ts +5 -1
  10. package/DataTable/utils/getIdOrCodeOrIndex.d.ts +2 -1
  11. package/DataTable/utils/getLastSelectedEntity.d.ts +7 -1
  12. package/DataTable/utils/getNewEntToSelect.d.ts +7 -6
  13. package/DataTable/utils/getRowCopyText.d.ts +1 -1
  14. package/DataTable/utils/handleCopyColumn.d.ts +1 -1
  15. package/DataTable/utils/handleCopyTable.d.ts +1 -1
  16. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +22 -1
  17. package/DataTable/utils/isBottomRightCornerOfRectangle.d.ts +10 -8
  18. package/DataTable/utils/isEntityClean.d.ts +3 -1
  19. package/DataTable/utils/primarySelectedValue.d.ts +1 -1
  20. package/DataTable/utils/removeCleanRows.d.ts +11 -3
  21. package/DataTable/utils/selection.d.ts +3 -1
  22. package/DataTable/utils/types/Entity.d.ts +5 -0
  23. package/DataTable/utils/types/Field.d.ts +4 -0
  24. package/DataTable/utils/types/OrderBy.d.ts +11 -0
  25. package/DataTable/utils/types/Schema.d.ts +4 -0
  26. package/DataTable/utils/useDeepEqualMemo.d.ts +1 -0
  27. package/DataTable/utils/useTableEntities.d.ts +17 -4
  28. package/DataTable/utils/useTableParams.d.ts +49 -0
  29. package/DataTable/utils/utils.d.ts +16 -5
  30. package/index.cjs.js +147 -121
  31. package/index.es.js +147 -121
  32. package/package.json +2 -2
  33. package/src/DataTable/Columns.jsx +945 -0
  34. package/src/DataTable/EditabelCell.js +44 -0
  35. package/src/DataTable/EditabelCell.jsx +44 -0
  36. package/src/DataTable/RenderCell.jsx +191 -0
  37. package/src/DataTable/defaultProps.js +45 -0
  38. package/src/DataTable/index.js +96 -68
  39. package/src/DataTable/utils/computePresets.js +42 -0
  40. package/src/DataTable/utils/convertSchema.ts +79 -0
  41. package/src/DataTable/utils/formatPasteData.ts +34 -0
  42. package/src/DataTable/utils/getAllRows.js +2 -6
  43. package/src/DataTable/utils/getAllRows.ts +11 -0
  44. package/src/DataTable/utils/getCellCopyText.ts +7 -0
  45. package/src/DataTable/utils/getCellInfo.ts +46 -0
  46. package/src/DataTable/utils/getFieldPathToField.ts +10 -0
  47. package/src/DataTable/utils/getIdOrCodeOrIndex.ts +14 -0
  48. package/src/DataTable/utils/getLastSelectedEntity.ts +15 -0
  49. package/src/DataTable/utils/getNewEntToSelect.ts +32 -0
  50. package/src/DataTable/utils/handleCopyColumn.js +2 -2
  51. package/src/DataTable/utils/handleCopyTable.js +2 -2
  52. package/src/DataTable/utils/initializeHasuraWhereAndFilter.ts +35 -0
  53. package/src/DataTable/utils/isBottomRightCornerOfRectangle.ts +27 -0
  54. package/src/DataTable/utils/isEntityClean.ts +15 -0
  55. package/src/DataTable/utils/primarySelectedValue.ts +1 -0
  56. package/src/DataTable/utils/removeCleanRows.ts +25 -0
  57. package/src/DataTable/utils/selection.ts +11 -0
  58. package/src/DataTable/utils/types/Entity.ts +7 -0
  59. package/src/DataTable/utils/types/Field.ts +4 -0
  60. package/src/DataTable/utils/types/OrderBy.ts +15 -0
  61. package/src/DataTable/utils/types/Schema.ts +5 -0
  62. package/src/DataTable/utils/useDeepEqualMemo.js +10 -0
  63. package/src/DataTable/utils/useTableEntities.ts +60 -0
  64. package/src/DataTable/utils/useTableParams.js +361 -0
  65. package/src/DataTable/utils/utils.ts +39 -0
  66. package/style.css +10537 -0
@@ -0,0 +1,7 @@
1
+ export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric, initialValue }: {
2
+ cancelEdit: any;
3
+ dataTest: any;
4
+ finishEdit: any;
5
+ isNumeric: any;
6
+ initialValue: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { noop } from 'lodash-es';
2
+ declare namespace _default {
3
+ export { noop as addFilters };
4
+ export let className: string;
5
+ export { noop as clearFilters };
6
+ export { noop as contextMenu };
7
+ export let disabled: boolean;
8
+ export let entities: never[];
9
+ export let extraClasses: string;
10
+ export let filters: never[];
11
+ export let isCopyable: boolean;
12
+ export { noop as isEntityDisabled };
13
+ export let isLoading: boolean;
14
+ export let isSimple: boolean;
15
+ export let isSingleSelect: boolean;
16
+ export let maxHeight: number;
17
+ export let noHeader: boolean;
18
+ export let noSelect: boolean;
19
+ export let noUserSelect: boolean;
20
+ export { noop as onDeselect };
21
+ export { noop as onMultiRowSelect };
22
+ export { noop as onRowClick };
23
+ export { noop as onRowSelect };
24
+ export { noop as onSingleRowSelect };
25
+ export let page: number;
26
+ export let pageSize: number;
27
+ export let reduxFormExpandedEntityIdMap: {};
28
+ export let reduxFormSearchInput: string;
29
+ export let reduxFormSelectedEntityIdMap: {};
30
+ export { noop as removeSingleFilter };
31
+ export let resized: never[];
32
+ export { noop as resizePersist };
33
+ export { noop as setFilter };
34
+ export { noop as setOrder };
35
+ export { noop as setPage };
36
+ export { noop as setPageSize };
37
+ export { noop as setSearchTerm };
38
+ export let showCount: boolean;
39
+ export let style: {};
40
+ export let withCheckboxes: boolean;
41
+ export let withSort: boolean;
42
+ }
43
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function computePresets(props?: {}): import('lodash').Dictionary<any>;
@@ -1,3 +1,23 @@
1
- export function mergeSchemas(_originalSchema: any, _overrideSchema: any): any;
1
+ type Field = {
2
+ type?: string;
3
+ displayName?: string;
4
+ path?: string;
5
+ filterDisabled?: boolean;
6
+ sortDisabled?: boolean;
7
+ };
8
+ type Schema = {
9
+ fields: (Field | string)[];
10
+ };
11
+ type CompleteField = Field & {
12
+ type: string;
13
+ displayName: string;
14
+ path: string;
15
+ };
16
+ type CompleteSchema = {
17
+ fields: CompleteField[];
18
+ };
19
+ declare const convertSchema: (schema: Schema) => CompleteSchema;
20
+ export declare function mergeSchemas(_originalSchema: Schema, _overrideSchema: Schema): {
21
+ fields: CompleteField[];
22
+ };
2
23
  export default convertSchema;
3
- declare function convertSchema(schema: any): any;
@@ -1,5 +1,11 @@
1
- export function formatPasteData({ schema, newVal, path }: {
2
- schema: any;
3
- newVal: any;
4
- path: any;
5
- }): any;
1
+ import { Schema } from './types/Schema';
2
+ type GenericSelectValue = {
3
+ __strVal: string;
4
+ __genSelCol: string;
5
+ };
6
+ export declare const formatPasteData: ({ schema, newVal, path }: {
7
+ schema: Schema;
8
+ newVal: GenericSelectValue | string | number | boolean | null | undefined;
9
+ path: string;
10
+ }) => string | number | boolean | null | undefined;
11
+ export {};
@@ -1 +1,4 @@
1
- export function getAllRows(e: any): any;
1
+ import { RefObject } from '../../../../../node_modules/react';
2
+ export declare const getAllRows: (tableRef: RefObject<{
3
+ tableRef: HTMLDivElement;
4
+ }>) => NodeListOf<Element> | undefined;
@@ -1 +1 @@
1
- export function getCellCopyText(cellWrapper: any): any[];
1
+ export declare const getCellCopyText: (cellWrapper: HTMLElement | null) => (string | null | undefined)[];
@@ -1,17 +1,22 @@
1
- export function getCellInfo({ columnIndex, columnPath, rowId, schema, entities, rowIndex, isEntityDisabled, entity }: {
2
- columnIndex: any;
3
- columnPath: any;
4
- rowId: any;
5
- schema: any;
6
- entities: any;
7
- rowIndex: any;
8
- isEntityDisabled: any;
9
- entity: any;
10
- }): {
1
+ import { Entity } from './types/Entity';
2
+ export declare const getCellInfo: <T extends Entity>({ columnIndex, columnPath, rowId, schema, entities, rowIndex, isEntityDisabled, entity }: {
3
+ columnIndex: number;
4
+ columnPath: string;
5
+ rowId: string | number;
6
+ schema: {
7
+ fields: {
8
+ path: string;
9
+ }[];
10
+ };
11
+ entities: T[];
12
+ rowIndex: number;
13
+ isEntityDisabled: (entity: T) => boolean;
14
+ entity: T;
15
+ }) => {
11
16
  cellId: string;
12
- cellIdAbove: any;
13
- cellIdToRight: any;
14
- cellIdBelow: any;
15
- cellIdToLeft: any;
16
- rowDisabled: any;
17
+ cellIdAbove: string | 0;
18
+ cellIdToRight: string;
19
+ cellIdBelow: string | 0;
20
+ cellIdToLeft: string;
21
+ rowDisabled: boolean;
17
22
  };
@@ -1 +1,5 @@
1
- export function getFieldPathToField(schema: any): {};
1
+ import { Field } from './types/Field';
2
+ import { Schema } from './types/Schema';
3
+ export declare const getFieldPathToField: (schema: Schema) => {
4
+ [path: string]: Field;
5
+ };
@@ -1 +1,2 @@
1
- export function getIdOrCodeOrIndex(record: any, rowIndex: any): any;
1
+ import { Entity } from './types/Entity';
2
+ export declare const getIdOrCodeOrIndex: (record: Entity, rowIndex?: number) => string | number;
@@ -1 +1,7 @@
1
- export function getLastSelectedEntity(idMap: any): undefined;
1
+ import { Entity } from './types/Entity';
2
+ export declare const getLastSelectedEntity: (idMap: {
3
+ [id: string]: {
4
+ time: number;
5
+ entity: Entity;
6
+ };
7
+ }) => undefined;
@@ -1,6 +1,7 @@
1
- export function getNewEntToSelect({ type, lastSelectedIndex, entities, isEntityDisabled }: {
2
- type: any;
3
- lastSelectedIndex: any;
4
- entities: any;
5
- isEntityDisabled: any;
6
- }): any;
1
+ import { Entity } from './types/Entity';
2
+ export declare const getNewEntToSelect: ({ type, lastSelectedIndex, entities, isEntityDisabled }: {
3
+ type: "up" | "down";
4
+ lastSelectedIndex: number;
5
+ entities: Entity[];
6
+ isEntityDisabled?: (entity: Entity) => boolean;
7
+ }) => Entity | undefined;
@@ -1 +1 @@
1
- export function getRowCopyText(rowEl: any, { specificColumn }?: {}): (string | any[])[];
1
+ export function getRowCopyText(rowEl: any, { specificColumn }?: {}): (string | (string | null | undefined)[])[];
@@ -1 +1 @@
1
- export function handleCopyColumn(e: any, cellWrapper: any, selectedRecords: any): void;
1
+ export function handleCopyColumn(tableRef: any, cellWrapper: any, selectedRecords: any): void;
@@ -1 +1 @@
1
- export function handleCopyTable(e: any, opts: any): void;
1
+ export function handleCopyTable(tableRef: any, opts: any): void;
@@ -1 +1,22 @@
1
- export function initializeHasuraWhereAndFilter(additionalFilter: any, where: {} | undefined, currentParams: any): void;
1
+ type Filter = {
2
+ [key: string]: {
3
+ _eq: string | number | boolean;
4
+ } | {
5
+ _in: (string | number | boolean)[];
6
+ } | {
7
+ _gt: number;
8
+ } | {
9
+ _lt: number;
10
+ } | {
11
+ _gte: number;
12
+ } | {
13
+ _lte: number;
14
+ };
15
+ };
16
+ type Where = {
17
+ _and?: Filter[];
18
+ _or?: Filter[];
19
+ };
20
+ type CurrentParams = object;
21
+ export declare function initializeHasuraWhereAndFilter(additionalFilter: ((where: Where, currentParams: CurrentParams) => Filter | void) | Filter | undefined | null, where: Where | undefined, currentParams: CurrentParams): void;
22
+ export {};
@@ -1,8 +1,10 @@
1
- export function isBottomRightCornerOfRectangle({ cellId, selectionGrid, lastRowIndex, lastCellIndex, entityMap, pathToIndex }: {
2
- cellId: any;
3
- selectionGrid: any;
4
- lastRowIndex: any;
5
- lastCellIndex: any;
6
- entityMap: any;
7
- pathToIndex: any;
8
- }): boolean | undefined;
1
+ export declare const isBottomRightCornerOfRectangle: ({ cellId, selectionGrid, lastRowIndex, lastCellIndex, entityMap, pathToIndex }: {
2
+ cellId: string;
3
+ selectionGrid: (string | undefined)[][];
4
+ lastRowIndex: number;
5
+ lastCellIndex: number;
6
+ entityMap: Record<string, {
7
+ i: number;
8
+ }>;
9
+ pathToIndex: Record<string, number>;
10
+ }) => boolean | undefined;
@@ -1 +1,3 @@
1
- export function isEntityClean(e: any): boolean;
1
+ export declare function isEntityClean(e: {
2
+ [key: string]: unknown;
3
+ } | null): boolean;
@@ -1 +1 @@
1
- export const PRIMARY_SELECTED_VAL: "main_cell";
1
+ export declare const PRIMARY_SELECTED_VAL = "main_cell";
@@ -1,4 +1,12 @@
1
- export function removeCleanRows(entities: any, cellValidation: any): {
2
- entsToUse: any;
3
- validationToUse: {};
1
+ export declare const removeCleanRows: (entities: ({
2
+ [key: string]: unknown;
3
+ } & {
4
+ _isClean?: boolean;
5
+ })[], cellValidation: Record<string, unknown>) => {
6
+ entsToUse: ({
7
+ [key: string]: unknown;
8
+ } & {
9
+ _isClean?: boolean;
10
+ })[];
11
+ validationToUse: Record<string, unknown>;
4
12
  };
@@ -1 +1,3 @@
1
- export function getSelectedRowsFromEntities(entities: any, idMap: any): any;
1
+ export declare const getSelectedRowsFromEntities: (entities: {
2
+ [key: string]: unknown;
3
+ }[], idMap: Record<string, boolean>) => number[];
@@ -0,0 +1,5 @@
1
+ export type Entity = {
2
+ id?: string | number;
3
+ } | {
4
+ code?: string;
5
+ };
@@ -0,0 +1,4 @@
1
+ export type Field = {
2
+ path: string;
3
+ type: "genericSelect" | string;
4
+ };
@@ -0,0 +1,11 @@
1
+ type OrderByClause<T = {
2
+ id: string;
3
+ }> = {
4
+ path?: string;
5
+ direction?: "asc" | "desc";
6
+ type?: string;
7
+ sortFn?: ((record: T) => unknown) | string | Array<((record: T) => unknown) | string>;
8
+ getValueToFilterOn?: (record: T) => unknown;
9
+ };
10
+ export type OrderBy = OrderByClause | OrderByClause[] | Record<string, "asc" | "desc">;
11
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Field } from './Field';
2
+ export type Schema = {
3
+ fields: Field[];
4
+ };
@@ -0,0 +1 @@
1
+ export function useDeepEqualMemo(value: any): undefined;
@@ -1,5 +1,18 @@
1
- export function useTableEntities(tableFormName: any): {
2
- selectTableEntities: (entities?: any[]) => void;
3
- allOrderedEntities: any;
4
- selectedEntities: any;
1
+ type _Entity = {
2
+ [key: string]: unknown;
3
+ } & {
4
+ id: string;
5
5
  };
6
+ type SelectedEntityIdMap<Entity extends _Entity> = Record<string, {
7
+ entity: Entity;
8
+ time: number;
9
+ index?: number;
10
+ }>;
11
+ export declare const useTableEntities: <Entity extends _Entity>(tableFormName: string) => {
12
+ selectTableEntities: (entities?: {
13
+ id: string;
14
+ }[]) => void;
15
+ allOrderedEntities: Entity[] | undefined;
16
+ selectedEntities: SelectedEntityIdMap<Entity> | undefined;
17
+ };
18
+ export {};
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
3
+ *
4
+ * @export
5
+ *
6
+ * @param {compOrOpts} compOrOpts
7
+ * @typedef {object} compOrOpts
8
+ * @property {*string} formName - required unique identifier for the table
9
+ * @property {Object | Function} schema - The data table schema or a function returning it. The function wll be called with props as the argument.
10
+ * @property {boolean} urlConnected - whether the table should connect to/update the URL
11
+ * @property {boolean} withSelectedEntities - whether or not to pass the selected entities
12
+ * @property {boolean} isCodeModel - whether the model is keyed by code instead of id in the db
13
+ * @property {object} defaults - tableParam defaults such as pageSize, filter, etc
14
+ * @property {boolean} noOrderError - won't console an error if an order is not found on schema
15
+ */
16
+ export default function useTableParams(props: any): any;
17
+ /**
18
+ * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
19
+ */
20
+ export type compOrOpts = {
21
+ /**
22
+ * } formName - required unique identifier for the table
23
+ */
24
+ string: any;
25
+ /**
26
+ * - The data table schema or a function returning it. The function wll be called with props as the argument.
27
+ */
28
+ schema: Object | Function;
29
+ /**
30
+ * - whether the table should connect to/update the URL
31
+ */
32
+ urlConnected: boolean;
33
+ /**
34
+ * - whether or not to pass the selected entities
35
+ */
36
+ withSelectedEntities: boolean;
37
+ /**
38
+ * - whether the model is keyed by code instead of id in the db
39
+ */
40
+ isCodeModel: boolean;
41
+ /**
42
+ * - tableParam defaults such as pageSize, filter, etc
43
+ */
44
+ defaults: object;
45
+ /**
46
+ * - won't console an error if an order is not found on schema
47
+ */
48
+ noOrderError: boolean;
49
+ };
@@ -1,5 +1,16 @@
1
- export function getFieldPathToIndex(schema: any): {};
2
- export function defaultParsePaste(str: any): any;
3
- export function getEntityIdToEntity(entities: any): {};
4
- export function getNumberStrAtEnd(str: any): any;
5
- export function stripNumberAtEnd(str: any): any;
1
+ import { Entity } from './types/Entity';
2
+ import { Field } from './types/Field';
3
+ export declare const getFieldPathToIndex: (schema: {
4
+ fields: Field[];
5
+ }) => {
6
+ [path: string]: number;
7
+ };
8
+ export declare const defaultParsePaste: (str: string) => string[][];
9
+ export declare const getEntityIdToEntity: (entities: Entity[]) => {
10
+ [id: string]: {
11
+ e: Entity;
12
+ i: number;
13
+ };
14
+ };
15
+ export declare const getNumberStrAtEnd: (str: string) => string | null | undefined;
16
+ export declare const stripNumberAtEnd: (str: string) => string;