@king-design/intact 3.3.2 → 3.3.3

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 (67) hide show
  1. package/components/button/demos/basic.md +5 -2
  2. package/components/button/demos/ghost.md +1 -0
  3. package/components/button/demos/group.md +7 -0
  4. package/components/button/group.ts +2 -0
  5. package/components/button/index.md +1 -0
  6. package/components/button/index.ts +2 -0
  7. package/components/button/index.vdt +12 -7
  8. package/components/button/styles.ts +31 -1
  9. package/components/dialog/alert.vdt +2 -3
  10. package/components/dialog/demos/static.md +18 -0
  11. package/components/switch/demos/beforeChange.md +52 -0
  12. package/components/switch/index.md +2 -0
  13. package/components/switch/index.spec.ts +11 -0
  14. package/components/switch/index.ts +28 -6
  15. package/components/switch/index.vdt +8 -2
  16. package/components/switch/styles.ts +15 -1
  17. package/components/table/cell.vdt +6 -1
  18. package/components/table/column.ts +2 -0
  19. package/components/table/column.vdt +2 -1
  20. package/components/table/demos/hidden.md +44 -0
  21. package/components/table/index.md +1 -0
  22. package/components/table/styles.ts +6 -3
  23. package/components/table/table.vdt +4 -2
  24. package/components/table/useColumns.ts +1 -1
  25. package/components/utils.ts +19 -0
  26. package/es/components/button/group.d.ts +1 -0
  27. package/es/components/button/group.js +2 -1
  28. package/es/components/button/index.d.ts +1 -0
  29. package/es/components/button/index.js +1 -0
  30. package/es/components/button/index.vdt.js +13 -6
  31. package/es/components/button/styles.d.ts +1 -1
  32. package/es/components/button/styles.js +3 -3
  33. package/es/components/dialog/alert.vdt.js +2 -2
  34. package/es/components/switch/index.d.ts +3 -1
  35. package/es/components/switch/index.js +65 -13
  36. package/es/components/switch/index.spec.js +21 -0
  37. package/es/components/switch/index.vdt.js +14 -4
  38. package/es/components/switch/styles.js +12 -7
  39. package/es/components/table/cell.vdt.js +3 -1
  40. package/es/components/table/column.d.ts +1 -0
  41. package/es/components/table/column.js +1 -0
  42. package/es/components/table/column.vdt.js +3 -2
  43. package/es/components/table/styles.js +1 -1
  44. package/es/components/table/table.vdt.js +1 -1
  45. package/es/components/table/useColumns.js +1 -1
  46. package/es/components/utils.js +17 -0
  47. package/es/i18n/en-US.js +6 -2
  48. package/es/index.d.ts +2 -2
  49. package/es/index.js +2 -2
  50. package/es/site/data/components/button/demos/basic/react.js +7 -1
  51. package/es/site/data/components/button/demos/ghost/react.js +3 -0
  52. package/es/site/data/components/button/demos/group/react.js +17 -0
  53. package/es/site/data/components/dialog/demos/static/index.d.ts +1 -0
  54. package/es/site/data/components/dialog/demos/static/index.js +15 -0
  55. package/es/site/data/components/dialog/demos/static/react.d.ts +1 -0
  56. package/es/site/data/components/dialog/demos/static/react.js +18 -1
  57. package/es/site/data/components/switch/demos/beforeChange/index.d.ts +12 -0
  58. package/es/site/data/components/switch/demos/beforeChange/index.js +39 -0
  59. package/es/site/data/components/switch/demos/beforeChange/react.d.ts +11 -0
  60. package/es/site/data/components/switch/demos/beforeChange/react.js +62 -0
  61. package/es/site/data/components/table/demos/hidden/index.d.ts +14 -0
  62. package/es/site/data/components/table/demos/hidden/index.js +28 -0
  63. package/es/site/data/components/table/demos/hidden/react.d.ts +13 -0
  64. package/es/site/data/components/table/demos/hidden/react.js +63 -0
  65. package/i18n/en-US.ts +5 -2
  66. package/index.ts +2 -2
  67. package/package.json +2 -2
@@ -293,9 +293,28 @@ export function strPad(str: number | string, length: number, pad: string = '0')
293
293
  return str;
294
294
  }
295
295
 
296
+ /**
297
+ * 在vue3.0中,数组会转成Proxy对象,需要获取原始数据比较
298
+ * https://github.com/ksc-fe/kpc/issues/985
299
+ * https://github.com/vuejs/core/blob/main/packages/reactivity/src/reactive.ts
300
+ */
301
+ const RAW = '__v_raw';
302
+ function isProxy(value: any): boolean {
303
+ return value ? !!value[RAW] : false
304
+ }
305
+ function toRaw<T>(observed: T): T {
306
+ const raw = observed && (observed as any)[RAW]
307
+ return raw ? toRaw(raw) : observed
308
+ }
296
309
  type EqualArrayValue = any | EqualArrayValue[]
297
310
  export function isEqualArray(a: EqualArrayValue, b: EqualArrayValue): boolean {
298
311
  if (a === b) return true;
312
+
313
+ // for vue3.0 Proxy object
314
+ if (isProxy(a)) a = toRaw(a);
315
+ if (isProxy(b)) b = toRaw(b);
316
+ if (a === b) return true;
317
+
299
318
  if (Array.isArray(a) && Array.isArray(b)) {
300
319
  if (a.length !== b.length) return false;
301
320
  return a.every((value, index) => isEqualArray(value, b[index]));
@@ -5,6 +5,7 @@ export interface ButtonGroupProps {
5
5
  checkType?: 'none' | 'radio' | 'checkbox';
6
6
  fluid?: boolean;
7
7
  seperate?: boolean;
8
+ btnWidth?: number | string;
8
9
  }
9
10
  export declare class ButtonGroup extends Component<ButtonGroupProps> {
10
11
  static template: string | import("intact").Template<any>;
@@ -10,7 +10,8 @@ var typeDefs = {
10
10
  value: null,
11
11
  fluid: Boolean,
12
12
  checkType: ['none', 'radio', 'checkbox'],
13
- seperate: Boolean
13
+ seperate: Boolean,
14
+ btnWidth: [Number, String]
14
15
  };
15
16
  var defaults = function defaults() {
16
17
  return {
@@ -18,6 +18,7 @@ export interface ButtonProps extends ButtonHTMLAttributes {
18
18
  size?: Sizes;
19
19
  icon?: boolean;
20
20
  circle?: boolean;
21
+ color?: string;
21
22
  loading?: boolean;
22
23
  disabled?: boolean;
23
24
  fluid?: boolean;
@@ -12,6 +12,7 @@ var typeDefs = {
12
12
  size: ['large', 'default', 'small', 'mini'],
13
13
  icon: Boolean,
14
14
  circle: Boolean,
15
+ color: String,
15
16
  loading: Boolean,
16
17
  disabled: Boolean,
17
18
  fluid: Boolean,
@@ -1,13 +1,13 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import { createUnknownComponentVNode as _$cc, className as _$cn, createElementVNode as _$ce } from 'intact';
3
- import { getRestProps } from '../utils';
3
+ import { addStyle, getRestProps } from '../utils';
4
4
  import { Icon } from '../icon';
5
5
  import { makeButtonStyles } from './styles';
6
6
  import { DynamicButton } from './dynamicButton';
7
7
  import { Wave } from '../wave';
8
8
  import { button as theme } from './styles';
9
9
  export default function ($props, $blocks, $__proto__) {
10
- var _classNameObj;
10
+ var _classNameObj, _buttonGroup$get;
11
11
  $blocks || ($blocks = {});
12
12
  $props || ($props = {});
13
13
  var $this = this;
@@ -27,7 +27,9 @@ export default function ($props, $blocks, $__proto__) {
27
27
  loading = _this$get.loading,
28
28
  disabled = _this$get.disabled,
29
29
  name = _this$get.name,
30
- ghost = _this$get.ghost;
30
+ ghost = _this$get.ghost,
31
+ color = _this$get.color,
32
+ style = _this$get.style;
31
33
  var _this$config = this.config,
32
34
  cls = _this$config.cls,
33
35
  k = _this$config.k;
@@ -53,7 +55,7 @@ export default function ($props, $blocks, $__proto__) {
53
55
  }
54
56
  });
55
57
  }
56
- var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = true, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[makeButtonStyles(k, iconSide)] = true, _classNameObj);
58
+ var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[cls('custom')] = color, _classNameObj[makeButtonStyles(k, iconSide, color)] = true, _classNameObj);
57
59
  var loadingIcon = _$cc(Icon, {
58
60
  'className': _$cn("ion-load-c " + k + "-icon-loading"),
59
61
  'size': size /*loadingSizeMap[size]*/,
@@ -61,10 +63,14 @@ export default function ($props, $blocks, $__proto__) {
61
63
  'rotate': true
62
64
  }, 'k-loading');
63
65
  var buttonGroup = this.buttonGroup;
64
- var checkType = buttonGroup ? buttonGroup.get('checkType') : 'none';
66
+ var checkType = (_buttonGroup$get = buttonGroup == null ? void 0 : buttonGroup.get('checkType')) != null ? _buttonGroup$get : 'none';
67
+ var btnWidth = buttonGroup == null ? void 0 : buttonGroup.get('btnWidth');
68
+ var _style = {
69
+ width: typeof btnWidth === 'number' ? btnWidth + "px" : btnWidth
70
+ };
65
71
  var isCheckType = checkType !== 'none';
66
72
  var typeStyles = theme[type];
67
- var waveColor = typeStyles && typeStyles.borderColor || theme.primary.borderColor;
73
+ var waveColor = typeStyles && typeStyles.borderColor || color || theme.primary.borderColor;
68
74
  return _$cc(Wave, {
69
75
  'disabled': loading || disabled || type === 'none' || type === 'link',
70
76
  'inset': type === 'flat' ? '-1px' : '-2px',
@@ -73,6 +79,7 @@ export default function ($props, $blocks, $__proto__) {
73
79
  'className': _$cn(classNameObj),
74
80
  'tagName': tagName
75
81
  }, getRestProps(this), {
82
+ 'style': btnWidth ? addStyle(style, _style) : style,
76
83
  'ref': this.elementRef,
77
84
  'tabindex': disabled || loading ? '-1' : tabindex,
78
85
  'ev-click': this.onClick,
@@ -84,7 +84,7 @@ declare const defaults: {
84
84
  declare let button: typeof defaults;
85
85
  export { button };
86
86
  export declare const makeButtonStyles: {
87
- (k: string, iconSide?: string | undefined): string;
87
+ (k: string, iconSide?: string | undefined, color?: string | undefined): string;
88
88
  clearCache(): {};
89
89
  };
90
90
  export declare const makeButtonGroupStyles: {
@@ -190,7 +190,7 @@ setDefault(function () {
190
190
  makeButtonGroupStyles == null || makeButtonGroupStyles.clearCache();
191
191
  });
192
192
  export { button };
193
- export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
193
+ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color) {
194
194
  var _button = button,
195
195
  secondary = _button.secondary,
196
196
  link = _button.link;
@@ -200,7 +200,7 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
200
200
  css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";.", k, "-icon{color:inherit;}&.", k, "-default,&.", k, "-none,&.", k, "-flat{.", k, "-icon{color:", theme.color.lightBlack, ";}&:hover{.", k, "-icon{color:inherit;}}}&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.", k, "-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
201
201
  var typeStyles = button[type];
202
202
  return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
203
- }), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
203
+ }), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
204
204
  var styles = button[size];
205
205
  return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.", k, "-btn-icon{width:", styles.height, ";}}");
206
206
  }), "&.", k, "-btn-icon{width:", button.height, ";padding:0;.", k, "-icon{margin:0;}}&.", k, "-fluid{width:100%;padding:0;}&.", k, "-circle{border-radius:calc(", button.large.height, " / 2);}&.", k, "-loading{", _mapInstanceProperty(types).call(types, function (type) {
@@ -211,7 +211,7 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
211
211
  ghostColor = _button$type.ghostColor,
212
212
  borderColor = _button$type.borderColor;
213
213
  return /*#__PURE__*/css("&.", k, "-", type, "{color:", ghostColor, ";border-color:", borderColor, ";&:hover{color:", palette(ghostColor, -1), ";border-color:", palette(ghostColor, -1), ";}&:active{color:", palette(ghostColor, 1), ";border-color:", palette(ghostColor, 1), ";}}");
214
- }), "&.", k, "-disabled{&,&:hover{color:", button.disabled.color, ";border-color:", button.disabled.ghostBorderColor, ";background:transparent;}}}"),
214
+ }), " ", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover{color:", palette(color, -1), ";border-color:", palette(color, -1), ";}&:active{color:", palette(color, 1), ";border-color:", palette(color, 1), ";}}"), "&.", k, "-disabled{&,&:hover{color:", button.disabled.color, ";border-color:", button.disabled.ghostBorderColor, ";background:transparent;}}}"),
215
215
  /*#__PURE__*/
216
216
  // dynamic styles
217
217
  css(".", k, "-icon{", iconSide === 'right' ? "margin-left: " + button.icon.gap + ";" : "margin-right: " + button.icon.gap + ";", ";}", !iconSide && /*#__PURE__*/css("&.", k, "-loading{&:not(.", k, "-btn-icon){padding-left:calc(", getLeft(button.padding), " + 1em);", _mapInstanceProperty(sizes).call(sizes, function (size) {
@@ -34,8 +34,8 @@ export default function ($props, $blocks, $__proto__) {
34
34
  }), (_$blocks['body'] = function ($super) {
35
35
  var _ref;
36
36
  return [_$ce(2, 'div', [!hideIcon && !icon ? _$cc(Icon, {
37
- 'className': _$cn(iconClassName || (_ref = {}, _ref[k + "-icon-success-fill"] = type === 'success', _ref[k + "-icon-warning-fill"] = type === 'warning', _ref[k + "-icon-error-fill"] = type === 'error', _ref[k + "-icon-question-fill"] = type === 'confirm', _ref)),
38
- 'color': type === 'error' ? 'danger' : type === 'confirm' ? 'primary' : type
37
+ 'className': _$cn(iconClassName || (_ref = {}, _ref[k + "-icon-success-fill"] = type === 'success', _ref[k + "-icon-warning-fill"] = type === 'warning' || type === 'confirm', _ref[k + "-icon-error-fill"] = type === 'error', _ref)),
38
+ 'color': type === 'error' ? 'danger' : type === 'confirm' ? 'warning' : type
39
39
  }) : undefined, icon], 0, _$cn(k + "-dialog-tip-icon")), _$ce(2, 'div', [title ? _$ce(2, 'div', title, 0, _$cn(k + "-alert-dialog-title")) : undefined, content], 0, _$cn(k + "-alert-dialog-wrapper"))];
40
40
  }, __$blocks['body'] = function ($super, data) {
41
41
  var block = $blocks['body'];
@@ -12,6 +12,8 @@ export interface SwitchProps<True = any, False = any> {
12
12
  height?: number | string;
13
13
  size?: Sizes;
14
14
  disabled?: boolean;
15
+ loading?: boolean;
16
+ beforeChange?: (value: True | False | undefined) => boolean | Promise<boolean>;
15
17
  }
16
18
  export interface SwitchEvents {
17
19
  click: [MouseEvent];
@@ -32,7 +34,7 @@ export declare class Switch<True = true, False = false> extends Component<Switch
32
34
  private onClick;
33
35
  private onClickOnHandle;
34
36
  private onKeypress;
35
- toggle(isKeypress: boolean): void;
37
+ toggle(isKeypress: boolean): Promise<void>;
36
38
  isChecked(): boolean;
37
39
  check(): void;
38
40
  uncheck(): void;
@@ -1,4 +1,6 @@
1
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
1
2
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
3
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
2
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
5
  import { __decorate } from "tslib";
4
6
  import { Component, createRef } from 'intact';
@@ -17,14 +19,17 @@ var typeDefs = {
17
19
  width: [Number, String],
18
20
  height: [Number, String],
19
21
  size: sizes,
20
- disabled: Boolean
22
+ disabled: Boolean,
23
+ loading: Boolean,
24
+ beforeChange: Function
21
25
  };
22
26
  var defaults = function defaults() {
23
27
  return {
24
28
  value: false,
25
29
  trueValue: true,
26
30
  falseValue: false,
27
- size: 'default'
31
+ size: 'default',
32
+ loading: false
28
33
  };
29
34
  };
30
35
  var events = {
@@ -62,18 +67,65 @@ export var Switch = /*#__PURE__*/function (_Component) {
62
67
  this.toggle(true);
63
68
  }
64
69
  };
65
- _proto.toggle = function toggle(isKeypress) {
66
- if (this.get('disabled')) return;
67
- // if is not keypress, we blur it to remove focus style
68
- if (!isKeypress) {
69
- this.elementRef.value.blur();
70
+ _proto.toggle = /*#__PURE__*/function () {
71
+ var _toggle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(isKeypress) {
72
+ var _this$get, disabled, beforeChange, value, ret;
73
+ return _regeneratorRuntime.wrap(function _callee$(_context2) {
74
+ while (1) switch (_context2.prev = _context2.next) {
75
+ case 0:
76
+ _this$get = this.get(), disabled = _this$get.disabled, beforeChange = _this$get.beforeChange, value = _this$get.value;
77
+ if (!disabled) {
78
+ _context2.next = 3;
79
+ break;
80
+ }
81
+ return _context2.abrupt("return");
82
+ case 3:
83
+ // if is not keypress, we blur it to remove focus style
84
+ if (!isKeypress) {
85
+ this.elementRef.value.blur();
86
+ }
87
+ if (!beforeChange) {
88
+ _context2.next = 15;
89
+ break;
90
+ }
91
+ this.set({
92
+ disabled: true,
93
+ loading: true
94
+ });
95
+ _context2.prev = 6;
96
+ _context2.next = 9;
97
+ return beforeChange(value);
98
+ case 9:
99
+ ret = _context2.sent;
100
+ if (ret) {
101
+ _context2.next = 12;
102
+ break;
103
+ }
104
+ return _context2.abrupt("return");
105
+ case 12:
106
+ _context2.prev = 12;
107
+ this.set({
108
+ disabled: false,
109
+ loading: false
110
+ });
111
+ return _context2.finish(12);
112
+ case 15:
113
+ if (this.isChecked()) {
114
+ this.uncheck();
115
+ } else {
116
+ this.check();
117
+ }
118
+ case 16:
119
+ case "end":
120
+ return _context2.stop();
121
+ }
122
+ }, _callee, this, [[6,, 12, 15]]);
123
+ }));
124
+ function toggle(_x) {
125
+ return _toggle.apply(this, arguments);
70
126
  }
71
- if (this.isChecked()) {
72
- this.uncheck();
73
- } else {
74
- this.check();
75
- }
76
- };
127
+ return toggle;
128
+ }();
77
129
  _proto.isChecked = function isChecked() {
78
130
  return this.get('value') === this.get('trueValue');
79
131
  };
@@ -4,6 +4,7 @@ import BasicDemo from '~/components/switch/demos/basic';
4
4
  import DisabledDemo from '~/components/switch/demos/disabled';
5
5
  import ValueDemo from '~/components/switch/demos/value';
6
6
  import WidthHeightDemo from '~/components/switch/demos/widthHeight';
7
+ import BeforeChangeDemo from '~/components/switch/demos/beforeChange';
7
8
  import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
8
9
  describe('Switch', function () {
9
10
  afterEach(function () {
@@ -239,4 +240,24 @@ describe('Switch', function () {
239
240
  }
240
241
  }, _callee6);
241
242
  })));
243
+ it('beforeChange', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
244
+ var _mount7, instance, element, _element$querySelecto5, el1, el2;
245
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
246
+ while (1) switch (_context7.prev = _context7.next) {
247
+ case 0:
248
+ _mount7 = mount(BeforeChangeDemo), instance = _mount7[0], element = _mount7[1];
249
+ _element$querySelecto5 = element.querySelectorAll('.k-switch'), el1 = _element$querySelecto5[0], el2 = _element$querySelecto5[1];
250
+ el1.click();
251
+ el2.click();
252
+ _context7.next = 6;
253
+ return wait(1000);
254
+ case 6:
255
+ expect(instance.get('value1')).to.be.true;
256
+ expect(instance.get('value2')).to.be.false;
257
+ case 8:
258
+ case "end":
259
+ return _context7.stop();
260
+ }
261
+ }, _callee7);
262
+ })));
242
263
  });
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
3
- import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, isChecked as _$isc, linkEvent as _$le, setCheckboxModel as _$scm, noop as _$no } from 'intact';
3
+ import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, isChecked as _$isc, linkEvent as _$le, setCheckboxModel as _$scm, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact';
4
4
  import { makeStyles } from './styles';
5
5
  import { addStyle, getRestProps } from '../utils';
6
+ import { Icon } from '../icon';
6
7
  var _$tmp0 = {
7
8
  'src': 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
8
9
  };
@@ -25,7 +26,8 @@ export default function ($props, $blocks, $__proto__) {
25
26
  width = _this$get.width,
26
27
  height = _this$get.height,
27
28
  size = _this$get.size,
28
- disabled = _this$get.disabled;
29
+ disabled = _this$get.disabled,
30
+ loading = _this$get.loading;
29
31
  var _this$draggable = this.draggable,
30
32
  start = _this$draggable.start,
31
33
  dragging = _this$draggable.dragging,
@@ -36,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
36
38
  var onStyle;
37
39
  var offStyle;
38
40
  var barStyle;
41
+ var iconStyle;
39
42
  if (width || height) {
40
43
  var _style = {};
41
44
  onStyle = {};
@@ -60,6 +63,9 @@ export default function ($props, $blocks, $__proto__) {
60
63
  barStyle = {
61
64
  width: value === trueValue ? '100%' : height + "px"
62
65
  };
66
+ iconStyle = {
67
+ fontSize: height * 0.7 + "px"
68
+ };
63
69
  }
64
70
  style = addStyle(style, _style);
65
71
  }
@@ -106,10 +112,14 @@ export default function ($props, $blocks, $__proto__) {
106
112
  return block ? block.call($this, callBlock, data) : callBlock();
107
113
  }, __$blocks['on'](_$no)), 0, _$cn(k + "-switch-on"), {
108
114
  'style': onStyle
109
- }) : undefined, _$ce(2, 'div', _$ce(2, 'div', _$ce(2, 'img', null, 1, null, _$tmp0), 2, _$cn(k + "-switch-handle"), {
115
+ }) : undefined, _$ce(2, 'div', [loading ? _$cc(Icon, {
116
+ 'className': _$cn(k + "-switch-icon ion-load-c"),
117
+ 'rotate': true,
118
+ 'style': iconStyle
119
+ }) : undefined, _$ce(2, 'div', _$ce(2, 'img', null, 1, null, _$tmp0), 2, _$cn(k + "-switch-handle"), {
110
120
  'ev-click': this.onClickOnHandle,
111
121
  'ev-mousedown': start
112
- }), 2, _$cn(k + "-switch-wrapper"))], 0, _$cn(k + "-switch-bar"), {
122
+ })], 0, _$cn(k + "-switch-wrapper"))], 0, _$cn(k + "-switch-bar"), {
113
123
  'style': barStyle
114
124
  }, null, barRef)]);
115
125
  }
@@ -34,25 +34,29 @@ var defaults = {
34
34
  default: {
35
35
  width: "45px",
36
36
  height: "24px",
37
- padding: "3px"
37
+ padding: "3px",
38
+ iconSize: "16px"
38
39
  },
39
40
  // large
40
41
  large: {
41
42
  width: "58px",
42
43
  height: "30px",
43
- padding: "3px"
44
+ padding: "3px",
45
+ iconSize: "20px"
44
46
  },
45
47
  // small
46
48
  small: {
47
49
  width: "30px",
48
50
  height: "16px",
49
- padding: "2px"
51
+ padding: "2px",
52
+ iconSize: "10px"
50
53
  },
51
54
  // mini
52
55
  mini: {
53
56
  width: "18px",
54
57
  height: "10px",
55
- padding: "1px"
58
+ padding: "1px",
59
+ iconSize: "6px"
56
60
  },
57
61
  // disabled
58
62
  get disabledBgColor() {
@@ -67,11 +71,12 @@ setDefault(function () {
67
71
  makeStyles == null || makeStyles.clearCache();
68
72
  });
69
73
  export var makeStyles = cache(function makeStyles(k) {
70
- return /*#__PURE__*/css("display:inline-block;vertical-align:middle;background:", kswitch.bgColor, ";position:relative;cursor:pointer;user-select:none;overflow:hidden;box-sizing:content-box;transition:background ", kswitch.transition, ";input{opacity:0;position:absolute;}.", k, "-switch-bar,.", k, "-switch-off{box-sizing:border-box;}.", k, "-switch-bar{position:absolute;text-align:right;overflow:hidden;}.", k, "-switch-wrapper{display:inline-block;position:relative;z-index:1;border-radius:", kswitch.handleBorderRadius, ";}.", k, "-switch-bar,.", k, "-switch-wrapper{height:100%;background:", kswitch.bgColor, ";transition:all ", kswitch.transition, ";}&:hover{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.hoverBgColor, ";}}.", k, "-switch-handle{border-radius:", kswitch.handleBorderRadius, ";background:", kswitch.handleBgColor, ";height:100%;cursor:pointer;transition:left ", kswitch.transition, ";display:inline-block;img{height:100%;visibility:hidden;}}.", k, "-switch-on,.", k, "-switch-off{position:absolute;font-size:", kswitch.fontSize, ";color:", kswitch.color, ";text-align:center;}&.", k, "-dragging{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";transition:background ", kswitch.transition, ";}}&:focus{outline:none;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
74
+ return /*#__PURE__*/css("display:inline-block;vertical-align:middle;background:", kswitch.bgColor, ";position:relative;cursor:pointer;user-select:none;overflow:hidden;box-sizing:content-box;transition:background ", kswitch.transition, ";input{opacity:0;position:absolute;}.", k, "-switch-bar,.", k, "-switch-off{box-sizing:border-box;}.", k, "-switch-bar{position:absolute;text-align:right;overflow:hidden;}.", k, "-switch-wrapper{display:inline-block;position:relative;z-index:1;border-radius:", kswitch.handleBorderRadius, ";}.", k, "-switch-bar,.", k, "-switch-wrapper{height:100%;background:", kswitch.bgColor, ";transition:all ", kswitch.transition, ";}&:hover{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.hoverBgColor, ";}}.", k, "-switch-handle{border-radius:", kswitch.handleBorderRadius, ";background:", kswitch.handleBgColor, ";height:100%;cursor:pointer;transition:left ", kswitch.transition, ";display:inline-block;img{height:100%;visibility:hidden;}}.", k, "-switch-icon{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);}.", k, "-switch-on,.", k, "-switch-off{position:absolute;font-size:", kswitch.fontSize, ";color:", kswitch.color, ";text-align:center;}&.", k, "-dragging{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";transition:background ", kswitch.transition, ";}}&:focus{outline:none;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
71
75
  var _kswitch$size = kswitch[size],
72
76
  width = _kswitch$size.width,
73
77
  height = _kswitch$size.height,
74
- padding = _kswitch$size.padding;
75
- return /*#__PURE__*/css("&.", k, "-", size, ",&.", k, "-", size, " .", k, "-switch-on,&.", k, "-", size, " .", k, "-switch-off{width:", width, ";height:", height, ";}&.", k, "-", size, "{border-radius:", height, ";.", k, "-switch-bar{width:", height, ";border-radius:", height, ";}.", k, "-switch-wrapper{padding:", padding, ";}.", k, "-switch-on,.", k, "-switch-off{line-height:", height, ";left:0;}.", k, "-switch-on{padding:0 ", height, " 0 calc(", height, " / 3);}.", k, "-switch-off{padding:0 calc(", height, " / 3) 0 ", height, ";}}");
78
+ padding = _kswitch$size.padding,
79
+ iconSize = _kswitch$size.iconSize;
80
+ return /*#__PURE__*/css("&.", k, "-", size, ",&.", k, "-", size, " .", k, "-switch-on,&.", k, "-", size, " .", k, "-switch-off{width:", width, ";height:", height, ";}&.", k, "-", size, "{border-radius:", height, ";.", k, "-switch-bar{width:", height, ";border-radius:", height, ";}.", k, "-switch-wrapper{padding:", padding, ";}.", k, "-switch-on,.", k, "-switch-off{line-height:", height, ";left:0;}.", k, "-switch-on{padding:0 ", height, " 0 calc(", height, " / 3);}.", k, "-switch-off{padding:0 calc(", height, " / 3) 0 ", height, ";}.", k, "-switch-icon{font-size:", iconSize, ";}}");
76
81
  }), "&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
77
82
  });
@@ -5,6 +5,7 @@ import { Button } from '../button';
5
5
  import { Icon } from '../icon';
6
6
  import { getTextByChildren } from '../utils';
7
7
  export default function ($props, $blocks, $__proto__) {
8
+ var _classNameObj;
8
9
  $blocks || ($blocks = {});
9
10
  $props || ($props = {});
10
11
  var $this = this;
@@ -37,6 +38,7 @@ export default function ($props, $blocks, $__proto__) {
37
38
  style || (style = {});
38
39
  style.paddingLeft = indent + "px";
39
40
  }
41
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-hidden"] = props.hidden, _classNameObj[className] = className, _classNameObj);
40
42
  return _$ce(2, 'td', [columnIndex === 0 && hasChildren ? _$cc(Button, {
41
43
  'type': 'none',
42
44
  'icon': true,
@@ -48,7 +50,7 @@ export default function ($props, $blocks, $__proto__) {
48
50
  'className': _$cn(k + "-icon-right"),
49
51
  'size': 'small'
50
52
  })
51
- }) : undefined, children], 0, _$cn(className), {
53
+ }) : undefined, children], 0, _$cn(classNameObj), {
52
54
  'style': style,
53
55
  'title': getTextByChildren(children),
54
56
  'rowspan': rowspan,
@@ -12,6 +12,7 @@ export interface TableColumnProps {
12
12
  exportTitle?: string;
13
13
  exportCell?: (data: any, index: number) => string;
14
14
  minWidth?: number;
15
+ hidden?: boolean;
15
16
  cols?: number;
16
17
  rows?: number;
17
18
  prevVNode?: VNodeComponentClass<TableColumn> | null;
@@ -20,6 +20,7 @@ var typeDefs = {
20
20
  exportTitle: String,
21
21
  exportCell: Function,
22
22
  minWidth: Number,
23
+ hidden: Boolean,
23
24
  // offset: null,
24
25
  cols: null,
25
26
  rows: null,
@@ -32,7 +32,8 @@ export default function ($props, $blocks, $__proto__) {
32
32
  key = _this$get.key,
33
33
  sortable = _this$get.sortable,
34
34
  cols = _this$get.cols,
35
- rows = _this$get.rows;
35
+ rows = _this$get.rows,
36
+ hidden = _this$get.hidden;
36
37
  var _this$group = this.group,
37
38
  onSelect = _this$group.onSelect,
38
39
  isChecked = _this$group.isChecked,
@@ -66,7 +67,7 @@ export default function ($props, $blocks, $__proto__) {
66
67
  var _getClassAndStyleForF = getClassAndStyleForFixed(_this.get(), offsetMap[key], k, checkType),
67
68
  className = _getClassAndStyleForF.className,
68
69
  style = _getClassAndStyleForF.style;
69
- var classNameObj = (_classNameObj = {}, _classNameObj[k + "-column-sortable"] = sortable, _classNameObj[className] = className, _classNameObj);
70
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-column-sortable"] = sortable, _classNameObj[k + "-hidden"] = hidden, _classNameObj[className] = className, _classNameObj);
70
71
  var groupValue = currentGroup && currentGroup[key];
71
72
  var type = sort && sort.key === key && sort.type;
72
73
  var checked;
@@ -90,7 +90,7 @@ setDefault(function () {
90
90
  makeGroupMenuStyles == null || makeGroupMenuStyles.clearCache();
91
91
  });
92
92
  export var makeStyles = cache(function makeStyles(k) {
93
- return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
93
+ return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
94
94
  return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
95
95
  }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}}");
96
96
  });
@@ -84,7 +84,7 @@ export default function ($props, $blocks, $__proto__) {
84
84
  var onStart = this.resizable.start;
85
85
  var colgroup = _$ce(2, 'colgroup', [checkType !== 'none' ? _$ce(2, 'col', null, 1, null, _$tmp0) : undefined, _$ma(cols, function ($value, $key) {
86
86
  var _$cn2;
87
- return _$ce(2, 'col', null, 1, _$cn((_$cn2 = {}, _$cn2[$value.className] = $value.className, _$cn2)), {
87
+ return _$ce(2, 'col', null, 1, _$cn((_$cn2 = {}, _$cn2[k + "-hidden"] = $value.hidden, _$cn2[$value.className] = $value.className, _$cn2)), {
88
88
  'width': $value.width,
89
89
  'style': {
90
90
  width: getWidth($value.key)
@@ -61,7 +61,7 @@ export function useColumns() {
61
61
  props.children = null;
62
62
  props.cols = 1;
63
63
  cols.push(props);
64
- maxCols++;
64
+ if (!props.hidden) maxCols++;
65
65
  Object.defineProperty(props, 'rows', {
66
66
  get: function get() {
67
67
  return maxRows - row;
@@ -263,7 +263,24 @@ export function strPad(str, length, pad) {
263
263
  }
264
264
  return str;
265
265
  }
266
+ /**
267
+ * 在vue3.0中,数组会转成Proxy对象,需要获取原始数据比较
268
+ * https://github.com/ksc-fe/kpc/issues/985
269
+ * https://github.com/vuejs/core/blob/main/packages/reactivity/src/reactive.ts
270
+ */
271
+ var RAW = '__v_raw';
272
+ function isProxy(value) {
273
+ return value ? !!value[RAW] : false;
274
+ }
275
+ function toRaw(observed) {
276
+ var raw = observed && observed[RAW];
277
+ return raw ? toRaw(raw) : observed;
278
+ }
266
279
  export function isEqualArray(a, b) {
280
+ if (a === b) return true;
281
+ // for vue3.0 Proxy object
282
+ if (isProxy(a)) a = toRaw(a);
283
+ if (isProxy(b)) b = toRaw(b);
267
284
  if (a === b) return true;
268
285
  if (Array.isArray(a) && Array.isArray(b)) {
269
286
  if (a.length !== b.length) return false;
package/es/i18n/en-US.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
1
2
  var i18n = {
2
3
  // datepicker
3
4
  'yearMonthFormat': 'MM YYYY',
@@ -107,6 +108,9 @@ var i18n = {
107
108
  '复制': 'Copy'
108
109
  };
109
110
  export default i18n;
110
- if (typeof global.Kpc !== 'undefined') {
111
- global.Kpc.localize(i18n);
111
+ /**
112
+ * global does not exist in Vite, use standard object globalThis
113
+ */
114
+ if (typeof _globalThis.Kpc !== 'undefined') {
115
+ _globalThis.Kpc.localize(i18n);
112
116
  }
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.3.2
2
+ * @king-design v3.3.3
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -63,4 +63,4 @@ export * from './components/treeSelect';
63
63
  export * from './components/upload';
64
64
  export * from './components/view';
65
65
  export * from './components/wave';
66
- export declare const version = "3.3.2";
66
+ export declare const version = "3.3.3";