Skip to content

Commit 6ae06ec

Browse files
committed
Merge remote-tracking branch 'upstream/feat_v3.x' into 3.0-font
2 parents 0946c4b + f764c71 commit 6ae06ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+906
-1023
lines changed

migrate-from-v2.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,9 @@ plugins: [
273273

274274
#### NavBar
275275

276-
- `desc` 重命名为 `right`,类型修改为 `React.Node`
277-
- 新增 `left`,左侧内容,渲染在返回区域的右侧
278-
- 新增 `back`,返回区域内容
279-
- `onClickBack` 重命名为 `onBackClick`
280-
- 移除 `title`,通过 `children` 实现
281-
- 移除 `leftText` `leftShow`,通过 `back``left`实现
282-
- `safeAreaInsetTop` 重命名为 `safeArea`
283-
- `border` 废弃
284-
- 移除 `onClickTitle` `onClickRight` `onClickIcon`,通过在`left``title``right`自定义事件实现,参考文档demo示例
285-
-
276+
- 移除 titleAlign 属性,可通过 title 和 children 替代
277+
- 增加 title 属性,默认居中展示
278+
- 组件中出现 children ,则采取 titleAlign 的 left 方式布局
286279

287280
#### Pagination
288281

@@ -417,6 +410,10 @@ plugins: [
417410

418411
#### Input
419412

413+
- 新增 `plain` 属性,标记为 纯文本型;该值默认为false,标记为 container 容器型;
414+
- 区分了 readonly 和 disabled 的样式;
415+
- 删除一些样式变量,统一到由通用变量控制,如`$input-color``$input-disabled-color`
416+
420417
#### InputNumber
421418

422419
- 增加 `allowEmpty`, 用于允许内容是否为空
@@ -516,12 +513,9 @@ plugins: [
516513

517514
#### TextArea
518515

519-
- `maxlength` 重命名为 `maxLength`
520-
- `readonly` 重命名为 `readOnly`
521-
- `limitShow` 重命名为 `showCount`
522-
- `autosize` 重命名为 `autoSize`
523-
- 移除 `textAlign`,可通过 `style` 传入
524-
- `defaultValue` 改为非受控,增加受控值 `value`
516+
- 新增 `plain` 属性,标记为 纯文本型;该值默认为false,标记为 container 容器型;
517+
- 新增 `status` 属性,值为 `default` | `error`,可定义输入框的状态;
518+
- 删掉一些可使用基础样式变量,并且建议使用基础样式变量的样式变量,比如 `$textarea-font` `$textarea-limit-color` `$textarea-disabled-color`
525519

526520
#### Uploader
527521

scripts/build-taro.mjs

Lines changed: 75 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,32 @@ async function buildUMD() {
213213
}
214214

215215
async function buildAllCSS() {
216+
// 拷贝styles
217+
async function copyStyles() {
218+
await copy(
219+
resolve(__dirname, '../src/styles'),
220+
resolve(__dirname, '../dist/styles')
221+
)
222+
223+
const content = [
224+
`@import './styles/theme-default.scss';`,
225+
`@import './styles/variables.scss';`,
226+
`@import './styles/mixins/index.scss';`,
227+
`@import './styles/animation/index.scss';`,
228+
]
229+
const projectID = process.env.VITE_APP_PROJECT_ID
230+
if (projectID) {
231+
content[1] = `@import '../variables-${projectID}.scss';`
232+
}
233+
const scssFiles = await glob(['dist/es/packages/**/*.scss'])
234+
scssFiles.forEach((file) => {
235+
content.push(
236+
`@import '${relativeFilePath('/dist/style.scss', '/' + file)}';`
237+
)
238+
})
239+
dest('dist/style.scss', content.join('\n'))
240+
}
241+
await copyStyles()
216242
await vite.build({
217243
logLevel: 'error',
218244
resolve: {
@@ -221,7 +247,7 @@ async function buildAllCSS() {
221247
build: {
222248
emptyOutDir: false,
223249
lib: {
224-
entry: './dist/styles/themes/default.scss',
250+
entry: './dist/style.scss',
225251
formats: ['es'],
226252
name: 'style',
227253
fileName: 'style',
@@ -230,6 +256,29 @@ async function buildAllCSS() {
230256
})
231257
}
232258

259+
async function buildThemeCSS() {
260+
await vite.build({
261+
logLevel: 'error',
262+
resolve: {
263+
alias: [{ find: '@', replacement: resolve(__dirname, '../src') }],
264+
},
265+
build: {
266+
emptyOutDir: false,
267+
rollupOptions: {
268+
output: [
269+
{
270+
dir: 'dist/styles/themes',
271+
assetFileNames: 'default.css',
272+
},
273+
],
274+
},
275+
lib: {
276+
entry: './dist/styles/themes/default.scss',
277+
},
278+
},
279+
})
280+
}
281+
233282
// 拷贝styles
234283
async function copyStyles() {
235284
await copy(
@@ -338,39 +387,45 @@ async function buildCSS(p) {
338387

339388
}
340389

341-
console.log('clean dist')
390+
console.time('clean dist')
342391
await deleteAsync('dist')
343-
console.log('clean: ✅')
392+
console.timeEnd('clean dist')
344393

345394
await generate()
346395

347-
console.log('build ES Module')
396+
console.time('build ES Module')
348397
await buildES()
349-
console.log('build ES Module: ✅')
398+
console.timeEnd('build ES Module')
350399

351-
console.log('build CommonJS')
400+
console.time('build CommonJS')
352401
await buildCJS()
353-
console.log('build CommonJS: ✅')
402+
console.timeEnd('build CommonJS')
354403

355-
console.log('build UMD')
404+
console.time('build UMD')
356405
await buildUMD()
357-
console.log('build UMD: ✅')
406+
console.timeEnd('build UMD')
358407

359-
console.log('Build CSS')
408+
console.time('Build CSS')
360409
await buildCSS()
361-
console.log('Build CSS: ✅')
410+
console.timeEnd('Build CSS')
362411

363-
console.log('Copy Styles')
412+
console.time('Copy Styles')
364413
await copyStyles()
365-
console.log('Copy Styles: ✅')
414+
console.timeEnd('Copy Styles')
366415

367-
console.log('Build All CSS')
416+
console.time('Build All CSS')
368417
await buildAllCSS()
369-
console.log('Build All CSS: ✅')
418+
console.timeEnd('Build All CSS')
419+
420+
console.time('Build Theme CSS')
421+
await buildThemeCSS()
422+
console.timeEnd('Build Theme CSS')
370423

371-
console.log('Build Declaration')
424+
console.time('Build Declaration')
372425
await buildDeclaration()
373-
console.log('Build Declaration: ✅')
426+
console.timeEnd('Build Declaration')
427+
428+
// await exportProps()
374429

375430
await deleteAsync([
376431
'dist/es/packages/nutui.react.js',
@@ -379,4 +434,6 @@ await deleteAsync([
379434
'dist/es/packages/nutui.react.scss.js',
380435
])
381436

382-
codeShift('Taro')
437+
console.time('Build JSDoc')
438+
codeShift()
439+
console.timeEnd('Build JSDoc')

scripts/build.mjs

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,32 @@ async function buildUMD(p) {
173173
}
174174

175175
async function buildAllCSS() {
176+
// 拷贝styles
177+
async function copyStyles() {
178+
await copy(
179+
resolve(__dirname, '../src/styles'),
180+
resolve(__dirname, '../dist/styles')
181+
)
182+
183+
const content = [
184+
`@import './styles/theme-default.scss';`,
185+
`@import './styles/variables.scss';`,
186+
`@import './styles/mixins/index.scss';`,
187+
`@import './styles/animation/index.scss';`,
188+
]
189+
const projectID = process.env.VITE_APP_PROJECT_ID
190+
if (projectID) {
191+
content[1] = `@import '../variables-${projectID}.scss';`
192+
}
193+
const scssFiles = await glob(['dist/es/packages/**/*.scss'])
194+
scssFiles.forEach((file) => {
195+
content.push(
196+
`@import '${relativeFilePath('/dist/style.scss', '/' + file)}';`
197+
)
198+
})
199+
dest('dist/style.scss', content.join('\n'))
200+
}
201+
await copyStyles()
176202
await vite.build({
177203
logLevel: 'error',
178204
resolve: {
@@ -181,7 +207,7 @@ async function buildAllCSS() {
181207
build: {
182208
emptyOutDir: false,
183209
lib: {
184-
entry: './dist/styles/themes/default.scss',
210+
entry: './dist/style.scss',
185211
formats: ['es'],
186212
name: 'style',
187213
fileName: 'style',
@@ -190,6 +216,29 @@ async function buildAllCSS() {
190216
})
191217
}
192218

219+
async function buildThemeCSS() {
220+
await vite.build({
221+
logLevel: 'error',
222+
resolve: {
223+
alias: [{ find: '@', replacement: resolve(__dirname, '../src') }],
224+
},
225+
build: {
226+
emptyOutDir: false,
227+
rollupOptions: {
228+
output: [
229+
{
230+
dir: 'dist/styles/themes',
231+
assetFileNames: 'default.css',
232+
},
233+
],
234+
},
235+
lib: {
236+
entry: './dist/styles/themes/default.scss',
237+
},
238+
},
239+
})
240+
}
241+
193242
// 拷贝styles
194243
async function copyStyles() {
195244
await copy(
@@ -218,6 +267,7 @@ async function buildCSS(p) {
218267
const cssFiles = await glob(['src/packages/**/*.scss'], {
219268
ignore: ['src/packages/**/demo.scss'],
220269
})
270+
221271
const variables = await readFile(
222272
join(__dirname, '../src/styles/variables.scss')
223273
)
@@ -296,26 +346,6 @@ async function buildCSS(p) {
296346
}
297347
}
298348

299-
// async function exportProps() {
300-
// const types = []
301-
// const a = await readFile(join(__dirname, '../src/config.json'))
302-
// const componentsConfig = JSON.parse(a.toString())
303-
// componentsConfig.nav.forEach((item) => {
304-
// item.packages.forEach((element) => {
305-
// const { name, show, exportEmpty } = element
306-
// if (show || exportEmpty) {
307-
// const lowerName = name.toLowerCase()
308-
// if (lowerName === 'icon') return
309-
// types.push(`export * from './${lowerName}/index'`)
310-
// }
311-
// })
312-
// })
313-
// await appendFile(
314-
// join(__dirname, '../dist/es/packages/nutui.react.build.d.ts'),
315-
// types.join('\n')
316-
// )
317-
// }
318-
319349
console.time('clean dist')
320350
await deleteAsync('dist')
321351
console.timeEnd('clean dist')
@@ -346,6 +376,10 @@ console.time('Build All CSS')
346376
await buildAllCSS()
347377
console.timeEnd('Build All CSS')
348378

379+
console.time('Build Theme CSS')
380+
await buildThemeCSS()
381+
console.timeEnd('Build Theme CSS')
382+
349383
console.time('Build Declaration')
350384
await buildDeclaration()
351385
console.timeEnd('Build Declaration')

src/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@
331331
"sort": 1,
332332
"show": true,
333333
"taro": true,
334+
"v15": true,
334335
"author": "dsj"
335336
},
336337
{
@@ -538,6 +539,7 @@
538539
"sort": 1,
539540
"show": true,
540541
"taro": true,
542+
"v15": true,
541543
"author": "VickyYe"
542544
},
543545
{
@@ -702,6 +704,7 @@
702704
"sort": 2,
703705
"show": true,
704706
"taro": true,
707+
"v15": true,
705708
"author": "VickyYe"
706709
},
707710
{

src/packages/formitem/formitem.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.nut-form-item {
22
display: flex;
3+
align-items: center;
4+
padding: 4px 12px;
35

46
&.error {
57
&.line {

src/packages/input/demos/h5/demo1.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Divider, Input } from '@nutui/nutui-react'
33

44
const Demo1 = () => {
55
return (
66
<>
7-
<Input placeholder="请输入文本" />
7+
<Input placeholder="请输入文本:容器型" />
8+
<Divider />
9+
<Input placeholder="请输入文本:纯文本型" plain />
810
</>
911
)
1012
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo10 = () => {
55
const formatter = (value: string) => value.replace(/\d/g, '')
66
return (
7-
<>
7+
<Space direction="vertical" style={{ marginBottom: 10 }}>
88
<Input formatter={formatter} placeholder="在输入时移除数字" />
99
<Input
1010
formatter={formatter}
1111
formatTrigger="onBlur"
1212
placeholder="在失焦时移除数字"
1313
/>
14-
</>
14+
</Space>
1515
)
1616
}
1717
export default Demo10
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo11 = () => {
55
return (
6-
<>
6+
<Space direction="vertical" style={{ marginBottom: 10 }}>
77
<Input align="left" placeholder="文本内容对齐" />
88
<Input align="right" placeholder="文本内容对齐" />
9-
</>
9+
</Space>
1010
)
1111
}
1212
export default Demo11

0 commit comments

Comments
 (0)