@opentiny/vue-dropdown-item 2.6.0 → 2.6.1-alpha.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
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
@@ -1,64 +1,30 @@
1
- import { $prefix, $props, $setup } from '@opentiny/vue-common';
2
- import PCTemplate from './pc';
3
- import MobileTemplate from './mobile';
4
-
5
- function ownKeys(object, enumerableOnly) {
6
- var keys = Object.keys(object);
7
- if (Object.getOwnPropertySymbols) {
8
- var symbols = Object.getOwnPropertySymbols(object);
9
- enumerableOnly && (symbols = symbols.filter(function (sym) {
10
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
11
- })), keys.push.apply(keys, symbols);
12
- }
13
- return keys;
14
- }
15
- function _objectSpread2(target) {
16
- for (var i = 1; i < arguments.length; i++) {
17
- var source = null != arguments[i] ? arguments[i] : {};
18
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
19
- _defineProperty(target, key, source[key]);
20
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
21
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22
- });
23
- }
24
- return target;
25
- }
26
- function _defineProperty(obj, key, value) {
27
- key = _toPropertyKey(key);
28
- if (key in obj) {
29
- Object.defineProperty(obj, key, {
30
- value: value,
31
- enumerable: true,
32
- configurable: true,
33
- writable: true
34
- });
35
- } else {
36
- obj[key] = value;
37
- }
38
- return obj;
39
- }
40
- function _toPrimitive(input, hint) {
41
- if (typeof input !== "object" || input === null) return input;
42
- var prim = input[Symbol.toPrimitive];
43
- if (prim !== undefined) {
44
- var res = prim.call(input, hint || "default");
45
- if (typeof res !== "object") return res;
46
- throw new TypeError("@@toPrimitive must return a primitive value.");
47
- }
48
- return (hint === "string" ? String : Number)(input);
49
- }
50
- function _toPropertyKey(arg) {
51
- var key = _toPrimitive(arg, "string");
52
- return typeof key === "symbol" ? key : String(key);
1
+ function _extends() {
2
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
3
+ for (var i = 1; i < arguments.length; i++) {
4
+ var source = arguments[i];
5
+ for (var key in source) {
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
53
14
  }
54
-
55
- var template = function template(mode) {
56
- if (process.env.TINY_MODE === 'pc') return PCTemplate;else if (process.env.TINY_MODE === 'mobile') return MobileTemplate;else return mode === 'mobile' ? MobileTemplate : PCTemplate;
15
+ import { defineComponent, $prefix, $props, $setup } from "@opentiny/vue-common";
16
+ import PcTemplate from "./pc.js";
17
+ import MobileTemplate from "./mobile.js";
18
+ var template = function template2(mode) {
19
+ if ("mobile" === (process.env.TINY_MODE || mode))
20
+ return MobileTemplate;
21
+ else
22
+ return PcTemplate;
57
23
  };
58
- var DropdownItem = {
59
- name: $prefix + 'DropdownItem',
60
- componentName: 'TinyDropdownItem',
61
- props: _objectSpread2(_objectSpread2({}, $props), {}, {
24
+ var DropdownItem = defineComponent({
25
+ name: $prefix + "DropdownItem",
26
+ componentName: "TinyDropdownItem",
27
+ props: _extends({}, $props, {
62
28
  icon: [String, Object],
63
29
  disabled: Boolean,
64
30
  divided: Boolean,
@@ -73,15 +39,15 @@ var DropdownItem = {
73
39
  },
74
40
  type: {
75
41
  type: String,
76
- default: 'selection'
42
+ default: "selection"
77
43
  },
78
44
  label: {
79
45
  type: String,
80
- default: ''
46
+ default: ""
81
47
  },
82
48
  itemData: {
83
49
  type: Object,
84
- default: function _default() {
50
+ default: function _default2() {
85
51
  return {};
86
52
  }
87
53
  },
@@ -91,25 +57,26 @@ var DropdownItem = {
91
57
  },
92
58
  textField: {
93
59
  type: String,
94
- default: 'label'
60
+ default: "label"
95
61
  }
96
62
  }),
97
63
  setup: function setup(props, context) {
98
64
  return $setup({
99
- props: props,
100
- context: context,
101
- template: template
65
+ props,
66
+ context,
67
+ template
102
68
  });
103
69
  }
104
- };
105
-
70
+ });
71
+ var version = "3.7.0";
106
72
  DropdownItem.model = {
107
- prop: 'modelValue',
108
- event: 'update:modelValue'
73
+ prop: "modelValue",
74
+ event: "update:modelValue"
109
75
  };
110
- DropdownItem.install = function (Vue) {
76
+ DropdownItem.install = function(Vue) {
111
77
  Vue.component(DropdownItem.name, DropdownItem);
112
78
  };
113
- DropdownItem.version = '2.6.0';
114
-
115
- export { DropdownItem as default };
79
+ DropdownItem.version = version;
80
+ export {
81
+ DropdownItem as default
82
+ };
package/lib/mobile.js CHANGED
@@ -1,149 +1,89 @@
1
- import { renderless, api } from '@opentiny/vue-renderless/dropdown-item/vue';
2
- import { setup, props } from '@opentiny/vue-common';
3
- import { iconYes } from '@opentiny/vue-icon';
4
- import Popup from '@opentiny/vue-popup';
5
- import Button from '@opentiny/vue-button';
6
- import Clickoutside from '@opentiny/vue-renderless/common/deps/clickoutside';
7
- import '@opentiny/vue-theme-mobile/dropdown-item/index.css';
8
-
9
- function _toConsumableArray(arr) {
10
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
11
- }
12
- function _arrayWithoutHoles(arr) {
13
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
14
- }
15
- function _iterableToArray(iter) {
16
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
17
- }
18
- function _unsupportedIterableToArray(o, minLen) {
19
- if (!o) return;
20
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
21
- var n = Object.prototype.toString.call(o).slice(8, -1);
22
- if (n === "Object" && o.constructor) n = o.constructor.name;
23
- if (n === "Map" || n === "Set") return Array.from(o);
24
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
25
- }
26
- function _arrayLikeToArray(arr, len) {
27
- if (len == null || len > arr.length) len = arr.length;
28
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
29
- return arr2;
30
- }
31
- function _nonIterableSpread() {
32
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
33
- }
34
-
35
- var script = {
36
- directives: {
37
- Clickoutside: Clickoutside
38
- },
39
- props: [].concat(_toConsumableArray(props), ['modelValue', 'title', 'disabled', 'titleClass', 'options', 'icon', 'type']),
40
- components: {
41
- IconYes: iconYes(),
42
- TinyPopup: Popup,
43
- TinyButton: Button
44
- },
45
- emits: ['update:modelValue', 'open', 'opened', 'click', 'change', 'closed', 'close', 'reset', 'confirm', 'item-click'],
46
- setup: function setup$1(props, context) {
47
- return setup({
48
- props: props,
49
- context: context,
50
- renderless: renderless,
51
- api: api
52
- });
1
+ import { renderless, api } from "@opentiny/vue-renderless/dropdown-item/vue";
2
+ import { defineComponent, props, setup as _setup } from "@opentiny/vue-common";
3
+ import { iconYes } from "@opentiny/vue-icon";
4
+ import Popup from "@opentiny/vue-popup";
5
+ import Button from "@opentiny/vue-button";
6
+ import Clickoutside from "@opentiny/vue-renderless/common/deps/clickoutside";
7
+ import "@opentiny/vue-theme-mobile/dropdown-item/index.css";
8
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
9
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
10
+ if (render) {
11
+ options.render = render;
12
+ options.staticRenderFns = staticRenderFns;
13
+ options._compiled = true;
14
+ }
15
+ if (functionalTemplate) {
16
+ options.functional = true;
53
17
  }
54
- };
55
-
56
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
57
- /* server only */
58
- , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
59
- if (typeof shadowMode !== 'boolean') {
60
- createInjectorSSR = createInjector;
61
- createInjector = shadowMode;
62
- shadowMode = false;
63
- } // Vue.extend constructor export interop.
64
-
65
-
66
- var options = typeof script === 'function' ? script.options : script; // render functions
67
-
68
- if (template && template.render) {
69
- options.render = template.render;
70
- options.staticRenderFns = template.staticRenderFns;
71
- options._compiled = true; // functional template
72
-
73
- if (isFunctionalTemplate) {
74
- options.functional = true;
75
- }
76
- } // scopedId
77
-
78
-
79
18
  if (scopeId) {
80
- options._scopeId = scopeId;
19
+ options._scopeId = "data-v-" + scopeId;
81
20
  }
82
-
83
21
  var hook;
84
-
85
22
  if (moduleIdentifier) {
86
- // server build
87
- hook = function hook(context) {
88
- // 2.3 injection
23
+ hook = function hook2(context) {
89
24
  context = context || // cached call
90
25
  this.$vnode && this.$vnode.ssrContext || // stateful
91
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
92
- // 2.2 with runInNewContext: true
93
-
94
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
26
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
27
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
95
28
  context = __VUE_SSR_CONTEXT__;
96
- } // inject component styles
97
-
98
-
99
- if (style) {
100
- style.call(this, createInjectorSSR(context));
101
- } // register component module identifier for async chunk inference
102
-
103
-
29
+ }
30
+ if (injectStyles) {
31
+ injectStyles.call(this, context);
32
+ }
104
33
  if (context && context._registeredComponents) {
105
34
  context._registeredComponents.add(moduleIdentifier);
106
35
  }
107
- }; // used by ssr in case component is cached and beforeCreate
108
- // never gets called
109
-
110
-
111
- options._ssrRegister = hook;
112
- } else if (style) {
113
- hook = shadowMode ? function () {
114
- style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
115
- } : function (context) {
116
- style.call(this, createInjector(context));
117
36
  };
37
+ options._ssrRegister = hook;
38
+ } else if (injectStyles) {
39
+ hook = shadowMode ? function() {
40
+ injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
41
+ } : injectStyles;
118
42
  }
119
-
120
43
  if (hook) {
121
44
  if (options.functional) {
122
- // register for functional component in vue file
45
+ options._injectStyles = hook;
123
46
  var originalRender = options.render;
124
-
125
47
  options.render = function renderWithStyleInjection(h, context) {
126
48
  hook.call(context);
127
49
  return originalRender(h, context);
128
50
  };
129
51
  } else {
130
- // inject component registration as beforeCreate hook
131
52
  var existing = options.beforeCreate;
132
53
  options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
133
54
  }
134
55
  }
135
-
136
- return script;
56
+ return {
57
+ exports: scriptExports,
58
+ options
59
+ };
137
60
  }
138
61
 
139
- var normalizeComponent_1 = normalizeComponent;
140
-
141
- var __vue_script__ = script;
142
- var __vue_render__ = function __vue_render__() {
62
+ var __vue2_script = defineComponent({
63
+ directives: {
64
+ Clickoutside
65
+ },
66
+ props: [].concat(props, ["modelValue", "title", "disabled", "titleClass", "options", "icon", "type"]),
67
+ components: {
68
+ IconYes: iconYes(),
69
+ TinyPopup: Popup,
70
+ TinyButton: Button
71
+ },
72
+ emits: ["update:modelValue", "open", "opened", "click", "change", "closed", "close", "reset", "confirm", "item-click"],
73
+ setup: function setup(props2, context) {
74
+ return _setup({
75
+ props: props2,
76
+ context,
77
+ renderless,
78
+ api
79
+ });
80
+ }
81
+ });
82
+ var render = function render2() {
143
83
  var _vm = this;
144
84
  var _h = _vm.$createElement;
145
85
  var _c = _vm._self._c || _h;
146
- return _c('div', {
86
+ return _c("div", {
147
87
  directives: [{
148
88
  name: "show",
149
89
  rawName: "v-show",
@@ -152,18 +92,18 @@ var __vue_render__ = function __vue_render__() {
152
92
  }],
153
93
  ref: "wrapper",
154
94
  staticClass: "tiny-mobile-dropdown-item",
155
- class: 'tiny-mobile-dropdown-item--' + _vm.state.direction,
95
+ class: "tiny-mobile-dropdown-item--" + _vm.state.direction,
156
96
  style: _vm.state.itemStyle,
157
97
  on: {
158
98
  "click": _vm.clickWrapper
159
99
  }
160
- }, [_c('tiny-popup', {
100
+ }, [_c("tiny-popup", {
161
101
  attrs: {
162
- "popupClass": "tiny-mobile-dropdown-item__content",
102
+ "popup-class": "tiny-mobile-dropdown-item__content",
163
103
  "overlay": _vm.state.overlay,
164
104
  "close-on-click-overlay": _vm.state.closeOnClickOverlay,
165
105
  "closeable": false,
166
- "position": _vm.state.direction === 'down' ? 'top' : 'bottom',
106
+ "position": _vm.state.direction === "down" ? "top" : "bottom",
167
107
  "duration": _vm.state.transition ? _vm.state.duration : 0
168
108
  },
169
109
  on: {
@@ -179,14 +119,14 @@ var __vue_render__ = function __vue_render__() {
179
119
  },
180
120
  expression: "state.showPopup"
181
121
  }
182
- }, [_vm._t("default", function () {
183
- return [_vm.type === 'selection' ? _c('div', {
122
+ }, [_vm._t("default", function() {
123
+ return [_vm.type === "selection" ? _c("div", {
184
124
  staticClass: "tiny-mobile-dropdown-item__options"
185
- }, _vm._l(_vm.options, function (item, index) {
186
- return _c('div', {
125
+ }, _vm._l(_vm.options, function(item, index) {
126
+ return _c("div", {
187
127
  key: index,
188
128
  staticClass: "tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__option",
189
- class: item.value === _vm.modelValue ? 'is-active' : '',
129
+ class: item.value === _vm.modelValue ? "is-active" : "",
190
130
  attrs: {
191
131
  "tabindex": "0"
192
132
  },
@@ -195,30 +135,30 @@ var __vue_render__ = function __vue_render__() {
195
135
  return _vm.clickItem(item.value);
196
136
  }
197
137
  }
198
- }, [_c('div', {
138
+ }, [_c("div", {
199
139
  staticClass: "tiny-mobile-dropdown-item__option-icon"
200
- }, [_vm._t("icon", function () {
140
+ }, [_vm._t("icon", function() {
201
141
  return [_c(_vm.icon, {
202
142
  tag: "component"
203
143
  })];
204
- })], 2), _vm._v(" "), _c('div', {
144
+ })], 2), _c("div", {
205
145
  staticClass: "tiny-mobile-dropdown-item__option-title"
206
- }, [_vm._t("title", function () {
207
- return [_c('span', {
146
+ }, [_vm._t("title", function() {
147
+ return [_c("span", {
208
148
  style: {
209
- color: item.value === _vm.modelValue && _vm.state.activeColor ? _vm.state.activeColor : ''
149
+ color: item.value === _vm.modelValue && _vm.state.activeColor ? _vm.state.activeColor : ""
210
150
  }
211
151
  }, [_vm._v(_vm._s(item.text))])];
212
152
  }, {
213
153
  "titleData": item
214
- })], 2), _vm._v(" "), _c('div', {
154
+ })], 2), _c("div", {
215
155
  staticClass: "tiny-mobile-dropdown-item__option-value"
216
- }, [item.value === _vm.modelValue ? _c('icon-yes', {
156
+ }, [item.value === _vm.modelValue ? _c("icon-yes", {
217
157
  attrs: {
218
- "fill": _vm.state.activeColor ? _vm.state.activeColor : '#f36f64'
158
+ "fill": _vm.state.activeColor ? _vm.state.activeColor : "#f36f64"
219
159
  }
220
160
  }) : _vm._e()], 1)]);
221
- }), 0) : _vm._e(), _vm._v(" "), _vm.type === 'filter' ? _c('div', {
161
+ }), 0) : _vm._e(), _vm.type === "filter" ? _c("div", {
222
162
  directives: [{
223
163
  name: "clickoutside",
224
164
  rawName: "v-clickoutside",
@@ -226,51 +166,54 @@ var __vue_render__ = function __vue_render__() {
226
166
  expression: "clickOutside"
227
167
  }],
228
168
  staticClass: "tiny-mobile-dropdown-item__filter"
229
- }, [_c('div', {
169
+ }, [_c("div", {
230
170
  staticClass: "tiny-mobile-dropdown-item__filter-wrap"
231
- }, _vm._l(_vm.options, function (item, key) {
232
- return _c('div', {
233
- key: key,
171
+ }, _vm._l(_vm.options, function(item, key) {
172
+ return _c("div", {
173
+ key,
234
174
  staticClass: "tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__filter-item"
235
- }, [_c('span', {
175
+ }, [_c("span", {
236
176
  staticClass: "tiny-mobile-dropdown-item__filter-title"
237
- }, [_vm._v(_vm._s(item.title))]), _vm._v(" "), _c('ul', _vm._l(_vm.options.length === 0 ? item.data = [] : item.data, function (tag, tagkey) {
238
- return _c('li', {
177
+ }, [_vm._v(_vm._s(item.title))]), _c("ul", _vm._l(_vm.options.length === 0 ? item.data = [] : item.data, function(tag, tagkey) {
178
+ return _c("li", {
239
179
  key: tagkey,
240
180
  staticClass: "tiny-mobile-dropdown-item__filter-li",
241
- class: [_vm.modelValue[key].indexOf(tag.value) > -1 ? 'checked' : ''],
181
+ class: [_vm.modelValue[key].indexOf(tag.value) > -1 ? "checked" : ""],
242
182
  style: _vm.getOptionStyle(tag, _vm.modelValue[key]),
243
183
  on: {
244
184
  "click": function click($event) {
245
185
  return _vm.tagClick(key, tag, $event);
246
186
  }
247
187
  }
248
- }, [_vm._v("\n " + _vm._s(tag.text) + "\n ")]);
188
+ }, [_vm._v(" " + _vm._s(tag.text) + " ")]);
249
189
  }), 0)]);
250
- }), 0), _vm._v(" "), _c('div', {
190
+ }), 0), _c("div", {
251
191
  staticClass: "tiny-mobile-dropdown-item__filter-operate"
252
- }, [_c('tiny-button', {
192
+ }, [_c("tiny-button", {
253
193
  on: {
254
194
  "click": _vm.reset
255
195
  }
256
- }, [_vm._v("Reset")]), _vm._v(" "), _c('tiny-button', {
196
+ }, [_vm._v(" Reset ")]), _c("tiny-button", {
257
197
  attrs: {
258
198
  "type": "primary"
259
199
  },
260
200
  on: {
261
201
  "click": _vm.confirm
262
202
  }
263
- }, [_vm._v("OK")])], 1)]) : _vm._e()];
203
+ }, [_vm._v(" OK ")])], 1)]) : _vm._e()];
264
204
  })], 2)], 1);
265
205
  };
266
- var __vue_staticRenderFns__ = [];
267
- var __vue_inject_styles__ = undefined;
268
- var __vue_scope_id__ = undefined;
269
- var __vue_module_identifier__ = undefined;
270
- var __vue_is_functional_template__ = false;
271
- var __vue_component__ = normalizeComponent_1({
272
- render: __vue_render__,
273
- staticRenderFns: __vue_staticRenderFns__
274
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
275
-
276
- export { __vue_component__ as default };
206
+ var staticRenderFns = [];
207
+ var __cssModules = {};
208
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
209
+ function __vue2_injectStyles(context) {
210
+ for (var o in __cssModules) {
211
+ this[o] = __cssModules[o];
212
+ }
213
+ }
214
+ var mobile = /* @__PURE__ */ function() {
215
+ return __component__.exports;
216
+ }();
217
+ export {
218
+ mobile as default
219
+ };
package/lib/pc.js CHANGED
@@ -1,148 +1,88 @@
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';
4
- import '@opentiny/vue-theme/dropdown-item/index.css';
5
-
6
- function _toConsumableArray(arr) {
7
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
8
- }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
11
- }
12
- function _iterableToArray(iter) {
13
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
- }
15
- function _unsupportedIterableToArray(o, minLen) {
16
- if (!o) return;
17
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
18
- var n = Object.prototype.toString.call(o).slice(8, -1);
19
- if (n === "Object" && o.constructor) n = o.constructor.name;
20
- if (n === "Map" || n === "Set") return Array.from(o);
21
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
22
- }
23
- function _arrayLikeToArray(arr, len) {
24
- if (len == null || len > arr.length) len = arr.length;
25
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
26
- return arr2;
27
- }
28
- function _nonIterableSpread() {
29
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30
- }
31
-
32
- var script = {
33
- name: $prefix + 'DropdownItem',
34
- componentName: $prefix + 'DropdownItem',
35
- emits: ['item-click'],
36
- props: [].concat(_toConsumableArray(props), ['command', 'disabled', 'divided', 'icon', 'label', 'itemData', 'appendToBody', 'textField']),
37
- components: {
38
- iconDeltaLeft: iconDeltaLeft()
39
- },
40
- setup: function setup$1(props, context) {
41
- return setup({
42
- props: props,
43
- context: context,
44
- renderless: renderless,
45
- api: api
46
- });
1
+ import { defineComponent, $prefix, props, setup as _setup } from "@opentiny/vue-common";
2
+ import { renderless, api } from "@opentiny/vue-renderless/dropdown-item/vue";
3
+ import { iconDeltaLeft } from "@opentiny/vue-icon";
4
+ import "@opentiny/vue-theme/dropdown-item/index.css";
5
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
6
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
7
+ if (render) {
8
+ options.render = render;
9
+ options.staticRenderFns = staticRenderFns;
10
+ options._compiled = true;
11
+ }
12
+ if (functionalTemplate) {
13
+ options.functional = true;
47
14
  }
48
- };
49
-
50
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
51
- /* server only */
52
- , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
53
- if (typeof shadowMode !== 'boolean') {
54
- createInjectorSSR = createInjector;
55
- createInjector = shadowMode;
56
- shadowMode = false;
57
- } // Vue.extend constructor export interop.
58
-
59
-
60
- var options = typeof script === 'function' ? script.options : script; // render functions
61
-
62
- if (template && template.render) {
63
- options.render = template.render;
64
- options.staticRenderFns = template.staticRenderFns;
65
- options._compiled = true; // functional template
66
-
67
- if (isFunctionalTemplate) {
68
- options.functional = true;
69
- }
70
- } // scopedId
71
-
72
-
73
15
  if (scopeId) {
74
- options._scopeId = scopeId;
16
+ options._scopeId = "data-v-" + scopeId;
75
17
  }
76
-
77
18
  var hook;
78
-
79
19
  if (moduleIdentifier) {
80
- // server build
81
- hook = function hook(context) {
82
- // 2.3 injection
20
+ hook = function hook2(context) {
83
21
  context = context || // cached call
84
22
  this.$vnode && this.$vnode.ssrContext || // stateful
85
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
86
- // 2.2 with runInNewContext: true
87
-
88
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
23
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
24
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
89
25
  context = __VUE_SSR_CONTEXT__;
90
- } // inject component styles
91
-
92
-
93
- if (style) {
94
- style.call(this, createInjectorSSR(context));
95
- } // register component module identifier for async chunk inference
96
-
97
-
26
+ }
27
+ if (injectStyles) {
28
+ injectStyles.call(this, context);
29
+ }
98
30
  if (context && context._registeredComponents) {
99
31
  context._registeredComponents.add(moduleIdentifier);
100
32
  }
101
- }; // used by ssr in case component is cached and beforeCreate
102
- // never gets called
103
-
104
-
105
- options._ssrRegister = hook;
106
- } else if (style) {
107
- hook = shadowMode ? function () {
108
- style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
109
- } : function (context) {
110
- style.call(this, createInjector(context));
111
33
  };
34
+ options._ssrRegister = hook;
35
+ } else if (injectStyles) {
36
+ hook = shadowMode ? function() {
37
+ injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
38
+ } : injectStyles;
112
39
  }
113
-
114
40
  if (hook) {
115
41
  if (options.functional) {
116
- // register for functional component in vue file
42
+ options._injectStyles = hook;
117
43
  var originalRender = options.render;
118
-
119
44
  options.render = function renderWithStyleInjection(h, context) {
120
45
  hook.call(context);
121
46
  return originalRender(h, context);
122
47
  };
123
48
  } else {
124
- // inject component registration as beforeCreate hook
125
49
  var existing = options.beforeCreate;
126
50
  options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
127
51
  }
128
52
  }
129
-
130
- return script;
53
+ return {
54
+ exports: scriptExports,
55
+ options
56
+ };
131
57
  }
132
58
 
133
- var normalizeComponent_1 = normalizeComponent;
134
-
135
- var __vue_script__ = script;
136
- var __vue_render__ = function __vue_render__() {
59
+ var __vue2_script = defineComponent({
60
+ name: $prefix + "DropdownItem",
61
+ componentName: $prefix + "DropdownItem",
62
+ emits: ["item-click"],
63
+ props: [].concat(props, ["command", "disabled", "divided", "icon", "label", "itemData", "appendToBody", "textField"]),
64
+ components: {
65
+ IconDeltaLeft: iconDeltaLeft()
66
+ },
67
+ setup: function setup(props2, context) {
68
+ return _setup({
69
+ props: props2,
70
+ context,
71
+ renderless,
72
+ api
73
+ });
74
+ }
75
+ });
76
+ var render = function render2() {
137
77
  var _vm = this;
138
78
  var _h = _vm.$createElement;
139
79
  var _c = _vm._self._c || _h;
140
- return _c('li', {
80
+ return _c("li", {
141
81
  ref: "dropdownItem",
142
82
  staticClass: "tiny-dropdown-menu__item",
143
83
  class: {
144
- 'is-disabled': _vm.disabled,
145
- 'tiny-dropdown-menu__item--divided': _vm.divided
84
+ "is-disabled": _vm.disabled,
85
+ "tiny-dropdown-menu__item--divided": _vm.divided
146
86
  },
147
87
  attrs: {
148
88
  "aria-disabled": _vm.disabled,
@@ -154,21 +94,21 @@ var __vue_render__ = function __vue_render__() {
154
94
  $event.stopPropagation();
155
95
  }
156
96
  }
157
- }, [_vm.itemData.children && _vm.itemData.children.length ? _c('span', {
97
+ }, [_vm.itemData.children && _vm.itemData.children.length ? _c("span", {
158
98
  staticClass: "tiny-dropdown-menu__item-expand"
159
- }, [_c('icon-delta-left')], 1) : _vm._e(), _vm._v(" "), _c('div', {
99
+ }, [_c("icon-delta-left")], 1) : _vm._e(), _c("div", {
160
100
  staticClass: "tiny-dropdown-menu__item-content"
161
101
  }, [_vm.icon ? _c(_vm.icon, {
162
102
  tag: "component",
163
103
  staticClass: "tiny-svg-size"
164
- }) : _vm._e(), _vm._v(" "), _vm._t("default", function () {
165
- return [_c('span', [_vm._v(_vm._s(_vm.label))])];
104
+ }) : _vm._e(), _vm._t("default", function() {
105
+ return [_c("span", [_vm._v(_vm._s(_vm.label))])];
166
106
  }, {
167
107
  "itemData": _vm.itemData
168
- })], 2), _vm._v(" "), _vm.itemData.children && _vm.itemData.children.length ? _c('ul', {
169
- class: ['tiny-dropdown-menu', 'tiny-dropdown-menu__item--child', _vm.state.popperClass]
170
- }, _vm._l(_vm.itemData.children, function (item, index) {
171
- return _c('tiny-dropdown-item', {
108
+ })], 2), _vm.itemData.children && _vm.itemData.children.length ? _c("ul", {
109
+ class: ["tiny-dropdown-menu", "tiny-dropdown-menu__item--child", _vm.state.popperClass]
110
+ }, _vm._l(_vm.itemData.children, function(item, index) {
111
+ return _c("tiny-dropdown-item", {
172
112
  key: index,
173
113
  attrs: {
174
114
  "label": item[_vm.state.textField],
@@ -182,14 +122,17 @@ var __vue_render__ = function __vue_render__() {
182
122
  })], 2);
183
123
  }), 1) : _vm._e()]);
184
124
  };
185
- var __vue_staticRenderFns__ = [];
186
- var __vue_inject_styles__ = undefined;
187
- var __vue_scope_id__ = undefined;
188
- var __vue_module_identifier__ = undefined;
189
- var __vue_is_functional_template__ = false;
190
- var __vue_component__ = normalizeComponent_1({
191
- render: __vue_render__,
192
- staticRenderFns: __vue_staticRenderFns__
193
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
194
-
195
- export { __vue_component__ as default };
125
+ var staticRenderFns = [];
126
+ var __cssModules = {};
127
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
128
+ function __vue2_injectStyles(context) {
129
+ for (var o in __cssModules) {
130
+ this[o] = __cssModules[o];
131
+ }
132
+ }
133
+ var pc = /* @__PURE__ */ function() {
134
+ return __component__.exports;
135
+ }();
136
+ export {
137
+ pc as default
138
+ };
package/package.json CHANGED
@@ -1,22 +1,19 @@
1
1
  {
2
2
  "name": "@opentiny/vue-dropdown-item",
3
- "version": "2.6.0",
3
+ "version": "2.6.1-alpha.1",
4
4
  "description": "",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "lint": "eslint src/**/*{.js,.html,.vue} --quiet",
8
- "build:ui2": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../build/build-ui.js",
9
- "build:ui3": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../example/build/build-ui.js"
10
- },
5
+ "main": "./lib/index.js",
11
6
  "dependencies": {
12
- "@opentiny/vue-common": "~2.6.0",
13
- "@opentiny/vue-icon": "~2.6.0",
14
- "@opentiny/vue-renderless": "~3.6.0",
15
- "@opentiny/vue-popup": "~2.6.0",
16
- "@opentiny/vue-button": "~2.6.0",
17
- "@opentiny/vue-theme": "~3.6.0",
18
- "@opentiny/vue-theme-mobile": "~3.6.0"
7
+ "@opentiny/vue-common": "~2.6.1-alpha.1",
8
+ "@opentiny/vue-icon": "~2.6.1-alpha.1",
9
+ "@opentiny/vue-renderless": "~3.6.1-alpha.1",
10
+ "@opentiny/vue-popup": "~2.6.1-alpha.1",
11
+ "@opentiny/vue-button": "~2.6.1-alpha.1"
19
12
  },
20
13
  "license": "MIT",
21
- "sideEffects": false
14
+ "types": "index.d.ts",
15
+ "scripts": {
16
+ "build": "pnpm -w build:ui $npm_package_name",
17
+ "//postversion": "pnpm build"
18
+ }
22
19
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,82 @@
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>);
82
+ export default _default;
@@ -0,0 +1,26 @@
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>);
26
+ export default _sfc_main;
@@ -0,0 +1,26 @@
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>);
26
+ export default _sfc_main;