Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@dangojs/digitforce-ui-utils

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dangojs/digitforce-ui-utils - npm Package Compare versions

Comparing version
0.0.1
to
0.0.2
+26
-0
dist/index.cjs

@@ -6,2 +6,3 @@ 'use strict';

const vue = require('vue');
const lodashEs = require('lodash-es');

@@ -34,4 +35,29 @@ function isEmptyElement(c) {

const transformComponent = (tag, defaultProps, defaultSlots) => {
return vue.defineComponent({
setup(props, context) {
let { attrs, slots } = context;
return () => {
let data = {
...attrs
};
if (defaultProps) {
data = lodashEs.merge(defaultProps, attrs);
}
if (defaultSlots) {
if (typeof defaultSlots === "function") {
slots = lodashEs.merge(defaultSlots(data, context), slots);
} else {
slots = lodashEs.merge(defaultSlots, slots);
}
}
return vue.h(tag, data, slots);
};
}
});
};
exports.filterEmpty = filterEmpty;
exports.isEmptyElement = isEmptyElement;
exports.transformComponent = transformComponent;
exports.withInstall = withInstall;
+3
-1

@@ -13,2 +13,4 @@ import * as vue from 'vue';

export { filterEmpty, isEmptyElement, withInstall };
declare const transformComponent: <T extends Record<string, any>>(tag: any, defaultProps?: Partial<T> | undefined, defaultSlots?: any) => any;
export { filterEmpty, isEmptyElement, transformComponent, withInstall };

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

import { Comment, Fragment, Text } from 'vue';
import { Comment, Fragment, Text, defineComponent, h } from 'vue';
import { merge } from 'lodash-es';

@@ -29,2 +30,26 @@ function isEmptyElement(c) {

export { filterEmpty, isEmptyElement, withInstall };
const transformComponent = (tag, defaultProps, defaultSlots) => {
return defineComponent({
setup(props, context) {
let { attrs, slots } = context;
return () => {
let data = {
...attrs
};
if (defaultProps) {
data = merge(defaultProps, attrs);
}
if (defaultSlots) {
if (typeof defaultSlots === "function") {
slots = merge(defaultSlots(data, context), slots);
} else {
slots = merge(defaultSlots, slots);
}
}
return h(tag, data, slots);
};
}
});
};
export { filterEmpty, isEmptyElement, transformComponent, withInstall };
{
"name": "@dangojs/digitforce-ui-utils",
"type": "module",
"version": "0.0.1",
"version": "0.0.2",
"description": "UI 组件库的一些帮助方法和函数",

@@ -40,3 +40,3 @@ "author": "Digitforce Team",

"prepublishOnly": "nr build",
"release": "bumpp && npm publish",
"release": "bumpp --tag=false && npm publish",
"start": "esno src/index.ts",

@@ -47,2 +47,3 @@ "test": "vitest",

"dependencies": {
"lodash-es": "^4.17.21",
"vue": "^3.2.37"

@@ -54,2 +55,3 @@ },

"@antfu/utils": "^0.5.2",
"@types/lodash-es": "^4.17.6",
"@types/node": "^18.0.3",

@@ -56,0 +58,0 @@ "bumpp": "^8.2.1",