@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/picker/index.js CHANGED
@@ -40,7 +40,9 @@ export var watchPickerVisible = function watchPickerVisible(_ref2) {
40
40
  props = _ref2.props,
41
41
  state = _ref2.state;
42
42
  return function (value) {
43
- if (props.readonly || state.pickerDisabled) return;
43
+ if (props.readonly || state.pickerDisabled) {
44
+ return;
45
+ }
44
46
  if (value) {
45
47
  api.showPicker();
46
48
  state.valueOnOpen = Array.isArray(props.modelValue) ? _toConsumableArray(props.modelValue) : props.modelValue;
@@ -91,8 +93,10 @@ export var getMode = function getMode(_ref3) {
91
93
  export var formatAsFormatAndType = function formatAsFormatAndType(_ref4) {
92
94
  var api = _ref4.api;
93
95
  return function (value, customFormat, type) {
94
- if (!value) return null;
95
- var formatter = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()['default']).formatter;
96
+ if (!value) {
97
+ return null;
98
+ }
99
+ var formatter = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()["default"]).formatter;
96
100
  var format = customFormat || DATEPICKER.DateFormats[type];
97
101
  return formatter(value, format);
98
102
  };
@@ -117,8 +121,10 @@ export var parseAsFormatAndType = function parseAsFormatAndType(_ref6) {
117
121
  var api = _ref6.api;
118
122
  return function (value, customFormat, type) {
119
123
  var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
120
- if (!value) return null;
121
- var parser = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()['default']).parser;
124
+ if (!value) {
125
+ return null;
126
+ }
127
+ var parser = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()["default"]).parser;
122
128
  var format = customFormat || DATEPICKER.DateFormats[type];
123
129
  return parser(value, format, rangeSeparator);
124
130
  };
@@ -129,8 +135,12 @@ export var parsedValue = function parsedValue(_ref7) {
129
135
  state = _ref7.state,
130
136
  t = _ref7.t;
131
137
  return function () {
132
- if (!props.modelValue) return props.modelValue;
133
- if (state.type === DATEPICKER.TimeSelect) return props.modelValue;
138
+ if (!props.modelValue) {
139
+ return props.modelValue;
140
+ }
141
+ if (state.type === DATEPICKER.TimeSelect) {
142
+ return props.modelValue;
143
+ }
134
144
  var valueIsDateObject = isDateObject(props.modelValue) || Array.isArray(props.modelValue) && props.modelValue.every(isDateObject);
135
145
  var _state$timezone = state.timezone,
136
146
  from = _state$timezone.from,
@@ -237,14 +247,18 @@ export var getValueFormat = function getValueFormat(_ref10) {
237
247
  export var dateFormatter = function dateFormatter(_ref11) {
238
248
  var t = _ref11.t;
239
249
  return function (value, format) {
240
- if (format === DATEPICKER.TimesTamp) return value.getTime();
250
+ if (format === DATEPICKER.TimesTamp) {
251
+ return value.getTime();
252
+ }
241
253
  return formatDate(value, format, t);
242
254
  };
243
255
  };
244
256
  export var dateParser = function dateParser(_ref12) {
245
257
  var t = _ref12.t;
246
258
  return function (text, format) {
247
- if (format === DATEPICKER.TimesTamp) return new Date(Number(text));
259
+ if (format === DATEPICKER.TimesTamp) {
260
+ return new Date(Number(text));
261
+ }
248
262
  return parseDate(text, format, t);
249
263
  };
250
264
  };
@@ -286,7 +300,7 @@ export var getWeekData = function getWeekData(value) {
286
300
  var getDefaultOfTypeValueResolveMap = function getDefaultOfTypeValueResolveMap() {
287
301
  return {
288
302
  formatter: function formatter(value) {
289
- return value ? '' + value : '';
303
+ return value ? String(value) : '';
290
304
  },
291
305
  parser: function parser(text) {
292
306
  return text === undefined || text === '' ? null : text;
@@ -318,7 +332,7 @@ var getWeekOfTypeValueResolveMap = function getWeekOfTypeValueResolveMap(_ref13)
318
332
  var getNumberOfTypeValueResolveMap = function getNumberOfTypeValueResolveMap() {
319
333
  return {
320
334
  formatter: function formatter(value) {
321
- return value ? '' + value : '';
335
+ return value ? String(value) : '';
322
336
  },
323
337
  parser: function parser(text) {
324
338
  var result = Number(text);
@@ -402,7 +416,9 @@ export var firstInputId = function firstInputId(_ref15) {
402
416
  } else {
403
417
  id = props.id;
404
418
  }
405
- if (id) obj.id = id;
419
+ if (id) {
420
+ obj.id = id;
421
+ }
406
422
  return obj;
407
423
  };
408
424
  };
@@ -415,7 +431,9 @@ export var secondInputId = function secondInputId(_ref16) {
415
431
  if (state.ranged) {
416
432
  id = props.id && props.id[1];
417
433
  }
418
- if (id) obj.id = id;
434
+ if (id) {
435
+ obj.id = id;
436
+ }
419
437
  return obj;
420
438
  };
421
439
  };
@@ -478,7 +496,9 @@ export var handleMouseEnter = function handleMouseEnter(_ref22) {
478
496
  var props = _ref22.props,
479
497
  state = _ref22.state;
480
498
  return function () {
481
- if (props.readonly || state.pickerDisabled) return;
499
+ if (props.readonly || state.pickerDisabled) {
500
+ return;
501
+ }
482
502
  if (!state.valueIsEmpty && props.clearable) {
483
503
  state.showClose = true;
484
504
  }
@@ -584,7 +604,9 @@ export var handleClickIcon = function handleClickIcon(_ref26) {
584
604
  props = _ref26.props,
585
605
  state = _ref26.state;
586
606
  return function (event) {
587
- if (props.readonly || state.pickerDisabled) return;
607
+ if (props.readonly || state.pickerDisabled) {
608
+ return;
609
+ }
588
610
  if (state.showClose) {
589
611
  state.valueOnOpen = props.modelValue;
590
612
  event.stopPropagation();
@@ -604,7 +626,9 @@ export var handleClose = function handleClose(_ref27) {
604
626
  props = _ref27.props,
605
627
  state = _ref27.state;
606
628
  return function () {
607
- if (!state.pickerVisible) return;
629
+ if (!state.pickerVisible) {
630
+ return;
631
+ }
608
632
  state.pickerVisible = false;
609
633
  if (state.type === DATEPICKER.Dates) {
610
634
  var oldValue = api.parseAsFormatAndType(state.valueOnOpen, state.valueFormat, state.type, props.rangeSeparator) || state.valueOnOpen;
@@ -794,7 +818,9 @@ export var updateOptions = function updateOptions(_ref34) {
794
818
  props = _ref34.props,
795
819
  state = _ref34.state;
796
820
  return function () {
797
- if (!state.picker) return;
821
+ if (!state.picker) {
822
+ return;
823
+ }
798
824
  var options = props.pickerOptions;
799
825
  if (options && options.selectableRange) {
800
826
  var ranges = options.selectableRange;
@@ -1,5 +1,5 @@
1
1
  export default {
2
- 'en-US': [{
2
+ 'enUS': [{
3
3
  name: '(UTC-12:00)International Date Line West',
4
4
  code: '001-12',
5
5
  offset: -12,
@@ -485,7 +485,7 @@ export default {
485
485
  offset: 13,
486
486
  tz: 'Pacific/Tongatapu'
487
487
  }],
488
- 'zh-CN': [{
488
+ 'zhCN': [{
489
489
  name: '(UTC-12:00)国际日期变更线西',
490
490
  code: '001-12',
491
491
  offset: -12,
@@ -61,10 +61,14 @@ export var adjustIndex = function adjustIndex(state) {
61
61
  return function (index) {
62
62
  index = range(index, 0, state.count);
63
63
  for (var i = index; i < state.count; i++) {
64
- if (!isOptionDisabled(state.columnsItem.values[i])) return i;
64
+ if (!isOptionDisabled(state.columnsItem.values[i])) {
65
+ return i;
66
+ }
65
67
  }
66
68
  for (var _i = index - 1; _i >= 0; _i--) {
67
- if (!isOptionDisabled(state.columnsItem.values[_i])) return _i;
69
+ if (!isOptionDisabled(state.columnsItem.values[_i])) {
70
+ return _i;
71
+ }
68
72
  }
69
73
  };
70
74
  };
@@ -176,7 +180,7 @@ export var momentum = function momentum(_ref9) {
176
180
  var speed = Math.abs(distance / duration);
177
181
  distance = state.offset + speed / 0.002 * (distance < 0 ? -1 : 1);
178
182
  var index = range(Math.round(-distance / state.itemHeight), 0, state.count - 1);
179
- state.duration = +props.swipeDuration;
183
+ state.duration = Number(props.swipeDuration);
180
184
  api.setIndex(index, true);
181
185
  };
182
186
  };
@@ -307,9 +307,11 @@ export var beforeAvatarUpload = function beforeAvatarUpload(_ref24) {
307
307
  var arr = filepath.split('.');
308
308
  var fileend = '.' + arr[arr.length - 1];
309
309
  isnext = !~state.uploadFileType.indexOf(fileend);
310
- if (isnext) state.errorTips.push({
311
- type: file.name
312
- });
310
+ if (isnext) {
311
+ state.errorTips.push({
312
+ type: file.name
313
+ });
314
+ }
313
315
  }
314
316
  if (state.maxUploadFileSize && state.maxUploadFileSize != 0) {
315
317
  if (file.size > state.maxUploadFileSize) {
@@ -112,7 +112,9 @@ export var getRadioSelectedData = function getRadioSelectedData(_ref6) {
112
112
  var refs = vm.$refs;
113
113
  var table = props.showHistory && state.activeName === 'history' ? refs[constants.GRID_REF.history] : refs[constants.GRID_REF.source];
114
114
  var radioRow = table && table.getRadioRow();
115
- if (radioRow) state.selectedDatas = radioRow;
115
+ if (radioRow) {
116
+ state.selectedDatas = radioRow;
117
+ }
116
118
  state.commitValue = state.selectedDatas ? state.selectedDatas[props.valueField] : '';
117
119
  };
118
120
  };
@@ -237,7 +239,9 @@ export var handleCancel = function handleCancel(_ref13) {
237
239
  state = _ref13.state,
238
240
  constants = _ref13.constants;
239
241
  return function () {
240
- if (typeof props.beforeClose === 'function' && props.beforeClose('cancel') === false) return;
242
+ if (typeof props.beforeClose === 'function' && props.beforeClose('cancel') === false) {
243
+ return;
244
+ }
241
245
  cancelOrClose({
242
246
  props: props,
243
247
  state: state,
@@ -307,7 +311,7 @@ var getTreeSelectList = function getTreeSelectList(_ref17) {
307
311
  var value = _ref17.value,
308
312
  state = _ref17.state,
309
313
  props = _ref17.props;
310
- value = typeOf(value) === 'number' ? isNaN(value) ? '' : '' + value : value;
314
+ value = typeOf(value) === 'number' ? isNaN(value) ? '' : String(value) : value;
311
315
  var treeSelectList = [];
312
316
  if (!isNullOrEmpty(value)) {
313
317
  var values = value.split(props.valueSplit);
@@ -552,7 +556,7 @@ export var sourceGridSelectAll = function sourceGridSelectAll(_ref26) {
552
556
  });
553
557
  } else {
554
558
  var len = state.sourceGridDataset.length;
555
- var _loop = function _loop(i) {
559
+ var _loop = function _loop() {
556
560
  var sourceGridItem = state.sourceGridDataset[i][props.valueField];
557
561
  var selectedItem = find(state.selectedValues, function (val) {
558
562
  return val == sourceGridItem;
@@ -564,7 +568,7 @@ export var sourceGridSelectAll = function sourceGridSelectAll(_ref26) {
564
568
  }
565
569
  };
566
570
  for (var i = 0; i < len; i++) {
567
- _loop(i);
571
+ _loop();
568
572
  }
569
573
  }
570
574
  if (state.showSuggestPanel) {
@@ -604,7 +608,9 @@ export var sourceGridSelectChange = function sourceGridSelectChange(_ref28) {
604
608
  };
605
609
  export var filterNode = function filterNode() {
606
610
  return function (value, data) {
607
- if (!value) return true;
611
+ if (!value) {
612
+ return true;
613
+ }
608
614
  return data.label.indexOf(value) !== -1;
609
615
  };
610
616
  };
@@ -758,7 +764,9 @@ export var doSuggesst = function doSuggesst(_ref37) {
758
764
  popper = _ref37.popper,
759
765
  api = _ref37.api;
760
766
  return function (event) {
761
- if (!props.suggest) return;
767
+ if (!props.suggest) {
768
+ return;
769
+ }
762
770
  var query = event;
763
771
  off(window, 'resize', api.updateSuggestWidth);
764
772
  off(document, 'click', api.closeSuggestPanel);
package/popover/index.js CHANGED
@@ -1,11 +1,41 @@
1
1
  import { on, off, addClass, removeClass } from '@opentiny/vue-renderless/common/deps/dom';
2
2
  import { guid } from '@opentiny/vue-renderless/common/string';
3
3
  import { KEY_CODE } from '@opentiny/vue-renderless/common';
4
- export var mounted = function mounted(_ref) {
4
+ var processTrigger = function processTrigger(_ref) {
5
5
  var api = _ref.api,
6
6
  state = _ref.state,
7
- constants = _ref.constants,
8
- props = _ref.props;
7
+ props = _ref.props,
8
+ nextTick = _ref.nextTick;
9
+ var referenceElm = state.referenceElm,
10
+ popperElm = state.popperElm;
11
+ if (props.trigger === 'click') {
12
+ on(referenceElm, 'click', api.doToggle);
13
+ on(document, 'click', api.handleDocumentClick);
14
+ } else if (props.trigger === 'hover') {
15
+ on(referenceElm, 'mouseenter', api.handleMouseEnter);
16
+ on(popperElm, 'mouseenter', api.handleMouseEnter);
17
+ on(referenceElm, 'mouseleave', api.handleMouseLeave);
18
+ on(popperElm, 'mouseleave', api.handleMouseLeave);
19
+ } else if (props.trigger === 'focus') {
20
+ if (referenceElm.querySelector('input, textarea')) {
21
+ on(referenceElm, 'focusin', api.doShow);
22
+ on(referenceElm, 'focusout', api.doClose);
23
+ } else {
24
+ on(referenceElm, 'mousedown', api.doShow);
25
+ on(referenceElm, 'mouseup', api.doClose);
26
+ }
27
+ } else if (props.trigger === 'manual') {
28
+ if (props.modelValue) {
29
+ nextTick(api.doShow);
30
+ }
31
+ }
32
+ };
33
+ export var mounted = function mounted(_ref2) {
34
+ var api = _ref2.api,
35
+ state = _ref2.state,
36
+ constants = _ref2.constants,
37
+ props = _ref2.props,
38
+ nextTick = _ref2.nextTick;
9
39
  return function () {
10
40
  state.mounted = true;
11
41
  var referenceElm = state.referenceElm,
@@ -31,23 +61,12 @@ export var mounted = function mounted(_ref) {
31
61
  on(referenceElm, 'keydown', api.handleKeydown);
32
62
  on(referenceElm, 'click', api.handleClick);
33
63
  }
34
- if (props.trigger === 'click') {
35
- on(referenceElm, 'click', api.doToggle);
36
- on(document, 'click', api.handleDocumentClick);
37
- } else if (props.trigger === 'hover') {
38
- on(referenceElm, 'mouseenter', api.handleMouseEnter);
39
- on(popperElm, 'mouseenter', api.handleMouseEnter);
40
- on(referenceElm, 'mouseleave', api.handleMouseLeave);
41
- on(popperElm, 'mouseleave', api.handleMouseLeave);
42
- } else if (props.trigger === 'focus') {
43
- if (referenceElm.querySelector('input, textarea')) {
44
- on(referenceElm, 'focusin', api.doShow);
45
- on(referenceElm, 'focusout', api.doClose);
46
- } else {
47
- on(referenceElm, 'mousedown', api.doShow);
48
- on(referenceElm, 'mouseup', api.doClose);
49
- }
50
- }
64
+ processTrigger({
65
+ api: api,
66
+ state: state,
67
+ props: props,
68
+ nextTick: nextTick
69
+ });
51
70
  };
52
71
  };
53
72
  export var doToggle = function doToggle(state) {
@@ -65,9 +84,9 @@ export var doClose = function doClose(state) {
65
84
  state.showPopper = false;
66
85
  };
67
86
  };
68
- export var handleFocus = function handleFocus(_ref2) {
69
- var props = _ref2.props,
70
- state = _ref2.state;
87
+ export var handleFocus = function handleFocus(_ref3) {
88
+ var props = _ref3.props,
89
+ state = _ref3.state;
71
90
  return function () {
72
91
  addClass(state.referenceElm, 'focusing');
73
92
  if (props.trigger === 'click' || props.trigger === 'focus') {
@@ -76,13 +95,17 @@ export var handleFocus = function handleFocus(_ref2) {
76
95
  };
77
96
  };
78
97
  export var handleClick = function handleClick(state) {
79
- return function () {
98
+ return function (event) {
99
+ var popperElm = state.popperElm;
100
+ if (event !== null && event !== void 0 && event.target && popperElm) {
101
+ popperElm.webCompEventTarget = event.target;
102
+ }
80
103
  removeClass(state.referenceElm, 'focusing');
81
104
  };
82
105
  };
83
- export var handleBlur = function handleBlur(_ref3) {
84
- var props = _ref3.props,
85
- state = _ref3.state;
106
+ export var handleBlur = function handleBlur(_ref4) {
107
+ var props = _ref4.props,
108
+ state = _ref4.state;
86
109
  return function () {
87
110
  removeClass(state.referenceElm, 'focusing');
88
111
  if (props.trigger === 'click' || props.trigger === 'focus') {
@@ -90,9 +113,9 @@ export var handleBlur = function handleBlur(_ref3) {
90
113
  }
91
114
  };
92
115
  };
93
- export var handleMouseEnter = function handleMouseEnter(_ref4) {
94
- var props = _ref4.props,
95
- state = _ref4.state;
116
+ export var handleMouseEnter = function handleMouseEnter(_ref5) {
117
+ var props = _ref5.props,
118
+ state = _ref5.state;
96
119
  return function () {
97
120
  clearTimeout(state.timer);
98
121
  if (props.openDelay) {
@@ -104,18 +127,18 @@ export var handleMouseEnter = function handleMouseEnter(_ref4) {
104
127
  }
105
128
  };
106
129
  };
107
- export var handleKeydown = function handleKeydown(_ref5) {
108
- var api = _ref5.api,
109
- props = _ref5.props;
130
+ export var handleKeydown = function handleKeydown(_ref6) {
131
+ var api = _ref6.api,
132
+ props = _ref6.props;
110
133
  return function (event) {
111
134
  if (event.keyCode === KEY_CODE.Escape && props.trigger !== 'manual') {
112
135
  api.doClose();
113
136
  }
114
137
  };
115
138
  };
116
- export var handleMouseLeave = function handleMouseLeave(_ref6) {
117
- var props = _ref6.props,
118
- state = _ref6.state;
139
+ export var handleMouseLeave = function handleMouseLeave(_ref7) {
140
+ var props = _ref7.props,
141
+ state = _ref7.state;
119
142
  return function () {
120
143
  clearTimeout(state.timer);
121
144
  if (props.closeDelay) {
@@ -127,14 +150,19 @@ export var handleMouseLeave = function handleMouseLeave(_ref6) {
127
150
  }
128
151
  };
129
152
  };
130
- export var handleDocumentClick = function handleDocumentClick(_ref7) {
131
- var refs = _ref7.refs,
132
- state = _ref7.state;
153
+ export var handleDocumentClick = function handleDocumentClick(_ref8) {
154
+ var refs = _ref8.refs,
155
+ state = _ref8.state;
133
156
  return function (event) {
157
+ var _target;
134
158
  var reference = state.referenceElm;
135
159
  var popperElm = state.popperElm;
136
160
  var $el = refs.root;
137
- if (!$el || !reference || $el.contains(event.target) || reference.contains(event.target) || !popperElm || popperElm.contains(event.target)) {
161
+ var target = event.target;
162
+ if ((_target = target) !== null && _target !== void 0 && _target.shadowRoot && popperElm) {
163
+ target = popperElm.webCompEventTarget;
164
+ }
165
+ if (!$el || !reference || $el.contains(target) || reference.contains(target) || !popperElm || popperElm.contains(target)) {
138
166
  return;
139
167
  }
140
168
  state.showPopper = false;
@@ -145,26 +173,31 @@ export var handleAfterEnter = function handleAfterEnter(emit) {
145
173
  emit('after-enter');
146
174
  };
147
175
  };
148
- export var handleAfterLeave = function handleAfterLeave(_ref8) {
149
- var emit = _ref8.emit,
150
- api = _ref8.api;
176
+ export var handleAfterLeave = function handleAfterLeave(emit) {
151
177
  return function () {
152
178
  emit('after-leave');
153
- api.doDestroy();
154
179
  };
155
180
  };
156
- export var cleanup = function cleanup(_ref9) {
157
- var props = _ref9.props,
181
+ export var handleItemClick = function handleItemClick(_ref9) {
182
+ var emit = _ref9.emit,
158
183
  state = _ref9.state;
184
+ return function (item) {
185
+ state.showPopper = false;
186
+ emit('item-click', item);
187
+ };
188
+ };
189
+ export var cleanup = function cleanup(_ref10) {
190
+ var props = _ref10.props,
191
+ state = _ref10.state;
159
192
  return function () {
160
193
  if (props.openDelay) {
161
194
  clearTimeout(state.timer);
162
195
  }
163
196
  };
164
197
  };
165
- export var destroyed = function destroyed(_ref10) {
166
- var state = _ref10.state,
167
- api = _ref10.api;
198
+ export var destroyed = function destroyed(_ref11) {
199
+ var state = _ref11.state,
200
+ api = _ref11.api;
168
201
  return function () {
169
202
  var reference = state.referenceElm;
170
203
  off(reference, 'click', api.doToggle);
@@ -184,11 +217,11 @@ export var computedTooltipId = function computedTooltipId(constants) {
184
217
  return "".concat(constants.IDPREFIX, "-").concat(guid('', 4));
185
218
  };
186
219
  };
187
- export var wrapMounted = function wrapMounted(_ref11) {
188
- var api = _ref11.api,
189
- props = _ref11.props,
190
- refs = _ref11.refs,
191
- state = _ref11.state;
220
+ export var wrapMounted = function wrapMounted(_ref12) {
221
+ var api = _ref12.api,
222
+ props = _ref12.props,
223
+ refs = _ref12.refs,
224
+ state = _ref12.state;
192
225
  return function () {
193
226
  var reference = refs.reference,
194
227
  popper = refs.popper,
package/popover/vue.js CHANGED
@@ -1,6 +1,6 @@
1
- import { mounted, computedTooltipId, destroyed, doToggle, doShow, doClose, handleFocus, handleClick, handleBlur, handleKeydown, handleAfterEnter, handleAfterLeave, handleMouseEnter, handleMouseLeave, handleDocumentClick, cleanup, wrapMounted } from './index';
1
+ import { mounted, computedTooltipId, destroyed, doToggle, doShow, doClose, handleFocus, handleClick, handleBlur, handleKeydown, handleAfterEnter, handleAfterLeave, handleMouseEnter, handleMouseLeave, handleDocumentClick, cleanup, wrapMounted, handleItemClick } from './index';
2
2
  import userPopper from '@opentiny/vue-renderless/common/deps/vue-popper';
3
- export var api = ['state', 'handleAfterEnter', 'handleAfterLeave'];
3
+ export var api = ['state', 'handleAfterEnter', 'handleAfterLeave', 'handleItemClick'];
4
4
  var initState = function initState(_ref) {
5
5
  var reactive = _ref.reactive,
6
6
  computed = _ref.computed,
@@ -27,14 +27,16 @@ var initApi = function initApi(_ref2) {
27
27
  refs = _ref2.refs,
28
28
  emit = _ref2.emit,
29
29
  doDestroy = _ref2.doDestroy,
30
- constants = _ref2.constants;
30
+ constants = _ref2.constants,
31
+ nextTick = _ref2.nextTick;
31
32
  Object.assign(api, {
32
33
  state: state,
33
34
  mounted: mounted({
34
35
  api: api,
35
36
  state: state,
36
37
  constants: constants,
37
- props: props
38
+ props: props,
39
+ nextTick: nextTick
38
40
  }),
39
41
  cleanup: cleanup({
40
42
  state: state,
@@ -67,10 +69,7 @@ var initApi = function initApi(_ref2) {
67
69
  props: props,
68
70
  state: state
69
71
  }),
70
- handleAfterLeave: handleAfterLeave({
71
- emit: emit,
72
- api: api
73
- }),
72
+ handleAfterLeave: handleAfterLeave(emit),
74
73
  handleMouseEnter: handleMouseEnter({
75
74
  props: props,
76
75
  state: state
@@ -84,6 +83,10 @@ var initApi = function initApi(_ref2) {
84
83
  props: props,
85
84
  refs: refs,
86
85
  state: state
86
+ }),
87
+ handleItemClick: handleItemClick({
88
+ emit: emit,
89
+ state: state
87
90
  })
88
91
  });
89
92
  };
@@ -154,7 +157,8 @@ export var renderless = function renderless(props, _ref4, _ref5) {
154
157
  state: state,
155
158
  refs: refs,
156
159
  emit: emit,
157
- doDestroy: doDestroy
160
+ doDestroy: doDestroy,
161
+ nextTick: nextTick
158
162
  });
159
163
  onDeactivated(function () {
160
164
  api.destroyed();
package/rate/index.js CHANGED
@@ -167,8 +167,8 @@ export var computedText = function computedText(_ref9) {
167
167
  state = _ref9.state;
168
168
  var result = '';
169
169
  var currentValue = 0;
170
- if (!isNaN(+state.currentValue)) {
171
- currentValue = +state.currentValue > 0 ? +state.currentValue : 0;
170
+ if (!isNaN(Number(state.currentValue))) {
171
+ currentValue = Number(state.currentValue) > 0 ? Number(state.currentValue) : 0;
172
172
  }
173
173
  if (currentValue > props.texts.length) {
174
174
  currentValue = props.texts.length;
@@ -0,0 +1,77 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
8
+ var selectors = [];
9
+ var doms = [];
10
+ var scrolls = [];
11
+ function backup() {
12
+ doms.push(window);
13
+ scrolls.push({
14
+ left: window.pageXOffset,
15
+ top: window.pageYOffset
16
+ });
17
+ selectors.forEach(function (selector) {
18
+ var dom = document.querySelector(".".concat(selector));
19
+ if (dom) {
20
+ doms.push(dom);
21
+ scrolls.push({
22
+ left: dom.scrollLeft,
23
+ top: dom.scrollTop
24
+ });
25
+ }
26
+ });
27
+ }
28
+ function restore() {
29
+ doms.forEach(function (dom, i) {
30
+ return dom.scrollTo(scrolls[i]);
31
+ });
32
+ doms = [];
33
+ scrolls = [];
34
+ }
35
+ function registerCustomClipboard(Quill, keepClass) {
36
+ var Clipboard = Quill["import"]('modules/clipboard');
37
+ var Delta = Quill["import"]('delta');
38
+ if (typeof keepClass === 'string') {
39
+ selectors.push(keepClass);
40
+ } else if (Array.isArray(keepClass)) {
41
+ selectors = keepClass.slice(0);
42
+ }
43
+ var CustomClipboard = function (_Clipboard) {
44
+ _inherits(CustomClipboard, _Clipboard);
45
+ var _super = _createSuper(CustomClipboard);
46
+ function CustomClipboard() {
47
+ _classCallCheck(this, CustomClipboard);
48
+ return _super.apply(this, arguments);
49
+ }
50
+ _createClass(CustomClipboard, [{
51
+ key: "onPaste",
52
+ value: function onPaste(e) {
53
+ var _this = this;
54
+ backup();
55
+ if (e.defaultPrevented || !this.quill.isEnabled()) {
56
+ return;
57
+ }
58
+ var range = this.quill.getSelection();
59
+ var delta = new Delta().retain(range.index);
60
+ var scrollTop = this.quill.scrollingContainer.scrollTop;
61
+ this.container.focus();
62
+ this.quill.selection.update(Quill.sources.SILENT);
63
+ setTimeout(function () {
64
+ delta = delta.concat(_this.convert())["delete"](range.length);
65
+ _this.quill.updateContents(delta, Quill.sources.USER);
66
+ _this.quill.setSelection(delta.length() - range.length, Quill.sources.SILENT);
67
+ _this.quill.scrollingContainer.scrollTop = scrollTop;
68
+ _this.quill.focus();
69
+ restore();
70
+ }, 1);
71
+ }
72
+ }]);
73
+ return CustomClipboard;
74
+ }(Clipboard);
75
+ Quill.register('modules/clipboard', CustomClipboard, true);
76
+ }
77
+ export default registerCustomClipboard;