@king-design/intact 2.0.1 → 2.0.4
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.
- package/components/cascader/index.spec.ts +59 -0
- package/components/cascader/index.vdt +4 -4
- package/components/cascader/useLabel.ts +9 -9
- package/components/dropdown/dropdown.ts +5 -6
- package/components/form/index.spec.ts +1 -1
- package/components/menu/demos/collapse.md +3 -1
- package/components/menu/index.spec.ts +10 -4
- package/components/menu/item.ts +5 -4
- package/components/menu/item.vdt +3 -3
- package/components/menu/menu.ts +4 -0
- package/components/menu/useExpanded.ts +1 -1
- package/components/menu/useHighlight.ts +45 -40
- package/components/portal.ts +1 -1
- package/components/skeleton/demos/animate.md +30 -0
- package/components/skeleton/demos/avator.md +30 -0
- package/components/skeleton/demos/basic.md +30 -0
- package/components/skeleton/demos/custom.md +39 -0
- package/components/skeleton/demos/rows.md +32 -0
- package/components/skeleton/index.md +24 -0
- package/components/skeleton/index.ts +2 -0
- package/components/skeleton/item.ts +30 -0
- package/components/skeleton/item.vdt +28 -0
- package/components/skeleton/skeleton.ts +33 -0
- package/components/skeleton/skeleton.vdt +32 -0
- package/components/skeleton/style.ts +105 -0
- package/components/tree/useFilter.ts +1 -2
- package/es/components/cascader/index.spec.js +88 -0
- package/es/components/cascader/index.vdt.js +4 -4
- package/es/components/cascader/useLabel.js +8 -12
- package/es/components/dropdown/dropdown.js +7 -7
- package/es/components/form/index.spec.js +2 -4
- package/es/components/menu/index.spec.js +13 -6
- package/es/components/menu/item.d.ts +0 -1
- package/es/components/menu/item.js +6 -4
- package/es/components/menu/item.vdt.js +4 -4
- package/es/components/menu/menu.d.ts +3 -0
- package/es/components/menu/menu.js +4 -0
- package/es/components/menu/useExpanded.d.ts +1 -4
- package/es/components/menu/useHighlight.d.ts +5 -8
- package/es/components/menu/useHighlight.js +44 -33
- package/es/components/portal.js +1 -1
- package/es/components/skeleton/index.d.ts +2 -0
- package/es/components/skeleton/index.js +2 -0
- package/es/components/skeleton/item.d.ts +16 -0
- package/es/components/skeleton/item.js +26 -0
- package/es/components/skeleton/item.vdt.js +35 -0
- package/es/components/skeleton/skeleton.d.ts +17 -0
- package/es/components/skeleton/skeleton.js +30 -0
- package/es/components/skeleton/skeleton.vdt.js +37 -0
- package/es/components/skeleton/style.d.ts +6 -0
- package/es/components/skeleton/style.js +35 -0
- package/es/components/tree/useFilter.js +1 -2
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/packages/kpc-react/__tests__/components/form.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/form.spec.js +46 -0
- package/es/site/data/components/menu/demos/collapse/index.js +1 -0
- package/es/site/data/components/menu/demos/collapse/react.js +7 -0
- package/es/site/data/components/skeleton/demos/animate/index.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/animate/index.js +23 -0
- package/es/site/data/components/skeleton/demos/animate/react.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/animate/react.js +38 -0
- package/es/site/data/components/skeleton/demos/avator/index.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/avator/index.js +23 -0
- package/es/site/data/components/skeleton/demos/avator/react.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/avator/react.js +37 -0
- package/es/site/data/components/skeleton/demos/basic/index.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/basic/index.js +23 -0
- package/es/site/data/components/skeleton/demos/basic/react.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/basic/react.js +36 -0
- package/es/site/data/components/skeleton/demos/custom/index.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/custom/index.js +23 -0
- package/es/site/data/components/skeleton/demos/custom/react.d.ts +11 -0
- package/es/site/data/components/skeleton/demos/custom/react.js +60 -0
- package/es/site/data/components/skeleton/demos/rows/index.d.ts +13 -0
- package/es/site/data/components/skeleton/demos/rows/index.js +24 -0
- package/es/site/data/components/skeleton/demos/rows/react.d.ts +13 -0
- package/es/site/data/components/skeleton/demos/rows/react.js +38 -0
- package/es/site/data/components/skeleton/index.d.ts +57 -0
- package/es/site/data/components/skeleton/index.js +42 -0
- package/es/site/src/client.js +4 -4
- package/es/site/src/components/footer/styles.js +1 -1
- package/es/site/src/pages/colorProcess/index.d.ts +21 -0
- package/es/site/src/pages/colorProcess/index.js +79 -0
- package/es/site/src/pages/colorProcess/style.d.ts +3 -0
- package/es/site/src/pages/colorProcess/style.js +53 -0
- package/es/site/src/pages/font/index.d.ts +12 -0
- package/es/site/src/pages/font/index.js +22 -0
- package/es/site/src/pages/font/styles.d.ts +1 -0
- package/es/site/src/pages/font/styles.js +9 -0
- package/es/site/src/pages/iframe/colorProcess/styles.js +2 -2
- package/es/site/src/pages/index/BestPractice/styles.js +1 -1
- package/es/site/src/pages/index/ColorProcess/styles.js +2 -2
- package/es/site/src/pages/index/KingVersion/styles.js +1 -1
- package/es/site/src/pages/index/NewFunction/index.d.ts +2 -0
- package/es/site/src/pages/index/NewFunction/index.js +8 -2
- package/es/site/src/pages/index/NewFunction/styles.js +1 -1
- package/es/site/src/pages/index/styles.js +2 -1
- package/es/site/src/pages/resource/index.d.ts +1 -0
- package/es/site/src/pages/resource/index.js +4 -1
- package/es/site/src/pages/styles.js +1 -1
- package/es/site/src/router/index.js +75 -5
- package/index.ts +3 -2
- package/package.json +5 -4
|
@@ -2,56 +2,67 @@ import _Set from "@babel/runtime-corejs3/core-js/set";
|
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
3
|
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
4
4
|
import { useInstance } from 'intact';
|
|
5
|
-
import {
|
|
5
|
+
import { useRecordParent } from '../../hooks/useRecordComponent';
|
|
6
|
+
import { inArray } from '../table/useChecked';
|
|
7
|
+
import { useState } from '../../hooks/useState';
|
|
8
|
+
export var MENU_RECORD_KEY = 'MenuKeys';
|
|
9
|
+
export function useHighlight() {
|
|
10
|
+
var instance = useInstance();
|
|
11
|
+
var menuItems = useRecordParent(MENU_RECORD_KEY);
|
|
12
|
+
var highlightedKeys = useState([]);
|
|
13
|
+
instance.watch('selectedKey', updateStatus, {
|
|
14
|
+
presented: true
|
|
15
|
+
});
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
function updateStatus(newValue) {
|
|
18
|
+
var _loop = function _loop(i) {
|
|
19
|
+
var menuItem = menuItems[i];
|
|
20
|
+
var key = menuItem.get('key');
|
|
21
|
+
if (newValue !== key) return "continue";
|
|
22
|
+
var items = [];
|
|
23
|
+
var parentItem = menuItem.parentMenuItem;
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
while (parentItem) {
|
|
26
|
+
items.push(parentItem);
|
|
27
|
+
parentItem = parentItem.parentMenuItem;
|
|
28
|
+
}
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
key =
|
|
30
|
+
var expandedKeys = new _Set(instance.get('expandedKeys'));
|
|
31
|
+
highlightedKeys.set(_mapInstanceProperty(items).call(items, function (item) {
|
|
32
|
+
var key = item.get('key');
|
|
33
|
+
expandedKeys.add(key);
|
|
34
|
+
return key;
|
|
35
|
+
}));
|
|
36
|
+
instance.set('expandedKeys', _Array$from(expandedKeys));
|
|
37
|
+
return {
|
|
38
|
+
v: void 0
|
|
39
|
+
};
|
|
40
|
+
};
|
|
18
41
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var parentItem = parentMenuItem;
|
|
42
|
+
for (var i = 0; i < menuItems.length; i++) {
|
|
43
|
+
var _ret = _loop(i);
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
parentItem = parentItem.parentMenuItem;
|
|
45
|
+
if (_ret === "continue") continue;
|
|
46
|
+
if (typeof _ret === "object") return _ret.v;
|
|
26
47
|
}
|
|
27
48
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var highlightedKeys = _mapInstanceProperty(items).call(items, function (item) {
|
|
31
|
-
var key = item.get('key');
|
|
32
|
-
expandedKeys.add(key);
|
|
33
|
-
return key;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
rootMenu.highlightedKeys = highlightedKeys;
|
|
37
|
-
rootMenu.set('expandedKeys', _Array$from(expandedKeys));
|
|
49
|
+
highlightedKeys.set([]);
|
|
38
50
|
}
|
|
39
51
|
|
|
40
|
-
function isHighlighted() {
|
|
41
|
-
return inArray(
|
|
52
|
+
function isHighlighted(key) {
|
|
53
|
+
return inArray(highlightedKeys.value, key);
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
function select() {
|
|
45
|
-
|
|
56
|
+
function select(key) {
|
|
57
|
+
instance.set('selectedKey', key);
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
function isSelected() {
|
|
49
|
-
return
|
|
60
|
+
function isSelected(key) {
|
|
61
|
+
return instance.get('selectedKey') === key;
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
return {
|
|
53
65
|
isHighlighted: isHighlighted,
|
|
54
|
-
updateStatus: updateStatus,
|
|
55
66
|
select: select,
|
|
56
67
|
isSelected: isSelected
|
|
57
68
|
};
|
package/es/components/portal.js
CHANGED
|
@@ -81,7 +81,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
81
81
|
}
|
|
82
82
|
} else {
|
|
83
83
|
mountedQueue.push(function () {
|
|
84
|
-
parentDom = _this2.$lastInput.dom.parentElement;
|
|
84
|
+
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
85
85
|
|
|
86
86
|
_this2.initContainer(nextProps.container, parentDom, anchor);
|
|
87
87
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact';
|
|
2
|
+
declare type ItemType = 'text' | 'avator' | 'image' | 'button' | 'input';
|
|
3
|
+
export declare const ItemTypeMap: ItemType[];
|
|
4
|
+
export interface SkeletonItemProps {
|
|
5
|
+
type?: ItemType;
|
|
6
|
+
}
|
|
7
|
+
export interface SkeletonItemEvents {
|
|
8
|
+
}
|
|
9
|
+
export interface SkeletonItemBlocks {
|
|
10
|
+
}
|
|
11
|
+
export declare class SkeletonItem extends Component<SkeletonItemProps, SkeletonItemEvents, SkeletonItemBlocks> {
|
|
12
|
+
static template: string | import("intact").Template<any>;
|
|
13
|
+
static typeDefs: Required<TypeDefs<SkeletonItemProps>>;
|
|
14
|
+
static defaults: () => Partial<SkeletonItemProps>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import template from './item.vdt';
|
|
4
|
+
export var ItemTypeMap = ['text', 'avator', 'image', 'button', 'input'];
|
|
5
|
+
var typeDefs = {
|
|
6
|
+
type: ItemTypeMap
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
var defaults = function defaults() {
|
|
10
|
+
return {
|
|
11
|
+
type: 'text'
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export var SkeletonItem = /*#__PURE__*/function (_Component) {
|
|
16
|
+
_inheritsLoose(SkeletonItem, _Component);
|
|
17
|
+
|
|
18
|
+
function SkeletonItem() {
|
|
19
|
+
return _Component.apply(this, arguments) || this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return SkeletonItem;
|
|
23
|
+
}(Component);
|
|
24
|
+
SkeletonItem.template = template;
|
|
25
|
+
SkeletonItem.typeDefs = typeDefs;
|
|
26
|
+
SkeletonItem.defaults = defaults;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce } from 'intact';
|
|
3
|
+
import { makeItemStyles } from './style';
|
|
4
|
+
import { getRestProps } from '../utils';
|
|
5
|
+
var _$tmp0 = {
|
|
6
|
+
'd': 'M64 896V128h896v768H64z m64-128l192-192 116.352 116.352L640 448l256 307.2V192H128v576z m224-480a96 96 0 1 1-0.064 192.064A96 96 0 0 1 352 288z'
|
|
7
|
+
};
|
|
8
|
+
var _$tmp1 = {
|
|
9
|
+
'viewBox': '0 0 1024 1024',
|
|
10
|
+
'xmlns': 'http://www.w3.org/2000/svg'
|
|
11
|
+
};
|
|
12
|
+
export default function ($props, $blocks, $__proto__) {
|
|
13
|
+
var _classNameObj, _ItemklsObj;
|
|
14
|
+
|
|
15
|
+
$blocks || ($blocks = {});
|
|
16
|
+
$props || ($props = {});
|
|
17
|
+
var $this = this;
|
|
18
|
+
|
|
19
|
+
var _this$get = this.get(),
|
|
20
|
+
type = _this$get.type;
|
|
21
|
+
|
|
22
|
+
var classNameObj = (_classNameObj = {
|
|
23
|
+
'k-skeleton-item': true
|
|
24
|
+
}, _classNameObj[makeItemStyles()] = true, _classNameObj);
|
|
25
|
+
var ItemklsObj = (_ItemklsObj = {
|
|
26
|
+
'k-skeleton-item-box': true
|
|
27
|
+
}, _ItemklsObj["skeleton-item-" + type] = true, _ItemklsObj);
|
|
28
|
+
|
|
29
|
+
var skeletonItem = _$cv('div', _extends({
|
|
30
|
+
'className': _$cn(ItemklsObj)
|
|
31
|
+
}, getRestProps(this)), type === 'image' ? _$ce(512, 'svg', _$ce(2, 'path', null, 1, null, _$tmp0), 2, null, _$tmp1) : undefined);
|
|
32
|
+
|
|
33
|
+
return _$ce(2, 'div', skeletonItem, 0, _$cn(classNameObj));
|
|
34
|
+
}
|
|
35
|
+
;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact';
|
|
2
|
+
export interface SkeletonProps {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
animated?: boolean;
|
|
5
|
+
rows?: number;
|
|
6
|
+
avator?: boolean;
|
|
7
|
+
size?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SkeletonEvents {
|
|
10
|
+
}
|
|
11
|
+
export interface SkeletonBlocks {
|
|
12
|
+
}
|
|
13
|
+
export declare class Skeleton extends Component<SkeletonProps, SkeletonEvents, SkeletonBlocks> {
|
|
14
|
+
static template: string | import("intact").Template<any>;
|
|
15
|
+
static typeDefs: Required<TypeDefs<SkeletonProps>>;
|
|
16
|
+
static defaults: () => Partial<SkeletonProps>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import template from './skeleton.vdt';
|
|
4
|
+
var typeDefs = {
|
|
5
|
+
loading: Boolean,
|
|
6
|
+
animated: Boolean,
|
|
7
|
+
rows: Number,
|
|
8
|
+
avator: Boolean,
|
|
9
|
+
size: String
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var defaults = function defaults() {
|
|
13
|
+
return {
|
|
14
|
+
rows: 2,
|
|
15
|
+
size: 'large'
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export var Skeleton = /*#__PURE__*/function (_Component) {
|
|
20
|
+
_inheritsLoose(Skeleton, _Component);
|
|
21
|
+
|
|
22
|
+
function Skeleton() {
|
|
23
|
+
return _Component.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Skeleton;
|
|
27
|
+
}(Component);
|
|
28
|
+
Skeleton.template = template;
|
|
29
|
+
Skeleton.typeDefs = typeDefs;
|
|
30
|
+
Skeleton.defaults = defaults;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js/instance/fill";
|
|
2
|
+
import { map as _$ma, createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn } from 'intact';
|
|
3
|
+
import { SkeletonItem } from './item';
|
|
4
|
+
import { makeStyles, kls } from './style';
|
|
5
|
+
var _$tmp0 = {
|
|
6
|
+
'type': 'avator'
|
|
7
|
+
};
|
|
8
|
+
export default function ($props, $blocks, $__proto__) {
|
|
9
|
+
var _context, _classNameObj;
|
|
10
|
+
|
|
11
|
+
$blocks || ($blocks = {});
|
|
12
|
+
$props || ($props = {});
|
|
13
|
+
var $this = this;
|
|
14
|
+
|
|
15
|
+
var _this$get = this.get(),
|
|
16
|
+
rows = _this$get.rows,
|
|
17
|
+
avator = _this$get.avator,
|
|
18
|
+
animated = _this$get.animated,
|
|
19
|
+
children = _this$get.children,
|
|
20
|
+
loading = _this$get.loading,
|
|
21
|
+
size = _this$get.size;
|
|
22
|
+
|
|
23
|
+
var targetRows = typeof rows !== 'number' ? 3 : rows < 1 ? 1 : parseInt(rows);
|
|
24
|
+
|
|
25
|
+
var skeletonList = _fillInstanceProperty(_context = Array(targetRows + 2)).call(_context);
|
|
26
|
+
|
|
27
|
+
var skeletonItems = _$ma(skeletonList, function ($value, $key) {
|
|
28
|
+
return _$cc(SkeletonItem);
|
|
29
|
+
}, $this);
|
|
30
|
+
|
|
31
|
+
var classNameObj = (_classNameObj = {
|
|
32
|
+
'k-skeleton': true,
|
|
33
|
+
'k-animated': animated
|
|
34
|
+
}, _classNameObj[makeStyles(size)] = true, _classNameObj);
|
|
35
|
+
return loading ? _$ce(2, 'div', children ? _$ce(2, 'div', children, 0) : avator ? _$ce(2, 'div', [_$cc(SkeletonItem, _$tmp0), _$ce(2, 'div', skeletonItems, 0, 'k-skeleton-items')], 4, _$cn(kls('avator-box'))) : _$ce(2, 'div', skeletonItems, 0, 'k-skeleton-items'), 2, _$cn(classNameObj)) : undefined;
|
|
36
|
+
}
|
|
37
|
+
;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '../../styles/global';
|
|
2
|
+
export declare const kls: (className: string) => string;
|
|
3
|
+
declare type ItemSize = 'default' | 'large' | 'small' | 'mini';
|
|
4
|
+
export declare function makeStyles(size: ItemSize): string;
|
|
5
|
+
export declare function makeItemStyles(): string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
|
|
3
|
+
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
5
|
+
import { css, keyframes } from '@emotion/css';
|
|
6
|
+
import '../../styles/global';
|
|
7
|
+
export var kls = function kls(className) {
|
|
8
|
+
return "k-skeleton-" + className;
|
|
9
|
+
};
|
|
10
|
+
var defaults = {
|
|
11
|
+
item: {
|
|
12
|
+
bgColor: '#dcdde0'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var skeleton;
|
|
16
|
+
setDefault(function () {
|
|
17
|
+
skeleton = deepDefaults(theme, {
|
|
18
|
+
skeleton: defaults
|
|
19
|
+
}).skeleton;
|
|
20
|
+
});
|
|
21
|
+
export function makeStyles(size) {
|
|
22
|
+
return /*#__PURE__*/css("&.k-animated{.", kls('item'), "{&>.k-skeleton-item-box{background:linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%);background-size:400% 100%;animation:", skeletonLoading, " 1.4s ease infinite;}}}.k-skeleton-items{.", kls('item'), ":first-child{.skeleton-item-text{width:33%;}}.", kls('item'), ":last-child{.skeleton-item-text{width:61%;}}}.", kls('avator-box'), "{display:flex;&>div:last-child{flex-grow:1;padding-left:20px;}}.skeleton-item-button,.skeleton-item-input{height:", theme[size].height, ";}");
|
|
23
|
+
}
|
|
24
|
+
var skeletonLoading = /*#__PURE__*/keyframes(process.env.NODE_ENV === "production" ? {
|
|
25
|
+
name: "1jmexzm",
|
|
26
|
+
styles: "0%{background-position:100% 50%;}to{background-position:0 50%;}"
|
|
27
|
+
} : {
|
|
28
|
+
name: "1jmexzm",
|
|
29
|
+
styles: "0%{background-position:100% 50%;}to{background-position:0 50%;}",
|
|
30
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
31
|
+
});
|
|
32
|
+
export function makeItemStyles() {
|
|
33
|
+
var skeletonItem = skeleton.item;
|
|
34
|
+
return /*#__PURE__*/css("&>div{background:", skeletonItem.bgColor, ";}.skeleton-item-text{width:100%;height:16px;border-radius:4px;margin-top:16px;}.skeleton-item-avator{width:40px;height:40px;border-radius:50%;}.skeleton-item-image{display:flex;justify-content:center;align-items:center;width:200px;height:200px;&>svg{width:48px;height:48px;fill:", skeletonItem.bgColor, ";}}.skeleton-item-button{width:64px;background:", skeletonItem.bgColor, ";}.skeleton-item-input{width:160px;background:", skeletonItem.bgColor, ";}");
|
|
35
|
+
}
|
|
@@ -43,10 +43,9 @@ export function useFilter(getNodes, getExpandedKeys) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function updateFilterUpward(node) {
|
|
46
|
-
if (!node) return; // should expand the node
|
|
46
|
+
if (!node || _filterInstanceProperty(node)) return; // should expand the node
|
|
47
47
|
|
|
48
48
|
getExpandedKeys().add(node.key);
|
|
49
|
-
if (_filterInstanceProperty(node)) return;
|
|
50
49
|
node.filter = true;
|
|
51
50
|
updateFilterUpward(node.parent);
|
|
52
51
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -38,6 +38,7 @@ export * from './components/radio';
|
|
|
38
38
|
export * from './components/rate';
|
|
39
39
|
export * from './components/scrollSelect';
|
|
40
40
|
export * from './components/select';
|
|
41
|
+
export * from './components/skeleton';
|
|
41
42
|
export * from './components/slider';
|
|
42
43
|
export * from './components/spin';
|
|
43
44
|
export * from './components/spinner';
|
|
@@ -56,4 +57,4 @@ export * from './components/tree';
|
|
|
56
57
|
export * from './components/treeSelect';
|
|
57
58
|
export * from './components/upload';
|
|
58
59
|
export * from './components/wave';
|
|
59
|
-
export declare const version = "2.0.
|
|
60
|
+
export declare const version = "2.0.4";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -40,6 +40,7 @@ export * from './components/radio';
|
|
|
40
40
|
export * from './components/rate';
|
|
41
41
|
export * from './components/scrollSelect';
|
|
42
42
|
export * from './components/select';
|
|
43
|
+
export * from './components/skeleton';
|
|
43
44
|
export * from './components/slider';
|
|
44
45
|
export * from './components/spin';
|
|
45
46
|
export * from './components/spinner';
|
|
@@ -58,5 +59,5 @@ export * from './components/tree';
|
|
|
58
59
|
export * from './components/treeSelect';
|
|
59
60
|
export * from './components/upload';
|
|
60
61
|
export * from './components/wave';
|
|
61
|
-
export var version = '2.0.
|
|
62
|
+
export var version = '2.0.4';
|
|
62
63
|
/* generate end */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import { Tooltip, Form, FormItem } from '../../';
|
|
6
|
+
import { getElement, wait, dispatchEvent } from '../../../../test/utils';
|
|
7
|
+
describe('Form', function () {
|
|
8
|
+
it('should show Tooltip in append slot', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
+
var click, container, trigger;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) {
|
|
12
|
+
switch (_context.prev = _context.next) {
|
|
13
|
+
case 0:
|
|
14
|
+
click = sinon.spy(function () {
|
|
15
|
+
return console.log(1);
|
|
16
|
+
});
|
|
17
|
+
container = document.createElement('div');
|
|
18
|
+
document.body.appendChild(container);
|
|
19
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormItem, {
|
|
20
|
+
label: "\u6D4B\u8BD5",
|
|
21
|
+
value: "1",
|
|
22
|
+
slotAppend: /*#__PURE__*/React.createElement(Tooltip, {
|
|
23
|
+
content: "\u6D4B\u8BD5"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
25
|
+
className: "k-icon ion-ionic"
|
|
26
|
+
}))
|
|
27
|
+
})), container);
|
|
28
|
+
trigger = container.querySelector('.k-icon');
|
|
29
|
+
expect(trigger).to.be.exist;
|
|
30
|
+
dispatchEvent(trigger, 'mouseover');
|
|
31
|
+
_context.next = 9;
|
|
32
|
+
return wait();
|
|
33
|
+
|
|
34
|
+
case 9:
|
|
35
|
+
expect(getElement('.k-tooltip-content')).to.be.exist;
|
|
36
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
37
|
+
document.body.removeChild(container);
|
|
38
|
+
|
|
39
|
+
case 12:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
})));
|
|
46
|
+
});
|
|
@@ -20,6 +20,7 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
20
20
|
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
21
21
|
_this.state = {
|
|
22
22
|
expandedKeys: ['3'],
|
|
23
|
+
selectedKey: '3-2',
|
|
23
24
|
collapse: false,
|
|
24
25
|
theme: 'dark'
|
|
25
26
|
};
|
|
@@ -66,6 +67,12 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
66
67
|
expandedKeys: expandedKeys
|
|
67
68
|
});
|
|
68
69
|
},
|
|
70
|
+
selectedKey: this.state.selectedKey,
|
|
71
|
+
onChangeSelectedKey: function onChangeSelectedKey(selectedKey) {
|
|
72
|
+
return _this2.setState({
|
|
73
|
+
selectedKey: selectedKey
|
|
74
|
+
});
|
|
75
|
+
},
|
|
69
76
|
collapse: this.state.collapse,
|
|
70
77
|
theme: this.state.theme,
|
|
71
78
|
ref: function ref(i) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
interface Props {
|
|
4
|
+
showSkeleton?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default class extends Component<Props> {
|
|
7
|
+
static template: string | import("intact").Template<any>;
|
|
8
|
+
static defaults(): {
|
|
9
|
+
showSkeleton: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
|
|
6
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
7
|
+
_inheritsLoose(default_1, _Component);
|
|
8
|
+
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
default_1.defaults = function defaults() {
|
|
14
|
+
return {
|
|
15
|
+
showSkeleton: true
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return default_1;
|
|
20
|
+
}(Component);
|
|
21
|
+
|
|
22
|
+
default_1.template = template;
|
|
23
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Skeleton } from '@king-design/react';
|
|
5
|
+
|
|
6
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
7
|
+
_inheritsLoose(Demo, _React$Component);
|
|
8
|
+
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
|
|
12
|
+
var _this;
|
|
13
|
+
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
19
|
+
_this.state = {
|
|
20
|
+
showSkeleton: true
|
|
21
|
+
};
|
|
22
|
+
return _this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var _proto = Demo.prototype;
|
|
26
|
+
|
|
27
|
+
_proto.render = function render() {
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
29
|
+
loading: this.state.showSkeleton,
|
|
30
|
+
avator: true,
|
|
31
|
+
animated: true
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return Demo;
|
|
36
|
+
}(React.Component);
|
|
37
|
+
|
|
38
|
+
export { Demo as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
interface Props {
|
|
4
|
+
showSkeleton?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default class extends Component<Props> {
|
|
7
|
+
static template: string | import("intact").Template<any>;
|
|
8
|
+
static defaults(): {
|
|
9
|
+
showSkeleton: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
|
|
6
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
7
|
+
_inheritsLoose(default_1, _Component);
|
|
8
|
+
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
default_1.defaults = function defaults() {
|
|
14
|
+
return {
|
|
15
|
+
showSkeleton: true
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return default_1;
|
|
20
|
+
}(Component);
|
|
21
|
+
|
|
22
|
+
default_1.template = template;
|
|
23
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Skeleton } from '@king-design/react';
|
|
5
|
+
|
|
6
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
7
|
+
_inheritsLoose(Demo, _React$Component);
|
|
8
|
+
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
|
|
12
|
+
var _this;
|
|
13
|
+
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
19
|
+
_this.state = {
|
|
20
|
+
showSkeleton: true
|
|
21
|
+
};
|
|
22
|
+
return _this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var _proto = Demo.prototype;
|
|
26
|
+
|
|
27
|
+
_proto.render = function render() {
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
29
|
+
loading: this.state.showSkeleton,
|
|
30
|
+
avator: true
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return Demo;
|
|
35
|
+
}(React.Component);
|
|
36
|
+
|
|
37
|
+
export { Demo as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
interface Props {
|
|
4
|
+
showSkeleton?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default class extends Component<Props> {
|
|
7
|
+
static template: string | import("intact").Template<any>;
|
|
8
|
+
static defaults(): {
|
|
9
|
+
showSkeleton: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|