@opentiny/vue-dropdown-item 2.6.6 → 2.8.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
@@ -15,17 +15,12 @@ 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 "@opentiny/vue-renderless/dropdown-item/vue";
19
- import "@opentiny/vue-icon";
20
- import "@opentiny/vue-theme/dropdown-item/index.css";
21
- import "../../vueComponentNormalizer-de5b7a1c.mjs";
22
- import "@opentiny/vue-popup";
23
- import "@opentiny/vue-button";
24
- import "@opentiny/vue-renderless/common/deps/clickoutside";
25
- import "@opentiny/vue-theme-mobile/dropdown-item/index.css";
18
+ import MobileFirstTemplate from "./mobile-first.js";
26
19
  var template = function template2(mode) {
27
20
  if ("mobile" === (process.env.TINY_MODE || mode))
28
21
  return MobileTemplate;
22
+ else if ("mobile-first" === (process.env.TINY_MODE || mode))
23
+ return MobileFirstTemplate;
29
24
  else
30
25
  return PcTemplate;
31
26
  };
@@ -66,6 +61,24 @@ var DropdownItem = defineComponent({
66
61
  textField: {
67
62
  type: String,
68
63
  default: "label"
64
+ },
65
+ selected: {
66
+ type: Boolean,
67
+ default: false
68
+ },
69
+ selectedField: {
70
+ type: String,
71
+ default: "selected"
72
+ },
73
+ multiStage: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ currentIndex: {
78
+ type: Number,
79
+ default: function _default3() {
80
+ return -1;
81
+ }
69
82
  }
70
83
  }),
71
84
  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/mobile.js CHANGED
@@ -211,9 +211,9 @@ function __vue2_injectStyles(context) {
211
211
  this[o] = __cssModules[o];
212
212
  }
213
213
  }
214
- var MobileTemplate = /* @__PURE__ */ function() {
214
+ var mobile = /* @__PURE__ */ function() {
215
215
  return __component__.exports;
216
216
  }();
217
217
  export {
218
- MobileTemplate as default
218
+ mobile as default
219
219
  };
package/lib/pc.js CHANGED
@@ -79,10 +79,10 @@ 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
86
  },
87
87
  attrs: {
88
88
  "aria-disabled": _vm.disabled,
@@ -94,10 +94,12 @@ var render = function render2() {
94
94
  $event.stopPropagation();
95
95
  }
96
96
  }
97
+ }, [_c("div", {
98
+ staticClass: "tiny-dropdown-item__wrap"
97
99
  }, [_vm.itemData.children && _vm.itemData.children.length ? _c("span", {
98
- staticClass: "tiny-dropdown-menu__item-expand"
100
+ staticClass: "tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
99
101
  }, [_c("icon-delta-left")], 1) : _vm._e(), _c("div", {
100
- staticClass: "tiny-dropdown-menu__item-content"
102
+ staticClass: "tiny-dropdown-item__content tiny-dropdown-menu__item-content"
101
103
  }, [_vm.icon ? _c(_vm.icon, {
102
104
  tag: "component",
103
105
  staticClass: "tiny-svg-size"
@@ -106,13 +108,13 @@ var render = function render2() {
106
108
  }, {
107
109
  "itemData": _vm.itemData
108
110
  })], 2), _vm.itemData.children && _vm.itemData.children.length ? _c("ul", {
109
- class: ["tiny-dropdown-menu", "tiny-dropdown-menu__item--child", _vm.state.popperClass]
111
+ class: ["tiny-dropdown-menu", "tiny-dropdown-item--child tiny-dropdown-menu__item--child", _vm.state.popperClass]
110
112
  }, _vm._l(_vm.itemData.children, function(item, index) {
111
113
  return _c("tiny-dropdown-item", {
112
114
  key: index,
113
115
  attrs: {
114
116
  "label": item[_vm.state.textField],
115
- "itemData": item,
117
+ "item-data": item,
116
118
  "icon": item.icon,
117
119
  "disabled": item.disabled,
118
120
  "divided": item.divided
@@ -120,7 +122,7 @@ var render = function render2() {
120
122
  }, [_vm._t("default", null, {
121
123
  "itemData": item
122
124
  })], 2);
123
- }), 1) : _vm._e()]);
125
+ }), 1) : _vm._e()])]);
124
126
  };
125
127
  var staticRenderFns = [];
126
128
  var __cssModules = {};
@@ -130,9 +132,9 @@ function __vue2_injectStyles(context) {
130
132
  this[o] = __cssModules[o];
131
133
  }
132
134
  }
133
- var PcTemplate = /* @__PURE__ */ function() {
135
+ var pc = /* @__PURE__ */ function() {
134
136
  return __component__.exports;
135
137
  }();
136
138
  export {
137
- PcTemplate as default
139
+ pc as default
138
140
  };
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@opentiny/vue-dropdown-item",
3
- "version": "2.6.6",
3
+ "version": "2.8.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
6
7
  "dependencies": {
7
- "@opentiny/vue-common": "~2.6.6",
8
- "@opentiny/vue-icon": "~2.6.6",
9
- "@opentiny/vue-renderless": "~3.6.6",
10
- "@opentiny/vue-popup": "~2.6.6",
11
- "@opentiny/vue-button": "~2.6.6"
8
+ "@opentiny/vue-common": "~2.8.0",
9
+ "@opentiny/vue-icon": "~2.8.0",
10
+ "@opentiny/vue-renderless": "~3.8.0",
11
+ "@opentiny/vue-popup": "~2.8.0",
12
+ "@opentiny/vue-button": "~2.8.0"
12
13
  },
13
14
  "license": "MIT",
14
15
  "types": "index.d.ts",
package/src/index.d.ts CHANGED
@@ -29,54 +29,110 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
29
29
  type: StringConstructor;
30
30
  default: string;
31
31
  };
32
+ selected: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ selectedField: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ multiStage: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ currentIndex: {
45
+ type: NumberConstructor;
46
+ default: () => number;
47
+ };
48
+ tiny_mode: StringConstructor;
49
+ tiny_mode_root: BooleanConstructor;
50
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
51
+ tiny_renderless: FunctionConstructor;
52
+ tiny_theme: StringConstructor;
53
+ tiny_chart_theme: ObjectConstructor;
32
54
  }, {
33
- disabled: boolean;
34
55
  type: string;
35
- textField: string;
56
+ disabled: boolean;
57
+ tiny_mode_root: boolean;
36
58
  label: string;
37
59
  options: unknown[];
60
+ textField: string;
61
+ selected: boolean;
38
62
  divided: boolean;
39
63
  itemData: Record<string, any>;
40
64
  appendToBody: boolean;
65
+ selectedField: string;
66
+ multiStage: boolean;
67
+ currentIndex: number;
41
68
  } & {
42
- icon?: unknown;
43
69
  title?: string | undefined;
70
+ tiny_mode?: string | undefined;
71
+ tiny_template?: unknown;
72
+ tiny_renderless?: Function | undefined;
73
+ tiny_theme?: string | undefined;
74
+ tiny_chart_theme?: Record<string, any> | undefined;
44
75
  titleClass?: string | undefined;
76
+ icon?: unknown;
45
77
  command?: unknown;
46
78
  }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
47
- disabled: boolean;
48
79
  type: string;
49
- textField: string;
80
+ disabled: boolean;
81
+ tiny_mode_root: boolean;
50
82
  label: string;
51
83
  options: unknown[];
84
+ textField: string;
85
+ selected: boolean;
52
86
  divided: boolean;
53
87
  itemData: Record<string, any>;
54
88
  appendToBody: boolean;
89
+ selectedField: string;
90
+ multiStage: boolean;
91
+ currentIndex: number;
55
92
  } & {
56
- icon?: unknown;
57
93
  title?: string | undefined;
94
+ tiny_mode?: string | undefined;
95
+ tiny_template?: unknown;
96
+ tiny_renderless?: Function | undefined;
97
+ tiny_theme?: string | undefined;
98
+ tiny_chart_theme?: Record<string, any> | undefined;
58
99
  titleClass?: string | undefined;
100
+ icon?: unknown;
59
101
  command?: unknown;
60
102
  }, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode>, import("@vue/composition-api").Data, {}, {}, {
61
- disabled: boolean;
62
103
  type: string;
63
- textField: string;
104
+ disabled: boolean;
105
+ tiny_mode_root: boolean;
64
106
  label: string;
65
107
  options: unknown[];
108
+ textField: string;
109
+ selected: boolean;
66
110
  divided: boolean;
67
111
  itemData: Record<string, any>;
68
112
  appendToBody: boolean;
113
+ selectedField: string;
114
+ multiStage: boolean;
115
+ currentIndex: number;
69
116
  } & {
70
- icon?: unknown;
71
117
  title?: string | undefined;
118
+ tiny_mode?: string | undefined;
119
+ tiny_template?: unknown;
120
+ tiny_renderless?: Function | undefined;
121
+ tiny_theme?: string | undefined;
122
+ tiny_chart_theme?: Record<string, any> | undefined;
72
123
  titleClass?: string | undefined;
124
+ icon?: unknown;
73
125
  command?: unknown;
74
126
  }, {
75
127
  type: string;
76
- textField: string;
77
128
  label: string;
78
129
  options: unknown[];
130
+ textField: string;
131
+ selected: boolean;
79
132
  itemData: Record<string, any>;
80
133
  appendToBody: boolean;
134
+ selectedField: string;
135
+ multiStage: boolean;
136
+ currentIndex: number;
81
137
  }, true>);
82
138
  export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<any> & import("@vue/composition-api").Data, {}, {}, Readonly<{
2
+ [x: string]: any;
3
+ }>, {
4
+ [x: string]: any;
5
+ } & {}> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
6
+ [x: string]: any;
7
+ } & {}, import("@vue/composition-api").ShallowUnwrapRef<any>, import("@vue/composition-api").Data, {}, {}, {
8
+ [x: string]: any;
9
+ } & {}, {
10
+ [x: string]: any;
11
+ }, true>);
12
+ export default _sfc_main;
@@ -5,6 +5,8 @@ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, i
5
5
  a: (attrs: any, filters: any, include: any) => {};
6
6
  d: (props: any) => void;
7
7
  dp: (props: any) => void;
8
+ gcls: (key: any) => any;
9
+ m: (...cssClasses: any[]) => string;
8
10
  }> & import("@vue/composition-api").Data, {}, {}, Readonly<{
9
11
  [x: string]: any;
10
12
  }>, {
@@ -18,6 +20,8 @@ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, i
18
20
  a: (attrs: any, filters: any, include: any) => {};
19
21
  d: (props: any) => void;
20
22
  dp: (props: any) => void;
23
+ gcls: (key: any) => any;
24
+ m: (...cssClasses: any[]) => string;
21
25
  }>, import("@vue/composition-api").Data, {}, {}, {
22
26
  [x: string]: any;
23
27
  } & {}, {
package/src/pc.vue.d.ts CHANGED
@@ -5,6 +5,8 @@ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, i
5
5
  a: (attrs: any, filters: any, include: any) => {};
6
6
  d: (props: any) => void;
7
7
  dp: (props: any) => void;
8
+ gcls: (key: any) => any;
9
+ m: (...cssClasses: any[]) => string;
8
10
  }> & import("@vue/composition-api").Data, {}, {}, Readonly<{
9
11
  [x: string]: any;
10
12
  }>, {
@@ -18,6 +20,8 @@ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, i
18
20
  a: (attrs: any, filters: any, include: any) => {};
19
21
  d: (props: any) => void;
20
22
  dp: (props: any) => void;
23
+ gcls: (key: any) => any;
24
+ m: (...cssClasses: any[]) => string;
21
25
  }>, import("@vue/composition-api").Data, {}, {}, {
22
26
  [x: string]: any;
23
27
  } & {}, {