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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 只读模式
|
|
3
|
+
description: 通过设置 `readonly` 属性来开启只读模式, 不会触发 `onchange` 事件
|
|
4
|
+
order: 7
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree readonly="true" value="fileName.code"></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
|
|
12
|
+
el.onchange = function (e) {
|
|
13
|
+
// 不会触发
|
|
14
|
+
console.log(e);
|
|
15
|
+
};
|
|
16
|
+
el.data = [
|
|
17
|
+
{
|
|
18
|
+
title: '文件地址',
|
|
19
|
+
subTitle: 'fileAddr',
|
|
20
|
+
key: 'fileAddr',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
subTitle: 'fileName',
|
|
24
|
+
title: '文件名称',
|
|
25
|
+
key: 'fileName',
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
title: '编号',
|
|
29
|
+
subTitle: 'fileName.code',
|
|
30
|
+
key: 'fileName.code',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: '编号',
|
|
36
|
+
subTitle: 'code',
|
|
37
|
+
key: 'code',
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
title: '是否有效',
|
|
41
|
+
subTitle: 'valid',
|
|
42
|
+
key: 'valid',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
<n-tree
|
|
52
|
+
data={[
|
|
53
|
+
{
|
|
54
|
+
title: '文件地址',
|
|
55
|
+
subTitle: 'fileAddr',
|
|
56
|
+
key: 'fileAddr',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
subTitle: 'fileName',
|
|
60
|
+
title: '文件名称',
|
|
61
|
+
key: 'fileName',
|
|
62
|
+
children: [
|
|
63
|
+
{
|
|
64
|
+
title: '编号',
|
|
65
|
+
subTitle: 'fileName.code',
|
|
66
|
+
key: 'fileName.code',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: '编号',
|
|
72
|
+
subTitle: 'code',
|
|
73
|
+
key: 'code',
|
|
74
|
+
children: [
|
|
75
|
+
{
|
|
76
|
+
title: '是否有效',
|
|
77
|
+
subTitle: 'valid',
|
|
78
|
+
key: 'valid',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
]}
|
|
83
|
+
value="fileName.code"
|
|
84
|
+
readonly
|
|
85
|
+
onChange={(e) => {
|
|
86
|
+
// 不会触发
|
|
87
|
+
console.log(e);
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 渲染树状字符串
|
|
3
|
+
description: 渲染 tree 命令输出的树状字符串
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
|
|
12
|
+
el.data = `.
|
|
13
|
+
|-- components
|
|
14
|
+
| |-- index.ts
|
|
15
|
+
| \`-- wave-circle
|
|
16
|
+
| |-- examples
|
|
17
|
+
| | |-- api.md
|
|
18
|
+
| | \`-- demo.mdx
|
|
19
|
+
| |-- index.tsx
|
|
20
|
+
| \`-- README.mdx
|
|
21
|
+
|-- config
|
|
22
|
+
| |-- index.ts
|
|
23
|
+
| \`-- prod.ts
|
|
24
|
+
|-- docs
|
|
25
|
+
| |-- index.js
|
|
26
|
+
| \`-- index.html
|
|
27
|
+
|-- es
|
|
28
|
+
| |-- index.js
|
|
29
|
+
| \`-- wave-circle
|
|
30
|
+
| \`-- index.js
|
|
31
|
+
|-- .eslintrc.yaml
|
|
32
|
+
|-- .gitattributes
|
|
33
|
+
|-- .prettierrc.yaml
|
|
34
|
+
|-- .stylelintrc.yaml
|
|
35
|
+
|-- package.json
|
|
36
|
+
|-- README.md
|
|
37
|
+
\`-- tsconfig.json`;
|
|
38
|
+
</script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
<n-tree
|
|
43
|
+
data={`.
|
|
44
|
+
|-- components
|
|
45
|
+
| |-- index.ts
|
|
46
|
+
| \`-- wave-circle
|
|
47
|
+
| |-- examples
|
|
48
|
+
| | |-- api.md
|
|
49
|
+
| | \`-- demo.mdx
|
|
50
|
+
| |-- index.tsx
|
|
51
|
+
| \`-- README.mdx
|
|
52
|
+
|-- config
|
|
53
|
+
| |-- index.ts
|
|
54
|
+
| \`-- prod.ts
|
|
55
|
+
|-- docs
|
|
56
|
+
| |-- index.js
|
|
57
|
+
| \`-- index.html
|
|
58
|
+
|-- es
|
|
59
|
+
| |-- index.js
|
|
60
|
+
| \`-- wave-circle
|
|
61
|
+
| \`-- index.js
|
|
62
|
+
|-- .eslintrc.yaml
|
|
63
|
+
|-- .gitattributes
|
|
64
|
+
|-- .prettierrc.yaml
|
|
65
|
+
|-- .stylelintrc.yaml
|
|
66
|
+
|-- package.json
|
|
67
|
+
|-- README.md
|
|
68
|
+
\`-- tsconfig.json`}
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 渲染 tree 命令输出的树状字符串
|
|
3
|
+
description: 渲染另一种格式的树状字符串
|
|
4
|
+
order: 10
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
|
|
12
|
+
el.data = `.
|
|
13
|
+
├── components
|
|
14
|
+
│ ├── @moneko
|
|
15
|
+
│ │ ├── README.mdx
|
|
16
|
+
│ │ └── 🕸sso
|
|
17
|
+
│ │ ├── README.mdx
|
|
18
|
+
│ │ └── examples
|
|
19
|
+
│ │ └── readme.md
|
|
20
|
+
│ └── index.ts
|
|
21
|
+
├── config
|
|
22
|
+
│ ├── deploy.ts
|
|
23
|
+
│ └── index.ts
|
|
24
|
+
├── jest.config.ts
|
|
25
|
+
├── package.json
|
|
26
|
+
├── tsconfig.json
|
|
27
|
+
└── typings
|
|
28
|
+
└── typings.d.ts`;
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
<n-tree
|
|
34
|
+
data={`.
|
|
35
|
+
├── components
|
|
36
|
+
│ ├── @moneko
|
|
37
|
+
│ │ ├── README.mdx
|
|
38
|
+
│ │ └── 🕸sso
|
|
39
|
+
│ │ ├── README.mdx
|
|
40
|
+
│ │ └── examples
|
|
41
|
+
│ │ └── readme.md
|
|
42
|
+
│ └── index.ts
|
|
43
|
+
├── config
|
|
44
|
+
│ ├── deploy.ts
|
|
45
|
+
│ └── index.ts
|
|
46
|
+
├── jest.config.ts
|
|
47
|
+
├── package.json
|
|
48
|
+
├── tsconfig.json
|
|
49
|
+
└── typings
|
|
50
|
+
└── typings.d.ts`}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 渲染JSON Schema结构
|
|
3
|
+
description: 通过设置 `fromSchema` 属性渲染来支持 `JSONSchema` 的数据源。
|
|
4
|
+
order: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree from-schema="true"></n-tree>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-tree');
|
|
11
|
+
el.onchange = function (e) {
|
|
12
|
+
const [key, item] = e.detail;
|
|
13
|
+
|
|
14
|
+
el.value = key;
|
|
15
|
+
console.log(item);
|
|
16
|
+
};
|
|
17
|
+
el.data = {
|
|
18
|
+
$schema: 'http://json-schema.org/draft-07/schema',
|
|
19
|
+
$id: 'http://example.com/example.json',
|
|
20
|
+
type: 'object',
|
|
21
|
+
additionalProperties: true,
|
|
22
|
+
properties: {
|
|
23
|
+
user: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
title: '用户信息',
|
|
26
|
+
propertyOrder: 12,
|
|
27
|
+
required: ['name', 'email'],
|
|
28
|
+
properties: {
|
|
29
|
+
name: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
title: '姓名',
|
|
32
|
+
description: '',
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
works: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
title: '履历',
|
|
38
|
+
description: '',
|
|
39
|
+
required: ['desgin'],
|
|
40
|
+
properties: {
|
|
41
|
+
desgin: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
title: '设计',
|
|
44
|
+
description: '',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
tags: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
title: '标签',
|
|
53
|
+
description: '',
|
|
54
|
+
items: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
title: 'items',
|
|
57
|
+
description: '',
|
|
58
|
+
additionalProperties: true,
|
|
59
|
+
properties: {
|
|
60
|
+
s: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
title: 's',
|
|
63
|
+
description: '',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
<n-tree
|
|
75
|
+
data={{
|
|
76
|
+
$schema: 'http://json-schema.org/draft-07/schema',
|
|
77
|
+
$id: 'http://example.com/example.json',
|
|
78
|
+
type: 'object',
|
|
79
|
+
additionalProperties: true,
|
|
80
|
+
properties: {
|
|
81
|
+
user: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
title: '用户信息',
|
|
84
|
+
propertyOrder: 12,
|
|
85
|
+
required: ['name', 'email'],
|
|
86
|
+
properties: {
|
|
87
|
+
name: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
title: '姓名',
|
|
90
|
+
description: '',
|
|
91
|
+
default: '',
|
|
92
|
+
},
|
|
93
|
+
works: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
title: '履历',
|
|
96
|
+
description: '',
|
|
97
|
+
required: ['desgin'],
|
|
98
|
+
properties: {
|
|
99
|
+
desgin: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
title: '设计',
|
|
102
|
+
description: '',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
tags: {
|
|
109
|
+
type: 'array',
|
|
110
|
+
title: '标签',
|
|
111
|
+
description: '',
|
|
112
|
+
items: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
title: 'items',
|
|
115
|
+
description: '',
|
|
116
|
+
additionalProperties: true,
|
|
117
|
+
properties: {
|
|
118
|
+
s: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
title: 's',
|
|
121
|
+
description: '',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
}}
|
|
128
|
+
from-schema
|
|
129
|
+
/>
|
|
130
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 不同的尺寸
|
|
3
|
+
description: Tree 内置有大、中、小三种尺寸。通过 `size` 设置尺寸; 默认为 'normal'。
|
|
4
|
+
order: 7
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-segmented default-value="normal"></n-segmented>
|
|
9
|
+
<n-tree></n-tree>
|
|
10
|
+
<script>
|
|
11
|
+
const segmented = container.querySelector('n-segmented');
|
|
12
|
+
const tree = container.querySelector('n-tree');
|
|
13
|
+
|
|
14
|
+
segmented.options = [
|
|
15
|
+
{ label: '小', value: 'small' },
|
|
16
|
+
{ label: '默认:中', value: 'normal' },
|
|
17
|
+
{ label: '大', value: 'large' },
|
|
18
|
+
];
|
|
19
|
+
segmented.onchange = function (e) {
|
|
20
|
+
tree.size = e.detail;
|
|
21
|
+
};
|
|
22
|
+
tree.data = [
|
|
23
|
+
{
|
|
24
|
+
title: '文件名称',
|
|
25
|
+
subTitle: 'object',
|
|
26
|
+
key: 'a',
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
title: '备注',
|
|
30
|
+
subTitle: 'object',
|
|
31
|
+
key: 'a.b',
|
|
32
|
+
children: [
|
|
33
|
+
{
|
|
34
|
+
title: '备注',
|
|
35
|
+
subTitle: 'string',
|
|
36
|
+
key: 'a.b.x',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: '编号',
|
|
44
|
+
subTitle: 'object',
|
|
45
|
+
key: 'b',
|
|
46
|
+
children: [
|
|
47
|
+
{
|
|
48
|
+
title: '备注',
|
|
49
|
+
subTitle: 'string',
|
|
50
|
+
key: 'b2',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: '是否有效',
|
|
54
|
+
subTitle: 'boolean',
|
|
55
|
+
key: 'c2',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```jsx
|
|
64
|
+
function Demo() {
|
|
65
|
+
let el;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
<n-segmented
|
|
70
|
+
default-value="normal"
|
|
71
|
+
options={[
|
|
72
|
+
{ label: '小', value: 'small' },
|
|
73
|
+
{ label: '默认:中', value: 'normal' },
|
|
74
|
+
{ label: '大', value: 'large' },
|
|
75
|
+
]}
|
|
76
|
+
onChange={(e) => {
|
|
77
|
+
el.size = e.detail;
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
<n-tree
|
|
81
|
+
ref={(e) => (el = e)}
|
|
82
|
+
size="normal"
|
|
83
|
+
data={[
|
|
84
|
+
{
|
|
85
|
+
title: '文件名称',
|
|
86
|
+
subTitle: 'object',
|
|
87
|
+
key: 'a',
|
|
88
|
+
children: [
|
|
89
|
+
{
|
|
90
|
+
title: '备注',
|
|
91
|
+
subTitle: 'object',
|
|
92
|
+
key: 'a.b',
|
|
93
|
+
children: [
|
|
94
|
+
{
|
|
95
|
+
title: '备注',
|
|
96
|
+
subTitle: 'string',
|
|
97
|
+
key: 'a.b.x',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: '编号',
|
|
105
|
+
subTitle: 'object',
|
|
106
|
+
key: 'b',
|
|
107
|
+
children: [
|
|
108
|
+
{
|
|
109
|
+
title: '备注',
|
|
110
|
+
subTitle: 'string',
|
|
111
|
+
key: 'b2',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: '是否有效',
|
|
115
|
+
subTitle: 'boolean',
|
|
116
|
+
key: 'c2',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
]}
|
|
121
|
+
/>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 重复点击取消选中
|
|
3
|
+
description: 通过设置`toggle`属性来开启取消选中, 仅支持单选模式; 重复点击同一项时,如果已选中则取消选中。
|
|
4
|
+
order: 6
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-tree toggle="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
|
+
|
|
15
|
+
el.value = key;
|
|
16
|
+
console.log(item);
|
|
17
|
+
};
|
|
18
|
+
el.data = [
|
|
19
|
+
{
|
|
20
|
+
title: '文件地址',
|
|
21
|
+
subTitle: 'fileAddr',
|
|
22
|
+
key: 'fileAddr',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: '编号',
|
|
26
|
+
subTitle: 'channelCustNum',
|
|
27
|
+
key: 'channelCustNum',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '编号2',
|
|
31
|
+
subTitle: 'string',
|
|
32
|
+
key: 'string',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
function Demo() {
|
|
40
|
+
let el;
|
|
41
|
+
return (
|
|
42
|
+
<n-tree
|
|
43
|
+
ref={(e) => (el = e)}
|
|
44
|
+
toggle
|
|
45
|
+
onChange={(e) => {
|
|
46
|
+
const [key, item] = e.detail;
|
|
47
|
+
|
|
48
|
+
el.value = key;
|
|
49
|
+
console.log(item);
|
|
50
|
+
}}
|
|
51
|
+
data={[
|
|
52
|
+
{
|
|
53
|
+
title: '文件地址',
|
|
54
|
+
subTitle: 'fileAddr',
|
|
55
|
+
key: 'fileAddr',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '编号',
|
|
59
|
+
subTitle: 'channelCustNum',
|
|
60
|
+
key: 'channelCustNum',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: '编号2',
|
|
64
|
+
subTitle: 'string',
|
|
65
|
+
key: 'string',
|
|
66
|
+
},
|
|
67
|
+
]}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
package/es/tree/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{use as e}from"solid-js/web";import{template as t}from"solid-js/web";import{style as l}from"solid-js/web";import{setAttribute as o}from"solid-js/web";import{insert as r}from"solid-js/web";import{effect as n}from"solid-js/web";import{delegateEvents as i}from"solid-js/web";import{createComponent as s}from"solid-js/web";import{classList as a}from"solid-js/web";let c=t('<li class="row">'),m=t('<span class="title">'),d=t('<span class="sub-title">'),u=t("<style> "),p=t("<style>"),f=t('<ul class="tree">');import{
|
|
1
|
+
import{use as e}from"solid-js/web";import{template as t}from"solid-js/web";import{style as l}from"solid-js/web";import{setAttribute as o}from"solid-js/web";import{insert as r}from"solid-js/web";import{effect as n}from"solid-js/web";import{delegateEvents as i}from"solid-js/web";import{createComponent as s}from"solid-js/web";import{classList as a}from"solid-js/web";let c=t('<li class="row">'),m=t('<span class="title">'),d=t('<span class="sub-title">'),u=t("<style> "),p=t("<style>"),f=t('<ul class="tree">');import{createEffect as h,createMemo as g,createSignal as v,For as $,Show as b}from"solid-js";import y from"@moneko/common/lib/frameCallback";import k from"@moneko/common/lib/isFunction";import w from"@moneko/common/lib/isString";import{css as _}from"@moneko/css";import C from"../from-schema";import j from"../theme";import{style as R}from"./style";import"./register";export*from"./type";export default function(t){let i;let S={small:6,normal:8,large:10},{baseStyle:x}=j,[A,L]=v([]),[P,T]=v([]),z={key:"key",name:"name",title:"title",subTitle:"subTitle",children:"children",description:"description"},B=g(()=>Object.assign(z,t.fieldNames)),D=g(()=>"rtl"===t.direction),O=g(()=>void 0!==t.value&&null!==t.value?Array.isArray(t.value)?t.value:[t.value]:[]),q=Symbol("path"),E=Symbol("path-end");return h(()=>{let e=t.fromSchema?C(t.data):w(t.data)?function(e){let t=B(),l=t.key,o=t.title,r=t.children,n=/[^\s|`│├└]/,i=e.trim().split("\n"),s=[{[o]:i[0],[l]:i[0]}];for(let e=1;e<i.length;e++){let t=i[e].search(n);if(-1===t)continue;let a={[o]:i[e].slice(t+3),depth:t};for(;s.length&&t<=(s[s.length-1].depth||0);)s.pop();if(!s.length)return[];let c=s[s.length-1];c[r]||(c[r]=[]),a[l]=`${c[l]}-${a[o]}-${t}-${e}`,c[r].push(a),s.push(a)}return[s[0]]}(t.data):t.data;L([...new Set(function e(t,l=0){let o=t.length-1,r=t[o],n=t[0],i=[],s=B(),a=s.key,c=s.children;for(let s=0,m=t.length;s<m;s++){let m=t[s],d=s===o;delete m[q],delete m[E],(0===s||d)&&(m[q]=n[a]+(1===t.length?"":`>${r[a]}`),d&&(m[E]=""),i.push(m[q])),m[c]&&(i=i.concat(e(m[c],l+1)))}return i}(e))]),T(e)}),h(()=>{let e=A(),l=t.size||"normal";y(()=>{let t=e.length;if(i&&t){let o=S[l];for(let l=0;l<t;l++){let t=i.querySelectorAll(`li[data-path="${e[l]}"]`);if(t.length){let e=t[0].getBoundingClientRect(),r=e.height/2+o;if(t.length>1){let{bottom:n,height:i,top:s}=t[1].getBoundingClientRect();r=0===l?s-e.top:n-e.top-i/2+o,t[1].style.setProperty("--c","none")}else 0===l&&t[0].style.setProperty("--c","none");(1!==t.length||0!==l)&&t[0].style.setProperty("--line",`${Math.abs(r)}px`)}}}})}),[(()=>{let e=u(),t=e.firstChild;return n(()=>t.data=x()),e})(),(()=>{let e=p();return e.textContent=R,e})(),s(b,{get when(){return t.css},get children(){let e=u(),l=e.firstChild;return n(()=>l.data=_(t.css)),e}}),(()=>{let u=f(),p=i;return"function"==typeof p?e(p,u):i=u,r(u,()=>(function e(i,a=0){return s($,{each:i,children:i=>{let u=B(),p=i[u.title],f=i[u.key],h=i[u.name],g=i[u.subTitle],v=i[u.children],$=h!==p&&h?[h,p]:[p];return[(()=>{let e=c();return e.$$dblclick=e=>null==t.onRowDoubleClick?void 0:t.onRowDoubleClick.call(t,e,f,i),e.$$click=e=>{!function(e,l){let o=B();(function(e,l){if(!t.readonly&&k(t.onChange)){let o=[...O()];if(t.multiple){let t=o.indexOf(e);-1===t?o.push(e):o.splice(t,1)}else o=t.toggle&&o[0]===e?[]:[e];t.onChange(t.multiple?o:o[0],l)}})(l[o.key],l),null==t.onRowClick||t.onRowClick.call(t,e,l[o.key],l)}(e,i)},r(e,()=>(function(e,l,o){let r=(null==t.renderRow?void 0:t.renderRow.call(t,e,l,o))||[l,o];return D()?r.reverse():r})(i,(()=>{let e=m();return r(e,()=>(D()?$.reverse():$).join(": ")),e})(),s(b,{when:g,get children(){let e=d();return r(e,g),e}}))),n(r=>{let n=!!O().includes(f),s=!!(t.readonly||!k(t.onChange)),c=a?{"--depth":`${2*a}em`}:void 0,m=i[E],d=i[q];return n!==r._v$&&e.classList.toggle("active",r._v$=n),s!==r._v$2&&e.classList.toggle("non",r._v$2=s),r._v$3=l(e,c,r._v$3),m!==r._v$4&&o(e,"data-path-end",r._v$4=m),d!==r._v$5&&o(e,"data-path",r._v$5=d),r},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0}),e})(),s(b,{when:v,get children(){return e(v,a+1)}})]}})})(P())),n(e=>a(u,{[t.size||"normal"]:!0,[t.class]:!!t.class,rtl:D()},e)),u})()]}i(["click","dblclick"]);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/es/tree/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/tree/index.tsx"],"sourcesContent":["import { For, Show, createEffect, createMemo, createSignal } from 'solid-js';\nimport { frameCallback, isFunction, isString } from '@moneko/common';\nimport { css } from '@moneko/css';\nimport './register';\nimport { style } from './style';\nimport schema from '../from-schema';\nimport theme from '../theme';\nimport type {\n TreeData,\n TreeMultipleProps,\n TreeMultipleSchemaProps,\n TreeMultipleStringProps,\n TreeProps,\n TreeSchemaProps,\n TreeStack,\n TreeStringProps,\n} from './type';\n\nfunction Tree(\n _:\n | TreeProps\n | TreeMultipleProps\n | TreeMultipleSchemaProps\n | TreeSchemaProps\n | TreeMultipleStringProps\n | TreeStringProps,\n) {\n const sizeCnt = {\n small: 6,\n normal: 8,\n large: 10,\n };\n const { baseStyle } = theme;\n let el: HTMLUListElement | undefined;\n const [lines, setLines] = createSignal<string[]>([]);\n const [treeData, setTreeData] = createSignal<TreeData[]>([]);\n const normalFieldNames = {\n key: 'key' as const,\n name: 'name' as const,\n title: 'title' as const,\n subTitle: 'subTitle' as const,\n children: 'children' as const,\n description: 'description' as const,\n };\n const fieldNames = createMemo(() => Object.assign(normalFieldNames, _.fieldNames));\n const rtl = createMemo(() => _.direction === 'rtl');\n const current = createMemo(() => {\n if (_.value !== void 0 && _.value !== null) {\n return Array.isArray(_.value) ? _.value : [_.value];\n }\n return [];\n });\n const path = Symbol('path');\n const pathEnd = Symbol('path-end');\n\n function countLineLen(tree: TreeData[], depth = 0) {\n const lastIdx = tree.length - 1;\n const last = tree[lastIdx];\n const frist = tree[0];\n let line: string[] = [];\n const fields = fieldNames();\n const key = fields.key;\n const children = fields.children;\n\n for (let i = 0, len = tree.length; i < len; i++) {\n const item = tree[i],\n isLast = i === lastIdx;\n\n delete item[path];\n delete item[pathEnd];\n if (i === 0 || isLast) {\n item[path] = frist[key] + (tree.length === 1 ? '' : `>${last[key]}`);\n if (isLast) {\n item[pathEnd] = '';\n }\n line.push(item[path]);\n }\n if (item[children]) {\n line = line.concat(countLineLen(item[children]!, depth + 1));\n }\n }\n return line;\n }\n\n function parseTree(str: string): TreeData[] {\n const fields = fieldNames();\n const key = fields.key;\n const title = fields.title;\n const children = fields.children;\n const depthRegex = /[^\\s|`│├└]/;\n const rows = str.trim().split('\\n');\n const stack: TreeStack[] = [{ [title]: rows[0], [key]: rows[0] }];\n\n for (let i = 1; i < rows.length; i++) {\n const depth = rows[i].search(depthRegex);\n\n if (depth === -1) {\n continue;\n }\n const node: Partial<TreeData> = {\n [title]: rows[i].slice(depth + 3),\n depth,\n };\n\n while (stack.length && depth <= (stack[stack.length - 1].depth || 0)) {\n stack.pop();\n }\n if (!stack.length) {\n return [];\n }\n const parent = stack[stack.length - 1];\n\n if (!parent[children]) {\n parent[children] = [];\n }\n node[key] = `${parent[key]}-${node[title]}-${depth}-${i}`;\n parent[children].push(node as TreeData);\n stack.push(node as TreeData);\n }\n\n return [stack[0]];\n }\n\n function handleChange(key: string, item: TreeData) {\n if (!_.readonly && isFunction(_.onChange)) {\n let _current = [...current()];\n\n if (_.multiple) {\n const idx = _current.indexOf(key);\n\n if (idx === -1) {\n _current.push(key);\n } else {\n _current.splice(idx, 1);\n }\n } else if (_.toggle && _current[0] === key) {\n _current = [];\n } else {\n _current = [key];\n }\n _.onChange(_.multiple ? _current : _current[0], item);\n }\n }\n function handleClick(e: MouseEvent, item: TreeData) {\n const fields = fieldNames();\n\n handleChange(item[fields.key], item);\n _.onRowClick?.(e, item[fields.key] as never, item as TreeData<never>);\n }\n function renderItem(item: TreeData, title: JSX.Element, subTitle?: JSX.Element): JSX.Element[] {\n const row = _.renderRow?.(item, title, subTitle) || [title, subTitle];\n\n return rtl() ? row.reverse() : row;\n }\n\n function renderTreeRow(list: TreeData[], depth = 0): JSX.Element {\n return (\n <For each={list}>\n {(item) => {\n const fields = fieldNames();\n const title = item[fields.title];\n const key = item[fields.key];\n const name = item[fields.name];\n const subTitle = item[fields.subTitle];\n const children = item[fields.children];\n const _title = name === title || !name ? [title] : [name, title];\n\n return (\n <>\n <li\n class=\"row\"\n classList={{\n active: current().includes(key),\n non: _.readonly || !isFunction(_.onChange),\n }}\n onClick={(e) => handleClick(e, item)}\n onDblClick={(e) => _.onRowDoubleClick?.(e, key, item)}\n style={depth ? { '--depth': `${depth * 2}em` } : void 0}\n data-path-end={item[pathEnd]}\n data-path={item[path]}\n >\n {renderItem(\n item,\n <span class=\"title\">{(rtl() ? _title.reverse() : _title).join(': ')}</span>,\n <Show when={subTitle}>\n <span class=\"sub-title\">{subTitle}</span>\n </Show>,\n )}\n </li>\n <Show when={children}>{renderTreeRow(children!, depth + 1)}</Show>\n </>\n );\n }}\n </For>\n );\n }\n createEffect(() => {\n const data = _.fromSchema ? schema(_.data) : isString(_.data) ? parseTree(_.data) : _.data;\n\n setLines([...new Set(countLineLen(data))]);\n setTreeData(data);\n });\n\n createEffect(() => {\n const list = lines();\n const size = _.size || 'normal';\n\n frameCallback(() => {\n const len = list.length;\n\n if (el && len) {\n const prefixSize = sizeCnt[size];\n\n for (let i = 0; i < len; i++) {\n const al: NodeListOf<HTMLLIElement> = el.querySelectorAll(`li[data-path=\"${list[i]}\"]`);\n\n if (al.length) {\n const rect1 = al[0].getBoundingClientRect();\n let sideLen = rect1.height / 2 + prefixSize;\n\n if (al.length > 1) {\n const { bottom, height, top } = al[1].getBoundingClientRect();\n\n sideLen = i === 0 ? top - rect1.top : bottom - rect1.top - height / 2 + prefixSize;\n al[1].style.setProperty('--c', 'none');\n } else if (i === 0) {\n al[0].style.setProperty('--c', 'none');\n }\n if (al.length !== 1 || i !== 0) {\n al[0].style.setProperty('--line', `${Math.abs(sideLen)}px`);\n }\n }\n }\n }\n });\n });\n\n return (\n <>\n <style textContent={baseStyle()} />\n <style textContent={style} />\n <Show when={_.css}>\n <style textContent={css(_.css)} />\n </Show>\n <ul\n ref={el}\n class=\"tree\"\n classList={{\n [_.size || 'normal']: true,\n [_.class as string]: !!_.class,\n rtl: rtl(),\n }}\n >\n {renderTreeRow(treeData())}\n </ul>\n </>\n );\n}\n\nexport * from './type';\nexport default Tree;\n"],"names":["For","Show","createEffect","createMemo","createSignal","frameCallback","isFunction","isString","css","style","schema","theme","_","el","sizeCnt","small","normal","large","baseStyle","lines","setLines","treeData","setTreeData","normalFieldNames","key","name","title","subTitle","children","description","fieldNames","Object","assign","rtl","direction","current","value","Array","isArray","path","Symbol","pathEnd","data","fromSchema","parseTree","str","fields","depthRegex","rows","trim","split","stack","i","length","depth","search","node","slice","pop","parent","push","Set","countLineLen","tree","lastIdx","last","frist","line","len","item","isLast","concat","list","size","prefixSize","al","querySelectorAll","rect1","getBoundingClientRect","sideLen","height","bottom","top","setProperty","Math","abs","renderTreeRow","_title","e","onRowDoubleClick","handleClick","handleChange","readonly","onChange","_current","multiple","idx","indexOf","splice","toggle","onRowClick","renderItem","row","renderRow","reverse","join","includes","class"],"mappings":"6fAAA,QAASA,OAAAA,CAAG,CAAEC,QAAAA,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3C,EAAOC,KAAa,CAACD,EAAOC,EAAS,CAErE,OAAOM,IAAQqE,EAAIE,OAAO,GAAKF,CACjC,CAAA,EA6BgBjC,iCACqB,AAACpC,CAAAA,IAAQsD,EAAOiB,OAAO,GAAKjB,CAAK,EAAGkB,IAAI,CAAC,eAC7DxG,QAAW0B,sCACeA,wBAbnBQ,IAAUuE,QAAQ,CAAClF,OACtBZ,CAAAA,EAAEgF,QAAQ,EAAI,CAACtF,EAAWM,EAAEiF,QAAQ,CAAA,IAIpCvC,EAAQ,CAAE,UAAW,CAAC,EAAEA,AAAQ,EAARA,EAAU,EAAE,CAAC,AAAC,EAAI,KAAK,IACvCe,CAAI,CAAC5B,EAAQ,GACjB4B,CAAI,CAAC9B,EAAK,qRAUtBtC,QAAW2B,wBAAW0D,EAAc1D,EAAW0B,EAAQ,MAG9D,GAGN,CAAA,EA0DqBjC,eANJ,CACT,CAACT,EAAE6D,IAAI,EAAI,SAAS,CAAE,CAAA,EACtB,CAAC7D,EAAE+F,KAAK,CAAW,CAAE,CAAC,CAAC/F,EAAE+F,KAAK,CAC9B1E,IAAKA,GACP,YAMR"}
|
|
1
|
+
{"version":3,"sources":["../../components/tree/index.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, For, Show } from 'solid-js';\nimport { frameCallback, isFunction, isString } from '@moneko/common';\nimport { css } from '@moneko/css';\n\nimport schema from '../from-schema';\nimport theme from '../theme';\n\nimport { style } from './style';\nimport type {\n TreeData,\n TreeMultipleProps,\n TreeMultipleSchemaProps,\n TreeMultipleStringProps,\n TreeProps,\n TreeSchemaProps,\n TreeStack,\n TreeStringProps,\n} from './type';\n\nimport './register';\n\nfunction Tree(\n _:\n | TreeProps\n | TreeMultipleProps\n | TreeMultipleSchemaProps\n | TreeSchemaProps\n | TreeMultipleStringProps\n | TreeStringProps,\n) {\n const sizeCnt = {\n small: 6,\n normal: 8,\n large: 10,\n };\n const { baseStyle } = theme;\n let el: HTMLUListElement | undefined;\n const [lines, setLines] = createSignal<string[]>([]);\n const [treeData, setTreeData] = createSignal<TreeData[]>([]);\n const normalFieldNames = {\n key: 'key' as const,\n name: 'name' as const,\n title: 'title' as const,\n subTitle: 'subTitle' as const,\n children: 'children' as const,\n description: 'description' as const,\n };\n const fieldNames = createMemo(() => Object.assign(normalFieldNames, _.fieldNames));\n const rtl = createMemo(() => _.direction === 'rtl');\n const current = createMemo(() => {\n if (_.value !== void 0 && _.value !== null) {\n return Array.isArray(_.value) ? _.value : [_.value];\n }\n return [];\n });\n const path = Symbol('path');\n const pathEnd = Symbol('path-end');\n\n function countLineLen(tree: TreeData[], depth = 0) {\n const lastIdx = tree.length - 1;\n const last = tree[lastIdx];\n const frist = tree[0];\n let line: string[] = [];\n const fields = fieldNames();\n const key = fields.key;\n const children = fields.children;\n\n for (let i = 0, len = tree.length; i < len; i++) {\n const item = tree[i],\n isLast = i === lastIdx;\n\n delete item[path];\n delete item[pathEnd];\n if (i === 0 || isLast) {\n item[path] = frist[key] + (tree.length === 1 ? '' : `>${last[key]}`);\n if (isLast) {\n item[pathEnd] = '';\n }\n line.push(item[path]);\n }\n if (item[children]) {\n line = line.concat(countLineLen(item[children], depth + 1));\n }\n }\n return line;\n }\n\n function parseTree(str: string): TreeData[] {\n const fields = fieldNames();\n const key = fields.key;\n const title = fields.title;\n const children = fields.children;\n const depthRegex = /[^\\s|`│├└]/;\n const rows = str.trim().split('\\n');\n const stack: TreeStack[] = [{ [title]: rows[0], [key]: rows[0] }];\n\n for (let i = 1; i < rows.length; i++) {\n const depth = rows[i].search(depthRegex);\n\n if (depth === -1) {\n continue;\n }\n const node: Partial<TreeData> = {\n [title]: rows[i].slice(depth + 3),\n depth,\n };\n\n while (stack.length && depth <= (stack[stack.length - 1].depth || 0)) {\n stack.pop();\n }\n if (!stack.length) {\n return [];\n }\n const parent = stack[stack.length - 1];\n\n if (!parent[children]) {\n parent[children] = [];\n }\n node[key] = `${parent[key]}-${node[title]}-${depth}-${i}`;\n parent[children].push(node as TreeData);\n stack.push(node as TreeData);\n }\n\n return [stack[0]];\n }\n\n function handleChange(key: string, item: TreeData) {\n if (!_.readonly && isFunction(_.onChange)) {\n let _current = [...current()];\n\n if (_.multiple) {\n const idx = _current.indexOf(key);\n\n if (idx === -1) {\n _current.push(key);\n } else {\n _current.splice(idx, 1);\n }\n } else if (_.toggle && _current[0] === key) {\n _current = [];\n } else {\n _current = [key];\n }\n _.onChange(_.multiple ? _current : _current[0], item);\n }\n }\n function handleClick(e: MouseEvent, item: TreeData) {\n const fields = fieldNames();\n\n handleChange(item[fields.key], item);\n _.onRowClick?.(e, item[fields.key] as never, item as TreeData<never>);\n }\n function renderItem(item: TreeData, title: JSX.Element, subTitle?: JSX.Element): JSX.Element[] {\n const row = _.renderRow?.(item, title, subTitle) || [title, subTitle];\n\n return rtl() ? row.reverse() : row;\n }\n\n function renderTreeRow(list: TreeData[], depth = 0): JSX.Element {\n return (\n <For each={list}>\n {(item) => {\n const fields = fieldNames();\n const title = item[fields.title];\n const key = item[fields.key];\n const name = item[fields.name];\n const subTitle = item[fields.subTitle];\n const children = item[fields.children];\n const _title = name === title || !name ? [title] : [name, title];\n\n return (\n <>\n <li\n class=\"row\"\n classList={{\n active: current().includes(key),\n non: _.readonly || !isFunction(_.onChange),\n }}\n onClick={(e) => {\n handleClick(e, item);\n }}\n onDblClick={(e) => _.onRowDoubleClick?.(e, key, item)}\n style={depth ? { '--depth': `${depth * 2}em` } : void 0}\n data-path-end={item[pathEnd]}\n data-path={item[path]}\n >\n {renderItem(\n item,\n <span class=\"title\">{(rtl() ? _title.reverse() : _title).join(': ')}</span>,\n <Show when={subTitle}>\n <span class=\"sub-title\">{subTitle}</span>\n </Show>,\n )}\n </li>\n <Show when={children}>{renderTreeRow(children!, depth + 1)}</Show>\n </>\n );\n }}\n </For>\n );\n }\n createEffect(() => {\n const data = _.fromSchema ? schema(_.data) : isString(_.data) ? parseTree(_.data) : _.data;\n\n setLines([...new Set(countLineLen(data))]);\n setTreeData(data);\n });\n\n createEffect(() => {\n const list = lines();\n const size = _.size || 'normal';\n\n frameCallback(() => {\n const len = list.length;\n\n if (el && len) {\n const prefixSize = sizeCnt[size];\n\n for (let i = 0; i < len; i++) {\n const al: NodeListOf<HTMLLIElement> = el.querySelectorAll(`li[data-path=\"${list[i]}\"]`);\n\n if (al.length) {\n const rect1 = al[0].getBoundingClientRect();\n let sideLen = rect1.height / 2 + prefixSize;\n\n if (al.length > 1) {\n const { bottom, height, top } = al[1].getBoundingClientRect();\n\n sideLen = i === 0 ? top - rect1.top : bottom - rect1.top - height / 2 + prefixSize;\n al[1].style.setProperty('--c', 'none');\n } else if (i === 0) {\n al[0].style.setProperty('--c', 'none');\n }\n if (al.length !== 1 || i !== 0) {\n al[0].style.setProperty('--line', `${Math.abs(sideLen)}px`);\n }\n }\n }\n }\n });\n });\n\n return (\n <>\n <style textContent={baseStyle()} />\n <style textContent={style} />\n <Show when={_.css}>\n <style textContent={css(_.css)} />\n </Show>\n <ul\n ref={el}\n class=\"tree\"\n classList={{\n [_.size || 'normal']: true,\n [_.class!]: !!_.class,\n rtl: rtl(),\n }}\n >\n {renderTreeRow(treeData())}\n </ul>\n </>\n );\n}\n\nexport * from './type';\nexport default Tree;\n"],"names":["createEffect","createMemo","createSignal","For","Show","frameCallback","isFunction","isString","css","schema","theme","style","_","el","sizeCnt","small","normal","large","baseStyle","lines","setLines","treeData","setTreeData","normalFieldNames","key","name","title","subTitle","children","description","fieldNames","Object","assign","rtl","direction","current","value","Array","isArray","path","Symbol","pathEnd","data","fromSchema","parseTree","str","fields","depthRegex","rows","trim","split","stack","i","length","depth","search","node","slice","pop","parent","push","Set","countLineLen","tree","lastIdx","last","frist","line","len","item","isLast","concat","list","size","prefixSize","al","querySelectorAll","rect1","getBoundingClientRect","sideLen","height","bottom","top","setProperty","Math","abs","renderTreeRow","_title","e","onRowDoubleClick","handleClick","handleChange","readonly","onChange","_current","multiple","idx","indexOf","splice","toggle","onRowClick","renderItem","row","renderRow","reverse","join","includes","class"],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F,EAAE2F,SAAS,MAAX3F,EAAcyD,EAAM3C,EAAOC,KAAa,CAACD,EAAOC,EAAS,CAErE,OAAOM,IAAQqE,EAAIE,OAAO,GAAKF,CACjC,CAAA,EA+BgBjC,iCACqB,AAACpC,CAAAA,IAAQsD,EAAOiB,OAAO,GAAKjB,CAAK,EAAGkB,IAAI,CAAC,eAC7DrG,QAAWuB,sCACeA,wBAfnBQ,IAAUuE,QAAQ,CAAClF,OACtBZ,CAAAA,EAAEgF,QAAQ,EAAI,CAACtF,EAAWM,EAAEiF,QAAQ,CAAA,IAMpCvC,EAAQ,CAAE,UAAW,CAAC,EAAEA,AAAQ,EAARA,EAAU,EAAE,CAAC,AAAC,EAAI,KAAK,IACvCe,CAAI,CAAC5B,EAAQ,GACjB4B,CAAI,CAAC9B,EAAK,qRAUtBnC,QAAWwB,wBAAW0D,EAAc1D,EAAW0B,EAAQ,MAG9D,GAGN,CAAA,EA0DqBjC,eANJ,CACT,CAACT,EAAE6D,IAAI,EAAI,SAAS,CAAE,CAAA,EACtB,CAAC7D,EAAE+F,KAAK,CAAE,CAAE,CAAC,CAAC/F,EAAE+F,KAAK,CACrB1E,IAAKA,GACP,YAMR"}
|
package/es/tree/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/tree/register.tsx"],"sourcesContent":["import { createEffect, mergeProps } from 'solid-js';\nimport { customElement } from 'solid-element';\nimport Tree from './index';\nimport type { TreeData, TreeProps } from './type';\n\ncustomElement<TreeProps>(\n 'n-tree',\n {\n fieldNames: {},\n fromSchema: void 0,\n size: void 0,\n data: [],\n multiple: void 0,\n value: void 0,\n onChange: void 0,\n class: void 0,\n css: void 0,\n readonly: void 0,\n toggle: void 0,\n direction: void 0,\n onRowClick: void 0,\n onRowDoubleClick: void 0,\n renderRow: void 0,\n },\n (_, opt) => {\n const el = opt.element;\n const props = mergeProps(\n {\n data: el.data,\n value: el.value,\n multiple: el.multiple,\n fromSchema: el.fromSchema,\n size: el.size,\n css: el.css,\n readonly: el.readonly,\n toggle: el.toggle,\n direction: el.direction,\n onChange(key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('change', {\n detail: [key, item],\n }),\n );\n },\n onRowClick(e: MouseEvent, key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('rowclick', {\n detail: [e, key, item],\n }),\n );\n },\n onRowDoubleClick(e: MouseEvent, key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('rowdoubleclick', {\n detail: [e, key, item],\n }),\n );\n },\n },\n _,\n );\n\n createEffect(() => {\n el.removeAttribute('css');\n el.removeAttribute('field-names');\n el.removeAttribute('data');\n });\n return <Tree {...props} />;\n },\n);\n"],"names":["createEffect","mergeProps","customElement","Tree","fieldNames","fromSchema","size","data","multiple","value","onChange","class","css","readonly","toggle","direction","onRowClick","onRowDoubleClick","renderRow","_","opt","el","element","props","key","item","dispatchEvent","CustomEvent","detail","e","removeAttribute"],"mappings":"8CAAA,QAASA,gBAAAA,CAAY,CAAEC,cAAAA,CAAU,KAAQ,UAAW,AACpD,QAASC,iBAAAA,CAAa,KAAQ,eAAgB,
|
|
1
|
+
{"version":3,"sources":["../../components/tree/register.tsx"],"sourcesContent":["import { createEffect, mergeProps } from 'solid-js';\nimport { customElement } from 'solid-element';\n\nimport Tree from './index';\nimport type { TreeData, TreeProps } from './type';\n\ncustomElement<TreeProps>(\n 'n-tree',\n {\n fieldNames: {},\n fromSchema: void 0,\n size: void 0,\n data: [],\n multiple: void 0,\n value: void 0,\n onChange: void 0,\n class: void 0,\n css: void 0,\n readonly: void 0,\n toggle: void 0,\n direction: void 0,\n onRowClick: void 0,\n onRowDoubleClick: void 0,\n renderRow: void 0,\n },\n (_, opt) => {\n const el = opt.element;\n const props = mergeProps(\n {\n data: el.data,\n value: el.value,\n multiple: el.multiple,\n fromSchema: el.fromSchema,\n size: el.size,\n css: el.css,\n readonly: el.readonly,\n toggle: el.toggle,\n direction: el.direction,\n onChange(key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('change', {\n detail: [key, item],\n }),\n );\n },\n onRowClick(e: MouseEvent, key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('rowclick', {\n detail: [e, key, item],\n }),\n );\n },\n onRowDoubleClick(e: MouseEvent, key: string, item: TreeData) {\n el.dispatchEvent(\n new CustomEvent('rowdoubleclick', {\n detail: [e, key, item],\n }),\n );\n },\n },\n _,\n );\n\n createEffect(() => {\n el.removeAttribute('css');\n el.removeAttribute('field-names');\n el.removeAttribute('data');\n });\n return <Tree {...props} />;\n },\n);\n"],"names":["createEffect","mergeProps","customElement","Tree","fieldNames","fromSchema","size","data","multiple","value","onChange","class","css","readonly","toggle","direction","onRowClick","onRowDoubleClick","renderRow","_","opt","el","element","props","key","item","dispatchEvent","CustomEvent","detail","e","removeAttribute"],"mappings":"8CAAA,QAASA,gBAAAA,CAAY,CAAEC,cAAAA,CAAU,KAAQ,UAAW,AACpD,QAASC,iBAAAA,CAAa,KAAQ,eAAgB,AAE9C,QAAOC,MAAU,SAAU,CAG3BD,EACE,SACA,CACEE,WAAY,CAAC,EACbC,WAAY,KAAK,EACjBC,KAAM,KAAK,EACXC,KAAM,EAAE,CACRC,SAAU,KAAK,EACfC,MAAO,KAAK,EACZC,SAAU,KAAK,EACfC,MAAO,KAAK,EACZC,IAAK,KAAK,EACVC,SAAU,KAAK,EACfC,OAAQ,KAAK,EACbC,UAAW,KAAK,EAChBC,WAAY,KAAK,EACjBC,iBAAkB,KAAK,EACvBC,UAAW,KAAK,CAClB,EACA,CAACC,EAAGC,KACF,IAAMC,EAAKD,EAAIE,OAAO,CAChBC,EAAQtB,EACZ,CACEM,KAAMc,EAAGd,IAAI,CACbE,MAAOY,EAAGZ,KAAK,CACfD,SAAUa,EAAGb,QAAQ,CACrBH,WAAYgB,EAAGhB,UAAU,CACzBC,KAAMe,EAAGf,IAAI,CACbM,IAAKS,EAAGT,GAAG,CACXC,SAAUQ,EAAGR,QAAQ,CACrBC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