neko-ui 2.8.21 → 2.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/avatar/README.mdx +10 -0
- package/es/avatar/examples/basic.md +14 -0
- package/es/avatar/examples/group.md +57 -0
- package/es/avatar/examples/size.md +21 -0
- package/es/avatar/group.js +2 -2
- package/es/avatar/group.js.map +1 -1
- package/es/avatar/index.js +2 -2
- package/es/avatar/index.js.map +1 -1
- package/es/avatar/style.js +2 -2
- package/es/avatar/style.js.map +1 -1
- package/es/back-top/README.mdx +10 -0
- package/es/back-top/examples/basic.md +19 -0
- package/es/back-top/examples/mount.md +36 -0
- package/es/back-top/examples/target.md +46 -0
- package/es/back-top/index.js +1 -1
- package/es/back-top/index.js.map +1 -1
- package/es/basic-config/README.mdx +11 -0
- package/es/button/README.mdx +10 -0
- package/es/button/examples/basic.md +21 -0
- package/es/button/examples/block.md +33 -0
- package/es/button/examples/circle.md +21 -0
- package/es/button/examples/danger.md +23 -0
- package/es/button/examples/dashed.md +21 -0
- package/es/button/examples/disabled.md +35 -0
- package/es/button/examples/fill.md +21 -0
- package/es/button/examples/flat.md +21 -0
- package/es/button/examples/ghost.md +21 -0
- package/es/button/examples/icon.md +30 -0
- package/es/button/examples/link.md +21 -0
- package/es/button/examples/size.md +23 -0
- package/es/button/index.js +1 -1
- package/es/button/index.js.map +1 -1
- package/es/button/style.js +1 -0
- package/es/button/style.js.map +1 -1
- package/es/capture-screen/README.mdx +10 -0
- package/es/capture-screen/examples/basic.md +13 -0
- package/es/capture-screen/examples/custom-save.md +30 -0
- package/es/capture-screen/examples/preview.md +13 -0
- package/es/capture-screen/examples/recorder-save.md +13 -0
- package/es/capture-screen/index.js +1 -1
- package/es/capture-screen/index.js.map +1 -1
- package/es/carousel/README.mdx +10 -0
- package/es/carousel/examples/autoplay.md +21 -0
- package/es/carousel/examples/basic.md +23 -0
- package/es/carousel/examples/dots.md +23 -0
- package/es/carousel/examples/header.md +38 -0
- package/es/carousel/index.js +1 -1
- package/es/carousel/index.js.map +1 -1
- package/es/checkbox/README.mdx +10 -0
- package/es/checkbox/examples/basic.md +31 -0
- package/es/checkbox/examples/check-all.md +37 -0
- package/es/checkbox/examples/disabled-all.md +28 -0
- package/es/checkbox/examples/disabled-option.md +35 -0
- package/es/checkbox/examples/field-names.md +40 -0
- package/es/checkbox/examples/status.md +37 -0
- package/es/checkbox/examples/vertical.md +36 -0
- package/es/checkbox/index.js +1 -1
- package/es/checkbox/index.js.map +1 -1
- package/es/code/README.mdx +10 -0
- package/es/code/examples/basic.md +19 -0
- package/es/code/examples/diff.md +45 -0
- package/es/code/examples/line-number.md +18 -0
- package/es/code/examples/live-edit.md +20 -0
- package/es/code/examples/toolbar.md +18 -0
- package/es/code/index.js +2 -2
- package/es/code/index.js.map +1 -1
- package/es/code/worker.js.map +1 -1
- package/es/color-palette/README.mdx +10 -0
- package/es/color-palette/examples/default-value.md +25 -0
- package/es/color-palette/examples/hexa.md +13 -0
- package/es/color-palette/examples/hsla.md +13 -0
- package/es/color-palette/examples/rgba.md +13 -0
- package/es/color-palette/index.js +1 -1
- package/es/color-palette/index.js.map +1 -1
- package/es/color-picker/README.mdx +10 -0
- package/es/color-picker/examples/basic.md +12 -0
- package/es/color-picker/examples/default-value.md +20 -0
- package/es/color-picker/examples/size.md +17 -0
- package/es/color-picker/index.js +1 -1
- package/es/color-picker/index.js.map +1 -1
- package/es/cron/README.mdx +10 -0
- package/es/cron/begin-interval.js.map +1 -1
- package/es/cron/day.js.map +1 -1
- package/es/cron/examples/basic.md +19 -0
- package/es/cron/examples/card.md +12 -0
- package/es/cron/examples/show-cron.md +12 -0
- package/es/cron/hour.js +1 -1
- package/es/cron/hour.js.map +1 -1
- package/es/cron/index.js +1 -1
- package/es/cron/index.js.map +1 -1
- package/es/cron/item.js.map +1 -1
- package/es/cron/minute.js +1 -1
- package/es/cron/minute.js.map +1 -1
- package/es/cron/month.js +1 -1
- package/es/cron/month.js.map +1 -1
- package/es/cron/period.js.map +1 -1
- package/es/cron/second.js +1 -1
- package/es/cron/second.js.map +1 -1
- package/es/cron/some.js.map +1 -1
- package/es/date-picker/README.mdx +10 -0
- package/es/date-picker/date.js +1 -1
- package/es/date-picker/date.js.map +1 -1
- package/es/date-picker/dayjs.js +1 -1
- package/es/date-picker/dayjs.js.map +1 -1
- package/es/date-picker/examples/basic.md +24 -0
- package/es/date-picker/examples/date.md +13 -0
- package/es/date-picker/examples/disbaled.md +13 -0
- package/es/date-picker/examples/header.md +13 -0
- package/es/date-picker/examples/month.md +13 -0
- package/es/date-picker/examples/time.md +15 -0
- package/es/date-picker/examples/today.md +13 -0
- package/es/date-picker/examples/year.md +13 -0
- package/es/date-picker/index.js +1 -1
- package/es/date-picker/index.js.map +1 -1
- package/es/date-picker/month.js +1 -1
- package/es/date-picker/month.js.map +1 -1
- package/es/date-picker/panel.js +1 -1
- package/es/date-picker/panel.js.map +1 -1
- package/es/date-picker/time.js +1 -1
- package/es/date-picker/time.js.map +1 -1
- package/es/date-picker/year.js +1 -1
- package/es/date-picker/year.js.map +1 -1
- package/es/dropdown/README.mdx +10 -0
- package/es/dropdown/examples/arrow.md +59 -0
- package/es/dropdown/examples/basic.md +17 -0
- package/es/dropdown/examples/click.md +45 -0
- package/es/dropdown/examples/context-menu.md +66 -0
- package/es/dropdown/examples/field-names.md +44 -0
- package/es/dropdown/examples/icon.md +30 -0
- package/es/dropdown/examples/multiple.md +45 -0
- package/es/dropdown/examples/no-data.md +16 -0
- package/es/dropdown/examples/placement.md +59 -0
- package/es/dropdown/examples/toggle.md +36 -0
- package/es/dropdown/index.js +1 -1
- package/es/dropdown/index.js.map +1 -1
- package/es/empty/index.js.map +1 -1
- package/es/from-schema/index.js +1 -1
- package/es/from-schema/index.js.map +1 -1
- package/es/highlight-text/README.mdx +10 -0
- package/es/highlight-text/examples/basic.md +19 -0
- package/es/highlight-text/examples/mut.md +47 -0
- package/es/highlight-text/examples/not-hightlight.md +19 -0
- package/es/highlight-text/index.js +2 -2
- package/es/highlight-text/index.js.map +1 -1
- package/es/img/README.mdx +10 -0
- package/es/img/examples/basic.md +17 -0
- package/es/img/examples/close-mask.md +21 -0
- package/es/img/examples/disabled.md +16 -0
- package/es/img/examples/error.md +13 -0
- package/es/img/examples/esc.md +21 -0
- package/es/img/examples/open-change.md +25 -0
- package/es/img/index.js +1 -1
- package/es/img/index.js.map +1 -1
- package/es/img/lazy.js +1 -1
- package/es/img/lazy.js.map +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/input/README.mdx +10 -0
- package/es/input/examples/basic.md +31 -0
- package/es/input/examples/prefix&suffix.md +33 -0
- package/es/input/examples/size.md +21 -0
- package/es/input/examples/status.md +23 -0
- package/es/input/index.js +1 -1
- package/es/input/index.js.map +1 -1
- package/es/input-number/README.mdx +10 -0
- package/es/input-number/examples/basic.md +26 -0
- package/es/input-number/examples/formatter.md +36 -0
- package/es/input-number/examples/max-min.md +13 -0
- package/es/input-number/index.js.map +1 -1
- package/es/katex/README.mdx +42 -0
- package/es/katex/examples/block.md +25 -0
- package/es/katex/examples/inline.md +19 -0
- package/es/md/README.mdx +10 -0
- package/es/md/examples/in-children.md +23 -0
- package/es/md/examples/in-text.md +32 -0
- package/es/md/examples/math.md +36 -0
- package/es/md/index.js +1 -1
- package/es/md/index.js.map +1 -1
- package/es/menu/README.mdx +10 -0
- package/es/menu/examples/basic.md +17 -0
- package/es/menu/examples/field-names.md +42 -0
- package/es/menu/examples/icon.md +125 -0
- package/es/menu/examples/multiple.md +42 -0
- package/es/menu/index.js +1 -1
- package/es/menu/index.js.map +1 -1
- package/es/modal/README.mdx +10 -0
- package/es/modal/examples/basic.md +56 -0
- package/es/modal/examples/close-icon.md +57 -0
- package/es/modal/examples/esc-closable.md +64 -0
- package/es/modal/examples/mask-blur.md +56 -0
- package/es/modal/examples/mask-closable.md +64 -0
- package/es/modal/index.js +1 -1
- package/es/modal/index.js.map +1 -1
- package/es/notification/README.mdx +11 -0
- package/es/notification/examples/basic.md +35 -0
- package/es/notification/examples/close.md +35 -0
- package/es/notification/examples/type.md +84 -0
- package/es/notification/examples/update.md +52 -0
- package/es/notification/index.js.map +1 -1
- package/es/notification/notification.js +1 -1
- package/es/notification/notification.js.map +1 -1
- package/es/pagination/README.mdx +10 -0
- package/es/pagination/examples/basic.md +13 -0
- package/es/pagination/examples/onchange.md +29 -0
- package/es/pagination/examples/size.md +23 -0
- package/es/pagination/examples/total-text.md +42 -0
- package/es/pagination/index.js +1 -1
- package/es/pagination/index.js.map +1 -1
- package/es/popover/README.mdx +10 -0
- package/es/popover/examples/basic.md +35 -0
- package/es/popover/examples/click.md +15 -0
- package/es/popover/examples/context-menu.md +58 -0
- package/es/popover/examples/controlled.md +47 -0
- package/es/popover/index.js +1 -1
- package/es/popover/index.js.map +1 -1
- package/es/prism/css.js.map +1 -1
- package/es/prism/index.js.map +1 -1
- package/es/provider/README.mdx +10 -0
- package/es/provider/examples/scheme.md +14 -0
- package/es/provider/index.js.map +1 -1
- package/es/radio/README.mdx +10 -0
- package/es/radio/examples/basic.md +19 -0
- package/es/radio/examples/disabled-option.md +19 -0
- package/es/radio/examples/disabled.md +19 -0
- package/es/radio/examples/field-names.md +39 -0
- package/es/radio/examples/layout-vertical.md +19 -0
- package/es/radio/examples/status.md +31 -0
- package/es/radio/index.js +1 -1
- package/es/radio/index.js.map +1 -1
- package/es/segmented/README.mdx +10 -0
- package/es/segmented/examples/basic.md +18 -0
- package/es/segmented/examples/custom-field-names.md +43 -0
- package/es/segmented/examples/disabled-option.md +29 -0
- package/es/segmented/examples/disabled.md +18 -0
- package/es/segmented/examples/icon.md +28 -0
- package/es/segmented/examples/options.md +21 -0
- package/es/segmented/index.js +2 -2
- package/es/segmented/index.js.map +1 -1
- package/es/select/README.mdx +10 -0
- package/es/select/examples/basic.md +44 -0
- package/es/select/examples/disabled-option.md +21 -0
- package/es/select/examples/disabled.md +24 -0
- package/es/select/examples/field-names.md +40 -0
- package/es/select/examples/item-suffix.md +84 -0
- package/es/select/examples/multiple.md +61 -0
- package/es/select/examples/no-data.md +12 -0
- package/es/select/examples/prefix-icon.md +74 -0
- package/es/select/index.js +1 -1
- package/es/select/index.js.map +1 -1
- package/es/skeleton/README.mdx +10 -0
- package/es/skeleton/examples/animation.md +13 -0
- package/es/skeleton/examples/avatar.md +13 -0
- package/es/skeleton/examples/basic.md +12 -0
- package/es/skeleton/examples/rows.md +13 -0
- package/es/skeleton/examples/title.md +12 -0
- package/es/skeleton/index.js +3 -3
- package/es/skeleton/index.js.map +1 -1
- package/es/spin/README.mdx +10 -0
- package/es/spin/examples/basic.md +67 -0
- package/es/spin/index.js +4 -4
- package/es/spin/index.js.map +1 -1
- package/es/switch/README.mdx +10 -0
- package/es/switch/examples/basic.md +24 -0
- package/es/switch/examples/checked-text.md +17 -0
- package/es/switch/examples/disabled.md +15 -0
- package/es/switch/examples/loading.md +17 -0
- package/es/switch/index.js +1 -1
- package/es/switch/index.js.map +1 -1
- package/es/table/README.mdx +10 -0
- package/es/table/examples/basic.md +29 -0
- package/es/table/examples/key.md +29 -0
- package/es/table/examples/order.md +29 -0
- package/es/table/examples/pagination.md +67 -0
- package/es/table/examples/render.md +92 -0
- package/es/table/examples/size.md +52 -0
- package/es/table/examples/summary.md +40 -0
- package/es/table/index.js +1 -1
- package/es/table/index.js.map +1 -1
- package/es/tabs/README.mdx +10 -0
- package/es/tabs/examples/add-remove.md +115 -0
- package/es/tabs/examples/animated.md +33 -0
- package/es/tabs/examples/basic.md +32 -0
- package/es/tabs/examples/card.md +33 -0
- package/es/tabs/examples/center.md +33 -0
- package/es/tabs/examples/disabled-tab.md +34 -0
- package/es/tabs/examples/disabled.md +33 -0
- package/es/tabs/examples/extra.md +65 -0
- package/es/tabs/index.js +2 -2
- package/es/tabs/index.js.map +1 -1
- package/es/tag/README.mdx +10 -0
- package/es/tag/examples/basic.md +28 -0
- package/es/tag/examples/bordered.md +19 -0
- package/es/tag/examples/color.md +25 -0
- package/es/tag/examples/icon.md +21 -0
- package/es/tag/examples/type.md +19 -0
- package/es/tag/index.js +3 -3
- package/es/tag/index.js.map +1 -1
- package/es/theme/README.mdx +10 -0
- package/es/theme/examples/colors.md +123 -0
- package/es/theme/examples/theme.md +19 -0
- package/es/theme/index.js +1 -1
- package/es/theme/index.js.map +1 -1
- package/es/tree/README.mdx +10 -0
- package/es/tree/examples/basic.md +108 -0
- package/es/tree/examples/custom-render.md +115 -0
- package/es/tree/examples/direction.md +100 -0
- package/es/tree/examples/field-names.md +114 -0
- package/es/tree/examples/multiple.md +117 -0
- package/es/tree/examples/readonly.md +90 -0
- package/es/tree/examples/render-tree-string1.md +70 -0
- package/es/tree/examples/render-tree-string2.md +52 -0
- package/es/tree/examples/schema.md +130 -0
- package/es/tree/examples/size.md +125 -0
- package/es/tree/examples/toggle.md +71 -0
- package/es/tree/index.js +1 -1
- package/es/tree/index.js.map +1 -1
- package/es/tree/register.js.map +1 -1
- package/es/typography/README.mdx +10 -0
- package/es/typography/examples/basic.md +27 -0
- package/es/typography/examples/tag.md +25 -0
- package/es/typography/examples/truncated.md +17 -0
- package/es/typography/index.js +3 -3
- package/es/typography/index.js.map +1 -1
- package/eslint.config.mjs +9 -0
- package/lib/avatar/README.mdx +10 -0
- package/lib/avatar/examples/basic.md +14 -0
- package/lib/avatar/examples/group.md +57 -0
- package/lib/avatar/examples/size.md +21 -0
- package/lib/avatar/group.js.map +1 -1
- package/lib/avatar/index.js +2 -2
- package/lib/avatar/index.js.map +1 -1
- package/lib/avatar/style.js +2 -2
- package/lib/avatar/style.js.map +1 -1
- package/lib/back-top/README.mdx +10 -0
- package/lib/back-top/examples/basic.md +19 -0
- package/lib/back-top/examples/mount.md +36 -0
- package/lib/back-top/examples/target.md +46 -0
- package/lib/back-top/index.js +1 -1
- package/lib/back-top/index.js.map +1 -1
- package/lib/basic-config/README.mdx +11 -0
- package/lib/button/README.mdx +10 -0
- package/lib/button/examples/basic.md +21 -0
- package/lib/button/examples/block.md +33 -0
- package/lib/button/examples/circle.md +21 -0
- package/lib/button/examples/danger.md +23 -0
- package/lib/button/examples/dashed.md +21 -0
- package/lib/button/examples/disabled.md +35 -0
- package/lib/button/examples/fill.md +21 -0
- package/lib/button/examples/flat.md +21 -0
- package/lib/button/examples/ghost.md +21 -0
- package/lib/button/examples/icon.md +30 -0
- package/lib/button/examples/link.md +21 -0
- package/lib/button/examples/size.md +23 -0
- package/lib/button/index.js +1 -1
- package/lib/button/index.js.map +1 -1
- package/lib/button/style.js +1 -0
- package/lib/button/style.js.map +1 -1
- package/lib/capture-screen/README.mdx +10 -0
- package/lib/capture-screen/examples/basic.md +13 -0
- package/lib/capture-screen/examples/custom-save.md +30 -0
- package/lib/capture-screen/examples/preview.md +13 -0
- package/lib/capture-screen/examples/recorder-save.md +13 -0
- package/lib/capture-screen/index.js +1 -1
- package/lib/capture-screen/index.js.map +1 -1
- package/lib/carousel/README.mdx +10 -0
- package/lib/carousel/examples/autoplay.md +21 -0
- package/lib/carousel/examples/basic.md +23 -0
- package/lib/carousel/examples/dots.md +23 -0
- package/lib/carousel/examples/header.md +38 -0
- package/lib/carousel/index.js +1 -1
- package/lib/carousel/index.js.map +1 -1
- package/lib/checkbox/README.mdx +10 -0
- package/lib/checkbox/examples/basic.md +31 -0
- package/lib/checkbox/examples/check-all.md +37 -0
- package/lib/checkbox/examples/disabled-all.md +28 -0
- package/lib/checkbox/examples/disabled-option.md +35 -0
- package/lib/checkbox/examples/field-names.md +40 -0
- package/lib/checkbox/examples/status.md +37 -0
- package/lib/checkbox/examples/vertical.md +36 -0
- package/lib/checkbox/index.js +1 -1
- package/lib/checkbox/index.js.map +1 -1
- package/lib/code/README.mdx +10 -0
- package/lib/code/examples/basic.md +19 -0
- package/lib/code/examples/diff.md +45 -0
- package/lib/code/examples/line-number.md +18 -0
- package/lib/code/examples/live-edit.md +20 -0
- package/lib/code/examples/toolbar.md +18 -0
- package/lib/code/index.js +2 -2
- package/lib/code/index.js.map +1 -1
- package/lib/code/worker.js.map +1 -1
- package/lib/color-palette/README.mdx +10 -0
- package/lib/color-palette/examples/default-value.md +25 -0
- package/lib/color-palette/examples/hexa.md +13 -0
- package/lib/color-palette/examples/hsla.md +13 -0
- package/lib/color-palette/examples/rgba.md +13 -0
- package/lib/color-palette/index.js +1 -1
- package/lib/color-palette/index.js.map +1 -1
- package/lib/color-picker/README.mdx +10 -0
- package/lib/color-picker/examples/basic.md +12 -0
- package/lib/color-picker/examples/default-value.md +20 -0
- package/lib/color-picker/examples/size.md +17 -0
- package/lib/color-picker/index.js +1 -1
- package/lib/color-picker/index.js.map +1 -1
- package/lib/cron/README.mdx +10 -0
- package/lib/cron/begin-interval.js.map +1 -1
- package/lib/cron/day.js.map +1 -1
- package/lib/cron/examples/basic.md +19 -0
- package/lib/cron/examples/card.md +12 -0
- package/lib/cron/examples/show-cron.md +12 -0
- package/lib/cron/hour.js +1 -1
- package/lib/cron/hour.js.map +1 -1
- package/lib/cron/index.js.map +1 -1
- package/lib/cron/item.js.map +1 -1
- package/lib/cron/minute.js +1 -1
- package/lib/cron/minute.js.map +1 -1
- package/lib/cron/month.js +1 -1
- package/lib/cron/month.js.map +1 -1
- package/lib/cron/period.js.map +1 -1
- package/lib/cron/second.js +1 -1
- package/lib/cron/second.js.map +1 -1
- package/lib/cron/some.js.map +1 -1
- package/lib/date-picker/README.mdx +10 -0
- package/lib/date-picker/date.js.map +1 -1
- package/lib/date-picker/dayjs.js +1 -1
- package/lib/date-picker/dayjs.js.map +1 -1
- package/lib/date-picker/examples/basic.md +24 -0
- package/lib/date-picker/examples/date.md +13 -0
- package/lib/date-picker/examples/disbaled.md +13 -0
- package/lib/date-picker/examples/header.md +13 -0
- package/lib/date-picker/examples/month.md +13 -0
- package/lib/date-picker/examples/time.md +15 -0
- package/lib/date-picker/examples/today.md +13 -0
- package/lib/date-picker/examples/year.md +13 -0
- package/lib/date-picker/index.js +1 -1
- package/lib/date-picker/index.js.map +1 -1
- package/lib/date-picker/month.js.map +1 -1
- package/lib/date-picker/panel.js +1 -1
- package/lib/date-picker/panel.js.map +1 -1
- package/lib/date-picker/time.js.map +1 -1
- package/lib/date-picker/year.js.map +1 -1
- package/lib/dropdown/README.mdx +10 -0
- package/lib/dropdown/examples/arrow.md +59 -0
- package/lib/dropdown/examples/basic.md +17 -0
- package/lib/dropdown/examples/click.md +45 -0
- package/lib/dropdown/examples/context-menu.md +66 -0
- package/lib/dropdown/examples/field-names.md +44 -0
- package/lib/dropdown/examples/icon.md +30 -0
- package/lib/dropdown/examples/multiple.md +45 -0
- package/lib/dropdown/examples/no-data.md +16 -0
- package/lib/dropdown/examples/placement.md +59 -0
- package/lib/dropdown/examples/toggle.md +36 -0
- package/lib/dropdown/index.js +1 -1
- package/lib/dropdown/index.js.map +1 -1
- package/lib/empty/index.js.map +1 -1
- package/lib/from-schema/index.js +1 -1
- package/lib/from-schema/index.js.map +1 -1
- package/lib/highlight-text/README.mdx +10 -0
- package/lib/highlight-text/examples/basic.md +19 -0
- package/lib/highlight-text/examples/mut.md +47 -0
- package/lib/highlight-text/examples/not-hightlight.md +19 -0
- package/lib/highlight-text/index.js.map +1 -1
- package/lib/img/README.mdx +10 -0
- package/lib/img/examples/basic.md +17 -0
- package/lib/img/examples/close-mask.md +21 -0
- package/lib/img/examples/disabled.md +16 -0
- package/lib/img/examples/error.md +13 -0
- package/lib/img/examples/esc.md +21 -0
- package/lib/img/examples/open-change.md +25 -0
- package/lib/img/index.js +1 -1
- package/lib/img/index.js.map +1 -1
- package/lib/img/lazy.js +1 -1
- package/lib/img/lazy.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/input/README.mdx +10 -0
- package/lib/input/examples/basic.md +31 -0
- package/lib/input/examples/prefix&suffix.md +33 -0
- package/lib/input/examples/size.md +21 -0
- package/lib/input/examples/status.md +23 -0
- package/lib/input/index.js +1 -1
- package/lib/input/index.js.map +1 -1
- package/lib/input-number/README.mdx +10 -0
- package/lib/input-number/examples/basic.md +26 -0
- package/lib/input-number/examples/formatter.md +36 -0
- package/lib/input-number/examples/max-min.md +13 -0
- package/lib/input-number/index.js.map +1 -1
- package/lib/katex/README.mdx +42 -0
- package/lib/katex/examples/block.md +25 -0
- package/lib/katex/examples/inline.md +19 -0
- package/lib/md/README.mdx +10 -0
- package/lib/md/examples/in-children.md +23 -0
- package/lib/md/examples/in-text.md +32 -0
- package/lib/md/examples/math.md +36 -0
- package/lib/md/index.js +1 -1
- package/lib/md/index.js.map +1 -1
- package/lib/menu/README.mdx +10 -0
- package/lib/menu/examples/basic.md +17 -0
- package/lib/menu/examples/field-names.md +42 -0
- package/lib/menu/examples/icon.md +125 -0
- package/lib/menu/examples/multiple.md +42 -0
- package/lib/menu/index.js +1 -1
- package/lib/menu/index.js.map +1 -1
- package/lib/modal/README.mdx +10 -0
- package/lib/modal/examples/basic.md +56 -0
- package/lib/modal/examples/close-icon.md +57 -0
- package/lib/modal/examples/esc-closable.md +64 -0
- package/lib/modal/examples/mask-blur.md +56 -0
- package/lib/modal/examples/mask-closable.md +64 -0
- package/lib/modal/index.js.map +1 -1
- package/lib/notification/README.mdx +11 -0
- package/lib/notification/examples/basic.md +35 -0
- package/lib/notification/examples/close.md +35 -0
- package/lib/notification/examples/type.md +84 -0
- package/lib/notification/examples/update.md +52 -0
- package/lib/notification/index.js.map +1 -1
- package/lib/notification/notification.js +1 -1
- package/lib/notification/notification.js.map +1 -1
- package/lib/pagination/README.mdx +10 -0
- package/lib/pagination/examples/basic.md +13 -0
- package/lib/pagination/examples/onchange.md +29 -0
- package/lib/pagination/examples/size.md +23 -0
- package/lib/pagination/examples/total-text.md +42 -0
- package/lib/pagination/index.js +1 -1
- package/lib/pagination/index.js.map +1 -1
- package/lib/popover/README.mdx +10 -0
- package/lib/popover/examples/basic.md +35 -0
- package/lib/popover/examples/click.md +15 -0
- package/lib/popover/examples/context-menu.md +58 -0
- package/lib/popover/examples/controlled.md +47 -0
- package/lib/popover/index.js +1 -1
- package/lib/popover/index.js.map +1 -1
- package/lib/prism/css.js.map +1 -1
- package/lib/prism/index.js.map +1 -1
- package/lib/provider/README.mdx +10 -0
- package/lib/provider/examples/scheme.md +14 -0
- package/lib/provider/index.js.map +1 -1
- package/lib/radio/README.mdx +10 -0
- package/lib/radio/examples/basic.md +19 -0
- package/lib/radio/examples/disabled-option.md +19 -0
- package/lib/radio/examples/disabled.md +19 -0
- package/lib/radio/examples/field-names.md +39 -0
- package/lib/radio/examples/layout-vertical.md +19 -0
- package/lib/radio/examples/status.md +31 -0
- package/lib/radio/index.js +1 -1
- package/lib/radio/index.js.map +1 -1
- package/lib/segmented/README.mdx +10 -0
- package/lib/segmented/examples/basic.md +18 -0
- package/lib/segmented/examples/custom-field-names.md +43 -0
- package/lib/segmented/examples/disabled-option.md +29 -0
- package/lib/segmented/examples/disabled.md +18 -0
- package/lib/segmented/examples/icon.md +28 -0
- package/lib/segmented/examples/options.md +21 -0
- package/lib/segmented/index.js +2 -2
- package/lib/segmented/index.js.map +1 -1
- package/lib/select/README.mdx +10 -0
- package/lib/select/examples/basic.md +44 -0
- package/lib/select/examples/disabled-option.md +21 -0
- package/lib/select/examples/disabled.md +24 -0
- package/lib/select/examples/field-names.md +40 -0
- package/lib/select/examples/item-suffix.md +84 -0
- package/lib/select/examples/multiple.md +61 -0
- package/lib/select/examples/no-data.md +12 -0
- package/lib/select/examples/prefix-icon.md +74 -0
- package/lib/select/index.js +1 -1
- package/lib/select/index.js.map +1 -1
- package/lib/skeleton/README.mdx +10 -0
- package/lib/skeleton/examples/animation.md +13 -0
- package/lib/skeleton/examples/avatar.md +13 -0
- package/lib/skeleton/examples/basic.md +12 -0
- package/lib/skeleton/examples/rows.md +13 -0
- package/lib/skeleton/examples/title.md +12 -0
- package/lib/skeleton/index.js.map +1 -1
- package/lib/spin/README.mdx +10 -0
- package/lib/spin/examples/basic.md +67 -0
- package/lib/spin/index.js +3 -3
- package/lib/spin/index.js.map +1 -1
- package/lib/switch/README.mdx +10 -0
- package/lib/switch/examples/basic.md +24 -0
- package/lib/switch/examples/checked-text.md +17 -0
- package/lib/switch/examples/disabled.md +15 -0
- package/lib/switch/examples/loading.md +17 -0
- package/lib/switch/index.js +1 -1
- package/lib/switch/index.js.map +1 -1
- package/lib/table/README.mdx +10 -0
- package/lib/table/examples/basic.md +29 -0
- package/lib/table/examples/key.md +29 -0
- package/lib/table/examples/order.md +29 -0
- package/lib/table/examples/pagination.md +67 -0
- package/lib/table/examples/render.md +92 -0
- package/lib/table/examples/size.md +52 -0
- package/lib/table/examples/summary.md +40 -0
- package/lib/table/index.js +1 -1
- package/lib/table/index.js.map +1 -1
- package/lib/tabs/README.mdx +10 -0
- package/lib/tabs/examples/add-remove.md +115 -0
- package/lib/tabs/examples/animated.md +33 -0
- package/lib/tabs/examples/basic.md +32 -0
- package/lib/tabs/examples/card.md +33 -0
- package/lib/tabs/examples/center.md +33 -0
- package/lib/tabs/examples/disabled-tab.md +34 -0
- package/lib/tabs/examples/disabled.md +33 -0
- package/lib/tabs/examples/extra.md +65 -0
- package/lib/tabs/index.js +2 -2
- package/lib/tabs/index.js.map +1 -1
- package/lib/tag/README.mdx +10 -0
- package/lib/tag/examples/basic.md +28 -0
- package/lib/tag/examples/bordered.md +19 -0
- package/lib/tag/examples/color.md +25 -0
- package/lib/tag/examples/icon.md +21 -0
- package/lib/tag/examples/type.md +19 -0
- package/lib/tag/index.js +3 -3
- package/lib/tag/index.js.map +1 -1
- package/lib/theme/README.mdx +10 -0
- package/lib/theme/examples/colors.md +123 -0
- package/lib/theme/examples/theme.md +19 -0
- package/lib/theme/index.js +1 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/tree/README.mdx +10 -0
- package/lib/tree/examples/basic.md +108 -0
- package/lib/tree/examples/custom-render.md +115 -0
- package/lib/tree/examples/direction.md +100 -0
- package/lib/tree/examples/field-names.md +114 -0
- package/lib/tree/examples/multiple.md +117 -0
- package/lib/tree/examples/readonly.md +90 -0
- package/lib/tree/examples/render-tree-string1.md +70 -0
- package/lib/tree/examples/render-tree-string2.md +52 -0
- package/lib/tree/examples/schema.md +130 -0
- package/lib/tree/examples/size.md +125 -0
- package/lib/tree/examples/toggle.md +71 -0
- package/lib/tree/index.js +1 -1
- package/lib/tree/index.js.map +1 -1
- package/lib/tree/register.js.map +1 -1
- package/lib/typography/README.mdx +10 -0
- package/lib/typography/examples/basic.md +27 -0
- package/lib/typography/examples/tag.md +25 -0
- package/lib/typography/examples/truncated.md +17 -0
- package/lib/typography/index.js.map +1 -1
- package/package.json +18 -18
- package/types/avatar/group.d.ts +1 -1
- package/types/back-top/index.d.ts +1 -1
- package/types/capture-screen/index.d.ts +1 -1
- package/types/color-palette/index.d.ts +1 -1
- package/types/color-picker/index.d.ts +1 -1
- package/types/cron/begin-interval.d.ts +3 -3
- package/types/cron/index.d.ts +5 -5
- package/types/cron/item.d.ts +4 -4
- package/types/cron/period.d.ts +3 -3
- package/types/cron/some.d.ts +3 -3
- package/types/date-picker/date.d.ts +2 -2
- package/types/date-picker/index.d.ts +2 -2
- package/types/date-picker/month.d.ts +2 -2
- package/types/date-picker/panel.d.ts +3 -3
- package/types/date-picker/time.d.ts +2 -2
- package/types/date-picker/year.d.ts +2 -2
- package/types/dropdown/index.d.ts +1 -1
- package/types/empty/index.d.ts +1 -1
- package/types/from-schema/index.d.ts +4 -4
- package/types/index.d.ts +12 -12
- package/types/md/index.d.ts +1 -1
- package/types/modal/index.d.ts +1 -1
- package/types/notification/index.d.ts +1 -1
- package/types/pagination/index.d.ts +1 -1
- package/types/provider/index.d.ts +1 -1
- package/types/segmented/index.d.ts +1 -1
- package/types/select/index.d.ts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/tabs/index.d.ts +1 -1
- package/types/tree/index.d.ts +1 -1
- package/umd/assets/svg/favicon.svg +1 -0
- package/umd/index.js +2 -2
- package/umd/js/46e8f96158e59015.js +1 -0
package/es/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/theme/index.ts"],"sourcesContent":["import {\n type Accessor,\n type Setter,\n createEffect,\n createMemo,\n createRoot,\n createSignal,\n getOwner,\n} from 'solid-js';\nimport { colorParse, mixColor, toneColor } from '@moneko/common';\nimport { CSSObject, css } from '@moneko/css';\nexport { toneColor } from '@moneko/common';\n\n/** 生成主题色调\n * @param {string} base 基础颜色\n * @param {ThemeOption} option 配置项\n * @returns {Record<string, string>} 主题色调\n */\nexport function generateColor(base: string, option: ThemeOption): Record<string, string> {\n const obj = toneColor(base, option?.dark);\n const textColor = colorParse(obj[5]);\n const baseColor = colorParse(base);\n\n return {\n [`--${option.name}-text`]: textColor.setAlpha(0.65).toRgbaString(),\n [`--${option.name}-secondary`]: textColor.setAlpha(0.45).toRgbaString(),\n [`--${option.name}-heading`]: obj[5],\n [`--${option.name}-active`]: obj[30],\n [`--${option.name}-color`]: obj[40],\n [`--${option.name}-hover`]: mixColor(obj[40], obj[30], 15),\n [`--${option.name}-secondary-bg`]: obj[70],\n [`--${option.name}-border`]: obj[80],\n [`--${option.name}-outline`]: mixColor(obj[90], obj[40], 5),\n [`--${option.name}-selection`]: obj[90],\n [`--${option.name}-notify-bg`]: colorParse(obj[90]).setAlpha(0.8).toRgbaString(),\n [`--on-${option.name}-selection`]: obj[10],\n [`--${option.name}-shadow`]: baseColor.setAlpha(0.12).toRgbaString(),\n [`--${option.name}-shadow-1`]: baseColor.setAlpha(0.08).toRgbaString(),\n [`--${option.name}-shadow-2`]: baseColor.setAlpha(0.05).toRgbaString(),\n [`--${option.name}-details-bg`]: obj[95],\n [`--${option.name}-component-bg`]: obj[98],\n [`--${option.name}-bg`]: obj[99],\n [`--on-${option.name}-bg`]: obj[5],\n };\n}\n\n/** 颜色模式 */\nexport enum ColorScheme {\n /** 明亮 */\n light = 'light',\n /** 暗黑 */\n dark = 'dark',\n /** 跟随系统 */\n auto = 'auto',\n}\n\nfunction createTheme() {\n const baseTokens = css({\n ':root,:host': {\n '--scrollbar-size': '4px',\n '--font-size': '14px',\n '--font-size-sm': '12px',\n '--font-size-xs': '10px',\n '--font-size-lg': '16px',\n '--border-base': '1px solid var(--border-color)',\n '--border-radius': '8px',\n '--text-color': 'var(--primary-text)',\n '--text-secondary': 'var(--primary-secondary)',\n '--text-heading': 'var(--primary-heading)',\n '--text-selection': 'var(--primary-selection)',\n '--transition-duration': '0.3s',\n '--mask-bg': 'rgb(0 0 0 / 5%)',\n '--modal-component-bg': 'rgb(255 255 255 / 80%)',\n '--modal-box-shadow': '0 5px 35px rgb(0 0 0 / 10%)',\n '--notification-box-shadow': '0 4px 16px rgb(0 0 0 / 5%)',\n '--transition-timing-function': 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n fontSize: 'var(--font-size)',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', Helvetica, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans'\",\n color: 'var(--text-color, rgb(0 0 0 / 65%))',\n lineHeight: 1.8,\n },\n '[disabled]:not([disabled=\"false\"]):not(n-img)': {\n cursor: 'not-allowed',\n color: 'var(--disable-color)',\n },\n '::selection': {\n backgroundColor: 'var(--text-selection)',\n },\n '::-webkit-scrollbar': {\n inlineSize: 'var(--scrollbar-size)',\n blockSize: 'var(--scrollbar-size)',\n },\n });\n const preset =\n ColorScheme[localStorage.getItem('color-scheme') as keyof typeof ColorScheme] || 'auto';\n /** 检测 prefers-color-scheme 媒体查询是否为 light 模式 */\n const media = window.matchMedia('(prefers-color-scheme: dark)');\n const [scheme, setScheme] = createSignal<keyof typeof ColorScheme>(preset);\n const [isDark, setIsDark] = createSignal(media.matches);\n const [light, setLight] = createSignal({\n primary: '#5794ff',\n warning: '#faad14',\n error: '#ff4d4f',\n success: '#52c41a',\n });\n const [dark, setDark] = createSignal({\n primary: '#4d81dc',\n warning: '#bb8314',\n error: '#901c22',\n success: '#419418',\n });\n const primary = createMemo(() => generateColor(light().primary, { name: 'primary' }));\n const darkPrimary = createMemo(() =>\n generateColor(dark().primary, { name: 'primary', dark: true }),\n );\n const warning = createMemo(() => generateColor(light().warning, { name: 'warning' }));\n const darkWarning = createMemo(() =>\n generateColor(dark().warning, { name: 'warning', dark: true }),\n );\n const success = createMemo(() => generateColor(light().success, { name: 'success' }));\n const darkSuccess = createMemo(() =>\n generateColor(dark().success, { name: 'success', dark: true }),\n );\n const error = createMemo(() => generateColor(light().error, { name: 'error' }));\n const darkError = createMemo(() => generateColor(dark().error, { name: 'error', dark: true }));\n\n function getHostCss(tokens: CSSObject) {\n let str = '';\n\n for (const key in tokens) {\n if (Object.prototype.hasOwnProperty.call(tokens, key)) {\n str += `${key}:${tokens[key]};`;\n }\n }\n return `${baseTokens}:root,:host{${str}}`;\n }\n const lightCss = createMemo(() => {\n const tokens = Object.assign({}, primary(), warning(), success(), error(), {\n '--bg': 'transparent',\n '--disable-color': 'rgb(0 0 0 / 25%)',\n '--disable-bg': 'rgb(0 0 0 / 4%)',\n '--disable-border': '#d9d9d9',\n '--border-color': 'var(--primary-border)',\n '--component-bg': 'var(--primary-bg)',\n });\n\n return getHostCss(tokens);\n });\n const darkCss = createMemo(() => {\n const tokens = Object.assign({}, darkPrimary(), darkWarning(), darkSuccess(), darkError(), {\n '--bg': '#1c1c1c',\n '--disable-color': 'rgb(255 255 255 / 25%)',\n '--disable-bg': 'rgb(255 255 255 / 8%)',\n '--disable-border': '#424242',\n '--border-color': '#303030',\n '--component-bg': '#141414',\n '--primary-shadow': 'rgb(0 0 0 / 12%)',\n '--primary-selection': 'rgb(255 255 255 / 5%)',\n '--primary-details-bg': 'rgb(255 255 255 / 3%)',\n '--primary-component-bg': '#000',\n '--modal-component-bg': 'rgb(30 30 30 / 80%)',\n });\n\n return getHostCss(tokens);\n });\n\n function update(e: MediaQueryListEvent) {\n setIsDark(e.matches);\n }\n createEffect(() => {\n const _ = scheme();\n\n setIsDark(_ === 'dark' || (_ === 'auto' && media.matches));\n });\n const baseStyle = createMemo(() => (isDark() ? darkCss() : lightCss()));\n\n createEffect(() => {\n if (scheme() === 'auto') {\n // 监听 prefers-color-scheme 媒体查询变化,自动更新颜色方案\n media.addEventListener('change', update);\n } else {\n media.removeEventListener('change', update);\n }\n localStorage.setItem('color-scheme', scheme());\n });\n\n return {\n baseStyle,\n dark,\n setDark,\n light,\n setLight,\n scheme,\n setScheme,\n isDark,\n };\n}\n\n/** API */\nexport interface Theme {\n /** 亮色样式的主要色 */\n light: Accessor<Color>;\n /** 设置亮色样式的主要色 */\n setLight: Setter<Color>;\n /** 黑色样式的主要色 */\n dark: Accessor<Color>;\n /** 设置黑色样式的主要色 */\n setDark: Setter<Color>;\n /** 颜色模式\n * @default 'auto'\n */\n scheme: Accessor<keyof typeof ColorScheme>;\n /** 设置颜色模式 */\n setScheme: Setter<keyof typeof ColorScheme>;\n /** 是否为色模式 */\n isDark: Accessor<boolean>;\n /** 基本都样式表, 响应 scheme 变化 */\n baseStyle: Accessor<string>;\n}\n\n/** 主要色 */\ninterface Color {\n /** 主要\n * @default '#5794ff'\n */\n primary: string;\n /** 警告\n * @default '#faad14'\n */\n warning: string;\n /** 错误\n * @default '#ff4d4f'\n */\n error: string;\n /** 成功\n * @default '#52c41a'\n */\n success: string;\n}\n\nexport interface ThemeOption {\n /** 是否采用暗色算法\n * @default false\n */\n dark?: boolean;\n /** 颜色名称 */\n name: string;\n}\n\nexport default createRoot<Theme>(createTheme, getOwner());\n"],"names":["ColorScheme","createEffect","createMemo","createRoot","createSignal","getOwner","colorParse","mixColor","toneColor","css","generateColor","base","option","obj","dark","textColor","baseColor","name","setAlpha","toRgbaString","baseTokens","fontSize","fontFamily","color","lineHeight","cursor","backgroundColor","inlineSize","blockSize","preset","localStorage","getItem","media","window","matchMedia","scheme","setScheme","isDark","setIsDark","matches","light","setLight","primary","warning","error","success","setDark","darkPrimary","darkWarning","darkSuccess","darkError","getHostCss","tokens","str","key","Object","prototype","hasOwnProperty","call","lightCss","assign","darkCss","update","e","_","baseStyle","addEventListener","removeEventListener","setItem"],"mappings":"IA+CYA,CA/CZ,QAGEC,gBAAAA,CAAY,CACZC,cAAAA,CAAU,CACVC,cAAAA,CAAU,CACVC,gBAAAA,CAAY,CACZC,YAAAA,CAAQ,KACH,UAAW,AAClB,QAASC,MAAuC,+BAAiB,AAAjE,QAAqBC,MAA2B,6BAAiB,AAAjE,QAA+BC,MAAiB,8BAAiB,AACjE,QAAoBC,OAAAA,CAAG,KAAQ,aAAc,AAC7C,QAASD,SAAS,KAAQ,gBAAiB,AAO3C,QAAO,SAASE,cAAcC,CAAY,CAAEC,CAAmB,EAC7D,IAAMC,EAAML,EAAUG,QAAMC,SAAAA,EAAQE,IAAI,EAClCC,EAAYT,EAAWO,CAAG,CAAC,EAAE,EAC7BG,EAAYV,EAAWK,GAE7B,MAAO,CACL,CAAC,CAAC,EAAE,EAAEC,EAAOK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAEF,EAAUG,QAAQ,CAAC,KAAMC,YAAY,GAChE,CAAC,CAAC,EAAE,EAAEP,EAAOK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAEF,EAAUG,QAAQ,CAAC,KAAMC,YAAY,GACrE,CAAC,CAAC,EAAE,EAAEP,EAAOK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAEJ,CAAG,CAAC,EAAE,CACpC,CAAC,CAAC,EAAE,EAAED,EAAOK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAEJ,CAAG,CAAC,GAAG,CACpC,CAAC,CAAC,EAAE,EAAED,EAAOK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAEJ,CAAG,CAAC,GAAG,CACnC,CAAC,CAAC,EAAE,EAAED,EAAOK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAEV,EAASM,CAAG,CAAC,GAAG,CAAEA,CAAG,CAAC,GAAG,CAAE,IACvD,CAAC,CAAC,EAAE,EAAED,EAAOK,IAAI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1B,uBAAwB,qBAC1B,KAKF,SAASY,EAAOC,CAAsB,EACpCzB,EAAUyB,EAAExB,OAAO,CACrB,CACAtC,EAAa,KACX,IAAM+D,EAAI7B,IAEVG,EAAU0B,AAAM,SAANA,GAAiBA,AAAM,SAANA,GAAgBhC,EAAMO,OAAO,CAC1D,GACA,IAAM0B,EAAY/D,EAAW,IAAOmC,IAAWwB,IAAYF,KAY3D,OAVA1D,EAAa,KACPkC,AAAa,SAAbA,IAEFH,EAAMkC,gBAAgB,CAAC,SAAUJ,GAEjC9B,EAAMmC,mBAAmB,CAAC,SAAUL,GAEtChC,aAAasC,OAAO,CAAC,eAAgBjC,IACvC,GAEO,CACL8B,UAAAA,EACAnD,KAAAA,EACAgC,QAAAA,EACAN,MAAAA,EACAC,SAAAA,EACAN,OAAAA,EACAC,UAAAA,EACAC,OAAAA,CACF,CACF,EAqD8ChC,IAAY"}
|
|
1
|
+
{"version":3,"sources":["../../components/theme/index.ts"],"sourcesContent":["import {\n type Accessor,\n createEffect,\n createMemo,\n createRoot,\n createSignal,\n getOwner,\n type Setter,\n} from 'solid-js';\nimport { colorParse, mixColor, toneColor } from '@moneko/common';\nimport { css, type CSSObject } from '@moneko/css';\nexport { toneColor } from '@moneko/common';\n\n/** 生成主题色调\n * @param {string} base 基础颜色\n * @param {ThemeOption} option 配置项\n * @returns {Record<string, string>} 主题色调\n */\nexport function generateColor(base: string, option: ThemeOption): Record<string, string> {\n const obj = toneColor(base, option.dark);\n const textColor = colorParse(obj[5]);\n const baseColor = colorParse(base);\n\n return {\n [`--${option.name}-text`]: textColor.setAlpha(0.65).toRgbaString(),\n [`--${option.name}-secondary`]: textColor.setAlpha(0.45).toRgbaString(),\n [`--${option.name}-heading`]: obj[5],\n [`--${option.name}-active`]: obj[30],\n [`--${option.name}-color`]: obj[40],\n [`--${option.name}-hover`]: mixColor(obj[40], obj[30], 15),\n [`--${option.name}-secondary-bg`]: obj[70],\n [`--${option.name}-border`]: obj[80],\n [`--${option.name}-outline`]: mixColor(obj[90], obj[40], 5),\n [`--${option.name}-selection`]: obj[90],\n [`--${option.name}-notify-bg`]: colorParse(obj[90]).setAlpha(0.8).toRgbaString(),\n [`--on-${option.name}-selection`]: obj[10],\n [`--${option.name}-shadow`]: baseColor.setAlpha(0.12).toRgbaString(),\n [`--${option.name}-shadow-1`]: baseColor.setAlpha(0.08).toRgbaString(),\n [`--${option.name}-shadow-2`]: baseColor.setAlpha(0.05).toRgbaString(),\n [`--${option.name}-details-bg`]: obj[95],\n [`--${option.name}-component-bg`]: obj[98],\n [`--${option.name}-bg`]: obj[99],\n [`--on-${option.name}-bg`]: obj[5],\n };\n}\n\n/** 颜色模式 */\nexport enum ColorScheme {\n /** 明亮 */\n light = 'light',\n /** 暗黑 */\n dark = 'dark',\n /** 跟随系统 */\n auto = 'auto',\n}\n\nfunction createTheme() {\n const baseTokens = css({\n ':root,:host': {\n '--scrollbar-size': '4px',\n '--font-size': '14px',\n '--font-size-sm': '12px',\n '--font-size-xs': '10px',\n '--font-size-lg': '16px',\n '--border-base': '1px solid var(--border-color)',\n '--border-radius': '8px',\n '--text-color': 'var(--primary-text)',\n '--text-secondary': 'var(--primary-secondary)',\n '--text-heading': 'var(--primary-heading)',\n '--text-selection': 'var(--primary-selection)',\n '--transition-duration': '0.3s',\n '--mask-bg': 'rgb(0 0 0 / 5%)',\n '--modal-component-bg': 'rgb(255 255 255 / 80%)',\n '--modal-box-shadow': '0 5px 35px rgb(0 0 0 / 10%)',\n '--notification-box-shadow': '0 4px 16px rgb(0 0 0 / 5%)',\n '--transition-timing-function': 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n fontSize: 'var(--font-size)',\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', Helvetica, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans'\",\n color: 'var(--text-color, rgb(0 0 0 / 65%))',\n lineHeight: 1.8,\n },\n '[disabled]:not([disabled=\"false\"]):not(n-img)': {\n cursor: 'not-allowed',\n color: 'var(--disable-color)',\n },\n '::selection': {\n backgroundColor: 'var(--text-selection)',\n },\n '::-webkit-scrollbar': {\n inlineSize: 'var(--scrollbar-size)',\n blockSize: 'var(--scrollbar-size)',\n },\n });\n const preset =\n ColorScheme[localStorage.getItem('color-scheme') as keyof typeof ColorScheme] || 'auto';\n /** 检测 prefers-color-scheme 媒体查询是否为 light 模式 */\n const media = window.matchMedia('(prefers-color-scheme: dark)');\n const [scheme, setScheme] = createSignal<keyof typeof ColorScheme>(preset);\n const [isDark, setIsDark] = createSignal(media.matches);\n const [light, setLight] = createSignal({\n primary: '#5794ff',\n warning: '#faad14',\n error: '#ff4d4f',\n success: '#52c41a',\n });\n const [dark, setDark] = createSignal({\n primary: '#4d81dc',\n warning: '#bb8314',\n error: '#901c22',\n success: '#419418',\n });\n const primary = createMemo(() => generateColor(light().primary, { name: 'primary' }));\n const darkPrimary = createMemo(() =>\n generateColor(dark().primary, { name: 'primary', dark: true }),\n );\n const warning = createMemo(() => generateColor(light().warning, { name: 'warning' }));\n const darkWarning = createMemo(() =>\n generateColor(dark().warning, { name: 'warning', dark: true }),\n );\n const success = createMemo(() => generateColor(light().success, { name: 'success' }));\n const darkSuccess = createMemo(() =>\n generateColor(dark().success, { name: 'success', dark: true }),\n );\n const error = createMemo(() => generateColor(light().error, { name: 'error' }));\n const darkError = createMemo(() => generateColor(dark().error, { name: 'error', dark: true }));\n\n function getHostCss(tokens: CSSObject) {\n let str = '';\n\n for (const key in tokens) {\n if (Object.prototype.hasOwnProperty.call(tokens, key)) {\n str += `${key}:${tokens[key]};`;\n }\n }\n return `${baseTokens}:root,:host{${str}}`;\n }\n const lightCss = createMemo(() => {\n const tokens = Object.assign({}, primary(), warning(), success(), error(), {\n '--bg': 'transparent',\n '--disable-color': 'rgb(0 0 0 / 25%)',\n '--disable-bg': 'rgb(0 0 0 / 4%)',\n '--disable-border': '#d9d9d9',\n '--border-color': 'var(--primary-border)',\n '--component-bg': 'var(--primary-bg)',\n });\n\n return getHostCss(tokens);\n });\n const darkCss = createMemo(() => {\n const tokens = Object.assign({}, darkPrimary(), darkWarning(), darkSuccess(), darkError(), {\n '--bg': '#1c1c1c',\n '--disable-color': 'rgb(255 255 255 / 25%)',\n '--disable-bg': 'rgb(255 255 255 / 8%)',\n '--disable-border': '#424242',\n '--border-color': '#303030',\n '--component-bg': '#141414',\n '--primary-shadow': 'rgb(0 0 0 / 12%)',\n '--primary-selection': 'rgb(255 255 255 / 5%)',\n '--primary-details-bg': 'rgb(255 255 255 / 3%)',\n '--primary-component-bg': '#000',\n '--modal-component-bg': 'rgb(30 30 30 / 80%)',\n });\n\n return getHostCss(tokens);\n });\n\n function update(e: MediaQueryListEvent) {\n setIsDark(e.matches);\n }\n createEffect(() => {\n const _ = scheme();\n\n setIsDark(_ === 'dark' || (_ === 'auto' && media.matches));\n });\n const baseStyle = createMemo(() => (isDark() ? darkCss() : lightCss()));\n\n createEffect(() => {\n if (scheme() === 'auto') {\n // 监听 prefers-color-scheme 媒体查询变化,自动更新颜色方案\n media.addEventListener('change', update);\n } else {\n media.removeEventListener('change', update);\n }\n localStorage.setItem('color-scheme', scheme());\n });\n\n return {\n baseStyle,\n dark,\n setDark,\n light,\n setLight,\n scheme,\n setScheme,\n isDark,\n };\n}\n\n/** API */\nexport interface Theme {\n /** 亮色样式的主要色 */\n light: Accessor<Color>;\n /** 设置亮色样式的主要色 */\n setLight: Setter<Color>;\n /** 黑色样式的主要色 */\n dark: Accessor<Color>;\n /** 设置黑色样式的主要色 */\n setDark: Setter<Color>;\n /** 颜色模式\n * @default 'auto'\n */\n scheme: Accessor<keyof typeof ColorScheme>;\n /** 设置颜色模式 */\n setScheme: Setter<keyof typeof ColorScheme>;\n /** 是否为色模式 */\n isDark: Accessor<boolean>;\n /** 基本都样式表, 响应 scheme 变化 */\n baseStyle: Accessor<string>;\n}\n\n/** 主要色 */\ninterface Color {\n /** 主要\n * @default '#5794ff'\n */\n primary: string;\n /** 警告\n * @default '#faad14'\n */\n warning: string;\n /** 错误\n * @default '#ff4d4f'\n */\n error: string;\n /** 成功\n * @default '#52c41a'\n */\n success: string;\n}\n\nexport interface ThemeOption {\n /** 是否采用暗色算法\n * @default false\n */\n dark?: boolean;\n /** 颜色名称 */\n name: string;\n}\n\nexport default createRoot<Theme>(createTheme, getOwner());\n"],"names":["ColorScheme","createEffect","createMemo","createRoot","createSignal","getOwner","colorParse","mixColor","toneColor","css","generateColor","base","option","obj","dark","textColor","baseColor","name","setAlpha","toRgbaString","baseTokens","fontSize","fontFamily","color","lineHeight","cursor","backgroundColor","inlineSize","blockSize","preset","localStorage","getItem","media","window","matchMedia","scheme","setScheme","isDark","setIsDark","matches","light","setLight","primary","warning","error","success","setDark","darkPrimary","darkWarning","darkSuccess","darkError","getHostCss","tokens","str","key","Object","prototype","hasOwnProperty","call","lightCss","assign","darkCss","update","e","_","baseStyle","addEventListener","removeEventListener","setItem"],"mappings":"IA+CYA,CA/CZ,QAEEC,gBAAAA,CAAY,CACZC,cAAAA,CAAU,CACVC,cAAAA,CAAU,CACVC,gBAAAA,CAAY,CACZC,YAAAA,CAAQ,KAEH,UAAW,AAClB,QAASC,MAAuC,+BAAiB,AAAjE,QAAqBC,MAA2B,6BAAiB,AAAjE,QAA+BC,MAAiB,8BAAiB,AACjE,QAASC,OAAAA,CAAG,KAAwB,aAAc,AAClD,QAASD,SAAS,KAAQ,gBAAiB,AAO3C,QAAO,SAASE,cAAcC,CAAY,CAAEC,CAAmB,EAC7D,IAAMC,EAAML,EAAUG,EAAMC,EAAOE,IAAI,EACjCC,EAAYT,EAAWO,CAAG,CAAC,EAAE,EAC7BG,EAAYV,EAAWK,GAE7B,MAAO,CACL,CAAC,CAAC,EAAE,EAAEC,EAAOK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAEF,EAAUG,QAAQ,CAAC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data` 数据进行渲染
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button size="small" type="primary">点击添加字段</n-button>
|
|
9
|
+
<n-tree></n-tree>
|
|
10
|
+
<script>
|
|
11
|
+
const el = container.querySelector('n-tree');
|
|
12
|
+
const btn = container.querySelector('n-button');
|
|
13
|
+
|
|
14
|
+
btn.onclick = function () {
|
|
15
|
+
el.data = [
|
|
16
|
+
...el.data,
|
|
17
|
+
{
|
|
18
|
+
key: Math.random().toString(32).slice(2),
|
|
19
|
+
name: 'new Field',
|
|
20
|
+
title: '新字段',
|
|
21
|
+
subTitle: '(new)',
|
|
22
|
+
s: 1,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
el.data = [
|
|
27
|
+
{
|
|
28
|
+
title: '文件名称',
|
|
29
|
+
subTitle: 'object',
|
|
30
|
+
key: 'a',
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
title: '备注',
|
|
34
|
+
subTitle: 'object',
|
|
35
|
+
key: 'a.b',
|
|
36
|
+
children: [
|
|
37
|
+
{
|
|
38
|
+
title: '备注',
|
|
39
|
+
subTitle: 'string',
|
|
40
|
+
key: 'a.b.x',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: '编号',
|
|
48
|
+
subTitle: 'object',
|
|
49
|
+
key: 'b',
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
title: '备注',
|
|
53
|
+
subTitle: 'string',
|
|
54
|
+
key: 'b2',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: '是否有效',
|
|
58
|
+
subTitle: 'boolean',
|
|
59
|
+
key: 'c2',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
<n-tree
|
|
69
|
+
data={[
|
|
70
|
+
{
|
|
71
|
+
title: '文件名称',
|
|
72
|
+
subTitle: 'object',
|
|
73
|
+
key: 'a',
|
|
74
|
+
children: [
|
|
75
|
+
{
|
|
76
|
+
title: '备注',
|
|
77
|
+
subTitle: 'object',
|
|
78
|
+
key: 'a.b',
|
|
79
|
+
children: [
|
|
80
|
+
{
|
|
81
|
+
title: '备注',
|
|
82
|
+
subTitle: 'string',
|
|
83
|
+
key: 'a.b.x',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: '编号',
|
|
91
|
+
subTitle: 'object',
|
|
92
|
+
key: 'b',
|
|
93
|
+
children: [
|
|
94
|
+
{
|
|
95
|
+
title: '备注',
|
|
96
|
+
subTitle: 'string',
|
|
97
|
+
key: 'b2',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: '是否有效',
|
|
101
|
+
subTitle: 'boolean',
|
|
102
|
+
key: 'c2',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
]}
|
|
107
|
+
/>
|
|
108
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 自定义渲染
|
|
3
|
+
description: 通过`renderRow`函数自定义渲染每一行的内容
|
|
4
|
+
order: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
|
|
12
|
+
el.renderRow = function (item, title, subTitle) {
|
|
13
|
+
const _tit = document.createElement('span'),
|
|
14
|
+
_close = document.createElement('i');
|
|
15
|
+
|
|
16
|
+
_tit.style.color = 'pink';
|
|
17
|
+
_tit.textContent = item.title;
|
|
18
|
+
_close.style.flex = 1;
|
|
19
|
+
_close.style.textAlign = 'right';
|
|
20
|
+
_close.textContent = 'x';
|
|
21
|
+
|
|
22
|
+
return [_tit, subTitle, _close];
|
|
23
|
+
};
|
|
24
|
+
el.data = [
|
|
25
|
+
{
|
|
26
|
+
title: '文件名称',
|
|
27
|
+
subTitle: 'object',
|
|
28
|
+
key: 'a',
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
title: '备注',
|
|
32
|
+
subTitle: 'object',
|
|
33
|
+
key: 'a.b',
|
|
34
|
+
children: [
|
|
35
|
+
{
|
|
36
|
+
title: '备注',
|
|
37
|
+
subTitle: 'string',
|
|
38
|
+
key: 'a.b.x',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: '编号',
|
|
46
|
+
subTitle: 'object',
|
|
47
|
+
key: 'b',
|
|
48
|
+
children: [
|
|
49
|
+
{
|
|
50
|
+
title: '备注',
|
|
51
|
+
subTitle: 'string',
|
|
52
|
+
key: 'b2',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: '是否有效',
|
|
56
|
+
subTitle: 'boolean',
|
|
57
|
+
key: 'c2',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
</script>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```jsx
|
|
66
|
+
function Demo() {
|
|
67
|
+
const data = [
|
|
68
|
+
{
|
|
69
|
+
title: '文件名称',
|
|
70
|
+
subTitle: 'object',
|
|
71
|
+
key: 'a',
|
|
72
|
+
children: [
|
|
73
|
+
{
|
|
74
|
+
title: '备注',
|
|
75
|
+
subTitle: 'object',
|
|
76
|
+
key: 'a.b',
|
|
77
|
+
children: [
|
|
78
|
+
{
|
|
79
|
+
title: '备注',
|
|
80
|
+
subTitle: 'string',
|
|
81
|
+
key: 'a.b.x',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: '编号',
|
|
89
|
+
subTitle: 'object',
|
|
90
|
+
key: 'b',
|
|
91
|
+
children: [
|
|
92
|
+
{
|
|
93
|
+
title: '备注',
|
|
94
|
+
subTitle: 'string',
|
|
95
|
+
key: 'b2',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
title: '是否有效',
|
|
99
|
+
subTitle: 'boolean',
|
|
100
|
+
key: 'c2',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
function renderRow(item, title, subTitle) {
|
|
107
|
+
return [
|
|
108
|
+
<span style={{ color: 'red' }}>{item.title}</span>,
|
|
109
|
+
subTitle,
|
|
110
|
+
<i style={{ flex: 1, 'text-align': 'right' }}>x</i>,
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
return <n-tree data={data} render-row={() => renderRow} />;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 从右到左
|
|
3
|
+
description: 将 `direction` 属性设置为 `rtl` 来支持从右到左的布局;
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div style="display:flex;justify-content:space-between;">
|
|
9
|
+
<n-tree direction="ltr" size="small"></n-tree>
|
|
10
|
+
<n-tree direction="rtl" size="small"></n-tree>
|
|
11
|
+
</div>
|
|
12
|
+
<script>
|
|
13
|
+
const els = container.querySelectorAll('n-tree');
|
|
14
|
+
const data = [
|
|
15
|
+
{
|
|
16
|
+
title: '文件名称',
|
|
17
|
+
subTitle: 'object',
|
|
18
|
+
key: 'a',
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
title: '备注',
|
|
22
|
+
subTitle: 'object',
|
|
23
|
+
key: 'a.b',
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
title: '备注',
|
|
27
|
+
subTitle: 'string',
|
|
28
|
+
key: 'a.b.x',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: '编号',
|
|
36
|
+
subTitle: 'object',
|
|
37
|
+
key: 'b',
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
title: '备注',
|
|
41
|
+
subTitle: 'string',
|
|
42
|
+
key: 'b2',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
els[0].data = data;
|
|
48
|
+
els[1].data = data;
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```jsx
|
|
53
|
+
function Demo() {
|
|
54
|
+
const data = [
|
|
55
|
+
{
|
|
56
|
+
title: '文件名称',
|
|
57
|
+
subTitle: 'object',
|
|
58
|
+
key: 'a',
|
|
59
|
+
children: [
|
|
60
|
+
{
|
|
61
|
+
title: '备注',
|
|
62
|
+
subTitle: 'object',
|
|
63
|
+
key: 'a.b',
|
|
64
|
+
children: [
|
|
65
|
+
{
|
|
66
|
+
title: '备注',
|
|
67
|
+
subTitle: 'string',
|
|
68
|
+
key: 'a.b.x',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
title: '编号',
|
|
76
|
+
subTitle: 'object',
|
|
77
|
+
key: 'b',
|
|
78
|
+
children: [
|
|
79
|
+
{
|
|
80
|
+
title: '备注',
|
|
81
|
+
subTitle: 'string',
|
|
82
|
+
key: 'b2',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: '是否有效',
|
|
86
|
+
subTitle: 'boolean',
|
|
87
|
+
key: 'c2',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div style="display:flex;justify-content:space-between;">
|
|
95
|
+
<n-tree data={data} direction="ltr" size="small" />
|
|
96
|
+
<n-tree data={data} direction="rtl" size="small" />
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 自定义字段名
|
|
3
|
+
description: 自定义节点 'title'、'key' 等字段
|
|
4
|
+
order: 11
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button size="small" type="primary">点击添加字段</n-button>
|
|
9
|
+
<n-tree></n-tree>
|
|
10
|
+
<script>
|
|
11
|
+
const el = container.querySelector('n-tree');
|
|
12
|
+
const btn = container.querySelector('n-button');
|
|
13
|
+
|
|
14
|
+
btn.onclick = function () {
|
|
15
|
+
el.data = [
|
|
16
|
+
...el.data,
|
|
17
|
+
{
|
|
18
|
+
code: Math.random().toString(32).slice(2),
|
|
19
|
+
name: '新字段',
|
|
20
|
+
subTitle: '(new)',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
};
|
|
24
|
+
el.fieldNames = {
|
|
25
|
+
title: 'name',
|
|
26
|
+
key: 'code',
|
|
27
|
+
};
|
|
28
|
+
el.data = [
|
|
29
|
+
{
|
|
30
|
+
name: '文件名称',
|
|
31
|
+
subTitle: 'object',
|
|
32
|
+
code: 'a',
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
name: '备注',
|
|
36
|
+
subTitle: 'object',
|
|
37
|
+
code: 'a.b',
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
name: '备注',
|
|
41
|
+
subTitle: 'string',
|
|
42
|
+
code: 'a.b.x',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: '编号',
|
|
50
|
+
subTitle: 'object',
|
|
51
|
+
code: 'b',
|
|
52
|
+
children: [
|
|
53
|
+
{
|
|
54
|
+
name: '备注',
|
|
55
|
+
subTitle: 'string',
|
|
56
|
+
code: 'b2',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: '是否有效',
|
|
60
|
+
subTitle: 'boolean',
|
|
61
|
+
code: 'c2',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
<n-tree
|
|
71
|
+
field-names={{
|
|
72
|
+
title: 'name',
|
|
73
|
+
key: 'code',
|
|
74
|
+
}}
|
|
75
|
+
data={[
|
|
76
|
+
{
|
|
77
|
+
name: '文件名称',
|
|
78
|
+
subTitle: 'object',
|
|
79
|
+
code: 'a',
|
|
80
|
+
children: [
|
|
81
|
+
{
|
|
82
|
+
name: '备注',
|
|
83
|
+
subTitle: 'object',
|
|
84
|
+
code: 'a.b',
|
|
85
|
+
children: [
|
|
86
|
+
{
|
|
87
|
+
name: '备注',
|
|
88
|
+
subTitle: 'string',
|
|
89
|
+
code: 'a.b.x',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: '编号',
|
|
97
|
+
subTitle: 'object',
|
|
98
|
+
code: 'b',
|
|
99
|
+
children: [
|
|
100
|
+
{
|
|
101
|
+
name: '备注',
|
|
102
|
+
subTitle: 'string',
|
|
103
|
+
code: 'b2',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: '是否有效',
|
|
107
|
+
subTitle: 'boolean',
|
|
108
|
+
code: 'c2',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 多选模式
|
|
3
|
+
description: 将 `multiple` 属性设置为 `true` 来开启多选模式; 重复点击同一项时,如果已选中则取消选中。
|
|
4
|
+
order: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree multiple="true"></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
|
|
12
|
+
el.onchange = function (e) {
|
|
13
|
+
const [key, item] = e.detail;
|
|
14
|
+
el.value = key;
|
|
15
|
+
console.log('html', item);
|
|
16
|
+
};
|
|
17
|
+
el.data = [
|
|
18
|
+
{
|
|
19
|
+
title: '文件名称',
|
|
20
|
+
subTitle: 'object',
|
|
21
|
+
key: 'a',
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
title: '备注',
|
|
25
|
+
subTitle: 'object',
|
|
26
|
+
key: 'a.b',
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
title: '备注',
|
|
30
|
+
subTitle: 'string',
|
|
31
|
+
key: 'a.b.x',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: '编号',
|
|
39
|
+
subTitle: 'object',
|
|
40
|
+
key: 'b',
|
|
41
|
+
children: [
|
|
42
|
+
{
|
|
43
|
+
title: '备注',
|
|
44
|
+
subTitle: 'string',
|
|
45
|
+
key: 'b2',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: '是否有效',
|
|
49
|
+
subTitle: 'boolean',
|
|
50
|
+
key: 'c2',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
function Demo() {
|
|
60
|
+
let el;
|
|
61
|
+
const data = [
|
|
62
|
+
{
|
|
63
|
+
title: '文件名称',
|
|
64
|
+
subTitle: 'object',
|
|
65
|
+
key: 'a',
|
|
66
|
+
children: [
|
|
67
|
+
{
|
|
68
|
+
title: '备注',
|
|
69
|
+
subTitle: 'object',
|
|
70
|
+
key: 'a.b',
|
|
71
|
+
children: [
|
|
72
|
+
{
|
|
73
|
+
title: '备注',
|
|
74
|
+
subTitle: 'string',
|
|
75
|
+
key: 'a.b.x',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: '编号',
|
|
83
|
+
subTitle: 'object',
|
|
84
|
+
key: 'b',
|
|
85
|
+
children: [
|
|
86
|
+
{
|
|
87
|
+
title: '备注',
|
|
88
|
+
subTitle: 'string',
|
|
89
|
+
key: 'b2',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: '是否有效',
|
|
93
|
+
subTitle: 'boolean',
|
|
94
|
+
key: 'c2',
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<n-tree
|
|
102
|
+
ref={(e) => (el = e)}
|
|
103
|
+
data={data}
|
|
104
|
+
multiple
|
|
105
|
+
// 或者使用数据绑定
|
|
106
|
+
value={[]}
|
|
107
|
+
onChange={(e) => {
|
|
108
|
+
if (el) {
|
|
109
|
+
const [key, item] = e.detail;
|
|
110
|
+
el.value = key;
|
|
111
|
+
console.log('jsx', item);
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|