antd-mini
Advanced tools
Comparing version 2.29.3 to 2.29.4
import dayjs from 'dayjs'; | ||
import { useEvent, useState, useMemo } from 'functional-mini/component'; | ||
import { useEvent, useState, useEffect, useMemo } from 'functional-mini/component'; | ||
import '../_util/assert-component2'; | ||
@@ -61,6 +61,18 @@ import { mountComponent } from '../_util/component'; | ||
var _d = useState({ | ||
visible: false, | ||
value: [], | ||
columns: [], | ||
}), _e = _d[0], visible = _e.visible, value = _e.value, columns = _e.columns, setState = _d[1]; | ||
}), _e = _d[0], value = _e.value, columns = _e.columns, setState = _d[1]; | ||
var _f = useMixState(props.defaultVisible, { | ||
value: props.visible, | ||
}), visible = _f[0], updateVisible = _f[1].update; | ||
useEffect(function () { | ||
setTimeout(function () { | ||
if (visible) { | ||
updateDateColumnsAndValue(true); | ||
} | ||
else { | ||
updateDateColumnsAndValue(false); | ||
} | ||
}); | ||
}, [visible]); | ||
function generateData(currentValue, currentProps) { | ||
@@ -99,4 +111,3 @@ var precision = currentProps.precision, propsMin = currentProps.min, propsMax = currentProps.max; | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
function updateDateColumnsAndValue(visible) { | ||
if (visible) { | ||
@@ -108,3 +119,2 @@ var currentValue = getCurrentValueWithCValue(props); | ||
columns: newColumns, | ||
visible: true, | ||
}); | ||
@@ -116,5 +126,13 @@ } | ||
columns: [], | ||
visible: false, | ||
}); | ||
} | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
updateVisible(true); | ||
} | ||
else { | ||
updateVisible(false); | ||
} | ||
triggerEvent('visibleChange', visible, {}); | ||
@@ -139,3 +157,2 @@ }); | ||
setState({ | ||
visible: true, | ||
columns: newColumns, | ||
@@ -169,2 +186,5 @@ value: selectedIndex, | ||
return { | ||
state: { | ||
visible: visible | ||
}, | ||
formattedValueText: formattedValueText, | ||
@@ -171,0 +191,0 @@ currentValue: visible ? value : realValue, |
@@ -52,2 +52,4 @@ --- | ||
| value | 选中的时间 | Date | - | | ||
| visible | 是否显示 | boolean | false | | ||
| defaultVisible | 默认是否显示 | boolean | false | | ||
| onOk | 点击确定按钮,触发回调 | (date: Date, dateStr: string, event: [Event](https://opendocs.alipay.com/mini/framework/event-object)) => void | - | | ||
@@ -54,0 +56,0 @@ | onCancel | 点击取消按钮/蒙层,触发回调 | (event: [Event](https://opendocs.alipay.com/mini/framework/event-object)) => void | - | |
@@ -10,2 +10,4 @@ export var DatePickerDefaultProps = { | ||
export var DatePickerFunctionalProps = { | ||
visible: null, | ||
defaultVisible: null, | ||
animationType: 'transform', | ||
@@ -12,0 +14,0 @@ format: 'YYYY/MM/DD', |
@@ -10,3 +10,3 @@ import { useState, useEvent, useMemo } from 'functional-mini/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
var RangePicker = function (props) { | ||
@@ -63,3 +63,4 @@ var _a = useMixState(props.defaultValue, { | ||
var formattedValueText = onFormat(realValue); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -66,0 +67,0 @@ var state = init(realValue); |
@@ -6,3 +6,3 @@ import { useEvent, useMemo, useState } from 'functional-mini/component'; | ||
import { useMixState } from '../../_util/hooks/useMixState'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
import { CascaderFunctionalProps } from './props'; | ||
@@ -75,3 +75,4 @@ import { defaultFormat, getterColumns, getValidValue } from './utils'; | ||
}, [realValue]); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -78,0 +79,0 @@ var newColumns = getterColumns(realValue, props.options); |
@@ -53,2 +53,4 @@ --- | ||
| value | 选中的值 | string \| number \| Array\<string \| number\> | - | | ||
| visible | 是否显示 | boolean | false | | ||
| defaultVisible | 默认是否显示 | boolean | false | | ||
| onOk | 点击确定按钮,触发回调 | (value: [PickerColumnItem](#pickercolumnitem), column: [PickerColumnItem](#pickercolumnitem), event: [Event](https://opendocs.alipay.com/mini/framework/event-object)) => void | - | | ||
@@ -55,0 +57,0 @@ | onCancel | 点击取消按钮/蒙层,触发回调 | (event: [Event](https://opendocs.alipay.com/mini/framework/event-object)) => void | - | |
import dayjs from 'dayjs'; | ||
import { useEvent, useState, useMemo } from 'functional-mini/component'; | ||
import { useEvent, useState, useEffect, useMemo } from 'functional-mini/component'; | ||
import '../_util/assert-component2'; | ||
@@ -61,6 +61,18 @@ import { mountComponent } from '../_util/component'; | ||
var _d = useState({ | ||
visible: false, | ||
value: [], | ||
columns: [], | ||
}), _e = _d[0], visible = _e.visible, value = _e.value, columns = _e.columns, setState = _d[1]; | ||
}), _e = _d[0], value = _e.value, columns = _e.columns, setState = _d[1]; | ||
var _f = useMixState(props.defaultVisible, { | ||
value: props.visible, | ||
}), visible = _f[0], updateVisible = _f[1].update; | ||
useEffect(function () { | ||
setTimeout(function () { | ||
if (visible) { | ||
updateDateColumnsAndValue(true); | ||
} | ||
else { | ||
updateDateColumnsAndValue(false); | ||
} | ||
}); | ||
}, [visible]); | ||
function generateData(currentValue, currentProps) { | ||
@@ -99,4 +111,3 @@ var precision = currentProps.precision, propsMin = currentProps.min, propsMax = currentProps.max; | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
function updateDateColumnsAndValue(visible) { | ||
if (visible) { | ||
@@ -108,3 +119,2 @@ var currentValue = getCurrentValueWithCValue(props); | ||
columns: newColumns, | ||
visible: true, | ||
}); | ||
@@ -116,5 +126,13 @@ } | ||
columns: [], | ||
visible: false, | ||
}); | ||
} | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
updateVisible(true); | ||
} | ||
else { | ||
updateVisible(false); | ||
} | ||
triggerEvent('visibleChange', visible, {}); | ||
@@ -139,3 +157,2 @@ }); | ||
setState({ | ||
visible: true, | ||
columns: newColumns, | ||
@@ -169,2 +186,5 @@ value: selectedIndex, | ||
return { | ||
state: { | ||
visible: visible | ||
}, | ||
formattedValueText: formattedValueText, | ||
@@ -171,0 +191,0 @@ currentValue: visible ? value : realValue, |
@@ -7,2 +7,4 @@ import { IBaseProps } from '../_util/base'; | ||
export interface IDatePickerProps extends IBaseProps { | ||
visible?: boolean; | ||
defaultVisible?: boolean; | ||
/** | ||
@@ -9,0 +11,0 @@ * @desciption 动画类型 |
@@ -10,2 +10,4 @@ export var DatePickerDefaultProps = { | ||
export var DatePickerFunctionalProps = { | ||
visible: null, | ||
defaultVisible: null, | ||
animationType: 'transform', | ||
@@ -12,0 +14,0 @@ format: 'YYYY/MM/DD', |
@@ -10,3 +10,3 @@ import { useState, useEvent, useMemo } from 'functional-mini/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
var RangePicker = function (props) { | ||
@@ -63,3 +63,4 @@ var _a = useMixState(props.defaultValue, { | ||
var formattedValueText = onFormat(realValue); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -66,0 +67,0 @@ var state = init(realValue); |
@@ -6,3 +6,3 @@ import { useEvent, useMemo, useState } from 'functional-mini/component'; | ||
import { useMixState } from '../../_util/hooks/useMixState'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
import { CascaderFunctionalProps } from './props'; | ||
@@ -75,3 +75,4 @@ import { defaultFormat, getterColumns, getValidValue } from './utils'; | ||
}, [realValue]); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -78,0 +79,0 @@ var newColumns = getterColumns(realValue, props.options); |
import dayjs from 'dayjs'; | ||
import { useEvent, useState, useMemo } from 'functional-mini/component'; | ||
import { useEvent, useState, useEffect, useMemo } from 'functional-mini/component'; | ||
import '../_util/assert-component2'; | ||
@@ -61,6 +61,18 @@ import { mountComponent } from '../_util/component'; | ||
var _d = useState({ | ||
visible: false, | ||
value: [], | ||
columns: [], | ||
}), _e = _d[0], visible = _e.visible, value = _e.value, columns = _e.columns, setState = _d[1]; | ||
}), _e = _d[0], value = _e.value, columns = _e.columns, setState = _d[1]; | ||
var _f = useMixState(props.defaultVisible, { | ||
value: props.visible, | ||
}), visible = _f[0], updateVisible = _f[1].update; | ||
useEffect(function () { | ||
setTimeout(function () { | ||
if (visible) { | ||
updateDateColumnsAndValue(true); | ||
} | ||
else { | ||
updateDateColumnsAndValue(false); | ||
} | ||
}); | ||
}, [visible]); | ||
function generateData(currentValue, currentProps) { | ||
@@ -99,4 +111,3 @@ var precision = currentProps.precision, propsMin = currentProps.min, propsMax = currentProps.max; | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
function updateDateColumnsAndValue(visible) { | ||
if (visible) { | ||
@@ -108,3 +119,2 @@ var currentValue = getCurrentValueWithCValue(props); | ||
columns: newColumns, | ||
visible: true, | ||
}); | ||
@@ -116,5 +126,13 @@ } | ||
columns: [], | ||
visible: false, | ||
}); | ||
} | ||
} | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
updateVisible(true); | ||
} | ||
else { | ||
updateVisible(false); | ||
} | ||
triggerEvent('visibleChange', visible, {}); | ||
@@ -139,3 +157,2 @@ }); | ||
setState({ | ||
visible: true, | ||
columns: newColumns, | ||
@@ -169,2 +186,5 @@ value: selectedIndex, | ||
return { | ||
state: { | ||
visible: visible | ||
}, | ||
formattedValueText: formattedValueText, | ||
@@ -171,0 +191,0 @@ currentValue: visible ? value : realValue, |
@@ -7,2 +7,4 @@ import { IBaseProps } from '../_util/base'; | ||
export interface IDatePickerProps extends IBaseProps { | ||
visible?: boolean; | ||
defaultVisible?: boolean; | ||
/** | ||
@@ -9,0 +11,0 @@ * @desciption 动画类型 |
@@ -10,2 +10,4 @@ export var DatePickerDefaultProps = { | ||
export var DatePickerFunctionalProps = { | ||
visible: null, | ||
defaultVisible: null, | ||
animationType: 'transform', | ||
@@ -12,0 +14,0 @@ format: 'YYYY/MM/DD', |
@@ -10,3 +10,3 @@ import { useState, useEvent, useMemo } from 'functional-mini/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
var RangePicker = function (props) { | ||
@@ -63,3 +63,4 @@ var _a = useMixState(props.defaultValue, { | ||
var formattedValueText = onFormat(realValue); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -66,0 +67,0 @@ var state = init(realValue); |
@@ -6,3 +6,3 @@ import { useEvent, useMemo, useState } from 'functional-mini/component'; | ||
import { useMixState } from '../../_util/hooks/useMixState'; | ||
import { resolveEventValues } from '../../_util/platform'; | ||
import { resolveEventValues, resolveEventValue } from '../../_util/platform'; | ||
import { CascaderFunctionalProps } from './props'; | ||
@@ -75,3 +75,4 @@ import { defaultFormat, getterColumns, getValidValue } from './utils'; | ||
}, [realValue]); | ||
useEvent('onVisibleChange', function (visible) { | ||
useEvent('onVisibleChange', function (event) { | ||
var visible = resolveEventValue(event); | ||
if (visible) { | ||
@@ -78,0 +79,0 @@ var newColumns = getterColumns(realValue, props.options); |
{ | ||
"name": "antd-mini", | ||
"version": "2.29.3", | ||
"version": "2.29.4", | ||
"description": "antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。", | ||
@@ -57,3 +57,3 @@ "miniprogram": "compiled/wechat/src", | ||
"@typescript-eslint/parser": "^5.6.0", | ||
"@vitest/coverage-istanbul": "^1.1.1", | ||
"@vitest/coverage-istanbul": "~1.4.0", | ||
"antd": "^4.20.7", | ||
@@ -101,3 +101,3 @@ "auto-changelog": "^2.4.0", | ||
"typescript": "^4.0.0", | ||
"vitest": "^1.1.1", | ||
"vitest": "~1.4.0", | ||
"yorkie": "^2.0.0" | ||
@@ -104,0 +104,0 @@ }, |
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
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
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
3748400
39681