UNPKG

antd-mini

Version:

antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。

67 lines (66 loc) 2.29 kB
import { __awaiter, __generator } from "tslib"; import { effect } from '@preact/signals-core'; import mixinValue from '../mixins/value'; import { ComponentWithSignalStoreImpl, triggerEvent, triggerEventOnly, } from '../_util/simply'; import i18nController from '../_util/store'; import { GuideTourDefaultProps } from './props'; ComponentWithSignalStoreImpl({ store: function () { return i18nController; }, updateHook: effect, mapState: { locale: function (_a) { var store = _a.store; return store.currentLocale.value; }, }, }, GuideTourDefaultProps, { onNext: function () { return __awaiter(this, void 0, void 0, function () { var currentValue, newCurrent; return __generator(this, function (_a) { currentValue = this.getValue(); newCurrent = currentValue + 1; if (!this.isControlled()) { this.update(newCurrent); } triggerEvent(this, 'change', newCurrent); return [2 /*return*/]; }); }); }, onPrev: function () { return __awaiter(this, void 0, void 0, function () { var currentValue, newCurrent; return __generator(this, function (_a) { currentValue = this.getValue(); newCurrent = currentValue - 1; if (!this.isControlled()) { this.update(newCurrent); } triggerEvent(this, 'change', newCurrent); return [2 /*return*/]; }); }); }, onCancel: function () { triggerEventOnly(this, 'cancel'); }, onSwiperChange: function (e) { return __awaiter(this, void 0, void 0, function () { var current; return __generator(this, function (_a) { current = e.detail.current; if (!this.isControlled()) { this.update(current); } triggerEvent(this, 'change', current); return [2 /*return*/]; }); }); }, }, undefined, [ mixinValue({ valueKey: 'current', defaultValueKey: 'defaultCurrent', }), ]);