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

antd-mini

Package Overview
Dependencies
Maintainers
3
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-mini - npm Package Compare versions

Comparing version 0.0.7-alpha.1 to 0.0.7-alpha.2

es/Container/ContainerHeader/index.js

1

es/CheckboxGroup/props.js

@@ -12,4 +12,5 @@ "use strict";

controlled: false,
position: 'vertical',
value: []
};
exports.CheckboxGroupDefaultProps = CheckboxGroupDefaultProps;

@@ -11,8 +11,17 @@ "use strict";

},
deriveDataFromProps: function (nextProps) {
var value = nextProps.value, optionValue = nextProps.optionValue;
if ((0, fast_deep_equal_1.default)(this.props.value, value))
didMount: function () {
var checked = this.getChecked();
this.setData({
checked: checked
});
},
didUpdate: function (prevProps) {
var value = prevProps.value, item = prevProps.item, multiple = prevProps.multiple;
if ((0, fast_deep_equal_1.default)(this.props.value, value) &&
(0, fast_deep_equal_1.default)(this.props.item, item) &&
(0, fast_deep_equal_1.default)(this.props.multiple, multiple))
return;
var checked = this.getChecked();
this.setData({
checked: value.indexOf(optionValue) !== -1 ? true : false
checked: checked
});

@@ -27,17 +36,39 @@ },

});
onChange && onChange.call(this.props, this.getValues(!checked));
var value = this.getValues(!checked);
onChange && onChange.call(this.props, value);
},
getChecked: function () {
var _a = this.props, multiple = _a.multiple, item = _a.item, value = _a.value;
if (!multiple) {
return value === item.value;
}
var valueArr = [];
if (!Array.isArray(value)) {
valueArr = [value];
}
else {
valueArr = value.slice();
}
return valueArr.indexOf(item.value) > -1;
},
getValues: function (checked) {
var _a = this.props, optionValue = _a.optionValue, value = _a.value, multiple = _a.multiple;
var _a = this.props, multiple = _a.multiple, item = _a.item, value = _a.value;
if (!multiple) {
return [optionValue];
return checked ? item.value : '';
}
if (checked && !value.includes(optionValue)) {
return value.concat([optionValue]);
var valueArr = value;
if (!Array.isArray(value)) {
valueArr = [value];
}
else {
return value.filter(function (item) { return item !== optionValue; });
valueArr = value.slice();
}
if (checked && valueArr.indexOf(item.value) === -1) {
return valueArr.concat([item.value]);
}
else {
return valueArr.filter(function (v) { return v !== item.value; });
}
}
},
});

32

es/Checklist/ChecklistItem/props.d.ts
import { IBaseProps } from '../../_base';
import { ChecklistItem } from '../props'

@@ -9,18 +10,2 @@ /**

/**
* @description 当前选项的描述文案
*/
description: string;
/**
* @description 当前选项是否禁用
* @default false
*/
disabled: boolean;
/**
* @description 当前选项的图片
*/
image: string;
/**
* @description 是否支持多选

@@ -31,18 +16,9 @@ * @default false

/**
* @description 当前选项的选项值
* @default ''
*/
optionValue: string | number;
item: ChecklistItem
/**
* @description 当前选项是否只读
* @default false
*/
readOnly: boolean;
/**
* @description 可勾选列表的值
*/
value: Array<string | number>;
value: Array<string | number>| string| number;

@@ -49,0 +25,0 @@ /**

@@ -8,6 +8,5 @@ "use strict";

var ChecklistItemDefaultProps = {
disabled: false,
multiple: false,
readOnly: false
item: {}
};
exports.ChecklistItemDefaultProps = ChecklistItemDefaultProps;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var props_1 = require("./props");
var controlled_1 = tslib_1.__importDefault(require("../mixins/controlled"));
Component({
props: props_1.ChecklistDefaultProps,
data: {
value: []
},
mixins: [(0, controlled_1.default)()],
didMount: function () {
var defaultValue = this.props.defaultValue;
this.setData({
value: defaultValue
});
},
methods: {
onChange: function (v) {
var onChange = this.props.onChange;
var _a = this.props, multiple = _a.multiple, value = _a.value;
if (multiple && !Array.isArray(value)) {
this.setData({
value: v
cValue: []
});
onChange && onChange.call(this.props, v);
}
},
methods: {
onChange: function (value) {
var _a;
var _b = this.props, multiple = _b.multiple, options = _b.options;
var items = null;
if (multiple && Array.isArray(value)) {
items = value.map(function (v) {
var _a;
return (_a = options.filter(function (o) { return o.value === v; })) === null || _a === void 0 ? void 0 : _a[0];
});
}
else {
items = (_a = options.filter(function (o) { return o.value === value; })) === null || _a === void 0 ? void 0 : _a[0];
}
this.cOnChange(value, items);
}
},
});

@@ -7,7 +7,7 @@ import { IBaseProps } from '../_base';

interface ChecklistItem {
export interface ChecklistItem {
/**
* @description 可勾选项的描述文案
*/
description: string;
description?: string;

@@ -17,3 +17,3 @@ /**

*/
image: string;
image?: string;

@@ -36,3 +36,3 @@ /**

*/
defaultValue: Array<string | number>;
value: Array<string | number> | string | number;

@@ -53,5 +53,5 @@ /**

*/
onChange: (v: Array<string | number>) => void;
onChange: (v: Array<string | number>| string| number, item: ChecklistItem| Array<ChecklistItem>) => void;
}
export declare const ChecklistDefaultProps: Partial<IChecklistProps>;

@@ -8,5 +8,6 @@ "use strict";

var ChecklistDefaultProps = {
defaultValue: [],
multiple: false
value: '',
multiple: false,
options: []
};
exports.ChecklistDefaultProps = ChecklistDefaultProps;
{
"component": "true"
"component": true
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var props_1 = require("./props");
var fmtEvent_1 = tslib_1.__importDefault(require("../_util/fmtEvent"));
var console_1 = require("../_util/console");
Component({
props: props_1.ContainerDefaultProps,
didMount: function () {
var _a = this.props, onIconTap = _a.onIconTap, icon = _a.icon;
if (!icon && onIconTap) {
console_1.log.error('Container', '未设置 icon 属性值或者值为空,onIconTap 将无效。');
}
},
methods: {
onIconTap: function (e) {
var onIconTap = this.props.onIconTap;
if (onIconTap) {
var event = (0, fmtEvent_1.default)(this.props, e);
return onIconTap(event);
}
},
},
methods: {},
});
{
"component": true,
"usingComponents": {
"icon": "../Icon/index"
"header": "./ContainerHeader"
}
}

@@ -13,14 +13,16 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

/**
* @description 缩略图 url
* @description 标题缩略图 url
*/
image?: string;
titleImage?: string;
/**
* @description 右侧图标
* @description 容器中有几个盒子,最大值 3
* @default 0
*/
icon?: IconType;
multiBox: number;
/**
* @description 右侧图标点击回调
* @description 标题是否在容器内
* @default true
*/
onIconTap?: (event?: any) => void;
headerInBox: boolean;
}
export declare const ContainerDefaultProps: Partial<IContainerProps>;

@@ -7,3 +7,6 @@ "use strict";

exports.ContainerDefaultProps = void 0;
var ContainerDefaultProps = {};
var ContainerDefaultProps = {
multiBox: 0,
headerInBox: true
};
exports.ContainerDefaultProps = ContainerDefaultProps;

@@ -13,3 +13,3 @@ "use strict";

className: '',
color: '#999',
color: '#fff',
height: '',

@@ -16,0 +16,0 @@ type: 'spin'

@@ -8,8 +8,11 @@ "use strict";

var getFixedValue = function (value, multiple) {
var fixedValue;
if (multiple) {
var fixedValue = [];
if (value === null) {
fixedValue = [];
}
else if (multiple && Array.isArray(value)) {
fixedValue = value;
}
else {
fixedValue = value === null || value === void 0 ? void 0 : value.slice(0, 1);
else if (!Array.isArray(value)) {
fixedValue = [value];
}

@@ -24,6 +27,7 @@ return fixedValue;

onChange: function (e) {
var _a = e.currentTarget.dataset, disabled = _a.disabled, value = _a.value, text = _a.text;
var _b = this.props, multiple = _b.multiple, items = _b.items;
var _a;
var _b = e.currentTarget.dataset, disabled = _b.disabled, value = _b.value;
var _c = this.props, multiple = _c.multiple, items = _c.items;
if (!disabled && !this.props.disabled) {
var nextValue = void 0;
var nextValue_1;
var fixedValue = getFixedValue(this.data.cValue, multiple);

@@ -33,3 +37,3 @@ if (multiple) {

if ((fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.indexOf(value)) !== -1) {
nextValue = fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.filter(function (item) {
nextValue_1 = fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue.filter(function (item) {
return item !== value;

@@ -40,3 +44,3 @@ });

// 之前未选中,增加
nextValue = tslib_1.__spreadArray(tslib_1.__spreadArray([], fixedValue, true), [value], false);
nextValue_1 = tslib_1.__spreadArray(tslib_1.__spreadArray([], fixedValue, true), [value], false);
}

@@ -47,4 +51,5 @@ // 将 value 重新按 options 排序

};
nextValue = sortValue(nextValue);
this.cOnChange(nextValue);
nextValue_1 = sortValue(nextValue_1);
var selectedItems = nextValue_1.map(function (v) { var _a; return (_a = items.filter(function (item) { return item.value === v; })) === null || _a === void 0 ? void 0 : _a[0]; });
this.cOnChange(nextValue_1, selectedItems);
}

@@ -56,9 +61,10 @@ else {

if ((fixedValue === null || fixedValue === void 0 ? void 0 : fixedValue[0]) === value) {
nextValue = '';
nextValue_1 = '';
}
else {
// 选中
nextValue = value;
nextValue_1 = value;
}
this.cOnChange(nextValue, text);
var selectedItem = ((_a = items.filter(function (item) { return item.value === nextValue_1; })) === null || _a === void 0 ? void 0 : _a[0]) || null;
this.cOnChange(nextValue_1, selectedItem);
}

@@ -65,0 +71,0 @@ }

{
"name": "antd-mini",
"version": "0.0.7-alpha.1",
"version": "0.0.7-alpha.2",
"scripts": {
"dev": "minidev dev --less --typescript --no-source-map",
"dev": "minidev dev --no-source-map",
"dev:site": "dumi dev",

@@ -7,0 +7,0 @@ "build": "npm run build:component && npm run build:site",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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