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

antd-mini

Package Overview
Dependencies
Maintainers
4
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.7 to 0.0.7-alpha.8

es/_util/promisify.js

115

es/Picker/index.js

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

var props_1 = require("./props");
var computed_1 = tslib_1.__importDefault(require("../mixins/computed"));
var mixin_1 = tslib_1.__importDefault(require("../Form/mixin"));
var controlled_1 = tslib_1.__importDefault(require("../mixins/controlled"));
var form_1 = tslib_1.__importDefault(require("../mixins/form"));
var utils_1 = require("./utils");
Component({
mixins: [
(0, mixin_1.default)({
defaultPropsValue: null,
propsTriggerChange: 'onOk',
}),
(0, computed_1.default)(),
],
mixins: [(0, controlled_1.default)(), (0, form_1.default)({ trigger: 'onOk' })],
props: props_1.PickerDefaultProps,

@@ -25,25 +19,49 @@ single: false,

},
tempSelectedIndex: null,
single: false,
isChangingPickerView: false,
didMount: function () {
this.tempSelectedIndex = null;
var _this = this;
var columns = this.getterColumns();
this.setData({
columns: columns
}, function () {
var formatValue = _this.getterFormatText();
var selectedIndex = _this.getterSelectedIndex();
_this.setData({
formatValue: formatValue,
selectedIndex: selectedIndex
});
});
},
didUpdate: function (prevProps, prevData) {
var _a = this.data, visible = _a.visible, columns = _a.columns, cValue = _a.cValue;
var prevColumns = prevData.columns, prevCValue = prevData.cValue;
if (visible) {
if (!(0, fast_deep_equal_1.default)(prevColumns, columns) || !(0, fast_deep_equal_1.default)(prevCValue, cValue)) {
this.tempSelectedIndex = this.getterSelectedIndex();
}
var _this = this;
var cValue = this.data.cValue;
var prevCValue = prevData.cValue;
if (!(0, fast_deep_equal_1.default)(prevProps.data, this.props.data)) {
var newColums = this.getterColumns();
this.setData({
columns: newColums
}, function () {
if (!_this.isChangingPickerView) {
var formatValue = _this.getterFormatText();
var selectedIndex = _this.getterSelectedIndex();
_this.setData({
formatValue: formatValue,
selectedIndex: selectedIndex
});
}
_this.isChangingPickerView = false;
});
}
if (!(0, fast_deep_equal_1.default)(cValue, prevCValue)) {
var selectedIndex = this.getterSelectedIndex();
var formatValue = this.getterFormatText();
this.setData({
selectedIndex: selectedIndex,
formatValue: formatValue
});
}
},
methods: {
computed: function () {
var columns = this.getterColumns();
var formatValue = this.getterFormatText();
var selectedIndex = this.getterSelectedIndex();
return {
formatValue: formatValue,
selectedIndex: selectedIndex,
columns: columns
};
},
getterColumns: function () {

@@ -128,2 +146,3 @@ var columns = [];

this.tempSelectedIndex = selectedIndex;
this.isChangingPickerView = true;
var _a = (0, utils_1.getMatchedItemByIndex)(this.data.columns, this.tempSelectedIndex, this.single), matchedColumn = _a.matchedColumn, matchedValues = _a.matchedValues;

@@ -135,14 +154,34 @@ if (onChange) {

onOk: function () {
var result;
if (this.tempSelectedIndex) {
result = (0, utils_1.getMatchedItemByIndex)(this.data.columns, this.tempSelectedIndex, this.single);
}
else {
result = (0, utils_1.getMatchedItemByValue)(this.data.columns, this.data.cValue, this.single);
}
var matchedColumn = result.matchedColumn, matchedValues = result.matchedValues;
this.triggerChange(matchedValues, matchedColumn);
this.triggerPicker(false);
this.setData({
visible: false,
return tslib_1.__awaiter(this, void 0, void 0, function () {
var result, matchedColumn, matchedValues, isContinue;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.tempSelectedIndex) {
result = (0, utils_1.getMatchedItemByIndex)(this.data.columns, this.tempSelectedIndex, this.single);
}
else {
result = (0, utils_1.getMatchedItemByValue)(this.data.columns, this.data.cValue, this.single);
}
matchedColumn = result.matchedColumn, matchedValues = result.matchedValues;
this.triggerPicker(false);
this.setData({
visible: false,
});
if (!this.props.onBeforeOk) return [3 /*break*/, 2];
return [4 /*yield*/, this.props.onBeforeOk(matchedValues, matchedColumn)];
case 1:
isContinue = _a.sent();
if (!isContinue) {
return [2 /*return*/];
}
_a.label = 2;
case 2:
this.triggerChange(matchedValues, matchedColumn);
if (this.props.onOk) {
this.props.onOk.call(this, matchedValues, matchedColumn);
}
return [2 /*return*/];
}
});
});

@@ -149,0 +188,0 @@ },

@@ -69,3 +69,6 @@ import { IBaseFormItemPropsWithOutFocus } from '../_base';

onTriggerPicker?: (visible) => void;
onBeforeOk?: (value: PickerValue, column:PickerData) => boolean
}
export declare const PickerDefaultProps: Partial<IPickerProps>;

@@ -71,2 +71,3 @@ "use strict";

function getMatchedItemByIndex(columns, selectedIndex, single) {
var _a;
var matchedValues = [];

@@ -84,2 +85,6 @@ var matchedColumn = [];

index = compareValue;
// 当column变化时, selectedIndex有可能不正确
if (((_a = columns === null || columns === void 0 ? void 0 : columns[i]) === null || _a === void 0 ? void 0 : _a[compareValue]) === undefined) {
index = 0;
}
if (index === -1) {

@@ -86,0 +91,0 @@ index = 0;

{
"name": "antd-mini",
"version": "0.0.7-alpha.7",
"version": "0.0.7-alpha.8",
"scripts": {

@@ -5,0 +5,0 @@ "dev": "minidev dev --less --typescript --no-source-map",

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