dou-ui 0.1.0-alpha.13 → 0.1.0-alpha.15
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/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-panel/style.js +1 -0
- package/dist/components/color-picker/style.js +1 -0
- package/dist/components/comment-thread/style.js +2 -0
- package/dist/components/context-menu/context-menu.js.map +1 -1
- package/dist/components/context-menu/context-menu.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/components/context-menu/context-menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/copy-button/copy-button.js.map +1 -1
- package/dist/components/copy-button/copy-button.vue_vue_type_script_setup_true_lang.js +13 -5
- package/dist/components/copy-button/copy-button.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dropdown/dropdown-sub.js.map +1 -1
- package/dist/components/dropdown/dropdown-sub.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/components/dropdown/dropdown-sub.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dropdown/dropdown.js.map +1 -1
- package/dist/components/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/components/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/dropdown/dropdown2.js.map +1 -1
- package/dist/components/dropdown/style.js +2 -0
- package/dist/components/field-group/style.js +2 -0
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +22 -7
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/input-number/input-number.js.map +1 -1
- package/dist/components/input-number/input-number.vue_vue_type_script_setup_true_lang.js +22 -7
- package/dist/components/input-number/input-number.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/menu/style.js +2 -0
- package/dist/components/menubar/style.js +2 -0
- package/dist/style.css +1 -1
- package/dist/types/components/dropdown/dropdown.d.ts +7 -0
- package/dist/types/utils/field-action.d.ts +59 -0
- package/dist/utils/field-action.js +139 -0
- package/dist/utils/field-action.js.map +1 -0
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ import { menuItems, useMenuKeys } from "./menu-keys.js";
|
|
|
7
7
|
import { findMenuItem } from "./menu-entries.js";
|
|
8
8
|
import dropdown_items_default from "./dropdown-items.js";
|
|
9
9
|
import { useItemsWarning } from "./items-warning.js";
|
|
10
|
-
import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, openBlock, provide, renderSlot, unref, useId, useModel, useSlots, vShow, withCtx, withDirectives } from "vue";
|
|
10
|
+
import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, openBlock, provide, renderSlot, unref, useAttrs, useId, useModel, useSlots, vShow, withCtx, withDirectives } from "vue";
|
|
11
11
|
// src/components/dropdown/dropdown.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var _hoisted_1 = ["data-placement", "data-dou-theme"];
|
|
13
13
|
var dropdown_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -91,6 +91,7 @@ var dropdown_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
91
91
|
"aria-controls": rendered.value ? id : void 0
|
|
92
92
|
}));
|
|
93
93
|
const host = inject(dropdownHostKey, null);
|
|
94
|
+
const attrs = useAttrs();
|
|
94
95
|
const onKeys = useMenuKeys(() => panelRef.value, () => {
|
|
95
96
|
popup.reference()?.focus();
|
|
96
97
|
popup.hide();
|
|
@@ -114,7 +115,9 @@ var dropdown_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
114
115
|
opened: () => open.value,
|
|
115
116
|
hold: () => props.trigger === "hover" && popup.show(),
|
|
116
117
|
release: () => props.trigger === "hover" && popup.hide(props.hideDelay),
|
|
117
|
-
move: host ? (direction) => host.move(direction) : void 0
|
|
118
|
+
move: host ? (direction) => host.move(direction) : void 0,
|
|
119
|
+
panelClass: () => attrs.class,
|
|
120
|
+
teleport: () => teleportTarget.value
|
|
118
121
|
});
|
|
119
122
|
__expose({
|
|
120
123
|
open: () => popup.show(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_useSlots","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","DropdownItems","_createCommentVNode","_vShow"],"sources":["../../../src/components/dropdown/dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject, mergeProps, nextTick, provide, useId } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { dropdownHostKey, dropdownKey } from './dropdown'\nimport { menuItems, useMenuKeys } from './menu-keys'\nimport type { DropdownExpose, DropdownProps, DropdownSlots, DropdownValue } from './dropdown'\nimport { useTeleport } from '../../utils/teleport'\nimport DropdownItems from './dropdown-items.vue'\nimport { useItemsWarning } from './items-warning'\nimport { findMenuItem } from './menu-entries'\n\ndefineOptions({ name: 'DouDropdown', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n placement: 'bottom-start',\n trigger: 'click',\n disabled: false,\n hideOnSelect: true,\n sameWidth: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 6,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{ select: [value: DropdownValue | undefined] }>()\nconst slots = defineSlots<DropdownSlots>()\nuseItemsWarning('Dropdown', () => !!props.items && !!slots.menu)\n\nconst ns = useNamespace('dropdown')\nconst id = `dou-dropdown-${useId()}`\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n sameWidth: () => props.sameWidth,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n // a menu closes on a press outside however it was opened, `manual` too\n closeOnOutside: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\nconst items = () => menuItems(panelRef.value)\n\nasync function openAndFocus(which: 'first' | 'last') {\n popup.show()\n await nextTick()\n const list = items()\n ;(which === 'first' ? list[0] : list.at(-1))?.focus()\n}\n\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (props.disabled || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return\n event.preventDefault()\n void openAndFocus(event.key === 'ArrowDown' ? 'first' : 'last')\n}\n\n// A click from Enter or Space (`detail` is 0) opens the menu with its\n// first item focused, so the keyboard can carry on from there.\nfunction onTriggerClick(event: MouseEvent) {\n if (event.detail !== 0 || props.disabled) return\n if (props.trigger === 'click' ? open.value : !open.value) void openAndFocus('first')\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'menu',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst host = inject(dropdownHostKey, null)\n\n// Tab leaves from the trigger so focus moves on from where the menu was opened.\nconst onKeys = useMenuKeys(\n () => panelRef.value,\n () => {\n ;(popup.reference() as HTMLElement | null)?.focus()\n popup.hide()\n },\n)\n\nfunction onMenuKeydown(event: KeyboardEvent) {\n if (host && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventDefault()\n return host.move(event.key === 'ArrowRight' ? 1 : -1)\n }\n onKeys(event)\n}\n\nprovide(dropdownKey, {\n select(value) {\n findMenuItem(props.items, value)?.run?.()\n emit('select', value)\n if (!props.hideOnSelect) return\n // Focus may be in a submenu, outside the panel: it goes back to the trigger too.\n const restore = !!(document.activeElement as HTMLElement | null)?.closest(`.${ns.b()}`)\n popup.hide()\n if (restore) (popup.reference() as HTMLElement | null)?.focus()\n },\n opened: () => open.value,\n hold: () => props.trigger === 'hover' && popup.show(),\n release: () => props.trigger === 'hover' && popup.hide(props.hideDelay),\n move: host ? (direction) => host.move(direction) : undefined,\n})\n\ndefineExpose<DropdownExpose>({ open: () => popup.show(), close: () => popup.hide() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"menu\"\n tabindex=\"-1\"\n :class=\"[ns.b(), 'dou-floating']\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onMenuKeydown\"\n >\n <slot name=\"menu\"><DropdownItems v-if=\"props.items\" :items=\"props.items\" /></slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,MAAM,QAAQ;EAWd,MAAM,iBAAiB,kBAAkB,MAAM,QAAQ;EACvD,MAAM,OAAOC,SAAoB,SAAC,MAA0B;EAC5D,MAAM,OAAO;EACb,MAAM,QAAQC,SAAA;EACd,gBAAgB,kBAAkB,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,MAAM,IAAI;EAE/D,MAAM,KAAK,aAAa,UAAU;EAClC,MAAM,KAAK,gBAAgB,MAAM;EAEjC,MAAM,QAAQ,SAAS;GACrB;GACA,eAAe,MAAM;GACrB,gBAAgB,MAAM;GACtB,iBAAiB,MAAM;GACvB,cAAc,MAAM;GACpB,iBAAiB,MAAM;GACvB,iBAAiB,MAAM;GACvB,iBAAiB,MAAM;GAEvB,gBAAgB;EAClB,CAAC;EACD,MAAM,EAAE,YAAY,UAAU,UAAU,OAAO,WAAW,YAAY,mBAAmB;EAEzF,MAAM,cAAc,UAAU,SAAS,KAAK;EAE5C,eAAe,aAAa,OAAyB;GACnD,MAAM,KAAK;GACX,MAAM,SAAS;GACf,MAAM,OAAO,MAAM;GAClB,CAAC,UAAU,UAAU,KAAK,KAAK,KAAK,GAAG,EAAE,EAAA,EAAI,MAAM;EACtD;EAEA,SAAS,iBAAiB,OAAsB;GAC9C,IAAI,MAAM,YAAa,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAY;GAC9E,MAAM,eAAe;GACrB,aAAkB,MAAM,QAAQ,cAAc,UAAU,MAAM;EAChE;EAIA,SAAS,eAAe,OAAmB;GACzC,IAAI,MAAM,WAAW,KAAK,MAAM,UAAU;GAC1C,IAAI,MAAM,YAAY,UAAU,KAAK,QAAQ,CAAC,KAAK,OAAO,aAAkB,OAAO;EACrF;EAEA,MAAM,eAAe,eACnB,WAAW,MAAM,iBAAiB,OAAO;GACvC,WAAW;GACX,SAAS;GACT,iBAAiB;GACjB,iBAAiB,KAAK;GACtB,iBAAiB,SAAS,QAAQ,KAAK,KAAA;EACzC,CAAC,CACH;EAEA,MAAM,OAAO,OAAO,iBAAiB,IAAI;
|
|
1
|
+
{"version":3,"file":"dropdown.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_useSlots","_openBlock","_createElementBlock","_Fragment","_createVNode","_unref","_mergeProps","_withCtx","_renderSlot","_createBlock","_Teleport","_Transition","_withDirectives","_createElementVNode","DropdownItems","_createCommentVNode","_vShow"],"sources":["../../../src/components/dropdown/dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject, mergeProps, nextTick, provide, useAttrs, useId } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { dropdownHostKey, dropdownKey } from './dropdown'\nimport { menuItems, useMenuKeys } from './menu-keys'\nimport type { DropdownExpose, DropdownProps, DropdownSlots, DropdownValue } from './dropdown'\nimport { useTeleport } from '../../utils/teleport'\nimport DropdownItems from './dropdown-items.vue'\nimport { useItemsWarning } from './items-warning'\nimport { findMenuItem } from './menu-entries'\n\ndefineOptions({ name: 'DouDropdown', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n placement: 'bottom-start',\n trigger: 'click',\n disabled: false,\n hideOnSelect: true,\n sameWidth: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 6,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{ select: [value: DropdownValue | undefined] }>()\nconst slots = defineSlots<DropdownSlots>()\nuseItemsWarning('Dropdown', () => !!props.items && !!slots.menu)\n\nconst ns = useNamespace('dropdown')\nconst id = `dou-dropdown-${useId()}`\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n sameWidth: () => props.sameWidth,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n // a menu closes on a press outside however it was opened, `manual` too\n closeOnOutside: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\nconst items = () => menuItems(panelRef.value)\n\nasync function openAndFocus(which: 'first' | 'last') {\n popup.show()\n await nextTick()\n const list = items()\n ;(which === 'first' ? list[0] : list.at(-1))?.focus()\n}\n\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (props.disabled || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return\n event.preventDefault()\n void openAndFocus(event.key === 'ArrowDown' ? 'first' : 'last')\n}\n\n// A click from Enter or Space (`detail` is 0) opens the menu with its\n// first item focused, so the keyboard can carry on from there.\nfunction onTriggerClick(event: MouseEvent) {\n if (event.detail !== 0 || props.disabled) return\n if (props.trigger === 'click' ? open.value : !open.value) void openAndFocus('first')\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'menu',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst host = inject(dropdownHostKey, null)\nconst attrs = useAttrs()\n\n// Tab leaves from the trigger so focus moves on from where the menu was opened.\nconst onKeys = useMenuKeys(\n () => panelRef.value,\n () => {\n ;(popup.reference() as HTMLElement | null)?.focus()\n popup.hide()\n },\n)\n\nfunction onMenuKeydown(event: KeyboardEvent) {\n if (host && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventDefault()\n return host.move(event.key === 'ArrowRight' ? 1 : -1)\n }\n onKeys(event)\n}\n\nprovide(dropdownKey, {\n select(value) {\n findMenuItem(props.items, value)?.run?.()\n emit('select', value)\n if (!props.hideOnSelect) return\n // Focus may be in a submenu, outside the panel: it goes back to the trigger too.\n const restore = !!(document.activeElement as HTMLElement | null)?.closest(`.${ns.b()}`)\n popup.hide()\n if (restore) (popup.reference() as HTMLElement | null)?.focus()\n },\n opened: () => open.value,\n hold: () => props.trigger === 'hover' && popup.show(),\n release: () => props.trigger === 'hover' && popup.hide(props.hideDelay),\n move: host ? (direction) => host.move(direction) : undefined,\n panelClass: () => attrs.class,\n teleport: () => teleportTarget.value,\n})\n\ndefineExpose<DropdownExpose>({ open: () => popup.show(), close: () => popup.hide() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"menu\"\n tabindex=\"-1\"\n :class=\"[ns.b(), 'dou-floating']\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onMenuKeydown\"\n >\n <slot name=\"menu\"><DropdownItems v-if=\"props.items\" :items=\"props.items\" /></slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,MAAM,QAAQ;EAWd,MAAM,iBAAiB,kBAAkB,MAAM,QAAQ;EACvD,MAAM,OAAOC,SAAoB,SAAC,MAA0B;EAC5D,MAAM,OAAO;EACb,MAAM,QAAQC,SAAA;EACd,gBAAgB,kBAAkB,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,MAAM,IAAI;EAE/D,MAAM,KAAK,aAAa,UAAU;EAClC,MAAM,KAAK,gBAAgB,MAAM;EAEjC,MAAM,QAAQ,SAAS;GACrB;GACA,eAAe,MAAM;GACrB,gBAAgB,MAAM;GACtB,iBAAiB,MAAM;GACvB,cAAc,MAAM;GACpB,iBAAiB,MAAM;GACvB,iBAAiB,MAAM;GACvB,iBAAiB,MAAM;GAEvB,gBAAgB;EAClB,CAAC;EACD,MAAM,EAAE,YAAY,UAAU,UAAU,OAAO,WAAW,YAAY,mBAAmB;EAEzF,MAAM,cAAc,UAAU,SAAS,KAAK;EAE5C,eAAe,aAAa,OAAyB;GACnD,MAAM,KAAK;GACX,MAAM,SAAS;GACf,MAAM,OAAO,MAAM;GAClB,CAAC,UAAU,UAAU,KAAK,KAAK,KAAK,GAAG,EAAE,EAAA,EAAI,MAAM;EACtD;EAEA,SAAS,iBAAiB,OAAsB;GAC9C,IAAI,MAAM,YAAa,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAY;GAC9E,MAAM,eAAe;GACrB,aAAkB,MAAM,QAAQ,cAAc,UAAU,MAAM;EAChE;EAIA,SAAS,eAAe,OAAmB;GACzC,IA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AA,SAAA,GAAtEC,WAAsE;IAAvD,SAAA;IAAJ,KAAI;GAAqB,GAAA,aAAA,KAAY,GAAA;IAAE,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C;;G,QAC1CH,MAAA,QAAA,KAAhBJ,UAAA,GAAAQ,YAkBWC,UAAA;;IAlBgB,IAAIL,MAAA,cAAA,CAAc,CAAC;IAAK,UAAUA,MAAA,cAAA,CAAc,CAAC;G,IAC1ED,YAgBaO,YAAA;IAhBD,QAAA;IAAO,MAAK;IAAxB,WAAA;;IACE,SAAAJ,cAcM,CAdNK,eAAAC,mBAcM,OAdNP,WAcM;KAZC;KACD,SAAA;KAAJ,KAAI;KACJ,MAAK;KACL,UAAS;KACR,OAAK,CAAGD,MAAA,EAAA,CAAE,CAAC,EAAC,GAAA,cAAA;KACZ,OAAOA,MAAA,UAAA;KACP,kBAAgBA,MAAA,SAAA;KAChB,kBAAgBA,MAAA,KAAA;IACJP,GAAAA;KAAAA,GAAAA,KAAAA;KAAM,GAAKO,MAAA,cAAA;IAAc,GAAA,EACrC,WAAS,cAAa,CAAA,GAAA,CAEvBG,WAAkF,KAAA,QAAA,QAAA,CAAA,SAAA,CAA3C,MAAM,SAA3BP,UAAA,GAAAQ,YAAyDK,wBAAA;;KAAtB,OAAO,MAAM;I,6EAZ1D,CAAAE,OAAA,KAAA,KAAI,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown2.js","names":["_sfc_main"],"sources":["../../../src/components/dropdown/dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject, mergeProps, nextTick, provide, useId } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { dropdownHostKey, dropdownKey } from './dropdown'\nimport { menuItems, useMenuKeys } from './menu-keys'\nimport type { DropdownExpose, DropdownProps, DropdownSlots, DropdownValue } from './dropdown'\nimport { useTeleport } from '../../utils/teleport'\nimport DropdownItems from './dropdown-items.vue'\nimport { useItemsWarning } from './items-warning'\nimport { findMenuItem } from './menu-entries'\n\ndefineOptions({ name: 'DouDropdown', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n placement: 'bottom-start',\n trigger: 'click',\n disabled: false,\n hideOnSelect: true,\n sameWidth: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 6,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{ select: [value: DropdownValue | undefined] }>()\nconst slots = defineSlots<DropdownSlots>()\nuseItemsWarning('Dropdown', () => !!props.items && !!slots.menu)\n\nconst ns = useNamespace('dropdown')\nconst id = `dou-dropdown-${useId()}`\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n sameWidth: () => props.sameWidth,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n // a menu closes on a press outside however it was opened, `manual` too\n closeOnOutside: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\nconst items = () => menuItems(panelRef.value)\n\nasync function openAndFocus(which: 'first' | 'last') {\n popup.show()\n await nextTick()\n const list = items()\n ;(which === 'first' ? list[0] : list.at(-1))?.focus()\n}\n\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (props.disabled || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return\n event.preventDefault()\n void openAndFocus(event.key === 'ArrowDown' ? 'first' : 'last')\n}\n\n// A click from Enter or Space (`detail` is 0) opens the menu with its\n// first item focused, so the keyboard can carry on from there.\nfunction onTriggerClick(event: MouseEvent) {\n if (event.detail !== 0 || props.disabled) return\n if (props.trigger === 'click' ? open.value : !open.value) void openAndFocus('first')\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'menu',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst host = inject(dropdownHostKey, null)\n\n// Tab leaves from the trigger so focus moves on from where the menu was opened.\nconst onKeys = useMenuKeys(\n () => panelRef.value,\n () => {\n ;(popup.reference() as HTMLElement | null)?.focus()\n popup.hide()\n },\n)\n\nfunction onMenuKeydown(event: KeyboardEvent) {\n if (host && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventDefault()\n return host.move(event.key === 'ArrowRight' ? 1 : -1)\n }\n onKeys(event)\n}\n\nprovide(dropdownKey, {\n select(value) {\n findMenuItem(props.items, value)?.run?.()\n emit('select', value)\n if (!props.hideOnSelect) return\n // Focus may be in a submenu, outside the panel: it goes back to the trigger too.\n const restore = !!(document.activeElement as HTMLElement | null)?.closest(`.${ns.b()}`)\n popup.hide()\n if (restore) (popup.reference() as HTMLElement | null)?.focus()\n },\n opened: () => open.value,\n hold: () => props.trigger === 'hover' && popup.show(),\n release: () => props.trigger === 'hover' && popup.hide(props.hideDelay),\n move: host ? (direction) => host.move(direction) : undefined,\n})\n\ndefineExpose<DropdownExpose>({ open: () => popup.show(), close: () => popup.hide() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"menu\"\n tabindex=\"-1\"\n :class=\"[ns.b(), 'dou-floating']\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onMenuKeydown\"\n >\n <slot name=\"menu\"><DropdownItems v-if=\"props.items\" :items=\"props.items\" /></slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"dropdown2.js","names":["_sfc_main"],"sources":["../../../src/components/dropdown/dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, inject, mergeProps, nextTick, provide, useAttrs, useId } from 'vue'\nimport { usePopup } from '../../composables/use-popup'\nimport { useNamespace } from '../../utils/namespace'\nimport { OnlyChild } from '../../utils/only-child'\nimport { dropdownHostKey, dropdownKey } from './dropdown'\nimport { menuItems, useMenuKeys } from './menu-keys'\nimport type { DropdownExpose, DropdownProps, DropdownSlots, DropdownValue } from './dropdown'\nimport { useTeleport } from '../../utils/teleport'\nimport DropdownItems from './dropdown-items.vue'\nimport { useItemsWarning } from './items-warning'\nimport { findMenuItem } from './menu-entries'\n\ndefineOptions({ name: 'DouDropdown', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n placement: 'bottom-start',\n trigger: 'click',\n disabled: false,\n hideOnSelect: true,\n sameWidth: false,\n showDelay: 100,\n hideDelay: 150,\n offset: 6,\n teleport: undefined,\n})\nconst teleportTarget = useTeleport(() => props.teleport)\nconst open = defineModel<boolean>('open', { default: false })\nconst emit = defineEmits<{ select: [value: DropdownValue | undefined] }>()\nconst slots = defineSlots<DropdownSlots>()\nuseItemsWarning('Dropdown', () => !!props.items && !!slots.menu)\n\nconst ns = useNamespace('dropdown')\nconst id = `dou-dropdown-${useId()}`\n\nconst popup = usePopup({\n open,\n trigger: () => props.trigger,\n disabled: () => props.disabled,\n placement: () => props.placement,\n offset: () => props.offset,\n sameWidth: () => props.sameWidth,\n showDelay: () => props.showDelay,\n hideDelay: () => props.hideDelay,\n // a menu closes on a press outside however it was opened, `manual` too\n closeOnOutside: true,\n})\nconst { triggerRef, panelRef, rendered, theme, placement, panelStyle, panelListeners } = popup\n\nconst items = () => menuItems(panelRef.value)\n\nasync function openAndFocus(which: 'first' | 'last') {\n popup.show()\n await nextTick()\n const list = items()\n ;(which === 'first' ? list[0] : list.at(-1))?.focus()\n}\n\nfunction onTriggerKeydown(event: KeyboardEvent) {\n if (props.disabled || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return\n event.preventDefault()\n void openAndFocus(event.key === 'ArrowDown' ? 'first' : 'last')\n}\n\n// A click from Enter or Space (`detail` is 0) opens the menu with its\n// first item focused, so the keyboard can carry on from there.\nfunction onTriggerClick(event: MouseEvent) {\n if (event.detail !== 0 || props.disabled) return\n if (props.trigger === 'click' ? open.value : !open.value) void openAndFocus('first')\n}\n\nconst triggerProps = computed(() =>\n mergeProps(popup.triggerListeners.value, {\n onKeydown: onTriggerKeydown,\n onClick: onTriggerClick,\n 'aria-haspopup': 'menu',\n 'aria-expanded': open.value,\n 'aria-controls': rendered.value ? id : undefined,\n }),\n)\n\nconst host = inject(dropdownHostKey, null)\nconst attrs = useAttrs()\n\n// Tab leaves from the trigger so focus moves on from where the menu was opened.\nconst onKeys = useMenuKeys(\n () => panelRef.value,\n () => {\n ;(popup.reference() as HTMLElement | null)?.focus()\n popup.hide()\n },\n)\n\nfunction onMenuKeydown(event: KeyboardEvent) {\n if (host && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {\n event.preventDefault()\n return host.move(event.key === 'ArrowRight' ? 1 : -1)\n }\n onKeys(event)\n}\n\nprovide(dropdownKey, {\n select(value) {\n findMenuItem(props.items, value)?.run?.()\n emit('select', value)\n if (!props.hideOnSelect) return\n // Focus may be in a submenu, outside the panel: it goes back to the trigger too.\n const restore = !!(document.activeElement as HTMLElement | null)?.closest(`.${ns.b()}`)\n popup.hide()\n if (restore) (popup.reference() as HTMLElement | null)?.focus()\n },\n opened: () => open.value,\n hold: () => props.trigger === 'hover' && popup.show(),\n release: () => props.trigger === 'hover' && popup.hide(props.hideDelay),\n move: host ? (direction) => host.move(direction) : undefined,\n panelClass: () => attrs.class,\n teleport: () => teleportTarget.value,\n})\n\ndefineExpose<DropdownExpose>({ open: () => popup.show(), close: () => popup.hide() })\n</script>\n\n<template>\n <OnlyChild ref=\"triggerRef\" v-bind=\"triggerProps\"><slot /></OnlyChild>\n <Teleport v-if=\"rendered\" :to=\"teleportTarget.to\" :disabled=\"teleportTarget.disabled\">\n <Transition appear name=\"dou-floating\">\n <div\n v-show=\"open\"\n :id=\"id\"\n ref=\"panelRef\"\n role=\"menu\"\n tabindex=\"-1\"\n :class=\"[ns.b(), 'dou-floating']\"\n :style=\"panelStyle\"\n :data-placement=\"placement\"\n :data-dou-theme=\"theme\"\n v-bind=\"{ ...$attrs, ...panelListeners }\"\n @keydown=\"onMenuKeydown\"\n >\n <slot name=\"menu\"><DropdownItems v-if=\"props.items\" :items=\"props.items\" /></slot>\n </div>\n </Transition>\n </Teleport>\n</template>\n"],"mappings":""}
|
|
@@ -4,4 +4,6 @@ import '@dou-ui/theme/components/button.css'
|
|
|
4
4
|
import '@dou-ui/theme/components/color-panel.css'
|
|
5
5
|
import '@dou-ui/theme/components/dropdown.css'
|
|
6
6
|
import '@dou-ui/theme/components/icon.css'
|
|
7
|
+
import '@dou-ui/theme/components/input-number.css'
|
|
8
|
+
import '@dou-ui/theme/components/input.css'
|
|
7
9
|
import '@dou-ui/theme/components/field-group.css'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":["_sfc_main"],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, EyeIcon, EyeOffIcon } from '@dou-ui/icons'\nimport { computed, nextTick, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputExpose, InputProps, InputSlots } from './input'\n\ndefineOptions({ name: 'DouInput', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n disabled: false,\n readonly: false,\n invalid: false,\n clearable: false,\n type: 'text',\n showPassword: false,\n showCount: false,\n})\nconst model = defineModel<string>({ default: '' })\nconst emit = defineEmits<{ clear: [] }>()\nconst slots = defineSlots<InputSlots>()\n\nconst ns = useNamespace('input')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// `class` and `style` dress the field; every other attribute (placeholder,\n// name, autocomplete, listeners...) belongs to the native input. Inside a\n// form item the input also takes the item's id and description, unless\n// the caller sets them.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nconst revealed = ref(false)\nconst nativeType = computed(() =>\n props.type === 'password' && props.showPassword && revealed.value ? 'text' : props.type,\n)\n\nconst maxLength = computed(() => {\n const value = Number(attrs.maxlength ?? attrs.maxLength)\n return Number.isFinite(value) && value > 0 ? value : undefined\n})\n// Count what a person sees as characters, so an emoji counts once.\nconst count = computed(() => [...model.value].length)\n\nconst showClear = computed(\n () => props.clearable && !disabled.value && !readonly.value && model.value !== '',\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n attrs.class,\n])\n\nasync function clear() {\n model.value = ''\n emit('clear')\n formItem?.trigger('change', { lazy: true })\n await nextTick()\n inputRef.value?.focus()\n}\n\n// Pressing the padding or a plain affix should land in the text without\n// first blurring it. Interactive content inside an affix keeps its own focus.\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('button, a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\ndefineExpose<InputExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n select: () => inputRef.value?.select(),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <
|
|
1
|
+
{"version":3,"file":"input.js","names":["_sfc_main"],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, EyeIcon, EyeOffIcon } from '@dou-ui/icons'\nimport { computed, nextTick, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { FieldAffix } from '../../utils/field-action'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputExpose, InputProps, InputSlots } from './input'\n\ndefineOptions({ name: 'DouInput', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n disabled: false,\n readonly: false,\n invalid: false,\n clearable: false,\n type: 'text',\n showPassword: false,\n showCount: false,\n})\nconst model = defineModel<string>({ default: '' })\nconst emit = defineEmits<{ clear: [] }>()\nconst slots = defineSlots<InputSlots>()\n\nconst ns = useNamespace('input')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// `class` and `style` dress the field; every other attribute (placeholder,\n// name, autocomplete, listeners...) belongs to the native input. Inside a\n// form item the input also takes the item's id and description, unless\n// the caller sets them.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nconst revealed = ref(false)\nconst nativeType = computed(() =>\n props.type === 'password' && props.showPassword && revealed.value ? 'text' : props.type,\n)\n\nconst maxLength = computed(() => {\n const value = Number(attrs.maxlength ?? attrs.maxLength)\n return Number.isFinite(value) && value > 0 ? value : undefined\n})\n// Count what a person sees as characters, so an emoji counts once.\nconst count = computed(() => [...model.value].length)\n\nconst showClear = computed(\n () => props.clearable && !disabled.value && !readonly.value && model.value !== '',\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n attrs.class,\n])\n\nasync function clear() {\n model.value = ''\n emit('clear')\n formItem?.trigger('change', { lazy: true })\n await nextTick()\n inputRef.value?.focus()\n}\n\n// Pressing the padding or a plain affix should land in the text without\n// first blurring it. Interactive content inside an affix keeps its own focus.\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('button, a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\ndefineExpose<InputExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n select: () => inputRef.value?.select(),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <FieldAffix\n v-if=\"slots.prefix\"\n side=\"start\"\n :class=\"[ns.e('affix'), ns.e('prefix')]\"\n :disabled=\"disabled\"\n :render=\"slots.prefix\"\n />\n <input\n ref=\"input\"\n v-model=\"model\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n :type=\"nativeType\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"formItem?.trigger('change', { lazy: true })\"\n @blur=\"formItem?.trigger('blur')\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('input.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <button\n v-if=\"type === 'password' && showPassword\"\n type=\"button\"\n :class=\"ns.e('reveal')\"\n :aria-label=\"t(revealed ? 'input.hidePassword' : 'input.showPassword')\"\n :aria-pressed=\"revealed\"\n :disabled=\"disabled\"\n @mousedown.prevent\n @click=\"revealed = !revealed\"\n >\n <EyeOffIcon v-if=\"revealed\" />\n <EyeIcon v-else />\n </button>\n <span v-if=\"showCount\" :class=\"ns.e('count')\" aria-hidden=\"true\">\n {{ maxLength ? `${count} / ${maxLength}` : count }}\n </span>\n <FieldAffix\n v-if=\"slots.suffix\"\n side=\"end\"\n :class=\"[ns.e('affix'), ns.e('suffix')]\"\n :disabled=\"disabled\"\n :render=\"slots.suffix\"\n />\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useNamespace } from "../../utils/namespace.js";
|
|
2
2
|
import { useLocale } from "../config-provider/use-config.js";
|
|
3
3
|
import { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from "../form/use-form-item.js";
|
|
4
|
-
import {
|
|
4
|
+
import { FieldAffix } from "../../utils/field-action.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, ref, toDisplayString, unref, useAttrs, useModel, useSlots, useTemplateRef, vModelDynamic, withDirectives, withModifiers } from "vue";
|
|
5
6
|
import { CloseIcon, EyeIcon, EyeOffIcon } from "@dou-ui/icons";
|
|
6
7
|
// src/components/input/input.vue?vue&type=script&setup=true&lang.ts
|
|
7
8
|
var _hoisted_1 = [
|
|
@@ -120,10 +121,17 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
120
121
|
style: normalizeStyle(unref(attrs).style),
|
|
121
122
|
onMousedown
|
|
122
123
|
}, [
|
|
123
|
-
slots.prefix ? (openBlock(),
|
|
124
|
+
slots.prefix ? (openBlock(), createBlock(unref(FieldAffix), {
|
|
124
125
|
key: 0,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
side: "start",
|
|
127
|
+
class: normalizeClass([unref(ns).e("affix"), unref(ns).e("prefix")]),
|
|
128
|
+
disabled: unref(disabled),
|
|
129
|
+
render: slots.prefix
|
|
130
|
+
}, null, 8, [
|
|
131
|
+
"class",
|
|
132
|
+
"disabled",
|
|
133
|
+
"render"
|
|
134
|
+
])) : createCommentVNode("", true),
|
|
127
135
|
withDirectives(createElementVNode("input", mergeProps({
|
|
128
136
|
ref: "input",
|
|
129
137
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
|
|
@@ -160,10 +168,17 @@ var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
160
168
|
class: normalizeClass(unref(ns).e("count")),
|
|
161
169
|
"aria-hidden": "true"
|
|
162
170
|
}, toDisplayString(maxLength.value ? `${count.value} / ${maxLength.value}` : count.value), 3)) : createCommentVNode("", true),
|
|
163
|
-
slots.suffix ? (openBlock(),
|
|
171
|
+
slots.suffix ? (openBlock(), createBlock(unref(FieldAffix), {
|
|
164
172
|
key: 4,
|
|
165
|
-
|
|
166
|
-
|
|
173
|
+
side: "end",
|
|
174
|
+
class: normalizeClass([unref(ns).e("affix"), unref(ns).e("suffix")]),
|
|
175
|
+
disabled: unref(disabled),
|
|
176
|
+
render: slots.suffix
|
|
177
|
+
}, null, 8, [
|
|
178
|
+
"class",
|
|
179
|
+
"disabled",
|
|
180
|
+
"render"
|
|
181
|
+
])) : createCommentVNode("", true)
|
|
167
182
|
], 38);
|
|
168
183
|
};
|
|
169
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","
|
|
1
|
+
{"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","_createBlock","_createCommentVNode","_withDirectives","_createElementVNode","_mergeProps","_vModelDynamic","_withModifiers","_createVNode","_toDisplayString"],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, EyeIcon, EyeOffIcon } from '@dou-ui/icons'\nimport { computed, nextTick, ref, useAttrs, useTemplateRef } from 'vue'\nimport type { StyleValue } from 'vue'\nimport { FieldAffix } from '../../utils/field-action'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputExpose, InputProps, InputSlots } from './input'\n\ndefineOptions({ name: 'DouInput', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n disabled: false,\n readonly: false,\n invalid: false,\n clearable: false,\n type: 'text',\n showPassword: false,\n showCount: false,\n})\nconst model = defineModel<string>({ default: '' })\nconst emit = defineEmits<{ clear: [] }>()\nconst slots = defineSlots<InputSlots>()\n\nconst ns = useNamespace('input')\nconst { t } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// `class` and `style` dress the field; every other attribute (placeholder,\n// name, autocomplete, listeners...) belongs to the native input. Inside a\n// form item the input also takes the item's id and description, unless\n// the caller sets them.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nconst revealed = ref(false)\nconst nativeType = computed(() =>\n props.type === 'password' && props.showPassword && revealed.value ? 'text' : props.type,\n)\n\nconst maxLength = computed(() => {\n const value = Number(attrs.maxlength ?? attrs.maxLength)\n return Number.isFinite(value) && value > 0 ? value : undefined\n})\n// Count what a person sees as characters, so an emoji counts once.\nconst count = computed(() => [...model.value].length)\n\nconst showClear = computed(\n () => props.clearable && !disabled.value && !readonly.value && model.value !== '',\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n attrs.class,\n])\n\nasync function clear() {\n model.value = ''\n emit('clear')\n formItem?.trigger('change', { lazy: true })\n await nextTick()\n inputRef.value?.focus()\n}\n\n// Pressing the padding or a plain affix should land in the text without\n// first blurring it. Interactive content inside an affix keeps its own focus.\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('button, a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\ndefineExpose<InputExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n select: () => inputRef.value?.select(),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <FieldAffix\n v-if=\"slots.prefix\"\n side=\"start\"\n :class=\"[ns.e('affix'), ns.e('prefix')]\"\n :disabled=\"disabled\"\n :render=\"slots.prefix\"\n />\n <input\n ref=\"input\"\n v-model=\"model\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n :type=\"nativeType\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"formItem?.trigger('change', { lazy: true })\"\n @blur=\"formItem?.trigger('blur')\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('input.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <button\n v-if=\"type === 'password' && showPassword\"\n type=\"button\"\n :class=\"ns.e('reveal')\"\n :aria-label=\"t(revealed ? 'input.hidePassword' : 'input.showPassword')\"\n :aria-pressed=\"revealed\"\n :disabled=\"disabled\"\n @mousedown.prevent\n @click=\"revealed = !revealed\"\n >\n <EyeOffIcon v-if=\"revealed\" />\n <EyeIcon v-else />\n </button>\n <span v-if=\"showCount\" :class=\"ns.e('count')\" aria-hidden=\"true\">\n {{ maxLength ? `${count} / ${maxLength}` : count }}\n </span>\n <FieldAffix\n v-if=\"slots.suffix\"\n side=\"end\"\n :class=\"[ns.e('affix'), ns.e('suffix')]\"\n :disabled=\"disabled\"\n :render=\"slots.suffix\"\n />\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYA,MAAM,QAAQ;EASd,MAAM,QAAQA,SAAmB,SAAA,YAAgB;EACjD,MAAM,OAAO;EACb,MAAM,QAAQC,SAAA;EAEd,MAAM,KAAK,aAAa,OAAO;EAC/B,MAAM,EAAE,MAAM,UAAU;EACxB,MAAM,EAAE,aAAa,YAAY;EACjC,MAAM,OAAO,kBAAkB,MAAM,IAAI;EACzC,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,UAAU,eAAe,MAAM,WAAW,CAAC,CAAC,UAAU,QAAQ,KAAK;EAMzE,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,eAAe;GAChC,MAAM,EAAE,OAAO,QAAQ,OAAO,QAAQ,GAAG,SAAS;GAClD,IAAI,CAAC,UAAU,OAAO;GACtB,OAAO;IACL,IAAI,SAAS;IACb,oBAAoB,SAAS,YAAY;IACzC,iBAAiB,SAAS,SAAS,SAAS,KAAA;IAC5C,GAAG;GACL;EACF,CAAC;EAED,MAAM,WAAW,eAAiC,OAAO;EAEzD,MAAM,WAAW,IAAI,KAAK;EAC1B,MAAM,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AAS,OAAA,OAAA,OAAA,KAAAO,oBAAV,CAAA,GAAkB,CAAA,SAAA,CAAA;KACjB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,SAAA,QAAQ,CAAI,SAAA;I,IAEF,SAAA,SAAlBX,UAAA,GAAAK,YAA8BD,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,CAAA,MAC9BJ,UAAA,GAAAK,YAAkBD,MAAA,OAAA,GAAA,EAAA,KAAA,EAAA,CAAA,E;IAER,QAAA,aAAZJ,UAAA,GAAAC,mBAEO,QAAA;;KAFiB,OAAKC,eAAEE,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;KAAW,eAAY;IACrD,GAAAS,gBAAA,UAAA,QAAS,GAAM,MAAA,MAAK,KAAM,UAAA,UAAc,MAAA,KAAK,GAAA,CAAA,K;IAG1C,MAAM,UADdb,UAAA,GAAAK,YAMED,MAAA,UAAA,GAAA;;KAJA,MAAK;KACJ,OAAKF,eAAA,CAAGE,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,GAAWA,MAAA,EAAA,CAAE,CAAC,EAAC,QAAA,CAAA,CAAA;KAC3B,UAAUA,MAAA,QAAA;KACV,QAAQ,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-number.js","names":["_sfc_main"],"sources":["../../../src/components/input-number/input-number.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, MinusIcon, PlusIcon } from '@dou-ui/icons'\nimport { computed, onBeforeUnmount, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes, StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputNumberExpose, InputNumberProps, InputNumberSlots } from './input-number'\n\ndefineOptions({ name: 'DouInputNumber', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputNumberProps>(), {\n min: -Infinity,\n max: Infinity,\n step: 1,\n disabled: false,\n readonly: false,\n invalid: false,\n controls: true,\n clearable: false,\n})\nconst model = defineModel<number | null>({ default: null })\nconst emit = defineEmits<{ change: [value: number | null, oldValue: number | null]; clear: [] }>()\nconst slots = defineSlots<InputNumberSlots>()\n\nconst ns = useNamespace('input-number')\nconst { t, locale } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\nconst editable = computed(() => !disabled.value && !readonly.value)\n\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\n// The on-screen keyboard: digits only for whole numbers. The iOS number\n// pads have no minus key, so a range that reaches below zero gets the full\n// keyboard. An `inputmode` attribute overrides this.\nconst inputMode = computed((): HTMLAttributes['inputmode'] => {\n if (typeof attrs.inputmode === 'string') return attrs.inputmode as HTMLAttributes['inputmode']\n if (Number.isFinite(props.min) && props.min < 0) return 'text'\n return props.precision === 0 ? 'numeric' : 'decimal'\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n// Round through the decimal notation, so 1.005 rounds to 1.01 and\n// 0.1 + 0.2 lands on 0.3.\nfunction round(value: number, places: number) {\n return Number(`${Math.round(Number(`${value}e${places}`))}e-${places}`)\n}\n\nconst clamp = (value: number) => Math.min(Math.max(value, props.min), props.max)\n\nfunction normalize(value: number) {\n return clamp(props.precision === undefined ? value : round(value, props.precision))\n}\n\nfunction format(value: number | null) {\n if (value === null || Number.isNaN(value)) return ''\n return props.precision === undefined ? String(value) : value.toFixed(props.precision)\n}\n\n// How the value reads while the field is not being edited.\nconst formatter = computed(() => {\n const option = props.format\n if (!option) return undefined\n if (typeof option === 'function') return option\n const digits =\n props.precision === undefined\n ? {}\n : { minimumFractionDigits: props.precision, maximumFractionDigits: props.precision }\n const intl = new Intl.NumberFormat(locale.value.name, { ...digits, ...option })\n return (value: number) => intl.format(value)\n})\nconst focused = ref(false)\n\n/** `null` for an empty field, `NaN` for text that is not a number. */\nfunction parse(text: string) {\n const trimmed = text.trim()\n if (trimmed === '') return null\n // Accept the full-width digits and signs an IME may produce.\n const ascii = trimmed\n .replace(/[0-9]/g, (digit) => String(digit.charCodeAt(0) - 0xff10))\n .replace(/[.。]/g, '.')\n .replace(/[-−]/g, '-')\n return /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(e[+-]?\\d+)?$/i.test(ascii) ? Number(ascii) : Number.NaN\n}\n\n// What the field shows. It follows the model, except while the user is\n// typing something that is not a number yet, such as `-` or `1.`.\nconst text = ref(format(model.value))\n// The value as of the last commit, reported as `oldValue` by `change`.\nlet committed = model.value\n\n// A value that does not match the text came from outside, not from typing.\nwatch(model, (value) => {\n if (parse(text.value) === value) return\n text.value = format(value)\n committed = value\n})\n\nfunction commit(value: number | null) {\n model.value = value\n text.value = format(value)\n if (value !== committed) {\n const old = committed\n committed = value\n emit('change', value, old)\n formItem?.trigger('change')\n }\n}\n\nfunction onInput(event: Event) {\n text.value = (event.target as HTMLInputElement).value\n const value = parse(text.value)\n // Only report values that would survive the commit unchanged, so a\n // half-typed number never reaches the model out of range.\n if (value === null || (!Number.isNaN(value) && value === normalize(value))) {\n model.value = value\n formItem?.trigger('change', { lazy: true })\n }\n}\n\nfunction onChange() {\n const value = parse(text.value)\n commit(Number.isNaN(value) ? model.value : value === null ? null : normalize(value))\n}\n\n// The plain text while editing, the formatted value otherwise.\nconst shown = computed(() =>\n focused.value || !formatter.value || model.value === null || Number.isNaN(model.value)\n ? text.value\n : formatter.value(model.value),\n)\n\nfunction onBlur() {\n focused.value = false\n onChange()\n formItem?.trigger('blur')\n}\n\nconst showClear = computed(() => props.clearable && editable.value && model.value !== null)\n\nfunction clear() {\n commit(null)\n emit('clear')\n inputRef.value?.focus()\n}\n\nfunction stepBy(count: number) {\n if (!editable.value) return\n const parsed = parse(text.value)\n const from = parsed === null || Number.isNaN(parsed) ? (model.value ?? 0) : parsed\n const next = round(from + props.step * count, Math.max(decimals(from), decimals(props.step)))\n commit(normalize(next))\n}\n\nconst canIncrease = computed(() => editable.value && (model.value ?? -Infinity) < props.max)\nconst canDecrease = computed(() => editable.value && (model.value ?? Infinity) > props.min)\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!editable.value) return\n const steps: Record<string, number> = { ArrowUp: 1, ArrowDown: -1, PageUp: 10, PageDown: -10 }\n if (event.key in steps) {\n event.preventDefault()\n stepBy(steps[event.key]!)\n } else if (event.key === 'Home' && Number.isFinite(props.min)) {\n event.preventDefault()\n commit(props.min)\n } else if (event.key === 'End' && Number.isFinite(props.max)) {\n event.preventDefault()\n commit(props.max)\n } else if (event.key === 'Enter') {\n onChange()\n }\n}\n\n// Holding a step key repeats the step, slowly at first.\nlet timer: ReturnType<typeof setTimeout> | undefined\n// The key being held: 1 for increase, -1 for decrease, 0 for none.\nconst held = ref(0)\n\nfunction stopRepeat() {\n clearTimeout(timer)\n timer = undefined\n held.value = 0\n}\n\nfunction startRepeat(count: number) {\n stopRepeat()\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return\n held.value = count\n stepBy(count)\n const repeat = (delay: number) => {\n timer = setTimeout(() => {\n // A key that reaches the limit turns disabled, so stop there.\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return stopRepeat()\n stepBy(count)\n repeat(50)\n }, delay)\n }\n repeat(400)\n}\n\nfunction onStepPointerdown(event: PointerEvent, count: number) {\n // Touch goes through the key pad below.\n if (event.pointerType === 'touch' || event.button !== 0) return\n startRepeat(count)\n // The pointer may come up over a key that turned disabled, so listen\n // on the window.\n window.addEventListener('pointerup', stopRepeat, { once: true })\n}\n\n// On touch the keys are too small to aim at, so the first press only\n// enlarges them. Keeping the finger down and sliding onto a key steps\n// with it, and the pad shrinks back as soon as that finger lifts. After a\n// plain press the pad stays, later taps step as usual, and it shrinks back\n// after a tap elsewhere or a short pause.\nconst COLLAPSE_DELAY = 2000\n// How far a finger slides from where the pad opened before it counts.\nconst SLIDE_THRESHOLD = 6\n\nconst keysRef = useTemplateRef<HTMLElement>('keys')\nconst expanded = ref(false)\nlet idle: ReturnType<typeof setTimeout> | undefined\n\nfunction onOutsidePointerdown(event: PointerEvent) {\n if (!keysRef.value?.contains(event.target as Node)) collapse()\n}\n\nfunction expand() {\n clearTimeout(idle)\n if (expanded.value) return\n expanded.value = true\n document.addEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\nfunction collapse() {\n clearTimeout(idle)\n stopRepeat()\n expanded.value = false\n document.removeEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\n/** The key under a finger at `y`: 1 above the middle, -1 below, 0 on the seam. */\nfunction keyAt(y: number) {\n const box = keysRef.value!.getBoundingClientRect()\n const middle = box.top + box.height / 2\n return Math.abs(y - middle) <= 2 ? 0 : y < middle ? 1 : -1\n}\n\nfunction onKeysPointerdown(event: PointerEvent) {\n if (event.pointerType !== 'touch' || !editable.value) return\n // Keep the keyboard closed and the page still while the finger is down.\n event.preventDefault()\n const keys = event.currentTarget as HTMLElement\n keys.setPointerCapture?.(event.pointerId)\n const opened = !expanded.value\n expand()\n const startY = event.clientY\n let slid = !opened\n let stepped = false\n const follow = (y: number) => {\n slid ||= Math.abs(y - startY) >= SLIDE_THRESHOLD\n const count = slid ? keyAt(y) : 0\n if (count === held.value) return\n stepped ||= count !== 0\n if (count) startRepeat(count)\n else stopRepeat()\n }\n follow(startY)\n const move = (e: PointerEvent) => {\n if (e.pointerId === event.pointerId) follow(e.clientY)\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n stopRepeat()\n keys.removeEventListener('pointermove', move)\n keys.removeEventListener('pointerup', end)\n keys.removeEventListener('pointercancel', end)\n // A press that opened the pad and slid to adjust is done when lifted.\n if (opened && stepped) return collapse()\n clearTimeout(idle)\n idle = setTimeout(collapse, COLLAPSE_DELAY)\n }\n keys.addEventListener('pointermove', move)\n keys.addEventListener('pointerup', end)\n keys.addEventListener('pointercancel', end)\n}\n\nwatch(editable, (value) => value || collapse())\n\nonBeforeUnmount(collapse)\n\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('controls', props.controls),\n ns.is('expanded', expanded.value),\n attrs.class,\n])\n\ndefineExpose<InputNumberExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n increase: (count = 1) => stepBy(count),\n decrease: (count = 1) => stepBy(-count),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <span v-if=\"slots.prefix\" :class=\"[ns.e('affix'), ns.e('prefix')]\">\n <slot name=\"prefix\" />\n </span>\n <input\n ref=\"input\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n type=\"text\"\n :inputmode=\"inputMode\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n :value=\"shown\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-valuenow=\"model ?? undefined\"\n :aria-valuetext=\"formatter && model !== null ? formatter(model) : undefined\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"onInput\"\n @focus=\"focused = true\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('inputNumber.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <span v-if=\"slots.suffix\" :class=\"[ns.e('affix'), ns.e('suffix')]\">\n <slot name=\"suffix\" />\n </span>\n <span v-if=\"controls\" :class=\"ns.e('controls')\">\n <span ref=\"keys\" :class=\"ns.e('keys')\" @pointerdown=\"onKeysPointerdown\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('increase'), ns.is('held', held === 1)]\"\n :aria-label=\"t('inputNumber.increase')\"\n :disabled=\"!canIncrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, 1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <PlusIcon />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('decrease'), ns.is('held', held === -1)]\"\n :aria-label=\"t('inputNumber.decrease')\"\n :disabled=\"!canDecrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, -1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <MinusIcon />\n </button>\n </span>\n </span>\n </span>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"input-number.js","names":["_sfc_main"],"sources":["../../../src/components/input-number/input-number.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, MinusIcon, PlusIcon } from '@dou-ui/icons'\nimport { computed, onBeforeUnmount, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes, StyleValue } from 'vue'\nimport { FieldAffix } from '../../utils/field-action'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputNumberExpose, InputNumberProps, InputNumberSlots } from './input-number'\n\ndefineOptions({ name: 'DouInputNumber', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputNumberProps>(), {\n min: -Infinity,\n max: Infinity,\n step: 1,\n disabled: false,\n readonly: false,\n invalid: false,\n controls: true,\n clearable: false,\n})\nconst model = defineModel<number | null>({ default: null })\nconst emit = defineEmits<{ change: [value: number | null, oldValue: number | null]; clear: [] }>()\nconst slots = defineSlots<InputNumberSlots>()\n\nconst ns = useNamespace('input-number')\nconst { t, locale } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\nconst editable = computed(() => !disabled.value && !readonly.value)\n\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\n// The on-screen keyboard: digits only for whole numbers. The iOS number\n// pads have no minus key, so a range that reaches below zero gets the full\n// keyboard. An `inputmode` attribute overrides this.\nconst inputMode = computed((): HTMLAttributes['inputmode'] => {\n if (typeof attrs.inputmode === 'string') return attrs.inputmode as HTMLAttributes['inputmode']\n if (Number.isFinite(props.min) && props.min < 0) return 'text'\n return props.precision === 0 ? 'numeric' : 'decimal'\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n// Round through the decimal notation, so 1.005 rounds to 1.01 and\n// 0.1 + 0.2 lands on 0.3.\nfunction round(value: number, places: number) {\n return Number(`${Math.round(Number(`${value}e${places}`))}e-${places}`)\n}\n\nconst clamp = (value: number) => Math.min(Math.max(value, props.min), props.max)\n\nfunction normalize(value: number) {\n return clamp(props.precision === undefined ? value : round(value, props.precision))\n}\n\nfunction format(value: number | null) {\n if (value === null || Number.isNaN(value)) return ''\n return props.precision === undefined ? String(value) : value.toFixed(props.precision)\n}\n\n// How the value reads while the field is not being edited.\nconst formatter = computed(() => {\n const option = props.format\n if (!option) return undefined\n if (typeof option === 'function') return option\n const digits =\n props.precision === undefined\n ? {}\n : { minimumFractionDigits: props.precision, maximumFractionDigits: props.precision }\n const intl = new Intl.NumberFormat(locale.value.name, { ...digits, ...option })\n return (value: number) => intl.format(value)\n})\nconst focused = ref(false)\n\n/** `null` for an empty field, `NaN` for text that is not a number. */\nfunction parse(text: string) {\n const trimmed = text.trim()\n if (trimmed === '') return null\n // Accept the full-width digits and signs an IME may produce.\n const ascii = trimmed\n .replace(/[0-9]/g, (digit) => String(digit.charCodeAt(0) - 0xff10))\n .replace(/[.。]/g, '.')\n .replace(/[-−]/g, '-')\n return /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(e[+-]?\\d+)?$/i.test(ascii) ? Number(ascii) : Number.NaN\n}\n\n// What the field shows. It follows the model, except while the user is\n// typing something that is not a number yet, such as `-` or `1.`.\nconst text = ref(format(model.value))\n// The value as of the last commit, reported as `oldValue` by `change`.\nlet committed = model.value\n\n// A value that does not match the text came from outside, not from typing.\nwatch(model, (value) => {\n if (parse(text.value) === value) return\n text.value = format(value)\n committed = value\n})\n\nfunction commit(value: number | null) {\n model.value = value\n text.value = format(value)\n if (value !== committed) {\n const old = committed\n committed = value\n emit('change', value, old)\n formItem?.trigger('change')\n }\n}\n\nfunction onInput(event: Event) {\n text.value = (event.target as HTMLInputElement).value\n const value = parse(text.value)\n // Only report values that would survive the commit unchanged, so a\n // half-typed number never reaches the model out of range.\n if (value === null || (!Number.isNaN(value) && value === normalize(value))) {\n model.value = value\n formItem?.trigger('change', { lazy: true })\n }\n}\n\nfunction onChange() {\n const value = parse(text.value)\n commit(Number.isNaN(value) ? model.value : value === null ? null : normalize(value))\n}\n\n// The plain text while editing, the formatted value otherwise.\nconst shown = computed(() =>\n focused.value || !formatter.value || model.value === null || Number.isNaN(model.value)\n ? text.value\n : formatter.value(model.value),\n)\n\nfunction onBlur() {\n focused.value = false\n onChange()\n formItem?.trigger('blur')\n}\n\nconst showClear = computed(() => props.clearable && editable.value && model.value !== null)\n\nfunction clear() {\n commit(null)\n emit('clear')\n inputRef.value?.focus()\n}\n\nfunction stepBy(count: number) {\n if (!editable.value) return\n const parsed = parse(text.value)\n const from = parsed === null || Number.isNaN(parsed) ? (model.value ?? 0) : parsed\n const next = round(from + props.step * count, Math.max(decimals(from), decimals(props.step)))\n commit(normalize(next))\n}\n\nconst canIncrease = computed(() => editable.value && (model.value ?? -Infinity) < props.max)\nconst canDecrease = computed(() => editable.value && (model.value ?? Infinity) > props.min)\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!editable.value) return\n const steps: Record<string, number> = { ArrowUp: 1, ArrowDown: -1, PageUp: 10, PageDown: -10 }\n if (event.key in steps) {\n event.preventDefault()\n stepBy(steps[event.key]!)\n } else if (event.key === 'Home' && Number.isFinite(props.min)) {\n event.preventDefault()\n commit(props.min)\n } else if (event.key === 'End' && Number.isFinite(props.max)) {\n event.preventDefault()\n commit(props.max)\n } else if (event.key === 'Enter') {\n onChange()\n }\n}\n\n// Holding a step key repeats the step, slowly at first.\nlet timer: ReturnType<typeof setTimeout> | undefined\n// The key being held: 1 for increase, -1 for decrease, 0 for none.\nconst held = ref(0)\n\nfunction stopRepeat() {\n clearTimeout(timer)\n timer = undefined\n held.value = 0\n}\n\nfunction startRepeat(count: number) {\n stopRepeat()\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return\n held.value = count\n stepBy(count)\n const repeat = (delay: number) => {\n timer = setTimeout(() => {\n // A key that reaches the limit turns disabled, so stop there.\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return stopRepeat()\n stepBy(count)\n repeat(50)\n }, delay)\n }\n repeat(400)\n}\n\nfunction onStepPointerdown(event: PointerEvent, count: number) {\n // Touch goes through the key pad below.\n if (event.pointerType === 'touch' || event.button !== 0) return\n startRepeat(count)\n // The pointer may come up over a key that turned disabled, so listen\n // on the window.\n window.addEventListener('pointerup', stopRepeat, { once: true })\n}\n\n// On touch the keys are too small to aim at, so the first press only\n// enlarges them. Keeping the finger down and sliding onto a key steps\n// with it, and the pad shrinks back as soon as that finger lifts. After a\n// plain press the pad stays, later taps step as usual, and it shrinks back\n// after a tap elsewhere or a short pause.\nconst COLLAPSE_DELAY = 2000\n// How far a finger slides from where the pad opened before it counts.\nconst SLIDE_THRESHOLD = 6\n\nconst keysRef = useTemplateRef<HTMLElement>('keys')\nconst expanded = ref(false)\nlet idle: ReturnType<typeof setTimeout> | undefined\n\nfunction onOutsidePointerdown(event: PointerEvent) {\n if (!keysRef.value?.contains(event.target as Node)) collapse()\n}\n\nfunction expand() {\n clearTimeout(idle)\n if (expanded.value) return\n expanded.value = true\n document.addEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\nfunction collapse() {\n clearTimeout(idle)\n stopRepeat()\n expanded.value = false\n document.removeEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\n/** The key under a finger at `y`: 1 above the middle, -1 below, 0 on the seam. */\nfunction keyAt(y: number) {\n const box = keysRef.value!.getBoundingClientRect()\n const middle = box.top + box.height / 2\n return Math.abs(y - middle) <= 2 ? 0 : y < middle ? 1 : -1\n}\n\nfunction onKeysPointerdown(event: PointerEvent) {\n if (event.pointerType !== 'touch' || !editable.value) return\n // Keep the keyboard closed and the page still while the finger is down.\n event.preventDefault()\n const keys = event.currentTarget as HTMLElement\n keys.setPointerCapture?.(event.pointerId)\n const opened = !expanded.value\n expand()\n const startY = event.clientY\n let slid = !opened\n let stepped = false\n const follow = (y: number) => {\n slid ||= Math.abs(y - startY) >= SLIDE_THRESHOLD\n const count = slid ? keyAt(y) : 0\n if (count === held.value) return\n stepped ||= count !== 0\n if (count) startRepeat(count)\n else stopRepeat()\n }\n follow(startY)\n const move = (e: PointerEvent) => {\n if (e.pointerId === event.pointerId) follow(e.clientY)\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n stopRepeat()\n keys.removeEventListener('pointermove', move)\n keys.removeEventListener('pointerup', end)\n keys.removeEventListener('pointercancel', end)\n // A press that opened the pad and slid to adjust is done when lifted.\n if (opened && stepped) return collapse()\n clearTimeout(idle)\n idle = setTimeout(collapse, COLLAPSE_DELAY)\n }\n keys.addEventListener('pointermove', move)\n keys.addEventListener('pointerup', end)\n keys.addEventListener('pointercancel', end)\n}\n\nwatch(editable, (value) => value || collapse())\n\nonBeforeUnmount(collapse)\n\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('controls', props.controls),\n ns.is('expanded', expanded.value),\n attrs.class,\n])\n\ndefineExpose<InputNumberExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n increase: (count = 1) => stepBy(count),\n decrease: (count = 1) => stepBy(-count),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <FieldAffix\n v-if=\"slots.prefix\"\n side=\"start\"\n :class=\"[ns.e('affix'), ns.e('prefix')]\"\n :disabled=\"disabled\"\n :render=\"slots.prefix\"\n />\n <input\n ref=\"input\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n type=\"text\"\n :inputmode=\"inputMode\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n :value=\"shown\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-valuenow=\"model ?? undefined\"\n :aria-valuetext=\"formatter && model !== null ? formatter(model) : undefined\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"onInput\"\n @focus=\"focused = true\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('inputNumber.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <FieldAffix\n v-if=\"slots.suffix\"\n side=\"end\"\n :class=\"[ns.e('affix'), ns.e('suffix')]\"\n :disabled=\"disabled\"\n :render=\"slots.suffix\"\n />\n <span v-if=\"controls\" :class=\"ns.e('controls')\">\n <span ref=\"keys\" :class=\"ns.e('keys')\" @pointerdown=\"onKeysPointerdown\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('increase'), ns.is('held', held === 1)]\"\n :aria-label=\"t('inputNumber.increase')\"\n :disabled=\"!canIncrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, 1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <PlusIcon />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('decrease'), ns.is('held', held === -1)]\"\n :aria-label=\"t('inputNumber.decrease')\"\n :disabled=\"!canDecrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, -1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <MinusIcon />\n </button>\n </span>\n </span>\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useNamespace } from "../../utils/namespace.js";
|
|
2
2
|
import { useLocale } from "../config-provider/use-config.js";
|
|
3
3
|
import { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from "../form/use-form-item.js";
|
|
4
|
-
import {
|
|
4
|
+
import { FieldAffix } from "../../utils/field-action.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, unref, useAttrs, useModel, useSlots, useTemplateRef, watch, withModifiers } from "vue";
|
|
5
6
|
import { CloseIcon, MinusIcon, PlusIcon } from "@dou-ui/icons";
|
|
6
7
|
// src/components/input-number/input-number.vue?vue&type=script&setup=true&lang.ts
|
|
7
8
|
var _hoisted_1 = [
|
|
@@ -314,10 +315,17 @@ var input_number_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
314
315
|
style: normalizeStyle(unref(attrs).style),
|
|
315
316
|
onMousedown
|
|
316
317
|
}, [
|
|
317
|
-
slots.prefix ? (openBlock(),
|
|
318
|
+
slots.prefix ? (openBlock(), createBlock(unref(FieldAffix), {
|
|
318
319
|
key: 0,
|
|
319
|
-
|
|
320
|
-
|
|
320
|
+
side: "start",
|
|
321
|
+
class: normalizeClass([unref(ns).e("affix"), unref(ns).e("prefix")]),
|
|
322
|
+
disabled: unref(disabled),
|
|
323
|
+
render: slots.prefix
|
|
324
|
+
}, null, 8, [
|
|
325
|
+
"class",
|
|
326
|
+
"disabled",
|
|
327
|
+
"render"
|
|
328
|
+
])) : createCommentVNode("", true),
|
|
321
329
|
createElementVNode("input", mergeProps({ ref: "input" }, inputAttrs.value, {
|
|
322
330
|
class: unref(ns).e("native"),
|
|
323
331
|
type: "text",
|
|
@@ -347,10 +355,17 @@ var input_number_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
347
355
|
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
|
|
348
356
|
onClick: clear
|
|
349
357
|
}, [createVNode(unref(CloseIcon))], 42, _hoisted_2)) : createCommentVNode("", true),
|
|
350
|
-
slots.suffix ? (openBlock(),
|
|
358
|
+
slots.suffix ? (openBlock(), createBlock(unref(FieldAffix), {
|
|
351
359
|
key: 2,
|
|
352
|
-
|
|
353
|
-
|
|
360
|
+
side: "end",
|
|
361
|
+
class: normalizeClass([unref(ns).e("affix"), unref(ns).e("suffix")]),
|
|
362
|
+
disabled: unref(disabled),
|
|
363
|
+
render: slots.suffix
|
|
364
|
+
}, null, 8, [
|
|
365
|
+
"class",
|
|
366
|
+
"disabled",
|
|
367
|
+
"render"
|
|
368
|
+
])) : createCommentVNode("", true),
|
|
354
369
|
__props.controls ? (openBlock(), createElementBlock("span", {
|
|
355
370
|
key: 3,
|
|
356
371
|
class: normalizeClass(unref(ns).e("controls"))
|
package/dist/components/input-number/input-number.vue_vue_type_script_setup_true_lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-number.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","_renderSlot","_createCommentVNode","_createElementVNode","_mergeProps","_withModifiers","_createVNode"],"sources":["../../../src/components/input-number/input-number.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, MinusIcon, PlusIcon } from '@dou-ui/icons'\nimport { computed, onBeforeUnmount, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes, StyleValue } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputNumberExpose, InputNumberProps, InputNumberSlots } from './input-number'\n\ndefineOptions({ name: 'DouInputNumber', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputNumberProps>(), {\n min: -Infinity,\n max: Infinity,\n step: 1,\n disabled: false,\n readonly: false,\n invalid: false,\n controls: true,\n clearable: false,\n})\nconst model = defineModel<number | null>({ default: null })\nconst emit = defineEmits<{ change: [value: number | null, oldValue: number | null]; clear: [] }>()\nconst slots = defineSlots<InputNumberSlots>()\n\nconst ns = useNamespace('input-number')\nconst { t, locale } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\nconst editable = computed(() => !disabled.value && !readonly.value)\n\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\n// The on-screen keyboard: digits only for whole numbers. The iOS number\n// pads have no minus key, so a range that reaches below zero gets the full\n// keyboard. An `inputmode` attribute overrides this.\nconst inputMode = computed((): HTMLAttributes['inputmode'] => {\n if (typeof attrs.inputmode === 'string') return attrs.inputmode as HTMLAttributes['inputmode']\n if (Number.isFinite(props.min) && props.min < 0) return 'text'\n return props.precision === 0 ? 'numeric' : 'decimal'\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n// Round through the decimal notation, so 1.005 rounds to 1.01 and\n// 0.1 + 0.2 lands on 0.3.\nfunction round(value: number, places: number) {\n return Number(`${Math.round(Number(`${value}e${places}`))}e-${places}`)\n}\n\nconst clamp = (value: number) => Math.min(Math.max(value, props.min), props.max)\n\nfunction normalize(value: number) {\n return clamp(props.precision === undefined ? value : round(value, props.precision))\n}\n\nfunction format(value: number | null) {\n if (value === null || Number.isNaN(value)) return ''\n return props.precision === undefined ? String(value) : value.toFixed(props.precision)\n}\n\n// How the value reads while the field is not being edited.\nconst formatter = computed(() => {\n const option = props.format\n if (!option) return undefined\n if (typeof option === 'function') return option\n const digits =\n props.precision === undefined\n ? {}\n : { minimumFractionDigits: props.precision, maximumFractionDigits: props.precision }\n const intl = new Intl.NumberFormat(locale.value.name, { ...digits, ...option })\n return (value: number) => intl.format(value)\n})\nconst focused = ref(false)\n\n/** `null` for an empty field, `NaN` for text that is not a number. */\nfunction parse(text: string) {\n const trimmed = text.trim()\n if (trimmed === '') return null\n // Accept the full-width digits and signs an IME may produce.\n const ascii = trimmed\n .replace(/[0-9]/g, (digit) => String(digit.charCodeAt(0) - 0xff10))\n .replace(/[.。]/g, '.')\n .replace(/[-−]/g, '-')\n return /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(e[+-]?\\d+)?$/i.test(ascii) ? Number(ascii) : Number.NaN\n}\n\n// What the field shows. It follows the model, except while the user is\n// typing something that is not a number yet, such as `-` or `1.`.\nconst text = ref(format(model.value))\n// The value as of the last commit, reported as `oldValue` by `change`.\nlet committed = model.value\n\n// A value that does not match the text came from outside, not from typing.\nwatch(model, (value) => {\n if (parse(text.value) === value) return\n text.value = format(value)\n committed = value\n})\n\nfunction commit(value: number | null) {\n model.value = value\n text.value = format(value)\n if (value !== committed) {\n const old = committed\n committed = value\n emit('change', value, old)\n formItem?.trigger('change')\n }\n}\n\nfunction onInput(event: Event) {\n text.value = (event.target as HTMLInputElement).value\n const value = parse(text.value)\n // Only report values that would survive the commit unchanged, so a\n // half-typed number never reaches the model out of range.\n if (value === null || (!Number.isNaN(value) && value === normalize(value))) {\n model.value = value\n formItem?.trigger('change', { lazy: true })\n }\n}\n\nfunction onChange() {\n const value = parse(text.value)\n commit(Number.isNaN(value) ? model.value : value === null ? null : normalize(value))\n}\n\n// The plain text while editing, the formatted value otherwise.\nconst shown = computed(() =>\n focused.value || !formatter.value || model.value === null || Number.isNaN(model.value)\n ? text.value\n : formatter.value(model.value),\n)\n\nfunction onBlur() {\n focused.value = false\n onChange()\n formItem?.trigger('blur')\n}\n\nconst showClear = computed(() => props.clearable && editable.value && model.value !== null)\n\nfunction clear() {\n commit(null)\n emit('clear')\n inputRef.value?.focus()\n}\n\nfunction stepBy(count: number) {\n if (!editable.value) return\n const parsed = parse(text.value)\n const from = parsed === null || Number.isNaN(parsed) ? (model.value ?? 0) : parsed\n const next = round(from + props.step * count, Math.max(decimals(from), decimals(props.step)))\n commit(normalize(next))\n}\n\nconst canIncrease = computed(() => editable.value && (model.value ?? -Infinity) < props.max)\nconst canDecrease = computed(() => editable.value && (model.value ?? Infinity) > props.min)\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!editable.value) return\n const steps: Record<string, number> = { ArrowUp: 1, ArrowDown: -1, PageUp: 10, PageDown: -10 }\n if (event.key in steps) {\n event.preventDefault()\n stepBy(steps[event.key]!)\n } else if (event.key === 'Home' && Number.isFinite(props.min)) {\n event.preventDefault()\n commit(props.min)\n } else if (event.key === 'End' && Number.isFinite(props.max)) {\n event.preventDefault()\n commit(props.max)\n } else if (event.key === 'Enter') {\n onChange()\n }\n}\n\n// Holding a step key repeats the step, slowly at first.\nlet timer: ReturnType<typeof setTimeout> | undefined\n// The key being held: 1 for increase, -1 for decrease, 0 for none.\nconst held = ref(0)\n\nfunction stopRepeat() {\n clearTimeout(timer)\n timer = undefined\n held.value = 0\n}\n\nfunction startRepeat(count: number) {\n stopRepeat()\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return\n held.value = count\n stepBy(count)\n const repeat = (delay: number) => {\n timer = setTimeout(() => {\n // A key that reaches the limit turns disabled, so stop there.\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return stopRepeat()\n stepBy(count)\n repeat(50)\n }, delay)\n }\n repeat(400)\n}\n\nfunction onStepPointerdown(event: PointerEvent, count: number) {\n // Touch goes through the key pad below.\n if (event.pointerType === 'touch' || event.button !== 0) return\n startRepeat(count)\n // The pointer may come up over a key that turned disabled, so listen\n // on the window.\n window.addEventListener('pointerup', stopRepeat, { once: true })\n}\n\n// On touch the keys are too small to aim at, so the first press only\n// enlarges them. Keeping the finger down and sliding onto a key steps\n// with it, and the pad shrinks back as soon as that finger lifts. After a\n// plain press the pad stays, later taps step as usual, and it shrinks back\n// after a tap elsewhere or a short pause.\nconst COLLAPSE_DELAY = 2000\n// How far a finger slides from where the pad opened before it counts.\nconst SLIDE_THRESHOLD = 6\n\nconst keysRef = useTemplateRef<HTMLElement>('keys')\nconst expanded = ref(false)\nlet idle: ReturnType<typeof setTimeout> | undefined\n\nfunction onOutsidePointerdown(event: PointerEvent) {\n if (!keysRef.value?.contains(event.target as Node)) collapse()\n}\n\nfunction expand() {\n clearTimeout(idle)\n if (expanded.value) return\n expanded.value = true\n document.addEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\nfunction collapse() {\n clearTimeout(idle)\n stopRepeat()\n expanded.value = false\n document.removeEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\n/** The key under a finger at `y`: 1 above the middle, -1 below, 0 on the seam. */\nfunction keyAt(y: number) {\n const box = keysRef.value!.getBoundingClientRect()\n const middle = box.top + box.height / 2\n return Math.abs(y - middle) <= 2 ? 0 : y < middle ? 1 : -1\n}\n\nfunction onKeysPointerdown(event: PointerEvent) {\n if (event.pointerType !== 'touch' || !editable.value) return\n // Keep the keyboard closed and the page still while the finger is down.\n event.preventDefault()\n const keys = event.currentTarget as HTMLElement\n keys.setPointerCapture?.(event.pointerId)\n const opened = !expanded.value\n expand()\n const startY = event.clientY\n let slid = !opened\n let stepped = false\n const follow = (y: number) => {\n slid ||= Math.abs(y - startY) >= SLIDE_THRESHOLD\n const count = slid ? keyAt(y) : 0\n if (count === held.value) return\n stepped ||= count !== 0\n if (count) startRepeat(count)\n else stopRepeat()\n }\n follow(startY)\n const move = (e: PointerEvent) => {\n if (e.pointerId === event.pointerId) follow(e.clientY)\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n stopRepeat()\n keys.removeEventListener('pointermove', move)\n keys.removeEventListener('pointerup', end)\n keys.removeEventListener('pointercancel', end)\n // A press that opened the pad and slid to adjust is done when lifted.\n if (opened && stepped) return collapse()\n clearTimeout(idle)\n idle = setTimeout(collapse, COLLAPSE_DELAY)\n }\n keys.addEventListener('pointermove', move)\n keys.addEventListener('pointerup', end)\n keys.addEventListener('pointercancel', end)\n}\n\nwatch(editable, (value) => value || collapse())\n\nonBeforeUnmount(collapse)\n\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('controls', props.controls),\n ns.is('expanded', expanded.value),\n attrs.class,\n])\n\ndefineExpose<InputNumberExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n increase: (count = 1) => stepBy(count),\n decrease: (count = 1) => stepBy(-count),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <span v-if=\"slots.prefix\" :class=\"[ns.e('affix'), ns.e('prefix')]\">\n <slot name=\"prefix\" />\n </span>\n <input\n ref=\"input\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n type=\"text\"\n :inputmode=\"inputMode\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n :value=\"shown\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-valuenow=\"model ?? undefined\"\n :aria-valuetext=\"formatter && model !== null ? formatter(model) : undefined\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"onInput\"\n @focus=\"focused = true\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('inputNumber.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <span v-if=\"slots.suffix\" :class=\"[ns.e('affix'), ns.e('suffix')]\">\n <slot name=\"suffix\" />\n </span>\n <span v-if=\"controls\" :class=\"ns.e('controls')\">\n <span ref=\"keys\" :class=\"ns.e('keys')\" @pointerdown=\"onKeysPointerdown\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('increase'), ns.is('held', held === 1)]\"\n :aria-label=\"t('inputNumber.increase')\"\n :disabled=\"!canIncrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, 1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <PlusIcon />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('decrease'), ns.is('held', held === -1)]\"\n :aria-label=\"t('inputNumber.decrease')\"\n :disabled=\"!canDecrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, -1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <MinusIcon />\n </button>\n </span>\n </span>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4OA,IAAM,iBAAiB;AAEvB,IAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnOxB,MAAM,QAAQ;EAUd,MAAM,QAAQA,SAA0B,SAAA,YAAkB;EAC1D,MAAM,OAAO;EACb,MAAM,QAAQC,SAAA;EAEd,MAAM,KAAK,aAAa,cAAc;EACtC,MAAM,EAAE,GAAG,WAAW,UAAU;EAChC,MAAM,EAAE,aAAa,YAAY;EACjC,MAAM,OAAO,kBAAkB,MAAM,IAAI;EACzC,MAAM,WAAW,sBA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["_useModel","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_unref","_createBlock","_createCommentVNode","_createElementVNode","_mergeProps","_withModifiers","_createVNode"],"sources":["../../../src/components/input-number/input-number.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon, MinusIcon, PlusIcon } from '@dou-ui/icons'\nimport { computed, onBeforeUnmount, ref, useAttrs, useTemplateRef, watch } from 'vue'\nimport type { HTMLAttributes, StyleValue } from 'vue'\nimport { FieldAffix } from '../../utils/field-action'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type { InputNumberExpose, InputNumberProps, InputNumberSlots } from './input-number'\n\ndefineOptions({ name: 'DouInputNumber', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<InputNumberProps>(), {\n min: -Infinity,\n max: Infinity,\n step: 1,\n disabled: false,\n readonly: false,\n invalid: false,\n controls: true,\n clearable: false,\n})\nconst model = defineModel<number | null>({ default: null })\nconst emit = defineEmits<{ change: [value: number | null, oldValue: number | null]; clear: [] }>()\nconst slots = defineSlots<InputNumberSlots>()\n\nconst ns = useNamespace('input-number')\nconst { t, locale } = useLocale()\nconst { formItem } = useFormItem()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\nconst editable = computed(() => !disabled.value && !readonly.value)\n\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n if (!formItem) return rest\n return {\n id: formItem.inputId,\n 'aria-describedby': formItem.describedBy.value,\n 'aria-required': formItem.required.value || undefined,\n ...rest,\n }\n})\n\n// The on-screen keyboard: digits only for whole numbers. The iOS number\n// pads have no minus key, so a range that reaches below zero gets the full\n// keyboard. An `inputmode` attribute overrides this.\nconst inputMode = computed((): HTMLAttributes['inputmode'] => {\n if (typeof attrs.inputmode === 'string') return attrs.inputmode as HTMLAttributes['inputmode']\n if (Number.isFinite(props.min) && props.min < 0) return 'text'\n return props.precision === 0 ? 'numeric' : 'decimal'\n})\n\nconst inputRef = useTemplateRef<HTMLInputElement>('input')\n\nfunction decimals(value: number) {\n const [digits = '', exponent] = String(value).split('e')\n const fraction = digits.split('.')[1]?.length ?? 0\n return Math.max(0, fraction - Number(exponent ?? 0))\n}\n\n// Round through the decimal notation, so 1.005 rounds to 1.01 and\n// 0.1 + 0.2 lands on 0.3.\nfunction round(value: number, places: number) {\n return Number(`${Math.round(Number(`${value}e${places}`))}e-${places}`)\n}\n\nconst clamp = (value: number) => Math.min(Math.max(value, props.min), props.max)\n\nfunction normalize(value: number) {\n return clamp(props.precision === undefined ? value : round(value, props.precision))\n}\n\nfunction format(value: number | null) {\n if (value === null || Number.isNaN(value)) return ''\n return props.precision === undefined ? String(value) : value.toFixed(props.precision)\n}\n\n// How the value reads while the field is not being edited.\nconst formatter = computed(() => {\n const option = props.format\n if (!option) return undefined\n if (typeof option === 'function') return option\n const digits =\n props.precision === undefined\n ? {}\n : { minimumFractionDigits: props.precision, maximumFractionDigits: props.precision }\n const intl = new Intl.NumberFormat(locale.value.name, { ...digits, ...option })\n return (value: number) => intl.format(value)\n})\nconst focused = ref(false)\n\n/** `null` for an empty field, `NaN` for text that is not a number. */\nfunction parse(text: string) {\n const trimmed = text.trim()\n if (trimmed === '') return null\n // Accept the full-width digits and signs an IME may produce.\n const ascii = trimmed\n .replace(/[0-9]/g, (digit) => String(digit.charCodeAt(0) - 0xff10))\n .replace(/[.。]/g, '.')\n .replace(/[-−]/g, '-')\n return /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(e[+-]?\\d+)?$/i.test(ascii) ? Number(ascii) : Number.NaN\n}\n\n// What the field shows. It follows the model, except while the user is\n// typing something that is not a number yet, such as `-` or `1.`.\nconst text = ref(format(model.value))\n// The value as of the last commit, reported as `oldValue` by `change`.\nlet committed = model.value\n\n// A value that does not match the text came from outside, not from typing.\nwatch(model, (value) => {\n if (parse(text.value) === value) return\n text.value = format(value)\n committed = value\n})\n\nfunction commit(value: number | null) {\n model.value = value\n text.value = format(value)\n if (value !== committed) {\n const old = committed\n committed = value\n emit('change', value, old)\n formItem?.trigger('change')\n }\n}\n\nfunction onInput(event: Event) {\n text.value = (event.target as HTMLInputElement).value\n const value = parse(text.value)\n // Only report values that would survive the commit unchanged, so a\n // half-typed number never reaches the model out of range.\n if (value === null || (!Number.isNaN(value) && value === normalize(value))) {\n model.value = value\n formItem?.trigger('change', { lazy: true })\n }\n}\n\nfunction onChange() {\n const value = parse(text.value)\n commit(Number.isNaN(value) ? model.value : value === null ? null : normalize(value))\n}\n\n// The plain text while editing, the formatted value otherwise.\nconst shown = computed(() =>\n focused.value || !formatter.value || model.value === null || Number.isNaN(model.value)\n ? text.value\n : formatter.value(model.value),\n)\n\nfunction onBlur() {\n focused.value = false\n onChange()\n formItem?.trigger('blur')\n}\n\nconst showClear = computed(() => props.clearable && editable.value && model.value !== null)\n\nfunction clear() {\n commit(null)\n emit('clear')\n inputRef.value?.focus()\n}\n\nfunction stepBy(count: number) {\n if (!editable.value) return\n const parsed = parse(text.value)\n const from = parsed === null || Number.isNaN(parsed) ? (model.value ?? 0) : parsed\n const next = round(from + props.step * count, Math.max(decimals(from), decimals(props.step)))\n commit(normalize(next))\n}\n\nconst canIncrease = computed(() => editable.value && (model.value ?? -Infinity) < props.max)\nconst canDecrease = computed(() => editable.value && (model.value ?? Infinity) > props.min)\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!editable.value) return\n const steps: Record<string, number> = { ArrowUp: 1, ArrowDown: -1, PageUp: 10, PageDown: -10 }\n if (event.key in steps) {\n event.preventDefault()\n stepBy(steps[event.key]!)\n } else if (event.key === 'Home' && Number.isFinite(props.min)) {\n event.preventDefault()\n commit(props.min)\n } else if (event.key === 'End' && Number.isFinite(props.max)) {\n event.preventDefault()\n commit(props.max)\n } else if (event.key === 'Enter') {\n onChange()\n }\n}\n\n// Holding a step key repeats the step, slowly at first.\nlet timer: ReturnType<typeof setTimeout> | undefined\n// The key being held: 1 for increase, -1 for decrease, 0 for none.\nconst held = ref(0)\n\nfunction stopRepeat() {\n clearTimeout(timer)\n timer = undefined\n held.value = 0\n}\n\nfunction startRepeat(count: number) {\n stopRepeat()\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return\n held.value = count\n stepBy(count)\n const repeat = (delay: number) => {\n timer = setTimeout(() => {\n // A key that reaches the limit turns disabled, so stop there.\n if (!(count > 0 ? canIncrease.value : canDecrease.value)) return stopRepeat()\n stepBy(count)\n repeat(50)\n }, delay)\n }\n repeat(400)\n}\n\nfunction onStepPointerdown(event: PointerEvent, count: number) {\n // Touch goes through the key pad below.\n if (event.pointerType === 'touch' || event.button !== 0) return\n startRepeat(count)\n // The pointer may come up over a key that turned disabled, so listen\n // on the window.\n window.addEventListener('pointerup', stopRepeat, { once: true })\n}\n\n// On touch the keys are too small to aim at, so the first press only\n// enlarges them. Keeping the finger down and sliding onto a key steps\n// with it, and the pad shrinks back as soon as that finger lifts. After a\n// plain press the pad stays, later taps step as usual, and it shrinks back\n// after a tap elsewhere or a short pause.\nconst COLLAPSE_DELAY = 2000\n// How far a finger slides from where the pad opened before it counts.\nconst SLIDE_THRESHOLD = 6\n\nconst keysRef = useTemplateRef<HTMLElement>('keys')\nconst expanded = ref(false)\nlet idle: ReturnType<typeof setTimeout> | undefined\n\nfunction onOutsidePointerdown(event: PointerEvent) {\n if (!keysRef.value?.contains(event.target as Node)) collapse()\n}\n\nfunction expand() {\n clearTimeout(idle)\n if (expanded.value) return\n expanded.value = true\n document.addEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\nfunction collapse() {\n clearTimeout(idle)\n stopRepeat()\n expanded.value = false\n document.removeEventListener('pointerdown', onOutsidePointerdown, true)\n}\n\n/** The key under a finger at `y`: 1 above the middle, -1 below, 0 on the seam. */\nfunction keyAt(y: number) {\n const box = keysRef.value!.getBoundingClientRect()\n const middle = box.top + box.height / 2\n return Math.abs(y - middle) <= 2 ? 0 : y < middle ? 1 : -1\n}\n\nfunction onKeysPointerdown(event: PointerEvent) {\n if (event.pointerType !== 'touch' || !editable.value) return\n // Keep the keyboard closed and the page still while the finger is down.\n event.preventDefault()\n const keys = event.currentTarget as HTMLElement\n keys.setPointerCapture?.(event.pointerId)\n const opened = !expanded.value\n expand()\n const startY = event.clientY\n let slid = !opened\n let stepped = false\n const follow = (y: number) => {\n slid ||= Math.abs(y - startY) >= SLIDE_THRESHOLD\n const count = slid ? keyAt(y) : 0\n if (count === held.value) return\n stepped ||= count !== 0\n if (count) startRepeat(count)\n else stopRepeat()\n }\n follow(startY)\n const move = (e: PointerEvent) => {\n if (e.pointerId === event.pointerId) follow(e.clientY)\n }\n const end = (e: PointerEvent) => {\n if (e.pointerId !== event.pointerId) return\n stopRepeat()\n keys.removeEventListener('pointermove', move)\n keys.removeEventListener('pointerup', end)\n keys.removeEventListener('pointercancel', end)\n // A press that opened the pad and slid to adjust is done when lifted.\n if (opened && stepped) return collapse()\n clearTimeout(idle)\n idle = setTimeout(collapse, COLLAPSE_DELAY)\n }\n keys.addEventListener('pointermove', move)\n keys.addEventListener('pointerup', end)\n keys.addEventListener('pointercancel', end)\n}\n\nwatch(editable, (value) => value || collapse())\n\nonBeforeUnmount(collapse)\n\nfunction onMousedown(event: MouseEvent) {\n const target = event.target as HTMLElement\n if (target === inputRef.value || target.closest('a, input, select, textarea')) return\n event.preventDefault()\n inputRef.value?.focus()\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('controls', props.controls),\n ns.is('expanded', expanded.value),\n attrs.class,\n])\n\ndefineExpose<InputNumberExpose>({\n get input() {\n return inputRef.value\n },\n focus: () => inputRef.value?.focus(),\n blur: () => inputRef.value?.blur(),\n increase: (count = 1) => stepBy(count),\n decrease: (count = 1) => stepBy(-count),\n})\n</script>\n\n<template>\n <span :class=\"classes\" :style=\"attrs.style as StyleValue\" @mousedown=\"onMousedown\">\n <FieldAffix\n v-if=\"slots.prefix\"\n side=\"start\"\n :class=\"[ns.e('affix'), ns.e('prefix')]\"\n :disabled=\"disabled\"\n :render=\"slots.prefix\"\n />\n <input\n ref=\"input\"\n v-bind=\"inputAttrs\"\n :class=\"ns.e('native')\"\n type=\"text\"\n :inputmode=\"inputMode\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n :value=\"shown\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-valuenow=\"model ?? undefined\"\n :aria-valuetext=\"formatter && model !== null ? formatter(model) : undefined\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid || undefined\"\n @input=\"onInput\"\n @focus=\"focused = true\"\n @blur=\"onBlur\"\n @keydown=\"onKeydown\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n tabindex=\"-1\"\n :class=\"ns.e('clear')\"\n :aria-label=\"t('inputNumber.clear')\"\n @mousedown.prevent\n @click=\"clear\"\n >\n <CloseIcon />\n </button>\n <FieldAffix\n v-if=\"slots.suffix\"\n side=\"end\"\n :class=\"[ns.e('affix'), ns.e('suffix')]\"\n :disabled=\"disabled\"\n :render=\"slots.suffix\"\n />\n <span v-if=\"controls\" :class=\"ns.e('controls')\">\n <span ref=\"keys\" :class=\"ns.e('keys')\" @pointerdown=\"onKeysPointerdown\">\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('increase'), ns.is('held', held === 1)]\"\n :aria-label=\"t('inputNumber.increase')\"\n :disabled=\"!canIncrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, 1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <PlusIcon />\n </button>\n <button\n type=\"button\"\n tabindex=\"-1\"\n :class=\"[ns.e('step'), ns.e('decrease'), ns.is('held', held === -1)]\"\n :aria-label=\"t('inputNumber.decrease')\"\n :disabled=\"!canDecrease\"\n @mousedown.prevent\n @pointerdown=\"onStepPointerdown($event, -1)\"\n @pointerleave=\"$event.pointerType === 'touch' || stopRepeat()\"\n @pointercancel=\"stopRepeat\"\n >\n <MinusIcon />\n </button>\n </span>\n </span>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6OA,IAAM,iBAAiB;AAEvB,IAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnOxB,MAAM,QAAQ;EAUd,MAAM,QAAQA,SAA0B,SAAA,YAAkB;EAC1D,MAAM,OAAO;EACb,MAAM,QAAQC,SAAA;EAEd,MAAM,KAAK,aAAa,cAAc;EACtC,MAAM,EAAE,GAAG,WAAW,UAAU;EAChC,MAAM,EAAE,aAAa,YAAY;EACjC,MAAM,OAAO,kBAAkB,MAAM,IAAI;EACzC,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,WAAW,sBAAsB,MAAM,QAAQ;EACrD,MAAM,UAAU,eAAe,MAAM,WAAW,CAAC,CAAC,UAAU,QAAQ,KAAK;EACzE,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,CAAC,SAAS,KAAK;EAElE,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,eAAe;GAChC,MAAM,EAAE,OAAO,QAAQ,OAAO,QAAQ,GAAG,SAAS;GAClD,IAAI,CAAC,UAAU,OAAO;GACtB,OAAO;IACL,IAAI,SAAS;IACb,oBAAoB,SAAS,YAAY;IACzC,iBAAiB,SAAS,SAAS,SAAS,KAAA;IAC5C,GAAG;GACL;EACF,CAAC;EAKD,MAAM,YAAY,eAA4C;GAC5D,IAAI,OAAO,MAAM,cAAc,UAAU,OAAO,MAAM;GACtD,IAAI,OAAO,SAAS,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AAE,kBAAkB,QAAM,CAAA;KACrC,gBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,OAAO,gBAAW,WAAgB,WAAU;KAC1D,iBAAe;I,IAEhBC,YAAYN,MAAA,QAAA,CAAA,C,oBAEdG,mBAYS,UAAA;KAXP,MAAK;KACL,UAAS;KACR,OAAKL,eAAA;MAAGE,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA;MAAUA,MAAA,EAAA,CAAE,CAAC,EAAC,UAAA;MAAcA,MAAA,EAAA,CAAE,CAAC,GAAE,QAAS,KAAA,UAAI,EAAA;KAAA,CAAA;KAC1D,cAAYA,MAAA,CAAA,CAAC,CAAA,sBAAA;KACb,UAAQ,CAAG,YAAA;KACX,aAAS,OAAA,OAAA,OAAA,KAAAK,oBAAV,CAAA,GAAkB,CAAA,SAAA,CAAA;KACjB,eAAW,OAAA,OAAA,OAAA,MAAA,WAAE,kBAAkB,QAAM,EAAA;KACrC,gBAAY,OAAA,OAAA,OAAA,MAAA,WAAE,OAAO,gBAAW,WAAgB,WAAU;KAC1D,iBAAe;I,IAEhBC,YAAaN,MAAA,SAAA,CAAA,C"}
|
|
@@ -5,6 +5,8 @@ import '@dou-ui/theme/components/collapse.css'
|
|
|
5
5
|
import '@dou-ui/theme/components/color-panel.css'
|
|
6
6
|
import '@dou-ui/theme/components/dropdown.css'
|
|
7
7
|
import '@dou-ui/theme/components/icon.css'
|
|
8
|
+
import '@dou-ui/theme/components/input-number.css'
|
|
9
|
+
import '@dou-ui/theme/components/input.css'
|
|
8
10
|
import '@dou-ui/theme/components/kbd.css'
|
|
9
11
|
import '@dou-ui/theme/components/menu.css'
|
|
10
12
|
import '@dou-ui/theme/components/tooltip.css'
|
|
@@ -4,5 +4,7 @@ import '@dou-ui/theme/components/button.css'
|
|
|
4
4
|
import '@dou-ui/theme/components/color-panel.css'
|
|
5
5
|
import '@dou-ui/theme/components/dropdown.css'
|
|
6
6
|
import '@dou-ui/theme/components/icon.css'
|
|
7
|
+
import '@dou-ui/theme/components/input-number.css'
|
|
8
|
+
import '@dou-ui/theme/components/input.css'
|
|
7
9
|
import '@dou-ui/theme/components/menubar.css'
|
|
8
10
|
import '@dou-ui/theme/components/field-group.css'
|