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