vue-devui 1.0.0-rc.7 → 1.0.0-rc.8

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.
Files changed (125) hide show
  1. package/README.md +3 -0
  2. package/alert/index.es.js +37 -11
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +62 -26
  6. package/auto-complete/index.umd.js +5 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +32 -6
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +27 -3
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5548 -77
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +34 -13
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +47 -29
  21. package/checkbox/index.umd.js +1 -1
  22. package/checkbox/style.css +1 -1
  23. package/date-picker/index.es.js +90 -138
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +28 -3
  27. package/drawer/index.umd.js +1 -1
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +36 -12
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/form/index.es.js +208 -73
  33. package/form/index.umd.js +12 -12
  34. package/form/style.css +1 -1
  35. package/fullscreen/index.es.js +28 -4
  36. package/fullscreen/index.umd.js +1 -1
  37. package/fullscreen/style.css +1 -1
  38. package/grid/index.es.js +68 -49
  39. package/grid/index.umd.js +1 -1
  40. package/grid/style.css +1 -1
  41. package/image-preview/index.es.js +34 -11
  42. package/image-preview/index.umd.js +1 -1
  43. package/image-preview/style.css +1 -1
  44. package/input/index.es.js +90 -138
  45. package/input/index.umd.js +1 -1
  46. package/input/style.css +1 -1
  47. package/layout/index.es.js +34 -6
  48. package/layout/index.umd.js +1 -1
  49. package/layout/style.css +1 -1
  50. package/loading/index.es.js +34 -10
  51. package/loading/index.umd.js +1 -1
  52. package/loading/style.css +1 -1
  53. package/modal/index.es.js +41 -15
  54. package/modal/index.umd.js +1 -1
  55. package/modal/style.css +1 -1
  56. package/notification/index.es.js +40 -13
  57. package/notification/index.umd.js +1 -1
  58. package/notification/style.css +1 -1
  59. package/nuxt/components/ButtonGroup.js +3 -0
  60. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  61. package/nuxt/components/buttonGroupProps.js +3 -0
  62. package/overlay/index.es.js +31 -9
  63. package/overlay/index.umd.js +1 -1
  64. package/overlay/style.css +1 -1
  65. package/package.json +1 -1
  66. package/pagination/index.es.js +59 -32
  67. package/pagination/index.umd.js +1 -1
  68. package/pagination/style.css +1 -1
  69. package/popover/index.es.js +53 -24
  70. package/popover/index.umd.js +13 -13
  71. package/popover/style.css +1 -1
  72. package/progress/index.es.js +31 -9
  73. package/progress/index.umd.js +3 -3
  74. package/progress/style.css +1 -1
  75. package/radio/index.es.js +32 -7
  76. package/radio/index.umd.js +1 -1
  77. package/radio/style.css +1 -1
  78. package/rate/index.es.js +32 -8
  79. package/rate/index.umd.js +1 -1
  80. package/rate/style.css +1 -1
  81. package/search/index.es.js +100 -146
  82. package/search/index.umd.js +13 -13
  83. package/search/style.css +1 -1
  84. package/select/index.es.js +74 -51
  85. package/select/index.umd.js +1 -1
  86. package/select/style.css +1 -1
  87. package/skeleton/index.es.js +37 -12
  88. package/skeleton/index.umd.js +1 -1
  89. package/skeleton/style.css +1 -1
  90. package/slider/index.es.js +34 -10
  91. package/slider/index.umd.js +1 -1
  92. package/slider/style.css +1 -1
  93. package/splitter/index.es.js +52 -24
  94. package/splitter/index.umd.js +15 -15
  95. package/splitter/style.css +1 -1
  96. package/status/index.es.js +26 -2
  97. package/status/index.umd.js +1 -1
  98. package/status/style.css +1 -1
  99. package/style.css +1 -1
  100. package/switch/index.es.js +30 -6
  101. package/switch/index.umd.js +1 -1
  102. package/switch/style.css +1 -1
  103. package/table/index.es.js +5710 -265
  104. package/table/index.umd.js +27 -1
  105. package/table/style.css +1 -1
  106. package/tabs/index.es.js +32 -8
  107. package/tabs/index.umd.js +1 -1
  108. package/tabs/style.css +1 -1
  109. package/tag/index.es.js +27 -2
  110. package/tag/index.umd.js +1 -1
  111. package/tag/style.css +1 -1
  112. package/textarea/index.es.js +93 -76
  113. package/textarea/index.umd.js +1 -1
  114. package/textarea/style.css +1 -1
  115. package/tooltip/index.es.js +41 -14
  116. package/tooltip/index.umd.js +12 -12
  117. package/tooltip/style.css +1 -1
  118. package/tree/index.es.js +60 -51
  119. package/tree/index.umd.js +1 -1
  120. package/tree/style.css +1 -1
  121. package/upload/index.es.js +53 -22
  122. package/upload/index.umd.js +1 -1
  123. package/upload/style.css +1 -1
  124. package/vue-devui.es.js +3703 -3560
  125. package/vue-devui.umd.js +20 -20
@@ -1,4 +1,4 @@
1
- import { computed, ref, watch, defineComponent, inject, createVNode, withDirectives, mergeProps, resolveDirective, resolveComponent } from "vue";
1
+ import { computed, ref, watch, inject, toRefs, defineComponent, createVNode, mergeProps, resolveComponent } from "vue";
2
2
  const searchProps = {
3
3
  size: {
4
4
  type: String,
@@ -49,6 +49,29 @@ const searchProps = {
49
49
  default: void 0
50
50
  }
51
51
  };
52
+ function createBem(namespace, element, modifier) {
53
+ let cls = namespace;
54
+ if (element) {
55
+ cls += `__${element}`;
56
+ }
57
+ if (modifier) {
58
+ cls += `--${modifier}`;
59
+ }
60
+ return cls;
61
+ }
62
+ function useNamespace(block) {
63
+ const namespace = `devui-${block}`;
64
+ const b = () => createBem(namespace);
65
+ const e = (element) => element ? createBem(namespace, element) : "";
66
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
67
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
68
+ return {
69
+ b,
70
+ e,
71
+ m,
72
+ em
73
+ };
74
+ }
52
75
  const SIZE_CLASS = {
53
76
  lg: "lg",
54
77
  md: "md",
@@ -58,13 +81,14 @@ const ICON_POSITION = {
58
81
  right: "right",
59
82
  left: "left"
60
83
  };
84
+ const ns = useNamespace("search");
61
85
  const getRootClass = (props) => {
62
86
  return computed(() => ({
63
- "devui-search": true,
64
- "devui-search__disbaled": props.disabled,
65
- "devui-search__no-border": props.noBorder,
66
- [`devui-search__${props.size}`]: SIZE_CLASS[props.size],
67
- [`devui-search__${props.iconPosition}`]: ICON_POSITION[props.iconPosition]
87
+ [ns.b()]: true,
88
+ [ns.m("disabled")]: props.disabled,
89
+ [ns.m("no-border")]: props.noBorder,
90
+ [ns.m(props.size)]: SIZE_CLASS[props.size],
91
+ [ns.m(props.iconPosition)]: ICON_POSITION[props.iconPosition]
68
92
  }));
69
93
  };
70
94
  const keywordsHandles = (ctx, props) => {
@@ -5524,173 +5548,102 @@ const keydownHandles = (ctx, keywords, props) => {
5524
5548
  };
5525
5549
  };
5526
5550
  const inputProps = {
5527
- placeholder: {
5551
+ modelValue: {
5528
5552
  type: String,
5529
- default: void 0
5553
+ default: ""
5530
5554
  },
5531
5555
  disabled: {
5532
5556
  type: Boolean,
5533
5557
  default: false
5534
5558
  },
5535
- autoFocus: {
5536
- type: Boolean,
5537
- default: false
5538
- },
5539
- maxLength: {
5540
- type: Number,
5541
- default: Number.MAX_SAFE_INTEGER
5542
- },
5543
- cssClass: {
5544
- type: String,
5545
- default: ""
5546
- },
5547
5559
  error: {
5548
5560
  type: Boolean,
5549
5561
  default: false
5550
5562
  },
5551
5563
  size: {
5552
5564
  type: String,
5553
- default: ""
5554
- },
5555
- showPassword: {
5556
- type: Boolean,
5557
- default: false
5558
- },
5559
- modelValue: {
5560
- type: String,
5561
- default: ""
5562
- },
5563
- "update:modelValue": {
5564
- type: Function,
5565
- default: void 0
5566
- },
5567
- onChange: {
5568
- type: Function,
5569
- default: void 0
5570
- },
5571
- onKeydown: {
5572
- type: Function,
5573
- default: void 0
5574
- },
5575
- onFocus: {
5576
- type: Function,
5577
- default: void 0
5578
- },
5579
- onBlur: {
5580
- type: Function,
5581
- default: void 0
5565
+ default: "md"
5582
5566
  }
5583
5567
  };
5584
5568
  const FORM_ITEM_TOKEN = Symbol("dFormItem");
5569
+ function useInputRender(props) {
5570
+ const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
5571
+ const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
5572
+ const ns2 = useNamespace("input");
5573
+ const isFocus = ref(false);
5574
+ const { error, size, disabled } = toRefs(props);
5575
+ const wrapClasses = computed(() => ({
5576
+ [ns2.b()]: true,
5577
+ [ns2.m("focus")]: isFocus.value,
5578
+ [ns2.m("disabled")]: disabled.value,
5579
+ [ns2.m("error")]: error.value || isValidateError.value,
5580
+ [ns2.m("feedback")]: formItemContext == null ? void 0 : formItemContext.showFeedback,
5581
+ [ns2.m(size.value)]: true
5582
+ }));
5583
+ return { isFocus, wrapClasses };
5584
+ }
5585
+ function useInputEvent(isFocus, ctx) {
5586
+ const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
5587
+ const onFocus = (e) => {
5588
+ isFocus.value = true;
5589
+ ctx.emit("focus", e);
5590
+ };
5591
+ const onBlur = (e) => {
5592
+ isFocus.value = false;
5593
+ ctx.emit("blur", e);
5594
+ formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
5595
+ };
5596
+ const onInput = (e) => {
5597
+ ctx.emit("update:modelValue", e.target.value);
5598
+ };
5599
+ const onChange = (e) => {
5600
+ ctx.emit("change", e.target.value);
5601
+ };
5602
+ const onKeydown = (e) => {
5603
+ ctx.emit("keydown", e);
5604
+ };
5605
+ return { onFocus, onBlur, onInput, onChange, onKeydown };
5606
+ }
5585
5607
  var input = "";
5586
5608
  var DInput = defineComponent({
5587
5609
  name: "DInput",
5588
- directives: {
5589
- focus: {
5590
- mounted: function(el, binding) {
5591
- if (binding.value) {
5592
- el.focus();
5593
- }
5594
- }
5595
- }
5596
- },
5610
+ inheritAttrs: false,
5597
5611
  props: inputProps,
5598
- emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
5612
+ emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown"],
5599
5613
  setup(props, ctx) {
5600
- const formItemContext = inject(FORM_ITEM_TOKEN);
5601
- const sizeCls = computed(() => `devui-input-${props.size}`);
5602
- const showPwdIcon = ref(false);
5603
- const inputType = ref("text");
5604
- const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
5605
- const inputCls = computed(() => ({
5606
- "devui-error": props.error || isValidateError.value,
5607
- [props.cssClass]: true,
5608
- "devui-input-restore": showPwdIcon.value,
5609
- [sizeCls.value]: props.size !== ""
5610
- }));
5611
- const showPreviewIcon = computed(() => inputType.value === "password");
5612
- watch(() => props.showPassword, (flg) => {
5613
- inputType.value = flg ? "password" : "text";
5614
- showPwdIcon.value = props.showPassword;
5615
- }, {
5616
- immediate: true
5617
- });
5618
- watch(() => props.modelValue, () => {
5619
- formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
5620
- });
5621
- const onInput = ($event) => {
5622
- ctx.emit("update:modelValue", $event.target.value);
5623
- }, onFocus = () => {
5624
- ctx.emit("focus");
5625
- }, onBlur = () => {
5626
- ctx.emit("blur");
5627
- formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
5628
- }, onChange = ($event) => {
5629
- ctx.emit("change", $event.target.value);
5630
- }, onKeydown = ($event) => {
5631
- ctx.emit("keydown", $event);
5632
- }, onChangeInputType = () => {
5633
- inputType.value = inputType.value === "password" ? "text" : "password";
5634
- };
5635
- return {
5636
- inputCls,
5637
- inputType,
5638
- showPreviewIcon,
5639
- showPwdIcon,
5640
- onInput,
5641
- onFocus,
5642
- onBlur,
5643
- onChange,
5644
- onKeydown,
5645
- onChangeInputType
5646
- };
5647
- },
5648
- render() {
5614
+ const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
5649
5615
  const {
5650
5616
  modelValue,
5651
- showPreviewIcon,
5652
- showPwdIcon,
5653
- inputCls,
5654
- inputType,
5655
- maxLength,
5656
- autoFocus,
5657
- placeholder,
5658
- disabled,
5659
- onInput,
5617
+ disabled
5618
+ } = toRefs(props);
5619
+ const ns2 = useNamespace("input");
5620
+ const {
5621
+ isFocus,
5622
+ wrapClasses
5623
+ } = useInputRender(props);
5624
+ const {
5660
5625
  onFocus,
5661
5626
  onBlur,
5627
+ onInput,
5662
5628
  onChange,
5663
- onKeydown,
5664
- onChangeInputType
5665
- } = this;
5666
- return createVNode("div", {
5667
- "class": "devui-input__wrap"
5668
- }, [withDirectives(createVNode("input", mergeProps({
5669
- dinput: true
5670
- }, {
5671
- "value": modelValue,
5672
- "disabled": disabled,
5673
- "type": inputType,
5674
- "maxlength": maxLength,
5675
- "placeholder": placeholder,
5676
- "class": inputCls,
5629
+ onKeydown
5630
+ } = useInputEvent(isFocus, ctx);
5631
+ watch(() => props.modelValue, () => {
5632
+ formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
5633
+ });
5634
+ return () => createVNode("div", {
5635
+ "class": wrapClasses.value
5636
+ }, [createVNode("input", mergeProps({
5637
+ "value": modelValue.value,
5638
+ "disabled": disabled.value,
5639
+ "class": ns2.e("inner")
5640
+ }, ctx.attrs, {
5677
5641
  "onInput": onInput,
5678
5642
  "onFocus": onFocus,
5679
5643
  "onBlur": onBlur,
5680
5644
  "onChange": onChange,
5681
5645
  "onKeydown": onKeydown
5682
- }), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
5683
- "class": "devui-input__preview",
5684
- "onClick": onChangeInputType
5685
- }, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
5686
- "name": "preview-forbidden",
5687
- "size": "12px",
5688
- "key": 1
5689
- }, null) : createVNode(resolveComponent("d-icon"), {
5690
- "name": "preview",
5691
- "size": "12px",
5692
- "key": 2
5693
- }, null)])]);
5646
+ }), null)]);
5694
5647
  }
5695
5648
  });
5696
5649
  var search = "";
@@ -5699,6 +5652,7 @@ var Search = defineComponent({
5699
5652
  props: searchProps,
5700
5653
  emits: ["update:modelValue", "search"],
5701
5654
  setup(props, ctx) {
5655
+ const ns2 = useNamespace("search");
5702
5656
  const rootClasses = getRootClass(props);
5703
5657
  const {
5704
5658
  keywords,
@@ -5732,21 +5686,21 @@ var Search = defineComponent({
5732
5686
  return createVNode("div", {
5733
5687
  "class": rootClasses.value
5734
5688
  }, [props.iconPosition === "left" && createVNode("div", {
5735
- "class": "devui-search__icon",
5689
+ "class": ns2.e("icon"),
5736
5690
  "onClick": onClickHandle
5737
5691
  }, [createVNode(resolveComponent("d-icon"), {
5738
5692
  "name": "search",
5739
5693
  "size": "inherit",
5740
5694
  "key": "search"
5741
5695
  }, null)]), createVNode(DInput, inputProps2, null), clearIconShow.value && createVNode("div", {
5742
- "class": "devui-search__clear",
5696
+ "class": ns2.e("clear"),
5743
5697
  "onClick": onClearHandle
5744
5698
  }, [createVNode(resolveComponent("d-icon"), {
5745
5699
  "name": "close",
5746
5700
  "size": "inherit",
5747
5701
  "key": "close"
5748
5702
  }, null)]), props.iconPosition === "right" && createVNode("div", {
5749
- "class": "devui-search__icon",
5703
+ "class": ns2.e("icon"),
5750
5704
  "onClick": onClickHandle
5751
5705
  }, [createVNode(resolveComponent("d-icon"), {
5752
5706
  "name": "search",