Skip to content

Commit

Permalink
wip: improve(ui): improve generated types
Browse files Browse the repository at this point in the history
  • Loading branch information
wzc520pyfm committed Jan 13, 2025
1 parent c0f1850 commit 3a4a4c9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
},
"devDependencies": {
"@ant-design/pro-form": "^2.31.2",
"@ant-design/pro-layout": "^7.21.2"
"@ant-design/pro-layout": "^7.21.2",
"@types/hoist-non-react-statics": "^3.3.6"
},
"peerDependencies": {
"react": ">=16.9.0",
Expand Down
28 changes: 27 additions & 1 deletion packages/ui/src/DateRanger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,33 @@ import InternalDateRanger from './Ranger';

export * from './Ranger';

const DateRanger = InternalDateRanger;
type InternalDateRangerType = typeof InternalDateRanger;

export interface DateRangerInstance extends InternalDateRangerType {
NEAR_1_MINUTES: typeof NEAR_1_MINUTES;
NEAR_5_MINUTES: typeof NEAR_5_MINUTES;
NEAR_10_MINUTES: typeof NEAR_10_MINUTES;
NEAR_20_MINUTES: typeof NEAR_20_MINUTES;
NEAR_30_MINUTES: typeof NEAR_30_MINUTES;
NEAR_1_HOURS: typeof NEAR_1_HOURS;
NEAR_2_HOURS: typeof NEAR_2_HOURS;
NEAR_3_HOURS: typeof NEAR_3_HOURS;
NEAR_6_HOURS: typeof NEAR_6_HOURS;
NEAR_12_HOURS: typeof NEAR_12_HOURS;
TODAY: typeof TODAY;
LAST_1_DAY: typeof LAST_1_DAY;
LAST_3_DAYS: typeof LAST_3_DAYS;
LAST_WEEK: typeof LAST_WEEK;
YESTERDAY: typeof YESTERDAY;
THIS_WEEK: typeof THIS_WEEK;
THIS_MONTH: typeof THIS_MONTH;
LAST_MONTH: typeof LAST_MONTH;
THIS_YEAR: typeof THIS_YEAR;
LAST_YEAR: typeof LAST_YEAR;
NEXT_YEAR: typeof NEXT_YEAR;
}

const DateRanger = InternalDateRanger as DateRangerInstance;

// 内置 ranges
DateRanger.NEAR_1_MINUTES = NEAR_1_MINUTES;
Expand Down

0 comments on commit 3a4a4c9

Please sign in to comment.