@king-design/intact 3.4.1 → 3.4.3-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.
- package/components/button/demos/disabled.md +14 -4
- package/components/button/index.vdt +1 -1
- package/components/button/styles.ts +14 -1
- package/components/descriptions/item.vdt +2 -4
- package/components/dialog/styles.ts +3 -3
- package/components/dropdown/item.ts +7 -2
- package/components/editable/index.spec.ts +8 -8
- package/components/editable/index.vdt +3 -1
- package/components/editable/styles.ts +8 -1
- package/components/ellipsis/index.vdt +1 -0
- package/components/menu/styles.ts +3 -0
- package/components/select/base.ts +7 -1
- package/components/select/base.vdt +2 -1
- package/components/select/demos/immutable.md +38 -0
- package/components/select/useImmutable.ts +46 -0
- package/components/switch/index.ts +1 -1
- package/components/table/cell.ts +1 -0
- package/components/table/cell.vdt +8 -2
- package/components/table/column.ts +2 -0
- package/components/table/demos/asyncTree.md +70 -0
- package/components/table/demos/footer.md +38 -0
- package/components/table/index.md +3 -0
- package/components/table/row.ts +4 -3
- package/components/table/row.vdt +2 -2
- package/components/table/styles.ts +1 -1
- package/components/table/table.ts +3 -0
- package/components/table/table.vdt +10 -2
- package/components/table/useTree.ts +9 -2
- package/components/tooltip/tooltip.ts +2 -0
- package/components/treeSelect/demos/basic.md +1 -0
- package/components/treeSelect/index.vdt +1 -0
- package/es/components/button/index.vdt.js +1 -1
- package/es/components/button/styles.js +3 -3
- package/es/components/descriptions/item.vdt.js +2 -3
- package/es/components/diagram/shapes/callout.d.ts +1 -1
- package/es/components/diagram/shapes/circle.d.ts +1 -1
- package/es/components/diagram/shapes/document.d.ts +1 -1
- package/es/components/diagram/shapes/ellipse.d.ts +1 -1
- package/es/components/diagram/shapes/hexagon.d.ts +1 -1
- package/es/components/diagram/shapes/image.d.ts +1 -1
- package/es/components/diagram/shapes/parallelogram.d.ts +1 -1
- package/es/components/diagram/shapes/rectangle.d.ts +1 -1
- package/es/components/diagram/shapes/square.d.ts +1 -1
- package/es/components/diagram/shapes/text.d.ts +1 -1
- package/es/components/dialog/styles.js +3 -3
- package/es/components/dropdown/item.js +5 -2
- package/es/components/editable/index.spec.js +8 -8
- package/es/components/editable/index.vdt.js +3 -1
- package/es/components/editable/styles.d.ts +1 -0
- package/es/components/editable/styles.js +4 -1
- package/es/components/ellipsis/index.vdt.js +1 -0
- package/es/components/menu/styles.js +1 -1
- package/es/components/select/base.d.ts +4 -0
- package/es/components/select/base.js +11 -1
- package/es/components/select/base.vdt.js +2 -1
- package/es/components/select/useImmutable.d.ts +4 -0
- package/es/components/select/useImmutable.js +46 -0
- package/es/components/switch/index.js +1 -1
- package/es/components/table/cell.d.ts +1 -0
- package/es/components/table/cell.vdt.js +13 -3
- package/es/components/table/column.d.ts +1 -0
- package/es/components/table/column.js +1 -0
- package/es/components/table/row.d.ts +2 -1
- package/es/components/table/row.js +3 -2
- package/es/components/table/row.vdt.js +3 -1
- package/es/components/table/styles.js +1 -1
- package/es/components/table/table.d.ts +2 -0
- package/es/components/table/table.js +2 -1
- package/es/components/table/table.vdt.js +14 -0
- package/es/components/table/useTree.d.ts +1 -1
- package/es/components/table/useTree.js +30 -2
- package/es/components/tooltip/tooltip.d.ts +1 -0
- package/es/components/tooltip/tooltip.js +9 -1
- package/es/components/treeSelect/index.vdt.js +1 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/disabled/index.d.ts +1 -0
- package/es/site/data/components/button/demos/disabled/index.js +1 -0
- package/es/site/data/components/button/demos/disabled/react.d.ts +1 -0
- package/es/site/data/components/button/demos/disabled/react.js +28 -15
- package/es/site/data/components/select/demos/immutable/index.d.ts +9 -0
- package/es/site/data/components/select/demos/immutable/index.js +18 -0
- package/es/site/data/components/select/demos/immutable/react.d.ts +9 -0
- package/es/site/data/components/select/demos/immutable/react.js +53 -0
- package/es/site/data/components/table/demos/asyncTree/index.d.ts +20 -0
- package/es/site/data/components/table/demos/asyncTree/index.js +53 -0
- package/es/site/data/components/table/demos/asyncTree/react.d.ts +20 -0
- package/es/site/data/components/table/demos/asyncTree/react.js +76 -0
- package/es/site/data/components/table/demos/footer/index.d.ts +12 -0
- package/es/site/data/components/table/demos/footer/index.js +25 -0
- package/es/site/data/components/table/demos/footer/react.d.ts +11 -0
- package/es/site/data/components/table/demos/footer/react.js +46 -0
- package/es/site/data/components/treeSelect/demos/basic/react.js +2 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/components/descriptions/.DS_Store +0 -0
- package/components/menu/.DS_Store +0 -0
- package/components/menu/demos/.DS_Store +0 -0
- package/styles/.DS_Store +0 -0
|
@@ -65,6 +65,7 @@ export interface TableProps<
|
|
|
65
65
|
animation?: boolean | [boolean, boolean]
|
|
66
66
|
hideHeader?: boolean
|
|
67
67
|
pagination?: boolean | PaginationProps
|
|
68
|
+
load?: (value: T) => Promise<void> | void
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
@@ -82,6 +83,7 @@ export interface TableBlocks<T = unknown> {
|
|
|
82
83
|
empty: null
|
|
83
84
|
tooltip: [T, number]
|
|
84
85
|
expand: [T, number]
|
|
86
|
+
footer: null
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
type CheckType = 'checkbox' | 'radio' | 'none'
|
|
@@ -130,6 +132,7 @@ const typeDefs: Required<TypeDefs<TableProps<unknown>>> = {
|
|
|
130
132
|
animation: [Boolean, Array],
|
|
131
133
|
hideHeader: Boolean,
|
|
132
134
|
pagination: [Boolean, Object],
|
|
135
|
+
load: Function,
|
|
133
136
|
};
|
|
134
137
|
|
|
135
138
|
const defaults = (): Partial<TableProps> => ({
|
|
@@ -137,11 +137,11 @@ const tbody = (
|
|
|
137
137
|
const spreaded = isSpreaded(key);
|
|
138
138
|
const hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
139
139
|
const indentSize = indent ? indent * level : 0;
|
|
140
|
-
|
|
141
140
|
let row = <TableRow
|
|
142
141
|
key={key}
|
|
143
142
|
cols={cols}
|
|
144
143
|
data={value}
|
|
144
|
+
loaded={value.loaded}
|
|
145
145
|
checkType={checkType}
|
|
146
146
|
hasFixedLeft={hasFixedLeft}
|
|
147
147
|
onClick={this.clickRow}
|
|
@@ -199,7 +199,15 @@ const tbody = (
|
|
|
199
199
|
|
|
200
200
|
return hidden || !spreaded;
|
|
201
201
|
});
|
|
202
|
-
|
|
202
|
+
if ($blocks.footer) {
|
|
203
|
+
rows.push(
|
|
204
|
+
<tr key="table-footer">
|
|
205
|
+
<td colspan={colCount} class={`${k}-table-footer`}>
|
|
206
|
+
<b:footer />
|
|
207
|
+
</td>
|
|
208
|
+
</tr>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
203
211
|
return animation[0] ?
|
|
204
212
|
<TransitionGroup name="k-fade-in-left" move={!draggingKey.value}>{rows}</TransitionGroup> :
|
|
205
213
|
rows;
|
|
@@ -11,8 +11,15 @@ export function useTree(data: State<any[] | undefined>) {
|
|
|
11
11
|
return inArray(instance.get('spreadKeys'), key);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function toggleSpreadRow(key: TableRowKey) {
|
|
15
|
-
|
|
14
|
+
async function toggleSpreadRow(key: TableRowKey, rowData?: any) {
|
|
15
|
+
const {spreadKeys, load} = instance.get();
|
|
16
|
+
instance.set('spreadKeys', toggleArray(spreadKeys, key));
|
|
17
|
+
if (load && data.value && !rowData.loaded) {
|
|
18
|
+
rowData.loaded = false;
|
|
19
|
+
await load(rowData);
|
|
20
|
+
rowData.loaded = true;
|
|
21
|
+
instance.forceUpdate();
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
function loopData<T>(
|
|
@@ -55,7 +55,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('
|
|
58
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('custom')] = color, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[makeButtonStyles(k, iconSide, color)] = true, _classNameObj);
|
|
59
59
|
var loadingIcon = _$cc(Icon, {
|
|
60
60
|
'className': _$cn("ion-load-c " + k + "-icon-loading"),
|
|
61
61
|
'size': size /*loadingSizeMap[size]*/,
|
|
@@ -11,7 +11,7 @@ var btnStyles = {
|
|
|
11
11
|
return theme.color.text;
|
|
12
12
|
},
|
|
13
13
|
bgColor: '#fff',
|
|
14
|
-
lineHeight: '1
|
|
14
|
+
lineHeight: '1',
|
|
15
15
|
get padding() {
|
|
16
16
|
return "0 16px";
|
|
17
17
|
},
|
|
@@ -199,8 +199,8 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color
|
|
|
199
199
|
// extract static styles to individual css method for performance
|
|
200
200
|
css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";.", k, "-icon{color:inherit;}&.", k, "-default,&.", k, "-none,&.", k, "-flat{.", k, "-icon{color:", theme.color.lightBlack, ";}&:hover{.", k, "-icon{color:inherit;}}}&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.", k, "-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
|
|
201
201
|
var typeStyles = button[type];
|
|
202
|
-
return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
|
|
203
|
-
}), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
202
|
+
return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}&.", k, "-disabled{&,&:hover{background:", palette(typeStyles.bgColor, -2), ";color:", palette(typeStyles.color, -2), ";border-color:", palette(typeStyles.borderColor, -2), ";}}}");
|
|
203
|
+
}), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}&.", k, "-disabled{border:none;}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}&.", k, "-disabled{border:none;}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
204
204
|
var styles = button[size];
|
|
205
205
|
return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.", k, "-btn-icon{width:", styles.height, ";}}");
|
|
206
206
|
}), "&.", k, "-btn-icon{width:", button.height, ";padding:0;.", k, "-icon{margin:0;}}&.", k, "-fluid{width:100%;padding:0;}&.", k, "-circle{border-radius:calc(", button.large.height, " / 2);}&.", k, "-loading{", _mapInstanceProperty(types).call(types, function (type) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact';
|
|
3
3
|
import { makeStyles } from './styles';
|
|
4
|
-
import { getRestProps
|
|
5
|
-
import {
|
|
6
|
-
import { Ellipsis } from 'kpc';
|
|
4
|
+
import { getRestProps } from '../utils';
|
|
5
|
+
import { Ellipsis } from '../ellipsis';
|
|
7
6
|
export default function ($props, $blocks, $__proto__) {
|
|
8
7
|
var _classNameObj;
|
|
9
8
|
$blocks || ($blocks = {});
|
|
@@ -12,7 +12,7 @@ export declare class DCallout extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DCircle extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DDocument extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DEllipse extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DHexagon extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -18,7 +18,7 @@ export declare class DImage extends DShape<DImageProps> {
|
|
|
18
18
|
rotatable?: boolean | undefined;
|
|
19
19
|
editable?: boolean | undefined;
|
|
20
20
|
connectable?: boolean | undefined;
|
|
21
|
-
strokeStyle?: "
|
|
21
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
22
22
|
label?: string | number | undefined;
|
|
23
23
|
style?: Record<string, string | number> | undefined;
|
|
24
24
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DParallelogram extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -18,7 +18,7 @@ export declare class DRectangle extends DShape<DRectangleProps> {
|
|
|
18
18
|
rotatable?: boolean | undefined;
|
|
19
19
|
editable?: boolean | undefined;
|
|
20
20
|
connectable?: boolean | undefined;
|
|
21
|
-
strokeStyle?: "
|
|
21
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
22
22
|
label?: string | number | undefined;
|
|
23
23
|
style?: Record<string, string | number> | undefined;
|
|
24
24
|
data?: any;
|
|
@@ -13,7 +13,7 @@ export declare class DSquare extends DRectangle {
|
|
|
13
13
|
rotatable?: boolean | undefined;
|
|
14
14
|
editable?: boolean | undefined;
|
|
15
15
|
connectable?: boolean | undefined;
|
|
16
|
-
strokeStyle?: "
|
|
16
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
17
17
|
label?: string | number | undefined;
|
|
18
18
|
style?: Record<string, string | number> | undefined;
|
|
19
19
|
data?: any;
|
|
@@ -12,7 +12,7 @@ export declare class DText extends DShape {
|
|
|
12
12
|
rotatable?: boolean | undefined;
|
|
13
13
|
editable?: boolean | undefined;
|
|
14
14
|
connectable?: boolean | undefined;
|
|
15
|
-
strokeStyle?: "
|
|
15
|
+
strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
|
|
16
16
|
label?: string | number | undefined;
|
|
17
17
|
style?: Record<string, string | number> | undefined;
|
|
18
18
|
data?: any;
|
|
@@ -58,11 +58,11 @@ var defaults = {
|
|
|
58
58
|
padding: "0 24px",
|
|
59
59
|
bodyMarginTop: "-25px",
|
|
60
60
|
tipIconMarginBottom: '10px',
|
|
61
|
-
tipIconFontSize: '
|
|
62
|
-
tipIconLineHeight: '
|
|
61
|
+
tipIconFontSize: '24px',
|
|
62
|
+
tipIconLineHeight: '24px',
|
|
63
63
|
// with title
|
|
64
64
|
titleFontWeight: '500',
|
|
65
|
-
titleTipIconFontSize: '
|
|
65
|
+
titleTipIconFontSize: '24px',
|
|
66
66
|
titleFontSize: '14px',
|
|
67
67
|
wrapperPaddingLeft: '8px',
|
|
68
68
|
titleBodyMarginTop: '-36px'
|
|
@@ -50,8 +50,11 @@ export var DropdownItem = /*#__PURE__*/function (_Component) {
|
|
|
50
50
|
// hide all dropdowns
|
|
51
51
|
var dropdown = this.dropdown;
|
|
52
52
|
do {
|
|
53
|
-
dropdown
|
|
54
|
-
|
|
53
|
+
if (!dropdown.$isTooltip) {
|
|
54
|
+
dropdown.hide(true);
|
|
55
|
+
}
|
|
56
|
+
dropdown = dropdown.dropdown;
|
|
57
|
+
} while (dropdown);
|
|
55
58
|
}
|
|
56
59
|
};
|
|
57
60
|
_proto.hasSubMenu = function hasSubMenu() {
|
|
@@ -24,7 +24,7 @@ describe('Editable', function () {
|
|
|
24
24
|
case 5:
|
|
25
25
|
expect(element.innerHTML).to.matchSnapshot();
|
|
26
26
|
// input
|
|
27
|
-
input = element.querySelector('
|
|
27
|
+
input = element.querySelector('textarea');
|
|
28
28
|
input.value = 'test';
|
|
29
29
|
dispatchEvent(input, 'blur');
|
|
30
30
|
_context.next = 11;
|
|
@@ -39,7 +39,7 @@ describe('Editable', function () {
|
|
|
39
39
|
return wait();
|
|
40
40
|
case 16:
|
|
41
41
|
expect(element.innerHTML).to.matchSnapshot();
|
|
42
|
-
input = element.querySelector('
|
|
42
|
+
input = element.querySelector('textarea');
|
|
43
43
|
input.value = 'new';
|
|
44
44
|
dispatchEvent(input, 'keydown', {
|
|
45
45
|
keyCode: 27
|
|
@@ -56,7 +56,7 @@ describe('Editable', function () {
|
|
|
56
56
|
return wait();
|
|
57
57
|
case 27:
|
|
58
58
|
expect(element.innerHTML).to.matchSnapshot();
|
|
59
|
-
input = element.querySelector('
|
|
59
|
+
input = element.querySelector('textarea');
|
|
60
60
|
input.value = 'new';
|
|
61
61
|
dispatchEvent(input, 'keydown', {
|
|
62
62
|
keyCode: 13
|
|
@@ -84,7 +84,7 @@ describe('Editable', function () {
|
|
|
84
84
|
_context2.next = 5;
|
|
85
85
|
return wait();
|
|
86
86
|
case 5:
|
|
87
|
-
input = findDomFromVNode(first.$lastInput, true).querySelector('
|
|
87
|
+
input = findDomFromVNode(first.$lastInput, true).querySelector('textarea');
|
|
88
88
|
dispatchEvent(input, 'focus');
|
|
89
89
|
input.value = 'a';
|
|
90
90
|
dispatchEvent(input, 'input');
|
|
@@ -98,7 +98,7 @@ describe('Editable', function () {
|
|
|
98
98
|
_context2.next = 16;
|
|
99
99
|
return wait();
|
|
100
100
|
case 16:
|
|
101
|
-
input = findDomFromVNode(second.$lastInput, true).querySelector('
|
|
101
|
+
input = findDomFromVNode(second.$lastInput, true).querySelector('textarea');
|
|
102
102
|
input.value = 'a';
|
|
103
103
|
dispatchEvent(input, 'input');
|
|
104
104
|
dispatchEvent(input, 'blur');
|
|
@@ -111,7 +111,7 @@ describe('Editable', function () {
|
|
|
111
111
|
_context2.next = 26;
|
|
112
112
|
return wait();
|
|
113
113
|
case 26:
|
|
114
|
-
input = findDomFromVNode(third.$lastInput, true).querySelector('
|
|
114
|
+
input = findDomFromVNode(third.$lastInput, true).querySelector('textarea');
|
|
115
115
|
input.value = 'a';
|
|
116
116
|
dispatchEvent(input, 'input');
|
|
117
117
|
dispatchEvent(input, 'blur');
|
|
@@ -164,7 +164,7 @@ describe('Editable', function () {
|
|
|
164
164
|
_context4.next = 7;
|
|
165
165
|
return wait();
|
|
166
166
|
case 7:
|
|
167
|
-
input = element.querySelector("
|
|
167
|
+
input = element.querySelector("textarea");
|
|
168
168
|
input.value = 'aa';
|
|
169
169
|
dispatchEvent(input, 'blur');
|
|
170
170
|
_context4.next = 12;
|
|
@@ -175,7 +175,7 @@ describe('Editable', function () {
|
|
|
175
175
|
_context4.next = 16;
|
|
176
176
|
return wait();
|
|
177
177
|
case 16:
|
|
178
|
-
input = element.querySelector("
|
|
178
|
+
input = element.querySelector("textarea");
|
|
179
179
|
expect(input.value).to.eql('aa');
|
|
180
180
|
case 18:
|
|
181
181
|
case "end":
|
|
@@ -31,7 +31,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
31
31
|
'ref': this.inputRef,
|
|
32
32
|
'frozenOnInput': true,
|
|
33
33
|
'ev-$mounted': this.select,
|
|
34
|
-
'
|
|
34
|
+
'width': 300,
|
|
35
|
+
'type': 'textarea',
|
|
36
|
+
'rows': 'auto'
|
|
35
37
|
}, null, this.inputRef), 0, 'c-ellipsis'), !disabled && !editing ? _$cc(Tooltip, {
|
|
36
38
|
'content': tip,
|
|
37
39
|
'children': _$cc(Icon, {
|
|
@@ -5,6 +5,9 @@ import '../../styles/global';
|
|
|
5
5
|
import { cache } from '../utils';
|
|
6
6
|
var defaults = {
|
|
7
7
|
iconGap: '0 0 0 8px',
|
|
8
|
+
get smallPadding() {
|
|
9
|
+
return theme.small.padding;
|
|
10
|
+
},
|
|
8
11
|
// invalid
|
|
9
12
|
invalid: {
|
|
10
13
|
get border() {
|
|
@@ -21,5 +24,5 @@ setDefault(function () {
|
|
|
21
24
|
});
|
|
22
25
|
export { editable };
|
|
23
26
|
export var makeStyles = cache(function makeStyles(k) {
|
|
24
|
-
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;}}");
|
|
27
|
+
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;}}&.", k, "-editable{.", k, "-type-textarea{.", k, "-textarea{padding:0 ", editable.smallPadding, ";}}}");
|
|
25
28
|
});
|
|
@@ -115,7 +115,7 @@ export var makeMenuStyles = cache(function makeMenuStyles(k) {
|
|
|
115
115
|
return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";position:relative;}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";padding:0 16px;color:", menu.header.color, ";font-size:", menu.header.fontSize, ";font-weight:bold;}.", k, "-menu-body{padding:", menu.item.bodyPadding, ";max-height:calc(100% - ", menu.header.height, ");overflow-y:auto;overflow-x:hidden;scrollbar-width:none;}.", k, "-menu-title{height:", menu.title.height, ";border-top:", menu.border, ";margin-top:4px;.", k, "-menu-name{transition:all ", menu.transition, ";height:", menu.title.height, ";color:", menu.title.color, ";font-weight:bold;}}.", k, "-menu-arrow-box{width:14px;height:60px;cursor:pointer;background:", menu.bgColor, ";border-radius:0 8px 8px 0;position:absolute;display:flex;align-items:center;justify-content:center;top:50%;left:calc(", menu.width, " - 2px);transition:left ", menu.transition, ";transform:translateY(-50%);border:", menu.border, ";border-left:none;.", k, "-icon{margin-right:0;}&:hover{.", k, "-menu-arrow:before{color:", menu.item.activeBgColor, ";}}}&.", k, "-light{border-right:1px solid ", theme.color.disabledBg, ";background:", menu.light.bgColor, ";.", k, "-menu-header{color:", menu.light.title.color, ";}.", k, "-menu-item{.", k, "-menu-item-title{color:", menu.light.item.color, ";&:hover{background:", menu.light.item.hoverBg, ";}}.", k, "-menu-item-arrow{color:", menu.light.item.color, ";}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", menu.light.item.disabledColor, "!important;}}}.", k, "-menu-title{border-top:", menu.light.border, ";.", k, "-menu-name{color:", menu.light.title.color, ";}}.", k, "-menu-arrow-box{background:", menu.light.bgColor, ";border:", menu.light.border, ";border-left:none;&:hover{.", k, "-menu-arrow:before{color:", menu.light.active.color, ";}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", menu.light.bgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", menu.light.border, ";}.", k, "-menu-body>.", k, "-menu-title{border-right:", menu.light.border, ";}}.", k, "-menu-item.", k, "-active{>.", k, "-menu-item-title{color:", menu.light.active.color, "!important;background:", menu.light.active.bgColor, ";}}.", k, "-sub-menu{.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.light.item.subTitleColor, "!important;}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
116
116
|
var styles = menu[size];
|
|
117
117
|
return /*#__PURE__*/css("&.", k, "-", size, "{width:", styles.width, ";font-size:", styles.fontSize, ";.", k, "-menu{font-size:", styles.fontSize, ";}.", k, "-menu-arrow-box{left:calc(", styles.width, " - 2px);}}");
|
|
118
|
-
}), "&.", k, "-collapsed{width:calc(", menu.icon.width, " + (", getLeft(menu.item.padding), " + ", getLeft(menu.item.bodyPadding), ") * 2);.", k, "-icon{margin-right:0;}.", k, "-menu-item-arrow{display:none;}}&.", k, "-collapsed-arrow{width:0px;border-left:none;.", k, "-menu-body{overflow:hidden;padding:0;}.", k, "-menu-arrow-box{left:0;.", k, "-menu-arrow:before{transform:rotateY(180deg);}}}&.", k, "-dropdown-menu{width:fit-content;min-width:", menu.dropdown.minWidth, ";.", k, "-menu-item-arrow{transform:rotate(-90deg);}}&.", k, "-horizontal{width:auto;display:flex;.", k, "-menu-body{display:flex;align-items:center;.", k, "-menu-title{border-top:none;border-right:", menu.border, ";}}}");
|
|
118
|
+
}), "&.", k, "-collapsed{width:calc(", menu.icon.width, " + (", getLeft(menu.item.padding), " + ", getLeft(menu.item.bodyPadding), ") * 2);.", k, "-icon{margin-right:0;}.", k, "-menu-item-arrow{display:none;}}&.", k, "-collapsed-arrow{width:0px;border-left:none;.", k, "-menu-header{padding:0;}.", k, "-menu-body{overflow:hidden;padding:0;}.", k, "-menu-arrow-box{left:0;.", k, "-menu-arrow:before{transform:rotateY(180deg);}}}&.", k, "-dropdown-menu{width:fit-content;min-width:", menu.dropdown.minWidth, ";.", k, "-menu-item-arrow{transform:rotate(-90deg);}}&.", k, "-horizontal{width:auto;display:flex;.", k, "-menu-body{display:flex;align-items:center;.", k, "-menu-title{border-top:none;border-right:", menu.border, ";}}}");
|
|
119
119
|
});
|
|
120
120
|
export var makeTitleStyles = cache(function makeTitleStyles(k) {
|
|
121
121
|
var item = menu.item;
|
|
@@ -51,6 +51,10 @@ export declare abstract class BaseSelect<T extends BaseSelectProps<any> = BaseSe
|
|
|
51
51
|
};
|
|
52
52
|
private focusout;
|
|
53
53
|
private draggable;
|
|
54
|
+
immutable: {
|
|
55
|
+
immutableValues: State<any[]>;
|
|
56
|
+
isClosable: (key: string) => boolean;
|
|
57
|
+
};
|
|
54
58
|
protected config: {
|
|
55
59
|
cls: (name: string) => string;
|
|
56
60
|
readonly k: string;
|
|
@@ -2,6 +2,8 @@ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
3
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
4
4
|
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
5
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
6
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
5
7
|
import { __decorate } from "tslib";
|
|
6
8
|
import { Component, provide, createRef } from 'intact';
|
|
7
9
|
import template from './base.vdt';
|
|
@@ -14,6 +16,7 @@ import { useInput } from './useInput';
|
|
|
14
16
|
import { useFocusout } from './useFocusout';
|
|
15
17
|
import { isNullOrUndefined } from 'intact-shared';
|
|
16
18
|
import { useDraggable } from './useDraggble';
|
|
19
|
+
import { useImmutable } from './useImmutable';
|
|
17
20
|
import { useConfigContext } from '../config';
|
|
18
21
|
var typeDefs = {
|
|
19
22
|
value: null,
|
|
@@ -60,6 +63,7 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
60
63
|
_this.input = useInput(_this.resetKeywords);
|
|
61
64
|
_this.focusout = useFocusout();
|
|
62
65
|
_this.draggable = useDraggable();
|
|
66
|
+
_this.immutable = useImmutable();
|
|
63
67
|
_this.config = useConfigContext();
|
|
64
68
|
return _this;
|
|
65
69
|
}
|
|
@@ -104,7 +108,13 @@ export var BaseSelect = /*#__PURE__*/function (_Component) {
|
|
|
104
108
|
};
|
|
105
109
|
_proto.clear = function clear(e) {
|
|
106
110
|
e.stopPropagation();
|
|
107
|
-
|
|
111
|
+
var _this$get2 = this.get(),
|
|
112
|
+
value = _this$get2.value,
|
|
113
|
+
multiple = _this$get2.multiple;
|
|
114
|
+
var immutableValues = this.immutable.immutableValues.value;
|
|
115
|
+
this.set('value', multiple ? Array.isArray(value) ? _filterInstanceProperty(value).call(value, function (key) {
|
|
116
|
+
return _includesInstanceProperty(immutableValues).call(immutableValues, key);
|
|
117
|
+
}) : [] : null);
|
|
108
118
|
};
|
|
109
119
|
_proto.onKeydown = function onKeydown(e) {
|
|
110
120
|
this.trigger('keydown', e);
|
|
@@ -57,6 +57,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
57
57
|
var _this$focusout = this.focusout,
|
|
58
58
|
onFocusout = _this$focusout.onFocusout,
|
|
59
59
|
triggerRef = _this$focusout.triggerRef;
|
|
60
|
+
var isClosable = this.immutable.isClosable;
|
|
60
61
|
var filterInput = filterable ? _$cc(Input, {
|
|
61
62
|
'className': _$cn(k + "-select-input"),
|
|
62
63
|
'value': keywords,
|
|
@@ -139,7 +140,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
139
140
|
'children': _$ma(label, function ($label, $key) {
|
|
140
141
|
return _$cc(Tag, {
|
|
141
142
|
'key': isStringOrNumber($label) ? $label : isStringOrNumber(value[$key]) ? value[$key] : $key,
|
|
142
|
-
'closable':
|
|
143
|
+
'closable': isClosable(value[$key]),
|
|
143
144
|
'ev-close': this.delete.bind(this, $key),
|
|
144
145
|
'disabled': disabled,
|
|
145
146
|
'size': size,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
2
|
+
import { useInstance } from 'intact';
|
|
3
|
+
import { Option } from './option';
|
|
4
|
+
import { OptionGroup } from './group';
|
|
5
|
+
import { eachChildren, isComponentVNode } from '../utils';
|
|
6
|
+
import { useState } from '../../hooks/useState';
|
|
7
|
+
export function useImmutable() {
|
|
8
|
+
var instance = useInstance();
|
|
9
|
+
var immutableValues = useState([]);
|
|
10
|
+
function setImmutableValues() {
|
|
11
|
+
var _instance$get = instance.get(),
|
|
12
|
+
children = _instance$get.children,
|
|
13
|
+
multiple = _instance$get.multiple;
|
|
14
|
+
if (!multiple) return;
|
|
15
|
+
updateImmutableValues(children);
|
|
16
|
+
}
|
|
17
|
+
function updateImmutableValues(children) {
|
|
18
|
+
var _immutableValues = [];
|
|
19
|
+
var loop = function loop(children) {
|
|
20
|
+
eachChildren(children, function (vNode) {
|
|
21
|
+
if (isComponentVNode(vNode, Option)) {
|
|
22
|
+
var _vNode$props = vNode.props,
|
|
23
|
+
disabled = _vNode$props.disabled,
|
|
24
|
+
value = _vNode$props.value;
|
|
25
|
+
if (disabled) {
|
|
26
|
+
_immutableValues.push(value);
|
|
27
|
+
}
|
|
28
|
+
} else if (isComponentVNode(vNode, OptionGroup)) {
|
|
29
|
+
loop(vNode.props.children);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
loop(children);
|
|
34
|
+
immutableValues.set(_immutableValues);
|
|
35
|
+
}
|
|
36
|
+
function isClosable(key) {
|
|
37
|
+
var _context;
|
|
38
|
+
return !_includesInstanceProperty(_context = immutableValues.value).call(_context, key);
|
|
39
|
+
}
|
|
40
|
+
setImmutableValues();
|
|
41
|
+
// instance.on('$receive:children', setImmutableValues);
|
|
42
|
+
return {
|
|
43
|
+
immutableValues: immutableValues,
|
|
44
|
+
isClosable: isClosable
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -15,6 +15,7 @@ export interface TableCellProps {
|
|
|
15
15
|
rowspan: number;
|
|
16
16
|
onClickArrow: (e: MouseEvent) => void;
|
|
17
17
|
hasChildren: boolean;
|
|
18
|
+
loaded: boolean;
|
|
18
19
|
}
|
|
19
20
|
export declare class TableCell extends Component<TableCellProps> {
|
|
20
21
|
static template: string | import("intact").Template<any>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn } from 'intact';
|
|
2
2
|
import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
3
3
|
import { get, noop } from 'intact-shared';
|
|
4
4
|
import { Button } from '../button';
|
|
5
5
|
import { Icon } from '../icon';
|
|
6
6
|
import { getTextByChildren } from '../utils';
|
|
7
|
+
import { Ellipsis } from '../ellipsis';
|
|
7
8
|
export default function ($props, $blocks, $__proto__) {
|
|
8
9
|
var _classNameObj;
|
|
9
10
|
$blocks || ($blocks = {});
|
|
@@ -21,7 +22,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
21
22
|
colspan = _this$get.colspan,
|
|
22
23
|
rowspan = _this$get.rowspan,
|
|
23
24
|
onClickArrow = _this$get.onClickArrow,
|
|
24
|
-
hasChildren = _this$get.hasChildren
|
|
25
|
+
hasChildren = _this$get.hasChildren,
|
|
26
|
+
loaded = _this$get.loaded;
|
|
25
27
|
var k = this.config.k;
|
|
26
28
|
var blocks = props.$blocks;
|
|
27
29
|
var children = get(data, props.key);
|
|
@@ -31,6 +33,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
31
33
|
children = template(noop, [data, rowIndex]);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
36
|
+
if (props.ellipsis) {
|
|
37
|
+
children = _$cc(Ellipsis, {
|
|
38
|
+
'children': children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
34
41
|
var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, k, checkType),
|
|
35
42
|
className = _getClassAndStyleForF.className,
|
|
36
43
|
style = _getClassAndStyleForF.style;
|
|
@@ -46,9 +53,12 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
46
53
|
'size': 'mini',
|
|
47
54
|
'className': _$cn(k + "-table-arrow"),
|
|
48
55
|
'ev-click': onClickArrow,
|
|
49
|
-
'children': _$cc(Icon, {
|
|
56
|
+
'children': loaded !== false ? _$cc(Icon, {
|
|
50
57
|
'className': _$cn(k + "-icon-right"),
|
|
51
58
|
'size': 'small'
|
|
59
|
+
}) : _$cc(Icon, {
|
|
60
|
+
'className': _$cn(k + "-tree-icon ion-load-c"),
|
|
61
|
+
'rotate': true
|
|
52
62
|
})
|
|
53
63
|
}) : undefined, children], 0, _$cn(classNameObj), {
|
|
54
64
|
'style': style,
|