@opentiny/vue-dropdown-item 2.6.7 → 2.8.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/lib/index.js CHANGED
@@ -15,16 +15,34 @@ function _extends() {
15
15
  import { defineComponent, $prefix, $props, $setup } from "@opentiny/vue-common";
16
16
  import PcTemplate from "./pc.js";
17
17
  import MobileTemplate from "./mobile.js";
18
+ import MobileFirstTemplate from "./mobile-first.js";
18
19
  var template = function template2(mode) {
19
- if ("mobile" === (process.env.TINY_MODE || mode))
20
- return MobileTemplate;
21
- else
20
+ if ("pc" === (process.env.TINY_MODE || mode)) {
22
21
  return PcTemplate;
22
+ }
23
+ if ("mobile" === (process.env.TINY_MODE || mode)) {
24
+ return MobileTemplate;
25
+ }
26
+ if ("mobile-first" === (process.env.TINY_MODE || mode)) {
27
+ return MobileFirstTemplate;
28
+ }
29
+ return PcTemplate;
30
+ };
31
+ var $constants = {
32
+ ICON_MAP: {
33
+ leftWardArrow: "icon-delta-left"
34
+ }
23
35
  };
24
36
  var DropdownItem = defineComponent({
25
37
  name: $prefix + "DropdownItem",
26
38
  componentName: "TinyDropdownItem",
27
39
  props: _extends({}, $props, {
40
+ _constants: {
41
+ type: Object,
42
+ default: function _default() {
43
+ return $constants;
44
+ }
45
+ },
28
46
  icon: [String, Object],
29
47
  disabled: Boolean,
30
48
  divided: Boolean,
@@ -33,7 +51,7 @@ var DropdownItem = defineComponent({
33
51
  titleClass: String,
34
52
  options: {
35
53
  type: Array,
36
- default: function _default() {
54
+ default: function _default2() {
37
55
  return [];
38
56
  }
39
57
  },
@@ -47,7 +65,7 @@ var DropdownItem = defineComponent({
47
65
  },
48
66
  itemData: {
49
67
  type: Object,
50
- default: function _default2() {
68
+ default: function _default3() {
51
69
  return {};
52
70
  }
53
71
  },
@@ -58,6 +76,24 @@ var DropdownItem = defineComponent({
58
76
  textField: {
59
77
  type: String,
60
78
  default: "label"
79
+ },
80
+ selected: {
81
+ type: Boolean,
82
+ default: false
83
+ },
84
+ selectedField: {
85
+ type: String,
86
+ default: "selected"
87
+ },
88
+ multiStage: {
89
+ type: Boolean,
90
+ default: false
91
+ },
92
+ currentIndex: {
93
+ type: Number,
94
+ default: function _default4() {
95
+ return -1;
96
+ }
61
97
  }
62
98
  }),
63
99
  setup: function setup(props, context) {
@@ -0,0 +1,115 @@
1
+ import { defineComponent, props, setup as _setup } from "@opentiny/vue-common";
2
+ import { renderless, api } from "@opentiny/vue-renderless/dropdown-item/mf";
3
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
4
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
5
+ if (render) {
6
+ options.render = render;
7
+ options.staticRenderFns = staticRenderFns;
8
+ options._compiled = true;
9
+ }
10
+ if (functionalTemplate) {
11
+ options.functional = true;
12
+ }
13
+ if (scopeId) {
14
+ options._scopeId = "data-v-" + scopeId;
15
+ }
16
+ var hook;
17
+ if (moduleIdentifier) {
18
+ hook = function hook2(context) {
19
+ context = context || // cached call
20
+ this.$vnode && this.$vnode.ssrContext || // stateful
21
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
22
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
23
+ context = __VUE_SSR_CONTEXT__;
24
+ }
25
+ if (injectStyles) {
26
+ injectStyles.call(this, context);
27
+ }
28
+ if (context && context._registeredComponents) {
29
+ context._registeredComponents.add(moduleIdentifier);
30
+ }
31
+ };
32
+ options._ssrRegister = hook;
33
+ } else if (injectStyles) {
34
+ hook = shadowMode ? function() {
35
+ injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
36
+ } : injectStyles;
37
+ }
38
+ if (hook) {
39
+ if (options.functional) {
40
+ options._injectStyles = hook;
41
+ var originalRender = options.render;
42
+ options.render = function renderWithStyleInjection(h, context) {
43
+ hook.call(context);
44
+ return originalRender(h, context);
45
+ };
46
+ } else {
47
+ var existing = options.beforeCreate;
48
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
49
+ }
50
+ }
51
+ return {
52
+ exports: scriptExports,
53
+ options
54
+ };
55
+ }
56
+
57
+ var __vue2_script = defineComponent({
58
+ props: [].concat(props, ["disabled", "icon", "itemData", "selected", "label", "level", "currentIndex"]),
59
+ setup: function setup(props2, context) {
60
+ return _setup({
61
+ props: props2,
62
+ context,
63
+ renderless,
64
+ api
65
+ });
66
+ }
67
+ });
68
+ var render = function render2() {
69
+ var _vm = this;
70
+ var _h = _vm.$createElement;
71
+ var _c = _vm._self._c || _h;
72
+ return _c("li", {
73
+ class: ["list-none leading-10 sm:leading-8 m-0 cursor-pointer outline-0 min-w-[4.5rem] max-w-[13.5rem] w-full [&_svg]:sm:w-3.5 [&_svg]:sm:h-3.5 [&_svg]:sm:mr-1.5 [&_svg]:mr-2 [&_svg]:align-text-bottom", {
74
+ "text-color-text-primary active:bg-color-bg-4 visited:text-color-brand hover:bg-color-bg-4 focus:bg-color-bg-4": !_vm.disabled
75
+ }, {
76
+ "cursor-not-allowed text-color-text-disabled [&_svg]:fill-color-text-disabled": _vm.disabled
77
+ }, {
78
+ "text-color-brand-focus": _vm.dataStore.checkedStatus && _vm.selected
79
+ }, {
80
+ "!px-0 sm:!px-0": _vm.dataStore.multiStage
81
+ }],
82
+ attrs: {
83
+ "aria-disabled": _vm.disabled,
84
+ "tabindex": _vm.disabled ? null : -1
85
+ },
86
+ on: {
87
+ "mouseenter": _vm.mouseEnter,
88
+ "mouseleave": _vm.mouseLeave,
89
+ "click": function click($event) {
90
+ $event.stopPropagation();
91
+ return _vm.handleClick.apply(null, arguments);
92
+ }
93
+ }
94
+ }, [_c("div", {
95
+ ref: "level",
96
+ class: ["sm:text-xs text-sm", _vm.level === "2" ? "mx-6 overflow-hidden text-ellipsis whitespace-nowrap" : "mx-4 sm:mx-3 overflow-hidden text-ellipsis whitespace-nowrap"]
97
+ }, [_vm.icon ? _c(_vm.icon, {
98
+ tag: "component",
99
+ staticClass: "sm:w-3.5 sm:h-3.5 sm:mr-1.5 mr-2 align-text-bottom"
100
+ }) : _vm._e(), _vm._t("default")], 2)]);
101
+ };
102
+ var staticRenderFns = [];
103
+ var __cssModules = {};
104
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
105
+ function __vue2_injectStyles(context) {
106
+ for (var o in __cssModules) {
107
+ this[o] = __cssModules[o];
108
+ }
109
+ }
110
+ var mobileFirst = /* @__PURE__ */ function() {
111
+ return __component__.exports;
112
+ }();
113
+ export {
114
+ mobileFirst as default
115
+ };
package/lib/pc.js CHANGED
@@ -79,10 +79,11 @@ var render = function render2() {
79
79
  var _c = _vm._self._c || _h;
80
80
  return _c("li", {
81
81
  ref: "dropdownItem",
82
- staticClass: "tiny-dropdown-menu__item",
82
+ staticClass: "tiny-dropdown-item tiny-dropdown-menu__item",
83
83
  class: {
84
84
  "is-disabled": _vm.disabled,
85
- "tiny-dropdown-menu__item--divided": _vm.divided
85
+ "tiny-dropdown-item--divided tiny-dropdown-menu__item--divided": _vm.divided,
86
+ "has-children": _vm.itemData.children && _vm.itemData.children.length
86
87
  },
87
88
  attrs: {
88
89
  "aria-disabled": _vm.disabled,
@@ -94,10 +95,14 @@ var render = function render2() {
94
95
  $event.stopPropagation();
95
96
  }
96
97
  }
98
+ }, [_c("div", {
99
+ staticClass: "tiny-dropdown-item__wrap"
97
100
  }, [_vm.itemData.children && _vm.itemData.children.length ? _c("span", {
98
- staticClass: "tiny-dropdown-menu__item-expand"
99
- }, [_c("icon-delta-left")], 1) : _vm._e(), _c("div", {
100
- staticClass: "tiny-dropdown-menu__item-content"
101
+ staticClass: "tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
102
+ }, [_c(_vm.state.getIcon, {
103
+ tag: "component"
104
+ })], 1) : _vm._e(), _c("div", {
105
+ staticClass: "tiny-dropdown-item__content tiny-dropdown-menu__item-content"
101
106
  }, [_vm.icon ? _c(_vm.icon, {
102
107
  tag: "component",
103
108
  staticClass: "tiny-svg-size"
@@ -106,13 +111,13 @@ var render = function render2() {
106
111
  }, {
107
112
  "itemData": _vm.itemData
108
113
  })], 2), _vm.itemData.children && _vm.itemData.children.length ? _c("ul", {
109
- class: ["tiny-dropdown-menu", "tiny-dropdown-menu__item--child", _vm.state.popperClass]
114
+ class: ["tiny-dropdown-menu", "tiny-dropdown-item--child tiny-dropdown-menu__item--child", _vm.state.popperClass]
110
115
  }, _vm._l(_vm.itemData.children, function(item, index) {
111
116
  return _c("tiny-dropdown-item", {
112
117
  key: index,
113
118
  attrs: {
114
119
  "label": item[_vm.state.textField],
115
- "itemData": item,
120
+ "item-data": item,
116
121
  "icon": item.icon,
117
122
  "disabled": item.disabled,
118
123
  "divided": item.divided
@@ -120,7 +125,7 @@ var render = function render2() {
120
125
  }, [_vm._t("default", null, {
121
126
  "itemData": item
122
127
  })], 2);
123
- }), 1) : _vm._e()]);
128
+ }), 1) : _vm._e()])]);
124
129
  };
125
130
  var staticRenderFns = [];
126
131
  var __cssModules = {};
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@opentiny/vue-dropdown-item",
3
- "version": "2.6.7",
3
+ "version": "2.8.2",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
6
7
  "dependencies": {
7
- "@opentiny/vue-common": "~2.6.7",
8
- "@opentiny/vue-icon": "~2.6.7",
9
- "@opentiny/vue-renderless": "~3.6.6",
10
- "@opentiny/vue-popup": "~2.6.7",
11
- "@opentiny/vue-button": "~2.6.7"
8
+ "@opentiny/vue-common": "~2.8.2",
9
+ "@opentiny/vue-icon": "~2.8.2",
10
+ "@opentiny/vue-renderless": "~3.8.2",
11
+ "@opentiny/vue-popup": "~2.8.2",
12
+ "@opentiny/vue-button": "~2.8.2"
12
13
  },
13
14
  "license": "MIT",
14
15
  "types": "index.d.ts",
package/src/index.d.ts CHANGED
@@ -1,82 +1,2 @@
1
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode> & import("@vue/composition-api").Data, {}, {}, {
2
- icon: (StringConstructor | ObjectConstructor)[];
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
- label: {
17
- type: StringConstructor;
18
- default: string;
19
- };
20
- itemData: {
21
- type: ObjectConstructor;
22
- default: () => {};
23
- };
24
- appendToBody: {
25
- type: BooleanConstructor;
26
- default: boolean;
27
- };
28
- textField: {
29
- type: StringConstructor;
30
- default: string;
31
- };
32
- }, {
33
- disabled: boolean;
34
- type: string;
35
- textField: string;
36
- label: string;
37
- options: unknown[];
38
- divided: boolean;
39
- itemData: Record<string, any>;
40
- appendToBody: boolean;
41
- } & {
42
- icon?: unknown;
43
- title?: string | undefined;
44
- titleClass?: string | undefined;
45
- command?: unknown;
46
- }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
47
- disabled: boolean;
48
- type: string;
49
- textField: string;
50
- label: string;
51
- options: unknown[];
52
- divided: boolean;
53
- itemData: Record<string, any>;
54
- appendToBody: boolean;
55
- } & {
56
- icon?: unknown;
57
- title?: string | undefined;
58
- titleClass?: string | undefined;
59
- command?: unknown;
60
- }, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode>, import("@vue/composition-api").Data, {}, {}, {
61
- disabled: boolean;
62
- type: string;
63
- textField: string;
64
- label: string;
65
- options: unknown[];
66
- divided: boolean;
67
- itemData: Record<string, any>;
68
- appendToBody: boolean;
69
- } & {
70
- icon?: unknown;
71
- title?: string | undefined;
72
- titleClass?: string | undefined;
73
- command?: unknown;
74
- }, {
75
- type: string;
76
- textField: string;
77
- label: string;
78
- options: unknown[];
79
- itemData: Record<string, any>;
80
- appendToBody: boolean;
81
- }, true>);
1
+ declare const _default: any;
82
2
  export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _sfc_main: any;
2
+ export default _sfc_main;
@@ -1,26 +1,2 @@
1
- declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
2
- t: (this: any, path: any, options?: any) => any;
3
- vm: any;
4
- f: (props: any, attrs?: {}) => {};
5
- a: (attrs: any, filters: any, include: any) => {};
6
- d: (props: any) => void;
7
- dp: (props: any) => void;
8
- }> & import("@vue/composition-api").Data, {}, {}, Readonly<{
9
- [x: string]: any;
10
- }>, {
11
- [x: string]: any;
12
- } & {}> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
13
- [x: string]: any;
14
- } & {}, import("@vue/composition-api").ShallowUnwrapRef<{
15
- t: (this: any, path: any, options?: any) => any;
16
- vm: any;
17
- f: (props: any, attrs?: {}) => {};
18
- a: (attrs: any, filters: any, include: any) => {};
19
- d: (props: any) => void;
20
- dp: (props: any) => void;
21
- }>, import("@vue/composition-api").Data, {}, {}, {
22
- [x: string]: any;
23
- } & {}, {
24
- [x: string]: any;
25
- }, true>);
1
+ declare const _sfc_main: any;
26
2
  export default _sfc_main;
package/src/pc.vue.d.ts CHANGED
@@ -1,26 +1,2 @@
1
- declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
2
- t: (this: any, path: any, options?: any) => any;
3
- vm: any;
4
- f: (props: any, attrs?: {}) => {};
5
- a: (attrs: any, filters: any, include: any) => {};
6
- d: (props: any) => void;
7
- dp: (props: any) => void;
8
- }> & import("@vue/composition-api").Data, {}, {}, Readonly<{
9
- [x: string]: any;
10
- }>, {
11
- [x: string]: any;
12
- } & {}> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
13
- [x: string]: any;
14
- } & {}, import("@vue/composition-api").ShallowUnwrapRef<{
15
- t: (this: any, path: any, options?: any) => any;
16
- vm: any;
17
- f: (props: any, attrs?: {}) => {};
18
- a: (attrs: any, filters: any, include: any) => {};
19
- d: (props: any) => void;
20
- dp: (props: any) => void;
21
- }>, import("@vue/composition-api").Data, {}, {}, {
22
- [x: string]: any;
23
- } & {}, {
24
- [x: string]: any;
25
- }, true>);
1
+ declare const _sfc_main: any;
26
2
  export default _sfc_main;