@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
package/dialog-box/vue.js CHANGED
@@ -60,7 +60,8 @@ var initApi = function initApi(_ref3) {
60
60
  constants = _ref3.constants,
61
61
  usePopups = _ref3.usePopups,
62
62
  nextTick = _ref3.nextTick,
63
- refs = _ref3.refs;
63
+ refs = _ref3.refs,
64
+ broadcast = _ref3.broadcast;
64
65
  var open = usePopups.open,
65
66
  close = usePopups.close,
66
67
  doOpen = usePopups.doOpen,
@@ -77,6 +78,7 @@ var initApi = function initApi(_ref3) {
77
78
  doAfterOpen: doAfterOpen,
78
79
  doAfterClose: doAfterClose,
79
80
  restoreBodyStyle: restoreBodyStyle,
81
+ broadcast: broadcast,
80
82
  handleCancel: handleCancel({
81
83
  api: api,
82
84
  emit: emit
@@ -174,7 +176,8 @@ export var renderless = function renderless(props, _ref5, _ref6) {
174
176
  constants = _ref6.constants,
175
177
  nextTick = _ref6.nextTick,
176
178
  refs = _ref6.refs,
177
- mode = _ref6.mode;
179
+ mode = _ref6.mode,
180
+ broadcast = _ref6.broadcast;
178
181
  var api = {};
179
182
  var lockScrollClass = constants.scrollLockClass(mode);
180
183
  var state = initState({
@@ -206,7 +209,8 @@ export var renderless = function renderless(props, _ref5, _ref6) {
206
209
  usePopups: usePopups,
207
210
  lockScrollClass: lockScrollClass,
208
211
  nextTick: nextTick,
209
- refs: refs
212
+ refs: refs,
213
+ broadcast: broadcast
210
214
  });
211
215
  state = mergeState({
212
216
  reactive: reactive,
@@ -0,0 +1,73 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ export var init = function init(_ref) {
3
+ var state = _ref.state,
4
+ service = _ref.service,
5
+ emit = _ref.emit;
6
+ return function () {
7
+ var promise;
8
+ var _service$fields = service.fields,
9
+ textField = _service$fields.textField,
10
+ valueField = _service$fields.valueField;
11
+ if (state.source) {
12
+ promise = new Promise(function (resolve) {
13
+ return resolve(state.source);
14
+ });
15
+ } else {
16
+ promise = Promise.all([service.fetchRole(), service.fetchCurrentRole()]).then(function (result) {
17
+ var _result = _slicedToArray(result, 2),
18
+ validRoles = _result[0],
19
+ currentRole = _result[1];
20
+ if (validRoles) {
21
+ state.source = validRoles;
22
+ if (currentRole && currentRole[valueField]) {
23
+ state.selectedValue = currentRole[valueField];
24
+ emit('update:modelValue', state.selectedValue);
25
+ }
26
+ } else {
27
+ state.source = [];
28
+ }
29
+ return state.source;
30
+ });
31
+ }
32
+ promise.then(function (data) {
33
+ state.options = data.map(function (item) {
34
+ return {
35
+ label: item[textField],
36
+ value: item[valueField]
37
+ };
38
+ });
39
+ emit('render', state.options, state.selectedValue);
40
+ });
41
+ };
42
+ };
43
+ export var change = function change(emit) {
44
+ return function (value) {
45
+ emit('update:modelValue', value);
46
+ emit('change', value);
47
+ };
48
+ };
49
+ export var initService = function initService(_ref2) {
50
+ var props = _ref2.props,
51
+ service = _ref2.service;
52
+ var _ref3 = service || {},
53
+ _ref3$setting = _ref3.setting,
54
+ setting = _ref3$setting === void 0 ? {} : _ref3$setting,
55
+ fetchRole = _ref3.fetchRole,
56
+ fetchCurrentRole = _ref3.fetchCurrentRole;
57
+ var _setting$options = setting.options,
58
+ options = _setting$options === void 0 ? {} : _setting$options;
59
+ var noopFnCreator = function noopFnCreator(propName) {
60
+ return function () {
61
+ return Promise.reject(new Error("[AUI Error][DropRoles] Prop ".concat(propName, " is not configured")));
62
+ };
63
+ };
64
+ var defaultDropRolesSetting = {
65
+ textField: 'roleName',
66
+ valueField: 'roleId'
67
+ };
68
+ return {
69
+ fetchRole: props.fetchRole || fetchRole || noopFnCreator('fetchRole'),
70
+ fetchCurrentRole: props.fetchCurrentRole || fetchCurrentRole || noopFnCreator('fetchCurrentRole'),
71
+ fields: props.fields || options.DropRoles || defaultDropRolesSetting
72
+ };
73
+ };
@@ -0,0 +1,38 @@
1
+ import { init, change, initService } from './index';
2
+ export var api = ['state', 'change'];
3
+ export var renderless = function renderless(props, _ref, _ref2) {
4
+ var onMounted = _ref.onMounted,
5
+ reactive = _ref.reactive,
6
+ watch = _ref.watch;
7
+ var parent = _ref2.parent,
8
+ emit = _ref2.emit,
9
+ service = _ref2.service;
10
+ var $service = initService({
11
+ props: props,
12
+ service: service
13
+ });
14
+ var state = reactive({
15
+ options: [],
16
+ source: null,
17
+ selectedValue: props.modelValue,
18
+ attrs: parent.$attr
19
+ });
20
+ watch(function () {
21
+ return props.modelValue;
22
+ }, function (value) {
23
+ state.selectedValue = value;
24
+ }, {
25
+ immediate: true
26
+ });
27
+ var api = {
28
+ state: state,
29
+ change: change(emit),
30
+ init: init({
31
+ state: state,
32
+ service: $service,
33
+ emit: emit
34
+ })
35
+ };
36
+ onMounted(api.init);
37
+ return api;
38
+ };
package/dropdown/index.js CHANGED
@@ -2,12 +2,13 @@ import { KEY_CODE } from '@opentiny/vue-renderless/common';
2
2
  import { addClass, removeClass, on, off } from '@opentiny/vue-renderless/common/deps/dom';
3
3
  export var watchVisible = function watchVisible(_ref) {
4
4
  var broadcast = _ref.broadcast,
5
- emit = _ref.emit;
5
+ emit = _ref.emit,
6
+ nextTick = _ref.nextTick;
6
7
  return function (value) {
7
8
  broadcast('TinyDropdownMenu', 'visible', value);
8
- setTimeout(function () {
9
- emit('visibles-change', value);
10
- }, 0);
9
+ nextTick(function () {
10
+ return emit('visible-change', value);
11
+ });
11
12
  };
12
13
  };
13
14
  export var watchFocusing = function watchFocusing(_ref2) {
package/dropdown/vue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { guid } from '@opentiny/vue-renderless/common/string';
2
2
  import { watchVisible, watchFocusing, show, hide, handleClick, handleTriggerKeyDown, handleItemKeyDown, resetTabindex, removeTabindex, initAria, initEvent, handleMenuItemClick, handleMainButtonClick, triggerElmFocus, initDomOperation, mounted, beforeDistory } from './index';
3
- export var api = ['state', 'handleMainButtonClick', 'hide', 'initDomOperation', 'handleClick'];
3
+ export var api = ['state', 'handleMainButtonClick', 'hide', 'show', 'initDomOperation', 'handleClick'];
4
4
  export var renderless = function renderless(props, _ref, _ref2) {
5
5
  var reactive = _ref.reactive,
6
6
  watch = _ref.watch,
@@ -9,7 +9,8 @@ export var renderless = function renderless(props, _ref, _ref2) {
9
9
  var emit = _ref2.emit,
10
10
  parent = _ref2.parent,
11
11
  broadcast = _ref2.broadcast,
12
- vm = _ref2.vm;
12
+ vm = _ref2.vm,
13
+ nextTick = _ref2.nextTick;
13
14
  var api = {};
14
15
  var state = reactive({
15
16
  visible: false,
@@ -26,7 +27,8 @@ export var renderless = function renderless(props, _ref, _ref2) {
26
27
  state: state,
27
28
  watchVisible: watchVisible({
28
29
  broadcast: broadcast,
29
- emit: emit
30
+ emit: emit,
31
+ nextTick: nextTick
30
32
  }),
31
33
  watchFocusing: watchFocusing({
32
34
  parent: parent
@@ -152,4 +152,19 @@ export var clickOutside = function clickOutside(parent) {
152
152
  });
153
153
  }
154
154
  };
155
+ };
156
+ export var handleClick = function handleClick(_ref9) {
157
+ var props = _ref9.props,
158
+ dispatch = _ref9.dispatch,
159
+ vm = _ref9.vm,
160
+ emit = _ref9.emit;
161
+ return function (event) {
162
+ event.stopPropagation();
163
+ var data = {
164
+ itemData: props.itemData,
165
+ vm: vm
166
+ };
167
+ emit('item-click', data);
168
+ dispatch('TinyDropdown', 'menu-item-click', data);
169
+ };
155
170
  };
@@ -1,11 +1,12 @@
1
- import { tagClick, confirm, clickOutside, getOptionStyle, reset, getTitle, bindScroll, toggle, onScroll, open, opened, close, closed, clickItem, clickWrapper, getItemStyle } from './index';
2
- export var api = ['state', 'confirm', 'clickOutside', 'getOptionStyle', 'reset', 'tagClick', 'clickItem', 'clickWrapper', 'toggle', 'open', 'opened', 'close', 'closed'];
1
+ import { tagClick, confirm, clickOutside, getOptionStyle, reset, getTitle, bindScroll, toggle, onScroll, open, opened, close, closed, clickItem, clickWrapper, getItemStyle, handleClick } from './index';
2
+ export var api = ['state', 'confirm', 'clickOutside', 'getOptionStyle', 'reset', 'tagClick', 'clickItem', 'clickWrapper', 'toggle', 'open', 'opened', 'close', 'closed', 'handleClick'];
3
3
  var initState = function initState(_ref) {
4
4
  var reactive = _ref.reactive,
5
5
  computed = _ref.computed,
6
6
  api = _ref.api,
7
7
  props = _ref.props,
8
- parent = _ref.parent;
8
+ parent = _ref.parent,
9
+ dropdownMenu = _ref.dropdownMenu;
9
10
  var state = reactive({
10
11
  sort: props.modelValue,
11
12
  transition: true,
@@ -33,7 +34,10 @@ var initState = function initState(_ref) {
33
34
  }),
34
35
  closeOnClickOverlay: computed(function () {
35
36
  return parent.closeOnClickOverlay;
36
- })
37
+ }),
38
+ children: [],
39
+ textField: (dropdownMenu === null || dropdownMenu === void 0 ? void 0 : dropdownMenu.textField) || props.textField,
40
+ popperClass: (dropdownMenu === null || dropdownMenu === void 0 ? void 0 : dropdownMenu.popperClass) || ''
37
41
  });
38
42
  return state;
39
43
  };
@@ -42,7 +46,9 @@ var initApi = function initApi(_ref2) {
42
46
  state = _ref2.state,
43
47
  emit = _ref2.emit,
44
48
  props = _ref2.props,
45
- parent = _ref2.parent;
49
+ parent = _ref2.parent,
50
+ dispatch = _ref2.dispatch,
51
+ vm = _ref2.vm;
46
52
  Object.assign(api, {
47
53
  state: state,
48
54
  open: open(emit),
@@ -87,38 +93,46 @@ var initApi = function initApi(_ref2) {
87
93
  emit: emit,
88
94
  props: props,
89
95
  state: state
96
+ }),
97
+ handleClick: handleClick({
98
+ props: props,
99
+ dispatch: dispatch,
100
+ vm: vm,
101
+ emit: emit
90
102
  })
91
103
  });
92
104
  };
93
105
  export var renderless = function renderless(props, _ref3, _ref4) {
94
106
  var computed = _ref3.computed,
95
- onMounted = _ref3.onMounted,
96
107
  reactive = _ref3.reactive,
97
- watch = _ref3.watch;
108
+ watch = _ref3.watch,
109
+ inject = _ref3.inject;
98
110
  var parent = _ref4.parent,
99
111
  emit = _ref4.emit,
100
- vm = _ref4.vm;
112
+ vm = _ref4.vm,
113
+ dispatch = _ref4.dispatch;
101
114
  var api = {};
115
+ var dropdownMenu = inject('dropdownMenu', null);
102
116
  parent = parent.$parent;
103
117
  var state = initState({
104
118
  reactive: reactive,
105
119
  computed: computed,
106
120
  api: api,
107
121
  props: props,
108
- parent: parent
122
+ parent: parent,
123
+ dropdownMenu: dropdownMenu
109
124
  });
110
125
  initApi({
111
126
  api: api,
112
127
  state: state,
113
128
  emit: emit,
114
129
  props: props,
115
- parent: parent
130
+ parent: parent,
131
+ dispatch: dispatch,
132
+ vm: vm
116
133
  });
117
134
  watch(function () {
118
135
  return state.showPopup;
119
136
  }, api.bindScroll);
120
- onMounted(function () {
121
- parent.state.children.push(vm);
122
- });
123
137
  return api;
124
138
  };
@@ -0,0 +1,129 @@
1
+ import { xss } from '@opentiny/vue-renderless/common';
2
+ export var getUserHref = function getUserHref(_ref) {
3
+ var api = _ref.api,
4
+ props = _ref.props;
5
+ return function (item) {
6
+ var type = item.type ? String(item.type).toLocaleLowerCase() : '';
7
+ var value = item.value ? String(item.value).toLocaleLowerCase() : '';
8
+ var href = '';
9
+ if (props.isNewImMode) {
10
+ if (type === 'im' || type === 'sip') {
11
+ href = 'javascript:;';
12
+ } else {
13
+ href = "".concat(type, ":").concat(value);
14
+ }
15
+ if (type === 'im' || type === 'sip') {
16
+ api.testUID(value);
17
+ }
18
+ } else {
19
+ href = "".concat(type, ":").concat(value);
20
+ }
21
+ return xss.filterUrl(href);
22
+ };
23
+ };
24
+ export var getUserTitle = function getUserTitle(item) {
25
+ var type = item.type ? String(item.type).toLocaleLowerCase() : '';
26
+ var value = item.value ? String(item.value).toLocaleLowerCase() : '';
27
+ var title = "".concat(type, ":").concat(value);
28
+ return title;
29
+ };
30
+ export var doUserAction = function doUserAction(_ref2) {
31
+ var api = _ref2.api,
32
+ props = _ref2.props,
33
+ state = _ref2.state,
34
+ eSpaceCtrl = _ref2.eSpaceCtrl;
35
+ return function (item) {
36
+ state.dataItem = item;
37
+ var type = item.type ? String(item.type).toLocaleLowerCase() : '';
38
+ if (props.isNewImMode) {
39
+ if (eSpaceCtrl) {
40
+ if (state.initialized) {
41
+ if (type === 'im') {
42
+ api.openEspace();
43
+ } else if (type === 'sip') {
44
+ api.soundEspace();
45
+ }
46
+ } else {
47
+ if (type === 'im' || type === 'sip') {
48
+ api.initEspaceLink();
49
+ }
50
+ }
51
+ }
52
+ }
53
+ };
54
+ };
55
+ export var initEspaceLink = function initEspaceLink(_ref3) {
56
+ var api = _ref3.api,
57
+ props = _ref3.props,
58
+ state = _ref3.state,
59
+ eSpaceCtrl = _ref3.eSpaceCtrl,
60
+ eSpaceCtrlDisabled = _ref3.eSpaceCtrlDisabled;
61
+ return function () {
62
+ var flag = localStorage.getItem('eSpaceCtrl_initialized');
63
+ var dataItem = state.dataItem;
64
+ var type = dataItem.type ? String(dataItem.type).toLocaleLowerCase() : '';
65
+ if (Number(flag)) {
66
+ state.initialized = true;
67
+ if (type === 'im') {
68
+ api.openEspace();
69
+ } else if (type === 'sip') {
70
+ api.soundEspace();
71
+ }
72
+ } else if (!eSpaceCtrlDisabled) {
73
+ var timeout = props.timeout || 3000;
74
+ var pollingInterval = props.pollingInterval || 1000;
75
+ var options = {
76
+ timeout: timeout,
77
+ pollingInterval: pollingInterval
78
+ };
79
+ eSpaceCtrl.init && eSpaceCtrl.init(options);
80
+ eSpaceCtrl.ready && eSpaceCtrl.ready(function () {
81
+ state.initialized = true;
82
+ if (type === 'im') {
83
+ api.openEspace();
84
+ } else if (type === 'sip') {
85
+ api.soundEspace();
86
+ }
87
+ });
88
+ eSpaceCtrl.error && eSpaceCtrl.error(function () {
89
+ state.initialized = false;
90
+ });
91
+ }
92
+ };
93
+ };
94
+ export var openEspace = function openEspace(_ref4) {
95
+ var api = _ref4.api,
96
+ state = _ref4.state,
97
+ eSpaceCtrl = _ref4.eSpaceCtrl;
98
+ return function () {
99
+ var dataItem = state.dataItem;
100
+ var uid = dataItem.value ? String(dataItem.value).toLocaleLowerCase() : '';
101
+ if (uid && api.testUID(uid)) {
102
+ eSpaceCtrl.showImDialog(uid);
103
+ }
104
+ };
105
+ };
106
+ export var testUID = function testUID(uid) {
107
+ uid = uid ? String(uid).toLocaleLowerCase() : '';
108
+ if (uid) {
109
+ var employer = /^[a-z]\d+$/i;
110
+ var employee = /^[a-z]{3}\d+$/i;
111
+ if (!employer.test(uid) && !employee.test(uid)) {
112
+ return false;
113
+ }
114
+ return true;
115
+ }
116
+ return false;
117
+ };
118
+ export var soundEspace = function soundEspace(_ref5) {
119
+ var api = _ref5.api,
120
+ state = _ref5.state,
121
+ eSpaceCtrl = _ref5.eSpaceCtrl;
122
+ return function () {
123
+ var dataItem = state.dataItem;
124
+ var uid = dataItem.value ? String(dataItem.value).toLocaleLowerCase() : '';
125
+ if (uid && api.testUID(uid)) {
126
+ eSpaceCtrl.eSpaceCallByAccount(uid);
127
+ }
128
+ };
129
+ };
package/espace/vue.js ADDED
@@ -0,0 +1,52 @@
1
+ import { init } from '@opentiny/vue-renderless/common/deps/eSpaceCtrl';
2
+ import { getUserHref, getUserTitle, doUserAction, initEspaceLink, openEspace, testUID, soundEspace } from './index';
3
+ export var api = ['getUserHref', 'getUserTitle', 'doUserAction', 'initEspaceLink', 'openEspace', 'testUID', 'soundEspace'];
4
+ export var renderless = function renderless(props, _ref, _ref2) {
5
+ var reactive = _ref.reactive;
6
+ var service = _ref2.service;
7
+ var api = {};
8
+ var _ref3 = service || {},
9
+ _ref3$setting = _ref3.setting,
10
+ setting = _ref3$setting === void 0 ? {} : _ref3$setting;
11
+ var _setting$widgets = setting.widgets,
12
+ widgets = _setting$widgets === void 0 ? {} : _setting$widgets;
13
+ var eSpaceCtrlDisabled = widgets.ESpaceCtrl && !widgets.ESpaceCtrl.autoLink;
14
+ var eSpaceCtrl = eSpaceCtrlDisabled ? {} : init();
15
+ var state = reactive({
16
+ initialized: false,
17
+ dataItem: null
18
+ });
19
+ Object.assign(api, {
20
+ state: state,
21
+ testUID: testUID,
22
+ getUserTitle: getUserTitle,
23
+ getUserHref: getUserHref({
24
+ api: api,
25
+ props: props
26
+ }),
27
+ initEspaceLink: initEspaceLink({
28
+ api: api,
29
+ props: props,
30
+ state: state,
31
+ eSpaceCtrl: eSpaceCtrl,
32
+ eSpaceCtrlDisabled: eSpaceCtrlDisabled
33
+ }),
34
+ doUserAction: doUserAction({
35
+ api: api,
36
+ props: props,
37
+ state: state,
38
+ eSpaceCtrl: eSpaceCtrl
39
+ }),
40
+ openEspace: openEspace({
41
+ api: api,
42
+ state: state,
43
+ eSpaceCtrl: eSpaceCtrl
44
+ }),
45
+ soundEspace: soundEspace({
46
+ api: api,
47
+ state: state,
48
+ eSpaceCtrl: eSpaceCtrl
49
+ })
50
+ });
51
+ return api;
52
+ };