@king-design/intact 2.0.16 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/components/cascader/index.md +18 -0
  2. package/components/cascader/index.spec.ts +56 -0
  3. package/components/cascader/index.ts +35 -12
  4. package/components/cascader/index.vdt +9 -8
  5. package/components/cascader/styles.ts +2 -1
  6. package/components/cascader/useFields.ts +22 -0
  7. package/components/cascader/useFilterable.ts +23 -8
  8. package/components/cascader/useLabel.ts +7 -4
  9. package/components/cascader/useLoad.ts +4 -2
  10. package/components/code/demos/basic.md +1 -1
  11. package/components/colorpicker/index.md +16 -0
  12. package/components/colorpicker/index.ts +4 -0
  13. package/components/colorpicker/index.vdt +3 -2
  14. package/components/datepicker/index.md +11 -0
  15. package/components/dialog/index.spec.ts +2 -2
  16. package/components/dropdown/dropdown.ts +18 -10
  17. package/components/dropdown/item.ts +3 -2
  18. package/components/dropdown/menu.ts +1 -1
  19. package/components/dropdown/usePosition.ts +9 -1
  20. package/components/editable/index.ts +17 -3
  21. package/components/editable/index.vdt +1 -0
  22. package/components/input/demos/autoRows.md +44 -0
  23. package/components/input/demos/password.md +12 -0
  24. package/components/input/demos/textarea.md +2 -2
  25. package/components/input/index.md +1 -0
  26. package/components/input/index.spec.ts +97 -1
  27. package/components/input/index.ts +17 -3
  28. package/components/input/index.vdt +29 -6
  29. package/components/input/styles.ts +18 -1
  30. package/components/input/useAutoRows.ts +65 -0
  31. package/components/input/useAutoWidth.ts +12 -3
  32. package/components/input/useShowPassword.ts +27 -0
  33. package/components/pagination/index.spec.ts +1 -1
  34. package/components/pagination/index.ts +1 -2
  35. package/components/portal.ts +4 -4
  36. package/components/position.ts +5 -1
  37. package/components/select/base.ts +3 -1
  38. package/components/select/base.vdt +2 -0
  39. package/components/select/index.md +11 -1
  40. package/components/table/cell.ts +4 -5
  41. package/components/table/demos/hideHeader.md +33 -0
  42. package/components/table/demos/pagination.md +53 -0
  43. package/components/table/index.md +22 -0
  44. package/components/table/index.spec.ts +73 -1
  45. package/components/table/row.ts +3 -3
  46. package/components/table/styles.ts +5 -0
  47. package/components/table/table.ts +29 -4
  48. package/components/table/table.vdt +21 -3
  49. package/components/table/useChecked.ts +21 -6
  50. package/components/table/useDisableRow.ts +3 -2
  51. package/components/table/useDraggable.ts +11 -8
  52. package/components/table/useGroup.ts +2 -0
  53. package/components/table/useMerge.ts +6 -3
  54. package/components/table/usePagination.ts +71 -0
  55. package/components/table/useRestRowStatus.ts +4 -1
  56. package/components/table/useTree.ts +4 -3
  57. package/components/timepicker/index.md +11 -0
  58. package/components/tooltip/demos/trigger.md +1 -1
  59. package/components/tooltip/index.md +1 -1
  60. package/components/tooltip/index.spec.ts +8 -5
  61. package/components/tooltip/tooltip.ts +0 -2
  62. package/components/treeSelect/index.md +9 -0
  63. package/es/components/cascader/index.d.ts +22 -11
  64. package/es/components/cascader/index.js +9 -12
  65. package/es/components/cascader/index.spec.js +81 -0
  66. package/es/components/cascader/index.vdt.js +10 -8
  67. package/es/components/cascader/styles.js +1 -1
  68. package/es/components/cascader/useFields.d.ts +2 -0
  69. package/es/components/cascader/useFields.js +18 -0
  70. package/es/components/cascader/useFilterable.d.ts +2 -1
  71. package/es/components/cascader/useFilterable.js +17 -6
  72. package/es/components/cascader/useLabel.d.ts +2 -1
  73. package/es/components/cascader/useLabel.js +4 -4
  74. package/es/components/cascader/useLoad.d.ts +2 -1
  75. package/es/components/cascader/useLoad.js +9 -7
  76. package/es/components/colorpicker/index.d.ts +2 -0
  77. package/es/components/colorpicker/index.js +7 -2
  78. package/es/components/colorpicker/index.vdt.js +3 -6
  79. package/es/components/dialog/index.spec.js +2 -2
  80. package/es/components/dropdown/dropdown.d.ts +0 -1
  81. package/es/components/dropdown/dropdown.js +19 -8
  82. package/es/components/dropdown/item.js +3 -3
  83. package/es/components/dropdown/menu.js +1 -1
  84. package/es/components/dropdown/usePosition.js +8 -1
  85. package/es/components/editable/index.d.ts +1 -0
  86. package/es/components/editable/index.js +20 -6
  87. package/es/components/editable/index.vdt.js +2 -1
  88. package/es/components/input/index.d.ts +10 -2
  89. package/es/components/input/index.js +10 -3
  90. package/es/components/input/index.spec.js +169 -1
  91. package/es/components/input/index.vdt.js +26 -7
  92. package/es/components/input/styles.js +8 -3
  93. package/es/components/input/useAutoRows.d.ts +2 -0
  94. package/es/components/input/useAutoRows.js +79 -0
  95. package/es/components/input/useAutoWidth.js +13 -3
  96. package/es/components/input/useShowPassword.d.ts +7 -0
  97. package/es/components/input/useShowPassword.js +31 -0
  98. package/es/components/pagination/index.js +1 -3
  99. package/es/components/pagination/index.spec.js +2 -4
  100. package/es/components/portal.d.ts +6 -2
  101. package/es/components/portal.js +4 -3
  102. package/es/components/position.js +2 -1
  103. package/es/components/select/base.d.ts +2 -1
  104. package/es/components/select/base.js +3 -1
  105. package/es/components/select/base.vdt.js +3 -1
  106. package/es/components/table/cell.js +1 -6
  107. package/es/components/table/index.spec.js +130 -19
  108. package/es/components/table/row.d.ts +1 -1
  109. package/es/components/table/row.js +2 -1
  110. package/es/components/table/styles.js +1 -1
  111. package/es/components/table/table.d.ts +15 -0
  112. package/es/components/table/table.js +16 -7
  113. package/es/components/table/table.vdt.js +20 -6
  114. package/es/components/table/useChecked.d.ts +3 -2
  115. package/es/components/table/useChecked.js +23 -12
  116. package/es/components/table/useDisableRow.d.ts +2 -1
  117. package/es/components/table/useDisableRow.js +4 -4
  118. package/es/components/table/useDraggable.d.ts +3 -2
  119. package/es/components/table/useDraggable.js +11 -8
  120. package/es/components/table/useGroup.js +3 -0
  121. package/es/components/table/useMerge.d.ts +2 -1
  122. package/es/components/table/useMerge.js +5 -4
  123. package/es/components/table/usePagination.d.ts +8 -0
  124. package/es/components/table/usePagination.js +81 -0
  125. package/es/components/table/useTree.d.ts +2 -1
  126. package/es/components/table/useTree.js +3 -4
  127. package/es/components/tooltip/index.spec.js +9 -10
  128. package/es/components/tooltip/tooltip.d.ts +0 -1
  129. package/es/components/tooltip/tooltip.js +1 -12
  130. package/es/index.d.ts +3 -3
  131. package/es/index.js +3 -3
  132. package/es/packages/kpc-react/__tests__/components/cascader.spec.d.ts +1 -0
  133. package/es/packages/kpc-react/__tests__/components/cascader.spec.js +79 -0
  134. package/es/site/data/components/dialog/demos/basic/react.js +4 -1
  135. package/es/site/data/components/input/demos/autoRows/index.d.ts +9 -0
  136. package/es/site/data/components/input/demos/autoRows/index.js +24 -0
  137. package/es/site/data/components/input/demos/autoRows/react.d.ts +8 -0
  138. package/es/site/data/components/input/demos/autoRows/react.js +62 -0
  139. package/es/site/data/components/input/demos/password/index.d.ts +5 -0
  140. package/es/site/data/components/input/demos/password/index.js +17 -0
  141. package/es/site/data/components/input/demos/password/react.d.ts +5 -0
  142. package/es/site/data/components/input/demos/password/react.js +41 -0
  143. package/es/site/data/components/input/demos/textarea/react.js +4 -2
  144. package/es/site/data/components/table/demos/hideHeader/index.d.ts +12 -0
  145. package/es/site/data/components/table/demos/hideHeader/index.js +30 -0
  146. package/es/site/data/components/table/demos/hideHeader/react.d.ts +11 -0
  147. package/es/site/data/components/table/demos/hideHeader/react.js +60 -0
  148. package/es/site/data/components/table/demos/pagination/index.d.ts +12 -0
  149. package/es/site/data/components/table/demos/pagination/index.js +35 -0
  150. package/es/site/data/components/table/demos/pagination/react.d.ts +16 -0
  151. package/es/site/data/components/table/demos/pagination/react.js +65 -0
  152. package/es/styles/fonts/ionicons.js +1 -1
  153. package/index.ts +3 -3
  154. package/package.json +4 -4
  155. package/styles/fonts/ionicons.ts +0 -1
@@ -1,11 +1,11 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "waveDisabled", "ev-click", "ev-mounseenter", "ev-mouseleave"];
3
+ var _excluded = ["className", "style", "type", "value", "defaultValue", "placeholder", "clearable", "disabled", "size", "rows", "autoWidth", "fluid", "width", "stackClearIcon", "frozenOnInput", "readonly", "inline", "waveDisabled", "resize", "ev-click", "ev-mounseenter", "ev-mouseleave"];
4
4
  import { createElementVNode as _$ce, className as _$cn, createUnknownComponentVNode as _$cc, noop as _$no, createVNode as _$cv } from 'intact';
5
5
  import { Icon } from '../icon';
6
6
  import { addStyle, isTextBlock, getRestProps } from '../utils';
7
7
  import { makeStyles } from './styles';
8
- import { noop, isNullOrUndefined } from 'intact-shared';
8
+ import { noop, isNullOrUndefined, isStringOrNumber } from 'intact-shared';
9
9
  import { Wave } from '../wave';
10
10
  import { context as ErrorContext } from '../form/useError';
11
11
  export default function ($props, $blocks, $__proto__) {
@@ -39,6 +39,7 @@ export default function ($props, $blocks, $__proto__) {
39
39
  readonly = _this$get.readonly,
40
40
  inline = _this$get.inline,
41
41
  waveDisabled = _this$get.waveDisabled,
42
+ resize = _this$get.resize,
42
43
  click = _this$get['ev-click'],
43
44
  mouseenter = _this$get['ev-mounseenter'],
44
45
  mouseleave = _this$get['ev-mouseleave'],
@@ -50,12 +51,19 @@ export default function ($props, $blocks, $__proto__) {
50
51
  startInput = _this$frozen.startInput,
51
52
  onInput = _this$frozen.onInput,
52
53
  endInput = _this$frozen.endInput;
54
+ var isNotAutoRows = isStringOrNumber(rows) && rows !== 'auto';
53
55
  var classNameObj = (_classNameObj = {
54
56
  'k-input': true
55
- }, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-group'] = $blocks.prepend || $blocks.append, _classNameObj['k-disabled'] = disabled, _classNameObj['k-with-prefix'] = $blocks.prefix, _classNameObj['k-with-suffix'] = $blocks.suffix, _classNameObj['k-clearable'] = clearable, _classNameObj['k-auto-width'] = autoWidth, _classNameObj['k-fluid'] = fluid, _classNameObj['k-stack-clear'] = stackClearIcon, _classNameObj['k-inline'] = inline, _classNameObj[className] = className, _classNameObj[makeStyles()] = true, _classNameObj);
57
+ }, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-group'] = $blocks.prepend || $blocks.append, _classNameObj['k-disabled'] = disabled, _classNameObj['k-with-prefix'] = $blocks.prefix, _classNameObj['k-with-suffix'] = $blocks.suffix, _classNameObj['k-clearable'] = clearable, _classNameObj['k-auto-width'] = autoWidth, _classNameObj['k-fluid'] = fluid, _classNameObj['k-stack-clear'] = stackClearIcon, _classNameObj['k-inline'] = inline, _classNameObj["k-resize-" + resize] = type === 'textarea' && isNotAutoRows, _classNameObj["k-resize-none"] = type === 'textarea' && !isNotAutoRows, _classNameObj[className] = className, _classNameObj[makeStyles()] = true, _classNameObj);
58
+ var _this$showPassword = this.showPassword,
59
+ isShowPassword = _this$showPassword.isShow,
60
+ toggleShowPassword = _this$showPassword.toggleShow,
61
+ showPasswordType = _this$showPassword.type,
62
+ showPasswordIcon = _this$showPassword.showIcon;
56
63
  var _this$autoWidth = this.autoWidth,
57
64
  fakeRef = _this$autoWidth.fakeRef,
58
65
  fakeWidth = _this$autoWidth.width.value;
66
+ var height = this.autoRows;
59
67
  var inputValue = frozenOnInput && inputing ? originalValue : value;
60
68
  var hasInputValue = !isNullOrUndefined(inputValue);
61
69
  var hasValue = hasInputValue && inputValue !== '';
@@ -69,7 +77,7 @@ export default function ($props, $blocks, $__proto__) {
69
77
  placeholder: placeholder,
70
78
  disabled: disabled,
71
79
  ref: this.inputRef,
72
- style: autoWidth ? {
80
+ style: autoWidth && fakeWidth ? {
73
81
  width: fakeWidth + 'px'
74
82
  } : undefined
75
83
  }); // if we pass value to input element, the input is controlled and the
@@ -100,11 +108,22 @@ export default function ($props, $blocks, $__proto__) {
100
108
  return block ? block.call($this, callBlock, data) : callBlock();
101
109
  }, __$blocks['prefix'](_$no)), 0, 'k-input-prefix') : undefined, type !== 'textarea' ? _$cv('input', _extends({}, inputProps, {
102
110
  'className': 'k-input-inner',
103
- 'type': type
111
+ 'type': showPasswordType.value
104
112
  })) : _$cv('textarea', _extends({}, inputProps, {
105
113
  'className': 'k-input-inner k-textarea',
106
- 'rows': rows
107
- })), $blocks.suffix || clearable && !disabled ? _$ce(2, 'div', [clearable && !disabled ? _$cc(Icon, {
114
+ 'rows': isNotAutoRows ? rows : 1,
115
+ 'style': height.value ? addStyle(inputProps.style, {
116
+ height: height.value + 'px'
117
+ }) : inputProps.style
118
+ })), $blocks.suffix || clearable && !disabled || showPasswordIcon.value ? _$ce(2, 'div', [showPasswordIcon.value ? [_$cc(Icon, {
119
+ 'hoverable': true,
120
+ 'className': _$cn({
121
+ "k-input-show-password": true,
122
+ "ion-eye-disabled": !isShowPassword.value,
123
+ "ion-eye": isShowPassword.value
124
+ }),
125
+ 'ev-click': toggleShowPassword
126
+ }), ' '] : undefined, clearable && !disabled ? _$cc(Icon, {
108
127
  'className': _$cn({
109
128
  "k-input-clear ion-ios-close": true,
110
129
  "k-input-show": hasValue
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
3
3
  import { theme, setDefault } from '../../styles/theme';
4
4
  import { deepDefaults, sizes } from '../../styles/utils';
5
5
  import '../../styles/global';
6
+ import { Input } from './';
6
7
  var defaults = deepDefaults({
7
8
  get transition() {
8
9
  return theme.transition.middle;
@@ -58,7 +59,7 @@ var defaults = deepDefaults({
58
59
 
59
60
  // textarea
60
61
  get textareaPadding() {
61
- return "5px " + input.paddingGap;
62
+ return "6px " + input.paddingGap;
62
63
  },
63
64
 
64
65
  // group
@@ -120,12 +121,16 @@ setDefault(function () {
120
121
  }).input;
121
122
  });
122
123
  export function makeStyles() {
123
- return /*#__PURE__*/css("display:inline-block;width:", input.width, ";vertical-align:middle;.k-input-wrapper{display:inline-block;width:100%;position:relative;}.k-input-inner{display:inline-block;width:100%;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";outline:none;position:relative;color:", input.color, ";&:hover{border:", input.hoverBorder, ";z-index:1;}&:focus{border:", input.focusBorder, ";z-index:1;}&::placeholder{color:", input.placeholderColor, ";}}&.k-fluid{width:100%;}.k-input-prefix,.k-input-suffix{position:absolute;top:50%;transform:translateY(-50%);z-index:2;}.k-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";+*{margin-left:", input.clearIconGap, ";}}&:hover .k-input-clear.k-input-show{opacity:1;pointer-events:all;}&.k-stack-clear{.k-input-clear{position:absolute;z-index:1;right:0;&.k-input-show+i{transition:opacity ", input.transition, ";}}&:hover{.k-input-clear.k-input-show+i{opacity:0;}}}&.k-group{display:table;.k-input-inner{border-radius:0;}.k-input-wrapper:first-child{.k-input-inner{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.k-input-wrapper:last-child{.k-input-inner{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}}.k-input-prepend,.k-input-append{display:table-cell;width:1px;vertical-align:middle;background-color:", input.groupBgColor, ";border:", input.border, ";text-align:center;white-space:nowrap;.k-btn{margin:-1px 0;border-radius:0;border:none;}.k-select{margin:-1px;text-align:left;}}.k-input-prepend{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";.k-select{z-index:1;.k-select-wrapper{border-radius:", theme.borderRadius, " 0 0 ", theme.borderRadius, ";}}}.k-input-append{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;.k-select{.k-select-wrapper{border-radius:0 ", theme.borderRadius, " ", theme.borderRadius, " 0;}}}.k-input-padding{padding:0 ", input.groupPaddingGap, ";}.k-input-prepend{border-right:none;}.k-input-append{border-left:none;}&.k-disabled{color:", input.disabledColor, ";cursor:not-allowed;.k-input-inner{color:", input.disabledColor, ";border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
124
+ var _context;
125
+
126
+ return /*#__PURE__*/css("display:inline-block;width:", input.width, ";vertical-align:middle;.k-input-wrapper{display:inline-block;width:100%;position:relative;}.k-input-inner{display:inline-block;width:100%;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";outline:none;position:relative;color:", input.color, ";&:hover{border:", input.hoverBorder, ";z-index:1;}&:focus{border:", input.focusBorder, ";z-index:1;}&::placeholder{color:", input.placeholderColor, ";}}&.k-fluid{width:100%;}.k-input-prefix,.k-input-suffix{position:absolute;top:50%;transform:translateY(-50%);z-index:2;}.k-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";+*{margin-left:", input.clearIconGap, ";}}&:hover .k-input-clear.k-input-show{opacity:1;pointer-events:all;}.k-input-show-password{color:", input.clearIconColor, ";}&.k-stack-clear{.k-input-clear{position:absolute;z-index:1;right:0;&.k-input-show+i{transition:opacity ", input.transition, ";}}&:hover{.k-input-clear.k-input-show+i{opacity:0;}}}&.k-group{display:table;.k-input-inner{border-radius:0;}.k-input-wrapper:first-child{.k-input-inner{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.k-input-wrapper:last-child{.k-input-inner{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}}.k-input-prepend,.k-input-append{display:table-cell;width:1px;vertical-align:middle;background-color:", input.groupBgColor, ";border:", input.border, ";text-align:center;white-space:nowrap;.k-btn{margin:-1px 0;border-radius:0;border:none;}.k-select{margin:-1px;text-align:left;}}.k-input-prepend{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";.k-select{z-index:1;.k-select-wrapper{border-radius:", theme.borderRadius, " 0 0 ", theme.borderRadius, ";}}}.k-input-append{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;.k-select{.k-select-wrapper{border-radius:0 ", theme.borderRadius, " ", theme.borderRadius, " 0;}}}.k-input-padding{padding:0 ", input.groupPaddingGap, ";}.k-input-prepend{border-right:none;}.k-input-append{border-left:none;}&.k-disabled{color:", input.disabledColor, ";cursor:not-allowed;.k-input-inner{color:", input.disabledColor, ";border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
124
127
  var styles = input[size];
125
128
  var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.k-input-inner{height:", styles.height, ";line-height:", styles.height, ";font-size:", styles.fontSize, ";padding:0 ", styles.paddingGap, ";}.k-input-prefix{left:", styles.paddingGap, ";}.k-input-suffix{right:", styles.paddingGap, ";}&.k-with-prefix{.k-input-inner{padding-left:calc(", styles.paddingGap, " + 1rem + ", input.clearIconGap, ");}}&.k-with-suffix,&.k-clearable{.k-input-inner{padding-right:calc(", styles.paddingGap, " + 1rem + ", input.clearIconGap, ");}}&:not(.k-stack-clear).k-with-suffix.k-clearable{.k-input-inner{padding-right:calc(", styles.paddingGap, " + 2rem + ", input.clearIconGap, " * 2);}}");
126
129
  if (size === 'default') return sizeClassName;
127
130
  return /*#__PURE__*/css("&.k-", size, "{", sizeClassName, ";}");
128
- }), "&.k-inline{.k-input-inner{height:auto;line-height:inherit;border:none;border-radius:0;padding:0;}}.k-textarea{padding:", input.textareaPadding, ";height:auto;line-height:1.5;vertical-align:top;}.k-input-fake{position:absolute;visibility:hidden;top:0;white-space:nowrap;}&.k-auto-width{width:auto;.k-input-inner{box-sizing:content-box;}}");
131
+ }), "&.k-inline{.k-input-inner{height:auto;line-height:inherit;border:none;border-radius:0;padding:0;}}.k-textarea{padding:", input.textareaPadding, ";height:auto;line-height:1.5;vertical-align:top;}", _mapInstanceProperty(_context = Input.typeDefs.resize).call(_context, function (type) {
132
+ return /*#__PURE__*/css("&.k-resize-", type, "{.k-textarea{resize:", type, ";}}");
133
+ }), ".k-input-fake{position:absolute;visibility:hidden;top:0;white-space:nowrap;}&.k-auto-width{width:auto;max-width:100%;.k-input-inner{max-width:100%;box-sizing:content-box;}}");
129
134
  }
130
135
  export function makeSearchStyles() {
131
136
  return /*#__PURE__*/css("position:relative;display:inline-block;.k-input{transition:width ", input.transition, ";}.k-btn{position:absolute;top:0;right:0;z-index:1;}.k-input-suffix{margin-right:", input.search.suffixMarginRight, ";}&.k-hide{", _mapInstanceProperty(sizes).call(sizes, function (size) {
@@ -0,0 +1,2 @@
1
+ import { RefObject } from 'intact';
2
+ export declare function useAutoRows(inputRef: RefObject<HTMLInputElement>): import("../../hooks/useState").State<number>;
@@ -0,0 +1,79 @@
1
+ import { useInstance, onMounted } from 'intact';
2
+ import { useState } from '../../hooks/useState';
3
+ import { isObject } from 'intact-shared';
4
+ export function useAutoRows(inputRef) {
5
+ var instance = useInstance();
6
+ var height = useState(0);
7
+ var lineHeight;
8
+ var paddingTop;
9
+ var paddingBottom;
10
+ var isBorderBox;
11
+
12
+ function getStyles() {
13
+ if (instance.get('type') === 'textarea') {
14
+ var styles = getComputedStyle(inputRef.value);
15
+ lineHeight = parseInt(styles.lineHeight);
16
+ paddingTop = parseInt(styles.paddingTop);
17
+ paddingBottom = parseInt(styles.paddingBottom);
18
+ isBorderBox = styles.boxSizing === 'border-box';
19
+ }
20
+ }
21
+
22
+ onMounted(getStyles);
23
+ instance.watch('type', getStyles, {
24
+ presented: true
25
+ });
26
+ instance.watch('value', adjust, {
27
+ inited: true,
28
+ presented: true
29
+ });
30
+ instance.watch('placeholder', adjust, {
31
+ inited: true,
32
+ presented: true
33
+ });
34
+ instance.watch('rows', adjust, {
35
+ inited: true,
36
+ presented: true
37
+ });
38
+ onMounted(adjust);
39
+
40
+ function adjust() {
41
+ var _instance$get = instance.get(),
42
+ rows = _instance$get.rows,
43
+ type = _instance$get.type;
44
+
45
+ if (type === 'textarea' && (rows === 'auto' || isObject(rows))) {
46
+ var textarea = inputRef.value;
47
+ var originheight = textarea.style.height; // we shuold remove height before get scrollHeight,
48
+ // otherwise we cannot shrink the height when we remove the text
49
+
50
+ textarea.style.height = '';
51
+ var scrollHeight = textarea.scrollHeight;
52
+ var lines = (scrollHeight - paddingTop - paddingBottom) / lineHeight;
53
+ textarea.style.height = originheight;
54
+ var actualLines = lines;
55
+
56
+ if (rows !== 'auto') {
57
+ var min = rows.min,
58
+ max = rows.max;
59
+
60
+ if (min && lines <= min) {
61
+ actualLines = min;
62
+ }
63
+
64
+ if (max && lines >= max) {
65
+ actualLines = max;
66
+ }
67
+ }
68
+
69
+ height.set(lineHeight * actualLines + (isBorderBox ? paddingTop + paddingBottom + 2
70
+ /* border */
71
+ : 0));
72
+ return;
73
+ }
74
+
75
+ height.set(0);
76
+ }
77
+
78
+ return height;
79
+ }
@@ -1,4 +1,4 @@
1
- import { useInstance, createRef, onMounted } from 'intact';
1
+ import { useInstance, createRef, onMounted, nextTick } from 'intact';
2
2
  import { useState } from '../../hooks/useState';
3
3
  export function useAutoWidth() {
4
4
  var instance = useInstance();
@@ -16,9 +16,15 @@ export function useAutoWidth() {
16
16
 
17
17
  function adjustWidth() {
18
18
  if (instance.get('autoWidth')) {
19
- var _width = fakeRef.value.offsetWidth || 1;
19
+ nextTick(function () {
20
+ var fakeElem = fakeRef.value;
20
21
 
21
- width.set(_width);
22
+ if (isVisible(fakeElem)) {
23
+ var _width = fakeElem.offsetWidth || 1;
24
+
25
+ width.set(_width);
26
+ }
27
+ });
22
28
  }
23
29
  }
24
30
 
@@ -26,4 +32,8 @@ export function useAutoWidth() {
26
32
  fakeRef: fakeRef,
27
33
  width: width
28
34
  };
35
+ }
36
+
37
+ function isVisible(elem) {
38
+ return elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
29
39
  }
@@ -0,0 +1,7 @@
1
+ import type { HTMLInputTypes } from './';
2
+ export declare function useShowPassword(): {
3
+ isShow: import("../../hooks/useState").State<boolean>;
4
+ type: import("../../hooks/useState").State<HTMLInputTypes | undefined>;
5
+ toggleShow: () => void;
6
+ showIcon: import("../../hooks/useState").State<boolean>;
7
+ };
@@ -0,0 +1,31 @@
1
+ import { useInstance } from 'intact';
2
+ import { useState } from '../../hooks/useState';
3
+ import { useReceive } from '../../hooks/useReceive';
4
+ export function useShowPassword() {
5
+ var instance = useInstance();
6
+ var isShow = useState(false);
7
+ var type = useState(undefined);
8
+ var showIcon = useState(false);
9
+ instance.on('$receive:type', function (_type) {
10
+ type.set(_type);
11
+ });
12
+ useReceive(['type', 'showPassword'], function () {
13
+ var _instance$get = instance.get(),
14
+ showPassword = _instance$get.showPassword,
15
+ type = _instance$get.type;
16
+
17
+ showIcon.set(type === 'password' && !!showPassword);
18
+ });
19
+
20
+ function toggleShow() {
21
+ isShow.set(!isShow.value);
22
+ type.set(isShow.value ? 'text' : 'password');
23
+ }
24
+
25
+ return {
26
+ isShow: isShow,
27
+ type: type,
28
+ toggleShow: toggleShow,
29
+ showIcon: showIcon
30
+ };
31
+ }
@@ -105,9 +105,7 @@ export var Pagination = /*#__PURE__*/function (_Component) {
105
105
 
106
106
  if (page > totalPages) {
107
107
  page = totalPages;
108
- }
109
-
110
- if (page < 1) {
108
+ } else if (page < 1) {
111
109
  page = 1;
112
110
  }
113
111
 
@@ -4,11 +4,9 @@ import BasicDemo from '~/components/pagination/demos/basic';
4
4
  import GotoDemo from '~/components/pagination/demos/goto';
5
5
  import CurrentDemo from '~/components/pagination/demos/current';
6
6
  import DisableDemo from '~/components/pagination/demos/disable';
7
- import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
7
+ import { mount, dispatchEvent, wait } from '../../test/utils';
8
8
  describe('Pagination', function () {
9
- afterEach(function () {
10
- return unmount();
11
- });
9
+ // afterEach(() => unmount());
12
10
  it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
13
11
  var _mount, instance, element, pagination, btns, prev, next;
14
12
 
@@ -11,8 +11,12 @@ export declare class Portal<T extends PortalProps = PortalProps> extends Compone
11
11
  mountedQueue?: Function[];
12
12
  mountedDone?: boolean;
13
13
  $isPortal: boolean;
14
- $render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[]): void;
15
- $update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[], force: boolean): void;
14
+ $render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[] & {
15
+ priority?: Function[];
16
+ }): void;
17
+ $update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[] & {
18
+ priority?: Function[];
19
+ }, force: boolean): void;
16
20
  $unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null): void;
17
21
  private initContainer;
18
22
  }
@@ -38,7 +38,8 @@ export var Portal = /*#__PURE__*/function (_Component) {
38
38
 
39
39
  var _proto = Portal.prototype;
40
40
 
41
- _proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue) {
41
+ _proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue // in React, it has priority property to add some prior functions
42
+ ) {
42
43
  var _this2 = this;
43
44
 
44
45
  /**
@@ -47,7 +48,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
47
48
  */
48
49
  var nextProps = nextVNode.props;
49
50
  var fakeContainer = document.createDocumentFragment();
50
- mountedQueue.push(function () {
51
+ (mountedQueue.priority || mountedQueue).push(function () {
51
52
  var parentDom = _this2.$lastInput.dom.parentElement;
52
53
 
53
54
  _this2.initContainer(nextProps.container, parentDom, anchor);
@@ -87,7 +88,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
87
88
 
88
89
  if (!this.container) {
89
90
  // in react, sometimes $update will be called before mountedQueue in $render
90
- mountedQueue.push(update);
91
+ (mountedQueue.priority || mountedQueue).push(update);
91
92
  } else {
92
93
  update();
93
94
  }
@@ -1,6 +1,7 @@
1
1
  import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
3
  import _atInstanceProperty from "@babel/runtime-corejs3/core-js/instance/at";
4
+ import { isArray } from 'intact-shared';
4
5
  var max = Math.max;
5
6
  var abs = Math.abs;
6
7
  var rHorizontal = /left|center|right/;
@@ -191,7 +192,7 @@ export default function position(elem, options) {
191
192
  var basePosition = _Object$assign({}, targetOffset); // don't detect collison if the target is not in viewport
192
193
 
193
194
 
194
- var collision = isInViewport(targetRect) ? (options.collision || 'flip').split(' ') : ['none', 'none'];
195
+ var collision = isInViewport(targetRect) ? !isArray(options.collision) ? (options.collision || 'flip').split(' ') : options.collision : ['none', 'none'];
195
196
  var offsets = {};
196
197
  var within = getWithinInfo(options.within);
197
198
  var scrollInfo = getScrollInfo(within);
@@ -1,7 +1,7 @@
1
1
  import { Component, Children, TypeDefs, RefObject } from 'intact';
2
2
  import { Sizes } from '../../styles/utils';
3
3
  import type { Input } from '../input';
4
- import { Dropdown } from '../dropdown';
4
+ import { Dropdown, DropdownProps } from '../dropdown';
5
5
  import { State } from '../../hooks/useState';
6
6
  import { Container } from '../portal';
7
7
  import type { Events } from '../types';
@@ -21,6 +21,7 @@ export interface BaseSelectProps<V, Multipe extends boolean = boolean, Attach =
21
21
  container?: Container;
22
22
  width?: string | number;
23
23
  show?: boolean;
24
+ position?: DropdownProps['position'];
24
25
  }
25
26
  export interface BaseSelectEvents {
26
27
  keydown: [KeyboardEvent];
@@ -9,6 +9,7 @@ import { sizes } from '../../styles/utils';
9
9
  import { SELECT } from './constants';
10
10
  import { useShowHideEvents } from '../../hooks/useShowHideEvents';
11
11
  import { bind } from '../utils';
12
+ import { Dropdown } from '../dropdown';
12
13
  import { useInput } from './useInput';
13
14
  import { useFocusout } from './useFocusout';
14
15
  import { isNullOrUndefined } from 'intact-shared';
@@ -27,7 +28,8 @@ var typeDefs = {
27
28
  placeholder: [String, Number],
28
29
  container: [Function, String],
29
30
  width: [String, Number],
30
- show: Boolean
31
+ show: Boolean,
32
+ position: Dropdown.typeDefs.position
31
33
  };
32
34
 
33
35
  var defaults = function defaults() {
@@ -40,7 +40,8 @@ export default function ($props, $blocks, $__proto__) {
40
40
  inline = _this$get.inline,
41
41
  style = _this$get.style,
42
42
  width = _this$get.width,
43
- show = _this$get.show;
43
+ show = _this$get.show,
44
+ position = _this$get.position;
44
45
 
45
46
  var classNameObj = (_classNameObj = {
46
47
  'k-select': true,
@@ -67,6 +68,7 @@ export default function ($props, $blocks, $__proto__) {
67
68
  'ref': _this.dropdownRef,
68
69
  'disabled': disabled,
69
70
  'container': container,
71
+ 'position': position,
70
72
  'children': [_$cv('div', _extends({}, getRestProps(_this), {
71
73
  'className': _$cn(classNameObj),
72
74
  'tabindex': disabled ? '-1' : '0',
@@ -16,12 +16,7 @@ export var TableCell = /*#__PURE__*/function (_Component) {
16
16
  var isSame = true;
17
17
 
18
18
  for (var key in lastProps) {
19
- if (lastProps[key] !== nextProps[key]) {
20
- isSame = false;
21
- break;
22
- }
23
-
24
- if (key === 'props' && nextProps.props.$blocks) {
19
+ if (lastProps[key] !== nextProps[key] || key === 'props' && nextProps.props.$blocks) {
25
20
  isSame = false;
26
21
  break;
27
22
  }