@king-design/vue 2.0.9 → 2.0.11

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.
@@ -30,7 +30,8 @@ var typeDefs = {
30
30
  terminate: Function,
31
31
  escClosable: Boolean,
32
32
  width: [String, Number],
33
- mode: ['destroy', 'hide']
33
+ mode: ['destroy', 'hide'],
34
+ draggable: Boolean
34
35
  };
35
36
 
36
37
  var defaults = function defaults() {
@@ -43,7 +44,8 @@ var defaults = function defaults() {
43
44
  overlay: true,
44
45
  closable: true,
45
46
  escClosable: true,
46
- mode: 'hide'
47
+ mode: 'hide',
48
+ draggable: true
47
49
  };
48
50
  };
49
51
 
@@ -49,6 +49,9 @@ export function useDraggable(dialogRef, areaRef) {
49
49
 
50
50
  return useBaseDraggable({
51
51
  onStart: onStart,
52
- onMove: onMove
52
+ onMove: onMove,
53
+ disable: function disable() {
54
+ return !component.get('draggable');
55
+ }
53
56
  });
54
57
  }
@@ -34,7 +34,7 @@ export function useEscClosable() {
34
34
  }
35
35
  }
36
36
 
37
- _spliceInstanceProperty(dialogs).call(dialogs, 0, index);
37
+ _spliceInstanceProperty(dialogs).call(dialogs, index, 1);
38
38
 
39
39
  if (!dialogs.length) {
40
40
  document.removeEventListener('keydown', escClose);
@@ -10,7 +10,8 @@ var typeDefs = _extends({}, BaseDialog.typeDefs, {
10
10
 
11
11
  var defaults = function defaults() {
12
12
  return _extends({}, BaseDialog.defaults(), {
13
- placement: 'right'
13
+ placement: 'right',
14
+ draggable: false
14
15
  });
15
16
  };
16
17
 
@@ -97,13 +97,17 @@ export var Portal = /*#__PURE__*/function (_Component) {
97
97
 
98
98
  if (!this.container) {
99
99
  // find the closest dialog if exists
100
- var tmp;
101
-
102
- if ((tmp = this.dialog) && tmp !== this.$senior && (tmp = tmp.dialogRef.value)) {
103
- this.container = tmp;
104
- } else {
105
- this.container = document.body;
106
- }
100
+ this.container = parentDom.closest('.k-dialog') || document.body;
101
+ /**
102
+ * @FIXME: We cannot get parent ref from sub component in Vue
103
+ */
104
+ // find the closest dialog if exists
105
+ // let tmp;
106
+ // if ((tmp = this.dialog) && (tmp !== this.$senior) && (tmp = tmp.dialogRef.value)) {
107
+ // this.container = tmp;
108
+ // } else {
109
+ // this.container = document.body;
110
+ // }
107
111
  }
108
112
  };
109
113
 
@@ -35,6 +35,7 @@ export interface BaseSelectBlocks<V> {
35
35
  suffix: null;
36
36
  }
37
37
  export declare abstract class BaseSelect<T extends BaseSelectProps<any> = BaseSelectProps<any>, E extends BaseSelectEvents = BaseSelectEvents, B extends BaseSelectBlocks<any> = BaseSelectBlocks<any>> extends Component<T, E, B> {
38
+ static $doubleVNodes: boolean;
38
39
  static template: string | import("intact").Template<any>;
39
40
  static typeDefs: Required<TypeDefs<BaseSelectProps<any, boolean, any>>>;
40
41
  static defaults: () => Partial<BaseSelectProps<any, boolean, any>>;
@@ -138,6 +138,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
138
138
 
139
139
  return BaseSelect;
140
140
  }(Component);
141
+ BaseSelect.$doubleVNodes = true;
141
142
  BaseSelect.template = template;
142
143
  BaseSelect.typeDefs = typeDefs;
143
144
  BaseSelect.defaults = defaults;
@@ -2,6 +2,7 @@ import { Children, Component } from 'intact-vue-next';
2
2
  declare type BaseLabelProps = {
3
3
  value: any;
4
4
  multiple: boolean;
5
+ filterable: boolean;
5
6
  };
6
7
  export declare function useBaseLabel<T, C extends Component<P>, P extends BaseLabelProps>(getChildren: () => T, findLabelFromChildren: (children: T, value: any) => Children): {
7
8
  getLabel: () => Children;
@@ -2,7 +2,7 @@ import _Map from "@babel/runtime-corejs3/core-js/map";
2
2
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
3
3
  import { useInstance } from 'intact-vue-next';
4
4
  import { isNullOrUndefined, isStringOrNumber } from 'intact-shared';
5
- import { isEmptyString } from '../utils';
5
+ import { isEmptyString, getTextByChildren } from '../utils';
6
6
  export function useBaseLabel(getChildren, findLabelFromChildren) {
7
7
  var instance = useInstance();
8
8
  var labelMap = new _Map();
@@ -36,6 +36,10 @@ export function useBaseLabel(getChildren, findLabelFromChildren) {
36
36
  if (isNullOrUndefined(label)) {
37
37
  label = labelMap.get(value);
38
38
  } else {
39
+ if (instance.get('filterable')) {
40
+ label = getTextByChildren(label);
41
+ }
42
+
39
43
  labelMap.set(value, label);
40
44
  }
41
45
 
@@ -2,6 +2,7 @@ export declare type Options = {
2
2
  onStart?: (e: MouseEvent) => void;
3
3
  onMove: (e: MouseEvent) => void;
4
4
  onEnd?: (e?: MouseEvent) => void;
5
+ disable?: () => boolean;
5
6
  };
6
7
  export declare function useDraggable(options: Options): {
7
8
  start: (e: MouseEvent) => void;
@@ -5,7 +5,7 @@ export function useDraggable(options) {
5
5
 
6
6
  function start(e) {
7
7
  // ignore if it isn't left key
8
- if (e.which !== 1) return;
8
+ if (e.which !== 1 || options.disable != null && options.disable()) return;
9
9
  dragging.set(true);
10
10
 
11
11
  if (options.onStart) {
@@ -17,6 +17,7 @@ export function useDraggable(options) {
17
17
  }
18
18
 
19
19
  function move(e) {
20
+ if (options.disable != null && options.disable()) return;
20
21
  e.preventDefault();
21
22
 
22
23
  if (dragging.value) {
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v2.0.9
2
+ * @king-design v2.0.11
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.9";
60
+ export declare const version = "2.0.11";
61
61
 
62
62
 
63
63
  export {normalize} from 'intact-vue-next';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v2.0.9
2
+ * @king-design v2.0.11
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.9';
62
+ export var version = '2.0.11';
63
63
  /* generate end */
64
64
 
65
65
  export {normalize} from 'intact-vue-next';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/vue",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "King-Design UI components for Vue3.0.",
5
5
  "keywords": [
6
6
  "component",
@@ -38,7 +38,7 @@
38
38
  "dayjs": "^1.10.7",
39
39
  "downloadjs": "^1.4.7",
40
40
  "enquire.js": "^2.1.6",
41
- "intact-vue-next": "^3.0.10",
41
+ "intact-vue-next": "^3.0.12",
42
42
  "monaco-editor": "^0.26.1",
43
43
  "mxgraphx": "^4.0.7",
44
44
  "resize-observer-polyfill": "^1.5.1",