@opentiny/vue-dropdown-item 3.1.0-alpha.0 → 3.4.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/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ import DropdownItem from './src/index';
13
+ export default DropdownItem;
package/lib/index.js CHANGED
@@ -74,6 +74,24 @@ var DropdownItem = {
74
74
  type: {
75
75
  type: String,
76
76
  default: 'selection'
77
+ },
78
+ label: {
79
+ type: String,
80
+ default: ''
81
+ },
82
+ itemData: {
83
+ type: Object,
84
+ default: function _default() {
85
+ return {};
86
+ }
87
+ },
88
+ appendToBody: {
89
+ type: Boolean,
90
+ default: true
91
+ },
92
+ textField: {
93
+ type: String,
94
+ default: 'label'
77
95
  }
78
96
  }),
79
97
  setup: function setup(props, context) {
@@ -92,6 +110,6 @@ DropdownItem.model = {
92
110
  DropdownItem.install = function (Vue) {
93
111
  Vue.component(DropdownItem.name, DropdownItem);
94
112
  };
95
- DropdownItem.version = '3.1.0-alpha.0';
113
+ DropdownItem.version = '3.4.7';
96
114
 
97
115
  export { DropdownItem as default };
package/lib/pc.js CHANGED
@@ -1,6 +1,8 @@
1
- import { setup, props } from '@opentiny/vue-common';
1
+ import { $prefix, setup, props } from '@opentiny/vue-common';
2
+ import { renderless, api } from '@opentiny/vue-renderless/dropdown-item/vue';
3
+ import { iconDeltaLeft } from '@opentiny/vue-icon';
2
4
  import '@opentiny/vue-theme/dropdown-item/index.css';
3
- import { openBlock, createElementBlock, normalizeClass, withModifiers, createBlock, resolveDynamicComponent, createCommentVNode, renderSlot } from 'vue';
5
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, withModifiers, createVNode, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, renderSlot, toDisplayString, Fragment, renderList, withCtx } from 'vue';
4
6
 
5
7
  function _toConsumableArray(arr) {
6
8
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
@@ -29,41 +31,73 @@ function _nonIterableSpread() {
29
31
  }
30
32
 
31
33
  var script = {
32
- props: [].concat(_toConsumableArray(props), ['command', 'disabled', 'divided', 'icon']),
34
+ name: $prefix + 'DropdownItem',
35
+ componentName: $prefix + 'DropdownItem',
36
+ emits: ['item-click'],
37
+ props: [].concat(_toConsumableArray(props), ['command', 'disabled', 'divided', 'icon', 'label', 'itemData', 'appendToBody', 'textField']),
38
+ components: {
39
+ iconDeltaLeft: iconDeltaLeft()
40
+ },
33
41
  setup: function setup$1(props, context) {
34
42
  return setup({
35
43
  props: props,
36
44
  context: context,
37
- renderless: function renderless(props, hooks, _ref) {
38
- var dispatch = _ref.dispatch,
39
- vm = _ref.vm;
40
- return {
41
- handleClick: function handleClick() {
42
- dispatch('TinyDropdown', 'menu-item-click', [props.itemData, vm]);
43
- }
44
- };
45
- },
46
- api: ['handleClick']
45
+ renderless: renderless,
46
+ api: api
47
47
  });
48
48
  }
49
49
  };
50
50
 
51
51
  var _hoisted_1 = ["aria-disabled", "tabindex"];
52
+ var _hoisted_2 = {
53
+ key: 0,
54
+ class: "tiny-dropdown-menu__item-expand"
55
+ };
56
+ var _hoisted_3 = {
57
+ class: "tiny-dropdown-menu__item-content"
58
+ };
52
59
  function render(_ctx, _cache, $props, $setup, $data, $options) {
60
+ var _component_icon_delta_left = resolveComponent("icon-delta-left");
61
+ var _component_tiny_dropdown_item = resolveComponent("tiny-dropdown-item");
53
62
  return openBlock(), createElementBlock("li", {
54
63
  class: normalizeClass(["tiny-dropdown-menu__item", {
55
64
  'is-disabled': $props.disabled,
56
65
  'tiny-dropdown-menu__item--divided': $props.divided
57
66
  }]),
58
- onClick: _cache[0] || (_cache[0] = withModifiers(function () {
67
+ ref: "dropdownItem",
68
+ onClick: _cache[0] || (_cache[0] = function () {
59
69
  return _ctx.handleClick && _ctx.handleClick.apply(_ctx, arguments);
60
- }, ["stop"])),
70
+ }),
71
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(function () {}, ["stop"])),
61
72
  "aria-disabled": $props.disabled,
62
73
  tabindex: $props.disabled ? null : -1
63
- }, [$props.icon ? (openBlock(), createBlock(resolveDynamicComponent($props.icon), {
74
+ }, [$props.itemData.children && $props.itemData.children.length ? (openBlock(), createElementBlock("span", _hoisted_2, [createVNode(_component_icon_delta_left)])) : createCommentVNode("", true), createElementVNode("div", _hoisted_3, [$props.icon ? (openBlock(), createBlock(resolveDynamicComponent($props.icon), {
64
75
  key: 0,
65
76
  class: "tiny-svg-size"
66
- })) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default")], 10, _hoisted_1);
77
+ })) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default", {
78
+ itemData: $props.itemData
79
+ }, function () {
80
+ return [createElementVNode("span", null, toDisplayString($props.label), 1)];
81
+ })]), $props.itemData.children && $props.itemData.children.length ? (openBlock(), createElementBlock("ul", {
82
+ key: 1,
83
+ class: normalizeClass(['tiny-dropdown-menu', 'tiny-dropdown-menu__item--child', _ctx.state.popperClass])
84
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList($props.itemData.children, function (item, index) {
85
+ return openBlock(), createBlock(_component_tiny_dropdown_item, {
86
+ key: index,
87
+ label: item[_ctx.state.textField],
88
+ itemData: item,
89
+ icon: item.icon,
90
+ disabled: item.disabled,
91
+ divided: item.divided
92
+ }, {
93
+ default: withCtx(function () {
94
+ return [renderSlot(_ctx.$slots, "default", {
95
+ itemData: item
96
+ })];
97
+ }),
98
+ _: 2
99
+ }, 1032, ["label", "itemData", "icon", "disabled", "divided"]);
100
+ }), 128))], 2)) : createCommentVNode("", true)], 42, _hoisted_1);
67
101
  }
68
102
 
69
103
  script.render = render;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-dropdown-item",
3
- "version": "3.1.0-alpha.0",
3
+ "version": "3.4.7",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -9,14 +9,15 @@
9
9
  "build:ui3": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../example/build/build-ui.js"
10
10
  },
11
11
  "dependencies": {
12
- "@opentiny/vue-common": "~3.1.0-alpha.0",
13
- "@opentiny/vue-icon": "~3.1.0-alpha.0",
14
- "@opentiny/vue-renderless": "~3.1.0-alpha.0",
15
- "@opentiny/vue-popup": "~3.1.0-alpha.0",
16
- "@opentiny/vue-button": "~3.1.0-alpha.0",
17
- "@opentiny/vue-theme": "~3.1.0-alpha.0",
18
- "@opentiny/vue-theme-mobile": "~3.1.0-alpha.0"
12
+ "@opentiny/vue-common": "~3.4.7",
13
+ "@opentiny/vue-icon": "~3.4.7",
14
+ "@opentiny/vue-renderless": "~3.4.0",
15
+ "@opentiny/vue-popup": "~3.4.7",
16
+ "@opentiny/vue-button": "~3.4.7",
17
+ "@opentiny/vue-theme": "~3.4.0",
18
+ "@opentiny/vue-theme-mobile": "~3.4.0"
19
19
  },
20
20
  "license": "MIT",
21
+ "types": "index.d.ts",
21
22
  "sideEffects": false
22
23
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ icon: (ObjectConstructor | StringConstructor)[];
3
+ disabled: BooleanConstructor;
4
+ divided: BooleanConstructor;
5
+ command: {};
6
+ title: StringConstructor;
7
+ titleClass: StringConstructor;
8
+ options: {
9
+ type: ArrayConstructor;
10
+ default: () => never[];
11
+ };
12
+ type: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
17
+ icon: (ObjectConstructor | StringConstructor)[];
18
+ disabled: BooleanConstructor;
19
+ divided: BooleanConstructor;
20
+ command: {};
21
+ title: StringConstructor;
22
+ titleClass: StringConstructor;
23
+ options: {
24
+ type: ArrayConstructor;
25
+ default: () => never[];
26
+ };
27
+ type: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ }>>, {
32
+ type: string;
33
+ disabled: boolean;
34
+ options: unknown[];
35
+ divided: boolean;
36
+ }>;
37
+ export default _default;
@@ -0,0 +1,50 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: null;
3
+ title: StringConstructor;
4
+ disabled: BooleanConstructor;
5
+ titleClass: StringConstructor;
6
+ options: {
7
+ type: ArrayConstructor;
8
+ default: () => never[];
9
+ };
10
+ icon: ObjectConstructor;
11
+ type: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ }, {
16
+ t: any;
17
+ vm: any;
18
+ f: (props: any, attrs?: {}) => {};
19
+ a: (attrs: any, filters: any, include: any) => {};
20
+ d: (props: any) => void;
21
+ dp: (props: any) => void;
22
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "change" | "update:modelValue" | "close" | "confirm" | "open" | "opened" | "closed")[], "click" | "change" | "update:modelValue" | "close" | "confirm" | "open" | "opened" | "closed", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
+ modelValue: null;
24
+ title: StringConstructor;
25
+ disabled: BooleanConstructor;
26
+ titleClass: StringConstructor;
27
+ options: {
28
+ type: ArrayConstructor;
29
+ default: () => never[];
30
+ };
31
+ icon: ObjectConstructor;
32
+ type: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ }>> & {
37
+ onChange?: ((...args: any[]) => any) | undefined;
38
+ onClick?: ((...args: any[]) => any) | undefined;
39
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
40
+ onClose?: ((...args: any[]) => any) | undefined;
41
+ onConfirm?: ((...args: any[]) => any) | undefined;
42
+ onOpen?: ((...args: any[]) => any) | undefined;
43
+ onOpened?: ((...args: any[]) => any) | undefined;
44
+ onClosed?: ((...args: any[]) => any) | undefined;
45
+ }, {
46
+ type: string;
47
+ disabled: boolean;
48
+ options: unknown[];
49
+ }>;
50
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import '@opentiny/vue-theme-mobile/dropdown-item/index.css';
2
+ declare const _default: {
3
+ directives: {
4
+ Clickoutside: any;
5
+ };
6
+ props: string[];
7
+ components: {
8
+ IconYes: any;
9
+ TinyPopup: any;
10
+ TinyButton: any;
11
+ };
12
+ emits: string[];
13
+ setup(props: any, context: any): {
14
+ t: any;
15
+ vm: any;
16
+ f: (props: any, attrs?: {}) => {};
17
+ a: (attrs: any, filters: any, include: any) => {};
18
+ d: (props: any) => void;
19
+ dp: (props: any) => void;
20
+ };
21
+ };
22
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import '@opentiny/vue-theme/dropdown-item/index.css';
2
+ declare const _default: {
3
+ props: string[];
4
+ setup(props: any, context: any): {
5
+ t: any;
6
+ vm: any;
7
+ f: (props: any, attrs?: {}) => {};
8
+ a: (attrs: any, filters: any, include: any) => {};
9
+ d: (props: any) => void;
10
+ dp: (props: any) => void;
11
+ };
12
+ };
13
+ export default _default;