vue-devui 1.0.0-rc.0 → 1.0.0-rc.11
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/README.md +78 -116
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8190 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +34 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +63 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8068 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8167 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1048 -1176
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8074 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +11 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7972 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3653 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9170 -596
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +144 -137
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +41 -34
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7802 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10459 -1511
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +344 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7921 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → time-select}/index.d.ts +0 -0
- package/{color-picker → time-select}/index.es.js +4171 -2898
- package/time-select/index.umd.js +27 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/{back-top → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +5198 -1850
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +427 -132
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12064 -15841
- package/vue-devui.umd.js +30 -20
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/dragdrop/index.es.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
const shadowId = "shadow0611";
|
|
2
|
-
function getElementStyle(id, styleName) {
|
|
3
|
-
return document.getElementById(id).currentStyle ? document.getElementById(id).currentStyle[styleName] : window.getComputedStyle(document.getElementById(id), styleName);
|
|
4
|
-
}
|
|
5
|
-
function createShadow(originId) {
|
|
6
|
-
const shadow = document.createElement("div");
|
|
7
|
-
shadow.id = shadowId;
|
|
8
|
-
shadow.style.background = "rgb(206, 215, 255)";
|
|
9
|
-
shadow.style.width = getElementStyle(originId, "width");
|
|
10
|
-
shadow.style.height = "20px";
|
|
11
|
-
return shadow;
|
|
12
|
-
}
|
|
13
|
-
function changeDragState(el, originId, dragStart, drag, dragover, drop, shouldCreateShadow, dragFlag) {
|
|
14
|
-
el.dataset.originId = originId;
|
|
15
|
-
el.dataset.dragStart = dragStart;
|
|
16
|
-
el.dataset.dragover = dragover;
|
|
17
|
-
el.dataset.drop = drop;
|
|
18
|
-
el.dataset.shouldCreateShadow = shouldCreateShadow;
|
|
19
|
-
el.dataset.dragFlag = dragFlag;
|
|
20
|
-
}
|
|
21
|
-
function computeCompareElementHeight(compareElement) {
|
|
22
|
-
return compareElement.getBoundingClientRect().top + Math.floor(compareElement.offsetHeight / 2);
|
|
23
|
-
}
|
|
24
|
-
function createInsertSortableShadow(sortDropArea, mouseObject, originId) {
|
|
25
|
-
const sortDropAreaArr = [...sortDropArea.children];
|
|
26
|
-
if (sortDropAreaArr.length == 0) {
|
|
27
|
-
if (!document.getElementById(shadowId)) {
|
|
28
|
-
const shadowElement = createShadow(originId);
|
|
29
|
-
sortDropArea.appendChild(shadowElement);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
for (let index2 = 0; index2 < sortDropAreaArr.length; index2++) {
|
|
33
|
-
const compareHeight = computeCompareElementHeight(sortDropAreaArr[index2]);
|
|
34
|
-
document.getElementById(shadowId) ? sortDropArea.removeChild(document.getElementById(shadowId)) : null;
|
|
35
|
-
if (index2 == sortDropAreaArr.length - 1) {
|
|
36
|
-
sortDropArea.appendChild(createShadow(originId));
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
if (Math.floor(mouseObject.clientY) <= compareHeight) {
|
|
40
|
-
sortDropArea.insertBefore(createShadow(originId), sortDropAreaArr[index2]);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function insertDragElement(dropAreaContainer, dragId, mouseObject) {
|
|
47
|
-
for (let index2 = 0; index2 < [...dropAreaContainer.children].length; index2++) {
|
|
48
|
-
if (index2 == [...dropAreaContainer.children].length - 1) {
|
|
49
|
-
dropAreaContainer.appendChild(document.getElementById(dragId));
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
if (Math.floor(mouseObject.clientY) <= computeCompareElementHeight([...dropAreaContainer.children][index2])) {
|
|
53
|
-
dropAreaContainer.insertBefore(document.getElementById(dragId), [...dropAreaContainer.children][index2]);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function deleteInsertedSortableShadow(dropSortArea) {
|
|
59
|
-
if (dropSortArea) {
|
|
60
|
-
if (document.getElementById(shadowId)) {
|
|
61
|
-
if (dropSortArea.contains(document.getElementById(shadowId))) {
|
|
62
|
-
dropSortArea.removeChild(document.getElementById(shadowId));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var DraggableDirective = {
|
|
68
|
-
mounted(el, binding) {
|
|
69
|
-
el.setAttribute("draggable", "true");
|
|
70
|
-
el.style.cursor = "grab";
|
|
71
|
-
el.addEventListener("drag", () => {
|
|
72
|
-
changeDragState(el, el.id, "true", "true", "false", "false", "false", "true");
|
|
73
|
-
if (binding.instance.$root.dropElement && document.getElementById(shadowId)) {
|
|
74
|
-
deleteInsertedSortableShadow(binding.instance.$root.dropElement);
|
|
75
|
-
binding.instance.$root.dropElement = null;
|
|
76
|
-
}
|
|
77
|
-
}, false);
|
|
78
|
-
el.addEventListener("dragstart", () => {
|
|
79
|
-
changeDragState(el, el.id, "true", "true", "false", "false", "false", "false");
|
|
80
|
-
binding.instance.$root.identity = el.id;
|
|
81
|
-
el.dataset.dragArea = el.parentNode.className;
|
|
82
|
-
}, false);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var DroppableDirective = {
|
|
86
|
-
mounted(el, binding) {
|
|
87
|
-
el.addEventListener("dragover", (event) => {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
const dragId = binding.instance.$root.identity;
|
|
90
|
-
changeDragState(document.getElementById(dragId), dragId, "true", "false", "true", "false", "false", "false");
|
|
91
|
-
document.getElementById(dragId).dataset.dropArea = [...el.childNodes][1].className;
|
|
92
|
-
}, false);
|
|
93
|
-
el.addEventListener("drop", (event) => {
|
|
94
|
-
event.preventDefault();
|
|
95
|
-
const dragId = binding.instance.$root.identity;
|
|
96
|
-
if (document.getElementById(dragId).dataset.dropArea == document.getElementById(dragId).dataset.dragArea) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const childrenArr = [...Array.from(el.children)[1].children];
|
|
100
|
-
if (childrenArr.length > 0) {
|
|
101
|
-
for (let index2 = 0; index2 < childrenArr.length; index2++) {
|
|
102
|
-
const childrenYRange = childrenArr[index2].getBoundingClientRect().top + childrenArr[index2].offsetHeight / 2;
|
|
103
|
-
if (parseFloat(event.clientY) < parseFloat(childrenYRange)) {
|
|
104
|
-
el.children[1].insertBefore(document.getElementById(dragId), childrenArr[index2]);
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
if (index2 === childrenArr.length - 1) {
|
|
108
|
-
el.children[1].appendChild(document.getElementById(dragId));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
el.childNodes[1].appendChild(document.getElementById(dragId));
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var SortableDirective = {
|
|
118
|
-
mounted(el, binding) {
|
|
119
|
-
el.addEventListener("dragover", function(event) {
|
|
120
|
-
event.preventDefault();
|
|
121
|
-
const targetNode = event.target;
|
|
122
|
-
const dragId = binding.instance.$root.identity;
|
|
123
|
-
if (!binding.instance.$root.dropElement) {
|
|
124
|
-
binding.instance.$root.dropElement = [...el.childNodes][1];
|
|
125
|
-
}
|
|
126
|
-
changeDragState(document.getElementById(binding.instance.$root.identity), binding.instance.$root.identity, "true", "false", "true", "false", "true", "false");
|
|
127
|
-
const { dragover, shouldCreateShadow } = document.getElementById(dragId).dataset;
|
|
128
|
-
if (dragover == "true") {
|
|
129
|
-
if (shouldCreateShadow == "true") {
|
|
130
|
-
createInsertSortableShadow([...targetNode.children][1], event, dragId);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
el.addEventListener("drop", function(event) {
|
|
135
|
-
const dropArea = [...el.childNodes][1];
|
|
136
|
-
const dragId = binding.instance.$root.identity;
|
|
137
|
-
dropArea.removeChild(document.getElementById(shadowId));
|
|
138
|
-
if ([...dropArea.childNodes].length == 0) {
|
|
139
|
-
dropArea.appendChild(document.getElementById(dragId));
|
|
140
|
-
} else {
|
|
141
|
-
insertDragElement(dropArea, dragId, event);
|
|
142
|
-
}
|
|
143
|
-
changeDragState(document.getElementById(dragId), dragId, "false", "false", "false", "true", "false", "false");
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
var index = {
|
|
148
|
-
title: "Dragdrop \u62D6\u62FD",
|
|
149
|
-
category: "\u901A\u7528",
|
|
150
|
-
status: "10%",
|
|
151
|
-
install(app) {
|
|
152
|
-
app.directive("DDraggable", DraggableDirective);
|
|
153
|
-
app.directive("DDroppable", DroppableDirective);
|
|
154
|
-
app.directive("DSortable", SortableDirective);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
export { DraggableDirective, DroppableDirective, SortableDirective, index as default };
|
package/dragdrop/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(l,r){typeof exports=="object"&&typeof module!="undefined"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(l=typeof globalThis!="undefined"?globalThis:l||self,r(l.index={}))})(this,function(l){"use strict";const r="shadow0611";function h(e,t){return document.getElementById(e).currentStyle?document.getElementById(e).currentStyle[t]:window.getComputedStyle(document.getElementById(e),t)}function s(e){const t=document.createElement("div");return t.id=r,t.style.background="rgb(206, 215, 255)",t.style.width=h(e,"width"),t.style.height="20px",t}function i(e,t,a,n,d,o,c,I){e.dataset.originId=t,e.dataset.dragStart=a,e.dataset.dragover=d,e.dataset.drop=o,e.dataset.shouldCreateShadow=c,e.dataset.dragFlag=I}function u(e){return e.getBoundingClientRect().top+Math.floor(e.offsetHeight/2)}function y(e,t,a){const n=[...e.children];if(n.length==0){if(!document.getElementById(r)){const d=s(a);e.appendChild(d)}}else for(let d=0;d<n.length;d++){const o=u(n[d]);if(document.getElementById(r)&&e.removeChild(document.getElementById(r)),d==n.length-1){e.appendChild(s(a));break}if(Math.floor(t.clientY)<=o){e.insertBefore(s(a),n[d]);break}}}function E(e,t,a){for(let n=0;n<[...e.children].length;n++){if(n==[...e.children].length-1){e.appendChild(document.getElementById(t));break}if(Math.floor(a.clientY)<=u([...e.children][n])){e.insertBefore(document.getElementById(t),[...e.children][n]);break}}}function p(e){e&&document.getElementById(r)&&e.contains(document.getElementById(r))&&e.removeChild(document.getElementById(r))}var f={mounted(e,t){e.setAttribute("draggable","true"),e.style.cursor="grab",e.addEventListener("drag",()=>{i(e,e.id,"true","true","false","false","false","true"),t.instance.$root.dropElement&&document.getElementById(r)&&(p(t.instance.$root.dropElement),t.instance.$root.dropElement=null)},!1),e.addEventListener("dragstart",()=>{i(e,e.id,"true","true","false","false","false","false"),t.instance.$root.identity=e.id,e.dataset.dragArea=e.parentNode.className},!1)}},m={mounted(e,t){e.addEventListener("dragover",a=>{a.preventDefault();const n=t.instance.$root.identity;i(document.getElementById(n),n,"true","false","true","false","false","false"),document.getElementById(n).dataset.dropArea=[...e.childNodes][1].className},!1),e.addEventListener("drop",a=>{a.preventDefault();const n=t.instance.$root.identity;if(document.getElementById(n).dataset.dropArea==document.getElementById(n).dataset.dragArea)return;const d=[...Array.from(e.children)[1].children];if(d.length>0)for(let o=0;o<d.length;o++){const c=d[o].getBoundingClientRect().top+d[o].offsetHeight/2;if(parseFloat(a.clientY)<parseFloat(c)){e.children[1].insertBefore(document.getElementById(n),d[o]);break}o===d.length-1&&e.children[1].appendChild(document.getElementById(n))}else e.childNodes[1].appendChild(document.getElementById(n))})}},g={mounted(e,t){e.addEventListener("dragover",function(a){a.preventDefault();const n=a.target,d=t.instance.$root.identity;t.instance.$root.dropElement||(t.instance.$root.dropElement=[...e.childNodes][1]),i(document.getElementById(t.instance.$root.identity),t.instance.$root.identity,"true","false","true","false","true","false");const{dragover:o,shouldCreateShadow:c}=document.getElementById(d).dataset;o=="true"&&c=="true"&&y([...n.children][1],a,d)}),e.addEventListener("drop",function(a){const n=[...e.childNodes][1],d=t.instance.$root.identity;n.removeChild(document.getElementById(r)),[...n.childNodes].length==0?n.appendChild(document.getElementById(d)):E(n,d,a),i(document.getElementById(d),d,"false","false","false","true","false","false")})}},B={title:"Dragdrop \u62D6\u62FD",category:"\u901A\u7528",status:"10%",install(e){e.directive("DDraggable",f),e.directive("DDroppable",m),e.directive("DSortable",g)}};l.DraggableDirective=f,l.DroppableDirective=m,l.SortableDirective=g,l.default=B,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
|
package/dragdrop/package.json
DELETED
package/gantt/index.d.ts
DELETED
package/gantt/index.es.js
DELETED
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
import { defineComponent, toRefs, ref, onMounted, watch, createVNode, withDirectives, resolveComponent, resolveDirective, createTextVNode } from "vue";
|
|
2
|
-
var ganttScale = "";
|
|
3
|
-
var GanttScaleUnit = /* @__PURE__ */ ((GanttScaleUnit2) => {
|
|
4
|
-
GanttScaleUnit2["day"] = "day";
|
|
5
|
-
GanttScaleUnit2["week"] = "week";
|
|
6
|
-
GanttScaleUnit2["month"] = "month";
|
|
7
|
-
return GanttScaleUnit2;
|
|
8
|
-
})(GanttScaleUnit || {});
|
|
9
|
-
const isSameDate = (date, compareDate) => {
|
|
10
|
-
return date.getFullYear() === compareDate.getFullYear() && date.getMonth() === compareDate.getMonth() && date.getDate() === compareDate.getDate();
|
|
11
|
-
};
|
|
12
|
-
const useScaleData = (milestoneList) => {
|
|
13
|
-
const SCALE_START_LABLE_OFFSET = 7;
|
|
14
|
-
const generateDateInfo = (date, index2) => {
|
|
15
|
-
const dateInfo = {
|
|
16
|
-
dayOfMonthLabel: "",
|
|
17
|
-
dayOfWeekLabel: "",
|
|
18
|
-
monthLabel: "",
|
|
19
|
-
yearLabel: "",
|
|
20
|
-
date,
|
|
21
|
-
monthStart: false,
|
|
22
|
-
weekend: false,
|
|
23
|
-
today: false,
|
|
24
|
-
milestone: "",
|
|
25
|
-
highlightStart: false,
|
|
26
|
-
scaleStartVisable: true,
|
|
27
|
-
index: index2
|
|
28
|
-
};
|
|
29
|
-
const dayOfMonth = date.getDate();
|
|
30
|
-
dateInfo.dayOfMonthLabel = dayOfMonth + "";
|
|
31
|
-
if (dayOfMonth === 1) {
|
|
32
|
-
dateInfo.monthStart = true;
|
|
33
|
-
}
|
|
34
|
-
const dayOfWeek = date.getDay();
|
|
35
|
-
dateInfo.dayOfWeekLabel = dayOfWeek + "";
|
|
36
|
-
if (dayOfWeek === 6) {
|
|
37
|
-
dateInfo.weekend = true;
|
|
38
|
-
}
|
|
39
|
-
const month = date.getMonth() + 1;
|
|
40
|
-
dateInfo.monthLabel = month + "";
|
|
41
|
-
const year = date.getFullYear();
|
|
42
|
-
dateInfo.yearLabel = year + "";
|
|
43
|
-
if (isSameDate(date, new Date())) {
|
|
44
|
-
dateInfo.today = true;
|
|
45
|
-
}
|
|
46
|
-
if (new Date(year, month - 1, dayOfMonth + SCALE_START_LABLE_OFFSET).getMonth() > month - 1) {
|
|
47
|
-
dateInfo.scaleStartVisable = false;
|
|
48
|
-
}
|
|
49
|
-
if (milestoneList.value) {
|
|
50
|
-
milestoneList.value.forEach((milestone) => {
|
|
51
|
-
if (milestone.date) {
|
|
52
|
-
if (isSameDate(milestone.date, dateInfo.date)) {
|
|
53
|
-
dateInfo.milestone = milestone.lable;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return dateInfo;
|
|
59
|
-
};
|
|
60
|
-
const getNextDay = (date) => {
|
|
61
|
-
const nextDayDate = date.setDate(date.getDate() + 1);
|
|
62
|
-
return new Date(nextDayDate);
|
|
63
|
-
};
|
|
64
|
-
const generateScaleData = (startDate, endDate) => {
|
|
65
|
-
const scaleData = [];
|
|
66
|
-
let handleDate = startDate;
|
|
67
|
-
let index2 = 0;
|
|
68
|
-
while (!isSameDate(handleDate, endDate)) {
|
|
69
|
-
const dateInfo = generateDateInfo(handleDate, index2);
|
|
70
|
-
scaleData.push(dateInfo);
|
|
71
|
-
handleDate = getNextDay(new Date(handleDate));
|
|
72
|
-
index2++;
|
|
73
|
-
}
|
|
74
|
-
console.log({ scaleData });
|
|
75
|
-
return scaleData;
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
generateScaleData
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
const i18nText = {
|
|
82
|
-
en: {
|
|
83
|
-
today: "today",
|
|
84
|
-
monthsOfYear: [
|
|
85
|
-
"January",
|
|
86
|
-
"February",
|
|
87
|
-
"March",
|
|
88
|
-
"April",
|
|
89
|
-
"May",
|
|
90
|
-
"June",
|
|
91
|
-
"July",
|
|
92
|
-
"August",
|
|
93
|
-
"September",
|
|
94
|
-
"October",
|
|
95
|
-
"November",
|
|
96
|
-
"December"
|
|
97
|
-
],
|
|
98
|
-
yearDisplay(year) {
|
|
99
|
-
return `${year}`;
|
|
100
|
-
},
|
|
101
|
-
monthDisplay(strMonthIndex) {
|
|
102
|
-
return this.monthsOfYear[Number(strMonthIndex) - 1];
|
|
103
|
-
},
|
|
104
|
-
yearAndMonthDisplay(year, strMonthIndex) {
|
|
105
|
-
return this.yearDisplay(year) + this.monthDisplay(strMonthIndex);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
zh: {
|
|
109
|
-
today: "\u4ECA\u5929",
|
|
110
|
-
monthsOfYear: [
|
|
111
|
-
"1\u6708",
|
|
112
|
-
"2\u6708",
|
|
113
|
-
"3\u6708",
|
|
114
|
-
"4\u6708",
|
|
115
|
-
"5\u6708",
|
|
116
|
-
"6\u6708",
|
|
117
|
-
"7\u6708",
|
|
118
|
-
"8\u6708",
|
|
119
|
-
"9\u6708",
|
|
120
|
-
"10\u6708",
|
|
121
|
-
"11\u6708",
|
|
122
|
-
"12\u6708"
|
|
123
|
-
],
|
|
124
|
-
yearDisplay(year) {
|
|
125
|
-
return `${year}\u5E74`;
|
|
126
|
-
},
|
|
127
|
-
monthDisplay(strMonthIndex) {
|
|
128
|
-
return this.monthsOfYear[Number(strMonthIndex) - 1];
|
|
129
|
-
},
|
|
130
|
-
yearAndMonthDisplay(year, strMonthIndex) {
|
|
131
|
-
return this.yearDisplay(year) + this.monthDisplay(strMonthIndex);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
var DGanttScale = defineComponent({
|
|
136
|
-
name: "DGanttScale",
|
|
137
|
-
props: {
|
|
138
|
-
unit: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: GanttScaleUnit.day
|
|
141
|
-
},
|
|
142
|
-
height: {
|
|
143
|
-
type: Number
|
|
144
|
-
},
|
|
145
|
-
startDate: {
|
|
146
|
-
type: Date
|
|
147
|
-
},
|
|
148
|
-
endDate: {
|
|
149
|
-
type: Date
|
|
150
|
-
},
|
|
151
|
-
ganttScaleContainerOffsetLeft: {
|
|
152
|
-
type: Number
|
|
153
|
-
},
|
|
154
|
-
milestoneList: {
|
|
155
|
-
type: Array
|
|
156
|
-
},
|
|
157
|
-
scrollElement: {
|
|
158
|
-
type: Object
|
|
159
|
-
},
|
|
160
|
-
ganttBarContainerElement: {
|
|
161
|
-
type: Object
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
emits: ["addMilestone"],
|
|
165
|
-
setup(props, ctx) {
|
|
166
|
-
const {
|
|
167
|
-
startDate,
|
|
168
|
-
endDate,
|
|
169
|
-
milestoneList,
|
|
170
|
-
scrollElement,
|
|
171
|
-
unit
|
|
172
|
-
} = toRefs(props);
|
|
173
|
-
const scaleData = ref([]);
|
|
174
|
-
const viewSCaleData = ref([]);
|
|
175
|
-
const scaleWidth = ref({
|
|
176
|
-
day: 40,
|
|
177
|
-
week: 30,
|
|
178
|
-
month: 20
|
|
179
|
-
});
|
|
180
|
-
const highlight = ref(false);
|
|
181
|
-
const highlightStartText = ref("");
|
|
182
|
-
const highlightEndText = ref("");
|
|
183
|
-
const {
|
|
184
|
-
generateScaleData
|
|
185
|
-
} = useScaleData(milestoneList);
|
|
186
|
-
let viewScaleRange = [0, 0];
|
|
187
|
-
const addMilestone = (info) => {
|
|
188
|
-
ctx.emit("addMilestone", info);
|
|
189
|
-
};
|
|
190
|
-
const getViewScaleData = () => {
|
|
191
|
-
if (scrollElement.value) {
|
|
192
|
-
const containerWidth = scrollElement.value.clientWidth;
|
|
193
|
-
const scrollLeft = scrollElement.value.scrollLeft;
|
|
194
|
-
const start = Math.floor(scrollLeft / scaleWidth.value[unit.value]);
|
|
195
|
-
const offset = Math.ceil(containerWidth / scaleWidth.value[unit.value]);
|
|
196
|
-
viewScaleRange = [start - 2, start + offset + 2];
|
|
197
|
-
viewSCaleData.value = scaleData.value.filter((i) => {
|
|
198
|
-
return i.index >= viewScaleRange[0] && i.index <= viewScaleRange[1];
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
onMounted(() => {
|
|
203
|
-
if (startDate.value && endDate.value) {
|
|
204
|
-
scaleData.value = generateScaleData(startDate.value, endDate.value);
|
|
205
|
-
getViewScaleData();
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
watch(() => props.scrollElement, () => {
|
|
209
|
-
getViewScaleData();
|
|
210
|
-
props.scrollElement.addEventListener("scroll", () => {
|
|
211
|
-
getViewScaleData();
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
return {
|
|
215
|
-
viewSCaleData,
|
|
216
|
-
scaleWidth,
|
|
217
|
-
addMilestone,
|
|
218
|
-
highlight,
|
|
219
|
-
highlightStartText,
|
|
220
|
-
highlightEndText
|
|
221
|
-
};
|
|
222
|
-
},
|
|
223
|
-
render() {
|
|
224
|
-
const {
|
|
225
|
-
unit,
|
|
226
|
-
viewSCaleData,
|
|
227
|
-
scaleWidth,
|
|
228
|
-
addMilestone,
|
|
229
|
-
highlight,
|
|
230
|
-
highlightStartText,
|
|
231
|
-
highlightEndText,
|
|
232
|
-
ganttBarContainerElement
|
|
233
|
-
} = this;
|
|
234
|
-
return createVNode("div", {
|
|
235
|
-
"class": "devui-gantt-scale-wrapper"
|
|
236
|
-
}, [viewSCaleData.map((data, index2) => withDirectives(createVNode("div", {
|
|
237
|
-
"class": `devui-gantt-scale ${unit} ${data.today} ${data.milestone}`,
|
|
238
|
-
"style": {
|
|
239
|
-
left: `${scaleWidth[unit] * data.index}px`,
|
|
240
|
-
width: `${scaleWidth[unit]}px`
|
|
241
|
-
}
|
|
242
|
-
}, [createVNode("div", {
|
|
243
|
-
"class": `devui-scale-start ${data.milestone}`
|
|
244
|
-
}, [data.milestone && unit === "day" && createVNode("div", null, [data.milestone]), (!data.milestone || unit !== "day") && data.scaleStartVisable && (index2 === 0 || data.monthStart) ? unit === "month" ? i18nText.zh.yearDisplay(data.yearLabel) : i18nText.zh.yearAndMonthDisplay(data.yearLabel, data.monthLabel) : ""]), createVNode("div", {
|
|
245
|
-
"class": "devui-scale-unit"
|
|
246
|
-
}, [highlight && data.highlightStart && createVNode("div", {
|
|
247
|
-
"class": "scale-highlight"
|
|
248
|
-
}, [createVNode("div", {
|
|
249
|
-
"style": "float: left"
|
|
250
|
-
}, [highlightStartText]), createVNode("div", {
|
|
251
|
-
"style": "float: right"
|
|
252
|
-
}, [highlightEndText]), createVNode("div", {
|
|
253
|
-
"style": "clear: both"
|
|
254
|
-
}, null)]), (!highlight || !data.highlightStart) && unit === "day" && createVNode("div", {
|
|
255
|
-
"class": `border-left ${data.today ? "today" : ""}`
|
|
256
|
-
}, [data.today ? i18nText.zh.today : data.dayOfMonthLabel]), (!highlight || !data.highlightStart) && unit === "week" && createVNode("div", {
|
|
257
|
-
"class": `${data.weekend || index2 === 0 ? "border-left" : ""}`
|
|
258
|
-
}, [index2 === 0 || data.weekend ? data.dayOfMonthLabel : ""]), (!highlight || !data.highlightStart) && unit === "month" && createVNode("div", {
|
|
259
|
-
"class": `${data.monthStart || index2 === 0 ? "border-left" : ""}`
|
|
260
|
-
}, [index2 === 0 || data.monthStart ? i18nText.zh.monthDisplay(data.monthLabel) : ""])]), createVNode("div", {
|
|
261
|
-
"class": `milestone-new ${unit}`,
|
|
262
|
-
"title": "milestone",
|
|
263
|
-
"onClick": () => addMilestone(data)
|
|
264
|
-
}, [createVNode(resolveComponent("d-icon"), {
|
|
265
|
-
"name": "add"
|
|
266
|
-
}, null)])]), [[resolveDirective("gantt-marker"), {
|
|
267
|
-
ganttBarContainerElement,
|
|
268
|
-
monthMark: data.monthMark,
|
|
269
|
-
weekend: data.weekend,
|
|
270
|
-
milestone: data.milestone,
|
|
271
|
-
today: data.today,
|
|
272
|
-
date: data.date,
|
|
273
|
-
unit,
|
|
274
|
-
last: index2 === viewSCaleData.length - 1
|
|
275
|
-
}]]))]);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
var ganttTools = "";
|
|
279
|
-
var GanttTools = defineComponent({
|
|
280
|
-
name: "DGanttTools",
|
|
281
|
-
props: {
|
|
282
|
-
unit: {
|
|
283
|
-
type: String,
|
|
284
|
-
default: null
|
|
285
|
-
},
|
|
286
|
-
isFullScreen: {
|
|
287
|
-
type: Boolean,
|
|
288
|
-
default: false
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
emits: ["goToday", "reduceUnit", "increaseUnit", "switchView"],
|
|
292
|
-
setup(props, ctx) {
|
|
293
|
-
const currentUnitLabel = ref(props.unit);
|
|
294
|
-
const views = ref([{
|
|
295
|
-
name: "Day",
|
|
296
|
-
value: "day"
|
|
297
|
-
}, {
|
|
298
|
-
name: "Week",
|
|
299
|
-
value: "week"
|
|
300
|
-
}, {
|
|
301
|
-
name: "Month",
|
|
302
|
-
value: "month"
|
|
303
|
-
}]);
|
|
304
|
-
const actionHandle = (type) => {
|
|
305
|
-
switch (type) {
|
|
306
|
-
case "today":
|
|
307
|
-
ctx.emit("goToday");
|
|
308
|
-
break;
|
|
309
|
-
case "reduce":
|
|
310
|
-
ctx.emit("reduceUnit");
|
|
311
|
-
break;
|
|
312
|
-
case "increase":
|
|
313
|
-
ctx.emit("increaseUnit");
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
const selectView = (selectItem) => {
|
|
318
|
-
ctx.emit("switchView", selectItem.value);
|
|
319
|
-
};
|
|
320
|
-
return {
|
|
321
|
-
actionHandle,
|
|
322
|
-
currentUnitLabel,
|
|
323
|
-
views,
|
|
324
|
-
selectView
|
|
325
|
-
};
|
|
326
|
-
},
|
|
327
|
-
render() {
|
|
328
|
-
const {
|
|
329
|
-
isFullScreen,
|
|
330
|
-
actionHandle,
|
|
331
|
-
views,
|
|
332
|
-
selectView,
|
|
333
|
-
$slots
|
|
334
|
-
} = this;
|
|
335
|
-
return createVNode("div", {
|
|
336
|
-
"class": "tools-container",
|
|
337
|
-
"style": {
|
|
338
|
-
position: isFullScreen ? "fixed" : "absolute"
|
|
339
|
-
}
|
|
340
|
-
}, [createVNode(resolveComponent("d-button"), {
|
|
341
|
-
"variant": "common",
|
|
342
|
-
"onClick": () => actionHandle("today"),
|
|
343
|
-
"class": "tool"
|
|
344
|
-
}, {
|
|
345
|
-
default: () => [createTextVNode("Today")]
|
|
346
|
-
}), createVNode("div", {
|
|
347
|
-
"class": "tool"
|
|
348
|
-
}, [createVNode(resolveComponent("d-select"), {
|
|
349
|
-
"modelValue": this.currentUnitLabel,
|
|
350
|
-
"onUpdate:modelValue": ($event) => this.currentUnitLabel = $event,
|
|
351
|
-
"options": views,
|
|
352
|
-
"onValueChange": selectView
|
|
353
|
-
}, null)]), createVNode(resolveComponent("d-button"), {
|
|
354
|
-
"variant": "common",
|
|
355
|
-
"class": ["tool", "minus", this.currentUnitLabel === GanttScaleUnit.day ? "disabled" : ""],
|
|
356
|
-
"disabled": this.currentUnitLabel === GanttScaleUnit.day,
|
|
357
|
-
"onClick": () => actionHandle("reduce")
|
|
358
|
-
}, {
|
|
359
|
-
default: () => [createVNode(resolveComponent("d-icon"), {
|
|
360
|
-
"name": "minus"
|
|
361
|
-
}, null)]
|
|
362
|
-
}), createVNode(resolveComponent("d-button"), {
|
|
363
|
-
"variant": "common",
|
|
364
|
-
"class": ["tool", "add", this.currentUnitLabel === GanttScaleUnit.month ? "disabled" : ""],
|
|
365
|
-
"disabled": this.currentUnitLabel === GanttScaleUnit.month,
|
|
366
|
-
"onClick": () => actionHandle("increase")
|
|
367
|
-
}, {
|
|
368
|
-
default: () => [createVNode(resolveComponent("d-icon"), {
|
|
369
|
-
"name": "add"
|
|
370
|
-
}, null)]
|
|
371
|
-
}), $slots.default && $slots.default()]);
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
const ganttProps = {
|
|
375
|
-
startDate: {
|
|
376
|
-
type: Date
|
|
377
|
-
},
|
|
378
|
-
endDate: {
|
|
379
|
-
type: Date
|
|
380
|
-
},
|
|
381
|
-
unit: {
|
|
382
|
-
type: String,
|
|
383
|
-
default: GanttScaleUnit.day
|
|
384
|
-
},
|
|
385
|
-
progressRate: {
|
|
386
|
-
type: Number
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
var gantt = "";
|
|
390
|
-
const useGantt = (scaleUnit = GanttScaleUnit.day) => {
|
|
391
|
-
const DAY_DURATION = 24 * 60 * 60 * 1e3;
|
|
392
|
-
const getScaleUnitPixel = () => {
|
|
393
|
-
switch (scaleUnit) {
|
|
394
|
-
case GanttScaleUnit.day:
|
|
395
|
-
return 40;
|
|
396
|
-
case GanttScaleUnit.week:
|
|
397
|
-
return 30;
|
|
398
|
-
case GanttScaleUnit.month:
|
|
399
|
-
return 20;
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
const getDuration = (startDate, endDate) => {
|
|
403
|
-
if (startDate && endDate) {
|
|
404
|
-
const timeOffset = endDate.getTime() - startDate.getTime();
|
|
405
|
-
const duration = timeOffset / DAY_DURATION + 1;
|
|
406
|
-
console.log("duration => ", duration);
|
|
407
|
-
return Math.round(duration);
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
const getDurationWidth = (startDate, endDate) => {
|
|
411
|
-
if (startDate && endDate) {
|
|
412
|
-
const duration = getDuration(startDate, endDate);
|
|
413
|
-
return duration * getScaleUnitPixel();
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
return {
|
|
417
|
-
getDurationWidth
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
var Gantt = defineComponent({
|
|
421
|
-
name: "DGantt",
|
|
422
|
-
components: {
|
|
423
|
-
DGanttScale,
|
|
424
|
-
DGanttTools: GanttTools
|
|
425
|
-
},
|
|
426
|
-
props: ganttProps,
|
|
427
|
-
setup(props, ctx) {
|
|
428
|
-
const {
|
|
429
|
-
startDate,
|
|
430
|
-
endDate
|
|
431
|
-
} = toRefs(props);
|
|
432
|
-
const ganttContainer = ref();
|
|
433
|
-
const ganttScaleWidth = ref();
|
|
434
|
-
const {
|
|
435
|
-
getDurationWidth
|
|
436
|
-
} = useGantt();
|
|
437
|
-
onMounted(() => {
|
|
438
|
-
ganttScaleWidth.value = getDurationWidth(startDate.value, endDate.value);
|
|
439
|
-
});
|
|
440
|
-
return {
|
|
441
|
-
ganttContainer,
|
|
442
|
-
ganttScaleWidth
|
|
443
|
-
};
|
|
444
|
-
},
|
|
445
|
-
render() {
|
|
446
|
-
const {
|
|
447
|
-
$slots,
|
|
448
|
-
startDate,
|
|
449
|
-
endDate,
|
|
450
|
-
unit,
|
|
451
|
-
ganttContainer,
|
|
452
|
-
ganttScaleWidth
|
|
453
|
-
} = this;
|
|
454
|
-
return createVNode("div", {
|
|
455
|
-
"style": {
|
|
456
|
-
position: "relative"
|
|
457
|
-
}
|
|
458
|
-
}, [createVNode("div", {
|
|
459
|
-
"class": "devui-gantt gantt-container",
|
|
460
|
-
"ref": "ganttContainer"
|
|
461
|
-
}, [createVNode("div", {
|
|
462
|
-
"class": "header",
|
|
463
|
-
"style": {
|
|
464
|
-
width: `${ganttScaleWidth}px`
|
|
465
|
-
}
|
|
466
|
-
}, [createVNode(resolveComponent("d-gantt-scale"), {
|
|
467
|
-
"startDate": startDate,
|
|
468
|
-
"endDate": endDate,
|
|
469
|
-
"unit": unit,
|
|
470
|
-
"scrollElement": ganttContainer
|
|
471
|
-
}, null)]), createVNode(resolveComponent("d-gantt-tools"), {
|
|
472
|
-
"unit": unit
|
|
473
|
-
}, null), createVNode("div", {
|
|
474
|
-
"class": "body",
|
|
475
|
-
"style": {
|
|
476
|
-
width: `${ganttScaleWidth}px`
|
|
477
|
-
}
|
|
478
|
-
}, null)])]);
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
const ganttMarkerDirective = {
|
|
482
|
-
ganttBarContainerElement: null,
|
|
483
|
-
monthMarkElement: null,
|
|
484
|
-
weekendElement: null,
|
|
485
|
-
todayElement: null,
|
|
486
|
-
milestoneElement: null,
|
|
487
|
-
monthMark: "",
|
|
488
|
-
mounted(el, binding) {
|
|
489
|
-
const { ganttBarContainerElement, monthMark } = binding.value;
|
|
490
|
-
if (ganttBarContainerElement) {
|
|
491
|
-
this.ganttBarContainerElement = ganttBarContainerElement;
|
|
492
|
-
}
|
|
493
|
-
if (monthMark) {
|
|
494
|
-
this.monthMark = this.monthMark;
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
updated(el, binding) {
|
|
498
|
-
const { monthMark, weekend, today, milestone, unit } = binding.value;
|
|
499
|
-
if (monthMark) {
|
|
500
|
-
this.initMarkElement();
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
initMarkElement() {
|
|
504
|
-
if (this.ganttBarContainerElement) {
|
|
505
|
-
if (this.monthMark && !this.monthMarkElement)
|
|
506
|
-
;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
Gantt.install = function(app) {
|
|
511
|
-
app.component(Gantt.name, Gantt);
|
|
512
|
-
app.component(GanttTools.name, GanttTools);
|
|
513
|
-
app.directive("gantt-marker", ganttMarkerDirective);
|
|
514
|
-
};
|
|
515
|
-
var index = {
|
|
516
|
-
title: "Gantt \u7518\u7279\u56FE",
|
|
517
|
-
category: "\u6570\u636E\u5C55\u793A",
|
|
518
|
-
status: "10%",
|
|
519
|
-
install(app) {
|
|
520
|
-
app.use(Gantt);
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
export { Gantt, index as default };
|