From 3282e95db0207ee133d1e98d9771dec9d83b0fc4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 02 四月 2026 16:24:38 +0800
Subject: [PATCH] 2026.4.2 新增专题管理功能
---
miniprogram_npm/tdesign-miniprogram/dialog/dialog.js | 147 ------------------------------------------------
1 files changed, 1 insertions(+), 146 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
index 2ce509c..6d361fd 100644
--- a/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
+++ b/miniprogram_npm/tdesign-miniprogram/dialog/dialog.js
@@ -1,146 +1 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-import { SuperComponent, wxComponent } from '../common/src/index';
-import config from '../common/config';
-import props from './props';
-import { isObject, toCamel } from '../common/utils';
-const { prefix } = config;
-const name = `${prefix}-dialog`;
-let Dialog = class Dialog extends SuperComponent {
- constructor() {
- super(...arguments);
- this.options = {
- multipleSlots: true,
- addGlobalClass: true,
- };
- this.externalClasses = [
- `${prefix}-class`,
- `${prefix}-class-content`,
- `${prefix}-class-confirm`,
- `${prefix}-class-cancel`,
- `${prefix}-class-action`,
- ];
- this.properties = props;
- this.data = {
- prefix,
- classPrefix: name,
- buttonVariant: 'text',
- };
- this.observers = {
- 'confirmBtn, cancelBtn'(confirm, cancel) {
- const { prefix, classPrefix, buttonLayout } = this.data;
- const rect = { buttonVariant: 'text' };
- const useBaseVariant = [confirm, cancel].some((item) => isObject(item) && item.variant && item.variant !== 'text');
- const buttonMap = { confirm, cancel };
- const cls = [`${classPrefix}__button`];
- const externalCls = [];
- if (useBaseVariant) {
- rect.buttonVariant = 'base';
- cls.push(`${classPrefix}__button--${buttonLayout}`);
- }
- else {
- cls.push(`${classPrefix}__button--text`);
- externalCls.push(`${classPrefix}-button`);
- }
- Object.keys(buttonMap).forEach((key) => {
- const btn = buttonMap[key];
- const base = {
- block: true,
- class: [...cls, `${classPrefix}__button--${key}`],
- externalClass: [...externalCls, `${prefix}-class-${key}`],
- variant: rect.buttonVariant,
- };
- if (key === 'cancel' && rect.buttonVariant === 'base') {
- base.theme = 'light';
- }
- if (typeof btn === 'string') {
- rect[`_${key}`] = Object.assign(Object.assign({}, base), { content: btn });
- }
- else if (btn && typeof btn === 'object') {
- rect[`_${key}`] = Object.assign(Object.assign({}, base), btn);
- }
- else {
- rect[`_${key}`] = null;
- }
- });
- this.setData(Object.assign({}, rect));
- },
- };
- this.methods = {
- onTplButtonTap(e) {
- var _a, _b;
- const evtType = e.type;
- const { type, extra } = e.target.dataset;
- const button = this.data[`_${type}`];
- const cbName = `bind${evtType}`;
- if (type === 'action') {
- this.onActionTap(extra);
- return;
- }
- if (typeof button[cbName] === 'function') {
- const closeFlag = button[cbName](e);
- if (closeFlag) {
- this.close();
- }
- }
- const hasOpenType = 'openType' in button;
- if (!hasOpenType && ['confirm', 'cancel'].includes(type)) {
- (_a = this[toCamel(`on-${type}`)]) === null || _a === void 0 ? void 0 : _a.call(this, type);
- }
- if (evtType !== 'tap') {
- const success = ((_b = e.detail) === null || _b === void 0 ? void 0 : _b.errMsg.indexOf('ok')) > -1;
- this.triggerEvent(success ? 'open-type-event' : 'open-type-error-event', e.detail);
- }
- },
- onConfirm() {
- this.triggerEvent('confirm');
- if (this._onConfirm) {
- this._onConfirm();
- this.close();
- }
- },
- onCancel() {
- this.triggerEvent('close', { trigger: 'cancel' });
- this.triggerEvent('cancel');
- if (this._onCancel) {
- this._onCancel();
- this.close();
- }
- },
- onClose() {
- this.triggerEvent('close', { trigger: 'close-btn' });
- this.close();
- },
- close() {
- this.setData({ visible: false });
- },
- overlayClick() {
- if (this.properties.closeOnOverlayClick) {
- this.triggerEvent('close', { trigger: 'overlay' });
- }
- this.triggerEvent('overlay-click');
- },
- onActionTap(index) {
- this.triggerEvent('action', { index });
- if (this._onAction) {
- this._onAction({ index });
- this.close();
- }
- },
- openValueCBHandle(e) {
- this.triggerEvent('open-type-event', e.detail);
- },
- openValueErrCBHandle(e) {
- this.triggerEvent('open-type-error-event', e.detail);
- },
- };
- }
-};
-Dialog = __decorate([
- wxComponent()
-], Dialog);
-export default Dialog;
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{toCamel}from"../common/utils";import{isObject}from"../common/validator";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-dialog`;let Dialog=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar],this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-confirm`,`${prefix}-class-cancel`,`${prefix}-class-action`],this.properties=props,this.data={prefix:prefix,classPrefix:name,buttonVariant:"text"},this.observers={"confirmBtn, cancelBtn"(t,e){const{prefix:o,classPrefix:i,buttonLayout:n}=this.data,s={buttonVariant:"text"},r=[t,e].some(t=>isObject(t)&&t.variant&&"text"!==t.variant),a={confirm:t,cancel:e},c=[`${i}__button`],l=[];r?(s.buttonVariant="base",c.push(`${i}__button--${n}`)):(c.push(`${i}__button--text`),l.push(`${i}-button`)),Object.keys(a).forEach(t=>{const e=a[t],n={block:!0,rootClass:[...c,`${i}__button--${t}`],tClass:[...l,`${o}-class-${t}`],variant:s.buttonVariant,openType:""};"cancel"===t&&"base"===s.buttonVariant&&(n.theme="light"),s[`_${t}`]="string"==typeof e?Object.assign(Object.assign({},n),{content:e}):e&&"object"==typeof e?Object.assign(Object.assign({},n),e):null}),this.setData(Object.assign({},s))}},this.methods={onTplButtonTap(t){var e,o,i;const n=t.type,{type:s,extra:r}=t.target.dataset,a=this.data[`_${s}`],c=`bind${n}`;if("action"===s)return void this.onActionTap(r);if("function"==typeof a[c]){a[c](t)&&this.close()}if(!!!a.openType&&["confirm","cancel"].includes(s)&&(null===(e=this[toCamel(`on-${s}`)])||void 0===e||e.call(this,s)),"tap"!==n){const e=(null===(i=null===(o=t.detail)||void 0===o?void 0:o.errMsg)||void 0===i?void 0:i.indexOf("ok"))>-1;this.triggerEvent(e?"open-type-event":"open-type-error-event",t.detail)}},onConfirm(){this.triggerEvent("confirm"),this._onConfirm&&(this._onConfirm({trigger:"confirm"}),this.close())},onCancel(){const t={trigger:"cancel"};this.triggerEvent("cancel"),this.triggerEvent("close",t),this._onCancel&&(this._onCancel(t),this.close())},onClose(){var t;const e={trigger:"close-btn"};this.triggerEvent("close",e),null===(t=this._onCancel)||void 0===t||t.call(this,e),this.close()},close(){this.setData({visible:!1})},overlayClick(){var t;if(this.triggerEvent("overlay-click"),this.properties.closeOnOverlayClick){const e={trigger:"overlay"};this.triggerEvent("close",e),null===(t=this._onCancel)||void 0===t||t.call(this,e),this.close()}},onActionTap(t){this.triggerEvent("action",{index:t}),this._onAction&&(this._onAction({index:t}),this.close())},openValueCBHandle(t){this.triggerEvent("open-type-event",t.detail)},openValueErrCBHandle(t){this.triggerEvent("open-type-error-event",t.detail)}}}};Dialog=__decorate([wxComponent()],Dialog);export default Dialog;
\ No newline at end of file
--
Gitblit v1.9.3