Compare commits

...

633 Commits
3.x ... main

Author SHA1 Message Date
tangjinzhou 2cda7bde09 docs: add Sponsor 2025-11-18 00:45:12 +08:00
tangjinzhou 6255f1632c docs: update readme 2025-11-18 00:29:08 +08:00
tangjinzhou ef51f7f1cc docs: update GlobalConfig type import paths across multiple components 2025-11-17 23:57:03 +08:00
tangjinzhou 252a0e2563 docs: clean up GlobalConfig type definition by moving it to a separate type file 2025-11-17 23:50:44 +08:00
tangjinzhou bbb7670df1 refactor: remove Google Ads component from top_rice.vue and update favicon.ico 2025-09-20 14:30:15 +08:00
tangjinzhou fcdda4a0be docs: update links 2025-09-19 11:28:25 +08:00
tangjinzhou 79b63b41c6 feat: add routing configuration for antdv.com in wrangler.jsonc 2025-09-19 00:16:11 +08:00
tangjinzhou 56d9b358f2 refactor: remove Surely Form links and related alert banners from Menu and Header components 2025-09-18 23:08:14 +08:00
tangjinzhou b58e73d51a refactor: update URLs from surely.cool to surelyvue.com across multiple components and documentation 2025-09-18 22:54:57 +08:00
tangjinzhou e8ec520d9a docs: update npm scripts for build process and remove cheerio dependency 2025-09-18 22:53:48 +08:00
tangjinzhou ce56f0c8f6 docs: remove aliyun 2025-09-18 22:39:56 +08:00
Sid Roberts 723bb47a42
Updated to actions/cache@v4 for GitHub workflows. (#8317)
https://github.com/actions/cache/discussions/1510
2025-08-27 15:30:19 +08:00
Junyang 57ea8a65d4
fix: fixed the Select component not taking keys according to the corresponding value when passing fieldNames. (#8247)
Co-authored-by: fanjunyang <fanjunyang@daojia-inc.com>
2025-08-27 15:27:56 +08:00
Chris Yang 7e5008080d
fix: Select tagRender click cannot open list #8132 (#8236) 2025-08-27 15:24:42 +08:00
MonsterXue 74b3018945
fix(slider): fix slider last dot can’t click (#8246) 2025-08-27 15:12:36 +08:00
Jason Ren 28b1c4f62d
docs: typo in button (#8024) 2025-08-27 15:09:00 +08:00
pengpeng 04f6ba33c7
fix(vcSelect):Maintain keyboard events when using a custom element. (#8321) 2025-08-27 15:07:36 +08:00
Mr.Zhang 35c1ad9c80
docs: anchor scroll (#8245) 2025-07-09 11:47:07 +08:00
HeyXml e9f8ea7903
fix: popover Mask.tsx v-if #8252 (#8253) 2025-07-09 11:45:52 +08:00
云荷YunHerry 27acc9a80e
docs(table): ajax demo (#8120)
Co-authored-by: Xian Yu <h3209851541@outlook.com>
2025-06-13 15:46:47 +08:00
selicens 43ad5dec90
docs(mentions): Spelling error in En title (#8127) 2025-06-13 15:45:49 +08:00
selicens aa8802679f
docs(Typography): fix slot name (#8184) 2025-06-13 15:35:05 +08:00
爆炒芋头 aa211fd789
docs(input): showCount type 文档 (#8041)
* fix(input): showCount type 文档

* fix(input): showCount type 文档

---------

Co-authored-by: zhiqiangchen <zhiqiang.chen@igg.com>
2025-03-06 14:37:19 +08:00
tangjinzhou 61d39be86f
Update config.yml 2025-03-06 14:34:53 +08:00
tangjinzhou b80bd37f6e fix: sm select placeholder 2025-02-17 11:28:06 +08:00
wzc520pyfm 3db5e191b8
docs: add ant-design-x-vue link at ecosystem (#8034) 2025-02-09 09:23:58 +08:00
Attacktive 45c7109212
docs: correct possible `size` size in component Select (#7991) 2025-01-05 17:04:07 +08:00
Shai b58d0fb723
docs: added centered to docs (#7967) 2025-01-05 16:55:58 +08:00
clddup a21a1ca533
docs: theme editor 2025-01-05 16:54:32 +08:00
tangjinzhou 4a37016f4e fix: ts type error 2024-11-11 14:52:27 +08:00
tangjinzhou 5d6ebb30ac release 4.2.6 2024-11-11 14:47:34 +08:00
tangjinzhou 888457238d fix: modal aria error 2024-11-11 14:40:49 +08:00
果冻橙 b0d9309471
docs: Add custom icons to support Rsbuild documentation (#7743) 2024-11-08 10:30:05 +08:00
selicens f64d0718ae
docs: Change the default values of attributes (#7744) 2024-11-08 10:28:03 +08:00
selicens 968317ca9f
fix(InputNumber): disabled text clolor (#7776) 2024-11-08 10:18:03 +08:00
Carl Chen 22dad3ba6d
fix[Select]: fix select losing focus issue (#7829) 2024-11-08 10:17:22 +08:00
iamnotblank 4f7bd6f28d
fix(Dialog): aira error (#7823)
* fix(vc-dialog): aira error

* fix(vc-dialog): aira error
2024-11-07 22:54:53 +08:00
snoweast 12fcfa15b1
fix: Safari of input IME (#7918) 2024-11-07 22:45:48 +08:00
tangjinzhou e46d537d45 release 4.2.5 2024-09-19 19:08:59 +08:00
tangjinzhou ac9d1b0a7f fix: empty memory issue 2024-09-19 19:07:08 +08:00
tangjinzhou 2c7008d786 fix: image width & height not work 2024-09-19 19:06:34 +08:00
tangjinzhou 49d4b3166e feat: update type 2024-09-13 19:33:38 +08:00
tangjinzhou 339fb4a230 release 4.2.4 2024-09-13 19:06:37 +08:00
tangjinzhou bb443a05e2 fix: button wave memory leak 2024-09-13 19:05:04 +08:00
YYP 3a79f72816
fix(doc): `positonStyle` typo (#7808) 2024-09-13 18:51:17 +08:00
5918vo 89eec07145
docs: event demo (#7699) (#7728) 2024-09-05 11:38:10 +08:00
Jason Ren c69a6d29b2
docs(zh-cn): finish translation of float-button (#7811) 2024-09-05 11:37:36 +08:00
tangjinzhou 2666cb79ab refactor: transition 2024-06-21 13:40:28 +08:00
tangjinzhou 35d5185634 docs: update changelog 2024-06-10 09:37:38 +08:00
tangjinzhou 4492086aac release 4.2.3 2024-06-10 09:20:15 +08:00
trry-hub 4b7c6ac02c
feat: TourStep support fn children (#7628)
* Fix: [修复自定义按钮无渲染]

* refactor(完善 Tour 自定义按钮代码健壮性): 🦄

---------

Co-authored-by: shizhu <shizhu@yaomaitong.cn>
2024-06-10 09:14:27 +08:00
Kylin 208b8d3085
docs: unify the default value of none to - (#7636) 2024-06-09 22:08:30 +08:00
Carl Chen f41fec26ba
fix[vc-util]: styleObjectToString filter invalid value (#7642) 2024-06-09 09:56:45 +08:00
tangjinzhou 9118d6cd42 release 4.2.2 2024-06-06 10:16:02 +08:00
Aaron-zon 5c7aaf0dd6
fix(FloatButton): type error (#7632) 2024-06-06 10:03:24 +08:00
evanlc b82d8dd2ad
fix(PresetPanel): preset panel stopPropagation (#7550) 2024-06-04 23:28:22 +08:00
Aaron-zon 1d0fa8533a
fix: add missing space-evenly alignment for grid rows (#7579) 2024-06-04 23:26:03 +08:00
Kylin 4318147fc6
refactor(input): remove unnecessary assertions and use?? instead of the ternary operator (#7571)
* refactor: remove unnecessary assertions and use?? instead of the ternary operator

* refactor: use?? instead of the ternary operator
2024-06-04 23:24:44 +08:00
Carl Chen 312bcc5127
docs(collapse): modify the `accordion` attribute text to be easier to understand (#7612) 2024-06-04 23:20:54 +08:00
tangjinzhou 6594fe3964 fix: textarea 2024-06-04 23:12:06 +08:00
tangjinzhou 82f28ce3d0 fix: select input 2024-06-04 21:20:10 +08:00
Carl Chen 6e2c5a6a83
fix[select]: fix placeholder error when inputting Chinese (#7611)
* fix[select]: fix placeholder error when inputting Chinese

fix(selector): fix placeholder error when inputting Chinese

perf: optimize types

* Update SingleSelector.tsx

* Update index.tsx

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2024-06-04 18:59:24 +08:00
lchrennew 307148e2df
fix: empty space-item are not been hidden (#7557) 2024-06-04 16:13:11 +08:00
bsuooo afebeb9ffa
docs(DatePicker): updating deprecated API (#7570) 2024-06-04 16:12:20 +08:00
selicens aeda2637f6
fix(Input): Chinese input is invalid when the modifier is lazy (#7543) 2024-06-04 16:10:46 +08:00
extclp f42d8ad1ce
chore: remove css-animation (#7613)
* chore: remove css-animate

* chore(site): remove localStorage support check
2024-06-04 16:05:21 +08:00
selicens 33a0708eb4
docs: upgrade document link direction error (#7602) 2024-06-04 16:01:26 +08:00
selicens 085eb398a4
fix(FormItem): class name error (#7582) 2024-06-04 16:00:40 +08:00
selicens 9c27414cd0
fix(FloatButton): type prompt error (#7576) 2024-06-04 15:57:40 +08:00
Kylin 014e86bd27
docs: update README-zh_CN (#7584) 2024-06-04 15:49:47 +08:00
tangjinzhou 40ad45bc05 fix: tree reative data error 2024-06-04 15:46:22 +08:00
neverland 1c82940160
docs: add Vite and Rsbuild to getting started (#7556) 2024-05-09 21:21:20 +08:00
bsuooo 7ce0f115d5
fix(cascader): remove outdated compatibility code(#7532) (#7534) 2024-04-30 19:13:48 +08:00
extclp 54434b0931
docs(Select): remove qs dependencie (#7541) 2024-04-30 19:12:05 +08:00
selicens e01f26c541
fix(TreeSelect): placehold slot invalid (#7545) 2024-04-30 19:11:08 +08:00
tangjinzhou 9a45b35511 release 4.2.1 2024-04-25 09:40:07 +08:00
hippo 8e8073d17e
fix: input clear error (#7523) 2024-04-25 09:29:38 +08:00
extclp d6cc262c3a
refactor: replement deprecated fields (#7519) 2024-04-25 09:25:29 +08:00
tangjinzhou 9d7c171940 release 4.2.0 2024-04-22 15:51:05 +08:00
extclp 48a3ceb921
chore: remove vetur type generator (#7517) 2024-04-22 15:27:58 +08:00
tangjinzhou 23c620ea3a fix: select customicon error #7377 2024-04-22 15:26:02 +08:00
tangjinzhou 752686e334 fix: input composing error, close #7516 2024-04-22 15:11:10 +08:00
tangjinzhou 9b0f0e71e7 perf: table hover cell, close #7451 2024-04-22 10:37:28 +08:00
24min 42d33e963c
fix: carousel beforeChange current value not correct (#7419) 2024-04-22 10:18:19 +08:00
tangjinzhou ed27700ef4 style: lint code 2024-04-22 10:07:02 +08:00
extclp eedd7f3302
chore: remove json file type declare (#7514) 2024-04-22 10:00:03 +08:00
Carl Chen c28c38d02e
fix[Select|Cascader]: select multiple error & cascader error in ssr mode (#7377)
* docs: updating the `dropdownRender` description and jumps in the FAQ for Select

* fix: fix  select error in multiple mode

* fix: fix cascader select error in ssr mode
2024-04-19 22:56:07 +08:00
ashu-guo 162d1fcf95
fix(AutoComplete): #7380 and #7276 (#7391) 2024-04-19 22:46:19 +08:00
selicens 4815ee6f20
fix(Pagination): block default events for the enter key (#7368)
* fix(Pagination): block default events for the enter key

* refactor: consider other keyboard events
2024-04-19 22:44:34 +08:00
bqy_fe 2b41e56520
fix(Input): autoSize not work when change value in onMounted (#7478) 2024-04-19 22:36:44 +08:00
Sean ab874ffd4b
docs: update tree-select api description (#7388) 2024-04-19 22:07:41 +08:00
tangjinzhou 61ade6b8ec fix: autoComplete option slot error, close #7396 #7405 2024-04-19 19:27:51 +08:00
selicens 4d35b8caa3
docs(Modal): add simplified descriptions (#7408)
close #7393
2024-04-19 19:19:33 +08:00
Tang 040af82eb9
docs: update table docs (#7400)
Co-authored-by: 汤显文 <tang_xianwen@gov-info.cn>
2024-04-19 19:19:01 +08:00
Carl Chen a8c72fc5e7
fix[Menu]: fix `menu-item-group` not rendering in SSR (#7349)
* docs: updating the `dropdownRender` description and jumps in the FAQ for Select

* fix: `menu-item-group` rendered in ssr
2024-04-19 19:18:30 +08:00
ashu-guo c25736d57d
chore: merge duplicate property declarations (#7417) 2024-04-19 19:16:46 +08:00
SonicKang 4a48bfc66b
fix: a-qrcord component cannot show ts prompt (#7502) 2024-04-19 19:15:12 +08:00
tangjinzhou 4138d3c822 fix: tabs size error, close #7491 #7482 2024-04-19 19:14:18 +08:00
tangjinzhou dec67a6d65 docs: update site 2024-04-19 19:13:06 +08:00
Carl Chen 85c48c0566
feat[tooltip]: add `arrow` attribute (#7459)
* docs: updating the `dropdownRender` description and jumps in the FAQ for Select

* wip: add popover-arrow

* wip: trigger add arrow attr

* fix: remove popupContextKey

* optimize

* perf: optimize

* docs: optimize docs

* docs: add `arrow` attribute in tooltip en-US docs

* fix: fix bug

* perf[demo]: `radio-group` replace with `segmented`
2024-04-19 13:17:15 +08:00
Carl Chen 966bc1004c
fix[layout]: in a dark mode layout, the text color should change. (#7498)
* docs: updating the `dropdownRender` description and jumps in the FAQ for Select

* fix[layout]: in a dark mode layout, the text color should change
2024-04-19 10:25:23 +08:00
Ordinary 457d0fde0b
fix: remove duplicate style variable (#7490)
Co-authored-by: p-hehongsheng <p-hehongsheng@xiaomi.com>
2024-04-19 10:21:07 +08:00
Saveliy ff184b3969
feat: update ru_RU localization (#7497) 2024-04-19 10:20:15 +08:00
ashu-guo 75886a8cbf
docs: match dependencies in package.json instead of simply setting 'latest' (#7381) 2024-04-19 10:19:50 +08:00
fwd01 2b0c2da232
docs: typo error (#7505)
Co-authored-by: fuwedong <fuwendong5@outlook.com>
2024-04-19 10:18:59 +08:00
tangjinzhou ffd4d8fe92 fix: useForm model change validate error 2024-04-19 10:18:04 +08:00
tangjinzhou 49e1323baa docs: update codesandbox 2024-04-19 09:52:43 +08:00
tangjinzhou 35d1de9ea6 docs: update sandbox 2024-04-19 09:29:05 +08:00
huyikai fa46999963
Update ja_JP.ts (#7438) 2024-03-23 10:40:28 +08:00
tangjinzhou 01300d01da docs: add eth sponsor 2024-03-22 16:20:10 +08:00
tangjinzhou 9a5f83ed06 chore: update pkg 2024-03-03 14:09:19 +08:00
tangjinzhou ce6b7f3b4e chore: update pkg 2024-03-03 14:04:52 +08:00
tangjinzhou 4a2f95fe88 release 4.1.2 2024-01-30 12:19:46 +08:00
Carl Chen 7c73beb309
fix: fixed an error caused by dragging under the `headerCell` slot. (#7291)
* fix: fix headerCell slots

* perf: optimize table columnTitle type
2024-01-30 12:06:45 +08:00
Carl Chen 0cbf3ca354
docs: updating the `dropdownRender` description and jumps in the FAQ for Select (#7313) 2024-01-30 12:05:20 +08:00
Weite Su 7afb7ce465
fix(segmented): title property in segmented component slot not effective (#7302)
Co-authored-by: suweite <weite.su@infinigo.cn>
2024-01-30 12:04:24 +08:00
tangjinzhou 9cc73011c5 chore: import error 2024-01-16 21:23:36 +08:00
tangjinzhou 4b21210700 release 4.1.1 2024-01-16 21:10:05 +08:00
Carl Chen a80ca17461
fix: table slot type optimization (#7288) 2024-01-16 20:57:29 +08:00
HaiWei Lian ad8d32ab09
fix: table filter does not work in header group (#7233) 2024-01-16 20:56:47 +08:00
Carl Chen d870f3f8e0
fix: fixed error with no expected value in `expandColumnTitle` slot (#7265)
* fix: fixed error report with no expected value in `expandColumnTitle` slot

* fix: optimize optional chain

* fix: use default render

* refactor: use `customRenderSlot` replace `renderSlot`

* style: code format

* perf: optimize useColumns code

* fix: fix path

* feat: add customRenderSlot unit test
2024-01-16 20:49:38 +08:00
tangjinzhou c717473568 fix: hook warning, close #7281 #7273 #7274 2024-01-16 20:34:11 +08:00
selicens 1e07544e74
feat(QRCode): support scanned status (#7242) 2024-01-12 11:44:33 +08:00
Light 8ab008d255
typo(table): Supplement FilterDropdown type (#7226)
* fix(table): Supplement FilterDropdown type

* docs(table): Type format
2024-01-12 11:42:46 +08:00
一堆菠萝 f034a7759e
fix(divider): vertical dashed divider not show (#7218) 2024-01-12 10:50:06 +08:00
Konv Suu 3f33cefa81
ci: issue-labeled format error (#7200) 2024-01-12 10:45:46 +08:00
一堆菠萝 81e43c56ef
docs(typography): trigerType api supplement Chinese translation (#7228) 2024-01-12 10:45:09 +08:00
aShu-guo f400c803e1
docs: update modal api description (#7232)
* docs: update modal api description

* docs: update modal api description
2024-01-12 10:44:48 +08:00
somethingfornothing 502c11cc4c
fix(dropdown): unexpectedly hidden(#7246) (#7254) 2024-01-12 10:42:36 +08:00
markthree 2cdb69f706
faet: fix css prefix in nuxt generate (#7256) 2024-01-12 10:30:17 +08:00
tangjinzhou 2eed8e62ec fix: type error 2024-01-05 19:28:55 +08:00
tangjinzhou 61c0d0cc9d release 4.1.0 2024-01-05 16:22:56 +08:00
tangjinzhou d7f9bd27dc fix: support vue 3.4 2024-01-05 16:20:05 +08:00
cc heart 4ed2868137
fix(vue): fixed modal component failed to trigger update in vue@3.4.x (#7244)
* fix(vue): fixed modal component failed to trigger update in vue@3.4.x version

* refactor: use cloneVNode trigger vNode update
2024-01-05 09:11:25 +08:00
tangjinzhou 8696e01039 release 4.0.8 2023-12-18 16:19:36 +08:00
tangjinzhou a3fd390619 docs: update demo 2023-12-18 16:17:43 +08:00
tangjinzhou a9198e44df fix: theme reactive not work #7180 2023-12-18 15:34:54 +08:00
yanyu 509ec682f2
fix: Fix custom theme token (#7180)
* fix: fix table column data is passed into chlidren is undefined or null errorr

* fix: fix custom theme token not take effect

* chore: reset button style

---------

Co-authored-by: undefined <undefined>
2023-12-18 15:20:24 +08:00
tangjinzhou 73f0a29acf fix: textarea cursor error, close #7121 2023-12-18 14:31:53 +08:00
somethingfornothing f93dd9170d
fix: dataRange active-bar (#7157) 2023-12-18 11:37:38 +08:00
yang cfa0a68568
fix(Menu.SubMenu): 修复ConfigProvider组件设置prefixCls属性后动画过渡失效 (#7150) 2023-12-18 11:32:38 +08:00
Konv Suu afcff32fcc
fix(menu): pass motion name to collapseMotion (#7130) 2023-12-18 11:31:57 +08:00
tangjinzhou b989cf2d97 perf: watermark 2023-12-18 11:31:04 +08:00
Jevin 0e6fd652b8
fix(watermark): modify dom properties to regenerate (#7149)
Co-authored-by: “Jevin” <jevin@mogul-tech.com>
2023-12-18 11:29:27 +08:00
selicens 6625d39118
fix(RangPicker): Incorrect display of prevIcon and nextIcon (#7127)
* fix(RangPicker): Incorrect display of prevIcon and nextIcon

* fix: superPrevIcon and superNextIcon invalid
2023-12-18 11:23:30 +08:00
Nined 67efafca4a
perf(Typography): fast and efficient syncEllipsis (#7146) 2023-12-18 11:21:55 +08:00
OliverYoung a8a774a5ff
fix: tooltip onPopupAlign never called (#7112) 2023-12-18 10:54:30 +08:00
一堆菠萝 1fc109704b
fix: Form disabled no effect on Upload (#7110)
* fix: Form disabled no effect on Upload

* docs: update Upload disabled api default value
2023-12-18 10:45:27 +08:00
puppetkkk d140523c89
fix: useWave unref (#7108)
* fix: useWave unref

* fix: wave init value

* fix: wave value

* Update useConfigInject.ts

---------

Co-authored-by: pangzebang <pangzebang@dm-ai.com>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-12-18 10:41:50 +08:00
cc heart 91fe1b0d71
docs(menu): repair Anchor Jump (#7178)
Under the menu document, some anchor clicks cannot scroll.
2023-12-18 10:27:48 +08:00
lyn c1b4941def
docs: fix typo (#7162) 2023-12-18 10:27:22 +08:00
puppetkkk af383a34bc
docs(config-provider): add wave setting (#7107)
* docs(config-provider): add wave setting

* docs(config-provider): add wave setting

---------

Co-authored-by: pangzebang <pangzebang@dm-ai.com>
2023-12-18 10:25:23 +08:00
cc heart 1dccce4e16
docs(header): restore button hover style (#7105) 2023-12-18 10:24:56 +08:00
cc heart 8aa8e5a778
docs(calendar): optimize calendar docs note layout (#7102)
docs(calendar): optimize calendar docs note layout

docs(calendar): optimize calendar docs note layout

docs(calendar): optimize calendar docs note layout

docs(calendar): optimize calendar docs note layout
2023-12-18 10:24:18 +08:00
Light 42952b713a
docs(notification): Fix hooks description in demo (#7191) 2023-12-18 10:22:49 +08:00
yang 07c36192b8
【docs】:Code example 'setup' is missing (#7153)
* flx

* flx【docs】:Modify the official website code example, switch TS to JS, the top of the example should be '<script setup>'
2023-12-18 10:22:04 +08:00
Jacky 562623c091
fix: remove /* #__PURE__*/ comments (#7156) 2023-12-18 10:21:15 +08:00
tangjinzhou e362571719 test: update flex test 2023-11-11 10:35:49 +08:00
tangjinzhou e32ae99bfd release 4.0.7 2023-11-11 10:33:04 +08:00
tangjinzhou ccbeb44264 docs: add new tag 2023-11-11 10:25:16 +08:00
tangjinzhou 3499b11a47 refactor: flex components 2023-11-11 10:24:58 +08:00
selicens dae7262f13
feat(Flex): New component (#7052)
* feat(Flex): New component

* fix: Unified type

* test: Add unit test and update snapshots

* docs: update md file

---------

Co-authored-by: undefined <undefined>
2023-11-11 10:06:02 +08:00
w-z-y 8cf6be11f7
fix: DatePicker panelChange(#7059)
onPanelChange事件缺少
2023-11-11 10:00:48 +08:00
Konv Suu 2510608665
fix(collapse): custom prefix in animation (#7074) 2023-11-11 09:59:40 +08:00
cc heart b22875db33
fix(message): message offset error (#7093) 2023-11-11 09:53:59 +08:00
lyn 2bdeed1432
typo: fix docs ant Rect is spelled as React (#7082) 2023-11-11 09:31:38 +08:00
lai9fox 49a6b588c1
docs(tree-select): fix duplicate values in demo (#7083) 2023-11-11 09:30:42 +08:00
Konv Suu bd080cde2a
chore: enable pnpm run pre scripts (#7078) 2023-11-11 09:29:29 +08:00
huiliangShen c1454bc7b5
fix(carousel): can not use jsx render children (#7077)
Co-authored-by: banruo <shl@dataqin.com>
2023-11-11 09:28:33 +08:00
cc heart 61402142f8
feat[watermark]: support dark theme (#7067)
* perf[watermark]: replace with token variable

* feat: add theme toggle watch
2023-11-11 09:14:43 +08:00
Konv Suu 242982301d
site: menu show tag when front-matter has tag prop (#7053) 2023-11-02 19:00:16 +08:00
Konv Suu 9bdf882517
docs(theme-editor): handleEditConfigChange logic (#7038) 2023-10-23 10:51:46 +08:00
Konv Suu 88ec06b717
fix(upload): disabled prop apply order (#7047) 2023-10-23 10:16:23 +08:00
Konv Suu 6c39bec277
feat(config-provider ): wave config (#7036) 2023-10-23 10:15:56 +08:00
Konv Suu 82f407d396
docs(tag): colorful demo css style (#7037) 2023-10-23 10:13:49 +08:00
bowen bfcdba251f
docs(checkbox): fix typo (#7039) 2023-10-23 10:13:18 +08:00
cc heart 0abcd25b2a
fix: fix space duplicated key (#7048) 2023-10-23 10:12:26 +08:00
tangjinzhou 72b8d09b92 release 4.0.6 2023-10-17 23:01:50 +08:00
selicens b4c29d927b
fix: dropdownVisibleChange invalid (#7033)
Co-authored-by: undefined <undefined>
2023-10-17 22:59:42 +08:00
tangjinzhou bf917f36eb release 4.0.5 2023-10-17 19:04:56 +08:00
黄小民 0f9c80b86e
fix: rangePick onOk can't close the panel (#7026) 2023-10-17 19:02:10 +08:00
Zev Zhu 61e5746b0d
fix(StyleContext): fix style cache loaded repeat (#7029)
Co-authored-by: unknown <aibayanyu20>
2023-10-17 18:55:10 +08:00
bowen 7786a81e76
docs(menu): fix typo (#7025) 2023-10-17 10:53:20 +08:00
tangjinzhou 6f89185fe1 release 4.0.4 2023-10-16 16:19:34 +08:00
Konv Suu 449adb03df
fix: setContainer in onBeforeMount for drawer (#6986)
* fix: setContainer in onBeforeMount for drawer

* fix: add judgement
2023-10-16 15:56:28 +08:00
tangjinzhou 4428423be4 fix: select dropdown custom input error #7020 2023-10-16 15:51:44 +08:00
selicens 380fcd4aa9
fix(Select): dropdownRender inside dropdown box disappears when the input box gains focus (#7020)
Co-authored-by: undefined <undefined>
2023-10-16 15:03:37 +08:00
tangjinzhou 4a1296bb3f fix: code error #7001 2023-10-16 14:35:19 +08:00
selicens b9c65656db
fix(select): list scrollbar height and timing (#6987) (#7001)
* fix: select scrollbar height

* fix: mousemove appear scrollbar

* Update List.tsx

* Update List.tsx

---------

Co-authored-by: undefined <undefined>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-10-16 14:33:37 +08:00
selicens f1bcf2093a
fix(FloatButton): BackTop attribute invalid (#7009)
* fix(FloatButton): BackTop attribute invalid

* fix: attribute props

* fix: Remove default slot

---------

Co-authored-by: undefined <undefined>
2023-10-16 14:21:39 +08:00
selicens 398710cf1b
feat(Form): FormItem add tooltip attributes (#7014)
* feat(Form): FormItem add tooltip attributes

* fix: Delete duplicate types

* fix: Remove excess slots and types

* Update FormItemLabel.tsx

---------

Co-authored-by: undefined <undefined>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-10-16 14:20:32 +08:00
黄小民 858c4ec409
fix bug:#6911 a-range-picker canot close when set popContainer (#6994)
* fix bug:#6911 a-range-picker 组件选择完之后下拉面板无法收起的问题

* update prettier to 3.0.3

* Update package.json

* Update package.json

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-10-16 11:42:55 +08:00
一堆菠萝 77eab3637c
docs(pagination): fix pageSizeOptions API (#7010) 2023-10-16 10:39:56 +08:00
Konv Suu 664711373c
fix(drawer): wrapper style pass to drawer content (#6983) 2023-10-16 09:57:27 +08:00
Konv Suu 21d85ea82c
fix(form-item): initialValue issue in resetField (#6979) 2023-10-16 09:54:41 +08:00
Konv Suu b3ef24963f
fix(checkbox): get disabled prop from parent (#6970) 2023-10-16 09:53:29 +08:00
Konv Suu f953482a4d
chore: remove repeat type (#6962) 2023-10-16 09:51:13 +08:00
Cherry7 a9f9899185
fix(useMessage): closeIcon (#6957)
* fix(useMessage): closeIcon

* chore: del debugger
2023-10-16 09:50:38 +08:00
果冻橙 c99e9b00bd
fix: chrome 117 onCancel event (#6991) 2023-10-16 09:48:13 +08:00
Nitin Ramnani 3084ced55f
test: Added testcases for Tour Component (#7000) 2023-10-16 09:46:04 +08:00
Konv Suu c5ea668e88
chore: provide esm output file in dist (#6966) 2023-10-16 09:44:54 +08:00
Konv Suu 3c5fb84542
fix(vc-image): remove repeat listener (#6945) 2023-09-15 14:25:48 +08:00
Konv Suu 2f7f0e6928
fix(message): getContainer prop doesn't work (#6942) 2023-09-15 14:21:22 +08:00
agoni1212 2c4d4650da
docs: typo (#6941) 2023-09-15 14:19:15 +08:00
Konv Suu 0f1ffc99cd
chore: optimize startup performance (#6952) 2023-09-15 14:18:44 +08:00
tangjinzhou 83d6c93765 release 4.0.3 2023-09-10 11:03:59 +08:00
tangjinzhou a6c945caaa fix: support shadow dom, close #6912 2023-09-10 10:36:30 +08:00
tangjinzhou d0f7c34497 chore: update cssinjs 2023-09-09 23:31:44 +08:00
tangjinzhou 2b8f2adcbf fix: icons support shadow dom, close #6914 2023-09-09 21:50:57 +08:00
Attacktive f25bf6e189
docs: correct simple copy-paste error (#6924) 2023-09-09 09:21:18 +08:00
Konv Suu 93415d0442
docs: mobile drawer menu trigger (#6927) 2023-09-09 09:20:46 +08:00
Konv Suu d185a3af21
docs: update dynamic form item demo (#6930) 2023-09-09 09:19:16 +08:00
tangjinzhou d3800b54a3 chore: update github workflow 2023-09-09 09:11:20 +08:00
tangjinzhou b7eed32484 docs: update img link 2023-09-02 21:06:07 +08:00
Konv Suu 46be19531d
docs: add hide code btn in the bottom for code box (#6917) 2023-09-01 09:35:37 +08:00
tangjinzhou 089548ed74 release 4.0.2 2023-08-31 08:05:31 +08:00
Konv Suu ce72484623
fix(transfer): checkbox click evt run repeatedly (#6902) 2023-08-31 07:47:10 +08:00
tangjinzhou 31d00bf7d1 chore: update lit & format 2023-08-30 22:48:17 +08:00
tangjinzhou deada0aeb8 chore: udpate lint, close #6896 2023-08-30 21:44:03 +08:00
Konv Suu 418d8b33dd
fix(modal): add onUpdate:open prop (#6876) 2023-08-30 16:18:54 +08:00
24min 3c05b7704b
fix(ImageGroup):fix open imagegroup without animation (#6898) 2023-08-30 16:10:03 +08:00
Konv Suu 1254677805
fix: table expandColumnTitle slot type declaration (#6908) 2023-08-30 16:08:01 +08:00
Konv Suu f7cc27b7ad
fix: onAfterClose init flip value (#6913) 2023-08-30 16:07:35 +08:00
tangjinzhou 9855e43805 fix: button wave error, close #6895 2023-08-30 16:05:54 +08:00
Konv Suu 1f01ae0728
docs: nav-phone-icon display normal (#6906) 2023-08-30 15:39:15 +08:00
Konv Suu 9464158c0c
docs(modal): remove obsolete apis (#6904) 2023-08-30 15:38:39 +08:00
24min 13a4470fd8
docs:fix full-screen modal on the presentation documentation has no effect (#6905) 2023-08-30 15:37:13 +08:00
cc hearts 84fb4b4b3d
docs: github icon support hover tips and optimized the background (#6899)
* docs: github icon support hover tips and optimized the background color under hover

* refactor: modify icon to `icon` export

* style: optimize githubIcon style
2023-08-30 15:36:18 +08:00
cc hearts 106750ed62
docs[FormItem]: update FormItem name attribute type (#6897) 2023-08-30 15:35:20 +08:00
tangjinzhou cac650737c docs: add align #6885 2023-08-30 15:26:59 +08:00
Konv Suu 95fa2547fe
docs: add judgement condition for contributor list (#6889) 2023-08-30 15:12:49 +08:00
Konv Suu 70102039c4
fix: default value for direction in configProvider (#6890)
* fix: default value for direction in configProvider

* update defaultConfigProvider
2023-08-30 15:12:10 +08:00
Konv Suu 7a0c2a384c
docs: improve footer & fix toc-affix (#6883) 2023-08-30 15:10:16 +08:00
tangjinzhou 72e148cae8 fix: portal error, close #6880 #6837 #6807 2023-08-30 15:07:27 +08:00
tangjinzhou 6c13c964c5 chore: update type 2023-08-22 14:53:50 +08:00
tangjinzhou 367ddff30e release 4.0.1 2023-08-22 14:37:57 +08:00
Konv Suu e3ad856543
fix(badge): dot with processing status (#6874)
* fix(badge): dot with processing status

* tests: update snapshot
2023-08-22 14:03:09 +08:00
Konv Suu 61df5e656f
fix(input-group): layout style (#6866)
* fix(input-group): layout style

* tests: update snapshot
2023-08-22 10:45:40 +08:00
Konv Suu 439fe840b4
docs(drawer): demo width overflow (#6872) 2023-08-22 10:05:39 +08:00
Konv Suu 197a00f6ea
docs: contributors list add last updated time (#6871) 2023-08-22 10:02:42 +08:00
tangjinzhou 3f99a7e985 docs: update readme 2023-08-21 14:31:04 +08:00
Konv Suu 9c0311546b
feat(input): add password visible feature (#6863)
* feat(input): modify visibilityToggle feature

* test: update snapshot and update test cases

* Update Password.tsx

* Update Password.tsx

* chore: update

* chore: update demo and test

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-08-18 17:03:16 +08:00
Kaivan Wong 7f5b630d72
docs: update the description for fieldNames fields. (#6835)
* fix: update the description for fieldNames fields.

* Update index.zh-CN.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-08-18 15:51:17 +08:00
selicens 65ccb447c9
feat(AutoComplete): add border less and customize clear button (#6829)
* feat: add border less

* feat: add customize clear button
2023-08-18 14:52:22 +08:00
tangjinzhou 18405e13b2 docs: update site style 2023-08-18 14:40:56 +08:00
Konv Suu 9e78b4a985
fix(tag): checkable tag don't pass class props (#6854), close #6850 2023-08-18 14:34:44 +08:00
Konv Suu 6cf5d79e2e
fix(tabs): animated tabs style (#6855), close #6804 2023-08-18 14:33:41 +08:00
Konv Suu 1abc33a9e7
docs: improve algolia dropdown menu shadow effect (#6845) 2023-08-18 14:24:36 +08:00
Konv Suu e39e998ecc
feat: pagination buttons transition style (#6832) 2023-08-18 14:23:50 +08:00
selicens cfd4aadc29
feat(Avatar): group add shape & synch demo (#6822) 2023-08-18 14:22:07 +08:00
Konv Suu 38dd977b4c
style: remove table's tr rounded corner (#6825) 2023-08-18 13:52:23 +08:00
selicens 72f9262d0a
feat(Tag): add border less & synch checkable (#6819) 2023-08-18 13:48:00 +08:00
cc-hearts c2d71fa7c3
docs[Form]: fix form docs code references (#6843)
* docs[Form]: fix form docs code references

* docs[Form]: fix form en docs code references

* docs[Form]: fix form en docs title
2023-08-18 11:11:54 +08:00
Cherry7 969dadb265
fix: image height (#6840), close #6836
* fix: image height

* test: update snap
2023-08-18 11:10:44 +08:00
No Two 9c3bf46108
fix: fix spelling of words in code. (#6839) 2023-08-18 11:08:47 +08:00
Konv Suu 141f0100d2
docs: improve site page (#6826) 2023-08-18 11:07:22 +08:00
Konv Suu 6ced156342
docs: add icon search input (#6828)
* docs: add icon search input

* docs: add affix for search input
2023-08-18 11:05:17 +08:00
selicens 42608a5121
docs: add contributors list (#6842) 2023-08-18 11:03:57 +08:00
Konv Suu 22b21cdac8
docs: use a-space replace br in demo (#6861) 2023-08-18 11:03:03 +08:00
Zev Zhu 80a5b531f6
feat: add px2rem in cssinjs (#6817)
* fix: fix table column data is passed into chlidren is undefined or null errorr

* feat: add px2rem in cssinjs
2023-08-18 09:48:10 +08:00
内小子 cacbde3e03
fix(InputNumber): input-number mouseup (#6772)
* fix(InputNumber): input-number mouseup

* fix: replace  with onClick

---------

Co-authored-by: nbn <nabaonan@yunlizhihui.com>
2023-08-06 12:46:26 +08:00
tangjinzhou e3f09a18a1 feat: okText add function #6748 2023-08-06 12:44:16 +08:00
selicens 7bfe30d280
docs(Modal): confirm default oktext synch (#6745) (#6748)
* docs(Modal): confim default oktext synch

* fix: okText logic
2023-08-06 12:43:09 +08:00
Zev Zhu 53dc5daaaf
feat: add static-style-extract (#6713)
* docs: add ant-design-vue nuxt module

* feat: add static-style-extract

* docs: fix import defineProps and defineEmits

* feat: add static-style extract test

* fix: add ignore component

* feat:  calendar select support info.source param (#6697)

* docs: add ant-design-vue nuxt module

* feat: calendar select support info.source param

* docs: synchronous config-provider demo (#6706)

* revert: #6706

* feat: node error

* fix: Handle the output of styles in Server Side Rendering mode

* fix: fix value required error

* chore: change tests dirname

* fix: auchor warning

* chore: add tests

* chore: generate tests snap

* docs: add ssr docs

* docs: synchronous config-provider demo (#6706)

* revert: #6706

* docs: add extract ssr doc

* fix: Removing canUseDom does not have any effect.

* fix: remove range picker in picker map

* fix: watch source can only be a getter/effect function style warning

* fix: styleContext props maybe ref

* fix: remove black list component

* feat: add compChildNameMap

---------

Co-authored-by: selicens <1244620067@qq.com>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-08-06 12:28:22 +08:00
Cherry7 531ae16553
fix: Dropdown show (#6757) 2023-08-06 11:50:43 +08:00
tangjinzhou d2b6eb9d94 docs: update site 2023-08-06 11:25:35 +08:00
tangjinzhou 27a4d8ceff
Revert "docs: banner adjust light and dark mode (#6799)" (#6816)
This reverts commit 826c183d0b.
2023-08-06 11:23:04 +08:00
tangjinzhou 12074a0dca Merge remote-tracking branch 'origin/feat-v4' 2023-08-06 11:18:07 +08:00
selicens 8f95cdd5a3
feat(App): add App component (#6735)
* feat(App): add App component

* docs: modification error

* docs: doucment update

docs: doucment update
2023-08-06 10:58:13 +08:00
Konv Suu cb0abe5fd5
docs: prev and next buttons only show cn title (#6806) 2023-08-06 10:52:49 +08:00
Konv Suu ed87500e77
docs: fix typo in en docs (#6805) 2023-08-06 10:51:50 +08:00
Konv Suu c01630113d
fix(input): prefix prop has not been passed (#6810), close #4809 2023-08-06 10:51:24 +08:00
Konv Suu 5279d1289a
fix(checkbox): change trigger form validation. (#6741) 2023-07-31 08:52:52 +08:00
Cherry7 9d406ab7ba
fix(PageHeader): ghost style (#6761)
* test(pageheader): update test snap

* fix: ghost style

* fix: ghost style

* chore(pageheader): update ghost demo

* test(pageheader): update test snap
2023-07-31 08:49:35 +08:00
Konv Suu 826c183d0b
docs: banner adjust light and dark mode (#6799) 2023-07-31 08:48:30 +08:00
tangjinzhou bc576d6255 docs: update treeselect 2023-07-29 12:21:21 +08:00
Cherry7 2c39273cc6
fix: autoplay (#6771) close #6768 2023-07-29 12:18:58 +08:00
Cherry7 b49540a339
feat: cssinjs add MULTI_VALUE key (#6770) 2023-07-29 12:17:14 +08:00
果冻橙 37059c38fd
fix dayjs is not excluded in dist (#6767) 2023-07-29 12:16:17 +08:00
黄小民 4fe57fa322
fix(table): expandedRowRender does't work(close #6782) (#6783) 2023-07-29 12:02:34 +08:00
Konv Suu a3ccdeffc2
feat(img): add img flip feature (#6785) 2023-07-29 11:18:34 +08:00
Konv Suu e8c2860c7d
fix(image): sensitivity of image scaling (#6784) 2023-07-29 11:18:22 +08:00
Fts f1f89191ee
fix: Update presetColor.tsx (#6790)
修复相互依赖的报错
2023-07-29 11:10:13 +08:00
Cherry7 0c863c1803
Update README.md (#6734) 2023-07-17 09:35:58 +08:00
selicens 7591d5c3e6
feat: float button support badge (#6738)
* docs(FloatButton): add badge demo

* fix(Badge): color attribute invalid
2023-07-17 09:35:19 +08:00
Simon He 4ea318be30
docs(drawer): fix typo (#6736) 2023-07-17 09:07:49 +08:00
tangjinzhou 5fd00c05b5 doc: update menu 2023-07-14 12:11:27 +08:00
tangjinzhou a2e50dc43e
Feat v4 (#6329)
* refactor(icon): remove style dir (#6215)

* refactor: rename locale

* refactor: locale-provider

* refactor: modal

* refactor: menu

* fix: custom class (#6217)

* refactor: tooltip

* refactor: grid (#6220)

* refactor: grid

* fix(grid): align & justify responsive

* chore: update demo and snapshot

* fix: row ts type not work

* doc: update demo

* refactor: ts

* refactor: spin (#6222)

* fix: typo (#6218)

* fix:  typo

* docs<upload>: docs update

* refactor: spin

* refactor: spin

* refactor: spin

* refactor: spinnn

* refactor: spin

---------

Co-authored-by: lyn <76365499@qq.com>

* fix: spin error #6222

* test: test case error (#6225)

* fix: inject value maybe undefined

* fix: tootip emit correct value

* fix: rollback warning suffix avoid test break

* doc(grid): remove unused type="flex"

* refactor: skeleton (#6224)

* refactor: skeleton

* refactor: skeleton style

* chore: modify skeleton demo style

* fix(button): link and text should not have wave (#6226)

* refactor: dropdown

* refactor: popover & popconfirm

* refactor(tag): less to cssinjs (#6227)

* refactor(empty): less to cssinjs (#6230)

* refactor(empty): less to cssinjs

* chore: remove unuse code

* fix: reactivity lose

* fix: empty props #6230

* refactor: progress style (#6234)

* refactor: progress

* refactor: progress style

* fix: progress attrs

* refactor: progress #6234

* refactor: switch (#6236)

* refactor: switch style

* refactor: delete switch style

* refactor:input (#6237)

* refactor:input

* fix inheritAttrs:false

* fix attrs.class

* feat: input add disabled

* refactor:comment (#6238)

* refactor:comment

* fix inheritAttrs: false & attrs.class

* refactor:pageheader (#6239)

* refactor:pageheader

* fix inheritAttrs: false & attrs.class

* refactor:statistic (#6240)

* refactor:statistic

* fix inheritAttrs: false & attrs.class

* refactor:list (#6241)

* refactor:list

* fix inheritAttrs: false & attrs.class

* feat: update type

* refactor(Space): less to cssinjs & add compact mode (#6229)

* refactor(Space): less to cssinjs & add compact mode

* chore(space): update md

* chore(space): add demo

* chore(space): add some demo

* feat(button): add compact mode

* fix: reactivity lose

* docs: fix props version

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* perf: space compact

* refactor:typography (#6244)

* refactor:typography

* fix return

* fix import type

* fix: typography #6244

* refactor:datepicker (#6245)

* refactor: datepicker type

* refactor: rate style (#6254)

* refactor(layout): less to cssinjs (#6249)

* doc: update layout cover

* refactor(result): less to cssinjs (#6246)

* refactor(result): less to cssinjs

* fix: class name is overridden

* docs: update result cover

* refactor:slider (#6250)

* feat: slider  deprecated tooltipVisible

* refactor(crad): less to cssinjs  (#6258)

* update

* switch

* Style adjustment

* refactor(Card): less to cssinjs

* Eliminate invalid code

* optimization and adjustment css

* Adjust the css

* Optimize each item

* adjustment css

* refactor: card #6258

* refactor:carousel (#6262)

* refactor:carousel

* docs:update & refactor: carousel type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* refactor:transfer (#6247)

* refactor:transfer

* merge v4 branch & fix theme interface conflict

* docs:update & refactor: transfer type

* perf: transfer

* refactor:checkbox (#6248)

* refactor:checkbox

* docs:update & refactor: checkbox type

* feat: checkbox add disabled context

* refactor:pagination (#6251)

* refactor:pagination

* docs:update & refactor: pagination type

* style: update pagination props type

* refactor: mentions (#6255)

* refactor: mentions

* refactor: mentions menu provider

* doc: update mentions demo

* refcator:upload (#6261)

* refcator:upload

* docs:update & refactor: upload type

* Update style.ts

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* perf: upload motion

* refactor:timeline (#6263)

* refactor:timeline

* docs:update & refactor: timeline type

* perf: timeline

* refactor:steps (#6264)

* refactor:steps

* fix ...attrs

* fix StepsToken error

* docs:update & refactor: steps type

* fix: steps icon clss error

* refactor:collapse (#6266)

* refactor:collapse

* fix collapse props version

* docs:update & refactor: collapse type & fix collapsible

* feat: update collapse type

* refactor:inputnumber (#6265)

* refactor:inputnumber

* docs:update & refactor: inputnumber type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* feat: number add compactSize & disabledContext

* refactor:table (#6267)

* refactor:table

* docs:update & refactor: table type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* refactor: table

* feat: table add expandColumnTitle slot

* refactor:calendar (#6269)

* refactor:calendar

* docs:update

* refactor:timepicker (#6270)

* refactor:timepicker

* docs:update & refactor: timepicker type

* refactor:tree (#6276)

* Feat v4 fix type errors (#6285)

* fix compile type errors

* fix menuprops type import

* fix lint errors

* fix lint errors

* fix format error

* fix node version

* fix run dist error

* fix run lint

* fix as any

* fix string type

* refactor: rename locale file

* feat: tree add leafIcon

* [tabs] :less to cssinjs  (#6288)

* update

* switch

* Style adjustment

* refactor(Card): less to cssinjs

* tabs: less to cssinjs 开发ing

* add function cssinjs

* Eliminate irrelevant code

* Eliminate irrelevant code 2

* update components

* Eliminate irrelevant input  code

* refactor: tabs #6288

* feat: add segmented (#6286)

* refactor: segmented #6286

* refactor:select (#6295)

* refactor:select

* update doc

* delete useless

* feat: select add context size

* refactor: tree select (#6296)

* feat: tree-select add context size

* perf: table

* docs: update doc toc

* refactor: cascader

* refactor: auto-complete

* refactor: image

* refactor: drawer

* refactor:radio (#6299)

* refactor:radio

* fix attrs

* feat: radio add disabled context

* fix: some type & doc (#6292)

* fix: typo (#6218)

* fix:  typo

* docs<upload>: docs update

* fix: type of minute in props disabledDateTime of DatePicker (#6233)

* docs: typo (#6256)

* feat: tooltip added overlayInnerStyle attribute

* Update abstractTooltipProps.ts

* Update Tooltip.tsx

---------

Co-authored-by: lyn <76365499@qq.com>
Co-authored-by: H1mple <35363759+baohangxing@users.noreply.github.com>
Co-authored-by: tangjinzhou <415800467@qq.com>

* refactor: form

* fix: directive not work

* fix: use open, remove visible

* doc: update cover

* refactor: remove not use code

* chore: update build script

* doc: update doc

* doc: refactor doc

* chore: update token error

* chore: update style

* refactor: rename _style to style

* fix: tag warning

* fix(dropdown): open invalid (#6316)

* feat: add watermark  (#6300)

* feat: add watermark

* feat: add watermark demo

* feat: add mutationObserver

* feat: add watermark demo

* refactor: watermark type

* doc: add theme-editor

* fix: inject value maybe undefined && tag style invalid (#6320)

* fix: inject value maybe undefined

* fix(tag): style invalid

* feat: add qrcode (#6315)

* feat: add qrcode

* fix: qrcode bug

* fix: qrcode value required

* refactor: props  deconstruct

* Feat v4 floatbutton (#6294)

* feat: add float-button components

* fix type &  demo display

* fix components entry

* fix review bug

* fix bug

* fix .value

* refactor: qrcode #6315

* refactor: float-button

* fix: groupsize context error

* fix: floatbutton animation not work

* Feat v4 theme editor (#6348)

* feat: add theme editor container

* feat: add theme editor layout

* add left panel

* add vue-colorful & fix bug

* 修复hue组件抖动问题

* fix bug && add demo

* fix bug

* fix demo preview

* fix theme editor components demo

* fix: token effect error

* Feat v4 theme editor (#6349)

* feat: add theme editor container

* feat: add theme editor layout

* add left panel

* add vue-colorful & fix bug

* 修复hue组件抖动问题

* fix bug && add demo

* fix bug

* fix demo preview

* fix theme editor components demo

* add theme editor token drawer

* add theme editor token drawer

* fix bug

* open commment

* fix error demo

* fix theme editor bug

* fix: cssinjs effect error

* doc: format code

* fix: tag click event not trigger

* release 4.0.0-alpha.1

* fix: qrcode type

* fix: remove not use file

* doc: update doc site

* doc: update site

* doc: fix theme editor bgcolor (#6358)

* fix: motion not work

* release 4.0.0-alpha.2

* fix: qrcode ; error, close #6362

* fix docs dark theme & add docs coverDark (#6367)

* fix docs dark theme & add docs coverDark

* fix theme Editor edit

* fix: dropdown divider disappear, close  #6365 (#6369)

* doc: update baner

* fix: button wave not work

* fix: ant-piker-cell-range-hover-end style error (#6373)

* fix: ant-piker-cell-range-hover-end style error

* feat: be consistent with antd

* feat: be consistent with antd

* fix: ConfigProvider error for style, close #6368

* release 4.0.0-alpha.4

* style: add dark style for `pre` and `code` (#6382)

* docs: version menu (#6390)

* Feat(DatePicker): increase presets prop (#6387)

* feat(date-picker): add PresetDate type

* feat(date-picker): add usePresets hook

* feat(date-picker): add PresetPanel Component

* feat(date-picker): add PresetPanel Component

* feat(demo): update Preset Ranges Examples

* feat(docs): add new prop presets

* feat(docs): add new prop presets with english

* fix(RangePicker): footer is not managed by panels

* chore(Picker): prefixCls default rc-picker

* chore(date-picker): update presetted-ranges demo

* chore(date-picker): update rangePickerProps'presets

* feat(date-picker): presets reactively processing

* chore(date-picker): update type

* refactor(RangePicker): deprecated ranges prop

* chore(date-picker): update type

* chore(PickerPanel): del notuse panelRef

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* fix: datepicker presets error #6387

* docs: update datepicker doc #6387

* feat(Steps): add items prop and variants (#6406)

* refactor(steps): add items prop and variants

* feat(steps): add Label Placement and Inline Steps demo

* feat(steps): Label Placement and Inline Steps snap

* test(steps): Steps demo snap

* feat(Steps): update docs

* fix(Step): progressDot

* chore(useLegacyItems): change from warning to devWarning

* refactor(Steps): Remove useLegacyItems

* refactor(Steps): renderStep

* test(Steps): update test snapshot

* chore(Steps): filterEmpty

* feat(Steps): update docs

* docs: update site

* refactor: steps #6406

* test: update steps

* perf: shallowRef instead ref

* fix(Modal): fix modal locale (#6423)

* feat(StyleProvider): add StyleProvider handle cssinjs features (#6415)

* feat(StyleProvider): StyleProvider

* feat(StyleProvider): refactor to  use context

* chore(StyleProvider): update AStyleProviderProps type

* chore(App): reback

* chore(StyleProvider): export StyleProvider

* feat(StyleProvider): update StyleProvider docs

* feat(StyleProvider): update StyleProvider docs

* feat(StyleProvider): add StyleProvider docs routes

* chore(StyleProvider): with useStyleProvider

* docs: update compatiple #6415

* feat(Progress): enhance size prop and add variants (#6409)

* refactor(progress): Progress size and add variants

* feat(progress): add `getsize`

* refactor(progress): Progress size and add variants

* chore(progress): update props type

* chore(progress): update props type

* feat(progress): update demo

* feat(progress): update docs

* test(progress): update test snap

* fix(Circle): Merging classes

* test(progress): update test snap

* feat(progress): add size demo

* test(progress): add size snapshot

* chore(Progress): reback Circle svg class change

* fix: progress borderRadius reactive #6409

* fix(defaultConfigProvider): add getPopupContainer (#6425), close #6419

* fix: qrcode size error, close #6418

* release 4.0.0-alpha.4

* fix: picker import error

* test: add QRCode unit testing (#6441)

* fix

* fix compile type errors

* fix menuprops type import

* fix lint errors

* fix lint errors

* fix format error

* fix node version

* fix run dist error

* fix run lint

* fix as any

* fix string type

* fix steps error & fix docs version select option & fix theme editor error

* fix(badge): badge props count default value error (#6433)

* docs: update site responsive

* fix: modal api method i18n not work, close #6438

* release 4.0.0-alpha.5

* chore(docs): update docs (#6446)

* docs(space): update demo

* docs(affix): update docs

* fix: cssinjs compatibility (#6454)

* feat: add convertLegacyToken

* docs: v4 vuedocs (#6468)

* fix introduce doc

* fix getting-started doc

* add migration-v4 doc

* fix docs

* Update migration-v4.zh-CN.md

* Update migration-v4.zh-CN.md

* Update migration-v4.en-US.md

* Update migration-v4.zh-CN.md

* Update getting-started.en-US.md

* Update getting-started.zh-CN.md

* Update introduce.en-US.md

* Update introduce.zh-CN.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* feat: remove backtop

* feat(anchor): add direction action (#6447)

* refactor(anchor): direction show

* refactor(anchor): update anchor css

* feat(anchor): update demo

* test(anchor): update demo test snap

* feat(anchor): update docs

* Update index.zh-CN.md

* Update index.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* feat: anchor add customTitle slot #6447

* docs: update doc anchor

* feat(menu): icon support function components with items and update demo (#6457)

* fix(menu): icon do not show problem

* fix(menu): icon do not show problem

* feat(menu): update demo

* test(menu): update demo snap

* chore(Menu): update docs

* test(Menu): update demo

* Update MenuItem.tsx

* Update SubMenu.tsx

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* doc: update menu icon

* feat: menu items icon add arg

* fix: antd.min error

* release 4.0.0-alpha.6

* fix: table resizable not work && type error (#6514)

* Refactor(demo): change options to composition api (#6499)

* feat(demo): A-B

* feat(demo): update B-checkbox

* feat(demo): update CheckBox -DatePicker

* feat(demo): update DatePicker - Form

* feat(demo): update Form - List

* feat(demo): update  List-pagination

* feat(demo): update  List - skeleton

* feat(demo): update  skeleton - switch

* feat(demo): update  skeleton - switch

* feat(demo): update   switch - upload

* feat(demo): update  watermark

* fix(demo): del hashId

* fix: submenu type lose theme

* fix: dropdown menu hide error

* fix: dealing with switching topics modal, notification, message does not take effect close #6512 (#6518)

* fix: resolve dark mode not support

* fix: unified expression

* feat(modal): add useModal (#6517)

* feat(modal): add useModal hook

* feat(modal): add HookModal demo

* test(modal): update HookModal demo snap

* feat(modal): update modal docs

* chore(modal): update modal type

* perf: useModal #6517

* release 4.0.0-beta.1

* docs: fix tab demo error

* fix(config-provider): fix ConfigProvider.config is not function close #6528 (#6529)

* Feat(use): add useMessage useNotification (#6527)

* feat(Message): add useMessage hook

* feat(Notification): add useNotification hook

* feat(Message): add Hook demo

* feat(Notification): add Hook demo

* test(Message): update demo snap

* test(Notification): update demo snap

* docs(Message): update docs with FAQ

* docs(Notification): update docs with FAQ

* refactor: useMessage #6527

* refactor: useNotification #6527

* release 4.0.0-beta.2

* docs(button): update demo with space (#6536)

* feat(button): demo space

* test(button): update demo snap

* chore(button): disabled demo Ghost space

* test(button): update disabled demo snap

* docs(introduce): update docs (#6539)

* docs(introduce): update docs

* docs(introduce): add Dollar

* Update introduce.zh-CN.md

* Update introduce.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* docs(customize-theme): update docs (#6540)

* fix introduce doc

* fix getting-started doc

* add migration-v4 doc

* fix docs

* Update migration-v4.zh-CN.md

* Update migration-v4.zh-CN.md

* Update migration-v4.en-US.md

* Update migration-v4.zh-CN.md

* Update getting-started.en-US.md

* Update getting-started.zh-CN.md

* Update introduce.en-US.md

* Update introduce.zh-CN.md

* update customize-theme doc & fix migration-v4 error

* update customize-theme doc

* fix migration-v4 error

* remove SSR & shadowDom

* Update customize-theme.zh-CN.md

* Update customize-theme.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* fix: getPopupContainer not work

* release 4.0.0-beta.3

* release 4.0.0-beta.4

* docs: update grid docs (#6549)

Co-authored-by: zhuzhengjian <zhuzhengjian@hoteamsoft.com>

* test(alert): update demo with space (#6541)

* docs(alert): update demo with space

* docs(alert): update alert test snap

---------

Co-authored-by: zhuzhengjian <zhuzhengjian@hoteamsoft.com>

* fix: components bug & update docs (#6548)

* fix bug

* fix test case and update snapshot,fix space merge class

* docs(grid): update migrate docs && delete xxxl in grid docs (#6562)

* fix: segmentd disabled label is undefined (#6556)

* fix: segmentd disabled label is undefined

* fix: segmentd disabled label is undefined

* fix: segmentd disabled label is undefined

* fix(grid): remove grid xxxl attribute (#6572)

* fix: remove grid xxxl attribute

* docs: remove xxxl in grid docs

* fix: tooltip custom color error

* feat: remove Step __legacy

* feat: add tour (#6332)

* feat v4 add tour

* fix type error

* sync tour from antd5.4.6 & fix type error

* fix error

* refactor: tour #6332

* fix: tour center

* fix: picker support v-show

* test: update snap

* test: update tour test

* fix: tour-mask attrs pointer-events (#6577)

* fix: tour animated

* feat: support vue 3.3 slot type

* release 4.0.0-rc.1

* release 4.0.0-rc.2, close #6588

* 4.0.0-rc.3

* chore: remove vue private api

* fix: paginantion error, close #6590

* release 4.0.0-rc.4

* fix: checxbox style

* fix: pagination mini size style

* release 4.0.0-rc.5

* docs: update v4 tabs doc error(#6606) (#6607)

* docs: add ant-design-vue nuxt module (#6620)

* fix: layout-sider and menu transition style(#6637) (#6640)

* docs: fixed the style error of online demo (#6630)

* feat: checkbox label slot support use option label (#6642)

* docs: 📃change the default  setting of  "treeNodeFilterProp" from  "value" to "label"

* revert: ↩revert this config and create another pr to commit

* feat: checkbox label slot support use option label

* test: 🧪update checkbox *.snap file

---------

Co-authored-by: tangjinzhou <415800467@qq.com>

* fix: add disabledContext override with form components (#6618)

* fix: add disabledContext override with form components

* test: update snap

* fix: LabelWidth demo filename

* fix: fontsize spelling mistake

* fix(tour): target position (#6629)

* style: format lint

* docs(form): add form disabled demo (#6658)

* fix: comment node error

* release 4.0

* fix: portalWrapper add autoLock prop (#6687), close #6649

* fix: image animation & zindex, close #6675

* docs(QRCode): Synchronize QR code demonstration and add SVG (#6660)

* fix: Synchronize QR code demonstration and add SVG

* fix: responsive loss and invalid border style

* docs: synchronize antd5.6.3 QRCode color in dark mode

* feat:  calendar select support info.source param (#6697)

* docs: add ant-design-vue nuxt module

* feat: calendar select support info.source param

* docs: synchronous config-provider demo (#6706)

* revert: #6706

* docs: export space-compact types (#6716)

* release 4.0.0

---------

Co-authored-by: bqy_fe <1743369777@qq.com>
Co-authored-by: zkwolf <chenhao5866@gmail.com>
Co-authored-by: Zev Zhu <45655660+aibayanyu20@users.noreply.github.com>
Co-authored-by: lyn <76365499@qq.com>
Co-authored-by: 果冻橙 <shifeng199307@gmail.com>
Co-authored-by: songsong0707 <74165917+songsong0707@users.noreply.github.com>
Co-authored-by: yang <30883395+webvs2@users.noreply.github.com>
Co-authored-by: selicens <1244620067@qq.com>
Co-authored-by: 一堆菠萝 <53335668+JavanShen@users.noreply.github.com>
Co-authored-by: H1mple <35363759+baohangxing@users.noreply.github.com>
Co-authored-by: Cherry7 <79909910+CCherry07@users.noreply.github.com>
Co-authored-by: Konv Suu <2583695112@qq.com>
Co-authored-by: luoawai <32483950+luoawai@users.noreply.github.com>
Co-authored-by: 鱼见 <657715602@qq.com>
Co-authored-by: zhuzhengjian <zhuzhengjian@hoteamsoft.com>
Co-authored-by: Cupid Valentine <53572196+valcosmos@users.noreply.github.com>
Co-authored-by: 专业逮虾户aa <30494925+waldonUB@users.noreply.github.com>
Co-authored-by: PanStar <PanStar@users.noreply.github.com>
2023-07-14 11:58:27 +08:00
tangjinzhou 0a738a36b6
Merge branch 'main' into feat-v4 2023-07-14 11:56:19 +08:00
tangjinzhou 10f990d534 release 4.0.0 2023-07-14 11:54:46 +08:00
PanStar 8b5d71663a
docs: export space-compact types (#6716) 2023-07-14 10:08:30 +08:00
tangjinzhou 058e8ec542 revert: #6706 2023-07-03 21:40:54 +08:00
selicens f70b04c74f
docs: synchronous config-provider demo (#6706) 2023-07-03 21:29:54 +08:00
Zev Zhu 2ce4e7da82
feat: calendar select support info.source param (#6697)
* docs: add ant-design-vue nuxt module

* feat: calendar select support info.source param
2023-07-03 21:27:18 +08:00
selicens fc5181d1d8
docs(QRCode): Synchronize QR code demonstration and add SVG (#6660)
* fix: Synchronize QR code demonstration and add SVG

* fix: responsive loss and invalid border style

* docs: synchronize antd5.6.3 QRCode color in dark mode
2023-06-28 10:11:52 +08:00
tangjinzhou 994707bd50 fix: image animation & zindex, close #6675 2023-06-25 10:55:27 +08:00
Cherry7 e9d26f2a7d
fix: portalWrapper add autoLock prop (#6687), close #6649 2023-06-25 06:51:25 +08:00
tangjinzhou 7fd0e4a225 release 4.0 2023-06-15 21:06:59 +08:00
tangjinzhou e229248053 fix: comment node error 2023-06-15 21:06:59 +08:00
selicens 10159941b9
docs(form): add form disabled demo (#6658) 2023-06-15 16:07:35 +08:00
tangjinzhou 9c26ab05d3 style: format lint 2023-06-15 13:38:17 +08:00
果冻橙 6861a77d29
fix(tour): target position (#6629) 2023-06-15 13:23:04 +08:00
Cherry7 308c30c738
fix: add disabledContext override with form components (#6618)
* fix: add disabledContext override with form components

* test: update snap

* fix: LabelWidth demo filename

* fix: fontsize spelling mistake
2023-06-15 11:17:58 +08:00
专业逮虾户aa afc1b84ed0
feat: checkbox label slot support use option label (#6642)
* docs: 📃change the default  setting of  "treeNodeFilterProp" from  "value" to "label"

* revert: ↩revert this config and create another pr to commit

* feat: checkbox label slot support use option label

* test: 🧪update checkbox *.snap file

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-06-15 11:11:24 +08:00
tangjinzhou 58f6d6ee28 Merge remote-tracking branch 'origin/main' into feat-v4 2023-06-15 11:05:14 +08:00
Cupid Valentine 7270855ce8
docs: fixed the style error of online demo (#6630) 2023-06-12 22:47:37 +08:00
selicens 19f0aea965
fix: layout-sider and menu transition style(#6637) (#6640) 2023-06-12 22:47:01 +08:00
Zev Zhu 6f032c9722
docs: add ant-design-vue nuxt module (#6620) 2023-06-01 14:57:23 +08:00
selicens 6be947aeb9
docs: update v4 tabs doc error(#6606) (#6607) 2023-06-01 14:55:50 +08:00
tangjinzhou 45ede0853b release 4.0.0-rc.5 2023-05-25 22:19:01 +08:00
tangjinzhou afb2619a81 fix: pagination mini size style 2023-05-25 22:18:34 +08:00
tangjinzhou 2bf85998ba fix: checxbox style 2023-05-25 21:57:35 +08:00
tangjinzhou 42cb6871ee release 4.0.0-rc.4 2023-05-23 14:38:58 +08:00
tangjinzhou 508e8e3706 fix: paginantion error, close #6590 2023-05-23 14:38:26 +08:00
tangjinzhou fe3c2bdf89 chore: remove vue private api 2023-05-20 22:09:11 +08:00
tangjinzhou 64b9347fce 4.0.0-rc.3 2023-05-20 16:58:23 +08:00
tangjinzhou 96f940d834 release 4.0.0-rc.2, close #6588 2023-05-20 15:52:46 +08:00
tangjinzhou d3d37f08a2 Merge remote-tracking branch 'origin/main' into feat-v4 2023-05-20 15:50:21 +08:00
tangjinzhou d49082008e Merge remote-tracking branch 'origin/main' into feat-v4 2023-05-19 10:15:43 +08:00
tangjinzhou 1d0a2737a4 release 4.0.0-rc.1 2023-05-19 09:12:03 +08:00
tangjinzhou c9f0841628 feat: support vue 3.3 slot type 2023-05-18 23:30:34 +08:00
tangjinzhou 03760e3e3d Merge remote-tracking branch 'origin/main' into feat-v4 2023-05-18 23:23:43 +08:00
tangjinzhou c36f7e701f fix: tour animated 2023-05-18 07:23:46 +08:00
果冻橙 83017269ab
fix: tour-mask attrs pointer-events (#6577) 2023-05-18 07:19:48 +08:00
tangjinzhou 1c7b7a35f6 test: update tour test 2023-05-17 23:05:18 +08:00
tangjinzhou 28263bbe33 test: update snap 2023-05-17 22:57:15 +08:00
tangjinzhou 5aad611d4c fix: picker support v-show 2023-05-17 22:53:02 +08:00
tangjinzhou 429172b345 fix: tour center 2023-05-17 22:12:52 +08:00
tangjinzhou e5787c2ed2 refactor: tour #6332 2023-05-17 19:02:49 +08:00
果冻橙 698c0ff3b4
feat: add tour (#6332)
* feat v4 add tour

* fix type error

* sync tour from antd5.4.6 & fix type error

* fix error
2023-05-17 11:05:47 +08:00
tangjinzhou db4148af5a feat: remove Step __legacy 2023-05-17 09:23:44 +08:00
tangjinzhou 21cf533664 fix: tooltip custom color error 2023-05-16 22:49:17 +08:00
Zev Zhu 4c8cc0129f
fix(grid): remove grid xxxl attribute (#6572)
* fix: remove grid xxxl attribute

* docs: remove xxxl in grid docs
2023-05-16 22:30:18 +08:00
selicens a694167f37
fix: segmentd disabled label is undefined (#6556)
* fix: segmentd disabled label is undefined

* fix: segmentd disabled label is undefined

* fix: segmentd disabled label is undefined
2023-05-14 17:02:07 +08:00
Zev Zhu 3ed455b3f7
docs(grid): update migrate docs && delete xxxl in grid docs (#6562) 2023-05-14 17:01:26 +08:00
果冻橙 e49e72d24a
fix: components bug & update docs (#6548)
* fix bug

* fix test case and update snapshot,fix space merge class
2023-05-14 16:59:56 +08:00
Zev Zhu 149cedd262
test(alert): update demo with space (#6541)
* docs(alert): update demo with space

* docs(alert): update alert test snap

---------

Co-authored-by: zhuzhengjian <zhuzhengjian@hoteamsoft.com>
2023-05-11 23:29:19 +08:00
Zev Zhu 8bf8515933
docs: update grid docs (#6549)
Co-authored-by: zhuzhengjian <zhuzhengjian@hoteamsoft.com>
2023-05-11 23:28:47 +08:00
tangjinzhou 0d24755ee3 release 4.0.0-beta.4 2023-05-08 16:39:33 +08:00
tangjinzhou f2f7cfd94d release 4.0.0-beta.3 2023-05-08 16:09:50 +08:00
tangjinzhou d933605b56 fix: getPopupContainer not work 2023-05-08 16:09:29 +08:00
果冻橙 266482deca
docs(customize-theme): update docs (#6540)
* fix introduce doc

* fix getting-started doc

* add migration-v4 doc

* fix docs

* Update migration-v4.zh-CN.md

* Update migration-v4.zh-CN.md

* Update migration-v4.en-US.md

* Update migration-v4.zh-CN.md

* Update getting-started.en-US.md

* Update getting-started.zh-CN.md

* Update introduce.en-US.md

* Update introduce.zh-CN.md

* update customize-theme doc & fix migration-v4 error

* update customize-theme doc

* fix migration-v4 error

* remove SSR & shadowDom

* Update customize-theme.zh-CN.md

* Update customize-theme.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-05-08 10:03:07 +08:00
Cherry7 fd8af2322c
docs(introduce): update docs (#6539)
* docs(introduce): update docs

* docs(introduce): add Dollar

* Update introduce.zh-CN.md

* Update introduce.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-05-07 20:36:58 +08:00
Cherry7 9fdc297686
docs(button): update demo with space (#6536)
* feat(button): demo space

* test(button): update demo snap

* chore(button): disabled demo Ghost space

* test(button): update disabled demo snap
2023-05-07 20:33:24 +08:00
tangjinzhou fded418b8a release 4.0.0-beta.2 2023-05-05 11:59:37 +08:00
tangjinzhou feffe70ebb refactor: useNotification #6527 2023-05-05 11:55:42 +08:00
tangjinzhou 02ed988cba refactor: useMessage #6527 2023-05-05 11:01:57 +08:00
Cherry7 6eb4d8f5c5
Feat(use): add useMessage useNotification (#6527)
* feat(Message): add useMessage hook

* feat(Notification): add useNotification hook

* feat(Message): add Hook demo

* feat(Notification): add Hook demo

* test(Message): update demo snap

* test(Notification): update demo snap

* docs(Message): update docs with FAQ

* docs(Notification): update docs with FAQ
2023-05-05 09:59:57 +08:00
Zev Zhu b61c88e5df
fix(config-provider): fix ConfigProvider.config is not function close #6528 (#6529) 2023-05-05 09:41:34 +08:00
tangjinzhou ac93c476d1 docs: fix tab demo error 2023-05-03 15:35:46 +08:00
tangjinzhou db46965761 release 4.0.0-beta.1 2023-05-03 15:10:52 +08:00
tangjinzhou 5578c14a8e perf: useModal #6517 2023-05-03 15:09:01 +08:00
Cherry7 69640c0af8
feat(modal): add useModal (#6517)
* feat(modal): add useModal hook

* feat(modal): add HookModal demo

* test(modal): update HookModal demo snap

* feat(modal): update modal docs

* chore(modal): update modal type
2023-05-03 14:15:34 +08:00
tangjinzhou 0df6abe3a7 Merge remote-tracking branch 'origin/main' into feat-v4 2023-05-03 13:50:14 +08:00
Zev Zhu b103b7570d
fix: dealing with switching topics modal, notification, message does not take effect close #6512 (#6518)
* fix: resolve dark mode not support

* fix: unified expression
2023-05-03 13:24:28 +08:00
tangjinzhou 61d6312783 fix: dropdown menu hide error 2023-05-02 23:36:12 +08:00
tangjinzhou 98be7071e5 Merge remote-tracking branch 'origin/main' into feat-v4 2023-04-28 15:51:46 +08:00
tangjinzhou 5439e0c164 fix: submenu type lose theme 2023-04-28 15:37:29 +08:00
Cherry7 9be58078d2
Refactor(demo): change options to composition api (#6499)
* feat(demo): A-B

* feat(demo): update B-checkbox

* feat(demo): update CheckBox -DatePicker

* feat(demo): update DatePicker - Form

* feat(demo): update Form - List

* feat(demo): update  List-pagination

* feat(demo): update  List - skeleton

* feat(demo): update  skeleton - switch

* feat(demo): update  skeleton - switch

* feat(demo): update   switch - upload

* feat(demo): update  watermark

* fix(demo): del hashId
2023-04-28 14:08:21 +08:00
果冻橙 063c06f9c6
fix: table resizable not work && type error (#6514) 2023-04-27 21:04:29 +08:00
tangjinzhou 43009f0c59 release 4.0.0-alpha.6 2023-04-23 19:33:19 +08:00
tangjinzhou 678ec079bc fix: antd.min error 2023-04-23 19:18:11 +08:00
tangjinzhou eba8f6b960 feat: menu items icon add arg 2023-04-23 15:52:31 +08:00
tangjinzhou 760c4c2695 doc: update menu icon 2023-04-23 15:00:34 +08:00
Cherry7 8ab50b1757
feat(menu): icon support function components with items and update demo (#6457)
* fix(menu): icon do not show problem

* fix(menu): icon do not show problem

* feat(menu): update demo

* test(menu): update demo snap

* chore(Menu): update docs

* test(Menu): update demo

* Update MenuItem.tsx

* Update SubMenu.tsx

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-04-23 14:23:15 +08:00
tangjinzhou b0990b7323 Merge remote-tracking branch 'origin/main' into feat-v4 2023-04-23 11:02:19 +08:00
tangjinzhou 5376014b33 docs: update doc anchor 2023-04-21 22:29:04 +08:00
tangjinzhou bccd9204e8 feat: anchor add customTitle slot #6447 2023-04-21 21:29:20 +08:00
Cherry7 8932aff13f
feat(anchor): add direction action (#6447)
* refactor(anchor): direction show

* refactor(anchor): update anchor css

* feat(anchor): update demo

* test(anchor): update demo test snap

* feat(anchor): update docs

* Update index.zh-CN.md

* Update index.en-US.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-04-21 17:33:38 +08:00
tangjinzhou de00607dc7 feat: remove backtop 2023-04-21 16:19:41 +08:00
果冻橙 118ae9a50b
docs: v4 vuedocs (#6468)
* fix introduce doc

* fix getting-started doc

* add migration-v4 doc

* fix docs

* Update migration-v4.zh-CN.md

* Update migration-v4.zh-CN.md

* Update migration-v4.en-US.md

* Update migration-v4.zh-CN.md

* Update getting-started.en-US.md

* Update getting-started.zh-CN.md

* Update introduce.en-US.md

* Update introduce.zh-CN.md

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-04-21 15:46:40 +08:00
tangjinzhou 0683ede0fb feat: add convertLegacyToken 2023-04-21 14:52:32 +08:00
果冻橙 838aa71b4b
fix: cssinjs compatibility (#6454) 2023-04-13 16:39:29 +08:00
Cherry7 2bf654da71
chore(docs): update docs (#6446)
* docs(space): update demo

* docs(affix): update docs
2023-04-12 21:25:23 +08:00
tangjinzhou 515ab9e38c release 4.0.0-alpha.5 2023-04-08 22:02:52 +08:00
tangjinzhou d4f2e97ca9 fix: modal api method i18n not work, close #6438 2023-04-08 21:56:32 +08:00
tangjinzhou be90b53527 docs: update site responsive 2023-04-08 21:14:27 +08:00
鱼见 0b85b84dcf
fix(badge): badge props count default value error (#6433) 2023-04-08 21:05:12 +08:00
果冻橙 4e277ea9bb
fix
* fix compile type errors

* fix menuprops type import

* fix lint errors

* fix lint errors

* fix format error

* fix node version

* fix run dist error

* fix run lint

* fix as any

* fix string type

* fix steps error & fix docs version select option & fix theme editor error
2023-04-08 20:57:46 +08:00
selicens bf97057c2c
test: add QRCode unit testing (#6441) 2023-04-08 20:56:35 +08:00
tangjinzhou 637656b0c3 fix: picker import error 2023-04-06 17:31:51 +08:00
tangjinzhou 0e1b7fd94f release 4.0.0-alpha.4 2023-04-06 17:12:50 +08:00
tangjinzhou 33d1553908 fix: qrcode size error, close #6418 2023-04-06 17:09:04 +08:00
Cherry7 2eaad16331
fix(defaultConfigProvider): add getPopupContainer (#6425), close #6419 2023-04-06 15:56:58 +08:00
tangjinzhou 58998c4978 fix: progress borderRadius reactive #6409 2023-04-06 15:40:10 +08:00
Cherry7 7db4265616
feat(Progress): enhance size prop and add variants (#6409)
* refactor(progress): Progress size and add variants

* feat(progress): add `getsize`

* refactor(progress): Progress size and add variants

* chore(progress): update props type

* chore(progress): update props type

* feat(progress): update demo

* feat(progress): update docs

* test(progress): update test snap

* fix(Circle): Merging classes

* test(progress): update test snap

* feat(progress): add size demo

* test(progress): add size snapshot

* chore(Progress): reback Circle svg class change
2023-04-06 15:11:58 +08:00
tangjinzhou 8a3ed32254 docs: update compatiple #6415 2023-04-06 14:46:47 +08:00
Cherry7 1151bdad0f
feat(StyleProvider): add StyleProvider handle cssinjs features (#6415)
* feat(StyleProvider): StyleProvider

* feat(StyleProvider): refactor to  use context

* chore(StyleProvider): update AStyleProviderProps type

* chore(App): reback

* chore(StyleProvider): export StyleProvider

* feat(StyleProvider): update StyleProvider docs

* feat(StyleProvider): update StyleProvider docs

* feat(StyleProvider): add StyleProvider docs routes

* chore(StyleProvider): with useStyleProvider
2023-04-06 11:07:55 +08:00
luoawai 84037f8eef
fix(Modal): fix modal locale (#6423) 2023-04-06 10:56:10 +08:00
tangjinzhou 3e46f27b59 perf: shallowRef instead ref 2023-04-05 22:03:02 +08:00
tangjinzhou 719847901e test: update steps 2023-04-05 17:04:02 +08:00
tangjinzhou fbfec0a062 refactor: steps #6406 2023-04-05 16:28:49 +08:00
tangjinzhou 9a5cbeee50 docs: update site 2023-04-05 13:50:08 +08:00
Cherry7 b0125de963
feat(Steps): add items prop and variants (#6406)
* refactor(steps): add items prop and variants

* feat(steps): add Label Placement and Inline Steps demo

* feat(steps): Label Placement and Inline Steps snap

* test(steps): Steps demo snap

* feat(Steps): update docs

* fix(Step): progressDot

* chore(useLegacyItems): change from warning to devWarning

* refactor(Steps): Remove useLegacyItems

* refactor(Steps): renderStep

* test(Steps): update test snapshot

* chore(Steps): filterEmpty

* feat(Steps): update docs
2023-04-05 13:39:40 +08:00
tangjinzhou bf1e6fec95 docs: update datepicker doc #6387 2023-04-05 13:30:31 +08:00
tangjinzhou 5f1cb0d240 fix: datepicker presets error #6387 2023-04-05 13:29:08 +08:00
Cherry7 f6daa8d28f
Feat(DatePicker): increase presets prop (#6387)
* feat(date-picker): add PresetDate type

* feat(date-picker): add usePresets hook

* feat(date-picker): add PresetPanel Component

* feat(date-picker): add PresetPanel Component

* feat(demo): update Preset Ranges Examples

* feat(docs): add new prop presets

* feat(docs): add new prop presets with english

* fix(RangePicker): footer is not managed by panels

* chore(Picker): prefixCls default rc-picker

* chore(date-picker): update presetted-ranges demo

* chore(date-picker): update rangePickerProps'presets

* feat(date-picker): presets reactively processing

* chore(date-picker): update type

* refactor(RangePicker): deprecated ranges prop

* chore(date-picker): update type

* chore(PickerPanel): del notuse panelRef

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-04-05 10:56:07 +08:00
tangjinzhou 48ab5a2f99 Merge remote-tracking branch 'origin/main' into feat-v4 2023-04-05 10:05:59 +08:00
Cherry7 ae27d430e5
docs: version menu (#6390) 2023-03-27 08:16:03 +08:00
Konv Suu 9dbe035efe
style: add dark style for `pre` and `code` (#6382) 2023-03-27 08:11:29 +08:00
tangjinzhou 6d60eba281 release 4.0.0-alpha.4 2023-03-21 15:09:00 +08:00
tangjinzhou bfcbd5bdef fix: ConfigProvider error for style, close #6368 2023-03-21 15:08:16 +08:00
Cherry7 4d2a37fcd3
fix: ant-piker-cell-range-hover-end style error (#6373)
* fix: ant-piker-cell-range-hover-end style error

* feat: be consistent with antd

* feat: be consistent with antd
2023-03-21 14:08:37 +08:00
tangjinzhou dcc3bb10cb fix: button wave not work 2023-03-20 16:45:26 +08:00
tangjinzhou 7d1418d9f4 doc: update baner 2023-03-20 13:36:49 +08:00
zkwolf 3653f37d6b
fix: dropdown divider disappear, close #6365 (#6369) 2023-03-20 13:32:23 +08:00
果冻橙 f265a7bb02
fix docs dark theme & add docs coverDark (#6367)
* fix docs dark theme & add docs coverDark

* fix theme Editor edit
2023-03-20 11:15:02 +08:00
tangjinzhou 89314fb4d0 fix: qrcode ; error, close #6362 2023-03-17 10:27:17 +08:00
tangjinzhou b1f38eb2ec release 4.0.0-alpha.2 2023-03-16 14:42:15 +08:00
tangjinzhou d95861aa90 fix: motion not work 2023-03-16 14:41:44 +08:00
果冻橙 5cc85f3cc1
doc: fix theme editor bgcolor (#6358) 2023-03-16 08:27:37 +08:00
tangjinzhou f3935ebb4f doc: update site 2023-03-14 13:38:47 +08:00
tangjinzhou 11c52d487d doc: update doc site 2023-03-14 10:30:18 +08:00
tangjinzhou 295c417f49 fix: remove not use file 2023-03-13 21:24:27 +08:00
tangjinzhou 27c5a6c96a fix: qrcode type 2023-03-13 15:22:48 +08:00
tangjinzhou fc7cadb3f9 release 4.0.0-alpha.1 2023-03-13 15:08:43 +08:00
tangjinzhou ad1d6443f2 fix: tag click event not trigger 2023-03-13 12:08:38 +08:00
tangjinzhou 77d0d188f0 doc: format code 2023-03-13 11:58:59 +08:00
tangjinzhou b22bd85828 fix: cssinjs effect error 2023-03-13 11:11:40 +08:00
果冻橙 f819a1b209
Feat v4 theme editor (#6349)
* feat: add theme editor container

* feat: add theme editor layout

* add left panel

* add vue-colorful & fix bug

* 修复hue组件抖动问题

* fix bug && add demo

* fix bug

* fix demo preview

* fix theme editor components demo

* add theme editor token drawer

* add theme editor token drawer

* fix bug

* open commment

* fix error demo

* fix theme editor bug
2023-03-13 09:54:21 +08:00
tangjinzhou dde2ff140d fix: token effect error 2023-03-12 23:48:46 +08:00
果冻橙 f429148734
Feat v4 theme editor (#6348)
* feat: add theme editor container

* feat: add theme editor layout

* add left panel

* add vue-colorful & fix bug

* 修复hue组件抖动问题

* fix bug && add demo

* fix bug

* fix demo preview

* fix theme editor components demo
2023-03-12 15:15:52 +08:00
tangjinzhou 23a213acda Merge remote-tracking branch 'origin/main' into feat-v4 2023-03-08 13:44:43 +08:00
tangjinzhou d241a06f9d Merge remote-tracking branch 'origin/main' into feat-v4 2023-03-04 08:37:28 +08:00
tangjinzhou 1d9a521669 fix: floatbutton animation not work 2023-03-03 17:25:11 +08:00
tangjinzhou a04cae1221 fix: groupsize context error 2023-03-03 17:13:48 +08:00
tangjinzhou add208aefb refactor: float-button 2023-03-03 16:58:47 +08:00
tangjinzhou 355c41b4aa refactor: qrcode #6315 2023-03-03 14:56:23 +08:00
果冻橙 3f5f3ecabf
Feat v4 floatbutton (#6294)
* feat: add float-button components

* fix type &  demo display

* fix components entry

* fix review bug

* fix bug

* fix .value
2023-03-02 10:59:44 +08:00
selicens 41a455f881
feat: add qrcode (#6315)
* feat: add qrcode

* fix: qrcode bug

* fix: qrcode value required

* refactor: props  deconstruct
2023-03-02 10:46:16 +08:00
zkwolf eda7247c2c
fix: inject value maybe undefined && tag style invalid (#6320)
* fix: inject value maybe undefined

* fix(tag): style invalid
2023-02-28 21:57:11 +08:00
tangjinzhou f85485e733 doc: add theme-editor 2023-02-28 16:47:38 +08:00
tangjinzhou a1e967dfc2 refactor: watermark type 2023-02-28 11:01:43 +08:00
Zev Zhu 6058ca5576
feat: add watermark (#6300)
* feat: add watermark

* feat: add watermark demo

* feat: add mutationObserver

* feat: add watermark demo
2023-02-28 10:35:10 +08:00
zkwolf dd063b8275
fix(dropdown): open invalid (#6316) 2023-02-28 10:25:46 +08:00
tangjinzhou 9c6a9fb47c fix: tag warning 2023-02-27 16:06:26 +08:00
tangjinzhou 516b2e5a0c refactor: rename _style to style 2023-02-27 16:00:05 +08:00
tangjinzhou d3a919b0bf chore: update style 2023-02-27 15:54:40 +08:00
tangjinzhou 261e7d0857 chore: update token error 2023-02-27 11:00:19 +08:00
tangjinzhou b393a0a2dd doc: refactor doc 2023-02-24 23:58:46 +08:00
tangjinzhou 2b80870461 doc: update doc 2023-02-23 21:42:41 +08:00
tangjinzhou 33a47bc27a chore: update build script 2023-02-23 17:20:38 +08:00
tangjinzhou 53b146ab88 refactor: remove not use code 2023-02-23 17:19:50 +08:00
tangjinzhou f3ffcdbc7e doc: update cover 2023-02-23 12:21:23 +08:00
tangjinzhou 37b5d02b6d fix: use open, remove visible 2023-02-23 11:58:23 +08:00
tangjinzhou 1b51e6ffb3 fix: directive not work 2023-02-23 10:01:30 +08:00
tangjinzhou f39d4894e4 refactor: form 2023-02-21 23:11:05 +08:00
一堆菠萝 975d70e7ed
fix: some type & doc (#6292)
* fix: typo (#6218)

* fix:  typo

* docs<upload>: docs update

* fix: type of minute in props disabledDateTime of DatePicker (#6233)

* docs: typo (#6256)

* feat: tooltip added overlayInnerStyle attribute

* Update abstractTooltipProps.ts

* Update Tooltip.tsx

---------

Co-authored-by: lyn <76365499@qq.com>
Co-authored-by: H1mple <35363759+baohangxing@users.noreply.github.com>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-21 14:10:35 +08:00
tangjinzhou c301c63e8b feat: radio add disabled context 2023-02-21 12:06:31 +08:00
果冻橙 e04f73dfef
refactor:radio (#6299)
* refactor:radio

* fix attrs
2023-02-21 11:33:54 +08:00
tangjinzhou 8fcb3fdfe3 refactor: drawer 2023-02-20 23:26:23 +08:00
tangjinzhou c7b15a96a8 refactor: image 2023-02-20 15:38:42 +08:00
tangjinzhou e8918ce589 refactor: auto-complete 2023-02-20 14:17:36 +08:00
tangjinzhou 62dda88ea0 refactor: cascader 2023-02-20 14:08:09 +08:00
tangjinzhou 3741931363 docs: update doc toc 2023-02-20 11:58:26 +08:00
tangjinzhou 7af22a70f9 perf: table 2023-02-20 11:15:17 +08:00
tangjinzhou 087dfa2f1b feat: tree-select add context size 2023-02-20 11:04:25 +08:00
果冻橙 799eeed346
refactor: tree select (#6296) 2023-02-20 10:32:25 +08:00
tangjinzhou 124aae72a4 feat: select add context size 2023-02-20 10:28:16 +08:00
果冻橙 39e5824699
refactor:select (#6295)
* refactor:select

* update doc

* delete useless
2023-02-20 00:17:22 +08:00
tangjinzhou 9df8317ece refactor: segmented #6286 2023-02-20 00:05:54 +08:00
selicens 62e7f94aba
feat: add segmented (#6286) 2023-02-18 16:16:44 +08:00
tangjinzhou 47385347ee refactor: tabs #6288 2023-02-17 23:14:26 +08:00
yang 6240ab2885
[tabs] :less to cssinjs (#6288)
* update

* switch

* Style adjustment

* refactor(Card): less to cssinjs

* tabs: less to cssinjs 开发ing

* add function cssinjs

* Eliminate irrelevant code

* Eliminate irrelevant code 2

* update components

* Eliminate irrelevant input  code
2023-02-17 22:08:24 +08:00
tangjinzhou 328e42a9be feat: tree add leafIcon 2023-02-17 22:02:59 +08:00
tangjinzhou 634675e032 refactor: rename locale file 2023-02-17 22:02:59 +08:00
果冻橙 7ddf882a99
Feat v4 fix type errors (#6285)
* fix compile type errors

* fix menuprops type import

* fix lint errors

* fix lint errors

* fix format error

* fix node version

* fix run dist error

* fix run lint

* fix as any

* fix string type
2023-02-17 22:01:30 +08:00
果冻橙 895b43338d
refactor:tree (#6276) 2023-02-17 10:04:45 +08:00
果冻橙 9f53d53cb8
refactor:timepicker (#6270)
* refactor:timepicker

* docs:update & refactor: timepicker type
2023-02-17 10:03:34 +08:00
果冻橙 cd47a277da
refactor:calendar (#6269)
* refactor:calendar

* docs:update
2023-02-17 10:02:38 +08:00
tangjinzhou adec5211f1 feat: table add expandColumnTitle slot 2023-02-17 09:49:21 +08:00
tangjinzhou a6a270b44a refactor: table 2023-02-16 19:23:44 +08:00
果冻橙 8472c25633
refactor:table (#6267)
* refactor:table

* docs:update & refactor: table type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-16 07:44:48 +08:00
tangjinzhou c1ed77f67a feat: number add compactSize & disabledContext 2023-02-15 15:49:23 +08:00
果冻橙 df6a1fdb71
refactor:inputnumber (#6265)
* refactor:inputnumber

* docs:update & refactor: inputnumber type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-15 15:37:49 +08:00
tangjinzhou 321989b9c2 feat: update collapse type 2023-02-15 15:33:54 +08:00
果冻橙 2f51f2d3af
refactor:collapse (#6266)
* refactor:collapse

* fix collapse props version

* docs:update & refactor: collapse type & fix collapsible
2023-02-15 15:28:52 +08:00
tangjinzhou dc9987aea8 fix: steps icon clss error 2023-02-15 14:34:11 +08:00
果冻橙 3715ded674
refactor:steps (#6264)
* refactor:steps

* fix ...attrs

* fix StepsToken error

* docs:update & refactor: steps type
2023-02-15 14:08:45 +08:00
tangjinzhou 04e3819b0b perf: timeline 2023-02-15 14:03:11 +08:00
果冻橙 587c1ca89d
refactor:timeline (#6263)
* refactor:timeline

* docs:update & refactor: timeline type
2023-02-15 13:52:47 +08:00
tangjinzhou 8a233d7c3a perf: upload motion 2023-02-15 13:38:57 +08:00
果冻橙 0464c84afc
refcator:upload (#6261)
* refcator:upload

* docs:update & refactor: upload type

* Update style.ts

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-15 10:19:49 +08:00
tangjinzhou 7e29eb2163 doc: update mentions demo 2023-02-14 15:50:16 +08:00
Zev Zhu 92795a828f
refactor: mentions (#6255)
* refactor: mentions

* refactor: mentions menu provider
2023-02-14 14:09:23 +08:00
tangjinzhou 44e5d09f22 style: update pagination props type 2023-02-14 14:06:14 +08:00
果冻橙 f6afd7fffc
refactor:pagination (#6251)
* refactor:pagination

* docs:update & refactor: pagination type
2023-02-14 14:02:22 +08:00
tangjinzhou 7de1be6a9a feat: checkbox add disabled context 2023-02-14 13:58:37 +08:00
果冻橙 19ec975deb
refactor:checkbox (#6248)
* refactor:checkbox

* docs:update & refactor: checkbox type
2023-02-14 13:49:06 +08:00
tangjinzhou 4ccb1c3e19 perf: transfer 2023-02-13 20:46:02 +08:00
果冻橙 68d295d7ef
refactor:transfer (#6247)
* refactor:transfer

* merge v4 branch & fix theme interface conflict

* docs:update & refactor: transfer type
2023-02-13 20:21:29 +08:00
果冻橙 bbfb3cef7d
refactor:carousel (#6262)
* refactor:carousel

* docs:update & refactor: carousel type

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-13 17:46:06 +08:00
tangjinzhou e9ce4eb2d5 refactor: card #6258 2023-02-13 17:35:49 +08:00
yang cb08f8551a
refactor(crad): less to cssinjs (#6258)
* update

* switch

* Style adjustment

* refactor(Card): less to cssinjs

* Eliminate invalid code

* optimization and adjustment css

* Adjust the css

* Optimize each item

* adjustment css
2023-02-13 17:21:48 +08:00
tangjinzhou f0e5da3b69 feat: slider deprecated tooltipVisible 2023-02-12 15:24:58 +08:00
果冻橙 2f049329a5
refactor:slider (#6250) 2023-02-12 15:00:38 +08:00
tangjinzhou 350dbfedbb docs: update result cover 2023-02-12 14:48:12 +08:00
bqy_fe 4b2ffd7127
refactor(result): less to cssinjs (#6246)
* refactor(result): less to cssinjs

* fix: class name is overridden
2023-02-12 14:44:50 +08:00
tangjinzhou a5389a22ea doc: update layout cover 2023-02-12 14:37:02 +08:00
bqy_fe 7a34c99935
refactor(layout): less to cssinjs (#6249) 2023-02-12 14:34:58 +08:00
songsong0707 dc480bd4b3
refactor: rate style (#6254) 2023-02-12 11:24:00 +08:00
tangjinzhou 1d774507c0 refactor: datepicker type 2023-02-12 11:18:49 +08:00
果冻橙 80918cba98
refactor:datepicker (#6245) 2023-02-12 10:37:06 +08:00
tangjinzhou 197e209b4e fix: typography #6244 2023-02-12 10:05:44 +08:00
果冻橙 82c4c8f0d3
refactor:typography (#6244)
* refactor:typography

* fix return

* fix import type
2023-02-12 09:56:57 +08:00
tangjinzhou 23b81b0e17 perf: space compact 2023-02-12 09:49:00 +08:00
bqy_fe f0649999fb
refactor(Space): less to cssinjs & add compact mode (#6229)
* refactor(Space): less to cssinjs & add compact mode

* chore(space): update md

* chore(space): add demo

* chore(space): add some demo

* feat(button): add compact mode

* fix: reactivity lose

* docs: fix props version

---------

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-02-12 09:26:39 +08:00
tangjinzhou e2d4f8c2e3 feat: update type 2023-02-08 15:14:43 +08:00
果冻橙 de77b0175d
refactor:list (#6241)
* refactor:list

* fix inheritAttrs: false & attrs.class
2023-02-08 14:14:08 +08:00
果冻橙 26f98b7b10
refactor:statistic (#6240)
* refactor:statistic

* fix inheritAttrs: false & attrs.class
2023-02-08 14:11:53 +08:00
果冻橙 a9fbf98f0e
refactor:pageheader (#6239)
* refactor:pageheader

* fix inheritAttrs: false & attrs.class
2023-02-08 14:10:45 +08:00
果冻橙 fee7c04d67
refactor:comment (#6238)
* refactor:comment

* fix inheritAttrs: false & attrs.class
2023-02-08 14:09:32 +08:00
tangjinzhou 8658806e3f feat: input add disabled 2023-02-08 11:04:16 +08:00
果冻橙 4f3ce35e74
refactor:input (#6237)
* refactor:input

* fix inheritAttrs:false

* fix attrs.class
2023-02-08 07:50:04 +08:00
Zev Zhu 69c17dc255
refactor: switch (#6236)
* refactor: switch style

* refactor: delete switch style
2023-02-07 23:19:09 +08:00
tangjinzhou a40816880a refactor: progress #6234 2023-02-07 11:08:42 +08:00
Zev Zhu 2c1afa5e72
refactor: progress style (#6234)
* refactor: progress

* refactor: progress style

* fix: progress attrs
2023-02-07 10:25:02 +08:00
tangjinzhou 81e26a900e fix: empty props #6230 2023-02-07 10:06:05 +08:00
bqy_fe fc0f0d8a96
refactor(empty): less to cssinjs (#6230)
* refactor(empty): less to cssinjs

* chore: remove unuse code

* fix: reactivity lose
2023-02-07 09:57:31 +08:00
bqy_fe a205615af9
refactor(tag): less to cssinjs (#6227) 2023-02-03 09:50:40 +08:00
tangjinzhou 9b5a07220b refactor: popover & popconfirm 2023-02-02 22:18:42 +08:00
tangjinzhou 47c84cdbad refactor: dropdown 2023-02-02 22:18:42 +08:00
zkwolf 989bedda47
fix(button): link and text should not have wave (#6226) 2023-02-02 18:08:36 +08:00
Zev Zhu dd57d1e305
refactor: skeleton (#6224)
* refactor: skeleton

* refactor: skeleton style

* chore: modify skeleton demo style
2023-02-02 18:07:46 +08:00
zkwolf 158cca7f8a
test: test case error (#6225)
* fix: inject value maybe undefined

* fix: tootip emit correct value

* fix: rollback warning suffix avoid test break

* doc(grid): remove unused type="flex"
2023-02-02 18:05:58 +08:00
tangjinzhou 8099391e97 fix: spin error #6222 2023-02-01 17:33:59 +08:00
Zev Zhu 7939eb1718
refactor: spin (#6222)
* fix: typo (#6218)

* fix:  typo

* docs<upload>: docs update

* refactor: spin

* refactor: spin

* refactor: spin

* refactor: spinnn

* refactor: spin

---------

Co-authored-by: lyn <76365499@qq.com>
2023-02-01 17:17:56 +08:00
tangjinzhou 34373ca05d refactor: ts 2023-02-01 15:49:24 +08:00
tangjinzhou 4ef70b1503 doc: update demo 2023-01-31 22:49:08 +08:00
tangjinzhou 31776a2cf8 fix: row ts type not work 2023-01-31 22:37:36 +08:00
zkwolf 31ca070a18
refactor: grid (#6220)
* refactor: grid

* fix(grid): align & justify responsive

* chore: update demo and snapshot
2023-01-31 22:20:43 +08:00
tangjinzhou 1d01df4b85 refactor: tooltip 2023-01-30 22:28:00 +08:00
zkwolf 337d958c67
fix: custom class (#6217) 2023-01-29 14:50:30 +08:00
tangjinzhou 94e981e00b refactor: menu 2023-01-28 19:11:32 +08:00
tangjinzhou 221b203cbb refactor: modal 2023-01-28 10:02:40 +08:00
tangjinzhou dfe462ec6f refactor: locale-provider 2023-01-28 08:53:47 +08:00
tangjinzhou 8110d8cbbd refactor: rename locale 2023-01-28 08:39:47 +08:00
bqy_fe c903de3c0e
refactor(icon): remove style dir (#6215) 2023-01-28 08:25:17 +08:00
bqy_fe 44d7917afd
refactor(divider): less to cssinjs (#6214)
* refactor(divider): less to cssinjs

* fix: add inheritAttrs
2023-01-28 08:22:49 +08:00
tangjinzhou 73ce708868 refactor: message & notification 2023-01-27 22:36:28 +08:00
tangjinzhou d211688059 fix: responsive reactive #6213 2023-01-27 16:54:13 +08:00
zkwolf 9d5343ae9c
refactor: descriptions (#6213)
* refactor: descriptions

* fix: ts error

Co-authored-by: tangjinzhou <415800467@qq.com>
2023-01-27 16:46:58 +08:00
tangjinzhou 2d54e2124f fix: type error 2023-01-27 16:29:47 +08:00
tangjinzhou b5d7d582cd refactor: configprovider 2023-01-27 16:00:17 +08:00
tangjinzhou 0399ce0ec7 style: update util 2023-01-26 22:14:20 +08:00
tangjinzhou 94c2887c81 fix: button classname error 2023-01-26 22:13:01 +08:00
tangjinzhou 75e4b72c21 refactor: button 2023-01-26 21:42:27 +08:00
tangjinzhou 287a8d0c4e refactor: Breadcrumb 2023-01-26 16:52:06 +08:00
tangjinzhou 1e4e3cb3b4 refactor: badge 2023-01-26 11:13:29 +08:00
tangjinzhou e64a19a05a refactor: backtop 2023-01-26 10:13:10 +08:00
tangjinzhou 6c735fee67 refactor: anchor & add items 2023-01-25 17:23:03 +08:00
tangjinzhou f8ddc430cf refactor: avatar 2023-01-25 16:39:56 +08:00
tangjinzhou 641714734a doc: update component cover 2023-01-25 16:22:35 +08:00
tangjinzhou 46862d749b refactor: affix support cssinjs 2023-01-25 16:16:25 +08:00
tangjinzhou 1f33babc89 feat: alert add action slot 2023-01-25 15:27:03 +08:00
tangjinzhou b2841a27ae refactor: cssinjs 2023-01-25 11:28:53 +08:00
tangjinzhou c0d7d041b4 refactor: cssinjs 2023-01-25 10:28:10 +08:00
tangjinzhou 10b52e0072 refactor: ccsinjs 2023-01-24 22:51:59 +08:00
tangjinzhou d64c6a8d53 Merge remote-tracking branch 'origin/main' into feat-v3.3 2023-01-17 18:39:55 +08:00
tangjinzhou 2eb071ce30 release 3.3.0-beta.4 2022-12-01 21:26:57 +08:00
tangjinzhou 6bd8a9b984 test: update snap 2022-11-25 09:55:31 +08:00
tangjinzhou 040956819f Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-11-24 19:28:21 +08:00
tangjinzhou 0f634e27d5 fix: popover button style 2022-09-13 20:04:00 +08:00
tangjinzhou 9815f817d4 fix: type import error 2022-08-28 09:00:25 +08:00
tangjinzhou d933f3edd5 fix: table column null error, close #5888 2022-08-12 16:19:32 +08:00
tangjinzhou dd60465373 chore: update webpack confgi 2022-08-11 22:26:35 +08:00
tangjinzhou 60a8be3014 release 3.3.0-beta.3 2022-08-11 14:27:54 +08:00
tangjinzhou a26ac3e9f4 feat: rating character add params 2022-08-11 14:24:39 +08:00
tangjinzhou e7fdb128e3 Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-08-11 14:12:39 +08:00
tangjinzhou 8d0155878e Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-08-07 20:03:09 +08:00
tangjinzhou e5e98e5776 feat: add tooltip-border-radius 2022-08-06 17:16:11 +08:00
meteorlxy 05357a8c3f
feat(Divider): add divider-horizontal-gutter variable (#5820) 2022-07-24 09:08:40 +08:00
tangjinzhou 86450c2a1b perf: import icons #5822 2022-07-24 08:56:44 +08:00
tangjinzhou 9ea87fb973 release 3.3.0-beta.2 2022-07-02 22:28:43 +08:00
tangjinzhou dae579a88e chore: update tools 2022-07-02 22:22:01 +08:00
tangjinzhou 58e8fd3e2e doc: update changelog 2022-07-02 21:04:01 +08:00
Amour1688 aae9a48dd0
chore: bundle esm output (#5772) 2022-07-02 21:02:48 +08:00
tangjinzhou 09c5a3e53f Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-07-02 21:01:41 +08:00
tangjinzhou e42fdd7a06 Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-07-02 09:54:19 +08:00
tangjinzhou 8b6a771318 Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-06-24 10:52:47 +08:00
tangjinzhou bb4b86a82e feat: merge main 2022-06-13 11:07:06 +08:00
tangjinzhou 9280b418d7
Merge branch 'main' into feat-v3.3 2022-05-23 14:30:18 +08:00
tangjinzhou efe600e89e test: update snap 2022-05-23 10:42:09 +08:00
tangjinzhou 8b34bdfa5e doc: add 3.3.0 changelog 2022-05-23 09:26:07 +08:00
tangjinzhou 3b1d48b4b4 test: update test 2022-05-22 21:45:48 +08:00
tangjinzhou dd1a535943 test: update test 2022-05-22 17:01:43 +08:00
tangjinzhou 5b583962db style: lint format 2022-05-22 16:39:57 +08:00
tangjinzhou 37d35f7801 feat: table add filterResetToDefaultFilteredValue & filterSearch funcion 2022-05-22 14:23:53 +08:00
tangjinzhou a4b6c0aee4 feat: transfer add status 2022-05-22 10:35:19 +08:00
tangjinzhou 03f559a0dc feat: tree-select add status & placement 2022-05-22 10:10:43 +08:00
tangjinzhou bf1226d3bb feat: timepicker add status & placement 2022-05-21 22:23:52 +08:00
tangjinzhou 527dec6078 feat: select add status & placement 2022-05-21 22:03:56 +08:00
tangjinzhou af9371fe6f style: tooltip 2022-05-21 17:44:43 +08:00
tangjinzhou 5c136e0286 style: tag 2022-05-21 17:40:52 +08:00
tangjinzhou a32d29149f style: tabs 2022-05-21 17:38:19 +08:00
tangjinzhou e6a46b43ac feat: add some less var 2022-05-21 17:31:39 +08:00
tangjinzhou 9d1e5d72b5 fix: Switch disabled color in dark theme 2022-05-21 17:27:32 +08:00
tangjinzhou 63a688f94c feat: steps add small dot 2022-05-21 17:25:20 +08:00
tangjinzhou 21f9a1178a feat: dd aria-* to Spin 2022-05-21 17:21:53 +08:00
tangjinzhou 76573fc252 refactor: rename slider js to ts 2022-05-21 17:14:41 +08:00
tangjinzhou 208c7ac6de feat: skeleton add block input 2022-05-21 16:51:10 +08:00
tangjinzhou 44be8722f8 refactor: radio context 2022-05-21 16:29:11 +08:00
tangjinzhou a435e2c090 fix: apply scale transform to disabled star 2022-05-21 15:52:09 +08:00
tangjinzhou 8475542b2f style: upload 2022-05-21 15:50:39 +08:00
tangjinzhou 40a65d19da feat: upload add crossOrigin 2022-05-21 15:23:45 +08:00
tangjinzhou 8ad9317d11 Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-05-21 15:14:29 +08:00
tangjinzhou 76585f75b9 style: popover & progress 2022-05-19 22:28:59 +08:00
tangjinzhou 3656dd5dbb style: pagination 2022-05-19 22:22:58 +08:00
tangjinzhou 7b60f2a8e6 style: page-header 2022-05-19 22:14:53 +08:00
tangjinzhou 5cf2707e11 feat: notification add top & bottom placement 2022-05-19 17:42:45 +08:00
tangjinzhou d716421745 feat: mentions add status 2022-05-19 17:34:41 +08:00
tangjinzhou c6f692222d Merge remote-tracking branch 'origin/main' into feat-v3.3 2022-05-19 17:20:31 +08:00
tangjinzhou c1a1b93553 style: update message 2022-05-19 16:38:19 +08:00
tangjinzhou 6e41fbd01f feat: inputnumber add status & upIcon & downIcon 2022-05-19 11:03:26 +08:00
tangjinzhou 093fa555ba feat: input add clearIcon & status 2022-05-18 22:51:45 +08:00
tangjinzhou e9d41efcec feat: add image progress 2022-05-16 14:56:35 +08:00
tangjinzhou d5348f0361 feat(row): add support for space-evenly 2022-05-16 14:51:48 +08:00
tangjinzhou e4f678f665 feat: add skipFlatten 2022-05-16 14:31:46 +08:00
tangjinzhou f00b9535d2 feat: dropdown add arrow 2022-05-16 10:57:15 +08:00
tangjinzhou a1ac22443e feat: drawer add rtl 2022-05-15 15:04:40 +08:00
tangjinzhou 4eb8088645 feat: datePicker add status & placement 2022-05-15 14:48:46 +08:00
tangjinzhou 353f470c11 style: config-provider 2022-05-15 10:28:34 +08:00
tangjinzhou 73f7f9e3b9 style: update checkbox 2022-05-14 15:50:50 +08:00
tangjinzhou 5bc17f0578 feat: cascader add status & showCheckedStrategy 2022-05-14 15:40:17 +08:00
tangjinzhou dbe7fe78ce feat: autocomplete add status 2022-05-14 14:57:40 +08:00
tangjinzhou 6e1f30666b refactor: form 2022-05-11 21:52:51 +08:00
tangjinzhou c4a61f210f feat: menu add itemsType 2022-05-11 09:58:23 +08:00
tangjinzhou 0244e7f5b4 refactor: Simplify Button Group Style 2022-05-10 16:18:44 +08:00
tangjinzhou 3aedf48eaf feat: Breadcrumb accessibility improvements 2022-05-10 15:48:14 +08:00
tangjinzhou 78045b4b5b fix: Badge Animation enter and leave in RTL 2022-05-10 15:43:23 +08:00
tangjinzhou 894a5b955c fix: BackTop responsive in RTL 2022-05-10 15:41:07 +08:00
tangjinzhou a8dbea7c32 style: update some code 2022-05-10 15:36:18 +08:00
tangjinzhou 1d08e80165 feat: anchor add activeLink arg 2022-05-10 15:35:44 +08:00
2587 changed files with 419556 additions and 63913 deletions

View File

@ -1,195 +1,36 @@
const fs = require('fs');
const path = require('path');
const defaultVars = require('./scripts/default-vars');
const darkVars = require('./scripts/dark-vars');
const compactVars = require('./scripts/compact-vars');
function generateThemeFileContent(theme) {
return `const { ${theme}ThemeSingle } = require('./theme');\nconst defaultTheme = require('./default-theme');\n
module.exports = {
...defaultTheme,
...${theme}ThemeSingle
}`;
}
const restCssPath = path.join(process.cwd(), 'components', 'style', 'reset.css');
const tokenStatisticPath = path.join(process.cwd(), 'components', 'version', 'token.json');
const tokenMetaPath = path.join(process.cwd(), 'components', 'version', 'token-meta.json');
// We need compile additional content for antd user
function finalizeCompile() {
if (fs.existsSync(path.join(__dirname, './es'))) {
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'es', 'style', 'reset.css'));
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'es', 'version', 'token.json'));
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'es', 'version', 'token-meta.json'));
}
if (fs.existsSync(path.join(__dirname, './lib'))) {
// Build a entry less file to dist/antd.less
const componentsPath = path.join(process.cwd(), 'components');
let componentsLessContent = '';
// Build components in one file: lib/style/components.less
fs.readdir(componentsPath, (err, files) => {
files.forEach(file => {
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
componentsLessContent += `@import "../${path.posix.join(
file,
'style',
'index-pure.less',
)}";\n`;
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'lib', 'style', 'reset.css'));
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'lib', 'version', 'token.json'));
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'lib', 'version', 'token-meta.json'));
}
});
fs.writeFileSync(
path.join(process.cwd(), 'lib', 'style', 'components.less'),
componentsLessContent,
);
});
}
}
function buildThemeFile(theme, vars) {
// Build less entry file: dist/antd.${theme}.less
if (theme !== 'default') {
fs.writeFileSync(
path.join(process.cwd(), 'dist', `antd.${theme}.less`),
`@import "../lib/style/${theme}.less";\n@import "../lib/style/components.less";`,
);
// eslint-disable-next-line no-console
console.log(`Built a entry less file to dist/antd.${theme}.less`);
} else {
fs.writeFileSync(
path.join(process.cwd(), 'dist', `default-theme.js`),
`module.exports = ${JSON.stringify(vars, null, 2)};\n`,
);
return;
}
// Build ${theme}.js: dist/${theme}-theme.js, for less-loader
fs.writeFileSync(
path.join(process.cwd(), 'dist', `theme.js`),
`const ${theme}ThemeSingle = ${JSON.stringify(vars, null, 2)};\n`,
{
flag: 'a',
},
);
fs.writeFileSync(
path.join(process.cwd(), 'dist', `${theme}-theme.js`),
generateThemeFileContent(theme),
);
// eslint-disable-next-line no-console
console.log(`Built a ${theme} theme js file to dist/${theme}-theme.js`);
}
function finalizeDist() {
if (fs.existsSync(path.join(__dirname, './dist'))) {
// Build less entry file: dist/antd.less
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'antd.less'),
'@import "../lib/style/default.less";\n@import "../lib/style/components.less";',
);
// eslint-disable-next-line no-console
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'theme.js'),
`const defaultTheme = require('./default-theme.js');\n`,
);
// eslint-disable-next-line no-console
console.log('Built a entry less file to dist/antd.less');
buildThemeFile('default', defaultVars);
buildThemeFile('dark', darkVars);
buildThemeFile('compact', compactVars);
buildThemeFile('variable', {});
fs.writeFileSync(
path.join(process.cwd(), 'dist', `theme.js`),
`
function getThemeVariables(options = {}) {
let themeVar = {
'hack': \`true;@import "\${require.resolve('ant-design-vue/lib/style/color/colorPalette.less')}";\`,
...defaultTheme
};
if(options.dark) {
themeVar = {
...themeVar,
...darkThemeSingle
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'dist', 'reset.css'));
}
}
if(options.compact){
themeVar = {
...themeVar,
...compactThemeSingle
}
}
return themeVar;
}
module.exports = {
darkThemeSingle,
compactThemeSingle,
getThemeVariables
}`,
{
flag: 'a',
},
);
}
}
function isComponentStyleEntry(file) {
return file.path.match(/style(\/|\\)index\.tsx/);
}
function needTransformStyle(content) {
return content.includes('../../style/index.less') || content.includes('./index.less');
}
module.exports = {
compile: {
includeLessFile: [/(\/|\\)components(\/|\\)style(\/|\\)default.less$/],
transformTSFile(file) {
if (isComponentStyleEntry(file)) {
let content = file.contents.toString();
if (needTransformStyle(content)) {
const cloneFile = file.clone();
// Origin
content = content.replace('../../style/index.less', '../../style/default.less');
cloneFile.contents = Buffer.from(content);
return cloneFile;
}
}
},
transformFile(file) {
if (isComponentStyleEntry(file)) {
const indexLessFilePath = file.path.replace('index.tsx', 'index.less');
if (fs.existsSync(indexLessFilePath)) {
// We put origin `index.less` file to `index-pure.less`
const pureFile = file.clone();
pureFile.contents = Buffer.from(fs.readFileSync(indexLessFilePath, 'utf8'));
pureFile.path = pureFile.path.replace('index.tsx', 'index-pure.less');
// Rewrite `index.less` file with `root-entry-name`
const indexLessFile = file.clone();
indexLessFile.contents = Buffer.from(
[
// Inject variable
'@root-entry-name: default;',
// Point to origin file
"@import './index-pure.less';",
].join('\n\n'),
);
indexLessFile.path = indexLessFile.path.replace('index.tsx', 'index.less');
return [indexLessFile, pureFile];
}
}
return [];
},
lessConfig: {
modifyVars: {
'root-entry-name': 'default',
},
},
finalize: finalizeCompile,
},
dist: {
finalize: finalizeDist,
},
generateThemeFileContent,
bail: true,
};

View File

@ -7,4 +7,7 @@ es/
lib/
_site/
dist/
components/version/version.tsx
site/dist/
components/version/version.ts
site/src/router/demoRoutes.js
locale/

View File

@ -15,9 +15,21 @@ module.exports = {
'plugin:vue/vue3-recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
'@vue/typescript/recommended',
'@vue/prettier',
// 'prettier',
],
// extends: [
// 'eslint:recommended',
// 'plugin:vue/vue3-recommended',
// '@vue/typescript/recommended',
// '@vue/prettier',
// ],
plugins: ['markdown', 'jest', '@typescript-eslint', 'import'],
globals: {
h: true,
defineProps: 'readonly',
},
overrides: [
{
files: ['*.md'],
@ -28,12 +40,11 @@ module.exports = {
},
{
files: ['*.ts', '*.tsx'],
extends: ['@vue/typescript/recommended', '@vue/prettier', '@vue/prettier/@typescript-eslint'],
// extends: ['@vue/typescript/recommended', '@vue/prettier'],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-module-boundary-types': 0,
@ -51,17 +62,21 @@ module.exports = {
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2021,
},
rules: {
'no-console': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
],
'vue/no-reserved-component-names': 'off',
},
},
],
rules: {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true, argsIgnorePattern: '^_' },
],
'import/no-named-as-default': 'off',
'import/namespace': [2, { allowComputed: true }],
'import/no-named-as-default-member': 'off',
@ -94,7 +109,4 @@ module.exports = {
],
'vue/multi-word-component-names': 'off',
},
globals: {
h: true,
},
};

View File

@ -1,4 +1,4 @@
blank_issues_enabled: false
blank_issues_enabled: true
contact_links:
- name: Create new issue
url: https://vuecomponent.github.io/issue-helper/
@ -12,6 +12,3 @@ contact_links:
- name: Paypal
url: https://www.paypal.me/tangjinzhou
about: Love Ant Design Vue? Please consider supporting us via Paypal.
- name: 支付宝/微信 赞助
url: https://qn.antdv.com/alipay-and-wechat.png
about: Ant Design Vue 的健康持续发展需要您的支持,🙏

63
.github/workflows/cloudflare.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Build and Deploy to Cloudflare
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
name: Build Application
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install --force
- name: Build application
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-files
path: site/dist/
retention-days: 1
deploy:
runs-on: ubuntu-latest
name: Deploy to Cloudflare
needs: build
permissions:
contents: read
deployments: write
steps:
- name: Checkout (for config files)
uses: actions/checkout@v5
with:
sparse-checkout: |
wrangler.jsonc
sparse-checkout-cone-mode: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-files
path: site/dist/
- name: Deploy (Workers + Static Assets)
uses: cloudflare/wrangler-action@v3.14.1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --config wrangler.jsonc
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

View File

@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v2
- name: cache package-lock.json
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -27,7 +27,7 @@ jobs:
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -52,13 +52,13 @@ jobs:
# submodules: true
- name: restore cache from package-lock.json
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

View File

@ -4,12 +4,15 @@ on:
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
jobs:
close-issues:
runs-on: ubuntu-latest
steps:
- name: need reproduce
uses: actions-cool/issues-helper@v1.7
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
labels: '🤔 Need Reproduce'

View File

@ -1,18 +1,25 @@
name: Issue Reply
name: Issue Labeled
on:
issues:
types: [labeled]
permissions:
contents: read
jobs:
issue-reply:
issue-labeled:
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
runs-on: ubuntu-latest
steps:
- name: Need Reproduce
if: github.event.label.name == '🤔 Need Reproduce'
uses: actions-cool/issues-helper@v1.2
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking this [link for vue2](https://codesandbox.io/s/2wpk21kzvr)、 [link for vue3](https://codesandbox.io/s/agitated-franklin-1w72v) or a minimal GitHub repository. Make sure to choose the correct version.
@ -21,9 +28,10 @@ jobs:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch, fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
@ -32,12 +40,37 @@ jobs:
- name: Usage
if: github.event.label.name == 'Usage'
uses: actions-cool/issues-helper@v1.2
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment, close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}, we use GitHub issues to trace bugs or discuss plans of Ant Design Vue. So, please don't ask usage questions here. You can try to open a new discussion in [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions), select `Q&A` to ask questions, also can ask questions on [Stack Overflow](http://stackoverflow.com/questions/) or [Segment Fault](https://segmentfault.com).
你好 @${{ github.event.issue.user.login }}Ant Design Vue Issue 板块是用于 bug 反馈与需求讨论的地方。请勿询问如何使用的问题,你可以试着在 [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions) 新开一个 discussion选择 `Q&A` 类别进行提问,也可以在 [Stack Overflow](http://stackoverflow.com/questions/) 或者 [Segment Fault](https://segmentfault.com/) 中提问。
- name: 1.x
if: github.event.label.name == '1.x'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hi @${{ github.event.issue.user.login }}. Current version (1.x) is off the maintenance period. We may not accept pull request or fix bug with it anymore. This topic will be auto closed.
你好 @${{ github.event.issue.user.login }}当前版本1.x已经过了维护期。我们不会再接受对其的相关 PR 与 issue。当前 topic 会被自动关闭。
- name: 2.x
if: github.event.label.name == '2.x'
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hi @${{ github.event.issue.user.login }}. Current version (2.x) is off the maintenance period. We may not accept pull request or fix bug with it anymore. This topic will be auto closed.
你好 @${{ github.event.issue.user.login }}当前版本2.x已经过了维护期。我们不会再接受对其的相关 PR 与 issue。当前 topic 会被自动关闭。

View File

@ -4,8 +4,16 @@ on:
issues:
types: [opened]
permissions:
contents: read
jobs:
check-issue:
issue-open-check:
permissions:
contents: read # for visiky/dingtalk-release-notify to get latest release
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
runs-on: ubuntu-latest
steps:
- uses: actions-cool/check-user-permission@v1.0.0
@ -15,7 +23,7 @@ jobs:
- name: check invalid
if: (contains(github.event.issue.body, 'issue-helper') == false) && (steps.checkUser.outputs.result == 'false')
uses: actions-cool/issues-helper@v1.2
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,add-labels,close-issue'
issue-number: ${{ github.event.issue.number }}

View File

@ -1,20 +0,0 @@
name: PR Labeled
on:
pull_request_target:
types: [labeled]
jobs:
reply:
runs-on: ubuntu-latest
steps:
- name: Usage
if: github.event.label.name == 'Usage'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment, close-issue'
issue-number: ${{ github.event.pull_request.number }}
body: |
Hello @${{ github.event.pull_request.user.login }}, we use GitHub PR to build and perfect of Ant Design Vue. So, please don't ask usage questions here. You can try to open a new discussion in [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions), select `Q&A` to ask questions, also can ask questions on [Stack Overflow](http://stackoverflow.com/questions/) or [Segment Fault](https://segmentfault.com).
你好 @${{ github.event.pull_request.user.login }}Ant Design Vue PR 是用于建设、完善项目的地方。请勿询问如何使用的问题,你可以试着在 [antdv discussions](https://github.com/vueComponent/ant-design-vue/discussions) 新开一个 discussion选择 `Q&A` 类别进行提问,也可以在 [Stack Overflow](http://stackoverflow.com/questions/) 或者 [Segment Fault](https://segmentfault.com/) 中提问。

View File

@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v2
- name: cache package-lock.json
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -27,7 +27,7 @@ jobs:
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -43,25 +43,25 @@ jobs:
uses: actions/checkout@v2
- name: restore cache from package-lock.json
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: cache lib
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: lib
key: lib-${{ github.sha }}
- name: cache es
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: es
key: es-${{ github.sha }}
@ -77,13 +77,13 @@ jobs:
uses: actions/checkout@v2
- name: restore cache from package-lock.json
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -99,13 +99,13 @@ jobs:
uses: actions/checkout@v2
- name: restore cache from package-lock.json
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

4
.gitignore vendored
View File

@ -59,6 +59,7 @@ jspm_packages/
dist
lib
es
/locale
_site
yarn.lock
package-lock.json
@ -78,5 +79,8 @@ report.html
site/src/router/demoRoutes.js
components/version/version.ts
components/version/version.tsx
components/version/token.json
components/version/token-meta.json
~component-api.json

View File

@ -18,6 +18,7 @@ function getTestRegex(libDir) {
module.exports = {
verbose: true,
setupFiles: ['./tests/setup.js'],
setupFilesAfterEnv: ['./tests/setupAfterEnv.ts'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue', 'md', 'jpg'],
modulePathIgnorePatterns: ['/_site/'],
testPathIgnorePatterns: testPathIgnorePatterns,
@ -30,23 +31,19 @@ module.exports = {
testRegex: getTestRegex(libDir),
moduleNameMapper: {
'^@/(.*)$/': '<rootDir>/$1',
'ant-design-vue$/': '<rootDir>/components/index.ts',
'ant-design-vue/es/': '<rootDir>/components',
'^ant-design-vue$': '<rootDir>/components/index',
'^ant-design-vue/es/(.*)$': '<rootDir>/components/$1',
},
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
collectCoverage: process.env.COVERAGE === 'true',
collectCoverageFrom: [
'components/**/*.{js,jsx,vue}',
'!components/*/style/index.{js,jsx}',
'!components/style/*.{js,jsx}',
'!components/*/locale/*.{js,jsx}',
'!components/*/__tests__/**/type.{js,jsx}',
'!components/vc-*/**/*',
'!components/*/demo/**/*',
'!components/_util/**/*',
'!components/align/**/*',
'!components/trigger/**/*',
'!components/style.js',
'!**/node_modules/**',
],
testEnvironment: 'jsdom',

1
.npmrc Normal file
View File

@ -0,0 +1 @@
enable-pre-post-scripts=true

View File

@ -18,7 +18,6 @@ yarn-error.log
.editorconfig
.eslintignore
**/*.yml
components/style/color/*.less
**/assets
.gitattributes
.stylelintrc

View File

@ -4,13 +4,40 @@
"stylelint-config-rational-order",
"stylelint-config-prettier"
],
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"],
"customSyntax": "postcss-less",
"plugins": ["stylelint-declaration-block-no-ignored-properties"],
"rules": {
"comment-empty-line-before": null,
"function-name-case": ["lower", { "ignoreFunctions": ["/colorPalette/"] }],
"no-invalid-double-slash-comments": null,
"no-descending-specificity": null,
"declaration-empty-line-before": null
},
"ignoreFiles": ["components/style/color/{bezierEasing,colorPalette,tinyColor}.less"]
"function-name-case": ["lower"],
"function-no-unknown": [
true,
{
"ignoreFunctions": [
"fade",
"fadeout",
"tint",
"darken",
"ceil",
"fadein",
"floor",
"unit",
"shade",
"lighten",
"percentage",
"-"
]
}
],
"import-notation": null,
"no-descending-specificity": null,
"no-invalid-position-at-import-rule": null,
"declaration-empty-line-before": null,
"keyframes-name-pattern": null,
"custom-property-pattern": null,
"number-max-precision": 8,
"alpha-value-notation": "number",
"color-function-notation": "legacy",
"selector-class-pattern": null,
"selector-id-pattern": null,
"selector-not-notation": null
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,10 @@
<p align="center">
<a href="https://www.antdv.com/">
<img width="200" src="https://qn.antdv.com/logo.png">
</a>
</p>
<h1 align="center">
<a href="https://www.antdv.com/" target="_blank">Ant Design Vue</a>
</h1>
<div align="center">
An enterprise-class UI components based on Ant Design and Vue 3.
基于 Ant Design 和 Vue 3 的企业级 UI 组件库。
![test](https://github.com/vueComponent/ant-design-vue/workflows/test/badge.svg) [![codecov](https://img.shields.io/codecov/c/github/vueComponent/ant-design-vue/master.svg?style=flat-square)](https://codecov.io/gh/vueComponent/ant-design-vue) [![npm package](https://img.shields.io/npm/v/ant-design-vue.svg?style=flat-square)](https://www.npmjs.org/package/ant-design-vue) [![NPM downloads](http://img.shields.io/npm/dm/ant-design-vue.svg?style=flat-square)](http://www.npmtrends.com/ant-design-vue) [![backers](https://opencollective.com/ant-design-vue/backers/badge.svg)](#backers) [![sponsors](https://opencollective.com/ant-design-vue/sponsors/badge.svg)](#sponsors) [![extension-for-VSCode](https://img.shields.io/badge/extension%20for-VSCode-blue.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=ant-design-vue.vscode-ant-design-vue-helper) [![issues-helper](https://img.shields.io/badge/Issues%20Manage%20By-issues--helper-orange?style=flat-square)](https://github.com/actions-cool/issues-helper)
@ -18,6 +12,14 @@ An enterprise-class UI components based on Ant Design and Vue 3.
[![](https://cdn-images-1.medium.com/max/2000/1*NIlj0-TdLMbo_hzSBP8tmg.png)](https://www.antdv.com/)
<div align="center">
<sup><strong>赞助商</strong></sup>
<br>
<a href="https://mentorbook.ai/" target="_blank">
<img src="/site/public/mentorbook_banner_zh.svg" alt="Mentorbook.AI - 你的 AI 导师,你的学习之旅" />
</a>
</div>
[English](./README.md) | 简体中文
## 特性
@ -26,6 +28,12 @@ An enterprise-class UI components based on Ant Design and Vue 3.
- 开箱即用的高质量 Vue 组件。
- 共享 [Ant Design of React](http://ant-design.gitee.io/docs/spec/introduce-cn) 设计工具体系。
## 关注我们
收藏加关注,第一时间获取更新动态!
![star us](https://user-images.githubusercontent.com/6937879/261937060-e0501ab3-9388-4712-a25d-3f2ba2271865.gif)
## 支持环境
- 现代浏览器。1.x 版本支持 IE 9+(需要 [polyfills](https://www.antdv.com/docs/vue/getting-started-cn/#兼容性)
@ -66,6 +74,8 @@ $ yarn add ant-design-vue
| [vue-cli-plugin-ant-design](https://github.com/vueComponent/vue-cli-plugin-ant-design) | 使用 vue-cli3 快速使用 ant-design-vue 组件库 |
| [vue-dash-event](https://github.com/vueComponent/vue-dash-event) | 在 DOM 模板中,您可以使用 ant-design-vue 组件的自定义事件camelCase |
| [@formily/antdv](https://github.com/formilyjs/antdv) | 这是一个结合了 Formily 和 ant-design-vue 的组件库 |
| [@ant-design-vue/nuxt](https://github.com/vueComponent/ant-design-vue-nuxt) | ant-design-vue 的 nuxt 模块扩展 |
| [ant-design-x-vue](https://github.com/wzc520pyfm/ant-design-x-vue) | 基于 Ant Design X 设计规范的 Vue AI 界面解决方案 |
## 问答
@ -80,24 +90,32 @@ ant-design-vue 是 MIT 协议的开源项目。为了项目能够更好的持续
- [Patreon](https://www.patreon.com/tangjinzhou)
- [opencollective](https://opencollective.com/ant-design-vue)
- [paypal](https://www.paypal.me/tangjinzhou)
- [支付宝或微信](https://qn.antdv.com/alipay-and-wechat.png)
- ETH: 0x30cc48515d8ae9fefa20ab87226ad7e8ab9c3bc2
## Sponsors
## 赞助商
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/ant-design-vue#sponsor)]
成为赞助商,并在 Github 上的自述文件上获得您的徽标,并链接到您的网站。 [[成为赞助商](https://opencollective.com/ant-design-vue#sponsor)]
<a href="http://www.jeecg.com/" target="_blank"><img src="https://aliyuncdn.antdv.com/jeecg-logo.png" height="64"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/10/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/10/avatar.svg"></a>
<a href="http://www.jeecg.com/" target="_blank"><img src="https://www.antdv.com/jeecg-logo.png" height="64"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/10/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/10/avatar.svg"></a>
## Backers
## 支持者
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/ant-design-vue#backer)]
每月捐款支持我们,帮助我们继续我们的活动。 [[成为支持者](https://opencollective.com/ant-design-vue#backer)]
<a href="https://github.com/chuzhixin/vue-admin-beautiful" target="_blank"><img width="64" style="border-radius: 50%;" src="https://gitee.com/chu1204505056/image/raw/master/vue-admin-beautiful.png" title="vue-admin-beautiful"></a> <a href="https://opencollective.com/ant-design-vue/backer/0/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/0/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/1/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/1/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/2/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/2/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/3/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/3/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/4/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/4/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/5/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/5/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/6/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/6/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/7/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/7/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/8/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/8/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/9/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/9/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/backer/10/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/backer/10/avatar.svg"></a>
## Patreon
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://www.patreon.com/tangjinzhou)]
每月捐款支持我们,帮助我们继续我们的活动。 [[成为支持者](https://www.patreon.com/tangjinzhou)]
<a href="https://www.mokeyjay.com" target="_blank"><img width="64" style="border-radius: 50%;" src="https://www.mokeyjay.com/headimg.png" title="donation by Patreon"></a>
## [更多赞助者 (通过 Patreon、支付宝、微信、paypal 等等)](https://github.com/vueComponent/ant-design-vue/blob/master/BACKERS.md)
## 贡献者
感谢所有为 ant-design-vue 做出贡献的人!
<a href="https://github.com/vueComponent/ant-design-vue/graphs/contributors">
<img src="https://contrib.rocks/image?repo=vueComponent/ant-design-vue&max=100&columns=15" />
</a>

View File

@ -1,6 +1,6 @@
<p align="center">
<a href="https://www.antdv.com/">
<img width="200" src="https://qn.antdv.com/logo.png">
<img width="200" src="https://www.antdv.com/logo.png">
</a>
</p>
@ -18,6 +18,14 @@ An enterprise-class UI components based on Ant Design and Vue.
[![](https://cdn-images-1.medium.com/max/2000/1*NIlj0-TdLMbo_hzSBP8tmg.png)](https://www.antdv.com/)
<div align="center">
<sup><strong>Sponsored by</strong></sup>
<br>
<a href="https://mentorbook.ai/" target="_blank">
<img src="/site/public/mentorbook_banner_en.svg" alt="Mentorbook.AI - Your AI Mentor, Your Learning Journey" />
</a>
</div>
English | [简体中文](./README-zh_CN.md)
## Features
@ -26,9 +34,15 @@ English | [简体中文](./README-zh_CN.md)
- A set of high-quality Vue components out of the box.
- Shared [Ant Design of React](https://ant.design/docs/spec/introduce) design resources.
## Getting started & staying tuned with us.
Star us, and you will receive all releases notifications from GitHub without any delay!
![star us](https://user-images.githubusercontent.com/6937879/261937060-e0501ab3-9388-4712-a25d-3f2ba2271865.gif)
## Environment Support
- Modern browsers. v1.x support Internet Explorer 9+ (with [polyfills](https://www.antdv.com/docs/vue/getting-started/#Compatibility))
- Modern browsers. v1.x support Internet Explorer 9+ (with [polyfills](https://www.antdv.com/docs/vue/getting-started/#compatibility))
- Server-side Rendering
- Support Vue 2 & Vue 3
- [Electron](https://electronjs.org/)
@ -39,7 +53,7 @@ English | [简体中文](./README-zh_CN.md)
## Using npm or yarn
**We recommend using npm or yarn to install**it not only makes development easierbut also allow you to take advantage of the rich ecosystem of Javascript packages and tooling.
**We recommend using npm or yarn to install**, it not only makes development easier, but also allow you to take advantage of the rich ecosystem of Javascript packages and tooling.
```bash
$ npm install ant-design-vue --save
@ -49,7 +63,7 @@ $ npm install ant-design-vue --save
$ yarn add ant-design-vue
```
If you are in a bad network environmentyou can try other registries and tools like [cnpm](https://github.com/cnpm/cnpm).
If you are in a bad network environment, you can try other registries and tools like [cnpm](https://github.com/cnpm/cnpm).
## Links
@ -66,6 +80,8 @@ If you are in a bad network environmentyou can try other registries and tools
| [vue-cli-plugin-ant-design](https://github.com/vueComponent/vue-cli-plugin-ant-design) | Vue-cli 3 plugin to add ant-design-vue |
| [vue-dash-event](https://github.com/vueComponent/vue-dash-event) | The library function, implemented in the DOM template, can use the custom event of the ant-design-vue component (camelCase) |
| [@formily/antdv](https://github.com/formilyjs/antdv) | The Library with Formily and ant-design-vue |
| [@ant-design-vue/nuxt](https://github.com/vueComponent/ant-design-vue-nuxt) | A nuxt module for ant-design-vue |
| [ant-design-x-vue](https://github.com/wzc520pyfm/ant-design-x-vue) | A Vue AI interface solutions base on the Ant Design X design specification |
## Donation
@ -74,16 +90,24 @@ ant-design-vue is an MIT-licensed open source project. In order to achieve bette
- [Patreon](https://www.patreon.com/tangjinzhou)
- [opencollective](https://opencollective.com/ant-design-vue)
- [paypal](https://www.paypal.me/tangjinzhou)
- [支付宝或微信](https://qn.antdv.com/alipay-and-wechat.png)
- ETH: 0x30cc48515d8ae9fefa20ab87226ad7e8ab9c3bc2
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/ant-design-vue#sponsor)]
<a href="http://www.jeecg.com/" target="_blank"><img src="https://aliyuncdn.antdv.com/jeecg-logo.png" height="64"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/10/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/10/avatar.svg"></a>
<a href="http://www.jeecg.com/" target="_blank"><img src="https://www.antdv.com/jeecg-logo.png" height="64"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/9/avatar.svg"></a> <a href="https://opencollective.com/ant-design-vue/sponsor/10/website" target="_blank"><img src="https://opencollective.com/ant-design-vue/sponsor/10/avatar.svg"></a>
## [More Sponsor (From Patreon、alipay、wechat、paypal...)](https://github.com/vueComponent/ant-design-vue/blob/master/BACKERS.md)
## Contributors
Thank you to all the people who already contributed to ant-design-vue!
<a href="https://github.com/vueComponent/ant-design-vue/graphs/contributors">
<img src="https://contrib.rocks/image?repo=vueComponent/ant-design-vue&max=100&columns=15" />
</a>
[![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/repos/104172832)
This project is tested with BrowserStack.

View File

@ -91,7 +91,7 @@ export function formatter(
!tableTitle.includes('()')
) {
const childTag: VueTag = {
name: getComponentName(tableTitle.replaceAll('.', '').replaceAll('/', ''), tagPrefix),
name: getComponentName(tableTitle.replace(/\.|\//g, ''), tagPrefix),
slots: [],
events: [],
attributes: [],

View File

@ -6,7 +6,7 @@ import { genWebTypes } from './web-types';
import { outputFileSync, readFileSync } from 'fs-extra';
import type { Options, VueTag } from './type';
import { getComponentName, normalizePath, toKebabCase } from './utils';
import { genVeturAttributes, genVeturTags } from './vetur';
import { flatMap } from 'lodash';
async function readMarkdown(options: Options): Promise<Map<String, VueTag>> {
const mdPaths = await glob(normalizePath(`${options.path}/**/*.md`));
@ -21,13 +21,13 @@ async function readMarkdown(options: Options): Promise<Map<String, VueTag>> {
return formatter(mdParser(fileContent), componentName, kebabComponentName, options.tagPrefix);
})
.filter(item => item) as VueTag[][];
const tags: Map<String, VueTag> = new Map();
data.flatMap(item => item).forEach(mergedTag => mergeTag(tags, mergedTag));
const tags = new Map<String, VueTag>();
flatMap(data, item => item).forEach(mergedTag => mergeTag(tags, mergedTag));
return tags;
}
function readTypings(options: Options): Map<String, VueTag> {
const tags: Map<String, VueTag> = new Map();
const tags = new Map<String, VueTag>();
const fileContent = readFileSync(options.typingsPath, 'utf-8');
fileContent
.split('\n')
@ -61,7 +61,7 @@ function mergeTag(tags: Map<String, VueTag>, mergedTag: VueTag) {
function mergeTags(mergedTagsArr: Map<String, VueTag>[]): VueTag[] {
if (mergedTagsArr.length === 1) return [...mergedTagsArr[0].values()];
const tags: Map<String, VueTag> = new Map();
const tags = new Map<String, VueTag>();
if (mergedTagsArr.length === 0) return [];
mergedTagsArr.forEach(mergedTags => {
mergedTags.forEach(mergedTag => mergeTag(tags, mergedTag));
@ -77,13 +77,6 @@ export async function parseAndWrite(options: Options): Promise<Number> {
const tagsFromTypings = await readTypings(options);
const tags = mergeTags([tagsFromMarkdown, tagsFromTypings]);
const webTypes = genWebTypes(tags, options);
const veturTags = genVeturTags(tags);
const veturAttributes = genVeturAttributes(tags);
outputFileSync(join(options.outputDir, 'tags.json'), JSON.stringify(veturTags, null, 2));
outputFileSync(
join(options.outputDir, 'attributes.json'),
JSON.stringify(veturAttributes, null, 2),
);
outputFileSync(join(options.outputDir, 'web-types.json'), JSON.stringify(webTypes, null, 2));
return tags.length;
}

View File

@ -21,13 +21,13 @@ export type Articals = Artical[];
function readLine(input: string) {
const end = input.indexOf('\n');
return input.substr(0, end !== -1 ? end : input.length);
return input.substring(0, end !== -1 ? end : input.length);
}
function splitTableLine(line: string) {
line = line.replace(/\\\|/g, 'JOIN');
const items = line.split('|').map(item => item.trim().replaceAll('JOIN', '|'));
const items = line.split('|').map(item => item.trim().replace(/JOIN/g, '|'));
// remove pipe character on both sides
items.pop();
@ -47,7 +47,7 @@ function tableParse(input: string) {
};
while (start < end) {
const target = input.substr(start);
const target = input.substring(start);
const line = readLine(target);
if (!/^\|/.test(target)) {
@ -79,7 +79,7 @@ export function mdParser(input: string): Articals {
const end = input.length;
while (start < end) {
const target = input.substr(start);
const target = input.substring(start);
let match;
if ((match = TITLE_REG.exec(target))) {
@ -91,7 +91,7 @@ export function mdParser(input: string): Articals {
start += match.index + match[0].length;
} else if ((match = TABLE_REG.exec(target))) {
const { table, usedLength } = tableParse(target.substr(match.index));
const { table, usedLength } = tableParse(target.substring(match.index));
artical.push({
type: 'table',
table,

View File

@ -34,25 +34,6 @@ export type VueTag = {
description?: string;
};
export type VeturTag = {
description?: string;
attributes: string[];
};
export type VeturTags = Record<string, VeturTag>;
export type VeturAttribute = {
type: string;
description: string;
};
export type VeturAttributes = Record<string, VeturAttribute>;
export type VeturResult = {
tags: VeturTags;
attributes: VeturAttributes;
};
export type Options = {
name: string;
path: PathLike;

View File

@ -1,30 +0,0 @@
import type { VueTag, VeturTags, VeturAttributes } from './type';
export function genVeturTags(tags: VueTag[]) {
const veturTags: VeturTags = {};
tags.forEach(tag => {
veturTags[tag.name] = {
attributes: tag.attributes ? tag.attributes.map(item => item.name) : [],
};
});
return veturTags;
}
export function genVeturAttributes(tags: VueTag[]) {
const veturAttributes: VeturAttributes = {};
tags.forEach(tag => {
if (tag.attributes) {
tag.attributes.forEach(attr => {
veturAttributes[`${tag.name}/${attr.name}`] = {
type: attr.value.type,
description: `${attr.description}, Default: ${attr.default}`,
};
});
}
});
return veturAttributes;
}

View File

@ -20,7 +20,8 @@ module.exports = function (modules) {
resolve('@babel/plugin-transform-runtime'),
{
useESModules: modules === false,
version: '^7.10.4',
version:
require(`${process.cwd()}/package.json`).dependencies['@babel/runtime'] || '^7.10.4',
},
],
// resolve('babel-plugin-inline-import-data-uri'),

View File

@ -1,7 +1,6 @@
'use strict';
const fs = require('fs');
const assign = require('object-assign');
const { getProjectPath } = require('./utils/projectHelper');
module.exports = function () {
@ -9,7 +8,7 @@ module.exports = function () {
if (fs.existsSync(getProjectPath('tsconfig.json'))) {
my = require(getProjectPath('tsconfig.json'));
}
return assign(
return Object.assign(
{
noUnusedParameters: true,
noUnusedLocals: true,

View File

@ -22,7 +22,7 @@ const imageOptions = {
limit: 10000,
};
function getWebpackConfig(modules) {
function getWebpackConfig(modules, esm = false) {
const pkg = require(getProjectPath('package.json'));
const babelConfig = require('./getBabelCommonConfig')(modules || false);
@ -150,36 +150,6 @@ function getWebpackConfig(modules) {
},
],
},
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: ['autoprefixer'],
},
sourceMap: true,
},
},
{
loader: 'less-loader',
options: {
lessOptions: {
javascriptEnabled: true,
},
sourceMap: true,
},
},
],
},
// Images
{
test: svgRegex,
@ -200,7 +170,7 @@ function getWebpackConfig(modules) {
new webpack.BannerPlugin(`
${pkg.name} v${pkg.version}
Copyright 2017-present, ant-design-vue.
Copyright 2017-present, Ant Design Vue.
All rights reserved.
`),
new WebpackBar({
@ -215,7 +185,7 @@ All rights reserved.
};
if (process.env.RUN_ENV === 'PRODUCTION') {
const entry = ['./index'];
let entry = ['./index'];
config.externals = [
{
vue: {
@ -223,11 +193,29 @@ All rights reserved.
commonjs2: 'vue',
commonjs: 'vue',
amd: 'vue',
module: 'vue',
},
},
];
config.output.library = distFileBaseName;
if (esm) {
entry = ['./index.esm'];
config.experiments = {
...config.experiments,
outputModule: true,
};
config.output.chunkFormat = 'module';
config.output.library = {
type: 'module',
};
config.target = 'es2019';
} else {
config.output.libraryTarget = 'umd';
config.output.library = distFileBaseName;
config.output.globalObject = 'this';
}
const entryName = esm ? `${distFileBaseName}.esm` : distFileBaseName;
config.optimization = {
minimizer: [
new TerserPlugin({
@ -238,11 +226,10 @@ All rights reserved.
}),
],
};
// Development
const uncompressedConfig = merge({}, config, {
entry: {
[distFileBaseName]: entry,
[entryName]: entry,
},
mode: 'development',
plugins: [
@ -255,7 +242,7 @@ All rights reserved.
// Production
const prodConfig = merge({}, config, {
entry: {
[`${distFileBaseName}.min`]: entry,
[`${entryName}.min`]: entry,
},
mode: 'production',
plugins: [

View File

@ -5,7 +5,6 @@ const getBabelCommonConfig = require('./getBabelCommonConfig');
const merge2 = require('merge2');
const { execSync } = require('child_process');
const through2 = require('through2');
const transformLess = require('./transformLess');
const webpack = require('webpack');
const babel = require('gulp-babel');
const argv = require('minimist')(process.argv.slice(2));
@ -27,15 +26,22 @@ const compareVersions = require('compare-versions');
const getTSCommonConfig = require('./getTSCommonConfig');
const replaceLib = require('./replaceLib');
const sortApiTable = require('./sortApiTable');
const { glob } = require('glob');
const packageJson = require(getProjectPath('package.json'));
const tsDefaultReporter = ts.reporter.defaultReporter();
const cwd = process.cwd();
const libDir = getProjectPath('lib');
const esDir = getProjectPath('es');
const localeDir = getProjectPath('locale');
const tsConfig = getTSCommonConfig();
// FIXME: hard code, not find typescript can modify the path resolution
const localeDts = `import type { Locale } from '../lib/locale-provider';
declare const localeValues: Locale;
export default localeValues;`;
function dist(done) {
rimraf.sync(path.join(cwd, 'dist'));
process.env.RUN_ENV = 'PRODUCTION';
@ -108,6 +114,11 @@ gulp.task('tsc', () =>
),
);
gulp.task('clean', () => {
rimraf.sync(getProjectPath('_site'));
rimraf.sync(getProjectPath('_data'));
});
function babelify(js, modules) {
const babelConfig = getBabelCommonConfig(modules);
babelConfig.babelrc = false;
@ -118,17 +129,7 @@ function babelify(js, modules) {
const stream = js.pipe(babel(babelConfig)).pipe(
through2.obj(function z(file, encoding, next) {
this.push(file.clone());
if (file.path.match(/\/style\/index\.(js|jsx|ts|tsx)$/)) {
const content = file.contents.toString(encoding);
file.contents = Buffer.from(
content
.replace(/\/style\/?'/g, "/style/css'")
.replace(/\/style\/?"/g, '/style/css"')
.replace(/\.less/g, '.css'),
);
file.path = file.path.replace(/index\.(js|jsx|ts|tsx)$/, 'css.js');
this.push(file);
} else if (modules !== false) {
if (modules !== false) {
const content = file.contents.toString(encoding);
file.contents = Buffer.from(
content
@ -144,47 +145,9 @@ function babelify(js, modules) {
}
function compile(modules) {
const { compile: { transformTSFile, transformFile, includeLessFile = [] } = {} } = getConfig();
const { compile: { transformTSFile, transformFile } = {} } = getConfig();
rimraf.sync(modules !== false ? libDir : esDir);
// =============================== LESS ===============================
const less = gulp
.src(['components/**/*.less'])
.pipe(
through2.obj(function (file, encoding, next) {
// Replace content
const cloneFile = file.clone();
const content = file.contents.toString().replace(/^\uFEFF/, '');
cloneFile.contents = Buffer.from(content);
// Clone for css here since `this.push` will modify file.path
const cloneCssFile = cloneFile.clone();
this.push(cloneFile);
// Transform less file
if (
file.path.match(/(\/|\\)style(\/|\\)index\.less$/) ||
file.path.match(/(\/|\\)style(\/|\\)v2-compatible-reset\.less$/) ||
includeLessFile.some(regex => file.path.match(regex))
) {
transformLess(cloneCssFile.contents.toString(), cloneCssFile.path)
.then(css => {
cloneCssFile.contents = Buffer.from(css);
cloneCssFile.path = cloneCssFile.path.replace(/\.less$/, '.css');
this.push(cloneCssFile);
next();
})
.catch(e => {
console.error(e);
});
} else {
next();
}
}),
)
.pipe(gulp.dest(modules === false ? esDir : libDir));
const assets = gulp
.src(['components/**/*.@(png|svg)'])
.pipe(gulp.dest(modules === false ? esDir : libDir));
@ -259,7 +222,26 @@ function compile(modules) {
tsResult.on('end', check);
const tsFilesStream = babelify(tsResult.js, modules);
const tsd = tsResult.dts.pipe(gulp.dest(modules === false ? esDir : libDir));
return merge2([less, tsFilesStream, tsd, assets, transformFileStream].filter(s => s));
return merge2([tsFilesStream, tsd, assets, transformFileStream].filter(s => s));
}
function generateLocale() {
if (!fs.existsSync(localeDir)) {
fs.mkdirSync(localeDir);
}
const localeFiles = glob.sync('components/locale/*.ts?(x)');
localeFiles.forEach(item => {
const match = item.match(/components\/locale\/(.*)\.tsx?/);
if (match) {
const locale = match[1];
fs.writeFileSync(
path.join(localeDir, `${locale}.js`),
`module.exports = require('../lib/locale/${locale}');`,
);
fs.writeFileSync(path.join(localeDir, `${locale}.d.ts`), localeDts);
}
});
}
function tag() {
@ -386,7 +368,7 @@ function pub(done) {
}
}
let startTime = new Date();
const startTime = new Date();
gulp.task('compile-with-es', done => {
console.log('start compile at ', startTime);
console.log('[Parallel] Compile to es...');
@ -395,7 +377,10 @@ gulp.task('compile-with-es', done => {
gulp.task('compile-with-lib', done => {
console.log('[Parallel] Compile to js...');
compile().on('finish', done);
compile().on('finish', () => {
generateLocale();
done();
});
});
gulp.task('compile-finalize', done => {
@ -467,7 +452,7 @@ gulp.task(
newVersion.trim() === version
) {
// eslint-disable-next-line no-unused-vars
runCmd('npm', ['run', 'pub'], code => {
runCmd('npm', ['run', 'pub'], _code => {
done();
});
} else {

View File

@ -1,27 +0,0 @@
const less = require('less');
const path = require('path');
const postcss = require('postcss');
const autoprefixer = require('autoprefixer');
const NpmImportPlugin = require('less-plugin-npm-import');
const { getConfig } = require('./utils/projectHelper');
function transformLess(lessContent, lessFilePath, config = {}) {
const { cwd = process.cwd() } = config;
const { compile: { lessConfig } = {} } = getConfig();
const resolvedLessFile = path.resolve(cwd, lessFilePath);
// Do less compile
const lessOpts = {
paths: [path.dirname(resolvedLessFile)],
filename: resolvedLessFile,
plugins: [new NpmImportPlugin({ prefix: '~' })],
javascriptEnabled: true,
...lessConfig,
};
return less
.render(lessContent, lessOpts)
.then(result => postcss([autoprefixer]).process(result.css, { from: undefined }))
.then(r => r.css);
}
module.exports = transformLess;

View File

@ -1,11 +0,0 @@
// We convert less import in es/lib to css file path
function cssInjection(content) {
return content
.replace(/\/style\/?'/g, "/style/css'")
.replace(/\/style\/?"/g, '/style/css"')
.replace(/\.less/g, '.css');
}
module.exports = {
cssInjection,
};

View File

@ -1,10 +1,12 @@
import type { ExtractPropTypes, PropType } from 'vue';
import { onMounted, ref, defineComponent, onBeforeUnmount } from 'vue';
import { shallowRef, onMounted, defineComponent, onBeforeUnmount } from 'vue';
import Button from '../button';
import type { ButtonProps } from '../button';
import type { LegacyButtonType } from '../button/buttonTypes';
import { convertLegacyProps } from '../button/buttonTypes';
import useDestroyed from './hooks/useDestroyed';
import { objectType } from './type';
import { findDOMNode } from './props-util';
const actionButtonProps = {
type: {
@ -14,15 +16,15 @@ const actionButtonProps = {
close: Function,
autofocus: Boolean,
prefixCls: String,
buttonProps: Object as PropType<ButtonProps>,
buttonProps: objectType<ButtonProps>(),
emitEvent: Boolean,
quitOnNullishReturnValue: Boolean,
};
export type ActionButtonProps = ExtractPropTypes<typeof actionButtonProps>;
function isThenable(thing?: PromiseLike<any>): boolean {
return !!(thing && !!thing.then);
function isThenable<T>(thing?: PromiseLike<T>): boolean {
return !!(thing && thing.then);
}
export default defineComponent({
@ -30,22 +32,25 @@ export default defineComponent({
name: 'ActionButton',
props: actionButtonProps,
setup(props, { slots }) {
const clickedRef = ref<boolean>(false);
const buttonRef = ref();
const loading = ref(false);
const clickedRef = shallowRef<boolean>(false);
const buttonRef = shallowRef();
const loading = shallowRef(false);
let timeoutId: any;
const isDestroyed = useDestroyed();
onMounted(() => {
if (props.autofocus) {
timeoutId = setTimeout(() => buttonRef.value.$el?.focus());
timeoutId = setTimeout(() => findDOMNode(buttonRef.value)?.focus?.());
}
});
onBeforeUnmount(() => {
clearTimeout(timeoutId);
});
const onInternalClose = (...args: any[]) => {
props.close?.(...args);
};
const handlePromiseOnOk = (returnValueOfOnOk?: PromiseLike<any>) => {
const { close } = props;
if (!isThenable(returnValueOfOnOk)) {
return;
}
@ -55,48 +60,46 @@ export default defineComponent({
if (!isDestroyed.value) {
loading.value = false;
}
close(...args);
onInternalClose(...args);
clickedRef.value = false;
},
(e: Error) => {
// Emit error when catch promise reject
// eslint-disable-next-line no-console
console.error(e);
// See: https://github.com/ant-design/ant-design/issues/6183
if (!isDestroyed.value) {
loading.value = false;
}
clickedRef.value = false;
return Promise.reject(e);
},
);
};
const onClick = (e: MouseEvent) => {
const { actionFn, close = () => {} } = props;
const { actionFn } = props;
if (clickedRef.value) {
return;
}
clickedRef.value = true;
if (!actionFn) {
close();
onInternalClose();
return;
}
let returnValueOfOnOk;
let returnValueOfOnOk: PromiseLike<any>;
if (props.emitEvent) {
returnValueOfOnOk = actionFn(e);
if (props.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
clickedRef.value = false;
close(e);
onInternalClose(e);
return;
}
} else if (actionFn.length) {
returnValueOfOnOk = actionFn(close);
returnValueOfOnOk = actionFn(props.close);
// https://github.com/ant-design/ant-design/issues/23358
clickedRef.value = false;
} else {
returnValueOfOnOk = actionFn();
if (!returnValueOfOnOk) {
close();
onInternalClose();
return;
}
}

View File

@ -1,51 +1,167 @@
import { defineComponent, ref, withDirectives } from 'vue';
import antInput from './antInputDirective';
import type { PropType } from 'vue';
import { computed, defineComponent, shallowRef, ref, watch } from 'vue';
import PropTypes from './vue-types';
import type { BaseInputInnerExpose } from './BaseInputInner';
import BaseInputInner from './BaseInputInner';
import { styleObjectToString } from '../vc-util/Dom/css';
export interface BaseInputExpose {
focus: () => void;
blur: () => void;
input: HTMLInputElement | HTMLTextAreaElement | null;
setSelectionRange: (
start: number,
end: number,
direction?: 'forward' | 'backward' | 'none',
) => void;
select: () => void;
getSelectionStart: () => number | null;
getSelectionEnd: () => number | null;
getScrollTop: () => number | null;
setScrollTop: (scrollTop: number) => void;
}
const BaseInput = defineComponent({
compatConfig: { MODE: 3 },
inheritAttrs: false,
props: {
value: PropTypes.string.def(''),
disabled: PropTypes.looseBool,
type: PropTypes.string,
value: PropTypes.any,
lazy: PropTypes.bool.def(true),
tag: {
type: String as PropType<'input' | 'textarea'>,
default: 'input',
},
emits: ['change', 'input'],
setup(_p, { emit }) {
const inputRef = ref(null);
size: PropTypes.string,
style: PropTypes.oneOfType([String, Object]),
class: PropTypes.string,
},
emits: [
'change',
'input',
'blur',
'keydown',
'focus',
'compositionstart',
'compositionend',
'keyup',
'paste',
'mousedown',
],
setup(props, { emit, attrs, expose }) {
const inputRef = shallowRef<BaseInputInnerExpose>(null);
const renderValue = ref();
const isComposing = ref(false);
watch(
[() => props.value, isComposing],
() => {
if (isComposing.value) return;
renderValue.value = props.value;
},
{ immediate: true },
);
const handleChange = (e: Event) => {
const { composing } = e.target as any;
if ((e as any).isComposing || composing) {
emit('input', e);
} else {
emit('input', e);
emit('change', e);
}
};
return {
inputRef,
focus: () => {
const onCompositionstart = (e: CompositionEvent) => {
isComposing.value = true;
(e.target as any).composing = true;
emit('compositionstart', e);
};
const onCompositionend = (e: CompositionEvent) => {
isComposing.value = false;
(e.target as any).composing = false;
emit('compositionend', e);
const event = document.createEvent('HTMLEvents');
event.initEvent('input', true, true);
e.target.dispatchEvent(event);
handleChange(e);
};
const handleInput = (e: Event) => {
if (isComposing.value && props.lazy) {
renderValue.value = (e.target as HTMLInputElement).value;
return;
}
emit('input', e);
};
const handleBlur = (e: Event) => {
emit('blur', e);
};
const handleFocus = (e: Event) => {
emit('focus', e);
};
const focus = () => {
if (inputRef.value) {
inputRef.value.focus();
}
},
blur: () => {
};
const blur = () => {
if (inputRef.value) {
inputRef.value.blur();
}
},
handleChange,
};
},
render() {
return withDirectives(
(
<input
{...this.$props}
{...this.$attrs}
onInput={this.handleChange}
onChange={this.handleChange}
ref="inputRef"
const handleKeyDown = (e: KeyboardEvent) => {
emit('keydown', e);
};
const handleKeyUp = (e: KeyboardEvent) => {
emit('keyup', e);
};
const setSelectionRange = (
start: number,
end: number,
direction?: 'forward' | 'backward' | 'none',
) => {
inputRef.value?.setSelectionRange(start, end, direction);
};
const select = () => {
inputRef.value?.select();
};
expose({
focus,
blur,
input: computed(() => inputRef.value?.input),
setSelectionRange,
select,
getSelectionStart: () => inputRef.value?.getSelectionStart(),
getSelectionEnd: () => inputRef.value?.getSelectionEnd(),
getScrollTop: () => inputRef.value?.getScrollTop(),
});
const handleMousedown = (e: MouseEvent) => {
emit('mousedown', e);
};
const handlePaste = (e: ClipboardEvent) => {
emit('paste', e);
};
const styleString = computed(() => {
return props.style && typeof props.style !== 'string'
? styleObjectToString(props.style)
: props.style;
});
return () => {
const { style, lazy, ...restProps } = props;
return (
<BaseInputInner
{...restProps}
{...attrs}
style={styleString.value}
onInput={handleInput}
onChange={handleChange}
onBlur={handleBlur}
onFocus={handleFocus}
ref={inputRef}
value={renderValue.value}
onCompositionstart={onCompositionstart}
onCompositionend={onCompositionend}
onKeyup={handleKeyUp}
onKeydown={handleKeyDown}
onPaste={handlePaste}
onMousedown={handleMousedown}
/>
) as any,
[[antInput]],
);
};
},
});

View File

@ -0,0 +1,96 @@
import type { PropType } from 'vue';
import { defineComponent, shallowRef } from 'vue';
import PropTypes from './vue-types';
export interface BaseInputInnerExpose {
focus: () => void;
blur: () => void;
input: HTMLInputElement | HTMLTextAreaElement | null;
setSelectionRange: (
start: number,
end: number,
direction?: 'forward' | 'backward' | 'none',
) => void;
select: () => void;
getSelectionStart: () => number | null;
getSelectionEnd: () => number | null;
getScrollTop: () => number | null;
setScrollTop: (scrollTop: number) => void;
}
const BaseInputInner = defineComponent({
compatConfig: { MODE: 3 },
// inheritAttrs: false,
props: {
disabled: PropTypes.looseBool,
type: PropTypes.string,
value: PropTypes.any,
tag: {
type: String as PropType<'input' | 'textarea'>,
default: 'input',
},
size: PropTypes.string,
onChange: Function as PropType<(e: Event) => void>,
onInput: Function as PropType<(e: Event) => void>,
onBlur: Function as PropType<(e: Event) => void>,
onFocus: Function as PropType<(e: Event) => void>,
onKeydown: Function as PropType<(e: Event) => void>,
onCompositionstart: Function as PropType<(e: Event) => void>,
onCompositionend: Function as PropType<(e: Event) => void>,
onKeyup: Function as PropType<(e: Event) => void>,
onPaste: Function as PropType<(e: Event) => void>,
onMousedown: Function as PropType<(e: Event) => void>,
},
emits: [
'change',
'input',
'blur',
'keydown',
'focus',
'compositionstart',
'compositionend',
'keyup',
'paste',
'mousedown',
],
setup(props, { expose }) {
const inputRef = shallowRef(null);
const focus = () => {
if (inputRef.value) {
inputRef.value.focus();
}
};
const blur = () => {
if (inputRef.value) {
inputRef.value.blur();
}
};
const setSelectionRange = (
start: number,
end: number,
direction?: 'forward' | 'backward' | 'none',
) => {
inputRef.value?.setSelectionRange(start, end, direction);
};
const select = () => {
inputRef.value?.select();
};
expose({
focus,
blur,
input: inputRef,
setSelectionRange,
select,
getSelectionStart: () => inputRef.value?.selectionStart,
getSelectionEnd: () => inputRef.value?.selectionEnd,
getScrollTop: () => inputRef.value?.scrollTop,
});
return () => {
const { tag: Tag, value, ...restProps } = props;
return <Tag {...restProps} ref={inputRef} value={value} />;
};
},
});
export default BaseInputInner;

View File

@ -3,7 +3,7 @@ import { getOptionProps } from './props-util';
export default {
methods: {
setState(state = {}, callback) {
setState(state = {}, callback: () => any) {
let newState = typeof state === 'function' ? state(this.$data, this.$props) : state;
if (this.getDerivedStateFromProps) {
const s = this.getDerivedStateFromProps(getOptionProps(this), {
@ -26,6 +26,7 @@ export default {
},
__emit() {
// 直接调用事件底层组件不需要vueTool记录events
// eslint-disable-next-line prefer-rest-params
const args = [].slice.call(arguments, 0);
let eventName = args[0];
eventName = `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;

View File

@ -3,7 +3,7 @@ import {
defineComponent,
nextTick,
onBeforeMount,
onBeforeUnmount,
onMounted,
onUpdated,
Teleport,
watch,
@ -23,12 +23,24 @@ export default defineComponent({
// getContainer
let container: HTMLElement;
const { shouldRender } = useInjectPortal();
onBeforeMount(() => {
isSSR = false;
function setContainer() {
if (shouldRender.value) {
container = props.getContainer();
}
}
onBeforeMount(() => {
isSSR = false;
// drawer
setContainer();
});
onMounted(() => {
if (container) return;
// https://github.com/vueComponent/ant-design-vue/issues/6937
setContainer();
});
const stopWatch = watch(shouldRender, () => {
if (shouldRender.value && !container) {
container = props.getContainer();
@ -44,11 +56,11 @@ export default defineComponent({
}
});
});
onBeforeUnmount(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
});
// onBeforeUnmount(() => {
// if (container && container.parentNode) {
// container.parentNode.removeChild(container);
// }
// });
return () => {
if (!shouldRender.value) return null;
if (isSSR) {

View File

@ -1,20 +1,19 @@
import PropTypes from './vue-types';
import switchScrollingEffect from './switchScrollingEffect';
import setStyle from './setStyle';
import Portal from './Portal';
import {
defineComponent,
ref,
shallowRef,
watch,
onMounted,
onBeforeUnmount,
onUpdated,
getCurrentInstance,
nextTick,
computed,
} from 'vue';
import canUseDom from './canUseDom';
import ScrollLocker from '../vc-util/Dom/scrollLocker';
import raf from './raf';
import { booleanType } from './type';
import useScrollLocker from './hooks/useScrollLocker';
let openCount = 0;
const supportDom = canUseDom();
@ -24,17 +23,13 @@ export function getOpenCount() {
return process.env.NODE_ENV === 'test' ? openCount : 0;
}
// https://github.com/ant-design/ant-design/issues/19340
// https://github.com/ant-design/ant-design/issues/19332
let cacheOverflow = {};
const getParent = (getContainer: GetContainer) => {
if (!supportDom) {
return null;
}
if (getContainer) {
if (typeof getContainer === 'string') {
return document.querySelectorAll(getContainer)[0];
return document.querySelectorAll(getContainer)[0] as HTMLElement;
}
if (typeof getContainer === 'function') {
return getContainer();
@ -57,24 +52,28 @@ export default defineComponent({
forceRender: { type: Boolean, default: undefined },
getContainer: PropTypes.any,
visible: { type: Boolean, default: undefined },
autoLock: booleanType(),
didUpdate: Function,
},
setup(props, { slots }) {
const container = ref<HTMLElement>();
const componentRef = ref();
const rafId = ref<number>();
const scrollLocker = new ScrollLocker({
container: getParent(props.getContainer) as HTMLElement,
});
const container = shallowRef<HTMLElement>();
const componentRef = shallowRef();
const rafId = shallowRef<number>();
const triggerUpdate = shallowRef(1);
const defaultContainer = canUseDom() && document.createElement('div');
const removeCurrentContainer = () => {
// Portal will remove from `parentNode`.
// Let's handle this again to avoid refactor issue.
if (container.value === defaultContainer) {
container.value?.parentNode?.removeChild(container.value);
}
container.value = null;
};
let parent: HTMLElement = null;
const attachToParent = (force = false) => {
if (force || (container.value && !container.value.parentNode)) {
const parent = getParent(props.getContainer);
parent = getParent(props.getContainer);
if (parent) {
parent.appendChild(container.value);
return true;
@ -85,14 +84,12 @@ export default defineComponent({
return true;
};
// attachToParent();
const getContainer = () => {
if (!supportDom) {
return null;
}
if (!container.value) {
container.value = document.createElement('div');
container.value = defaultContainer;
attachToParent(true);
}
setWrapperClassName();
@ -108,43 +105,33 @@ export default defineComponent({
setWrapperClassName();
attachToParent();
});
/**
* Enhance ./switchScrollingEffect
* 1. Simulate document body scroll bar with
* 2. Record body has overflow style and recover when all of PortalWrapper invisible
* 3. Disable body scroll when PortalWrapper has open
*
* @memberof PortalWrapper
*/
const switchScrolling = () => {
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
switchScrollingEffect();
// Must be set after switchScrollingEffect
cacheOverflow = setStyle({
overflow: 'hidden',
overflowX: 'hidden',
overflowY: 'hidden',
});
} else if (!openCount) {
setStyle(cacheOverflow);
cacheOverflow = {};
switchScrollingEffect(true);
}
};
const instance = getCurrentInstance();
useScrollLocker(
computed(() => {
return (
props.autoLock &&
props.visible &&
canUseDom() &&
(container.value === document.body || container.value === defaultContainer)
);
}),
);
onMounted(() => {
let init = false;
watch(
[() => props.visible, () => props.getContainer],
([visible, getContainer], [prevVisible, prevGetContainer]) => {
// Update count
if (supportDom && getParent(props.getContainer) === document.body) {
if (supportDom) {
parent = getParent(props.getContainer);
if (parent === document.body) {
if (visible && !prevVisible) {
openCount += 1;
} else if (init) {
openCount -= 1;
}
}
}
if (init) {
// Clean up container if needed
@ -157,17 +144,6 @@ export default defineComponent({
) {
removeCurrentContainer();
}
// updateScrollLocker
if (
visible &&
visible !== prevVisible &&
supportDom &&
getParent(getContainer) !== scrollLocker.getContainer()
) {
scrollLocker.reLock({
container: getParent(getContainer) as HTMLElement,
});
}
}
init = true;
},
@ -177,37 +153,34 @@ export default defineComponent({
nextTick(() => {
if (!attachToParent()) {
rafId.value = raf(() => {
instance.update();
triggerUpdate.value += 1;
});
}
});
});
onBeforeUnmount(() => {
const { visible, getContainer } = props;
if (supportDom && getParent(getContainer) === document.body) {
const { visible } = props;
if (supportDom && parent === document.body) {
// render func
openCount = visible && openCount ? openCount - 1 : openCount;
}
removeCurrentContainer();
raf.cancel(rafId.value);
});
return () => {
const { forceRender, visible } = props;
let portal = null;
const childProps = {
getOpenCount: () => openCount,
getContainer,
switchScrollingEffect: switchScrolling,
scrollLocker,
};
if (forceRender || visible || componentRef.value) {
if (triggerUpdate.value && (forceRender || visible || componentRef.value)) {
portal = (
<Portal
getContainer={getContainer}
ref={componentRef}
didUpdate={props.didUpdate}
v-slots={{ default: () => slots.default?.(childProps) }}
></Portal>
);

View File

@ -0,0 +1,11 @@
import { defineComponent } from 'vue';
import { customRenderSlot } from '../vnode';
export default defineComponent({
name: 'RenderSlot',
setup(_props, { slots }) {
return () => {
return customRenderSlot(slots, 'default', {}, () => ['default value']);
};
},
});

View File

@ -0,0 +1,26 @@
import RenderSlot from '../__mocks__/RenderSlot';
import { mount } from '@vue/test-utils';
import { nextTick } from 'vue';
describe('render slot content', () => {
it('renders slot content', () => {
const wrapper = mount(RenderSlot, {
slots: {
default: () => 'This is slot content',
},
});
expect(wrapper.html()).toContain('This is slot content');
});
it('render default value when slot is fragment', async () => {
const wrapper = mount(RenderSlot, {
slots: {
default: () => <></>,
},
});
await nextTick();
expect(wrapper.html()).toContain('default value');
});
});

View File

@ -1,35 +0,0 @@
function onCompositionStart(e) {
e.target.composing = true;
}
function onCompositionEnd(e) {
// prevent triggering an input event for no reason
if (!e.target.composing) return;
e.target.composing = false;
trigger(e.target, 'input');
}
function trigger(el, type) {
const e = document.createEvent('HTMLEvents');
e.initEvent(type, true, true);
el.dispatchEvent(e);
}
export function addEventListener(el, event, handler, options) {
el.addEventListener(event, handler, options);
}
const antInput = {
created(el, binding) {
if (!binding.modifiers || !binding.modifiers.lazy) {
addEventListener(el, 'compositionstart', onCompositionStart);
addEventListener(el, 'compositionend', onCompositionEnd);
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
addEventListener(el, 'change', onCompositionEnd);
}
},
};
export default antInput;

View File

@ -1,23 +1,34 @@
import type { ElementOf } from './type';
import { tuple } from './type';
import type { PresetColorKey } from '../theme/interface';
import { PresetColors } from '../theme/interface';
export const PresetStatusColorTypes = tuple('success', 'processing', 'error', 'default', 'warning');
type InverseColor = `${PresetColorKey}-inverse`;
const inverseColors = PresetColors.map<InverseColor>(color => `${color}-inverse`);
export const PresetColorTypes = tuple(
'pink',
'red',
'yellow',
'orange',
'cyan',
'green',
'blue',
'purple',
'geekblue',
'magenta',
'volcano',
'gold',
'lime',
);
export const PresetStatusColorTypes = [
'success',
'processing',
'error',
'default',
'warning',
] as const;
export type PresetColorType = ElementOf<typeof PresetColorTypes>;
export type PresetStatusColorType = ElementOf<typeof PresetStatusColorTypes>;
export type PresetColorType = PresetColorKey | InverseColor;
export type PresetStatusColorType = (typeof PresetStatusColorTypes)[number];
/**
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.
* @param color color to be judged
* @param includeInverse whether to include reversed colors
*/
export function isPresetColor(color?: any, includeInverse = true) {
if (includeInverse) {
return [...inverseColors, ...PresetColors].includes(color);
}
return PresetColors.includes(color);
}
export function isPresetStatusColor(color?: any): color is PresetStatusColorType {
return PresetStatusColorTypes.includes(color);
}

View File

@ -0,0 +1,22 @@
import { inject, provide, reactive, watchEffect } from 'vue';
function createContext<T extends Record<string, any>>(defaultValue?: T) {
const contextKey = Symbol('contextKey');
const useProvide = (props: T, newProps?: T) => {
const mergedProps = reactive<T>({} as T);
provide(contextKey, mergedProps);
watchEffect(() => {
Object.assign(mergedProps, props, newProps || {});
});
return mergedProps;
};
const useInject = () => {
return inject(contextKey, defaultValue as T) || ({} as T);
};
return {
useProvide,
useInject,
};
}
export default createContext;

View File

@ -1,130 +0,0 @@
const START_EVENT_NAME_MAP = {
transitionstart: {
transition: 'transitionstart',
WebkitTransition: 'webkitTransitionStart',
MozTransition: 'mozTransitionStart',
OTransition: 'oTransitionStart',
msTransition: 'MSTransitionStart',
},
animationstart: {
animation: 'animationstart',
WebkitAnimation: 'webkitAnimationStart',
MozAnimation: 'mozAnimationStart',
OAnimation: 'oAnimationStart',
msAnimation: 'MSAnimationStart',
},
};
const END_EVENT_NAME_MAP = {
transitionend: {
transition: 'transitionend',
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'mozTransitionEnd',
OTransition: 'oTransitionEnd',
msTransition: 'MSTransitionEnd',
},
animationend: {
animation: 'animationend',
WebkitAnimation: 'webkitAnimationEnd',
MozAnimation: 'mozAnimationEnd',
OAnimation: 'oAnimationEnd',
msAnimation: 'MSAnimationEnd',
},
};
const startEvents = [];
const endEvents = [];
function detectEvents() {
const testEl = document.createElement('div');
const style = testEl.style;
if (!('AnimationEvent' in window)) {
delete START_EVENT_NAME_MAP.animationstart.animation;
delete END_EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete START_EVENT_NAME_MAP.transitionstart.transition;
delete END_EVENT_NAME_MAP.transitionend.transition;
}
function process(EVENT_NAME_MAP, events) {
for (const baseEventName in EVENT_NAME_MAP) {
if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
const baseEvents = EVENT_NAME_MAP[baseEventName];
for (const styleName in baseEvents) {
if (styleName in style) {
events.push(baseEvents[styleName]);
break;
}
}
}
}
}
process(START_EVENT_NAME_MAP, startEvents);
process(END_EVENT_NAME_MAP, endEvents);
}
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
detectEvents();
}
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
const TransitionEvents = {
// Start events
startEvents,
addStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
setTimeout(eventListener, 0);
return;
}
startEvents.forEach(startEvent => {
addEventListener(node, startEvent, eventListener);
});
},
removeStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
return;
}
startEvents.forEach(startEvent => {
removeEventListener(node, startEvent, eventListener);
});
},
// End events
endEvents,
addEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
setTimeout(eventListener, 0);
return;
}
endEvents.forEach(endEvent => {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(endEvent => {
removeEventListener(node, endEvent, eventListener);
});
},
};
export default TransitionEvents;

View File

@ -1,186 +0,0 @@
// https://github.com/yiminghe/css-animation 1.5.0
import Event from './Event';
import classes from '../component-classes';
import { requestAnimationTimeout, cancelAnimationTimeout } from '../requestAnimationTimeout';
import { inBrowser } from '../env';
const isCssAnimationSupported = Event.endEvents.length !== 0;
const capitalPrefixes = [
'Webkit',
'Moz',
'O',
// ms is special .... !
'ms',
];
const prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
function getStyleProperty(node, name) {
if (inBrowser) return '';
// old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
const style = window.getComputedStyle(node, null);
let ret = '';
for (let i = 0; i < prefixes.length; i++) {
ret = style.getPropertyValue(prefixes[i] + name);
if (ret) {
break;
}
}
return ret;
}
function fixBrowserByTimeout(node) {
if (isCssAnimationSupported) {
const transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
const transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
const animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
const animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
const time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
// sometimes, browser bug
node.rcEndAnimTimeout = setTimeout(() => {
node.rcEndAnimTimeout = null;
if (node.rcEndListener) {
node.rcEndListener();
}
}, time * 1000 + 200);
}
}
function clearBrowserBugTimeout(node) {
if (node.rcEndAnimTimeout) {
clearTimeout(node.rcEndAnimTimeout);
node.rcEndAnimTimeout = null;
}
}
const cssAnimation = (node, transitionName, endCallback) => {
const nameIsObj = typeof transitionName === 'object';
const className = nameIsObj ? transitionName.name : transitionName;
const activeClassName = nameIsObj ? transitionName.active : `${transitionName}-active`;
let end = endCallback;
let start;
let active;
const nodeClasses = classes(node);
if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
end = endCallback.end;
start = endCallback.start;
active = endCallback.active;
}
if (node.rcEndListener) {
node.rcEndListener();
}
node.rcEndListener = e => {
if (e && e.target !== node) {
return;
}
if (node.rcAnimTimeout) {
cancelAnimationTimeout(node.rcAnimTimeout);
node.rcAnimTimeout = null;
}
clearBrowserBugTimeout(node);
nodeClasses.remove(className);
nodeClasses.remove(activeClassName);
Event.removeEndEventListener(node, node.rcEndListener);
node.rcEndListener = null;
// Usually this optional end is used for informing an owner of
// a leave animation and telling it to remove the child.
if (end) {
end();
}
};
Event.addEndEventListener(node, node.rcEndListener);
if (start) {
start();
}
nodeClasses.add(className);
node.rcAnimTimeout = requestAnimationTimeout(() => {
node.rcAnimTimeout = null;
nodeClasses.add(className);
nodeClasses.add(activeClassName);
if (active) {
requestAnimationTimeout(active, 0);
}
fixBrowserByTimeout(node);
// 30ms for firefox
}, 30);
return {
stop() {
if (node.rcEndListener) {
node.rcEndListener();
}
},
};
};
cssAnimation.style = (node, style, callback) => {
if (node.rcEndListener) {
node.rcEndListener();
}
node.rcEndListener = e => {
if (e && e.target !== node) {
return;
}
if (node.rcAnimTimeout) {
cancelAnimationTimeout(node.rcAnimTimeout);
node.rcAnimTimeout = null;
}
clearBrowserBugTimeout(node);
Event.removeEndEventListener(node, node.rcEndListener);
node.rcEndListener = null;
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
if (callback) {
callback();
}
};
Event.addEndEventListener(node, node.rcEndListener);
node.rcAnimTimeout = requestAnimationTimeout(() => {
for (const s in style) {
if (style.hasOwnProperty(s)) {
node.style[s] = style[s];
}
}
node.rcAnimTimeout = null;
fixBrowserByTimeout(node);
}, 0);
};
cssAnimation.setTransition = (node, p, value) => {
let property = p;
let v = value;
if (value === undefined) {
v = property;
property = '';
}
property = property || '';
capitalPrefixes.forEach(prefix => {
node.style[`${prefix}Transition${property}`] = v;
});
};
cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
export { isCssAnimationSupported };
export default cssAnimation;

View File

@ -0,0 +1,29 @@
export type KeyType = string | number;
type ValueType = [number, any]; // [times, realValue]
const SPLIT = '%';
class Entity {
instanceId: string;
constructor(instanceId: string) {
this.instanceId = instanceId;
}
/** @private Internal cache map. Do not access this directly */
cache = new Map<string, ValueType>();
get(keys: KeyType[] | string): ValueType | null {
return this.cache.get(Array.isArray(keys) ? keys.join(SPLIT) : keys) || null;
}
update(keys: KeyType[] | string, valueFn: (origin: ValueType | null) => ValueType | null) {
const path = Array.isArray(keys) ? keys.join(SPLIT) : keys;
const prevValue = this.cache.get(path)!;
const nextValue = valueFn(prevValue);
if (nextValue === null) {
this.cache.delete(path);
} else {
this.cache.set(path, nextValue);
}
}
}
export default Entity;

View File

@ -0,0 +1,19 @@
import type { CSSInterpolation } from './hooks/useStyleRegister';
class Keyframe {
private name: string;
style: CSSInterpolation;
constructor(name: string, style: CSSInterpolation) {
this.name = name;
this.style = style;
}
getName(hashId = ''): string {
return hashId ? `${hashId}-${this.name}` : this.name;
}
_keyframe = true;
}
export default Keyframe;

View File

@ -0,0 +1,195 @@
import type { ShallowRef, ExtractPropTypes, InjectionKey, Ref } from 'vue';
import {
provide,
defineComponent,
unref,
inject,
watch,
shallowRef,
getCurrentInstance,
} from 'vue';
import CacheEntity from './Cache';
import type { Linter } from './linters/interface';
import type { Transformer } from './transformers/interface';
import { arrayType, booleanType, objectType, someType, stringType, withInstall } from '../type';
export const ATTR_TOKEN = 'data-token-hash';
export const ATTR_MARK = 'data-css-hash';
export const ATTR_CACHE_PATH = 'data-cache-path';
// Mark css-in-js instance in style element
export const CSS_IN_JS_INSTANCE = '__cssinjs_instance__';
export function createCache() {
const cssinjsInstanceId = Math.random().toString(12).slice(2);
// Tricky SSR: Move all inline style to the head.
// PS: We do not recommend tricky mode.
if (typeof document !== 'undefined' && document.head && document.body) {
const styles = document.body.querySelectorAll(`style[${ATTR_MARK}]`) || [];
const { firstChild } = document.head;
Array.from(styles).forEach(style => {
(style as any)[CSS_IN_JS_INSTANCE] = (style as any)[CSS_IN_JS_INSTANCE] || cssinjsInstanceId;
// Not force move if no head
// Not force move if no head
if ((style as any)[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
document.head.insertBefore(style, firstChild);
}
});
// Deduplicate of moved styles
const styleHash: Record<string, boolean> = {};
Array.from(document.querySelectorAll(`style[${ATTR_MARK}]`)).forEach(style => {
const hash = style.getAttribute(ATTR_MARK)!;
if (styleHash[hash]) {
if ((style as any)[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
style.parentNode?.removeChild(style);
}
} else {
styleHash[hash] = true;
}
});
}
return new CacheEntity(cssinjsInstanceId);
}
export type HashPriority = 'low' | 'high';
export interface StyleContextProps {
autoClear?: boolean;
/** @private Test only. Not work in production. */
mock?: 'server' | 'client';
/**
* Only set when you need ssr to extract style on you own.
* If not provided, it will auto create <style /> on the end of Provider in server side.
*/
cache: CacheEntity;
/** Tell children that this context is default generated context */
defaultCache: boolean;
/** Use `:where` selector to reduce hashId css selector priority */
hashPriority?: HashPriority;
/** Tell cssinjs where to inject style in */
container?: Element | ShadowRoot;
/** Component wil render inline `<style />` for fallback in SSR. Not recommend. */
ssrInline?: boolean;
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
transformers?: Transformer[];
/**
* Linters to lint css before inject in document.
* Styles will be linted after transforming.
* Please note that `linters` do not support dynamic update.
*/
linters?: Linter[];
}
const StyleContextKey: InjectionKey<ShallowRef<Partial<StyleContextProps>>> =
Symbol('StyleContextKey');
export type UseStyleProviderProps = Partial<StyleContextProps> | Ref<Partial<StyleContextProps>>;
// fix: https://github.com/vueComponent/ant-design-vue/issues/7023
const getCache = () => {
const instance = getCurrentInstance();
let cache: CacheEntity;
if (instance && instance.appContext) {
const globalCache = instance.appContext?.config?.globalProperties?.__ANTDV_CSSINJS_CACHE__;
if (globalCache) {
cache = globalCache;
} else {
cache = createCache();
if (instance.appContext.config.globalProperties) {
instance.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__ = cache;
}
}
} else {
cache = createCache();
}
return cache;
};
const defaultStyleContext: StyleContextProps = {
cache: createCache(),
defaultCache: true,
hashPriority: 'low',
};
// fix: https://github.com/vueComponent/ant-design-vue/issues/6912
export const useStyleInject = () => {
const cache = getCache();
return inject(StyleContextKey, shallowRef({ ...defaultStyleContext, cache }));
};
export const useStyleProvider = (props: UseStyleProviderProps) => {
const parentContext = useStyleInject();
const context = shallowRef<Partial<StyleContextProps>>({
...defaultStyleContext,
cache: createCache(),
});
watch(
[() => unref(props), parentContext],
() => {
const mergedContext: Partial<StyleContextProps> = {
...parentContext.value,
};
const propsValue = unref(props);
Object.keys(propsValue).forEach(key => {
const value = propsValue[key];
if (propsValue[key] !== undefined) {
mergedContext[key] = value;
}
});
const { cache } = propsValue;
mergedContext.cache = mergedContext.cache || createCache();
mergedContext.defaultCache = !cache && parentContext.value.defaultCache;
context.value = mergedContext;
},
{ immediate: true },
);
provide(StyleContextKey, context);
return context;
};
export const styleProviderProps = () => ({
autoClear: booleanType(),
/** @private Test only. Not work in production. */
mock: stringType<'server' | 'client'>(),
/**
* Only set when you need ssr to extract style on you own.
* If not provided, it will auto create <style /> on the end of Provider in server side.
*/
cache: objectType<CacheEntity>(),
/** Tell children that this context is default generated context */
defaultCache: booleanType(),
/** Use `:where` selector to reduce hashId css selector priority */
hashPriority: stringType<HashPriority>(),
/** Tell cssinjs where to inject style in */
container: someType<Element | ShadowRoot>(),
/** Component wil render inline `<style />` for fallback in SSR. Not recommend. */
ssrInline: booleanType(),
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
transformers: arrayType<Transformer[]>(),
/**
* Linters to lint css before inject in document.
* Styles will be linted after transforming.
* Please note that `linters` do not support dynamic update.
*/
linters: arrayType<Linter[]>(),
});
export type StyleProviderProps = Partial<ExtractPropTypes<ReturnType<typeof styleProviderProps>>>;
export const StyleProvider = withInstall(
defineComponent({
name: 'AStyleProvider',
inheritAttrs: false,
props: styleProviderProps(),
setup(props, { slots }) {
useStyleProvider(props);
return () => slots.default?.();
},
}),
);
export default {
useStyleInject,
useStyleProvider,
StyleProvider,
};

View File

@ -0,0 +1,165 @@
import hash from '@emotion/hash';
import { ATTR_TOKEN, CSS_IN_JS_INSTANCE, useStyleInject } from '../StyleContext';
import type Theme from '../theme/Theme';
import useGlobalCache from './useGlobalCache';
import { flattenToken, token2key } from '../util';
import type { Ref } from 'vue';
import { ref, computed } from 'vue';
const EMPTY_OVERRIDE = {};
const isProduction = process.env.NODE_ENV === 'production';
// nuxt generate when NODE_ENV is prerender
const isPrerender = process.env.NODE_ENV === 'prerender';
// Generate different prefix to make user selector break in production env.
// This helps developer not to do style override directly on the hash id.
const hashPrefix = !isProduction && !isPrerender ? 'css-dev-only-do-not-override' : 'css';
export interface Option<DerivativeToken, DesignToken> {
/**
* Generate token with salt.
* This is used to generate different hashId even same derivative token for different version.
*/
salt?: string;
override?: object;
/**
* Format token as you need. Such as:
*
* - rename token
* - merge token
* - delete token
*
* This should always be the same since it's one time process.
* It's ok to useMemo outside but this has better cache strategy.
*/
formatToken?: (mergedToken: any) => DerivativeToken;
/**
* Get final token with origin token, override token and theme.
* The parameters do not contain formatToken since it's passed by user.
* @param origin The original token.
* @param override Extra tokens to override.
* @param theme Theme instance. Could get derivative token by `theme.getDerivativeToken`
*/
getComputedToken?: (
origin: DesignToken,
override: object,
theme: Theme<any, any>,
) => DerivativeToken;
}
const tokenKeys = new Map<string, number>();
function recordCleanToken(tokenKey: string) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
function removeStyleTags(key: string, instanceId: string) {
if (typeof document !== 'undefined') {
const styles = document.querySelectorAll(`style[${ATTR_TOKEN}="${key}"]`);
styles.forEach(style => {
if ((style as any)[CSS_IN_JS_INSTANCE] === instanceId) {
style.parentNode?.removeChild(style);
}
});
}
}
const TOKEN_THRESHOLD = 0;
// Remove will check current keys first
function cleanTokenStyle(tokenKey: string, instanceId: string) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
const tokenKeyList = Array.from(tokenKeys.keys());
const cleanableKeyList = tokenKeyList.filter(key => {
const count = tokenKeys.get(key) || 0;
return count <= 0;
});
// Should keep tokens under threshold for not to insert style too often
if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) {
cleanableKeyList.forEach(key => {
removeStyleTags(key, instanceId);
tokenKeys.delete(key);
});
}
}
export const getComputedToken = <DerivativeToken = object, DesignToken = DerivativeToken>(
originToken: DesignToken,
overrideToken: object,
theme: Theme<any, any>,
format?: (token: DesignToken) => DerivativeToken,
) => {
const derivativeToken = theme.getDerivativeToken(originToken);
// Merge with override
let mergedDerivativeToken = {
...derivativeToken,
...overrideToken,
};
// Format if needed
if (format) {
mergedDerivativeToken = format(mergedDerivativeToken);
}
return mergedDerivativeToken;
};
/**
* Cache theme derivative token as global shared one
* @param theme Theme entity
* @param tokens List of tokens, used for cache. Please do not dynamic generate object directly
* @param option Additional config
* @returns Call Theme.getDerivativeToken(tokenObject) to get token
*/
export default function useCacheToken<DerivativeToken = object, DesignToken = DerivativeToken>(
theme: Ref<Theme<any, any>>,
tokens: Ref<Partial<DesignToken>[]>,
option: Ref<Option<DerivativeToken, DesignToken>> = ref({}),
) {
const style = useStyleInject();
// Basic - We do basic cache here
const mergedToken = computed(() => Object.assign({}, ...tokens.value));
const tokenStr = computed(() => flattenToken(mergedToken.value));
const overrideTokenStr = computed(() => flattenToken(option.value.override || EMPTY_OVERRIDE));
const cachedToken = useGlobalCache<[DerivativeToken & { _tokenKey: string }, string]>(
'token',
computed(() => [
option.value.salt || '',
theme.value.id,
tokenStr.value,
overrideTokenStr.value,
]),
() => {
const {
salt = '',
override = EMPTY_OVERRIDE,
formatToken,
getComputedToken: compute,
} = option.value;
const mergedDerivativeToken = compute
? compute(mergedToken.value, override, theme.value)
: getComputedToken(mergedToken.value, override, theme.value, formatToken);
// Optimize for `useStyleRegister` performance
const tokenKey = token2key(mergedDerivativeToken, salt);
mergedDerivativeToken._tokenKey = tokenKey;
recordCleanToken(tokenKey);
const hashId = `${hashPrefix}-${hash(tokenKey)}`;
mergedDerivativeToken._hashId = hashId; // Not used
return [mergedDerivativeToken, hashId];
},
cache => {
// Remove token will remove all related style
cleanTokenStyle(cache[0]._tokenKey, style.value?.cache.instanceId);
},
);
return cachedToken;
}

View File

@ -0,0 +1,58 @@
import { useStyleInject } from '../StyleContext';
import type { KeyType } from '../Cache';
import useHMR from './useHMR';
import type { ShallowRef, Ref } from 'vue';
import { onBeforeUnmount, watch, watchEffect, shallowRef } from 'vue';
export default function useClientCache<CacheType>(
prefix: string,
keyPath: Ref<KeyType[]>,
cacheFn: () => CacheType,
onCacheRemove?: (cache: CacheType, fromHMR: boolean) => void,
): ShallowRef<CacheType> {
const styleContext = useStyleInject();
const fullPathStr = shallowRef('');
const res = shallowRef<CacheType>();
watchEffect(() => {
fullPathStr.value = [prefix, ...keyPath.value].join('%');
});
const HMRUpdate = useHMR();
const clearCache = (pathStr: string) => {
styleContext.value.cache.update(pathStr, prevCache => {
const [times = 0, cache] = prevCache || [];
const nextCount = times - 1;
if (nextCount === 0) {
onCacheRemove?.(cache, false);
return null;
}
return [times - 1, cache];
});
};
watch(
fullPathStr,
(newStr, oldStr) => {
if (oldStr) clearCache(oldStr);
// Create cache
styleContext.value.cache.update(newStr, prevCache => {
const [times = 0, cache] = prevCache || [];
// HMR should always ignore cache since developer may change it
let tmpCache = cache;
if (process.env.NODE_ENV !== 'production' && cache && HMRUpdate) {
onCacheRemove?.(tmpCache, HMRUpdate);
tmpCache = null;
}
const mergedCache = tmpCache || cacheFn();
return [times + 1, mergedCache];
});
res.value = styleContext.value.cache.get(fullPathStr.value)![1];
},
{ immediate: true },
);
onBeforeUnmount(() => {
clearCache(fullPathStr.value);
});
return res;
}

View File

@ -0,0 +1,34 @@
function useProdHMR() {
return false;
}
let webpackHMR = false;
function useDevHMR() {
return webpackHMR;
}
export default process.env.NODE_ENV === 'production' ? useProdHMR : useDevHMR;
// Webpack `module.hot.accept` do not support any deps update trigger
// We have to hack handler to force mark as HRM
if (
process.env.NODE_ENV !== 'production' &&
typeof module !== 'undefined' &&
module &&
(module as any).hot &&
typeof window !== 'undefined'
) {
const win = window as any;
if (typeof win.webpackHotUpdate === 'function') {
const originWebpackHotUpdate = win.webpackHotUpdate;
win.webpackHotUpdate = (...args: any[]) => {
webpackHMR = true;
setTimeout(() => {
webpackHMR = false;
}, 0);
return originWebpackHotUpdate(...args);
};
}
}

View File

@ -0,0 +1,91 @@
import canUseDom from '../../../../_util/canUseDom';
import { ATTR_MARK } from '../../StyleContext';
export const ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';
/**
* This marks style from the css file.
* Which means not exist in `<style />` tag.
*/
export const CSS_FILE_STYLE = '_FILE_STYLE__';
export function serialize(cachePathMap: Record<string, string>) {
return Object.keys(cachePathMap)
.map(path => {
const hash = cachePathMap[path];
return `${path}:${hash}`;
})
.join(';');
}
let cachePathMap: Record<string, string>;
let fromCSSFile = true;
/**
* @private Test usage only. Can save remove if no need.
*/
export function reset(mockCache?: Record<string, string>, fromFile = true) {
cachePathMap = mockCache!;
fromCSSFile = fromFile;
}
export function prepare() {
if (!cachePathMap) {
cachePathMap = {};
if (canUseDom()) {
const div = document.createElement('div');
div.className = ATTR_CACHE_MAP;
div.style.position = 'fixed';
div.style.visibility = 'hidden';
div.style.top = '-9999px';
document.body.appendChild(div);
let content = getComputedStyle(div).content || '';
content = content.replace(/^"/, '').replace(/"$/, '');
// Fill data
content.split(';').forEach(item => {
const [path, hash] = item.split(':');
cachePathMap[path] = hash;
});
// Remove inline record style
const inlineMapStyle = document.querySelector(`style[${ATTR_CACHE_MAP}]`);
if (inlineMapStyle) {
fromCSSFile = false;
inlineMapStyle.parentNode?.removeChild(inlineMapStyle);
}
document.body.removeChild(div);
}
}
}
export function existPath(path: string) {
prepare();
return !!cachePathMap[path];
}
export function getStyleAndHash(path: string): [style: string | null, hash: string] {
const hash = cachePathMap[path];
let styleStr: string | null = null;
if (hash && canUseDom()) {
if (fromCSSFile) {
styleStr = CSS_FILE_STYLE;
} else {
const style = document.querySelector(`style[${ATTR_MARK}="${cachePathMap[path]}"]`);
if (style) {
styleStr = style.innerHTML;
} else {
// Clean up since not exist anymore
delete cachePathMap[path];
}
}
}
return [styleStr, hash];
}

View File

@ -0,0 +1,566 @@
import hash from '@emotion/hash';
import type * as CSS from 'csstype';
// @ts-ignore
import unitless from '@emotion/unitless';
import { compile, serialize, stringify } from 'stylis';
import type { Theme, Transformer } from '../..';
import type Cache from '../../Cache';
import type Keyframes from '../../Keyframes';
import type { Linter } from '../../linters';
import { contentQuotesLinter, hashedAnimationLinter } from '../../linters';
import type { HashPriority } from '../../StyleContext';
import {
useStyleInject,
ATTR_CACHE_PATH,
ATTR_MARK,
ATTR_TOKEN,
CSS_IN_JS_INSTANCE,
} from '../../StyleContext';
import { supportLayer } from '../../util';
import useGlobalCache from '../useGlobalCache';
import { removeCSS, updateCSS } from '../../../../vc-util/Dom/dynamicCSS';
import type { Ref } from 'vue';
import { computed } from 'vue';
import type { VueNode } from '../../../type';
import canUseDom from '../../../../_util/canUseDom';
import {
ATTR_CACHE_MAP,
existPath,
getStyleAndHash,
serialize as serializeCacheMap,
} from './cacheMapUtil';
const isClientSide = canUseDom();
const SKIP_CHECK = '_skip_check_';
const MULTI_VALUE = '_multi_value_';
export type CSSProperties = Omit<CSS.PropertiesFallback<number | string>, 'animationName'> & {
animationName?: CSS.PropertiesFallback<number | string>['animationName'] | Keyframes;
};
export type CSSPropertiesWithMultiValues = {
[K in keyof CSSProperties]:
| CSSProperties[K]
| readonly Extract<CSSProperties[K], string>[]
| {
[SKIP_CHECK]?: boolean;
[MULTI_VALUE]?: boolean;
value: CSSProperties[K] | CSSProperties[K][];
};
};
export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject };
type ArrayCSSInterpolation = readonly CSSInterpolation[];
export type InterpolationPrimitive = null | undefined | boolean | number | string | CSSObject;
export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation | Keyframes;
export type CSSOthersObject = Record<string, CSSInterpolation>;
export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {}
// ============================================================================
// == Parser ==
// ============================================================================
// Preprocessor style content to browser support one
export function normalizeStyle(styleStr: string): string {
const serialized = serialize(compile(styleStr), stringify);
return serialized.replace(/\{%%%\:[^;];}/g, ';');
}
function isCompoundCSSProperty(value: CSSObject[string]) {
return typeof value === 'object' && value && (SKIP_CHECK in value || MULTI_VALUE in value);
}
// hash
function injectSelectorHash(key: string, hashId: string, hashPriority?: HashPriority) {
if (!hashId) {
return key;
}
const hashClassName = `.${hashId}`;
const hashSelector = hashPriority === 'low' ? `:where(${hashClassName})` : hashClassName;
// hashId
const keys = key.split(',').map(k => {
const fullPath = k.trim().split(/\s+/);
// Selector HTML Element
let firstPath = fullPath[0] || '';
const htmlElement = firstPath.match(/^\w+/)?.[0] || '';
firstPath = `${htmlElement}${hashSelector}${firstPath.slice(htmlElement.length)}`;
return [firstPath, ...fullPath.slice(1)].join(' ');
});
return keys.join(',');
}
export interface ParseConfig {
hashId?: string;
hashPriority?: HashPriority;
layer?: string;
path?: string;
transformers?: Transformer[];
linters?: Linter[];
}
export interface ParseInfo {
root?: boolean;
injectHash?: boolean;
parentSelectors: string[];
}
// Global effect style will mount once and not removed
// The effect will not save in SSR cache (e.g. keyframes)
const globalEffectStyleKeys = new Set();
/**
* @private Test only. Clear the global effect style keys.
*/
export const _cf =
process.env.NODE_ENV !== 'production' ? () => globalEffectStyleKeys.clear() : undefined;
// Parse CSSObject to style content
export const parseStyle = (
interpolation: CSSInterpolation,
config: ParseConfig = {},
{ root, injectHash, parentSelectors }: ParseInfo = {
root: true,
parentSelectors: [],
},
): [
parsedStr: string,
// Style content which should be unique on all of the style (e.g. Keyframes).
// Firefox will flick with same animation name when exist multiple same keyframes.
effectStyle: Record<string, string>,
] => {
const { hashId, layer, path, hashPriority, transformers = [], linters = [] } = config;
let styleStr = '';
let effectStyle: Record<string, string> = {};
function parseKeyframes(keyframes: Keyframes) {
const animationName = keyframes.getName(hashId);
if (!effectStyle[animationName]) {
const [parsedStr] = parseStyle(keyframes.style, config, {
root: false,
parentSelectors,
});
effectStyle[animationName] = `@keyframes ${keyframes.getName(hashId)}${parsedStr}`;
}
}
function flattenList(list: ArrayCSSInterpolation, fullList: CSSObject[] = []) {
list.forEach(item => {
if (Array.isArray(item)) {
flattenList(item, fullList);
} else if (item) {
fullList.push(item as CSSObject);
}
});
return fullList;
}
const flattenStyleList = flattenList(
Array.isArray(interpolation) ? interpolation : [interpolation],
);
flattenStyleList.forEach(originStyle => {
// Only root level can use raw string
const style: CSSObject = typeof originStyle === 'string' && !root ? {} : originStyle;
if (typeof style === 'string') {
styleStr += `${style}\n`;
} else if ((style as any)._keyframe) {
// Keyframe
parseKeyframes(style as unknown as Keyframes);
} else {
const mergedStyle = transformers.reduce((prev, trans) => trans?.visit?.(prev) || prev, style);
// Normal CSSObject
Object.keys(mergedStyle).forEach(key => {
const value = mergedStyle[key];
if (
typeof value === 'object' &&
value &&
(key !== 'animationName' || !(value as Keyframes)._keyframe) &&
!isCompoundCSSProperty(value)
) {
let subInjectHash = false;
//
let mergedKey = key.trim();
// Whether treat child as root. In most case it is false.
let nextRoot = false;
//
if ((root || injectHash) && hashId) {
if (mergedKey.startsWith('@')) {
// hashId
subInjectHash = true;
} else {
// hashId
mergedKey = injectSelectorHash(key, hashId, hashPriority);
}
} else if (root && !hashId && (mergedKey === '&' || mergedKey === '')) {
// In case of `{ '&': { a: { color: 'red' } } }` or `{ '': { a: { color: 'red' } } }` without hashId,
// we will get `&{a:{color:red;}}` or `{a:{color:red;}}` string for stylis to compile.
// But it does not conform to stylis syntax,
// and finally we will get `{color:red;}` as css, which is wrong.
// So we need to remove key in root, and treat child `{ a: { color: 'red' } }` as root.
mergedKey = '';
nextRoot = true;
}
const [parsedStr, childEffectStyle] = parseStyle(value as any, config, {
root: nextRoot,
injectHash: subInjectHash,
parentSelectors: [...parentSelectors, mergedKey],
});
effectStyle = {
...effectStyle,
...childEffectStyle,
};
styleStr += `${mergedKey}${parsedStr}`;
} else {
function appendStyle(cssKey: string, cssValue: any) {
if (
process.env.NODE_ENV !== 'production' &&
(typeof value !== 'object' || !(value as any)?.[SKIP_CHECK])
) {
[contentQuotesLinter, hashedAnimationLinter, ...linters].forEach(linter =>
linter(cssKey, cssValue, { path, hashId, parentSelectors }),
);
}
//
const styleName = cssKey.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`);
// Auto suffix with px
let formatValue = cssValue;
if (!unitless[cssKey] && typeof formatValue === 'number' && formatValue !== 0) {
formatValue = `${formatValue}px`;
}
// handle animationName & Keyframe value
if (cssKey === 'animationName' && (cssValue as Keyframes)?._keyframe) {
parseKeyframes(cssValue as Keyframes);
formatValue = (cssValue as Keyframes).getName(hashId);
}
styleStr += `${styleName}:${formatValue};`;
}
const actualValue = (value as any)?.value ?? value;
if (
typeof value === 'object' &&
(value as any)?.[MULTI_VALUE] &&
Array.isArray(actualValue)
) {
actualValue.forEach(item => {
appendStyle(key, item);
});
} else {
appendStyle(key, actualValue);
}
}
});
}
});
if (!root) {
styleStr = `{${styleStr}}`;
} else if (layer && supportLayer()) {
const layerCells = layer.split(',');
const layerName = layerCells[layerCells.length - 1].trim();
styleStr = `@layer ${layerName} {${styleStr}}`;
// Order of layer if needed
if (layerCells.length > 1) {
// zombieJ: stylis do not support layer order, so we need to handle it manually.
styleStr = `@layer ${layer}{%%%:%}${styleStr}`;
}
}
return [styleStr, effectStyle];
};
// ============================================================================
// == Register ==
// ============================================================================
function uniqueHash(path: (string | number)[], styleStr: string) {
return hash(`${path.join('%')}${styleStr}`);
}
// function Empty() {
// return null;
// }
/**
* Register a style to the global style sheet.
*/
export default function useStyleRegister(
info: Ref<{
theme: Theme<any, any>;
token: any;
path: string[];
hashId?: string;
layer?: string;
nonce?: string | (() => string);
clientOnly?: boolean;
/**
* Tell cssinjs the insert order of style.
* It's useful when you need to insert style
* before other style to overwrite for the same selector priority.
*/
order?: number;
}>,
styleFn: () => CSSInterpolation,
) {
const styleContext = useStyleInject();
const tokenKey = computed(() => info.value.token._tokenKey as string);
const fullPath = computed(() => [tokenKey.value, ...info.value.path]);
// Check if need insert style
let isMergedClientSide = isClientSide;
if (process.env.NODE_ENV !== 'production' && styleContext.value.mock !== undefined) {
isMergedClientSide = styleContext.value.mock === 'client';
}
// const [cacheStyle[0], cacheStyle[1], cacheStyle[2]]
useGlobalCache<
[
styleStr: string,
tokenKey: string,
styleId: string,
effectStyle: Record<string, string>,
clientOnly: boolean | undefined,
order: number,
]
>(
'style',
fullPath,
// Create cache if needed
() => {
const { path, hashId, layer, nonce, clientOnly, order = 0 } = info.value;
const cachePath = fullPath.value.join('|');
// Get style from SSR inline style directly
if (existPath(cachePath)) {
const [inlineCacheStyleStr, styleHash] = getStyleAndHash(cachePath);
if (inlineCacheStyleStr) {
return [inlineCacheStyleStr, tokenKey.value, styleHash, {}, clientOnly, order];
}
}
const styleObj = styleFn();
const { hashPriority, container, transformers, linters, cache } = styleContext.value;
const [parsedStyle, effectStyle] = parseStyle(styleObj, {
hashId,
hashPriority,
layer,
path: path.join('-'),
transformers,
linters,
});
const styleStr = normalizeStyle(parsedStyle);
const styleId = uniqueHash(fullPath.value, styleStr);
if (isMergedClientSide) {
const mergedCSSConfig: Parameters<typeof updateCSS>[2] = {
mark: ATTR_MARK,
prepend: 'queue',
attachTo: container,
priority: order,
};
const nonceStr = typeof nonce === 'function' ? nonce() : nonce;
if (nonceStr) {
mergedCSSConfig.csp = { nonce: nonceStr };
}
const style = updateCSS(styleStr, styleId, mergedCSSConfig);
(style as any)[CSS_IN_JS_INSTANCE] = cache.instanceId;
// Used for `useCacheToken` to remove on batch when token removed
style.setAttribute(ATTR_TOKEN, tokenKey.value);
// Dev usage to find which cache path made this easily
if (process.env.NODE_ENV !== 'production') {
style.setAttribute(ATTR_CACHE_PATH, fullPath.value.join('|'));
}
// Inject client side effect style
Object.keys(effectStyle).forEach(effectKey => {
if (!globalEffectStyleKeys.has(effectKey)) {
globalEffectStyleKeys.add(effectKey);
// Inject
updateCSS(normalizeStyle(effectStyle[effectKey]), `_effect-${effectKey}`, {
mark: ATTR_MARK,
prepend: 'queue',
attachTo: container,
});
}
});
}
return [styleStr, tokenKey.value, styleId, effectStyle, clientOnly, order];
},
// Remove cache if no need
([, , styleId], fromHMR) => {
if ((fromHMR || styleContext.value.autoClear) && isClientSide) {
removeCSS(styleId, { mark: ATTR_MARK });
}
},
);
return (node: VueNode) => {
return node;
// let styleNode: VueNode;
// if (!styleContext.ssrInline || isMergedClientSide || !styleContext.defaultCache) {
// styleNode = <Empty />;
// } else {
// styleNode = (
// <style
// {...{
// [ATTR_TOKEN]: cacheStyle.value[1],
// [ATTR_MARK]: cacheStyle.value[2],
// }}
// innerHTML={cacheStyle.value[0]}
// />
// );
// }
// return (
// <>
// {styleNode}
// {node}
// </>
// );
};
}
// ============================================================================
// == SSR ==
// ============================================================================
export function extractStyle(cache: Cache, plain = false) {
const matchPrefix = `style%`;
// prefix with `style` is used for `useStyleRegister` to cache style context
const styleKeys = Array.from(cache.cache.keys()).filter(key => key.startsWith(matchPrefix));
// Common effect styles like animation
const effectStyles: Record<string, boolean> = {};
// Mapping of cachePath to style hash
const cachePathMap: Record<string, string> = {};
let styleText = '';
function toStyleStr(
style: string,
tokenKey?: string,
styleId?: string,
customizeAttrs: Record<string, string> = {},
) {
const attrs: Record<string, string | undefined> = {
...customizeAttrs,
[ATTR_TOKEN]: tokenKey,
[ATTR_MARK]: styleId,
};
const attrStr = Object.keys(attrs)
.map(attr => {
const val = attrs[attr];
return val ? `${attr}="${val}"` : null;
})
.filter(v => v)
.join(' ');
return plain ? style : `<style ${attrStr}>${style}</style>`;
}
// ====================== Fill Style ======================
type OrderStyle = [order: number, style: string];
const orderStyles: OrderStyle[] = styleKeys
.map(key => {
const cachePath = key.slice(matchPrefix.length).replace(/%/g, '|');
const [styleStr, tokenKey, styleId, effectStyle, clientOnly, order]: [
string,
string,
string,
Record<string, string>,
boolean,
number,
] = cache.cache.get(key)![1];
// Skip client only style
if (clientOnly) {
return null! as OrderStyle;
}
// ====================== Style ======================
// Used for vc-util
const sharedAttrs = {
'data-vc-order': 'prependQueue',
'data-vc-priority': `${order}`,
};
let keyStyleText = toStyleStr(styleStr, tokenKey, styleId, sharedAttrs);
// Save cache path with hash mapping
cachePathMap[cachePath] = styleId;
// =============== Create effect style ===============
if (effectStyle) {
Object.keys(effectStyle).forEach(effectKey => {
// Effect style can be reused
if (!effectStyles[effectKey]) {
effectStyles[effectKey] = true;
keyStyleText += toStyleStr(
normalizeStyle(effectStyle[effectKey]),
tokenKey,
`_effect-${effectKey}`,
sharedAttrs,
);
}
});
}
const ret: OrderStyle = [order, keyStyleText];
return ret;
})
.filter(o => o);
orderStyles
.sort((o1, o2) => o1[0] - o2[0])
.forEach(([, style]) => {
styleText += style;
});
// ==================== Fill Cache Path ====================
styleText += toStyleStr(
`.${ATTR_CACHE_MAP}{content:"${serializeCacheMap(cachePathMap)}";}`,
undefined,
undefined,
{
[ATTR_CACHE_MAP]: ATTR_CACHE_MAP,
},
);
return styleText;
}

View File

@ -0,0 +1,77 @@
import useCacheToken from './hooks/useCacheToken';
import type { CSSInterpolation, CSSObject } from './hooks/useStyleRegister';
import useStyleRegister, { extractStyle } from './hooks/useStyleRegister';
import Keyframes from './Keyframes';
import type { Linter } from './linters';
import { legacyNotSelectorLinter, logicalPropertiesLinter, parentSelectorLinter } from './linters';
import type { StyleContextProps, StyleProviderProps } from './StyleContext';
import { createCache, useStyleInject, useStyleProvider, StyleProvider } from './StyleContext';
import type { DerivativeFunc, TokenType } from './theme';
import { createTheme, Theme } from './theme';
import type { Transformer } from './transformers/interface';
import legacyLogicalPropertiesTransformer from './transformers/legacyLogicalProperties';
import px2remTransformer from './transformers/px2rem';
import { supportLogicProps, supportWhere } from './util';
const cssinjs = {
Theme,
createTheme,
useStyleRegister,
useCacheToken,
createCache,
useStyleInject,
useStyleProvider,
Keyframes,
extractStyle,
// Transformer
legacyLogicalPropertiesTransformer,
px2remTransformer,
// Linters
logicalPropertiesLinter,
legacyNotSelectorLinter,
parentSelectorLinter,
// cssinjs
StyleProvider,
};
export {
Theme,
createTheme,
useStyleRegister,
useCacheToken,
createCache,
useStyleInject,
useStyleProvider,
Keyframes,
extractStyle,
// Transformer
legacyLogicalPropertiesTransformer,
px2remTransformer,
// Linters
logicalPropertiesLinter,
legacyNotSelectorLinter,
parentSelectorLinter,
// cssinjs
StyleProvider,
};
export type {
TokenType,
CSSObject,
CSSInterpolation,
DerivativeFunc,
Transformer,
Linter,
StyleContextProps,
StyleProviderProps,
};
export const _experimental = {
supportModernCSS: () => supportWhere() && supportLogicProps(),
};
export default cssinjs;

View File

@ -0,0 +1,25 @@
import type { Linter } from './interface';
import { lintWarning } from './utils';
const linter: Linter = (key, value, info) => {
if (key === 'content') {
// From emotion: https://github.com/emotion-js/emotion/blob/main/packages/serialize/src/index.js#L63
const contentValuePattern =
/(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
const contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
if (
typeof value !== 'string' ||
(contentValues.indexOf(value) === -1 &&
!contentValuePattern.test(value) &&
(value.charAt(0) !== value.charAt(value.length - 1) ||
(value.charAt(0) !== '"' && value.charAt(0) !== "'")))
) {
lintWarning(
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\`.`,
info,
);
}
}
};
export default linter;

View File

@ -0,0 +1,15 @@
import type { Linter } from './interface';
import { lintWarning } from './utils';
const linter: Linter = (key, value, info) => {
if (key === 'animation') {
if (info.hashId && value !== 'none') {
lintWarning(
`You seem to be using hashed animation '${value}', in which case 'animationName' with Keyframe as value is recommended.`,
info,
);
}
}
};
export default linter;

View File

@ -0,0 +1,6 @@
export { default as contentQuotesLinter } from './contentQuotesLinter';
export { default as hashedAnimationLinter } from './hashedAnimationLinter';
export type { Linter } from './interface';
export { default as legacyNotSelectorLinter } from './legacyNotSelectorLinter';
export { default as logicalPropertiesLinter } from './logicalPropertiesLinter';
export { default as parentSelectorLinter } from './parentSelectorLinter';

View File

@ -0,0 +1,9 @@
export interface LinterInfo {
path?: string;
hashId?: string;
parentSelectors: string[];
}
export interface Linter {
(key: string, value: string | number, info: LinterInfo): void;
}

View File

@ -0,0 +1,33 @@
import type { Linter, LinterInfo } from './interface';
import { lintWarning } from './utils';
function isConcatSelector(selector: string) {
const notContent = selector.match(/:not\(([^)]*)\)/)?.[1] || '';
// split selector. e.g.
// `h1#a.b` => ['h1', #a', '.b']
const splitCells = notContent.split(/(\[[^[]*])|(?=[.#])/).filter(str => str);
return splitCells.length > 1;
}
function parsePath(info: LinterInfo) {
return info.parentSelectors.reduce((prev, cur) => {
if (!prev) {
return cur;
}
return cur.includes('&') ? cur.replace(/&/g, prev) : `${prev} ${cur}`;
}, '');
}
const linter: Linter = (_key, _value, info) => {
const parentSelectorPath = parsePath(info);
const notList = parentSelectorPath.match(/:not\([^)]*\)/g) || [];
if (notList.length > 0 && notList.some(isConcatSelector)) {
lintWarning(`Concat ':not' selector not support in legacy browsers.`, info);
}
};
export default linter;

View File

@ -0,0 +1,88 @@
import type { Linter } from './interface';
import { lintWarning } from './utils';
const linter: Linter = (key, value, info) => {
switch (key) {
case 'marginLeft':
case 'marginRight':
case 'paddingLeft':
case 'paddingRight':
case 'left':
case 'right':
case 'borderLeft':
case 'borderLeftWidth':
case 'borderLeftStyle':
case 'borderLeftColor':
case 'borderRight':
case 'borderRightWidth':
case 'borderRightStyle':
case 'borderRightColor':
case 'borderTopLeftRadius':
case 'borderTopRightRadius':
case 'borderBottomLeftRadius':
case 'borderBottomRightRadius':
lintWarning(
`You seem to be using non-logical property '${key}' which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
info,
);
return;
case 'margin':
case 'padding':
case 'borderWidth':
case 'borderStyle':
// case 'borderColor':
if (typeof value === 'string') {
const valueArr = value.split(' ').map(item => item.trim());
if (valueArr.length === 4 && valueArr[1] !== valueArr[3]) {
lintWarning(
`You seem to be using '${key}' property with different left ${key} and right ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
info,
);
}
}
return;
case 'clear':
case 'textAlign':
if (value === 'left' || value === 'right') {
lintWarning(
`You seem to be using non-logical value '${value}' of ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
info,
);
}
return;
case 'borderRadius':
if (typeof value === 'string') {
const radiusGroups = value.split('/').map(item => item.trim());
const invalid = radiusGroups.reduce((result, group) => {
if (result) {
return result;
}
const radiusArr = group.split(' ').map(item => item.trim());
// borderRadius: '2px 4px'
if (radiusArr.length >= 2 && radiusArr[0] !== radiusArr[1]) {
return true;
}
// borderRadius: '4px 4px 2px'
if (radiusArr.length === 3 && radiusArr[1] !== radiusArr[2]) {
return true;
}
// borderRadius: '4px 4px 2px 4px'
if (radiusArr.length === 4 && radiusArr[2] !== radiusArr[3]) {
return true;
}
return result;
}, false);
if (invalid) {
lintWarning(
`You seem to be using non-logical value '${value}' of ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`,
info,
);
}
}
return;
default:
}
};
export default linter;

View File

@ -0,0 +1,15 @@
import type { Linter } from '..';
import { lintWarning } from './utils';
const linter: Linter = (_key, _value, info) => {
if (
info.parentSelectors.some(selector => {
const selectors = selector.split(',');
return selectors.some(item => item.split('&').length > 2);
})
) {
lintWarning('Should not use more than one `&` in a selector.', info);
}
};
export default linter;

View File

@ -0,0 +1,13 @@
import devWarning from '../../../vc-util/warning';
import type { LinterInfo } from './interface';
export function lintWarning(message: string, info: LinterInfo) {
const { path, parentSelectors } = info;
devWarning(
false,
`[Ant Design Vue CSS-in-JS] ${path ? `Error in '${path}': ` : ''}${message}${
parentSelectors.length ? ` Selector info: ${parentSelectors.join(' -> ')}` : ''
}`,
);
}

View File

@ -0,0 +1,38 @@
import warning from '../../warning';
import type { DerivativeFunc, TokenType } from './interface';
let uuid = 0;
/**
* Theme with algorithms to derive tokens from design tokens.
* Use `createTheme` first which will help to manage the theme instance cache.
*/
export default class Theme<DesignToken extends TokenType, DerivativeToken extends TokenType> {
private derivatives: DerivativeFunc<DesignToken, DerivativeToken>[];
public readonly id: number;
constructor(
derivatives:
| DerivativeFunc<DesignToken, DerivativeToken>
| DerivativeFunc<DesignToken, DerivativeToken>[],
) {
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
this.id = uuid;
if (derivatives.length === 0) {
warning(
derivatives.length > 0,
'[Ant Design Vue CSS-in-JS] Theme should have at least one derivative function.',
);
}
uuid += 1;
}
getDerivativeToken(token: DesignToken): DerivativeToken {
return this.derivatives.reduce<DerivativeToken>(
(result, derivative) => derivative(token, result),
undefined as any,
);
}
}

View File

@ -0,0 +1,135 @@
import type Theme from './Theme';
import type { DerivativeFunc } from './interface';
// ================================== Cache ==================================
type ThemeCacheMap = Map<
DerivativeFunc<any, any>,
{
map?: ThemeCacheMap;
value?: [Theme<any, any>, number];
}
>;
type DerivativeOptions = DerivativeFunc<any, any>[];
export function sameDerivativeOption(left: DerivativeOptions, right: DerivativeOptions) {
if (left.length !== right.length) {
return false;
}
for (let i = 0; i < left.length; i++) {
if (left[i] !== right[i]) {
return false;
}
}
return true;
}
export default class ThemeCache {
public static MAX_CACHE_SIZE = 20;
public static MAX_CACHE_OFFSET = 5;
private readonly cache: ThemeCacheMap;
private keys: DerivativeOptions[];
private cacheCallTimes: number;
constructor() {
this.cache = new Map();
this.keys = [];
this.cacheCallTimes = 0;
}
public size(): number {
return this.keys.length;
}
private internalGet(
derivativeOption: DerivativeOptions,
updateCallTimes = false,
): [Theme<any, any>, number] | undefined {
let cache: ReturnType<ThemeCacheMap['get']> = { map: this.cache };
derivativeOption.forEach(derivative => {
if (!cache) {
cache = undefined;
} else {
cache = cache?.map?.get(derivative);
}
});
if (cache?.value && updateCallTimes) {
cache.value[1] = this.cacheCallTimes++;
}
return cache?.value;
}
public get(derivativeOption: DerivativeOptions): Theme<any, any> | undefined {
return this.internalGet(derivativeOption, true)?.[0];
}
public has(derivativeOption: DerivativeOptions): boolean {
return !!this.internalGet(derivativeOption);
}
public set(derivativeOption: DerivativeOptions, value: Theme<any, any>): void {
// New cache
if (!this.has(derivativeOption)) {
if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) {
const [targetKey] = this.keys.reduce<[DerivativeOptions, number]>(
(result, key) => {
const [, callTimes] = result;
if (this.internalGet(key)![1] < callTimes) {
return [key, this.internalGet(key)![1]];
}
return result;
},
[this.keys[0], this.cacheCallTimes],
);
this.delete(targetKey);
}
this.keys.push(derivativeOption);
}
let cache = this.cache;
derivativeOption.forEach((derivative, index) => {
if (index === derivativeOption.length - 1) {
cache.set(derivative, { value: [value, this.cacheCallTimes++] });
} else {
const cacheValue = cache.get(derivative);
if (!cacheValue) {
cache.set(derivative, { map: new Map() });
} else if (!cacheValue.map) {
cacheValue.map = new Map();
}
cache = cache.get(derivative)!.map!;
}
});
}
private deleteByPath(
currentCache: ThemeCacheMap,
derivatives: DerivativeFunc<any, any>[],
): Theme<any, any> | undefined {
const cache = currentCache.get(derivatives[0])!;
if (derivatives.length === 1) {
if (!cache.map) {
currentCache.delete(derivatives[0]);
} else {
currentCache.set(derivatives[0], { map: cache.map });
}
return cache.value?.[0];
}
const result = this.deleteByPath(cache.map!, derivatives.slice(1));
if ((!cache.map || cache.map.size === 0) && !cache.value) {
currentCache.delete(derivatives[0]);
}
return result;
}
public delete(derivativeOption: DerivativeOptions): Theme<any, any> | undefined {
// If cache exists
if (this.has(derivativeOption)) {
this.keys = this.keys.filter(item => !sameDerivativeOption(item, derivativeOption));
return this.deleteByPath(this.cache, derivativeOption);
}
return undefined;
}
}

View File

@ -0,0 +1,26 @@
import ThemeCache from './ThemeCache';
import Theme from './Theme';
import type { DerivativeFunc, TokenType } from './interface';
const cacheThemes = new ThemeCache();
/**
* Same as new Theme, but will always return same one if `derivative` not changed.
*/
export default function createTheme<
DesignToken extends TokenType,
DerivativeToken extends TokenType,
>(
derivatives:
| DerivativeFunc<DesignToken, DerivativeToken>[]
| DerivativeFunc<DesignToken, DerivativeToken>,
) {
const derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
// Create new theme if not exist
if (!cacheThemes.has(derivativeArr)) {
cacheThemes.set(derivativeArr, new Theme(derivativeArr));
}
// Get theme from cache and return
return cacheThemes.get(derivativeArr)!;
}

View File

@ -0,0 +1,4 @@
export { default as createTheme } from './createTheme';
export { default as Theme } from './Theme';
export { default as ThemeCache } from './ThemeCache';
export type { TokenType, DerivativeFunc } from './interface';

View File

@ -0,0 +1,5 @@
export type TokenType = object;
export type DerivativeFunc<DesignToken extends TokenType, DerivativeToken extends TokenType> = (
designToken: DesignToken,
derivativeToken?: DerivativeToken,
) => DerivativeToken;

View File

@ -0,0 +1,5 @@
import type { CSSObject } from '..';
export interface Transformer {
visit?: (cssObj: CSSObject) => CSSObject;
}

View File

@ -0,0 +1,162 @@
import type { CSSObject } from '..';
import type { Transformer } from './interface';
function splitValues(value: string | number) {
if (typeof value === 'number') {
return [value];
}
const splitStyle = String(value).split(/\s+/);
// Combine styles split in brackets, like `calc(1px + 2px)`
let temp = '';
let brackets = 0;
return splitStyle.reduce<string[]>((list, item) => {
if (item.includes('(')) {
temp += item;
brackets += item.split('(').length - 1;
} else if (item.includes(')')) {
temp += ` ${item}`;
brackets -= item.split(')').length - 1;
if (brackets === 0) {
list.push(temp);
temp = '';
}
} else if (brackets > 0) {
temp += ` ${item}`;
} else {
list.push(item);
}
return list;
}, []);
}
type MatchValue = string[] & {
notSplit?: boolean;
};
function noSplit(list: MatchValue): MatchValue {
list.notSplit = true;
return list;
}
const keyMap: Record<string, MatchValue> = {
// Inset
inset: ['top', 'right', 'bottom', 'left'],
insetBlock: ['top', 'bottom'],
insetBlockStart: ['top'],
insetBlockEnd: ['bottom'],
insetInline: ['left', 'right'],
insetInlineStart: ['left'],
insetInlineEnd: ['right'],
// Margin
marginBlock: ['marginTop', 'marginBottom'],
marginBlockStart: ['marginTop'],
marginBlockEnd: ['marginBottom'],
marginInline: ['marginLeft', 'marginRight'],
marginInlineStart: ['marginLeft'],
marginInlineEnd: ['marginRight'],
// Padding
paddingBlock: ['paddingTop', 'paddingBottom'],
paddingBlockStart: ['paddingTop'],
paddingBlockEnd: ['paddingBottom'],
paddingInline: ['paddingLeft', 'paddingRight'],
paddingInlineStart: ['paddingLeft'],
paddingInlineEnd: ['paddingRight'],
// Border
borderBlock: noSplit(['borderTop', 'borderBottom']),
borderBlockStart: noSplit(['borderTop']),
borderBlockEnd: noSplit(['borderBottom']),
borderInline: noSplit(['borderLeft', 'borderRight']),
borderInlineStart: noSplit(['borderLeft']),
borderInlineEnd: noSplit(['borderRight']),
// Border width
borderBlockWidth: ['borderTopWidth', 'borderBottomWidth'],
borderBlockStartWidth: ['borderTopWidth'],
borderBlockEndWidth: ['borderBottomWidth'],
borderInlineWidth: ['borderLeftWidth', 'borderRightWidth'],
borderInlineStartWidth: ['borderLeftWidth'],
borderInlineEndWidth: ['borderRightWidth'],
// Border style
borderBlockStyle: ['borderTopStyle', 'borderBottomStyle'],
borderBlockStartStyle: ['borderTopStyle'],
borderBlockEndStyle: ['borderBottomStyle'],
borderInlineStyle: ['borderLeftStyle', 'borderRightStyle'],
borderInlineStartStyle: ['borderLeftStyle'],
borderInlineEndStyle: ['borderRightStyle'],
// Border color
borderBlockColor: ['borderTopColor', 'borderBottomColor'],
borderBlockStartColor: ['borderTopColor'],
borderBlockEndColor: ['borderBottomColor'],
borderInlineColor: ['borderLeftColor', 'borderRightColor'],
borderInlineStartColor: ['borderLeftColor'],
borderInlineEndColor: ['borderRightColor'],
// Border radius
borderStartStartRadius: ['borderTopLeftRadius'],
borderStartEndRadius: ['borderTopRightRadius'],
borderEndStartRadius: ['borderBottomLeftRadius'],
borderEndEndRadius: ['borderBottomRightRadius'],
};
function skipCheck(value: string | number) {
return { _skip_check_: true, value };
}
/**
* Convert css logical properties to legacy properties.
* Such as: `margin-block-start` to `margin-top`.
* Transform list:
* - inset
* - margin
* - padding
* - border
*/
const transform: Transformer = {
visit: cssObj => {
const clone: CSSObject = {};
Object.keys(cssObj).forEach(key => {
const value = cssObj[key];
const matchValue = keyMap[key];
if (matchValue && (typeof value === 'number' || typeof value === 'string')) {
const values = splitValues(value);
if (matchValue.length && matchValue.notSplit) {
// not split means always give same value like border
matchValue.forEach(matchKey => {
clone[matchKey] = skipCheck(value);
});
} else if (matchValue.length === 1) {
// Handle like `marginBlockStart` => `marginTop`
clone[matchValue[0]] = skipCheck(value);
} else if (matchValue.length === 2) {
// Handle like `marginBlock` => `marginTop` & `marginBottom`
matchValue.forEach((matchKey, index) => {
clone[matchKey] = skipCheck(values[index] ?? values[0]);
});
} else if (matchValue.length === 4) {
// Handle like `inset` => `top` & `right` & `bottom` & `left`
matchValue.forEach((matchKey, index) => {
clone[matchKey] = skipCheck(values[index] ?? values[index - 2] ?? values[0]);
});
} else {
clone[key] = value;
}
} else {
clone[key] = value;
}
});
return clone;
},
};
export default transform;

View File

@ -0,0 +1,76 @@
/**
* respect https://github.com/cuth/postcss-pxtorem
*/
import unitless from '@emotion/unitless';
import type { CSSObject } from '..';
import type { Transformer } from './interface';
export interface Options {
/**
* The root font size.
* @default 16
*/
rootValue?: number;
/**
* The decimal numbers to allow the REM units to grow to.
* @default 5
*/
precision?: number;
/**
* Whether to allow px to be converted in media queries.
* @default false
*/
mediaQuery?: boolean;
}
const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/g;
function toFixed(number: number, precision: number) {
const multiplier = Math.pow(10, precision + 1),
wholeNumber = Math.floor(number * multiplier);
return (Math.round(wholeNumber / 10) * 10) / multiplier;
}
const transform = (options: Options = {}): Transformer => {
const { rootValue = 16, precision = 5, mediaQuery = false } = options;
const pxReplace = (m: string, $1: any) => {
if (!$1) return m;
const pixels = parseFloat($1);
// covenant: pixels <= 1, not transform to rem @zombieJ
if (pixels <= 1) return m;
const fixedVal = toFixed(pixels / rootValue, precision);
return `${fixedVal}rem`;
};
const visit = (cssObj: CSSObject): CSSObject => {
const clone: CSSObject = { ...cssObj };
Object.entries(cssObj).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('px')) {
const newValue = value.replace(pxRegex, pxReplace);
clone[key] = newValue;
}
// no unit
if (!unitless[key] && typeof value === 'number' && value !== 0) {
clone[key] = `${value}px`.replace(pxRegex, pxReplace);
}
// Media queries
const mergedKey = key.trim();
if (mergedKey.startsWith('@') && mergedKey.includes('px') && mediaQuery) {
const newKey = key.replace(pxRegex, pxReplace);
clone[newKey] = clone[key];
delete clone[key];
}
});
return clone;
};
return { visit };
};
export default transform;

View File

@ -0,0 +1,118 @@
import hash from '@emotion/hash';
import { removeCSS, updateCSS } from '../../vc-util/Dom/dynamicCSS';
import canUseDom from '../canUseDom';
import { Theme } from './theme';
// Create a cache here to avoid always loop generate
const flattenTokenCache = new WeakMap<any, string>();
export function flattenToken(token: any) {
let str = flattenTokenCache.get(token) || '';
if (!str) {
Object.keys(token).forEach(key => {
const value = token[key];
str += key;
if (value instanceof Theme) {
str += value.id;
} else if (value && typeof value === 'object') {
str += flattenToken(value);
} else {
str += value;
}
});
// Put in cache
flattenTokenCache.set(token, str);
}
return str;
}
/**
* Convert derivative token to key string
*/
export function token2key(token: any, salt: string): string {
return hash(`${salt}_${flattenToken(token)}`);
}
const randomSelectorKey = `random-${Date.now()}-${Math.random()}`.replace(/\./g, '');
// Magic `content` for detect selector support
const checkContent = '_bAmBoO_';
function supportSelector(
styleStr: string,
handleElement: (ele: HTMLElement) => void,
supportCheck?: (ele: HTMLElement) => boolean,
): boolean {
if (canUseDom()) {
updateCSS(styleStr, randomSelectorKey);
const ele = document.createElement('div');
ele.style.position = 'fixed';
ele.style.left = '0';
ele.style.top = '0';
handleElement?.(ele);
document.body.appendChild(ele);
if (process.env.NODE_ENV !== 'production') {
ele.innerHTML = 'Test';
ele.style.zIndex = '9999999';
}
const support = supportCheck
? supportCheck(ele)
: getComputedStyle(ele).content?.includes(checkContent);
ele.parentNode?.removeChild(ele);
removeCSS(randomSelectorKey);
return support;
}
return false;
}
let canLayer: boolean | undefined = undefined;
export function supportLayer(): boolean {
if (canLayer === undefined) {
canLayer = supportSelector(
`@layer ${randomSelectorKey} { .${randomSelectorKey} { content: "${checkContent}"!important; } }`,
ele => {
ele.className = randomSelectorKey;
},
);
}
return canLayer!;
}
let canWhere: boolean | undefined = undefined;
export function supportWhere(): boolean {
if (canWhere === undefined) {
canWhere = supportSelector(
`:where(.${randomSelectorKey}) { content: "${checkContent}"!important; }`,
ele => {
ele.className = randomSelectorKey;
},
);
}
return canWhere!;
}
let canLogic: boolean | undefined = undefined;
export function supportLogicProps(): boolean {
if (canLogic === undefined) {
canLogic = supportSelector(
`.${randomSelectorKey} { inset-block: 93px !important; }`,
ele => {
ele.className = randomSelectorKey;
},
ele => getComputedStyle(ele).bottom === '93px',
);
}
return canLogic!;
}

View File

@ -0,0 +1,21 @@
type RecordType = Record<string, any>;
function extendsObject<T extends RecordType>(...list: T[]) {
const result: RecordType = { ...list[0] };
for (let i = 1; i < list.length; i++) {
const obj = list[i];
if (obj) {
Object.keys(obj).forEach(key => {
const val = obj[key];
if (val !== undefined) {
result[key] = val;
}
});
}
}
return result;
}
export default extendsObject;

View File

@ -0,0 +1,13 @@
import type { SizeType } from '../config-provider/SizeContext';
export function isPresetSize(size?: SizeType | string | number): size is SizeType {
return ['small', 'middle', 'large'].includes(size as string);
}
export function isValidGapNumber(size?: SizeType | string | number): size is number {
if (!size) {
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
return false;
}
return typeof size === 'number' && !Number.isNaN(size);
}

View File

@ -1,30 +0,0 @@
export function getComponentLocale(props, context, componentName, getDefaultLocale) {
let locale = {};
if (context && context.antLocale && context.antLocale[componentName]) {
locale = context.antLocale[componentName];
} else {
const defaultLocale = getDefaultLocale();
// TODO: make default lang of antd be English
// https://github.com/ant-design/ant-design/issues/6334
locale = defaultLocale.default || defaultLocale;
}
const result = {
...locale,
...props.locale,
};
result.lang = {
...locale.lang,
...props.locale.lang,
};
return result;
}
export function getLocaleCode(context) {
const localeCode = context.antLocale && context.antLocale.locale;
// Had use LocaleProvide but didn't set locale
if (context.antLocale && context.antLocale.exist && !localeCode) {
return 'zh-cn';
}
return localeCode;
}

View File

@ -1,4 +1,4 @@
export function isWindow(obj: any) {
export function isWindow(obj: any): obj is Window {
return obj !== null && obj !== undefined && obj === obj.window;
}
@ -12,16 +12,22 @@ export default function getScroll(
const method = top ? 'scrollTop' : 'scrollLeft';
let result = 0;
if (isWindow(target)) {
result = (target as Window)[top ? 'pageYOffset' : 'pageXOffset'];
result = target[top ? 'scrollY' : 'scrollX'];
} else if (target instanceof Document) {
result = target.documentElement[method];
} else if (target instanceof HTMLElement) {
result = target[method];
} else if (target) {
result = (target as HTMLElement)[method];
// According to the type inference, the `target` is `never` type.
// Since we configured the loose mode type checking, and supports mocking the target with such shape below::
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
// the program may falls into this branch.
// Check the corresponding tests for details. Don't sure what is the real scenario this happens.
result = target[method];
}
if (target && !isWindow(target) && typeof result !== 'number') {
result = ((target as HTMLElement).ownerDocument || (target as Document)).documentElement?.[
method
];
result = ((target.ownerDocument ?? target) as any).documentElement?.[method];
}
return result;
}

View File

@ -28,7 +28,7 @@ export interface ConfigurableLocation {
location?: Location;
}
export const defaultWindow = /* #__PURE__ */ isClient ? window : undefined;
export const defaultDocument = /* #__PURE__ */ isClient ? window.document : undefined;
export const defaultNavigator = /* #__PURE__ */ isClient ? window.navigator : undefined;
export const defaultLocation = /* #__PURE__ */ isClient ? window.location : undefined;
export const defaultWindow = isClient ? window : undefined;
export const defaultDocument = isClient ? window.document : undefined;
export const defaultNavigator = isClient ? window.navigator : undefined;
export const defaultLocation = isClient ? window.location : undefined;

View File

@ -21,8 +21,6 @@ export const rand = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
export const isIOS =
/* #__PURE__ */ isClient &&
window?.navigator?.userAgent &&
/iP(ad|hone|od)/.test(window.navigator.userAgent);
isClient && window?.navigator?.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
export const hasOwn = <T extends object, K extends keyof T>(val: T, key: K): key is K =>
Object.prototype.hasOwnProperty.call(val, key);

View File

@ -1,4 +1,4 @@
import { ref, watch } from 'vue';
import { shallowRef, watch } from 'vue';
import type { MaybeComputedElementRef } from './unrefElement';
import type { UseResizeObserverOptions } from './useResizeObserver';
import { useResizeObserver } from './useResizeObserver';
@ -23,8 +23,8 @@ export function useElementSize(
options: UseResizeObserverOptions = {},
) {
const { box = 'content-box' } = options;
const width = ref(initialSize.width);
const height = ref(initialSize.height);
const width = shallowRef(initialSize.width);
const height = shallowRef(initialSize.height);
useResizeObserver(
target,

View File

@ -0,0 +1,62 @@
import { tryOnScopeDispose } from './tryOnScopeDispose';
import { watch } from 'vue';
import type { MaybeElementRef } from './unrefElement';
import { unrefElement } from './unrefElement';
import { useSupported } from './useSupported';
import type { ConfigurableWindow } from './_configurable';
import { defaultWindow } from './_configurable';
export interface UseMutationObserverOptions extends MutationObserverInit, ConfigurableWindow {}
/**
* Watch for changes being made to the DOM tree.
*
* @see https://vueuse.org/useMutationObserver
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN
* @param target
* @param callback
* @param options
*/
export function useMutationObserver(
target: MaybeElementRef,
callback: MutationCallback,
options: UseMutationObserverOptions = {},
) {
const { window = defaultWindow, ...mutationOptions } = options;
let observer: MutationObserver | undefined;
const isSupported = useSupported(() => window && 'MutationObserver' in window);
const cleanup = () => {
if (observer) {
observer.disconnect();
observer = undefined;
}
};
const stopWatch = watch(
() => unrefElement(target),
el => {
cleanup();
if (isSupported.value && window && el) {
observer = new MutationObserver(callback);
observer!.observe(el, mutationOptions);
}
},
{ immediate: true },
);
const stop = () => {
cleanup();
stopWatch();
};
tryOnScopeDispose(stop);
return {
isSupported,
stop,
};
}
export type UseMutationObserverReturn = ReturnType<typeof useMutationObserver>;

View File

@ -1,9 +1,8 @@
import { tryOnMounted } from './tryOnMounted';
import type { Ref } from 'vue';
import { ref } from 'vue';
import { shallowRef } from 'vue';
export function useSupported(callback: () => unknown, sync = false) {
const isSupported = ref() as Ref<boolean>;
const isSupported = shallowRef<boolean>();
const update = () => (isSupported.value = Boolean(callback()));

View File

@ -1,19 +1,21 @@
import type { Ref } from 'vue';
import { onMounted, onUnmounted, ref } from 'vue';
import { onMounted, onUnmounted, shallowRef } from 'vue';
import type { ScreenMap } from '../../_util/responsiveObserve';
import ResponsiveObserve from '../../_util/responsiveObserve';
import useResponsiveObserve from '../../_util/responsiveObserve';
function useBreakpoint(): Ref<ScreenMap> {
const screens = ref<ScreenMap>({});
const screens = shallowRef<ScreenMap>({});
let token = null;
const responsiveObserve = useResponsiveObserve();
onMounted(() => {
token = ResponsiveObserve.subscribe(supportScreens => {
token = responsiveObserve.value.subscribe(supportScreens => {
screens.value = supportScreens;
});
});
onUnmounted(() => {
ResponsiveObserve.unsubscribe(token);
responsiveObserve.value.unsubscribe(token);
});
return screens;

View File

@ -1,84 +0,0 @@
import type { RequiredMark } from '../../form/Form';
import type { ComputedRef, UnwrapRef } from 'vue';
import { computed, inject } from 'vue';
import type { ConfigProviderProps, CSPConfig, Direction, SizeType } from '../../config-provider';
import { defaultConfigProvider } from '../../config-provider';
import type { VueNode } from '../type';
import type { ValidateMessages } from '../../form/interface';
export default (
name: string,
props: Record<any, any>,
): {
configProvider: UnwrapRef<ConfigProviderProps>;
prefixCls: ComputedRef<string>;
rootPrefixCls: ComputedRef<string>;
direction: ComputedRef<Direction>;
size: ComputedRef<SizeType>;
getTargetContainer: ComputedRef<() => HTMLElement>;
space: ComputedRef<{ size: SizeType | number }>;
pageHeader: ComputedRef<{ ghost: boolean }>;
form?: ComputedRef<{
requiredMark?: RequiredMark;
colon?: boolean;
validateMessages?: ValidateMessages;
}>;
autoInsertSpaceInButton: ComputedRef<boolean>;
renderEmpty?: ComputedRef<(componentName?: string) => VueNode>;
virtual: ComputedRef<boolean>;
dropdownMatchSelectWidth: ComputedRef<boolean | number>;
getPopupContainer: ComputedRef<ConfigProviderProps['getPopupContainer']>;
getPrefixCls: ConfigProviderProps['getPrefixCls'];
autocomplete: ComputedRef<string>;
csp: ComputedRef<CSPConfig>;
} => {
const configProvider = inject<UnwrapRef<ConfigProviderProps>>(
'configProvider',
defaultConfigProvider,
);
const prefixCls = computed(() => configProvider.getPrefixCls(name, props.prefixCls));
const direction = computed(() => props.direction ?? configProvider.direction);
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
const autoInsertSpaceInButton = computed(() => configProvider.autoInsertSpaceInButton);
const renderEmpty = computed(() => configProvider.renderEmpty);
const space = computed(() => configProvider.space);
const pageHeader = computed(() => configProvider.pageHeader);
const form = computed(() => configProvider.form);
const getTargetContainer = computed(
() => props.getTargetContainer || configProvider.getTargetContainer,
);
const getPopupContainer = computed(
() => props.getPopupContainer || configProvider.getPopupContainer,
);
const dropdownMatchSelectWidth = computed<boolean | number>(
() => props.dropdownMatchSelectWidth ?? configProvider.dropdownMatchSelectWidth,
);
const virtual = computed(
() =>
(props.virtual === undefined ? configProvider.virtual !== false : props.virtual !== false) &&
dropdownMatchSelectWidth.value !== false,
);
const size = computed(() => props.size || configProvider.componentSize);
const autocomplete = computed(() => props.autocomplete || configProvider.input?.autocomplete);
const csp = computed(() => configProvider.csp);
return {
configProvider,
prefixCls,
direction,
size,
getTargetContainer,
getPopupContainer,
space,
pageHeader,
form,
autoInsertSpaceInButton,
renderEmpty,
virtual,
dropdownMatchSelectWidth,
rootPrefixCls,
getPrefixCls: configProvider.getPrefixCls,
autocomplete,
csp,
};
};

View File

@ -1,7 +1,7 @@
import { onBeforeUnmount, ref } from 'vue';
import { onBeforeUnmount, shallowRef } from 'vue';
const useDestroyed = () => {
const destroyed = ref(false);
const destroyed = shallowRef(false);
onBeforeUnmount(() => {
destroyed.value = true;
});

View File

@ -1,8 +1,8 @@
import { onMounted, ref } from 'vue';
import { onMounted, shallowRef } from 'vue';
import { detectFlexGapSupported } from '../styleChecker';
export default () => {
const flexible = ref(false);
const flexible = shallowRef(false);
onMounted(() => {
flexible.value = detectFlexGapSupported();
});

View File

@ -0,0 +1,30 @@
import { ref } from 'vue';
import canUseDom from '../../_util/canUseDom';
let uuid = 0;
/** Is client side and not jsdom */
export const isBrowserClient = process.env.NODE_ENV !== 'test' && canUseDom();
/** Get unique id for accessibility usage */
export function getUUID(): number | string {
let retId: string | number;
// Test never reach
/* istanbul ignore if */
if (isBrowserClient) {
retId = uuid;
uuid += 1;
} else {
retId = 'TEST_OR_SSR';
}
return retId;
}
export default function useId(id = ref('')) {
// Inner id for accessibility usage. Only work in client side
const innerId = `vc_unique_${getUUID()}`;
return id.value || innerId;
}

View File

@ -1,5 +1,5 @@
import type { Ref } from 'vue';
import { onBeforeUnmount, ref } from 'vue';
import { onBeforeUnmount, shallowRef } from 'vue';
import raf from '../raf';
export type Updater<State> = (prev: State) => State;
@ -9,11 +9,11 @@ export type Updater<State> = (prev: State) => State;
export function useLayoutState<State>(
defaultState: State,
): [Ref<State>, (updater: Updater<State>) => void] {
const stateRef = ref(defaultState);
const stateRef = shallowRef(defaultState);
let tempState = stateRef.value;
let updateBatchRef = [];
const rafRef = ref();
const rafRef = shallowRef();
function setFrameState(updater: Updater<State>) {
raf.cancel(rafRef.value);
updateBatchRef.push(updater);

View File

@ -0,0 +1,52 @@
import type { Ref } from 'vue';
import { computed, watchEffect } from 'vue';
import { updateCSS, removeCSS } from '../../vc-util/Dom/dynamicCSS';
import getScrollBarSize from '../../_util/getScrollBarSize';
import canUseDom from '../../_util/canUseDom';
const UNIQUE_ID = `vc-util-locker-${Date.now()}`;
let uuid = 0;
/**../vc-util/Dom/dynam
* Test usage export. Do not use in your production
*/
export function isBodyOverflowing() {
return (
document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
window.innerWidth > document.body.offsetWidth
);
}
export default function useScrollLocker(lock?: Ref<boolean>) {
const mergedLock = computed(() => !!lock && !!lock.value);
uuid += 1;
const id = `${UNIQUE_ID}_${uuid}`;
watchEffect(
onClear => {
if (!canUseDom()) {
return;
}
if (mergedLock.value) {
const scrollbarSize = getScrollBarSize();
const isOverflow = isBodyOverflowing();
updateCSS(
`
html body {
overflow-y: hidden;
${isOverflow ? `width: calc(100% - ${scrollbarSize}px);` : ''}
}`,
id,
);
} else {
removeCSS(id);
}
onClear(() => {
removeCSS(id);
});
},
{ flush: 'post' },
);
}

View File

@ -1,30 +0,0 @@
import type { ComputedRef, UnwrapRef } from 'vue';
import { computed, inject, provide } from 'vue';
import type { ConfigProviderProps, SizeType } from '../../config-provider';
import { defaultConfigProvider } from '../../config-provider';
const sizeProvider = Symbol('SizeProvider');
const useProvideSize = <T = SizeType>(props: Record<any, any>): ComputedRef<T> => {
const configProvider = inject<UnwrapRef<ConfigProviderProps>>(
'configProvider',
defaultConfigProvider,
);
const size = computed<T>(() => props.size || configProvider.componentSize);
provide(sizeProvider, size);
return size;
};
const useInjectSize = <T = SizeType>(props?: Record<any, any>): ComputedRef<T> => {
const size: ComputedRef<T> = props
? computed(() => props.size)
: inject(
sizeProvider,
computed(() => 'default' as unknown as T),
);
return size;
};
export { useInjectSize, sizeProvider, useProvideSize };
export default useProvideSize;

View File

@ -1,24 +0,0 @@
let animation;
function isCssAnimationSupported() {
if (animation !== undefined) {
return animation;
}
const domPrefixes = 'Webkit Moz O ms Khtml'.split(' ');
const elm = document.createElement('div');
if (elm.style.animationName !== undefined) {
animation = true;
}
if (animation !== undefined) {
for (let i = 0; i < domPrefixes.length; i++) {
if (elm.style[`${domPrefixes[i]}AnimationName`] !== undefined) {
animation = true;
break;
}
}
}
animation = animation || false;
return animation;
}
export default isCssAnimationSupported;

View File

@ -1,110 +0,0 @@
// MIT License from https://github.com/kaimallea/isMobile
const applePhone = /iPhone/i;
const appleIpod = /iPod/i;
const appleTablet = /iPad/i;
const androidPhone = /\bAndroid(?:.+)Mobile\b/i; // Match 'Android' AND 'Mobile'
const androidTablet = /Android/i;
const amazonPhone = /\bAndroid(?:.+)SD4930UR\b/i;
const amazonTablet = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i;
const windowsPhone = /Windows Phone/i;
const windowsTablet = /\bWindows(?:.+)ARM\b/i; // Match 'Windows' AND 'ARM'
const otherBlackberry = /BlackBerry/i;
const otherBlackberry10 = /BB10/i;
const otherOpera = /Opera Mini/i;
const otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
const otherFirefox = /Mobile(?:.+)Firefox\b/i; // Match 'Mobile' AND 'Firefox'
function match(regex, userAgent) {
return regex.test(userAgent);
}
function isMobile(userAgent) {
let ua = userAgent || (typeof navigator !== 'undefined' ? navigator.userAgent : '');
// Facebook mobile app's integrated browser adds a bunch of strings that
// match everything. Strip it out if it exists.
let tmp = ua.split('[FBAN');
if (typeof tmp[1] !== 'undefined') {
[ua] = tmp;
}
// Twitter mobile app's integrated browser on iPad adds a "Twitter for
// iPhone" string. Same probably happens on other tablet platforms.
// This will confuse detection so strip it out if it exists.
tmp = ua.split('Twitter');
if (typeof tmp[1] !== 'undefined') {
[ua] = tmp;
}
const result = {
apple: {
phone: match(applePhone, ua) && !match(windowsPhone, ua),
ipod: match(appleIpod, ua),
tablet: !match(applePhone, ua) && match(appleTablet, ua) && !match(windowsPhone, ua),
device:
(match(applePhone, ua) || match(appleIpod, ua) || match(appleTablet, ua)) &&
!match(windowsPhone, ua),
},
amazon: {
phone: match(amazonPhone, ua),
tablet: !match(amazonPhone, ua) && match(amazonTablet, ua),
device: match(amazonPhone, ua) || match(amazonTablet, ua),
},
android: {
phone:
(!match(windowsPhone, ua) && match(amazonPhone, ua)) ||
(!match(windowsPhone, ua) && match(androidPhone, ua)),
tablet:
!match(windowsPhone, ua) &&
!match(amazonPhone, ua) &&
!match(androidPhone, ua) &&
(match(amazonTablet, ua) || match(androidTablet, ua)),
device:
(!match(windowsPhone, ua) &&
(match(amazonPhone, ua) ||
match(amazonTablet, ua) ||
match(androidPhone, ua) ||
match(androidTablet, ua))) ||
match(/\bokhttp\b/i, ua),
},
windows: {
phone: match(windowsPhone, ua),
tablet: match(windowsTablet, ua),
device: match(windowsPhone, ua) || match(windowsTablet, ua),
},
other: {
blackberry: match(otherBlackberry, ua),
blackberry10: match(otherBlackberry10, ua),
opera: match(otherOpera, ua),
firefox: match(otherFirefox, ua),
chrome: match(otherChrome, ua),
device:
match(otherBlackberry, ua) ||
match(otherBlackberry10, ua) ||
match(otherOpera, ua) ||
match(otherFirefox, ua) ||
match(otherChrome, ua),
},
// Additional
any: null,
phone: null,
tablet: null,
};
result.any =
result.apple.device || result.android.device || result.windows.device || result.other.device;
// excludes 'other' devices and ipods, targeting touchscreen phones
result.phone = result.apple.phone || result.android.phone || result.windows.phone;
result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;
return result;
}
const defaultResult = {
...isMobile(),
isMobile,
};
export default defaultResult;

View File

@ -3,7 +3,7 @@
* https://github.com/akiran/json2mq.git
*/
const camel2hyphen = function (str) {
const camel2hyphen = function (str: string) {
return str
.replace(/[A-Z]/g, function (match) {
return '-' + match.toLowerCase();
@ -11,12 +11,12 @@ const camel2hyphen = function (str) {
.toLowerCase();
};
const isDimension = function (feature) {
const isDimension = function (feature: string) {
const re = /[height|width]$/;
return re.test(feature);
};
const obj2mq = function (obj) {
const obj2mq = function (obj: { [x: string]: any }) {
let mq = '';
const features = Object.keys(obj);
features.forEach(function (feature, index) {
@ -40,7 +40,7 @@ const obj2mq = function (obj) {
return mq;
};
export default function (query) {
export default function (query: any[]) {
let mq = '';
if (typeof query === 'string') {
return query;

View File

@ -1,19 +1,19 @@
import isPlainObject from 'lodash-es/isPlainObject';
import classNames from '../classNames';
import { isVNode, Fragment, Comment, Text, h } from 'vue';
import { isVNode, Fragment, Comment, Text } from 'vue';
import { camelize, hyphenate, isOn, resolvePropValue } from '../util';
import isValid from '../isValid';
import initDefaultProps from './initDefaultProps';
import type { VueInstance } from '../hooks/_vueuse/unrefElement';
// function getType(fn) {
// const match = fn && fn.toString().match(/^\s*function (\w+)/);
// return match ? match[1] : '';
// }
const splitAttrs = attrs => {
const splitAttrs = (attrs: any) => {
const allAttrs = Object.keys(attrs);
const eventAttrs = {};
const onEvents = {};
const extraAttrs = {};
const eventAttrs: Record<string, any> = {};
const onEvents: Record<string, any> = {};
const extraAttrs: Record<string, any> = {};
for (let i = 0, l = allAttrs.length; i < l; i++) {
const key = allAttrs[i];
if (isOn(key)) {
@ -25,7 +25,7 @@ const splitAttrs = attrs => {
}
return { onEvents, events: eventAttrs, extraAttrs };
};
const parseStyleText = (cssText = '', camel) => {
const parseStyleText = (cssText = '', camel = false) => {
const res = {};
const listDelimiter = /;(?![^(]*\))/g;
const propertyDelimiter = /:(.+)/;
@ -42,35 +42,11 @@ const parseStyleText = (cssText = '', camel) => {
return res;
};
const hasProp = (instance, prop) => {
const hasProp = (instance: any, prop: string) => {
return instance[prop] !== undefined;
};
// 重构后直接使用 hasProp 替换
const slotHasProp = (slot, prop) => {
return hasProp(slot, prop);
};
const getScopedSlots = ele => {
return (ele.data && ele.data.scopedSlots) || {};
};
const getSlots = ele => {
let componentOptions = ele.componentOptions || {};
if (ele.$vnode) {
componentOptions = ele.$vnode.componentOptions || {};
}
const children = ele.children || componentOptions.children || [];
const slots = {};
children.forEach(child => {
if (!isEmptyElement(child)) {
const name = (child.data && child.data.slot) || 'default';
slots[name] = slots[name] || [];
slots[name].push(child);
}
});
return { ...slots, ...getScopedSlots(ele) };
};
export const skipFlattenKey = Symbol('skipFlatten');
const flattenChildren = (children = [], filterEmpty = true) => {
const temp = Array.isArray(children) ? children : [children];
const res = [];
@ -78,7 +54,11 @@ const flattenChildren = (children = [], filterEmpty = true) => {
if (Array.isArray(child)) {
res.push(...flattenChildren(child, filterEmpty));
} else if (child && child.type === Fragment) {
if (child.key === skipFlattenKey) {
res.push(child);
} else {
res.push(...flattenChildren(child.children, filterEmpty));
}
} else if (child && isVNode(child)) {
if (filterEmpty && !isEmptyElement(child)) {
res.push(child);
@ -92,39 +72,29 @@ const flattenChildren = (children = [], filterEmpty = true) => {
return res;
};
const getSlot = (self, name = 'default', options = {}) => {
const getSlot = (self: any, name = 'default', options = {}) => {
if (isVNode(self)) {
if (self.type === Fragment) {
return name === 'default' ? flattenChildren(self.children) : [];
return name === 'default' ? flattenChildren(self.children as any[]) : [];
} else if (self.children && self.children[name]) {
return flattenChildren(self.children[name](options));
} else {
return [];
}
} else {
let res = self.$slots[name] && self.$slots[name](options);
const res = self.$slots[name] && self.$slots[name](options);
return flattenChildren(res);
}
};
const getAllChildren = ele => {
let componentOptions = ele.componentOptions || {};
if (ele.$vnode) {
componentOptions = ele.$vnode.componentOptions || {};
}
return ele.children || componentOptions.children || [];
};
const getSlotOptions = () => {
throw Error('使用 .type 直接取值');
};
const findDOMNode = instance => {
const findDOMNode = (instance: any) => {
let node = instance?.vnode?.el || (instance && (instance.$el || instance));
while (node && !node.tagName) {
node = node.nextSibling;
}
return node;
};
const getOptionProps = instance => {
const getOptionProps = (instance: VueInstance) => {
const res = {};
if (instance.$ && instance.$.vnode) {
const props = instance.$.vnode.props || {};
@ -141,7 +111,7 @@ const getOptionProps = instance => {
Object.keys(originProps).forEach(key => {
props[camelize(key)] = originProps[key];
});
const options = instance.type.props || {};
const options = (instance.type as any).props || {};
Object.keys(options).forEach(k => {
const v = resolvePropValue(options, props, k, props[k]);
if (v !== undefined || k in props) {
@ -151,7 +121,7 @@ const getOptionProps = instance => {
}
return res;
};
const getComponent = (instance, prop = 'default', options = instance, execute = true) => {
const getComponent = (instance: any, prop = 'default', options = instance, execute = true) => {
let com = undefined;
if (instance.$) {
const temp = instance[prop];
@ -179,94 +149,13 @@ const getComponent = (instance, prop = 'default', options = instance, execute =
}
return com;
};
const getComponentFromProp = (instance, prop, options = instance, execute = true) => {
if (instance.$createElement) {
// const h = instance.$createElement;
const temp = instance[prop];
if (temp !== undefined) {
return typeof temp === 'function' && execute ? temp(h, options) : temp;
}
return (
(instance.$scopedSlots[prop] && execute && instance.$scopedSlots[prop](options)) ||
instance.$scopedSlots[prop] ||
instance.$slots[prop] ||
undefined
);
} else {
// const h = instance.context.$createElement;
const temp = getPropsData(instance)[prop];
if (temp !== undefined) {
return typeof temp === 'function' && execute ? temp(h, options) : temp;
}
const slotScope = getScopedSlots(instance)[prop];
if (slotScope !== undefined) {
return typeof slotScope === 'function' && execute ? slotScope(h, options) : slotScope;
}
const slotsProp = [];
const componentOptions = instance.componentOptions || {};
(componentOptions.children || []).forEach(child => {
if (child.data && child.data.slot === prop) {
if (child.data.attrs) {
delete child.data.attrs.slot;
}
if (child.tag === 'template') {
slotsProp.push(child.children);
} else {
slotsProp.push(child);
}
}
});
return slotsProp.length ? slotsProp : undefined;
}
};
const getAllProps = ele => {
let props = getOptionProps(ele);
if (ele.$) {
props = { ...props, ...this.$attrs };
} else {
props = { ...ele.props, ...props };
}
return props;
};
const getPropsData = ins => {
const vnode = ins.$ ? ins.$ : ins;
const res = {};
const originProps = vnode.props || {};
const props = {};
Object.keys(originProps).forEach(key => {
props[camelize(key)] = originProps[key];
});
const options = isPlainObject(vnode.type) ? vnode.type.props : {};
options &&
Object.keys(options).forEach(k => {
const v = resolvePropValue(options, props, k, props[k]);
if (k in props) {
// 仅包含 props不包含默认值
res[k] = v;
}
});
return { ...props, ...res }; // 合并事件、未声明属性等
};
const getValueByProp = (ele, prop) => {
return getPropsData(ele)[prop];
};
const getAttrs = ele => {
let data = ele.data;
if (ele.$vnode) {
data = ele.$vnode.data;
}
return data ? data.attrs || {} : {};
};
const getKey = ele => {
let key = ele.key;
const getKey = (ele: any) => {
const key = ele.key;
return key;
};
export function getEvents(ele = {}, on = true) {
export function getEvents(ele: any = {}, on = true) {
let props = {};
if (ele.$) {
props = { ...props, ...ele.$attrs };
@ -276,27 +165,9 @@ export function getEvents(ele = {}, on = true) {
return splitAttrs(props)[on ? 'onEvents' : 'events'];
}
export function getEvent(child, event) {
return child.props && child.props[event];
}
// 获取 xxx.native 或者 原生标签 事件
export function getDataEvents(child) {
let events = {};
if (child.data && child.data.on) {
events = child.data.on;
}
return { ...events };
}
// use getListeners instead this.$listeners
// https://github.com/vueComponent/ant-design-vue/issues/1705
export function getListeners(context) {
return (context.$vnode ? context.$vnode.componentOptions.listeners : context.$listeners) || {};
}
export function getClass(ele) {
export function getClass(ele: any) {
const props = (isVNode(ele) ? ele.props : ele.$attrs) || {};
let tempCls = props.class || {};
const tempCls = props.class || {};
let cls = {};
if (typeof tempCls === 'string') {
tempCls.split(' ').forEach(c => {
@ -313,7 +184,7 @@ export function getClass(ele) {
}
return cls;
}
export function getStyle(ele, camel) {
export function getStyle(ele: any, camel?: boolean) {
const props = (isVNode(ele) ? ele.props : ele.$attrs) || {};
let style = props.style || {};
if (typeof style === 'string') {
@ -327,19 +198,19 @@ export function getStyle(ele, camel) {
return style;
}
export function getComponentName(opts) {
export function getComponentName(opts: any) {
return opts && (opts.Ctor.options.name || opts.tag);
}
export function isFragment(c) {
export function isFragment(c: any) {
return c.length === 1 && c[0].type === Fragment;
}
export function isEmptyContent(c) {
export function isEmptyContent(c: any) {
return c === undefined || c === null || c === '' || (Array.isArray(c) && c.length === 0);
}
export function isEmptyElement(c) {
export function isEmptyElement(c: any) {
return (
c &&
(c.type === Comment ||
@ -348,11 +219,11 @@ export function isEmptyElement(c) {
);
}
export function isEmptySlot(c) {
export function isEmptySlot(c: any) {
return !c || c().every(isEmptyElement);
}
export function isStringElement(c) {
export function isStringElement(c: any) {
return c && c.type === Text;
}
@ -370,7 +241,7 @@ export function filterEmpty(children = []) {
return res.filter(c => !isEmptyElement(c));
}
export function filterEmptyWithUndefined(children) {
export function filterEmptyWithUndefined(children: any[]) {
if (children) {
const coms = filterEmpty(children);
return coms.length ? coms : undefined;
@ -379,34 +250,18 @@ export function filterEmptyWithUndefined(children) {
}
}
export function mergeProps() {
const args = [].slice.call(arguments, 0);
const props = {};
args.forEach((p = {}) => {
for (const [k, v] of Object.entries(p)) {
props[k] = props[k] || {};
if (isPlainObject(v)) {
Object.assign(props[k], v);
} else {
props[k] = v;
}
}
});
return props;
}
function isValidElement(element) {
function isValidElement(element: any) {
if (Array.isArray(element) && element.length === 1) {
element = element[0];
}
return element && element.__v_isVNode && typeof element.type !== 'symbol'; // remove text node
}
function getPropsSlot(slots, props, prop = 'default') {
function getPropsSlot(slots: any, props: any, prop = 'default') {
return props[prop] ?? slots[prop]?.();
}
export const getTextFromElement = ele => {
export const getTextFromElement = (ele: any) => {
if (isValidElement(ele) && isStringElement(ele[0])) {
return ele[0].children;
}
@ -417,21 +272,12 @@ export {
hasProp,
getOptionProps,
getComponent,
getComponentFromProp,
getSlotOptions,
slotHasProp,
getPropsData,
getKey,
getAttrs,
getValueByProp,
parseStyleText,
initDefaultProps,
isValidElement,
camelize,
getSlots,
getSlot,
getAllProps,
getAllChildren,
findDOMNode,
flattenChildren,
getPropsSlot,

View File

@ -1,26 +1,35 @@
import { computed } from 'vue';
import type { GlobalToken } from '../theme/interface';
import { useToken } from '../theme/internal';
export type Breakpoint = 'xxxl' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
export type BreakpointMap = Record<Breakpoint, string>;
export type ScreenMap = Partial<Record<Breakpoint, boolean>>;
export type ScreenSizeMap = Partial<Record<Breakpoint, number>>;
export const responsiveArray: Breakpoint[] = ['xxxl', 'xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
export const responsiveMap: BreakpointMap = {
xs: '(max-width: 575px)',
sm: '(min-width: 576px)',
md: '(min-width: 768px)',
lg: '(min-width: 992px)',
xl: '(min-width: 1200px)',
xxl: '(min-width: 1600px)',
xxxl: '(min-width: 2000px)',
};
type SubscribeFunc = (screens: ScreenMap) => void;
const getResponsiveMap = (token: GlobalToken): BreakpointMap => ({
xs: `(max-width: ${token.screenXSMax}px)`,
sm: `(min-width: ${token.screenSM}px)`,
md: `(min-width: ${token.screenMD}px)`,
lg: `(min-width: ${token.screenLG}px)`,
xl: `(min-width: ${token.screenXL}px)`,
xxl: `(min-width: ${token.screenXXL}px)`,
xxxl: `{min-width: ${token.screenXXXL}px}`,
});
export default function useResponsiveObserver() {
const [, token] = useToken();
return computed(() => {
const responsiveMap: BreakpointMap = getResponsiveMap(token.value);
const subscribers = new Map<Number, SubscribeFunc>();
let subUid = -1;
let screens = {};
const responsiveObserve = {
return {
matchHandlers: {} as {
[prop: string]: {
mql: MediaQueryList;
@ -39,8 +48,8 @@ const responsiveObserve = {
func(screens);
return subUid;
},
unsubscribe(token: number) {
subscribers.delete(token);
unsubscribe(paramToken: number) {
subscribers.delete(paramToken);
if (!subscribers.size) this.unregister();
},
unregister() {
@ -70,6 +79,7 @@ const responsiveObserve = {
listener(mql);
});
},
responsiveMap,
};
export default responsiveObserve;
});
}

View File

@ -1,6 +1,6 @@
import raf from './raf';
import getScroll, { isWindow } from './getScroll';
import { easeInOutCubic } from './easings';
import getScroll, { isWindow } from './getScroll';
interface ScrollToOptions {
/** Scroll container, default as window */
@ -22,9 +22,9 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) {
const time = timestamp - startTime;
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
if (isWindow(container)) {
(container as Window).scrollTo(window.pageXOffset, nextScrollTop);
} else if (container instanceof HTMLDocument || container.constructor.name === 'HTMLDocument') {
(container as HTMLDocument).documentElement.scrollTop = nextScrollTop;
(container as Window).scrollTo(window.scrollX, nextScrollTop);
} else if (container instanceof Document) {
(container as Document).documentElement.scrollTop = nextScrollTop;
} else {
(container as HTMLElement).scrollTop = nextScrollTop;
}

View File

@ -1,6 +1,6 @@
import { toRaw } from 'vue';
function shallowEqual(objA, objB, compare, compareContext) {
function shallowEqual(objA: any, objB: any, compare?: any, compareContext?: any) {
let ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
@ -45,6 +45,6 @@ function shallowEqual(objA, objB, compare, compareContext) {
return true;
}
export default function (value, other, customizer, thisArg) {
return shallowEqual(toRaw(value), toRaw(other), customizer, thisArg);
export default function (value: any, other: any) {
return shallowEqual(toRaw(value), toRaw(other));
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,82 @@
// import { StyleProvider } from '../../cssinjs';
import { extractStyle } from '../index';
import { ConfigProvider } from '../../../components';
import { theme } from '../../../index';
const testGreenColor = '#008000';
describe('Static-Style-Extract', () => {
it('should extract static styles', () => {
const cssText = extractStyle();
expect(cssText).not.toContain(testGreenColor);
expect(cssText).toMatchSnapshot();
});
it('should extract static styles with customTheme', () => {
const cssText = extractStyle(node => {
return (
<ConfigProvider
theme={{
token: {
colorPrimary: testGreenColor,
},
}}
>
{node}
</ConfigProvider>
);
});
expect(cssText).toContain(testGreenColor);
expect(cssText).toMatchSnapshot();
});
it('should extract static styles with customTheme and customStyle', () => {
const cssText = extractStyle(node => {
return (
<ConfigProvider
theme={{
algorithm: theme.darkAlgorithm,
token: {
colorPrimary: testGreenColor,
},
}}
>
{node}
</ConfigProvider>
);
});
expect(cssText).toContain('#037003');
expect(cssText).toMatchSnapshot();
});
// it('with custom hashPriority', () => {
// const cssText = extractStyle(
// (node) => (
// <StyleProvider hashPriority='high'>
// <ConfigProvider
// theme={{
// token: {
// colorPrimary: testGreenColor,
// },
// }}
// >
// {node}
// </ConfigProvider>
// </StyleProvider>
// ),
// );
// expect(cssText).toContain(testGreenColor);
// expect(cssText).not.toContain(':where');
// expect(cssText).toMatchSnapshot();
//
// const cssText2 = extractStyle((node) => (
// <ConfigProvider
// theme={{
// token: {
// colorPrimary: testGreenColor,
// },
// }}
// >
// {node}
// </ConfigProvider>
// ));
// expect(cssText2).toContain(':where');
// });
});

View File

@ -0,0 +1,90 @@
import { createCache, extractStyle as extStyle, StyleProvider } from '../cssinjs';
import * as antd from '../../components';
import { renderToString } from 'vue/server-renderer';
import type { CustomRender } from './interface';
const blackList: string[] = [
'ConfigProvider',
'Grid',
'Tour',
'SelectOptGroup',
'SelectOption',
'MentionsOption',
'TreeNode',
'TreeSelectNode',
'LocaleProvider',
];
const pickerMap = {
MonthPicker: 'month',
WeekPicker: 'week',
QuarterPicker: 'quarter',
};
const compChildNameMap = {
MenuDivider: 'Menu',
MenuItem: 'Menu',
MenuItemGroup: 'Menu',
SubMenu: 'Menu',
TableColumn: 'Table',
TableColumnGroup: 'Table',
TableSummary: 'Table',
TableSummaryRow: 'Table',
TableSummaryCell: 'Table',
TabPane: 'Tabs',
TimelineItem: 'Timeline',
};
const defaultNode = () => (
<>
{Object.keys(antd)
.filter(name => !blackList.includes(name) && name[0] === name[0].toUpperCase())
.map(compName => {
const Comp = antd[compName];
if (compName === 'Dropdown') {
return (
<Comp key={compName} menu={{ items: [] }}>
<div />
</Comp>
);
}
if (compName === 'Anchor') {
return <Comp key={compName} items={[]} />;
}
if (compName in pickerMap) {
const Comp = antd['DatePicker'];
const type = pickerMap[compName];
return <Comp key={compName} picker={type} />;
}
if (compName in compChildNameMap) {
const ParentComp = antd[compChildNameMap[compName]];
return (
<ParentComp>
<Comp />
</ParentComp>
);
}
if (compName === 'QRCode' || compName === 'Segmented') {
return (
<Comp key={compName} value={''}>
<div />
</Comp>
);
}
return <Comp key={compName} />;
})}
</>
);
export function extractStyle(customTheme?: CustomRender): string {
const cache = createCache();
renderToString(
<StyleProvider cache={cache}>
{customTheme ? customTheme(defaultNode()) : defaultNode()}
</StyleProvider>,
);
// Grab style from cache
const styleText = extStyle(cache, true);
return styleText;
}

Some files were not shown because too many files have changed in this diff Show More