da73f6a5053482374445326806cbc66622088a00f393da9f0bac543a2881b47f228c849cc192ab531cd8db971001f50749f8c8f721bc22b3ea738320432cc4 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var index = require('../../../../hooks/use-namespace/index.js');
  5. function useInputTagDom({
  6. props,
  7. isFocused,
  8. hovering,
  9. disabled,
  10. inputValue,
  11. size,
  12. validateState,
  13. validateIcon,
  14. needStatusIcon
  15. }) {
  16. const attrs = vue.useAttrs();
  17. const slots = vue.useSlots();
  18. const ns = index.useNamespace("input-tag");
  19. const nsInput = index.useNamespace("input");
  20. const containerKls = vue.computed(() => [
  21. ns.b(),
  22. ns.is("focused", isFocused.value),
  23. ns.is("hovering", hovering.value),
  24. ns.is("disabled", disabled.value),
  25. ns.m(size.value),
  26. ns.e("wrapper"),
  27. attrs.class
  28. ]);
  29. const containerStyle = vue.computed(() => [attrs.style]);
  30. const innerKls = vue.computed(() => {
  31. var _a, _b;
  32. return [
  33. ns.e("inner"),
  34. ns.is("draggable", props.draggable),
  35. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  36. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  37. ];
  38. });
  39. const showClear = vue.computed(() => {
  40. var _a;
  41. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  42. });
  43. const showSuffix = vue.computed(() => {
  44. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  45. });
  46. return {
  47. ns,
  48. nsInput,
  49. containerKls,
  50. containerStyle,
  51. innerKls,
  52. showClear,
  53. showSuffix
  54. };
  55. }
  56. exports.useInputTagDom = useInputTagDom;
  57. //# sourceMappingURL=use-input-tag-dom.js.map