kd-lane-container 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,272 @@
1
+ import { cloneDeep } from 'lodash';
2
+ import draggable from 'vuedraggable';
1
3
  import Vue from 'vue';
2
4
  import vClickOutside from 'v-click-outside';
3
5
 
6
+ //
7
+ Vue.use(vClickOutside);
8
+
9
+ var script$6 = {
10
+ name: "VueSimpleContextMenu",
11
+ props: {
12
+ options: {
13
+ type: Array,
14
+ required: true,
15
+ },
16
+ },
17
+ data() {
18
+ return {
19
+ item: null,
20
+ menuWidth: null,
21
+ menuHeight: null,
22
+ };
23
+ },
24
+ methods: {
25
+ showMenu(event, item) {
26
+ this.item = item;
27
+
28
+ const menu = this.$refs.refUl;
29
+ if (!menu) {
30
+ return;
31
+ }
32
+
33
+ if (!this.menuWidth || !this.menuHeight) {
34
+ menu.style.visibility = "hidden";
35
+ menu.style.display = "block";
36
+ this.menuWidth = menu.offsetWidth;
37
+ this.menuHeight = menu.offsetHeight;
38
+ menu.removeAttribute("style");
39
+ }
40
+
41
+ if (this.menuWidth + event.pageX >= window.innerWidth) {
42
+ menu.style.left = event.pageX - this.menuWidth + 2 + "px";
43
+ } else {
44
+ menu.style.left = event.pageX - 2 + "px";
45
+ }
46
+
47
+ if (this.menuHeight + event.pageY >= window.innerHeight) {
48
+ menu.style.top = event.pageY - this.menuHeight + 2 + "px";
49
+ } else {
50
+ menu.style.top = event.pageY - 2 + "px";
51
+ }
52
+ menu.classList.add("vue-simple-context-menu--active");
53
+ },
54
+ hideContextMenu() {
55
+ const element = this.$refs.refUl;
56
+ if (element) {
57
+ element.classList.remove("vue-simple-context-menu--active");
58
+ this.$emit("menu-closed");
59
+ }
60
+ },
61
+ onClickOutside() {
62
+ this.hideContextMenu();
63
+ },
64
+ optionClicked(option) {
65
+ this.hideContextMenu();
66
+ this.$emit("option-clicked", {
67
+ item: this.item,
68
+ option: option,
69
+ });
70
+ },
71
+ onEscKeyRelease(event) {
72
+ if (event.keyCode === 27) {
73
+ this.hideContextMenu();
74
+ }
75
+ },
76
+ },
77
+ mounted() {
78
+ document.body.addEventListener("keyup", this.onEscKeyRelease);
79
+ },
80
+ beforeDestroy() {
81
+ document.removeEventListener("keyup", this.onEscKeyRelease);
82
+ },
83
+ };
84
+
85
+ function styleInject(css, ref) {
86
+ if ( ref === void 0 ) ref = {};
87
+ var insertAt = ref.insertAt;
88
+
89
+ if (!css || typeof document === 'undefined') { return; }
90
+
91
+ var head = document.head || document.getElementsByTagName('head')[0];
92
+ var style = document.createElement('style');
93
+ style.type = 'text/css';
94
+
95
+ if (insertAt === 'top') {
96
+ if (head.firstChild) {
97
+ head.insertBefore(style, head.firstChild);
98
+ } else {
99
+ head.appendChild(style);
100
+ }
101
+ } else {
102
+ head.appendChild(style);
103
+ }
104
+
105
+ if (style.styleSheet) {
106
+ style.styleSheet.cssText = css;
107
+ } else {
108
+ style.appendChild(document.createTextNode(css));
109
+ }
110
+ }
111
+
112
+ var css_248z$6 = ".vue-simple-context-menu {\n top: 0;\n left: 0;\n margin: 0;\n padding: 0;\n display: none;\n list-style: none;\n position: fixed;\n z-index: 1000000;\n background-color: var(--kd-lane-container-context-background-color, #ecf0f1);\n border-bottom-width: 0px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n box-shadow: 0 3px 6px 0 rgba(var(--kd-lane-container-context-item-color, #333), 0.2);\n border-radius: 4px;\n}\n.vue-simple-context-menu--active {\n display: block;\n}\n.vue-simple-context-menu__item {\n display: flex;\n color: var(--kd-lane-container-context-item-color, #333);\n cursor: pointer;\n padding: 5px 15px;\n align-items: center;\n}\n.vue-simple-context-menu__item:hover {\n background-color: var(--kd-lane-container-context-hover-background-color, #007aff);\n color: var(--kd-lane-container-context-hover-item-color, #fff);\n}\n.vue-simple-context-menu__divider {\n box-sizing: content-box;\n height: 2px;\n background-color: var(--kd-lane-container-context-divider-color, #595a5a);\n padding: 4px 0;\n background-clip: content-box;\n pointer-events: none;\n}\n.vue-simple-context-menu li:first-of-type {\n margin-top: 4px;\n}\n.vue-simple-context-menu li:last-of-type {\n margin-bottom: 4px;\n}";
113
+ styleInject(css_248z$6);
114
+
115
+ function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
116
+ if (typeof shadowMode !== 'boolean') {
117
+ createInjectorSSR = createInjector;
118
+ createInjector = shadowMode;
119
+ shadowMode = false;
120
+ }
121
+ // Vue.extend constructor export interop.
122
+ const options = typeof script === 'function' ? script.options : script;
123
+ // render functions
124
+ if (template && template.render) {
125
+ options.render = template.render;
126
+ options.staticRenderFns = template.staticRenderFns;
127
+ options._compiled = true;
128
+ // functional template
129
+ if (isFunctionalTemplate) {
130
+ options.functional = true;
131
+ }
132
+ }
133
+ // scopedId
134
+ if (scopeId) {
135
+ options._scopeId = scopeId;
136
+ }
137
+ let hook;
138
+ if (moduleIdentifier) {
139
+ // server build
140
+ hook = function (context) {
141
+ // 2.3 injection
142
+ context =
143
+ context || // cached call
144
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
145
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
146
+ // 2.2 with runInNewContext: true
147
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
148
+ context = __VUE_SSR_CONTEXT__;
149
+ }
150
+ // inject component styles
151
+ if (style) {
152
+ style.call(this, createInjectorSSR(context));
153
+ }
154
+ // register component module identifier for async chunk inference
155
+ if (context && context._registeredComponents) {
156
+ context._registeredComponents.add(moduleIdentifier);
157
+ }
158
+ };
159
+ // used by ssr in case component is cached and beforeCreate
160
+ // never gets called
161
+ options._ssrRegister = hook;
162
+ }
163
+ else if (style) {
164
+ hook = shadowMode
165
+ ? function (context) {
166
+ style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
167
+ }
168
+ : function (context) {
169
+ style.call(this, createInjector(context));
170
+ };
171
+ }
172
+ if (hook) {
173
+ if (options.functional) {
174
+ // register for functional component in vue file
175
+ const originalRender = options.render;
176
+ options.render = function renderWithStyleInjection(h, context) {
177
+ hook.call(context);
178
+ return originalRender(h, context);
179
+ };
180
+ }
181
+ else {
182
+ // inject component registration as beforeCreate hook
183
+ const existing = options.beforeCreate;
184
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
185
+ }
186
+ }
187
+ return script;
188
+ }
189
+
190
+ /* script */
191
+ const __vue_script__$6 = script$6;
192
+ /* template */
193
+ var __vue_render__$6 = function () {
194
+ var _vm = this;
195
+ var _h = _vm.$createElement;
196
+ var _c = _vm._self._c || _h;
197
+ return _c("div", [
198
+ _c(
199
+ "ul",
200
+ {
201
+ directives: [
202
+ {
203
+ name: "click-outside",
204
+ rawName: "v-click-outside",
205
+ value: _vm.onClickOutside,
206
+ expression: "onClickOutside",
207
+ },
208
+ ],
209
+ ref: "refUl",
210
+ staticClass: "vue-simple-context-menu",
211
+ },
212
+ _vm._l(_vm.options, function (option, index) {
213
+ return _c(
214
+ "li",
215
+ {
216
+ key: index,
217
+ staticClass: "vue-simple-context-menu__item",
218
+ class: [
219
+ option.class,
220
+ option.type === "divider"
221
+ ? "vue-simple-context-menu__divider"
222
+ : "",
223
+ ],
224
+ on: {
225
+ click: function ($event) {
226
+ $event.stopPropagation();
227
+ return _vm.optionClicked(option)
228
+ },
229
+ },
230
+ },
231
+ [_c("span", { domProps: { innerHTML: _vm._s(option.name) } })]
232
+ )
233
+ }),
234
+ 0
235
+ ),
236
+ ])
237
+ };
238
+ var __vue_staticRenderFns__$6 = [];
239
+ __vue_render__$6._withStripped = true;
240
+
241
+ /* style */
242
+ const __vue_inject_styles__$6 = undefined;
243
+ /* scoped */
244
+ const __vue_scope_id__$6 = undefined;
245
+ /* module identifier */
246
+ const __vue_module_identifier__$6 = undefined;
247
+ /* functional template */
248
+ const __vue_is_functional_template__$6 = false;
249
+ /* style inject */
250
+
251
+ /* style inject SSR */
252
+
253
+ /* style inject shadow dom */
254
+
255
+
256
+
257
+ const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
258
+ { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
259
+ __vue_inject_styles__$6,
260
+ __vue_script__$6,
261
+ __vue_scope_id__$6,
262
+ __vue_is_functional_template__$6,
263
+ __vue_module_identifier__$6,
264
+ false,
265
+ undefined,
266
+ undefined,
267
+ undefined
268
+ );
269
+
4
270
  class CustomStrategy {
5
271
  constructor(strategy) {
6
272
  this.strategy = strategy;
@@ -1444,7 +1710,7 @@ class StrategyFactory {
1444
1710
  //
1445
1711
  //
1446
1712
 
1447
- var script$6 = {
1713
+ var script$5 = {
1448
1714
  inject: ["upsertTemplate", "setTargetData", "setExpanded"],
1449
1715
  props: {
1450
1716
  currentTemplate: {
@@ -1488,163 +1754,61 @@ var script$6 = {
1488
1754
  if (!payload.caseId) {
1489
1755
  payload.caseId = this.caseId;
1490
1756
  }
1491
- const result = this.upsertTemplate(payload);
1492
- if (result instanceof Promise) {
1493
- result
1494
- .then((res) => {
1495
- this.setTargetData(res);
1496
- })
1497
- .then(() => {
1498
- this.$message({
1499
- type: "success",
1500
- message: "保存成功",
1501
- });
1502
- })
1503
- .finally(() => {
1504
- this.saving = false;
1505
- });
1506
- } else {
1507
- this.saving = false;
1508
- }
1509
- });
1510
- },
1511
- },
1512
- computed: {
1513
- baseTemplate() {
1514
- if (!this.userTemplate) {
1515
- return [{ name: "空白模板", value: "" }];
1516
- } else {
1517
- return [
1518
- { name: "空白模板", value: "" },
1519
- ...this.userTemplate.map((item) => {
1520
- return {
1521
- name: item.templateName,
1522
- value: item.templateId,
1523
- };
1524
- }),
1525
- ];
1526
- }
1527
- },
1528
- },
1529
- watch: {
1530
- currentTemplate: {
1531
- deep: true,
1532
- handler: function (newV) {
1533
- this.formData = Object.assign({}, newV);
1534
- },
1535
- },
1536
- },
1537
- };
1538
-
1539
- function styleInject(css, ref) {
1540
- if ( ref === void 0 ) ref = {};
1541
- var insertAt = ref.insertAt;
1542
-
1543
- if (!css || typeof document === 'undefined') { return; }
1544
-
1545
- var head = document.head || document.getElementsByTagName('head')[0];
1546
- var style = document.createElement('style');
1547
- style.type = 'text/css';
1548
-
1549
- if (insertAt === 'top') {
1550
- if (head.firstChild) {
1551
- head.insertBefore(style, head.firstChild);
1552
- } else {
1553
- head.appendChild(style);
1554
- }
1555
- } else {
1556
- head.appendChild(style);
1557
- }
1558
-
1559
- if (style.styleSheet) {
1560
- style.styleSheet.cssText = css;
1561
- } else {
1562
- style.appendChild(document.createTextNode(css));
1563
- }
1564
- }
1565
-
1566
- var css_248z$6 = ".kd-lane-template-content {\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-template-content .template-buttons {\n text-align: center;\n}";
1567
- styleInject(css_248z$6);
1568
-
1569
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
1570
- if (typeof shadowMode !== 'boolean') {
1571
- createInjectorSSR = createInjector;
1572
- createInjector = shadowMode;
1573
- shadowMode = false;
1574
- }
1575
- // Vue.extend constructor export interop.
1576
- const options = typeof script === 'function' ? script.options : script;
1577
- // render functions
1578
- if (template && template.render) {
1579
- options.render = template.render;
1580
- options.staticRenderFns = template.staticRenderFns;
1581
- options._compiled = true;
1582
- // functional template
1583
- if (isFunctionalTemplate) {
1584
- options.functional = true;
1585
- }
1586
- }
1587
- // scopedId
1588
- if (scopeId) {
1589
- options._scopeId = scopeId;
1590
- }
1591
- let hook;
1592
- if (moduleIdentifier) {
1593
- // server build
1594
- hook = function (context) {
1595
- // 2.3 injection
1596
- context =
1597
- context || // cached call
1598
- (this.$vnode && this.$vnode.ssrContext) || // stateful
1599
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
1600
- // 2.2 with runInNewContext: true
1601
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1602
- context = __VUE_SSR_CONTEXT__;
1603
- }
1604
- // inject component styles
1605
- if (style) {
1606
- style.call(this, createInjectorSSR(context));
1607
- }
1608
- // register component module identifier for async chunk inference
1609
- if (context && context._registeredComponents) {
1610
- context._registeredComponents.add(moduleIdentifier);
1611
- }
1612
- };
1613
- // used by ssr in case component is cached and beforeCreate
1614
- // never gets called
1615
- options._ssrRegister = hook;
1616
- }
1617
- else if (style) {
1618
- hook = shadowMode
1619
- ? function (context) {
1620
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
1621
- }
1622
- : function (context) {
1623
- style.call(this, createInjector(context));
1624
- };
1625
- }
1626
- if (hook) {
1627
- if (options.functional) {
1628
- // register for functional component in vue file
1629
- const originalRender = options.render;
1630
- options.render = function renderWithStyleInjection(h, context) {
1631
- hook.call(context);
1632
- return originalRender(h, context);
1633
- };
1634
- }
1635
- else {
1636
- // inject component registration as beforeCreate hook
1637
- const existing = options.beforeCreate;
1638
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
1757
+ const result = this.upsertTemplate(payload);
1758
+ if (result instanceof Promise) {
1759
+ result
1760
+ .then((res) => {
1761
+ this.setTargetData(res);
1762
+ })
1763
+ .then(() => {
1764
+ this.$message({
1765
+ type: "success",
1766
+ message: "保存成功",
1767
+ });
1768
+ })
1769
+ .finally(() => {
1770
+ this.saving = false;
1771
+ });
1772
+ } else {
1773
+ this.saving = false;
1639
1774
  }
1640
- }
1641
- return script;
1642
- }
1775
+ });
1776
+ },
1777
+ },
1778
+ computed: {
1779
+ baseTemplate() {
1780
+ if (!this.userTemplate) {
1781
+ return [{ name: "空白模板", value: "" }];
1782
+ } else {
1783
+ return [
1784
+ { name: "空白模板", value: "" },
1785
+ ...this.userTemplate.map((item) => {
1786
+ return {
1787
+ name: item.templateName,
1788
+ value: item.templateId,
1789
+ };
1790
+ }),
1791
+ ];
1792
+ }
1793
+ },
1794
+ },
1795
+ watch: {
1796
+ currentTemplate: {
1797
+ deep: true,
1798
+ handler: function (newV) {
1799
+ this.formData = Object.assign({}, newV);
1800
+ },
1801
+ },
1802
+ },
1803
+ };
1804
+
1805
+ var css_248z$5 = ".kd-lane-template-content {\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-template-content .template-buttons {\n text-align: center;\n}";
1806
+ styleInject(css_248z$5);
1643
1807
 
1644
1808
  /* script */
1645
- const __vue_script__$6 = script$6;
1809
+ const __vue_script__$5 = script$5;
1646
1810
  /* template */
1647
- var __vue_render__$6 = function () {
1811
+ var __vue_render__$5 = function () {
1648
1812
  var _vm = this;
1649
1813
  var _h = _vm.$createElement;
1650
1814
  var _c = _vm._self._c || _h;
@@ -1839,17 +2003,17 @@ var __vue_render__$6 = function () {
1839
2003
  1
1840
2004
  )
1841
2005
  };
1842
- var __vue_staticRenderFns__$6 = [];
1843
- __vue_render__$6._withStripped = true;
2006
+ var __vue_staticRenderFns__$5 = [];
2007
+ __vue_render__$5._withStripped = true;
1844
2008
 
1845
2009
  /* style */
1846
- const __vue_inject_styles__$6 = undefined;
2010
+ const __vue_inject_styles__$5 = undefined;
1847
2011
  /* scoped */
1848
- const __vue_scope_id__$6 = undefined;
2012
+ const __vue_scope_id__$5 = undefined;
1849
2013
  /* module identifier */
1850
- const __vue_module_identifier__$6 = undefined;
2014
+ const __vue_module_identifier__$5 = undefined;
1851
2015
  /* functional template */
1852
- const __vue_is_functional_template__$6 = false;
2016
+ const __vue_is_functional_template__$5 = false;
1853
2017
  /* style inject */
1854
2018
 
1855
2019
  /* style inject SSR */
@@ -1858,13 +2022,13 @@ __vue_render__$6._withStripped = true;
1858
2022
 
1859
2023
 
1860
2024
 
1861
- const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
1862
- { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
1863
- __vue_inject_styles__$6,
1864
- __vue_script__$6,
1865
- __vue_scope_id__$6,
1866
- __vue_is_functional_template__$6,
1867
- __vue_module_identifier__$6,
2025
+ const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
2026
+ { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
2027
+ __vue_inject_styles__$5,
2028
+ __vue_script__$5,
2029
+ __vue_scope_id__$5,
2030
+ __vue_is_functional_template__$5,
2031
+ __vue_module_identifier__$5,
1868
2032
  false,
1869
2033
  undefined,
1870
2034
  undefined,
@@ -1886,7 +2050,7 @@ __vue_render__$6._withStripped = true;
1886
2050
  //
1887
2051
  //
1888
2052
 
1889
- var script$5 = {
2053
+ var script$4 = {
1890
2054
  inject: ["upsertLane", "setTargetData", "setExpanded"],
1891
2055
  props: {
1892
2056
  laneInfo: {
@@ -1959,13 +2123,13 @@ var script$5 = {
1959
2123
  },
1960
2124
  };
1961
2125
 
1962
- var css_248z$5 = ".kd-lane-lane-content {\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-lane-content .template-buttons {\n text-align: center;\n}";
1963
- styleInject(css_248z$5);
2126
+ var css_248z$4 = ".kd-lane-lane-content {\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-lane-content .template-buttons {\n text-align: center;\n}";
2127
+ styleInject(css_248z$4);
1964
2128
 
1965
2129
  /* script */
1966
- const __vue_script__$5 = script$5;
2130
+ const __vue_script__$4 = script$4;
1967
2131
  /* template */
1968
- var __vue_render__$5 = function () {
2132
+ var __vue_render__$4 = function () {
1969
2133
  var _vm = this;
1970
2134
  var _h = _vm.$createElement;
1971
2135
  var _c = _vm._self._c || _h;
@@ -2034,17 +2198,17 @@ var __vue_render__$5 = function () {
2034
2198
  1
2035
2199
  )
2036
2200
  };
2037
- var __vue_staticRenderFns__$5 = [];
2038
- __vue_render__$5._withStripped = true;
2201
+ var __vue_staticRenderFns__$4 = [];
2202
+ __vue_render__$4._withStripped = true;
2039
2203
 
2040
2204
  /* style */
2041
- const __vue_inject_styles__$5 = undefined;
2205
+ const __vue_inject_styles__$4 = undefined;
2042
2206
  /* scoped */
2043
- const __vue_scope_id__$5 = undefined;
2207
+ const __vue_scope_id__$4 = undefined;
2044
2208
  /* module identifier */
2045
- const __vue_module_identifier__$5 = undefined;
2209
+ const __vue_module_identifier__$4 = undefined;
2046
2210
  /* functional template */
2047
- const __vue_is_functional_template__$5 = false;
2211
+ const __vue_is_functional_template__$4 = false;
2048
2212
  /* style inject */
2049
2213
 
2050
2214
  /* style inject SSR */
@@ -2053,13 +2217,13 @@ __vue_render__$5._withStripped = true;
2053
2217
 
2054
2218
 
2055
2219
 
2056
- const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
2057
- { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
2058
- __vue_inject_styles__$5,
2059
- __vue_script__$5,
2060
- __vue_scope_id__$5,
2061
- __vue_is_functional_template__$5,
2062
- __vue_module_identifier__$5,
2220
+ const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
2221
+ { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
2222
+ __vue_inject_styles__$4,
2223
+ __vue_script__$4,
2224
+ __vue_scope_id__$4,
2225
+ __vue_is_functional_template__$4,
2226
+ __vue_module_identifier__$4,
2063
2227
  false,
2064
2228
  undefined,
2065
2229
  undefined,
@@ -2109,7 +2273,7 @@ __vue_render__$5._withStripped = true;
2109
2273
  //
2110
2274
  //
2111
2275
 
2112
- var script$4 = {
2276
+ var script$3 = {
2113
2277
  inject: ["upsertLine", "setTargetData", "setExpanded", "getThemeName"],
2114
2278
  props: {
2115
2279
  template: {
@@ -2251,153 +2415,37 @@ var script$4 = {
2251
2415
  },
2252
2416
  };
2253
2417
 
2254
- var css_248z$4 = ".kd-lane-line-content {\n width: 95%;\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-line-content .template-buttons {\n text-align: center;\n}";
2255
- styleInject(css_248z$4);
2418
+ var css_248z$3 = ".kd-lane-line-content {\n width: 95%;\n display: flex;\n flex-direction: column;\n align-content: center;\n}\n.kd-lane-line-content .template-buttons {\n text-align: center;\n}";
2419
+ styleInject(css_248z$3);
2256
2420
 
2257
2421
  /* script */
2258
- const __vue_script__$4 = script$4;
2422
+ const __vue_script__$3 = script$3;
2259
2423
  /* template */
2260
- var __vue_render__$4 = function () {
2261
- var _vm = this;
2262
- var _h = _vm.$createElement;
2263
- var _c = _vm._self._c || _h;
2264
- return _c(
2265
- "div",
2266
- { staticClass: "kd-lane-line-content" },
2267
- [
2268
- _c(
2269
- "el-form",
2270
- {
2271
- ref: "template",
2272
- attrs: {
2273
- rules: _vm.rules,
2274
- model: _vm.formData,
2275
- disabled: _vm.formDisable,
2276
- },
2277
- },
2278
- [
2279
- _c(
2280
- "el-form-item",
2281
- {
2282
- attrs: {
2283
- label: "参数名称",
2284
- prop: "paramId",
2285
- "label-width": "120px",
2286
- },
2287
- },
2288
- [
2289
- _c(
2290
- "el-select",
2291
- {
2292
- attrs: { filterable: "", placeholder: "请选择" },
2293
- model: {
2294
- value: _vm.formData.paramId,
2295
- callback: function ($$v) {
2296
- _vm.$set(_vm.formData, "paramId", $$v);
2297
- },
2298
- expression: "formData.paramId",
2299
- },
2300
- },
2301
- _vm._l(_vm.params, function (item) {
2302
- return _c("el-option", {
2303
- key: item.paramId,
2304
- attrs: { label: item.paramName, value: item.paramId },
2305
- })
2306
- }),
2307
- 1
2308
- ),
2309
- ],
2310
- 1
2311
- ),
2312
- _vm._v(" "),
2313
- _c(
2314
- "el-form-item",
2315
- { attrs: { label: "最小值", prop: "min", "label-width": "120px" } },
2316
- [
2317
- _c("el-input", {
2318
- model: {
2319
- value: _vm.formData.min,
2320
- callback: function ($$v) {
2321
- _vm.$set(_vm.formData, "min", $$v);
2322
- },
2323
- expression: "formData.min",
2324
- },
2325
- }),
2326
- ],
2327
- 1
2328
- ),
2329
- _vm._v(" "),
2330
- _c(
2331
- "el-form-item",
2332
- { attrs: { label: "最大值", prop: "max", "label-width": "120px" } },
2333
- [
2334
- _c("el-input", {
2335
- model: {
2336
- value: _vm.formData.max,
2337
- callback: function ($$v) {
2338
- _vm.$set(_vm.formData, "max", $$v);
2339
- },
2340
- expression: "formData.max",
2341
- },
2342
- }),
2343
- ],
2344
- 1
2345
- ),
2346
- _vm._v(" "),
2347
- _c(
2348
- "el-form-item",
2349
- {
2350
- attrs: {
2351
- label: "曲线粗细",
2352
- prop: "lineSize",
2353
- "label-width": "120px",
2354
- },
2355
- },
2356
- [
2357
- _c("el-input", {
2358
- attrs: { max: 4, min: 1, type: "number" },
2359
- model: {
2360
- value: _vm.formData.lineSize,
2361
- callback: function ($$v) {
2362
- _vm.$set(_vm.formData, "lineSize", $$v);
2363
- },
2364
- expression: "formData.lineSize",
2365
- },
2366
- }),
2367
- ],
2368
- 1
2369
- ),
2370
- _vm._v(" "),
2371
- _c(
2372
- "el-form-item",
2373
- {
2374
- attrs: {
2375
- label: "曲线颜色",
2376
- prop: "lineColor",
2377
- "label-width": "120px",
2378
- },
2379
- },
2380
- [
2381
- _c("el-color-picker", {
2382
- attrs: { disabled: _vm.formData.isGradient },
2383
- model: {
2384
- value: _vm.formData.lineColor,
2385
- callback: function ($$v) {
2386
- _vm.$set(_vm.formData, "lineColor", $$v);
2387
- },
2388
- expression: "formData.lineColor",
2389
- },
2390
- }),
2391
- ],
2392
- 1
2393
- ),
2394
- _vm._v(" "),
2424
+ var __vue_render__$3 = function () {
2425
+ var _vm = this;
2426
+ var _h = _vm.$createElement;
2427
+ var _c = _vm._self._c || _h;
2428
+ return _c(
2429
+ "div",
2430
+ { staticClass: "kd-lane-line-content" },
2431
+ [
2432
+ _c(
2433
+ "el-form",
2434
+ {
2435
+ ref: "template",
2436
+ attrs: {
2437
+ rules: _vm.rules,
2438
+ model: _vm.formData,
2439
+ disabled: _vm.formDisable,
2440
+ },
2441
+ },
2442
+ [
2395
2443
  _c(
2396
2444
  "el-form-item",
2397
2445
  {
2398
2446
  attrs: {
2399
- label: "线型",
2400
- prop: "lineType",
2447
+ label: "参数名称",
2448
+ prop: "paramId",
2401
2449
  "label-width": "120px",
2402
2450
  },
2403
2451
  },
@@ -2405,22 +2453,19 @@ var __vue_render__$4 = function () {
2405
2453
  _c(
2406
2454
  "el-select",
2407
2455
  {
2408
- attrs: {
2409
- placeholder: "请选择",
2410
- disabled: _vm.formData.isGradient,
2411
- },
2456
+ attrs: { filterable: "", placeholder: "请选择" },
2412
2457
  model: {
2413
- value: _vm.formData.lineType,
2458
+ value: _vm.formData.paramId,
2414
2459
  callback: function ($$v) {
2415
- _vm.$set(_vm.formData, "lineType", $$v);
2460
+ _vm.$set(_vm.formData, "paramId", $$v);
2416
2461
  },
2417
- expression: "formData.lineType",
2462
+ expression: "formData.paramId",
2418
2463
  },
2419
2464
  },
2420
- _vm._l(_vm.lines, function (item) {
2465
+ _vm._l(_vm.params, function (item) {
2421
2466
  return _c("el-option", {
2422
- key: item.value,
2423
- attrs: { label: item.name, value: item.value },
2467
+ key: item.paramId,
2468
+ attrs: { label: item.paramName, value: item.paramId },
2424
2469
  })
2425
2470
  }),
2426
2471
  1
@@ -2431,228 +2476,185 @@ var __vue_render__$4 = function () {
2431
2476
  _vm._v(" "),
2432
2477
  _c(
2433
2478
  "el-form-item",
2434
- {
2435
- attrs: {
2436
- label: "曲线顺序",
2437
- prop: "lineSort",
2438
- "label-width": "120px",
2439
- },
2440
- },
2479
+ { attrs: { label: "最小值", prop: "min", "label-width": "120px" } },
2441
2480
  [
2442
2481
  _c("el-input", {
2443
2482
  model: {
2444
- value: _vm.formData.lineSort,
2483
+ value: _vm.formData.min,
2445
2484
  callback: function ($$v) {
2446
- _vm.$set(_vm.formData, "lineSort", _vm._n($$v));
2485
+ _vm.$set(_vm.formData, "min", $$v);
2447
2486
  },
2448
- expression: "formData.lineSort",
2487
+ expression: "formData.min",
2449
2488
  },
2450
2489
  }),
2451
2490
  ],
2452
2491
  1
2453
2492
  ),
2454
2493
  _vm._v(" "),
2455
- _vm._e(),
2456
- ],
2457
- 1
2458
- ),
2459
- _vm._v(" "),
2460
- _c(
2461
- "div",
2462
- {
2463
- directives: [
2464
- {
2465
- name: "show",
2466
- rawName: "v-show",
2467
- value: _vm.template.createUser != "SYSTEM_USER",
2468
- expression: "template.createUser != 'SYSTEM_USER'",
2469
- },
2470
- ],
2471
- staticClass: "template-buttons",
2472
- },
2473
- [
2474
- _c("el-button", { on: { click: _vm.editable } }, [_vm._v("编辑")]),
2475
- _vm._v(" "),
2476
2494
  _c(
2477
- "el-button",
2478
- {
2479
- attrs: { type: "primary", disabled: _vm.formDisable },
2480
- on: {
2481
- click: function ($event) {
2482
- return _vm.submitForm("template")
2495
+ "el-form-item",
2496
+ { attrs: { label: "最大值", prop: "max", "label-width": "120px" } },
2497
+ [
2498
+ _c("el-input", {
2499
+ model: {
2500
+ value: _vm.formData.max,
2501
+ callback: function ($$v) {
2502
+ _vm.$set(_vm.formData, "max", $$v);
2503
+ },
2504
+ expression: "formData.max",
2483
2505
  },
2484
- },
2485
- },
2486
- [_vm._v("保存")]
2506
+ }),
2507
+ ],
2508
+ 1
2487
2509
  ),
2488
- ],
2489
- 1
2490
- ),
2491
- ],
2492
- 1
2493
- )
2494
- };
2495
- var __vue_staticRenderFns__$4 = [];
2496
- __vue_render__$4._withStripped = true;
2497
-
2498
- /* style */
2499
- const __vue_inject_styles__$4 = undefined;
2500
- /* scoped */
2501
- const __vue_scope_id__$4 = undefined;
2502
- /* module identifier */
2503
- const __vue_module_identifier__$4 = undefined;
2504
- /* functional template */
2505
- const __vue_is_functional_template__$4 = false;
2506
- /* style inject */
2507
-
2508
- /* style inject SSR */
2509
-
2510
- /* style inject shadow dom */
2511
-
2512
-
2513
-
2514
- const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
2515
- { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
2516
- __vue_inject_styles__$4,
2517
- __vue_script__$4,
2518
- __vue_scope_id__$4,
2519
- __vue_is_functional_template__$4,
2520
- __vue_module_identifier__$4,
2521
- false,
2522
- undefined,
2523
- undefined,
2524
- undefined
2525
- );
2526
-
2527
- //
2528
- Vue.use(vClickOutside);
2529
-
2530
- var script$3 = {
2531
- name: "VueSimpleContextMenu",
2532
- props: {
2533
- options: {
2534
- type: Array,
2535
- required: true,
2536
- },
2537
- },
2538
- data() {
2539
- return {
2540
- item: null,
2541
- menuWidth: null,
2542
- menuHeight: null,
2543
- };
2544
- },
2545
- methods: {
2546
- showMenu(event, item) {
2547
- this.item = item;
2548
-
2549
- const menu = this.$refs.refUl;
2550
- if (!menu) {
2551
- return;
2552
- }
2553
-
2554
- if (!this.menuWidth || !this.menuHeight) {
2555
- menu.style.visibility = "hidden";
2556
- menu.style.display = "block";
2557
- this.menuWidth = menu.offsetWidth;
2558
- this.menuHeight = menu.offsetHeight;
2559
- menu.removeAttribute("style");
2560
- }
2561
-
2562
- if (this.menuWidth + event.pageX >= window.innerWidth) {
2563
- menu.style.left = event.pageX - this.menuWidth + 2 + "px";
2564
- } else {
2565
- menu.style.left = event.pageX - 2 + "px";
2566
- }
2567
-
2568
- if (this.menuHeight + event.pageY >= window.innerHeight) {
2569
- menu.style.top = event.pageY - this.menuHeight + 2 + "px";
2570
- } else {
2571
- menu.style.top = event.pageY - 2 + "px";
2572
- }
2573
- menu.classList.add("vue-simple-context-menu--active");
2574
- },
2575
- hideContextMenu() {
2576
- const element = this.$refs.refUl;
2577
- if (element) {
2578
- element.classList.remove("vue-simple-context-menu--active");
2579
- this.$emit("menu-closed");
2580
- }
2581
- },
2582
- onClickOutside() {
2583
- this.hideContextMenu();
2584
- },
2585
- optionClicked(option) {
2586
- this.hideContextMenu();
2587
- this.$emit("option-clicked", {
2588
- item: this.item,
2589
- option: option,
2590
- });
2591
- },
2592
- onEscKeyRelease(event) {
2593
- if (event.keyCode === 27) {
2594
- this.hideContextMenu();
2595
- }
2596
- },
2597
- },
2598
- mounted() {
2599
- document.body.addEventListener("keyup", this.onEscKeyRelease);
2600
- },
2601
- beforeDestroy() {
2602
- document.removeEventListener("keyup", this.onEscKeyRelease);
2603
- },
2604
- };
2605
-
2606
- var css_248z$3 = ".vue-simple-context-menu {\n top: 0;\n left: 0;\n margin: 0;\n padding: 0;\n display: none;\n list-style: none;\n position: fixed;\n z-index: 1000000;\n background-color: var(--kd-lane-container-context-background-color, #ecf0f1);\n border-bottom-width: 0px;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n box-shadow: 0 3px 6px 0 rgba(var(--kd-lane-container-context-item-color, #333), 0.2);\n border-radius: 4px;\n}\n.vue-simple-context-menu--active {\n display: block;\n}\n.vue-simple-context-menu__item {\n display: flex;\n color: var(--kd-lane-container-context-item-color, #333);\n cursor: pointer;\n padding: 5px 15px;\n align-items: center;\n}\n.vue-simple-context-menu__item:hover {\n background-color: var(--kd-lane-container-context-hover-background-color, #007aff);\n color: var(--kd-lane-container-context-hover-item-color, #fff);\n}\n.vue-simple-context-menu__divider {\n box-sizing: content-box;\n height: 2px;\n background-color: var(--kd-lane-container-context-divider-color, #595a5a);\n padding: 4px 0;\n background-clip: content-box;\n pointer-events: none;\n}\n.vue-simple-context-menu li:first-of-type {\n margin-top: 4px;\n}\n.vue-simple-context-menu li:last-of-type {\n margin-bottom: 4px;\n}";
2607
- styleInject(css_248z$3);
2608
-
2609
- /* script */
2610
- const __vue_script__$3 = script$3;
2611
- /* template */
2612
- var __vue_render__$3 = function () {
2613
- var _vm = this;
2614
- var _h = _vm.$createElement;
2615
- var _c = _vm._self._c || _h;
2616
- return _c("div", [
2617
- _c(
2618
- "ul",
2619
- {
2620
- directives: [
2621
- {
2622
- name: "click-outside",
2623
- rawName: "v-click-outside",
2624
- value: _vm.onClickOutside,
2625
- expression: "onClickOutside",
2626
- },
2627
- ],
2628
- ref: "refUl",
2629
- staticClass: "vue-simple-context-menu",
2630
- },
2631
- _vm._l(_vm.options, function (option, index) {
2632
- return _c(
2633
- "li",
2634
- {
2635
- key: index,
2636
- staticClass: "vue-simple-context-menu__item",
2637
- class: [
2638
- option.class,
2639
- option.type === "divider"
2640
- ? "vue-simple-context-menu__divider"
2641
- : "",
2510
+ _vm._v(" "),
2511
+ _c(
2512
+ "el-form-item",
2513
+ {
2514
+ attrs: {
2515
+ label: "曲线粗细",
2516
+ prop: "lineSize",
2517
+ "label-width": "120px",
2518
+ },
2519
+ },
2520
+ [
2521
+ _c("el-input", {
2522
+ attrs: { max: 4, min: 1, type: "number" },
2523
+ model: {
2524
+ value: _vm.formData.lineSize,
2525
+ callback: function ($$v) {
2526
+ _vm.$set(_vm.formData, "lineSize", $$v);
2527
+ },
2528
+ expression: "formData.lineSize",
2529
+ },
2530
+ }),
2642
2531
  ],
2643
- on: {
2644
- click: function ($event) {
2645
- $event.stopPropagation();
2646
- return _vm.optionClicked(option)
2532
+ 1
2533
+ ),
2534
+ _vm._v(" "),
2535
+ _c(
2536
+ "el-form-item",
2537
+ {
2538
+ attrs: {
2539
+ label: "曲线颜色",
2540
+ prop: "lineColor",
2541
+ "label-width": "120px",
2647
2542
  },
2648
2543
  },
2649
- },
2650
- [_c("span", { domProps: { innerHTML: _vm._s(option.name) } })]
2651
- )
2652
- }),
2653
- 0
2654
- ),
2655
- ])
2544
+ [
2545
+ _c("el-color-picker", {
2546
+ attrs: { disabled: _vm.formData.isGradient },
2547
+ model: {
2548
+ value: _vm.formData.lineColor,
2549
+ callback: function ($$v) {
2550
+ _vm.$set(_vm.formData, "lineColor", $$v);
2551
+ },
2552
+ expression: "formData.lineColor",
2553
+ },
2554
+ }),
2555
+ ],
2556
+ 1
2557
+ ),
2558
+ _vm._v(" "),
2559
+ _c(
2560
+ "el-form-item",
2561
+ {
2562
+ attrs: {
2563
+ label: "线型",
2564
+ prop: "lineType",
2565
+ "label-width": "120px",
2566
+ },
2567
+ },
2568
+ [
2569
+ _c(
2570
+ "el-select",
2571
+ {
2572
+ attrs: {
2573
+ placeholder: "请选择",
2574
+ disabled: _vm.formData.isGradient,
2575
+ },
2576
+ model: {
2577
+ value: _vm.formData.lineType,
2578
+ callback: function ($$v) {
2579
+ _vm.$set(_vm.formData, "lineType", $$v);
2580
+ },
2581
+ expression: "formData.lineType",
2582
+ },
2583
+ },
2584
+ _vm._l(_vm.lines, function (item) {
2585
+ return _c("el-option", {
2586
+ key: item.value,
2587
+ attrs: { label: item.name, value: item.value },
2588
+ })
2589
+ }),
2590
+ 1
2591
+ ),
2592
+ ],
2593
+ 1
2594
+ ),
2595
+ _vm._v(" "),
2596
+ _c(
2597
+ "el-form-item",
2598
+ {
2599
+ attrs: {
2600
+ label: "曲线顺序",
2601
+ prop: "lineSort",
2602
+ "label-width": "120px",
2603
+ },
2604
+ },
2605
+ [
2606
+ _c("el-input", {
2607
+ model: {
2608
+ value: _vm.formData.lineSort,
2609
+ callback: function ($$v) {
2610
+ _vm.$set(_vm.formData, "lineSort", _vm._n($$v));
2611
+ },
2612
+ expression: "formData.lineSort",
2613
+ },
2614
+ }),
2615
+ ],
2616
+ 1
2617
+ ),
2618
+ _vm._v(" "),
2619
+ _vm._e(),
2620
+ ],
2621
+ 1
2622
+ ),
2623
+ _vm._v(" "),
2624
+ _c(
2625
+ "div",
2626
+ {
2627
+ directives: [
2628
+ {
2629
+ name: "show",
2630
+ rawName: "v-show",
2631
+ value: _vm.template.createUser != "SYSTEM_USER",
2632
+ expression: "template.createUser != 'SYSTEM_USER'",
2633
+ },
2634
+ ],
2635
+ staticClass: "template-buttons",
2636
+ },
2637
+ [
2638
+ _c("el-button", { on: { click: _vm.editable } }, [_vm._v("编辑")]),
2639
+ _vm._v(" "),
2640
+ _c(
2641
+ "el-button",
2642
+ {
2643
+ attrs: { type: "primary", disabled: _vm.formDisable },
2644
+ on: {
2645
+ click: function ($event) {
2646
+ return _vm.submitForm("template")
2647
+ },
2648
+ },
2649
+ },
2650
+ [_vm._v("保存")]
2651
+ ),
2652
+ ],
2653
+ 1
2654
+ ),
2655
+ ],
2656
+ 1
2657
+ )
2656
2658
  };
2657
2659
  var __vue_staticRenderFns__$3 = [];
2658
2660
  __vue_render__$3._withStripped = true;
@@ -2696,7 +2698,7 @@ var script$2 = {
2696
2698
  setExpanded: this.setExpanded,
2697
2699
  };
2698
2700
  },
2699
- components: { LineEdit: __vue_component__$4, TemplateEdit: __vue_component__$6, LaneEdit: __vue_component__$5, VueSimpleContextMenu: __vue_component__$3 },
2701
+ components: { LineEdit: __vue_component__$3, TemplateEdit: __vue_component__$5, LaneEdit: __vue_component__$4, VueSimpleContextMenu: __vue_component__$6 },
2700
2702
  props: {
2701
2703
  contextItem: {
2702
2704
  type: Object,
@@ -3254,6 +3256,11 @@ __vue_render__$2._withStripped = true;
3254
3256
  undefined
3255
3257
  );
3256
3258
 
3259
+ const ACTION_TYPE = {
3260
+ UPSERT_LINE: "upsertLine",
3261
+ DELETE_LINE: "delLine"
3262
+ };
3263
+
3257
3264
  //
3258
3265
  //
3259
3266
  //
@@ -3447,7 +3454,8 @@ var script = {
3447
3454
  components: {
3448
3455
  HeaderItem: __vue_component__$1,
3449
3456
  RealTimeCurveConfig: __vue_component__$2,
3450
- VueSimpleContextMenu: __vue_component__$3,
3457
+ VueSimpleContextMenu: __vue_component__$6,
3458
+ draggable,
3451
3459
  },
3452
3460
  props: {
3453
3461
  // {type:"local",dataSource:{},caseId:"",versionCode:"",load, save}
@@ -3500,6 +3508,124 @@ var script = {
3500
3508
  mounted() {},
3501
3509
 
3502
3510
  methods: {
3511
+ dragtoModifyLane() {
3512
+ let promises = this.currentTemplate.lanes.map((lane, index) => {
3513
+ lane.sort = index;
3514
+ return this.dragUpdateLane(lane);
3515
+ });
3516
+ Promise.all(promises).then(() => {
3517
+ this.setDefaultAndNotify();
3518
+ });
3519
+ },
3520
+ dragtoModifyLines(event) {
3521
+ if (Object.prototype.hasOwnProperty.call(event, "added") && event.added.element) {
3522
+ // 拖拽新增了线条,通过lineId找到线段位置
3523
+ let data = cloneDeep(event.added.element);
3524
+ const currentLanes = this.currentTemplate.lanes;
3525
+ currentLanes.forEach((lane) => {
3526
+ const lineIndex = lane.lines.findIndex((line) => line.lineId == data.lineId);
3527
+ if (lineIndex >= 0) {
3528
+ data.laneId = lane.laneId;
3529
+ data.lineSort = event.added.newIndex ?? 0;
3530
+ this.dragUpdateLine(data).then(() => {
3531
+ let promises = lane.lines.map((lines, index) => {
3532
+ lines.lineSort = index;
3533
+ return this.dragUpdateLine(lines);
3534
+ });
3535
+ Promise.all(promises).then(() => {
3536
+ this.onLineChange(lane.lines[lineIndex], ACTION_TYPE.UPSERT_LINE);
3537
+ });
3538
+ });
3539
+ }
3540
+ });
3541
+ } else if (Object.prototype.hasOwnProperty.call(event, "removed") && event.removed.element) {
3542
+ // 拖拽删除了线条
3543
+ let data = cloneDeep(event.removed.element);
3544
+ this.onLineChange(data, ACTION_TYPE.DELETE_LINE);
3545
+ } else if (Object.prototype.hasOwnProperty.call(event, "moved") && event.moved.element) {
3546
+ // 拖拽移动了线条
3547
+ let data = cloneDeep(event.moved.element);
3548
+ let currentLanes = this.currentTemplate.lanes;
3549
+ currentLanes.forEach((lane) => {
3550
+ if (lane.laneId == data.laneId) {
3551
+ let promises = lane.lines.map((lines, index) => {
3552
+ lines.lineSort = index;
3553
+ return this.dragUpdateLine(lines);
3554
+ });
3555
+ Promise.all(promises).then(() => {
3556
+ let lineIndex = lane.lines.findIndex((line) => line.lineId == data.lineId);
3557
+ this.onLineChange(lane.lines[lineIndex], ACTION_TYPE.UPSERT_LINE);
3558
+ });
3559
+ }
3560
+ });
3561
+ }
3562
+ },
3563
+ // 拖拽更新曲线
3564
+ dragUpdateLine(data) {
3565
+ return this.strategy.upsertLine(data).then((savedData) => {
3566
+ const currentLanes = this.currentTemplate.lanes;
3567
+ const laneIndex = currentLanes.findIndex((lane) => {
3568
+ return lane.laneId == savedData.laneId;
3569
+ });
3570
+ if (laneIndex < 0) {
3571
+ // 收说明不是更新的当前模板 替换内存中的数据
3572
+ for (const template of this.treeTemplates) {
3573
+ const { lanes } = template;
3574
+ for (const lane of lanes) {
3575
+ if (lane.laneId == savedData.laneId) {
3576
+ const { lines } = lane;
3577
+ const lineIndex = lines.findIndex((line) => {
3578
+ return line.lineId == savedData.lineId;
3579
+ });
3580
+ if (lineIndex < 0) {
3581
+ lines.push(savedData);
3582
+ } else {
3583
+ this.$set(lines, lineIndex, savedData);
3584
+ }
3585
+ sortLaneLines(lane);
3586
+ break;
3587
+ }
3588
+ }
3589
+ }
3590
+ } else {
3591
+ const lane = currentLanes[laneIndex];
3592
+ const currentLines = lane.lines;
3593
+ const lineIndex = currentLines.findIndex((line) => {
3594
+ return line.lineId == savedData.lineId;
3595
+ });
3596
+ if (lineIndex < 0) {
3597
+ currentLines.push(savedData);
3598
+ } else {
3599
+ this.$set(currentLines, lineIndex, savedData);
3600
+ }
3601
+ this.$set(currentLanes, laneIndex, lane);
3602
+ sortLaneLines(lane);
3603
+ return savedData;
3604
+ }
3605
+ });
3606
+ },
3607
+ // 拖拽更新泳道
3608
+ dragUpdateLane(data) {
3609
+ return this.strategy.upsertLane(data).then((savedData) => {
3610
+ const index = this.treeTemplates.findIndex((template) => {
3611
+ return template.templateId == savedData.templateId;
3612
+ });
3613
+ if (index < 0) {
3614
+ console.warn("template not found");
3615
+ } else {
3616
+ const template = this.treeTemplates[index];
3617
+ const lanes = template.lanes || [];
3618
+ const laneIndex = lanes.findIndex((lane) => lane.laneId == savedData.laneId);
3619
+ if (laneIndex < 0) {
3620
+ lanes.push(savedData);
3621
+ } else {
3622
+ this.$set(lanes, laneIndex, savedData);
3623
+ }
3624
+ sortLanes(template.lanes);
3625
+ }
3626
+ return savedData;
3627
+ });
3628
+ },
3503
3629
  getGridSize() {
3504
3630
  if (!this.$refs.refLaneDiv) return [];
3505
3631
  const isArray = Array.isArray(this.$refs.refLaneDiv);
@@ -3559,7 +3685,7 @@ var script = {
3559
3685
  currentLanes[laneIndex].lines.splice(lineIndex, 1);
3560
3686
  }
3561
3687
  // 以免每次保存都重新渲染
3562
- this.onLineChange(data, "delLine");
3688
+ this.onLineChange(data, ACTION_TYPE.DELETE_LINE);
3563
3689
  }
3564
3690
  });
3565
3691
  },
@@ -3603,7 +3729,7 @@ var script = {
3603
3729
  this.$set(currentLanes, laneIndex, lane);
3604
3730
  sortLaneLines(lane);
3605
3731
  // 以免每次保存都重新渲染
3606
- this.onLineChange(savedData, "upsertLine");
3732
+ this.onLineChange(savedData, ACTION_TYPE.UPSERT_LINE);
3607
3733
  return savedData;
3608
3734
  }
3609
3735
  });
@@ -3796,7 +3922,7 @@ var script = {
3796
3922
  const lineCount = Math.max(
3797
3923
  ...lanes.map((lane) => {
3798
3924
  return lane.lines?.length || 0;
3799
- })
3925
+ }),
3800
3926
  );
3801
3927
 
3802
3928
  return lineCount;
@@ -3876,106 +4002,162 @@ var __vue_render__ = function () {
3876
4002
  _vm.currentTemplate.lanes &&
3877
4003
  _vm.currentTemplate.lanes.length > 0
3878
4004
  ? [
3879
- _vm._l(_vm.currentTemplate.lanes || [], function (lane, index) {
3880
- return [
3881
- _vm.$scopedSlots["lane" + lane.laneId]
3882
- ? _c(
3883
- "div",
3884
- {
3885
- key: lane.laneId,
3886
- ref: "refLaneDiv",
3887
- refInFor: true,
3888
- staticClass: "kd-lane-chart-lane-slot-container",
3889
- class: { "border-left": index != 0 },
3890
- style: _vm.laneContainerStyle(lane, "slot"),
3891
- attrs: { "lane-id": lane.laneId },
3892
- },
3893
- [
3894
- _c(
4005
+ _c(
4006
+ "draggable",
4007
+ {
4008
+ staticClass: "kd-lane-chart-container",
4009
+ attrs: {
4010
+ animation: 200,
4011
+ fallbackOnBody: true,
4012
+ swapThreshold: 0.65,
4013
+ group: "laneGroup",
4014
+ },
4015
+ on: { change: _vm.dragtoModifyLane },
4016
+ model: {
4017
+ value: _vm.currentTemplate.lanes,
4018
+ callback: function ($$v) {
4019
+ _vm.$set(_vm.currentTemplate, "lanes", $$v);
4020
+ },
4021
+ expression: "currentTemplate.lanes",
4022
+ },
4023
+ },
4024
+ [
4025
+ _vm._l(_vm.currentTemplate.lanes || [], function (lane, index) {
4026
+ return [
4027
+ _vm.$scopedSlots["lane" + lane.laneId]
4028
+ ? _c(
3895
4029
  "div",
3896
4030
  {
3897
- staticClass: "kd-lane-chart-lane-header",
3898
- style: _vm.slotHeaderStyle,
4031
+ key: lane.laneId,
4032
+ ref: "refLaneDiv",
4033
+ refInFor: true,
4034
+ staticClass: "kd-lane-chart-lane-slot-container",
4035
+ class: { "border-left": index != 0 },
4036
+ style: _vm.laneContainerStyle(lane, "slot"),
4037
+ attrs: { "lane-id": lane.laneId },
3899
4038
  },
3900
- [_vm._t("lane" + lane.laneId, null, { lane: lane })],
3901
- 2
3902
- ),
3903
- ]
3904
- )
3905
- : _vm.$slots["lane" + lane.laneId]
3906
- ? _c(
3907
- "div",
3908
- {
3909
- key: "" + lane.laneId,
3910
- ref: "refLaneDiv",
3911
- refInFor: true,
3912
- staticClass: "kd-lane-chart-lane-slot-container",
3913
- class: { "border-left": index != 0 },
3914
- style: _vm.laneContainerStyle(lane, "slot"),
3915
- attrs: { "lane-id": lane.laneId },
3916
- },
3917
- [
3918
- _c(
4039
+ [
4040
+ _c(
4041
+ "div",
4042
+ {
4043
+ staticClass: "kd-lane-chart-lane-header",
4044
+ style: _vm.slotHeaderStyle,
4045
+ },
4046
+ [
4047
+ _vm._t("lane" + lane.laneId, null, {
4048
+ lane: lane,
4049
+ }),
4050
+ ],
4051
+ 2
4052
+ ),
4053
+ ]
4054
+ )
4055
+ : _vm.$slots["lane" + lane.laneId]
4056
+ ? _c(
3919
4057
  "div",
3920
4058
  {
3921
- staticClass: "kd-lane-chart-lane-header",
3922
- style: _vm.slotHeaderStyle,
4059
+ key: "" + lane.laneId,
4060
+ ref: "refLaneDiv",
4061
+ refInFor: true,
4062
+ staticClass: "kd-lane-chart-lane-slot-container",
4063
+ class: { "border-left": index != 0 },
4064
+ style: _vm.laneContainerStyle(lane, "slot"),
4065
+ attrs: { "lane-id": lane.laneId },
3923
4066
  },
3924
- [_vm._t("lane" + lane.laneId, null, { lane: lane })],
3925
- 2
3926
- ),
3927
- ]
3928
- )
3929
- : [
3930
- _c(
3931
- "div",
3932
- {
3933
- key: lane.laneId,
3934
- ref: "refLaneDiv",
3935
- refInFor: true,
3936
- staticClass: "kd-lane-chart-lane-container",
3937
- class: { "border-left": index != 0 },
3938
- style: _vm.laneContainerStyle(lane, "lane"),
3939
- attrs: { "lane-id": lane.laneId },
3940
- },
3941
- [
4067
+ [
4068
+ _c(
4069
+ "div",
4070
+ {
4071
+ staticClass: "kd-lane-chart-lane-header",
4072
+ style: _vm.slotHeaderStyle,
4073
+ },
4074
+ [
4075
+ _vm._t("lane" + lane.laneId, null, {
4076
+ lane: lane,
4077
+ }),
4078
+ ],
4079
+ 2
4080
+ ),
4081
+ ]
4082
+ )
4083
+ : [
3942
4084
  _c(
3943
4085
  "div",
3944
4086
  {
3945
- staticClass: "kd-lane-chart-lane-header",
3946
- style: _vm.headerStyle,
3947
- on: {
3948
- contextmenu: function ($event) {
3949
- $event.preventDefault();
3950
- return _vm.showContextMenu($event, lane)
3951
- },
3952
- },
4087
+ key: lane.laneId,
4088
+ ref: "refLaneDiv",
4089
+ refInFor: true,
4090
+ staticClass: "kd-lane-chart-lane-container",
4091
+ class: { "border-left": index != 0 },
4092
+ style: _vm.laneContainerStyle(lane, "lane"),
4093
+ attrs: { "lane-id": lane.laneId },
3953
4094
  },
3954
- _vm._l(lane.lines || [], function (line) {
3955
- return _c("HeaderItem", {
3956
- key: line.lineId,
3957
- attrs: {
3958
- itemHeight: _vm.headerItemHeight,
3959
- line: line,
3960
- paramsNameMap: _vm.paramsNameMap,
3961
- themeName: _vm.themeName,
3962
- },
3963
- on: { updateLine: _vm.upsertLine },
3964
- nativeOn: {
3965
- contextmenu: function ($event) {
3966
- $event.preventDefault();
3967
- return _vm.showContextMenu($event, line)
4095
+ [
4096
+ _c(
4097
+ "div",
4098
+ {
4099
+ staticClass: "kd-lane-chart-lane-header",
4100
+ style: _vm.headerStyle,
4101
+ on: {
4102
+ contextmenu: function ($event) {
4103
+ $event.preventDefault();
4104
+ return _vm.showContextMenu($event, lane)
4105
+ },
3968
4106
  },
3969
4107
  },
3970
- })
3971
- }),
3972
- 1
4108
+ [
4109
+ _c(
4110
+ "draggable",
4111
+ {
4112
+ attrs: {
4113
+ animation: 200,
4114
+ fallbackOnBody: true,
4115
+ swapThreshold: 0.65,
4116
+ group: "lineGroup",
4117
+ },
4118
+ on: { change: _vm.dragtoModifyLines },
4119
+ model: {
4120
+ value: lane.lines,
4121
+ callback: function ($$v) {
4122
+ _vm.$set(lane, "lines", $$v);
4123
+ },
4124
+ expression: "lane.lines",
4125
+ },
4126
+ },
4127
+ _vm._l(lane.lines || [], function (line) {
4128
+ return _c("HeaderItem", {
4129
+ key: line.lineId,
4130
+ attrs: {
4131
+ itemHeight: _vm.headerItemHeight,
4132
+ line: line,
4133
+ paramsNameMap: _vm.paramsNameMap,
4134
+ themeName: _vm.themeName,
4135
+ },
4136
+ on: { updateLine: _vm.upsertLine },
4137
+ nativeOn: {
4138
+ contextmenu: function ($event) {
4139
+ $event.preventDefault();
4140
+ return _vm.showContextMenu(
4141
+ $event,
4142
+ line
4143
+ )
4144
+ },
4145
+ },
4146
+ })
4147
+ }),
4148
+ 1
4149
+ ),
4150
+ ],
4151
+ 1
4152
+ ),
4153
+ ]
3973
4154
  ),
3974
- ]
3975
- ),
3976
- ],
3977
- ]
3978
- }),
4155
+ ],
4156
+ ]
4157
+ }),
4158
+ ],
4159
+ 2
4160
+ ),
3979
4161
  ]
3980
4162
  : [
3981
4163
  _c(