vxe-gantt 0.0.2 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +18 -24
  2. package/es/components.js +3 -2
  3. package/es/gantt/src/gantt-body.js +137 -0
  4. package/es/gantt/src/gantt-chart.js +125 -0
  5. package/es/gantt/src/gantt-header.js +97 -0
  6. package/es/gantt/src/gantt-view.js +820 -0
  7. package/es/gantt/src/gantt.js +1897 -43
  8. package/es/gantt/src/util.js +9 -0
  9. package/es/gantt/style.css +624 -0
  10. package/es/gantt/style.min.css +1 -0
  11. package/es/index.esm.js +5 -2
  12. package/es/style.css +1 -0
  13. package/es/style.min.css +1 -0
  14. package/es/ui/index.js +55 -5
  15. package/es/ui/src/comp.js +1 -2
  16. package/es/ui/src/dom.js +44 -105
  17. package/es/ui/src/log.js +3 -2
  18. package/es/ui/src/utils.js +4 -3
  19. package/es/ui/src/vn.js +1 -32
  20. package/es/vxe-gantt/style.css +624 -0
  21. package/es/vxe-gantt/style.min.css +1 -0
  22. package/helper/vetur/attributes.json +1 -1
  23. package/helper/vetur/tags.json +1 -1
  24. package/lib/components.js +20 -19
  25. package/lib/components.min.js +1 -1
  26. package/lib/gantt/index.js +3 -3
  27. package/lib/gantt/index.min.js +1 -1
  28. package/lib/gantt/src/gantt-body.js +140 -0
  29. package/lib/gantt/src/gantt-body.min.js +1 -0
  30. package/lib/gantt/src/gantt-chart.js +134 -0
  31. package/lib/gantt/src/gantt-chart.min.js +1 -0
  32. package/lib/gantt/src/gantt-header.js +97 -0
  33. package/lib/gantt/src/gantt-header.min.js +1 -0
  34. package/lib/gantt/src/gantt-view.js +808 -0
  35. package/lib/gantt/src/gantt-view.min.js +1 -0
  36. package/lib/gantt/src/gantt.js +2045 -48
  37. package/lib/gantt/src/gantt.min.js +1 -1
  38. package/lib/gantt/src/util.js +16 -0
  39. package/lib/gantt/src/util.min.js +1 -0
  40. package/lib/gantt/style/style.css +624 -0
  41. package/lib/gantt/style/style.min.css +1 -0
  42. package/lib/index.common.js +12 -7
  43. package/lib/index.umd.js +11484 -235
  44. package/lib/index.umd.min.js +1 -1
  45. package/lib/style.css +1 -0
  46. package/lib/style.min.css +1 -0
  47. package/lib/ui/index.js +54 -14
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/comp.js +3 -2
  50. package/lib/ui/src/comp.min.js +1 -1
  51. package/lib/ui/src/dom.js +78 -138
  52. package/lib/ui/src/dom.min.js +1 -1
  53. package/lib/ui/src/log.js +4 -3
  54. package/lib/ui/src/log.min.js +1 -1
  55. package/lib/ui/src/utils.js +5 -4
  56. package/lib/ui/src/utils.min.js +1 -1
  57. package/lib/ui/src/vn.js +1 -43
  58. package/lib/ui/src/vn.min.js +0 -1
  59. package/lib/vxe-gantt/index.js +4 -2
  60. package/lib/vxe-gantt/index.min.js +1 -1
  61. package/lib/vxe-gantt/style/style.css +624 -0
  62. package/lib/vxe-gantt/style/style.min.css +1 -0
  63. package/lib/vxe-ui/index.js +4 -2
  64. package/lib/vxe-ui/index.min.js +1 -1
  65. package/package.json +13 -13
  66. package/packages/components.ts +8 -5
  67. package/packages/gantt/index.ts +2 -2
  68. package/packages/gantt/src/gantt-body.ts +155 -0
  69. package/packages/gantt/src/gantt-chart.ts +143 -0
  70. package/packages/gantt/src/gantt-header.ts +109 -0
  71. package/packages/gantt/src/gantt-view.ts +908 -0
  72. package/packages/gantt/src/gantt.ts +2048 -46
  73. package/packages/gantt/src/util.ts +12 -0
  74. package/packages/index.ts +6 -2
  75. package/packages/ui/index.ts +56 -4
  76. package/packages/ui/src/comp.ts +2 -2
  77. package/packages/ui/src/dom.ts +53 -110
  78. package/packages/ui/src/log.ts +4 -2
  79. package/packages/ui/src/utils.ts +5 -3
  80. package/packages/ui/src/vn.ts +0 -37
  81. package/styles/components/gantt-module/all.scss +1 -0
  82. package/styles/components/gantt-module/gantt-chart.scss +65 -0
  83. package/styles/components/gantt.scss +591 -0
  84. package/styles/helpers/baseMixin.scss +96 -0
  85. package/styles/helpers/baseVar.scss +4 -0
  86. package/styles/helpers/placement.scss +39 -0
  87. package/styles/theme/base.scss +11 -0
  88. package/styles/theme/dark.scss +5 -0
  89. package/styles/theme/light.scss +5 -0
  90. package/types/all.d.ts +3 -3
  91. package/types/index.d.ts +2 -2
  92. package/README.en.md +0 -72
  93. package/README.ja-JP.md +0 -72
  94. package/README.zh-TW.md +0 -73
@@ -1,72 +1,2069 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
- var _vue = require("vue");
8
8
  var _comp = require("../../ui/src/comp");
9
- var _ui = require("../../ui");
9
+ var _core = require("@vxe-ui/core");
10
10
  var _xeUtils = _interopRequireDefault(require("xe-utils"));
11
+ var _utils = require("../../ui/src/utils");
12
+ var _dom = require("../../ui/src/dom");
13
+ var _log = require("../../ui/src/log");
14
+ var _ganttView = _interopRequireDefault(require("./gantt-view"));
15
+ var _vxeTable = require("vxe-table");
11
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
21
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
23
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
24
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
25
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
26
+ var getConfig = _core.VxeUI.getConfig,
27
+ getIcon = _core.VxeUI.getIcon,
28
+ getI18n = _core.VxeUI.getI18n,
29
+ commands = _core.VxeUI.commands,
30
+ globalMixins = _core.VxeUI.globalMixins,
31
+ createEvent = _core.VxeUI.createEvent,
32
+ globalEvents = _core.VxeUI.globalEvents,
33
+ GLOBAL_EVENT_KEYS = _core.VxeUI.GLOBAL_EVENT_KEYS,
34
+ renderEmptyElement = _core.VxeUI.renderEmptyElement,
35
+ getSlotVNs = _core.VxeUI.getSlotVNs;
36
+ var tableProps = _vxeTable.VxeTable.props;
37
+ var tableMethods = {};
38
+ var propKeys = Object.keys(tableProps);
39
+ var defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']];
40
+ function getTableOns(_vm) {
41
+ var $listeners = _vm.$listeners,
42
+ proxyConfig = _vm.proxyConfig,
43
+ proxyOpts = _vm.proxyOpts;
44
+ var ons = {};
45
+ _xeUtils.default.each($listeners, function (cb, type) {
46
+ ons[type] = function () {
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
49
+ }
50
+ _vm.$emit.apply(_vm, [type].concat(args));
51
+ };
52
+ });
53
+ if (proxyConfig) {
54
+ if (proxyOpts.sort) {
55
+ ons['sort-change'] = _vm.sortChangeEvent;
56
+ ons['clear-all-sort'] = _vm.clearAllSortEvent;
57
+ }
58
+ if (proxyOpts.filter) {
59
+ ons['filter-change'] = _vm.filterChangeEvent;
60
+ ons['clear-all-filter'] = _vm.clearAllFilterEvent;
61
+ }
62
+ }
63
+ return ons;
64
+ }
65
+ _xeUtils.default.each(_vxeTable.VxeTable.methods, function (fn, name) {
66
+ tableMethods[name] = function () {
67
+ var $xeGantt = this;
68
+ var $xeTable = $xeGantt.$refs.refTable;
69
+ return $xeTable && $xeTable[name].apply($xeTable, arguments);
70
+ };
71
+ });
12
72
  function createInternalData() {
13
- return {};
73
+ return {
74
+ resizeTableWidth: 0
75
+ };
14
76
  }
15
- var _default = exports.default = (0, _comp.defineVxeComponent)({
77
+ var _default2 = exports.default = /* define-vxe-component start */(0, _comp.defineVxeComponent)({
16
78
  name: 'VxeGantt',
17
- props: {
79
+ mixins: [globalMixins.sizeMixin],
80
+ props: Object.assign(Object.assign({}, tableProps), {
81
+ columns: Array,
82
+ pagerConfig: Object,
83
+ proxyConfig: Object,
84
+ toolbarConfig: Object,
85
+ formConfig: Object,
86
+ zoomConfig: Object,
87
+ layouts: Array,
88
+ taskConfig: Object,
89
+ taskViewConfig: Object,
90
+ taskBarConfig: Object,
91
+ taskSplitConfig: Object,
18
92
  size: {
19
93
  type: String,
20
- default: () => (0, _ui.getConfig)().gantt.size || (0, _ui.getConfig)().size
94
+ default: function _default() {
95
+ return getConfig().gantt.size || getConfig().size;
96
+ }
21
97
  }
98
+ }),
99
+ provide: function provide() {
100
+ var $xeGantt = this;
101
+ return {
102
+ $xeGantt: $xeGantt
103
+ };
22
104
  },
23
- emits: [],
24
- setup(props, context) {
25
- const {
26
- emit
27
- } = context;
28
- const xID = _xeUtils.default.uniqueId();
29
- const refElem = (0, _vue.ref)();
30
- const refTable = (0, _vue.ref)();
31
- const reactData = (0, _vue.reactive)({});
32
- const internalData = createInternalData();
33
- const refMaps = {
34
- refElem,
35
- refTable
105
+ data: function data() {
106
+ var _a;
107
+ var xID = _xeUtils.default.uniqueId();
108
+ var reactData = {
109
+ tableLoading: false,
110
+ proxyInited: false,
111
+ isZMax: false,
112
+ tableData: [],
113
+ filterData: [],
114
+ formData: {},
115
+ sortData: [],
116
+ tZindex: 0,
117
+ tablePage: {
118
+ total: 0,
119
+ pageSize: ((_a = getConfig().pager) === null || _a === void 0 ? void 0 : _a.pageSize) || 10,
120
+ currentPage: 1
121
+ },
122
+ showLeftView: true,
123
+ showRightView: true
36
124
  };
37
- const computeMaps = {};
38
- const $xeGantt = {
39
- xID,
40
- props,
41
- context,
42
- reactData,
43
- internalData,
44
- getRefMaps: () => refMaps,
45
- getComputeMaps: () => computeMaps
125
+ var internalData = createInternalData();
126
+ return {
127
+ xID: xID,
128
+ reactData: reactData,
129
+ internalData: internalData
46
130
  };
47
- const dispatchEvent = (type, params, evnt) => {
48
- emit(type, (0, _ui.createEvent)(evnt, {
131
+ },
132
+ computed: Object.assign(Object.assign({}, {}), {
133
+ computeProxyOpts: function computeProxyOpts() {
134
+ var $xeGantt = this;
135
+ var props = $xeGantt;
136
+ return _xeUtils.default.merge({}, _xeUtils.default.clone(getConfig().gantt.proxyConfig, true), props.proxyConfig);
137
+ },
138
+ computeIsRespMsg: function computeIsRespMsg() {
139
+ var $xeGantt = this;
140
+ var proxyOpts = $xeGantt.computeProxyOpts;
141
+ return !!(_xeUtils.default.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg);
142
+ },
143
+ computeIsActiveMsg: function computeIsActiveMsg() {
144
+ var $xeGantt = this;
145
+ var proxyOpts = $xeGantt.computeProxyOpts;
146
+ return _xeUtils.default.isBoolean(proxyOpts.showActionMsg) ? proxyOpts.showActionMsg : !!proxyOpts.showActiveMsg;
147
+ },
148
+ computePagerOpts: function computePagerOpts() {
149
+ var $xeGantt = this;
150
+ var props = $xeGantt;
151
+ return Object.assign({}, getConfig().gantt.pagerConfig, props.pagerConfig);
152
+ },
153
+ computeFormOpts: function computeFormOpts() {
154
+ var $xeGantt = this;
155
+ var props = $xeGantt;
156
+ return Object.assign({}, getConfig().gantt.formConfig, props.formConfig);
157
+ },
158
+ computeToolbarOpts: function computeToolbarOpts() {
159
+ var $xeGantt = this;
160
+ var props = $xeGantt;
161
+ return Object.assign({}, getConfig().gantt.toolbarConfig, props.toolbarConfig);
162
+ },
163
+ computeZoomOpts: function computeZoomOpts() {
164
+ var $xeGantt = this;
165
+ var props = $xeGantt;
166
+ return Object.assign({}, getConfig().gantt.zoomConfig, props.zoomConfig);
167
+ },
168
+ computeTaskOpts: function computeTaskOpts() {
169
+ var $xeGantt = this;
170
+ var props = $xeGantt;
171
+ return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig);
172
+ },
173
+ computeTaskViewOpts: function computeTaskViewOpts() {
174
+ var $xeGantt = this;
175
+ var props = $xeGantt;
176
+ return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig);
177
+ },
178
+ computeTaskBarOpts: function computeTaskBarOpts() {
179
+ var $xeGantt = this;
180
+ var props = $xeGantt;
181
+ return Object.assign({}, getConfig().gantt.taskBarConfig, props.taskBarConfig);
182
+ },
183
+ computeTaskSplitOpts: function computeTaskSplitOpts() {
184
+ var $xeGantt = this;
185
+ var props = $xeGantt;
186
+ return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
187
+ },
188
+ computeTitleField: function computeTitleField() {
189
+ var $xeGantt = this;
190
+ var taskOpts = $xeGantt.computeTaskOpts;
191
+ return taskOpts.titleField || 'title';
192
+ },
193
+ computeStartField: function computeStartField() {
194
+ var $xeGantt = this;
195
+ var taskOpts = $xeGantt.computeTaskOpts;
196
+ return taskOpts.startField || 'start';
197
+ },
198
+ computeEndField: function computeEndField() {
199
+ var $xeGantt = this;
200
+ var taskOpts = $xeGantt.computeTaskOpts;
201
+ return taskOpts.endField || 'end';
202
+ },
203
+ computeProgressField: function computeProgressField() {
204
+ var $xeGantt = this;
205
+ var taskOpts = $xeGantt.computeTaskOpts;
206
+ return taskOpts.progressField || 'progress';
207
+ },
208
+ computeScrollbarOpts: function computeScrollbarOpts() {
209
+ var $xeGantt = this;
210
+ var props = $xeGantt;
211
+ return Object.assign({}, getConfig().gantt.scrollbarConfig, props.scrollbarConfig);
212
+ },
213
+ computeScrollbarXToTop: function computeScrollbarXToTop() {
214
+ var $xeGantt = this;
215
+ var scrollbarOpts = $xeGantt.computeScrollbarOpts;
216
+ return !!(scrollbarOpts.x && scrollbarOpts.x.position === 'top');
217
+ },
218
+ computeScrollbarYToLeft: function computeScrollbarYToLeft() {
219
+ var $xeGantt = this;
220
+ var scrollbarOpts = $xeGantt.computeScrollbarOpts;
221
+ return !!(scrollbarOpts.y && scrollbarOpts.y.position === 'left');
222
+ },
223
+ computeStyles: function computeStyles() {
224
+ var $xeGantt = this;
225
+ var props = $xeGantt;
226
+ var reactData = $xeGantt.reactData;
227
+ var height = props.height,
228
+ maxHeight = props.maxHeight;
229
+ var isZMax = reactData.isZMax,
230
+ tZindex = reactData.tZindex;
231
+ var taskViewOpts = $xeGantt.computeTaskViewOpts;
232
+ var tableStyle = taskViewOpts.tableStyle;
233
+ var taskBarOpts = $xeGantt.computeTaskBarOpts;
234
+ var barStyle = taskBarOpts.barStyle;
235
+ var stys = {};
236
+ if (isZMax) {
237
+ stys.zIndex = tZindex;
238
+ } else {
239
+ if (height) {
240
+ stys.height = height === 'auto' || height === '100%' ? '100%' : (0, _dom.toCssUnit)(height);
241
+ }
242
+ if (maxHeight) {
243
+ stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : (0, _dom.toCssUnit)(maxHeight);
244
+ }
245
+ }
246
+ if (barStyle) {
247
+ var bgColor = barStyle.bgColor,
248
+ completedBgColor = barStyle.completedBgColor;
249
+ if (bgColor) {
250
+ stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor;
251
+ }
252
+ if (completedBgColor) {
253
+ stys['--vxe-ui-gantt-view-task-bar-completed-background-color'] = completedBgColor;
254
+ }
255
+ }
256
+ if (tableStyle) {
257
+ var defTbWidth = tableStyle.width;
258
+ if (defTbWidth) {
259
+ stys['--vxe-ui-gantt-view-table-default-width'] = (0, _dom.toCssUnit)(defTbWidth);
260
+ }
261
+ }
262
+ return stys;
263
+ },
264
+ computeTableExtendProps: function computeTableExtendProps() {
265
+ var $xeGantt = this;
266
+ var props = $xeGantt;
267
+ var rest = {};
268
+ var gridProps = props;
269
+ propKeys.forEach(function (key) {
270
+ rest[key] = gridProps[key];
271
+ });
272
+ return rest;
273
+ },
274
+ computeTableProps: function computeTableProps() {
275
+ var $xeGantt = this;
276
+ var props = $xeGantt;
277
+ var reactData = $xeGantt.reactData;
278
+ var seqConfig = props.seqConfig,
279
+ pagerConfig = props.pagerConfig,
280
+ editConfig = props.editConfig,
281
+ proxyConfig = props.proxyConfig;
282
+ var isZMax = reactData.isZMax,
283
+ tablePage = reactData.tablePage;
284
+ var tableExtendProps = $xeGantt.computeTableExtendProps;
285
+ var proxyOpts = $xeGantt.computeProxyOpts;
286
+ var pagerOpts = $xeGantt.computePagerOpts;
287
+ var isLoading = $xeGantt.computeIsLoading;
288
+ var tProps = Object.assign({}, tableExtendProps);
289
+ if (isZMax) {
290
+ if (tableExtendProps.maxHeight) {
291
+ tProps.maxHeight = '100%';
292
+ } else {
293
+ tProps.height = '100%';
294
+ }
295
+ }
296
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
297
+ tProps.loading = isLoading;
298
+ if (pagerConfig && proxyOpts.seq && (0, _utils.isEnableConf)(pagerOpts)) {
299
+ tProps.seqConfig = Object.assign({}, seqConfig, {
300
+ startIndex: (tablePage.currentPage - 1) * tablePage.pageSize
301
+ });
302
+ }
303
+ }
304
+ if (editConfig) {
305
+ tProps.editConfig = Object.assign({}, editConfig);
306
+ }
307
+ return tProps;
308
+ },
309
+ tableProps: function tableProps() {
310
+ var $xeGantt = this;
311
+ return $xeGantt.computeTableProps;
312
+ },
313
+ computeCurrLayoutConf: function computeCurrLayoutConf() {
314
+ var $xeGantt = this;
315
+ var props = $xeGantt;
316
+ var layouts = props.layouts;
317
+ var confs = [];
318
+ if (layouts && layouts.length) {
319
+ confs = layouts;
320
+ } else {
321
+ confs = getConfig().gantt.layouts || defaultLayouts;
322
+ }
323
+ var headKeys = [];
324
+ var bodyKeys = [];
325
+ var footKeys = [];
326
+ if (confs.length) {
327
+ if (_xeUtils.default.isArray(confs[0])) {
328
+ headKeys = confs[0];
329
+ bodyKeys = confs[1] || [];
330
+ footKeys = confs[2] || [];
331
+ } else {
332
+ bodyKeys = confs;
333
+ }
334
+ }
335
+ return {
336
+ headKeys: headKeys,
337
+ bodyKeys: bodyKeys,
338
+ footKeys: footKeys
339
+ };
340
+ },
341
+ computeCustomCurrentPageFlag: function computeCustomCurrentPageFlag() {
342
+ var $xeGantt = this;
343
+ var pagerOpts = $xeGantt.computePagerOpts;
344
+ return pagerOpts.currentPage;
345
+ },
346
+ computeCustomPageSizeFlag: function computeCustomPageSizeFlag() {
347
+ var $xeGantt = this;
348
+ var pagerOpts = $xeGantt.computePagerOpts;
349
+ return pagerOpts.pageSize;
350
+ },
351
+ computeCustomTotalFlag: function computeCustomTotalFlag() {
352
+ var $xeGantt = this;
353
+ var pagerOpts = $xeGantt.computePagerOpts;
354
+ return pagerOpts.total;
355
+ },
356
+ computePageCount: function computePageCount() {
357
+ var $xeGantt = this;
358
+ var reactData = $xeGantt.reactData;
359
+ var tablePage = reactData.tablePage;
360
+ return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1);
361
+ },
362
+ computeIsLoading: function computeIsLoading() {
363
+ var $xeGantt = this;
364
+ var props = $xeGantt;
365
+ var reactData = $xeGantt.reactData;
366
+ var loading = props.loading,
367
+ proxyConfig = props.proxyConfig;
368
+ var tableLoading = reactData.tableLoading;
369
+ var proxyOpts = $xeGantt.computeProxyOpts;
370
+ var showLoading = proxyOpts.showLoading;
371
+ return loading || tableLoading && showLoading && proxyConfig && (0, _utils.isEnableConf)(proxyOpts);
372
+ },
373
+ computeTableBorder: function computeTableBorder() {
374
+ var $xeGantt = this;
375
+ var props = $xeGantt;
376
+ var border = props.border;
377
+ if (border === true) {
378
+ return 'full';
379
+ }
380
+ if (border) {
381
+ return border;
382
+ }
383
+ return 'default';
384
+ }
385
+ }),
386
+ watch: {
387
+ columns: function columns() {
388
+ var $xeGantt = this;
389
+ var props = $xeGantt;
390
+ $xeGantt.$nextTick(function () {
391
+ return $xeGantt.loadColumn(props.columns || []);
392
+ });
393
+ },
394
+ toolbarConfig: function toolbarConfig() {
395
+ var $xeGantt = this;
396
+ $xeGantt.initToolbar();
397
+ },
398
+ computeCustomCurrentPageFlag: function computeCustomCurrentPageFlag() {
399
+ var $xeGantt = this;
400
+ $xeGantt.initPages('currentPage');
401
+ },
402
+ computeCustomPageSizeFlag: function computeCustomPageSizeFlag() {
403
+ var $xeGantt = this;
404
+ $xeGantt.initPages('pageSize');
405
+ },
406
+ computeCustomTotalFlag: function computeCustomTotalFlag() {
407
+ var $xeGantt = this;
408
+ $xeGantt.initPages('total');
409
+ },
410
+ proxyConfig: function proxyConfig() {
411
+ var $xeGantt = this;
412
+ $xeGantt.initProxy();
413
+ }
414
+ },
415
+ methods: Object.assign(Object.assign({}, tableMethods), {
416
+ dispatchEvent: function dispatchEvent(type, params, evnt) {
417
+ var $xeGantt = this;
418
+ $xeGantt.$emit(type, createEvent(evnt, {
419
+ $grid: null,
49
420
  $gantt: $xeGantt
50
421
  }, params));
51
- };
52
- const ganttMethods = {
53
- dispatchEvent
54
- };
55
- const ganttPrivateMethods = {};
56
- Object.assign($xeGantt, ganttMethods, ganttPrivateMethods);
57
- const renderVN = () => {
58
- return (0, _vue.h)('div', {
59
- ref: refElem,
60
- class: 'vxe-gantt'
422
+ },
423
+ initToolbar: function initToolbar() {
424
+ var $xeGantt = this;
425
+ $xeGantt.$nextTick(function () {
426
+ var $xeTable = $xeGantt.$refs.refTable;
427
+ var $xeToolbar = $xeGantt.$refs.refToolbar;
428
+ if ($xeTable && $xeToolbar) {
429
+ $xeTable.connectToolbar($xeToolbar);
430
+ }
61
431
  });
62
- };
63
- (0, _vue.onUnmounted)(() => {
64
- _xeUtils.default.assign(internalData, createInternalData());
432
+ },
433
+ initGanttView: function initGanttView() {
434
+ var $xeGantt = this;
435
+ var $xeTable = $xeGantt.$refs.refTable;
436
+ var $ganttView = $xeGantt.$refs.refGanttView;
437
+ if ($xeTable && $ganttView) {
438
+ $xeTable.handleConnectGanttView($ganttView);
439
+ }
440
+ },
441
+ initPages: function initPages(propKey) {
442
+ var $xeGantt = this;
443
+ var props = $xeGantt;
444
+ var reactData = $xeGantt.reactData;
445
+ var tablePage = reactData.tablePage;
446
+ var pagerConfig = props.pagerConfig;
447
+ var pagerOpts = $xeGantt.computePagerOpts;
448
+ if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
449
+ if (propKey) {
450
+ if (pagerOpts[propKey]) {
451
+ tablePage[propKey] = _xeUtils.default.toNumber(pagerOpts[propKey]);
452
+ }
453
+ } else {
454
+ var currentPage = pagerOpts.currentPage,
455
+ pageSize = pagerOpts.pageSize,
456
+ total = pagerOpts.total;
457
+ if (currentPage) {
458
+ tablePage.currentPage = currentPage;
459
+ }
460
+ if (pageSize) {
461
+ tablePage.pageSize = pageSize;
462
+ }
463
+ if (total) {
464
+ tablePage.total = total;
465
+ }
466
+ }
467
+ }
468
+ },
469
+ triggerPendingEvent: function triggerPendingEvent(code) {
470
+ var $xeGantt = this;
471
+ var isActiveMsg = $xeGantt.computeIsActiveMsg;
472
+ var $xeTable = $xeGantt.$refs.refTable;
473
+ var selectRecords = $xeTable.getCheckboxRecords();
474
+ if (selectRecords.length) {
475
+ $xeTable.togglePendingRow(selectRecords);
476
+ $xeGantt.clearCheckboxRow();
477
+ } else {
478
+ if (isActiveMsg) {
479
+ if (_core.VxeUI.modal) {
480
+ _core.VxeUI.modal.message({
481
+ id: code,
482
+ content: getI18n('vxe.grid.selectOneRecord'),
483
+ status: 'warning'
484
+ });
485
+ }
486
+ }
487
+ }
488
+ },
489
+ getRespMsg: function getRespMsg(rest, defaultMsg) {
490
+ var $xeGantt = this;
491
+ var proxyOpts = $xeGantt.computeProxyOpts;
492
+ var resConfigs = proxyOpts.response || proxyOpts.props || {};
493
+ var messageProp = resConfigs.message;
494
+ var $xeTable = $xeGantt.$refs.refTable;
495
+ var msg;
496
+ if (rest && messageProp) {
497
+ msg = _xeUtils.default.isFunction(messageProp) ? messageProp({
498
+ data: rest,
499
+ $table: $xeTable,
500
+ $grid: null,
501
+ $gantt: $xeGantt
502
+ }) : _xeUtils.default.get(rest, messageProp);
503
+ }
504
+ return msg || getI18n(defaultMsg);
505
+ },
506
+ handleDeleteRow: function handleDeleteRow(code, alertKey, callback) {
507
+ var $xeGantt = this;
508
+ var isActiveMsg = $xeGantt.computeIsActiveMsg;
509
+ var selectRecords = $xeGantt.getCheckboxRecords();
510
+ if (isActiveMsg) {
511
+ if (selectRecords.length) {
512
+ if (_core.VxeUI.modal) {
513
+ return _core.VxeUI.modal.confirm({
514
+ id: "cfm_".concat(code),
515
+ content: getI18n(alertKey),
516
+ escClosable: true
517
+ }).then(function (type) {
518
+ if (type === 'confirm') {
519
+ return callback();
520
+ }
521
+ });
522
+ }
523
+ } else {
524
+ if (_core.VxeUI.modal) {
525
+ _core.VxeUI.modal.message({
526
+ id: "msg_".concat(code),
527
+ content: getI18n('vxe.grid.selectOneRecord'),
528
+ status: 'warning'
529
+ });
530
+ }
531
+ }
532
+ } else {
533
+ if (selectRecords.length) {
534
+ callback();
535
+ }
536
+ }
537
+ return Promise.resolve();
538
+ },
539
+ pageChangeEvent: function pageChangeEvent(params) {
540
+ var $xeGantt = this;
541
+ var props = $xeGantt;
542
+ var reactData = $xeGantt.reactData;
543
+ var proxyConfig = props.proxyConfig;
544
+ var tablePage = reactData.tablePage;
545
+ var $event = params.$event,
546
+ currentPage = params.currentPage,
547
+ pageSize = params.pageSize;
548
+ var proxyOpts = $xeGantt.computeProxyOpts;
549
+ tablePage.currentPage = currentPage;
550
+ tablePage.pageSize = pageSize;
551
+ $xeGantt.dispatchEvent('page-change', params, $event);
552
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
553
+ $xeGantt.commitProxy('query').then(function (rest) {
554
+ $xeGantt.dispatchEvent('proxy-query', rest, $event);
555
+ });
556
+ }
557
+ },
558
+ handleSortEvent: function handleSortEvent(params) {
559
+ var $xeGantt = this;
560
+ var props = $xeGantt;
561
+ var reactData = $xeGantt.reactData;
562
+ var $xeTable = $xeGantt.$refs.refTable;
563
+ var proxyConfig = props.proxyConfig;
564
+ var proxyOpts = $xeGantt.computeProxyOpts;
565
+ var sortOpts = $xeTable.computeSortOpts;
566
+ // 如果是服务端排序
567
+ if (sortOpts.remote) {
568
+ reactData.sortData = params.sortList;
569
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
570
+ reactData.tablePage.currentPage = 1;
571
+ $xeGantt.commitProxy('query').then(function (rest) {
572
+ $xeGantt.dispatchEvent('proxy-query', rest, params.$event);
573
+ });
574
+ }
575
+ }
576
+ },
577
+ sortChangeEvent: function sortChangeEvent(params) {
578
+ var $xeGantt = this;
579
+ $xeGantt.handleSortEvent(params);
580
+ $xeGantt.dispatchEvent('sort-change', params, params.$event);
581
+ },
582
+ clearAllSortEvent: function clearAllSortEvent(params) {
583
+ var $xeGantt = this;
584
+ $xeGantt.handleSortEvent(params);
585
+ $xeGantt.dispatchEvent('clear-all-sort', params, params.$event);
586
+ },
587
+ handleFilterEvent: function handleFilterEvent(params) {
588
+ var $xeGantt = this;
589
+ var props = $xeGantt;
590
+ var reactData = $xeGantt.reactData;
591
+ var $xeTable = $xeGantt.$refs.refTable;
592
+ var proxyConfig = props.proxyConfig;
593
+ var proxyOpts = $xeGantt.computeProxyOpts;
594
+ var filterOpts = $xeTable.computeFilterOpts;
595
+ // 如果是服务端过滤
596
+ if (filterOpts.remote) {
597
+ reactData.filterData = params.filterList;
598
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
599
+ reactData.tablePage.currentPage = 1;
600
+ $xeGantt.commitProxy('query').then(function (rest) {
601
+ $xeGantt.dispatchEvent('proxy-query', rest, params.$event);
602
+ });
603
+ }
604
+ }
605
+ },
606
+ filterChangeEvent: function filterChangeEvent(params) {
607
+ var $xeGantt = this;
608
+ $xeGantt.handleFilterEvent(params);
609
+ $xeGantt.dispatchEvent('filter-change', params, params.$event);
610
+ },
611
+ clearAllFilterEvent: function clearAllFilterEvent(params) {
612
+ var $xeGantt = this;
613
+ $xeGantt.handleFilterEvent(params);
614
+ $xeGantt.dispatchEvent('clear-all-filter', params, params.$event);
615
+ },
616
+ submitFormEvent: function submitFormEvent(params) {
617
+ var $xeGantt = this;
618
+ var props = $xeGantt;
619
+ var reactData = $xeGantt.reactData;
620
+ var proxyConfig = props.proxyConfig;
621
+ var proxyOpts = $xeGantt.computeProxyOpts;
622
+ if (reactData.tableLoading) {
623
+ return;
624
+ }
625
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
626
+ $xeGantt.commitProxy('reload').then(function (rest) {
627
+ $xeGantt.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), {
628
+ isReload: true
629
+ }), params.$event);
630
+ });
631
+ }
632
+ $xeGantt.dispatchEvent('form-submit', params, params.$event);
633
+ },
634
+ resetFormEvent: function resetFormEvent(params) {
635
+ var $xeGantt = this;
636
+ var props = $xeGantt;
637
+ var $xeTable = $xeGantt.$refs.refTable;
638
+ var proxyConfig = props.proxyConfig;
639
+ var $event = params.$event;
640
+ var proxyOpts = $xeGantt.computeProxyOpts;
641
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts)) {
642
+ $xeTable.clearScroll();
643
+ $xeGantt.commitProxy('reload').then(function (rest) {
644
+ $xeGantt.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), {
645
+ isReload: true
646
+ }), $event);
647
+ });
648
+ }
649
+ $xeGantt.dispatchEvent('form-reset', params, $event);
650
+ },
651
+ submitInvalidEvent: function submitInvalidEvent(params) {
652
+ var $xeGantt = this;
653
+ $xeGantt.dispatchEvent('form-submit-invalid', params, params.$event);
654
+ },
655
+ collapseEvent: function collapseEvent(params) {
656
+ var $xeGantt = this;
657
+ var $event = params.$event;
658
+ $xeGantt.dispatchEvent('form-toggle-collapse', params, $event);
659
+ $xeGantt.dispatchEvent('form-collapse', params, $event);
660
+ },
661
+ handleZoom: function handleZoom(isMax) {
662
+ var $xeGantt = this;
663
+ var reactData = $xeGantt.reactData;
664
+ var isZMax = reactData.isZMax;
665
+ if (isMax ? !isZMax : isZMax) {
666
+ reactData.isZMax = !isZMax;
667
+ if (reactData.tZindex < (0, _utils.getLastZIndex)()) {
668
+ reactData.tZindex = (0, _utils.nextZIndex)();
669
+ }
670
+ }
671
+ return $xeGantt.$nextTick().then(function () {
672
+ return $xeGantt.recalculate(true);
673
+ }).then(function () {
674
+ setTimeout(function () {
675
+ return $xeGantt.recalculate(true);
676
+ }, 15);
677
+ return reactData.isZMax;
678
+ });
679
+ },
680
+ dragSplitEvent: function dragSplitEvent(evnt) {
681
+ var $xeGantt = this;
682
+ var el = $xeGantt.$refs.refElem;
683
+ if (!el) {
684
+ return;
685
+ }
686
+ var ganttContainerEl = $xeGantt.$refs.refGanttContainer;
687
+ if (!ganttContainerEl) {
688
+ return;
689
+ }
690
+ var tableWrapperEl = $xeGantt.$refs.refTableWrapper;
691
+ if (!tableWrapperEl) {
692
+ return;
693
+ }
694
+ var rsSplitLineEl = $xeGantt.$refs.refResizableSplitTip;
695
+ if (!rsSplitLineEl) {
696
+ return;
697
+ }
698
+ var taskViewOpts = $xeGantt.computeTaskViewOpts;
699
+ var containerRect = ganttContainerEl.getBoundingClientRect();
700
+ var rsSplitTipEl = rsSplitLineEl.children[0];
701
+ var disX = evnt.clientX;
702
+ var ganttWidth = ganttContainerEl.clientWidth;
703
+ var tableWidth = tableWrapperEl.clientWidth;
704
+ var tableMinWidth = taskViewOpts.tableStyle && _xeUtils.default.toNumber(taskViewOpts.tableStyle.minWidth) || 80;
705
+ var targetTableWidth = tableWidth;
706
+ var offsetLeft = -1;
707
+ (0, _dom.addClass)(el, 'is--split-drag');
708
+ var handleReStyle = function handleReStyle(evnt) {
709
+ var rsNumLeftEl = rsSplitTipEl.children[0];
710
+ var rsNumRightEl = rsSplitTipEl.children[1];
711
+ var tipHeight = 0;
712
+ if (rsNumLeftEl) {
713
+ if (offsetLeft < 0) {
714
+ rsNumLeftEl.textContent = "".concat(targetTableWidth, "px");
715
+ rsNumLeftEl.style.display = 'block';
716
+ tipHeight = rsNumLeftEl.offsetHeight;
717
+ } else {
718
+ rsNumLeftEl.style.display = 'none';
719
+ }
720
+ }
721
+ if (rsNumRightEl) {
722
+ if (offsetLeft < 0) {
723
+ rsNumRightEl.style.display = 'none';
724
+ } else {
725
+ rsNumRightEl.textContent = "".concat(Math.floor(containerRect.width - targetTableWidth), "px");
726
+ rsNumRightEl.style.display = 'block';
727
+ tipHeight = rsNumRightEl.offsetHeight;
728
+ }
729
+ }
730
+ var tipTop = evnt.clientY - containerRect.top - tipHeight / 2;
731
+ rsSplitLineEl.style.left = "".concat(targetTableWidth, "px");
732
+ rsSplitTipEl.style.top = "".concat(Math.min(containerRect.height - tipHeight - 1, Math.max(1, tipTop)), "px");
733
+ };
734
+ document.onmousemove = function (evnt) {
735
+ evnt.preventDefault();
736
+ offsetLeft = evnt.clientX - disX;
737
+ targetTableWidth = Math.min(ganttWidth - 80, Math.max(tableMinWidth, tableWidth + offsetLeft));
738
+ handleReStyle(evnt);
739
+ };
740
+ document.onmouseup = function () {
741
+ document.onmousemove = null;
742
+ document.onmouseup = null;
743
+ rsSplitLineEl.style.display = '';
744
+ tableWrapperEl.style.width = "".concat(targetTableWidth, "px");
745
+ (0, _dom.removeClass)(el, 'is--split-drag');
746
+ var $xeTable = $xeGantt.$refs.refTable;
747
+ if ($xeTable) {
748
+ $xeTable.recalculate(true);
749
+ }
750
+ };
751
+ rsSplitLineEl.style.display = 'block';
752
+ handleReStyle(evnt);
753
+ },
754
+ handleSplitLeftViewEvent: function handleSplitLeftViewEvent() {
755
+ var $xeGantt = this;
756
+ var reactData = $xeGantt.reactData;
757
+ reactData.showLeftView = !reactData.showLeftView;
758
+ },
759
+ handleSplitRightViewEvent: function handleSplitRightViewEvent() {
760
+ var $xeGantt = this;
761
+ var reactData = $xeGantt.reactData;
762
+ reactData.showRightView = !reactData.showRightView;
763
+ },
764
+ getDefaultFormData: function getDefaultFormData() {
765
+ var $xeGantt = this;
766
+ var formOpts = $xeGantt.computeFormOpts;
767
+ if (formOpts.items) {
768
+ var fData = {};
769
+ formOpts.items.forEach(function (item) {
770
+ var field = item.field,
771
+ itemRender = item.itemRender;
772
+ if (field) {
773
+ var itemValue = null;
774
+ if (itemRender) {
775
+ var defaultValue = itemRender.defaultValue;
776
+ if (_xeUtils.default.isFunction(defaultValue)) {
777
+ itemValue = defaultValue({
778
+ item: item
779
+ });
780
+ } else if (!_xeUtils.default.isUndefined(defaultValue)) {
781
+ itemValue = defaultValue;
782
+ }
783
+ }
784
+ fData[field] = itemValue;
785
+ }
786
+ });
787
+ return fData;
788
+ }
789
+ return {};
790
+ },
791
+ initProxy: function initProxy() {
792
+ var $xeGantt = this;
793
+ var props = $xeGantt;
794
+ var reactData = $xeGantt.reactData;
795
+ var proxyConfig = props.proxyConfig,
796
+ formConfig = props.formConfig;
797
+ var proxyInited = reactData.proxyInited;
798
+ var proxyOpts = $xeGantt.computeProxyOpts;
799
+ var formOpts = $xeGantt.computeFormOpts;
800
+ if (proxyConfig) {
801
+ if ((0, _utils.isEnableConf)(formConfig) && proxyOpts.form && formOpts.items) {
802
+ reactData.formData = $xeGantt.getDefaultFormData();
803
+ }
804
+ if (!proxyInited && proxyOpts.autoLoad !== false) {
805
+ reactData.proxyInited = true;
806
+ $xeGantt.$nextTick().then(function () {
807
+ return $xeGantt.commitProxy('initial');
808
+ }).then(function (rest) {
809
+ $xeGantt.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), {
810
+ isInited: true
811
+ }), new Event('initial'));
812
+ });
813
+ }
814
+ }
815
+ },
816
+ handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
817
+ var $xeGantt = this;
818
+ var reactData = $xeGantt.reactData;
819
+ var zoomOpts = $xeGantt.computeZoomOpts;
820
+ var isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
821
+ if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
822
+ $xeGantt.triggerZoomEvent(evnt);
823
+ }
824
+ },
825
+ getEl: function getEl() {
826
+ var $xeGantt = this;
827
+ return $xeGantt.$refs.refElem;
828
+ },
829
+ /**
830
+ * 提交指令,支持 code 或 button
831
+ * @param {String/Object} code 字符串或对象
832
+ */
833
+ commitProxy: function commitProxy(proxyTarget) {
834
+ var $xeGantt = this;
835
+ var props = $xeGantt;
836
+ var reactData = $xeGantt.reactData;
837
+ /**
838
+ * 已废弃
839
+ * @deprecated
840
+ */
841
+ var toolbar = props.toolbar;
842
+ var proxyConfig = props.proxyConfig,
843
+ toolbarConfig = props.toolbarConfig,
844
+ pagerConfig = props.pagerConfig,
845
+ editRules = props.editRules,
846
+ validConfig = props.validConfig;
847
+ var tablePage = reactData.tablePage;
848
+ var isActiveMsg = $xeGantt.computeIsActiveMsg;
849
+ var isRespMsg = $xeGantt.computeIsRespMsg;
850
+ var proxyOpts = $xeGantt.computeProxyOpts;
851
+ var pagerOpts = $xeGantt.computePagerOpts;
852
+ var toolbarOpts = $xeGantt.computeToolbarOpts;
853
+ var beforeQuery = proxyOpts.beforeQuery,
854
+ afterQuery = proxyOpts.afterQuery,
855
+ beforeDelete = proxyOpts.beforeDelete,
856
+ afterDelete = proxyOpts.afterDelete,
857
+ beforeSave = proxyOpts.beforeSave,
858
+ afterSave = proxyOpts.afterSave,
859
+ _proxyOpts$ajax = proxyOpts.ajax,
860
+ ajax = _proxyOpts$ajax === void 0 ? {} : _proxyOpts$ajax;
861
+ var resConfigs = proxyOpts.response || proxyOpts.props || {};
862
+ var $xeTable = $xeGantt.$refs.refTable;
863
+ var formData = $xeGantt.getFormData();
864
+ var button = null;
865
+ var code = null;
866
+ if (_xeUtils.default.isString(proxyTarget)) {
867
+ var buttons = toolbarOpts.buttons;
868
+ var matchObj = (toolbarConfig || toolbar) && (0, _utils.isEnableConf)(toolbarOpts) && buttons ? _xeUtils.default.findTree(buttons, function (item) {
869
+ return item.code === proxyTarget;
870
+ }, {
871
+ children: 'dropdowns'
872
+ }) : null;
873
+ button = matchObj ? matchObj.item : null;
874
+ code = proxyTarget;
875
+ } else {
876
+ button = proxyTarget;
877
+ code = button.code;
878
+ }
879
+ var btnParams = button ? button.params : null;
880
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
881
+ args[_key2 - 1] = arguments[_key2];
882
+ }
883
+ switch (code) {
884
+ case 'insert':
885
+ return $xeTable.insert({});
886
+ case 'insert_edit':
887
+ return $xeTable.insert({}).then(function (_ref) {
888
+ var row = _ref.row;
889
+ return $xeTable.setEditRow(row, true);
890
+ });
891
+ // 已废弃
892
+ case 'insert_actived':
893
+ return $xeTable.insert({}).then(function (_ref2) {
894
+ var row = _ref2.row;
895
+ return $xeTable.setEditRow(row, true);
896
+ });
897
+ // 已废弃
898
+ case 'mark_cancel':
899
+ $xeGantt.triggerPendingEvent(code);
900
+ break;
901
+ case 'remove':
902
+ return $xeGantt.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', function () {
903
+ return $xeTable.removeCheckboxRow();
904
+ });
905
+ case 'import':
906
+ $xeTable.importData(btnParams);
907
+ break;
908
+ case 'open_import':
909
+ $xeTable.openImport(btnParams);
910
+ break;
911
+ case 'export':
912
+ $xeTable.exportData(btnParams);
913
+ break;
914
+ case 'open_export':
915
+ $xeTable.openExport(btnParams);
916
+ break;
917
+ case 'reset_custom':
918
+ $xeTable.resetCustom(true);
919
+ break;
920
+ case 'initial':
921
+ case 'reload':
922
+ case 'query':
923
+ {
924
+ var ajaxMethods = ajax.query;
925
+ var querySuccessMethods = ajax.querySuccess;
926
+ var queryErrorMethods = ajax.queryError;
927
+ if (ajaxMethods) {
928
+ var isInited = code === 'initial';
929
+ var isReload = code === 'reload';
930
+ if (!isInited && reactData.tableLoading) {
931
+ return $xeGantt.$nextTick();
932
+ }
933
+ var sortList = [];
934
+ var filterList = [];
935
+ var pageParams = {};
936
+ if (pagerConfig) {
937
+ if (isInited || isReload) {
938
+ tablePage.currentPage = 1;
939
+ }
940
+ if ((0, _utils.isEnableConf)(pagerConfig)) {
941
+ pageParams = Object.assign({}, tablePage);
942
+ }
943
+ }
944
+ if (isInited) {
945
+ // 重置代理表单数据
946
+ if (proxyConfig && (0, _utils.isEnableConf)(proxyOpts) && proxyOpts.form) {
947
+ formData = $xeGantt.getDefaultFormData();
948
+ reactData.formData = formData;
949
+ }
950
+ if ($xeTable) {
951
+ var tableInternalData = $xeTable;
952
+ var tableFullColumn = tableInternalData.tableFullColumn,
953
+ fullColumnFieldData = tableInternalData.fullColumnFieldData;
954
+ var sortOpts = $xeTable.computeSortOpts;
955
+ var defaultSort = sortOpts.defaultSort;
956
+ tableFullColumn.forEach(function (column) {
957
+ column.order = null;
958
+ });
959
+ // 如果使用默认排序
960
+ if (defaultSort) {
961
+ if (!_xeUtils.default.isArray(defaultSort)) {
962
+ defaultSort = [defaultSort];
963
+ }
964
+ sortList = defaultSort.map(function (item) {
965
+ var field = item.field,
966
+ order = item.order;
967
+ var colRest = fullColumnFieldData[field];
968
+ if (colRest) {
969
+ var column = colRest.column;
970
+ if (column) {
971
+ column.order = order;
972
+ }
973
+ }
974
+ return {
975
+ field: field,
976
+ property: field,
977
+ order: order
978
+ };
979
+ });
980
+ }
981
+ filterList = $xeTable.getCheckedFilters();
982
+ }
983
+ } else {
984
+ if ($xeTable) {
985
+ if (isReload) {
986
+ $xeTable.clearAll();
987
+ } else {
988
+ sortList = $xeTable.getSortColumns();
989
+ filterList = $xeTable.getCheckedFilters();
990
+ }
991
+ }
992
+ }
993
+ var commitParams = {
994
+ $table: $xeTable,
995
+ $grid: null,
996
+ $gantt: $xeGantt,
997
+ code: code,
998
+ button: button,
999
+ isInited: isInited,
1000
+ isReload: isReload,
1001
+ page: pageParams,
1002
+ sort: sortList.length ? sortList[0] : {},
1003
+ sorts: sortList,
1004
+ filters: filterList,
1005
+ form: formData,
1006
+ options: ajaxMethods
1007
+ };
1008
+ reactData.sortData = sortList;
1009
+ reactData.filterData = filterList;
1010
+ reactData.tableLoading = true;
1011
+ var applyArgs = [commitParams].concat(args);
1012
+ return Promise.resolve((beforeQuery || ajaxMethods).apply(void 0, _toConsumableArray(applyArgs))).then(function (rest) {
1013
+ var tableData = [];
1014
+ reactData.tableLoading = false;
1015
+ if (rest) {
1016
+ if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
1017
+ var totalProp = resConfigs.total;
1018
+ var total = (_xeUtils.default.isFunction(totalProp) ? totalProp({
1019
+ data: rest,
1020
+ $table: $xeTable,
1021
+ $grid: null,
1022
+ $gantt: $xeGantt
1023
+ }) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
1024
+ tablePage.total = _xeUtils.default.toNumber(total);
1025
+ var resultProp = resConfigs.result;
1026
+ tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp({
1027
+ data: rest,
1028
+ $table: $xeTable,
1029
+ $grid: null,
1030
+ $gantt: $xeGantt
1031
+ }) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
1032
+ // 检验当前页码,不能超出当前最大页数
1033
+ var pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
1034
+ if (tablePage.currentPage > pageCount) {
1035
+ tablePage.currentPage = pageCount;
1036
+ }
1037
+ } else {
1038
+ var listProp = resConfigs.list;
1039
+ tableData = (listProp ? _xeUtils.default.isFunction(listProp) ? listProp({
1040
+ data: rest,
1041
+ $table: $xeTable,
1042
+ $grid: null,
1043
+ $gantt: $xeGantt
1044
+ }) : _xeUtils.default.get(rest, listProp) : rest) || [];
1045
+ }
1046
+ }
1047
+ if ($xeTable) {
1048
+ $xeTable.loadData(tableData);
1049
+ } else {
1050
+ $xeTable.$nextTick(function () {
1051
+ if ($xeTable) {
1052
+ $xeTable.loadData(tableData);
1053
+ }
1054
+ });
1055
+ }
1056
+ if (afterQuery) {
1057
+ afterQuery.apply(void 0, _toConsumableArray(applyArgs));
1058
+ }
1059
+ if (querySuccessMethods) {
1060
+ querySuccessMethods(Object.assign(Object.assign({}, commitParams), {
1061
+ response: rest
1062
+ }));
1063
+ }
1064
+ return {
1065
+ status: true
1066
+ };
1067
+ }).catch(function (rest) {
1068
+ reactData.tableLoading = false;
1069
+ if (queryErrorMethods) {
1070
+ queryErrorMethods(Object.assign(Object.assign({}, commitParams), {
1071
+ response: rest
1072
+ }));
1073
+ }
1074
+ return {
1075
+ status: false
1076
+ };
1077
+ });
1078
+ } else {
1079
+ (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.query']);
1080
+ }
1081
+ break;
1082
+ }
1083
+ case 'delete':
1084
+ {
1085
+ var _ajaxMethods = ajax.delete;
1086
+ var deleteSuccessMethods = ajax.deleteSuccess;
1087
+ var deleteErrorMethods = ajax.deleteError;
1088
+ if (_ajaxMethods) {
1089
+ var selectRecords = $xeTable.getCheckboxRecords();
1090
+ var removeRecords = selectRecords.filter(function (row) {
1091
+ return !$xeTable.isInsertByRow(row);
1092
+ });
1093
+ var body = {
1094
+ removeRecords: removeRecords
1095
+ };
1096
+ var _commitParams = {
1097
+ $table: $xeTable,
1098
+ $grid: null,
1099
+ $gantt: $xeGantt,
1100
+ code: code,
1101
+ button: button,
1102
+ body: body,
1103
+ form: formData,
1104
+ options: _ajaxMethods
1105
+ };
1106
+ var _applyArgs = [_commitParams].concat(args);
1107
+ if (selectRecords.length) {
1108
+ return $xeGantt.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', function () {
1109
+ if (!removeRecords.length) {
1110
+ return $xeTable.remove(selectRecords);
1111
+ }
1112
+ reactData.tableLoading = true;
1113
+ return Promise.resolve((beforeDelete || _ajaxMethods).apply(void 0, _toConsumableArray(_applyArgs))).then(function (rest) {
1114
+ reactData.tableLoading = false;
1115
+ $xeTable.setPendingRow(removeRecords, false);
1116
+ if (isRespMsg) {
1117
+ // 检测弹窗模块
1118
+ if (!_core.VxeUI.modal) {
1119
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1120
+ }
1121
+ _core.VxeUI.modal.message({
1122
+ content: $xeGantt.getRespMsg(rest, 'vxe.grid.delSuccess'),
1123
+ status: 'success'
1124
+ });
1125
+ }
1126
+ if (afterDelete) {
1127
+ afterDelete.apply(void 0, _toConsumableArray(_applyArgs));
1128
+ } else {
1129
+ $xeGantt.commitProxy('query');
1130
+ }
1131
+ if (deleteSuccessMethods) {
1132
+ deleteSuccessMethods(Object.assign(Object.assign({}, _commitParams), {
1133
+ response: rest
1134
+ }));
1135
+ }
1136
+ return {
1137
+ status: true
1138
+ };
1139
+ }).catch(function (rest) {
1140
+ reactData.tableLoading = false;
1141
+ if (isRespMsg) {
1142
+ // 检测弹窗模块
1143
+ if (!_core.VxeUI.modal) {
1144
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1145
+ }
1146
+ _core.VxeUI.modal.message({
1147
+ id: code,
1148
+ content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'),
1149
+ status: 'error'
1150
+ });
1151
+ }
1152
+ if (deleteErrorMethods) {
1153
+ deleteErrorMethods(Object.assign(Object.assign({}, _commitParams), {
1154
+ response: rest
1155
+ }));
1156
+ }
1157
+ return {
1158
+ status: false
1159
+ };
1160
+ });
1161
+ });
1162
+ } else {
1163
+ if (isActiveMsg) {
1164
+ // 检测弹窗模块
1165
+ if (!_core.VxeUI.modal) {
1166
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1167
+ }
1168
+ _core.VxeUI.modal.message({
1169
+ id: code,
1170
+ content: getI18n('vxe.grid.selectOneRecord'),
1171
+ status: 'warning'
1172
+ });
1173
+ }
1174
+ }
1175
+ } else {
1176
+ (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.delete']);
1177
+ }
1178
+ break;
1179
+ }
1180
+ case 'save':
1181
+ {
1182
+ var _ajaxMethods2 = ajax.save;
1183
+ var saveSuccessMethods = ajax.saveSuccess;
1184
+ var saveErrorMethods = ajax.saveError;
1185
+ if (_ajaxMethods2) {
1186
+ var _body = $xeGantt.getRecordset();
1187
+ var insertRecords = _body.insertRecords,
1188
+ _removeRecords = _body.removeRecords,
1189
+ updateRecords = _body.updateRecords,
1190
+ pendingRecords = _body.pendingRecords;
1191
+ var _commitParams2 = {
1192
+ $table: $xeTable,
1193
+ $grid: null,
1194
+ $gantt: $xeGantt,
1195
+ code: code,
1196
+ button: button,
1197
+ body: _body,
1198
+ form: formData,
1199
+ options: _ajaxMethods2
1200
+ };
1201
+ var _applyArgs2 = [_commitParams2].concat(args);
1202
+ // 排除掉新增且标记为删除的数据
1203
+ if (insertRecords.length) {
1204
+ _body.pendingRecords = pendingRecords.filter(function (row) {
1205
+ return insertRecords.indexOf(row) === -1;
1206
+ });
1207
+ }
1208
+ // 排除已标记为删除的数据
1209
+ if (pendingRecords.length) {
1210
+ _body.insertRecords = insertRecords.filter(function (row) {
1211
+ return pendingRecords.indexOf(row) === -1;
1212
+ });
1213
+ }
1214
+ var restPromise = Promise.resolve();
1215
+ if (editRules) {
1216
+ // 只校验新增和修改的数据
1217
+ restPromise = $xeGantt[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](_body.insertRecords.concat(updateRecords));
1218
+ }
1219
+ return restPromise.then(function (errMap) {
1220
+ if (errMap) {
1221
+ // 如果校验不通过
1222
+ return;
1223
+ }
1224
+ if (_body.insertRecords.length || _removeRecords.length || updateRecords.length || _body.pendingRecords.length) {
1225
+ reactData.tableLoading = true;
1226
+ return Promise.resolve((beforeSave || _ajaxMethods2).apply(void 0, _toConsumableArray(_applyArgs2))).then(function (rest) {
1227
+ reactData.tableLoading = false;
1228
+ $xeTable.clearPendingRow();
1229
+ if (isRespMsg) {
1230
+ // 检测弹窗模块
1231
+ if (!_core.VxeUI.modal) {
1232
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1233
+ }
1234
+ _core.VxeUI.modal.message({
1235
+ content: $xeGantt.getRespMsg(rest, 'vxe.grid.saveSuccess'),
1236
+ status: 'success'
1237
+ });
1238
+ }
1239
+ if (afterSave) {
1240
+ afterSave.apply(void 0, _toConsumableArray(_applyArgs2));
1241
+ } else {
1242
+ $xeGantt.commitProxy('query');
1243
+ }
1244
+ if (saveSuccessMethods) {
1245
+ saveSuccessMethods(Object.assign(Object.assign({}, _commitParams2), {
1246
+ response: rest
1247
+ }));
1248
+ }
1249
+ return {
1250
+ status: true
1251
+ };
1252
+ }).catch(function (rest) {
1253
+ reactData.tableLoading = false;
1254
+ if (isRespMsg) {
1255
+ // 检测弹窗模块
1256
+ if (!_core.VxeUI.modal) {
1257
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1258
+ }
1259
+ _core.VxeUI.modal.message({
1260
+ id: code,
1261
+ content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'),
1262
+ status: 'error'
1263
+ });
1264
+ }
1265
+ if (saveErrorMethods) {
1266
+ saveErrorMethods(Object.assign(Object.assign({}, _commitParams2), {
1267
+ response: rest
1268
+ }));
1269
+ }
1270
+ return {
1271
+ status: false
1272
+ };
1273
+ });
1274
+ } else {
1275
+ if (isActiveMsg) {
1276
+ // 检测弹窗模块
1277
+ if (!_core.VxeUI.modal) {
1278
+ (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1279
+ }
1280
+ _core.VxeUI.modal.message({
1281
+ id: code,
1282
+ content: getI18n('vxe.grid.dataUnchanged'),
1283
+ status: 'info'
1284
+ });
1285
+ }
1286
+ }
1287
+ });
1288
+ } else {
1289
+ (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.save']);
1290
+ }
1291
+ break;
1292
+ }
1293
+ default:
1294
+ {
1295
+ var gCommandOpts = commands.get(code);
1296
+ if (gCommandOpts) {
1297
+ var tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
1298
+ if (tCommandMethod) {
1299
+ tCommandMethod.apply(void 0, [{
1300
+ code: code,
1301
+ button: button,
1302
+ $grid: null,
1303
+ $table: $xeTable,
1304
+ $gantt: $xeGantt
1305
+ }].concat(args));
1306
+ } else {
1307
+ (0, _log.errLog)('vxe.error.notCommands', [code]);
1308
+ }
1309
+ }
1310
+ }
1311
+ }
1312
+ return $xeGantt.$nextTick();
1313
+ },
1314
+ getParams: function getParams() {
1315
+ var $xeGantt = this;
1316
+ var props = $xeGantt;
1317
+ return props.params;
1318
+ },
1319
+ zoom: function zoom() {
1320
+ var $xeGantt = this;
1321
+ var reactData = $xeGantt.reactData;
1322
+ if (reactData.isZMax) {
1323
+ return $xeGantt.revert();
1324
+ }
1325
+ return $xeGantt.maximize();
1326
+ },
1327
+ isMaximized: function isMaximized() {
1328
+ var $xeGantt = this;
1329
+ var reactData = $xeGantt.reactData;
1330
+ return reactData.isZMax;
1331
+ },
1332
+ maximize: function maximize() {
1333
+ var $xeGantt = this;
1334
+ return $xeGantt.handleZoom(true);
1335
+ },
1336
+ revert: function revert() {
1337
+ var $xeGantt = this;
1338
+ return $xeGantt.handleZoom();
1339
+ },
1340
+ getFormData: function getFormData() {
1341
+ var $xeGantt = this;
1342
+ var props = $xeGantt;
1343
+ var reactData = $xeGantt.reactData;
1344
+ var proxyConfig = props.proxyConfig;
1345
+ var formData = reactData.formData;
1346
+ var proxyOpts = $xeGantt.computeProxyOpts;
1347
+ var formOpts = $xeGantt.computeFormOpts;
1348
+ return proxyConfig && (0, _utils.isEnableConf)(proxyOpts) && proxyOpts.form ? formData : formOpts.data;
1349
+ },
1350
+ getFormItems: function getFormItems(itemIndex) {
1351
+ var $xeGantt = this;
1352
+ var props = $xeGantt;
1353
+ var formOpts = $xeGantt.computeFormOpts;
1354
+ var formConfig = props.formConfig;
1355
+ var items = formOpts.items;
1356
+ var itemList = [];
1357
+ _xeUtils.default.eachTree(formConfig && (0, _utils.isEnableConf)(formOpts) && items ? items : [], function (item) {
1358
+ itemList.push(item);
1359
+ }, {
1360
+ children: 'children'
1361
+ });
1362
+ return _xeUtils.default.isUndefined(itemIndex) ? itemList : itemList[itemIndex];
1363
+ },
1364
+ resetForm: function resetForm() {
1365
+ var $xeGantt = this;
1366
+ var $form = $xeGantt.$refs.refForm;
1367
+ if ($form) {
1368
+ return $form.reset();
1369
+ }
1370
+ return $xeGantt.$nextTick();
1371
+ },
1372
+ validateForm: function validateForm() {
1373
+ var $xeGantt = this;
1374
+ var $form = $xeGantt.$refs.refForm;
1375
+ if ($form) {
1376
+ return $form.validate();
1377
+ }
1378
+ return $xeGantt.$nextTick();
1379
+ },
1380
+ validateFormField: function validateFormField(field) {
1381
+ var $xeGantt = this;
1382
+ var $form = $xeGantt.$refs.refForm;
1383
+ if ($form) {
1384
+ return $form.validateField(field);
1385
+ }
1386
+ return $xeGantt.$nextTick();
1387
+ },
1388
+ clearFormValidate: function clearFormValidate(field) {
1389
+ var $xeGantt = this;
1390
+ var $form = $xeGantt.$refs.refForm;
1391
+ if ($form) {
1392
+ return $form.clearValidate(field);
1393
+ }
1394
+ return $xeGantt.$nextTick();
1395
+ },
1396
+ homePage: function homePage() {
1397
+ var $xeGantt = this;
1398
+ var reactData = $xeGantt.reactData;
1399
+ var tablePage = reactData.tablePage;
1400
+ tablePage.currentPage = 1;
1401
+ return $xeGantt.$nextTick();
1402
+ },
1403
+ homePageByEvent: function homePageByEvent(evnt) {
1404
+ var $xeGantt = this;
1405
+ var $pager = $xeGantt.$refs.refPager;
1406
+ if ($pager) {
1407
+ $pager.homePageByEvent(evnt);
1408
+ }
1409
+ },
1410
+ endPage: function endPage() {
1411
+ var $xeGantt = this;
1412
+ var reactData = $xeGantt.reactData;
1413
+ var tablePage = reactData.tablePage;
1414
+ var pageCount = $xeGantt.computePageCount;
1415
+ tablePage.currentPage = pageCount;
1416
+ return $xeGantt.$nextTick();
1417
+ },
1418
+ endPageByEvent: function endPageByEvent(evnt) {
1419
+ var $xeGantt = this;
1420
+ var $pager = $xeGantt.$refs.refPager;
1421
+ if ($pager) {
1422
+ $pager.endPageByEvent(evnt);
1423
+ }
1424
+ },
1425
+ setCurrentPage: function setCurrentPage(currentPage) {
1426
+ var $xeGantt = this;
1427
+ var reactData = $xeGantt.reactData;
1428
+ var tablePage = reactData.tablePage;
1429
+ var pageCount = $xeGantt.computePageCount;
1430
+ tablePage.currentPage = Math.min(pageCount, Math.max(1, _xeUtils.default.toNumber(currentPage)));
1431
+ return $xeGantt.$nextTick();
1432
+ },
1433
+ setCurrentPageByEvent: function setCurrentPageByEvent(evnt, currentPage) {
1434
+ var $xeGantt = this;
1435
+ var $pager = $xeGantt.$refs.refPager;
1436
+ if ($pager) {
1437
+ $pager.setCurrentPageByEvent(evnt, currentPage);
1438
+ }
1439
+ },
1440
+ setPageSize: function setPageSize(pageSize) {
1441
+ var $xeGantt = this;
1442
+ var reactData = $xeGantt.reactData;
1443
+ var tablePage = reactData.tablePage;
1444
+ tablePage.pageSize = Math.max(1, _xeUtils.default.toNumber(pageSize));
1445
+ return $xeGantt.$nextTick();
1446
+ },
1447
+ setPageSizeByEvent: function setPageSizeByEvent(evnt, pageSize) {
1448
+ var $xeGantt = this;
1449
+ var $pager = $xeGantt.$refs.refPager;
1450
+ if ($pager) {
1451
+ $pager.setPageSizeByEvent(evnt, pageSize);
1452
+ }
1453
+ },
1454
+ getProxyInfo: function getProxyInfo() {
1455
+ var $xeGantt = this;
1456
+ var props = $xeGantt;
1457
+ var $xeTable = $xeGantt.$refs.refTable;
1458
+ var reactData = $xeGantt.reactData;
1459
+ if (props.proxyConfig) {
1460
+ var sortData = reactData.sortData;
1461
+ return {
1462
+ data: $xeTable ? $xeTable.getFullData() : [],
1463
+ filter: reactData.filterData,
1464
+ form: $xeGantt.getFormData(),
1465
+ sort: sortData.length ? sortData[0] : {},
1466
+ sorts: sortData,
1467
+ pager: reactData.tablePage,
1468
+ pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
1469
+ };
1470
+ }
1471
+ return null;
1472
+ },
1473
+ refreshTaskView: function refreshTaskView() {
1474
+ var $xeGantt = this;
1475
+ var $ganttView = $xeGantt.$refs.refGanttView;
1476
+ if ($ganttView) {
1477
+ return $ganttView.refreshData();
1478
+ }
1479
+ return $xeGantt.$nextTick();
1480
+ },
1481
+ callSlot: function callSlot(slotFunc, params, h, vNodes) {
1482
+ var $xeGantt = this;
1483
+ var slots = $xeGantt.$scopedSlots;
1484
+ if (slotFunc) {
1485
+ if (_xeUtils.default.isString(slotFunc)) {
1486
+ slotFunc = slots[slotFunc] || null;
1487
+ }
1488
+ if (_xeUtils.default.isFunction(slotFunc)) {
1489
+ return getSlotVNs(slotFunc.call(this, params, h, vNodes));
1490
+ }
1491
+ }
1492
+ return [];
1493
+ },
1494
+ /**
1495
+ * 获取需要排除的高度
1496
+ */
1497
+ getExcludeHeight: function getExcludeHeight() {
1498
+ var $xeGantt = this;
1499
+ var reactData = $xeGantt.reactData;
1500
+ var isZMax = reactData.isZMax;
1501
+ var el = $xeGantt.$refs.refElem;
1502
+ if (el) {
1503
+ var formWrapper = $xeGantt.$refs.refFormWrapper;
1504
+ var toolbarWrapper = $xeGantt.$refs.refToolbarWrapper;
1505
+ var topWrapper = $xeGantt.$refs.refTopWrapper;
1506
+ var bottomWrapper = $xeGantt.$refs.refBottomWrapper;
1507
+ var pagerWrapper = $xeGantt.$refs.refPagerWrapper;
1508
+ var parentEl = el.parentElement;
1509
+ var parentPaddingSize = isZMax ? 0 : parentEl ? (0, _dom.getPaddingTopBottomSize)(parentEl) : 0;
1510
+ return parentPaddingSize + (0, _dom.getPaddingTopBottomSize)(el) + (0, _dom.getOffsetHeight)(formWrapper) + (0, _dom.getOffsetHeight)(toolbarWrapper) + (0, _dom.getOffsetHeight)(topWrapper) + (0, _dom.getOffsetHeight)(bottomWrapper) + (0, _dom.getOffsetHeight)(pagerWrapper);
1511
+ }
1512
+ return 0;
1513
+ },
1514
+ getParentHeight: function getParentHeight() {
1515
+ var $xeGantt = this;
1516
+ var reactData = $xeGantt.reactData;
1517
+ var el = $xeGantt.$refs.refElem;
1518
+ if (el) {
1519
+ var parentEl = el.parentElement;
1520
+ return (reactData.isZMax ? (0, _dom.getDomNode)().visibleHeight : parentEl ? _xeUtils.default.toNumber(getComputedStyle(parentEl).height) : 0) - $xeGantt.getExcludeHeight();
1521
+ }
1522
+ return 0;
1523
+ },
1524
+ triggerToolbarCommitEvent: function triggerToolbarCommitEvent(params, evnt) {
1525
+ var $xeGantt = this;
1526
+ var code = params.code;
1527
+ return $xeGantt.commitProxy(params, evnt).then(function (rest) {
1528
+ if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
1529
+ $xeGantt.dispatchEvent(code === 'delete' || code === 'save' ? "proxy-".concat(code) : 'proxy-query', Object.assign(Object.assign({}, rest), {
1530
+ isReload: code === 'reload'
1531
+ }), evnt);
1532
+ }
1533
+ });
1534
+ },
1535
+ triggerToolbarBtnEvent: function triggerToolbarBtnEvent(button, evnt) {
1536
+ var $xeGantt = this;
1537
+ $xeGantt.triggerToolbarCommitEvent(button, evnt);
1538
+ $xeGantt.dispatchEvent('toolbar-button-click', {
1539
+ code: button.code,
1540
+ button: button
1541
+ }, evnt);
1542
+ },
1543
+ triggerToolbarTolEvent: function triggerToolbarTolEvent(tool, evnt) {
1544
+ var $xeGantt = this;
1545
+ $xeGantt.triggerToolbarCommitEvent(tool, evnt);
1546
+ $xeGantt.dispatchEvent('toolbar-tool-click', {
1547
+ code: tool.code,
1548
+ tool: tool
1549
+ }, evnt);
1550
+ },
1551
+ triggerZoomEvent: function triggerZoomEvent(evnt) {
1552
+ var $xeGantt = this;
1553
+ var reactData = $xeGantt.reactData;
1554
+ $xeGantt.zoom();
1555
+ $xeGantt.dispatchEvent('zoom', {
1556
+ type: reactData.isZMax ? 'max' : 'revert'
1557
+ }, evnt);
1558
+ },
1559
+ handleTaskCellClickEvent: function handleTaskCellClickEvent(evnt, params) {
1560
+ var $xeGantt = this;
1561
+ $xeGantt.dispatchEvent('task-cell-click', params, evnt);
1562
+ },
1563
+ handleTaskCellDblclickEvent: function handleTaskCellDblclickEvent(evnt, params) {
1564
+ var $xeGantt = this;
1565
+ $xeGantt.dispatchEvent('task-cell-dblclick', params, evnt);
1566
+ },
1567
+ handleTaskBarClickEvent: function handleTaskBarClickEvent(evnt, params) {
1568
+ var $xeGantt = this;
1569
+ $xeGantt.dispatchEvent('task-bar-click', params, evnt);
1570
+ },
1571
+ handleTaskBarDblclickEvent: function handleTaskBarDblclickEvent(evnt, params) {
1572
+ var $xeGantt = this;
1573
+ $xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
1574
+ },
1575
+ loadColumn: function loadColumn(columns) {
1576
+ var $xeGantt = this;
1577
+ var slots = $xeGantt.$scopedSlots;
1578
+ var $xeTable = $xeGantt.$refs.refTable;
1579
+ _xeUtils.default.eachTree(columns, function (column) {
1580
+ if (column.slots) {
1581
+ _xeUtils.default.each(column.slots, function (func) {
1582
+ if (!_xeUtils.default.isFunction(func)) {
1583
+ if (!slots[func]) {
1584
+ (0, _log.errLog)('vxe.error.notSlot', [func]);
1585
+ }
1586
+ }
1587
+ });
1588
+ }
1589
+ });
1590
+ return $xeTable.loadColumn(columns);
1591
+ },
1592
+ reloadColumn: function reloadColumn(columns) {
1593
+ var $xeGantt = this;
1594
+ $xeGantt.clearAll();
1595
+ return $xeGantt.loadColumn(columns);
1596
+ },
1597
+ getConfigSlot: function getConfigSlot(slotConfigs) {
1598
+ var $xeGantt = this;
1599
+ var slots = $xeGantt.$scopedSlots;
1600
+ var slotConf = {};
1601
+ _xeUtils.default.objectMap(slotConfigs, function (slotFunc, slotKey) {
1602
+ if (slotFunc) {
1603
+ if (_xeUtils.default.isString(slotFunc)) {
1604
+ if (slots[slotFunc]) {
1605
+ slotConf[slotKey] = slots[slotFunc];
1606
+ } else {
1607
+ (0, _log.errLog)('vxe.error.notSlot', [slotFunc]);
1608
+ }
1609
+ } else {
1610
+ slotConf[slotKey] = slotFunc;
1611
+ }
1612
+ }
1613
+ });
1614
+ return slotConf;
1615
+ },
1616
+ getToolbarSlots: function getToolbarSlots() {
1617
+ var $xeGantt = this;
1618
+ var slots = $xeGantt.$scopedSlots;
1619
+ var toolbarOpts = $xeGantt.computeToolbarOpts;
1620
+ var toolbarOptSlots = toolbarOpts.slots;
1621
+ var toolbarSlots = {};
1622
+ if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
1623
+ (0, _log.warnLog)('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
1624
+ }
1625
+ if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
1626
+ (0, _log.warnLog)('vxe.error.reqProp', ['toolbar-config.slots.tools']);
1627
+ }
1628
+ if (toolbarOptSlots) {
1629
+ var buttonsSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttons');
1630
+ var buttonPrefixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttonPrefix');
1631
+ var buttonSuffixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttonSuffix');
1632
+ var toolsSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'tools');
1633
+ var toolPrefixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'toolPrefix');
1634
+ var toolSuffixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'toolSuffix');
1635
+ if (buttonsSlot) {
1636
+ toolbarSlots.buttons = buttonsSlot;
1637
+ }
1638
+ if (buttonPrefixSlot) {
1639
+ toolbarSlots.buttonPrefix = buttonPrefixSlot;
1640
+ }
1641
+ if (buttonSuffixSlot) {
1642
+ toolbarSlots.buttonSuffix = buttonSuffixSlot;
1643
+ }
1644
+ if (toolsSlot) {
1645
+ toolbarSlots.tools = toolsSlot;
1646
+ }
1647
+ if (toolPrefixSlot) {
1648
+ toolbarSlots.toolPrefix = toolPrefixSlot;
1649
+ }
1650
+ if (toolSuffixSlot) {
1651
+ toolbarSlots.toolSuffix = toolSuffixSlot;
1652
+ }
1653
+ }
1654
+ return toolbarSlots;
1655
+ },
1656
+ getFuncSlot: function getFuncSlot(optSlots, slotKey) {
1657
+ var $xeGantt = this;
1658
+ var slots = $xeGantt.$scopedSlots;
1659
+ var funcSlot = optSlots[slotKey];
1660
+ if (funcSlot) {
1661
+ if (_xeUtils.default.isString(funcSlot)) {
1662
+ if (slots[funcSlot]) {
1663
+ return slots[funcSlot];
1664
+ } else {
1665
+ (0, _log.errLog)('vxe.error.notSlot', [funcSlot]);
1666
+ }
1667
+ } else {
1668
+ return funcSlot;
1669
+ }
1670
+ }
1671
+ return null;
1672
+ },
1673
+ //
1674
+ // Render
1675
+ //
1676
+ renderDefaultForm: function renderDefaultForm(h) {
1677
+ var VxeUIFormComponent = _core.VxeUI.getComponent('VxeForm');
1678
+ var $xeGantt = this;
1679
+ var props = $xeGantt;
1680
+ var slots = $xeGantt.$scopedSlots;
1681
+ var reactData = $xeGantt.reactData;
1682
+ var proxyConfig = props.proxyConfig,
1683
+ formConfig = props.formConfig;
1684
+ var formData = reactData.formData;
1685
+ var proxyOpts = $xeGantt.computeProxyOpts;
1686
+ var formOpts = $xeGantt.computeFormOpts;
1687
+ if ((0, _utils.isEnableConf)(formConfig) && formOpts.items && formOpts.items.length) {
1688
+ var formSlots = {};
1689
+ if (!formOpts.inited) {
1690
+ formOpts.inited = true;
1691
+ var beforeItem = proxyOpts.beforeItem;
1692
+ if (proxyOpts && beforeItem) {
1693
+ formOpts.items.forEach(function (item) {
1694
+ beforeItem.call($xeGantt, {
1695
+ $grid: $xeGantt,
1696
+ $gantt: null,
1697
+ item: item
1698
+ });
1699
+ });
1700
+ }
1701
+ }
1702
+ // 处理插槽
1703
+ formOpts.items.forEach(function (item) {
1704
+ _xeUtils.default.each(item.slots, function (func) {
1705
+ if (!_xeUtils.default.isFunction(func)) {
1706
+ if (slots[func]) {
1707
+ formSlots[func] = slots[func];
1708
+ }
1709
+ }
1710
+ });
1711
+ });
1712
+ return [VxeUIFormComponent ? h(VxeUIFormComponent, {
1713
+ props: Object.assign({}, formOpts, {
1714
+ data: proxyConfig && proxyOpts.form ? formData : formOpts.data
1715
+ }),
1716
+ on: {
1717
+ submit: $xeGantt.submitFormEvent,
1718
+ reset: $xeGantt.resetFormEvent,
1719
+ collapse: $xeGantt.collapseEvent,
1720
+ 'submit-invalid': $xeGantt.submitInvalidEvent
1721
+ },
1722
+ scopedSlots: formSlots
1723
+ }) : renderEmptyElement($xeGantt)];
1724
+ }
1725
+ return [];
1726
+ },
1727
+ renderForm: function renderForm(h) {
1728
+ var $xeGantt = this;
1729
+ var props = $xeGantt;
1730
+ var slots = $xeGantt.$scopedSlots;
1731
+ var formConfig = props.formConfig;
1732
+ var formSlot = slots.form;
1733
+ var hasForm = !!(formSlot || (0, _utils.isEnableConf)(formConfig));
1734
+ if (hasForm) {
1735
+ return h('div', {
1736
+ key: 'form',
1737
+ ref: 'refFormWrapper',
1738
+ class: 'vxe-gantt--form-wrapper'
1739
+ }, formSlot ? formSlot.call($xeGantt, {
1740
+ $grid: null,
1741
+ $gantt: $xeGantt
1742
+ }) : $xeGantt.renderDefaultForm(h));
1743
+ }
1744
+ return renderEmptyElement($xeGantt);
1745
+ },
1746
+ renderToolbar: function renderToolbar(h) {
1747
+ var VxeUIToolbarComponent = _core.VxeUI.getComponent('VxeToolbar');
1748
+ var $xeGantt = this;
1749
+ var props = $xeGantt;
1750
+ var slots = $xeGantt.$scopedSlots;
1751
+ var toolbarConfig = props.toolbarConfig;
1752
+ var toolbarSlot = slots.toolbar;
1753
+ var hasToolbar = !!(toolbarSlot || (0, _utils.isEnableConf)(toolbarConfig) || toolbar);
1754
+ var toolbarOpts = $xeGantt.computeToolbarOpts;
1755
+ if (hasToolbar) {
1756
+ return h('div', {
1757
+ key: 'toolbar',
1758
+ ref: 'refToolbarWrapper',
1759
+ class: 'vxe-gantt--toolbar-wrapper'
1760
+ }, toolbarSlot ? toolbarSlot.call($xeGantt, {
1761
+ $grid: null,
1762
+ $gantt: $xeGantt
1763
+ }) : [h(VxeUIToolbarComponent, {
1764
+ props: Object.assign({}, toolbarOpts, {
1765
+ slots: undefined
1766
+ }),
1767
+ ref: 'refToolbar',
1768
+ scopedSlots: $xeGantt.getToolbarSlots()
1769
+ })]);
1770
+ }
1771
+ return renderEmptyElement($xeGantt);
1772
+ },
1773
+ renderTop: function renderTop(h) {
1774
+ var $xeGantt = this;
1775
+ var slots = $xeGantt.$scopedSlots;
1776
+ var topSlot = slots.top;
1777
+ return topSlot ? h('div', {
1778
+ key: 'top',
1779
+ ref: 'refTopWrapper',
1780
+ class: 'vxe-gantt--top-wrapper'
1781
+ }, topSlot.call($xeGantt, {
1782
+ $grid: null,
1783
+ $gantt: $xeGantt
1784
+ })) : renderEmptyElement($xeGantt);
1785
+ },
1786
+ renderTableLeft: function renderTableLeft(h) {
1787
+ var $xeGantt = this;
1788
+ var slots = $xeGantt.$scopedSlots;
1789
+ var leftSlot = slots.left;
1790
+ if (leftSlot) {
1791
+ return h('div', {
1792
+ class: 'vxe-gantt--left-wrapper'
1793
+ }, leftSlot({
1794
+ $grid: null,
1795
+ $gantt: $xeGantt
1796
+ }));
1797
+ }
1798
+ return renderEmptyElement($xeGantt);
1799
+ },
1800
+ renderTableRight: function renderTableRight(h) {
1801
+ var $xeGantt = this;
1802
+ var slots = $xeGantt.$scopedSlots;
1803
+ var rightSlot = slots.right;
1804
+ if (rightSlot) {
1805
+ return h('div', {
1806
+ class: 'vxe-gantt--right-wrapper'
1807
+ }, rightSlot({
1808
+ $grid: null,
1809
+ $gantt: $xeGantt
1810
+ }));
1811
+ }
1812
+ return renderEmptyElement($xeGantt);
1813
+ },
1814
+ renderTable: function renderTable(h) {
1815
+ var $xeGantt = this;
1816
+ var slots = $xeGantt.$scopedSlots;
1817
+ var tableProps = $xeGantt.computeTableProps;
1818
+ return h('div', {
1819
+ class: 'vxe-gantt--table-wrapper'
1820
+ }, [h(_vxeTable.VxeTable, {
1821
+ key: 'table',
1822
+ props: tableProps,
1823
+ on: getTableOns($xeGantt),
1824
+ scopedSlots: slots,
1825
+ ref: 'refTable'
1826
+ })]);
1827
+ },
1828
+ renderBottom: function renderBottom(h) {
1829
+ var $xeGantt = this;
1830
+ var slots = $xeGantt.$scopedSlots;
1831
+ var bottomSlot = slots.bottom;
1832
+ return bottomSlot ? h('div', {
1833
+ key: 'bottom',
1834
+ ref: 'refBottomWrapper',
1835
+ class: 'vxe-gantt--bottom-wrapper'
1836
+ }, bottomSlot.call($xeGantt, {
1837
+ $grid: null,
1838
+ $gantt: $xeGantt
1839
+ })) : renderEmptyElement($xeGantt);
1840
+ },
1841
+ renderPager: function renderPager(h) {
1842
+ var VxeUIPagerComponent = _core.VxeUI.getComponent('VxePager');
1843
+ var $xeGantt = this;
1844
+ var props = $xeGantt;
1845
+ var slots = $xeGantt.$scopedSlots;
1846
+ var reactData = $xeGantt.reactData;
1847
+ var proxyConfig = props.proxyConfig,
1848
+ pagerConfig = props.pagerConfig;
1849
+ var proxyOpts = $xeGantt.computeProxyOpts;
1850
+ var pagerOpts = $xeGantt.computePagerOpts;
1851
+ var pagerSlot = slots.pager;
1852
+ if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts) || slots.pager) {
1853
+ return h('div', {
1854
+ ref: 'refPagerWrapper',
1855
+ key: 'pager',
1856
+ class: 'vxe-gantt--pager-wrapper'
1857
+ }, pagerSlot ? pagerSlot.call($xeGantt, {
1858
+ $grid: null,
1859
+ $gantt: $xeGantt
1860
+ }) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
1861
+ ref: 'refPager',
1862
+ props: Object.assign(Object.assign({}, pagerOpts), proxyConfig && (0, _utils.isEnableConf)(proxyOpts) ? reactData.tablePage : {}),
1863
+ on: {
1864
+ 'page-change': $xeGantt.pageChangeEvent
1865
+ },
1866
+ scopedSlots: $xeGantt.getConfigSlot(pagerOpts.slots)
1867
+ }) : renderEmptyElement($xeGantt)]);
1868
+ }
1869
+ return renderEmptyElement($xeGantt);
1870
+ },
1871
+ /**
1872
+ * 渲染任务视图
1873
+ */
1874
+ renderTaskView: function renderTaskView(h) {
1875
+ return h('div', {
1876
+ ref: 'refGanttWrapper',
1877
+ class: 'vxe-gantt--view-wrapper'
1878
+ }, [h(_ganttView.default, {
1879
+ ref: 'refGanttView'
1880
+ })]);
1881
+ },
1882
+ renderSplitBar: function renderSplitBar(h) {
1883
+ var $xeGantt = this;
1884
+ var reactData = $xeGantt.reactData;
1885
+ var showLeftView = reactData.showLeftView,
1886
+ showRightView = reactData.showRightView;
1887
+ var taskSplitOpts = $xeGantt.computeTaskSplitOpts;
1888
+ var enabled = taskSplitOpts.enabled,
1889
+ resize = taskSplitOpts.resize,
1890
+ showCollapseTableButton = taskSplitOpts.showCollapseTableButton,
1891
+ showCollapseTaskButton = taskSplitOpts.showCollapseTaskButton;
1892
+ if (!enabled) {
1893
+ return renderEmptyElement($xeGantt);
1894
+ }
1895
+ var ons = {};
1896
+ if (resize) {
1897
+ ons.mousedown = $xeGantt.dragSplitEvent;
1898
+ }
1899
+ return h('div', {
1900
+ class: ['vxe-gantt--view-split-bar', {
1901
+ 'is--resize': resize,
1902
+ on: ons
1903
+ }]
1904
+ }, [h('div', {
1905
+ class: 'vxe-gantt--view-split-bar-handle'
1906
+ }), showCollapseTableButton || showCollapseTaskButton ? h('div', {
1907
+ class: 'vxe-gantt--view-split-bar-btn-wrapper'
1908
+ }, [showCollapseTableButton && showRightView ? h('div', {
1909
+ class: 'vxe-gantt--view-split-bar-left-btn',
1910
+ on: {
1911
+ click: $xeGantt.handleSplitLeftViewEvent
1912
+ }
1913
+ }, [h('i', {
1914
+ class: showLeftView ? getIcon().GANTT_VIEW_LEFT_OPEN : getIcon().GANTT_VIEW_LEFT_CLOSE
1915
+ })]) : renderEmptyElement($xeGantt), showCollapseTaskButton && showLeftView ? h('div', {
1916
+ class: 'vxe-gantt--view-split-bar-right-btn',
1917
+ on: {
1918
+ click: $xeGantt.handleSplitRightViewEvent
1919
+ }
1920
+ }, [h('i', {
1921
+ class: showRightView ? getIcon().GANTT_VIEW_RIGHT_OPEN : getIcon().GANTT_VIEW_RIGHT_CLOSE
1922
+ })]) : renderEmptyElement($xeGantt)]) : renderEmptyElement($xeGantt)]);
1923
+ },
1924
+ renderChildLayout: function renderChildLayout(h, layoutKeys) {
1925
+ var $xeGantt = this;
1926
+ var childVNs = [];
1927
+ layoutKeys.forEach(function (key) {
1928
+ switch (key) {
1929
+ case 'Form':
1930
+ childVNs.push($xeGantt.renderForm(h));
1931
+ break;
1932
+ case 'Toolbar':
1933
+ childVNs.push($xeGantt.renderToolbar(h));
1934
+ break;
1935
+ case 'Top':
1936
+ childVNs.push($xeGantt.renderTop(h));
1937
+ break;
1938
+ case 'Gantt':
1939
+ childVNs.push(h('div', {
1940
+ ref: 'refGanttContainer',
1941
+ key: 'tv',
1942
+ class: 'vxe-gantt--gantt-container'
1943
+ }, [$xeGantt.renderTableLeft(h), $xeGantt.renderTable(h), $xeGantt.renderSplitBar(h), $xeGantt.renderTaskView(h), $xeGantt.renderTableRight(h), h('div', {
1944
+ ref: 'refResizableSplitTip',
1945
+ class: 'vxe-gantt--resizable-split-tip'
1946
+ }, [h('div', {
1947
+ class: 'vxe-gantt--resizable-split-tip-number'
1948
+ }, [h('div', {
1949
+ class: 'vxe-gantt--resizable-split-number-left'
1950
+ }, '10px'), h('div', {
1951
+ class: 'vxe-gantt--resizable-split-number-right'
1952
+ }, '20px')])])]));
1953
+ break;
1954
+ case 'Bottom':
1955
+ childVNs.push($xeGantt.renderBottom(h));
1956
+ break;
1957
+ case 'Pager':
1958
+ childVNs.push($xeGantt.renderPager(h));
1959
+ break;
1960
+ default:
1961
+ (0, _log.errLog)('vxe.error.notProp', ["layouts -> ".concat(key)]);
1962
+ break;
1963
+ }
1964
+ });
1965
+ return childVNs;
1966
+ },
1967
+ renderLayout: function renderLayout(h) {
1968
+ var $xeGantt = this;
1969
+ var slots = $xeGantt.$scopedSlots;
1970
+ var currLayoutConf = $xeGantt.computeCurrLayoutConf;
1971
+ var headKeys = currLayoutConf.headKeys,
1972
+ bodyKeys = currLayoutConf.bodyKeys,
1973
+ footKeys = currLayoutConf.footKeys;
1974
+ var asideLeftSlot = slots.asideLeft || slots['aside-left'];
1975
+ var asideRightSlot = slots.asideRight || slots['aside-right'];
1976
+ return [h('div', {
1977
+ class: 'vxe-gantt--layout-header-wrapper'
1978
+ }, $xeGantt.renderChildLayout(h, headKeys)), h('div', {
1979
+ class: 'vxe-gantt--layout-body-wrapper'
1980
+ }, [asideLeftSlot ? h('div', {
1981
+ class: 'vxe-gantt--layout-aside-left-wrapper'
1982
+ }, asideLeftSlot({})) : renderEmptyElement($xeGantt), h('div', {
1983
+ class: 'vxe-gantt--layout-body-content-wrapper'
1984
+ }, $xeGantt.renderChildLayout(h, bodyKeys)), asideRightSlot ? h('div', {
1985
+ class: 'vxe-gantt--layout-aside-right-wrapper'
1986
+ }, asideRightSlot({})) : renderEmptyElement($xeGantt)]), h('div', {
1987
+ class: 'vxe-gantt--layout-footer-wrapper'
1988
+ }, $xeGantt.renderChildLayout(h, footKeys)), h('div', {
1989
+ class: 'vxe-gantt--border-line'
1990
+ })];
1991
+ },
1992
+ renderVN: function renderVN(h) {
1993
+ var $xeGantt = this;
1994
+ var props = $xeGantt;
1995
+ var reactData = $xeGantt.reactData;
1996
+ var showLeftView = reactData.showLeftView,
1997
+ showRightView = reactData.showRightView;
1998
+ var vSize = $xeGantt.computeSize;
1999
+ var styles = $xeGantt.computeStyles;
2000
+ var isLoading = $xeGantt.computeIsLoading;
2001
+ var tableBorder = $xeGantt.computeTableBorder;
2002
+ var scrollbarXToTop = $xeGantt.computeScrollbarXToTop;
2003
+ var scrollbarYToLeft = $xeGantt.computeScrollbarYToLeft;
2004
+ return h('div', {
2005
+ ref: 'refElem',
2006
+ class: ['vxe-gantt', "border--".concat(tableBorder), "sx-pos--".concat(scrollbarXToTop ? 'top' : 'bottom'), "sy-pos--".concat(scrollbarYToLeft ? 'left' : 'right'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'is--round', props.round), 'is--maximize', reactData.isZMax), 'is--loading', isLoading), 'show--left', showLeftView), 'show--right', showRightView)],
2007
+ style: styles
2008
+ }, $xeGantt.renderLayout(h));
2009
+ }
2010
+ }),
2011
+ created: function created() {
2012
+ // 使用已安装的组件,如果未安装则不渲染
2013
+ var VxeUIFormComponent = _core.VxeUI.getComponent('VxeForm');
2014
+ var VxeUIPagerComponent = _core.VxeUI.getComponent('VxePager');
2015
+ var VxeUIToolbarComponent = _core.VxeUI.getComponent('VxeToolbar');
2016
+ var $xeGantt = this;
2017
+ var props = $xeGantt;
2018
+ var proxyOpts = $xeGantt.computeProxyOpts;
2019
+ if (props.toolbar) {
2020
+ (0, _log.errLog)('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
2021
+ }
2022
+ if (props.toolbarConfig && !_xeUtils.default.isObject(props.toolbarConfig)) {
2023
+ (0, _log.errLog)('vxe.error.errProp', ["grid.toolbar-config=".concat(props.toolbarConfig), 'grid.toolbar-config={}']);
2024
+ }
2025
+ if (proxyOpts.props) {
2026
+ (0, _log.warnLog)('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response']);
2027
+ }
2028
+ $xeGantt.$nextTick(function () {
2029
+ if (props.formConfig) {
2030
+ if (!VxeUIFormComponent) {
2031
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-form']);
2032
+ }
2033
+ }
2034
+ if (props.pagerConfig) {
2035
+ if (!VxeUIPagerComponent) {
2036
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-pager']);
2037
+ }
2038
+ }
2039
+ if (props.toolbarConfig) {
2040
+ if (!VxeUIToolbarComponent) {
2041
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-toolbar']);
2042
+ }
2043
+ }
65
2044
  });
66
- $xeGantt.renderVN = renderVN;
67
- return $xeGantt;
2045
+ $xeGantt.initPages();
68
2046
  },
69
- render() {
70
- return this.renderVN();
2047
+ mounted: function mounted() {
2048
+ var $xeGantt = this;
2049
+ var props = $xeGantt;
2050
+ var columns = props.columns;
2051
+ if (columns && columns.length) {
2052
+ $xeGantt.loadColumn(columns);
2053
+ }
2054
+ $xeGantt.initToolbar();
2055
+ $xeGantt.initProxy();
2056
+ $xeGantt.initGanttView();
2057
+ globalEvents.on($xeGantt, 'keydown', $xeGantt.handleGlobalKeydownEvent);
2058
+ },
2059
+ destroyed: function destroyed() {
2060
+ var $xeGantt = this;
2061
+ var internalData = $xeGantt.internalData;
2062
+ globalEvents.off($xeGantt, 'keydown');
2063
+ _xeUtils.default.assign(internalData, createInternalData());
2064
+ },
2065
+ render: function render(h) {
2066
+ return this.renderVN(h);
71
2067
  }
72
- });
2068
+ });
2069
+ /* define-vxe-component end */