vue-devui 1.0.0-rc.7 → 1.0.0

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 (231) hide show
  1. package/README.md +163 -146
  2. package/alert/index.es.js +46 -15
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8230 -231
  6. package/auto-complete/index.umd.js +29 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +81 -70
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +34 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5706 -98
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +38 -13
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8066 -245
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{date-picker → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +213 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{date-picker → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +56 -13
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker-pro/index.d.ts +7 -0
  31. package/date-picker-pro/index.es.js +12020 -0
  32. package/date-picker-pro/index.umd.js +27 -0
  33. package/date-picker-pro/package.json +7 -0
  34. package/date-picker-pro/style.css +1 -0
  35. package/drawer/index.es.js +29 -4
  36. package/drawer/index.umd.js +1 -1
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +178 -142
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +742 -107
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +544 -316
  45. package/form/index.umd.js +17 -17
  46. package/form/style.css +1 -1
  47. package/fullscreen/index.es.js +28 -4
  48. package/fullscreen/index.umd.js +1 -1
  49. package/fullscreen/style.css +1 -1
  50. package/grid/index.es.js +71 -50
  51. package/grid/index.umd.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +184 -23
  54. package/icon/index.umd.js +1 -1
  55. package/icon/style.css +1 -0
  56. package/image-preview/index.es.js +34 -11
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8250 -131
  60. package/input/index.umd.js +27 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +275 -203
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/layout/index.es.js +34 -6
  66. package/layout/index.umd.js +1 -1
  67. package/layout/style.css +1 -1
  68. package/loading/index.es.js +34 -10
  69. package/loading/index.umd.js +1 -1
  70. package/loading/style.css +1 -1
  71. package/mention/index.d.ts +7 -0
  72. package/mention/index.es.js +8310 -0
  73. package/mention/index.umd.js +36 -0
  74. package/mention/package.json +7 -0
  75. package/mention/style.css +1 -0
  76. package/menu/index.d.ts +7 -0
  77. package/menu/index.es.js +934 -0
  78. package/menu/index.umd.js +1 -0
  79. package/menu/package.json +7 -0
  80. package/menu/style.css +1 -0
  81. package/message/index.d.ts +7 -0
  82. package/message/index.es.js +538 -0
  83. package/message/index.umd.js +1 -0
  84. package/message/package.json +7 -0
  85. package/message/style.css +1 -0
  86. package/modal/index.es.js +359 -170
  87. package/modal/index.umd.js +1 -1
  88. package/modal/style.css +1 -1
  89. package/notification/index.es.js +236 -65
  90. package/notification/index.umd.js +1 -1
  91. package/notification/style.css +1 -1
  92. package/nuxt/components/ButtonGroup.js +3 -0
  93. package/nuxt/components/CheckboxButton.js +3 -0
  94. package/nuxt/components/Collapse.js +3 -0
  95. package/nuxt/components/CollapseItem.js +3 -0
  96. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  97. package/nuxt/components/DatePickerPro.js +3 -0
  98. package/nuxt/components/Icon.js +1 -0
  99. package/nuxt/components/IconGroup.js +3 -0
  100. package/nuxt/components/LABEL_DATA.js +3 -0
  101. package/nuxt/components/Mention.js +3 -0
  102. package/nuxt/components/Menu.js +3 -0
  103. package/nuxt/components/MenuItem.js +3 -0
  104. package/nuxt/components/Message.js +3 -0
  105. package/nuxt/components/Option.js +3 -0
  106. package/nuxt/components/OptionGroup.js +3 -0
  107. package/nuxt/components/RadioButton.js +3 -0
  108. package/nuxt/components/Step.js +3 -0
  109. package/nuxt/components/Steps.js +3 -0
  110. package/nuxt/components/SubMenu.js +3 -0
  111. package/nuxt/components/TABLE_TOKEN.js +3 -0
  112. package/nuxt/components/TimePicker.js +3 -0
  113. package/nuxt/components/TimeSelect.js +3 -0
  114. package/nuxt/components/animationInjectionKey.js +3 -0
  115. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  116. package/nuxt/components/buttonGroupProps.js +3 -0
  117. package/nuxt/components/collapseItemProps.js +3 -0
  118. package/nuxt/components/collapseProps.js +3 -0
  119. package/nuxt/components/datePickerProCommonProps.js +3 -0
  120. package/nuxt/components/datePickerProPanelProps.js +3 -0
  121. package/nuxt/components/datePickerProProps.js +3 -0
  122. package/nuxt/components/iconProps.js +1 -0
  123. package/nuxt/components/mentionProps.js +3 -0
  124. package/nuxt/components/messageProps.js +3 -0
  125. package/nuxt/components/roundInjectionKey.js +3 -0
  126. package/nuxt/components/skeletonItemProps.js +3 -0
  127. package/nuxt/components/stepProps.js +3 -0
  128. package/nuxt/components/stepsProps.js +3 -0
  129. package/nuxt/components/svgIconProps.js +3 -0
  130. package/nuxt/components/tableProps.js +3 -0
  131. package/nuxt/components/timerPickerPanelProps.js +3 -0
  132. package/nuxt/components/treeNodeProps.js +3 -0
  133. package/overlay/index.es.js +84 -125
  134. package/overlay/index.umd.js +1 -1
  135. package/overlay/style.css +1 -1
  136. package/package.json +7 -3
  137. package/pagination/index.es.js +234 -39
  138. package/pagination/index.umd.js +1 -1
  139. package/pagination/style.css +1 -1
  140. package/panel/style.css +1 -1
  141. package/popover/index.es.js +274 -220
  142. package/popover/index.umd.js +13 -13
  143. package/popover/style.css +1 -1
  144. package/progress/index.es.js +31 -9
  145. package/progress/index.umd.js +3 -3
  146. package/progress/style.css +1 -1
  147. package/radio/index.es.js +7969 -152
  148. package/radio/index.umd.js +27 -1
  149. package/radio/style.css +1 -1
  150. package/rate/index.es.js +46 -14
  151. package/rate/index.umd.js +1 -1
  152. package/rate/style.css +1 -1
  153. package/result/index.es.js +169 -22
  154. package/result/index.umd.js +1 -1
  155. package/result/style.css +1 -1
  156. package/search/index.es.js +3823 -1090
  157. package/search/index.umd.js +18 -18
  158. package/search/style.css +1 -1
  159. package/select/index.es.js +9186 -478
  160. package/select/index.umd.js +27 -1
  161. package/select/style.css +1 -1
  162. package/skeleton/index.es.js +110 -259
  163. package/skeleton/index.umd.js +1 -1
  164. package/skeleton/style.css +1 -1
  165. package/slider/index.es.js +143 -146
  166. package/slider/index.umd.js +1 -1
  167. package/slider/style.css +1 -1
  168. package/splitter/index.es.js +433 -207
  169. package/splitter/index.umd.js +17 -17
  170. package/splitter/style.css +1 -1
  171. package/statistic/index.es.js +34 -16
  172. package/statistic/index.umd.js +1 -1
  173. package/statistic/style.css +1 -1
  174. package/status/index.es.js +26 -2
  175. package/status/index.umd.js +1 -1
  176. package/status/style.css +1 -1
  177. package/steps/index.d.ts +7 -0
  178. package/steps/index.es.js +386 -0
  179. package/steps/index.umd.js +1 -0
  180. package/steps/package.json +7 -0
  181. package/steps/style.css +1 -0
  182. package/style.css +1 -1
  183. package/switch/index.es.js +7802 -59
  184. package/switch/index.umd.js +27 -1
  185. package/switch/style.css +1 -1
  186. package/table/index.es.js +9769 -919
  187. package/table/index.umd.js +27 -1
  188. package/table/style.css +1 -1
  189. package/tabs/index.es.js +309 -96
  190. package/tabs/index.umd.js +1 -1
  191. package/tabs/style.css +1 -1
  192. package/tag/index.es.js +35 -7
  193. package/tag/index.umd.js +1 -1
  194. package/tag/style.css +1 -1
  195. package/textarea/index.es.js +7922 -78
  196. package/textarea/index.umd.js +35 -1
  197. package/textarea/style.css +1 -1
  198. package/time-picker/index.d.ts +7 -0
  199. package/time-picker/index.es.js +9549 -0
  200. package/time-picker/index.umd.js +27 -0
  201. package/time-picker/package.json +7 -0
  202. package/time-picker/style.css +1 -0
  203. package/time-select/index.d.ts +7 -0
  204. package/time-select/index.es.js +9585 -0
  205. package/time-select/index.umd.js +27 -0
  206. package/time-select/package.json +7 -0
  207. package/time-select/style.css +1 -0
  208. package/timeline/index.es.js +169 -22
  209. package/timeline/index.umd.js +1 -1
  210. package/timeline/style.css +1 -1
  211. package/tooltip/index.es.js +265 -212
  212. package/tooltip/index.umd.js +15 -15
  213. package/tooltip/style.css +1 -1
  214. package/tree/index.es.js +11343 -795
  215. package/tree/index.umd.js +27 -1
  216. package/tree/style.css +1 -1
  217. package/upload/index.es.js +494 -106
  218. package/upload/index.umd.js +1 -1
  219. package/upload/style.css +1 -1
  220. package/vue-devui.es.js +22849 -13614
  221. package/vue-devui.umd.js +30 -23
  222. package/date-picker/index.es.js +0 -1145
  223. package/date-picker/index.umd.js +0 -1
  224. package/date-picker/style.css +0 -1
  225. package/nuxt/components/DatePicker.js +0 -3
  226. package/nuxt/components/FormControl.js +0 -3
  227. package/nuxt/components/FormLabel.js +0 -3
  228. package/nuxt/components/StickSlider.js +0 -3
  229. package/nuxt/components/formControlProps.js +0 -3
  230. package/nuxt/components/overlayEmits.js +0 -3
  231. package/nuxt/components/overlayProps.js +0 -3
@@ -1,8 +1,22 @@
1
- import { defineComponent, toRefs, createVNode, ref, computed } from "vue";
1
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
4
+ var __objRest = (source, exclude) => {
5
+ var target = {};
6
+ for (var prop in source)
7
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
8
+ target[prop] = source[prop];
9
+ if (source != null && __getOwnPropSymbols)
10
+ for (var prop of __getOwnPropSymbols(source)) {
11
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
12
+ target[prop] = source[prop];
13
+ }
14
+ return target;
15
+ };
16
+ import { createVNode, computed, ref, toRefs, reactive, watch, defineComponent, mergeProps } from "vue";
2
17
  const inputNumberProps = {
3
18
  placeholder: {
4
- type: String,
5
- default: void 0
19
+ type: String
6
20
  },
7
21
  disabled: {
8
22
  type: Boolean,
@@ -10,7 +24,7 @@ const inputNumberProps = {
10
24
  },
11
25
  step: {
12
26
  type: Number,
13
- default: 0
27
+ default: 1
14
28
  },
15
29
  max: {
16
30
  type: Number,
@@ -25,227 +39,285 @@ const inputNumberProps = {
25
39
  default: ""
26
40
  },
27
41
  modelValue: {
28
- type: Number,
29
- default: 0
30
- },
31
- "onUpdate:modelValue": {
32
- type: Function,
33
- default: void 0
42
+ type: Number
34
43
  },
35
- "onChange": {
36
- type: Function,
37
- default: void 0
38
- },
39
- "onKeydown": {
40
- type: Function,
41
- default: void 0
42
- },
43
- "onFocus": {
44
- type: Function,
45
- default: void 0
46
- },
47
- "onBlur": {
48
- type: Function,
49
- default: void 0
44
+ precision: {
45
+ type: Number
50
46
  }
51
47
  };
52
- var inputNumber = "";
53
- const iconProps = {
54
- name: {
55
- type: String,
56
- default: "",
57
- required: true
58
- },
59
- size: {
60
- type: String,
61
- default: "inherit"
62
- },
63
- color: {
64
- type: String,
65
- default: "inherit"
66
- },
67
- classPrefix: {
68
- type: String,
69
- default: "icon"
48
+ function createBem(namespace, element, modifier) {
49
+ let cls = namespace;
50
+ if (element) {
51
+ cls += `__${element}`;
70
52
  }
71
- };
72
- var Icon = defineComponent({
73
- name: "DIcon",
74
- props: iconProps,
75
- setup(props) {
76
- const {
77
- name,
78
- size,
79
- color,
80
- classPrefix
81
- } = toRefs(props);
82
- return () => {
83
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
84
- "src": name.value,
85
- "alt": name.value.split("/")[name.value.split("/").length - 1],
86
- "style": {
87
- width: size.value,
88
- verticalAlign: "text-bottom"
89
- }
90
- }, null) : createVNode("i", {
91
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
92
- "style": {
93
- fontSize: size.value,
94
- color: color.value
95
- }
96
- }, null);
97
- };
53
+ if (modifier) {
54
+ cls += `--${modifier}`;
98
55
  }
99
- });
56
+ return cls;
57
+ }
58
+ function useNamespace(block, needDot = false) {
59
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
60
+ const b = () => createBem(namespace);
61
+ const e = (element) => element ? createBem(namespace, element) : "";
62
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
63
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
64
+ return {
65
+ b,
66
+ e,
67
+ m,
68
+ em
69
+ };
70
+ }
71
+ const ns$1 = useNamespace("input-number");
72
+ function IncIcon() {
73
+ return createVNode("svg", {
74
+ "class": ns$1.e("icon-arrow"),
75
+ "width": "1em",
76
+ "height": "1em",
77
+ "viewBox": "0 0 16 16",
78
+ "version": "1.1",
79
+ "xmlns": "http://www.w3.org/2000/svg"
80
+ }, [createVNode("g", {
81
+ "stroke": "none",
82
+ "stroke-width": "1",
83
+ "fill": "none",
84
+ "fill-rule": "evenodd"
85
+ }, [createVNode("path", {
86
+ "d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
87
+ "fill-rule": "nonzero"
88
+ }, null)])]);
89
+ }
90
+ function DecIcon() {
91
+ return createVNode("svg", {
92
+ "class": ns$1.e("icon-arrow"),
93
+ "width": "1em",
94
+ "height": "1em",
95
+ "viewBox": "0 0 16 16",
96
+ "version": "1.1",
97
+ "xmlns": "http://www.w3.org/2000/svg"
98
+ }, [createVNode("g", {
99
+ "stroke": "none",
100
+ "stroke-width": "1",
101
+ "fill": "none",
102
+ "fill-rule": "evenodd"
103
+ }, [createVNode("path", {
104
+ "d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
105
+ "fill-rule": "nonzero"
106
+ }, null)])]);
107
+ }
108
+ const isNumber = (value) => typeof value === "number";
109
+ const isUndefined = (value) => value === void 0;
110
+ const isNull = (value) => value === null;
111
+ const ns = useNamespace("input-number");
112
+ function useRender(props, ctx) {
113
+ const _a = ctx.attrs, { style, class: customClass } = _a, otherAttrs = __objRest(_a, ["style", "class"]);
114
+ const customStyle = { style };
115
+ const wrapClass = computed(() => [
116
+ {
117
+ [ns.b()]: true
118
+ },
119
+ customClass
120
+ ]);
121
+ const controlButtonsClass = computed(() => ({
122
+ [ns.e("control-buttons")]: true,
123
+ disabled: props.disabled,
124
+ [ns.m(props.size)]: true
125
+ }));
126
+ const inputWrapClass = computed(() => ({
127
+ [ns.e("input-wrap")]: true,
128
+ [ns.m(props.size)]: true
129
+ }));
130
+ const inputInnerClass = computed(() => ({
131
+ [ns.e("input-box")]: true,
132
+ disabled: props.disabled
133
+ }));
134
+ return { wrapClass, customStyle, otherAttrs, controlButtonsClass, inputWrapClass, inputInnerClass };
135
+ }
136
+ function useExpose(ctx) {
137
+ const inputRef = ref();
138
+ const focus = () => {
139
+ inputRef.value.focus();
140
+ };
141
+ const blur = () => {
142
+ inputRef.value.blur();
143
+ };
144
+ const select = () => {
145
+ inputRef.value.select();
146
+ };
147
+ ctx.expose({ focus, blur, select });
148
+ return { inputRef };
149
+ }
150
+ function getPrecision(pre) {
151
+ let precision = 0;
152
+ if (isUndefined(pre)) {
153
+ return precision;
154
+ }
155
+ const preString = pre.toString();
156
+ const dotIndex = preString.indexOf(".");
157
+ if (dotIndex !== -1) {
158
+ precision = preString.length - dotIndex - 1;
159
+ }
160
+ return precision;
161
+ }
162
+ function useEvent(props, ctx, inputRef) {
163
+ const { min, max, step, disabled } = toRefs(props);
164
+ const state = reactive({
165
+ currentValue: props.modelValue || "",
166
+ userInputValue: void 0
167
+ });
168
+ const numPrecision = computed(() => {
169
+ if (!isUndefined(props.precision)) {
170
+ return props.precision;
171
+ } else {
172
+ return Math.max(getPrecision(props.modelValue), getPrecision(step.value));
173
+ }
174
+ });
175
+ const inputVal = computed(() => {
176
+ if (!isUndefined(state.userInputValue)) {
177
+ return state.userInputValue;
178
+ }
179
+ let currentValue = state.currentValue;
180
+ if (currentValue === "" || isUndefined(currentValue) || Number.isNaN(currentValue)) {
181
+ return "";
182
+ }
183
+ if (isNumber(currentValue)) {
184
+ currentValue = currentValue.toFixed(numPrecision.value);
185
+ }
186
+ return currentValue;
187
+ });
188
+ const toPrecision = (num) => {
189
+ return Number.parseFloat(num.toFixed(numPrecision.value));
190
+ };
191
+ const computeByStep = (val, addOrNot = 1) => {
192
+ if (!isNumber(val)) {
193
+ return state.currentValue;
194
+ }
195
+ return toPrecision(val + step.value * addOrNot);
196
+ };
197
+ const correctValue = (value, shouldUpdate) => {
198
+ if (value === "" || isUndefined(value) || isNull(value) || Number.isNaN(value)) {
199
+ return void 0;
200
+ }
201
+ let newVal = Number(value);
202
+ newVal = toPrecision(newVal);
203
+ if (newVal > max.value || newVal < min.value) {
204
+ newVal = newVal > max.value ? max.value : min.value;
205
+ shouldUpdate && ctx.emit("update:modelValue", newVal);
206
+ }
207
+ return newVal;
208
+ };
209
+ const setCurrentValue = (value) => {
210
+ const oldVal = state.currentValue;
211
+ const newVal = correctValue(value);
212
+ if (oldVal === newVal) {
213
+ return;
214
+ }
215
+ state.userInputValue = void 0;
216
+ ctx.emit("update:modelValue", newVal);
217
+ ctx.emit("input", newVal);
218
+ ctx.emit("change", newVal, oldVal);
219
+ state.currentValue = newVal;
220
+ };
221
+ const minDisabled = computed(() => isNumber(state.currentValue) && computeByStep(state.currentValue, -1) < props.min);
222
+ const maxDisabled = computed(() => isNumber(state.currentValue) && computeByStep(state.currentValue) > props.max);
223
+ const onAdd = () => {
224
+ if (disabled.value || maxDisabled.value) {
225
+ return;
226
+ }
227
+ inputRef.value.focus();
228
+ const newVal = computeByStep(state.currentValue || 0);
229
+ setCurrentValue(newVal);
230
+ };
231
+ const onSubtract = () => {
232
+ if (disabled.value || minDisabled.value) {
233
+ return;
234
+ }
235
+ inputRef.value.focus();
236
+ const newVal = computeByStep(state.currentValue || 0, -1);
237
+ setCurrentValue(newVal);
238
+ };
239
+ watch(() => props.modelValue, (val) => {
240
+ state.currentValue = correctValue(val, true);
241
+ state.userInputValue = void 0;
242
+ }, { immediate: true });
243
+ const onInput = (event) => {
244
+ const value = event.target.value;
245
+ state.userInputValue = value;
246
+ };
247
+ const onChange = (event) => {
248
+ const value = event.target.value;
249
+ const newVal = value !== "" ? Number(value) : "";
250
+ if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
251
+ setCurrentValue(newVal);
252
+ }
253
+ state.userInputValue = void 0;
254
+ };
255
+ return { inputVal, minDisabled, maxDisabled, onAdd, onSubtract, onInput, onChange };
256
+ }
257
+ var inputNumber = "";
100
258
  var InputNumber = defineComponent({
101
259
  name: "DInputNumber",
102
260
  props: inputNumberProps,
103
- emits: ["update:modelValue", "change", "input", "focus", "blur", "keydown"],
261
+ emits: ["update:modelValue", "change", "input"],
104
262
  setup(props, ctx) {
105
- const inputVal = ref(props.modelValue < props.min ? props.min : props.modelValue);
106
- const focusVal = ref("");
107
- const isSize = computed(() => {
108
- return `devui-input-number-${props.size}`;
109
- });
110
- const isDisabled = computed(() => {
111
- return props.disabled;
112
- });
113
- const add = () => {
114
- if (props.disabled) {
115
- return;
116
- }
117
- if (inputVal.value >= props.max) {
118
- return;
119
- }
120
- if (props.step !== 0) {
121
- const maxSpaceVal = props.max - inputVal.value;
122
- if (inputVal.value < props.max && maxSpaceVal < props.step) {
123
- inputVal.value += maxSpaceVal;
124
- } else if (inputVal.value < props.max && maxSpaceVal > props.step) {
125
- inputVal.value += props.step;
126
- } else {
127
- inputVal.value += props.step;
128
- }
129
- } else {
130
- inputVal.value += 1;
131
- }
132
- focusVal.value = "active";
133
- ctx.emit("change", inputVal.value);
134
- ctx.emit("update:modelValue", inputVal.value);
135
- };
136
- const subtract = () => {
137
- if (props.disabled) {
138
- return;
139
- }
140
- if (inputVal.value <= props.min) {
141
- return;
142
- }
143
- if (props.step !== 0) {
144
- const minSpaceVal = inputVal.value - props.min;
145
- if (inputVal.value > props.min && minSpaceVal > props.step) {
146
- inputVal.value -= props.step;
147
- } else if (inputVal.value > props.min && minSpaceVal < props.step) {
148
- inputVal.value -= minSpaceVal;
149
- } else {
150
- inputVal.value -= props.step;
151
- }
152
- } else {
153
- inputVal.value -= 1;
154
- }
155
- focusVal.value = "active";
156
- ctx.emit("change", inputVal.value);
157
- ctx.emit("update:modelValue", inputVal.value);
158
- };
159
- const onInput = (val) => {
160
- inputVal.value = parseInt(val.data);
161
- ctx.emit("input", inputVal.value);
162
- ctx.emit("update:modelValue", inputVal.value);
163
- };
164
- const onFocus = ($event) => {
165
- focusVal.value = "active";
166
- ctx.emit("focus", $event);
167
- };
168
- const onBlur = ($event) => {
169
- focusVal.value = "";
170
- ctx.emit("blur", $event);
171
- };
172
- const onChange = ($event) => {
173
- ctx.emit("change", $event.target.value);
174
- };
175
- const onKeydown = ($event) => {
176
- ctx.emit("keydown", $event);
177
- };
178
- return {
179
- inputVal,
180
- focusVal,
181
- isDisabled,
182
- isSize,
183
- add,
184
- subtract,
185
- onInput,
186
- onChange,
187
- onKeydown,
188
- onBlur,
189
- onFocus
190
- };
191
- },
192
- render() {
193
263
  const {
194
- focusVal,
195
- placeholder,
196
- add,
264
+ disabled
265
+ } = toRefs(props);
266
+ const {
267
+ wrapClass,
268
+ customStyle,
269
+ otherAttrs,
270
+ controlButtonsClass,
271
+ inputWrapClass,
272
+ inputInnerClass
273
+ } = useRender(props, ctx);
274
+ const {
275
+ inputRef
276
+ } = useExpose(ctx);
277
+ const {
197
278
  inputVal,
198
- isDisabled,
199
- isSize,
200
- subtract,
279
+ minDisabled,
280
+ maxDisabled,
281
+ onAdd,
282
+ onSubtract,
201
283
  onInput,
202
- onChange,
203
- onKeydown,
204
- onBlur,
205
- onFocus
206
- } = this;
207
- const dInputNum = ["devui-input-number", isDisabled ? "devui-input-disabled" : "", isSize];
208
- return createVNode("div", {
209
- "class": dInputNum
210
- }, [createVNode("div", {
211
- "onBlur": onBlur,
212
- "tabindex": "1",
213
- "class": ["devui-control-buttons", focusVal.value]
284
+ onChange
285
+ } = useEvent(props, ctx, inputRef);
286
+ return () => createVNode("div", mergeProps({
287
+ "class": wrapClass.value
288
+ }, customStyle), [createVNode("div", {
289
+ "class": controlButtonsClass.value
214
290
  }, [createVNode("span", {
215
- "onClick": add
216
- }, [createVNode(Icon, {
217
- "size": "12px",
218
- "name": "chevron-up"
219
- }, null)]), createVNode("span", {
220
- "onClick": subtract
221
- }, [createVNode(Icon, {
222
- "size": "12px",
223
- "name": "chevron-down"
224
- }, null)])]), createVNode("div", {
225
- "class": "devui-input-item"
226
- }, [createVNode("input", {
291
+ "class": ["control-button control-inc", {
292
+ disabled: maxDisabled.value
293
+ }],
294
+ "onClick": onAdd
295
+ }, [createVNode(IncIcon, null, null)]), createVNode("span", {
296
+ "class": ["control-button control-dec", {
297
+ disabled: minDisabled.value
298
+ }],
299
+ "onClick": onSubtract
300
+ }, [createVNode(DecIcon, null, null)])]), createVNode("div", {
301
+ "class": inputWrapClass.value
302
+ }, [createVNode("input", mergeProps({
227
303
  "type": "number",
228
- "value": inputVal,
229
- "placeholder": placeholder,
230
- "disabled": isDisabled,
231
- "class": ["devui-input-style devui-input-box", focusVal.value],
304
+ "ref": inputRef,
305
+ "value": inputVal.value,
306
+ "placeholder": props.placeholder,
307
+ "disabled": disabled.value,
308
+ "class": inputInnerClass.value
309
+ }, otherAttrs, {
232
310
  "onInput": onInput,
233
- "onChange": onChange,
234
- "onFocus": onFocus,
235
- "onBlur": onBlur,
236
- "onKeydown": onKeydown
237
- }, null)])]);
311
+ "onChange": onChange
312
+ }), null)])]);
238
313
  }
239
314
  });
240
- InputNumber.install = function(app) {
241
- app.component(InputNumber.name, InputNumber);
242
- };
243
315
  var index = {
244
316
  title: "InputNumber \u6570\u5B57\u8F93\u5165\u6846",
245
317
  category: "\u6570\u636E\u5F55\u5165",
246
318
  status: "50%",
247
319
  install(app) {
248
- app.use(InputNumber);
320
+ app.component(InputNumber.name, InputNumber);
249
321
  }
250
322
  };
251
323
  export { InputNumber, index as default };
@@ -1 +1 @@
1
- (function(l,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(l=typeof globalThis!="undefined"?globalThis:l||self,n(l.index={},l.Vue))})(this,function(l,n){"use strict";const V={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},step:{type:Number,default:0},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},size:{type:String,default:""},modelValue:{type:Number,default:0},"onUpdate:modelValue":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}};var N="";const h={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var r=n.defineComponent({name:"DIcon",props:h,setup(e){const{name:u,size:t,color:i,classPrefix:o}=n.toRefs(e);return()=>/^((https?):)?\/\//.test(u.value)?n.createVNode("img",{src:u.value,alt:u.value.split("/")[u.value.split("/").length-1],style:{width:t.value,verticalAlign:"text-bottom"}},null):n.createVNode("i",{class:`${o.value} ${o.value}-${u.value}`,style:{fontSize:t.value,color:i.value}},null)}}),d=n.defineComponent({name:"DInputNumber",props:V,emits:["update:modelValue","change","input","focus","blur","keydown"],setup(e,u){const t=n.ref(e.modelValue<e.min?e.min:e.modelValue),i=n.ref(""),o=n.computed(()=>`devui-input-number-${e.size}`),s=n.computed(()=>e.disabled);return{inputVal:t,focusVal:i,isDisabled:s,isSize:o,add:()=>{if(!e.disabled&&!(t.value>=e.max)){if(e.step!==0){const a=e.max-t.value;t.value<e.max&&a<e.step?t.value+=a:(t.value<e.max&&a>e.step,t.value+=e.step)}else t.value+=1;i.value="active",u.emit("change",t.value),u.emit("update:modelValue",t.value)}},subtract:()=>{if(!e.disabled&&!(t.value<=e.min)){if(e.step!==0){const a=t.value-e.min;t.value>e.min&&a>e.step?t.value-=e.step:t.value>e.min&&a<e.step?t.value-=a:t.value-=e.step}else t.value-=1;i.value="active",u.emit("change",t.value),u.emit("update:modelValue",t.value)}},onInput:a=>{t.value=parseInt(a.data),u.emit("input",t.value),u.emit("update:modelValue",t.value)},onChange:a=>{u.emit("change",a.target.value)},onKeydown:a=>{u.emit("keydown",a)},onBlur:a=>{i.value="",u.emit("blur",a)},onFocus:a=>{i.value="active",u.emit("focus",a)}}},render(){const{focusVal:e,placeholder:u,add:t,inputVal:i,isDisabled:o,isSize:s,subtract:m,onInput:f,onChange:v,onKeydown:p,onBlur:c,onFocus:y}=this,b=["devui-input-number",o?"devui-input-disabled":"",s];return n.createVNode("div",{class:b},[n.createVNode("div",{onBlur:c,tabindex:"1",class:["devui-control-buttons",e.value]},[n.createVNode("span",{onClick:t},[n.createVNode(r,{size:"12px",name:"chevron-up"},null)]),n.createVNode("span",{onClick:m},[n.createVNode(r,{size:"12px",name:"chevron-down"},null)])]),n.createVNode("div",{class:"devui-input-item"},[n.createVNode("input",{type:"number",value:i,placeholder:u,disabled:o,class:["devui-input-style devui-input-box",e.value],onInput:f,onChange:v,onFocus:y,onBlur:c,onKeydown:p},null)])])}});d.install=function(e){e.component(d.name,d)};var g={title:"InputNumber \u6570\u5B57\u8F93\u5165\u6846",category:"\u6570\u636E\u5F55\u5165",status:"50%",install(e){e.use(d)}};l.InputNumber=d,l.default=g,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
1
+ var k=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var z=(a,e)=>{var g={};for(var c in a)j.call(a,c)&&e.indexOf(c)<0&&(g[c]=a[c]);if(a!=null&&k)for(var c of k(a))e.indexOf(c)<0&&O.call(a,c)&&(g[c]=a[c]);return g};(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const g={placeholder:{type:String},disabled:{type:Boolean,default:!1},step:{type:Number,default:1},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},size:{type:String,default:""},modelValue:{type:Number},precision:{type:Number}};function c(t,o,r){let s=t;return o&&(s+=`__${o}`),r&&(s+=`--${r}`),s}function P(t,o=!1){const r=o?`.devui-${t}`:`devui-${t}`;return{b:()=>c(r),e:n=>n?c(r,n):"",m:n=>n?c(r,"",n):"",em:(n,m)=>n&&m?c(r,n,m):""}}const D=P("input-number");function F(){return e.createVNode("svg",{class:D.e("icon-arrow"),width:"1em",height:"1em",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z","fill-rule":"nonzero"},null)])])}function M(){return e.createVNode("svg",{class:D.e("icon-arrow"),width:"1em",height:"1em",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z","fill-rule":"nonzero"},null)])])}const C=t=>typeof t=="number",v=t=>t===void 0,$=t=>t===null,b=P("input-number");function A(t,o){const V=o.attrs,{style:r,class:s}=V,d=z(V,["style","class"]),p={style:r},f=e.computed(()=>[{[b.b()]:!0},s]),n=e.computed(()=>({[b.e("control-buttons")]:!0,disabled:t.disabled,[b.m(t.size)]:!0})),m=e.computed(()=>({[b.e("input-wrap")]:!0,[b.m(t.size)]:!0})),N=e.computed(()=>({[b.e("input-box")]:!0,disabled:t.disabled}));return{wrapClass:f,customStyle:p,otherAttrs:d,controlButtonsClass:n,inputWrapClass:m,inputInnerClass:N}}function R(t){const o=e.ref(),r=()=>{o.value.focus()},s=()=>{o.value.blur()},d=()=>{o.value.select()};return t.expose({focus:r,blur:s,select:d}),{inputRef:o}}function L(t){let o=0;if(v(t))return o;const r=t.toString(),s=r.indexOf(".");return s!==-1&&(o=r.length-s-1),o}function _(t,o,r){const{min:s,max:d,step:p,disabled:f}=e.toRefs(t),n=e.reactive({currentValue:t.modelValue||"",userInputValue:void 0}),m=e.computed(()=>v(t.precision)?Math.max(L(t.modelValue),L(p.value)):t.precision),N=e.computed(()=>{if(!v(n.userInputValue))return n.userInputValue;let u=n.currentValue;return u===""||v(u)||Number.isNaN(u)?"":(C(u)&&(u=u.toFixed(m.value)),u)}),V=u=>Number.parseFloat(u.toFixed(m.value)),h=(u,i=1)=>C(u)?V(u+p.value*i):n.currentValue,I=(u,i)=>{if(u===""||v(u)||$(u)||Number.isNaN(u))return;let l=Number(u);return l=V(l),(l>d.value||l<s.value)&&(l=l>d.value?d.value:s.value,i&&o.emit("update:modelValue",l)),l},w=u=>{const i=n.currentValue,l=I(u);i!==l&&(n.userInputValue=void 0,o.emit("update:modelValue",l),o.emit("input",l),o.emit("change",l,i),n.currentValue=l)},y=e.computed(()=>C(n.currentValue)&&h(n.currentValue,-1)<t.min),x=e.computed(()=>C(n.currentValue)&&h(n.currentValue)>t.max),B=()=>{if(f.value||x.value)return;r.value.focus();const u=h(n.currentValue||0);w(u)},T=()=>{if(f.value||y.value)return;r.value.focus();const u=h(n.currentValue||0,-1);w(u)};return e.watch(()=>t.modelValue,u=>{n.currentValue=I(u,!0),n.userInputValue=void 0},{immediate:!0}),{inputVal:N,minDisabled:y,maxDisabled:x,onAdd:B,onSubtract:T,onInput:u=>{const i=u.target.value;n.userInputValue=i},onChange:u=>{const i=u.target.value,l=i!==""?Number(i):"";(C(l)&&!Number.isNaN(l)||i==="")&&w(l),n.userInputValue=void 0}}}var W="",S=e.defineComponent({name:"DInputNumber",props:g,emits:["update:modelValue","change","input"],setup(t,o){const{disabled:r}=e.toRefs(t),{wrapClass:s,customStyle:d,otherAttrs:p,controlButtonsClass:f,inputWrapClass:n,inputInnerClass:m}=A(t,o),{inputRef:N}=R(o),{inputVal:V,minDisabled:h,maxDisabled:I,onAdd:w,onSubtract:y,onInput:x,onChange:B}=_(t,o,N);return()=>e.createVNode("div",e.mergeProps({class:s.value},d),[e.createVNode("div",{class:f.value},[e.createVNode("span",{class:["control-button control-inc",{disabled:I.value}],onClick:w},[e.createVNode(F,null,null)]),e.createVNode("span",{class:["control-button control-dec",{disabled:h.value}],onClick:y},[e.createVNode(M,null,null)])]),e.createVNode("div",{class:n.value},[e.createVNode("input",e.mergeProps({type:"number",ref:N,value:V.value,placeholder:t.placeholder,disabled:r.value,class:m.value},p,{onInput:x,onChange:B}),null)])])}}),E={title:"InputNumber \u6570\u5B57\u8F93\u5165\u6846",category:"\u6570\u636E\u5F55\u5165",status:"50%",install(t){t.component(S.name,S)}};a.InputNumber=S,a.default=E,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
@@ -1 +1 @@
1
- .devui-input-number{position:relative;display:inline-block;width:80px;line-height:38px;margin-right:12px}.devui-input-number:hover:not(.devui-input-disabled) .devui-input-box{border-color:var(--devui-form-control-line-hover)}.devui-input-number:hover:not(.devui-input-disabled) .devui-control-buttons:not(.disabled){display:flex;border-color:var(--devui-form-control-line-hover)}.devui-input-number:focus-within .devui-control-buttons{display:flex}.devui-input-number .active{border:1px solid var(--devui-form-control-line-active)!important;display:flex!important}.devui-input-number.devui-input-disabled .devui-subtract,.devui-input-number.devui-input-disabled .devui-add,.devui-input-number.devui-input-disabled .devui-input-style{cursor:not-allowed;border-color:#e4e7ed;color:#e4e7ed}.devui-input-number.devui-input-disabled .devui-input-style{border-color:var(--devui-disabled-line)!important;color:var(--devui-disabled-text)!important;background-color:var(--devui-disabled-bg)!important}.devui-input-number.devui-input-number-sm{width:60px}.devui-input-number.devui-input-number-sm .devui-input-box{height:26px;line-height:26px}.devui-input-number.devui-input-number-md{width:80px}.devui-input-number.devui-input-number-md .devui-input-box{height:32px;line-height:32px}.devui-input-number.devui-input-number-lg{width:100px}.devui-input-number.devui-input-number-lg .devui-input-box{height:38px;line-height:38px}.devui-input-number .devui-input-item{line-height:100%}.devui-input-number .devui-input-style::-webkit-outer-spin-button,.devui-input-number .devui-input-style::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.devui-input-number .devui-add,.devui-input-number .devui-subtract{display:inline-block;width:50px;height:38px;line-height:38px;text-align:center;font-size:16px;color:#333;background:#f5f7fa;cursor:pointer;border:1px solid #dcdfe6}.devui-input-number .devui-add{float:right;margin-left:-1px;border-radius:0 4px 4px 0}.devui-input-number .devui-subtract{float:left;margin-right:-1px;border-radius:4px 0 0 4px}.devui-input-number .devui-input-style{display:block;-moz-appearance:textfield}.devui-input-number .devui-input-style{outline:none;background-color:var(--devui-base-bg);border:1px solid var(--devui-form-control-line);border-radius:var(--devui-border-radius);padding:4px 8px;line-height:18px;font-size:var(--devui-font-size);color:var(--devui-text);width:100%;display:block;cursor:text;height:28px;transition:border-color .3s var(--devui-animation-ease-in-out-smooth)}.devui-input-number .devui-input-box{box-sizing:border-box;padding:4px 8px;font-size:var(--devui-font-size);vertical-align:middle;border-radius:var(--devui-border-radius);outline:none;width:100%;line-height:20px;height:28px;border-width:1px;border-style:solid}.devui-input-number .devui-input-box:not(.disabled){background-color:var(--devui-base-bg);border-color:var(--devui-line);color:var(--devui-text)}.devui-input-number .disabled{cursor:not-allowed}.devui-input-number .devui-control-buttons{display:none;position:absolute;right:0;width:22px;height:100%;flex-direction:column;justify-content:center;align-items:center;border-left:1px solid var(--devui-line);box-sizing:border-box;line-height:100%;border-radius:0 var(--devui-border-radius) var(--devui-border-radius) 0}.devui-input-number .devui-control-buttons:not(.disabled){cursor:pointer}.devui-input-number .devui-control-buttons>span{display:flex}
1
+ .devui-input-number{position:relative;display:inline-block;width:80px}.devui-input-number:hover .devui-input-number__input-box:not(.disabled){border:1px solid var(--devui-form-control-line-hover, #575d6c);padding-right:24px}.devui-input-number:hover .devui-input-number__control-buttons:not(.disabled){display:flex;border-color:var(--devui-form-control-line-hover, #575d6c)}.devui-input-number:focus-within .devui-input-number__input-box:not(.disabled){border:1px solid var(--devui-form-control-line-active, #5e7ce0);padding-right:24px}.devui-input-number:focus-within .devui-input-number__control-buttons:not(.disabled){display:flex;border-color:var(--devui-form-control-line-active, #5e7ce0)}.devui-input-number.devui-input-number--md{width:80px}.devui-input-number.devui-input-number--md .devui-input-number__input-box{height:32px;line-height:32px}.devui-input-number .devui-input-number__input-box{box-sizing:border-box;padding:4px 8px;font-size:var(--devui-font-size, 14px);border-radius:var(--devui-border-radius, 4px);border:1px solid var(--devui-form-control-line, #d7d8da);outline:none;width:100%;line-height:20px;height:28px;display:block;cursor:text;-moz-appearance:textfield;transition:border-color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-input-number .devui-input-number__input-box:not(.disabled){background-color:var(--devui-base-bg, #ffffff);border-color:var(--devui-line, #d7d8da);color:var(--devui-text, #252b3a)}.devui-input-number .devui-input-number__input-box::-webkit-inner-spin-button,.devui-input-number .devui-input-number__input-box::-webkit-outer-spin-button{-webkit-appearance:none}.devui-input-number .devui-input-number__control-buttons{display:none;position:absolute;right:0;width:22px;height:100%;flex-direction:column;justify-content:center;align-items:center;border:1px solid transparent;border-left-color:var(--devui-line, #d7d8da);box-sizing:border-box;line-height:100%;border-radius:0 var(--devui-border-radius, 4px) var(--devui-border-radius, 4px) 0}.devui-input-number .devui-input-number__control-buttons.disabled{border-left-color:var(--devui-disabled-line, #dfe1e6)}.devui-input-number .devui-input-number__control-buttons .control-button{user-select:none;box-sizing:border-box;height:50%;line-height:50%;border-width:0 1px;transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1));display:flex;justify-content:center;align-items:center;background-color:var(--devui-base-bg, #ffffff)}.devui-input-number .devui-input-number__control-buttons .control-button.control-inc svg{position:relative;top:2px;transform:rotate(180deg)}.devui-input-number .devui-input-number__control-buttons .control-button.control-dec svg{position:relative;bottom:2px}.devui-input-number .devui-input-number__control-buttons .control-button svg path{fill:var(--devui-text-weak, #575d6c)}.devui-input-number .devui-input-number__control-buttons .control-button:not(.disabled){cursor:pointer}.devui-input-number .devui-input-number__control-buttons .control-button:not(.disabled):hover>svg path{fill:var(--devui-icon-fill-active-hover, #252b3a)}.devui-input-number .devui-input-number__control-buttons .control-button.disabled>svg path{fill:var(--devui-disabled-text, #adb0b8)}.devui-input-number .devui-input-number--lg>.devui-input-number__input-box{font-size:var(--devui-font-size-lg, 14px);line-height:24px;height:46px}.devui-input-number .devui-input-number--lg.devui-input-number__control-buttons .control-button .devui-input-number__icon-arrow{width:16px;height:16px}.devui-input-number .devui-input-number--md>.devui-input-number__input-box{font-size:var(--devui-font-size, 14px);line-height:20px;height:28px}.devui-input-number .devui-input-number--sm>.devui-input-number__input-box{font-size:var(--devui-font-size-sm, 12px);line-height:18px;height:26px}.devui-input-number .devui-input-number--sm.devui-input-number__control-buttons .control-button:first-child .devui-input-number__icon-arrow{width:14px;height:14px}.devui-input-number .devui-input-number--sm.devui-input-number__control-buttons .control-button:last-child .devui-input-number__icon-arrow{width:14px;height:14px}.devui-input-number .devui-input-number__input-wrap{line-height:100%}.devui-input-number .disabled{cursor:not-allowed}
@@ -1,4 +1,27 @@
1
1
  import { defineComponent, createVNode } from "vue";
2
+ function createBem(namespace, element, modifier) {
3
+ let cls = namespace;
4
+ if (element) {
5
+ cls += `__${element}`;
6
+ }
7
+ if (modifier) {
8
+ cls += `--${modifier}`;
9
+ }
10
+ return cls;
11
+ }
12
+ function useNamespace(block, needDot = false) {
13
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
14
+ const b = () => createBem(namespace);
15
+ const e = (element) => element ? createBem(namespace, element) : "";
16
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
17
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
18
+ return {
19
+ b,
20
+ e,
21
+ m,
22
+ em
23
+ };
24
+ }
2
25
  var layout = "";
3
26
  var Layout = defineComponent({
4
27
  name: "DLayout",
@@ -6,11 +29,12 @@ var Layout = defineComponent({
6
29
  setup(props, {
7
30
  slots
8
31
  }) {
32
+ const ns = useNamespace("layout");
9
33
  return () => {
10
34
  var _a;
11
35
  const slotDefault = (_a = slots.default) == null ? void 0 : _a.call(slots);
12
- const isAside = slotDefault.some((item) => item.name === "DAside");
13
- const classNames = `${isAside ? "devui-layout-aside " : ""}devui-layout`;
36
+ const isAside = slotDefault.some((item) => item.type.name === "DAside");
37
+ const classNames = `${isAside ? ns.e("aside") : ""} ${ns.b()}`;
14
38
  return createVNode("div", {
15
39
  "class": classNames
16
40
  }, [slotDefault]);
@@ -23,10 +47,11 @@ var Content = defineComponent({
23
47
  setup(props, {
24
48
  slots
25
49
  }) {
50
+ const ns = useNamespace("layout");
26
51
  return () => {
27
52
  var _a;
28
53
  return createVNode("div", {
29
- "class": "devui-content"
54
+ "class": ns.e("content")
30
55
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
31
56
  };
32
57
  }
@@ -37,10 +62,11 @@ var Header = defineComponent({
37
62
  setup(props, {
38
63
  slots
39
64
  }) {
65
+ const ns = useNamespace("layout");
40
66
  return () => {
41
67
  var _a;
42
68
  return createVNode("div", {
43
- "class": "devui-header"
69
+ "class": ns.e("header")
44
70
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
45
71
  };
46
72
  }
@@ -51,10 +77,11 @@ var Footer = defineComponent({
51
77
  setup(props, {
52
78
  slots
53
79
  }) {
80
+ const ns = useNamespace("layout");
54
81
  return () => {
55
82
  var _a;
56
83
  return createVNode("div", {
57
- "class": "devui-footer"
84
+ "class": ns.e("footer")
58
85
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
59
86
  };
60
87
  }
@@ -64,10 +91,11 @@ var Aside = defineComponent({
64
91
  setup(props, {
65
92
  slots
66
93
  }) {
94
+ const ns = useNamespace("layout");
67
95
  return () => {
68
96
  var _a;
69
97
  return createVNode("div", {
70
- "class": "devui-aside"
98
+ "class": ns.em("aside", "inner")
71
99
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
72
100
  };
73
101
  }