Skip to content

Commit

Permalink
finos#1073 move DateTimeColumnDescriptor to vuu-table-types package
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidzm13 committed Dec 15, 2023
1 parent 01bff1e commit 76e6a46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React, { useCallback } from "react";
import { FormattingSettingsProps } from "./types";
import { Dropdown, SingleSelectionHandler } from "@finos/vuu-ui-controls";
import {
DateTimeColumnDescriptor,
DateTimePattern,
defaultDateTimePatterns,
getTypeFormattingFromColumn,
isTypeDescriptor,
supportedDateTimePatterns,
} from "@finos/vuu-utils";
import { FormField, FormFieldLabel } from "@salt-ds/core";
import { DateTimeColumnTypeSimple } from "packages/vuu-table-types";
import {
DateTimeColumnDescriptor,
DateTimeColumnTypeSimple,
} from "@finos/vuu-table-types";

import { FormattingSettingsProps } from "./types";

export const DateTimeFormattingSettings: React.FC<
FormattingSettingsProps<DateTimeColumnDescriptor>
Expand Down
12 changes: 12 additions & 0 deletions vuu-ui/packages/vuu-table-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ export interface ValueListRenderer {
}

export declare type DateTimeColumnTypeSimple = "date" | "time";

type DateTimeColumnType =
| DateTimeColumnTypeSimple
| (Omit<ColumnTypeDescriptor, "name"> & { name: DateTimeColumnTypeSimple });

export declare type DateTimeColumnDescriptor = Omit<
ColumnDescriptor,
"type"
> & {
type: DateTimeColumnType;
};

export declare type ColumnTypeSimple =
| "string"
| "number"
Expand Down
9 changes: 1 addition & 8 deletions vuu-ui/packages/vuu-utils/src/column-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
LookupRenderer,
ValueListRenderer,
DateTimeColumnTypeSimple,
DateTimeColumnDescriptor,
} from "@finos/vuu-table-types";
import type { Filter, MultiClauseFilter } from "@finos/vuu-filter-types";
import type {
Expand Down Expand Up @@ -127,14 +128,6 @@ export const isNumericColumn = ({ serverDataType, type }: ColumnDescriptor) => {
return false;
};

type DateTimeColumnType =
| DateTimeColumnTypeSimple
| (Omit<ColumnTypeDescriptor, "name"> & { name: DateTimeColumnTypeSimple });

export type DateTimeColumnDescriptor = Omit<ColumnDescriptor, "type"> & {
type: DateTimeColumnType;
};

export const isDateColumn = ({ type }: ColumnDescriptor) =>
(isTypeDescriptor(type) ? type.name : type) === "date";
export const isTimeColumn = ({ type }: ColumnDescriptor) =>
Expand Down
7 changes: 5 additions & 2 deletions vuu-ui/packages/vuu-utils/src/date/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { DateTimeColumnTypeSimple } from "@finos/vuu-table-types";
import { DateTimeColumnDescriptor, isTypeDescriptor } from "../column-utils";
import {
DateTimeColumnTypeSimple,
DateTimeColumnDescriptor,
} from "@finos/vuu-table-types";
import { isTypeDescriptor } from "../column-utils";
import { DateTimePattern, isDateTimePattern } from "./types";

export const defaultDateTimePatterns: Record<
Expand Down

0 comments on commit 76e6a46

Please sign in to comment.