@king-design/vue 3.4.3-beta.1 → 3.4.3-beta.2
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/menu/styles.js +1 -1
- package/components/select/base.d.ts +4 -0
- package/components/select/base.js +11 -1
- package/components/select/base.vdt.js +2 -1
- package/components/select/useImmutable.d.ts +4 -0
- package/components/select/useImmutable.js +45 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -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-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, ";}}}");
|
|
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-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-vue-next';
|
|
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,45 @@
|
|
|
1
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
2
|
+
import { useInstance } from 'intact-vue-next';
|
|
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
|
+
instance.on('$receive:children', setImmutableValues);
|
|
41
|
+
return {
|
|
42
|
+
immutableValues: immutableValues,
|
|
43
|
+
isClosable: isClosable
|
|
44
|
+
};
|
|
45
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.4.3-beta.
|
|
2
|
+
* @king-design v3.4.3-beta.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -64,7 +64,7 @@ export * from './components/treeSelect';
|
|
|
64
64
|
export * from './components/upload';
|
|
65
65
|
export * from './components/view';
|
|
66
66
|
export * from './components/wave';
|
|
67
|
-
export declare const version = "3.4.3-beta.
|
|
67
|
+
export declare const version = "3.4.3-beta.2";
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
export {normalize} from 'intact-vue-next';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.4.3-beta.
|
|
2
|
+
* @king-design v3.4.3-beta.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -65,7 +65,7 @@ export * from './components/treeSelect';
|
|
|
65
65
|
export * from './components/upload';
|
|
66
66
|
export * from './components/view';
|
|
67
67
|
export * from './components/wave';
|
|
68
|
-
export var version = '3.4.3-beta.
|
|
68
|
+
export var version = '3.4.3-beta.2';
|
|
69
69
|
/* generate end */
|
|
70
70
|
|
|
71
71
|
export {normalize} from 'intact-vue-next';
|