@opentiny/vue-renderless 3.1.0-alpha.0 → 3.4.7

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 (177) hide show
  1. package/action-menu/index.js +10 -0
  2. package/action-menu/vue.js +26 -0
  3. package/amount/index.js +334 -0
  4. package/amount/vue.js +206 -0
  5. package/area/index.js +162 -0
  6. package/area/vue.js +68 -0
  7. package/autonavi-map/index.js +28 -0
  8. package/avatar/index.js +5 -1
  9. package/avatar/vue.js +2 -1
  10. package/baidu-map/index.js +28 -0
  11. package/breadcrumb/index.js +9 -0
  12. package/breadcrumb/vue.js +25 -3
  13. package/breadcrumb-item/index.js +26 -0
  14. package/breadcrumb-item/vue.js +20 -11
  15. package/bulletin-board/index.js +4 -1
  16. package/button-group/vue.js +1 -1
  17. package/calendar/index.js +14 -14
  18. package/card-template/index.js +1 -1
  19. package/cascader/index.js +21 -7
  20. package/cascader/vue.js +1 -2
  21. package/cascader-node/index.js +3 -1
  22. package/cascader-panel/index.js +12 -4
  23. package/cascader-panel/vue.js +1 -2
  24. package/chart-bar/index.js +533 -0
  25. package/chart-boxplot/index.js +270 -0
  26. package/chart-candle/index.js +428 -0
  27. package/chart-core/deps/constants.js +65 -0
  28. package/chart-core/deps/numerify.js +286 -0
  29. package/chart-core/deps/utils.js +205 -0
  30. package/chart-core/index.js +541 -0
  31. package/chart-core/modules/animation.js +10 -0
  32. package/chart-core/modules/extend.js +36 -0
  33. package/chart-core/modules/mark.js +7 -0
  34. package/chart-core/vue.js +128 -0
  35. package/chart-funnel/index.js +155 -0
  36. package/chart-gauge/index.js +153 -0
  37. package/chart-graph/index.js +38 -0
  38. package/chart-heatmap/index.js +407 -0
  39. package/chart-line/index.js +358 -0
  40. package/chart-liquidfill/index.js +119 -0
  41. package/chart-map/index.js +261 -0
  42. package/chart-pie/index.js +327 -0
  43. package/chart-radar/index.js +181 -0
  44. package/chart-sankey/index.js +166 -0
  45. package/chart-scatter/index.js +360 -0
  46. package/chart-sunburst/index.js +36 -0
  47. package/chart-tree/index.js +107 -0
  48. package/chart-waterfall/index.js +231 -0
  49. package/chart-wordcloud/index.js +109 -0
  50. package/checkbox/index.js +4 -4
  51. package/checkbox-button/index.js +3 -1
  52. package/common/bigInt.js +5 -2
  53. package/common/date.js +17 -17
  54. package/common/deps/date-util.js +15 -5
  55. package/common/deps/date.js +6 -6
  56. package/common/deps/dom.js +18 -6
  57. package/common/deps/eSpaceCtrl.js +286 -0
  58. package/common/deps/fullscreen/apis.js +22 -22
  59. package/common/deps/memorize.js +3 -3
  60. package/common/deps/modal-queue.js +2 -0
  61. package/common/deps/popper.js +12 -10
  62. package/common/deps/popup-manager.js +16 -5
  63. package/common/deps/resize-event.js +6 -2
  64. package/common/deps/scrollbar-width.js +6 -2
  65. package/common/deps/tree-model/node.js +30 -10
  66. package/common/deps/tree-model/tree-store.js +33 -21
  67. package/common/deps/tree-model/util.js +6 -2
  68. package/common/deps/upload-ajax.js +7 -1
  69. package/common/deps/vue-popper.js +2 -2
  70. package/common/string.js +1 -1
  71. package/company/index.js +56 -0
  72. package/company/vue.js +35 -0
  73. package/country/index.js +54 -0
  74. package/country/vue.js +35 -0
  75. package/credit-card-form/index.js +1 -0
  76. package/currency/index.js +78 -0
  77. package/currency/vue.js +39 -0
  78. package/date-panel/index.js +16 -6
  79. package/date-picker/index.js +9 -5
  80. package/date-range/index.js +28 -9
  81. package/date-table/index.js +3 -1
  82. package/dept/index.js +318 -0
  83. package/dept/vue.js +163 -0
  84. package/detail-page/index.js +4 -1
  85. package/dialog-box/index.js +14 -4
  86. package/dialog-box/vue.js +7 -3
  87. package/drop-roles/index.js +73 -0
  88. package/drop-roles/vue.js +38 -0
  89. package/dropdown/index.js +5 -4
  90. package/dropdown/vue.js +5 -3
  91. package/dropdown-item/index.js +15 -0
  92. package/dropdown-item/vue.js +27 -13
  93. package/espace/index.js +129 -0
  94. package/espace/vue.js +52 -0
  95. package/file-upload/index.js +336 -291
  96. package/form/index.js +3 -1
  97. package/form/vue.js +15 -0
  98. package/form-item/index.js +15 -5
  99. package/fullscreen/index.js +4 -4
  100. package/fullscreen/vue.js +3 -3
  101. package/grid/core/interceptor.js +4 -7
  102. package/grid/plugins/export.js +2 -2
  103. package/grid/plugins/exportExcel.js +28 -10
  104. package/grid/static/array/findTree.js +1 -1
  105. package/grid/static/base/helperCreateGetObjects.js +1 -1
  106. package/grid/static/base/helperEqualCompare.js +2 -2
  107. package/grid/static/base/helperGetHGSKeys.js +1 -1
  108. package/grid/static/base/uniqueId.js +1 -1
  109. package/grid/static/object/assign.js +3 -3
  110. package/grid/static/string/toString.js +3 -3
  111. package/hrapprover/index.js +118 -0
  112. package/hrapprover/vue.js +102 -0
  113. package/locales/index.js +116 -0
  114. package/locales/vue.js +46 -0
  115. package/logon-user/index.js +23 -0
  116. package/logon-user/vue.js +22 -0
  117. package/logout/index.js +118 -0
  118. package/logout/vue.js +22 -0
  119. package/milestone/index.js +2 -1
  120. package/mini-picker/index.js +1 -1
  121. package/mini-picker/vue.js +1 -1
  122. package/modal/index.js +4 -2
  123. package/month-table/index.js +2 -2
  124. package/nav-menu/index.js +2 -2
  125. package/numeric/index.js +4 -2
  126. package/package.json +33 -136
  127. package/pager-item/vue.js +6 -2
  128. package/picker/index.js +43 -17
  129. package/picker/timezone.js +2 -2
  130. package/picker-column/index.js +7 -3
  131. package/pop-upload/index.js +5 -3
  132. package/popeditor/index.js +15 -7
  133. package/popover/index.js +87 -54
  134. package/popover/vue.js +13 -9
  135. package/rate/index.js +2 -2
  136. package/rich-text/clipboard.js +77 -0
  137. package/rich-text/index.js +176 -0
  138. package/rich-text/module/file-upload.js +118 -0
  139. package/rich-text/module/image-drop.js +54 -0
  140. package/rich-text/module/image-upload.js +84 -0
  141. package/rich-text/options.js +187 -0
  142. package/rich-text/table-module.js +557 -0
  143. package/rich-text/vue.js +149 -0
  144. package/roles/index.js +87 -0
  145. package/roles/vue.js +39 -0
  146. package/search/index.js +32 -27
  147. package/search/vue.js +7 -2
  148. package/select/index.js +328 -304
  149. package/select/vue.js +19 -9
  150. package/select-dropdown/index.js +1 -1
  151. package/slider/index.js +9 -11
  152. package/slider/vue.js +3 -3
  153. package/split/vue.js +1 -1
  154. package/tab-nav/index.js +0 -6
  155. package/tab-nav/vue.js +0 -14
  156. package/table/index.js +1 -1
  157. package/text-popup/index.js +6 -4
  158. package/time/index.js +3 -1
  159. package/time-range/index.js +6 -2
  160. package/time-spinner/index.js +15 -5
  161. package/toggle-menu/index.js +11 -0
  162. package/toggle-menu/vue.js +2 -1
  163. package/tooltip/index.js +46 -35
  164. package/tooltip/vue.js +5 -1
  165. package/tree/index.js +57 -21
  166. package/tree-menu/index.js +3 -1
  167. package/tree-node/index.js +7 -3
  168. package/upload/index.js +14 -5
  169. package/user/index.js +634 -0
  170. package/user/vue.js +113 -0
  171. package/user-account/index.js +23 -0
  172. package/user-account/vue.js +25 -0
  173. package/user-contact/index.js +1 -4
  174. package/user-head/index.js +9 -11
  175. package/user-head/vue.js +2 -6
  176. package/user-link/index.js +43 -0
  177. package/user-link/vue.js +60 -0
@@ -111,7 +111,7 @@ export var onChange = function onChange(_ref5) {
111
111
  };
112
112
  export var padZero = function padZero(num) {
113
113
  var targetLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
114
- var str = num + '';
114
+ var str = String(num);
115
115
  while (str.length < targetLength) {
116
116
  str = '0' + str;
117
117
  }
@@ -178,8 +178,12 @@ export var getRanges = function getRanges(_ref7) {
178
178
  type: constants.Minute,
179
179
  range: [minMinute, maxMinute]
180
180
  }];
181
- if (props.type === constants.Date) result.splice(3, 2);
182
- if (props.type === constants.YearMonth) result.splice(2, 3);
181
+ if (props.type === constants.Date) {
182
+ result.splice(3, 2);
183
+ }
184
+ if (props.type === constants.YearMonth) {
185
+ result.splice(2, 3);
186
+ }
183
187
  return result;
184
188
  };
185
189
  };
@@ -261,11 +265,11 @@ export var getDisplayValue = function getDisplayValue(_ref12) {
261
265
  'S': value.getMilliseconds()
262
266
  };
263
267
  if (/(y+)/.test(fmt)) {
264
- fmt = fmt.replace(RegExp.$1, (value.getFullYear() + '').substr(4 - RegExp.$1.length));
268
+ fmt = fmt.replace(RegExp.$1, String(value.getFullYear()).substr(4 - RegExp.$1.length));
265
269
  }
266
270
  for (var k in o) {
267
271
  if (new RegExp('(' + k + ')').test(fmt)) {
268
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
272
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(String(o[k]).length));
269
273
  }
270
274
  }
271
275
  return fmt;
@@ -12,8 +12,12 @@ export var getMinVisibleDate = function getMinVisibleDate(_ref) {
12
12
  var state = _ref.state,
13
13
  t = _ref.t;
14
14
  return function () {
15
- if (state.dateUserInput.min !== null) return state.dateUserInput.min;
16
- if (state.minDate) return formatDate(state.minDate, state.dateFormat, t);
15
+ if (state.dateUserInput.min !== null) {
16
+ return state.dateUserInput.min;
17
+ }
18
+ if (state.minDate) {
19
+ return formatDate(state.minDate, state.dateFormat, t);
20
+ }
17
21
  return '';
18
22
  };
19
23
  };
@@ -21,7 +25,9 @@ export var getMaxVisibleDate = function getMaxVisibleDate(_ref2) {
21
25
  var state = _ref2.state,
22
26
  t = _ref2.t;
23
27
  return function () {
24
- if (state.dateUserInput.max !== null) return state.dateUserInput.max;
28
+ if (state.dateUserInput.max !== null) {
29
+ return state.dateUserInput.max;
30
+ }
25
31
  if (state.maxDate || state.minDate) {
26
32
  return formatDate(state.maxDate || state.minDate, state.dateFormat, t);
27
33
  }
@@ -32,8 +38,12 @@ export var getMinVisibleTime = function getMinVisibleTime(_ref3) {
32
38
  var state = _ref3.state,
33
39
  t = _ref3.t;
34
40
  return function () {
35
- if (state.timeUserInput.min !== null) return state.timeUserInput.min;
36
- if (state.minDate) return formatDate(state.minDate, state.timeFormat, t);
41
+ if (state.timeUserInput.min !== null) {
42
+ return state.timeUserInput.min;
43
+ }
44
+ if (state.minDate) {
45
+ return formatDate(state.minDate, state.timeFormat, t);
46
+ }
37
47
  return '';
38
48
  };
39
49
  };
@@ -41,7 +51,9 @@ export var getMaxVisibleTime = function getMaxVisibleTime(_ref4) {
41
51
  var state = _ref4.state,
42
52
  t = _ref4.t;
43
53
  return function () {
44
- if (state.timeUserInput.max !== null) return state.timeUserInput.max;
54
+ if (state.timeUserInput.max !== null) {
55
+ return state.timeUserInput.max;
56
+ }
45
57
  if (state.maxDate || state.minDate) {
46
58
  return formatDate(state.maxDate || state.minDate, state.timeFormat, t);
47
59
  }
@@ -63,7 +75,9 @@ export var watchMinDate = function watchMinDate(_ref5) {
63
75
  state.dateUserInput.min = null;
64
76
  state.timeUserInput.min = null;
65
77
  var minTimePicker = vm.$refs.minTimePicker;
66
- if (!minTimePicker) return;
78
+ if (!minTimePicker) {
79
+ return;
80
+ }
67
81
  if (state.maxDate && state.maxDate < state.minDate) {
68
82
  var format = 'HH:mm:ss';
69
83
  minTimePicker.state.selectableRange = [[parseDate(formatDate(state.minDate, format, t), format, t), parseDate('23:59:59', format, t)]];
@@ -158,6 +172,7 @@ export var handleClear = function handleClear(_ref11) {
158
172
  state.leftDate = calcDefaultValue(state.defaultValue)[0];
159
173
  state.rightDate = nextMonth(state.leftDate);
160
174
  state.rangeState.selecting = false;
175
+ state.rangeState.endDate = null;
161
176
  emit('pick', null);
162
177
  };
163
178
  };
@@ -173,7 +188,9 @@ export var handleDateInput = function handleDateInput(_ref12) {
173
188
  t = _ref12.t;
174
189
  return function (value, type) {
175
190
  state.dateUserInput[type] = value;
176
- if (value.length !== state.dateFormat.length) return;
191
+ if (value.length !== state.dateFormat.length) {
192
+ return;
193
+ }
177
194
  var parsedValue = parseDate(value, state.dateFormat, t);
178
195
  if (parsedValue) {
179
196
  if (typeof state.disabledDate === 'function' && state.disabledDate(new Date(parsedValue))) {
@@ -220,7 +237,9 @@ export var handleTimeInput = function handleTimeInput(_ref14) {
220
237
  t = _ref14.t;
221
238
  return function (value, type) {
222
239
  state.timeUserInput[type] = value;
223
- if (value.length !== state.timeFormat.length) return;
240
+ if (value.length !== state.timeFormat.length) {
241
+ return;
242
+ }
224
243
  var parsedValue = parseDate(value, state.timeFormat, t);
225
244
  if (parsedValue) {
226
245
  if (type === 'min') {
@@ -299,7 +299,9 @@ export var isWeekActive = function isWeekActive(_ref14) {
299
299
  var props = _ref14.props,
300
300
  state = _ref14.state;
301
301
  return function (cell) {
302
- if (props.selectionMode !== DATEPICKER.Week) return false;
302
+ if (props.selectionMode !== DATEPICKER.Week) {
303
+ return false;
304
+ }
303
305
  var newDate = new Date(state.year, state.month, 1);
304
306
  var year = newDate.getFullYear();
305
307
  var month = newDate.getMonth();
package/dept/index.js ADDED
@@ -0,0 +1,318 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ export var setSelectData = function setSelectData(_ref) {
5
+ var state = _ref.state,
6
+ deptState = _ref.deptState;
7
+ return function () {
8
+ var texts = [];
9
+ var _loop = function _loop() {
10
+ var value = deptState[i].value;
11
+ if (value === '') {
12
+ return "break";
13
+ }
14
+ var options = deptState[i].options;
15
+ var selectedOp = options.find(function (op) {
16
+ return op.hrCode === value;
17
+ });
18
+ texts.push(selectedOp.hrName);
19
+ };
20
+ for (var i = 0; i < deptState.length; i++) {
21
+ var _ret = _loop();
22
+ if (_ret === "break") break;
23
+ }
24
+ state.labels = texts;
25
+ };
26
+ };
27
+ export var setDefaultSearch = function setDefaultSearch(_ref2) {
28
+ var api = _ref2.api,
29
+ state = _ref2.state;
30
+ return function () {
31
+ state.searchValue = '';
32
+ api.searchMethod();
33
+ };
34
+ };
35
+ export var openDialog = function openDialog(_ref3) {
36
+ var props = _ref3.props,
37
+ state = _ref3.state,
38
+ api = _ref3.api,
39
+ emit = _ref3.emit;
40
+ return function () {
41
+ if (props.disabled || state.formDisabled) {
42
+ return;
43
+ }
44
+ api.setDefaultSearch();
45
+ state.open = true;
46
+ emit('open');
47
+ };
48
+ };
49
+ var formatJudgCofim = function formatJudgCofim(deptState) {
50
+ var value = '';
51
+ for (var i = 0; i < deptState.length; i++) {
52
+ if (deptState[i].value === '') {
53
+ break;
54
+ }
55
+ value = deptState[i].value;
56
+ }
57
+ return value;
58
+ };
59
+ export var resetDeptState = function resetDeptState(deptState) {
60
+ return function (state) {
61
+ var depeStates = state || deptState;
62
+ depeStates.forEach(function (dept) {
63
+ dept.value = '';
64
+ dept.options = [];
65
+ dept.disable = true;
66
+ });
67
+ };
68
+ };
69
+ export var getDisplay = function getDisplay(_ref4) {
70
+ var api = _ref4.api,
71
+ deptState = _ref4.deptState,
72
+ state = _ref4.state;
73
+ return function (value) {
74
+ if (value === state.current) {
75
+ return;
76
+ }
77
+ state.current = value;
78
+ api.resetDeptState();
79
+ if (!value) {
80
+ state.display = '';
81
+ state.labels = [];
82
+ state.lastLabels = [];
83
+ state.lastDeptState = deptState.map(function (item) {
84
+ return _objectSpread({}, item);
85
+ });
86
+ return;
87
+ }
88
+ api.setDeptState(value, true).then(function () {
89
+ api.setSelectData();
90
+ state.lastLabels = state.labels;
91
+ var hrapprover = state.hrapprover;
92
+ state.display = hrapprover ? hrapprover.state.approvalPerson : state.labels.join('/');
93
+ });
94
+ };
95
+ };
96
+ export var getCurrentList = function getCurrentList(_ref5) {
97
+ var deptState = _ref5.deptState,
98
+ api = _ref5.api;
99
+ return function (level, show) {
100
+ if (!show) {
101
+ return;
102
+ }
103
+ var value = level ? deptState[level - 1].value : '';
104
+ api.getDeptList({
105
+ level: level,
106
+ value: value
107
+ });
108
+ };
109
+ };
110
+ export var getDeptList = function getDeptList(_ref6) {
111
+ var api = _ref6.api,
112
+ state = _ref6.state,
113
+ deptState = _ref6.deptState;
114
+ return function (_ref7) {
115
+ var level = _ref7.level,
116
+ value = _ref7.value,
117
+ auto = _ref7.auto;
118
+ if (level > 8) {
119
+ return;
120
+ }
121
+ var upperCode = level ? value : undefined;
122
+ state.loading = true;
123
+ return api.fetchDeptList(upperCode).then(function (list) {
124
+ deptState[level].options = list;
125
+ state.loading = false;
126
+ if (list.length) {
127
+ deptState[level].disable = false;
128
+ if (auto && state.autoSelect && list.length === 1) {
129
+ var hrCode = list[0].hrCode;
130
+ deptState[level].value = hrCode;
131
+ api.selectChange({
132
+ level: level,
133
+ value: hrCode
134
+ });
135
+ }
136
+ }
137
+ });
138
+ };
139
+ };
140
+ export var selectChange = function selectChange(_ref8) {
141
+ var emit = _ref8.emit,
142
+ api = _ref8.api,
143
+ state = _ref8.state,
144
+ deptState = _ref8.deptState;
145
+ return function (_ref9) {
146
+ var level = _ref9.level,
147
+ value = _ref9.value;
148
+ api.resetDeptState(deptState.slice(level + 1, 9));
149
+ api.setSelectData();
150
+ var current = formatJudgCofim(deptState);
151
+ var hrapprover = state.hrapprover;
152
+ if (hrapprover) {
153
+ emit('selected', current);
154
+ } else {
155
+ emit('selected', value, level);
156
+ }
157
+ if (value) {
158
+ api.getDeptList({
159
+ level: level + 1,
160
+ value: value,
161
+ auto: true
162
+ });
163
+ }
164
+ };
165
+ };
166
+ export var searchMethod = function searchMethod(_ref10) {
167
+ var api = _ref10.api,
168
+ state = _ref10.state;
169
+ return function (query) {
170
+ state.loading = true;
171
+ api.fetchDeptByValue(query).then(function (list) {
172
+ state.searchOptions = list;
173
+ state.loading = false;
174
+ });
175
+ };
176
+ };
177
+ export var searchChange = function searchChange(api) {
178
+ return function (value) {
179
+ if (!value) {
180
+ return;
181
+ }
182
+ api.resetDeptState();
183
+ api.setDeptState(value).then(function () {
184
+ api.setSelectData();
185
+ });
186
+ };
187
+ };
188
+ export var confirm = function confirm(_ref11) {
189
+ var api = _ref11.api,
190
+ props = _ref11.props,
191
+ state = _ref11.state;
192
+ return function () {
193
+ var isClose = true;
194
+ if (!props.beforeConfirm) {
195
+ isClose = api.doConfirm();
196
+ state.open = !isClose;
197
+ return;
198
+ }
199
+ if (typeof props.beforeConfirm === 'function') {
200
+ var before = props.beforeConfirm();
201
+ if (before && before.then) {
202
+ before.then(function () {
203
+ isClose = api.doConfirm();
204
+ state.open = !isClose;
205
+ }, function () {
206
+ return undefined;
207
+ });
208
+ return;
209
+ }
210
+ if (before !== false) {
211
+ isClose = api.doConfirm();
212
+ state.open = !isClose;
213
+ }
214
+ }
215
+ };
216
+ };
217
+ export var closeDialog = function closeDialog(emit) {
218
+ return function () {
219
+ return emit('close');
220
+ };
221
+ };
222
+ export var cancel = function cancel(_ref12) {
223
+ var emit = _ref12.emit,
224
+ state = _ref12.state,
225
+ deptState = _ref12.deptState;
226
+ return function () {
227
+ state.labels = state.lastLabels;
228
+ deptState.forEach(function (item, i) {
229
+ return Object.assign(item, state.lastDeptState[i]);
230
+ });
231
+ emit('cancel');
232
+ state.open = false;
233
+ };
234
+ };
235
+ export var initService = function initService(_ref13) {
236
+ var props = _ref13.props,
237
+ service = _ref13.service;
238
+ var _ref14 = service || {},
239
+ fetchDeptList = _ref14.fetchDeptList,
240
+ fetchDeptByValue = _ref14.fetchDeptByValue,
241
+ fetchDept = _ref14.fetchDept;
242
+ var noopFnCreator = function noopFnCreator(propName) {
243
+ return function () {
244
+ return Promise.reject(new Error("[AUI Error][Dept] Prop ".concat(propName, " is not configured")));
245
+ };
246
+ };
247
+ return {
248
+ fetchDeptList: props.fetchDeptList || fetchDeptList || noopFnCreator('fetchDeptList'),
249
+ fetchDeptByValue: props.fetchDeptByValue || fetchDeptByValue || noopFnCreator('fetchDeptByValue'),
250
+ fetchDept: props.fetchDept || fetchDept || noopFnCreator('fetchDept')
251
+ };
252
+ };
253
+ export var doConfirm = function doConfirm(_ref15) {
254
+ var emit = _ref15.emit,
255
+ props = _ref15.props,
256
+ state = _ref15.state,
257
+ deptState = _ref15.deptState;
258
+ return function () {
259
+ state.current = formatJudgCofim(deptState);
260
+ var hrapprover = state.hrapprover;
261
+ if (hrapprover) {
262
+ if (state.current && !hrapprover.state.approvalPerson) {
263
+ hrapprover.showModal();
264
+ return false;
265
+ } else {
266
+ state.display = hrapprover.state.approvalPerson;
267
+ }
268
+ } else {
269
+ state.display = state.labels.join('/');
270
+ }
271
+ state.lastLabels = state.labels;
272
+ state.lastDeptState = deptState.map(function (item) {
273
+ return _objectSpread({}, item);
274
+ });
275
+ if (props.modelValue !== state.current) {
276
+ emit('change', state.current);
277
+ }
278
+ emit('update:modelValue', state.current);
279
+ emit('confirm', state.current);
280
+ return true;
281
+ };
282
+ };
283
+ export var setDeptState = function setDeptState(_ref16) {
284
+ var api = _ref16.api,
285
+ state = _ref16.state,
286
+ deptState = _ref16.deptState;
287
+ return function (value, isInit) {
288
+ return api.fetchDept(value).then(function (info) {
289
+ for (var i = 0; i < deptState.length; i++) {
290
+ var textField = "l".concat(i, "_Name");
291
+ var valueField = "l".concat(i, "_Dept_Code");
292
+ if (info && info[textField]) {
293
+ var hrName = info[textField];
294
+ var hrCode = info[valueField];
295
+ deptState[i].options.push({
296
+ hrName: hrName,
297
+ hrCode: hrCode
298
+ });
299
+ deptState[i].value = hrCode;
300
+ deptState[i].disable = false;
301
+ } else {
302
+ api.getDeptList({
303
+ level: i,
304
+ value: value,
305
+ auto: true
306
+ }).then(function () {
307
+ if (isInit) {
308
+ state.lastDeptState = deptState.map(function (item) {
309
+ return _objectSpread({}, item);
310
+ });
311
+ }
312
+ });
313
+ break;
314
+ }
315
+ }
316
+ });
317
+ };
318
+ };
package/dept/vue.js ADDED
@@ -0,0 +1,163 @@
1
+ import { setSelectData, initService, openDialog, setDefaultSearch, closeDialog, resetDeptState, getDisplay, searchMethod, getCurrentList, getDeptList, selectChange, searchChange, confirm, cancel, doConfirm, setDeptState } from './index';
2
+ export var api = ['select', 'state', 'deptState', 'openDialog', 'getCurrentList', 'confirm', 'searchMethod', 'searchChange', 'selectChange', 'closeDialog', 'cancel'];
3
+ var initState = function initState(_ref) {
4
+ var reactive = _ref.reactive,
5
+ computed = _ref.computed,
6
+ parent = _ref.parent,
7
+ props = _ref.props,
8
+ inject = _ref.inject,
9
+ lastDeptState = _ref.lastDeptState;
10
+ var state = reactive({
11
+ lastDeptState: lastDeptState,
12
+ lastLabels: [],
13
+ labels: [],
14
+ display: '',
15
+ open: false,
16
+ loading: false,
17
+ searchValue: '',
18
+ searchOptions: [],
19
+ current: '',
20
+ formDisabled: computed(function () {
21
+ return (parent.auiForm || {}).disabled;
22
+ }),
23
+ disabled: props.disabled,
24
+ autoSelect: props.autoSelect,
25
+ hrapprover: inject('hrapprover', null)
26
+ });
27
+ return state;
28
+ };
29
+ var initApi = function initApi(_ref2) {
30
+ var api = _ref2.api,
31
+ state = _ref2.state,
32
+ deptState = _ref2.deptState,
33
+ emit = _ref2.emit,
34
+ $service = _ref2.$service,
35
+ props = _ref2.props;
36
+ Object.assign(api, {
37
+ state: state,
38
+ deptState: deptState,
39
+ closeDialog: closeDialog(emit),
40
+ resetDeptState: resetDeptState(deptState),
41
+ fetchDept: $service.fetchDept,
42
+ fetchDeptList: $service.fetchDeptList,
43
+ fetchDeptByValue: $service.fetchDeptByValue,
44
+ setSelectData: setSelectData({
45
+ deptState: deptState,
46
+ state: state
47
+ }),
48
+ cancel: cancel({
49
+ emit: emit,
50
+ state: state,
51
+ deptState: deptState
52
+ }),
53
+ doConfirm: doConfirm({
54
+ emit: emit,
55
+ props: props,
56
+ state: state,
57
+ deptState: deptState
58
+ }),
59
+ searchChange: searchChange(api),
60
+ searchMethod: searchMethod({
61
+ api: api,
62
+ state: state
63
+ }),
64
+ openDialog: openDialog({
65
+ api: api,
66
+ emit: emit,
67
+ props: props,
68
+ state: state
69
+ }),
70
+ selectChange: selectChange({
71
+ api: api,
72
+ emit: emit,
73
+ state: state,
74
+ deptState: deptState
75
+ }),
76
+ setDefaultSearch: setDefaultSearch({
77
+ api: api,
78
+ state: state
79
+ }),
80
+ getCurrentList: getCurrentList({
81
+ api: api,
82
+ deptState: deptState
83
+ }),
84
+ confirm: confirm({
85
+ api: api,
86
+ props: props,
87
+ state: state
88
+ }),
89
+ getDeptList: getDeptList({
90
+ api: api,
91
+ deptState: deptState,
92
+ state: state
93
+ }),
94
+ getDisplay: getDisplay({
95
+ api: api,
96
+ deptState: deptState,
97
+ state: state
98
+ }),
99
+ setDeptState: setDeptState({
100
+ api: api,
101
+ state: state,
102
+ deptState: deptState
103
+ })
104
+ });
105
+ };
106
+ export var renderless = function renderless(props, _ref3, _ref4) {
107
+ var onBeforeUnmount = _ref3.onBeforeUnmount,
108
+ reactive = _ref3.reactive,
109
+ watch = _ref3.watch,
110
+ inject = _ref3.inject,
111
+ computed = _ref3.computed;
112
+ var service = _ref4.service,
113
+ emit = _ref4.emit,
114
+ parent = _ref4.parent;
115
+ parent.auiForm = parent.auiForm || inject('form', null);
116
+ var api = {};
117
+ var $service = initService({
118
+ props: props,
119
+ service: service
120
+ });
121
+ var deptLevels = ['company', 'dept1', 'dept2', 'dept3', 'dept4', 'dept5', 'dept6', 'dept7', 'dept8'];
122
+ var deptState = deptLevels.map(function (title) {
123
+ return reactive({
124
+ title: title,
125
+ options: [],
126
+ value: '',
127
+ disable: true
128
+ });
129
+ });
130
+ var lastDeptState = deptLevels.map(function (title) {
131
+ return reactive({
132
+ title: title,
133
+ options: [],
134
+ value: '',
135
+ disable: true
136
+ });
137
+ });
138
+ var state = initState({
139
+ reactive: reactive,
140
+ computed: computed,
141
+ parent: parent,
142
+ props: props,
143
+ inject: inject,
144
+ lastDeptState: lastDeptState
145
+ });
146
+ initApi({
147
+ api: api,
148
+ state: state,
149
+ deptState: deptState,
150
+ emit: emit,
151
+ $service: $service,
152
+ props: props
153
+ });
154
+ watch(function () {
155
+ return props.modelValue;
156
+ }, api.getDisplay, {
157
+ immediate: true
158
+ });
159
+ onBeforeUnmount(function () {
160
+ state.open = false;
161
+ });
162
+ return api;
163
+ };
@@ -86,8 +86,11 @@ export var checkAllHander = function checkAllHander(state) {
86
86
  };
87
87
  };
88
88
  export var checkValueHiddenItem = function checkValueHiddenItem(state) {
89
- return function () {
89
+ return function (index) {
90
90
  var hiddenItemCount = 0;
91
+ if (typeof index === 'number') {
92
+ state.cloneValue[index].hidden = !state.cloneValue[index].hidden;
93
+ }
91
94
  state.cloneValue.forEach(function (item) {
92
95
  if (item.hidden) {
93
96
  ++hiddenItemCount;
@@ -75,7 +75,10 @@ export var watchVisible = function watchVisible(_ref3) {
75
75
  return state.key++;
76
76
  });
77
77
  }
78
- props.rightSlide && (el.querySelector(constants.DIALOG_BOX_CLASS).style.left = '');
78
+ if (props.rightSlide) {
79
+ var dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
80
+ dialogBoxDom.style.left = '';
81
+ }
79
82
  }
80
83
  };
81
84
  };
@@ -126,9 +129,14 @@ export var handleClose = function handleClose(_ref7) {
126
129
  props = _ref7.props;
127
130
  return function () {
128
131
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'close';
129
- if (typeof props.beforeClose === 'function' && props.beforeClose(type) === false) return;
132
+ if (typeof props.beforeClose === 'function' && props.beforeClose(type) === false) {
133
+ return;
134
+ }
130
135
  var el = parent.$el;
131
- props.rightSlide && (el.querySelector(constants.DIALOG_BOX_CLASS).style.left = '');
136
+ if (props.rightSlide) {
137
+ var dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
138
+ dialogBoxDom.style.left = '';
139
+ }
132
140
  if (!emitEvent(emit, 'before-close', api.hide)) {
133
141
  return;
134
142
  }
@@ -189,7 +197,9 @@ var findPopoverComponent = function findPopoverComponent(_ref12) {
189
197
  var vm = _ref12.vm,
190
198
  componentList = _ref12.componentList;
191
199
  var children = vm.$children;
192
- if (!children || children.length === 0) return;
200
+ if (!children || children.length === 0) {
201
+ return;
202
+ }
193
203
  children.forEach(function (child) {
194
204
  var tag = child.$options.componentName;
195
205
  if (tag === 'Select') {