Skip to content

Commit

Permalink
chore: added .d.ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jul 4, 2024
1 parent 118c9dd commit 8cfa4d3
Show file tree
Hide file tree
Showing 235 changed files with 4,760 additions and 0 deletions.
38 changes: 38 additions & 0 deletions typings/interfaces/common/action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
ACTION_CLONE,
ACTION_DELETE,
ACTION_EDIT,
ACTION_RUN,
ACTION_UPLOAD,
ACTION_VIEW,
ACTION_VIEW_LOGS,
ACTION_VIEW_DATA,
ACTION_RESTART,
ACTION_COPY,
ACTION_START,
ACTION_STOP,
ACTION_SAVE,
ACTION_BACK,
ACTION_ENABLE,
} from '@/constants/action';

export declare global {
type ActionName =
| ACTION_VIEW
| ACTION_EDIT
| ACTION_CLONE
| ACTION_RUN
| ACTION_DELETE
| ACTION_UPLOAD
| ACTION_RESTART
| ACTION_VIEW_LOGS
| ACTION_VIEW_DATA
| ACTION_COPY
| ACTION_START
| ACTION_STOP
| ACTION_SAVE
| ACTION_BACK
| ACTION_ENABLE;

type GenericAction = ActionName | string;
}
16 changes: 16 additions & 0 deletions typings/interfaces/common/color.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export declare global {
type Color =
| 'red'
| 'magenta'
| 'purple'
| 'geekBlue'
| 'blue'
| 'cyan'
| 'green'
| 'limeGreen'
| 'yellow'
| 'gold'
| 'orange';

type ColorFunc = (m: MetricMeta) => string;
}
3 changes: 3 additions & 0 deletions typings/interfaces/common/dataType.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare global {
type BoolFunc = (data: any) => boolean;
}
5 changes: 5 additions & 0 deletions typings/interfaces/common/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './action';
export * from './color';
export * from './dataType';
export * from './lang';
export * from './os';
3 changes: 3 additions & 0 deletions typings/interfaces/common/lang.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare global {
type Lang = 'en' | 'zh';
}
5 changes: 5 additions & 0 deletions typings/interfaces/common/os.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OS_WINDOWS, OS_MAC, OS_LINUX } from '@/constants/os';

export declare global {
type OS = OS_WINDOWS | OS_MAC | OS_LINUX;
}
1 change: 1 addition & 0 deletions typings/interfaces/components/button/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type ButtonType = 'button' | 'fa-icon' | 'icon' | 'label';
16 changes: 16 additions & 0 deletions typings/interfaces/components/chart/Metric.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
interface MetricProps {
title?: string;
value?: number | string;
icon?: Icon;
color?: string;
clickable?: boolean;
}

interface MetricMeta {
name: string;
key: string;
value: number | string;
icon: Icon;
color?: string | ColorFunc;
path?: string;
}
3 changes: 3 additions & 0 deletions typings/interfaces/components/chart/MetricLineChart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface MetricLineChartProps extends LineChartProps {
metric?: string;
}
8 changes: 8 additions & 0 deletions typings/interfaces/components/chart/PieChart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface PieChartProps {
config: EChartsConfig;
width?: string;
height?: string;
theme?: string;
labelKey?: string;
valueKey?: string;
}
6 changes: 6 additions & 0 deletions typings/interfaces/components/color/ColorPicker.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface ColorPickerProps {
modelValue?: string;
disabled?: boolean;
predefine?: string[];
showAlpha?: boolean;
}
9 changes: 9 additions & 0 deletions typings/interfaces/components/context-menu/ContextMenu.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// import {Placement} from '@popperjs/core/lib/enums';
//
// declare global {
// interface ContextMenuProps {
// visible?: boolean;
// trigger: HTMLElement | string;
// placement?: Placement;
// }
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface ContextMenuListProps {
items: ContextMenuItem[];
}
22 changes: 22 additions & 0 deletions typings/interfaces/components/date/date.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Dayjs } from 'dayjs';

export declare global {
interface DateRange {
start: Dayjs;
end: Dayjs;
}

interface RangeItem {
key: RangeItemKey;
value?: DateRange;
}

interface RangeItemOption extends SelectOption {
value?: RangeItem;
}

type RangeItemValue = RangeItemValueFunc | DateRange;
type RangeItemValueFunc = () => DateRange;
type RangeItemKey = 'custom' | string;
type RangePickerType = 'daterange' | 'datetimerange';
}
18 changes: 18 additions & 0 deletions typings/interfaces/components/dialog/CreateEditDialog.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Ref } from 'vue';

declare global {
type CreateEditDialogType = 'create' | 'edit';

type CreateEditTabName = 'single' | 'batch';

interface CreateEditDialogActionFunctions {
onClose: () => void;
onConfirm: () => Promise<void>;
onTabChange: (value: CreateEditTabName) => void;
onAdd: (rowIndex: number) => void;
onClone: (rowIndex: number) => void;
onDelete: (rowIndex: number) => void;
onFieldChange: (rowIndex: number, prop: string, value: any) => void;
onFieldRegister: (rowIndex: number, prop: string, formRef: Ref) => void;
}
}
5 changes: 5 additions & 0 deletions typings/interfaces/components/dialog/Dialog.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type DialogKey = 'create' | 'edit' | 'run' | 'uploadFiles' | 'logs' | 'diff';

interface DialogVisible {
createEdit: boolean;
}
13 changes: 13 additions & 0 deletions typings/interfaces/components/drag/DraggableItem.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export declare global {
interface DraggableItemData {
key: string;
dragging: boolean;

[prop: string]: any;
}

interface DraggableListInternalItems {
draggingItem?: DraggableItemData;
targetItem?: DraggableItemData;
}
}
5 changes: 5 additions & 0 deletions typings/interfaces/components/drag/DraggableItemContent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare global {
interface DraggableItemContentProps {
item: DraggableItemData;
}
}
Empty file.
5 changes: 5 additions & 0 deletions typings/interfaces/components/ds/DataSourceConnectType.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare global {
interface DataSourceConnectTypeProps {
dataSource?: DataSource;
}
}
3 changes: 3 additions & 0 deletions typings/interfaces/components/ds/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './DataSourceConnectType';
export * from './DataSourceType';
export * from './DataSource';
15 changes: 15 additions & 0 deletions typings/interfaces/components/file/FileEditor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export declare global {
interface FileEditorOptions {
theme: 'vs' | 'vs-dark' | 'hc-black';
}

interface FileEditorStyles {
default: FileEditorStyle;
active: FileEditorStyle;
}

interface FileEditorStyle {
backgroundColor?: string;
color?: string;
}
}
19 changes: 19 additions & 0 deletions typings/interfaces/components/file/FileEditorNavMenu.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export declare global {
interface FileEditorNavMenuCache<T = any> {
[key: string]: T;
}

interface FileNavItem {
id?: string;
is_dir?: boolean;
path?: string;
name?: string;
extension?: string;
children?: FileNavItem[];
}

interface FileEditorNavMenuClickStatus {
clicked: boolean;
item?: FileNavItem;
}
}
7 changes: 7 additions & 0 deletions typings/interfaces/components/file/FileEditorNavTabs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare global {
interface FileEditorNavTabsProps {
activeTab?: FileNavItem;
tabs: FileNavItem[];
style?: any;
}
}
25 changes: 25 additions & 0 deletions typings/interfaces/components/file/FileUpload.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { FILE_UPLOAD_MODE_DIR, FILE_UPLOAD_MODE_FILES } from '@/constants';

export declare global {
interface FileUploadModeOption {
label: string;
value: string;
}

interface FileUploadInfo {
dirName?: string;
fileCount?: number;
filePaths?: string[];
}

type FileUploadMode = FILE_UPLOAD_MODE_DIR | FILE_UPLOAD_MODE_FILES;

interface FileWithPath extends File {
path?: string;
}

type InputFile = (FileWithPath | DataTransferItem) & {
path?: string;
size?: number;
};
}
4 changes: 4 additions & 0 deletions typings/interfaces/components/file/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './FileEditor';
export * from './FileEditorNavMenu';
export * from './FileEditorNavTabs';
export * from './FileUpload';
7 changes: 7 additions & 0 deletions typings/interfaces/components/filter/FilterCondition.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare global {
interface FilterConditionData {
key?: string;
op?: string;
value?: any;
}
}
3 changes: 3 additions & 0 deletions typings/interfaces/components/filter/FilterConditionList.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface FilterConditionListProps {
conditions: FilterConditionData[];
}
6 changes: 6 additions & 0 deletions typings/interfaces/components/filter/FilterInput.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare global {
interface FilterInputProps {
label?: string;
placeholder?: string;
}
}
15 changes: 15 additions & 0 deletions typings/interfaces/components/filter/FilterSelect.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export declare global {
interface FilterSelectOptionsRemote {
colName: string;
value?: string;
label?: string;
}

interface FilterSelectProps {
label?: string;
placeholder?: string;
filterable?: boolean;
options?: SelectOption[];
optionsRemote?: FilterSelectOptionsRemote;
}
}
12 changes: 12 additions & 0 deletions typings/interfaces/components/filter/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ASCENDING, DESCENDING, UNSORTED } from '@/constants/sort';

declare global {
type SortDirection = ASCENDING | DESCENDING | UNSORTED | undefined;

interface SortData {
// key
key: string;
// direction
d?: string;
}
}
51 changes: 51 additions & 0 deletions typings/interfaces/components/form/Form.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { RuleItem } from 'async-validator';
import { Ref } from 'vue';
import {
FORM_FIELD_TYPE_CHECK_TAG_GROUP,
FORM_FIELD_TYPE_INPUT,
FORM_FIELD_TYPE_INPUT_TEXTAREA,
FORM_FIELD_TYPE_INPUT_WITH_BUTTON,
FORM_FIELD_TYPE_TAG_INPUT,
FORM_FIELD_TYPE_TAG_SELECT,
} from '@/constants/form';

declare global {
interface FormContext {
labelWidth?: string;
size?: string;
grid: number;
}

interface FormModel {
[key: string]: any;
}

interface FormRuleItem extends RuleItem {
trigger?: string;
}

interface FormRules {
[key: string]: FormRuleItem | FormRuleItem[];
}

type FormValidateCallback = (valid: boolean) => void;

interface FormComponentData<T> {
formRef: Ref;
formList: Ref<T[]>;
formTableFieldRefsMap: Ref<FormTableFieldRefsMap>;
}

type FormTableFieldRefsMapKey = [number, string];
type FormTableFieldRefsMap = Map<FormTableFieldRefsMapKey, Ref>;

type DefaultFormFunc<T> = () => T;

type FormFieldType =
| FORM_FIELD_TYPE_INPUT
| FORM_FIELD_TYPE_INPUT_TEXTAREA
| FORM_FIELD_TYPE_INPUT_WITH_BUTTON
| FORM_FIELD_TYPE_TAG_INPUT
| FORM_FIELD_TYPE_TAG_SELECT
| FORM_FIELD_TYPE_CHECK_TAG_GROUP;
}
16 changes: 16 additions & 0 deletions typings/interfaces/components/form/FormItem.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RuleItem } from 'async-validator';

declare global {
interface FormItemProps {
prop?: string;
label?: string;
labelTooltip?: string;
labelWidth?: string;
size?: string;
span: number;
offset: number;
required: boolean;
rules?: RuleItem | RuleItem[];
notEditable?: boolean;
}
}
Loading

0 comments on commit 8cfa4d3

Please sign in to comment.