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,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 最简单的用法
|
|
3
|
+
description: 最简单的用法
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button>消息通知</n-button>
|
|
9
|
+
<script>
|
|
10
|
+
const { notification } = NekoUI;
|
|
11
|
+
const btn = container.querySelector('n-button');
|
|
12
|
+
|
|
13
|
+
btn.addEventListener('click', function () {
|
|
14
|
+
notification.info('操作成功!!!');
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const { notification } = NekoUI;
|
|
21
|
+
|
|
22
|
+
const Demo = () => {
|
|
23
|
+
const handleOpen = () => {
|
|
24
|
+
notification.info('操作成功!!!');
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<n-button type="primary" onClick={handleOpen}>
|
|
29
|
+
显示通知
|
|
30
|
+
</n-button>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
render(<Demo />);
|
|
35
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 手动关闭
|
|
3
|
+
description: 带关闭按钮
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button>消息通知(手动关闭)</n-button>
|
|
9
|
+
<script>
|
|
10
|
+
const { notification } = NekoUI;
|
|
11
|
+
const btn = container.querySelector('n-button');
|
|
12
|
+
|
|
13
|
+
btn.addEventListener('click', function () {
|
|
14
|
+
notification.info('操作成功!!!', 0, true);
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const { notification } = NekoUI;
|
|
21
|
+
|
|
22
|
+
const Demo = () => {
|
|
23
|
+
const handleOpen = () => {
|
|
24
|
+
notification.info('操作成功!!!', 0, true);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<n-button type="primary" onClick={handleOpen}>
|
|
29
|
+
显示通知
|
|
30
|
+
</n-button>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
render(<Demo />);
|
|
35
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 不同的通知类型
|
|
3
|
+
description: 不同的通知类型
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button>消息</n-button>
|
|
9
|
+
<n-button type="primary">主要</n-button>
|
|
10
|
+
<n-button type="error">错误</n-button>
|
|
11
|
+
<n-button type="warning">警告</n-button>
|
|
12
|
+
<n-button type="success">成功</n-button>
|
|
13
|
+
<script>
|
|
14
|
+
const { notification } = NekoUI;
|
|
15
|
+
const btns = container.querySelectorAll('n-button');
|
|
16
|
+
|
|
17
|
+
btns.forEach((btn) => {
|
|
18
|
+
btn.addEventListener('click', function () {
|
|
19
|
+
switch (btn.type) {
|
|
20
|
+
case 'primary':
|
|
21
|
+
notification.primary(`${btn.type} message`, 5000);
|
|
22
|
+
break;
|
|
23
|
+
case 'warning':
|
|
24
|
+
notification.warning(`${btn.type} message`, 2000);
|
|
25
|
+
break;
|
|
26
|
+
case 'error':
|
|
27
|
+
notification.error(`${btn.type} message`, 0, true);
|
|
28
|
+
break;
|
|
29
|
+
case 'success':
|
|
30
|
+
notification.success(`${btn.type} message`, 4000);
|
|
31
|
+
break;
|
|
32
|
+
default:
|
|
33
|
+
notification.info('info message', 1000);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
const Demo = () => {
|
|
43
|
+
const { notification } = NekoUI;
|
|
44
|
+
const handleOpen = (type: string) => {
|
|
45
|
+
switch (type) {
|
|
46
|
+
case 'primary':
|
|
47
|
+
notification.primary(`${type} message`, 5000);
|
|
48
|
+
break;
|
|
49
|
+
case 'warning':
|
|
50
|
+
notification.warning(`${type} message`, 2000);
|
|
51
|
+
break;
|
|
52
|
+
case 'error':
|
|
53
|
+
notification.error(`${type} message`, 0, true);
|
|
54
|
+
break;
|
|
55
|
+
case 'success':
|
|
56
|
+
notification.success(`${type} message`, 4000);
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
notification.info('info message', 1000);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<n-button onClick={handleOpen.bind(null, 'info')}>消息</n-button>
|
|
67
|
+
<n-button type="primary" onClick={handleOpen.bind(null, 'primary')}>
|
|
68
|
+
主要
|
|
69
|
+
</n-button>
|
|
70
|
+
<n-button type="error" onClick={handleOpen.bind(null, 'error')}>
|
|
71
|
+
错误
|
|
72
|
+
</n-button>
|
|
73
|
+
<n-button type="warning" onClick={handleOpen.bind(null, 'warning')}>
|
|
74
|
+
警告
|
|
75
|
+
</n-button>
|
|
76
|
+
<n-button type="success" onClick={handleOpen.bind(null, 'success')}>
|
|
77
|
+
成功
|
|
78
|
+
</n-button>
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
render(<Demo />);
|
|
84
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 更新内容
|
|
3
|
+
description: 可以通过唯一的 key 来更新内容
|
|
4
|
+
order: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-button>更新消息 (手动关闭)</n-button>
|
|
9
|
+
<script>
|
|
10
|
+
const { notification } = NekoUI;
|
|
11
|
+
const btn = container.querySelector('n-button');
|
|
12
|
+
|
|
13
|
+
btn.addEventListener('click', function () {
|
|
14
|
+
const id = notification.info('操作成功!!!', 5000);
|
|
15
|
+
|
|
16
|
+
const timer = setTimeout(() => {
|
|
17
|
+
const icon = document.createElement('i');
|
|
18
|
+
|
|
19
|
+
icon.textContent = '🎉';
|
|
20
|
+
notification.update(id, {
|
|
21
|
+
type: 'success',
|
|
22
|
+
children: '更新成功!!!',
|
|
23
|
+
icon: icon,
|
|
24
|
+
});
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
}, 2000);
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
const { notification } = NekoUI;
|
|
33
|
+
|
|
34
|
+
const Demo = () => {
|
|
35
|
+
const handleOpen = () => {
|
|
36
|
+
const id = notification.info('操作成功!!!', 5000);
|
|
37
|
+
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
notification.update(id, {
|
|
40
|
+
type: 'success',
|
|
41
|
+
children: '更新成功!!!',
|
|
42
|
+
icon: <i>🎉</i>,
|
|
43
|
+
});
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
}, 2000);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return <n-button onClick={handleOpen}>更新消息 (手动关闭)</n-button>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
render(<Demo />);
|
|
52
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/notification/index.tsx"],"sourcesContent":["import notification from './notification';\nimport queque, { type NotificationProps } from './queque';\n\nexport type {
|
|
1
|
+
{"version":3,"sources":["../../components/notification/index.tsx"],"sourcesContent":["import notification from './notification';\nimport queque, { type NotificationProps } from './queque';\n\nexport type { NotificationProps, NotificationType } from './queque';\n\n/** Api */\ninterface Notification {\n /**\n * 信息\n * @param {String} content - 内容.\n * @param {Number} duration - 显示时间.\n * @param {Boolean} close - 显示关闭按钮.\n * @return {String} id\n */\n info(content: JSX.Element, duration?: number, close?: boolean, icon?: JSX.Element): string;\n /**\n * 成功\n * @param {String} content - 内容.\n * @param {Number} duration - 显示时间.\n * @param {Boolean} close - 显示关闭按钮.\n * @return {String} id\n */\n success(content: JSX.Element, duration?: number, close?: boolean, icon?: JSX.Element): string;\n /**\n * 错误\n * @param {String} content - 内容.\n * @param {Number} duration - 显示时间.\n * @param {Boolean} close - 显示关闭按钮.\n * @return {String} id\n */\n error(content: JSX.Element, duration?: number, close?: boolean, icon?: JSX.Element): string;\n /**\n * 警告\n * @param {String} content - 内容.\n * @param {Number} duration - 显示时间.\n * @param {Boolean} close - 显示关闭按钮.\n * @return {String} id\n */\n warning(content: JSX.Element, duration?: number, close?: boolean, icon?: JSX.Element): string;\n /**\n * 主要\n * @param {String} content - 内容.\n * @param {Number} duration - 显示时间.\n * @param {Boolean} close - 显示关闭按钮.\n * @return {String} id\n */\n primary(content: JSX.Element, duration?: number, close?: boolean, icon?: JSX.Element): string;\n /**\n * 更新通知内容\n * @param {String} id 通知id\n * @param {NotificationProps} item 更新内容\n * @constructor\n */\n update(uniqueId: string, item: NotificationProps): void;\n /**\n * 销毁全部通知\n * @constructor\n */\n destory: VoidFunction;\n}\n\nexport default {\n info: notification.bind(null, 'info'),\n success: notification.bind(null, 'success'),\n error: notification.bind(null, 'error'),\n warning: notification.bind(null, 'warning'),\n primary: notification.bind(null, 'primary'),\n update: queque.update,\n destory: queque.clean,\n} as Notification;\n"],"names":["info","notification","bind","success","error","warning","primary","update","queque","destory","clean"],"mappings":"kGA6DA,+CAAA,uBA7DyB,+BACsB,sEA4D/C,EAAe,CACbA,KAAMC,SAAY,CAACC,IAAI,CAAC,KAAM,QAC9BC,QAASF,SAAY,CAACC,IAAI,CAAC,KAAM,WACjCE,MAAOH,SAAY,CAACC,IAAI,CAAC,KAAM,SAC/BG,QAASJ,SAAY,CAACC,IAAI,CAAC,KAAM,WACjCI,QAASL,SAAY,CAACC,IAAI,CAAC,KAAM,WACjCK,OAAQC,SAAM,CAACD,MAAM,CACrBE,QAASD,SAAM,CAACE,KAAK,AACvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});const e=require("solid-js/web"),t=require("solid-js"),n=require("@moneko/css"),r=i(require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});const e=require("solid-js/web"),t=require("solid-js"),n=require("@moneko/css"),r=i(require("../theme")),l=i(require("./queque")),o=require("./styles");function i(e){return e&&e.__esModule?e:{default:e}}const s=(0,e.template)("<style> "),c=(0,e.template)("<style>"),u=(0,e.template)('<span class="close">'),a=(0,e.template)('<div><div class="content">'),d="n-notification-box",f=(i,f,m=3e3,h,p)=>{let g=(0,t.createUniqueId)(),{list:v,add:y,remove:q}=l.default,{baseStyle:_}=r.default,w=document.getElementById(d);if(y({type:i,icon:p,children:f,close:h,uniqueId:g}),m&&m>0){let e=setTimeout(()=>{q(g),clearTimeout(e)},m)}if(!w){(w=document.createElement("div")).id=d,w.style.position="fixed",w.style.insetBlockStart="16px",w.style.insetInlineStart="50%",w.style.transform="translateX(-50%)",w.attachShadow({mode:"open"});let r=(0,e.render)(()=>((0,t.createEffect)(()=>{0===v().length&&(r(),w?.remove())}),(0,e.createComponent)(t.Show,{get when(){return v().length},get children(){return[(()=>{let t=s(),n=t.firstChild;return(0,e.effect)(()=>n.data=_()),t})(),(()=>{let e=c();return e.textContent=o.styles,e})(),(0,e.createComponent)(t.For,{get each(){return v()},children:r=>(()=>{let l=a(),o=l.firstChild;return(0,e.insert)(l,(0,e.createComponent)(t.Show,{get when(){return r.icon},get children(){return r.icon}}),o),(0,e.insert)(o,()=>r.children),(0,e.insert)(l,(0,e.createComponent)(t.Show,{get when(){return r.close},get children(){let e=u();return e.$$click=()=>{q(r.uniqueId)},e}}),null),(0,e.effect)(t=>{let o=(0,n.cx)("notification",r.type),i=!!r.closeing;return o!==t._v$&&(0,e.className)(l,t._v$=o),i!==t._v$2&&l.classList.toggle("closeing",t._v$2=i),t},{_v$:void 0,_v$2:void 0}),l})()})]}})),w.shadowRoot);document.body.appendChild(w)}return g};(0,e.delegateEvents)(["click"]);
|
|
2
2
|
//# sourceMappingURL=notification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/notification/notification.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../components/notification/notification.tsx"],"sourcesContent":["import { createEffect, createUniqueId, For, Show } from 'solid-js';\nimport { render } from 'solid-js/web';\nimport { cx } from '@moneko/css';\n\nimport theme from '../theme';\n\nimport queque, { type NotificationType } from './queque';\nimport { styles } from './styles';\n\nconst mountId = 'n-notification-box';\n\nconst notification = (\n type: keyof typeof NotificationType,\n children: JSX.Element,\n duration = 3000,\n close?: boolean,\n icon?: JSX.Element,\n) => {\n const uniqueId = createUniqueId();\n const { list, add, remove } = queque;\n const { baseStyle } = theme;\n let mount = document.getElementById(mountId);\n\n add({\n type,\n icon,\n children,\n close,\n uniqueId,\n });\n if (duration && duration > 0) {\n const timer = setTimeout(() => {\n remove(uniqueId);\n clearTimeout(timer);\n }, duration);\n }\n if (!mount) {\n mount = document.createElement('div');\n mount.id = mountId;\n mount.style.position = 'fixed';\n mount.style.insetBlockStart = '16px';\n mount.style.insetInlineStart = '50%';\n mount.style.transform = 'translateX(-50%)';\n mount.attachShadow({ mode: 'open' });\n\n const unmount = render(() => {\n createEffect(() => {\n if (list().length === 0) {\n unmount();\n mount?.remove();\n }\n });\n return (\n <Show when={list().length}>\n <style textContent={baseStyle()} />\n <style textContent={styles} />\n <For each={list()}>\n {(item) => {\n return (\n <div\n class={cx('notification', item.type)}\n classList={{\n closeing: item.closeing,\n }}\n >\n <Show when={item.icon}>{item.icon}</Show>\n <div class=\"content\">{item.children}</div>\n <Show when={item.close}>\n <span\n class=\"close\"\n onClick={() => {\n remove(item.uniqueId);\n }}\n />\n </Show>\n </div>\n );\n }}\n </For>\n </Show>\n );\n }, mount.shadowRoot!);\n\n document.body.appendChild(mount);\n }\n return uniqueId;\n};\n\nexport default notification;\n"],"names":["mountId","type","children","duration","close","icon","uniqueId","createUniqueId","list","add","remove","queque","baseStyle","theme","mount","document","getElementById","timer","setTimeout","clearTimeout","createElement","id","style","position","insetBlockStart","insetInlineStart","transform","attachShadow","mode","unmount","render","createEffect","length","Show","styles","For","item","cx","closeing","shadowRoot","body","appendChild"],"mappings":"kGAwFA,+CAAA,qBAvFuB,0BADiC,sBAErC,2BAED,yBAE4B,uBACvB,sNAEjBA,EAAU,qBA+EhB,EA7EqB,CACnBC,EACAC,EACAC,EAAW,GAAI,CACfC,EACAC,KAEA,IAAMC,EAAWC,GAAAA,gBAAc,IACzB,CAAEC,KAAAA,CAAI,CAAEC,IAAAA,CAAG,CAAEC,OAAAA,CAAM,CAAE,CAAGC,SAAM,CAC9B,CAAEC,UAAAA,CAAS,CAAE,CAAGC,SAAK,CACvBC,EAAQC,SAASC,cAAc,CAAChB,GASpC,GAPAS,EAAI,CACFR,KAAAA,EACAI,KAAAA,EACAH,SAAAA,EACAE,MAAAA,EACAE,SAAAA,CACF,GACIH,GAAYA,EAAW,EAAG,CAC5B,IAAMc,EAAQC,WAAW,KACvBR,EAAOJ,GACPa,aAAaF,EACf,EAAGd,EACL,CACA,GAAI,CAACW,EAAO,CAEVA,AADAA,CAAAA,EAAQC,SAASK,aAAa,CAAC,MAAK,EAC9BC,EAAE,CAAGrB,EACXc,EAAMQ,KAAK,CAACC,QAAQ,CAAG,QACvBT,EAAMQ,KAAK,CAACE,eAAe,CAAG,OAC9BV,EAAMQ,KAAK,CAACG,gBAAgB,CAAG,MAC/BX,EAAMQ,KAAK,CAACI,SAAS,CAAG,mBACxBZ,EAAMa,YAAY,CAAC,CAAEC,KAAM,MAAO,GAElC,IAAMC,EAAUC,GAAAA,QAAM,EAAC,KACrBC,GAAAA,cAAY,EAAC,KACW,IAAlBvB,IAAOwB,MAAM,GACfH,IACAf,GAAOJ,SAEX,yBAEGuB,MAAI,oBAAOzB,IAAOwB,MAAM,qFACHpB,gDACAsB,QAAM,6BACzBC,KAAG,oBAAO3B,cACR,AAAC4B,6EAQKH,MAAI,oBAAOG,EAAK/B,IAAI,wBAAG+B,EAAK/B,IAAI,0BACX+B,EAAKlC,QAAQ,uCAClC+B,MAAI,oBAAOG,EAAKhC,KAAK,4CAGT,KACPM,EAAO0B,EAAK9B,QAAQ,CACtB,oCAZG+B,GAAAA,IAAE,EAAC,eAAgBD,EAAKnC,IAAI,MAEvBmC,EAAKE,QAAQ,4IAmBpCxB,EAAMyB,UAAU,EAEnBxB,SAASyB,IAAI,CAACC,WAAW,CAAC3B,EAC5B,CACA,OAAOR,CACT"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 受控
|
|
3
|
+
description: 当手动传入 `page` 时, 为受控模式
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-pagination page="1" page-size="10" total="85"></n-pagination>
|
|
9
|
+
<script>
|
|
10
|
+
const el = container.querySelector('n-pagination');
|
|
11
|
+
|
|
12
|
+
el.onchange = function (e) {
|
|
13
|
+
const [page, size] = e.detail;
|
|
14
|
+
e.target.page = page;
|
|
15
|
+
};
|
|
16
|
+
</script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
<n-pagination
|
|
21
|
+
page={1}
|
|
22
|
+
page-size={10}
|
|
23
|
+
total={85}
|
|
24
|
+
onChange={function (e) {
|
|
25
|
+
const [page, size] = e.detail;
|
|
26
|
+
e.target.page = page;
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 不同的尺寸
|
|
3
|
+
description: Pagination 内置有大、中、小三种尺寸。通过 `size` 进行设置; 默认为 'normal'。
|
|
4
|
+
order: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<h4>小:</h4>
|
|
9
|
+
<n-pagination page-size="15" total="85" size="small"></n-pagination>
|
|
10
|
+
<h4>默认: 中</h4>
|
|
11
|
+
<n-pagination page-size="15" total="85" size="normal"></n-pagination>
|
|
12
|
+
<h4>大:</h4>
|
|
13
|
+
<n-pagination page-size="15" total="85" size="large"></n-pagination>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```jsx
|
|
17
|
+
<h4>小:</h4>
|
|
18
|
+
<n-pagination page-size={15} total={85} size="small" />
|
|
19
|
+
<h4>默认: 中</h4>
|
|
20
|
+
<n-pagination page-size={15} total={85} size="normal" />
|
|
21
|
+
<h4>大:</h4>
|
|
22
|
+
<n-pagination page-size={15} total={85} size="large" />
|
|
23
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 显示数据总量
|
|
3
|
+
description: 通过设置 `totalText` 展示总共有多少数据。
|
|
4
|
+
order: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<h4>不显示:</h4>
|
|
9
|
+
<n-pagination total-text="false" page-size="10" total="85"></n-pagination>
|
|
10
|
+
<h4>使用插槽: slot</h4>
|
|
11
|
+
<n-pagination page-size="10" total="85">
|
|
12
|
+
<span slot="total-text">总共 85 条数据</span>
|
|
13
|
+
</n-pagination>
|
|
14
|
+
<h4>使用函数:</h4>
|
|
15
|
+
<n-pagination class="func" page-size="10" total="85"></n-pagination>
|
|
16
|
+
<script>
|
|
17
|
+
const el = container.querySelector('n-pagination.func');
|
|
18
|
+
|
|
19
|
+
el.totalText = function (total, rangs) {
|
|
20
|
+
return `${rangs.join('~')} 共 ${total} 项`;
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<h4>不显示:</h4>
|
|
27
|
+
<n-pagination total-text={false} page-size={10} total={85} />
|
|
28
|
+
<h4>使用插槽: slot</h4>
|
|
29
|
+
<n-pagination page-size={10} total={85}>
|
|
30
|
+
<span slot="total-text">总共 85 条数据</span>
|
|
31
|
+
</n-pagination>
|
|
32
|
+
<h4>使用函数:</h4>
|
|
33
|
+
<n-pagination
|
|
34
|
+
page-size={10}
|
|
35
|
+
total={85}
|
|
36
|
+
total-text={function () {
|
|
37
|
+
return function (total, rangs) {
|
|
38
|
+
return `${rangs.join('~')} 共 ${total} 项`;
|
|
39
|
+
};
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
```
|
package/lib/pagination/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});const e=require("solid-js/web"),t=require("solid-js"),n=o(require("@moneko/common/lib/isFunction")),r=require("@moneko/css"),i=require("solid-element"),l=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});const e=require("solid-js/web"),t=require("solid-js"),n=o(require("@moneko/common/lib/isFunction")),r=require("@moneko/css"),i=require("solid-element"),l=o(require("../theme")),a=require("./styles");function o(e){return e&&e.__esModule?e:{default:e}}require("../button"),require("../typography");const s=(0,e.template)("<li>"),c=(0,e.template)(`<li><slot name="total-text"><n-typography>共 <!> 项`,!0,!1),u=(0,e.template)("<style> "),p=(0,e.template)("<style>"),v=(0,e.template)(`<nav aria-label="pagination" class="pagination"><ul><li><n-button class="pagination-item pagination-prev">〈</n-button></li><li><n-button class="pagination-item pagination-next">〉`,!0,!1),d=(0,e.template)('<li><n-button class="pagination-item">',!0,!1);function g(i){let{baseStyle:o}=l.default,[g,f]=(0,t.splitProps)(i,["page","pageSize","total","css","totalText"]),[h,m]=(0,t.createSignal)(1),[$,_]=(0,t.createSignal)(20),[b,C]=(0,t.createSignal)(0);(0,t.createEffect)(()=>{(0,t.batch)(()=>{"number"==typeof g.page&&g.page!==(0,t.untrack)(h)&&m(g.page),"number"==typeof g.pageSize&&g.pageSize!==(0,t.untrack)($)&&_(g.pageSize),"number"==typeof g.total&&g.total!==(0,t.untrack)(b)&&C(g.total)})});let w=(0,t.createMemo)(()=>Math.ceil(b()/$())),y=(0,t.createMemo)(()=>{let e=w(),t=[];if(e<=5)for(let n=1;n<=e;n++)t.push(n);else{let n=Math.min(e,Math.max(1,h()-Math.floor(2.5))+5-1);for(let e=n-5+1;e<=n;e++)t.push(e)}if(t.length){let n=t[t.length-1],r=t[0];r>=2&&(2===r?t.splice(0,1,"p"):t.unshift("p"),t.unshift(1),n<e&&(n+=1,t.push(n))),n===e-1?(t.splice(t.length-1,1,"n"),t.push(e)):n<e-1&&(t.push("n"),t.push(e))}return t});function x(e){let n=(0,t.untrack)(h),r="n"===e?n+5:"p"===e?n-5:e;r<1?r=1:r>(0,t.untrack)(w)&&(r=(0,t.untrack)(w)),n!==r&&(void 0===g.page&&m(r),f.onChange?.(r,(0,t.untrack)($)))}let k=()=>{let r=(0,t.createMemo)(()=>[(h()-1)*$()+1,h()*$()]);return(0,e.createComponent)(t.Show,{get when(){return!1!==g.totalText},get children(){let t=s();return(0,e.insert)(t,(()=>{let t=(0,e.memo)(()=>!!(0,n.default)(g.totalText));return()=>t()?g.totalText(b(),r()):(()=>{let t=c(),n=t.firstChild,r=n.firstChild,i=r.firstChild.nextSibling;return i.nextSibling,n._$owner=(0,e.getOwner)(),r._$owner=(0,e.getOwner)(),(0,e.insert)(r,b,i),t})()})()),t}})};return(0,e.createComponent)(t.Show,{get when(){return y().length},get children(){return[(()=>{let t=u(),n=t.firstChild;return(0,e.effect)(()=>n.data=o()),t})(),(()=>{let e=p();return e.textContent=a.styles,e})(),(0,e.createComponent)(t.Show,{get when(){return g.css},get children(){let t=u(),n=t.firstChild;return(0,e.effect)(()=>n.data=(0,r.css)(g.css)),t}}),(()=>{let n=v(),r=n.firstChild,i=r.firstChild,l=i.firstChild,a=i.nextSibling,o=a.firstChild;return(0,e.insert)(r,(0,e.createComponent)(k,{}),i),l.$$click=()=>{x((0,t.untrack)(h)-1)},l.flat=!0,l.circle=!0,l._$owner=(0,e.getOwner)(),(0,e.insert)(r,(0,e.createComponent)(t.For,{get each(){return y()},children:n=>{let r=(0,t.createMemo)(()=>n===h());return(()=>{let t=d(),i=t.firstChild;return i.$$click=()=>{x(n)},i.circle="number"!=typeof n,i._$owner=(0,e.getOwner)(),(0,e.insert)(i,n),(0,e.effect)(t=>{let l={[`pagination-${n}`]:"number"!=typeof n},a=f.size,o=!r(),s=r()?"primary":"default",c=r(),u=r()&&"page";return t._v$5=(0,e.classList)(i,l,t._v$5),a!==t._v$6&&(i.size=t._v$6=a),o!==t._v$7&&(i.flat=t._v$7=o),s!==t._v$8&&(i.type=t._v$8=s),c!==t._v$9&&(i.fill=t._v$9=c),u!==t._v$10&&(i.ariaCurrent=t._v$10=u),t},{_v$5:void 0,_v$6:void 0,_v$7:void 0,_v$8:void 0,_v$9:void 0,_v$10:void 0}),t})()}}),a),o.$$click=()=>{x((0,t.untrack)(h)+1)},o.flat=!0,o.circle=!0,o._$owner=(0,e.getOwner)(),(0,e.effect)(e=>{let t=f.size,n=1===h(),r=f.size,i=h()===w();return t!==e._v$&&(l.size=e._v$=t),n!==e._v$2&&(l.disabled=e._v$2=n),r!==e._v$3&&(o.size=e._v$3=r),i!==e._v$4&&(o.disabled=e._v$4=i),e},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),n})()]}})}(0,i.customElement)("n-pagination",{class:void 0,css:void 0,page:void 0,pageSize:void 0,total:0,size:void 0,onChange:void 0,totalText:void 0},(n,r)=>{let i=r.element,l=(0,t.mergeProps)({css:i.css,onChange(e,t){i.dispatchEvent(new CustomEvent("change",{detail:[e,t]}))}},n,{totalText:!!i.querySelector("[slot='total-text']")||n.totalText});return(0,t.createEffect)(()=>{i.removeAttribute("css")}),(0,e.createComponent)(g,l)});const f=g;(0,e.delegateEvents)(["click"]);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../components/pagination/index.tsx"],"sourcesContent":["import {\n For,\n Show,\n batch,\n createEffect,\n createMemo,\n createSignal,\n mergeProps,\n splitProps,\n untrack,\n} from 'solid-js';\nimport { isFunction } from '@moneko/common';\nimport { css } from '@moneko/css';\nimport { customElement } from 'solid-element';\nimport { styles } from './styles';\nimport '../button';\nimport theme from '../theme';\nimport '../typography';\nimport type { BasicConfig, CustomElement } from '..';\n\nfunction Pagination(_: PaginationProps) {\n const { baseStyle } = theme;\n const maxCount = 5;\n const [local, other] = splitProps(_, ['page', 'pageSize', 'total', 'css', 'totalText']);\n const [page, setPage] = createSignal(1);\n const [pageSize, setPageSize] = createSignal(20);\n const [total, setTotal] = createSignal(0);\n\n createEffect(() => {\n batch(() => {\n if (typeof local.page === 'number' && local.page !== untrack(page)) {\n setPage(local.page);\n }\n if (typeof local.pageSize === 'number' && local.pageSize !== untrack(pageSize)) {\n setPageSize(local.pageSize);\n }\n if (typeof local.total === 'number' && local.total !== untrack(total)) {\n setTotal(local.total);\n }\n });\n });\n const totalPages = createMemo(() => Math.ceil(total() / pageSize()));\n const pages = createMemo(() => {\n const totals = totalPages();\n const arr: (number | 'p' | 'n')[] = [];\n\n if (totals <= maxCount) {\n for (let i = 1; i <= totals; i++) {\n arr.push(i);\n }\n } else {\n const right = Math.min(totals, Math.max(1, page() - Math.floor(maxCount / 2)) + maxCount - 1);\n\n for (let i = right - maxCount + 1; i <= right; i++) {\n arr.push(i);\n }\n }\n\n if (arr.length) {\n let last = arr[arr.length - 1] as number;\n const fast = arr[0] as number;\n\n if (fast >= 2) {\n if (fast === 2) {\n arr.splice(0, 1, 'p');\n } else {\n arr.unshift('p');\n }\n arr.unshift(1);\n if (last < totals) {\n last += 1;\n arr.push(last);\n }\n }\n if (last === totals - 1) {\n arr.splice(arr.length - 1, 1, 'n');\n arr.push(totals);\n } else if (last < totals - 1) {\n arr.push('n');\n arr.push(totals);\n }\n }\n return arr;\n });\n\n function changePage(curr: number | 'p' | 'n') {\n const p = untrack(page);\n let next = curr === 'n' ? p + maxCount : curr === 'p' ? p - maxCount : curr;\n\n if (next < 1) {\n next = 1;\n } else if (next > untrack(totalPages)) {\n next = untrack(totalPages);\n }\n if (p !== next) {\n if (local.page === void 0) {\n setPage(next);\n }\n other.onChange?.(next, untrack(pageSize));\n }\n }\n const TotalText = () => {\n const ranges = createMemo(() => [(page() - 1) * pageSize() + 1, page() * pageSize()]);\n\n return (\n <Show when={local.totalText !== false}>\n <li>\n {isFunction(local.totalText) ? (\n local.totalText(total(), ranges())\n ) : (\n <li>\n <slot name=\"total-text\">\n <n-typography>共 {total()} 项</n-typography>\n </slot>\n </li>\n )}\n </li>\n </Show>\n );\n };\n\n return (\n <Show when={pages().length}>\n <style textContent={baseStyle()} />\n <style textContent={styles} />\n <Show when={local.css}>\n <style textContent={css(local.css)} />\n </Show>\n <nav aria-label=\"pagination\" class=\"pagination\">\n <ul>\n <TotalText />\n <li>\n <n-button\n class=\"pagination-item pagination-prev\"\n size={other.size}\n flat={true}\n circle={true}\n disabled={page() === 1}\n onClick={() => changePage(untrack(page) - 1)}\n >\n 〈\n </n-button>\n </li>\n <For each={pages()}>\n {(curr) => {\n const isCurrent = createMemo(() => curr === page());\n\n return (\n <li>\n <n-button\n class=\"pagination-item\"\n classList={{\n [`pagination-${curr}`]: typeof curr !== 'number',\n }}\n size={other.size}\n flat={!isCurrent()}\n circle={typeof curr !== 'number'}\n type={isCurrent() ? 'primary' : 'default'}\n fill={isCurrent()}\n aria-current={isCurrent() && 'page'}\n onClick={() => changePage(curr)}\n >\n {curr}\n </n-button>\n </li>\n );\n }}\n </For>\n <li>\n <n-button\n class=\"pagination-item pagination-next\"\n size={other.size}\n flat={true}\n circle={true}\n disabled={page() === totalPages()}\n onClick={() => changePage(untrack(page) + 1)}\n >\n 〉\n </n-button>\n </li>\n </ul>\n </nav>\n </Show>\n );\n}\n\n/** API */\nexport interface PaginationProps {\n /** 自定义类名 */\n class?: string;\n /** 自定义类名 */\n css?: string;\n /** 当前页数\n * @default 1\n */\n page?: number;\n /** 每页显示的数据条目数量\n * @default 20\n */\n pageSize?: number;\n /** 总数\n * @default 0\n */\n total?: number;\n /** 尺寸\n * @default 'normal'\n */\n size?: BasicConfig['size'];\n /** 用于显示数据总量和当前数据顺序;\n * 支持直接赋值给 'totalText' 属性\n * 或者通过[slot=\"total-text\"]插槽\n * @default true\n */\n totalText?: ((total: number, range: [start: number, end: number]) => JSX.Element) | false;\n /** 值修改时的回调方法 */\n onChange?(page: number, pageSize: number): void;\n children?: JSX.Element;\n}\nexport type PaginationElement = CustomElement<PaginationProps>;\n\ncustomElement<PaginationProps>(\n 'n-pagination',\n {\n class: void 0,\n css: void 0,\n page: void 0,\n pageSize: void 0,\n total: 0,\n size: void 0,\n onChange: void 0,\n totalText: void 0,\n },\n (_, opt) => {\n const el = opt.element;\n const props = mergeProps(\n {\n css: el.css,\n onChange(page: number, pageSize: number) {\n el.dispatchEvent(\n new CustomEvent('change', {\n detail: [page, pageSize],\n }),\n );\n },\n },\n _,\n {\n totalText: (!!el.querySelector(\"[slot='total-text']\") as false) || _.totalText,\n },\n );\n\n createEffect(() => {\n el.removeAttribute('css');\n });\n return <Pagination {...props} />;\n },\n);\nexport default Pagination;\n"],"names":["Pagination","_","baseStyle","theme","local","other","splitProps","page","setPage","createSignal","pageSize","setPageSize","total","setTotal","createEffect","batch","untrack","totalPages","createMemo","Math","ceil","pages","totals","arr","i","push","right","min","max","floor","maxCount","length","last","fast","splice","unshift","changePage","curr","p","next","onChange","TotalText","ranges","Show","totalText","isFunction","styles","css","For","isCurrent","size","customElement","class","opt","el","element","props","mergeProps","dispatchEvent","CustomEvent","detail","querySelector","removeAttribute"],"mappings":"kGAiQA,+CAAA,+CAvPO,wBACoB,4CACP,yBACU,2BACP,oBAChB,+BACW,wEACX,mcAGP,SAASA,EAAWC,CAAkB,EACpC,GAAM,CAAEC,UAAAA,CAAS,CAAE,CAAGC,SAAK,CAErB,CAACC,EAAO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x"],"sourcesContent":["import {\n batch,\n createEffect,\n createMemo,\n createSignal,\n For,\n mergeProps,\n Show,\n splitProps,\n untrack,\n} from 'solid-js';\nimport { isFunction } from '@moneko/common';\nimport { css } from '@moneko/css';\nimport { customElement } from 'solid-element';\n\nimport type { BasicConfig, CustomElement } from '..';\nimport theme from '../theme';\n\nimport { styles } from './styles';\n\nimport '../button';\nimport '../typography';\n\nfunction Pagination(_: PaginationProps) {\n const { baseStyle } = theme;\n const maxCount = 5;\n const [local, other] = splitProps(_, ['page', 'pageSize', 'total', 'css', 'totalText']);\n const [page, setPage] = createSignal(1);\n const [pageSize, setPageSize] = createSignal(20);\n const [total, setTotal] = createSignal(0);\n\n createEffect(() => {\n batch(() => {\n if (typeof local.page === 'number' && local.page !== untrack(page)) {\n setPage(local.page);\n }\n if (typeof local.pageSize === 'number' && local.pageSize !== untrack(pageSize)) {\n setPageSize(local.pageSize);\n }\n if (typeof local.total === 'number' && local.total !== untrack(total)) {\n setTotal(local.total);\n }\n });\n });\n const totalPages = createMemo(() => Math.ceil(total() / pageSize()));\n const pages = createMemo(() => {\n const totals = totalPages();\n const arr: (number | 'p' | 'n')[] = [];\n\n if (totals <= maxCount) {\n for (let i = 1; i <= totals; i++) {\n arr.push(i);\n }\n } else {\n const right = Math.min(totals, Math.max(1, page() - Math.floor(maxCount / 2)) + maxCount - 1);\n\n for (let i = right - maxCount + 1; i <= right; i++) {\n arr.push(i);\n }\n }\n\n if (arr.length) {\n let last = arr[arr.length - 1] as number;\n const fast = arr[0] as number;\n\n if (fast >= 2) {\n if (fast === 2) {\n arr.splice(0, 1, 'p');\n } else {\n arr.unshift('p');\n }\n arr.unshift(1);\n if (last < totals) {\n last += 1;\n arr.push(last);\n }\n }\n if (last === totals - 1) {\n arr.splice(arr.length - 1, 1, 'n');\n arr.push(totals);\n } else if (last < totals - 1) {\n arr.push('n');\n arr.push(totals);\n }\n }\n return arr;\n });\n\n function changePage(curr: number | 'p' | 'n') {\n const p = untrack(page);\n let next = curr === 'n' ? p + maxCount : curr === 'p' ? p - maxCount : curr;\n\n if (next < 1) {\n next = 1;\n } else if (next > untrack(totalPages)) {\n next = untrack(totalPages);\n }\n if (p !== next) {\n if (local.page === void 0) {\n setPage(next);\n }\n other.onChange?.(next, untrack(pageSize));\n }\n }\n const TotalText = () => {\n const ranges = createMemo(() => [(page() - 1) * pageSize() + 1, page() * pageSize()]);\n\n return (\n <Show when={local.totalText !== false}>\n <li>\n {isFunction(local.totalText) ? (\n local.totalText(total(), ranges())\n ) : (\n <li>\n <slot name=\"total-text\">\n <n-typography>共 {total()} 项</n-typography>\n </slot>\n </li>\n )}\n </li>\n </Show>\n );\n };\n\n return (\n <Show when={pages().length}>\n <style textContent={baseStyle()} />\n <style textContent={styles} />\n <Show when={local.css}>\n <style textContent={css(local.css)} />\n </Show>\n <nav aria-label=\"pagination\" class=\"pagination\">\n <ul>\n <TotalText />\n <li>\n <n-button\n class=\"pagination-item pagination-prev\"\n size={other.size}\n flat={true}\n circle={true}\n disabled={page() === 1}\n onClick={() => {\n changePage(untrack(page) - 1);\n }}\n >\n 〈\n </n-button>\n </li>\n <For each={pages()}>\n {(curr) => {\n const isCurrent = createMemo(() => curr === page());\n\n return (\n <li>\n <n-button\n class=\"pagination-item\"\n classList={{\n [`pagination-${curr}`]: typeof curr !== 'number',\n }}\n size={other.size}\n flat={!isCurrent()}\n circle={typeof curr !== 'number'}\n type={isCurrent() ? 'primary' : 'default'}\n fill={isCurrent()}\n aria-current={isCurrent() && 'page'}\n onClick={() => {\n changePage(curr);\n }}\n >\n {curr}\n </n-button>\n </li>\n );\n }}\n </For>\n <li>\n <n-button\n class=\"pagination-item pagination-next\"\n size={other.size}\n flat={true}\n circle={true}\n disabled={page() === totalPages()}\n onClick={() => {\n changePage(untrack(page) + 1);\n }}\n >\n 〉\n </n-button>\n </li>\n </ul>\n </nav>\n </Show>\n );\n}\n\n/** API */\nexport interface PaginationProps {\n /** 自定义类名 */\n class?: string;\n /** 自定义类名 */\n css?: string;\n /** 当前页数\n * @default 1\n */\n page?: number;\n /** 每页显示的数据条目数量\n * @default 20\n */\n pageSize?: number;\n /** 总数\n * @default 0\n */\n total?: number;\n /** 尺寸\n * @default 'normal'\n */\n size?: BasicConfig['size'];\n /** 用于显示数据总量和当前数据顺序;\n * 支持直接赋值给 'totalText' 属性\n * 或者通过[slot=\"total-text\"]插槽\n * @default true\n */\n totalText?: ((total: number, range: [start: number, end: number]) => JSX.Element) | false;\n /** 值修改时的回调方法 */\n onChange?(page: number, pageSize: number): void;\n children?: JSX.Element;\n}\nexport type PaginationElement = CustomElement<PaginationProps>;\n\ncustomElement<PaginationProps>(\n 'n-pagination',\n {\n class: void 0,\n css: void 0,\n page: void 0,\n pageSize: void 0,\n total: 0,\n size: void 0,\n onChange: void 0,\n totalText: void 0,\n },\n (_, opt) => {\n const el = opt.element;\n const props = mergeProps(\n {\n css: el.css,\n onChange(page: number, pageSize: number) {\n el.dispatchEvent(\n new CustomEvent('change', {\n detail: [page, pageSize],\n }),\n );\n },\n },\n _,\n {\n totalText: (!!el.querySelector(\"[slot='total-text']\") as false) || _.totalText,\n },\n );\n\n createEffect(() => {\n el.removeAttribute('css');\n });\n return <Pagination {...props} />;\n },\n);\nexport default Pagination;\n"],"names":["Pagination","_","baseStyle","theme","local","other","splitProps","page","setPage","createSignal","pageSize","setPageSize","total","setTotal","createEffect","batch","untrack","totalPages","createMemo","Math","ceil","pages","totals","arr","i","push","right","min","max","floor","maxCount","length","last","fast","splice","unshift","changePage","curr","p","next","onChange","TotalText","ranges","Show","totalText","isFunction","styles","css","For","isCurrent","size","customElement","class","opt","el","element","props","mergeProps","dispatchEvent","CustomEvent","detail","querySelector","removeAttribute"],"mappings":"kGA0QA,+CAAA,+CAhQO,wBACoB,4CACP,yBACU,6BAGZ,uBAEK,uEAEhB,qBACA,mcAEP,SAASA,EAAWC,CAAkB,EACpC,GAAM,CAAEC,UAAAA,CAAS,CAAE,CAAGC,SAAK,CAErB,CAACC,EAAOC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
|
+
---
|
|
2
|
+
title: 基本使用
|
|
3
|
+
order: 1
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```html
|
|
7
|
+
<n-popover arrow="true" placement="bottomLeft">
|
|
8
|
+
<span>hover</span>
|
|
9
|
+
</n-popover>
|
|
10
|
+
<script>
|
|
11
|
+
const el = container.querySelector('n-popover');
|
|
12
|
+
|
|
13
|
+
el.content = function () {
|
|
14
|
+
const c = document.createElement('div');
|
|
15
|
+
|
|
16
|
+
c.innerHTML = `<n-typography type="success">success</n-typography><n-typography type="error">danger</n-typography>`;
|
|
17
|
+
return c;
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
<n-popover
|
|
24
|
+
arrow
|
|
25
|
+
placement="bottomLeft"
|
|
26
|
+
content={() => (
|
|
27
|
+
<div>
|
|
28
|
+
<n-typography type="success">success</n-typography>
|
|
29
|
+
<n-typography type="error">danger</n-typography>
|
|
30
|
+
</div>
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<span>hover</span>
|
|
34
|
+
</n-popover>
|
|
35
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 点击触发
|
|
3
|
+
description: 将 `trigger` 为 `click`,将可以通过鼠标点击触发提示框显示
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-popover arrow="true" trigger="click" content="点击我">点击我</n-popover>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
<n-popover arrow content="点击我" trigger="click">
|
|
13
|
+
点击我
|
|
14
|
+
</n-popover>
|
|
15
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 右键触发
|
|
3
|
+
description: 将 `trigger` 为 `contextMenu`,将可以通过右键触发提示框显示
|
|
4
|
+
order: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<n-popover trigger="contextMenu" style="width: 100%;">
|
|
9
|
+
<div style="width: 100%;opacity: 0.4;">右键点我</div>
|
|
10
|
+
</n-popover>
|
|
11
|
+
<script>
|
|
12
|
+
const el = container.querySelector('n-popover');
|
|
13
|
+
const c = document.createElement('a');
|
|
14
|
+
|
|
15
|
+
c.style.color = 'red';
|
|
16
|
+
c.textContent = '右键触发';
|
|
17
|
+
el.content = c;
|
|
18
|
+
el.css = `.popover {
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 150px;
|
|
22
|
+
background-color: var(--disable-bg);
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
line-height: 150px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
font-size: x-large;
|
|
27
|
+
}`;
|
|
28
|
+
</script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
<n-popover
|
|
33
|
+
content={<a style="color: red;">右键触发</a>}
|
|
34
|
+
style={{ width: '100%' }}
|
|
35
|
+
trigger="contextMenu"
|
|
36
|
+
css={`
|
|
37
|
+
.popover {
|
|
38
|
+
display: block;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 150px;
|
|
41
|
+
background-color: var(--disable-bg);
|
|
42
|
+
border-radius: 8px;
|
|
43
|
+
line-height: 150px;
|
|
44
|
+
text-align: center;
|
|
45
|
+
font-size: x-large;
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
48
|
+
>
|
|
49
|
+
<div
|
|
50
|
+
style={{
|
|
51
|
+
width: '100%',
|
|
52
|
+
opacity: 0.4,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
右键点我
|
|
56
|
+
</div>
|
|
57
|
+
</n-popover>
|
|
58
|
+
```
|