@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.
- package/DataTable/EditabelCell.d.ts +7 -0
- package/DataTable/defaultProps.d.ts +43 -0
- package/DataTable/utils/computePresets.d.ts +1 -0
- package/DataTable/utils/convertSchema.d.ts +22 -2
- package/DataTable/utils/formatPasteData.d.ts +11 -5
- package/DataTable/utils/getAllRows.d.ts +4 -1
- package/DataTable/utils/getCellCopyText.d.ts +1 -1
- package/DataTable/utils/getCellInfo.d.ts +20 -15
- package/DataTable/utils/getFieldPathToField.d.ts +5 -1
- package/DataTable/utils/getIdOrCodeOrIndex.d.ts +2 -1
- package/DataTable/utils/getLastSelectedEntity.d.ts +7 -1
- package/DataTable/utils/getNewEntToSelect.d.ts +7 -6
- package/DataTable/utils/getRowCopyText.d.ts +1 -1
- package/DataTable/utils/handleCopyColumn.d.ts +1 -1
- package/DataTable/utils/handleCopyTable.d.ts +1 -1
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +22 -1
- package/DataTable/utils/isBottomRightCornerOfRectangle.d.ts +10 -8
- package/DataTable/utils/isEntityClean.d.ts +3 -1
- package/DataTable/utils/primarySelectedValue.d.ts +1 -1
- package/DataTable/utils/removeCleanRows.d.ts +11 -3
- package/DataTable/utils/selection.d.ts +3 -1
- package/DataTable/utils/types/Entity.d.ts +5 -0
- package/DataTable/utils/types/Field.d.ts +4 -0
- package/DataTable/utils/types/OrderBy.d.ts +11 -0
- package/DataTable/utils/types/Schema.d.ts +4 -0
- package/DataTable/utils/useDeepEqualMemo.d.ts +1 -0
- package/DataTable/utils/useTableEntities.d.ts +17 -4
- package/DataTable/utils/useTableParams.d.ts +49 -0
- package/DataTable/utils/utils.d.ts +16 -5
- package/index.cjs.js +147 -121
- package/index.es.js +147 -121
- package/package.json +2 -2
- package/src/DataTable/Columns.jsx +945 -0
- package/src/DataTable/EditabelCell.js +44 -0
- package/src/DataTable/EditabelCell.jsx +44 -0
- package/src/DataTable/RenderCell.jsx +191 -0
- package/src/DataTable/defaultProps.js +45 -0
- package/src/DataTable/index.js +96 -68
- package/src/DataTable/utils/computePresets.js +42 -0
- package/src/DataTable/utils/convertSchema.ts +79 -0
- package/src/DataTable/utils/formatPasteData.ts +34 -0
- package/src/DataTable/utils/getAllRows.js +2 -6
- package/src/DataTable/utils/getAllRows.ts +11 -0
- package/src/DataTable/utils/getCellCopyText.ts +7 -0
- package/src/DataTable/utils/getCellInfo.ts +46 -0
- package/src/DataTable/utils/getFieldPathToField.ts +10 -0
- package/src/DataTable/utils/getIdOrCodeOrIndex.ts +14 -0
- package/src/DataTable/utils/getLastSelectedEntity.ts +15 -0
- package/src/DataTable/utils/getNewEntToSelect.ts +32 -0
- package/src/DataTable/utils/handleCopyColumn.js +2 -2
- package/src/DataTable/utils/handleCopyTable.js +2 -2
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.ts +35 -0
- package/src/DataTable/utils/isBottomRightCornerOfRectangle.ts +27 -0
- package/src/DataTable/utils/isEntityClean.ts +15 -0
- package/src/DataTable/utils/primarySelectedValue.ts +1 -0
- package/src/DataTable/utils/removeCleanRows.ts +25 -0
- package/src/DataTable/utils/selection.ts +11 -0
- package/src/DataTable/utils/types/Entity.ts +7 -0
- package/src/DataTable/utils/types/Field.ts +4 -0
- package/src/DataTable/utils/types/OrderBy.ts +15 -0
- package/src/DataTable/utils/types/Schema.ts +5 -0
- package/src/DataTable/utils/useDeepEqualMemo.js +10 -0
- package/src/DataTable/utils/useTableEntities.ts +60 -0
- package/src/DataTable/utils/useTableParams.js +361 -0
- package/src/DataTable/utils/utils.ts +39 -0
- package/style.css +10537 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
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 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const getCellCopyText: (cellWrapper: HTMLElement | null) => (string | null | undefined)[];
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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:
|
|
13
|
-
cellIdToRight:
|
|
14
|
-
cellIdBelow:
|
|
15
|
-
cellIdToLeft:
|
|
16
|
-
rowDisabled:
|
|
17
|
+
cellIdAbove: string | 0;
|
|
18
|
+
cellIdToRight: string;
|
|
19
|
+
cellIdBelow: string | 0;
|
|
20
|
+
cellIdToLeft: string;
|
|
21
|
+
rowDisabled: boolean;
|
|
17
22
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Entity } from './types/Entity';
|
|
2
|
+
export declare const getIdOrCodeOrIndex: (record: Entity, rowIndex?: number) => string | number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 |
|
|
1
|
+
export function getRowCopyText(rowEl: any, { specificColumn }?: {}): (string | (string | null | undefined)[])[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function handleCopyColumn(
|
|
1
|
+
export function handleCopyColumn(tableRef: any, cellWrapper: any, selectedRecords: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function handleCopyTable(
|
|
1
|
+
export function handleCopyTable(tableRef: any, opts: any): void;
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
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
|
|
2
|
-
cellId:
|
|
3
|
-
selectionGrid:
|
|
4
|
-
lastRowIndex:
|
|
5
|
-
lastCellIndex:
|
|
6
|
-
entityMap:
|
|
7
|
-
|
|
8
|
-
}
|
|
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 @@
|
|
|
1
|
-
export const PRIMARY_SELECTED_VAL
|
|
1
|
+
export declare const PRIMARY_SELECTED_VAL = "main_cell";
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
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
|
};
|
|
@@ -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 @@
|
|
|
1
|
+
export function useDeepEqualMemo(value: any): undefined;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
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;
|