@king-design/intact 3.1.2 → 3.1.4-beta.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 (57) hide show
  1. package/components/button/demos/disabled.md +2 -2
  2. package/components/button/demos/ghost.md +3 -3
  3. package/components/button/demos/group.md +3 -3
  4. package/components/button/index.vdt +1 -1
  5. package/components/button/styles.ts +19 -0
  6. package/components/collapse/item.vdt +1 -1
  7. package/components/collapse/styles.ts +9 -8
  8. package/components/config/demos/basic.md +17 -1
  9. package/components/dialog/index.spec.ts +30 -0
  10. package/components/dialog/usePosition.ts +4 -0
  11. package/components/dropdown/usePosition.ts +19 -9
  12. package/components/editable/styles.ts +1 -1
  13. package/components/message/message.ts +10 -6
  14. package/components/message/message.vdt +1 -1
  15. package/components/message/messages.ts +10 -1
  16. package/components/message/messages.vdt +11 -8
  17. package/components/portal.ts +16 -3
  18. package/components/upload/useFiles.ts +3 -2
  19. package/es/components/button/index.vdt.js +1 -1
  20. package/es/components/button/styles.js +3 -3
  21. package/es/components/collapse/item.vdt.js +3 -3
  22. package/es/components/collapse/styles.js +4 -4
  23. package/es/components/diagram/index.d.ts +1 -1
  24. package/es/components/dialog/index.spec.js +61 -1
  25. package/es/components/dialog/usePosition.js +7 -0
  26. package/es/components/dropdown/usePosition.js +14 -11
  27. package/es/components/editable/styles.js +1 -1
  28. package/es/components/message/message.d.ts +1 -0
  29. package/es/components/message/message.js +12 -10
  30. package/es/components/message/message.vdt.js +2 -1
  31. package/es/components/message/messages.d.ts +5 -1
  32. package/es/components/message/messages.js +5 -1
  33. package/es/components/message/messages.vdt.js +13 -7
  34. package/es/components/portal.js +15 -3
  35. package/es/components/steps/context.d.ts +3 -3
  36. package/es/components/upload/useFiles.js +3 -2
  37. package/es/index.d.ts +2 -2
  38. package/es/index.js +2 -2
  39. package/es/packages/kpc-react/__tests__/components/cascader.spec.js +0 -1
  40. package/es/site/data/components/button/demos/disabled/react.js +3 -3
  41. package/es/site/data/components/button/demos/ghost/react.js +7 -3
  42. package/es/site/data/components/button/demos/group/react.js +5 -5
  43. package/es/site/data/components/config/demos/basic/index.d.ts +1 -0
  44. package/es/site/data/components/config/demos/basic/index.js +8 -0
  45. package/es/site/data/components/config/demos/basic/react.d.ts +1 -0
  46. package/es/site/data/components/config/demos/basic/react.js +9 -1
  47. package/es/site/data/components/menu/demos/collapse/react.d.ts +11 -0
  48. package/es/site/data/components/menu/demos/size/react.d.ts +7 -0
  49. package/es/styles/global.js +7 -2
  50. package/index.ts +2 -2
  51. package/package.json +4 -4
  52. package/styles/global.ts +28 -18
  53. package/es/components/cascader/index.d.ts +0 -45
  54. package/es/components/datepicker/index.d.ts +0 -63
  55. package/es/components/select/select.d.ts +0 -33
  56. package/es/components/timepicker/panelPicker.d.ts +0 -54
  57. package/es/components/treeSelect/index.d.ts +0 -28
@@ -7,7 +7,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
7
7
 
8
8
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
9
 
10
- function _unsupportedIterableToArray(o, minLen) { var _context21; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context21 = Object.prototype.toString.call(o)).call(_context21, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _unsupportedIterableToArray(o, minLen) { var _context23; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context23 = Object.prototype.toString.call(o)).call(_context23, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
11
 
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
13
 
@@ -732,6 +732,66 @@ describe('Dialog', function () {
732
732
  }
733
733
  }
734
734
  }, _callee14);
735
+ })));
736
+ it('should update position when change container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
737
+ var Demo, _mount15, instance, element, dialogDom, style;
738
+
739
+ return _regeneratorRuntime.wrap(function _callee15$(_context22) {
740
+ while (1) {
741
+ switch (_context22.prev = _context22.next) {
742
+ case 0:
743
+ Demo = /*#__PURE__*/function (_Component7) {
744
+ _inheritsLoose(Demo, _Component7);
745
+
746
+ function Demo() {
747
+ var _context21;
748
+
749
+ var _this7;
750
+
751
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
752
+ args[_key7] = arguments[_key7];
753
+ }
754
+
755
+ _this7 = _Component7.call.apply(_Component7, _concatInstanceProperty(_context21 = [this]).call(_context21, args)) || this;
756
+ _this7.Dialog = Dialog;
757
+ return _this7;
758
+ }
759
+
760
+ Demo.defaults = function defaults() {
761
+ return {
762
+ container: function container(parentDom) {
763
+ return parentDom;
764
+ }
765
+ };
766
+ };
767
+
768
+ return Demo;
769
+ }(Component);
770
+
771
+ Demo.template = "\n var Dialog = this.Dialog;\n <Dialog value={true} container={this.get('container')} ref=\"dialog\">test</Dialog>\n ";
772
+ _mount15 = mount(Demo), instance = _mount15[0], element = _mount15[1];
773
+ _context22.next = 5;
774
+ return wait();
775
+
776
+ case 5:
777
+ instance.set('container', undefined);
778
+ _context22.next = 8;
779
+ return wait();
780
+
781
+ case 8:
782
+ dialogDom = instance.refs.dialog.dialogRef.value;
783
+ style = dialogDom.style;
784
+ expect(style.left).not.eql('');
785
+ expect(style.top).not.eql(''); // should append to body
786
+
787
+ expect(dialogDom.closest('.k-dialog-wrapper').parentElement).to.eql(document.body);
788
+
789
+ case 13:
790
+ case "end":
791
+ return _context22.stop();
792
+ }
793
+ }
794
+ }, _callee15);
735
795
  }))); // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
736
796
  // const Test = {
737
797
  // template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
@@ -5,6 +5,13 @@ export function usePosition(elementRef) {
5
5
  var instance = useInstance();
6
6
  instance.on(SHOW, center);
7
7
  instance.on('afterClose', onAfterLeave);
8
+ instance.watch('container', function () {
9
+ if (!instance.get('value')) return;
10
+ center();
11
+ }, {
12
+ presented: true,
13
+ inited: true
14
+ });
8
15
 
9
16
  function center() {
10
17
  position(elementRef.value, {
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import { useInstance, findDomFromVNode } from 'intact';
3
3
  import { position } from '../position';
4
- import { noop } from 'intact-shared';
5
- import { isObject } from 'intact-shared';
4
+ import { noop, isObject, isFunction } from 'intact-shared';
6
5
  import { isEqualObject } from '../utils';
7
6
  export function usePosition() {
8
7
  var instance = useInstance();
@@ -16,19 +15,23 @@ export function usePosition() {
16
15
  });
17
16
  ['of', 'position'].forEach(function (item) {
18
17
  instance.watch(item, function (newValue, oldValue) {
19
- // return if object is the same
20
- if (isObject(newValue) && isObject(oldValue) && // is not event object
21
- !(newValue instanceof Event) && isEqualObject(newValue, oldValue)) {
22
- return;
23
- }
24
-
25
- if (instance.get('value')) {
26
- handle(noop);
27
- }
18
+ if (!instance.get('value') || // return if object is the same
19
+ isObject(newValue) && isObject(oldValue) && // is not event object
20
+ !(newValue instanceof Event) && isEqualObject(newValue, oldValue)) return;
21
+ handle(noop);
28
22
  }, {
29
23
  presented: true,
30
24
  inited: true
31
25
  });
26
+ }); // watch container, it is not commonly used
27
+
28
+ instance.watch('container', function (newValue, oldValue) {
29
+ if (!instance.get('value') || // return if function is the same. Not rigorous!
30
+ isFunction(newValue) && isFunction(oldValue) && newValue.toString() === oldValue.toString()) return;
31
+ handle(noop);
32
+ }, {
33
+ presented: true,
34
+ inited: true
32
35
  }); // if the dropdown is nested, we must show child after parent has positioned
33
36
 
34
37
  function p(ofElement, parentFeedback) {
@@ -22,5 +22,5 @@ setDefault(function () {
22
22
  });
23
23
  export { editable };
24
24
  export var makeStyles = cache(function makeStyles(k) {
25
- return /*#__PURE__*/css("display:inline-flex;align-items:center;.", k, "-editable-icon{margin:", editable.iconGap, ";}&.", k, "-invalid{.", k, "-input-inner{border:", editable.invalid.border, "!important;}}");
25
+ return /*#__PURE__*/css("display:inline-flex;align-items:center;.", k, "-editable-icon{margin:", editable.iconGap, ";}&.", k, "-invalid{.", k, "-input-wrapper{border:", editable.invalid.border, "!important;}}");
26
26
  });
@@ -10,6 +10,7 @@ export declare class Message extends Component<MessageProps> {
10
10
  static template: string | import("intact").Template<any>;
11
11
  static typeDefs: Required<TypeDefs<MessageProps>>;
12
12
  static defaults: () => Partial<MessageProps>;
13
+ static classNamePrefix: string;
13
14
  static notice(content: Children | Partial<MessageProps>, duration?: number, type?: MessageProps['type']): void;
14
15
  static info(content: Children | Partial<MessageProps>, duration?: number): void;
15
16
  static error(content: Children | Partial<MessageProps>, duration?: number): void;
@@ -54,16 +54,6 @@ export var Message = /*#__PURE__*/function (_Component) {
54
54
  type = 'info';
55
55
  }
56
56
 
57
- if (!messages) {
58
- var container = document.createElement('div');
59
- document.body.append(container);
60
- render(h(Messages, {
61
- ref: function ref(i) {
62
- return messages = i;
63
- }
64
- }), container);
65
- }
66
-
67
57
  if (isObject(content) && !content.tag) {
68
58
  content = _extends({}, content, {
69
59
  type: type,
@@ -78,6 +68,17 @@ export var Message = /*#__PURE__*/function (_Component) {
78
68
  };
79
69
  }
80
70
 
71
+ if (!messages) {
72
+ var container = document.createElement('div');
73
+ document.body.append(container);
74
+ render(h(Messages, {
75
+ ref: function ref(i) {
76
+ return messages = i;
77
+ },
78
+ classNamePrefix: Message.classNamePrefix
79
+ }), container);
80
+ }
81
+
81
82
  messages.notice(h(Message, content));
82
83
  };
83
84
 
@@ -108,5 +109,6 @@ export var Message = /*#__PURE__*/function (_Component) {
108
109
  Message.template = template;
109
110
  Message.typeDefs = typeDefs;
110
111
  Message.defaults = defaults;
112
+ Message.classNamePrefix = void 0;
111
113
 
112
114
  __decorate([bind], Message.prototype, "close", null);
@@ -16,7 +16,8 @@ export default function ($props, $blocks, $__proto__) {
16
16
  content = _this$get.content,
17
17
  children = _this$get.children,
18
18
  closable = _this$get.closable,
19
- hideIcon = _this$get.hideIcon;
19
+ hideIcon = _this$get.hideIcon,
20
+ classNamePrefix = _this$get.classNamePrefix;
20
21
 
21
22
  var k = this.config.k;
22
23
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-message"] = true, _classNameObj[k + "-" + type] = type, _classNameObj[makeMessageStyles(k)] = true, _classNameObj);
@@ -1,7 +1,11 @@
1
- import { Component, VNodeComponentClass } from 'intact';
1
+ import { Component, VNodeComponentClass, TypeDefs } from 'intact';
2
2
  import type { Message } from './message';
3
+ export interface MessagesProps {
4
+ classNamePrefix?: string;
5
+ }
3
6
  export declare class Messages extends Component {
4
7
  static template: string | import("intact").Template<any>;
8
+ static typeDefs: Required<TypeDefs<MessagesProps>>;
5
9
  private messages;
6
10
  private config;
7
11
  notice(message: VNodeComponentClass<Message>): void;
@@ -5,6 +5,9 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/spl
5
5
  import { Component } from 'intact';
6
6
  import template from './messages.vdt';
7
7
  import { useConfigContext } from '../config';
8
+ var typeDefs = {
9
+ classNamePrefix: String
10
+ };
8
11
  export var Messages = /*#__PURE__*/function (_Component) {
9
12
  _inheritsLoose(Messages, _Component);
10
13
 
@@ -48,4 +51,5 @@ export var Messages = /*#__PURE__*/function (_Component) {
48
51
 
49
52
  return Messages;
50
53
  }(Component);
51
- Messages.template = template;
54
+ Messages.template = template;
55
+ Messages.typeDefs = typeDefs;
@@ -1,17 +1,23 @@
1
- import { createElementVNode as _$ce, createUnknownComponentVNode as _$cc, map as _$ma, className as _$cn } from 'intact';
1
+ import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, map as _$ma, className as _$cn } from 'intact';
2
2
  import { TransitionGroup, Transition } from 'intact';
3
3
  import { makeMessagesStyles } from './styles';
4
+ import { ConfigProvider } from '../config';
4
5
  export default function ($props, $blocks, $__proto__) {
5
6
  var _$cn2;
6
7
 
7
8
  $blocks || ($blocks = {});
8
9
  $props || ($props = {});
9
10
  var $this = this;
10
- var k = this.config.k;
11
- return _$ce(2, 'div', _$cc(TransitionGroup, {
12
- 'children': _$ma(this.messages, function ($value, $key) {
13
- return $value;
14
- }, $this)
15
- }), 2, _$cn((_$cn2 = {}, _$cn2[k + "-messages"] = true, _$cn2[makeMessagesStyles(k)] = true, _$cn2)));
11
+ var k = this.get('classNamePrefix') || this.config.k;
12
+ return _$cc(ConfigProvider, {
13
+ 'value': {
14
+ classNamePrefix: k
15
+ },
16
+ 'children': _$ce(2, 'div', _$cc(TransitionGroup, {
17
+ 'children': _$ma(this.messages, function ($value, $key) {
18
+ return $value;
19
+ }, $this)
20
+ }), 2, _$cn((_$cn2 = {}, _$cn2[k + "-messages"] = true, _$cn2[makeMessagesStyles(k)] = true, _$cn2)))
21
+ });
16
22
  }
17
23
  ;
@@ -1,6 +1,6 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
- import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject } from 'intact';
3
+ import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject, unmount, removeVNodeDom } from 'intact';
4
4
  import { isString } from 'intact-shared';
5
5
  import { DIALOG } from './dialog/constants';
6
6
  import { BaseDialog } from './dialog/base';
@@ -51,7 +51,9 @@ export var Portal = /*#__PURE__*/function (_Component) {
51
51
  var nextProps = nextVNode.props;
52
52
  var fakeContainer = document.createDocumentFragment();
53
53
  (mountedQueue.priority || mountedQueue).push(function () {
54
- var parentDom = _this2.$lastInput.dom.parentElement;
54
+ var parentDom = _this2.$lastInput.dom.parentElement; // maybe the <!-- portal --> has been removed by react, #938
55
+
56
+ if (!parentDom) return;
55
57
 
56
58
  _this2.initContainer(nextProps.container, parentDom, anchor);
57
59
 
@@ -97,7 +99,14 @@ export var Portal = /*#__PURE__*/function (_Component) {
97
99
  };
98
100
 
99
101
  _proto.$unmount = function $unmount(vNode, nextVNode) {
100
- remove(vNode.props.children, this.container, false); // removeVNodeDom(vNode.props!.children as VNode, this.container!);
102
+ var children = vNode.props.children;
103
+ unmount(children, null);
104
+
105
+ if (this.container) {
106
+ // maybe the <!-- portal --> has been removed by react, #938
107
+ // remove(children, this.container, false);
108
+ removeVNodeDom(children, this.container);
109
+ }
101
110
 
102
111
  _Component.prototype.$unmount.call(this, vNode, nextVNode);
103
112
  };
@@ -109,6 +118,9 @@ export var Portal = /*#__PURE__*/function (_Component) {
109
118
  } else {
110
119
  this.container = container(parentDom, anchor);
111
120
  }
121
+ } else {
122
+ // let below logic to set container to default if container does not exist.
123
+ this.container = null;
112
124
  }
113
125
 
114
126
  if (!this.container) {
@@ -1,5 +1,5 @@
1
1
  export declare const context: {
2
- Provider: import("misstime").ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
3
- Consumer: import("misstime").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
4
- useContext: () => import("misstime").RefObject<any>;
2
+ Provider: import("vdt").ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
3
+ Consumer: import("vdt").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
4
+ useContext: () => import("vdt").RefObject<any>;
5
5
  };
@@ -9,6 +9,7 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/spl
9
9
  import { useInstance } from 'intact';
10
10
  import { _$ } from '../../i18n';
11
11
  import { UploadFileStatus } from './useUpload';
12
+ import { isEqualArray } from '../utils';
12
13
  var uid = 0;
13
14
  export function useFiles(isValidType, upload) {
14
15
  var instance = useInstance();
@@ -33,8 +34,8 @@ export function useFiles(isValidType, upload) {
33
34
  }
34
35
  }
35
36
 
36
- instance.on("$receive:files", function (files) {
37
- if (!files) return;
37
+ instance.on("$receive:files", function (files, oldFiles) {
38
+ if (!files || isEqualArray(files, oldFiles)) return;
38
39
  instance.set('files', _mapInstanceProperty(files).call(files, normalizeFile));
39
40
  });
40
41
 
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.4-beta.0
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -60,4 +60,4 @@ export * from './components/tree';
60
60
  export * from './components/treeSelect';
61
61
  export * from './components/upload';
62
62
  export * from './components/wave';
63
- export declare const version = "3.1.2";
63
+ export declare const version = "3.1.4-beta.0";
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.4-beta.0
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -62,5 +62,5 @@ export * from './components/tree';
62
62
  export * from './components/treeSelect';
63
63
  export * from './components/upload';
64
64
  export * from './components/wave';
65
- export var version = '3.1.2';
65
+ export var version = '3.1.4-beta.0';
66
66
  /* generate end */
@@ -36,7 +36,6 @@ describe('Cascader', function () {
36
36
  }]
37
37
  }],
38
38
  value: value,
39
- multiple: true,
40
39
  filterable: true,
41
40
  onChangeValue: function onChangeValue(v) {
42
41
  setValue(v);
@@ -1,6 +1,6 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import React from 'react';
3
- import { Button } from '@king-design/react';
3
+ import { Button, Icon } from '@king-design/react';
4
4
 
5
5
  var Demo = /*#__PURE__*/function (_React$Component) {
6
6
  _inheritsLoose(Demo, _React$Component);
@@ -21,8 +21,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
21
21
  disabled: true,
22
22
  icon: true,
23
23
  circle: true
24
- }, /*#__PURE__*/React.createElement("i", {
25
- className: "k-icon k-icon-search"
24
+ }, /*#__PURE__*/React.createElement(Icon, {
25
+ className: "k-icon-search"
26
26
  })), /*#__PURE__*/React.createElement(Button, {
27
27
  disabled: true,
28
28
  type: "link"
@@ -1,6 +1,6 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import React from 'react';
3
- import { Button } from '@king-design/react';
3
+ import { Button, Icon } from '@king-design/react';
4
4
  import './index.styl';
5
5
 
6
6
  var Demo = /*#__PURE__*/function (_React$Component) {
@@ -17,10 +17,14 @@ var Demo = /*#__PURE__*/function (_React$Component) {
17
17
  className: "wrapper"
18
18
  }, /*#__PURE__*/React.createElement(Button, {
19
19
  ghost: true
20
- }, "default"), /*#__PURE__*/React.createElement(Button, {
20
+ }, /*#__PURE__*/React.createElement(Icon, {
21
+ className: "k-icon-left"
22
+ }), "default"), /*#__PURE__*/React.createElement(Button, {
21
23
  type: "primary",
22
24
  ghost: true
23
- }, "primay"), /*#__PURE__*/React.createElement(Button, {
25
+ }, "primay", /*#__PURE__*/React.createElement(Icon, {
26
+ className: "k-icon-right"
27
+ })), /*#__PURE__*/React.createElement(Button, {
24
28
  type: "warning",
25
29
  ghost: true
26
30
  }, "warning"), /*#__PURE__*/React.createElement(Button, {
@@ -1,7 +1,7 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
3
  import React from 'react';
4
- import { Button, ButtonGroup } from '@king-design/react';
4
+ import { Button, ButtonGroup, Icon } from '@king-design/react';
5
5
  import './index.styl';
6
6
 
7
7
  var Demo = /*#__PURE__*/function (_React$Component) {
@@ -45,12 +45,12 @@ var Demo = /*#__PURE__*/function (_React$Component) {
45
45
  type: "flat"
46
46
  }, "\u91CD\u542F")), /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, {
47
47
  type: "primary"
48
- }, /*#__PURE__*/React.createElement("i", {
49
- className: "k-icon k-icon-left"
48
+ }, /*#__PURE__*/React.createElement(Icon, {
49
+ className: "k-icon-left"
50
50
  }), "\u4E0A\u4E00\u9875"), /*#__PURE__*/React.createElement(Button, {
51
51
  type: "primary"
52
- }, "\u4E0B\u4E00\u9875", /*#__PURE__*/React.createElement("i", {
53
- className: "k-icon k-icon-right"
52
+ }, "\u4E0B\u4E00\u9875", /*#__PURE__*/React.createElement(Icon, {
53
+ className: "k-icon-right"
54
54
  }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u7EB5\u5411\u6309\u94AE\u7EC4"), /*#__PURE__*/React.createElement(ButtonGroup, {
55
55
  vertical: true
56
56
  }, /*#__PURE__*/React.createElement(Button, {
@@ -2,4 +2,5 @@ export { default as data } from './index.json';
2
2
  import { Component } from 'intact';
3
3
  export default class extends Component {
4
4
  static template: string | import("intact").Template<any>;
5
+ showMessage(): void;
5
6
  }
@@ -2,6 +2,8 @@ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  export { default as data } from './index.json';
3
3
  import { Component } from 'intact';
4
4
  import template from './index.vdt';
5
+ import { Message } from 'kpc';
6
+ Message.classNamePrefix = 'kd';
5
7
 
6
8
  var default_1 = /*#__PURE__*/function (_Component) {
7
9
  _inheritsLoose(default_1, _Component);
@@ -10,6 +12,12 @@ var default_1 = /*#__PURE__*/function (_Component) {
10
12
  return _Component.apply(this, arguments) || this;
11
13
  }
12
14
 
15
+ var _proto = default_1.prototype;
16
+
17
+ _proto.showMessage = function showMessage() {
18
+ Message.info('Message with classNamePrefix');
19
+ };
20
+
13
21
  return default_1;
14
22
  }(Component);
15
23
 
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  export default class Demo extends React.Component {
3
+ showMessage(): void;
3
4
  render(): JSX.Element;
4
5
  }
@@ -1,6 +1,8 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import React from 'react';
3
3
  import { ConfigProvider, Button, Input } from '@king-design/react';
4
+ import { Message } from '@king-design/react';
5
+ Message.classNamePrefix = 'kd';
4
6
 
5
7
  var Demo = /*#__PURE__*/function (_React$Component) {
6
8
  _inheritsLoose(Demo, _React$Component);
@@ -11,12 +13,18 @@ var Demo = /*#__PURE__*/function (_React$Component) {
11
13
 
12
14
  var _proto = Demo.prototype;
13
15
 
16
+ _proto.showMessage = function showMessage() {
17
+ Message.info('Message with classNamePrefix');
18
+ };
19
+
14
20
  _proto.render = function render() {
15
21
  return /*#__PURE__*/React.createElement(ConfigProvider, {
16
22
  value: {
17
23
  classNamePrefix: 'kd'
18
24
  }
19
- }, /*#__PURE__*/React.createElement(Button, null, "Button"), /*#__PURE__*/React.createElement("div", {
25
+ }, /*#__PURE__*/React.createElement(Button, {
26
+ onClick: this.showMessage
27
+ }, "Button"), /*#__PURE__*/React.createElement("div", {
20
28
  style: {
21
29
  "marginTop": "8px"
22
30
  }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { MenuProps } from '@king-design/react';
3
+ interface Props extends MenuProps {
4
+ }
5
+ export default class Demo extends React.Component<{}, Props> {
6
+ state: MenuProps<import("vdt").Key>;
7
+ private __test;
8
+ setTheme(theme?: string): void;
9
+ render(): JSX.Element;
10
+ }
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './index.styl';
3
+ import type { MenuProps } from '@king-design/react';
4
+ export default class Demo extends React.Component {
5
+ state: MenuProps<import("vdt").Key>;
6
+ render(): JSX.Element;
7
+ }
@@ -10,8 +10,13 @@ var slideDirections = {
10
10
  up: 'center bottom 0',
11
11
  left: 'right center 0',
12
12
  right: 'left center 0'
13
- }; // TODO: update global when theme changed
13
+ };
14
14
 
15
- injectGlobal("html{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}::-webkit-scrollbar{width:10px;height:10px;background-color:#fff;}::-webkit-scrollbar-track{background-color:#fff;}::-webkit-scrollbar-thumb{background-color:#babac0;border-radius:16px;border:2px solid #fff;&:hover{background-color:#a0a0a5;}}::-webkit-scroll-button{display:none;}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
15
+ if (!/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
16
+ document.body.classList.add('k-customize-scrollbar');
17
+ } // TODO: update global when theme changed
18
+
19
+
20
+ injectGlobal("html{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}.k-customize-scrollbar{&::-webkit-scrollbar,*::-webkit-scrollbar{width:10px;height:10px;background-color:#fff;}&::-webkit-scrollbar-track,*::-webkit-scrollbar-track{background-color:#fff;}&::-webkit-scrollbar-thumb,*::-webkit-scrollbar-thumb{background-color:#babac0;border-radius:16px;border:2px solid #fff;&:hover{background-color:#a0a0a5;}}&::-webkit-scroll-button,*::-webkit-scroll-button{display:none;}}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
16
21
  return /*#__PURE__*/css(".k-slide", direction, "-enter-from,.k-slide", direction, "-leave-to{transform-origin:", slideDirections[direction], ";opacity:0;transform:", direction === 'down' || direction === 'up' ? "scaleY(.8)" : 'scaleX(.8)', ";}.k-slide", direction, "-enter-active,.k-slide", direction, "-leave-active{transform-origin:", slideDirections[direction], ";transition:opacity ", theme.transition.large, ",transform ", theme.transition.large, "!important;}.k-slide", direction, "-leave-active{pointer-events:none;}");
17
22
  }), " .k-fade-enter-from,.k-fade-leave-to{opacity:0!important;}.k-fade-enter-active,.k-fade-leave-active{transition:opacity ", theme.transition.large, "!important;}.k-fade-leave-active:not(tr){position:absolute;}.k-fade-move{transition:transform ", theme.transition.large, "!important;}.k-scale-enter-from,.k-scale-leave-to{transform:scale(0);}.k-scale-enter-active,.k-scale-leave-active{transition:transform ", theme.transition.large, ";}.k-expand-enter-from,.k-expand-leave-to{opacity:0;overflow:hidden;}.k-expand-enter-active,.k-expand-leave-active{transition:all ", theme.transition.large, "!important;overflow:hidden;}.k-expand-move{transition:transform ", theme.transition.large, ";}.k-dropdown-enter-from,.k-dropdown-leave-to{opacity:0;transform:translateY(-20px);}.k-dropdown-enter-active,.k-dropdown-leave-active,.k-dropdown-move{transition:all ", theme.transition.large, ";}.k-dropdown-leave-active{position:absolute!important;}.k-dropdown-move{transition:transform ", theme.transition.large, ";}.k-fade-in-left-enter-from,.k-fade-in-left-leave-to{opacity:0;transform:translate3d(-15px, 0, 0);}.k-fade-in-left-enter-active,.k-fade-in-left-leave-active{transition:all ", theme.transition.large, ";}.k-fade-in-left-move{transition:transform ", theme.transition.large, ";}.k-fade-expand-enter-from,.k-fade-expand-leave-to{opacity:0;}.k-fade-expand-enter-active,.k-fade-expand-leave-active{transition:all ", theme.transition.large, ";}.c-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.c-hidden{display:none!important;}.c-middle{display:inline-block;vertical-align:middle;}");
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.4-beta.0
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -65,6 +65,6 @@ export * from './components/treeSelect';
65
65
  export * from './components/upload';
66
66
  export * from './components/wave';
67
67
 
68
- export const version = '3.1.2';
68
+ export const version = '3.1.4-beta.0';
69
69
 
70
70
  /* generate end */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/intact",
3
- "version": "3.1.2",
3
+ "version": "3.1.4-beta.0",
4
4
  "description": "A component library written in Intact for Intact, Vue, React and Angular",
5
5
  "main": "es/index.js",
6
6
  "engines": {
@@ -120,7 +120,7 @@
120
120
  "highlight.js": "^10.4.1",
121
121
  "history": "^5.0.0",
122
122
  "html-webpack-plugin": "5.3.1",
123
- "intact-react": "^3.0.23",
123
+ "intact-react": "^3.0.24",
124
124
  "istanbul-instrumenter-loader": "^3.0.0",
125
125
  "js-yaml": "^4.1.0",
126
126
  "karma": "^6.3.2",
@@ -179,10 +179,10 @@
179
179
  "dependencies": {
180
180
  "@babel/runtime-corejs3": "^7.16.0",
181
181
  "@emotion/css": "^11.5.0",
182
- "@king-design/react": "^3.1.2",
182
+ "@king-design/react": "^3.1.4-beta.0",
183
183
  "dayjs": "^1.10.7",
184
184
  "enquire.js": "^2.1.6",
185
- "intact": "^3.0.19",
185
+ "intact": "^3.0.25",
186
186
  "monaco-editor": "^0.26.1",
187
187
  "mxgraphx": "^4.0.7",
188
188
  "resize-observer-polyfill": "^1.5.1",