@opentinyvue/vue-dropdown 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -7,7 +7,7 @@ function _extends() {
7
7
  return n;
8
8
  }, _extends.apply(null, arguments);
9
9
  }
10
- import { defineComponent, $prefix, $setup, $props } from "@opentinyvue/vue-common";
10
+ import { defineComponent, $props, $setup, $prefix } from "@opentinyvue/vue-common";
11
11
  import PcTemplate from "./pc.js";
12
12
  import MobileFirstTemplate from "./mobile-first.js";
13
13
  import "@opentinyvue/vue-theme/dropdown/index.css";
@@ -24,6 +24,11 @@ var template = function template2(mode) {
24
24
  };
25
25
  var dropdownProps = _extends({}, $props, {
26
26
  modelValue: [String, Number],
27
+ // tiny新增
28
+ visible: {
29
+ type: [Boolean, void 0],
30
+ default: void 0
31
+ },
27
32
  type: String,
28
33
  trigger: String,
29
34
  // 默认主题为 'hover'
@@ -110,7 +115,7 @@ var Dropdown = defineComponent({
110
115
  });
111
116
  }
112
117
  });
113
- var version = "2.21.0";
118
+ var version = "2.22.0";
114
119
  Dropdown.install = function(Vue) {
115
120
  Vue.component(Dropdown.name, Dropdown);
116
121
  };
@@ -2,7 +2,7 @@ import { renderless, api } from '@opentinyvue/vue-renderless/dropdown/vue';
2
2
  import { defineComponent, $prefix, directive, setup, h, $props } from '@opentinyvue/vue-common';
3
3
  import Button from '@opentinyvue/vue-button';
4
4
  import ButtonGroup from '@opentinyvue/vue-button-group';
5
- import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
5
+ import { Clickoutside } from '@opentinyvue/vue-directive';
6
6
  import { IconChevronDown, IconChevronUp, IconArrowBottom } from '@opentinyvue/vue-icon';
7
7
 
8
8
  function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
package/lib/pc.js CHANGED
@@ -2,7 +2,7 @@ import { renderless, api } from '@opentinyvue/vue-renderless/dropdown/vue';
2
2
  import { defineComponent, $prefix, directive, setup, h, $props } from '@opentinyvue/vue-common';
3
3
  import Button from '@opentinyvue/vue-button';
4
4
  import ButtonGroup from '@opentinyvue/vue-button-group';
5
- import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
5
+ import { Clickoutside } from '@opentinyvue/vue-directive';
6
6
  import DropdownMenu from '@opentinyvue/vue-dropdown-menu';
7
7
  import { iconDownWard } from '@opentinyvue/vue-icon';
8
8
 
@@ -60,6 +60,11 @@ var __vue2_script = defineComponent({
60
60
  props: _extends({}, $props, {
61
61
  type: String,
62
62
  trigger: String,
63
+ // tiny新增
64
+ visible: {
65
+ type: [Boolean, void 0],
66
+ default: void 0
67
+ },
63
68
  size: {
64
69
  type: String,
65
70
  default: ""
@@ -124,7 +129,7 @@ var __vue2_script = defineComponent({
124
129
  default: false
125
130
  }
126
131
  }),
127
- emits: ["visible-change", "item-click", "button-click", "menu-item-click", "handle-click", "is-disabled", "selected-index"],
132
+ emits: ["visible-change", "item-click", "button-click", "menu-item-click", "handle-click", "is-disabled", "selected-index", "update:visible"],
128
133
  setup: function setup$1(props, context) {
129
134
  return setup({
130
135
  props,
@@ -138,13 +143,14 @@ var __vue2_script = defineComponent({
138
143
  var _state$designConfig, _state$designConfig$i, _state$designConfig2, _state$designConfig2$;
139
144
  var h2 = arguments[0];
140
145
  var splitButton = this.splitButton, type = this.type, disabled = this.disabled, handleMainButtonClick = this.handleMainButtonClick, menuOptions = this.menuOptions, title = this.title, suffixIcon = this.suffixIcon, prefixIcon = this.prefixIcon;
141
- var slots = this.slots, size = this.size, state = this.state, border = this.border, showIcon = this.showIcon, round = this.round, clickOutside = this.clickOutside;
146
+ var slots = this.slots, size = this.size, state = this.state, border = this.border, showIcon = this.showIcon, round = this.round, clickOutside = this.clickOutside, visible = this.visible;
142
147
  var params = {
143
148
  visible: state.visible
144
149
  };
145
150
  var triggerElm = null;
146
151
  var triggerClass = "tiny-dropdown__trigger tiny-dropdown-trigger";
147
- var visibleClass = state.visible ? "tiny-dropdown--visible tiny-dropdown-visible" : "";
152
+ var addVisibleClass = state.visibleIsBoolean ? visible : state.visible;
153
+ var visibleClass = addVisibleClass ? "tiny-dropdown--visible tiny-dropdown-visible" : "";
148
154
  var IconDown = suffixIcon || ((_state$designConfig = state.designConfig) == null ? void 0 : (_state$designConfig$i = _state$designConfig.icons) == null ? void 0 : _state$designConfig$i.dropdownIcon) || iconDownWard();
149
155
  var IconPre = prefixIcon;
150
156
  var ButtonIconDown = ((_state$designConfig2 = state.designConfig) == null ? void 0 : (_state$designConfig2$ = _state$designConfig2.icons) == null ? void 0 : _state$designConfig2$.dropdownIcon) || iconDownWard();
@@ -218,7 +224,7 @@ var __vue2_script = defineComponent({
218
224
  "class": "tiny-dropdown",
219
225
  "directives": [{
220
226
  name: "clickoutside",
221
- value: clickOutside
227
+ value: !state.visibleIsBoolean && clickOutside
222
228
  }],
223
229
  "attrs": {
224
230
  "aria-disabled": disabled
package/package.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-dropdown",
3
- "version": "2.21.0",
3
+ "type": "module",
4
+ "version": "2.22.0",
4
5
  "description": "",
6
+ "license": "MIT",
7
+ "sideEffects": false,
5
8
  "main": "./lib/index.js",
6
9
  "module": "./lib/index.js",
7
- "sideEffects": false,
8
- "type": "module",
9
10
  "dependencies": {
10
- "@opentinyvue/vue-renderless": "~3.21.0",
11
- "@opentinyvue/vue-theme": "~3.21.0",
12
- "@opentinyvue/vue-button": "~2.21.0",
13
- "@opentinyvue/vue-button-group": "~2.21.0",
14
- "@opentinyvue/vue-common": "~2.21.0",
15
- "@opentinyvue/vue-icon": "~2.21.0",
16
- "@opentinyvue/vue-dropdown-menu": "~2.21.0"
11
+ "@opentinyvue/vue-button": "~2.22.0",
12
+ "@opentinyvue/vue-button-group": "~2.22.0",
13
+ "@opentinyvue/vue-common": "~2.22.0",
14
+ "@opentinyvue/vue-directive": "~2.22.0",
15
+ "@opentinyvue/vue-dropdown-menu": "~2.22.0",
16
+ "@opentinyvue/vue-icon": "~2.22.0",
17
+ "@opentinyvue/vue-renderless": "~3.22.0",
18
+ "@opentinyvue/vue-theme": "~3.22.0"
17
19
  },
18
- "license": "MIT",
19
20
  "types": "index.d.ts",
20
21
  "scripts": {
21
22
  "build": "pnpm -w build:ui $npm_package_name",
package/src/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export declare const dropdownProps: {
2
2
  modelValue: (StringConstructor | NumberConstructor)[];
3
+ visible: {
4
+ type: (BooleanConstructor | undefined)[];
5
+ default: undefined;
6
+ };
3
7
  type: StringConstructor;
4
8
  trigger: StringConstructor;
5
9
  size: {