bkui-vue 2.1.0-dev-beta.10 → 2.1.0-dev-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +62 -62
- package/dist/index.esm.js +13182 -13087
- package/dist/index.umd.js +59 -59
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/cascader/index.js +11 -5
- package/lib/index.js +1 -1
- package/lib/input/index.d.ts +36 -15
- package/lib/input/index.js +80 -95
- package/lib/input/input.d.ts +34 -10
- package/lib/tree/constant.d.ts +6 -0
- package/lib/tree/index.d.ts +39 -9
- package/lib/tree/index.js +560 -484
- package/lib/tree/props.d.ts +57 -1
- package/lib/tree/tree.css +31 -0
- package/lib/tree/tree.d.ts +22 -7
- package/lib/tree/tree.less +38 -6
- package/lib/tree/tree.variable.css +31 -0
- package/lib/tree/use-intersection-observer.d.ts +1 -1
- package/lib/tree/use-node-action.d.ts +2 -2
- package/lib/tree/use-node-async.d.ts +13 -3
- package/lib/tree/use-node-attribute.d.ts +68 -40
- package/lib/tree/use-node-drag.d.ts +16 -3
- package/lib/tree/use-tree-init.d.ts +14 -1
- package/lib/tree/util.d.ts +30 -1
- package/package.json +1 -1
package/lib/cascader/index.js
CHANGED
|
@@ -1725,7 +1725,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
1725
1725
|
// 只展开,不需要重复触发
|
|
1726
1726
|
var expandNode = function expandNode(node) {
|
|
1727
1727
|
var _node$children;
|
|
1728
|
-
if (!node || node !== null && node !== void 0 && node.isDisabled)
|
|
1728
|
+
if (!node || node !== null && node !== void 0 && node.isDisabled) {
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1729
1731
|
var level = node.level;
|
|
1730
1732
|
// 确保面板只更新到当前节点层级
|
|
1731
1733
|
menus.list = menus.list.slice(0, level);
|
|
@@ -1773,7 +1775,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
1773
1775
|
/** node点击展开回调 */
|
|
1774
1776
|
var nodeExpandHandler = function nodeExpandHandler(node) {
|
|
1775
1777
|
var _node$children2;
|
|
1776
|
-
if (!node || node !== null && node !== void 0 && node.isDisabled)
|
|
1778
|
+
if (!node || node !== null && node !== void 0 && node.isDisabled) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1777
1781
|
menus.list = menus.list.slice(0, node.level);
|
|
1778
1782
|
activePath.value = activePath.value.slice(0, node.level - 1);
|
|
1779
1783
|
/** 如果所点击的node具有children元素,则直接展开
|
|
@@ -1953,6 +1957,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
1953
1957
|
"class": [_this.resolveClassName('cascader-panel'), _this.resolveClassName('scroll-y')]
|
|
1954
1958
|
}, [_this.suggestions.map(function (node) {
|
|
1955
1959
|
return (0,external_vue_.createVNode)("li", (0,external_vue_.mergeProps)({
|
|
1960
|
+
"key": node.id,
|
|
1956
1961
|
"class": [_this.resolveClassName('cascader-node'), {
|
|
1957
1962
|
'is-selected': _this.isNodeInPath(node)
|
|
1958
1963
|
}, {
|
|
@@ -1971,8 +1976,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
1971
1976
|
return (0,external_vue_.createVNode)("div", {
|
|
1972
1977
|
"class": this.resolveClassName('cascader-panel-wrapper')
|
|
1973
1978
|
}, [this.isFiltering ? searchPanelRender() : this.menus.list.map(function (menu, index) {
|
|
1974
|
-
var _this$$slots$panel, _this$$slots;
|
|
1979
|
+
var _this$activePath$id, _this$activePath, _this$$slots$panel, _this$$slots;
|
|
1975
1980
|
return (0,external_vue_.createVNode)("ul", {
|
|
1981
|
+
"key": index === 0 ? '__root__' : (_this$activePath$id = (_this$activePath = _this.activePath[index - 1]) === null || _this$activePath === void 0 ? void 0 : _this$activePath.id) !== null && _this$activePath$id !== void 0 ? _this$activePath$id : "__level_".concat(index, "__"),
|
|
1976
1982
|
"style": {
|
|
1977
1983
|
height: _this.panelHeight,
|
|
1978
1984
|
width: _this.panelWidth
|
|
@@ -1985,6 +1991,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
1985
1991
|
}), menu.length ? menu.map(function (node) {
|
|
1986
1992
|
var _this$$slots$default, _this$$slots2;
|
|
1987
1993
|
return (0,external_vue_.createVNode)("li", (0,external_vue_.mergeProps)({
|
|
1994
|
+
"key": node.id,
|
|
1988
1995
|
"class": [_this.resolveClassName('cascader-node'), {
|
|
1989
1996
|
'is-selected': _this.isNodeInPath(node)
|
|
1990
1997
|
}, {
|
|
@@ -2506,7 +2513,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2506
2513
|
var isFocus = (0,external_vue_.ref)(false);
|
|
2507
2514
|
// 定义isShowPanel变量,用于标致面板显示
|
|
2508
2515
|
var isShowPanel = (0,external_vue_.ref)(false);
|
|
2509
|
-
//
|
|
2516
|
+
// 定义checkedValue变量,用于监听modelValue的变化
|
|
2510
2517
|
var checkedValue = (0,external_vue_.computed)({
|
|
2511
2518
|
get: function get() {
|
|
2512
2519
|
return modelValue.value;
|
|
@@ -2658,7 +2665,6 @@ var Store = /*#__PURE__*/function () {
|
|
|
2658
2665
|
}
|
|
2659
2666
|
// 开始过滤
|
|
2660
2667
|
isFiltering.value = true;
|
|
2661
|
-
isFiltering.value = true;
|
|
2662
2668
|
// 筛选方法,如果props中存在filterMethod,则使用props中的方法,否则使用默认方法
|
|
2663
2669
|
var filterMethod = props.filterMethod ? props.filterMethod : function (node) {
|
|
2664
2670
|
if (props.checkAnyLevel) {
|
package/lib/index.js
CHANGED
package/lib/input/index.d.ts
CHANGED
|
@@ -33,12 +33,18 @@ declare const BkInput: {
|
|
|
33
33
|
};
|
|
34
34
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
35
35
|
default: number;
|
|
36
|
+
} & {
|
|
37
|
+
default: number;
|
|
36
38
|
};
|
|
37
39
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
38
40
|
default: number;
|
|
41
|
+
} & {
|
|
42
|
+
default: number;
|
|
39
43
|
};
|
|
40
44
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
41
45
|
default: number;
|
|
46
|
+
} & {
|
|
47
|
+
default: number;
|
|
42
48
|
};
|
|
43
49
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
44
50
|
default: number;
|
|
@@ -111,13 +117,15 @@ declare const BkInput: {
|
|
|
111
117
|
} & {
|
|
112
118
|
default: boolean;
|
|
113
119
|
};
|
|
120
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
121
|
+
default: boolean;
|
|
122
|
+
} & {
|
|
123
|
+
default: boolean;
|
|
124
|
+
};
|
|
114
125
|
}>> & Readonly<{
|
|
115
126
|
onBlur?: (evt: FocusEvent) => any;
|
|
116
127
|
onChange?: (_value: any, _evt: KeyboardEvent) => any;
|
|
117
128
|
onClear?: () => any;
|
|
118
|
-
onCompositionend?: (evt: CompositionEvent) => any;
|
|
119
|
-
onCompositionstart?: (evt: CompositionEvent) => any;
|
|
120
|
-
onCompositionupdate?: (evt: CompositionEvent) => any;
|
|
121
129
|
onEnter?: (_value: any, _evt: KeyboardEvent) => any;
|
|
122
130
|
onFocus?: (evt: FocusEvent) => any;
|
|
123
131
|
onInput?: (_value: any, _evt: KeyboardEvent) => any;
|
|
@@ -139,9 +147,6 @@ declare const BkInput: {
|
|
|
139
147
|
keyup: (_value: any, _evt: KeyboardEvent) => any;
|
|
140
148
|
enter: (_value: any, _evt: KeyboardEvent) => any;
|
|
141
149
|
paste: (_value: any, _e: ClipboardEvent) => boolean;
|
|
142
|
-
compositionstart: (evt: CompositionEvent) => CompositionEvent;
|
|
143
|
-
compositionupdate: (evt: CompositionEvent) => CompositionEvent;
|
|
144
|
-
compositionend: (evt: CompositionEvent) => CompositionEvent;
|
|
145
150
|
search: (evt: Event) => Event;
|
|
146
151
|
}, import("vue").PublicProps, {
|
|
147
152
|
type: string;
|
|
@@ -172,6 +177,7 @@ declare const BkInput: {
|
|
|
172
177
|
showOverflowTooltips: boolean;
|
|
173
178
|
tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
|
|
174
179
|
autosize: boolean | import("./input").InputAutoSize;
|
|
180
|
+
allowEmptyValue: boolean;
|
|
175
181
|
}, true, {}, {}, import("vue").GlobalComponents, {
|
|
176
182
|
bkTooltips: import("vue").ObjectDirective<any, any, string, any>;
|
|
177
183
|
} & import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
@@ -215,12 +221,18 @@ declare const BkInput: {
|
|
|
215
221
|
};
|
|
216
222
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
217
223
|
default: number;
|
|
224
|
+
} & {
|
|
225
|
+
default: number;
|
|
218
226
|
};
|
|
219
227
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
220
228
|
default: number;
|
|
229
|
+
} & {
|
|
230
|
+
default: number;
|
|
221
231
|
};
|
|
222
232
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
223
233
|
default: number;
|
|
234
|
+
} & {
|
|
235
|
+
default: number;
|
|
224
236
|
};
|
|
225
237
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
226
238
|
default: number;
|
|
@@ -293,13 +305,15 @@ declare const BkInput: {
|
|
|
293
305
|
} & {
|
|
294
306
|
default: boolean;
|
|
295
307
|
};
|
|
308
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
309
|
+
default: boolean;
|
|
310
|
+
} & {
|
|
311
|
+
default: boolean;
|
|
312
|
+
};
|
|
296
313
|
}>> & Readonly<{
|
|
297
314
|
onBlur?: (evt: FocusEvent) => any;
|
|
298
315
|
onChange?: (_value: any, _evt: KeyboardEvent) => any;
|
|
299
316
|
onClear?: () => any;
|
|
300
|
-
onCompositionend?: (evt: CompositionEvent) => any;
|
|
301
|
-
onCompositionstart?: (evt: CompositionEvent) => any;
|
|
302
|
-
onCompositionupdate?: (evt: CompositionEvent) => any;
|
|
303
317
|
onEnter?: (_value: any, _evt: KeyboardEvent) => any;
|
|
304
318
|
onFocus?: (evt: FocusEvent) => any;
|
|
305
319
|
onInput?: (_value: any, _evt: KeyboardEvent) => any;
|
|
@@ -338,6 +352,7 @@ declare const BkInput: {
|
|
|
338
352
|
showOverflowTooltips: boolean;
|
|
339
353
|
tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
|
|
340
354
|
autosize: boolean | import("./input").InputAutoSize;
|
|
355
|
+
allowEmptyValue: boolean;
|
|
341
356
|
}>;
|
|
342
357
|
__isFragment?: never;
|
|
343
358
|
__isTeleport?: never;
|
|
@@ -376,12 +391,18 @@ declare const BkInput: {
|
|
|
376
391
|
};
|
|
377
392
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
378
393
|
default: number;
|
|
394
|
+
} & {
|
|
395
|
+
default: number;
|
|
379
396
|
};
|
|
380
397
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
381
398
|
default: number;
|
|
399
|
+
} & {
|
|
400
|
+
default: number;
|
|
382
401
|
};
|
|
383
402
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
384
403
|
default: number;
|
|
404
|
+
} & {
|
|
405
|
+
default: number;
|
|
385
406
|
};
|
|
386
407
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
387
408
|
default: number;
|
|
@@ -454,13 +475,15 @@ declare const BkInput: {
|
|
|
454
475
|
} & {
|
|
455
476
|
default: boolean;
|
|
456
477
|
};
|
|
478
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
479
|
+
default: boolean;
|
|
480
|
+
} & {
|
|
481
|
+
default: boolean;
|
|
482
|
+
};
|
|
457
483
|
}>> & Readonly<{
|
|
458
484
|
onBlur?: (evt: FocusEvent) => any;
|
|
459
485
|
onChange?: (_value: any, _evt: KeyboardEvent) => any;
|
|
460
486
|
onClear?: () => any;
|
|
461
|
-
onCompositionend?: (evt: CompositionEvent) => any;
|
|
462
|
-
onCompositionstart?: (evt: CompositionEvent) => any;
|
|
463
|
-
onCompositionupdate?: (evt: CompositionEvent) => any;
|
|
464
487
|
onEnter?: (_value: any, _evt: KeyboardEvent) => any;
|
|
465
488
|
onFocus?: (evt: FocusEvent) => any;
|
|
466
489
|
onInput?: (_value: any, _evt: KeyboardEvent) => any;
|
|
@@ -482,9 +505,6 @@ declare const BkInput: {
|
|
|
482
505
|
keyup: (_value: any, _evt: KeyboardEvent) => any;
|
|
483
506
|
enter: (_value: any, _evt: KeyboardEvent) => any;
|
|
484
507
|
paste: (_value: any, _e: ClipboardEvent) => boolean;
|
|
485
|
-
compositionstart: (evt: CompositionEvent) => CompositionEvent;
|
|
486
|
-
compositionupdate: (evt: CompositionEvent) => CompositionEvent;
|
|
487
|
-
compositionend: (evt: CompositionEvent) => CompositionEvent;
|
|
488
508
|
search: (evt: Event) => Event;
|
|
489
509
|
}, string, {
|
|
490
510
|
type: string;
|
|
@@ -515,6 +535,7 @@ declare const BkInput: {
|
|
|
515
535
|
showOverflowTooltips: boolean;
|
|
516
536
|
tooltipsOptions: Partial<import("../../bkui-vue").IOptions>;
|
|
517
537
|
autosize: boolean | import("./input").InputAutoSize;
|
|
538
|
+
allowEmptyValue: boolean;
|
|
518
539
|
}, {}, string, {}, import("vue").GlobalComponents, {
|
|
519
540
|
bkTooltips: import("vue").ObjectDirective<any, any, string, any>;
|
|
520
541
|
} & import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin<any[], any[]>;
|
package/lib/input/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__popperjs_core_a5c7319c__ from "@popperjs/
|
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__loading_4d683b23__ from "../loading";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__overflow_title_f9bafa47__ from "../overflow-title";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__ from "../icon";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash_trim_5cdad98c__ from "lodash/trim";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash_isNumber_64d4ca37__ from "lodash/isNumber";
|
|
11
13
|
/******/ var __webpack_modules__ = ({
|
|
12
14
|
|
|
13
15
|
/***/ 2439:
|
|
@@ -1564,6 +1566,14 @@ function calcTextareaHeight(targetElement) {
|
|
|
1564
1566
|
hiddenTextarea = undefined;
|
|
1565
1567
|
return result;
|
|
1566
1568
|
}
|
|
1569
|
+
;// CONCATENATED MODULE: external "lodash/trim"
|
|
1570
|
+
var trim_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
1571
|
+
var trim_y = x => () => x
|
|
1572
|
+
const trim_namespaceObject = trim_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_trim_5cdad98c__["default"] });
|
|
1573
|
+
;// CONCATENATED MODULE: external "lodash/isNumber"
|
|
1574
|
+
var isNumber_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
1575
|
+
var isNumber_y = x => () => x
|
|
1576
|
+
const isNumber_namespaceObject = isNumber_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isNumber_64d4ca37__["default"] });
|
|
1567
1577
|
;// CONCATENATED MODULE: ../../packages/input/src/input.tsx
|
|
1568
1578
|
|
|
1569
1579
|
|
|
@@ -1605,6 +1615,8 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
|
|
|
1605
1615
|
|
|
1606
1616
|
|
|
1607
1617
|
|
|
1618
|
+
|
|
1619
|
+
|
|
1608
1620
|
var inputType = {
|
|
1609
1621
|
type: shared_namespaceObject.PropTypes.string.def('text'),
|
|
1610
1622
|
clearable: shared_namespaceObject.PropTypes.bool,
|
|
@@ -1615,9 +1627,9 @@ var inputType = {
|
|
|
1615
1627
|
suffixIcon: shared_namespaceObject.PropTypes.string,
|
|
1616
1628
|
suffix: shared_namespaceObject.PropTypes.string,
|
|
1617
1629
|
prefix: shared_namespaceObject.PropTypes.string,
|
|
1618
|
-
step: shared_namespaceObject.PropTypes.number,
|
|
1619
|
-
max: shared_namespaceObject.PropTypes.number,
|
|
1620
|
-
min: shared_namespaceObject.PropTypes.number,
|
|
1630
|
+
step: shared_namespaceObject.PropTypes.number.def(1),
|
|
1631
|
+
max: shared_namespaceObject.PropTypes.number.def(Infinity),
|
|
1632
|
+
min: shared_namespaceObject.PropTypes.number.def(-Infinity),
|
|
1621
1633
|
maxlength: shared_namespaceObject.PropTypes.number,
|
|
1622
1634
|
maxcharacter: shared_namespaceObject.PropTypes.number,
|
|
1623
1635
|
behavior: (0,shared_namespaceObject.InputBehaviorType)(),
|
|
@@ -1642,7 +1654,8 @@ var inputType = {
|
|
|
1642
1654
|
},
|
|
1643
1655
|
resize: shared_namespaceObject.PropTypes.bool.def(true),
|
|
1644
1656
|
autosize: shared_namespaceObject.PropTypes.oneOfType([Boolean, Object]).def(false),
|
|
1645
|
-
stopPropagation: shared_namespaceObject.PropTypes.bool.def(true)
|
|
1657
|
+
stopPropagation: shared_namespaceObject.PropTypes.bool.def(true),
|
|
1658
|
+
allowEmptyValue: shared_namespaceObject.PropTypes.bool.def(false)
|
|
1646
1659
|
};
|
|
1647
1660
|
var EVENTS;
|
|
1648
1661
|
(function (EVENTS) {
|
|
@@ -1670,16 +1683,13 @@ function EventFunction(_value, _evt) {
|
|
|
1670
1683
|
function PastEventFunction(_value, _e) {
|
|
1671
1684
|
return true;
|
|
1672
1685
|
}
|
|
1673
|
-
function CompositionEventFunction(evt) {
|
|
1674
|
-
return evt;
|
|
1675
|
-
}
|
|
1676
1686
|
var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_inputEmitEventsType, EVENTS.UPDATE, EventFunction), EVENTS.FOCUS, function (evt) {
|
|
1677
1687
|
return evt;
|
|
1678
1688
|
}), EVENTS.BLUR, function (evt) {
|
|
1679
1689
|
return evt;
|
|
1680
1690
|
}), EVENTS.CHANGE, EventFunction), EVENTS.CLEAR, function () {
|
|
1681
1691
|
return true;
|
|
1682
|
-
}), EVENTS.INPUT, EventFunction), EVENTS.KEYPRESS, EventFunction), EVENTS.KEYDOWN, EventFunction), EVENTS.KEYUP, EventFunction), EVENTS.ENTER, EventFunction), _defineProperty(_defineProperty(
|
|
1692
|
+
}), EVENTS.INPUT, EventFunction), EVENTS.KEYPRESS, EventFunction), EVENTS.KEYDOWN, EventFunction), EVENTS.KEYUP, EventFunction), EVENTS.ENTER, EventFunction), _defineProperty(_defineProperty(_inputEmitEventsType, EVENTS.PASTE, PastEventFunction), EVENTS.SEARCH, function (evt) {
|
|
1683
1693
|
return evt;
|
|
1684
1694
|
}));
|
|
1685
1695
|
/* harmony default export */ const input = ((0,external_vue_namespaceObject.defineComponent)({
|
|
@@ -1696,7 +1706,6 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1696
1706
|
var formItem = (0,shared_namespaceObject.useFormItem)();
|
|
1697
1707
|
var t = (0,config_provider_namespaceObject.useLocale)('input');
|
|
1698
1708
|
var isFocused = (0,external_vue_namespaceObject.ref)(false);
|
|
1699
|
-
var isCNInput = (0,external_vue_namespaceObject.ref)(false);
|
|
1700
1709
|
var isTextArea = (0,external_vue_namespaceObject.computed)(function () {
|
|
1701
1710
|
return props.type === 'textarea';
|
|
1702
1711
|
});
|
|
@@ -1783,12 +1792,12 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1783
1792
|
});
|
|
1784
1793
|
var incControlCls = (0,external_vue_namespaceObject.computed)(function () {
|
|
1785
1794
|
return (0,shared_namespaceObject.classes)({
|
|
1786
|
-
'is-disabled': props.disabled || props.modelValue >= props.max
|
|
1795
|
+
'is-disabled': props.disabled || Number(props.modelValue) >= props.max
|
|
1787
1796
|
});
|
|
1788
1797
|
});
|
|
1789
1798
|
var decControlCls = (0,external_vue_namespaceObject.computed)(function () {
|
|
1790
1799
|
return (0,shared_namespaceObject.classes)({
|
|
1791
|
-
'is-disabled': props.disabled || props.modelValue <= props.min
|
|
1800
|
+
'is-disabled': props.disabled || Number(props.modelValue) <= props.min
|
|
1792
1801
|
});
|
|
1793
1802
|
});
|
|
1794
1803
|
var tooltips = (0,external_vue_namespaceObject.computed)(function () {
|
|
@@ -1878,10 +1887,15 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1878
1887
|
});
|
|
1879
1888
|
}
|
|
1880
1889
|
function clear() {
|
|
1881
|
-
if (props.disabled)
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1890
|
+
if (props.disabled) {
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
var value = '';
|
|
1894
|
+
if (props.type === 'number' && !props.allowEmptyValue) {
|
|
1895
|
+
value = props.min !== -Infinity ? props.min : 0;
|
|
1896
|
+
}
|
|
1897
|
+
ctx.emit(EVENTS.UPDATE, value, null);
|
|
1898
|
+
ctx.emit(EVENTS.CHANGE, value, null);
|
|
1885
1899
|
ctx.emit(EVENTS.CLEAR);
|
|
1886
1900
|
}
|
|
1887
1901
|
function handleFocus(e) {
|
|
@@ -1904,10 +1918,16 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1904
1918
|
function eventHandler(eventName) {
|
|
1905
1919
|
return function (e) {
|
|
1906
1920
|
props.stopPropagation && e.stopPropagation();
|
|
1921
|
+
if (e.isComposing) {
|
|
1922
|
+
// 跳过输入法复合事件
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
var inputValue = (0,trim_namespaceObject["default"])(e.target.value) || '';
|
|
1926
|
+
// 字符类型输入框才会有这种场景
|
|
1907
1927
|
if (showMaxLimit.value && !props.overMaxLengthLimit) {
|
|
1908
|
-
var limit = getValueLimits(
|
|
1909
|
-
if (limit.len >= ceilMaxLength.value && (eventName === EVENTS.KEYDOWN || eventName === EVENTS.INPUT)
|
|
1910
|
-
var val = limit.pos > 0 ?
|
|
1928
|
+
var limit = getValueLimits(inputValue);
|
|
1929
|
+
if (limit.len >= ceilMaxLength.value && (eventName === EVENTS.KEYDOWN || eventName === EVENTS.INPUT)) {
|
|
1930
|
+
var val = limit.pos > 0 ? "".concat(inputValue).slice(0, limit.pos) : inputValue;
|
|
1911
1931
|
innerInputValue.value = {
|
|
1912
1932
|
value: val
|
|
1913
1933
|
};
|
|
@@ -1916,44 +1936,37 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1916
1936
|
return;
|
|
1917
1937
|
}
|
|
1918
1938
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
if (eventName === EVENTS.INPUT) {
|
|
1926
|
-
// ctx.emit(EVENTS.UPDATE, isNumberInput.value ? handleNumber(e.target.value, 0) : e.target.value, e);
|
|
1927
|
-
ctx.emit(EVENTS.UPDATE, isNumberInput.value ?
|
|
1928
|
-
// 这里不直接使用 handleNumber,是因为 handleNumber 里有 min 和 max 的判断
|
|
1929
|
-
// https://github.com/TencentBlueKing/bkui-vue3/issues/2426
|
|
1930
|
-
function () {
|
|
1931
|
-
var precision = Number.isInteger(props.precision) ? props.precision : 0;
|
|
1932
|
-
var val = e.target.value;
|
|
1933
|
-
if (Number.isNaN(val)) {
|
|
1934
|
-
return isNum(props.min) ? props.min : 0;
|
|
1935
|
-
}
|
|
1936
|
-
if (val === '' || val === null || val === undefined) {
|
|
1937
|
-
return '';
|
|
1939
|
+
// 数字输入框需要处理空值和类型转换
|
|
1940
|
+
if (props.type === 'number') {
|
|
1941
|
+
if (inputValue === '') {
|
|
1942
|
+
// 处理空值(默认为0,可通过allowEmptyValue控制)
|
|
1943
|
+
if (!props.allowEmptyValue) {
|
|
1944
|
+
inputValue = props.min !== -Infinity ? props.min : 0;
|
|
1938
1945
|
}
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
} else if (eventName === EVENTS.
|
|
1951
|
-
|
|
1952
|
-
ctx.emit(EVENTS.UPDATE,
|
|
1953
|
-
|
|
1954
|
-
|
|
1946
|
+
} else {
|
|
1947
|
+
inputValue = Number(Number(inputValue).toFixed(props.precision));
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
if (eventName === EVENTS.KEYDOWN && e.code === 'Enter') {
|
|
1951
|
+
// 输入框值改变时,数字输入框需要限制最大最小值
|
|
1952
|
+
if ((0,isNumber_namespaceObject["default"])(inputValue)) {
|
|
1953
|
+
inputValue = Math.min(Math.max(Number(inputValue), props.min), props.max);
|
|
1954
|
+
}
|
|
1955
|
+
ctx.emit(EVENTS.ENTER, inputValue, e);
|
|
1956
|
+
ctx.emit(EVENTS.UPDATE, inputValue, e);
|
|
1957
|
+
} else if (eventName === EVENTS.INPUT) {
|
|
1958
|
+
ctx.emit(EVENTS.INPUT, inputValue, e);
|
|
1959
|
+
ctx.emit(EVENTS.UPDATE, inputValue, e);
|
|
1960
|
+
} else if (eventName === EVENTS.CHANGE) {
|
|
1961
|
+
// 输入框值改变时,数字输入框需要限制最大最小值
|
|
1962
|
+
if ((0,isNumber_namespaceObject["default"])(inputValue)) {
|
|
1963
|
+
inputValue = Math.min(Math.max(Number(inputValue), props.min), props.max);
|
|
1964
|
+
}
|
|
1965
|
+
ctx.emit(EVENTS.CHANGE, inputValue, e);
|
|
1966
|
+
ctx.emit(EVENTS.UPDATE, inputValue, e);
|
|
1967
|
+
} else {
|
|
1968
|
+
ctx.emit(eventName, inputValue, e);
|
|
1955
1969
|
}
|
|
1956
|
-
ctx.emit(eventName, isNumberInput.value ? handleNumber(e.target.value, 0) : e.target.value, e);
|
|
1957
1970
|
};
|
|
1958
1971
|
}
|
|
1959
1972
|
var _map = [EVENTS.KEYUP, EVENTS.KEYDOWN, EVENTS.KEYPRESS, EVENTS.PASTE, EVENTS.CHANGE, EVENTS.INPUT].map(eventHandler),
|
|
@@ -1964,47 +1977,21 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
1964
1977
|
handlePaste = _map2[3],
|
|
1965
1978
|
handleChange = _map2[4],
|
|
1966
1979
|
handleInput = _map2[5];
|
|
1967
|
-
// 输入法启用时
|
|
1968
|
-
function handleCompositionStart() {
|
|
1969
|
-
isCNInput.value = true;
|
|
1970
|
-
}
|
|
1971
|
-
// 输入法输入结束时
|
|
1972
|
-
function handleCompositionEnd(e) {
|
|
1973
|
-
isCNInput.value = false;
|
|
1974
|
-
handleInput(e);
|
|
1975
|
-
}
|
|
1976
|
-
function isNum(num) {
|
|
1977
|
-
return typeof num === 'number' && !Number.isNaN(num);
|
|
1978
|
-
}
|
|
1979
|
-
function handleNumber(modelValue, step) {
|
|
1980
|
-
var INC = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1981
|
-
var numStep = Number(step);
|
|
1982
|
-
var factor = isNum(numStep) ? numStep : 1;
|
|
1983
|
-
var precision = Number.isInteger(props.precision) ? props.precision : 0;
|
|
1984
|
-
var val = Number(modelValue);
|
|
1985
|
-
if (Number.isNaN(val)) {
|
|
1986
|
-
return isNum(props.min) ? props.min : 0;
|
|
1987
|
-
}
|
|
1988
|
-
var newVal = val + (INC ? factor : -1 * factor);
|
|
1989
|
-
if (isNum(props.max)) {
|
|
1990
|
-
newVal = Math.min(newVal, props.max);
|
|
1991
|
-
}
|
|
1992
|
-
if (isNum(props.min)) {
|
|
1993
|
-
newVal = Math.max(newVal, props.min);
|
|
1994
|
-
}
|
|
1995
|
-
return +newVal.toFixed(precision);
|
|
1996
|
-
}
|
|
1997
1980
|
function handleInc(e) {
|
|
1998
|
-
if (props.disabled)
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1981
|
+
if (props.disabled) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
var newValue = Number(Math.min(Number(props.modelValue) + props.step, props.max).toFixed(props.precision));
|
|
1985
|
+
ctx.emit(EVENTS.UPDATE, newValue, e);
|
|
1986
|
+
ctx.emit(EVENTS.CHANGE, newValue, e);
|
|
2002
1987
|
}
|
|
2003
1988
|
function handleDec(e) {
|
|
2004
|
-
if (props.disabled)
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
1989
|
+
if (props.disabled) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
var newValue = Number(Math.max(Number(props.modelValue) - props.step, props.min).toFixed(props.precision));
|
|
1993
|
+
ctx.emit(EVENTS.UPDATE, newValue, e);
|
|
1994
|
+
ctx.emit(EVENTS.CHANGE, newValue, e);
|
|
2008
1995
|
}
|
|
2009
1996
|
function getCls(name) {
|
|
2010
1997
|
return "".concat(inputClsPrefix.value, "--").concat(name);
|
|
@@ -2028,9 +2015,7 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
|
|
|
2028
2015
|
onChange: handleChange,
|
|
2029
2016
|
onKeypress: handleKeyPress,
|
|
2030
2017
|
onKeydown: handleKeydown,
|
|
2031
|
-
onKeyup: handleKeyup
|
|
2032
|
-
onCompositionstart: handleCompositionStart,
|
|
2033
|
-
onCompositionend: handleCompositionEnd
|
|
2018
|
+
onKeyup: handleKeyup
|
|
2034
2019
|
};
|
|
2035
2020
|
return function () {
|
|
2036
2021
|
var _ctx$slots$prefix, _ctx$slots, _ctx$slots$prefix2, _ctx$slots$suffix, _ctx$slots2, _ctx$slots2$suffix;
|
package/lib/input/input.d.ts
CHANGED
|
@@ -38,12 +38,18 @@ export declare const inputType: {
|
|
|
38
38
|
};
|
|
39
39
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
40
40
|
default: number;
|
|
41
|
+
} & {
|
|
42
|
+
default: number;
|
|
41
43
|
};
|
|
42
44
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
43
45
|
default: number;
|
|
46
|
+
} & {
|
|
47
|
+
default: number;
|
|
44
48
|
};
|
|
45
49
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
46
50
|
default: number;
|
|
51
|
+
} & {
|
|
52
|
+
default: number;
|
|
47
53
|
};
|
|
48
54
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
49
55
|
default: number;
|
|
@@ -116,6 +122,11 @@ export declare const inputType: {
|
|
|
116
122
|
} & {
|
|
117
123
|
default: boolean;
|
|
118
124
|
};
|
|
125
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
126
|
+
default: boolean;
|
|
127
|
+
} & {
|
|
128
|
+
default: boolean;
|
|
129
|
+
};
|
|
119
130
|
};
|
|
120
131
|
export declare const enum EVENTS {
|
|
121
132
|
BLUR = "blur",
|
|
@@ -136,7 +147,6 @@ export declare const enum EVENTS {
|
|
|
136
147
|
}
|
|
137
148
|
declare function EventFunction(_value: any, _evt: KeyboardEvent): any;
|
|
138
149
|
declare function PastEventFunction(_value: any, _e: ClipboardEvent): boolean;
|
|
139
|
-
declare function CompositionEventFunction(evt: CompositionEvent): CompositionEvent;
|
|
140
150
|
export declare const inputEmitEventsType: {
|
|
141
151
|
"update:modelValue": typeof EventFunction;
|
|
142
152
|
focus: (evt: FocusEvent) => FocusEvent;
|
|
@@ -149,9 +159,6 @@ export declare const inputEmitEventsType: {
|
|
|
149
159
|
keyup: typeof EventFunction;
|
|
150
160
|
enter: typeof EventFunction;
|
|
151
161
|
paste: typeof PastEventFunction;
|
|
152
|
-
compositionstart: typeof CompositionEventFunction;
|
|
153
|
-
compositionupdate: typeof CompositionEventFunction;
|
|
154
|
-
compositionend: typeof CompositionEventFunction;
|
|
155
162
|
search: (evt: Event) => Event;
|
|
156
163
|
};
|
|
157
164
|
export type InputType = ExtractPropTypes<typeof inputType>;
|
|
@@ -189,12 +196,18 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
189
196
|
};
|
|
190
197
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
191
198
|
default: number;
|
|
199
|
+
} & {
|
|
200
|
+
default: number;
|
|
192
201
|
};
|
|
193
202
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
194
203
|
default: number;
|
|
204
|
+
} & {
|
|
205
|
+
default: number;
|
|
195
206
|
};
|
|
196
207
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
197
208
|
default: number;
|
|
209
|
+
} & {
|
|
210
|
+
default: number;
|
|
198
211
|
};
|
|
199
212
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
200
213
|
default: number;
|
|
@@ -267,6 +280,11 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
267
280
|
} & {
|
|
268
281
|
default: boolean;
|
|
269
282
|
};
|
|
283
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
284
|
+
default: boolean;
|
|
285
|
+
} & {
|
|
286
|
+
default: boolean;
|
|
287
|
+
};
|
|
270
288
|
}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
271
289
|
"update:modelValue": typeof EventFunction;
|
|
272
290
|
focus: (evt: FocusEvent) => FocusEvent;
|
|
@@ -279,9 +297,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
279
297
|
keyup: typeof EventFunction;
|
|
280
298
|
enter: typeof EventFunction;
|
|
281
299
|
paste: typeof PastEventFunction;
|
|
282
|
-
compositionstart: typeof CompositionEventFunction;
|
|
283
|
-
compositionupdate: typeof CompositionEventFunction;
|
|
284
|
-
compositionend: typeof CompositionEventFunction;
|
|
285
300
|
search: (evt: Event) => Event;
|
|
286
301
|
}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
287
302
|
type: import("vue-types").VueTypeValidableDef<string> & {
|
|
@@ -317,12 +332,18 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
317
332
|
};
|
|
318
333
|
step: import("vue-types").VueTypeValidableDef<number> & {
|
|
319
334
|
default: number;
|
|
335
|
+
} & {
|
|
336
|
+
default: number;
|
|
320
337
|
};
|
|
321
338
|
max: import("vue-types").VueTypeValidableDef<number> & {
|
|
322
339
|
default: number;
|
|
340
|
+
} & {
|
|
341
|
+
default: number;
|
|
323
342
|
};
|
|
324
343
|
min: import("vue-types").VueTypeValidableDef<number> & {
|
|
325
344
|
default: number;
|
|
345
|
+
} & {
|
|
346
|
+
default: number;
|
|
326
347
|
};
|
|
327
348
|
maxlength: import("vue-types").VueTypeValidableDef<number> & {
|
|
328
349
|
default: number;
|
|
@@ -395,13 +416,15 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
395
416
|
} & {
|
|
396
417
|
default: boolean;
|
|
397
418
|
};
|
|
419
|
+
allowEmptyValue: import("vue-types").VueTypeValidableDef<boolean> & {
|
|
420
|
+
default: boolean;
|
|
421
|
+
} & {
|
|
422
|
+
default: boolean;
|
|
423
|
+
};
|
|
398
424
|
}>> & Readonly<{
|
|
399
425
|
onBlur?: (evt: FocusEvent) => any;
|
|
400
426
|
onChange?: (_value: any, _evt: KeyboardEvent) => any;
|
|
401
427
|
onClear?: () => any;
|
|
402
|
-
onCompositionend?: (evt: CompositionEvent) => any;
|
|
403
|
-
onCompositionstart?: (evt: CompositionEvent) => any;
|
|
404
|
-
onCompositionupdate?: (evt: CompositionEvent) => any;
|
|
405
428
|
onEnter?: (_value: any, _evt: KeyboardEvent) => any;
|
|
406
429
|
onFocus?: (evt: FocusEvent) => any;
|
|
407
430
|
onInput?: (_value: any, _evt: KeyboardEvent) => any;
|
|
@@ -440,6 +463,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
440
463
|
showOverflowTooltips: boolean;
|
|
441
464
|
tooltipsOptions: Partial<IOptions>;
|
|
442
465
|
autosize: boolean | InputAutoSize;
|
|
466
|
+
allowEmptyValue: boolean;
|
|
443
467
|
}, {}, {}, {
|
|
444
468
|
bkTooltips: import("vue").ObjectDirective<any, any, string, any>;
|
|
445
469
|
}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/lib/tree/constant.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export declare enum EVENTS {
|
|
2
|
+
NODE_ASYNC_LOAD = "nodeAsyncLoad",
|
|
3
|
+
NODE_ASYNC_LOAD_ERROR = "nodeAsyncLoadError",
|
|
2
4
|
NODE_CHECKED = "nodeChecked",
|
|
3
5
|
NODE_CLICK = "nodeClick",
|
|
4
6
|
NODE_COLLAPSE = "nodeCollapse",
|
|
7
|
+
NODE_DATA_CHANGE = "nodeDataChange",
|
|
5
8
|
NODE_DRAG_LEAVE = "nodeDragLeave",
|
|
6
9
|
NODE_DRAG_OVER = "nodeDragOver",
|
|
7
10
|
NODE_DRAG_SORT = "nodeDragSort",
|
|
@@ -12,10 +15,13 @@ export declare enum EVENTS {
|
|
|
12
15
|
NODE_SELECTED = "nodeSelected"
|
|
13
16
|
}
|
|
14
17
|
export declare const TreeEmitEventsType: {
|
|
18
|
+
nodeAsyncLoad: (..._args: any[]) => boolean;
|
|
19
|
+
nodeAsyncLoadError: (..._args: any[]) => boolean;
|
|
15
20
|
nodeClick: (..._args: any[]) => boolean;
|
|
16
21
|
nodeCollapse: (..._args: any[]) => boolean;
|
|
17
22
|
nodeExpand: (..._args: any[]) => boolean;
|
|
18
23
|
nodeChecked: (..._args: any[]) => boolean;
|
|
24
|
+
nodeDataChange: (..._args: any[]) => boolean;
|
|
19
25
|
nodeDragStart: (..._args: any[]) => boolean;
|
|
20
26
|
nodeDragOver: (..._args: any[]) => boolean;
|
|
21
27
|
nodeDragLeave: (..._args: any[]) => boolean;
|