@opentiny/vue-renderless 3.10.7 → 3.11.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.
- package/action-menu/index.js +1 -1
- package/action-menu/vue.js +7 -9
- package/action-sheet/index.js +4 -1
- package/action-sheet/vue.js +1 -1
- package/alert/index.js +1 -1
- package/alert/vue.js +1 -1
- package/amount/index.js +1 -1
- package/amount/vue.js +1 -1
- package/anchor/index.js +39 -28
- package/anchor/vue.js +38 -10
- package/area/index.js +1 -1
- package/area/vue.js +1 -1
- package/async-flowchart/index.js +66 -0
- package/async-flowchart/vue.js +40 -0
- package/autocomplete/index.js +1 -1
- package/autocomplete/vue.js +1 -1
- package/autonavi-map/index.js +1 -1
- package/avatar/index.js +1 -1
- package/avatar/vue.js +1 -1
- package/badge/index.js +1 -1
- package/badge/vue.js +1 -1
- package/baidu-map/index.js +1 -1
- package/breadcrumb/index.js +2 -2
- package/breadcrumb/vue.js +2 -1
- package/breadcrumb-item/index.js +1 -1
- package/breadcrumb-item/vue.js +1 -1
- package/bulletin-board/index.js +1 -1
- package/bulletin-board/vue.js +1 -1
- package/button/index.js +2 -2
- package/button/vue.js +2 -2
- package/button-group/index.js +2 -2
- package/button-group/vue.js +1 -1
- package/calendar/index.js +15 -15
- package/calendar/vue.js +1 -1
- package/calendar-bar/index.js +4 -4
- package/calendar-bar/vue.js +1 -1
- package/calendar-view/index.js +600 -0
- package/calendar-view/vue.js +289 -0
- package/card/index.js +1 -1
- package/card/vue.js +1 -1
- package/card-group/index.js +1 -1
- package/card-group/vue.js +1 -1
- package/card-template/index.js +1 -1
- package/card-template/vue.js +1 -1
- package/carousel/index.js +1 -1
- package/carousel/vue.js +1 -1
- package/carousel-item/index.js +1 -1
- package/carousel-item/vue.js +1 -1
- package/cascader/index.js +3 -5
- package/cascader/vue.js +2 -1
- package/cascader-menu/index.js +11 -3
- package/cascader-menu/vue.js +1 -1
- package/cascader-mobile/index.js +1 -1
- package/cascader-mobile/vue.js +1 -1
- package/cascader-node/index.js +2 -2
- package/cascader-node/vue.js +1 -1
- package/cascader-panel/index.js +22 -17
- package/cascader-panel/node.js +14 -5
- package/cascader-panel/store.js +18 -1
- package/cascader-panel/vue.js +16 -3
- package/cascader-select/index.js +1 -1
- package/cascader-select/vue.js +1 -1
- package/cell/vue.js +1 -1
- package/chart-bar/index.js +1 -1
- package/chart-boxplot/index.js +2 -1
- package/chart-candle/index.js +1 -1
- package/chart-core/deps/constants.js +1 -1
- package/chart-core/deps/numerify.js +1 -1
- package/chart-core/deps/utils.js +1 -1
- package/chart-core/index.js +1 -1
- package/chart-core/modules/animation.js +1 -1
- package/chart-core/modules/extend.js +1 -1
- package/chart-core/modules/mark.js +1 -1
- package/chart-core/vue.js +1 -1
- package/chart-funnel/index.js +1 -1
- package/chart-gauge/index.js +1 -1
- package/chart-graph/index.js +1 -1
- package/chart-heatmap/index.js +1 -1
- package/chart-line/index.js +1 -1
- package/chart-liquidfill/index.js +1 -1
- package/chart-map/index.js +1 -1
- package/chart-pie/index.js +1 -1
- package/chart-radar/index.js +1 -1
- package/chart-sankey/index.js +1 -1
- package/chart-scatter/index.js +1 -1
- package/chart-sunburst/index.js +1 -1
- package/chart-tree/index.js +1 -1
- package/chart-waterfall/index.js +1 -1
- package/chart-wordcloud/index.js +1 -1
- package/checkbox/index.js +23 -6
- package/checkbox/vue.js +15 -2
- package/checkbox-button/index.js +1 -1
- package/checkbox-button/vue.js +1 -1
- package/checkbox-group/index.js +1 -1
- package/checkbox-group/vue.js +1 -1
- package/col/index.js +8 -7
- package/col/vue.js +1 -1
- package/collapse/index.js +1 -1
- package/collapse/vue.js +2 -2
- package/collapse-item/index.js +1 -1
- package/collapse-item/vue.js +1 -1
- package/color-picker/alpha-select/index.js +24 -0
- package/color-picker/alpha-select/vue.js +58 -0
- package/color-picker/color-select/index.js +73 -0
- package/color-picker/color-select/vue.js +67 -0
- package/color-picker/index.js +52 -0
- package/color-picker/utils/color.js +96 -0
- package/color-picker/utils/use-drag.js +38 -0
- package/color-picker/vue.js +63 -0
- package/color-select-panel/alpha-select/index.js +24 -0
- package/color-select-panel/alpha-select/vue.js +59 -0
- package/color-select-panel/hue-select/index.js +73 -0
- package/color-select-panel/hue-select/vue.js +67 -0
- package/color-select-panel/index.js +74 -0
- package/color-select-panel/utils/color.js +97 -0
- package/color-select-panel/utils/use-drag.js +38 -0
- package/color-select-panel/vue.js +92 -0
- package/column-list-group/vue.js +1 -1
- package/column-list-item/index.js +1 -1
- package/column-list-item/vue.js +1 -1
- package/common/array.js +1 -1
- package/common/bigInt.js +12 -3
- package/common/browser.js +1 -1
- package/common/calendar/calendar.js +97 -0
- package/common/dataset/index.js +1 -1
- package/common/date.js +3 -3
- package/common/decimal.js +1 -1
- package/common/deps/ResizeObserver.js +1 -1
- package/common/deps/after-leave.js +1 -1
- package/common/deps/clickoutside.js +1 -1
- package/common/deps/date-util.js +1 -1
- package/common/deps/date.js +3 -3
- package/common/deps/debounce.js +1 -1
- package/common/deps/dom.js +21 -70
- package/common/deps/eSpaceCtrl.js +1 -1
- package/common/deps/fastdom/async.js +1 -1
- package/common/deps/fastdom/index.js +1 -1
- package/common/deps/fastdom/sandbox.js +1 -1
- package/common/deps/fastdom/singleton.js +2 -2
- package/common/deps/fullscreen/apis.js +1 -1
- package/common/deps/fullscreen/screenfull.js +1 -1
- package/common/deps/infinite-scroll.js +1 -1
- package/common/deps/letter-only.js +1 -1
- package/common/deps/memorize.js +4 -4
- package/common/deps/modal-queue.js +1 -1
- package/common/deps/number-only.js +1 -1
- package/common/deps/observe-visibility.js +1 -1
- package/common/deps/popper.js +344 -449
- package/common/deps/popup-manager.js +56 -37
- package/common/deps/repeat-click.js +1 -1
- package/common/deps/requestAnimationFrame.js +1 -1
- package/common/deps/resize-event.js +1 -1
- package/common/deps/scroll-into-view.js +1 -1
- package/common/deps/scrollbar-width.js +1 -1
- package/common/deps/throttle.js +3 -3
- package/common/deps/touch.js +2 -1
- package/common/deps/tree-model/node.js +1 -1
- package/common/deps/tree-model/tree-store.js +1 -1
- package/common/deps/tree-model/util.js +1 -1
- package/common/deps/upload-ajax.js +1 -1
- package/common/deps/vue-emitter.js +1 -1
- package/common/deps/vue-popper.js +89 -220
- package/common/deps/vue-popup.js +65 -81
- package/common/event.js +9 -2
- package/common/index.js +2 -2
- package/common/object.js +20 -22
- package/common/runtime.js +2 -2
- package/common/string.js +14 -4
- package/common/type.js +2 -2
- package/common/validate/index.js +1 -1
- package/common/validate/messages.js +1 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/index.js +1 -1
- package/common/validate/rules/pattern.js +1 -1
- package/common/validate/rules/range.js +1 -1
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +1 -1
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/schema.js +8 -1
- package/common/validate/util.js +4 -4
- package/common/validate/validations/array.js +1 -1
- package/common/validate/validations/date.js +1 -1
- package/common/validate/validations/enum.js +1 -1
- package/common/validate/validations/float.js +1 -1
- package/common/validate/validations/index.js +1 -1
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/common/validate/validations/number.js +1 -1
- package/common/validate/validations/pattern.js +1 -1
- package/common/validate/validations/required.js +1 -1
- package/common/validate/validations/string.js +1 -1
- package/common/validate/validations/type.js +1 -1
- package/common/xss.js +4 -156
- package/company/index.js +1 -1
- package/company/vue.js +1 -1
- package/container/index.js +1 -1
- package/container/vue.js +1 -1
- package/country/index.js +1 -1
- package/country/vue.js +1 -1
- package/credit-card/index.js +1 -1
- package/credit-card/vue.js +1 -1
- package/credit-card-form/index.js +1 -1
- package/credit-card-form/vue.js +3 -3
- package/crop/index.js +1 -1
- package/crop/vue.js +1 -1
- package/currency/index.js +1 -1
- package/currency/vue.js +1 -1
- package/date-panel/index.js +4 -4
- package/date-panel/vue.js +3 -3
- package/date-picker/index.js +1 -1
- package/date-picker/vue.js +1 -1
- package/date-picker-mobile/index.js +127 -85
- package/date-picker-mobile/vue.js +42 -23
- package/date-picker-mobile/year-month.js +53 -0
- package/date-range/index.js +7 -7
- package/date-range/vue.js +3 -3
- package/date-table/index.js +2 -2
- package/date-table/vue.js +1 -1
- package/dept/index.js +1 -1
- package/dept/vue.js +1 -1
- package/detail-page/index.js +1 -1
- package/detail-page/vue.js +1 -1
- package/dialog-box/index.js +28 -8
- package/dialog-box/vue.js +12 -16
- package/dialog-select/index.js +1 -1
- package/dialog-select/vue.js +1 -1
- package/divider/vue.js +9 -0
- package/drawer/index.js +2 -2
- package/drawer/vue.js +1 -1
- package/drop-roles/index.js +1 -1
- package/drop-roles/vue.js +1 -1
- package/drop-times/index.js +1 -1
- package/drop-times/vue.js +1 -1
- package/dropdown/index.js +33 -24
- package/dropdown/vue.js +8 -8
- package/dropdown-item/index.js +1 -1
- package/dropdown-item/mf.js +1 -1
- package/dropdown-item/vue.js +3 -3
- package/dropdown-menu/index.js +7 -5
- package/dropdown-menu/vue.js +3 -3
- package/dynamic-scroller/index.js +1 -1
- package/dynamic-scroller/vue.js +1 -1
- package/dynamic-scroller-item/index.js +1 -1
- package/dynamic-scroller-item/vue.js +1 -1
- package/espace/index.js +1 -1
- package/espace/vue.js +1 -1
- package/exception/index.js +1 -1
- package/exception/vue.js +1 -1
- package/fall-menu/index.js +1 -1
- package/fall-menu/vue.js +1 -1
- package/file-upload/index.js +213 -31
- package/file-upload/vue.js +13 -7
- package/filter/index.js +1 -1
- package/filter/tag-group.js +1 -1
- package/filter/vue.js +1 -1
- package/filter-bar/index.js +1 -1
- package/filter-bar/vue.js +1 -1
- package/filter-box/index.js +1 -1
- package/filter-box/vue.js +1 -1
- package/filter-panel/index.js +1 -1
- package/filter-panel/vue.js +1 -1
- package/floatbar/index.js +1 -1
- package/floatbar/vue.js +1 -1
- package/floating-button/index.js +1 -1
- package/floating-button/vue.js +1 -1
- package/flowchart/index.js +648 -227
- package/flowchart/node.js +52 -0
- package/flowchart/vue.js +25 -9
- package/form/index.js +37 -5
- package/form/vue.js +16 -3
- package/form-item/index.js +56 -27
- package/form-item/vue.js +25 -9
- package/fullscreen/index.js +1 -1
- package/fullscreen/vue.js +2 -1
- package/grid/core/index.js +1 -1
- package/grid/core/interceptor.js +1 -1
- package/grid/core/storeMap.js +1 -1
- package/grid/plugins/export.js +1 -1
- package/grid/plugins/exportExcel.js +4 -1
- package/grid/plugins/header.js +1 -1
- package/grid/plugins/resize.js +1 -1
- package/grid/static/array/arrayEach.js +1 -1
- package/grid/static/array/arrayIndexOf.js +1 -1
- package/grid/static/array/eachTree.js +1 -1
- package/grid/static/array/every.js +1 -1
- package/grid/static/array/filterTree.js +1 -1
- package/grid/static/array/find.js +1 -1
- package/grid/static/array/findTree.js +1 -1
- package/grid/static/array/helperCreateIterateHandle.js +1 -1
- package/grid/static/array/helperCreateTreeFunc.js +1 -1
- package/grid/static/array/includes.js +1 -1
- package/grid/static/array/lastArrayEach.js +1 -1
- package/grid/static/array/map.js +1 -1
- package/grid/static/array/mapTree.js +1 -1
- package/grid/static/array/slice.js +1 -1
- package/grid/static/array/sortBy.js +1 -1
- package/grid/static/array/sum.js +1 -1
- package/grid/static/array/toArray.js +1 -1
- package/grid/static/array/toTreeArray.js +1 -1
- package/grid/static/base/clear.js +1 -1
- package/grid/static/base/clone.js +1 -1
- package/grid/static/base/destructuring.js +1 -1
- package/grid/static/base/each.js +1 -1
- package/grid/static/base/eqNull.js +1 -1
- package/grid/static/base/findIndexOf.js +1 -1
- package/grid/static/base/get.js +1 -1
- package/grid/static/base/has.js +1 -1
- package/grid/static/base/hasOwnProp.js +1 -1
- package/grid/static/base/helperCreateGetObjects.js +1 -1
- package/grid/static/base/helperCreateInInObjectString.js +1 -1
- package/grid/static/base/helperCreateInTypeof.js +1 -1
- package/grid/static/base/helperCreateIndexOf.js +1 -1
- package/grid/static/base/helperCreateiterateIndexOf.js +1 -1
- package/grid/static/base/helperDefaultCompare.js +1 -1
- package/grid/static/base/helperDeleteProperty.js +1 -1
- package/grid/static/base/helperEqualCompare.js +1 -1
- package/grid/static/base/helperGetHGSKeys.js +5 -2
- package/grid/static/base/indexOf.js +1 -1
- package/grid/static/base/isArray.js +1 -1
- package/grid/static/base/isBoolean.js +1 -1
- package/grid/static/base/isDate.js +1 -1
- package/grid/static/base/isEmpty.js +1 -1
- package/grid/static/base/isEqual.js +1 -1
- package/grid/static/base/isFunction.js +1 -1
- package/grid/static/base/isNaN.js +1 -1
- package/grid/static/base/isNull.js +1 -1
- package/grid/static/base/isNumber.js +1 -1
- package/grid/static/base/isObject.js +1 -1
- package/grid/static/base/isPlainObject.js +1 -1
- package/grid/static/base/isRegExp.js +1 -1
- package/grid/static/base/isSet.js +1 -1
- package/grid/static/base/isString.js +1 -1
- package/grid/static/base/isUndefined.js +1 -1
- package/grid/static/base/keys.js +1 -1
- package/grid/static/base/lastEach.js +1 -1
- package/grid/static/base/remove.js +1 -1
- package/grid/static/base/set.js +1 -1
- package/grid/static/base/toJSONString.js +1 -1
- package/grid/static/base/toStringJSON.js +1 -1
- package/grid/static/base/uniqueId.js +1 -1
- package/grid/static/browse/browse.js +1 -1
- package/grid/static/function/property.js +1 -1
- package/grid/static/function/throttle.js +1 -1
- package/grid/static/index.js +1 -1
- package/grid/static/number/helperCreateToNumber.js +1 -1
- package/grid/static/number/toNumber.js +1 -1
- package/grid/static/object/assign.js +1 -1
- package/grid/static/object/extend.js +1 -1
- package/grid/static/object/lastObjectEach.js +1 -1
- package/grid/static/object/objectEach.js +1 -1
- package/grid/static/object/objectMap.js +1 -1
- package/grid/static/object/values.js +1 -1
- package/grid/static/static/staticDocument.js +1 -1
- package/grid/static/static/staticHGKeyRE.js +1 -1
- package/grid/static/static/staticParseInt.js +1 -1
- package/grid/static/static/staticStrUndefined.js +1 -1
- package/grid/static/static/staticWindow.js +1 -1
- package/grid/static/string/template.js +1 -1
- package/grid/static/string/toString.js +1 -1
- package/grid/utils/column.js +1 -1
- package/grid/utils/common.js +1 -1
- package/grid/utils/dom.js +3 -2
- package/grid/utils/event.js +1 -1
- package/grid/utils/index.js +1 -1
- package/guide/index.js +4 -3
- package/guide/vue.js +1 -1
- package/hrapprover/index.js +1 -1
- package/hrapprover/vue.js +1 -1
- package/image/index.js +6 -3
- package/image/vue.js +19 -3
- package/image-viewer/index.js +327 -42
- package/image-viewer/vue.js +64 -19
- package/index-bar/index.js +1 -2
- package/index-bar/vue.js +1 -1
- package/index-bar-anchor/vue.js +1 -1
- package/input/index.js +19 -6
- package/input/vue.js +43 -5
- package/ip-address/index.js +1 -1
- package/ip-address/vue.js +1 -1
- package/layout/vue.js +1 -1
- package/link/index.js +1 -1
- package/link/vue.js +1 -1
- package/link-menu/index.js +1 -1
- package/link-menu/vue.js +1 -1
- package/list/index.js +1 -1
- package/list/vue.js +1 -1
- package/loading/index.js +1 -1
- package/loading/vue.js +1 -1
- package/locales/index.js +2 -2
- package/locales/vue.js +1 -1
- package/logon-user/index.js +1 -1
- package/logon-user/vue.js +1 -1
- package/logout/index.js +1 -1
- package/logout/vue.js +1 -1
- package/milestone/index.js +3 -3
- package/milestone/vue.js +4 -4
- package/mini-picker/index.js +1 -1
- package/mini-picker/vue.js +1 -1
- package/modal/index.js +210 -107
- package/modal/vue.js +10 -7
- package/month-range/index.js +2 -2
- package/month-range/vue.js +3 -3
- package/month-table/index.js +3 -3
- package/month-table/vue.js +1 -1
- package/multi-select/index.js +1 -1
- package/multi-select/vue.js +1 -1
- package/nav-menu/index.js +103 -20
- package/nav-menu/vue.js +19 -9
- package/notify/index.js +1 -1
- package/notify/vue.js +1 -1
- package/numeric/index.js +28 -5
- package/numeric/vue.js +21 -11
- package/option/index.js +1 -1
- package/option/vue.js +1 -1
- package/option-group/index.js +1 -1
- package/option-group/vue.js +1 -1
- package/package.json +5 -4
- package/pager/vue.js +1 -1
- package/pager-item/index.js +1 -1
- package/pager-item/vue.js +1 -1
- package/panel/index.js +1 -1
- package/panel/vue.js +1 -1
- package/picker/index.js +8 -19
- package/picker/timezone.js +1 -1
- package/picker/vue.js +25 -30
- package/picker-column/index.js +1 -1
- package/picker-column/vue.js +1 -1
- package/pop-upload/index.js +1 -1
- package/pop-upload/vue.js +1 -1
- package/popconfirm/index.js +1 -1
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +4 -1
- package/popeditor/vue.js +1 -1
- package/popover/index.js +21 -9
- package/popover/vue.js +49 -9
- package/popup/index.js +1 -1
- package/popup/vue.js +1 -1
- package/progress/index.js +1 -1
- package/progress/vue.js +1 -1
- package/pull-refresh/index.js +1 -3
- package/pull-refresh/vue.js +1 -1
- package/query-builder/index.js +1 -1
- package/query-builder/vue.js +1 -1
- package/radio/index.js +29 -6
- package/radio/vue.js +2 -2
- package/radio-button/index.js +26 -12
- package/radio-button/vue.js +14 -6
- package/radio-group/index.js +3 -3
- package/radio-group/vue.js +2 -2
- package/rate/index.js +1 -1
- package/rate/vue.js +1 -1
- package/record/index.js +1 -1
- package/record/vue.js +1 -1
- package/recycle-scroller/index.js +2 -1
- package/recycle-scroller/vue.js +1 -1
- package/rich-text-edtior/index.js +254 -0
- package/rich-text-edtior/vue.js +320 -0
- package/river/index.js +1 -1
- package/river/river.js +1 -1
- package/river/vue.js +1 -1
- package/roles/index.js +1 -1
- package/roles/vue.js +1 -1
- package/row/index.js +1 -1
- package/row/vue.js +1 -1
- package/scroll-text/index.js +1 -1
- package/scroll-text/vue.js +1 -1
- package/scrollbar/index.js +1 -1
- package/scrollbar/vue-bar.js +1 -1
- package/scrollbar/vue.js +1 -1
- package/search/index.js +12 -9
- package/search/vue.js +7 -7
- package/select/index.js +42 -22
- package/select/vue.js +7 -4
- package/select-dropdown/index.js +3 -3
- package/select-dropdown/vue.js +1 -1
- package/select-mobile/index.js +1 -1
- package/select-mobile/vue.js +1 -1
- package/select-view/index.js +1 -1
- package/select-view/vue.js +1 -1
- package/selected-box/index.js +1 -1
- package/selected-box/vue.js +1 -1
- package/slide-bar/index.js +1 -1
- package/slide-bar/vue.js +1 -1
- package/slider/index.js +36 -13
- package/slider/vue.js +5 -2
- package/slider-button/index.js +1 -1
- package/slider-button/vue.js +1 -1
- package/slider-button-group/slide-button.js +1 -1
- package/slider-button-group/vue.js +1 -1
- package/split/index.js +65 -22
- package/split/vue.js +48 -41
- package/standard-list-item/index.js +1 -1
- package/standard-list-item/vue.js +1 -1
- package/steps/index.js +1 -1
- package/steps/slide-bar.js +2 -1
- package/steps/vue.js +3 -2
- package/switch/index.js +4 -10
- package/switch/vue.js +4 -6
- package/tab-bar/index.js +33 -31
- package/tab-bar/vue.js +1 -1
- package/tab-dropdown/index.js +1 -1
- package/tab-dropdown/vue.js +1 -1
- package/tab-item/index.js +1 -1
- package/tab-item/vue.js +1 -1
- package/tab-item-mf/vue.js +1 -1
- package/tab-nav/index.js +19 -8
- package/tab-nav/vue.js +3 -2
- package/tabbar/index.js +36 -3
- package/tabbar/vue.js +34 -9
- package/tabbar-item/index.js +11 -6
- package/tabbar-item/vue.js +13 -8
- package/table/index.js +1 -1
- package/table/vue.js +1 -1
- package/tabs/index.js +22 -8
- package/tabs/vue.js +9 -2
- package/tabs-mf/index.js +1 -1
- package/tabs-mf/vue-bar.js +1 -1
- package/tabs-mf/vue-nav-item.js +1 -1
- package/tabs-mf/vue-nav.js +1 -1
- package/tabs-mf/vue.js +1 -1
- package/tabs-mf/wheel.js +1 -1
- package/tag/index.js +2 -2
- package/tag/vue.js +1 -1
- package/tag-group/index.js +1 -1
- package/tag-group/vue.js +1 -1
- package/tall-storage/index.js +1 -1
- package/tall-storage/vue-storage-box.js +1 -1
- package/tall-storage/vue.js +1 -1
- package/text-popup/index.js +1 -1
- package/text-popup/vue.js +1 -1
- package/time/index.js +2 -2
- package/time/vue.js +4 -4
- package/time-line/index.js +2 -2
- package/time-line/vue.js +5 -4
- package/time-panel/index.js +1 -1
- package/time-panel/scrollIntoView.js +1 -1
- package/time-panel/vue.js +1 -1
- package/time-picker-mobile/index.js +1 -1
- package/time-picker-mobile/vue.js +1 -1
- package/time-range/index.js +5 -5
- package/time-range/vue.js +4 -4
- package/time-spinner/index.js +1 -1
- package/time-spinner/vue.js +3 -3
- package/timeline-item/index.js +14 -15
- package/timeline-item/vue.js +7 -6
- package/toggle-menu/index.js +1 -1
- package/toggle-menu/vue.js +2 -1
- package/tooltip/index.js +6 -11
- package/tooltip/vue.js +5 -10
- package/top-box/index.js +1 -1
- package/top-box/vue.js +1 -1
- package/transfer/index.js +1 -1
- package/transfer/vue.js +1 -1
- package/transfer-panel/index.js +1 -1
- package/transfer-panel/vue.js +1 -1
- package/tree/index.js +2 -1
- package/tree/vue.js +1 -1
- package/tree-menu/index.js +6 -6
- package/tree-menu/vue.js +3 -3
- package/tree-node/index.js +5 -3
- package/tree-node/vue.js +6 -6
- package/types/action-menu.type.d.mts +88 -0
- package/types/action-sheet.type.d.mts +2 -0
- package/types/alert.type.d.mts +112 -0
- package/types/amount.type.d.mts +2 -0
- package/types/anchor.type.d.mts +87 -0
- package/types/area.type.d.mts +2 -0
- package/types/autocomplete.type.d.mts +2 -0
- package/types/autonavi-map.type.d.mts +2 -0
- package/types/avatar.type.d.mts +2 -0
- package/types/badge.type.d.mts +82 -0
- package/types/baidu-map.type.d.mts +2 -0
- package/types/breadcrumb-item.type.d.mts +31 -0
- package/types/breadcrumb.type.d.mts +57 -0
- package/types/bulletin-board.type.d.mts +2 -0
- package/types/button-group.type.d.mts +87 -0
- package/types/button.type.d.mts +90 -0
- package/types/calendar-bar.type.d.mts +2 -0
- package/types/calendar.type.d.mts +2 -0
- package/types/card-group.type.d.mts +2 -0
- package/types/card-template.type.d.mts +2 -0
- package/types/card.type.d.mts +2 -0
- package/types/carousel-item.type.d.mts +2 -0
- package/types/carousel.type.d.mts +2 -0
- package/types/cascader-menu.type.d.mts +49 -0
- package/types/cascader-mobile.type.d.mts +2 -0
- package/types/cascader-node.type.d.mts +53 -0
- package/types/cascader-panel.type.d.mts +241 -0
- package/types/cascader-select.type.d.mts +2 -0
- package/types/cascader.type.d.mts +2 -0
- package/types/cell.type.d.mts +2 -0
- package/types/chart-bar.type.d.mts +2 -0
- package/types/chart-boxplot.type.d.mts +2 -0
- package/types/chart-candle.type.d.mts +2 -0
- package/types/chart-core.type.d.mts +2 -0
- package/types/chart-funnel.type.d.mts +2 -0
- package/types/chart-gauge.type.d.mts +2 -0
- package/types/chart-graph.type.d.mts +2 -0
- package/types/chart-heatmap.type.d.mts +2 -0
- package/types/chart-line.type.d.mts +2 -0
- package/types/chart-liquidfill.type.d.mts +2 -0
- package/types/chart-map.type.d.mts +2 -0
- package/types/chart-pie.type.d.mts +2 -0
- package/types/chart-radar.type.d.mts +2 -0
- package/types/chart-sankey.type.d.mts +2 -0
- package/types/chart-scatter.type.d.mts +2 -0
- package/types/chart-sunburst.type.d.mts +2 -0
- package/types/chart-tree.type.d.mts +2 -0
- package/types/chart-waterfall.type.d.mts +2 -0
- package/types/chart-wordcloud.type.d.mts +2 -0
- package/types/checkbox-button.type.d.mts +2 -0
- package/types/checkbox-group.type.d.mts +2 -0
- package/types/checkbox.type.d.mts +154 -0
- package/types/col.type.d.mts +2 -0
- package/types/collapse-item.type.d.mts +60 -0
- package/types/collapse.type.d.mts +56 -0
- package/types/color-picker.type.d.mts +5 -0
- package/types/color-select-panel.type.d.mts +5 -0
- package/types/column-list-group.type.d.mts +2 -0
- package/types/column-list-item.type.d.mts +2 -0
- package/types/common.type.d.mts +2 -0
- package/types/company.type.d.mts +2 -0
- package/types/container.type.d.mts +2 -0
- package/types/country.type.d.mts +2 -0
- package/types/credit-card-form.type.d.mts +2 -0
- package/types/credit-card.type.d.mts +2 -0
- package/types/crop.type.d.mts +2 -0
- package/types/currency.type.d.mts +2 -0
- package/types/date-panel.type.d.mts +2 -0
- package/types/date-picker-mobile.type.d.mts +2 -0
- package/types/date-picker.type.d.mts +212 -0
- package/types/date-range.type.d.mts +2 -0
- package/types/date-table.type.d.mts +138 -0
- package/types/dept.type.d.mts +2 -0
- package/types/detail-page.type.d.mts +2 -0
- package/types/dialog-box.type.d.mts +250 -0
- package/types/dialog-select.type.d.mts +2 -0
- package/types/drawer.type.d.mts +2 -0
- package/types/drop-roles.type.d.mts +2 -0
- package/types/drop-times.type.d.mts +2 -0
- package/types/dropdown-item.type-e59174b8.d.ts +336 -0
- package/types/dropdown-item.type.d.mts +4 -0
- package/types/dropdown-menu.type.d.mts +4 -0
- package/types/dropdown.type.d.mts +142 -0
- package/types/dynamic-scroller-item.type.d.mts +2 -0
- package/types/dynamic-scroller.type.d.mts +2 -0
- package/types/espace.type.d.mts +2 -0
- package/types/exception.type.d.mts +2 -0
- package/types/fall-menu.type.d.mts +2 -0
- package/types/file-upload.type.d.mts +3 -0
- package/types/filter-bar.type.d.mts +2 -0
- package/types/filter-box.type.d.mts +2 -0
- package/types/filter-panel.type.d.mts +2 -0
- package/types/filter.type.d.mts +2 -0
- package/types/floatbar.type.d.mts +45 -0
- package/types/floating-button.type.d.mts +2 -0
- package/types/flowchart.type.d.mts +2 -0
- package/types/form-item.type.d.mts +3 -0
- package/types/form.type-004ecf93.d.ts +394 -0
- package/types/form.type.d.mts +3 -0
- package/types/fullscreen.type.d.mts +2 -0
- package/types/grid.type.d.mts +2 -0
- package/types/guide.type.d.mts +2 -0
- package/types/hrapprover.type.d.mts +2 -0
- package/types/image-viewer.type.d.mts +2 -0
- package/types/image.type.d.mts +176 -0
- package/types/index-bar-anchor.type.d.mts +2 -0
- package/types/index-bar.type.d.mts +2 -0
- package/types/index-e0250f63.d.ts +43 -0
- package/types/input.type.d.mts +294 -0
- package/types/ip-address.type.d.mts +2 -0
- package/types/layout.type.d.mts +2 -0
- package/types/link-menu.type.d.mts +2 -0
- package/types/link.type.d.mts +40 -0
- package/types/list.type.d.mts +2 -0
- package/types/loading.type.d.mts +90 -0
- package/types/locales.type.d.mts +2 -0
- package/types/logon-user.type.d.mts +2 -0
- package/types/logout.type.d.mts +2 -0
- package/types/milestone.type.d.mts +144 -0
- package/types/mini-picker.type.d.mts +2 -0
- package/types/modal.type.d.mts +264 -0
- package/types/month-range.type.d.mts +2 -0
- package/types/month-table.type.d.mts +2 -0
- package/types/multi-select.type.d.mts +2 -0
- package/types/nav-menu.type.d.mts +124 -0
- package/types/notify.type.d.mts +2 -0
- package/types/numeric.type.d.mts +275 -0
- package/types/option-group.type.d.mts +2 -0
- package/types/option.type.d.mts +2 -0
- package/types/pager-item.type.d.mts +2 -0
- package/types/pager.type.d.mts +2 -0
- package/types/panel.type.d.mts +2 -0
- package/types/picker-column.type.d.mts +2 -0
- package/types/picker.type.d.mts +191 -0
- package/types/pop-upload.type.d.mts +2 -0
- package/types/popconfirm.type.d.mts +2 -0
- package/types/popeditor.type.d.mts +275 -0
- package/types/popover.type.d.mts +164 -0
- package/types/popup.type.d.mts +2 -0
- package/types/progress.type.d.mts +216 -0
- package/types/pull-refresh.type.d.mts +2 -0
- package/types/query-builder.type.d.mts +2 -0
- package/types/radio-button.type.d.mts +90 -0
- package/types/radio-group.type.d.mts +67 -0
- package/types/radio.type.d.mts +103 -0
- package/types/rate.type.d.mts +2 -0
- package/types/record.type.d.mts +2 -0
- package/types/recycle-scroller.type.d.mts +2 -0
- package/types/river.type.d.mts +2 -0
- package/types/roles.type.d.mts +2 -0
- package/types/row.type.d.mts +2 -0
- package/types/scroll-text.type.d.mts +2 -0
- package/types/scrollbar.type.d.mts +2 -0
- package/types/search.type.d.mts +40 -0
- package/types/select-dropdown.type.d.mts +2 -0
- package/types/select-mobile.type.d.mts +2 -0
- package/types/select-view.type.d.mts +2 -0
- package/types/select.type.d.mts +2 -0
- package/types/selected-box.type.d.mts +2 -0
- package/types/shared.type.d.mts +178 -0
- package/types/slide-bar.type.d.mts +2 -0
- package/types/slider-button-group.type.d.mts +2 -0
- package/types/slider-button.type.d.mts +2 -0
- package/types/slider.type.d.mts +199 -0
- package/types/split.type.d.mts +2 -0
- package/types/standard-list-item.type.d.mts +2 -0
- package/types/steps.type.d.mts +78 -0
- package/types/switch.type.d.mts +113 -0
- package/types/tab-bar.type.d.mts +42 -0
- package/types/tab-dropdown.type.d.mts +2 -0
- package/types/tab-item-mf.type.d.mts +2 -0
- package/types/tab-item.type.d.mts +71 -0
- package/types/tab-nav.type.d.mts +106 -0
- package/types/tabbar-item.type.d.mts +2 -0
- package/types/tabbar.type.d.mts +2 -0
- package/types/table.type.d.mts +2 -0
- package/types/tabs-mf.type.d.mts +2 -0
- package/types/tabs.type.d.mts +148 -0
- package/types/tag-group.type.d.mts +2 -0
- package/types/tag.type.d.mts +51 -0
- package/types/tall-storage.type.d.mts +2 -0
- package/types/text-popup.type.d.mts +2 -0
- package/types/time-line.type-4a01d597.d.ts +280 -0
- package/types/time-line.type.d.mts +3 -0
- package/types/time-panel.type.d.mts +2 -0
- package/types/time-picker-mobile.type.d.mts +2 -0
- package/types/time-range.type.d.mts +2 -0
- package/types/time-spinner.type.d.mts +2 -0
- package/types/time.type.d.mts +2 -0
- package/types/timeline-item.type.d.mts +3 -0
- package/types/toggle-menu.type.d.mts +2 -0
- package/types/tooltip.type.d.mts +189 -0
- package/types/top-box.type.d.mts +2 -0
- package/types/transfer-panel.type.d.mts +2 -0
- package/types/transfer.type.d.mts +2 -0
- package/types/tree-menu.type.d.mts +2 -0
- package/types/tree-node.type.d.mts +2 -0
- package/types/tree.type.d.mts +2 -0
- package/types/upload-dragger.type.d.mts +50 -0
- package/types/upload-list.type-aa21a42e.d.ts +1130 -0
- package/types/upload-list.type.d.mts +3 -0
- package/types/upload.type.d.mts +3 -0
- package/types/user-account.type.d.mts +2 -0
- package/types/user-contact.type.d.mts +2 -0
- package/types/user-head-group.type.d.mts +2 -0
- package/types/user-head.type.d.mts +2 -0
- package/types/user-link.type.d.mts +2 -0
- package/types/user.type.d.mts +2 -0
- package/types/wheel.type.d.mts +2 -0
- package/types/wizard.type.d.mts +95 -0
- package/types/year-range.type.d.mts +2 -0
- package/types/year-table.type.d.mts +2 -0
- package/upload/index.js +103 -25
- package/upload/vue.js +4 -1
- package/upload-dragger/index.js +3 -2
- package/upload-dragger/vue.js +1 -1
- package/upload-list/index.js +7 -5
- package/upload-list/vue.js +3 -2
- package/user/index.js +5 -3
- package/user/vue.js +2 -2
- package/user-account/index.js +1 -1
- package/user-account/vue.js +1 -1
- package/user-contact/index.js +1 -1
- package/user-contact/vue.js +1 -1
- package/user-head/index.js +26 -31
- package/user-head/vue.js +16 -13
- package/user-head-group/index.js +20 -0
- package/user-head-group/vue.js +18 -5
- package/user-link/index.js +1 -1
- package/user-link/vue.js +1 -1
- package/wheel/index.js +1 -1
- package/wheel/vue.js +1 -1
- package/wizard/index.js +1 -1
- package/wizard/vue.js +1 -2
- package/year-range/index.js +2 -2
- package/year-range/vue.js +4 -4
- package/year-table/index.js +3 -3
- package/year-table/vue.js +1 -1
- /package/{chunk-PKUHTIDK.js → chunk-G2ADBYYC.js} +0 -0
package/flowchart/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import debounce from "../common/deps/debounce";
|
|
3
3
|
import { omitText as omit } from "../common/string";
|
|
4
4
|
const compute = ({ api, markRaw, props, state }) => () => {
|
|
@@ -16,7 +16,7 @@ const compute = ({ api, markRaw, props, state }) => () => {
|
|
|
16
16
|
const heights = seg(config.height, config.rows);
|
|
17
17
|
const afterNodes = api.buildAfterNode(nodes, widths, heights);
|
|
18
18
|
const afterLinks = api.buildAfterLink(links, widths, heights, afterNodes);
|
|
19
|
-
const hoverState = api.buildHoverState(afterLinks);
|
|
19
|
+
const hoverState = api.buildHoverState({ afterLinks });
|
|
20
20
|
const allItem = api.getAllItem(nodes);
|
|
21
21
|
const dropdowns = api.initDropdowns(nodes);
|
|
22
22
|
state.afterData = markRaw({ afterNodes, afterLinks, widths, heights, allItem, hoverState });
|
|
@@ -110,40 +110,99 @@ const buildAfterLink = () => (links, widths, heights, afterNodes) => {
|
|
|
110
110
|
};
|
|
111
111
|
return links.map((link) => path(link, widths[1], heights[1], afterNodes));
|
|
112
112
|
};
|
|
113
|
+
const clearHoverList = ({ afterLink, state }) => {
|
|
114
|
+
const { hoverMap, hoverList } = state.afterData.hoverState;
|
|
115
|
+
const indices = [];
|
|
116
|
+
hoverList.forEach((tri, i) => hoverMap.get(tri) === afterLink && indices.unshift(i));
|
|
117
|
+
indices.forEach((index) => hoverList.splice(index, 1));
|
|
118
|
+
};
|
|
119
|
+
const drawLinePart = (ctx, p) => {
|
|
120
|
+
const mmap = { m: "moveTo", l: "lineTo", a: "arcTo" };
|
|
121
|
+
const paths = p.split(",");
|
|
122
|
+
ctx[mmap[paths[0]]](...paths.slice(1).map(Number));
|
|
123
|
+
};
|
|
124
|
+
const styleDraw = ({ afterLink, afterNodes, api, config, ctx }) => {
|
|
125
|
+
if (typeof config.styleLink === "function") {
|
|
126
|
+
config.styleLink(ctx, afterLink, afterNodes);
|
|
127
|
+
} else {
|
|
128
|
+
ctx.strokeStyle = config.colors[afterLink.raw.info.status];
|
|
129
|
+
afterLink.raw.info.style !== "solid" && ctx.setLineDash(api.isMf() ? [6, 6] : [2, 4]);
|
|
130
|
+
}
|
|
131
|
+
if (api.isLinkHover(afterLink) && typeof config.styleHoverLink === "function") {
|
|
132
|
+
config.styleHoverLink(ctx, afterLink, afterNodes);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const hitMatch = (drawCfg, afterLink) => {
|
|
136
|
+
let matched = true;
|
|
137
|
+
if (drawCfg.filter) {
|
|
138
|
+
if (drawCfg.filter.from && drawCfg.filter.to) {
|
|
139
|
+
matched = afterLink.raw.from === drawCfg.filter.from && afterLink.raw.to === drawCfg.filter.to;
|
|
140
|
+
} else if (drawCfg.filter.from) {
|
|
141
|
+
matched = afterLink.raw.from === drawCfg.filter.from;
|
|
142
|
+
} else if (drawCfg.filter.to) {
|
|
143
|
+
matched = afterLink.raw.to === drawCfg.filter.to;
|
|
144
|
+
} else {
|
|
145
|
+
matched = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return matched;
|
|
149
|
+
};
|
|
150
|
+
const setLinear = ({ afterLink, ctx }) => {
|
|
151
|
+
if (afterLink.linearGrad) {
|
|
152
|
+
const { from, to, linear } = afterLink.linearGrad;
|
|
153
|
+
const grad = ctx.createLinearGradient(from.x, from.y, to.x, to.y);
|
|
154
|
+
if (Array.isArray(linear.stops) && Array.isArray(linear.colors) && linear.stops.length === linear.colors.length && linear.stops.length > 0) {
|
|
155
|
+
linear.stops.forEach((stop, i) => grad.addColorStop(stop, linear.colors[i]));
|
|
156
|
+
}
|
|
157
|
+
ctx.strokeStyle = grad;
|
|
158
|
+
afterLink._grad = grad;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const realDraw = ({ afterLink, afterNodes, config, ctx, state }) => {
|
|
162
|
+
const defaultDrawLink = () => {
|
|
163
|
+
setLinear({ afterLink, ctx });
|
|
164
|
+
afterLink.p.map((p) => drawLinePart(ctx, p));
|
|
165
|
+
};
|
|
166
|
+
let drawn = false;
|
|
167
|
+
if (typeof config.drawLink === "function") {
|
|
168
|
+
drawn = true;
|
|
169
|
+
config.drawLink({ ctx, afterLink, afterNodes });
|
|
170
|
+
} else if (Array.isArray(config.drawLink)) {
|
|
171
|
+
if (config.drawLink.length) {
|
|
172
|
+
for (let i = 0; i < config.drawLink.length; i++) {
|
|
173
|
+
if (drawn = hitMatch(config.drawLink[i], afterLink)) {
|
|
174
|
+
config.drawLink[i].method({ ctx, afterLink, afterNodes });
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
} else if (config.drawLink && typeof config.drawLink.method === "function") {
|
|
180
|
+
if (drawn = hitMatch(config.drawLink, afterLink)) {
|
|
181
|
+
config.drawLink.method({ ctx, afterLink, afterNodes });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (drawn) {
|
|
185
|
+
state.temporary.customLinks.push(afterLink.raw);
|
|
186
|
+
clearHoverList({ afterLink, state });
|
|
187
|
+
} else {
|
|
188
|
+
defaultDrawLink();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const draw = ({ afterLink, afterNodes, api, config, ctx, state }) => {
|
|
192
|
+
ctx.save();
|
|
193
|
+
ctx.beginPath();
|
|
194
|
+
styleDraw({ afterLink, afterNodes, api, config, ctx });
|
|
195
|
+
realDraw({ afterLink, afterNodes, config, ctx, state });
|
|
196
|
+
ctx.stroke();
|
|
197
|
+
ctx.restore();
|
|
198
|
+
drawArrow({ afterLink, config, ctx, state });
|
|
199
|
+
};
|
|
113
200
|
const drawAfterLink = ({ api, props, state, vm }) => () => {
|
|
114
201
|
const { config } = props;
|
|
115
202
|
const { afterData } = state;
|
|
116
203
|
const { $refs } = vm;
|
|
117
204
|
const { afterLinks, afterNodes, graph } = afterData;
|
|
118
|
-
const mmap = { m: "moveTo", l: "lineTo", a: "arcTo" };
|
|
119
205
|
const dpr = window.devicePixelRatio;
|
|
120
|
-
const drawLinePart = (ctx, p) => {
|
|
121
|
-
const paths = p.split(",");
|
|
122
|
-
ctx[mmap[paths[0]]](...paths.slice(1).map(Number));
|
|
123
|
-
};
|
|
124
|
-
const draw = (ctx, afterLink) => {
|
|
125
|
-
const { p, raw } = afterLink;
|
|
126
|
-
const { status, style } = raw.info;
|
|
127
|
-
const color = config.colors[status];
|
|
128
|
-
ctx.save();
|
|
129
|
-
ctx.beginPath();
|
|
130
|
-
if (typeof config.drawLink === "function") {
|
|
131
|
-
config.drawLink(ctx, afterLink, afterNodes);
|
|
132
|
-
} else {
|
|
133
|
-
if (typeof config.styleLink === "function") {
|
|
134
|
-
config.styleLink(ctx);
|
|
135
|
-
} else {
|
|
136
|
-
ctx.strokeStyle = color;
|
|
137
|
-
style !== "solid" && ctx.setLineDash(api.isMf() ? [6, 6] : [2, 4]);
|
|
138
|
-
}
|
|
139
|
-
if (api.isLinkHover(afterLink) && typeof config.styleHoverLink === "function") {
|
|
140
|
-
config.styleHoverLink(ctx);
|
|
141
|
-
}
|
|
142
|
-
p.map((p2) => drawLinePart(ctx, p2));
|
|
143
|
-
}
|
|
144
|
-
ctx.stroke();
|
|
145
|
-
ctx.restore();
|
|
146
|
-
};
|
|
147
206
|
if ($refs.canvas && $refs.canvas.getContext) {
|
|
148
207
|
const ctx = $refs.canvas.getContext("2d");
|
|
149
208
|
const width = graph ? graph.width : config.width;
|
|
@@ -163,14 +222,19 @@ const drawAfterLink = ({ api, props, state, vm }) => () => {
|
|
|
163
222
|
ctx.lineWidth = api.isMf() ? (config.lineWidth || 1) / dpr : 2;
|
|
164
223
|
ctx.miterLimit = 0;
|
|
165
224
|
ctx.lineDashOffset = 0;
|
|
166
|
-
|
|
225
|
+
state.temporary.customLinks = [];
|
|
226
|
+
afterLinks.map((afterLink) => draw({ afterLink, afterNodes, api, config, ctx, state }));
|
|
167
227
|
ctx.restore();
|
|
228
|
+
api.isMf() && drawGroup({ state, ctx });
|
|
168
229
|
}
|
|
169
230
|
}
|
|
170
|
-
api.isMf() && api.drawArrow();
|
|
171
231
|
};
|
|
172
|
-
const refresh = ({ api, nextTick, state }) => () => {
|
|
232
|
+
const refresh = ({ api, nextTick, state }) => ({ graphWidth = 0, adjustX = 0 } = {}) => {
|
|
173
233
|
api.removeListeners();
|
|
234
|
+
if (graphWidth && graphWidth !== state.temporary.graphWidth) {
|
|
235
|
+
state.temporary.graphWidth = graphWidth;
|
|
236
|
+
state.temporary.adjustX = adjustX;
|
|
237
|
+
}
|
|
174
238
|
if (api.isMf()) {
|
|
175
239
|
api.computeMf();
|
|
176
240
|
} else {
|
|
@@ -180,6 +244,7 @@ const refresh = ({ api, nextTick, state }) => () => {
|
|
|
180
244
|
nextTick(() => {
|
|
181
245
|
api.drawAfterLink();
|
|
182
246
|
api.addListeners();
|
|
247
|
+
state.temporary.emitter.emit("after-graph-refresh");
|
|
183
248
|
});
|
|
184
249
|
};
|
|
185
250
|
const getAllItem = (props) => (nodes) => {
|
|
@@ -215,15 +280,30 @@ const getVars = () => (afterNode, config) => {
|
|
|
215
280
|
};
|
|
216
281
|
const isLinkHover = (state) => (afterLink) => state.hoverAfterLink === afterLink;
|
|
217
282
|
const omitText = omit;
|
|
218
|
-
const buildHoverState = (props) => (afterLinks) => {
|
|
283
|
+
const buildHoverState = (props) => ({ afterGroups, afterLinks }) => {
|
|
219
284
|
const { config } = props;
|
|
220
|
-
const { hoverHit } = config;
|
|
221
285
|
const hoverMap = /* @__PURE__ */ new WeakMap();
|
|
222
286
|
const hoverList = [];
|
|
287
|
+
buildLinkHoverState({ afterLinks, hoverMap, hoverList, config });
|
|
288
|
+
const groupHoverMap = /* @__PURE__ */ new WeakMap();
|
|
289
|
+
const groupHoverList = [];
|
|
290
|
+
if (afterGroups) {
|
|
291
|
+
buildGroupHoverState({ afterGroups, groupHoverMap, groupHoverList });
|
|
292
|
+
}
|
|
293
|
+
return { hoverMap, hoverList, groupHoverMap, groupHoverList };
|
|
294
|
+
};
|
|
295
|
+
const buildLinkHoverState = ({ afterLinks, hoverMap, hoverList, config }) => {
|
|
296
|
+
const { hoverHit } = config;
|
|
223
297
|
const createItem = (cur, next, afterLink) => {
|
|
224
298
|
if (cur[0] === next[0]) {
|
|
225
|
-
|
|
226
|
-
|
|
299
|
+
let top, bottom;
|
|
300
|
+
if (cur[1] < next[1]) {
|
|
301
|
+
top = cur;
|
|
302
|
+
bottom = next;
|
|
303
|
+
} else {
|
|
304
|
+
top = next;
|
|
305
|
+
bottom = cur;
|
|
306
|
+
}
|
|
227
307
|
const tri1 = [top[0] + hoverHit, top[1], top[0] - hoverHit, top[1], bottom[0] - hoverHit, bottom[1]];
|
|
228
308
|
const tri2 = [bottom[0] - hoverHit, bottom[1], bottom[0] + hoverHit, bottom[1], top[0] + hoverHit, top[1]];
|
|
229
309
|
hoverList.push(tri1);
|
|
@@ -231,8 +311,14 @@ const buildHoverState = (props) => (afterLinks) => {
|
|
|
231
311
|
hoverList.push(tri2);
|
|
232
312
|
hoverMap.set(tri2, afterLink);
|
|
233
313
|
} else if (cur[1] === next[1]) {
|
|
234
|
-
|
|
235
|
-
|
|
314
|
+
let left, right;
|
|
315
|
+
if (cur[0] < next[0]) {
|
|
316
|
+
left = cur;
|
|
317
|
+
right = next;
|
|
318
|
+
} else {
|
|
319
|
+
left = next;
|
|
320
|
+
right = cur;
|
|
321
|
+
}
|
|
236
322
|
const tri1 = [left[0], left[1] - hoverHit, left[0], left[1] + hoverHit, right[0], right[1] + hoverHit];
|
|
237
323
|
const tri2 = [right[0], right[1] + hoverHit, right[0], right[1] - hoverHit, left[0], left[1] - hoverHit];
|
|
238
324
|
hoverList.push(tri1);
|
|
@@ -259,7 +345,17 @@ const buildHoverState = (props) => (afterLinks) => {
|
|
|
259
345
|
}
|
|
260
346
|
});
|
|
261
347
|
});
|
|
262
|
-
|
|
348
|
+
};
|
|
349
|
+
const buildGroupHoverState = ({ afterGroups, groupHoverMap, groupHoverList }) => {
|
|
350
|
+
afterGroups.forEach((afterGroup) => {
|
|
351
|
+
const [p0, p1, p2, p3] = afterGroup.coords;
|
|
352
|
+
const tri0 = [p0.x, p3.y, p0.x, p1.y, p2.x, p3.y];
|
|
353
|
+
const tri1 = [p0.x, p1.y, p2.x, p1.y, p2.x, p3.y];
|
|
354
|
+
groupHoverList.push(tri0);
|
|
355
|
+
groupHoverMap.set(tri0, afterGroup);
|
|
356
|
+
groupHoverList.push(tri1);
|
|
357
|
+
groupHoverMap.set(tri1, afterGroup);
|
|
358
|
+
});
|
|
263
359
|
};
|
|
264
360
|
const addListeners = ({ api, state, vm }) => () => {
|
|
265
361
|
api.setListeners();
|
|
@@ -276,6 +372,8 @@ const setListeners = ({ api, emit, props, state, vm }) => () => {
|
|
|
276
372
|
const { config } = props;
|
|
277
373
|
const { delay } = config;
|
|
278
374
|
state.mousemoveListener = debounce(delay, (e) => {
|
|
375
|
+
if (!vm.$refs.canvas)
|
|
376
|
+
return;
|
|
279
377
|
const { left, top } = vm.$refs.canvas.getBoundingClientRect();
|
|
280
378
|
const { clientX, clientY } = e;
|
|
281
379
|
let x = clientX - left;
|
|
@@ -288,55 +386,65 @@ const setListeners = ({ api, emit, props, state, vm }) => () => {
|
|
|
288
386
|
});
|
|
289
387
|
state.clickListener = debounce(delay, (e) => {
|
|
290
388
|
const afterLink = state.hoverAfterLink;
|
|
389
|
+
const afterGroup = state.hoverAfterGroup;
|
|
291
390
|
if (afterLink) {
|
|
292
391
|
emit("click-link", afterLink, e);
|
|
392
|
+
} else if (afterGroup) {
|
|
393
|
+
emit("click-group", afterGroup, e);
|
|
293
394
|
} else {
|
|
294
395
|
emit("click-blank", null, e);
|
|
295
396
|
}
|
|
296
397
|
api.clearDropdown();
|
|
297
398
|
});
|
|
298
399
|
};
|
|
400
|
+
const pointInTriangle = (x0, y0, x1, y1, x2, y2, px, py) => {
|
|
401
|
+
const v0 = [x2 - x0, y2 - y0];
|
|
402
|
+
const v1 = [x1 - x0, y1 - y0];
|
|
403
|
+
const v2 = [px - x0, py - y0];
|
|
404
|
+
const dot00 = v0[0] * v0[0] + v0[1] * v0[1];
|
|
405
|
+
const dot01 = v0[0] * v1[0] + v0[1] * v1[1];
|
|
406
|
+
const dot02 = v0[0] * v2[0] + v0[1] * v2[1];
|
|
407
|
+
const dot11 = v1[0] * v1[0] + v1[1] * v1[1];
|
|
408
|
+
const dot12 = v1[0] * v2[0] + v1[1] * v2[1];
|
|
409
|
+
const inverDeno = 1 / (dot00 * dot11 - dot01 * dot01);
|
|
410
|
+
const u = (dot11 * dot02 - dot01 * dot12) * inverDeno;
|
|
411
|
+
if (u < 0 || u > 1) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
const v = (dot00 * dot12 - dot01 * dot02) * inverDeno;
|
|
415
|
+
if (v < 0 || v > 1) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
return u + v <= 1;
|
|
419
|
+
};
|
|
299
420
|
const hitTest = ({ api, state, vm }) => (x, y) => {
|
|
421
|
+
const { hoverAfterLink = null, hoverAfterGroup = null } = state;
|
|
300
422
|
const { afterData } = state;
|
|
301
423
|
const { hoverState } = afterData;
|
|
302
|
-
const { hoverMap, hoverList } = hoverState;
|
|
303
|
-
|
|
304
|
-
const v0 = [x2 - x0, y2 - y0];
|
|
305
|
-
const v1 = [x1 - x0, y1 - y0];
|
|
306
|
-
const v2 = [px - x0, py - y0];
|
|
307
|
-
const dot00 = v0[0] * v0[0] + v0[1] * v0[1];
|
|
308
|
-
const dot01 = v0[0] * v1[0] + v0[1] * v1[1];
|
|
309
|
-
const dot02 = v0[0] * v2[0] + v0[1] * v2[1];
|
|
310
|
-
const dot11 = v1[0] * v1[0] + v1[1] * v1[1];
|
|
311
|
-
const dot12 = v1[0] * v2[0] + v1[1] * v2[1];
|
|
312
|
-
const inverDeno = 1 / (dot00 * dot11 - dot01 * dot01);
|
|
313
|
-
const u = (dot11 * dot02 - dot01 * dot12) * inverDeno;
|
|
314
|
-
if (u < 0 || u > 1) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
const v = (dot00 * dot12 - dot01 * dot02) * inverDeno;
|
|
318
|
-
if (v < 0 || v > 1) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
return u + v <= 1;
|
|
322
|
-
};
|
|
323
|
-
const tri = hoverList.find((item) => pointInTriangle(...item, x, y));
|
|
424
|
+
const { hoverMap, hoverList, groupHoverMap, groupHoverList } = hoverState;
|
|
425
|
+
let tri = hoverList.find((item) => pointInTriangle(...item, x, y));
|
|
324
426
|
state.hoverAfterLink = tri ? hoverMap.get(tri) : null;
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
|
|
427
|
+
if (!tri) {
|
|
428
|
+
tri = groupHoverList.find((item) => pointInTriangle(...item, x, y));
|
|
429
|
+
state.hoverAfterGroup = tri ? groupHoverMap.get(tri) : null;
|
|
430
|
+
}
|
|
431
|
+
if (hoverAfterLink !== state.hoverAfterLink || hoverAfterGroup !== state.hoverAfterGroup) {
|
|
432
|
+
if (state.hoverAfterLink || state.hoverAfterGroup) {
|
|
433
|
+
vm.$refs.canvas.style.cursor = "pointer";
|
|
434
|
+
api.drawAfterLink();
|
|
435
|
+
} else {
|
|
436
|
+
api.clearHoverAfterLink();
|
|
437
|
+
}
|
|
330
438
|
}
|
|
331
439
|
};
|
|
332
440
|
const clearHoverAfterLink = ({ api, state, vm }) => () => {
|
|
333
|
-
if (state.hoverAfterLink)
|
|
441
|
+
if (state.hoverAfterLink)
|
|
334
442
|
state.hoverAfterLink = null;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (vm.$refs.canvas.style.cursor)
|
|
443
|
+
if (state.hoverAfterGroup)
|
|
444
|
+
state.hoverAfterGroup = null;
|
|
445
|
+
if (vm.$refs.canvas.style.cursor)
|
|
338
446
|
vm.$refs.canvas.style.cursor = "";
|
|
339
|
-
|
|
447
|
+
api.drawAfterLink();
|
|
340
448
|
};
|
|
341
449
|
const clickNode = ({ api, emit }) => (params, e) => {
|
|
342
450
|
const { node, afterNode } = params;
|
|
@@ -352,35 +460,37 @@ const clearDropdown = (state) => (nodeName) => {
|
|
|
352
460
|
});
|
|
353
461
|
};
|
|
354
462
|
const computeMf = ({ api, markRaw, props, state }) => () => {
|
|
355
|
-
const
|
|
356
|
-
const { nodes, links } = hideNodeLink(data);
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const {
|
|
365
|
-
const {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
463
|
+
const afterConfig = normalConfig(props);
|
|
464
|
+
const { nodes, links, groups } = hideNodeLink(props.data);
|
|
465
|
+
const getRow = buildGetRow({ afterConfig, api });
|
|
466
|
+
const getCol = buildGetCol({ afterConfig, api });
|
|
467
|
+
const rectRow = buildRectRow({ afterConfig, getRow });
|
|
468
|
+
const rectNode = buildRectNode({ afterConfig, api, getRow, rectRow });
|
|
469
|
+
let args = { afterConfig, api, getCol, getRow, groups, nodes, rectNode, state };
|
|
470
|
+
const { afterGroups, afterNodes, graph } = buildAfterNodeGraph(args);
|
|
471
|
+
args = { afterConfig, afterNodes, graph, links };
|
|
472
|
+
const { afterLinks, arrows } = buildAfterLinkArrow(args);
|
|
473
|
+
const hoverState = api.buildHoverState({ afterGroups, afterLinks });
|
|
474
|
+
state.afterData = markRaw({ afterConfig, afterGroups, afterLinks, afterNodes, arrows, graph, hoverState });
|
|
475
|
+
state.wrapperStyle = { width: `${graph.width}px`, height: `${graph.height}px` };
|
|
476
|
+
};
|
|
477
|
+
const normalConfig = (props) => {
|
|
478
|
+
const { config } = props;
|
|
479
|
+
const { align = "", arrowEdge = 4, condHeight = 20, condWidth = 60 } = config;
|
|
480
|
+
const { font = "", gap = 0, height = 0, lineWidth = 1, linkEndMinus = 3 } = config;
|
|
481
|
+
const { padding = 0, prior = "", radius = 4, showArrow = true, width = 0 } = config;
|
|
482
|
+
const { extraWidth = 0, extraHeight = 0 } = config;
|
|
483
|
+
const cfg = { align, arrowEdge, condHeight, condWidth, font, gap, height, lineWidth, linkEndMinus };
|
|
484
|
+
Object.assign(cfg, { padding, prior, radius, showArrow, width, extraWidth, extraHeight });
|
|
485
|
+
const afterConfig = Object.assign({}, config, cfg);
|
|
486
|
+
afterConfig.thin = false;
|
|
487
|
+
return afterConfig;
|
|
378
488
|
};
|
|
379
489
|
const isMf = (mode) => () => mode === "mobile-first";
|
|
380
|
-
const getNodeDef = (node, type) => {
|
|
490
|
+
const getNodeDef = (props) => (node, type) => {
|
|
381
491
|
const shape = node.info.shape || "circle";
|
|
382
492
|
if (shape === "circle")
|
|
383
|
-
return 40;
|
|
493
|
+
return props.config.nodeWrapperSize || 40;
|
|
384
494
|
if (shape === "rectangle") {
|
|
385
495
|
if (type === "width")
|
|
386
496
|
return 160;
|
|
@@ -389,45 +499,45 @@ const getNodeDef = (node, type) => {
|
|
|
389
499
|
}
|
|
390
500
|
return 0;
|
|
391
501
|
};
|
|
392
|
-
const getNode = (node, type) => {
|
|
502
|
+
const getNode = (api) => (node, type) => {
|
|
393
503
|
const shape = node.info.shape || "circle";
|
|
394
504
|
if (shape === "circle") {
|
|
395
|
-
return node.info.width || getNodeDef(node, type);
|
|
505
|
+
return node.info.width || api.getNodeDef(node, type);
|
|
396
506
|
}
|
|
397
507
|
if (shape === "rectangle") {
|
|
398
|
-
return node.info[type] || getNodeDef(node, type);
|
|
508
|
+
return node.info[type] || api.getNodeDef(node, type);
|
|
399
509
|
}
|
|
400
510
|
return 0;
|
|
401
511
|
};
|
|
402
|
-
const buildGetRow = (
|
|
512
|
+
const buildGetRow = ({ api, afterConfig }) => (afterNodes, row, type) => {
|
|
403
513
|
const rowAfterNodes = afterNodes.filter((afterNode) => afterNode.row === row);
|
|
404
514
|
const rowNodes = rowAfterNodes.map((rowAfterNode) => rowAfterNode.raw);
|
|
405
515
|
if (rowNodes.length > 0) {
|
|
406
516
|
if (type === "width") {
|
|
407
|
-
return rowNodes.reduce((p, c) => p + getNode(c, type), 0) + (rowNodes.length - 1) * gap;
|
|
517
|
+
return rowNodes.reduce((p, c) => p + api.getNode(c, type), 0) + (rowNodes.length - 1) * afterConfig.gap;
|
|
408
518
|
}
|
|
409
519
|
if (type === "height") {
|
|
410
|
-
return Math.max(...rowNodes.map((rowNode) => getNode(rowNode, type)));
|
|
520
|
+
return Math.max(...rowNodes.map((rowNode) => api.getNode(rowNode, type)));
|
|
411
521
|
}
|
|
412
522
|
}
|
|
413
523
|
return 0;
|
|
414
524
|
};
|
|
415
|
-
const buildGetCol = (
|
|
525
|
+
const buildGetCol = ({ api, afterConfig }) => (afterNodes, col, type) => {
|
|
416
526
|
const colAfterNodes = afterNodes.filter((afterNode) => afterNode.col === col);
|
|
417
527
|
const colNodes = colAfterNodes.map((colAfterNode) => colAfterNode.raw);
|
|
418
528
|
if (colNodes.length > 0) {
|
|
419
529
|
if (type === "width") {
|
|
420
|
-
return Math.max(...colNodes.map((colNode) => getNode(colNode, type)));
|
|
530
|
+
return Math.max(...colNodes.map((colNode) => api.getNode(colNode, type)));
|
|
421
531
|
}
|
|
422
532
|
if (type === "height") {
|
|
423
|
-
return colNodes.reduce((p, c) => p + getNode(c, type), 0) + (colNodes.length - 1) * gap;
|
|
533
|
+
return colNodes.reduce((p, c) => p + api.getNode(c, type), 0) + (colNodes.length - 1) * afterConfig.gap;
|
|
424
534
|
}
|
|
425
535
|
}
|
|
426
536
|
return 0;
|
|
427
537
|
};
|
|
428
|
-
const buildRectRow = ({ getRow,
|
|
538
|
+
const buildRectRow = ({ getRow, afterConfig }) => (afterNodes, row, graph) => {
|
|
429
539
|
const accrueRowHeight = Array.from({ length: row }).map((c, i) => i).map((i) => getRow(afterNodes, i, "height")).reduce((p, c) => p + c, 0);
|
|
430
|
-
const accrueGapHeight = row > 0 ? row * gap : 0;
|
|
540
|
+
const accrueGapHeight = row > 0 ? row * afterConfig.gap : 0;
|
|
431
541
|
return {
|
|
432
542
|
x: 0,
|
|
433
543
|
y: accrueRowHeight + accrueGapHeight,
|
|
@@ -435,30 +545,31 @@ const buildRectRow = ({ getRow, gap }) => (afterNodes, row, graph) => {
|
|
|
435
545
|
height: getRow(afterNodes, row, "height")
|
|
436
546
|
};
|
|
437
547
|
};
|
|
438
|
-
const buildRectNode = ({
|
|
548
|
+
const buildRectNode = ({ api, rectRow, afterConfig, getRow }) => (afterNode, afterNodes, graph) => {
|
|
439
549
|
const { row, col } = afterNode;
|
|
440
550
|
const prevRowRect = rectRow(afterNodes, row - 1, graph);
|
|
441
551
|
const rowRect = rectRow(afterNodes, row, graph);
|
|
442
|
-
const width = getNode(afterNode.raw, "width");
|
|
443
|
-
const height = getNode(afterNode.raw, "height");
|
|
444
|
-
const y = prevRowRect.y + prevRowRect.height + (row > 0 ? gap : 0) + (rowRect.height - height) / 2;
|
|
552
|
+
const width = api.getNode(afterNode.raw, "width");
|
|
553
|
+
const height = api.getNode(afterNode.raw, "height");
|
|
554
|
+
const y = prevRowRect.y + prevRowRect.height + (row > 0 ? afterConfig.gap : 0) + (rowRect.height - height) / 2;
|
|
445
555
|
const rowAfterNodes = afterNodes.filter((afterNode2) => afterNode2.row === row);
|
|
446
556
|
const get = (i) => rowAfterNodes.find((rowAfterNode) => rowAfterNode.col === i);
|
|
447
557
|
const accrueColWidth = Array.from({ length: col }).map((c, i) => i).map((i) => {
|
|
448
558
|
const afterNode2 = get(i);
|
|
449
|
-
return afterNode2 ? getNode(afterNode2.raw, "width") : 0;
|
|
559
|
+
return afterNode2 ? api.getNode(afterNode2.raw, "width") : 0;
|
|
450
560
|
}).reduce((p, c) => p + c, 0);
|
|
451
|
-
const accrueGapWidth = col > 0 ? col * gap : 0;
|
|
452
|
-
const dx = align === "center" ? (graph.width - getRow(afterNodes, row, "width")) / 2 : 0;
|
|
561
|
+
const accrueGapWidth = col > 0 ? col * afterConfig.gap : 0;
|
|
562
|
+
const dx = afterConfig.align === "center" ? (graph.width - getRow(afterNodes, row, "width")) / 2 : 0;
|
|
453
563
|
const x = accrueColWidth + accrueGapWidth + dx;
|
|
454
564
|
return { x, y, width, height };
|
|
455
565
|
};
|
|
456
|
-
const normalRowCol = (nodes) => {
|
|
566
|
+
const normalRowCol = ({ afterConfig, nodes }) => {
|
|
457
567
|
let rows = /* @__PURE__ */ new Set();
|
|
458
568
|
const rowMap = /* @__PURE__ */ new Map();
|
|
569
|
+
const autoAdjustPos = afterConfig.autoAdjust !== false;
|
|
459
570
|
nodes.forEach((node) => !rows.has(node.info.row) && rows.add(node.info.row));
|
|
460
571
|
rows = [...rows].sort((a, b) => a - b);
|
|
461
|
-
rows.forEach((row, i) => rowMap.set(row, i));
|
|
572
|
+
rows.forEach((row, i) => rowMap.set(row, autoAdjustPos ? i : row));
|
|
462
573
|
const afterNodes = nodes.map((node) => {
|
|
463
574
|
return { type: "node", row: rowMap.get(node.info.row), col: 0, raw: node };
|
|
464
575
|
});
|
|
@@ -468,120 +579,361 @@ const normalRowCol = (nodes) => {
|
|
|
468
579
|
const colMap = /* @__PURE__ */ new Map();
|
|
469
580
|
cols = new Set(cols);
|
|
470
581
|
cols = [...cols].sort((a, b) => a - b);
|
|
471
|
-
cols.forEach((col, i) => colMap.set(col, i));
|
|
582
|
+
cols.forEach((col, i) => colMap.set(col, autoAdjustPos ? i : col));
|
|
472
583
|
rowAfterNodes.forEach((rowAfterNode) => rowAfterNode.col = colMap.get(rowAfterNode.raw.info.col));
|
|
473
584
|
});
|
|
474
585
|
return afterNodes;
|
|
475
586
|
};
|
|
476
|
-
const
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
const maxCol = Math.max(...afterNodes.map((afterNode) => afterNode.col));
|
|
480
|
-
const graph = { width: 0, height: 0, thin, thinValue: 1 };
|
|
587
|
+
const defaultLayout = ({ afterConfig, afterNodes, getCol, getRow, graph, maxCol, maxRow, rectNode }) => {
|
|
588
|
+
const { height, padding, width } = afterConfig;
|
|
589
|
+
let tmp;
|
|
481
590
|
for (let i = 0; i <= maxRow; i++) {
|
|
482
|
-
|
|
483
|
-
|
|
591
|
+
if ((tmp = getRow(afterNodes, i, "width")) > graph.width)
|
|
592
|
+
graph.width = tmp;
|
|
484
593
|
}
|
|
485
594
|
for (let i = 0; i <= maxCol; i++) {
|
|
486
|
-
|
|
487
|
-
|
|
595
|
+
if ((tmp = getCol(afterNodes, i, "height")) > graph.height)
|
|
596
|
+
graph.height = tmp;
|
|
488
597
|
}
|
|
489
598
|
afterNodes.forEach((afterNode) => Object.assign(afterNode, rectNode(afterNode, afterNodes, graph)));
|
|
490
599
|
if (padding > 0) {
|
|
491
|
-
|
|
492
|
-
graph.
|
|
600
|
+
tmp = 2 * padding;
|
|
601
|
+
graph.width += tmp;
|
|
602
|
+
graph.height += tmp;
|
|
493
603
|
afterNodes.forEach((afterNode) => {
|
|
494
604
|
afterNode.x += padding;
|
|
495
605
|
afterNode.y += padding;
|
|
496
606
|
});
|
|
497
607
|
}
|
|
498
|
-
let dx = 0;
|
|
499
|
-
let dy = 0;
|
|
500
608
|
if (width > graph.width) {
|
|
501
|
-
|
|
609
|
+
tmp = (width - graph.width) / 2;
|
|
502
610
|
graph.width = width;
|
|
503
|
-
afterNodes.forEach((afterNode) => afterNode.x +=
|
|
611
|
+
afterNodes.forEach((afterNode) => afterNode.x += tmp);
|
|
504
612
|
}
|
|
505
613
|
if (height > graph.height) {
|
|
506
|
-
|
|
614
|
+
tmp = (height - graph.height) / 2;
|
|
507
615
|
graph.height = height;
|
|
508
|
-
afterNodes.forEach((afterNode) => afterNode.y +=
|
|
616
|
+
afterNodes.forEach((afterNode) => afterNode.y += tmp);
|
|
509
617
|
}
|
|
510
|
-
return { afterNodes, graph };
|
|
511
618
|
};
|
|
512
|
-
const
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
619
|
+
const dotModeAdjust = ({ afterConfig, afterNodes, graph, maxCol, state }) => {
|
|
620
|
+
const { padding } = afterConfig;
|
|
621
|
+
if (afterConfig.type === "dot" && state.temporary.graphWidth) {
|
|
622
|
+
graph.width = state.temporary.graphWidth < graph.minWidth ? graph.minWidth : state.temporary.graphWidth;
|
|
623
|
+
const colSize = (graph.width - 2 * padding) / (maxCol + 1);
|
|
624
|
+
afterNodes.forEach((afterNode) => {
|
|
625
|
+
afterNode.x = ~~((afterNode.col + 0.5) * colSize + padding) + state.temporary.adjustX;
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const customLayout = ({ afterConfig, afterNodes, graph }) => {
|
|
630
|
+
if (typeof afterConfig.layout === "function") {
|
|
631
|
+
const graphHeight = graph.height;
|
|
632
|
+
const graphWidth = graph.width;
|
|
633
|
+
const coords = afterConfig.layout({ afterNodes, graphHeight, graphWidth });
|
|
634
|
+
if (coords && coords.length === afterNodes.length) {
|
|
635
|
+
afterNodes.forEach((afterNode, i) => {
|
|
636
|
+
if (coords[i]) {
|
|
637
|
+
afterNode.x = Number(coords[i].x) || 0;
|
|
638
|
+
afterNode.y = Number(coords[i].y) || 0;
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const calcGraphMinSize = ({ afterConfig, afterNodes, api, graph, maxCol, maxRow }) => {
|
|
645
|
+
const { gap, padding, extraWidth, extraHeight } = afterConfig;
|
|
646
|
+
const maxNodeSize = { width: 0, height: 0 };
|
|
647
|
+
let tempSize;
|
|
648
|
+
afterNodes.forEach((afterNode) => {
|
|
649
|
+
if ((tempSize = api.getNode(afterNode.raw, "width")) > maxNodeSize.width) {
|
|
650
|
+
maxNodeSize.width = tempSize;
|
|
651
|
+
}
|
|
652
|
+
if ((tempSize = api.getNode(afterNode.raw, "height")) > maxNodeSize.height) {
|
|
653
|
+
maxNodeSize.height = tempSize;
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
graph.minWidth = (maxCol + 1) * maxNodeSize.width + maxCol * gap + 2 * padding + extraWidth;
|
|
657
|
+
graph.minHeight = (maxRow + 1) * maxNodeSize.height + maxRow * gap + 2 * padding + extraHeight;
|
|
658
|
+
};
|
|
659
|
+
const buildAfterNodeGraph = (args) => {
|
|
660
|
+
const { afterConfig, api, getCol, getRow, groups, nodes, rectNode, state } = args;
|
|
661
|
+
const afterNodes = normalRowCol({ afterConfig, nodes });
|
|
662
|
+
const maxRow = Math.max(...afterNodes.map((afterNode) => afterNode.row));
|
|
663
|
+
const maxCol = Math.max(...afterNodes.map((afterNode) => afterNode.col));
|
|
664
|
+
const graph = { width: 0, height: 0, minWidth: 0, minHeight: 0, thin: afterConfig.thin, thinValue: 1 };
|
|
665
|
+
calcGraphMinSize({ afterConfig, afterNodes, api, graph, maxCol, maxRow });
|
|
666
|
+
defaultLayout({ afterConfig, afterNodes, getCol, getRow, graph, maxCol, maxRow, rectNode });
|
|
667
|
+
dotModeAdjust({ afterConfig, afterNodes, graph, maxCol, state });
|
|
668
|
+
customLayout({ afterConfig, afterNodes, graph });
|
|
669
|
+
const afterGroups = computeGroup({ afterConfig, afterNodes, graph, groups });
|
|
670
|
+
return { afterGroups, afterNodes, graph };
|
|
671
|
+
};
|
|
672
|
+
const computeGroup = ({ afterConfig, afterNodes, graph, groups }) => {
|
|
673
|
+
if (groups && groups.length) {
|
|
674
|
+
return groups.map((group) => {
|
|
675
|
+
const afterGroup = { coords: [], width: 0, height: 0, raw: group };
|
|
676
|
+
const coords = computeGroupCoord({ afterNodes, group });
|
|
677
|
+
const padding = [0, 0];
|
|
678
|
+
const adjust = adjustLine(afterConfig);
|
|
679
|
+
const { condWidth, condHeight } = afterConfig;
|
|
680
|
+
afterGroup.width = condWidth;
|
|
681
|
+
afterGroup.height = condHeight;
|
|
682
|
+
if (typeof group.padding === "number") {
|
|
683
|
+
padding[0] = padding[1] = group.padding;
|
|
684
|
+
} else if (Array.isArray(group.padding) && group.padding.length > 1) {
|
|
685
|
+
padding[0] = group.padding[0];
|
|
686
|
+
padding[1] = group.padding[1];
|
|
687
|
+
}
|
|
688
|
+
coords[0] = coords[0] - padding[1] < 0 ? 0 : coords[0] - padding[1];
|
|
689
|
+
coords[1] = coords[1] + padding[1] > graph.width ? graph.width : coords[1] + padding[1];
|
|
690
|
+
coords[2] = coords[2] - padding[0] < 0 ? 0 : coords[2] - padding[0];
|
|
691
|
+
coords[3] = coords[3] + padding[0] > graph.height ? graph.height : coords[3] + padding[0];
|
|
692
|
+
const p0 = { x: coords[0], y: coords[2] };
|
|
693
|
+
const p1 = { x: coords[0], y: coords[3] };
|
|
694
|
+
const p2 = { x: coords[1], y: coords[3] };
|
|
695
|
+
const p3 = { x: coords[1], y: coords[2] };
|
|
696
|
+
adjust({ from: p0, to: p1 });
|
|
697
|
+
adjust({ from: p1, to: p2 });
|
|
698
|
+
adjust({ from: p2, to: p3 });
|
|
699
|
+
adjust({ from: p3, to: p0 });
|
|
700
|
+
const dx = ~~((p3.x - p0.x) / 2);
|
|
701
|
+
const dy = ~~((p1.y - p0.y) / 2);
|
|
702
|
+
p0.y += dy;
|
|
703
|
+
p1.x += dx;
|
|
704
|
+
p2.y -= dy;
|
|
705
|
+
p3.x -= dx;
|
|
706
|
+
afterGroup.coords.push(p0, p1, p2, p3);
|
|
707
|
+
return afterGroup;
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
const computeGroupCoord = ({ afterNodes, group }) => {
|
|
712
|
+
const points = [];
|
|
713
|
+
const coords = ["", "", "", ""];
|
|
714
|
+
group.nodes.map((name) => afterNodes.find((afterNode) => afterNode.raw.name === name)).forEach(({ x, y, width, height }) => {
|
|
715
|
+
points.push({ x, y });
|
|
716
|
+
points.push({ x: x + width, y: y + height });
|
|
717
|
+
});
|
|
718
|
+
points.forEach(({ x, y }) => {
|
|
719
|
+
if (typeof coords[0] !== "number" || x < coords[0])
|
|
720
|
+
coords[0] = x;
|
|
721
|
+
if (typeof coords[1] !== "number" || x > coords[1])
|
|
722
|
+
coords[1] = x;
|
|
723
|
+
if (typeof coords[2] !== "number" || y < coords[2])
|
|
724
|
+
coords[2] = y;
|
|
725
|
+
if (typeof coords[3] !== "number" || y > coords[3])
|
|
726
|
+
coords[3] = y;
|
|
727
|
+
});
|
|
728
|
+
return coords;
|
|
729
|
+
};
|
|
730
|
+
const adjustLineEnd = ({ arrowEndMinus, e, from, isVertical, linkEndMinus, linkOffset, s, to }) => {
|
|
731
|
+
if (s) {
|
|
518
732
|
if (isVertical) {
|
|
519
|
-
|
|
733
|
+
to.y += (to.y > from.y ? -1 : 1) * (linkEndMinus + (arrowEndMinus || 0));
|
|
520
734
|
} else {
|
|
521
|
-
|
|
735
|
+
to.x += (to.x > from.x ? -1 : 1) * (linkEndMinus + (arrowEndMinus || 0));
|
|
522
736
|
}
|
|
523
|
-
}
|
|
737
|
+
}
|
|
738
|
+
if (e) {
|
|
524
739
|
if (isVertical) {
|
|
525
|
-
|
|
740
|
+
from.y += (to.y > from.y ? 1 : -1) * (linkOffset || 0);
|
|
526
741
|
} else {
|
|
527
|
-
|
|
742
|
+
from.x += (to.x > from.x ? 1 : -1) * (linkOffset || 0);
|
|
528
743
|
}
|
|
529
744
|
}
|
|
530
745
|
};
|
|
531
|
-
const
|
|
532
|
-
const
|
|
533
|
-
const
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
746
|
+
const adjustLine = ({ lineWidth, linkEndMinus }) => ({ from, to, s, arrowEndMinus, e, linkOffset }) => {
|
|
747
|
+
const dpr = window.devicePixelRatio;
|
|
748
|
+
const isOdd = lineWidth & 1;
|
|
749
|
+
const dx = Math.abs(from.x - to.x);
|
|
750
|
+
const isVertical = dx < Number.EPSILON;
|
|
751
|
+
if (isVertical) {
|
|
752
|
+
from.x = to.x = Math.floor(from.x) + (isOdd ? 0.5 / dpr : 0);
|
|
753
|
+
} else {
|
|
754
|
+
from.y = to.y = Math.floor(from.y) + (isOdd ? 0.5 / dpr : 0);
|
|
755
|
+
}
|
|
756
|
+
adjustLineEnd({ arrowEndMinus, e, from, isVertical, linkEndMinus, linkOffset, s, to });
|
|
757
|
+
return { x: ~~((from.x + to.x) / 2), y: ~~((from.y + to.y) / 2) };
|
|
758
|
+
};
|
|
759
|
+
const pathParser = ({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius }) => {
|
|
760
|
+
const arrowEndMinus = afterLink.raw.arrowEndMinus;
|
|
761
|
+
const linkOffset = afterLink.raw.linkOffset;
|
|
762
|
+
const len = points.length;
|
|
763
|
+
const p = [];
|
|
764
|
+
for (let i = 1; i < len; i++) {
|
|
765
|
+
adjust({ from: points[i - 1], to: points[i], s: i === len - 1, arrowEndMinus, e: i === 1, linkOffset });
|
|
766
|
+
}
|
|
767
|
+
const prevPoint = points[points.length - 2];
|
|
768
|
+
const lastPoint = points[points.length - 1];
|
|
769
|
+
if (len === 2) {
|
|
770
|
+
p.push(`m,${points[0].x},${points[0].y}`);
|
|
771
|
+
p.push(`l,${points[1].x},${points[1].y}`);
|
|
772
|
+
} else {
|
|
773
|
+
for (let i = 0; i < len - 1; i++) {
|
|
774
|
+
if (i === 0) {
|
|
775
|
+
p.push(`m,${points[i].x},${points[i].y}`);
|
|
776
|
+
} else {
|
|
777
|
+
p.push(`a,${points[i].x},${points[i].y},${points[i + 1].x},${points[i + 1].y},${radius}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
p.push(`l,${lastPoint.x},${lastPoint.y}`);
|
|
781
|
+
}
|
|
782
|
+
afterLink.p = p;
|
|
783
|
+
if (linear) {
|
|
784
|
+
afterLink.linearGrad = { from: points[0], to: lastPoint, linear };
|
|
785
|
+
}
|
|
786
|
+
if (midpoint) {
|
|
787
|
+
afterLink.mid = midpoint;
|
|
788
|
+
} else {
|
|
789
|
+
afterLink.mid = { x: ~~((prevPoint.x + lastPoint.x) / 2), y: ~~((prevPoint.y + lastPoint.y) / 2) };
|
|
790
|
+
middir = getMiddir(prevPoint, lastPoint);
|
|
791
|
+
}
|
|
792
|
+
afterLink.middir = middir;
|
|
793
|
+
arrow(prevPoint, lastPoint);
|
|
794
|
+
};
|
|
795
|
+
const getMiddir = (prev, last) => {
|
|
796
|
+
let middir = "r";
|
|
797
|
+
if (prev.x !== last.x) {
|
|
798
|
+
middir = prev.x > last.x ? "l" : "r";
|
|
799
|
+
} else if (prev.y !== last.y) {
|
|
800
|
+
middir = prev.y > last.y ? "u" : "d";
|
|
801
|
+
}
|
|
802
|
+
return middir;
|
|
803
|
+
};
|
|
804
|
+
const validLinkPath = (res) => {
|
|
805
|
+
let points, midpoint, middir, linear, flag;
|
|
806
|
+
if (Array.isArray(res) && res.length > 1) {
|
|
807
|
+
points = res;
|
|
808
|
+
midpoint = null;
|
|
809
|
+
middir = null;
|
|
810
|
+
linear = null;
|
|
811
|
+
flag = true;
|
|
812
|
+
} else if (res && Array.isArray(res.path) && res.path.length > 1) {
|
|
813
|
+
points = res.path;
|
|
814
|
+
midpoint = res.mid ? res.mid : null;
|
|
815
|
+
middir = res.middir || "r";
|
|
816
|
+
linear = res.linear ? res.linear : null;
|
|
817
|
+
flag = true;
|
|
818
|
+
}
|
|
819
|
+
return { points, midpoint, middir, linear, flag };
|
|
820
|
+
};
|
|
821
|
+
const customRoute = ({ adjust, afterConfig, afterLink, afterNodes, arrow }) => {
|
|
822
|
+
const { linkPath, radius } = afterConfig;
|
|
823
|
+
let valid = false;
|
|
824
|
+
if (Array.isArray(linkPath)) {
|
|
825
|
+
for (let i = 0; i < linkPath.length; i++) {
|
|
826
|
+
if (hitMatch(linkPath[i], afterLink)) {
|
|
827
|
+
const { points, midpoint, middir, linear, flag } = validLinkPath(linkPath[i].method({ afterLink, afterNodes }));
|
|
828
|
+
if (flag) {
|
|
829
|
+
valid = true;
|
|
830
|
+
pathParser({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius });
|
|
831
|
+
}
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
} else if (linkPath && typeof linkPath.method === "function") {
|
|
836
|
+
if (hitMatch(linkPath, afterLink)) {
|
|
837
|
+
const { points, midpoint, middir, linear, flag } = validLinkPath(linkPath.method({ afterLink, afterNodes }));
|
|
838
|
+
if (flag) {
|
|
839
|
+
valid = true;
|
|
840
|
+
pathParser({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius });
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
return valid;
|
|
845
|
+
};
|
|
846
|
+
const defaultRoute = (args) => {
|
|
847
|
+
const { adjust, afterConfig, afterLink, arrow, link } = args;
|
|
848
|
+
const { prior, radius } = afterConfig;
|
|
849
|
+
const { f, t, p } = afterLink;
|
|
850
|
+
const { arrowEndMinus, linkOffset } = link;
|
|
851
|
+
const dx = Math.abs(f.x - t.x);
|
|
852
|
+
const dy = Math.abs(f.y - t.y);
|
|
853
|
+
if (dx < Number.EPSILON || dy < Number.EPSILON) {
|
|
854
|
+
afterLink.mid = adjust({ from: f, to: t, s: 1, arrowEndMinus, e: 1, linkOffset });
|
|
855
|
+
afterLink.middir = getMiddir(f, t);
|
|
856
|
+
p.push(`m,${f.x},${f.y}`);
|
|
857
|
+
p.push(`l,${t.x},${t.y}`);
|
|
858
|
+
arrow(f, t);
|
|
859
|
+
} else {
|
|
860
|
+
const mid = [(f.x + t.x) / 2, (f.y + t.y) / 2];
|
|
861
|
+
if (!prior || prior === "vertical") {
|
|
862
|
+
const tmp0 = { x: f.x, y: mid[1] };
|
|
863
|
+
const tmp1 = { x: t.x, y: mid[1] };
|
|
864
|
+
adjust({ from: f, to: tmp0, s: 0, e: 1, linkOffset });
|
|
865
|
+
afterLink.mid = adjust({ from: tmp0, to: tmp1, s: 0, e: 0 });
|
|
866
|
+
afterLink.middir = getMiddir(tmp0, tmp1);
|
|
867
|
+
adjust({ from: tmp1, to: t, s: 1, arrowEndMinus, e: 0 });
|
|
868
|
+
mid[1] = tmp0.y;
|
|
546
869
|
p.push(`m,${f.x},${f.y}`);
|
|
870
|
+
p.push(`a,${f.x},${mid[1]},${mid[0]},${mid[1]},${radius}`);
|
|
871
|
+
p.push(`a,${t.x},${mid[1]},${t.x},${t.y},${radius}`);
|
|
547
872
|
p.push(`l,${t.x},${t.y}`);
|
|
548
|
-
|
|
549
|
-
} else {
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
873
|
+
arrow({ x: t.x, y: mid[1] }, t);
|
|
874
|
+
} else if (prior === "horizontal") {
|
|
875
|
+
const tmp0 = { x: mid[0], y: f.y };
|
|
876
|
+
const tmp1 = { x: mid[0], y: t.y };
|
|
877
|
+
adjust({ from: f, to: tmp0, s: 0, e: 1, linkOffset });
|
|
878
|
+
afterLink.mid = adjust({ from: tmp0, to: tmp1, s: 0, e: 0 });
|
|
879
|
+
afterLink.middir = getMiddir(tmp0, tmp1);
|
|
880
|
+
adjust({ from: tmp1, to: t, s: 1, arrowEndMinus, e: 0 });
|
|
881
|
+
mid[0] = tmp0.x;
|
|
882
|
+
p.push(`m,${f.x},${f.y}`);
|
|
883
|
+
p.push(`a,${mid[0]},${f.y},${mid[0]},${mid[1]},${radius}`);
|
|
884
|
+
p.push(`a,${mid[0]},${t.y},${t.x},${t.y},${radius}`);
|
|
885
|
+
p.push(`l,${t.x},${t.y}`);
|
|
886
|
+
arrow({ x: mid[0], y: t.y }, t);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
const computeLinkEnds = ({ afterNodes, graph, link }) => {
|
|
891
|
+
const { from, to } = link;
|
|
892
|
+
const f = point({
|
|
893
|
+
afterNode: afterNodes.find((afterNode) => afterNode.raw.name === from),
|
|
894
|
+
graph,
|
|
895
|
+
link,
|
|
896
|
+
type: 0
|
|
897
|
+
});
|
|
898
|
+
const t = point({
|
|
899
|
+
afterNode: afterNodes.find((afterNode) => afterNode.raw.name === to),
|
|
900
|
+
graph,
|
|
901
|
+
link,
|
|
902
|
+
type: 1
|
|
903
|
+
});
|
|
904
|
+
return { f, t };
|
|
905
|
+
};
|
|
906
|
+
const buildAfterLinkArrow = (args) => {
|
|
907
|
+
let { afterConfig, afterNodes, graph, links } = args;
|
|
908
|
+
const { condWidth, condHeight } = afterConfig;
|
|
909
|
+
const arrows = [];
|
|
910
|
+
const buildArrow = getBuildArrow({ arrows, afterConfig });
|
|
911
|
+
const adjust = adjustLine(afterConfig);
|
|
912
|
+
const afterLinks = links.map((link) => {
|
|
913
|
+
const { f, t } = computeLinkEnds({ afterNodes, graph, link });
|
|
914
|
+
const cond = !!(link && link.info.other && link.info.other.title);
|
|
915
|
+
const afterLink = { arrow: null, cond, f, linearGrad: null, mid: null };
|
|
916
|
+
Object.assign(afterLink, { p: [], raw: link, rect: null, t, type: "link" });
|
|
917
|
+
const arrow = (f2, t2) => buildArrow(f2, t2, link, afterLink);
|
|
918
|
+
const flag = customRoute({ adjust, afterConfig, afterLink, afterNodes, arrow });
|
|
919
|
+
if (!flag) {
|
|
920
|
+
defaultRoute({ adjust, afterConfig, afterLink, arrow, link });
|
|
576
921
|
}
|
|
577
|
-
|
|
922
|
+
afterLink.rect = {
|
|
923
|
+
x: ~~(afterLink.mid.x - condWidth / 2),
|
|
924
|
+
y: ~~(afterLink.mid.y - condHeight / 2),
|
|
925
|
+
w: condWidth,
|
|
926
|
+
h: condHeight
|
|
927
|
+
};
|
|
928
|
+
return afterLink;
|
|
578
929
|
});
|
|
579
930
|
return { afterLinks, arrows };
|
|
580
931
|
};
|
|
581
|
-
const point = (afterNode,
|
|
932
|
+
const point = ({ afterNode, graph, link, type }) => {
|
|
582
933
|
const exp = /^(bottom|top|left|right)$/;
|
|
583
934
|
const variant = /^(bottom|top|left|right)-(\d+)\/(\d+)$/;
|
|
584
935
|
const res = { x: 0, y: 0 };
|
|
936
|
+
const joint = type ? link.toJoint || "top" : link.fromJoint || "bottom";
|
|
585
937
|
if (exp.test(joint)) {
|
|
586
938
|
if (joint === "bottom") {
|
|
587
939
|
res.x = afterNode.x + afterNode.width / 2;
|
|
@@ -621,66 +973,110 @@ const point = (afterNode, joint, graph) => {
|
|
|
621
973
|
}
|
|
622
974
|
return res;
|
|
623
975
|
};
|
|
624
|
-
const getBuildArrow = ({ arrows,
|
|
625
|
-
const
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
|
|
976
|
+
const getBuildArrow = ({ arrows, afterConfig }) => (from, to, link, afterLink) => {
|
|
977
|
+
const { arrowEdge, linkEndMinus, showArrow } = afterConfig;
|
|
978
|
+
const { showArrow: linkShowArrow = true } = link;
|
|
979
|
+
if (!showArrow || !linkShowArrow)
|
|
980
|
+
return;
|
|
981
|
+
const p0 = { x: 0, y: 0 };
|
|
982
|
+
const p2 = { x: 0, y: 0 };
|
|
983
|
+
const dx = from.x - to.x;
|
|
984
|
+
const dy = from.y - to.y;
|
|
629
985
|
const absx = Math.abs(dx);
|
|
630
986
|
const absy = Math.abs(dy);
|
|
631
987
|
let t = 1;
|
|
632
988
|
const edge = arrowEdge;
|
|
633
989
|
if (absx < Number.EPSILON) {
|
|
634
990
|
t = dy > 0 ? 1 : dy < 0 ? -1 : 1;
|
|
635
|
-
|
|
636
|
-
p0
|
|
637
|
-
|
|
638
|
-
p2
|
|
991
|
+
to.y -= t * linkEndMinus;
|
|
992
|
+
p0.x = to.x - edge;
|
|
993
|
+
p0.y = to.y + Math.sqrt(3) * edge * t;
|
|
994
|
+
p2.x = to.x + edge;
|
|
995
|
+
p2.y = p0.y;
|
|
639
996
|
if (dy !== 0) {
|
|
640
|
-
arrows.push({ p0, p1: to, p2, link });
|
|
997
|
+
arrows.push(afterLink.arrow = { p0, p1: to, p2, link });
|
|
641
998
|
}
|
|
642
999
|
}
|
|
643
1000
|
if (absy < Number.EPSILON) {
|
|
644
1001
|
t = dx > 0 ? 1 : dx < 0 ? -1 : 1;
|
|
645
|
-
|
|
646
|
-
p0
|
|
647
|
-
|
|
648
|
-
p2
|
|
1002
|
+
to.x -= t * linkEndMinus;
|
|
1003
|
+
p0.x = to.x + Math.sqrt(3) * edge * t;
|
|
1004
|
+
p0.y = to.y - edge;
|
|
1005
|
+
p2.x = p0.x;
|
|
1006
|
+
p2.y = to.y + edge;
|
|
649
1007
|
if (dx !== 0) {
|
|
650
|
-
arrows.push({ p0, p1: to, p2, link });
|
|
1008
|
+
arrows.push(afterLink.arrow = { p0, p1: to, p2, link });
|
|
651
1009
|
}
|
|
652
1010
|
}
|
|
653
1011
|
};
|
|
654
1012
|
const hideNodeLink = (data) => {
|
|
655
|
-
let { nodes, links } = data;
|
|
1013
|
+
let { nodes, links, groups } = data;
|
|
656
1014
|
const hiddenNodeNames = nodes.filter((node) => node.hidden === true).map((node) => node.name);
|
|
657
1015
|
nodes = nodes.filter((node) => node.hidden !== true);
|
|
658
1016
|
links = links.filter((link) => !~hiddenNodeNames.indexOf(link.from) && !~hiddenNodeNames.indexOf(link.to));
|
|
659
|
-
|
|
1017
|
+
if (Array.isArray(groups)) {
|
|
1018
|
+
groups = groups.filter((group) => {
|
|
1019
|
+
group.nodes = group.nodes.filter((name) => !~hiddenNodeNames.indexOf(name));
|
|
1020
|
+
return group.nodes.length > 0;
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
return { nodes, links, groups };
|
|
660
1024
|
};
|
|
661
|
-
const drawArrow = ({
|
|
662
|
-
const {
|
|
663
|
-
|
|
664
|
-
|
|
1025
|
+
const drawArrow = ({ afterLink, config, ctx, state }) => {
|
|
1026
|
+
const { arrow } = afterLink;
|
|
1027
|
+
ctx.save();
|
|
1028
|
+
if (arrow && !~state.temporary.customLinks.indexOf(arrow.link)) {
|
|
1029
|
+
ctx.beginPath();
|
|
1030
|
+
ctx.moveTo(arrow.p0.x, arrow.p0.y);
|
|
1031
|
+
ctx.lineTo(arrow.p1.x, arrow.p1.y);
|
|
1032
|
+
ctx.lineTo(arrow.p2.x, arrow.p2.y);
|
|
1033
|
+
ctx.closePath();
|
|
1034
|
+
if (afterLink._grad) {
|
|
1035
|
+
ctx.fillStyle = afterLink._grad;
|
|
1036
|
+
afterLink._grad = null;
|
|
1037
|
+
} else {
|
|
1038
|
+
ctx.fillStyle = config.colors[arrow.link.info.status];
|
|
1039
|
+
}
|
|
1040
|
+
ctx.fill();
|
|
1041
|
+
}
|
|
1042
|
+
ctx.restore();
|
|
1043
|
+
};
|
|
1044
|
+
const drawGroup = ({ state, ctx }) => {
|
|
665
1045
|
const { afterData } = state;
|
|
666
|
-
const {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
1046
|
+
const { afterConfig, afterGroups } = afterData;
|
|
1047
|
+
const { showGroup = true, radius } = afterConfig;
|
|
1048
|
+
if (showGroup && ctx && afterGroups) {
|
|
1049
|
+
afterGroups.forEach((afterGroup) => {
|
|
1050
|
+
const [p0, p1, p2, p3] = afterGroup.coords;
|
|
670
1051
|
ctx.save();
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
1052
|
+
ctx.beginPath();
|
|
1053
|
+
ctx.moveTo(p0.x, p0.y);
|
|
1054
|
+
ctx.arcTo(p0.x, p1.y, p1.x, p1.y, radius);
|
|
1055
|
+
ctx.arcTo(p2.x, p1.y, p2.x, p2.y, radius);
|
|
1056
|
+
ctx.arcTo(p2.x, p3.y, p3.x, p3.y, radius);
|
|
1057
|
+
ctx.arcTo(p0.x, p3.y, p0.x, p0.y, radius);
|
|
1058
|
+
ctx.closePath();
|
|
1059
|
+
ctx.globalAlpha = 0.3;
|
|
1060
|
+
if (afterGroup.raw.fillStyle) {
|
|
1061
|
+
ctx.fillStyle = afterGroup.raw.fillStyle;
|
|
678
1062
|
ctx.fill();
|
|
679
|
-
}
|
|
1063
|
+
}
|
|
1064
|
+
if (afterGroup.raw.strokeStyle) {
|
|
1065
|
+
ctx.strokeStyle = afterGroup.raw.strokeStyle;
|
|
1066
|
+
if (Array.isArray(afterGroup.raw.lineDash)) {
|
|
1067
|
+
ctx.setLineDash(afterGroup.raw.lineDash);
|
|
1068
|
+
} else {
|
|
1069
|
+
ctx.setLineDash([3, 3]);
|
|
1070
|
+
}
|
|
1071
|
+
ctx.stroke();
|
|
1072
|
+
}
|
|
680
1073
|
ctx.restore();
|
|
681
|
-
}
|
|
1074
|
+
});
|
|
682
1075
|
}
|
|
683
1076
|
};
|
|
1077
|
+
const clickGroup = (emit) => (afterGroup, e) => {
|
|
1078
|
+
emit("click-group", afterGroup, e);
|
|
1079
|
+
};
|
|
684
1080
|
const antialiasing = (vm) => () => {
|
|
685
1081
|
const canvas = vm.$refs.canvas;
|
|
686
1082
|
const context = canvas.getContext("2d");
|
|
@@ -695,6 +1091,28 @@ const antialiasing = (vm) => () => {
|
|
|
695
1091
|
context.scale(dpr, dpr);
|
|
696
1092
|
}
|
|
697
1093
|
};
|
|
1094
|
+
const handleNodeResize = ({ state, vm }) => () => {
|
|
1095
|
+
const el = vm.$el;
|
|
1096
|
+
const { padding, height } = state.temporary;
|
|
1097
|
+
state.nodeHeight = el.offsetHeight;
|
|
1098
|
+
state.isSmall = (state.sizeMini || state.sizeMedium) && Math.abs(state.nodeHeight - height) < 0.1 || state.sizeSmall;
|
|
1099
|
+
if (state.layUpdown) {
|
|
1100
|
+
const titleWidth = vm.$refs.title.offsetWidth;
|
|
1101
|
+
const iconWidth = vm.$refs.icon.offsetWidth;
|
|
1102
|
+
state.posLeft = ~~((titleWidth - iconWidth) / 2);
|
|
1103
|
+
state.nodeWidth = iconWidth + padding;
|
|
1104
|
+
} else {
|
|
1105
|
+
let paddingLeft;
|
|
1106
|
+
if (state.isSmall) {
|
|
1107
|
+
paddingLeft = 24;
|
|
1108
|
+
} else if (state.sizeMini) {
|
|
1109
|
+
paddingLeft = 16;
|
|
1110
|
+
} else if (state.sizeMedium) {
|
|
1111
|
+
paddingLeft = 32;
|
|
1112
|
+
}
|
|
1113
|
+
state.nodeWidth = vm.$refs.title.offsetWidth + paddingLeft + padding;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
698
1116
|
export {
|
|
699
1117
|
addListeners,
|
|
700
1118
|
antialiasing,
|
|
@@ -703,13 +1121,16 @@ export {
|
|
|
703
1121
|
buildHoverState,
|
|
704
1122
|
clearDropdown,
|
|
705
1123
|
clearHoverAfterLink,
|
|
1124
|
+
clickGroup,
|
|
706
1125
|
clickNode,
|
|
707
1126
|
compute,
|
|
708
1127
|
computeMf,
|
|
709
1128
|
drawAfterLink,
|
|
710
|
-
drawArrow,
|
|
711
1129
|
getAllItem,
|
|
1130
|
+
getNode,
|
|
1131
|
+
getNodeDef,
|
|
712
1132
|
getVars,
|
|
1133
|
+
handleNodeResize,
|
|
713
1134
|
hitTest,
|
|
714
1135
|
initDropdowns,
|
|
715
1136
|
isLinkHover,
|