@king-design/react 3.0.0-beta.0 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/__tests__/__snapshots__/Dialog.md +1 -1
  2. package/__tests__/__snapshots__/React Demos.md +468 -309
  3. package/__tests__/components/cascader.spec.tsx +53 -0
  4. package/__tests__/components/drawer.spec.tsx +67 -5
  5. package/components/button/index.d.ts +1 -1
  6. package/components/button/index.js +1 -1
  7. package/components/button/styles.d.ts +1 -1
  8. package/components/button/styles.js +3 -5
  9. package/components/carousel/index.vdt.js +2 -2
  10. package/components/cascader/index.d.ts +22 -11
  11. package/components/cascader/index.js +9 -12
  12. package/components/cascader/index.spec.js +81 -0
  13. package/components/cascader/index.vdt.js +11 -9
  14. package/components/cascader/styles.js +1 -1
  15. package/components/cascader/useFields.d.ts +2 -0
  16. package/components/cascader/useFields.js +18 -0
  17. package/components/cascader/useFilterable.d.ts +2 -1
  18. package/components/cascader/useFilterable.js +17 -6
  19. package/components/cascader/useLabel.d.ts +2 -1
  20. package/components/cascader/useLabel.js +4 -4
  21. package/components/cascader/useLoad.d.ts +2 -1
  22. package/components/cascader/useLoad.js +9 -7
  23. package/components/collapse/item.vdt.js +1 -1
  24. package/components/colorpicker/index.d.ts +2 -0
  25. package/components/colorpicker/index.js +7 -2
  26. package/components/colorpicker/index.vdt.js +3 -6
  27. package/components/copy/index.d.ts +17 -0
  28. package/components/copy/index.js +43 -0
  29. package/components/copy/index.spec.d.ts +1 -0
  30. package/components/copy/index.spec.js +52 -0
  31. package/components/copy/index.vdt.js +45 -0
  32. package/components/copy/styles.d.ts +2 -0
  33. package/components/copy/styles.js +14 -0
  34. package/components/copy/useCopy.d.ts +4 -0
  35. package/components/copy/useCopy.js +90 -0
  36. package/components/datepicker/calendar.vdt.js +6 -6
  37. package/components/datepicker/index.spec.js +171 -153
  38. package/components/datepicker/index.vdt.js +1 -1
  39. package/components/datepicker/styles.js +1 -1
  40. package/components/datepicker/useValue.d.ts +3 -3
  41. package/components/datepicker/useValue.js +38 -9
  42. package/components/diagram/shapes/callout.d.ts +1 -1
  43. package/components/diagram/shapes/circle.d.ts +1 -1
  44. package/components/diagram/shapes/document.d.ts +1 -1
  45. package/components/diagram/shapes/ellipse.d.ts +1 -1
  46. package/components/diagram/shapes/hexagon.d.ts +1 -1
  47. package/components/diagram/shapes/image.d.ts +1 -1
  48. package/components/diagram/shapes/parallelogram.d.ts +1 -1
  49. package/components/diagram/shapes/rectangle.d.ts +1 -1
  50. package/components/diagram/shapes/square.d.ts +1 -1
  51. package/components/diagram/shapes/text.d.ts +1 -1
  52. package/components/dialog/alert.vdt.js +6 -5
  53. package/components/dialog/index.spec.js +6 -6
  54. package/components/dialog/styles.js +1 -1
  55. package/components/dropdown/dropdown.d.ts +6 -6
  56. package/components/dropdown/dropdown.js +58 -75
  57. package/components/dropdown/index.spec.js +96 -17
  58. package/components/dropdown/item.d.ts +1 -1
  59. package/components/dropdown/item.js +19 -7
  60. package/components/dropdown/menu.js +1 -1
  61. package/components/dropdown/usePosition.js +11 -2
  62. package/components/editable/index.d.ts +1 -0
  63. package/components/editable/index.js +20 -6
  64. package/components/editable/index.vdt.js +2 -1
  65. package/components/form/index.spec.js +4 -2
  66. package/components/form/item.vdt.js +2 -1
  67. package/components/form/styles.js +4 -4
  68. package/components/grid/useGutter.js +8 -8
  69. package/components/icon/styles.js +1 -1
  70. package/components/input/index.d.ts +13 -2
  71. package/components/input/index.js +16 -13
  72. package/components/input/index.spec.js +169 -1
  73. package/components/input/index.vdt.js +44 -12
  74. package/components/input/search.vdt.js +2 -4
  75. package/components/input/styles.js +30 -6
  76. package/components/input/useAutoRows.d.ts +2 -0
  77. package/components/input/useAutoRows.js +79 -0
  78. package/components/input/useAutoWidth.js +13 -3
  79. package/components/input/useFocus.d.ts +4 -0
  80. package/components/input/useFocus.js +21 -0
  81. package/components/input/useShowPassword.d.ts +7 -0
  82. package/components/input/useShowPassword.js +31 -0
  83. package/components/menu/index.spec.js +26 -15
  84. package/components/menu/item.d.ts +2 -0
  85. package/components/menu/item.js +5 -0
  86. package/components/menu/item.vdt.js +4 -1
  87. package/components/pagination/index.d.ts +1 -1
  88. package/components/pagination/index.js +3 -2
  89. package/components/pagination/index.spec.js +49 -0
  90. package/components/pagination/index.vdt.js +10 -12
  91. package/components/pagination/styles.js +1 -1
  92. package/components/popover/content.d.ts +19 -0
  93. package/components/popover/content.js +31 -0
  94. package/components/popover/content.vdt.js +68 -0
  95. package/components/popover/index.d.ts +16 -0
  96. package/components/popover/index.js +44 -0
  97. package/components/popover/index.spec.d.ts +1 -0
  98. package/components/popover/index.spec.js +195 -0
  99. package/components/popover/styles.d.ts +1 -0
  100. package/components/popover/styles.js +22 -0
  101. package/components/portal.d.ts +6 -2
  102. package/components/portal.js +4 -3
  103. package/components/position.js +2 -1
  104. package/components/progress/index.js +1 -1
  105. package/components/progress/index.vdt.js +46 -8
  106. package/components/progress/styles.js +19 -13
  107. package/components/rate/styles.js +1 -1
  108. package/components/select/base.d.ts +7 -3
  109. package/components/select/base.js +9 -3
  110. package/components/select/base.vdt.js +75 -47
  111. package/components/select/index.spec.js +25 -13
  112. package/components/select/menu.vdt.js +6 -6
  113. package/components/select/option.vdt.js +2 -1
  114. package/components/select/styles.js +11 -5
  115. package/components/select/useDraggble.d.ts +2 -0
  116. package/components/select/useDraggble.js +11 -0
  117. package/components/slider/index.spec.js +48 -9
  118. package/components/slider/index.vdt.js +23 -12
  119. package/components/slider/styles.js +23 -14
  120. package/components/slider/useValue.d.ts +3 -1
  121. package/components/slider/useValue.js +12 -0
  122. package/components/spinner/index.d.ts +0 -1
  123. package/components/spinner/index.js +1 -19
  124. package/components/spinner/index.vdt.js +13 -8
  125. package/components/spinner/styles.js +2 -2
  126. package/components/spinner/useChange.d.ts +1 -1
  127. package/components/spinner/useChange.js +2 -2
  128. package/components/spinner/useValue.d.ts +1 -0
  129. package/components/spinner/useValue.js +16 -1
  130. package/components/split/index.vdt.js +32 -20
  131. package/components/split/memo.d.ts +9 -0
  132. package/components/split/memo.js +26 -0
  133. package/components/steps/index.d.ts +1 -0
  134. package/components/steps/index.js +2 -1
  135. package/components/steps/index.spec.js +1 -1
  136. package/components/steps/index.vdt.js +7 -4
  137. package/components/steps/step.vdt.js +2 -3
  138. package/components/steps/styles.d.ts +1 -0
  139. package/components/steps/styles.js +50 -17
  140. package/components/switch/index.spec.js +82 -65
  141. package/components/table/cell.js +1 -6
  142. package/components/table/cell.vdt.js +1 -1
  143. package/components/table/column.vdt.js +40 -24
  144. package/components/table/index.spec.js +162 -20
  145. package/components/table/row.d.ts +1 -1
  146. package/components/table/row.js +2 -1
  147. package/components/table/styles.js +16 -9
  148. package/components/table/table.d.ts +15 -0
  149. package/components/table/table.js +16 -7
  150. package/components/table/table.vdt.js +20 -6
  151. package/components/table/useChecked.d.ts +3 -2
  152. package/components/table/useChecked.js +23 -12
  153. package/components/table/useDisableRow.d.ts +2 -1
  154. package/components/table/useDisableRow.js +4 -4
  155. package/components/table/useDraggable.d.ts +3 -2
  156. package/components/table/useDraggable.js +11 -15
  157. package/components/table/useGroup.d.ts +9 -3
  158. package/components/table/useGroup.js +48 -37
  159. package/components/table/useMerge.d.ts +2 -1
  160. package/components/table/useMerge.js +5 -4
  161. package/components/table/usePagination.d.ts +8 -0
  162. package/components/table/usePagination.js +81 -0
  163. package/components/table/useStickyScrollbar.js +2 -2
  164. package/components/table/useTree.d.ts +2 -1
  165. package/components/table/useTree.js +3 -4
  166. package/components/table/useWidth.js +2 -2
  167. package/components/tabs/index.d.ts +1 -1
  168. package/components/tabs/index.js +1 -1
  169. package/components/tabs/index.spec.js +67 -0
  170. package/components/tabs/index.vdt.js +9 -4
  171. package/components/tabs/styles.js +32 -34
  172. package/components/tabs/useScroll.d.ts +1 -1
  173. package/components/tabs/useScroll.js +75 -48
  174. package/components/tag/base.d.ts +1 -0
  175. package/components/tag/base.js +1 -1
  176. package/components/tag/index.d.ts +1 -0
  177. package/components/tag/index.js +2 -1
  178. package/components/tag/index.spec.js +147 -4
  179. package/components/tag/styles.d.ts +67 -0
  180. package/components/tag/styles.js +33 -8
  181. package/components/tag/tags.d.ts +27 -0
  182. package/components/tag/tags.js +51 -0
  183. package/components/tag/tags.vdt.js +91 -0
  184. package/components/tag/useChildren.d.ts +2 -0
  185. package/components/tag/useChildren.js +39 -0
  186. package/components/tag/useDraggable.d.ts +3 -0
  187. package/components/tag/useDraggable.js +89 -0
  188. package/components/tag/useNowrap.d.ts +7 -0
  189. package/components/tag/useNowrap.js +115 -0
  190. package/components/timepicker/index.spec.js +1 -1
  191. package/components/tooltip/content.d.ts +3 -2
  192. package/components/tooltip/content.js +18 -1
  193. package/components/tooltip/content.vdt.js +22 -10
  194. package/components/tooltip/index.spec.js +147 -92
  195. package/components/tooltip/styles.d.ts +23 -0
  196. package/components/tooltip/styles.js +2 -2
  197. package/components/tooltip/tooltip.d.ts +1 -1
  198. package/components/tooltip/tooltip.js +11 -11
  199. package/components/transfer/index.vdt.js +14 -3
  200. package/components/types.d.ts +1 -0
  201. package/components/upload/index.spec.js +5 -6
  202. package/components/upload/index.vdt.js +7 -5
  203. package/components/utils.d.ts +2 -0
  204. package/components/utils.js +24 -3
  205. package/components/virtual.d.ts +8 -0
  206. package/components/virtual.js +126 -0
  207. package/hooks/useResizeObserver.d.ts +1 -1
  208. package/hooks/useResizeObserver.js +19 -6
  209. package/i18n/en-US.d.ts +4 -1
  210. package/i18n/en-US.js +6 -2
  211. package/index.d.ts +5 -3
  212. package/index.js +5 -3
  213. package/package.json +2 -2
  214. package/styles/fonts/iconfont.eot +0 -0
  215. package/styles/fonts/iconfont.js +2 -2
  216. package/styles/fonts/iconfont.svg +35 -35
  217. package/styles/fonts/iconfont.ttf +0 -0
  218. package/styles/fonts/iconfont.woff +0 -0
  219. package/styles/fonts/ionicons.js +3 -3
  220. package/styles/global.js +1 -1
  221. package/yarn-error.log +41 -43
  222. package/components/table/useResizeObserver.d.ts +0 -2
  223. package/components/table/useResizeObserver.js +0 -20
@@ -4,6 +4,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
4
4
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
5
5
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
6
6
  import { Component } from 'intact-react';
7
+ import BasicDemo from '~/components/menu/demos/basic';
7
8
  import CollapseDemo from '~/components/menu/demos/collapse';
8
9
  import AccordionDemo from '~/components/menu/demos/accordion';
9
10
  import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
@@ -19,24 +20,29 @@ describe('Menu', function () {
19
20
  while (1) {
20
21
  switch (_context.prev = _context.next) {
21
22
  case 0:
22
- _mount = mount(CollapseDemo), instance = _mount[0], element = _mount[1];
23
+ _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
24
+ _context.next = 3;
25
+ return wait();
26
+
27
+ case 3:
28
+ // shrink
23
29
  title = element.querySelector('.k-expanded .k-menu-title');
24
30
  title.click();
25
- _context.next = 5;
31
+ _context.next = 7;
26
32
  return wait(500);
27
33
 
28
- case 5:
34
+ case 7:
29
35
  expect(element.outerHTML).to.matchSnapshot();
30
36
  expect(instance.get('expandedKeys')).to.eql([]);
31
37
  title.click();
32
- _context.next = 10;
38
+ _context.next = 12;
33
39
  return wait(500);
34
40
 
35
- case 10:
41
+ case 12:
36
42
  expect(element.outerHTML).to.matchSnapshot();
37
43
  expect(instance.get('expandedKeys')).to.eql(['3']);
38
44
 
39
- case 12:
45
+ case 14:
40
46
  case "end":
41
47
  return _context.stop();
42
48
  }
@@ -51,39 +57,44 @@ describe('Menu', function () {
51
57
  switch (_context2.prev = _context2.next) {
52
58
  case 0:
53
59
  _mount2 = mount(CollapseDemo), instance = _mount2[0], element = _mount2[1];
60
+ instance.set('collapse', false);
61
+ _context2.next = 4;
62
+ return wait();
63
+
64
+ case 4:
54
65
  expect(element.innerHTML).to.matchSnapshot();
55
66
  _element$querySelecto = element.querySelectorAll('.k-menu-title'), title = _element$querySelecto[0], disabledTitle = _element$querySelecto[1];
56
67
  title.click();
57
- _context2.next = 6;
68
+ _context2.next = 9;
58
69
  return wait();
59
70
 
60
- case 6:
71
+ case 9:
61
72
  expect(element.outerHTML).to.matchSnapshot();
62
73
  expect(instance.get('selectedKey')).to.eql('1');
63
74
  disabledTitle.click();
64
- _context2.next = 11;
75
+ _context2.next = 14;
65
76
  return wait();
66
77
 
67
- case 11:
78
+ case 14:
68
79
  expect(element.outerHTML).to.matchSnapshot();
69
80
  expect(instance.get('selectedKey')).to.eql('1');
70
81
  subTitle = element.querySelector('.k-expanded .k-menu .k-menu-title');
71
82
  subTitle.click();
72
- _context2.next = 17;
83
+ _context2.next = 20;
73
84
  return wait();
74
85
 
75
- case 17:
86
+ case 20:
76
87
  expect(element.outerHTML).to.matchSnapshot();
77
88
  expect(instance.get('selectedKey')).to.eql('3-1'); // clear
78
89
 
79
90
  instance.set('selectedKey', '');
80
- _context2.next = 22;
91
+ _context2.next = 25;
81
92
  return wait();
82
93
 
83
- case 22:
94
+ case 25:
84
95
  expect(element.querySelector('.k-highlighted')).to.be.null;
85
96
 
86
- case 23:
97
+ case 26:
87
98
  case "end":
88
99
  return _context2.stop();
89
100
  }
@@ -1,5 +1,6 @@
1
1
  import { Component, TypeDefs, Key } from 'intact-react';
2
2
  import { Menu } from './menu';
3
+ import { Events } from '../types';
3
4
  export interface MenuItemProps {
4
5
  key: Key;
5
6
  to?: string | object;
@@ -14,6 +15,7 @@ export declare const MENU_ITEM = "MenuItem";
14
15
  export declare class MenuItem extends Component<MenuItemProps, MenuItemEvents> {
15
16
  static template: string | import("intact").Template<any>;
16
17
  static typeDefs: Required<TypeDefs<MenuItemProps>>;
18
+ static events: Events<MenuItemEvents>;
17
19
  rootMenu: Menu<Key>;
18
20
  parentMenu: Menu<Key>;
19
21
  parentMenuItem: MenuItem | null;
@@ -19,6 +19,10 @@ var typeDefs = {
19
19
  dot: Boolean,
20
20
  disabled: Boolean
21
21
  };
22
+ var events = {
23
+ click: true,
24
+ select: true
25
+ };
22
26
  export var MENU_ITEM = 'MenuItem';
23
27
  export var MenuItem = /*#__PURE__*/function (_Component) {
24
28
  _inheritsLoose(MenuItem, _Component);
@@ -76,5 +80,6 @@ export var MenuItem = /*#__PURE__*/function (_Component) {
76
80
  }(Component);
77
81
  MenuItem.template = template;
78
82
  MenuItem.typeDefs = typeDefs;
83
+ MenuItem.events = events;
79
84
 
80
85
  __decorate([bind], MenuItem.prototype, "onClick", null);
@@ -11,6 +11,9 @@ import { makeItemStyles, makeTitleStyles } from './styles';
11
11
  var _$tmp0 = {
12
12
  'className': 'k-menu-dot ion-record'
13
13
  };
14
+ var _$tmp1 = {
15
+ 'className': 'k-menu-arrow k-icon-down'
16
+ };
14
17
  export default function ($props, $blocks, $__proto__) {
15
18
  var _classNameObj,
16
19
  _this = this;
@@ -56,7 +59,7 @@ export default function ($props, $blocks, $__proto__) {
56
59
  var title = function title(children) {
57
60
  var _$cn2;
58
61
 
59
- return _$ce(2, 'div', [showDot ? _$cc(Icon, _$tmp0) : undefined, _$ce(2, 'div', children, 0, 'k-menu-name'), subMenuVNode ? _$ce(2, 'i', null, 1, 'k-menu-arrow ion-ios-arrow-down') : undefined], 0, _$cn((_$cn2 = {
62
+ return _$ce(2, 'div', [showDot ? _$cc(Icon, _$tmp0) : undefined, _$ce(2, 'div', children, 0, 'k-menu-name'), subMenuVNode ? _$cc(Icon, _$tmp1) : undefined], 0, _$cn((_$cn2 = {
60
63
  'k-menu-title': true
61
64
  }, _$cn2[makeTitleStyles()] = true, _$cn2)), {
62
65
  'ev-click': _this.onClick.bind(_this, subMenuVNode)
@@ -8,7 +8,7 @@ export interface PaginationProps {
8
8
  value?: number;
9
9
  limit?: number;
10
10
  limits?: number[];
11
- noBorder?: boolean;
11
+ flat?: boolean;
12
12
  simple?: boolean;
13
13
  showTotal?: boolean;
14
14
  showGoto?: boolean;
@@ -12,7 +12,7 @@ var typeDefs = {
12
12
  value: Number,
13
13
  limit: Number,
14
14
  limits: Array,
15
- noBorder: Boolean,
15
+ flat: Boolean,
16
16
  simple: Boolean,
17
17
  showTotal: Boolean,
18
18
  showGoto: Boolean,
@@ -105,7 +105,8 @@ export var Pagination = /*#__PURE__*/function (_Component) {
105
105
 
106
106
  if (page > totalPages) {
107
107
  page = totalPages;
108
- }
108
+ } // perhaps totalPages is 0
109
+
109
110
 
110
111
  if (page < 1) {
111
112
  page = 1;
@@ -1,10 +1,14 @@
1
+ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
1
2
  import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
3
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
2
4
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
3
5
  import BasicDemo from '~/components/pagination/demos/basic';
4
6
  import GotoDemo from '~/components/pagination/demos/goto';
5
7
  import CurrentDemo from '~/components/pagination/demos/current';
6
8
  import DisableDemo from '~/components/pagination/demos/disable';
7
9
  import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
10
+ import { Component } from 'intact-react';
11
+ import { Pagination } from '.';
8
12
  describe('Pagination', function () {
9
13
  afterEach(function () {
10
14
  return unmount();
@@ -169,4 +173,49 @@ describe('Pagination', function () {
169
173
  }
170
174
  }, _callee4);
171
175
  })));
176
+ it('should not set value to 0 when total is 0 on intialization', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
177
+ var Demo, _mount5, instance;
178
+
179
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
180
+ while (1) {
181
+ switch (_context6.prev = _context6.next) {
182
+ case 0:
183
+ Demo = /*#__PURE__*/function (_Component) {
184
+ _inheritsLoose(Demo, _Component);
185
+
186
+ function Demo() {
187
+ var _context5;
188
+
189
+ var _this;
190
+
191
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
192
+ args[_key] = arguments[_key];
193
+ }
194
+
195
+ _this = _Component.call.apply(_Component, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
196
+ _this.Pagination = Pagination;
197
+ return _this;
198
+ }
199
+
200
+ Demo.defaults = function defaults() {
201
+ return {
202
+ page: 1
203
+ };
204
+ };
205
+
206
+ return Demo;
207
+ }(Component);
208
+
209
+ Demo.template = "\n const { Pagination } = this;\n <Pagination total={0} v-model=\"page\" />\n ";
210
+ _mount5 = mount(Demo), instance = _mount5[0]; // await wait();
211
+
212
+ expect(instance.get('page')).to.eql(1);
213
+
214
+ case 4:
215
+ case "end":
216
+ return _context6.stop();
217
+ }
218
+ }
219
+ }, _callee5);
220
+ })));
172
221
  });
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import _flatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/flat";
2
3
  import { createCommentVNode as _$ccv, createUnknownComponentVNode as _$cc, createElementVNode as _$ce, createTextVNode as _$ct, createVNode as _$cv, className as _$cn, map as _$ma } from 'intact-react';
3
4
  import { getRestProps, mapChildren } from '../utils';
4
5
  import { ButtonGroup, Button } from '../button';
@@ -8,10 +9,10 @@ import { Icon } from '../icon';
8
9
  import { _$ } from '../../i18n';
9
10
  import { makeStyles } from './styles';
10
11
  var _$tmp0 = {
11
- 'className': 'k-icon-arrow-left'
12
+ 'className': 'k-icon-left'
12
13
  };
13
14
  var _$tmp1 = {
14
- 'className': 'k-icon-arrow-right'
15
+ 'className': 'k-icon-right'
15
16
  };
16
17
  export default function ($props, $blocks, $__proto__) {
17
18
  var _classNameObj;
@@ -23,7 +24,7 @@ export default function ($props, $blocks, $__proto__) {
23
24
  var _this$get = this.get(),
24
25
  total = _this$get.total,
25
26
  size = _this$get.size,
26
- noBorder = _this$get.noBorder,
27
+ flat = _flatInstanceProperty(_this$get),
27
28
  simple = _this$get.simple,
28
29
  className = _this$get.className,
29
30
  showTotal = _this$get.showTotal,
@@ -39,13 +40,8 @@ export default function ($props, $blocks, $__proto__) {
39
40
  if (!total) return _$ccv(' pagination ');
40
41
  var classNameObj = (_classNameObj = {
41
42
  'k-pagination': true
42
- }, _classNameObj[className] = className, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-no-border'] = noBorder, _classNameObj['k-simple'] = simple, _classNameObj[makeStyles()] = true, _classNameObj);
43
- var type = 'default';
44
-
45
- if (noBorder || simple) {
46
- type = 'none';
47
- }
48
-
43
+ }, _classNameObj[className] = className, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-flat'] = flat, _classNameObj['k-simple'] = simple, _classNameObj[makeStyles()] = true, _classNameObj);
44
+ var type = flat ? 'flat' : simple ? 'none' : 'default';
49
45
  var totalPages = Math.ceil(total / limit) || 0;
50
46
 
51
47
  var paginationButton = function paginationButton(page) {
@@ -165,6 +161,7 @@ export default function ($props, $blocks, $__proto__) {
165
161
  'value': $this.get('value')
166
162
  }), !simple ? [showLimits ? _$ce(2, 'div', _$cc(Select, {
167
163
  'size': size,
164
+ 'flat': flat,
168
165
  'children': _$ma(limits, function ($value, $key) {
169
166
  return _$cc(Option, {
170
167
  'value': $value,
@@ -177,10 +174,11 @@ export default function ($props, $blocks, $__proto__) {
177
174
  $this.set('limit', $v);
178
175
  },
179
176
  'value': $this.get('limit')
180
- }), 2, 'k-pagination-limits') : undefined, showGoto ? _$ce(2, 'div', [_$ce(2, 'span', _$('跳至'), 0, 'c-middle'), _$cc(Input, {
177
+ }), 2, 'k-pagination-limits') : undefined, showGoto ? _$ce(2, 'div', [_$ce(2, 'span', _$('前往'), 0, 'c-middle'), _$cc(Input, {
181
178
  'size': size,
182
179
  'value': value,
183
- 'ev-change': this.goto
180
+ 'ev-change': this.goto,
181
+ 'flat': flat
184
182
  }), _$ce(2, 'span', _$('页'), 0, 'c-middle')], 4, 'k-pagination-goto') : undefined] : undefined]);
185
183
  }
186
184
  ;
@@ -68,5 +68,5 @@ export function makeStyles() {
68
68
  var styles = pagination[size];
69
69
  var btnStyles = button[size];
70
70
  return /*#__PURE__*/css("&.k-", size, "{font-size:", styles.fontSize, ";.k-btn{margin-right:", styles.btnGap, ";min-width:", btnStyles.height, ";.k-icon{font-size:", styles.iconFontSize, ";}}}");
71
- }), "&.k-no-border{.k-select{&,&:hover,&.k-show{border-color:transparent;}}}&.k-simple{.k-btn{margin:0;}.k-input-inner{text-align:center;}.k-pagination-text{vertical-align:middle;}}");
71
+ }), "&.k-flat{.k-select{&,&:hover,&.k-show{border-color:transparent;}}}&.k-simple{.k-btn{margin:0;}.k-input-inner{text-align:center;}.k-pagination-text{vertical-align:middle;}}");
72
72
  }
@@ -0,0 +1,19 @@
1
+ import { TooltipContent, TooltipContentProps, TooltipContentEvents, TooltipContentBlocks } from "../tooltip/content";
2
+ import { TypeDefs, Children } from 'intact-react';
3
+ export interface PopoverContentProps extends TooltipContentProps {
4
+ type?: 'info' | 'success' | 'warning' | 'error';
5
+ title?: Children;
6
+ content?: Children;
7
+ }
8
+ export interface PopoverContentEvents extends TooltipContentEvents {
9
+ }
10
+ export interface PopoverContentBlocks extends TooltipContentBlocks {
11
+ title: null;
12
+ content: null;
13
+ footer: null;
14
+ }
15
+ export declare class PopoverContent extends TooltipContent<PopoverContentProps, PopoverContentEvents, PopoverContentBlocks> {
16
+ static template: string | import("intact").Template<any>;
17
+ static typeDefs: Required<TypeDefs<PopoverContentProps>>;
18
+ protected isEmptyChildren: boolean;
19
+ }
@@ -0,0 +1,31 @@
1
+ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
+ import { TooltipContent } from "../tooltip/content";
4
+ import { VNode } from 'intact-react';
5
+ import template from "./content.vdt";
6
+ var typeDefs = {
7
+ type: ['info', 'error', 'success', 'warning'],
8
+ title: [String, Number, VNode, Array],
9
+ content: [String, Number, VNode, Array]
10
+ };
11
+ export var PopoverContent = /*#__PURE__*/function (_TooltipContent) {
12
+ _inheritsLoose(PopoverContent, _TooltipContent);
13
+
14
+ function PopoverContent() {
15
+ var _context;
16
+
17
+ var _this;
18
+
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+
23
+ _this = _TooltipContent.call.apply(_TooltipContent, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
24
+ _this.isEmptyChildren = false;
25
+ return _this;
26
+ }
27
+
28
+ return PopoverContent;
29
+ }(TooltipContent);
30
+ PopoverContent.template = template;
31
+ PopoverContent.typeDefs = typeDefs;
@@ -0,0 +1,68 @@
1
+ import { superCall as _$su, className as _$cn, extend as _$ex, EMPTY_OBJ as _$em, createElementVNode as _$ce, createUnknownComponentVNode as _$cc, noop as _$no } from 'intact-react';
2
+ import { Icon } from '../icon';
3
+ import makeStyles from "./styles";
4
+ export default function ($props, $blocks, $__proto__) {
5
+ var _classNameObj;
6
+
7
+ $blocks || ($blocks = {});
8
+ $props || ($props = {});
9
+ var $this = this;
10
+ var _$blocks = {};
11
+ var __$blocks = {};
12
+
13
+ var _this$get = this.get(),
14
+ type = _this$get.type,
15
+ title = _this$get.title,
16
+ content = _this$get.content;
17
+
18
+ var iconMap = {
19
+ info: 'information-fill',
20
+ warning: 'warning-fill',
21
+ success: 'success-fill',
22
+ error: 'error-fill'
23
+ };
24
+ var classNameObj = (_classNameObj = {}, _classNameObj[makeStyles()] = true, _classNameObj['k-popover'] = true, _classNameObj);
25
+ return _$su.call($this, {
26
+ 'className': _$cn(classNameObj)
27
+ }, function ($blocks) {
28
+ var _$blocks = {},
29
+ __$blocks = _$ex({}, $blocks);
30
+
31
+ return (_$blocks['body'] = function ($super) {
32
+ return [title || $blocks.title ? _$ce(2, 'div', [type ? _$cc(Icon, {
33
+ 'className': _$cn("k-icon-" + iconMap[type] + " k-popover-icon"),
34
+ 'color': type === 'error' ? 'danger' : type,
35
+ 'size': 'large'
36
+ }) : undefined, (_$blocks['title'] = function ($super) {
37
+ return title;
38
+ }, __$blocks['title'] = function ($super, data) {
39
+ var block = $blocks['title'];
40
+
41
+ var callBlock = function callBlock() {
42
+ return _$blocks['title'].call($this, $super, data);
43
+ };
44
+
45
+ return block ? block.call($this, callBlock, data) : callBlock();
46
+ }, __$blocks['title'](_$no))], 0, 'k-popover-title') : undefined, content || $blocks.content ? _$ce(2, 'div', (_$blocks['content'] = function ($super) {
47
+ return content;
48
+ }, __$blocks['content'] = function ($super, data) {
49
+ var block = $blocks['content'];
50
+
51
+ var callBlock = function callBlock() {
52
+ return _$blocks['content'].call($this, $super, data);
53
+ };
54
+
55
+ return block ? block.call($this, callBlock, data) : callBlock();
56
+ }, __$blocks['content'](_$no)), 0, 'k-popover-content') : undefined];
57
+ }, __$blocks['body'] = function ($super, data) {
58
+ var block = $blocks['body'];
59
+
60
+ var callBlock = function callBlock() {
61
+ return _$blocks['body'].call($this, $super, data);
62
+ };
63
+
64
+ return block ? block.call($this, callBlock, data) : callBlock();
65
+ }), __$blocks;
66
+ }.call($this, $blocks), $__proto__);
67
+ }
68
+ ;
@@ -0,0 +1,16 @@
1
+ import { Tooltip } from "../tooltip/tooltip";
2
+ import { TooltipProps, TooltipEvents, TooltipBlocks } from "../tooltip/tooltip";
3
+ import { PopoverContentProps, PopoverContentBlocks } from './content';
4
+ export interface PopoverProps extends TooltipProps, PopoverContentProps {
5
+ confirm?: never;
6
+ theme?: never;
7
+ hoverable?: never;
8
+ trigger?: never;
9
+ }
10
+ export interface PopoverEvents extends TooltipEvents {
11
+ }
12
+ export interface PopoverBlocks extends TooltipBlocks, PopoverContentBlocks {
13
+ }
14
+ export declare class _Popover extends Tooltip<PopoverProps, PopoverEvents, PopoverBlocks> {
15
+ }
16
+ export declare const Popover: typeof _Popover;
@@ -0,0 +1,44 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["children", "type", "title", "content", "$blocks"];
4
+ import { createVNode as h, Component } from 'intact-react';
5
+ import { Tooltip } from "../tooltip/tooltip";
6
+ import { PopoverContent } from './content';
7
+ import { noop } from 'intact-shared';
8
+
9
+ function Wrapper(props) {
10
+ var children = props.children,
11
+ type = props.type,
12
+ title = props.title,
13
+ content = props.content,
14
+ $blocks = props.$blocks,
15
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
16
+
17
+ if ($blocks) {
18
+ if ($blocks.title) {
19
+ title = $blocks.title(noop);
20
+ }
21
+
22
+ if ($blocks.content) {
23
+ content = $blocks.content(noop);
24
+ }
25
+ }
26
+
27
+ var contentVNode = h(PopoverContent, {
28
+ type: type,
29
+ title: title,
30
+ content: content,
31
+ $blocks: $blocks
32
+ });
33
+ return h(Tooltip, _extends({
34
+ children: [children, contentVNode]
35
+ }, rest, {
36
+ confirm: true,
37
+ theme: 'light',
38
+ hoverable: true,
39
+ trigger: 'click'
40
+ }));
41
+ }
42
+
43
+ var functionalWrapper = Component.functionalWrapper;
44
+ export var Popover = functionalWrapper ? functionalWrapper(Wrapper) : Wrapper;
@@ -0,0 +1 @@
1
+ export {};