Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: workspace #2057

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"source.fixAll.eslint": "explicit"
},
"cSpell.words": [
"stylelint"
"stylelint",
"tdesign"
]
}
8 changes: 7 additions & 1 deletion js/date-picker/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { isString } from 'lodash-es';
import dayjs from 'dayjs';
import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear';
import isLeapYear from 'dayjs/plugin/isLeapYear';
import { extractTimeFormat } from './utils';
import log from '../log';

type DateValue = string | number | Date;
Expand All @@ -12,6 +11,13 @@ dayjs.extend(isLeapYear);

export const TIME_FORMAT = 'HH:mm:ss';

// extract time format from a completed date format 'YYYY-MM-DD HH:mm' -> 'HH:mm'
export function extractTimeFormat(dateFormat: string = '') {
return dateFormat
.replace(/\W?Y{2,4}|\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
.trim();
}

uyarn marked this conversation as resolved.
Show resolved Hide resolved
// 统一解析日期格式字符串成 Dayjs 对象
export function parseToDayjs(
value: string | Date | number,
Expand Down
7 changes: 0 additions & 7 deletions js/date-picker/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,6 @@ export function flagActive(data: any[], { ...args }: FlagActiveOptions) {
}));
}

// extract time format from a completed date format 'YYYY-MM-DD HH:mm' -> 'HH:mm'
export function extractTimeFormat(dateFormat: string = '') {
return dateFormat
.replace(/\W?Y{2,4}|\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
.trim();
}

/**
* 返回时间对象的小时、分钟、秒、12小时制标识
* @param {String} timeFormat 'pm 20:11:11:333'
Expand Down
9 changes: 9 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@tdesign/common-js",
"private": true,
"author": "tdesign",
"license": "MIT",
"exports": {
"./*": "./*.ts"
}
}
2 changes: 1 addition & 1 deletion js/tree/tree-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class TreeStore {
public setConfig(options: TypeTreeStoreOptions) {
const { config } = this;
let hasChanged = false;
(Object.keys(options)).forEach((key: keyof TypeTreeStoreOptions) => {
(Object.keys(options) as (keyof TypeTreeStoreOptions)[]).forEach((key) => {
const val = options[key];
if (val !== config[key]) {
hasChanged = true;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "tdesign-common",
"name": "@tdesign/common",
"private": true,
"version": "1.0.0",
"homepage": "https://github.com/Tencent",
"description": "TDesign UI 样式库以及组件库公共函数(js)",
Expand Down
1 change: 0 additions & 1 deletion style/mobile/.stylelintignore

This file was deleted.

31 changes: 0 additions & 31 deletions style/mobile/package.json

This file was deleted.

36 changes: 0 additions & 36 deletions style/mobile/webpack.config.js

This file was deleted.

6 changes: 6 additions & 0 deletions style/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@tdesign/common-style",
"private": true,
"author": "tdesign",
"license": "MIT"
}
1 change: 0 additions & 1 deletion style/web/.stylelintignore

This file was deleted.

14 changes: 0 additions & 14 deletions style/web/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion test/unit/date-picker/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { extractTimeFormat } from '../../../js/date-picker/utils';
import { extractTimeFormat } from '../../../js/date-picker/format';

describe('utils', () => {
describe(' extractTimeFormat', () => {
Expand Down