@kdcloudjs/kdesign 1.3.4 → 1.3.7
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/CHANGELOG.md +33 -0
- package/dist/kdesign-complete.less +19 -6
- package/dist/kdesign.css +38 -5
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +3505 -1836
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +2 -2
- package/dist/kdesign.min.js +8 -8
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/usePopper.d.ts +1 -0
- package/es/_utils/usePopper.js +29 -25
- package/es/anchor/anchor.js +20 -1
- package/es/base-data/style/index.css +1 -0
- package/es/base-data/style/index.less +1 -0
- package/es/button/style/index.css +36 -0
- package/es/button/style/index.less +14 -2
- package/es/checkbox/checkbox.js +7 -3
- package/es/form/Field.js +7 -6
- package/es/form/Form.d.ts +1 -0
- package/es/form/Form.js +3 -1
- package/es/form/interface.d.ts +1 -0
- package/es/menu/menu.js +12 -11
- package/es/menu/subMenu.js +58 -57
- package/es/radio/radio.js +7 -3
- package/es/select/select.js +24 -18
- package/es/style/core/reset.less +4 -4
- package/es/style/index.css +0 -4
- package/es/table/feature/useRangeSelection.d.ts +3 -0
- package/es/table/feature/useRangeSelection.js +10 -0
- package/es/table/interface.d.ts +15 -2
- package/es/table/table.js +14 -7
- package/lib/_utils/usePopper.d.ts +1 -0
- package/lib/_utils/usePopper.js +29 -25
- package/lib/anchor/anchor.js +20 -1
- package/lib/base-data/style/index.css +1 -0
- package/lib/base-data/style/index.less +1 -0
- package/lib/button/style/index.css +36 -0
- package/lib/button/style/index.less +14 -2
- package/lib/checkbox/checkbox.js +7 -3
- package/lib/form/Field.js +7 -6
- package/lib/form/Form.d.ts +1 -0
- package/lib/form/Form.js +3 -1
- package/lib/form/interface.d.ts +1 -0
- package/lib/menu/menu.js +12 -11
- package/lib/menu/subMenu.js +58 -57
- package/lib/radio/radio.js +7 -3
- package/lib/select/select.js +24 -18
- package/lib/style/core/reset.less +4 -4
- package/lib/style/index.css +0 -4
- package/lib/table/feature/useRangeSelection.d.ts +3 -0
- package/lib/table/feature/useRangeSelection.js +21 -0
- package/lib/table/interface.d.ts +15 -2
- package/lib/table/table.js +15 -7
- package/package.json +2 -2
package/es/select/select.js
CHANGED
|
@@ -67,7 +67,6 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
67
67
|
setInitValue = _useMergedState2[1];
|
|
68
68
|
|
|
69
69
|
var realChildren = Array.isArray(options) ? options : toArray(children); // options配置项和默认children
|
|
70
|
-
// console.log('real', realChildren)
|
|
71
70
|
|
|
72
71
|
var innerRef = React.useRef();
|
|
73
72
|
var selectRef = ref || innerRef;
|
|
@@ -251,6 +250,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
251
250
|
return (child === null || child === void 0 ? void 0 : child.value) === key;
|
|
252
251
|
}
|
|
253
252
|
})) || {};
|
|
253
|
+
var optionsObj = obj.props ? obj.props : obj || {};
|
|
254
254
|
|
|
255
255
|
if (value !== undefined) {
|
|
256
256
|
// onChange && onChange(labelInValue ? { value: key, label } : key)
|
|
@@ -271,13 +271,13 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
271
271
|
_spliceInstanceProperty(optsArr).call(optsArr, idx, 1);
|
|
272
272
|
} else {
|
|
273
273
|
valArr.push(key);
|
|
274
|
-
optsArr.push({
|
|
274
|
+
optsArr.push(_extends(_extends({}, optionsObj), {
|
|
275
275
|
value: key,
|
|
276
276
|
label: obj.props ? (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children : obj.label || key
|
|
277
|
-
});
|
|
277
|
+
}));
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
onChange && onChange(labelInValue ? optsArr : valArr);
|
|
280
|
+
onChange && onChange(labelInValue ? optsArr : valArr, optsArr);
|
|
281
281
|
|
|
282
282
|
if (!isSelected) {
|
|
283
283
|
onDeselect && onDeselect(key); // 下拉项取消选中时调用,参数为选中项的value,多选模式下生效
|
|
@@ -287,7 +287,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
287
287
|
onChange && onChange(labelInValue ? {
|
|
288
288
|
value: key,
|
|
289
289
|
label: label
|
|
290
|
-
} : key)
|
|
290
|
+
} : key, _extends(_extends({}, optionsObj), {
|
|
291
|
+
value: key,
|
|
292
|
+
label: label
|
|
293
|
+
}));
|
|
291
294
|
}
|
|
292
295
|
|
|
293
296
|
onSelect && onSelect(key);
|
|
@@ -303,7 +306,10 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
303
306
|
onChange && onChange(labelInValue ? {
|
|
304
307
|
value: key,
|
|
305
308
|
label: label
|
|
306
|
-
} : key)
|
|
309
|
+
} : key, _extends(_extends({}, optionsObj), {
|
|
310
|
+
value: key,
|
|
311
|
+
label: label
|
|
312
|
+
}));
|
|
307
313
|
} else {
|
|
308
314
|
var _multipleRef$current2 = multipleRef.current,
|
|
309
315
|
_selectedVal = _multipleRef$current2.selectedVal,
|
|
@@ -318,15 +324,15 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
318
324
|
} else {
|
|
319
325
|
_selectedVal.push(key);
|
|
320
326
|
|
|
321
|
-
_selectMulOpts.push({
|
|
327
|
+
_selectMulOpts.push(_extends(_extends({}, optionsObj), {
|
|
322
328
|
value: key,
|
|
323
329
|
label: obj.props ? (_c = obj.props) === null || _c === void 0 ? void 0 : _c.children : obj.label || key
|
|
324
|
-
});
|
|
330
|
+
}));
|
|
325
331
|
} // setInitValue([...selectedVal])
|
|
326
332
|
|
|
327
333
|
|
|
328
334
|
setMulOptions(_toConsumableArray(_selectMulOpts));
|
|
329
|
-
onChange && onChange(labelInValue ? _selectMulOpts : _selectedVal);
|
|
335
|
+
onChange && onChange(labelInValue ? _selectMulOpts : _selectedVal, _selectMulOpts);
|
|
330
336
|
|
|
331
337
|
if (!isSelected) {
|
|
332
338
|
onDeselect && onDeselect(key); // 下拉项取消选中时调用,参数为选中项的value,多选模式下生效
|
|
@@ -347,9 +353,9 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
347
353
|
|
|
348
354
|
if ((realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) !== selectedVal.length) {
|
|
349
355
|
_mapInstanceProperty(realChildren).call(realChildren, function (child) {
|
|
350
|
-
var
|
|
351
|
-
value =
|
|
352
|
-
children =
|
|
356
|
+
var _ref = child.props || child,
|
|
357
|
+
value = _ref.value,
|
|
358
|
+
children = _ref.children;
|
|
353
359
|
|
|
354
360
|
if (!_includesInstanceProperty(selectedVal).call(selectedVal, value)) {
|
|
355
361
|
selectedVal.push(value);
|
|
@@ -362,12 +368,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
362
368
|
|
|
363
369
|
setMulOptions(_toConsumableArray(selectMulOpts));
|
|
364
370
|
} else {
|
|
365
|
-
multipleRef.current.selectedVal = [];
|
|
366
|
-
multipleRef.current.selectMulOpts = [];
|
|
371
|
+
multipleRef.current.selectedVal = selectedVal = [];
|
|
372
|
+
multipleRef.current.selectMulOpts = selectMulOpts = [];
|
|
367
373
|
setMulOptions([]);
|
|
368
374
|
}
|
|
369
375
|
|
|
370
|
-
onChange && onChange(labelInValue ? selectMulOpts : selectedVal);
|
|
376
|
+
onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
|
|
371
377
|
}; // 筛选内容 ---可以优化,抽成hook
|
|
372
378
|
|
|
373
379
|
|
|
@@ -428,7 +434,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
428
434
|
_spliceInstanceProperty(selectMulOpts).call(selectMulOpts, idx, 1);
|
|
429
435
|
|
|
430
436
|
setMulOptions(_toConsumableArray(selectMulOpts));
|
|
431
|
-
onChange && onChange(labelInValue ? selectMulOpts : selectedVal);
|
|
437
|
+
onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
|
|
432
438
|
e.stopPropagation();
|
|
433
439
|
}; // 渲染后缀图标
|
|
434
440
|
|
|
@@ -659,8 +665,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
659
665
|
var _a;
|
|
660
666
|
|
|
661
667
|
if (selectRef === null || selectRef === void 0 ? void 0 : selectRef.current) {
|
|
662
|
-
var
|
|
663
|
-
width =
|
|
668
|
+
var _ref2 = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
|
|
669
|
+
width = _ref2.width;
|
|
664
670
|
|
|
665
671
|
return {
|
|
666
672
|
width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || (width > 75 ? width : 75),
|
package/es/style/core/reset.less
CHANGED
|
@@ -194,10 +194,10 @@ template {
|
|
|
194
194
|
/**
|
|
195
195
|
* Reset scrollbar style
|
|
196
196
|
*/
|
|
197
|
-
::-webkit-scrollbar {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
197
|
+
// ::-webkit-scrollbar {
|
|
198
|
+
// width: 10px !important;
|
|
199
|
+
// height: 10px !important;
|
|
200
|
+
// }
|
|
201
201
|
|
|
202
202
|
::-webkit-scrollbar-button {
|
|
203
203
|
width: 0;
|
package/es/style/index.css
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { features } from '@kdcloudjs/table';
|
|
3
|
+
|
|
4
|
+
function useRangeSelection(pipeline, rangeSelection) {
|
|
5
|
+
if (rangeSelection) {
|
|
6
|
+
pipeline.use(features.rangeSelection(_extends({}, rangeSelection)));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default useRangeSelection;
|
package/es/table/interface.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps as BaseTableProps, TablePipeline as TP, ArtColumnStaticPart } from '@kdcloudjs/table';
|
|
2
|
-
import { SortFeatureOptions, RowDetailFeatureOptions, FilterFeatureOptions, TreeModeFeatureOptions, ColumnDragOptions, ColumnResizeOptions, ContextMenuFeatureOptions } from '@kdcloudjs/table/es/table/pipeline/features';
|
|
3
|
-
|
|
3
|
+
import { SortFeatureOptions, RowDetailFeatureOptions, FilterFeatureOptions, TreeModeFeatureOptions, ColumnDragOptions, ColumnResizeOptions, ContextMenuFeatureOptions, RangeSelectionFeatureOptions } from '@kdcloudjs/table/es/table/pipeline/features';
|
|
4
|
+
declare type TablePropsOfComponents = Pick<BaseTableProps, 'components'> & {
|
|
5
|
+
components?: {
|
|
6
|
+
/** 复选框 */
|
|
7
|
+
Checkbox?: React.ComponentType;
|
|
8
|
+
/** 单选框 */
|
|
9
|
+
Radio?: React.ComponentType;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare type TablePropsOfExtend = Omit<BaseTableProps, 'components'>;
|
|
13
|
+
export interface TableProps extends TablePropsOfExtend, TablePropsOfComponents {
|
|
4
14
|
rowSelection?: TableRowSelection;
|
|
5
15
|
prefixCls?: string;
|
|
6
16
|
rowDetail?: TableRowDetail;
|
|
@@ -11,6 +21,7 @@ export interface TableProps extends BaseTableProps {
|
|
|
11
21
|
columnDrag?: boolean | ColumnDragOptions;
|
|
12
22
|
columnResize?: boolean | ColumnResizeOptions;
|
|
13
23
|
contextMenu?: IContextMenu;
|
|
24
|
+
rangeSelection?: TableRangeSelection;
|
|
14
25
|
}
|
|
15
26
|
export declare type RowSelectionType = 'checkbox' | 'radio';
|
|
16
27
|
export declare type RowSelectionFixed = 'start' | 'end';
|
|
@@ -32,3 +43,5 @@ export declare type TableSort = SortFeatureOptions;
|
|
|
32
43
|
export declare type TableTreeMode = TreeModeFeatureOptions;
|
|
33
44
|
export declare type TablePipeline = TP;
|
|
34
45
|
export declare type IContextMenu = boolean | ContextMenuFeatureOptions;
|
|
46
|
+
export declare type TableRangeSelection = RangeSelectionFeatureOptions;
|
|
47
|
+
export {};
|
package/es/table/table.js
CHANGED
|
@@ -17,6 +17,7 @@ import useTreeMode from './feature/treeMode';
|
|
|
17
17
|
import useColumnResize from './feature/columnResize';
|
|
18
18
|
import useColumnDrag from './feature/columnDrag';
|
|
19
19
|
import useContextMenu from './feature/contextMenu';
|
|
20
|
+
import useRangeSelection from './feature/useRangeSelection';
|
|
20
21
|
import devWarning from '../_utils/devwarning';
|
|
21
22
|
|
|
22
23
|
function Table(props) {
|
|
@@ -46,6 +47,7 @@ function Table(props) {
|
|
|
46
47
|
getRowProps = props.getRowProps,
|
|
47
48
|
getTableProps = props.getTableProps,
|
|
48
49
|
contextMenu = props.contextMenu,
|
|
50
|
+
rangeSelection = props.rangeSelection,
|
|
49
51
|
cssVariables = props.cssVariables;
|
|
50
52
|
|
|
51
53
|
var _useContext = useContext(ConfigContext),
|
|
@@ -56,19 +58,24 @@ function Table(props) {
|
|
|
56
58
|
var tableCls = classNames(tablePrefixCls, className);
|
|
57
59
|
var pipeline = useTablePipeline({
|
|
58
60
|
components: {
|
|
59
|
-
Checkbox: Checkbox,
|
|
60
|
-
Radio: Radio
|
|
61
|
+
Checkbox: (components === null || components === void 0 ? void 0 : components.Checkbox) || Checkbox,
|
|
62
|
+
Radio: (components === null || components === void 0 ? void 0 : components.Radio) || Radio
|
|
61
63
|
}
|
|
62
64
|
}).primaryKey(primaryKey === undefined ? '' : primaryKey).input({
|
|
63
65
|
columns: columns,
|
|
64
66
|
dataSource: dataSource
|
|
65
67
|
});
|
|
68
|
+
|
|
69
|
+
if (footerDataSource) {
|
|
70
|
+
pipeline.footerDataSource(footerDataSource);
|
|
71
|
+
}
|
|
66
72
|
/* -------------------------------------------------------------------------- */
|
|
67
73
|
|
|
68
74
|
/* features */
|
|
69
75
|
|
|
70
76
|
/* -------------------------------------------------------------------------- */
|
|
71
77
|
|
|
78
|
+
|
|
72
79
|
useRowSelection(pipeline, rowSelection);
|
|
73
80
|
useRowDetail(pipeline, rowDetail);
|
|
74
81
|
useFilter(pipeline, filter);
|
|
@@ -78,6 +85,7 @@ function Table(props) {
|
|
|
78
85
|
useColumnResize(pipeline, columnResize);
|
|
79
86
|
useColumnDrag(pipeline, columnDrag);
|
|
80
87
|
useContextMenu(pipeline, contextMenu);
|
|
88
|
+
useRangeSelection(pipeline, rangeSelection);
|
|
81
89
|
/* -------------------------------------------------------------------------- */
|
|
82
90
|
|
|
83
91
|
/* after useTablePipeline, merge pipeline.getProps result */
|
|
@@ -101,18 +109,17 @@ function Table(props) {
|
|
|
101
109
|
className: tableCls,
|
|
102
110
|
style: style,
|
|
103
111
|
isLoading: isLoading,
|
|
104
|
-
components:
|
|
105
|
-
LoadingIcon: function
|
|
112
|
+
components: {
|
|
113
|
+
LoadingIcon: (components === null || components === void 0 ? void 0 : components.LoadingIcon) || function () {
|
|
106
114
|
return /*#__PURE__*/React.createElement(Spin, {
|
|
107
115
|
type: "container"
|
|
108
116
|
});
|
|
109
117
|
},
|
|
110
|
-
EmptyContent: function
|
|
118
|
+
EmptyContent: (components === null || components === void 0 ? void 0 : components.EmptyContent) || function () {
|
|
111
119
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
112
120
|
}
|
|
113
|
-
},
|
|
121
|
+
},
|
|
114
122
|
useVirtual: useVirtual,
|
|
115
|
-
footerDataSource: footerDataSource,
|
|
116
123
|
estimatedRowHeight: estimatedRowHeight,
|
|
117
124
|
emptyCellHeight: emptyCellHeight,
|
|
118
125
|
hasHeader: hasHeader,
|
package/lib/_utils/usePopper.js
CHANGED
|
@@ -186,6 +186,8 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
186
186
|
mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela,
|
|
187
187
|
_props$defaultVisible = props.defaultVisible,
|
|
188
188
|
defaultVisible = _props$defaultVisible === void 0 ? false : _props$defaultVisible,
|
|
189
|
+
_props$autoPlacement = props.autoPlacement,
|
|
190
|
+
autoPlacement = _props$autoPlacement === void 0 ? true : _props$autoPlacement,
|
|
189
191
|
_props$getTriggerElem = props.getTriggerElement,
|
|
190
192
|
getTriggerElement = _props$getTriggerElem === void 0 ? function (locatorNode) {
|
|
191
193
|
return locatorNode;
|
|
@@ -323,36 +325,38 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
323
325
|
var currentPos = trigger === 'contextMenu' ? mousePos : locatorPos;
|
|
324
326
|
var _currentPlacement = placement;
|
|
325
327
|
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
if (autoPlacement) {
|
|
329
|
+
if (top - gap - popperHeight <= 5 && bottom + gap + popperHeight < document.body.clientHeight - 5) {
|
|
330
|
+
_currentPlacement = _currentPlacement.replace('top', 'bottom');
|
|
331
|
+
}
|
|
329
332
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
+
if (bottom + gap + popperHeight >= document.body.clientHeight - 5 && top - gap - popperHeight > 5) {
|
|
334
|
+
_currentPlacement = _currentPlacement.replace('bottom', 'top');
|
|
335
|
+
}
|
|
333
336
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
if (left + popperWidth >= document.body.clientWidth - 5 && right - popperWidth > 5) {
|
|
338
|
+
_currentPlacement = _currentPlacement.replace('Left', 'Right');
|
|
339
|
+
}
|
|
337
340
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (right - popperWidth <= 5 && left + popperWidth < document.body.clientWidth - 5) {
|
|
342
|
+
_currentPlacement = _currentPlacement.replace('Right', 'Left');
|
|
343
|
+
}
|
|
341
344
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
+
if (top + popperHeight >= document.body.clientHeight - 5 && bottom - popperHeight > 5) {
|
|
346
|
+
_currentPlacement = _currentPlacement.replace('Top', 'Bottom');
|
|
347
|
+
}
|
|
345
348
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
+
if (bottom - popperHeight <= 5 && top + popperHeight < document.body.clientHeight - 5) {
|
|
350
|
+
_currentPlacement = _currentPlacement.replace('Bottom', 'Top');
|
|
351
|
+
}
|
|
349
352
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
+
if (left - gap - popperWidth <= 5 && right + gap + popperWidth < document.body.clientWidth - 5) {
|
|
354
|
+
_currentPlacement = _currentPlacement.replace('left', 'right');
|
|
355
|
+
}
|
|
353
356
|
|
|
354
|
-
|
|
355
|
-
|
|
357
|
+
if (right + gap + popperWidth >= document.body.clientWidth - 5 && left - gap - popperWidth > 5) {
|
|
358
|
+
_currentPlacement = _currentPlacement.replace('right', 'left');
|
|
359
|
+
}
|
|
356
360
|
}
|
|
357
361
|
|
|
358
362
|
var leftLeft = currentPos.left - popperWidth - gap;
|
|
@@ -465,7 +469,7 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
465
469
|
setArrowPos(_arrowPos);
|
|
466
470
|
setCurrentPlacement(_currentPlacement);
|
|
467
471
|
}
|
|
468
|
-
}, [locatorRef, popperRef, container, trigger, mousePos, placement, gap, arrowOffset, arrowSize, arrowWidth]);
|
|
472
|
+
}, [locatorRef, popperRef, container, trigger, mousePos, placement, gap, arrowOffset, arrowSize, arrowWidth, autoPlacement]);
|
|
469
473
|
(0, _react.useEffect)(function () {
|
|
470
474
|
if (canAlign) {
|
|
471
475
|
alignPopper();
|
|
@@ -479,7 +483,7 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
479
483
|
if (arrowPos.left) arrowStyle["--arrowLeft"] = arrowPos.left + 'px';
|
|
480
484
|
var popperContainerStyle = (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
|
|
481
485
|
position: 'absolute'
|
|
482
|
-
},
|
|
486
|
+
}, align), arrow ? arrowStyle : {}), popperStyle);
|
|
483
487
|
var popperProps = {
|
|
484
488
|
ref: popperRef,
|
|
485
489
|
style: popperContainerStyle,
|
package/lib/anchor/anchor.js
CHANGED
|
@@ -367,7 +367,9 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
367
367
|
!isLocked && setOptionShow(visible);
|
|
368
368
|
};
|
|
369
369
|
|
|
370
|
-
var popperProps = (0, _extends2.default)((0, _extends2.default)({
|
|
370
|
+
var popperProps = (0, _extends2.default)((0, _extends2.default)({
|
|
371
|
+
autoPlacement: false
|
|
372
|
+
}, anchorProps), {
|
|
371
373
|
prefixCls: anchorPrefixCls,
|
|
372
374
|
defaultVisible: optionShow,
|
|
373
375
|
visible: optionShow,
|
|
@@ -375,6 +377,22 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
375
377
|
onVisibleChange: handleVisibleChange
|
|
376
378
|
});
|
|
377
379
|
|
|
380
|
+
var fixedRef = _react.default.useRef(null);
|
|
381
|
+
|
|
382
|
+
if (type === 'advanced' && isLocked) {
|
|
383
|
+
if (fixedRef.current) {
|
|
384
|
+
var _fixedRef$current$get = fixedRef.current.getBoundingClientRect(),
|
|
385
|
+
left = _fixedRef$current$get.left,
|
|
386
|
+
top = _fixedRef$current$get.top;
|
|
387
|
+
|
|
388
|
+
popperProps.popperStyle = {
|
|
389
|
+
position: 'fixed',
|
|
390
|
+
left: left,
|
|
391
|
+
top: top
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
378
396
|
var addChildrenProps = function addChildrenProps(linksChildren) {
|
|
379
397
|
var _context4;
|
|
380
398
|
|
|
@@ -504,6 +522,7 @@ var InternalAnchor = function InternalAnchor(props, ref) {
|
|
|
504
522
|
});
|
|
505
523
|
|
|
506
524
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
525
|
+
ref: fixedRef,
|
|
507
526
|
className: anchorAdvancedClass,
|
|
508
527
|
style: dropdownStyle
|
|
509
528
|
}, lockedIcon !== false && /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -222,6 +222,7 @@
|
|
|
222
222
|
}
|
|
223
223
|
.kd-baseData-dropdown-options {
|
|
224
224
|
height: var(--kd-c-base-data-dropdown-options-sizing-height, 32px);
|
|
225
|
+
cursor: pointer;
|
|
225
226
|
}
|
|
226
227
|
.kd-baseData-dropdown-options:hover {
|
|
227
228
|
background: var(--kd-c-base-data-color-background-hover, var(--kd-g-color-hover, #f5f5f5));
|
|
@@ -241,6 +241,15 @@
|
|
|
241
241
|
.kd-btn-size-small.kd-btn-icon-only {
|
|
242
242
|
font-size: var(--kd-c-button-icon-font-size-small, 14px);
|
|
243
243
|
padding: 0 var(--kd-c-button-icon-spacing-padding-horizontal, 4px);
|
|
244
|
+
display: -webkit-inline-box;
|
|
245
|
+
display: -ms-inline-flexbox;
|
|
246
|
+
display: inline-flex;
|
|
247
|
+
-webkit-box-pack: center;
|
|
248
|
+
-ms-flex-pack: center;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
-webkit-box-align: center;
|
|
251
|
+
-ms-flex-align: center;
|
|
252
|
+
align-items: center;
|
|
244
253
|
}
|
|
245
254
|
.kd-btn-size-small .kd-btn-group-basic-icon {
|
|
246
255
|
font-size: var(--kd-c-button-icon-font-size-small, 14px);
|
|
@@ -255,6 +264,15 @@
|
|
|
255
264
|
.kd-btn-size-middle.kd-btn-icon-only {
|
|
256
265
|
font-size: var(--kd-c-button-icon-font-size-middle, 16px);
|
|
257
266
|
padding: 0 var(--kd-c-button-icon-spacing-padding-horizontal, 4px);
|
|
267
|
+
display: -webkit-inline-box;
|
|
268
|
+
display: -ms-inline-flexbox;
|
|
269
|
+
display: inline-flex;
|
|
270
|
+
-webkit-box-pack: center;
|
|
271
|
+
-ms-flex-pack: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
-webkit-box-align: center;
|
|
274
|
+
-ms-flex-align: center;
|
|
275
|
+
align-items: center;
|
|
258
276
|
}
|
|
259
277
|
.kd-btn-size-middle .kd-btn-group-basic-icon {
|
|
260
278
|
font-size: var(--kd-c-button-icon-font-size-middle, 16px);
|
|
@@ -269,6 +287,15 @@
|
|
|
269
287
|
.kd-btn-size-large.kd-btn-icon-only {
|
|
270
288
|
font-size: var(--kd-c-button-icon-font-size-large, 18px);
|
|
271
289
|
padding: 0 var(--kd-c-button-icon-spacing-padding-horizontal, 4px);
|
|
290
|
+
display: -webkit-inline-box;
|
|
291
|
+
display: -ms-inline-flexbox;
|
|
292
|
+
display: inline-flex;
|
|
293
|
+
-webkit-box-pack: center;
|
|
294
|
+
-ms-flex-pack: center;
|
|
295
|
+
justify-content: center;
|
|
296
|
+
-webkit-box-align: center;
|
|
297
|
+
-ms-flex-align: center;
|
|
298
|
+
align-items: center;
|
|
272
299
|
}
|
|
273
300
|
.kd-btn-size-large .kd-btn-group-basic-icon {
|
|
274
301
|
font-size: var(--kd-c-button-icon-font-size-large, 18px);
|
|
@@ -337,6 +364,15 @@
|
|
|
337
364
|
}
|
|
338
365
|
.kd-btn-loading {
|
|
339
366
|
cursor: default;
|
|
367
|
+
display: -webkit-inline-box;
|
|
368
|
+
display: -ms-inline-flexbox;
|
|
369
|
+
display: inline-flex;
|
|
370
|
+
-webkit-box-pack: center;
|
|
371
|
+
-ms-flex-pack: center;
|
|
372
|
+
justify-content: center;
|
|
373
|
+
-webkit-box-align: center;
|
|
374
|
+
-ms-flex-align: center;
|
|
375
|
+
align-items: center;
|
|
340
376
|
}
|
|
341
377
|
.kd-btn-block {
|
|
342
378
|
width: 100%;
|
|
@@ -114,6 +114,9 @@
|
|
|
114
114
|
&.@{btn-prefix-cls}-icon-only {
|
|
115
115
|
font-size: @btn-icon-small-font-size;
|
|
116
116
|
padding: 0 @btn-icon-padding-horizontal;
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
align-items: center;
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
.@{btn-prefix-cls}-group-basic-icon {
|
|
@@ -127,6 +130,9 @@
|
|
|
127
130
|
&.@{btn-prefix-cls}-icon-only {
|
|
128
131
|
font-size: @btn-icon-middle-font-size;
|
|
129
132
|
padding: 0 @btn-icon-padding-horizontal;
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
align-items: center;
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
.@{btn-prefix-cls}-group-basic-icon {
|
|
@@ -140,6 +146,9 @@
|
|
|
140
146
|
&.@{btn-prefix-cls}-icon-only {
|
|
141
147
|
font-size: @btn-icon-large-font-size;
|
|
142
148
|
padding: 0 @btn-icon-padding-horizontal;
|
|
149
|
+
display: inline-flex;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
align-items: center;
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
.@{btn-prefix-cls}-group-basic-icon {
|
|
@@ -234,6 +243,9 @@
|
|
|
234
243
|
// 加载中按钮
|
|
235
244
|
&-loading {
|
|
236
245
|
cursor: default;
|
|
246
|
+
display: inline-flex;
|
|
247
|
+
justify-content: center;
|
|
248
|
+
align-items: center;
|
|
237
249
|
}
|
|
238
250
|
// 按钮开启块化撑满父元素
|
|
239
251
|
&-block {
|
|
@@ -271,11 +283,11 @@
|
|
|
271
283
|
background: @btn-group-trigger-color-background-hover;
|
|
272
284
|
border-color: @btn-group-trigger-color-background-hover;
|
|
273
285
|
}
|
|
274
|
-
|
|
286
|
+
|
|
275
287
|
&:active {
|
|
276
288
|
background: @btn-group-trigger-color-background-active;
|
|
277
289
|
}
|
|
278
|
-
|
|
290
|
+
|
|
279
291
|
&:disabled {
|
|
280
292
|
background: @btn-group-trigger-color-background-disabled !important;
|
|
281
293
|
}
|
package/lib/checkbox/checkbox.js
CHANGED
|
@@ -104,6 +104,8 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
104
104
|
(0, _isBoolean.default)(checked) && checked !== selected && setSelected(checked);
|
|
105
105
|
}, [checked, selected]);
|
|
106
106
|
(0, _react.useEffect)(function () {
|
|
107
|
+
var _a;
|
|
108
|
+
|
|
107
109
|
var handleRepeatClick = function handleRepeatClick(e) {
|
|
108
110
|
var element = e.target;
|
|
109
111
|
|
|
@@ -112,10 +114,12 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
116
|
|
|
115
|
-
labelRef.current.addEventListener('click', handleRepeatClick);
|
|
117
|
+
(_a = labelRef === null || labelRef === void 0 ? void 0 : labelRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', handleRepeatClick);
|
|
116
118
|
return function () {
|
|
117
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
|
-
|
|
119
|
+
var _a; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
(_a = labelRef === null || labelRef === void 0 ? void 0 : labelRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', handleRepeatClick);
|
|
119
123
|
};
|
|
120
124
|
}, []);
|
|
121
125
|
|
package/lib/form/Field.js
CHANGED
|
@@ -137,7 +137,8 @@ var Field = function Field(props) {
|
|
|
137
137
|
getInternalHooks = fieldContext.getInternalHooks,
|
|
138
138
|
vertical = fieldContext.vertical,
|
|
139
139
|
getDefaultValue = fieldContext.getDefaultValue,
|
|
140
|
-
local = fieldContext.local
|
|
140
|
+
local = fieldContext.local,
|
|
141
|
+
formDisabled = fieldContext.disabled;
|
|
141
142
|
|
|
142
143
|
var _getInternalHooks = getInternalHooks(_useForm.INTERNAL_HOOK_KEY),
|
|
143
144
|
registerField = _getInternalHooks.registerField,
|
|
@@ -305,17 +306,17 @@ var Field = function Field(props) {
|
|
|
305
306
|
chDisabled = _ch$props.disabled,
|
|
306
307
|
chDefaultValue = _ch$props.defaultValue;
|
|
307
308
|
|
|
308
|
-
var onChange = function onChange(
|
|
309
|
+
var onChange = function onChange() {
|
|
309
310
|
if (chValue === undefined) {
|
|
310
|
-
setFieldValue(getInputValueFormProp(
|
|
311
|
+
setFieldValue(getInputValueFormProp(arguments.length <= 0 ? undefined : arguments[0]));
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
if (typeof faChange === 'function') {
|
|
314
|
-
faChange(
|
|
315
|
+
faChange.apply(void 0, arguments);
|
|
315
316
|
}
|
|
316
317
|
|
|
317
318
|
if (typeof chChange === 'function') {
|
|
318
|
-
chChange(
|
|
319
|
+
chChange.apply(void 0, arguments);
|
|
319
320
|
}
|
|
320
321
|
};
|
|
321
322
|
|
|
@@ -333,7 +334,7 @@ var Field = function Field(props) {
|
|
|
333
334
|
return (0, _extends5.default)((0, _extends5.default)({}, rest), (_extends3 = {
|
|
334
335
|
onChange: onChange,
|
|
335
336
|
defaultValue: defaultValue
|
|
336
|
-
}, (0, _defineProperty2.default)(_extends3, innerValuePropName, fieldValue), (0, _defineProperty2.default)(_extends3, "disabled", chDisabled
|
|
337
|
+
}, (0, _defineProperty2.default)(_extends3, innerValuePropName, fieldValue), (0, _defineProperty2.default)(_extends3, "disabled", chDisabled !== undefined ? chDisabled : faDisabled !== undefined ? faDisabled : formDisabled), _extends3));
|
|
337
338
|
};
|
|
338
339
|
|
|
339
340
|
return /*#__PURE__*/_react.default.createElement("div", {
|
package/lib/form/Form.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare type BaseFormProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, 'on
|
|
|
4
4
|
export interface FormProps<Values = any> extends BaseFormProps {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
defaultValues?: Store;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
className?: string;
|
|
8
9
|
form?: FormInstance<Values>;
|
|
9
10
|
labelAlign?: LabelAlign;
|
package/lib/form/Form.js
CHANGED
|
@@ -81,7 +81,8 @@ var Form = function Form(props, ref) {
|
|
|
81
81
|
onFinish = formProps.onFinish,
|
|
82
82
|
onFinishFailed = formProps.onFinishFailed,
|
|
83
83
|
onValuesChange = formProps.onValuesChange,
|
|
84
|
-
|
|
84
|
+
disabled = formProps.disabled,
|
|
85
|
+
restProps = __rest(formProps, ["children", "defaultValues", "className", "form", "labelAlign", "labelWidth", "layout", "name", "prefixCls", "wrapperWidth", "onFinish", "onFinishFailed", "onValuesChange", "disabled"]);
|
|
85
86
|
|
|
86
87
|
var formPrefixCls = getPrefixCls(prefixCls, 'form', customizePrefixCls);
|
|
87
88
|
var formClassName = (0, _classnames2.default)((_classnames = {}, (0, _defineProperty2.default)(_classnames, "".concat(formPrefixCls), true), (0, _defineProperty2.default)(_classnames, (0, _concat.default)(_context = "".concat(formPrefixCls, "-")).call(_context, layout), true), _classnames), className);
|
|
@@ -121,6 +122,7 @@ var Form = function Form(props, ref) {
|
|
|
121
122
|
labelWidth: labelWidth,
|
|
122
123
|
wrapperWidth: wrapperWidth,
|
|
123
124
|
local: formLang,
|
|
125
|
+
disabled: disabled,
|
|
124
126
|
vertical: layout === 'vertical'
|
|
125
127
|
});
|
|
126
128
|
}, [formInstance, labelAlign, labelWidth, wrapperWidth, layout, formLang]);
|
package/lib/form/interface.d.ts
CHANGED