Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentiny/vue-renderless

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentiny/vue-renderless - npm Package Compare versions

Comparing version 3.6.0-alpha.1 to 3.6.0

README.md

5

action-menu/index.js

@@ -10,2 +10,7 @@ export var handleMoreClick = function handleMoreClick(emit) {

};
};
export var visibleChange = function visibleChange(emit) {
return function (status) {
emit('visible-change', status);
};
};

10

action-menu/vue.js

@@ -1,10 +0,12 @@

import { handleMoreClick, handleItemClick } from './index';
export var api = ['state', 'handleMoreClick', 'handleItemClick'];
import { handleMoreClick, handleItemClick, visibleChange } from './index';
export var api = ['state', 'handleMoreClick', 'handleItemClick', 'visibleChange'];
export var renderless = function renderless(props, _ref, _ref2) {
var computed = _ref.computed,
reactive = _ref.reactive;
var emit = _ref2.emit;
var emit = _ref2.emit,
nextTick = _ref2.nextTick;
var api = {
handleMoreClick: handleMoreClick(emit),
handleItemClick: handleItemClick(emit)
handleItemClick: handleItemClick(emit),
visibleChange: visibleChange(emit)
};

@@ -11,0 +13,0 @@ var state = reactive({

7

dropdown-item/vue.js

@@ -0,1 +1,2 @@

import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import { tagClick, confirm, clickOutside, getOptionStyle, reset, getTitle, bindScroll, toggle, onScroll, open, opened, close, closed, clickItem, clickWrapper, getItemStyle, handleClick } from './index';

@@ -113,5 +114,9 @@ export var api = ['state', 'confirm', 'clickOutside', 'getOptionStyle', 'reset', 'tagClick', 'clickItem', 'clickWrapper', 'toggle', 'open', 'opened', 'close', 'closed', 'handleClick'];

vm = _ref4.vm,
dispatch = _ref4.dispatch;
dispatch = _ref4.dispatch,
mode = _ref4.mode;
var api = {};
var dropdownMenu = inject('dropdownMenu', null);
if (mode === 'mobile') {
dropdownMenu.state.children = [].concat(_toConsumableArray(dropdownMenu.state.children), [vm]);
}
parent = parent.$parent;

@@ -118,0 +123,0 @@ var state = initState({

@@ -5,6 +5,8 @@ import { toggleItem, updateOffset, clickOutside, getScroller, useVuePopper } from './index';

var api = {};
var reactive = hooks.reactive;
var reactive = hooks.reactive,
provide = hooks.provide;
var refs = instance.refs,
nextTick = instance.nextTick,
mode = instance.mode;
mode = instance.mode,
vm = instance.vm;
var state = reactive({

@@ -18,2 +20,3 @@ offset: 0,

if (mode === 'mobile') {
provide('dropdownMenu', vm);
nextTick(function () {

@@ -20,0 +23,0 @@ state.scroller = getScroller(refs.menu);

@@ -56,10 +56,12 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

var wheelLevelItems = getWheelLevelItems(state.wheelData, state.defaultSelectedIndexs);
var wheelLevelText = getWheelLevelText(wheelLevelItems, state.defaultSelectedIndexs);
var _getSelected = getSelected(wheelLevelItems, state.defaultSelectedIndexs),
selectedLabels = _getSelected.selectedLabels,
selectedItems = _getSelected.selectedItems;
state.headerInfo[state.headerIndex] = {
isSelected: true,
title: wheelLevelText,
title: selectedLabels,
isUP: false
};
state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
emit('confirm', state.defaultSelectedIndexs, wheelLevelText);
emit('confirm', selectedItems, state.headerIndex, state.defaultSelectedIndexs);
state.showWheel = false;

@@ -82,3 +84,3 @@ };

state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
emit('reset', state.headerIndex);
emit('reset', [], state.headerIndex, state.defaultSelectedIndexs);
state.showWheel = false;

@@ -95,3 +97,3 @@ };

emit = _ref5.emit;
return function (indexs, text) {
return function (indexs, text, item) {
if (indexs.length === 0) {

@@ -113,3 +115,3 @@ state.defaultSelectedIndexs = [-1];

state.defaultSelectedArray[state.headerIndex] = state.defaultSelectedIndexs;
emit('confirm', indexs, text);
emit('confirm', item, state.headerIndex, indexs);
state.showWheel = false;

@@ -119,8 +121,3 @@ };

export var getWheelLevelItems = function getWheelLevelItems(wheelData, newIndexs) {
var level_1 = wheelData.map(function (_ref6) {
var label = _ref6.label;
return {
label: label
};
});
var level_1 = wheelData;
var level_n = getNextLevel([], wheelData, newIndexs, 0);

@@ -145,17 +142,21 @@ var wheelLevelItems = [];

};
export var getWheelLevelText = function getWheelLevelText(wheelLevelItems, selectedIndexs) {
var selectedLabels = [];
export var getSelected = function getSelected(wheelLevelItems, selectedIndexs) {
var selectedItems = [];
wheelLevelItems.forEach(function (levelItem, i) {
var _levelItem$index;
var index = selectedIndexs[i];
if ((_levelItem$index = levelItem[index]) !== null && _levelItem$index !== void 0 && _levelItem$index.label) {
var _levelItem$index2;
selectedLabels.push((_levelItem$index2 = levelItem[index]) === null || _levelItem$index2 === void 0 ? void 0 : _levelItem$index2.label);
if (levelItem[index]) {
selectedItems.push(levelItem[index]);
}
});
return selectedLabels.join(' ');
var selectedLabels = selectedItems.map(function (item) {
return item === null || item === void 0 ? void 0 : item.label;
}).join(' ');
return {
selectedLabels: selectedLabels,
selectedItems: selectedItems
};
};
export var loadDefault = function loadDefault(_ref7) {
var props = _ref7.props,
state = _ref7.state;
export var loadDefault = function loadDefault(_ref6) {
var props = _ref6.props,
state = _ref6.state;
return function (value) {

@@ -162,0 +163,0 @@ var _props$defaultSelecte2, _state$dataSource$sta;

{
"name": "@opentiny/vue-renderless",
"version": "3.6.0-alpha.1",
"description": "@opentiny/vue-renderless",
"version": "3.6.0",
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
"homepage": "https://opentiny.design/tiny-vue",
"repository": {
"type": "git",
"url": ""
"url": "https://github.com/opentiny/tiny-vue-renderless"
},
"keywords": [
"vue",
"Tiny"
"vue3",
"frontend",
"component-library",
"components",
"vue-components",
"opentiny",
"renderless-components",
"headless-components"
],
"author": "Tiny Team",
"author": "OpenTiny Team",
"license": "MIT",

@@ -15,0 +23,0 @@ "sideEffects": false,

@@ -35,9 +35,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

};
export var onTouchmove = function onTouchmove(state) {
export var onTouchmove = function onTouchmove(_ref2) {
var props = _ref2.props,
state = _ref2.state;
return function (event) {
if (event.touches[0].clientY < state.draggposition) {
if (!state.pullUp.pullUpDisabled) {
state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
state.pullUpReplaces = Math.abs(state.translate3d) > state.pullUp.footHeight ? state.loosingText : state.pullUp.pullingUpText;
state.pullDownReplaces = '';
if (props.hasMore) {
state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
state.pullUpReplaces = Math.abs(state.translate3d) > state.pullUp.footHeight ? state.loosingText : state.pullUp.pullingUpText;
state.pullDownReplaces = '';
}
}

@@ -56,6 +60,6 @@ } else {

};
export var onTouchend = function onTouchend(_ref2) {
var api = _ref2.api,
props = _ref2.props,
state = _ref2.state;
export var onTouchend = function onTouchend(_ref3) {
var api = _ref3.api,
props = _ref3.props,
state = _ref3.state;
return function () {

@@ -103,5 +107,5 @@ state.animationDuration = props.animationDuration;

};
export var mountedHandler = function mountedHandler(_ref3) {
var api = _ref3.api,
refs = _ref3.refs;
export var mountedHandler = function mountedHandler(_ref4) {
var api = _ref4.api,
refs = _ref4.refs;
return function () {

@@ -114,5 +118,5 @@ var track = refs.track;

};
export var beforeUnmountHandler = function beforeUnmountHandler(_ref4) {
var api = _ref4.api,
refs = _ref4.refs;
export var beforeUnmountHandler = function beforeUnmountHandler(_ref5) {
var api = _ref5.api,
refs = _ref5.refs;
return function () {

@@ -125,5 +129,5 @@ var track = refs.track;

};
export var handlerModelValue = function handlerModelValue(_ref5) {
var api = _ref5.api,
state = _ref5.state;
export var handlerModelValue = function handlerModelValue(_ref6) {
var api = _ref6.api,
state = _ref6.state;
return function (value, result) {

@@ -130,0 +134,0 @@ state.pullUpLoading = false;

import { mountedHandler, beforeUnmountHandler, handlerModelValue, onTouchstart, onTouchmove, onTouchend, initPullRefresh, clearPullRefresh } from './index';
export var api = ['state'];
export var renderless = function renderless(props, _ref, _ref2) {
var computed = _ref.computed,
var watch = _ref.watch,
onMounted = _ref.onMounted,

@@ -22,2 +22,3 @@ reactive = _ref.reactive,

failedText: '',
noMoreText: '',
pullUp: null,

@@ -31,3 +32,6 @@ pullDown: null,

onTouchstart: onTouchstart(state),
onTouchmove: onTouchmove(state),
onTouchmove: onTouchmove({
props: props,
state: state
}),
onTouchend: onTouchend({

@@ -57,2 +61,10 @@ api: api,

});
watch(function () {
return props.hasMore;
}, function (value) {
if (!value) {
state.noMoreText = t('ui.pullRefresh.noMore');
api.clearPullRefresh();
}
});
onMounted(function () {

@@ -59,0 +71,0 @@ api.mountedHandler({

@@ -108,18 +108,21 @@ import { copyArray } from '@opentiny/vue-renderless/common/object';

return function (value) {
state.isToLeft = true;
var currentValue = props.modelValue.slice();
if (value === 'all') {
state.rightChecked = state.rightData.map(function (item) {
return item[props.props.key];
var change = function change() {
state.isToLeft = true;
var currentValue = props.modelValue.slice();
if (value === 'all') {
state.rightChecked = state.rightData.map(function (item) {
return item[props.props.key];
});
}
state.rightChecked.forEach(function (item) {
var index = currentValue.indexOf(item);
if (index > -1) {
currentValue.splice(index, 1);
}
});
}
state.rightChecked.forEach(function (item) {
var index = currentValue.indexOf(item);
if (index > -1) {
currentValue.splice(index, 1);
}
});
state.rightChecked = state.rightChecked.slice(0);
emit('update:modelValue', currentValue);
emit('change', currentValue, 'left', state.rightChecked);
state.rightChecked = state.rightChecked.slice(0);
emit('update:modelValue', currentValue);
emit('change', currentValue, 'left', state.rightChecked);
};
props.beforeTransfer ? props.beforeTransfer(change) : change();
};

@@ -134,36 +137,39 @@ };

return function (value) {
state.isToLeft = false;
var currentValue = props.modelValue.slice();
var itemsToBeMoved = [];
var key = props.props.key;
if (props.render && props.render.plugin.name === Tree) {
if (!props.treeOp.checkStrictly) {
currentValue = refs.leftPanel.$refs.plugin.getCheckedKeys();
var change = function change() {
state.isToLeft = false;
var currentValue = props.modelValue.slice();
var itemsToBeMoved = [];
var key = props.props.key;
if (props.render && props.render.plugin.name === Tree) {
if (!props.treeOp.checkStrictly) {
currentValue = refs.leftPanel.$refs.plugin.getCheckedKeys();
} else {
state.leftChecked.forEach(function (item) {
return currentValue.indexOf(item) === -1 && currentValue.push(item);
});
}
} else {
state.leftChecked.forEach(function (item) {
return currentValue.indexOf(item) === -1 && currentValue.push(item);
});
if (value === 'all') {
state.leftData.forEach(function (item) {
var itemKey = item[key];
if (props.modelValue.indexOf(itemKey) === -1) {
itemsToBeMoved.push(itemKey);
}
});
state.leftChecked = itemsToBeMoved.slice();
} else {
props.data.forEach(function (item) {
var itemKey = item[key];
if (state.leftChecked.indexOf(itemKey) > -1 && props.modelValue.indexOf(itemKey) === -1) {
itemsToBeMoved.push(itemKey);
}
});
}
currentValue = props.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
}
} else {
if (value === 'all') {
state.leftData.forEach(function (item) {
var itemKey = item[key];
if (props.modelValue.indexOf(itemKey) === -1) {
itemsToBeMoved.push(itemKey);
}
});
state.leftChecked = itemsToBeMoved.slice();
} else {
props.data.forEach(function (item) {
var itemKey = item[key];
if (state.leftChecked.indexOf(itemKey) > -1 && props.modelValue.indexOf(itemKey) === -1) {
itemsToBeMoved.push(itemKey);
}
});
}
currentValue = props.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
}
state.rightDisabled = false;
emit('update:modelValue', currentValue);
emit('change', currentValue, 'right', state.leftChecked);
state.rightDisabled = false;
emit('update:modelValue', currentValue);
emit('change', currentValue, 'right', state.leftChecked);
};
props.beforeTransfer ? props.beforeTransfer(change) : change();
};

@@ -170,0 +176,0 @@ };

@@ -15,8 +15,3 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

state.defaultSelectedIndexs = cloneDeep(props.defaultSelectedIndexs);
var level_1 = state.dataSource.map(function (_ref2) {
var label = _ref2.label;
return {
label: label
};
});
var level_1 = state.dataSource;
var level_n = getNextLevel([], state.dataSource, state.defaultSelectedIndexs, 0);

@@ -40,5 +35,5 @@ if (level_n.length === 0) {

};
export var wheelChanged = function wheelChanged(_ref3) {
var api = _ref3.api,
state = _ref3.state;
export var wheelChanged = function wheelChanged(_ref2) {
var api = _ref2.api,
state = _ref2.state;
return function (newIndexs, oldIndexs) {

@@ -66,6 +61,6 @@ if (newIndexs.length > 1) {

};
export var wheelsTo = function wheelsTo(_ref4) {
var api = _ref4.api,
state = _ref4.state,
nextTick = _ref4.nextTick;
export var wheelsTo = function wheelsTo(_ref3) {
var api = _ref3.api,
state = _ref3.state,
nextTick = _ref3.nextTick;
return function (indexs) {

@@ -87,9 +82,9 @@ nextTick(function () {

};
export var loadWheels = function loadWheels(_ref5) {
var api = _ref5.api,
props = _ref5.props,
state = _ref5.state,
nextTick = _ref5.nextTick,
refs = _ref5.refs;
return function (wheel) {
export var loadWheels = function loadWheels(_ref4) {
var api = _ref4.api,
props = _ref4.props,
state = _ref4.state,
nextTick = _ref4.nextTick,
refs = _ref4.refs;
return function () {
if (state.wheels.length === 0) {

@@ -110,7 +105,7 @@ nextTick(function () {

};
export var createWheelHasFooter = function createWheelHasFooter(_ref6) {
var api = _ref6.api,
state = _ref6.state,
emit = _ref6.emit,
BScroll = _ref6.BScroll;
export var createWheelHasFooter = function createWheelHasFooter(_ref5) {
var api = _ref5.api,
state = _ref5.state,
emit = _ref5.emit,
BScroll = _ref5.BScroll;
return function (wheelWrapper, i) {

@@ -133,12 +128,3 @@ var wheels = state.wheels;

state.prevSelectedIndexs = currentSelectedIndexs;
var selectedLabels = [];
state.pickerData.forEach(function (data, i) {
var _data$index;
var index = currentSelectedIndexs[i];
if ((_data$index = data[index]) !== null && _data$index !== void 0 && _data$index.label) {
var _data$index2;
selectedLabels.push((_data$index2 = data[index]) === null || _data$index2 === void 0 ? void 0 : _data$index2.label);
}
});
emit('change', currentSelectedIndexs, selectedLabels.join(' '));
emit('change', currentSelectedIndexs);
});

@@ -153,6 +139,6 @@ api.wheelsTo(state.defaultSelectedIndexs);

};
export var createWheelNoFooter = function createWheelNoFooter(_ref7) {
var api = _ref7.api,
state = _ref7.state,
BScroll = _ref7.BScroll;
export var createWheelNoFooter = function createWheelNoFooter(_ref6) {
var api = _ref6.api,
state = _ref6.state,
BScroll = _ref6.BScroll;
return function (wheelWrapper) {

@@ -194,6 +180,6 @@ var wheels = state.wheels;

};
export var clickWheelItem = function clickWheelItem(_ref8) {
var api = _ref8.api,
state = _ref8.state,
emit = _ref8.emit;
export var clickWheelItem = function clickWheelItem(_ref7) {
var api = _ref7.api,
state = _ref7.state,
emit = _ref7.emit;
return function (index) {

@@ -204,7 +190,7 @@ api.changeWheelItemStyle(state.pickerData, [index]);

var selectedLabel = rItem === null || rItem === void 0 ? void 0 : rItem.label;
emit('clickWheelItem', [index], selectedLabel);
emit('clickWheelItem', [index], selectedLabel, rItem);
} else {
emit('clickWheelItem', [], '');
emit('clickWheelItem', [], '', []);
}
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc