@opentiny/vue-dropdown-item
Advanced tools
Comparing version 3.6.0 to 3.6.1-alpha.0
@@ -0,0 +0,0 @@ /** |
115
lib/index.js
@@ -1,62 +0,28 @@ | ||
import { $prefix, $props, $setup } from '@opentiny/vue-common'; | ||
import PCTemplate from './pc'; | ||
import MobileTemplate from './mobile'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var template = function template(mode) { | ||
if (process.env.TINY_MODE === 'pc') return PCTemplate;else if (process.env.TINY_MODE === 'mobile') return MobileTemplate;else return mode === 'mobile' ? MobileTemplate : PCTemplate; | ||
import { defineComponent, $prefix, $props, $setup } from "@opentiny/vue-common"; | ||
import PcTemplate from "./pc.js"; | ||
import MobileTemplate from "./mobile.js"; | ||
var template = function template2(mode) { | ||
if ("mobile" === (process.env.TINY_MODE || mode)) | ||
return MobileTemplate; | ||
else | ||
return PcTemplate; | ||
}; | ||
var DropdownItem = { | ||
name: $prefix + 'DropdownItem', | ||
componentName: 'TinyDropdownItem', | ||
props: _objectSpread2(_objectSpread2({}, $props), {}, { | ||
var DropdownItem = defineComponent({ | ||
name: $prefix + "DropdownItem", | ||
componentName: "TinyDropdownItem", | ||
props: _extends({}, $props, { | ||
icon: [String, Object], | ||
@@ -76,11 +42,11 @@ disabled: Boolean, | ||
type: String, | ||
default: 'selection' | ||
default: "selection" | ||
}, | ||
label: { | ||
type: String, | ||
default: '' | ||
default: "" | ||
}, | ||
itemData: { | ||
type: Object, | ||
default: function _default() { | ||
default: function _default2() { | ||
return {}; | ||
@@ -95,3 +61,3 @@ } | ||
type: String, | ||
default: 'label' | ||
default: "label" | ||
} | ||
@@ -101,18 +67,19 @@ }), | ||
return $setup({ | ||
props: props, | ||
context: context, | ||
template: template | ||
props, | ||
context, | ||
template | ||
}); | ||
} | ||
}; | ||
}); | ||
var version = "3.7.0"; | ||
DropdownItem.model = { | ||
prop: 'modelValue', | ||
event: 'update:modelValue' | ||
prop: "modelValue", | ||
event: "update:modelValue" | ||
}; | ||
DropdownItem.install = function (Vue) { | ||
DropdownItem.install = function(Vue) { | ||
Vue.component(DropdownItem.name, DropdownItem); | ||
}; | ||
DropdownItem.version = '3.6.0'; | ||
export { DropdownItem as default }; | ||
DropdownItem.version = version; | ||
export { | ||
DropdownItem as default | ||
}; |
@@ -1,41 +0,59 @@ | ||
import { renderless, api } from '@opentiny/vue-renderless/dropdown-item/vue'; | ||
import { setup, props } from '@opentiny/vue-common'; | ||
import { iconYes } from '@opentiny/vue-icon'; | ||
import Popup from '@opentiny/vue-popup'; | ||
import Button from '@opentiny/vue-button'; | ||
import Clickoutside from '@opentiny/vue-renderless/common/deps/clickoutside'; | ||
import '@opentiny/vue-theme-mobile/dropdown-item/index.css'; | ||
import { resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, withCtx, renderSlot, Fragment, renderList, createElementVNode, createBlock, resolveDynamicComponent, toDisplayString, createCommentVNode, createTextVNode, vShow } from 'vue'; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
import { renderless, api } from "@opentiny/vue-renderless/dropdown-item/vue"; | ||
import { defineComponent, props, setup as _setup } from "@opentiny/vue-common"; | ||
import { iconYes } from "@opentiny/vue-icon"; | ||
import Popup from "@opentiny/vue-popup"; | ||
import Button from "@opentiny/vue-button"; | ||
import Clickoutside from "@opentiny/vue-renderless/common/deps/clickoutside"; | ||
import "@opentiny/vue-theme-mobile/dropdown-item/index.css"; | ||
import { resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, withCtx, renderSlot, Fragment, renderList, createElementVNode, createBlock, resolveDynamicComponent, toDisplayString, createCommentVNode, vShow, createTextVNode } from "vue"; | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (it) | ||
return (it = it.call(o)).next.bind(it); | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) | ||
o = it; | ||
var i = 0; | ||
return function() { | ||
if (i >= o.length) | ||
return { done: true }; | ||
return { done: false, value: o[i++] }; | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
if (!o) | ||
return; | ||
if (typeof o === "string") | ||
return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
if (n === "Object" && o.constructor) | ||
n = o.constructor.name; | ||
if (n === "Map" || n === "Set") | ||
return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
if (len == null || len > arr.length) | ||
len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) | ||
arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
var _export_sfc = function _export_sfc2(sfc, props) { | ||
var target = sfc.__vccOpts || sfc; | ||
for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) { | ||
var _step$value = _step.value, key = _step$value[0], val = _step$value[1]; | ||
target[key] = val; | ||
} | ||
return target; | ||
}; | ||
var script = { | ||
var _sfc_main = /* @__PURE__ */ defineComponent({ | ||
directives: { | ||
Clickoutside: Clickoutside | ||
Clickoutside | ||
}, | ||
props: [].concat(_toConsumableArray(props), ['modelValue', 'title', 'disabled', 'titleClass', 'options', 'icon', 'type']), | ||
props: [].concat(props, ["modelValue", "title", "disabled", "titleClass", "options", "icon", "type"]), | ||
components: { | ||
@@ -46,13 +64,12 @@ IconYes: iconYes(), | ||
}, | ||
emits: ['update:modelValue', 'open', 'opened', 'click', 'change', 'closed', 'close', 'reset', 'confirm', 'item-click'], | ||
setup: function setup$1(props, context) { | ||
return setup({ | ||
props: props, | ||
context: context, | ||
renderless: renderless, | ||
api: api | ||
emits: ["update:modelValue", "open", "opened", "click", "change", "closed", "close", "reset", "confirm", "item-click"], | ||
setup: function setup(props2, context) { | ||
return _setup({ | ||
props: props2, | ||
context, | ||
renderless, | ||
api | ||
}); | ||
} | ||
}; | ||
}); | ||
var _hoisted_1 = { | ||
@@ -86,3 +103,5 @@ key: 0, | ||
}; | ||
function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
var _hoisted_11 = /* @__PURE__ */ createTextVNode(" Reset "); | ||
var _hoisted_12 = /* @__PURE__ */ createTextVNode(" OK "); | ||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { | ||
var _component_icon_yes = resolveComponent("icon-yes"); | ||
@@ -92,87 +111,126 @@ var _component_tiny_button = resolveComponent("tiny-button"); | ||
var _directive_clickoutside = resolveDirective("clickoutside"); | ||
return withDirectives((openBlock(), createElementBlock("div", { | ||
ref: "wrapper", | ||
class: normalizeClass(['tiny-mobile-dropdown-item--' + _ctx.state.direction, "tiny-mobile-dropdown-item"]), | ||
onClick: _cache[1] || (_cache[1] = function () { | ||
return _ctx.clickWrapper && _ctx.clickWrapper.apply(_ctx, arguments); | ||
}), | ||
style: normalizeStyle(_ctx.state.itemStyle) | ||
}, [createVNode(_component_tiny_popup, { | ||
modelValue: _ctx.state.showPopup, | ||
"onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { | ||
return _ctx.state.showPopup = $event; | ||
}), | ||
popupClass: "tiny-mobile-dropdown-item__content", | ||
overlay: _ctx.state.overlay, | ||
"close-on-click-overlay": _ctx.state.closeOnClickOverlay, | ||
closeable: false, | ||
position: _ctx.state.direction === 'down' ? 'top' : 'bottom', | ||
duration: _ctx.state.transition ? _ctx.state.duration : 0, | ||
onOpen: _ctx.open, | ||
onClose: _ctx.close, | ||
onOpened: _ctx.opened, | ||
onClosed: _ctx.closed | ||
}, { | ||
default: withCtx(function () { | ||
return [renderSlot(_ctx.$slots, "default", {}, function () { | ||
return [$props.type === 'selection' ? (openBlock(), createElementBlock("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList($props.options, function (item, index) { | ||
return openBlock(), createElementBlock("div", { | ||
class: normalizeClass(["tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__option", item.value === $props.modelValue ? 'is-active' : '']), | ||
key: index, | ||
tabindex: "0", | ||
onClick: function onClick($event) { | ||
return _ctx.clickItem(item.value); | ||
} | ||
}, [createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "icon", {}, function () { | ||
return [(openBlock(), createBlock(resolveDynamicComponent($props.icon)))]; | ||
})]), createElementVNode("div", _hoisted_4, [renderSlot(_ctx.$slots, "title", { | ||
titleData: item | ||
}, function () { | ||
return [createElementVNode("span", { | ||
style: normalizeStyle({ | ||
color: item.value === $props.modelValue && _ctx.state.activeColor ? _ctx.state.activeColor : '' | ||
}) | ||
}, toDisplayString(item.text), 5)]; | ||
})]), createElementVNode("div", _hoisted_5, [item.value === $props.modelValue ? (openBlock(), createBlock(_component_icon_yes, { | ||
key: 0, | ||
fill: _ctx.state.activeColor ? _ctx.state.activeColor : '#f36f64' | ||
}, null, 8, ["fill"])) : createCommentVNode("", true)])], 10, _hoisted_2); | ||
}), 128))])) : createCommentVNode("", true), $props.type === 'filter' ? withDirectives((openBlock(), createElementBlock("div", _hoisted_6, [createElementVNode("div", _hoisted_7, [(openBlock(true), createElementBlock(Fragment, null, renderList($props.options, function (item, key) { | ||
return openBlock(), createElementBlock("div", { | ||
key: key, | ||
class: "tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__filter-item" | ||
}, [createElementVNode("span", _hoisted_8, toDisplayString(item.title), 1), createElementVNode("ul", null, [(openBlock(true), createElementBlock(Fragment, null, renderList($props.options.length === 0 ? item.data = [] : item.data, function (tag, tagkey) { | ||
return openBlock(), createElementBlock("li", { | ||
class: normalizeClass(["tiny-mobile-dropdown-item__filter-li", [$props.modelValue[key].indexOf(tag.value) > -1 ? 'checked' : '']]), | ||
style: normalizeStyle(_ctx.getOptionStyle(tag, $props.modelValue[key])), | ||
onClick: function onClick($event) { | ||
return _ctx.tagClick(key, tag, $event); | ||
}, | ||
key: tagkey | ||
}, toDisplayString(tag.text), 15, _hoisted_9); | ||
}), 128))])]); | ||
}), 128))]), createElementVNode("div", _hoisted_10, [createVNode(_component_tiny_button, { | ||
onClick: _ctx.reset | ||
}, { | ||
default: withCtx(function () { | ||
return [createTextVNode("Reset")]; | ||
}), | ||
_: 1 | ||
}, 8, ["onClick"]), createVNode(_component_tiny_button, { | ||
type: "primary", | ||
onClick: _ctx.confirm | ||
}, { | ||
default: withCtx(function () { | ||
return [createTextVNode("OK")]; | ||
}), | ||
_: 1 | ||
}, 8, ["onClick"])])])), [[_directive_clickoutside, _ctx.clickOutside]]) : createCommentVNode("", true)]; | ||
})]; | ||
}), | ||
_: 3 | ||
}, 8, ["modelValue", "overlay", "close-on-click-overlay", "position", "duration", "onOpen", "onClose", "onOpened", "onClosed"])], 6)), [[vShow, _ctx.state.showWrapper]]); | ||
return withDirectives((openBlock(), createElementBlock( | ||
"div", | ||
{ | ||
ref: "wrapper", | ||
class: normalizeClass(["tiny-mobile-dropdown-item--" + _ctx.state.direction, "tiny-mobile-dropdown-item"]), | ||
onClick: _cache[1] || (_cache[1] = function() { | ||
return _ctx.clickWrapper && _ctx.clickWrapper.apply(_ctx, arguments); | ||
}), | ||
style: normalizeStyle(_ctx.state.itemStyle) | ||
}, | ||
[createVNode(_component_tiny_popup, { | ||
modelValue: _ctx.state.showPopup, | ||
"onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) { | ||
return _ctx.state.showPopup = $event; | ||
}), | ||
"popup-class": "tiny-mobile-dropdown-item__content", | ||
overlay: _ctx.state.overlay, | ||
"close-on-click-overlay": _ctx.state.closeOnClickOverlay, | ||
closeable: false, | ||
position: _ctx.state.direction === "down" ? "top" : "bottom", | ||
duration: _ctx.state.transition ? _ctx.state.duration : 0, | ||
onOpen: _ctx.open, | ||
onClose: _ctx.close, | ||
onOpened: _ctx.opened, | ||
onClosed: _ctx.closed | ||
}, { | ||
default: withCtx(function() { | ||
return [renderSlot(_ctx.$slots, "default", {}, function() { | ||
return [_ctx.type === "selection" ? (openBlock(), createElementBlock("div", _hoisted_1, [(openBlock(true), createElementBlock( | ||
Fragment, | ||
null, | ||
renderList(_ctx.options, function(item, index) { | ||
return openBlock(), createElementBlock("div", { | ||
class: normalizeClass(["tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__option", item.value === _ctx.modelValue ? "is-active" : ""]), | ||
key: index, | ||
tabindex: "0", | ||
onClick: function onClick($event) { | ||
return _ctx.clickItem(item.value); | ||
} | ||
}, [createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "icon", {}, function() { | ||
return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))]; | ||
})]), createElementVNode("div", _hoisted_4, [renderSlot(_ctx.$slots, "title", { | ||
titleData: item | ||
}, function() { | ||
return [createElementVNode( | ||
"span", | ||
{ | ||
style: normalizeStyle({ | ||
color: item.value === _ctx.modelValue && _ctx.state.activeColor ? _ctx.state.activeColor : "" | ||
}) | ||
}, | ||
toDisplayString(item.text), | ||
5 | ||
/* TEXT, STYLE */ | ||
)]; | ||
})]), createElementVNode("div", _hoisted_5, [item.value === _ctx.modelValue ? (openBlock(), createBlock(_component_icon_yes, { | ||
key: 0, | ||
fill: _ctx.state.activeColor ? _ctx.state.activeColor : "#f36f64" | ||
}, null, 8, ["fill"])) : createCommentVNode("v-if", true)])], 10, _hoisted_2); | ||
}), | ||
128 | ||
/* KEYED_FRAGMENT */ | ||
))])) : createCommentVNode("v-if", true), _ctx.type === "filter" ? withDirectives((openBlock(), createElementBlock("div", _hoisted_6, [createElementVNode("div", _hoisted_7, [(openBlock(true), createElementBlock( | ||
Fragment, | ||
null, | ||
renderList(_ctx.options, function(item, key) { | ||
return openBlock(), createElementBlock("div", { | ||
key, | ||
class: "tiny-mobile-dropdown-item__cell tiny-mobile-dropdown-item__filter-item" | ||
}, [createElementVNode( | ||
"span", | ||
_hoisted_8, | ||
toDisplayString(item.title), | ||
1 | ||
/* TEXT */ | ||
), createElementVNode("ul", null, [(openBlock(true), createElementBlock( | ||
Fragment, | ||
null, | ||
renderList(_ctx.options.length === 0 ? item.data = [] : item.data, function(tag, tagkey) { | ||
return openBlock(), createElementBlock("li", { | ||
class: normalizeClass(["tiny-mobile-dropdown-item__filter-li", [_ctx.modelValue[key].indexOf(tag.value) > -1 ? "checked" : ""]]), | ||
style: normalizeStyle(_ctx.getOptionStyle(tag, _ctx.modelValue[key])), | ||
onClick: function onClick($event) { | ||
return _ctx.tagClick(key, tag, $event); | ||
}, | ||
key: tagkey | ||
}, toDisplayString(tag.text), 15, _hoisted_9); | ||
}), | ||
128 | ||
/* KEYED_FRAGMENT */ | ||
))])]); | ||
}), | ||
128 | ||
/* KEYED_FRAGMENT */ | ||
))]), createElementVNode("div", _hoisted_10, [createVNode(_component_tiny_button, { | ||
onClick: _ctx.reset | ||
}, { | ||
default: withCtx(function() { | ||
return [_hoisted_11]; | ||
}), | ||
_: 1 | ||
/* STABLE */ | ||
}, 8, ["onClick"]), createVNode(_component_tiny_button, { | ||
type: "primary", | ||
onClick: _ctx.confirm | ||
}, { | ||
default: withCtx(function() { | ||
return [_hoisted_12]; | ||
}), | ||
_: 1 | ||
/* STABLE */ | ||
}, 8, ["onClick"])])])), [[_directive_clickoutside, _ctx.clickOutside]]) : createCommentVNode("v-if", true)]; | ||
})]; | ||
}), | ||
_: 3 | ||
/* FORWARDED */ | ||
}, 8, ["modelValue", "overlay", "close-on-click-overlay", "position", "duration", "onOpen", "onClose", "onOpened", "onClosed"])], | ||
6 | ||
/* CLASS, STYLE */ | ||
)), [[vShow, _ctx.state.showWrapper]]); | ||
} | ||
script.render = render; | ||
export { script as default }; | ||
var mobile = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); | ||
export { | ||
mobile as default | ||
}; |
210
lib/pc.js
@@ -1,80 +0,68 @@ | ||
import { $prefix, setup, props } from '@opentiny/vue-common'; | ||
import { renderless, api } from '@opentiny/vue-renderless/dropdown-item/vue'; | ||
import { iconDeltaLeft } from '@opentiny/vue-icon'; | ||
import { resolveComponent, openBlock, createElementBlock, normalizeClass, withModifiers, createVNode, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, renderSlot, toDisplayString, Fragment, renderList, withCtx } from 'vue'; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
import { defineComponent, $prefix, props, setup as _setup } from "@opentiny/vue-common"; | ||
import { renderless, api } from "@opentiny/vue-renderless/dropdown-item/vue"; | ||
import { iconDeltaLeft } from "@opentiny/vue-icon"; | ||
import "@opentiny/vue-theme/dropdown-item/index.css"; | ||
import { resolveComponent, openBlock, createElementBlock, normalizeClass, withModifiers, createVNode, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, renderSlot, toDisplayString, Fragment, renderList, withCtx } from "vue"; | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (it) | ||
return (it = it.call(o)).next.bind(it); | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) | ||
o = it; | ||
var i = 0; | ||
return function() { | ||
if (i >= o.length) | ||
return { done: true }; | ||
return { done: false, value: o[i++] }; | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
if (!o) | ||
return; | ||
if (typeof o === "string") | ||
return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
if (n === "Object" && o.constructor) | ||
n = o.constructor.name; | ||
if (n === "Map" || n === "Set") | ||
return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
if (len == null || len > arr.length) | ||
len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) | ||
arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
var _export_sfc = function _export_sfc2(sfc, props) { | ||
var target = sfc.__vccOpts || sfc; | ||
for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) { | ||
var _step$value = _step.value, key = _step$value[0], val = _step$value[1]; | ||
target[key] = val; | ||
} | ||
return target; | ||
}; | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css_248z = "[class*=tiny-] li.tiny-dropdown-menu__item{--ti-dropdown-menu-item-hover-bg-color:var(--ti-base-color-hover-background);--ti-dropdown-menu-item-hover-text-color:var(--ti-base-color-brand-6);--ti-dropdown-menu-item-active-bg-color:var(--ti-base-color-brand-6);--ti-dropdown-menu-item-active-text-color:var(--ti-base-color-white);--ti-dropdown-menu-item-disabled-text-color:var(--ti-common-color-text-disabled);--ti-dropdown-menu-item-text-color:#333;--ti-dropdown-menu-item-height:1.5;--ti-dropdown-menu-item-padding-vertical:6px;--ti-dropdown-menu-item-padding-horizontal:20px;--ti-dropdown-menu-item-border-radius:0;--ti-dropdown-menu-item-max-width:130px;--ti-dropdown-menu-item-divided-bg-color:var(--ti-base-color-white);--ti-dropdown-menu-item-divided-margin-top:var(--ti-common-space-base);list-style:none;line-height:var(--ti-dropdown-menu-item-height);padding:var(--ti-dropdown-menu-item-padding-vertical) var(--ti-dropdown-menu-item-padding-horizontal);margin:0;font-size:var(--ti-common-font-size-base);color:var(--ti-dropdown-menu-item-text-color);cursor:pointer;outline:0;position:relative;word-break:break-all;max-width:var(--ti-dropdown-menu-item-max-width);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}[class*=tiny-] li.tiny-dropdown-menu__item .tiny-dropdown-menu__item--child{position:absolute;right:100%;top:0;display:none}[class*=tiny-] li.tiny-dropdown-menu__item:focus,[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):hover{background-color:var(--ti-dropdown-menu-item-hover-bg-color);color:var(--ti-dropdown-menu-item-hover-text-color);border-radius:var(--ti-dropdown-menu-item-border-radius)}[class*=tiny-] li.tiny-dropdown-menu__item:focus>.tiny-dropdown-menu__item-content svg,[class*=tiny-] li.tiny-dropdown-menu__item:focus>.tiny-dropdown-menu__item-expand svg,[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):hover>.tiny-dropdown-menu__item-content svg,[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):hover>.tiny-dropdown-menu__item-expand svg{fill:var(--ti-dropdown-menu-item-hover-text-color)}[class*=tiny-] li.tiny-dropdown-menu__item:focus>.tiny-dropdown-menu__item--child,[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):hover>.tiny-dropdown-menu__item--child{display:block}[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):active{background-color:var(--ti-dropdown-menu-item-active-bg-color);color:var(--ti-dropdown-menu-item-active-text-color);border-radius:var(--ti-dropdown-menu-item-border-radius)}[class*=tiny-] li.tiny-dropdown-menu__item:not(.is-disabled):active svg{fill:var(--ti-dropdown-menu-item-active-text-color)}[class*=tiny-] li.tiny-dropdown-menu__item svg{margin-right:5px;margin-top:-2px}[class*=tiny-] li.tiny-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--ti-dropdown-menu-item-disabled-text-color)}[class*=tiny-] li.tiny-dropdown-menu__item .tiny-dropdown-menu__item-expand{display:inline-block;height:100%;margin-left:-20px;width:20px}[class*=tiny-] li.tiny-dropdown-menu__item .tiny-dropdown-menu__item-expand .tiny-svg{width:.6em;height:.6em;margin-left:5px}.tiny-dropdown-menu__item--divided{position:relative;margin-top:6px;border-top:1px solid #e4e7ed}.tiny-dropdown-menu__item--divided:before{height:6px;display:block;margin:0 -20px;background-color:var(--ti-dropdown-menu-item-divided-bg-color)}"; | ||
styleInject(css_248z); | ||
var script = { | ||
name: $prefix + 'DropdownItem', | ||
componentName: $prefix + 'DropdownItem', | ||
emits: ['item-click'], | ||
props: [].concat(_toConsumableArray(props), ['command', 'disabled', 'divided', 'icon', 'label', 'itemData', 'appendToBody', 'textField']), | ||
var _sfc_main = /* @__PURE__ */ defineComponent({ | ||
name: $prefix + "DropdownItem", | ||
componentName: $prefix + "DropdownItem", | ||
emits: ["item-click"], | ||
props: [].concat(props, ["command", "disabled", "divided", "icon", "label", "itemData", "appendToBody", "textField"]), | ||
components: { | ||
iconDeltaLeft: iconDeltaLeft() | ||
IconDeltaLeft: iconDeltaLeft() | ||
}, | ||
setup: function setup$1(props, context) { | ||
return setup({ | ||
props: props, | ||
context: context, | ||
renderless: renderless, | ||
api: api | ||
setup: function setup(props2, context) { | ||
return _setup({ | ||
props: props2, | ||
context, | ||
renderless, | ||
api | ||
}); | ||
} | ||
}; | ||
}); | ||
var _hoisted_1 = ["aria-disabled", "tabindex"]; | ||
@@ -88,3 +76,3 @@ var _hoisted_2 = { | ||
}; | ||
function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { | ||
var _component_icon_delta_left = resolveComponent("icon-delta-left"); | ||
@@ -94,43 +82,63 @@ var _component_tiny_dropdown_item = resolveComponent("tiny-dropdown-item"); | ||
class: normalizeClass(["tiny-dropdown-menu__item", { | ||
'is-disabled': $props.disabled, | ||
'tiny-dropdown-menu__item--divided': $props.divided | ||
"is-disabled": _ctx.disabled, | ||
"tiny-dropdown-menu__item--divided": _ctx.divided | ||
}]), | ||
ref: "dropdownItem", | ||
onClick: _cache[0] || (_cache[0] = function () { | ||
onClick: _cache[0] || (_cache[0] = function() { | ||
return _ctx.handleClick && _ctx.handleClick.apply(_ctx, arguments); | ||
}), | ||
onMousedown: _cache[1] || (_cache[1] = withModifiers(function () {}, ["stop"])), | ||
"aria-disabled": $props.disabled, | ||
tabindex: $props.disabled ? null : -1 | ||
}, [$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), { | ||
onMousedown: _cache[1] || (_cache[1] = withModifiers(function() { | ||
}, ["stop"])), | ||
"aria-disabled": _ctx.disabled, | ||
tabindex: _ctx.disabled ? null : -1 | ||
}, [_ctx.itemData.children && _ctx.itemData.children.length ? (openBlock(), createElementBlock("span", _hoisted_2, [createVNode(_component_icon_delta_left)])) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_3, [_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { | ||
key: 0, | ||
class: "tiny-svg-size" | ||
})) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default", { | ||
itemData: $props.itemData | ||
}, function () { | ||
return [createElementVNode("span", null, toDisplayString($props.label), 1)]; | ||
})]), $props.itemData.children && $props.itemData.children.length ? (openBlock(), createElementBlock("ul", { | ||
key: 1, | ||
class: normalizeClass(['tiny-dropdown-menu', 'tiny-dropdown-menu__item--child', _ctx.state.popperClass]) | ||
}, [(openBlock(true), createElementBlock(Fragment, null, renderList($props.itemData.children, function (item, index) { | ||
return openBlock(), createBlock(_component_tiny_dropdown_item, { | ||
key: index, | ||
label: item[_ctx.state.textField], | ||
itemData: item, | ||
icon: item.icon, | ||
disabled: item.disabled, | ||
divided: item.divided | ||
}, { | ||
default: withCtx(function () { | ||
return [renderSlot(_ctx.$slots, "default", { | ||
itemData: item | ||
})]; | ||
})) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", { | ||
itemData: _ctx.itemData | ||
}, function() { | ||
return [createElementVNode( | ||
"span", | ||
null, | ||
toDisplayString(_ctx.label), | ||
1 | ||
/* TEXT */ | ||
)]; | ||
})]), _ctx.itemData.children && _ctx.itemData.children.length ? (openBlock(), createElementBlock( | ||
"ul", | ||
{ | ||
key: 1, | ||
class: normalizeClass(["tiny-dropdown-menu", "tiny-dropdown-menu__item--child", _ctx.state.popperClass]) | ||
}, | ||
[(openBlock(true), createElementBlock( | ||
Fragment, | ||
null, | ||
renderList(_ctx.itemData.children, function(item, index) { | ||
return openBlock(), createBlock(_component_tiny_dropdown_item, { | ||
key: index, | ||
label: item[_ctx.state.textField], | ||
itemData: item, | ||
icon: item.icon, | ||
disabled: item.disabled, | ||
divided: item.divided | ||
}, { | ||
default: withCtx(function() { | ||
return [renderSlot(_ctx.$slots, "default", { | ||
itemData: item | ||
})]; | ||
}), | ||
_: 2 | ||
/* DYNAMIC */ | ||
}, 1032, ["label", "itemData", "icon", "disabled", "divided"]); | ||
}), | ||
_: 2 | ||
}, 1032, ["label", "itemData", "icon", "disabled", "divided"]); | ||
}), 128))], 2)) : createCommentVNode("", true)], 42, _hoisted_1); | ||
128 | ||
/* KEYED_FRAGMENT */ | ||
))], | ||
2 | ||
/* CLASS */ | ||
)) : createCommentVNode("v-if", true)], 42, _hoisted_1); | ||
} | ||
script.render = render; | ||
export { script as default }; | ||
var pc = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); | ||
export { | ||
pc as default | ||
}; |
{ | ||
"name": "@opentiny/vue-dropdown-item", | ||
"version": "3.6.0", | ||
"version": "3.6.1-alpha.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"lint": "eslint src/**/*{.js,.html,.vue} --quiet", | ||
"build:ui2": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../build/build-ui.js", | ||
"build:ui3": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../example/build/build-ui.js" | ||
}, | ||
"main": "./lib/index.js", | ||
"dependencies": { | ||
"@opentiny/vue-common": "~3.6.0", | ||
"@opentiny/vue-icon": "~3.6.0", | ||
"@opentiny/vue-renderless": "~3.6.0", | ||
"@opentiny/vue-popup": "~3.6.0", | ||
"@opentiny/vue-button": "~3.6.0", | ||
"@opentiny/vue-theme": "~3.6.0", | ||
"@opentiny/vue-theme-mobile": "~3.6.0" | ||
"@opentiny/vue-common": "~3.6.1-alpha.0", | ||
"@opentiny/vue-icon": "~3.6.1-alpha.0", | ||
"@opentiny/vue-renderless": "~3.6.1-alpha.0", | ||
"@opentiny/vue-popup": "~3.6.1-alpha.0", | ||
"@opentiny/vue-button": "~3.6.1-alpha.0" | ||
}, | ||
"license": "MIT", | ||
"types": "index.d.ts", | ||
"sideEffects": false | ||
"scripts": { | ||
"build": "pnpm -w build:ui $npm_package_name", | ||
"//postversion": "pnpm build" | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
declare const _default: import("vue").DefineComponent<{ | ||
icon: (ObjectConstructor | StringConstructor)[]; | ||
declare const _default: import("@vue/runtime-core").DefineComponent<{ | ||
icon: (StringConstructor | ObjectConstructor)[]; | ||
disabled: BooleanConstructor; | ||
@@ -16,4 +16,22 @@ divided: BooleanConstructor; | ||
}; | ||
}, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{ | ||
icon: (ObjectConstructor | StringConstructor)[]; | ||
label: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
itemData: { | ||
type: ObjectConstructor; | ||
default: () => {}; | ||
}; | ||
appendToBody: { | ||
type: BooleanConstructor; | ||
default: boolean; | ||
}; | ||
textField: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { | ||
[key: string]: any; | ||
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{ | ||
icon: (StringConstructor | ObjectConstructor)[]; | ||
disabled: BooleanConstructor; | ||
@@ -32,8 +50,28 @@ divided: BooleanConstructor; | ||
}; | ||
label: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
itemData: { | ||
type: ObjectConstructor; | ||
default: () => {}; | ||
}; | ||
appendToBody: { | ||
type: BooleanConstructor; | ||
default: boolean; | ||
}; | ||
textField: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}>>, { | ||
type: string; | ||
disabled: boolean; | ||
textField: string; | ||
label: string; | ||
options: unknown[]; | ||
divided: boolean; | ||
itemData: Record<string, any>; | ||
appendToBody: boolean; | ||
}>; | ||
export default _default; |
@@ -1,22 +0,2 @@ | ||
import '@opentiny/vue-theme-mobile/dropdown-item/index.css'; | ||
declare const _default: { | ||
directives: { | ||
Clickoutside: any; | ||
}; | ||
props: string[]; | ||
components: { | ||
IconYes: any; | ||
TinyPopup: any; | ||
TinyButton: any; | ||
}; | ||
emits: string[]; | ||
setup(props: any, context: any): { | ||
t: any; | ||
vm: any; | ||
f: (props: any, attrs?: {}) => {}; | ||
a: (attrs: any, filters: any, include: any) => {}; | ||
d: (props: any) => void; | ||
dp: (props: any) => void; | ||
}; | ||
}; | ||
export default _default; | ||
declare const _sfc_main: import("@vue/runtime-core").DefineComponent<unknown, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<unknown>, {}>; | ||
export default _sfc_main; |
@@ -1,13 +0,17 @@ | ||
import '@opentiny/vue-theme/dropdown-item/index.css'; | ||
declare const _default: { | ||
props: string[]; | ||
setup(props: any, context: any): { | ||
t: any; | ||
vm: any; | ||
f: (props: any, attrs?: {}) => {}; | ||
a: (attrs: any, filters: any, include: any) => {}; | ||
d: (props: any) => void; | ||
dp: (props: any) => void; | ||
}; | ||
}; | ||
export default _default; | ||
declare const _sfc_main: import("@vue/runtime-core").DefineComponent<Readonly<{ | ||
[x: string]: any; | ||
}>, { | ||
t: (this: any, path: any, options?: any) => any; | ||
vm: any; | ||
f: (props: any, attrs?: {}) => {}; | ||
a: (attrs: any, filters: any, include: any) => {}; | ||
d: (props: any) => void; | ||
dp: (props: any) => void; | ||
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "item-click"[], "item-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{ | ||
[x: string]: any; | ||
}>>> & { | ||
"onItem-click"?: ((...args: any[]) => any) | undefined; | ||
}, { | ||
[x: string]: any; | ||
}>; | ||
export default _sfc_main; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
5
566
2
22282
2
1