@king-design/intact 2.0.9 → 2.0.10

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 (39) hide show
  1. package/components/dialog/base.ts +3 -0
  2. package/components/dialog/index.md +1 -0
  3. package/components/dialog/useDraggable.ts +4 -2
  4. package/components/drawer/index.ts +1 -0
  5. package/components/portal.ts +12 -6
  6. package/components/select/base.ts +3 -0
  7. package/components/select/useBaseLabel.ts +6 -1
  8. package/dist/fonts/ionicons.eot +0 -0
  9. package/dist/fonts/ionicons.svg +2230 -0
  10. package/dist/fonts/ionicons.ttf +0 -0
  11. package/dist/fonts/ionicons.woff +0 -0
  12. package/dist/i18n/en-US.js +218 -0
  13. package/dist/i18n/en-US.min.js +1 -0
  14. package/dist/kpc.css +3 -0
  15. package/dist/kpc.js +39860 -0
  16. package/dist/kpc.min.js +1 -0
  17. package/dist/kpc.react.js +90483 -0
  18. package/dist/kpc.react.min.js +1 -0
  19. package/dist/kpc.vue.js +48096 -0
  20. package/dist/kpc.vue.min.js +1 -0
  21. package/dist/ksyun.css +3 -0
  22. package/es/components/dialog/base.d.ts +1 -0
  23. package/es/components/dialog/base.js +4 -2
  24. package/es/components/dialog/useDraggable.js +4 -1
  25. package/es/components/drawer/index.js +2 -1
  26. package/es/components/portal.js +11 -7
  27. package/es/components/select/base.d.ts +1 -0
  28. package/es/components/select/base.js +1 -0
  29. package/es/components/select/useBaseLabel.d.ts +1 -0
  30. package/es/components/select/useBaseLabel.js +5 -1
  31. package/es/hooks/useDraggable.d.ts +1 -0
  32. package/es/hooks/useDraggable.js +2 -1
  33. package/es/index.d.ts +2 -2
  34. package/es/index.js +2 -2
  35. package/es/packages/kpc-react/__tests__/components/select.spec.d.ts +1 -0
  36. package/es/packages/kpc-react/__tests__/components/select.spec.js +64 -0
  37. package/hooks/useDraggable.ts +4 -1
  38. package/index.ts +2 -2
  39. package/package.json +3 -3
@@ -31,6 +31,7 @@ export interface BaseDialogProps {
31
31
  escClosable?: boolean
32
32
  width?: string | number
33
33
  mode?: 'destroy' | 'hide'
34
+ draggable?: boolean
34
35
  }
35
36
 
36
37
  export interface BaseDialogEvents {
@@ -68,6 +69,7 @@ const typeDefs: Required<TypeDefs<BaseDialogProps>> = {
68
69
  escClosable: Boolean,
69
70
  width: [String, Number],
70
71
  mode: ['destroy', 'hide'],
72
+ draggable: Boolean,
71
73
  };
72
74
 
73
75
  const defaults = (): Partial<BaseDialogProps> => ({
@@ -80,6 +82,7 @@ const defaults = (): Partial<BaseDialogProps> => ({
80
82
  closable: true,
81
83
  escClosable: true,
82
84
  mode: 'hide',
85
+ draggable: true,
83
86
  });
84
87
 
85
88
  const events: Events<BaseDialogEvents> = {
@@ -53,6 +53,7 @@ sidebar: doc
53
53
  | escClosable | 是否按ESC时关闭弹窗 | `boolean` | `true` |
54
54
  | width | 指定弹窗宽度,`number`类型时,单位为`px`;`string`类型时,需要指定单位 | `number` &#124; `string` | `undefined` |
55
55
  | mode | 指定主体元素在关闭状态下的渲染方式,`"destroy"`代表直接销毁,`"hide"`代表只是隐藏 | `"destroy"` &#124; `"hide"` | `"hide"` |
56
+ | draggable | 弹窗是否可拖拽 | `boolean` | `true` |
56
57
 
57
58
  ```ts
58
59
  export type Container = string | ((parentDom: Element, anchor: Node | null) => Element)
@@ -5,7 +5,7 @@ import type {Dialog} from './index';
5
5
 
6
6
  export function useDraggable(
7
7
  dialogRef: RefObject<HTMLDivElement>,
8
- areaRef: RefObject<HTMLDivElement>
8
+ areaRef: RefObject<HTMLDivElement>,
9
9
  ) {
10
10
  const component = useInstance() as Dialog;
11
11
  let x = 0;
@@ -60,5 +60,7 @@ export function useDraggable(
60
60
  style.top = `${top}px`;
61
61
  }
62
62
 
63
- return useBaseDraggable({onStart, onMove});
63
+ return useBaseDraggable({onStart, onMove, disable() {
64
+ return !component.get('draggable');
65
+ }});
64
66
  }
@@ -15,6 +15,7 @@ const typeDefs: Required<TypeDefs<DrawerProps>> = {
15
15
  const defaults = (): Partial<DrawerProps> => ({
16
16
  ...BaseDialog.defaults(),
17
17
  placement: 'right',
18
+ draggable: false,
18
19
  });
19
20
 
20
21
  export class Drawer extends BaseDialog<DrawerProps> {
@@ -132,12 +132,18 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
132
132
  }
133
133
  if (!this.container) {
134
134
  // find the closest dialog if exists
135
- let tmp;
136
- if ((tmp = this.dialog) && (tmp !== this.$senior) && (tmp = tmp.dialogRef.value)) {
137
- this.container = tmp;
138
- } else {
139
- this.container = document.body;
140
- }
135
+ this.container = parentDom.closest('.k-dialog') || document.body;
136
+
137
+ /**
138
+ * @FIXME: We cannot get parent ref from sub component in Vue
139
+ */
140
+ // find the closest dialog if exists
141
+ // let tmp;
142
+ // if ((tmp = this.dialog) && (tmp !== this.$senior) && (tmp = tmp.dialogRef.value)) {
143
+ // this.container = tmp;
144
+ // } else {
145
+ // this.container = document.body;
146
+ // }
141
147
  }
142
148
  }
143
149
  }
@@ -88,6 +88,9 @@ export abstract class BaseSelect<
88
88
  E extends BaseSelectEvents = BaseSelectEvents,
89
89
  B extends BaseSelectBlocks<any> = BaseSelectBlocks<any>,
90
90
  > extends Component<T, E, B> {
91
+ // for intact-react, intact-vue-next and intact-vue
92
+ static $doubleVNodes = true;
93
+
91
94
  static template = template;
92
95
  static typeDefs = typeDefs;
93
96
  static defaults = defaults;
@@ -1,10 +1,11 @@
1
1
  import {Children, useInstance, Component} from 'intact';
2
2
  import {isNullOrUndefined, isStringOrNumber} from 'intact-shared';
3
- import {isEmptyString} from '../utils';
3
+ import {isEmptyString, getTextByChildren} from '../utils';
4
4
 
5
5
  type BaseLabelProps = {
6
6
  value: any,
7
7
  multiple: boolean,
8
+ filterable: boolean,
8
9
  }
9
10
 
10
11
  export function useBaseLabel<T, C extends Component<P>, P extends BaseLabelProps>(
@@ -41,6 +42,10 @@ export function useBaseLabel<T, C extends Component<P>, P extends BaseLabelProps
41
42
  if (isNullOrUndefined(label)) {
42
43
  label = labelMap.get(value);
43
44
  } else {
45
+ if (instance.get('filterable')) {
46
+ label = getTextByChildren(label);
47
+ }
48
+
44
49
  labelMap.set(value, label);
45
50
  }
46
51
 
Binary file