@zkwq/business 0.0.1
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.
- package/dist/index.css +1 -0
- package/dist/index.js +21861 -0
- package/dist/index.umd.cjs +46 -0
- package/package.json +27 -0
- package/src/components/base/ui/alert/Alert.vue +94 -0
- package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +77 -0
- package/src/components/base/ui/autocomplete/autocomplete.vue +305 -0
- package/src/components/base/ui/backtop/main.vue +112 -0
- package/src/components/base/ui/button/Button.vue +84 -0
- package/src/components/base/ui/button/ButtonGroup.vue +10 -0
- package/src/components/base/ui/carousel/Carousel.vue +304 -0
- package/src/components/base/ui/carousel/CarouselItem.vue +137 -0
- package/src/components/base/ui/cascader/cascader.vue +650 -0
- package/src/components/base/ui/cascader-panel/cascader-menu.vue +138 -0
- package/src/components/base/ui/cascader-panel/cascader-node.vue +246 -0
- package/src/components/base/ui/cascader-panel/cascader-panel.vue +382 -0
- package/src/components/base/ui/cascader-panel/node.js +166 -0
- package/src/components/base/ui/cascader-panel/store.js +62 -0
- package/src/components/base/ui/checkbox/checkbox-button.vue +199 -0
- package/src/components/base/ui/checkbox/checkbox-group.vue +48 -0
- package/src/components/base/ui/checkbox/checkbox.vue +222 -0
- package/src/components/base/ui/col/col.js +71 -0
- package/src/components/base/ui/collapse/collapse-item.vue +180 -0
- package/src/components/base/ui/collapse/collapse.vue +73 -0
- package/src/components/base/ui/color-picker/color.js +317 -0
- package/src/components/base/ui/color-picker/components/alpha-slider.vue +132 -0
- package/src/components/base/ui/color-picker/components/hue-slider.vue +123 -0
- package/src/components/base/ui/color-picker/components/picker-dropdown.vue +119 -0
- package/src/components/base/ui/color-picker/components/predefine.vue +61 -0
- package/src/components/base/ui/color-picker/components/sv-panel.vue +100 -0
- package/src/components/base/ui/color-picker/draggable.js +36 -0
- package/src/components/base/ui/color-picker/index.js +2 -0
- package/src/components/base/ui/color-picker/main.vue +188 -0
- package/src/components/base/ui/date-picker/basic/date-table.vue +441 -0
- package/src/components/base/ui/date-picker/basic/month-table.vue +254 -0
- package/src/components/base/ui/date-picker/basic/time-spinner.vue +304 -0
- package/src/components/base/ui/date-picker/basic/year-table.vue +101 -0
- package/src/components/base/ui/date-picker/panel/date-range.vue +680 -0
- package/src/components/base/ui/date-picker/panel/date.vue +597 -0
- package/src/components/base/ui/date-picker/panel/month-range.vue +289 -0
- package/src/components/base/ui/date-picker/panel/time-range.vue +248 -0
- package/src/components/base/ui/date-picker/panel/time-select.vue +178 -0
- package/src/components/base/ui/date-picker/panel/time.vue +186 -0
- package/src/components/base/ui/date-picker/picker/date-picker.js +43 -0
- package/src/components/base/ui/date-picker/picker/time-picker.js +39 -0
- package/src/components/base/ui/date-picker/picker/time-select.js +21 -0
- package/src/components/base/ui/date-picker/picker.vue +942 -0
- package/src/components/base/ui/dialog/Index.vue +212 -0
- package/src/components/base/ui/directive/repeat-click.js +24 -0
- package/src/components/base/ui/directive/ripple.js +303 -0
- package/src/components/base/ui/divider/Divider.vue +37 -0
- package/src/components/base/ui/drawer/Drawer.vue +202 -0
- package/src/components/base/ui/dropdown/dropdown-item.vue +39 -0
- package/src/components/base/ui/dropdown/dropdown-menu.vue +63 -0
- package/src/components/base/ui/dropdown/dropdown.vue +308 -0
- package/src/components/base/ui/form/Form.vue +167 -0
- package/src/components/base/ui/form/FormItem.vue +334 -0
- package/src/components/base/ui/form/LabelWrap.vue +69 -0
- package/src/components/base/ui/icon/icon.vue +13 -0
- package/src/components/base/ui/image/image-viewer.vue +302 -0
- package/src/components/base/ui/image/main.vue +248 -0
- package/src/components/base/ui/index.js +189 -0
- package/src/components/base/ui/input/Input.vue +438 -0
- package/src/components/base/ui/input/calcTextareaHeight.js +104 -0
- package/src/components/base/ui/input-number/input-number.vue +285 -0
- package/src/components/base/ui/locale/format.js +32 -0
- package/src/components/base/ui/locale/index.js +48 -0
- package/src/components/base/ui/locale/lang/zh-CN.js +120 -0
- package/src/components/base/ui/menu/menu-item-group.vue +45 -0
- package/src/components/base/ui/menu/menu-item.vue +112 -0
- package/src/components/base/ui/menu/menu-mixin.js +44 -0
- package/src/components/base/ui/menu/menu.vue +312 -0
- package/src/components/base/ui/menu/submenu.vue +408 -0
- package/src/components/base/ui/message/index.js +2 -0
- package/src/components/base/ui/message/main.js +87 -0
- package/src/components/base/ui/message/main.vue +110 -0
- package/src/components/base/ui/message-box/main.js +216 -0
- package/src/components/base/ui/message-box/main.vue +323 -0
- package/src/components/base/ui/mixin/emitter.js +31 -0
- package/src/components/base/ui/mixin/focus.js +9 -0
- package/src/components/base/ui/mixin/locale.js +9 -0
- package/src/components/base/ui/mixin/migrating.js +33 -0
- package/src/components/base/ui/pagination/pager.vue +163 -0
- package/src/components/base/ui/pagination/pagination.jsx +391 -0
- package/src/components/base/ui/popover/directive.js +20 -0
- package/src/components/base/ui/popover/index.js +14 -0
- package/src/components/base/ui/popover/main.vue +236 -0
- package/src/components/base/ui/progress/Progress.vue +227 -0
- package/src/components/base/ui/radio/radio-button.vue +114 -0
- package/src/components/base/ui/radio/radio-group.vue +111 -0
- package/src/components/base/ui/radio/radio.vue +134 -0
- package/src/components/base/ui/row/row.js +47 -0
- package/src/components/base/ui/scrollbar/bar.jsx +91 -0
- package/src/components/base/ui/scrollbar/index.jsx +203 -0
- package/src/components/base/ui/scrollbar/util.js +32 -0
- package/src/components/base/ui/select/Option.vue +168 -0
- package/src/components/base/ui/select/OptionGroup.vue +60 -0
- package/src/components/base/ui/select/Select.vue +920 -0
- package/src/components/base/ui/select/SelectDropdown.vue +74 -0
- package/src/components/base/ui/select/navigation-mixin.js +54 -0
- package/src/components/base/ui/skeleton/index.js +8 -0
- package/src/components/base/ui/skeleton/src/img-placeholder.vue +16 -0
- package/src/components/base/ui/skeleton/src/index.vue +80 -0
- package/src/components/base/ui/skeleton/src/item.vue +22 -0
- package/src/components/base/ui/skeleton-item/index.js +8 -0
- package/src/components/base/ui/slider/button.vue +238 -0
- package/src/components/base/ui/slider/main.vue +427 -0
- package/src/components/base/ui/slider/marker.js +18 -0
- package/src/components/base/ui/style/alert.scss +147 -0
- package/src/components/base/ui/style/animations.scss +65 -0
- package/src/components/base/ui/style/autocomplete.scss +81 -0
- package/src/components/base/ui/style/backtop.scss +20 -0
- package/src/components/base/ui/style/button-group.scss +0 -0
- package/src/components/base/ui/style/button.scss +380 -0
- package/src/components/base/ui/style/carousel-item.scss +50 -0
- package/src/components/base/ui/style/carousel.scss +161 -0
- package/src/components/base/ui/style/cascader-panel.scss +120 -0
- package/src/components/base/ui/style/cascader.scss +185 -0
- package/src/components/base/ui/style/checkbox-button.scss +0 -0
- package/src/components/base/ui/style/checkbox-group.scss +0 -0
- package/src/components/base/ui/style/checkbox.scss +360 -0
- package/src/components/base/ui/style/col.scss +156 -0
- package/src/components/base/ui/style/collapse-item.scss +0 -0
- package/src/components/base/ui/style/collapse.scss +114 -0
- package/src/components/base/ui/style/color-picker.scss +387 -0
- package/src/components/base/ui/style/config.scss +4 -0
- package/src/components/base/ui/style/date-picker/date-picker.scss +97 -0
- package/src/components/base/ui/style/date-picker/date-range-picker.scss +101 -0
- package/src/components/base/ui/style/date-picker/date-table.scss +151 -0
- package/src/components/base/ui/style/date-picker/month-table.scss +82 -0
- package/src/components/base/ui/style/date-picker/picker-panel.scss +117 -0
- package/src/components/base/ui/style/date-picker/picker.scss +197 -0
- package/src/components/base/ui/style/date-picker/time-picker.scss +85 -0
- package/src/components/base/ui/style/date-picker/time-range-picker.scss +31 -0
- package/src/components/base/ui/style/date-picker/time-spinner.scss +110 -0
- package/src/components/base/ui/style/date-picker/year-table.scss +51 -0
- package/src/components/base/ui/style/date-picker.scss +12 -0
- package/src/components/base/ui/style/dialog.scss +123 -0
- package/src/components/base/ui/style/divider.scss +47 -0
- package/src/components/base/ui/style/drawer.scss +218 -0
- package/src/components/base/ui/style/dropdown-item.scss +0 -0
- package/src/components/base/ui/style/dropdown-menu.scss +0 -0
- package/src/components/base/ui/style/dropdown.scss +185 -0
- package/src/components/base/ui/style/form-item.scss +0 -0
- package/src/components/base/ui/style/form.scss +203 -0
- package/src/components/base/ui/style/function.scss +43 -0
- package/src/components/base/ui/style/icon.scss +1167 -0
- package/src/components/base/ui/style/image.scss +184 -0
- package/src/components/base/ui/style/index.scss +57 -0
- package/src/components/base/ui/style/input-number.scss +187 -0
- package/src/components/base/ui/style/input.scss +477 -0
- package/src/components/base/ui/style/menu-item-group.scss +0 -0
- package/src/components/base/ui/style/menu-item.scss +0 -0
- package/src/components/base/ui/style/menu.scss +294 -0
- package/src/components/base/ui/style/message-box.scss +231 -0
- package/src/components/base/ui/style/message.scss +120 -0
- package/src/components/base/ui/style/mixins.scss +196 -0
- package/src/components/base/ui/style/option-group.scss +42 -0
- package/src/components/base/ui/style/option.scss +36 -0
- package/src/components/base/ui/style/pagination.scss +295 -0
- package/src/components/base/ui/style/popover.scss +40 -0
- package/src/components/base/ui/style/popper.scss +102 -0
- package/src/components/base/ui/style/popup.scss +42 -0
- package/src/components/base/ui/style/progress.scss +141 -0
- package/src/components/base/ui/style/radio-button.scss +113 -0
- package/src/components/base/ui/style/radio-group.scss +9 -0
- package/src/components/base/ui/style/radio.scss +203 -0
- package/src/components/base/ui/style/ripple.scss +35 -0
- package/src/components/base/ui/style/row.scss +39 -0
- package/src/components/base/ui/style/scrollbar.scss +75 -0
- package/src/components/base/ui/style/select-dropdown.scss +59 -0
- package/src/components/base/ui/style/select.scss +154 -0
- package/src/components/base/ui/style/skeleton-item.scss +84 -0
- package/src/components/base/ui/style/skeleton.scss +40 -0
- package/src/components/base/ui/style/slider.scss +250 -0
- package/src/components/base/ui/style/switch.scss +116 -0
- package/src/components/base/ui/style/tabs.scss +602 -0
- package/src/components/base/ui/style/tag.scss +174 -0
- package/src/components/base/ui/style/tooltip.scss +146 -0
- package/src/components/base/ui/style/transition.scss +138 -0
- package/src/components/base/ui/style/upload.scss +603 -0
- package/src/components/base/ui/style/utils.scss +39 -0
- package/src/components/base/ui/style/var.scss +1007 -0
- package/src/components/base/ui/switch/index.vue +174 -0
- package/src/components/base/ui/tabs/tab-bar.vue +57 -0
- package/src/components/base/ui/tabs/tab-nav.vue +294 -0
- package/src/components/base/ui/tabs/tab-pane.vue +56 -0
- package/src/components/base/ui/tabs/tabs.vue +191 -0
- package/src/components/base/ui/tag/Tag.vue +60 -0
- package/src/components/base/ui/tooltip/tooltip.jsx +234 -0
- package/src/components/base/ui/upload/Index.vue +340 -0
- package/src/components/base/ui/upload/Upload.vue +216 -0
- package/src/components/base/ui/upload/UploadDragger.vue +70 -0
- package/src/components/base/ui/upload/UploadList.vue +100 -0
- package/src/components/base/ui/upload/ajax.js +85 -0
- package/src/components/base/ui/util/aria-dialog.js +90 -0
- package/src/components/base/ui/util/aria-utils.js +122 -0
- package/src/components/base/ui/util/clickoutside.js +76 -0
- package/src/components/base/ui/util/date-util.js +292 -0
- package/src/components/base/ui/util/date.js +370 -0
- package/src/components/base/ui/util/debounce.js +21 -0
- package/src/components/base/ui/util/deepmerge.js +100 -0
- package/src/components/base/ui/util/dom.js +215 -0
- package/src/components/base/ui/util/index.js +262 -0
- package/src/components/base/ui/util/menu/aria-menubar.js +14 -0
- package/src/components/base/ui/util/menu/aria-menuitem.js +49 -0
- package/src/components/base/ui/util/menu/aria-submenu.js +59 -0
- package/src/components/base/ui/util/merge.js +14 -0
- package/src/components/base/ui/util/popper.js +1235 -0
- package/src/components/base/ui/util/popup/index.js +218 -0
- package/src/components/base/ui/util/popup/popup-manager.js +194 -0
- package/src/components/base/ui/util/resize-events.js +32 -0
- package/src/components/base/ui/util/scroll-into-view.js +27 -0
- package/src/components/base/ui/util/scrollbar-width.js +29 -0
- package/src/components/base/ui/util/shared.js +7 -0
- package/src/components/base/ui/util/throttle.js +91 -0
- package/src/components/base/ui/util/types.js +24 -0
- package/src/components/base/ui/util/vdom.js +5 -0
- package/src/components/base/ui/util/vue-popper.js +188 -0
- package/src/components/normal/AggsItemH.vue +139 -0
- package/src/index.js +10 -0
- package/src/static/base-icons.ttf +0 -0
- package/src/static/base-icons.woff +0 -0
- package/src/static/label_bg.png +0 -0
- package/src/static/term-label-bg.png +0 -0
- package/src/style/app-article.scss +698 -0
- package/src/style/app-comment.scss +259 -0
- package/src/style/app-recommend.scss +48 -0
- package/src/style/app-richtext.scss +176 -0
- package/src/style/index.scss +523 -0
- package/vite.config.js +38 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
let hiddenTextarea;
|
|
2
|
+
|
|
3
|
+
const HIDDEN_STYLE = `
|
|
4
|
+
height:0 !important;
|
|
5
|
+
visibility:hidden !important;
|
|
6
|
+
overflow:hidden !important;
|
|
7
|
+
position:absolute !important;
|
|
8
|
+
z-index:-1000 !important;
|
|
9
|
+
top:0 !important;
|
|
10
|
+
right:0 !important
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const CONTEXT_STYLE = [
|
|
14
|
+
'letter-spacing',
|
|
15
|
+
'line-height',
|
|
16
|
+
'padding-top',
|
|
17
|
+
'padding-bottom',
|
|
18
|
+
'font-family',
|
|
19
|
+
'font-weight',
|
|
20
|
+
'font-size',
|
|
21
|
+
'text-rendering',
|
|
22
|
+
'text-transform',
|
|
23
|
+
'width',
|
|
24
|
+
'text-indent',
|
|
25
|
+
'padding-left',
|
|
26
|
+
'padding-right',
|
|
27
|
+
'border-width',
|
|
28
|
+
'box-sizing'
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
function calculateNodeStyling(targetElement) {
|
|
32
|
+
const style = window.getComputedStyle(targetElement);
|
|
33
|
+
|
|
34
|
+
const boxSizing = style.getPropertyValue('box-sizing');
|
|
35
|
+
|
|
36
|
+
const paddingSize = (
|
|
37
|
+
parseFloat(style.getPropertyValue('padding-bottom')) +
|
|
38
|
+
parseFloat(style.getPropertyValue('padding-top'))
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const borderSize = (
|
|
42
|
+
parseFloat(style.getPropertyValue('border-bottom-width')) +
|
|
43
|
+
parseFloat(style.getPropertyValue('border-top-width'))
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const contextStyle = CONTEXT_STYLE
|
|
47
|
+
.map(name => `${name}:${style.getPropertyValue(name)}`)
|
|
48
|
+
.join(';');
|
|
49
|
+
|
|
50
|
+
return { contextStyle, paddingSize, borderSize, boxSizing };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default function calcTextareaHeight(
|
|
54
|
+
targetElement,
|
|
55
|
+
minRows = 1,
|
|
56
|
+
maxRows = null
|
|
57
|
+
) {
|
|
58
|
+
if (!hiddenTextarea) {
|
|
59
|
+
hiddenTextarea = document.createElement('textarea');
|
|
60
|
+
document.body.appendChild(hiddenTextarea);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let {
|
|
64
|
+
paddingSize,
|
|
65
|
+
borderSize,
|
|
66
|
+
boxSizing,
|
|
67
|
+
contextStyle
|
|
68
|
+
} = calculateNodeStyling(targetElement);
|
|
69
|
+
|
|
70
|
+
hiddenTextarea.setAttribute('style', `${contextStyle};${HIDDEN_STYLE}`);
|
|
71
|
+
hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
|
72
|
+
|
|
73
|
+
let height = hiddenTextarea.scrollHeight;
|
|
74
|
+
const result = {};
|
|
75
|
+
|
|
76
|
+
if (boxSizing === 'border-box') {
|
|
77
|
+
height = height + borderSize;
|
|
78
|
+
} else if (boxSizing === 'content-box') {
|
|
79
|
+
height = height - paddingSize;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
hiddenTextarea.value = '';
|
|
83
|
+
let singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
84
|
+
|
|
85
|
+
if (minRows !== null) {
|
|
86
|
+
let minHeight = singleRowHeight * minRows;
|
|
87
|
+
if (boxSizing === 'border-box') {
|
|
88
|
+
minHeight = minHeight + paddingSize + borderSize;
|
|
89
|
+
}
|
|
90
|
+
height = Math.max(minHeight, height);
|
|
91
|
+
result.minHeight = `${ minHeight }px`;
|
|
92
|
+
}
|
|
93
|
+
if (maxRows !== null) {
|
|
94
|
+
let maxHeight = singleRowHeight * maxRows;
|
|
95
|
+
if (boxSizing === 'border-box') {
|
|
96
|
+
maxHeight = maxHeight + paddingSize + borderSize;
|
|
97
|
+
}
|
|
98
|
+
height = Math.min(maxHeight, height);
|
|
99
|
+
}
|
|
100
|
+
result.height = `${ height }px`;
|
|
101
|
+
hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
|
|
102
|
+
hiddenTextarea = null;
|
|
103
|
+
return result;
|
|
104
|
+
};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
@dragstart.prevent
|
|
4
|
+
:class="[
|
|
5
|
+
'base-input-number',
|
|
6
|
+
inputNumberSize ? 'base-input-number--' + inputNumberSize : '',
|
|
7
|
+
{ 'is-disabled': inputNumberDisabled },
|
|
8
|
+
{ 'is-without-controls': !controls },
|
|
9
|
+
{ 'is-controls-right': controlsAtRight }
|
|
10
|
+
]">
|
|
11
|
+
<span
|
|
12
|
+
class="base-input-number__decrease"
|
|
13
|
+
role="button"
|
|
14
|
+
v-if="controls"
|
|
15
|
+
v-repeat-click="decrease"
|
|
16
|
+
:class="{'is-disabled': minDisabled}"
|
|
17
|
+
@keydown.enter="decrease">
|
|
18
|
+
<i :class="`base-icon-${controlsAtRight ? 'arrow-down' : 'minus'}`"></i>
|
|
19
|
+
</span>
|
|
20
|
+
<span
|
|
21
|
+
class="base-input-number__increase"
|
|
22
|
+
role="button"
|
|
23
|
+
v-if="controls"
|
|
24
|
+
v-repeat-click="increase"
|
|
25
|
+
:class="{'is-disabled': maxDisabled}"
|
|
26
|
+
@keydown.enter="increase">
|
|
27
|
+
<i :class="`base-icon-${controlsAtRight ? 'arrow-up' : 'plus'}`"></i>
|
|
28
|
+
</span>
|
|
29
|
+
<base-input
|
|
30
|
+
ref="input"
|
|
31
|
+
:value="displayValue"
|
|
32
|
+
:placeholder="placeholder"
|
|
33
|
+
:disabled="inputNumberDisabled"
|
|
34
|
+
:size="inputNumberSize"
|
|
35
|
+
:max="max"
|
|
36
|
+
:min="min"
|
|
37
|
+
:name="name"
|
|
38
|
+
:label="label"
|
|
39
|
+
:show-lable="false"
|
|
40
|
+
:ripple="false"
|
|
41
|
+
@keydown.up.native.prevent="increase"
|
|
42
|
+
@keydown.down.native.prevent="decrease"
|
|
43
|
+
@blur="handleBlur"
|
|
44
|
+
@focus="handleFocus"
|
|
45
|
+
@input="handleInput"
|
|
46
|
+
@change="handleInputChange">
|
|
47
|
+
</base-input>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<script>
|
|
51
|
+
import BaseInput from '../input/Input';
|
|
52
|
+
import Focus from '../mixin/focus';
|
|
53
|
+
import RepeatClick from '../directive/repeat-click';
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'BaseInputNumber',
|
|
57
|
+
mixins: [Focus('input')],
|
|
58
|
+
inject: {
|
|
59
|
+
baseForm: {
|
|
60
|
+
default: ''
|
|
61
|
+
},
|
|
62
|
+
elFormItem: {
|
|
63
|
+
default: ''
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
directives: {
|
|
67
|
+
repeatClick: RepeatClick
|
|
68
|
+
},
|
|
69
|
+
components: {
|
|
70
|
+
BaseInput
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
step: {
|
|
74
|
+
type: Number,
|
|
75
|
+
default: 1
|
|
76
|
+
},
|
|
77
|
+
stepStrictly: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
max: {
|
|
82
|
+
type: Number,
|
|
83
|
+
default: Infinity
|
|
84
|
+
},
|
|
85
|
+
min: {
|
|
86
|
+
type: Number,
|
|
87
|
+
default: -Infinity
|
|
88
|
+
},
|
|
89
|
+
value: {},
|
|
90
|
+
disabled: Boolean,
|
|
91
|
+
size: String,
|
|
92
|
+
controls: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true
|
|
95
|
+
},
|
|
96
|
+
controlsPosition: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: ''
|
|
99
|
+
},
|
|
100
|
+
name: String,
|
|
101
|
+
label: String,
|
|
102
|
+
placeholder: String,
|
|
103
|
+
precision: {
|
|
104
|
+
type: Number,
|
|
105
|
+
validator(val) {
|
|
106
|
+
return val >= 0 && val === parseInt(val, 10);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
data() {
|
|
111
|
+
return {
|
|
112
|
+
currentValue: 0,
|
|
113
|
+
userInput: null
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
watch: {
|
|
117
|
+
value: {
|
|
118
|
+
immediate: true,
|
|
119
|
+
handler(value) {
|
|
120
|
+
let newVal = value === undefined ? value : Number(value);
|
|
121
|
+
if (newVal !== undefined) {
|
|
122
|
+
if (isNaN(newVal)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.stepStrictly) {
|
|
127
|
+
const stepPrecision = this.getPrecision(this.step);
|
|
128
|
+
const precisionFactor = Math.pow(10, stepPrecision);
|
|
129
|
+
newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (this.precision !== undefined) {
|
|
133
|
+
newVal = this.toPrecision(newVal, this.precision);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (newVal >= this.max) newVal = this.max;
|
|
137
|
+
if (newVal <= this.min) newVal = this.min;
|
|
138
|
+
this.currentValue = newVal;
|
|
139
|
+
this.userInput = null;
|
|
140
|
+
this.$emit('input', newVal);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
computed: {
|
|
145
|
+
minDisabled() {
|
|
146
|
+
return this._decrease(this.value, this.step) < this.min;
|
|
147
|
+
},
|
|
148
|
+
maxDisabled() {
|
|
149
|
+
return this._increase(this.value, this.step) > this.max;
|
|
150
|
+
},
|
|
151
|
+
numPrecision() {
|
|
152
|
+
const { value, step, getPrecision, precision } = this;
|
|
153
|
+
const stepPrecision = getPrecision(step);
|
|
154
|
+
if (precision !== undefined) {
|
|
155
|
+
if (stepPrecision > precision) {
|
|
156
|
+
console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
|
|
157
|
+
}
|
|
158
|
+
return precision;
|
|
159
|
+
} else {
|
|
160
|
+
return Math.max(getPrecision(value), stepPrecision);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
controlsAtRight() {
|
|
164
|
+
return this.controls && this.controlsPosition === 'right';
|
|
165
|
+
},
|
|
166
|
+
_baseFormItemSize() {
|
|
167
|
+
return (this.elFormItem || {}).baseFormItemSize;
|
|
168
|
+
},
|
|
169
|
+
inputNumberSize() {
|
|
170
|
+
return this.size || this._baseFormItemSize || (this.$ELEMENT || {}).size;
|
|
171
|
+
},
|
|
172
|
+
inputNumberDisabled() {
|
|
173
|
+
return this.disabled || !!(this.elForm || {}).disabled;
|
|
174
|
+
},
|
|
175
|
+
displayValue() {
|
|
176
|
+
if (this.userInput !== null) {
|
|
177
|
+
return this.userInput;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
let currentValue = this.currentValue;
|
|
181
|
+
|
|
182
|
+
if (typeof currentValue === 'number') {
|
|
183
|
+
if (this.stepStrictly) {
|
|
184
|
+
const stepPrecision = this.getPrecision(this.step);
|
|
185
|
+
const precisionFactor = Math.pow(10, stepPrecision);
|
|
186
|
+
currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (this.precision !== undefined) {
|
|
190
|
+
currentValue = currentValue.toFixed(this.precision);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return currentValue;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
methods: {
|
|
198
|
+
toPrecision(num, precision) {
|
|
199
|
+
if (precision === undefined) precision = this.numPrecision;
|
|
200
|
+
return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
|
|
201
|
+
},
|
|
202
|
+
getPrecision(value) {
|
|
203
|
+
if (value === undefined) return 0;
|
|
204
|
+
const valueString = value.toString();
|
|
205
|
+
const dotPosition = valueString.indexOf('.');
|
|
206
|
+
let precision = 0;
|
|
207
|
+
if (dotPosition !== -1) {
|
|
208
|
+
precision = valueString.length - dotPosition - 1;
|
|
209
|
+
}
|
|
210
|
+
return precision;
|
|
211
|
+
},
|
|
212
|
+
_increase(val, step) {
|
|
213
|
+
if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
|
214
|
+
|
|
215
|
+
const precisionFactor = Math.pow(10, this.numPrecision);
|
|
216
|
+
// Solve the accuracy problem of JS decimal calculation by converting the value to integer.
|
|
217
|
+
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
|
|
218
|
+
},
|
|
219
|
+
_decrease(val, step) {
|
|
220
|
+
if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
|
221
|
+
|
|
222
|
+
const precisionFactor = Math.pow(10, this.numPrecision);
|
|
223
|
+
|
|
224
|
+
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
|
|
225
|
+
},
|
|
226
|
+
increase() {
|
|
227
|
+
if (this.inputNumberDisabled || this.maxDisabled) return;
|
|
228
|
+
const value = this.value || 0;
|
|
229
|
+
const newVal = this._increase(value, this.step);
|
|
230
|
+
this.setCurrentValue(newVal);
|
|
231
|
+
},
|
|
232
|
+
decrease() {
|
|
233
|
+
if (this.inputNumberDisabled || this.minDisabled) return;
|
|
234
|
+
const value = this.value || 0;
|
|
235
|
+
const newVal = this._decrease(value, this.step);
|
|
236
|
+
this.setCurrentValue(newVal);
|
|
237
|
+
},
|
|
238
|
+
handleBlur(event) {
|
|
239
|
+
this.$emit('blur', event);
|
|
240
|
+
},
|
|
241
|
+
handleFocus(event) {
|
|
242
|
+
this.$emit('focus', event);
|
|
243
|
+
},
|
|
244
|
+
setCurrentValue(newVal) {
|
|
245
|
+
const oldVal = this.currentValue;
|
|
246
|
+
if (typeof newVal === 'number' && this.precision !== undefined) {
|
|
247
|
+
newVal = this.toPrecision(newVal, this.precision);
|
|
248
|
+
}
|
|
249
|
+
if (newVal >= this.max) newVal = this.max;
|
|
250
|
+
if (newVal <= this.min) newVal = this.min;
|
|
251
|
+
if (oldVal === newVal) return;
|
|
252
|
+
this.userInput = null;
|
|
253
|
+
this.$emit('input', newVal);
|
|
254
|
+
this.$emit('change', newVal, oldVal);
|
|
255
|
+
this.currentValue = newVal;
|
|
256
|
+
},
|
|
257
|
+
handleInput(value) {
|
|
258
|
+
this.userInput = value;
|
|
259
|
+
},
|
|
260
|
+
handleInputChange(value) {
|
|
261
|
+
const newVal = value === '' ? undefined : Number(value);
|
|
262
|
+
if (!isNaN(newVal) || value === '') {
|
|
263
|
+
this.setCurrentValue(newVal);
|
|
264
|
+
}
|
|
265
|
+
this.userInput = null;
|
|
266
|
+
},
|
|
267
|
+
select() {
|
|
268
|
+
this.$refs.input.select();
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
mounted() {
|
|
272
|
+
let innerInput = this.$refs.input.$refs.input;
|
|
273
|
+
innerInput.setAttribute('role', 'spinbutton');
|
|
274
|
+
innerInput.setAttribute('aria-valuemax', this.max);
|
|
275
|
+
innerInput.setAttribute('aria-valuemin', this.min);
|
|
276
|
+
innerInput.setAttribute('aria-valuenow', this.currentValue);
|
|
277
|
+
innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
|
|
278
|
+
},
|
|
279
|
+
updated() {
|
|
280
|
+
if (!this.$refs || !this.$refs.input) return;
|
|
281
|
+
const innerInput = this.$refs.input.$refs.input;
|
|
282
|
+
innerInput.setAttribute('aria-valuenow', this.currentValue);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { hasOwn } from '../util/index'
|
|
2
|
+
|
|
3
|
+
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g
|
|
4
|
+
|
|
5
|
+
export default function(Vue) {
|
|
6
|
+
function template(string, ...args) {
|
|
7
|
+
if (args.length === 1 && typeof args[0] === 'object') {
|
|
8
|
+
args = args[0]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!args || !args.hasOwnProperty) {
|
|
12
|
+
args = {}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return string.replace(RE_NARGS, (match, prefix, i, index) => {
|
|
16
|
+
let result
|
|
17
|
+
|
|
18
|
+
if (string[index - 1] === '{' &&
|
|
19
|
+
string[index + match.length] === '}') {
|
|
20
|
+
return i
|
|
21
|
+
} else {
|
|
22
|
+
result = hasOwn(args, i) ? args[i] : null
|
|
23
|
+
if (result === null || result === undefined) {
|
|
24
|
+
return ''
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
return template
|
|
32
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import defaultLang from './lang/zh-CN'
|
|
2
|
+
import Vue from 'vue'
|
|
3
|
+
import deepmerge from '../util/deepmerge'
|
|
4
|
+
import Format from './format'
|
|
5
|
+
|
|
6
|
+
const format = Format(Vue)
|
|
7
|
+
let lang = defaultLang
|
|
8
|
+
let merged = false
|
|
9
|
+
let i18nHandler = function() {
|
|
10
|
+
const vuei18n = Object.getPrototypeOf(this || Vue).$t
|
|
11
|
+
if (typeof vuei18n === 'function' && !!Vue.locale) {
|
|
12
|
+
if (!merged) {
|
|
13
|
+
merged = true
|
|
14
|
+
Vue.locale(
|
|
15
|
+
Vue.config.lang,
|
|
16
|
+
deepmerge(lang, Vue.locale(Vue.config.lang) || {}, { clone: true })
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
return vuei18n.apply(this, arguments)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const t = function(path, options) {
|
|
24
|
+
let value = i18nHandler.apply(this, arguments)
|
|
25
|
+
if (value !== null && value !== undefined) return value
|
|
26
|
+
|
|
27
|
+
const array = path.split('.')
|
|
28
|
+
let current = lang
|
|
29
|
+
|
|
30
|
+
for (let i = 0, j = array.length; i < j; i++) {
|
|
31
|
+
const property = array[i]
|
|
32
|
+
value = current[property]
|
|
33
|
+
if (i === j - 1) return format(value, options)
|
|
34
|
+
if (!value) return ''
|
|
35
|
+
current = value
|
|
36
|
+
}
|
|
37
|
+
return ''
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const use = function(l) {
|
|
41
|
+
lang = l || lang
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const i18n = function(fn) {
|
|
45
|
+
i18nHandler = fn || i18nHandler
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default { use, t, i18n }
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
base: {
|
|
3
|
+
colorpicker: {
|
|
4
|
+
confirm: '确定',
|
|
5
|
+
clear: '清空'
|
|
6
|
+
},
|
|
7
|
+
datepicker: {
|
|
8
|
+
now: '此刻',
|
|
9
|
+
today: '今天',
|
|
10
|
+
cancel: '取消',
|
|
11
|
+
clear: '清空',
|
|
12
|
+
confirm: '确定',
|
|
13
|
+
selectDate: '选择日期',
|
|
14
|
+
selectTime: '选择时间',
|
|
15
|
+
startDate: '开始日期',
|
|
16
|
+
startTime: '开始时间',
|
|
17
|
+
endDate: '结束日期',
|
|
18
|
+
endTime: '结束时间',
|
|
19
|
+
prevYear: '前一年',
|
|
20
|
+
nextYear: '后一年',
|
|
21
|
+
prevMonth: '上个月',
|
|
22
|
+
nextMonth: '下个月',
|
|
23
|
+
year: '年',
|
|
24
|
+
month1: '1 月',
|
|
25
|
+
month2: '2 月',
|
|
26
|
+
month3: '3 月',
|
|
27
|
+
month4: '4 月',
|
|
28
|
+
month5: '5 月',
|
|
29
|
+
month6: '6 月',
|
|
30
|
+
month7: '7 月',
|
|
31
|
+
month8: '8 月',
|
|
32
|
+
month9: '9 月',
|
|
33
|
+
month10: '10 月',
|
|
34
|
+
month11: '11 月',
|
|
35
|
+
month12: '12 月',
|
|
36
|
+
// week: '周次',
|
|
37
|
+
weeks: {
|
|
38
|
+
sun: '日',
|
|
39
|
+
mon: '一',
|
|
40
|
+
tue: '二',
|
|
41
|
+
wed: '三',
|
|
42
|
+
thu: '四',
|
|
43
|
+
fri: '五',
|
|
44
|
+
sat: '六'
|
|
45
|
+
},
|
|
46
|
+
months: {
|
|
47
|
+
jan: '一月',
|
|
48
|
+
feb: '二月',
|
|
49
|
+
mar: '三月',
|
|
50
|
+
apr: '四月',
|
|
51
|
+
may: '五月',
|
|
52
|
+
jun: '六月',
|
|
53
|
+
jul: '七月',
|
|
54
|
+
aug: '八月',
|
|
55
|
+
sep: '九月',
|
|
56
|
+
oct: '十月',
|
|
57
|
+
nov: '十一月',
|
|
58
|
+
dec: '十二月'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
select: {
|
|
62
|
+
loading: '加载中',
|
|
63
|
+
noMatch: '无匹配数据',
|
|
64
|
+
noData: '无数据',
|
|
65
|
+
placeholder: '请选择'
|
|
66
|
+
},
|
|
67
|
+
cascader: {
|
|
68
|
+
noMatch: '无匹配数据',
|
|
69
|
+
loading: '加载中',
|
|
70
|
+
placeholder: '请选择',
|
|
71
|
+
noData: '暂无数据'
|
|
72
|
+
},
|
|
73
|
+
pagination: {
|
|
74
|
+
goto: '前往',
|
|
75
|
+
pagesize: '条/页',
|
|
76
|
+
total: '共 {total} {unitText}',
|
|
77
|
+
pageClassifier: '页'
|
|
78
|
+
},
|
|
79
|
+
messagebox: {
|
|
80
|
+
title: '提示',
|
|
81
|
+
confirm: '确定',
|
|
82
|
+
cancel: '取消',
|
|
83
|
+
error: '输入的数据不合法!'
|
|
84
|
+
},
|
|
85
|
+
upload: {
|
|
86
|
+
deleteTip: '按 delete 键可删除',
|
|
87
|
+
delete: '删除',
|
|
88
|
+
preview: '查看图片',
|
|
89
|
+
continue: '继续上传'
|
|
90
|
+
},
|
|
91
|
+
table: {
|
|
92
|
+
emptyText: '暂无数据',
|
|
93
|
+
confirmFilter: '筛选',
|
|
94
|
+
resetFilter: '重置',
|
|
95
|
+
clearFilter: '全部',
|
|
96
|
+
sumText: '合计'
|
|
97
|
+
},
|
|
98
|
+
tree: {
|
|
99
|
+
emptyText: '暂无数据'
|
|
100
|
+
},
|
|
101
|
+
transfer: {
|
|
102
|
+
noMatch: '无匹配数据',
|
|
103
|
+
noData: '无数据',
|
|
104
|
+
titles: ['列表 1', '列表 2'],
|
|
105
|
+
filterPlaceholder: '请输入搜索内容',
|
|
106
|
+
noCheckedFormat: '共 {total} 项',
|
|
107
|
+
hasCheckedFormat: '已选 {checked}/{total} 项'
|
|
108
|
+
},
|
|
109
|
+
image: {
|
|
110
|
+
error: '加载失败'
|
|
111
|
+
},
|
|
112
|
+
pageHeader: {
|
|
113
|
+
title: '返回'
|
|
114
|
+
},
|
|
115
|
+
popconfirm: {
|
|
116
|
+
confirmButtonText: '确定',
|
|
117
|
+
cancelButtonText: '取消'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li class="base-menu-item-group">
|
|
3
|
+
<div class="base-menu-item-group__title" :style="{paddingLeft: levelPadding + 'px'}">
|
|
4
|
+
<template v-if="!$slots.title">{{title}}</template>
|
|
5
|
+
<slot v-else name="title"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<ul>
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</ul>
|
|
10
|
+
</li>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'BaseMenuItemGroup',
|
|
15
|
+
|
|
16
|
+
componentName: 'BaseMenuItemGroup',
|
|
17
|
+
|
|
18
|
+
inject: ['rootMenu'],
|
|
19
|
+
props: {
|
|
20
|
+
title: {
|
|
21
|
+
type: String
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
paddingLeft: 20
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
computed: {
|
|
30
|
+
levelPadding() {
|
|
31
|
+
let padding = 20;
|
|
32
|
+
let parent = this.$parent;
|
|
33
|
+
if (this.rootMenu.collapse) return 20;
|
|
34
|
+
while (parent && parent.$options.componentName !== 'BaseMenu') {
|
|
35
|
+
if (parent.$options.componentName === 'BaseSubmenu') {
|
|
36
|
+
padding += 20;
|
|
37
|
+
}
|
|
38
|
+
parent = parent.$parent;
|
|
39
|
+
}
|
|
40
|
+
return padding;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|