vue-devui 1.0.0-rc.1 → 1.0.0-rc.4

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 (293) hide show
  1. package/README.md +132 -200
  2. package/auto-complete/index.es.js +150 -110
  3. package/auto-complete/index.umd.js +5 -1
  4. package/auto-complete/style.css +1 -1
  5. package/avatar/index.es.js +77 -81
  6. package/avatar/index.umd.js +1 -1
  7. package/button/index.es.js +23 -15
  8. package/button/index.umd.js +1 -1
  9. package/button/style.css +1 -1
  10. package/card/index.es.js +3 -6
  11. package/card/index.umd.js +1 -1
  12. package/checkbox/index.es.js +5 -11
  13. package/checkbox/index.umd.js +1 -1
  14. package/comment/index.es.js +4 -6
  15. package/comment/index.umd.js +1 -1
  16. package/countdown/index.es.js +3 -6
  17. package/countdown/index.umd.js +1 -1
  18. package/editable-select/index.es.js +120 -167
  19. package/editable-select/index.umd.js +1 -1
  20. package/grid/index.es.js +30 -36
  21. package/grid/index.umd.js +1 -1
  22. package/image-preview/index.es.js +19 -19
  23. package/image-preview/index.umd.js +1 -1
  24. package/input/index.es.js +2 -5
  25. package/input/index.umd.js +1 -1
  26. package/layout/index.es.js +9 -22
  27. package/layout/index.umd.js +1 -1
  28. package/loading/index.es.js +40 -25
  29. package/loading/index.umd.js +1 -1
  30. package/modal/index.es.js +55 -47
  31. package/modal/index.umd.js +1 -1
  32. package/notification/index.es.js +100 -10
  33. package/notification/index.umd.js +1 -1
  34. package/notification/style.css +1 -1
  35. package/nuxt/components/DropdownPropsKey.js +3 -0
  36. package/nuxt/components/LoadingOptions.js +3 -0
  37. package/nuxt/components/autoCompleteProps.js +3 -0
  38. package/nuxt/components/avatarProps.js +3 -0
  39. package/nuxt/components/cardProps.js +3 -0
  40. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  41. package/nuxt/components/checkboxGroupProps.js +3 -0
  42. package/nuxt/components/checkboxProps.js +3 -0
  43. package/nuxt/components/colProps.js +3 -0
  44. package/nuxt/components/colPropsBaseClass.js +3 -0
  45. package/nuxt/components/colPropsBaseStyle.js +3 -0
  46. package/nuxt/components/commentProps.js +3 -0
  47. package/nuxt/components/countdownProps.js +3 -0
  48. package/nuxt/components/editableSelectProps.js +3 -0
  49. package/nuxt/components/imagePreviewProps.js +3 -0
  50. package/nuxt/components/inputProps.js +3 -0
  51. package/nuxt/components/loadingProps.js +3 -0
  52. package/nuxt/components/modalProps.js +3 -0
  53. package/nuxt/components/progressProps.js +3 -0
  54. package/nuxt/components/rateProps.js +3 -0
  55. package/nuxt/components/readTipProps.js +3 -0
  56. package/nuxt/components/resultProps.js +3 -0
  57. package/nuxt/components/rowProps.js +3 -0
  58. package/nuxt/components/screenSizes.js +3 -0
  59. package/nuxt/components/skeletonProps.js +3 -0
  60. package/nuxt/components/sliderProps.js +3 -0
  61. package/nuxt/components/splitterProps.js +3 -0
  62. package/nuxt/components/statisticProps.js +3 -0
  63. package/nuxt/components/switchProps.js +3 -0
  64. package/nuxt/components/tagInputProps.js +3 -0
  65. package/nuxt/components/tagProps.js +3 -0
  66. package/nuxt/components/textareaProps.js +3 -0
  67. package/nuxt/components/timeAxisProps.js +3 -0
  68. package/overlay/index.es.js +5 -5
  69. package/overlay/index.umd.js +1 -1
  70. package/package.json +1 -1
  71. package/pagination/index.es.js +14 -13
  72. package/pagination/index.umd.js +1 -1
  73. package/popover/index.es.js +7 -7
  74. package/popover/index.umd.js +12 -12
  75. package/progress/index.es.js +34 -36
  76. package/progress/index.umd.js +3 -3
  77. package/progress/style.css +1 -1
  78. package/radio/index.es.js +8 -2
  79. package/radio/index.umd.js +1 -1
  80. package/radio/style.css +1 -1
  81. package/rate/index.es.js +4 -7
  82. package/rate/index.umd.js +1 -1
  83. package/read-tip/index.es.js +34 -34
  84. package/read-tip/index.umd.js +1 -1
  85. package/read-tip/style.css +1 -1
  86. package/result/index.es.js +2 -5
  87. package/result/index.umd.js +1 -1
  88. package/ripple/index.es.js +43 -42
  89. package/ripple/index.umd.js +1 -1
  90. package/search/index.es.js +11 -11
  91. package/search/index.umd.js +8 -8
  92. package/skeleton/index.es.js +9 -12
  93. package/skeleton/index.umd.js +1 -1
  94. package/slider/index.es.js +59 -62
  95. package/slider/index.umd.js +1 -1
  96. package/splitter/index.es.js +176 -136
  97. package/splitter/index.umd.js +13 -13
  98. package/statistic/index.es.js +7 -18
  99. package/statistic/index.umd.js +1 -1
  100. package/style.css +1 -1
  101. package/switch/index.es.js +4 -7
  102. package/switch/index.umd.js +1 -1
  103. package/switch/style.css +1 -1
  104. package/tag/index.es.js +13 -17
  105. package/tag/index.umd.js +1 -1
  106. package/tag/style.css +1 -1
  107. package/tag-input/index.es.js +3 -6
  108. package/tag-input/index.umd.js +1 -1
  109. package/textarea/index.es.js +2 -5
  110. package/textarea/index.umd.js +1 -1
  111. package/timeline/index.es.js +10 -16
  112. package/timeline/index.umd.js +1 -1
  113. package/upload/index.es.js +160 -67
  114. package/upload/index.umd.js +1 -1
  115. package/upload/style.css +1 -1
  116. package/vue-devui.es.js +12182 -24718
  117. package/vue-devui.umd.js +24 -20
  118. package/accordion/index.d.ts +0 -7
  119. package/accordion/index.es.js +0 -723
  120. package/accordion/index.umd.js +0 -1
  121. package/accordion/package.json +0 -7
  122. package/accordion/style.css +0 -1
  123. package/anchor/index.d.ts +0 -7
  124. package/anchor/index.es.js +0 -263
  125. package/anchor/index.umd.js +0 -1
  126. package/anchor/package.json +0 -7
  127. package/anchor/style.css +0 -1
  128. package/back-top/index.d.ts +0 -7
  129. package/back-top/index.es.js +0 -130
  130. package/back-top/index.umd.js +0 -1
  131. package/back-top/package.json +0 -7
  132. package/back-top/style.css +0 -1
  133. package/breadcrumb/index.d.ts +0 -7
  134. package/breadcrumb/index.es.js +0 -128
  135. package/breadcrumb/index.umd.js +0 -1
  136. package/breadcrumb/package.json +0 -7
  137. package/breadcrumb/style.css +0 -1
  138. package/carousel/index.d.ts +0 -7
  139. package/carousel/index.es.js +0 -314
  140. package/carousel/index.umd.js +0 -1
  141. package/carousel/package.json +0 -7
  142. package/carousel/style.css +0 -1
  143. package/cascader/index.d.ts +0 -7
  144. package/cascader/index.es.js +0 -5971
  145. package/cascader/index.umd.js +0 -27
  146. package/cascader/package.json +0 -7
  147. package/cascader/style.css +0 -1
  148. package/color-picker/index.d.ts +0 -7
  149. package/color-picker/index.es.js +0 -8196
  150. package/color-picker/index.umd.js +0 -27
  151. package/color-picker/package.json +0 -7
  152. package/color-picker/style.css +0 -1
  153. package/date-picker/index.d.ts +0 -7
  154. package/date-picker/index.es.js +0 -1154
  155. package/date-picker/index.umd.js +0 -1
  156. package/date-picker/package.json +0 -7
  157. package/date-picker/style.css +0 -1
  158. package/dragdrop/index.d.ts +0 -7
  159. package/dragdrop/index.es.js +0 -157
  160. package/dragdrop/index.umd.js +0 -1
  161. package/dragdrop/package.json +0 -7
  162. package/drawer/index.d.ts +0 -7
  163. package/drawer/index.es.js +0 -234
  164. package/drawer/index.umd.js +0 -1
  165. package/drawer/package.json +0 -7
  166. package/drawer/style.css +0 -1
  167. package/dropdown/index.d.ts +0 -7
  168. package/dropdown/index.es.js +0 -693
  169. package/dropdown/index.umd.js +0 -1
  170. package/dropdown/package.json +0 -7
  171. package/dropdown/style.css +0 -1
  172. package/form/index.d.ts +0 -7
  173. package/form/index.es.js +0 -7876
  174. package/form/index.umd.js +0 -27
  175. package/form/package.json +0 -7
  176. package/form/style.css +0 -1
  177. package/gantt/index.d.ts +0 -7
  178. package/gantt/index.es.js +0 -523
  179. package/gantt/index.umd.js +0 -1
  180. package/gantt/package.json +0 -7
  181. package/gantt/style.css +0 -1
  182. package/input-icon/index.d.ts +0 -7
  183. package/input-icon/index.es.js +0 -332
  184. package/input-icon/index.umd.js +0 -1
  185. package/input-icon/package.json +0 -7
  186. package/input-icon/style.css +0 -1
  187. package/input-number/index.d.ts +0 -7
  188. package/input-number/index.es.js +0 -229
  189. package/input-number/index.umd.js +0 -1
  190. package/input-number/package.json +0 -7
  191. package/input-number/style.css +0 -1
  192. package/list/index.d.ts +0 -7
  193. package/list/index.es.js +0 -39
  194. package/list/index.umd.js +0 -1
  195. package/list/package.json +0 -7
  196. package/list/style.css +0 -1
  197. package/nav-sprite/index.d.ts +0 -7
  198. package/nav-sprite/index.es.js +0 -68
  199. package/nav-sprite/index.umd.js +0 -1
  200. package/nav-sprite/package.json +0 -7
  201. package/nuxt/components/Accordion.js +0 -3
  202. package/nuxt/components/Anchor.js +0 -3
  203. package/nuxt/components/BackTop.js +0 -3
  204. package/nuxt/components/Breadcrumb.js +0 -3
  205. package/nuxt/components/Carousel.js +0 -3
  206. package/nuxt/components/CarouselItem.js +0 -3
  207. package/nuxt/components/Cascader.js +0 -3
  208. package/nuxt/components/ColorPicker.js +0 -3
  209. package/nuxt/components/Column.js +0 -3
  210. package/nuxt/components/DatePicker.js +0 -3
  211. package/nuxt/components/Drawer.js +0 -3
  212. package/nuxt/components/DrawerService.js +0 -3
  213. package/nuxt/components/Dropdown.js +0 -3
  214. package/nuxt/components/DropdownMenu.js +0 -3
  215. package/nuxt/components/Form.js +0 -3
  216. package/nuxt/components/FormControl.js +0 -3
  217. package/nuxt/components/FormItem.js +0 -3
  218. package/nuxt/components/FormLabel.js +0 -3
  219. package/nuxt/components/FormOperation.js +0 -3
  220. package/nuxt/components/Gantt.js +0 -3
  221. package/nuxt/components/InputIcon.js +0 -3
  222. package/nuxt/components/InputNumber.js +0 -3
  223. package/nuxt/components/List.js +0 -3
  224. package/nuxt/components/ListItem.js +0 -3
  225. package/nuxt/components/NavSprite.js +0 -2
  226. package/nuxt/components/QuadrantDiagram.js +0 -3
  227. package/nuxt/components/Select.js +0 -3
  228. package/nuxt/components/StepsGuide.js +0 -3
  229. package/nuxt/components/StickSlider.js +0 -3
  230. package/nuxt/components/Sticky.js +0 -2
  231. package/nuxt/components/Table.js +0 -3
  232. package/nuxt/components/Tabs.js +0 -3
  233. package/nuxt/components/TimePicker.js +0 -3
  234. package/nuxt/components/Tooltip.js +0 -3
  235. package/nuxt/components/Transfer.js +0 -3
  236. package/nuxt/components/Tree.js +0 -3
  237. package/nuxt/components/TreeSelect.js +0 -3
  238. package/nuxt/components/dropdownMenuProps.js +0 -3
  239. package/nuxt/components/tooltipProps.js +0 -3
  240. package/quadrant-diagram/index.d.ts +0 -7
  241. package/quadrant-diagram/index.es.js +0 -5728
  242. package/quadrant-diagram/index.umd.js +0 -27
  243. package/quadrant-diagram/package.json +0 -7
  244. package/quadrant-diagram/style.css +0 -1
  245. package/select/index.d.ts +0 -7
  246. package/select/index.es.js +0 -706
  247. package/select/index.umd.js +0 -1
  248. package/select/package.json +0 -7
  249. package/select/style.css +0 -1
  250. package/steps-guide/index.d.ts +0 -7
  251. package/steps-guide/index.es.js +0 -242
  252. package/steps-guide/index.umd.js +0 -1
  253. package/steps-guide/package.json +0 -7
  254. package/steps-guide/style.css +0 -1
  255. package/sticky/index.d.ts +0 -7
  256. package/sticky/index.es.js +0 -197
  257. package/sticky/index.umd.js +0 -1
  258. package/sticky/package.json +0 -7
  259. package/table/index.d.ts +0 -7
  260. package/table/index.es.js +0 -2024
  261. package/table/index.umd.js +0 -1
  262. package/table/package.json +0 -7
  263. package/table/style.css +0 -1
  264. package/tabs/index.d.ts +0 -7
  265. package/tabs/index.es.js +0 -194
  266. package/tabs/index.umd.js +0 -1
  267. package/tabs/package.json +0 -7
  268. package/tabs/style.css +0 -1
  269. package/time-picker/index.d.ts +0 -7
  270. package/time-picker/index.es.js +0 -1238
  271. package/time-picker/index.umd.js +0 -1
  272. package/time-picker/package.json +0 -7
  273. package/time-picker/style.css +0 -1
  274. package/tooltip/index.d.ts +0 -7
  275. package/tooltip/index.es.js +0 -5835
  276. package/tooltip/index.umd.js +0 -27
  277. package/tooltip/package.json +0 -7
  278. package/tooltip/style.css +0 -1
  279. package/transfer/index.d.ts +0 -7
  280. package/transfer/index.es.js +0 -7615
  281. package/transfer/index.umd.js +0 -27
  282. package/transfer/package.json +0 -7
  283. package/transfer/style.css +0 -1
  284. package/tree/index.d.ts +0 -7
  285. package/tree/index.es.js +0 -6495
  286. package/tree/index.umd.js +0 -27
  287. package/tree/package.json +0 -7
  288. package/tree/style.css +0 -1
  289. package/tree-select/index.d.ts +0 -7
  290. package/tree-select/index.es.js +0 -627
  291. package/tree-select/index.umd.js +0 -1
  292. package/tree-select/package.json +0 -7
  293. package/tree-select/style.css +0 -1
@@ -44,6 +44,63 @@ var Slider = defineComponent({
44
44
  const currentPosition = ref(0);
45
45
  const newPostion = ref(0);
46
46
  const percentDispaly = ref("");
47
+ function handleOnInput(event) {
48
+ inputValue.value = parseInt(event.target.value);
49
+ if (!inputValue.value) {
50
+ inputValue.value = props.min;
51
+ percentDispaly.value = "0%";
52
+ } else {
53
+ if (inputValue.value < props.min || inputValue.value > props.max) {
54
+ return;
55
+ }
56
+ const re = /^(?:[1-9]?\d|100)$/;
57
+ if (re.test(`${inputValue.value}`)) {
58
+ percentDispaly.value = (inputValue.value - props.min) * 100 / (props.max - props.min) + "%";
59
+ ctx.emit("update:modelValue", inputValue.value);
60
+ }
61
+ }
62
+ }
63
+ function setPostion(newPosition) {
64
+ const sliderWidth = Math.round(sliderRunway.value.clientWidth);
65
+ if (newPosition < 0) {
66
+ newPosition = 0;
67
+ }
68
+ const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
69
+ const steps = Math.round(newPosition / LengthPerStep);
70
+ const value = steps * LengthPerStep;
71
+ if (Math.round(value) >= sliderWidth) {
72
+ currentPosition.value = sliderWidth;
73
+ inputValue.value = props.max;
74
+ percentDispaly.value = "100%";
75
+ ctx.emit("update:modelValue", props.max);
76
+ return;
77
+ }
78
+ percentDispaly.value = Math.round(value * 100 / sliderWidth) + "%";
79
+ inputValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
80
+ currentPosition.value = newPosition;
81
+ ctx.emit("update:modelValue", inputValue.value);
82
+ }
83
+ function dragStart(event) {
84
+ isClick = false;
85
+ startX = event.clientX;
86
+ startPosition = currentPosition.value;
87
+ newPostion.value = startPosition;
88
+ }
89
+ function onDragging(event) {
90
+ popoverShow.value = true;
91
+ const currentX = event.clientX;
92
+ const pxOffset = currentX - startX;
93
+ newPostion.value = startPosition + pxOffset;
94
+ setPostion(newPostion.value);
95
+ }
96
+ function onDragEnd() {
97
+ popoverShow.value = false;
98
+ setTimeout(() => {
99
+ isClick = true;
100
+ }, 100);
101
+ window.removeEventListener("mousemove", onDragging);
102
+ window.removeEventListener("mouseup", onDragEnd);
103
+ }
47
104
  const renderShowInput = () => {
48
105
  return props.showInput ? createVNode("div", {
49
106
  "class": "devui-input__out-wrap"
@@ -73,47 +130,6 @@ var Slider = defineComponent({
73
130
  window.addEventListener("mousemove", onDragging);
74
131
  window.addEventListener("mouseup", onDragEnd);
75
132
  }
76
- function dragStart(event) {
77
- isClick = false;
78
- startX = event.clientX;
79
- startPosition = currentPosition.value;
80
- newPostion.value = startPosition;
81
- }
82
- function onDragging(event) {
83
- popoverShow.value = true;
84
- const currentX = event.clientX;
85
- const pxOffset = currentX - startX;
86
- newPostion.value = startPosition + pxOffset;
87
- setPostion(newPostion.value);
88
- }
89
- function onDragEnd() {
90
- popoverShow.value = false;
91
- setTimeout(() => {
92
- isClick = true;
93
- }, 100);
94
- window.removeEventListener("mousemove", onDragging);
95
- window.removeEventListener("mouseup", onDragEnd);
96
- }
97
- function setPostion(newPosition) {
98
- const sliderWidth = Math.round(sliderRunway.value.clientWidth);
99
- if (newPosition < 0) {
100
- newPosition = 0;
101
- }
102
- const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
103
- const steps = Math.round(newPosition / LengthPerStep);
104
- const value = steps * LengthPerStep;
105
- if (Math.round(value) >= sliderWidth) {
106
- currentPosition.value = sliderWidth;
107
- inputValue.value = props.max;
108
- percentDispaly.value = "100%";
109
- ctx.emit("update:modelValue", props.max);
110
- return;
111
- }
112
- percentDispaly.value = Math.round(value * 100 / sliderWidth) + "%";
113
- inputValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
114
- currentPosition.value = newPosition;
115
- ctx.emit("update:modelValue", inputValue.value);
116
- }
117
133
  function handleRunwayMousedown(event) {
118
134
  if (!props.disabled && isClick) {
119
135
  startX = event.target.getBoundingClientRect().left;
@@ -124,22 +140,6 @@ var Slider = defineComponent({
124
140
  return;
125
141
  }
126
142
  }
127
- function handleOnInput(event) {
128
- inputValue.value = parseInt(event.target.value);
129
- if (!inputValue.value) {
130
- inputValue.value = props.min;
131
- percentDispaly.value = "0%";
132
- } else {
133
- if (inputValue.value < props.min || inputValue.value > props.max) {
134
- return;
135
- }
136
- const re = /^(?:[1-9]?\d|100)$/;
137
- if (re.test(`${inputValue.value}`)) {
138
- percentDispaly.value = (inputValue.value - props.min) * 100 / (props.max - props.min) + "%";
139
- ctx.emit("update:modelValue", inputValue.value);
140
- }
141
- }
142
- }
143
143
  const disableClass = computed(() => {
144
144
  return props.disabled ? " disabled" : "";
145
145
  });
@@ -183,15 +183,12 @@ var Slider = defineComponent({
183
183
  }, [props.max]), renderShowInput()]);
184
184
  }
185
185
  });
186
- Slider.install = function(app) {
187
- app.component(Slider.name, Slider);
188
- };
189
186
  var index = {
190
187
  title: "Slider \u6ED1\u5757",
191
188
  category: "\u6570\u636E\u5F55\u5165",
192
189
  status: "100%",
193
190
  install(app) {
194
- app.use(Slider);
191
+ app.component(Slider.name, Slider);
195
192
  }
196
193
  };
197
- export { Slider, index as default };
194
+ export { Slider, index as default, sliderProps };
@@ -1 +1 @@
1
- (function(a,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(a=typeof globalThis!="undefined"?globalThis:a||self,t(a.index={},a.Vue))})(this,function(a,t){"use strict";const g={disabled:{type:Boolean,default:!1},max:{type:Number,default:100},min:{type:Number,default:0},modelValue:{type:Number,default:0},showInput:{type:Boolean,default:!1},step:{type:Number,default:1},tipsRenderer:{type:String,default:""}};var R="",o=t.defineComponent({name:"DSlider",props:g,emits:["update:modelValue"],setup(e,v){let m=!0,f=0,s=0;const d=t.ref(!1),V=t.ref(null),l=t.ref(e.modelValue),r=t.ref(0),h=t.ref(0),u=t.ref(""),S=()=>e.showInput?t.createVNode("div",{class:"devui-input__out-wrap"},[t.createVNode("input",{onInput:D,value:l.value+""},null)]):"";e.modelValue>e.max?u.value="100%":e.modelValue<e.min?u.value="0%":u.value=(e.modelValue-e.min)*100/(e.max-e.min)+"%",t.onMounted(()=>{const n=V.value.clientWidth;r.value=n*(l.value-e.min)/(e.max-e.min)});function M(n){d.value=!0,!e.disabled&&(n.preventDefault(),E(n),window.addEventListener("mousemove",N),window.addEventListener("mouseup",_))}function E(n){m=!1,s=n.clientX,f=r.value,h.value=f}function N(n){d.value=!0;const c=n.clientX-s;h.value=f+c,b(h.value)}function _(){d.value=!1,setTimeout(()=>{m=!0},100),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",_)}function b(n){const i=Math.round(V.value.clientWidth);n<0&&(n=0);const c=i/((e.max-e.min)/e.step),y=Math.round(n/c)*c;if(Math.round(y)>=i){r.value=i,l.value=e.max,u.value="100%",v.emit("update:modelValue",e.max);return}u.value=Math.round(y*100/i)+"%",l.value=Math.round(y*(e.max-e.min)/i)+e.min,r.value=n,v.emit("update:modelValue",l.value)}function X(n){if(!e.disabled&&m){s=n.target.getBoundingClientRect().left;const i=n.clientX;b(i-s),M(n)}else return}function D(n){if(l.value=parseInt(n.target.value),!l.value)l.value=e.min,u.value="0%";else{if(l.value<e.min||l.value>e.max)return;/^(?:[1-9]?\d|100)$/.test(`${l.value}`)&&(u.value=(l.value-e.min)*100/(e.max-e.min)+"%",v.emit("update:modelValue",l.value))}}const w=t.computed(()=>e.disabled?" disabled":""),I=()=>t.createVNode("div",{class:"devui-slider_popover",style:{left:u.value,opacity:d.value?1:0}},[t.createVNode("div",{class:"devui-slider_popover-arrow"},null),t.createVNode("div",{class:"devui-slider_popover-content"},[l.value+" "+e.tipsRenderer])]);return()=>t.createVNode("div",{class:"devui-slider"},[t.createVNode("div",{ref:V,class:"devui-slider__runway"+w.value,onMousedown:X,onMouseout:()=>d.value=!1},[t.createVNode("div",{class:"devui-slider__bar"+w.value,style:{width:u.value}},null),t.createVNode("div",{class:"devui-slider__button"+w.value,style:{left:u.value},onMousedown:M,onMouseenter:()=>d.value=!0,onMouseout:()=>d.value=!1},null),e.tipsRenderer==="null"?"":I()]),t.createVNode("span",{class:"devui-min_count"},[e.min]),t.createVNode("span",{class:"devui-max_count"},[e.max]),S()])}});o.install=function(e){e.component(o.name,o)};var x={title:"Slider \u6ED1\u5757",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(o)}};a.Slider=o,a.default=x,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
1
+ (function(u,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(u=typeof globalThis!="undefined"?globalThis:u||self,t(u.index={},u.Vue))})(this,function(u,t){"use strict";const M={disabled:{type:Boolean,default:!1},max:{type:Number,default:100},min:{type:Number,default:0},modelValue:{type:Number,default:0},showInput:{type:Boolean,default:!1},step:{type:Number,default:1},tipsRenderer:{type:String,default:""}};var R="",c=t.defineComponent({name:"DSlider",props:M,emits:["update:modelValue"],setup(e,v){let m=!0,f=0,o=0;const d=t.ref(!1),V=t.ref(null),l=t.ref(e.modelValue),s=t.ref(0),h=t.ref(0),a=t.ref("");function S(n){if(l.value=parseInt(n.target.value),!l.value)l.value=e.min,a.value="0%";else{if(l.value<e.min||l.value>e.max)return;/^(?:[1-9]?\d|100)$/.test(`${l.value}`)&&(a.value=(l.value-e.min)*100/(e.max-e.min)+"%",v.emit("update:modelValue",l.value))}}function N(n){const i=Math.round(V.value.clientWidth);n<0&&(n=0);const r=i/((e.max-e.min)/e.step),y=Math.round(n/r)*r;if(Math.round(y)>=i){s.value=i,l.value=e.max,a.value="100%",v.emit("update:modelValue",e.max);return}a.value=Math.round(y*100/i)+"%",l.value=Math.round(y*(e.max-e.min)/i)+e.min,s.value=n,v.emit("update:modelValue",l.value)}function E(n){m=!1,o=n.clientX,f=s.value,h.value=f}function _(n){d.value=!0;const r=n.clientX-o;h.value=f+r,N(h.value)}function b(){d.value=!1,setTimeout(()=>{m=!0},100),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",b)}const X=()=>e.showInput?t.createVNode("div",{class:"devui-input__out-wrap"},[t.createVNode("input",{onInput:S,value:l.value+""},null)]):"";e.modelValue>e.max?a.value="100%":e.modelValue<e.min?a.value="0%":a.value=(e.modelValue-e.min)*100/(e.max-e.min)+"%",t.onMounted(()=>{const n=V.value.clientWidth;s.value=n*(l.value-e.min)/(e.max-e.min)});function g(n){d.value=!0,!e.disabled&&(n.preventDefault(),E(n),window.addEventListener("mousemove",_),window.addEventListener("mouseup",b))}function D(n){if(!e.disabled&&m){o=n.target.getBoundingClientRect().left;const i=n.clientX;N(i-o),g(n)}else return}const w=t.computed(()=>e.disabled?" disabled":""),I=()=>t.createVNode("div",{class:"devui-slider_popover",style:{left:a.value,opacity:d.value?1:0}},[t.createVNode("div",{class:"devui-slider_popover-arrow"},null),t.createVNode("div",{class:"devui-slider_popover-content"},[l.value+" "+e.tipsRenderer])]);return()=>t.createVNode("div",{class:"devui-slider"},[t.createVNode("div",{ref:V,class:"devui-slider__runway"+w.value,onMousedown:D,onMouseout:()=>d.value=!1},[t.createVNode("div",{class:"devui-slider__bar"+w.value,style:{width:a.value}},null),t.createVNode("div",{class:"devui-slider__button"+w.value,style:{left:a.value},onMousedown:g,onMouseenter:()=>d.value=!0,onMouseout:()=>d.value=!1},null),e.tipsRenderer==="null"?"":I()]),t.createVNode("span",{class:"devui-min_count"},[e.min]),t.createVNode("span",{class:"devui-max_count"},[e.max]),X()])}}),x={title:"Slider \u6ED1\u5757",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(c.name,c)}};u.Slider=c,u.default=x,u.sliderProps=M,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
@@ -23,24 +23,6 @@ var __publicField = (obj, key, value) => {
23
23
  };
24
24
  import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, toRefs, Fragment, inject, reactive, withDirectives, provide, resolveComponent, onUpdated } from "vue";
25
25
  import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
26
- const splitterProps = {
27
- orientation: {
28
- type: String,
29
- default: "horizontal"
30
- },
31
- splitBarSize: {
32
- type: String,
33
- default: "2px"
34
- },
35
- disabledBarSize: {
36
- type: String,
37
- default: "1px"
38
- },
39
- showCollapseButton: {
40
- type: Boolean,
41
- default: true
42
- }
43
- };
44
26
  var baseOverlay = "";
45
27
  function _isSlot(s) {
46
28
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -232,6 +214,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
232
214
  function useOverlay(props, emit) {
233
215
  const overlayRef = ref();
234
216
  const arrowRef = ref();
217
+ let originParent = null;
235
218
  const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
236
219
  const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
237
220
  const staticSide = {
@@ -270,21 +253,20 @@ function useOverlay(props, emit) {
270
253
  props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
271
254
  };
272
255
  watch(() => props.modelValue, () => {
273
- const originParent = getScrollParent(props.origin);
274
256
  if (props.modelValue && props.origin) {
257
+ originParent = getScrollParent(props.origin);
275
258
  nextTick(updatePosition);
276
- originParent.addEventListener("scroll", updatePosition);
259
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
277
260
  originParent !== window && window.addEventListener("scroll", updatePosition);
278
261
  window.addEventListener("resize", updatePosition);
279
262
  } else {
280
- originParent.removeEventListener("scroll", updatePosition);
263
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
281
264
  originParent !== window && window.removeEventListener("scroll", updatePosition);
282
265
  window.removeEventListener("resize", updatePosition);
283
266
  }
284
267
  });
285
268
  onUnmounted(() => {
286
- const originParent = getScrollParent(props.origin);
287
- originParent.removeEventListener("scroll", updatePosition);
269
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
288
270
  originParent !== window && window.removeEventListener("scroll", updatePosition);
289
271
  window.removeEventListener("resize", updatePosition);
290
272
  });
@@ -5883,58 +5865,58 @@ function removeClass(el, className) {
5883
5865
  }
5884
5866
  }
5885
5867
  }
5886
- const resize = {
5887
- mounted(el, { value }) {
5888
- el.$value = value;
5889
- if (value.enableResize) {
5890
- bindEvent(el);
5891
- }
5892
- },
5893
- unmounted(el, { value }) {
5894
- if (value.enableResize) {
5895
- unbind(el, "mousedown", onMousedown);
5896
- }
5897
- }
5898
- };
5899
- function bindEvent(el) {
5900
- bind(el, "mousedown", onMousedown);
5868
+ function normalizeEvent(evt) {
5869
+ return {
5870
+ pageX: evt.pageX,
5871
+ pageY: evt.pageY,
5872
+ clientX: evt.clientX,
5873
+ clientY: evt.clientY,
5874
+ offsetX: evt.offsetX,
5875
+ offsetY: evt.offsetY,
5876
+ type: evt.type,
5877
+ originalEvent: evt
5878
+ };
5901
5879
  }
5902
- function bind(el, event, callback) {
5903
- el.addEventListener && el.addEventListener(event, callback);
5880
+ function bind(el, eventName, callback) {
5881
+ el.addEventListener && el.addEventListener(eventName, callback);
5904
5882
  }
5905
- function unbind(el, event, callback) {
5906
- el.removeEventListener && el.removeEventListener(event, callback);
5883
+ function unbind(el, eventName, callback) {
5884
+ el.removeEventListener && el.removeEventListener(eventName, callback);
5907
5885
  }
5908
5886
  function onMousedown(e) {
5909
5887
  var _a;
5910
- const $value = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.$value;
5911
- if (!$value) {
5888
+ const resizeProps = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.resizeProps;
5889
+ if (!resizeProps) {
5912
5890
  return;
5913
5891
  }
5914
- bind(document, "mousemove", onMousemove);
5915
- bind(document, "mouseup", onMouseup);
5916
- $value.onPressEvent(normalizeEvent(e));
5917
- function onMousemove(e2) {
5918
- $value.onDragEvent(normalizeEvent(e2));
5892
+ function onMousemove(evt) {
5893
+ resizeProps.onDragEvent(normalizeEvent(evt));
5919
5894
  }
5920
- function onMouseup(e2) {
5895
+ function onMouseup(evt) {
5921
5896
  unbind(document, "mousemove", onMousemove);
5922
5897
  unbind(document, "mouseup", onMouseup);
5923
- $value.onReleaseEvent(normalizeEvent(e2));
5898
+ resizeProps.onReleaseEvent(normalizeEvent(evt));
5924
5899
  }
5900
+ bind(document, "mousemove", onMousemove);
5901
+ bind(document, "mouseup", onMouseup);
5902
+ resizeProps.onPressEvent(normalizeEvent(e));
5925
5903
  }
5926
- function normalizeEvent(e) {
5927
- return {
5928
- pageX: e.pageX,
5929
- pageY: e.pageY,
5930
- clientX: e.clientX,
5931
- clientY: e.clientY,
5932
- offsetX: e.offsetX,
5933
- offsetY: e.offsetY,
5934
- type: e.type,
5935
- originalEvent: e
5936
- };
5904
+ function bindEvent(el) {
5905
+ bind(el, "mousedown", onMousedown);
5937
5906
  }
5907
+ const resize = {
5908
+ mounted(el, { value }) {
5909
+ el.resizeProps = value;
5910
+ if (value.enableResize) {
5911
+ bindEvent(el);
5912
+ }
5913
+ },
5914
+ unmounted(el, { value }) {
5915
+ if (value.enableResize) {
5916
+ unbind(el, "mousedown", onMousedown);
5917
+ }
5918
+ }
5919
+ };
5938
5920
  const splitterBarProps = {
5939
5921
  index: {
5940
5922
  type: Number
@@ -5978,10 +5960,13 @@ var DSplitterBar = defineComponent({
5978
5960
  }, {
5979
5961
  immediate: true
5980
5962
  });
5981
- watch([() => store.state.panes, domRef], ([panes, ele]) => {
5963
+ watch([() => store == null ? void 0 : store.state.panes, domRef], ([, ele]) => {
5964
+ if (!store || !props || props.index === void 0) {
5965
+ return;
5966
+ }
5982
5967
  if (!store.isStaticBar(props.index)) {
5983
5968
  state.wrapperClass += " resizable";
5984
- } else {
5969
+ } else if (ele) {
5985
5970
  setStyle(ele, {
5986
5971
  flexBasis: props.disabledBarSize
5987
5972
  });
@@ -5989,62 +5974,10 @@ var DSplitterBar = defineComponent({
5989
5974
  }, {
5990
5975
  deep: true
5991
5976
  });
5992
- const coordinate = {
5993
- pageX: 0,
5994
- pageY: 0,
5995
- originalX: 0,
5996
- originalY: 0
5997
- };
5998
- let initState;
5999
- const resizeProp = {
6000
- enableResize: true,
6001
- onPressEvent: function({
6002
- originalEvent
6003
- }) {
6004
- originalEvent.stopPropagation();
6005
- if (!store.isResizable(props.index)) {
6006
- return;
6007
- }
6008
- initState = store.dragState(props.index);
6009
- coordinate.originalX = originalEvent.pageX;
6010
- coordinate.originalY = originalEvent.pageY;
6011
- },
6012
- onDragEvent: function({
6013
- originalEvent
6014
- }) {
6015
- originalEvent.stopPropagation();
6016
- if (!store.isResizable(props.index)) {
6017
- return;
6018
- }
6019
- coordinate.pageX = originalEvent.pageX;
6020
- coordinate.pageY = originalEvent.pageY;
6021
- let distance;
6022
- if (props.orientation === "vertical") {
6023
- distance = coordinate.pageY - coordinate.originalY;
6024
- } else {
6025
- distance = coordinate.pageX - coordinate.originalX;
6026
- }
6027
- store.setSize(initState, distance);
6028
- },
6029
- onReleaseEvent: function({
6030
- originalEvent
6031
- }) {
6032
- originalEvent.stopPropagation();
6033
- if (!store.isResizable(props.index)) {
6034
- return;
6035
- }
6036
- coordinate.pageX = originalEvent.pageX;
6037
- coordinate.pageY = originalEvent.pageY;
6038
- let distance;
6039
- if (props.orientation === "vertical") {
6040
- distance = coordinate.pageY - coordinate.originalY;
6041
- } else {
6042
- distance = coordinate.pageX - coordinate.originalX;
6043
- }
6044
- store.setSize(initState, distance);
6045
- }
6046
- };
6047
5977
  const queryPanes = (index2, nearIndex) => {
5978
+ if (!store) {
5979
+ return {};
5980
+ }
6048
5981
  const pane = store.getPane(index2);
6049
5982
  const nearPane = store.getPane(nearIndex);
6050
5983
  return {
@@ -6056,7 +5989,7 @@ var DSplitterBar = defineComponent({
6056
5989
  var _a, _b, _c, _d;
6057
5990
  const isCollapsible = ((_b = (_a = pane == null ? void 0 : pane.component) == null ? void 0 : _a.props) == null ? void 0 : _b.collapsible) && showIcon;
6058
5991
  const isCollapsed = (_d = (_c = pane == null ? void 0 : pane.component) == null ? void 0 : _c.props) == null ? void 0 : _d.collapsed;
6059
- const isNearPaneCollapsed = nearPane.collapsed;
5992
+ const isNearPaneCollapsed = nearPane == null ? void 0 : nearPane.collapsed;
6060
5993
  return {
6061
5994
  "devui-collapse": isCollapsible,
6062
5995
  collapsed: isCollapsed,
@@ -6065,6 +5998,9 @@ var DSplitterBar = defineComponent({
6065
5998
  };
6066
5999
  const prevClass = computed(() => {
6067
6000
  var _a, _b;
6001
+ if (!props || props.index === void 0) {
6002
+ return {};
6003
+ }
6068
6004
  const {
6069
6005
  pane,
6070
6006
  nearPane
@@ -6074,6 +6010,9 @@ var DSplitterBar = defineComponent({
6074
6010
  });
6075
6011
  const nextClass = computed(() => {
6076
6012
  var _a, _b;
6013
+ if (!store || !props || props.index === void 0) {
6014
+ return {};
6015
+ }
6077
6016
  const {
6078
6017
  pane,
6079
6018
  nearPane
@@ -6083,6 +6022,9 @@ var DSplitterBar = defineComponent({
6083
6022
  });
6084
6023
  const toggleResize = () => {
6085
6024
  var _a, _b, _c, _d;
6025
+ if (!domRef.value || !props || props.index === void 0) {
6026
+ return;
6027
+ }
6086
6028
  const {
6087
6029
  pane,
6088
6030
  nearPane
@@ -6095,10 +6037,16 @@ var DSplitterBar = defineComponent({
6095
6037
  }
6096
6038
  };
6097
6039
  const handleCollapsePrePane = (lockStatus) => {
6040
+ if (!store || !props || props.index === void 0) {
6041
+ return;
6042
+ }
6098
6043
  store.tooglePane(props.index, props.index + 1, lockStatus);
6099
6044
  toggleResize();
6100
6045
  };
6101
6046
  const handleCollapseNextPane = (lockStatus) => {
6047
+ if (!store || !props || props.index === void 0) {
6048
+ return;
6049
+ }
6102
6050
  store.tooglePane(props.index + 1, props.index, lockStatus);
6103
6051
  toggleResize();
6104
6052
  };
@@ -6106,11 +6054,78 @@ var DSplitterBar = defineComponent({
6106
6054
  handleCollapsePrePane(true);
6107
6055
  handleCollapseNextPane(true);
6108
6056
  };
6057
+ const coordinate = {
6058
+ pageX: 0,
6059
+ pageY: 0,
6060
+ originalX: 0,
6061
+ originalY: 0
6062
+ };
6063
+ let initState;
6064
+ const resizeProp = {
6065
+ enableResize: true,
6066
+ onPressEvent: function({
6067
+ originalEvent
6068
+ }) {
6069
+ originalEvent.stopPropagation();
6070
+ if (!store || !props || props.index === void 0) {
6071
+ return;
6072
+ }
6073
+ if (!store.isResizable(props.index)) {
6074
+ return;
6075
+ }
6076
+ initState = store.dragState(props.index);
6077
+ coordinate.originalX = originalEvent.pageX;
6078
+ coordinate.originalY = originalEvent.pageY;
6079
+ },
6080
+ onDragEvent: function({
6081
+ originalEvent
6082
+ }) {
6083
+ originalEvent.stopPropagation();
6084
+ if (!store || !props || props.index === void 0) {
6085
+ return;
6086
+ }
6087
+ if (!store.isResizable(props.index)) {
6088
+ return;
6089
+ }
6090
+ coordinate.pageX = originalEvent.pageX;
6091
+ coordinate.pageY = originalEvent.pageY;
6092
+ let distance;
6093
+ if (props.orientation === "vertical") {
6094
+ distance = coordinate.pageY - coordinate.originalY;
6095
+ } else {
6096
+ distance = coordinate.pageX - coordinate.originalX;
6097
+ }
6098
+ store.setSize(initState, distance);
6099
+ },
6100
+ onReleaseEvent: function({
6101
+ originalEvent
6102
+ }) {
6103
+ originalEvent.stopPropagation();
6104
+ if (!store || !props || props.index === void 0) {
6105
+ return;
6106
+ }
6107
+ if (!store.isResizable(props.index)) {
6108
+ return;
6109
+ }
6110
+ coordinate.pageX = originalEvent.pageX;
6111
+ coordinate.pageY = originalEvent.pageY;
6112
+ let distance;
6113
+ if (props.orientation === "vertical") {
6114
+ distance = coordinate.pageY - coordinate.originalY;
6115
+ } else {
6116
+ distance = coordinate.pageX - coordinate.originalX;
6117
+ }
6118
+ store.setSize(initState, distance);
6119
+ }
6120
+ };
6109
6121
  onMounted(() => {
6110
6122
  initialCollapseStatus();
6111
6123
  });
6112
6124
  const renderCollapsedTip = () => {
6113
6125
  var _a, _b, _c, _d;
6126
+ if (!props || props.index === void 0) {
6127
+ return "\u6536\u8D77";
6128
+ }
6114
6129
  const {
6115
6130
  pane,
6116
6131
  nearPane
@@ -6254,6 +6269,24 @@ class SplitterStore {
6254
6269
  }
6255
6270
  }
6256
6271
  }
6272
+ const splitterProps = {
6273
+ orientation: {
6274
+ type: String,
6275
+ default: "horizontal"
6276
+ },
6277
+ splitBarSize: {
6278
+ type: String,
6279
+ default: "2px"
6280
+ },
6281
+ disabledBarSize: {
6282
+ type: String,
6283
+ default: "1px"
6284
+ },
6285
+ showCollapseButton: {
6286
+ type: Boolean,
6287
+ default: true
6288
+ }
6289
+ };
6257
6290
  var splitter = "";
6258
6291
  var Splitter = defineComponent({
6259
6292
  name: "DSplitter",
@@ -6295,7 +6328,9 @@ var Splitter = defineComponent({
6295
6328
  return;
6296
6329
  }
6297
6330
  refreshSplitterContainerSize();
6298
- observer.observe(domRef.value);
6331
+ if (domRef.value) {
6332
+ observer.observe(domRef.value);
6333
+ }
6299
6334
  });
6300
6335
  onUnmounted(() => {
6301
6336
  observer.disconnect();
@@ -6391,27 +6426,35 @@ var SplitterPane = defineComponent({
6391
6426
  }
6392
6427
  };
6393
6428
  watch([() => props.size, domRef], ([size, ele]) => {
6394
- setSizeStyle(size, ele);
6429
+ if (size && ele) {
6430
+ setSizeStyle(size, ele);
6431
+ }
6395
6432
  }, {
6396
6433
  immediate: true
6397
6434
  });
6398
6435
  const orientation = inject("orientation");
6399
6436
  let initialSize = "";
6400
6437
  onMounted(() => {
6401
- initialSize = props.size;
6402
- store.setPanes({
6403
- panes: store.state.panes
6404
- });
6438
+ if (props.size) {
6439
+ initialSize = props.size;
6440
+ }
6441
+ if (store) {
6442
+ store.setPanes({
6443
+ panes: store.state.panes
6444
+ });
6445
+ }
6405
6446
  });
6406
6447
  onUpdated(() => {
6407
- store.setPanes({
6408
- panes: store.state.panes
6409
- });
6448
+ if (store) {
6449
+ store.setPanes({
6450
+ panes: store.state.panes
6451
+ });
6452
+ }
6410
6453
  });
6411
6454
  const getPaneSize = () => {
6412
6455
  const ele = domRef.value;
6413
6456
  if (!ele) {
6414
- return;
6457
+ return 0;
6415
6458
  }
6416
6459
  if (orientation === "vertical") {
6417
6460
  return ele.offsetHeight;
@@ -6468,16 +6511,13 @@ var SplitterPane = defineComponent({
6468
6511
  };
6469
6512
  }
6470
6513
  });
6471
- Splitter.install = function(app) {
6472
- app.component(Splitter.name, Splitter);
6473
- app.component(SplitterPane.name, SplitterPane);
6474
- };
6475
6514
  var index = {
6476
6515
  title: "Splitter \u5206\u5272\u5668",
6477
6516
  category: "\u5E03\u5C40",
6478
6517
  status: "100%",
6479
6518
  install(app) {
6480
- app.use(Splitter);
6519
+ app.component(Splitter.name, Splitter);
6520
+ app.component(SplitterPane.name, SplitterPane);
6481
6521
  }
6482
6522
  };
6483
- export { Splitter, index as default };
6523
+ export { Splitter, index as default, splitterProps };