@king-design/react 2.0.5 → 2.0.6

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.
@@ -41,7 +41,7 @@ describe('React Demos', () => {
41
41
  testDemos(reactReq, async (Demo) => {
42
42
  const [instance, element] = mount(wrap(Demo as any));
43
43
  await wait(100);
44
- // FIXME: I don't why the width of `autoWidth` input is an unexpected value
44
+ // FIXME: I don't know why the width of `autoWidth` input is an unexpected value
45
45
  // while we run test on Github Actions.
46
46
  const innerHTML = element.innerHTML.replace(/(\<input.*?style="width: )(?:.*?)(px;")/g, '$1$2');
47
47
  expect(innerHTML).to.matchSnapshot();
@@ -15,7 +15,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
15
15
  }
16
16
 
17
17
  if ($vNode === void 0) {
18
- $vNode = null;
18
+ $vNode = createVNode(BaseDialog);
19
19
  }
20
20
 
21
21
  if ($SVG === void 0) {
@@ -38,13 +38,14 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
38
38
  var _proto = BaseDialog.prototype;
39
39
 
40
40
  _proto.init = function init() {
41
- _BaseDialog2.prototype.init.call(this);
41
+ _BaseDialog2.prototype.init.call(this); // @ts-ignore
42
42
 
43
- usePosition(this.dialogRef);
44
43
 
45
- if (this.$vNode) {
44
+ if (this.$vNode.tag !== BaseDialog) {
46
45
  this.useAsComponent = true;
47
46
  }
47
+
48
+ usePosition(this.dialogRef);
48
49
  };
49
50
 
50
51
  _proto.show = function show() {
@@ -68,7 +69,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
68
69
 
69
70
  _this2.$init(null);
70
71
 
71
- var vNode = _this2.$vNode = createVNode(BaseDialog);
72
+ var vNode = _this2.$vNode;
72
73
  vNode.children = _this2;
73
74
 
74
75
  _this2.$render(null, vNode, document.body, null, mountedQueue);
@@ -5,6 +5,7 @@ export interface AlertDialogProps extends DialogProps {
5
5
  type?: 'success' | 'warning' | 'error' | 'confirm';
6
6
  hideIcon?: boolean;
7
7
  hideFooter?: boolean;
8
+ ref?: (i: Dialog) => void;
8
9
  }
9
10
  export declare type StaticMethod = (options?: AlertDialogProps) => Promise<void>;
10
11
  export declare function addStaticMethods(Component: typeof Dialog): void;
@@ -29,9 +29,10 @@ export function addStaticMethods(Component) {
29
29
  options = {};
30
30
  }
31
31
 
32
+ var dialog = new AlertDialog(options);
33
+ dialog.show();
34
+ if (options.ref) options.ref(dialog);
32
35
  return new _Promise(function (resolve, reject) {
33
- var dialog = new AlertDialog(options, null, false, [], null);
34
- dialog.show();
35
36
  dialog.on('ok', function () {
36
37
  resolve();
37
38
  });
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v2.0.5
2
+ * @king-design v2.0.6
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -57,7 +57,7 @@ export * from './components/tree';
57
57
  export * from './components/treeSelect';
58
58
  export * from './components/upload';
59
59
  export * from './components/wave';
60
- export declare const version = "2.0.5";
60
+ export declare const version = "2.0.6";
61
61
 
62
62
 
63
63
  export {normalize} from 'intact-react';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v2.0.5
2
+ * @king-design v2.0.6
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -59,7 +59,7 @@ export * from './components/tree';
59
59
  export * from './components/treeSelect';
60
60
  export * from './components/upload';
61
61
  export * from './components/wave';
62
- export var version = '2.0.5';
62
+ export var version = '2.0.6';
63
63
  /* generate end */
64
64
 
65
65
  export {normalize} from 'intact-react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/react",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "King-Design UI components for React.",
5
5
  "keywords": [
6
6
  "component",