@king-design/vue 3.1.6 → 3.2.1

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.
@@ -30,17 +30,6 @@ var defaults = {
30
30
  return menu.light.border;
31
31
  }
32
32
  },
33
- white: {
34
- get color() {
35
- return menu.white.item.color;
36
- },
37
- get bgColor() {
38
- return menu.white.bgColor;
39
- },
40
- get border() {
41
- return menu.white.border;
42
- }
43
- },
44
33
  get collapsedWidth() {
45
34
  return "calc(" + getLeft(menu.item.padding) + " * 2 + " + menu.icon.width + ")";
46
35
  },
@@ -64,16 +53,12 @@ export var makeLayoutStyles = cache(function makeLayoutStyles(k) {
64
53
  return /*#__PURE__*/css("display:flex;flex-direction:column;flex:1;transition:padding-left ", layout.transition, ";&.", k, "-has-aside{flex-direction:row;}.", k, "-layout-footer{padding:", layout.footerPadding, ";}.", k, "-layout-body{flex:1;}");
65
54
  });
66
55
  export var makeHeaderStyles = cache(function makeHeaderStyles(k) {
67
- return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ", layout.transition, ";&.", k, "-fixed{position:fixed;left:0;right:0;top:0;z-index:", theme.midZIndex + 1, ";}>.", k, "-menu{background:transparent!important;}&.", k, "-blur{backdrop-filter:blur(20px);background:", setAlpha(layout.bgColor, 0.1), ";}&.", k, "-box-shadow{border-bottom:none!important;box-shadow:", theme.boxShadow, ";}", _mapInstanceProperty(themes).call(themes, function (theme) {
68
- if (theme === 'dark') return;
69
- var styles = layout[theme];
70
- return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-bottom:", styles.border, ";&.", k, "-blur{background:", setAlpha(styles.bgColor, 0.1), ";}}");
71
- }), ";");
56
+ return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ", layout.transition, ";&.", k, "-fixed{position:fixed;left:0;right:0;top:0;z-index:", theme.midZIndex + 1, ";}>.", k, "-menu{background:transparent!important;}&.", k, "-blur{backdrop-filter:blur(20px);background:", setAlpha(layout.bgColor, 0.1), ";}&.", k, "-box-shadow{border-bottom:none!important;box-shadow:", theme.boxShadow, ";}&.", k, "-light{background:", layout.light.bgColor, ";color:", layout.light.color, ";border-bottom:", layout.light.border, ";&.", k, "-blur{background:", setAlpha(layout.light.bgColor, 0.1), ";}}");
72
57
  });
73
58
  export var makeAsideStyles = cache(function makeAsideStyles(k) {
74
59
  return /*#__PURE__*/css("transition:width ", layout.transition, ";display:flex;flex-direction:column;background:", layout.bgColor, ";color:", layout.color, ";", _mapInstanceProperty(themes).call(themes, function (theme) {
75
60
  if (theme === 'dark') return;
76
- var styles = layout[theme];
61
+ var styles = layout.light;
77
62
  return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-right:", styles.border, ";}");
78
63
  }), " &.", k, "-fixed{position:fixed;overflow:auto;left:0;top:0;bottom:0;z-index:", theme.midZIndex, ";}.", k, "-menu{width:auto!important;}");
79
64
  });
@@ -1,2 +1,3 @@
1
1
  export * from './menu';
2
2
  export * from './item';
3
+ export * from './title';
@@ -1,2 +1,3 @@
1
1
  export * from './menu';
2
- export * from './item';
2
+ export * from './item';
3
+ export * from './title';
@@ -7,6 +7,7 @@ import { Component } from 'intact-vue-next';
7
7
  import BasicDemo from '~/components/menu/demos/basic';
8
8
  import CollapseDemo from '~/components/menu/demos/collapse';
9
9
  import AccordionDemo from '~/components/menu/demos/accordion';
10
+ import CollapseArrowDemo from '~/components/menu/demos/showCollapseArrow';
10
11
  import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
11
12
  import { Menu, MenuItem } from './';
12
13
  describe('Menu', function () {
@@ -23,7 +24,7 @@ describe('Menu', function () {
23
24
  return wait();
24
25
  case 3:
25
26
  // shrink
26
- title = element.querySelector('.k-expanded .k-menu-title');
27
+ title = element.querySelector('.k-expanded .k-menu-item-title');
27
28
  title.click();
28
29
  _context.next = 7;
29
30
  return wait(500);
@@ -53,7 +54,7 @@ describe('Menu', function () {
53
54
  return wait();
54
55
  case 4:
55
56
  expect(element.innerHTML).to.matchSnapshot();
56
- _element$querySelecto = element.querySelectorAll('.k-menu-title'), title = _element$querySelecto[0], disabledTitle = _element$querySelecto[1];
57
+ _element$querySelecto = element.querySelectorAll('.k-menu-body .k-menu-item-title'), title = _element$querySelecto[0], disabledTitle = _element$querySelecto[1];
57
58
  title.click();
58
59
  _context2.next = 9;
59
60
  return wait();
@@ -66,7 +67,7 @@ describe('Menu', function () {
66
67
  case 14:
67
68
  expect(element.outerHTML).to.matchSnapshot();
68
69
  expect(instance.get('selectedKey')).to.eql('1');
69
- subTitle = element.querySelector('.k-expanded .k-menu .k-menu-title');
70
+ subTitle = element.querySelector('.k-expanded .k-menu .k-menu-body .k-menu-item-title');
70
71
  subTitle.click();
71
72
  _context2.next = 20;
72
73
  return wait();
@@ -97,14 +98,14 @@ describe('Menu', function () {
97
98
  case 4:
98
99
  expect(element.outerHTML).to.matchSnapshot();
99
100
  // show sub menu
100
- title = element.querySelector('.k-menu-item:nth-child(3) .k-menu-title');
101
+ title = element.querySelector('.k-menu-body .k-menu-item:nth-child(3) .k-menu-item-title');
101
102
  dispatchEvent(title, 'mouseenter');
102
103
  _context3.next = 9;
103
104
  return wait();
104
105
  case 9:
105
106
  dropdown = getElement('.k-dropdown-menu.k-menu');
106
107
  expect(dropdown.innerHTML).to.matchSnapshot();
107
- dispatchEvent(dropdown.querySelector('.k-menu-item:nth-child(4) .k-menu-title'), 'mouseenter');
108
+ dispatchEvent(dropdown.querySelector('.k-menu-body .k-menu-item:nth-child(4) .k-menu-item-title'), 'mouseenter');
108
109
  _context3.next = 14;
109
110
  return wait();
110
111
  case 14:
@@ -128,19 +129,19 @@ describe('Menu', function () {
128
129
  case 0:
129
130
  _mount4 = mount(CollapseDemo), instance = _mount4[0], element = _mount4[1];
130
131
  instance.set('collapse', true);
131
- title = element.querySelector('.k-menu-title');
132
+ title = element.querySelector('.k-menu-body .k-menu-item-title');
132
133
  title.click();
133
134
  _context4.next = 6;
134
135
  return wait();
135
136
  case 6:
136
137
  expect(element.outerHTML).to.matchSnapshot();
137
- title = element.querySelector('.k-menu-item:nth-child(3) .k-menu-title');
138
+ title = element.querySelector('.k-menu-body .k-menu-item:nth-child(3) .k-menu-item-title');
138
139
  dispatchEvent(title, 'mouseenter');
139
140
  _context4.next = 11;
140
141
  return wait();
141
142
  case 11:
142
143
  dropdown = getElement('.k-dropdown-menu.k-menu');
143
- dropdown.querySelector('.k-menu-title').click();
144
+ dropdown.querySelector('.k-menu-body .k-menu-item-title').click();
144
145
  _context4.next = 15;
145
146
  return wait();
146
147
  case 15:
@@ -157,40 +158,41 @@ describe('Menu', function () {
157
158
  }, _callee4);
158
159
  })));
159
160
  it('accordion', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
160
- var _mount5, instance, element, menu3, subMenu1, subMenu4, menu1;
161
+ var _mount5, instance, element, rootElement, menu3, subMenu1, subMenu4, menu1;
161
162
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
162
163
  while (1) switch (_context5.prev = _context5.next) {
163
164
  case 0:
164
- _mount5 = mount(AccordionDemo), instance = _mount5[0], element = _mount5[1];
165
- menu3 = element.children[2];
166
- subMenu1 = menu3.querySelector('.k-menu').firstElementChild.querySelector('.k-menu-title');
165
+ _mount5 = mount(AccordionDemo), instance = _mount5[0], element = _mount5[1]; // const menu3 = element.children[2] as HTMLElement;
166
+ rootElement = element.firstElementChild;
167
+ menu3 = rootElement.children[2];
168
+ subMenu1 = menu3.querySelector('.k-menu .k-menu-body').firstElementChild.querySelector('.k-menu-item-title');
167
169
  subMenu1.click();
168
- _context5.next = 6;
170
+ _context5.next = 7;
169
171
  return wait();
170
- case 6:
171
- expect(element.innerHTML).to.matchSnapshot();
172
+ case 7:
173
+ expect(rootElement.innerHTML).to.matchSnapshot();
172
174
  expect(instance.get('expandedKeys')).to.eql(['3', '3-1']);
173
- subMenu4 = menu3.querySelector('.k-menu').lastElementChild.querySelector('.k-menu-title');
175
+ subMenu4 = menu3.querySelector('.k-menu .k-menu-body').lastElementChild.querySelector('.k-menu-item-title');
174
176
  subMenu4.click();
175
- _context5.next = 12;
177
+ _context5.next = 13;
176
178
  return wait();
177
- case 12:
178
- expect(element.innerHTML).to.matchSnapshot();
179
+ case 13:
180
+ expect(rootElement.innerHTML).to.matchSnapshot();
179
181
  expect(instance.get('expandedKeys')).to.eql(['3', '3-4']);
180
- menu1 = element.firstElementChild.querySelector('.k-menu-title');
182
+ menu1 = rootElement.firstElementChild.querySelector('.k-menu-item-title');
181
183
  menu1.click();
182
- _context5.next = 18;
184
+ _context5.next = 19;
183
185
  return wait();
184
- case 18:
185
- expect(element.innerHTML).to.matchSnapshot();
186
+ case 19:
187
+ expect(rootElement.innerHTML).to.matchSnapshot();
186
188
  expect(instance.get('expandedKeys')).to.eql(['3-4', '1']);
187
- menu3.querySelector('.k-menu-title').click();
188
- _context5.next = 23;
189
+ menu3.querySelector('.k-menu-item-title').click();
190
+ _context5.next = 24;
189
191
  return wait();
190
- case 23:
191
- expect(element.innerHTML).to.matchSnapshot();
192
+ case 24:
193
+ expect(rootElement.innerHTML).to.matchSnapshot();
192
194
  expect(instance.get('expandedKeys')).to.eql(['3-4', '3']);
193
- case 25:
195
+ case 26:
194
196
  case "end":
195
197
  return _context5.stop();
196
198
  }
@@ -240,4 +242,33 @@ describe('Menu', function () {
240
242
  }
241
243
  }, _callee6);
242
244
  })));
245
+ it('collapsed arrow', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
246
+ var _mount7, instance, element, arrow;
247
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
248
+ while (1) switch (_context8.prev = _context8.next) {
249
+ case 0:
250
+ _mount7 = mount(CollapseArrowDemo), instance = _mount7[0], element = _mount7[1];
251
+ instance.set('showCollapseArrow', true);
252
+ _context8.next = 4;
253
+ return wait();
254
+ case 4:
255
+ expect(element.outerHTML).to.matchSnapshot();
256
+ arrow = element.querySelector('.k-menu .k-menu-arrow-box');
257
+ arrow.click();
258
+ _context8.next = 9;
259
+ return wait(500);
260
+ case 9:
261
+ expect(element.outerHTML).to.matchSnapshot();
262
+ instance.set('showCollapseArrow', false);
263
+ _context8.next = 13;
264
+ return wait();
265
+ case 13:
266
+ expect(element.outerHTML).to.matchSnapshot();
267
+ expect(getElement('.k-menu-arrow-box')).to.be.undefined;
268
+ case 15:
269
+ case "end":
270
+ return _context8.stop();
271
+ }
272
+ }, _callee7);
273
+ })));
243
274
  });
@@ -47,8 +47,8 @@ export default function ($props, $blocks, $__proto__) {
47
47
  return _$ce(2, 'div', [showDot ? _$cc(Icon, {
48
48
  'className': _$cn(k + "-menu-dot ion-record")
49
49
  }) : undefined, _$ce(2, 'div', children, 0, _$cn(k + "-menu-name")), subMenuVNode ? _$cc(Icon, {
50
- 'className': _$cn(k + "-menu-arrow " + k + "-icon-down")
51
- }) : undefined], 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-title"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2)), {
50
+ 'className': _$cn(k + "-menu-item-arrow ion-arrow-down-b")
51
+ }) : undefined], 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-item-title"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2)), {
52
52
  'ev-click': _this.onClick.bind(_this, subMenuVNode)
53
53
  });
54
54
  };
@@ -65,7 +65,7 @@ export default function ($props, $blocks, $__proto__) {
65
65
  var _makeNestedMenuStyles = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft),
66
66
  _classname = _makeNestedMenuStyles[0],
67
67
  _paddingLeft = _makeNestedMenuStyles[1];
68
- var _className = _$cn((_$cn3 = {}, _$cn3[_classname] = true, _$cn3[subMenuVNode.className] = subMenuVNode.className, _$cn3));
68
+ var _className = _$cn((_$cn3 = {}, _$cn3[_classname] = true, _$cn3[subMenuVNode.className] = subMenuVNode.className, _$cn3[k + "-sub-menu"] = true, _$cn3));
69
69
  var clonedVNode = directClone(subMenuVNode);
70
70
  clonedVNode.props = _extends({}, clonedVNode.props, {
71
71
  className: _className,
@@ -5,6 +5,7 @@ export interface MenuProps<K extends Key = Key> {
5
5
  selectedKey?: K;
6
6
  theme?: 'light' | 'dark' | 'white';
7
7
  collapse?: boolean;
8
+ showCollapseArrow?: boolean;
8
9
  type?: 'vertical' | 'horizontal';
9
10
  size?: 'large' | 'default' | 'small';
10
11
  accordion?: boolean;
@@ -28,4 +29,5 @@ export declare class Menu<K extends Key = Key> extends Component<MenuProps<K>, M
28
29
  highlight?: ReturnType<typeof useHighlight>;
29
30
  private config;
30
31
  init(): void;
32
+ onClick(e: MouseEvent): void;
31
33
  }
@@ -1,14 +1,17 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
+ import { __decorate } from "tslib";
3
4
  import { Component, provide, inject } from 'intact-vue-next';
4
5
  import template from './menu.vdt';
5
6
  import { useHighlight } from './useHighlight';
6
7
  import { useConfigContext } from '../config';
8
+ import { bind } from '../utils';
7
9
  var typeDefs = {
8
10
  expandedKeys: Array,
9
11
  selectedKey: [String, Number],
10
12
  theme: ['light', 'dark', 'white'],
11
13
  collapse: Boolean,
14
+ showCollapseArrow: Boolean,
12
15
  type: ['vertical', 'horizontal'],
13
16
  size: ['large', 'default', 'small'],
14
17
  accordion: Boolean,
@@ -50,8 +53,16 @@ export var Menu = /*#__PURE__*/function (_Component) {
50
53
  this.highlight = useHighlight();
51
54
  }
52
55
  };
56
+ _proto.onClick = function onClick(e) {
57
+ var _this$get = this.get(),
58
+ collapse = _this$get.collapse;
59
+ this.set({
60
+ collapse: !collapse
61
+ });
62
+ };
53
63
  return Menu;
54
64
  }(Component);
55
65
  Menu.template = template;
56
66
  Menu.typeDefs = typeDefs;
57
- Menu.defaults = defaults;
67
+ Menu.defaults = defaults;
68
+ __decorate([bind], Menu.prototype, "onClick", null);
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
- import { noop as _$no, createElementVNode as _$ce, className as _$cn, createVNode as _$cv, createUnknownComponentVNode as _$cc } from 'intact-vue-next';
2
+ import { noop as _$no, createElementVNode as _$ce, className as _$cn, createUnknownComponentVNode as _$cc, createVNode as _$cv } from 'intact-vue-next';
3
3
  import { DropdownMenu } from '../dropdown';
4
4
  import { getRestProps, findChildren, isComponentVNode } from '../utils';
5
5
  import { isDropdown } from './useDropdown';
@@ -19,11 +19,12 @@ export default function ($props, $blocks, $__proto__) {
19
19
  collapse = _get.collapse,
20
20
  theme = _get.theme,
21
21
  type = _get.type,
22
- size = _get.size;
22
+ size = _get.size,
23
+ showCollapseArrow = _get.showCollapseArrow;
23
24
  var isRootMenu = !this.rootMenu;
24
25
  var isDropdownMenu = !isRootMenu && isDropdown(this.rootMenu);
25
26
  var k = this.config.k;
26
- var classNameObj = (_classNameObj = {}, _classNameObj[k + "-menu"] = true, _classNameObj[className] = className, _classNameObj[k + "-" + theme] = (isRootMenu || isDropdownMenu) && theme, _classNameObj[k + "-" + size] = isRootMenu && size !== 'default', _classNameObj[k + "-collapsed"] = isRootMenu && collapse, _classNameObj[k + "-" + type] = isRootMenu && type, _classNameObj[makeMenuStyles(k)] = true, _classNameObj);
27
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-menu"] = true, _classNameObj[className] = className, _classNameObj[k + "-" + (theme === 'dark' ? 'dark' : 'light')] = (isRootMenu || isDropdownMenu) && theme, _classNameObj[k + "-" + size] = isRootMenu && size !== 'default', _classNameObj[k + "-collapsed"] = isRootMenu && collapse, _classNameObj[k + "-collapsed-arrow"] = isRootMenu && showCollapseArrow && collapse, _classNameObj[k + "-" + type] = isRootMenu && type, _classNameObj[makeMenuStyles(k)] = true, _classNameObj);
27
28
  var header = (_$blocks['header'] = function ($super) {
28
29
  return null;
29
30
  }, __$blocks['header'] = function ($super, data) {
@@ -35,7 +36,11 @@ export default function ($props, $blocks, $__proto__) {
35
36
  }, __$blocks['header'](_$no));
36
37
  var content = [$blocks.header ? _$ce(2, 'div', !collapse ? header : findChildren(header, function (vNode) {
37
38
  return isComponentVNode(vNode, Icon);
38
- }), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-header"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))) : undefined, children];
39
+ }), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-header"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))) : undefined, isRootMenu && showCollapseArrow && type !== 'horizontal' ? _$ce(2, 'div', _$cc(Icon, {
40
+ 'className': _$cn(k + "-menu-arrow ion-arrow-left-b")
41
+ }), 2, _$cn(k + "-menu-arrow-box"), {
42
+ 'ev-click': this.onClick.bind(this)
43
+ }) : undefined, _$ce(2, 'div', children, 0, _$cn(k + "-menu-body"))];
39
44
  return !isDropdownMenu ? _$cv('div', _extends({}, getRestProps(this), {
40
45
  'className': _$cn(classNameObj)
41
46
  }), content) : _$cc(DropdownMenu, _extends({}, getRestProps(this), {
@@ -5,14 +5,23 @@ declare const defaults: {
5
5
  bgColor: string;
6
6
  fontSize: string;
7
7
  readonly borderRadius: string;
8
+ readonly border: string;
8
9
  item: {
9
10
  height: string;
10
11
  padding: string;
12
+ bodyPadding: string;
11
13
  color: string;
12
14
  hoverColor: string;
13
- readonly disabledColor: string;
15
+ disabledColor: string;
14
16
  readonly activeBgColor: string;
17
+ readonly hoverBgColor: string;
15
18
  dotFontSize: string;
19
+ subTitleColor: string;
20
+ };
21
+ title: {
22
+ height: string;
23
+ padding: string;
24
+ color: string;
16
25
  };
17
26
  icon: {
18
27
  width: string;
@@ -21,27 +30,21 @@ declare const defaults: {
21
30
  header: {
22
31
  height: string;
23
32
  fontSize: string;
33
+ color: string;
24
34
  borderBottom: string;
25
35
  };
26
- subBgColor: string;
27
36
  light: {
28
37
  bgColor: string;
29
- subBgColor: string;
30
- border: string;
38
+ readonly border: string;
31
39
  item: {
32
40
  readonly color: string;
33
41
  readonly hoverColor: string;
42
+ readonly hoverBg: string;
34
43
  disabledColor: string;
44
+ subTitleColor: string;
35
45
  };
36
- };
37
- white: {
38
- bgColor: string;
39
- subBgColor: string;
40
- border: string;
41
- item: {
46
+ title: {
42
47
  readonly color: string;
43
- readonly hoverColor: string;
44
- readonly disabledColor: string;
45
48
  };
46
49
  active: {
47
50
  readonly color: string;
@@ -10,53 +10,50 @@ var defaults = {
10
10
  return theme.transition.large;
11
11
  },
12
12
  width: '200px',
13
- bgColor: '#262626',
13
+ bgColor: '#1c1c20',
14
14
  fontSize: '14px',
15
15
  get borderRadius() {
16
16
  return theme.borderRadius;
17
17
  },
18
+ get border() {
19
+ return "1px solid " + theme.color.darkBorder;
20
+ },
18
21
  item: {
19
22
  height: '40px',
20
- padding: '0 21px',
21
- color: '#b2b2b2',
23
+ padding: '0 17px',
24
+ bodyPadding: '0 4px',
25
+ color: '#aeaeb9',
22
26
  hoverColor: '#fff',
23
- get disabledColor() {
24
- return theme.color.text;
25
- },
27
+ disabledColor: '#53535a',
26
28
  get activeBgColor() {
27
29
  return theme.color.primary;
28
30
  },
29
- dotFontSize: '12px'
31
+ get hoverBgColor() {
32
+ return palette(theme.color.primary, 4);
33
+ },
34
+ dotFontSize: '12px',
35
+ subTitleColor: '#858592'
36
+ },
37
+ title: {
38
+ height: '40px',
39
+ padding: '0 17px',
40
+ color: '#fff'
30
41
  },
31
42
  icon: {
32
43
  width: '16px',
33
44
  gap: '11px'
34
45
  },
35
46
  header: {
36
- height: '50px',
47
+ height: '52px',
37
48
  fontSize: '14px',
49
+ color: '#fff',
38
50
  borderBottom: '1px solid #1b1b1d'
39
51
  },
40
- // sub-menu
41
- subBgColor: '#000',
42
52
  light: {
43
- bgColor: '#e5e5e9',
44
- subBgColor: '#d5d5d9',
45
- border: '1px solid #d5d5d9',
46
- item: {
47
- get color() {
48
- return theme.color.text;
49
- },
50
- get hoverColor() {
51
- return theme.color.primary;
52
- },
53
- disabledColor: '#999'
54
- }
55
- },
56
- white: {
57
53
  bgColor: '#fff',
58
- subBgColor: '#fafafa',
59
- border: '1px solid #eee',
54
+ get border() {
55
+ return "1px solid " + theme.color.disabledBg;
56
+ },
60
57
  item: {
61
58
  get color() {
62
59
  return theme.color.text;
@@ -64,8 +61,15 @@ var defaults = {
64
61
  get hoverColor() {
65
62
  return theme.color.primary;
66
63
  },
67
- get disabledColor() {
68
- return theme.color.disabled;
64
+ get hoverBg() {
65
+ return theme.color.hoverBg;
66
+ },
67
+ disabledColor: '#b6bec2',
68
+ subTitleColor: '#5e686f'
69
+ },
70
+ title: {
71
+ get color() {
72
+ return theme.color.title;
69
73
  }
70
74
  },
71
75
  active: {
@@ -106,16 +110,12 @@ setDefault(function () {
106
110
  });
107
111
  export { menu };
108
112
  export var makeMenuStyles = cache(function makeMenuStyles(k) {
109
- var _context;
110
113
  // we must increase the priority by adding &.${k}-menu
111
114
  // to override the css of dropdownMenu
112
- return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";font-size:", menu.header.fontSize, ";font-weight:bold;border-bottom:", menu.header.borderBottom, ";}", _mapInstanceProperty(_context = ['light', 'white']).call(_context, function (theme) {
113
- var styles = menu[theme];
114
- return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";.", k, "-menu-header{color:", styles.item.color, ";border-bottom:", styles.border, ";}.", k, "-menu-item{.", k, "-menu-title{color:", styles.item.color, ";&:hover{color:", styles.item.hoverColor, ";}}&.", k, "-highlighted{>.", k, "-menu-title{color:", styles.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", styles.item.disabledColor, "!important;}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", styles.subBgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", styles.border, ";}}}");
115
- }), " &.", k, "-white{.", k, "-menu-item.", k, "-active{>.", k, "-menu-title{color:", menu.white.active.color, "!important;background:", menu.white.active.bgColor, ";}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
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 21px;color:", menu.header.color, ";font-size:", menu.header.fontSize, ";font-weight:bold;}.", k, "-menu-body{padding:", menu.item.bodyPadding, ";max-height:calc(100vh - ", menu.header.height, ");overflow-y:auto;}.", 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: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
- return /*#__PURE__*/css("&.", k, "-", size, "{width:", styles.width, ";font-size:", styles.fontSize, ";.", k, "-menu{font-size:", styles.fontSize, ";}}");
118
- }), "&.", k, "-collapsed{width:calc(", menu.icon.width, " + ", getLeft(menu.item.padding), " * 2);.", k, "-icon{margin-right:0;}.", k, "-menu-arrow{display:none;}}&.", k, "-dropdown-menu{width:auto;min-width:", menu.dropdown.minWidth, ";.", k, "-menu-arrow{transform:rotate(-90deg);}}&.", k, "-horizontal{width:auto;display:flex;align-items:center;.", k, "-menu-header{border-bottom:none;border-right:", menu.header.borderBottom, ";}}");
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, ";}}}");
119
119
  });
120
120
  export var makeTitleStyles = cache(function makeTitleStyles(k) {
121
121
  var item = menu.item;
@@ -123,12 +123,12 @@ export var makeTitleStyles = cache(function makeTitleStyles(k) {
123
123
  });
124
124
  export var makeItemStyles = cache(function makeItemStyles(k) {
125
125
  var item = menu.item;
126
- return /*#__PURE__*/css(".", k, "-menu-title{cursor:pointer;height:", item.height, ";&:hover{color:", item.hoverColor, ";}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}.", k, "-icon{color:inherit;}}.", k, "-menu-arrow{transition:transform ", menu.transition, ";margin:0 0 0 ", menu.icon.gap, ";}&.", k, "-expanded{>.", k, "-menu-title{color:", item.hoverColor, ";.", k, "-menu-arrow{transform:rotateX(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-title{color:", item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-title{color:", item.hoverColor, "!important;background:", item.activeBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", item.dotFontSize, ";transform:scale(.4);}");
126
+ return /*#__PURE__*/css(".", k, "-menu-item-title{transition:all ", menu.transition, ";cursor:pointer;height:", item.height, ";&:hover{padding:", item.padding, ";border-radius:", menu.borderRadius, ";background:#2a2a30;}&>.", k, "-menu-item-arrow:before{font-size:small;}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}.", k, "-icon{color:inherit;}}.", k, "-menu-item-arrow{color:", item.color, ";margin:0 0 0 ", menu.icon.gap, ";transition:transform ", menu.transition, ";}&.", k, "-expanded{>.", k, "-menu-item-title{color:", item.hoverColor, ";.", k, "-menu-item-arrow{transform:rotate(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-item-title{border-radius:", menu.borderRadius, ";color:", item.activeBgColor, "!important;background:", item.hoverBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", item.dotFontSize, ";transform:scale(.4);}");
127
127
  });
128
128
  export var makeNestedMenuStyles = cache(function makeNestedMenuStyles(k, hasIcon, parentPaddingLeft) {
129
129
  if (parentPaddingLeft === void 0) {
130
130
  parentPaddingLeft = getLeft(menu.item.padding);
131
131
  }
132
- var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width : '') + " + " + menu.icon.gap;
133
- return [/*#__PURE__*/css("&.", k, "-menu{width:auto;background:", menu.subBgColor, ";.", k, "-menu-title{padding-left:calc(", paddingLeft, ");}}"), paddingLeft];
132
+ var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width + ' + ' + menu.icon.gap : '');
133
+ return [/*#__PURE__*/css("&.", k, "-menu{position:relative;width:auto;background:", menu.bgColor, ";border:none;.", k, "-menu-body{padding:0;.", k, "-menu-item-title{padding-left:calc(", paddingLeft, ");}.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.item.subTitleColor, ";}}}"), paddingLeft];
134
134
  });
@@ -0,0 +1,7 @@
1
+ import { Component } from 'intact-vue-next';
2
+ import { Menu } from './menu';
3
+ export declare class MenuTitle extends Component {
4
+ static template: string | import('intact-vue-next').Template<any>;
5
+ rootMenu: Menu<import('intact-vue-next').Key>;
6
+ private config;
7
+ }
@@ -0,0 +1,22 @@
1
+ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
+ import { Component, inject } from 'intact-vue-next';
4
+ import { ROOT_MENU } from './menu';
5
+ import template from './title.vdt';
6
+ import { useConfigContext } from '../config';
7
+ export var MenuTitle = /*#__PURE__*/function (_Component) {
8
+ _inheritsLoose(MenuTitle, _Component);
9
+ function MenuTitle() {
10
+ var _context;
11
+ var _this;
12
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13
+ args[_key] = arguments[_key];
14
+ }
15
+ _this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
16
+ _this.rootMenu = inject(ROOT_MENU);
17
+ _this.config = useConfigContext();
18
+ return _this;
19
+ }
20
+ return MenuTitle;
21
+ }(Component);
22
+ MenuTitle.template = template;
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce } from 'intact-vue-next';
3
+ import { Icon } from '../icon';
4
+ import { getRestProps, findChildren, isComponentVNode } from '../utils';
5
+ import { makeTitleStyles } from './styles';
6
+ export default function ($props, $blocks, $__proto__) {
7
+ var _classNameObj, _$cn2;
8
+ $blocks || ($blocks = {});
9
+ $props || ($props = {});
10
+ var $this = this;
11
+ var rootMenu = this.rootMenu;
12
+ var _rootMenu$get = rootMenu.get(),
13
+ collapse = _rootMenu$get.collapse;
14
+ var _this$get = this.get(),
15
+ children = _this$get.children,
16
+ className = _this$get.className;
17
+ var k = this.config.k;
18
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-menu-title"] = true, _classNameObj[className] = className, _classNameObj);
19
+ return _$cv('div', _extends({
20
+ 'className': _$cn(classNameObj)
21
+ }, getRestProps(this)), _$ce(2, 'div', !collapse ? _$ce(2, 'span', children, 0) : findChildren(children, function (vNode) {
22
+ return isComponentVNode(vNode, Icon);
23
+ }), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-name"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))));
24
+ }
25
+ ;
@@ -9,7 +9,7 @@ var defaults = {
9
9
  return theme.transition.small;
10
10
  },
11
11
  get borderColor() {
12
- return theme.color.darkBorder;
12
+ return theme.color.border;
13
13
  },
14
14
  get hoverBorderColor() {
15
15
  return theme.color.primary;
@@ -409,7 +409,7 @@ describe('Select', function () {
409
409
  _context12.next = 12;
410
410
  return wait();
411
411
  case 12:
412
- expect(instance.get('days')).have.length(7);
412
+ expect(instance.get('days')).have.length(6);
413
413
  // unselect all
414
414
  select.click();
415
415
  _context12.next = 16;
@@ -33,6 +33,7 @@ export default function ($props, $blocks, $__proto__) {
33
33
  'value': value.value,
34
34
  'ev-$change:value': value.set,
35
35
  'trueValue': _this.get('value'),
36
+ 'disabled': disabled,
36
37
  'children': _children2
37
38
  });
38
39
  }
@@ -58,7 +58,10 @@ export var Select = /*#__PURE__*/function (_BaseSelect) {
58
58
  var loop = function loop(children) {
59
59
  eachChildren(children, function (vNode) {
60
60
  if (isComponentVNode(vNode, Option)) {
61
- values.push(vNode.props.value);
61
+ var props = vNode.props;
62
+ if (!props.disabled) {
63
+ values.push(props.value);
64
+ }
62
65
  } else if (isComponentVNode(vNode, OptionGroup)) {
63
66
  loop(vNode.props.children);
64
67
  }