This commit is contained in:
Xu Chang 2022-10-19 13:21:16 +08:00
commit 52bd20b797
1123 changed files with 319 additions and 45217 deletions

View File

@ -1,48 +0,0 @@
import { WebEnv, WechatMpEnv } from "../general-app-domain/Token/Schema";
import { AppType } from '../general-app-domain/Application/Schema';
import { EntityDict } from "../general-app-domain";
import { QiniuUploadInfo } from "oak-frontend-base/lib/types/Upload";
import { RuntimeContext } from '../context/RuntimeContext';
import { Config, Origin } from "../types/Config";
declare type GeneralAspectDict<ED extends EntityDict, Cxt extends RuntimeContext<ED>> = {
loginByMobile: (params: {
captcha?: string;
password?: string;
mobile: string;
env: WebEnv | WechatMpEnv;
}, context: Cxt) => Promise<string>;
loginWechat: ({ code, env, }: {
code: string;
env: WebEnv;
}, context: Cxt) => Promise<string>;
loginWechatMp: ({ code, env, }: {
code: string;
env: WechatMpEnv;
}, context: Cxt) => Promise<string>;
syncUserInfoWechatMp: ({ nickname, avatarUrl, encryptedData, iv, signature, }: {
nickname: string;
avatarUrl: string;
encryptedData: string;
iv: string;
signature: string;
}, context: Cxt) => Promise<void>;
getUploadInfo: (params: {
origin: Origin;
bucket?: string;
key?: string;
}, context: Cxt) => Promise<QiniuUploadInfo>;
sendCaptcha: (params: {
mobile: string;
env: WechatMpEnv | WebEnv;
}) => Promise<string>;
getApplication: (params: {
type: AppType;
}, context: Cxt) => Promise<string>;
updateConfig: (params: {
entity: 'platform' | 'system';
entityId: string;
config: Config;
}, context: Cxt) => Promise<void>;
};
export declare type AspectDict<ED extends EntityDict, Cxt extends RuntimeContext<ED>> = GeneralAspectDict<ED, Cxt>;
export {};

View File

@ -1,2 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -1,4 +0,0 @@
import { getApplication as getApplicationDev } from './application.dev';
import { getApplication as getApplicationProd } from './application.prod';
declare const getApplication: typeof getApplicationDev | typeof getApplicationProd;
export { getApplication, };

View File

@ -1,6 +0,0 @@
import { EntityDict } from "../general-app-domain";
import { AppType } from "../general-app-domain/Application/Schema";
import { RuntimeContext } from '../context/RuntimeContext';
export declare function getApplication<ED extends EntityDict, Cxt extends RuntimeContext<ED>>(params: {
type: AppType;
}, context: Cxt): Promise<string>;

View File

@ -1,43 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApplication = void 0;
var tslib_1 = require("tslib");
var DEV_CONFIG_1 = require("../data/DEV-CONFIG");
function getApplication(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var type, APP_ID, appId, _a, application;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
type = params.type;
APP_ID = {
web: DEV_CONFIG_1.DEV_WEB_APPLICATION_ID,
wechatMp: DEV_CONFIG_1.DEV_WECHATMP_APPLICATION_ID,
wechatPublic: DEV_CONFIG_1.DEV_WECHATPUPLIC_APPLICATION_ID,
};
appId = APP_ID[type];
return [4 /*yield*/, context.rowStore.select('application', {
data: {
id: 1,
name: 1,
config: 1,
type: 1,
systemId: 1,
system: {
id: 1,
name: 1,
config: 1,
}
},
filter: {
id: appId
}
}, context, {})];
case 1:
_a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), application = _a[0];
return [2 /*return*/, application.id];
}
});
});
}
exports.getApplication = getApplication;

View File

@ -1,7 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApplication = void 0;
var application_dev_1 = require("./application.dev");
var application_prod_1 = require("./application.prod");
var getApplication = process.env.NODE_ENV === 'development' ? application_dev_1.getApplication : application_prod_1.getApplication;
exports.getApplication = getApplication;

View File

@ -1,6 +0,0 @@
import { EntityDict } from "../general-app-domain";
import { AppType } from "../general-app-domain/Application/Schema";
import { RuntimeContext } from '../context/RuntimeContext';
export declare function getApplication<ED extends EntityDict, Cxt extends RuntimeContext<ED>>(params: {
type: AppType;
}, context: Cxt): Promise<string>;

View File

@ -1,45 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApplication = void 0;
var tslib_1 = require("tslib");
var DEV_CONFIG_1 = require("../data/DEV-CONFIG");
function getApplication(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var type, APP_ID, appId, url, _a, application;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
type = params.type;
APP_ID = {
web: DEV_CONFIG_1.DEV_WEB_APPLICATION_ID,
wechatMp: DEV_CONFIG_1.DEV_WECHATMP_APPLICATION_ID,
wechatPublic: DEV_CONFIG_1.DEV_WECHATPUPLIC_APPLICATION_ID,
};
appId = APP_ID[type];
url = context.getHeader('url');
console.log('url is', url);
return [4 /*yield*/, context.rowStore.select('application', {
data: {
id: 1,
name: 1,
config: 1,
type: 1,
systemId: 1,
system: {
id: 1,
name: 1,
config: 1,
}
},
filter: {
id: appId
}
}, context, {})];
case 1:
_a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), application = _a[0];
return [2 /*return*/, application.id];
}
});
});
}
exports.getApplication = getApplication;

View File

@ -1,8 +0,0 @@
import { RuntimeContext } from '../context/RuntimeContext';
import { EntityDict } from '../general-app-domain';
import { Config } from '../types/Config';
export declare function updateConfig<ED extends EntityDict, Cxt extends RuntimeContext<ED>>(params: {
entity: 'platform' | 'system';
entityId: string;
config: Config;
}, context: Cxt): Promise<void>;

View File

@ -1,34 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateConfig = void 0;
var tslib_1 = require("tslib");
function updateConfig(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var rowStore, entity, entityId, config, _a, _b, _c;
var _d;
return tslib_1.__generator(this, function (_e) {
switch (_e.label) {
case 0:
rowStore = context.rowStore;
entity = params.entity, entityId = params.entityId, config = params.config;
_b = (_a = rowStore).operate;
_c = [entity];
_d = {};
return [4 /*yield*/, generateNewId()];
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_d.id = _e.sent(),
_d.action = 'update',
_d.data = {
config: config,
},
_d.filter = {
id: entityId,
},
_d), context, {}]))];
case 2:
_e.sent();
return [2 /*return*/];
}
});
});
}
exports.updateConfig = updateConfig;

View File

@ -1,9 +0,0 @@
import { RuntimeContext } from '../context/RuntimeContext';
import { EntityDict } from '../general-app-domain';
import { Origin } from '../types/Config';
import { QiniuUploadInfo } from 'oak-frontend-base/lib/types/Upload';
export declare function getUploadInfo<ED extends EntityDict, Cxt extends RuntimeContext<ED>>(params: {
origin: Origin;
bucket?: string;
key?: string;
}, context: Cxt): Promise<QiniuUploadInfo>;

View File

@ -1,24 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUploadInfo = void 0;
var tslib_1 = require("tslib");
var getContextConfig_1 = require("../utils/getContextConfig");
var assert_1 = require("oak-domain/lib/utils/assert");
function getUploadInfo(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var origin, key, bucket, _a, instance, config, _b, uploadHost, domain, bucket2;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
origin = params.origin, key = params.key, bucket = params.bucket;
return [4 /*yield*/, (0, getContextConfig_1.getConfig)(context, 'Cos', origin)];
case 1:
_a = _c.sent(), instance = _a.instance, config = _a.config;
(0, assert_1.assert)(origin === 'qiniu');
_b = config, uploadHost = _b.uploadHost, domain = _b.domain, bucket2 = _b.bucket;
return [2 /*return*/, instance.getUploadInfo(uploadHost, domain, bucket || bucket2, key)];
}
});
});
}
exports.getUploadInfo = getUploadInfo;

View File

@ -1,13 +0,0 @@
import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha } from './token';
import { getUploadInfo } from './extraFile';
import { updateConfig } from './config';
export declare const aspectDict: {
loginByMobile: typeof loginByMobile;
loginWechat: typeof loginWechat;
loginWechatMp: typeof loginWechatMp;
syncUserInfoWechatMp: typeof syncUserInfoWechatMp;
getUploadInfo: typeof getUploadInfo;
sendCaptcha: typeof sendCaptcha;
getApplication: typeof import("./application.dev").getApplication | typeof import("./application.prod").getApplication;
updateConfig: typeof updateConfig;
};

View File

@ -1,19 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aspectDict = void 0;
var token_1 = require("./token");
var extraFile_1 = require("./extraFile");
var application_1 = require("./application");
var config_1 = require("./config");
// import commonAspectDict from 'oak-common-aspect';
exports.aspectDict = {
loginByMobile: token_1.loginByMobile,
loginWechat: token_1.loginWechat,
loginWechatMp: token_1.loginWechatMp,
syncUserInfoWechatMp: token_1.syncUserInfoWechatMp,
getUploadInfo: extraFile_1.getUploadInfo,
sendCaptcha: token_1.sendCaptcha,
getApplication: application_1.getApplication,
updateConfig: config_1.updateConfig,
};
// export type AspectDict<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;

View File

@ -1,45 +0,0 @@
import { RuntimeContext } from '../context/RuntimeContext';
import { EntityDict } from '../general-app-domain';
import { WechatMpConfig } from '../general-app-domain/Application/Schema';
import { WebEnv, WechatMpEnv } from '../general-app-domain/Token/Schema';
export declare function loginByMobile<ED extends EntityDict, Cxt extends RuntimeContext<ED>>(params: {
captcha?: string;
password?: string;
mobile: string;
env: WebEnv | WechatMpEnv;
}, context: Cxt): Promise<string>;
/**
*
* @param param0
* @param context
*/
export declare function loginWechat<ED extends EntityDict, Cxt extends RuntimeContext<ED>>({ code, env }: {
code: string;
env: WebEnv;
}, context: Cxt): Promise<string>;
/**
*
* @param param0
* @param context
* @returns
*/
export declare function loginWechatMp<ED extends EntityDict, Cxt extends RuntimeContext<ED>>({ code, env }: {
code: string;
env: WechatMpEnv;
}, context: Cxt): Promise<string>;
/**
* wx.getUserProfile拿到的用户信息
* @param param0
* @param context
*/
export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends RuntimeContext<ED>>({ nickname, avatarUrl, encryptedData, iv, signature }: {
nickname: string;
avatarUrl: string;
encryptedData: string;
iv: string;
signature: string;
}, context: Cxt): Promise<void>;
export declare function sendCaptcha<ED extends EntityDict, Cxt extends RuntimeContext<ED>>({ mobile, env }: {
mobile: string;
env: WechatMpConfig | WebEnv;
}, context: Cxt): Promise<string>;

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
import { EntityDict } from "../general-app-domain";
import { WechatQrCodeProps } from '../general-app-domain/WechatQrCode/Schema';
import { RuntimeContext } from '../context/RuntimeContext';
export declare function createWechatQrCode<ED extends EntityDict, T extends keyof ED, Cxt extends RuntimeContext<ED>>(options: {
entity: T;
entityId: string;
applicationId: string;
tag?: string;
lifetimeLength?: number;
permanent?: boolean;
props: WechatQrCodeProps;
}, context: Cxt): Promise<(Omit<Omit<import("../general-app-domain/WechatQrCode/Schema").OpSchema, "applicationId" | "entity" | "entityId">, import("oak-domain/lib/types").InstinctiveAttributes> & {
id: string;
} & {
applicationId: string;
application?: import("../general-app-domain/Application/Schema").UpdateOperation | undefined;
} & {
[K: string]: any;
entity?: string | undefined;
entityId?: string | undefined;
} & {
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[], undefined, undefined> | import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">, undefined, undefined>[] | undefined;
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[], undefined, undefined> | import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">, undefined, undefined>[] | undefined;
}) | (Omit<Omit<import("../general-app-domain/WechatQrCode/Schema").OpSchema, "applicationId" | "entity" | "entityId">, import("oak-domain/lib/types").InstinctiveAttributes> & {
id: string;
} & {
applicationId: string;
} & {
[K: string]: any;
entity?: string | undefined;
entityId?: string | undefined;
} & {
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[], undefined, undefined> | import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">, undefined, undefined>[] | undefined;
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[], undefined, undefined> | import("oak-domain/lib/types").Operation<"create", Omit<import("../general-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">, undefined, undefined>[] | undefined;
})>;

View File

@ -1,145 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWechatQrCode = void 0;
var tslib_1 = require("tslib");
var assert_1 = require("oak-domain/lib/utils/assert");
function createWechatQrCode(options, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var entity, entityId, applicationId, tag, lifetimeLength, permanent, props, _a, appType, config, qrCodePrefix, id, data, _b, _c, _d, data, _e, _f, _g, id, data, _h, _j, _k, id, data, _l, _m, _o;
var _p, _q, _r, _s;
return tslib_1.__generator(this, function (_t) {
switch (_t.label) {
case 0:
entity = options.entity, entityId = options.entityId, applicationId = options.applicationId, tag = options.tag, lifetimeLength = options.lifetimeLength, permanent = options.permanent, props = options.props;
return [4 /*yield*/, context.getApplication()];
case 1:
_a = (_t.sent()), appType = _a.type, config = _a.config;
if (!(appType === 'wechatMp')) return [3 /*break*/, 9];
qrCodePrefix = config.qrCodePrefix;
return [4 /*yield*/, generateNewId()];
case 2:
id = _t.sent();
if (!qrCodePrefix) return [3 /*break*/, 5];
data = {
id: id,
type: 'wechatMpDomainUrl',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: true,
url: "".concat(qrCodePrefix, "/id"),
expired: false,
props: props,
};
_c = (_b = context.rowStore).operate;
_d = ['wechatQrCode'];
_p = {};
return [4 /*yield*/, generateNewId()];
case 3: return [4 /*yield*/, _c.apply(_b, _d.concat([(_p.id = _t.sent(),
_p.action = 'create',
_p.data = data,
_p), context,
{
dontCollect: true,
}]))];
case 4:
_t.sent();
return [2 /*return*/, data];
case 5:
data = {
id: id,
type: 'wechatMpWxaCode',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
_f = (_e = context.rowStore).operate;
_g = ['wechatQrCode'];
_q = {};
return [4 /*yield*/, generateNewId()];
case 6: return [4 /*yield*/, _f.apply(_e, _g.concat([(_q.id = _t.sent(),
_q.action = 'create',
_q.data = data,
_q), context,
{
dontCollect: true,
}]))];
case 7:
_t.sent();
return [2 /*return*/, data];
case 8: return [3 /*break*/, 17];
case 9:
if (!(appType === 'wechatPublic')) return [3 /*break*/, 13];
return [4 /*yield*/, generateNewId()];
case 10:
id = _t.sent();
data = {
id: id,
type: 'wechatPublic',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
_j = (_h = context.rowStore).operate;
_k = ['wechatQrCode'];
_r = {};
return [4 /*yield*/, generateNewId()];
case 11: return [4 /*yield*/, _j.apply(_h, _k.concat([(_r.id = _t.sent(),
_r.action = 'create',
_r.data = data,
_r), context,
{
dontCollect: true,
}]))];
case 12:
_t.sent();
return [2 /*return*/, data];
case 13:
(0, assert_1.assert)(appType === 'web');
return [4 /*yield*/, generateNewId()];
case 14:
id = _t.sent();
data = {
id: id,
type: 'webForWechatPublic',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
_m = (_l = context.rowStore).operate;
_o = ['wechatQrCode'];
_s = {};
return [4 /*yield*/, generateNewId()];
case 15: return [4 /*yield*/, _m.apply(_l, _o.concat([(_s.id = _t.sent(),
_s.action = 'create',
_s.data = data,
_s), context,
{
dontCollect: true,
}]))];
case 16:
_t.sent();
return [2 /*return*/, data];
case 17: return [2 /*return*/];
}
});
});
}
exports.createWechatQrCode = createWechatQrCode;

View File

@ -1,5 +0,0 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
declare const checkers: Checker<EntityDict, 'address', RuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -1,39 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var validator_1 = require("oak-domain/lib/utils/validator");
var types_1 = require("oak-domain/lib/types");
var validator_2 = require("oak-domain/lib/utils/validator");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'address',
checker: function (_a) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var action, data;
return tslib_1.__generator(this, function (_b) {
action = operation.action, data = operation.data;
if (data instanceof Array) {
data.forEach(function (ele) {
var a = 'name';
(0, validator_2.checkAttributesNotNull)(ele, ['name', 'detail', 'phone', 'areaId']);
if (!(0, validator_1.isMobile)(ele.phone)) {
throw new types_1.OakInputIllegalException(['phone'], '手机号非法');
}
});
}
else {
(0, validator_2.checkAttributesNotNull)(data, ['name', 'detail', 'phone', 'areaId']);
if (!(0, validator_1.isMobile)(data.phone)) {
throw new types_1.OakInputIllegalException(['phone'], '手机号非法');
}
}
return [2 /*return*/, 0];
});
});
},
}
];
exports.default = checkers;

View File

@ -1,2 +0,0 @@
declare const checkers: (import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "address", import("../context/RuntimeContext").RuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "token", import("../context/RuntimeContext").RuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "user", import("../context/RuntimeContext").RuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "userEntityGrant", import("../context/RuntimeContext").RuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "wechatQrCode", import("../context/RuntimeContext").RuntimeContext<import("../general-app-domain").EntityDict>>)[];
export default checkers;

View File

@ -1,12 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var address_1 = tslib_1.__importDefault(require("./address"));
var token_1 = tslib_1.__importDefault(require("./token"));
var user_1 = tslib_1.__importDefault(require("./user"));
var userEntityGrant_1 = tslib_1.__importDefault(require("./userEntityGrant"));
var wechatQrCode_1 = tslib_1.__importDefault(require("./wechatQrCode"));
var check_1 = require("../utils/check");
var checkers = tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(address_1.default), false), tslib_1.__read(token_1.default), false), tslib_1.__read(user_1.default), false), tslib_1.__read(userEntityGrant_1.default), false), tslib_1.__read(wechatQrCode_1.default), false);
(0, check_1.processCheckers)(checkers);
exports.default = checkers;

View File

@ -1,5 +0,0 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
declare const checkers: Checker<EntityDict, 'token', RuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var checkers = [];
exports.default = checkers;

View File

@ -1,5 +0,0 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
declare const checkers: Checker<EntityDict, 'user', RuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -1,83 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var actionDef_1 = require("oak-domain/lib/store/actionDef");
var types_1 = require("oak-domain/lib/types");
var checkers = [
{
type: 'data',
action: 'remove',
entity: 'user',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var filter;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
filter = operation.filter;
return [4 /*yield*/, (0, actionDef_1.checkFilterContains)('user', context.rowStore.getSchema(), {
idState: 'shadow',
}, context, filter)];
case 1:
_b.sent();
return [2 /*return*/, 0];
}
});
});
},
},
{
type: 'user',
action: 'play',
entity: 'user',
checker: function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
// 只有root才能play
throw new types_1.OakUserUnpermittedException();
});
}); },
},
{
type: 'data',
action: 'play',
entity: 'user',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var token, userId;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, context.getToken()];
case 1:
token = _b.sent();
userId = token.userId;
if (userId === operation.filter.id) {
throw new types_1.OakRowInconsistencyException();
}
return [2 /*return*/, 0];
}
});
});
},
},
{
type: 'data',
action: 'grant',
entity: 'user',
checker: function (_a) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data;
return tslib_1.__generator(this, function (_b) {
data = operation.data;
if (Object.keys(data).filter(function (ele) { return !ele.includes('$'); }).length > 0) {
throw new types_1.OakInputIllegalException(Object.keys(data), '授权不允许传入其它属性');
}
return [2 /*return*/, 0];
});
});
}
}
];
exports.default = checkers;

View File

@ -1,5 +0,0 @@
import { Checker } from 'oak-domain/lib/types';
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
declare const checkers: Checker<EntityDict, 'userEntityGrant', RuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -1,57 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("oak-domain/lib/types");
var validator_1 = require("oak-domain/lib/utils/validator");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'userEntityGrant',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data;
return tslib_1.__generator(this, function (_b) {
data = operation.data;
if (data instanceof Array) {
data.forEach(function (ele) {
(0, validator_1.checkAttributesNotNull)(ele, ['type', 'entity', 'entityId', 'relation']);
if (!ele.hasOwnProperty('number') || ele.type === 'transfer') {
Object.assign(ele, {
number: 1,
});
}
else {
if (ele.number <= 0) {
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
}
}
Object.assign(ele, {
confirmed: 0,
});
});
}
else {
(0, validator_1.checkAttributesNotNull)(data, ['type', 'entity', 'entityId', 'relation']);
if (!data.hasOwnProperty('number') || data.type === 'transfer') {
Object.assign(data, {
number: 1,
});
}
else {
if (data.number <= 0) {
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
}
}
Object.assign(data, {
confirmed: 0,
});
}
return [2 /*return*/, 0];
});
});
},
},
];
exports.default = checkers;

View File

@ -1,5 +0,0 @@
import { Checker } from 'oak-domain/lib/types';
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
declare const checkers: Checker<EntityDict, 'wechatQrCode', RuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -1,19 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'wechatQrCode',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_b) {
return [2 /*return*/, 0];
});
});
},
},
];
exports.default = checkers;

View File

@ -1,3 +0,0 @@
import Map from './map';
import Location from './location';
export { Map, Location };

View File

@ -1,8 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Location = exports.Map = void 0;
var tslib_1 = require("tslib");
var map_1 = tslib_1.__importDefault(require("./map"));
exports.Map = map_1.default;
var location_1 = tslib_1.__importDefault(require("./location"));
exports.Location = location_1.default;

View File

@ -1,10 +0,0 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
export declare type PositionProps = {
loadUI: boolean;
__map__: AMap.Map | undefined;
onSuccess?: (result: AMapUI.PositionPickerResult) => void;
onFail?: (error: any) => void;
};
declare const _default: React.MemoExoticComponent<(props: PositionProps) => null>;
export default _default;

View File

@ -1,35 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("react");
exports.default = (0, react_1.memo)(function (props) {
var map = props.__map__;
var loadUI = props.loadUI;
var onSuccess = props.onSuccess, onFail = props.onFail;
(0, react_1.useEffect)(function () {
if (map && window.AMapUI) {
dragSiteSelection();
}
}, [map, window.AMapUI]);
var dragSiteSelection = function () {
window.AMapUI.loadUI(['misc/PositionPicker'], function (PositionPicker) {
var positionPicker = new PositionPicker({
mode: 'dragMap',
map: map,
iconStyle: {
//自定义外观
url: '//webapi.amap.com/ui/1.0/assets/position-picker2.png',
ancher: [24, 40],
size: [48, 48],
},
});
positionPicker.on('success', function (result) {
onSuccess && onSuccess(result);
});
positionPicker.on('fail', function (error) {
onFail && onFail(error);
});
positionPicker.start();
});
};
return null;
});

View File

@ -1,39 +0,0 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
import { DialogProps } from 'tdesign-react';
import { GeolocationProps } from '@uiw/react-amap';
import './index.less';
export declare type LocationProps = {
akey: string;
version?: string;
visible?: boolean;
className?: string;
children?: React.ReactNode;
onClose?: () => void;
onConfirm?: (poi: Poi, result?: AMap.SearchResult | AMapUI.PositionPickerResult) => void;
geolocationProps?: GeolocationProps;
useGeolocation?: boolean;
dialogProps?: DialogProps;
};
export declare type Poi = {
id: string;
name: string;
type: string;
tel: string;
direction?: string;
distance: number;
address: string;
location: AMap.LngLat;
website?: string;
pcode: string;
citycode: string;
adcode: string;
postcode?: string;
pname: string;
cityname: string;
adname: string;
email?: string;
businessArea?: string;
};
declare const Location: (props: LocationProps) => JSX.Element;
export default Location;

View File

@ -1,200 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = tslib_1.__importStar(require("react"));
var tdesign_react_1 = require("tdesign-react");
var tdesign_icons_react_1 = require("tdesign-icons-react");
var react_amap_1 = require("@uiw/react-amap");
var map_1 = tslib_1.__importDefault(require("./../map"));
var PositionPicker_1 = tslib_1.__importDefault(require("./PositionPicker"));
require("./index.less");
var ListItem = tdesign_react_1.List.ListItem, ListItemMeta = tdesign_react_1.List.ListItemMeta;
var Location = function (props) {
var visible = props.visible, akey = props.akey, _a = props.version, version = _a === void 0 ? '2.0' : _a, onClose = props.onClose, onConfirm = props.onConfirm, _b = props.geolocationProps, geolocationProps = _b === void 0 ? {} : _b, _c = props.useGeolocation, useGeolocation = _c === void 0 ? true : _c, _d = props.dialogProps, dialogProps = _d === void 0 ? {} : _d;
var prefixCls = 'oak';
var searchRef = (0, react_1.useRef)();
var _e = tslib_1.__read((0, react_1.useState)(''), 2), searchValue = _e[0], setSearchValue = _e[1];
var _f = tslib_1.__read((0, react_1.useState)(true), 2), refresh = _f[0], setRefresh = _f[1]; // 点击poi不触发setPositionPickerResult
var _g = tslib_1.__read((0, react_1.useState)('dragMap'), 2), mode = _g[0], setMode = _g[1];
var _h = tslib_1.__read((0, react_1.useState)(), 2), map = _h[0], setMap = _h[1];
var _j = tslib_1.__read((0, react_1.useState)(), 2), positionPickerResult = _j[0], setPositionPickerResult = _j[1];
var _k = tslib_1.__read((0, react_1.useState)(), 2), searchResult = _k[0], setSearchResult = _k[1];
var _l = tslib_1.__read((0, react_1.useState)(), 2), pois = _l[0], setPois = _l[1];
var _m = tslib_1.__read((0, react_1.useState)(), 2), currentPoi = _m[0], setCurrentPoi = _m[1];
var _o = tslib_1.__read((0, react_1.useState)(), 2), oldPois = _o[0], setOldPois = _o[1];
var _p = tslib_1.__read((0, react_1.useState)(), 2), oldPoi = _p[0], setOldPoi = _p[1];
var _q = tslib_1.__read((0, react_1.useState)(false), 2), loadUI = _q[0], setLoadUI = _q[1];
var _r = tslib_1.__read((0, react_1.useState)(false), 2), focus = _r[0], setFocus = _r[1];
var _s = tslib_1.__read((0, react_1.useState)(false), 2), searchLoading = _s[0], setSearchLoading = _s[1];
var _t = tslib_1.__read((0, react_1.useState)(false), 2), show = _t[0], setShow = _t[1];
var setCenter = function (center) {
if (map) {
map.setCenter(center);
}
};
var placeSearch = function (value) {
// window.AMap存在再搜素
return new Promise(function (resolve, reject) {
var _a;
(_a = window.AMap) === null || _a === void 0 ? void 0 : _a.plugin(['AMap.PlaceSearch'], function () {
var placeSearch = new window.AMap.PlaceSearch({
pageSize: 20,
pageIndex: 1,
extensions: 'all',
city: '全国', //城市
});
placeSearch.search(value, function (status, result) {
if (status === 'complete') {
resolve(result);
}
else {
reject(result);
}
});
});
});
};
(0, react_1.useEffect)(function () {
if (window.AMap && !window.AMapUI) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "".concat(window.location.protocol, "//webapi.amap.com/ui/1.1/main.js");
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = function () {
setLoadUI(true);
};
script.onerror = function (error) {
setLoadUI(false);
};
}
else if (window.AMap && window.AMapUI) {
setLoadUI(true);
}
}, [window.AMap]);
(0, react_1.useEffect)(function () {
if (currentPoi && !refresh) {
var lngLat = new window.AMap.LngLat(currentPoi.location.lng, currentPoi.location.lat);
setCenter(lngLat);
}
}, [refresh, currentPoi]);
(0, react_1.useEffect)(function () {
// 拖动地图才触发
if (mode === 'dragMap' && positionPickerResult && refresh) {
var regeocode = positionPickerResult.regeocode;
var pois_1 = regeocode.pois, addressComponent_1 = regeocode.addressComponent;
var pois2 = pois_1 === null || pois_1 === void 0 ? void 0 : pois_1.map(function (poi, index) {
return tslib_1.__assign(tslib_1.__assign({}, poi), { pcode: '', citycode: addressComponent_1 === null || addressComponent_1 === void 0 ? void 0 : addressComponent_1.citycode, adcode: addressComponent_1.adcode, postcode: '', pname: addressComponent_1.province, cityname: addressComponent_1.city, adname: addressComponent_1 === null || addressComponent_1 === void 0 ? void 0 : addressComponent_1.district });
});
setPois(pois2);
setCurrentPoi(pois2[0]);
}
}, [refresh, positionPickerResult]);
(0, react_1.useEffect)(function () {
if (searchValue) {
setSearchLoading(true);
placeSearch(searchValue).then(function (result) {
var pois = (result === null || result === void 0 ? void 0 : result.poiList).pois;
setSearchResult(result);
setShow(true);
setSearchLoading(false);
setPois(pois);
setCurrentPoi(pois[0]);
}, function (error) {
setSearchResult(undefined);
setShow(true);
setSearchLoading(false);
});
}
}, [searchValue]);
(0, react_1.useEffect)(function () {
if (mode === 'searchPoi') {
setOldPoi(currentPoi);
setOldPois(pois);
setPois([]);
setCurrentPoi(undefined);
}
else {
setPois(oldPois);
setCurrentPoi(oldPoi);
}
}, [mode]);
(0, react_1.useEffect)(function () {
if (visible && map && loadUI) {
setCenter(map.getCenter());
}
}, [visible, map, loadUI]);
var clearData = function () {
setMode('dragMap');
setFocus(false);
setShow(false);
setSearchValue('');
setRefresh(true);
};
return ((0, jsx_runtime_1.jsx)(tdesign_react_1.Dialog, tslib_1.__assign({ width: "80%" }, dialogProps, { visible: visible, onClose: function () {
onClose && onClose();
clearData();
}, onConfirm: function () {
if (!currentPoi) {
return;
}
onConfirm &&
onConfirm(currentPoi, mode === 'dragMap' ? positionPickerResult : searchResult);
clearData();
} }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-location") }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Row, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Col, tslib_1.__assign({ xs: 12, sm: 7 }, { children: (0, jsx_runtime_1.jsxs)(map_1.default, tslib_1.__assign({ className: "".concat(prefixCls, "-location-map"), akey: akey, version: version, useAMapUI: true, mapRef: function (instance) {
if (instance && instance.map && !map) {
setMap(instance.map);
}
}, mapProps: {
onDragStart: function () {
setRefresh(true);
setMode('dragMap');
setSearchValue('');
setShow(false);
},
} }, { children: [(0, jsx_runtime_1.jsx)(PositionPicker_1.default, { loadUI: loadUI, __map__: map, onSuccess: function (result) {
setPositionPickerResult(result);
} }), useGeolocation && ((0, jsx_runtime_1.jsx)(react_amap_1.Geolocation, tslib_1.__assign({ maximumAge: 100000, borderRadius: "5px", position: "RB", offset: [10, 10], zoomToAccuracy: true, showCircle: true }, geolocationProps, { onComplete: function (data) { }, onError: function (err) {
console.error(err);
} })))] })) })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Col, tslib_1.__assign({ xs: 12, sm: 5 }, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.List, tslib_1.__assign({ className: "".concat(prefixCls, "-location-list"), header: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-location-list-header") }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { ref: searchRef, placeholder: "\u641C\u7D22\u5730\u70B9", value: searchValue, clearable: true, onChange: function (value) {
setSearchValue(value);
}, onClear: function () {
setSearchValue('');
}, prefixIcon: (0, jsx_runtime_1.jsx)(tdesign_icons_react_1.SearchIcon, {}), onFocus: function () {
setMode('searchPoi');
setFocus(true);
}, onBlur: function () {
setFocus(false);
} }), mode === 'searchPoi' && ((0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ style: { marginLeft: 5 }, variant: "text", theme: "primary", onClick: function () {
var _a;
setMode('dragMap');
setSearchValue('');
setShow(false);
//@ts-ignore
(_a = searchRef === null || searchRef === void 0 ? void 0 : searchRef.current) === null || _a === void 0 ? void 0 : _a.blur();
} }, { children: "\u53D6\u6D88" })))] })) }, { children: [mode === 'dragMap' &&
(pois === null || pois === void 0 ? void 0 : pois.map(function (poi, index) {
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function () {
setRefresh(false);
setCurrentPoi(poi);
} }, { children: (0, jsx_runtime_1.jsx)(ListItem, tslib_1.__assign({ action: (currentPoi === null || currentPoi === void 0 ? void 0 : currentPoi.id) ===
poi.id ? ((0, jsx_runtime_1.jsx)(tdesign_icons_react_1.CheckCircleFilledIcon, { className: "".concat(prefixCls, "-location-list-checked"), size: 24 })) : ((0, jsx_runtime_1.jsx)("div", { style: {
width: 24,
} })) }, { children: (0, jsx_runtime_1.jsx)(ListItemMeta, { title: poi.name, description: "".concat(poi.distance
? "".concat(poi.distance, "m\u5185 | ")
: '').concat(poi.address) }) })) }), poi.id));
})), mode === 'searchPoi' && ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [searchLoading && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-location-list-loadingBox") }, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Loading, { delay: 0, fullscreen: false, indicator: true, inheritColor: false, loading: true, preventScrollThrough: true, showOverlay: true, size: "medium" }) }))), (pois === null || pois === void 0 ? void 0 : pois.length)
? pois.map(function (poi, index) {
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function () {
setRefresh(false);
setCurrentPoi(poi);
} }, { children: (0, jsx_runtime_1.jsx)(ListItem, tslib_1.__assign({ action: (currentPoi === null || currentPoi === void 0 ? void 0 : currentPoi.id) ===
poi.id ? ((0, jsx_runtime_1.jsx)(tdesign_icons_react_1.CheckCircleFilledIcon, { className: "".concat(prefixCls, "-location-list-checked"), size: 24 })) : ((0, jsx_runtime_1.jsx)("div", { style: {
width: 24,
} })) }, { children: (0, jsx_runtime_1.jsx)(ListItemMeta, { title: poi.name, description: "".concat(poi.distance
? "".concat(poi.distance, "m\u5185 | ")
: '').concat(poi.address) }) })) }), poi.id));
})
: show && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-location-list-noData") }, { children: "\u65E0\u641C\u7D20\u7ED3\u679C" })))] }))] })) }) }))] }) })) })));
};
exports.default = Location;

View File

@ -1,39 +0,0 @@
.oak-location {
&-map {
width: 100%;
height: 500px;
}
&-list {
height: 500px;
&-header {
display: flex;
flex-direction: row;
align-items: center;
}
&-checked {
color: var(--oak-brand-color);
}
&-loadingBox {
display: flex;
flex-direction: row;
justify-content: center;
min-height: 100px;
}
&-noData {
display: flex;
flex-direction: row;
justify-content: center;
min-height: 100px;
align-items: center;
color: var(--oak-text-color-placeholder);
align-self: center;
}
}
}

View File

@ -1,31 +0,0 @@
/// <reference types="@uiw/react-amap-types" />
import React from 'react';
import { MapProps, APILoaderConfig } from '@uiw/react-amap';
import './index.less';
export declare type APILoaderProps = {
akey: APILoaderConfig['akay'];
version?: APILoaderConfig['version'];
};
declare type RenderProps = {
children?: (data: {
AMap: typeof AMap;
map: AMap.Map;
container?: HTMLDivElement | null;
}) => undefined;
} | {
children?: React.ReactNode;
};
export interface AMapProps extends APILoaderProps {
style?: React.CSSProperties;
className?: string;
children?: RenderProps['children'];
mapProps?: MapProps;
mapRef?: React.Ref<MapProps & {
map?: AMap.Map | undefined;
}>;
useAMapUI?: boolean;
uiVersion?: string;
uiCallback?: (status: 'success' | 'fail', result?: any) => void;
}
declare const memo: (props: AMapProps) => JSX.Element;
export default memo;

View File

@ -1,32 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var react_amap_1 = require("@uiw/react-amap");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
;
var memo = function (props) {
var akey = props.akey, version = props.version, className = props.className, style = props.style, children = props.children, _a = props.mapProps, mapProps = _a === void 0 ? {} : _a, mapRef = props.mapRef, useAMapUI = props.useAMapUI, _b = props.uiVersion, uiVersion = _b === void 0 ? '1.1' : _b, uiCallback = props.uiCallback;
var prefixCls = 'oak';
(0, react_1.useEffect)(function () {
if (!useAMapUI) {
return;
}
if (window.AMap && !window.AMapUI) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "".concat(window.location.protocol, "//webapi.amap.com/ui/").concat(uiVersion, "/main.js");
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = function () {
uiCallback && uiCallback('success');
};
script.onerror = function (error) {
uiCallback && uiCallback('fail', error);
};
}
}, [window.AMap, useAMapUI]);
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: style, className: (0, classnames_1.default)("".concat(prefixCls, "-map"), className) }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.APILoader, tslib_1.__assign({ akay: akey, version: version }, { children: (0, jsx_runtime_1.jsx)(react_amap_1.Map, tslib_1.__assign({ ref: mapRef }, mapProps, { children: children })) })) })));
};
exports.default = memo;

View File

@ -1,5 +0,0 @@
.oak-map {
width: 500px;
height: 500px;
}

View File

@ -1,52 +0,0 @@
"use strict";
// index.ts
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
OakComponent({
entity: 'area',
isList: false,
formData: function (_a) {
var area = _a.data;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
return [2 /*return*/, ({
name: area === null || area === void 0 ? void 0 : area.name,
})];
});
});
},
});

View File

@ -1 +0,0 @@
{}

View File

@ -1,28 +0,0 @@
/** index.wxss **/
.page-body {
display: flex;
flex-direction: column;
align-items: stretch;
color: #aaa;
}
.label-bar {
padding: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.label-bar text {
margin-right: 20rpx;
width: 200rpx;
}
.label-bar input {
flex: 1;
}
.usermotto {
margin-top: 200px;
}

View File

@ -1,7 +0,0 @@
<!-- index.wxml -->
<view class="page-body">
<view class="label-bar">
<text>地区名称</text>
<input placeholder="请输入名称" value="{{name}}" type="string" data-path="name" bindinput="setUpdateData" />
</view>
</view>

View File

@ -1,4 +0,0 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,12 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
require("./index.less");
var Empty = function () {
var prefixCls = 'oak';
var themeMode = document.documentElement.getAttribute('theme-mode');
var themePrefixCls = "".concat(prefixCls, "-empty-img-default") + (themeMode === 'dark' ? '-dark' : '');
return ((0, jsx_runtime_1.jsx)("svg", tslib_1.__assign({ className: themePrefixCls, width: "184", height: "152", viewBox: "0 0 184 152", xmlns: "http://www.w3.org/2000/svg" }, { children: (0, jsx_runtime_1.jsxs)("g", tslib_1.__assign({ fill: "none", fillRule: "evenodd" }, { children: [(0, jsx_runtime_1.jsxs)("g", tslib_1.__assign({ transform: "translate(24 31.67)" }, { children: [(0, jsx_runtime_1.jsx)("ellipse", { className: "".concat(themePrefixCls, "-ellipse"), cx: "67.797", cy: "106.89", rx: "67.797", ry: "12.668" }), (0, jsx_runtime_1.jsx)("path", { className: "".concat(themePrefixCls, "-path-1"), d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z" }), (0, jsx_runtime_1.jsx)("path", { className: "".concat(themePrefixCls, "-path-2"), d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z", transform: "translate(13.56)" }), (0, jsx_runtime_1.jsx)("path", { className: "".concat(themePrefixCls, "-path-3"), d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z" }), (0, jsx_runtime_1.jsx)("path", { className: "".concat(themePrefixCls, "-path-4"), d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z" })] })), (0, jsx_runtime_1.jsx)("path", { className: "".concat(prefixCls, "-path-5"), d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z" }), (0, jsx_runtime_1.jsxs)("g", tslib_1.__assign({ className: "".concat(themePrefixCls, "-g"), transform: "translate(149.65 15.383)" }, { children: [(0, jsx_runtime_1.jsx)("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })] }))] })) })));
};
exports.default = Empty;

View File

@ -1,16 +0,0 @@
import * as React from 'react';
import './index.less';
declare type EmptyProps = {
className?: string;
style?: React.CSSProperties;
imageStyle?: React.CSSProperties;
image?: React.ReactNode;
description?: React.ReactNode;
children?: React.ReactNode;
};
interface EmptyType extends React.FC<EmptyProps> {
PRESENTED_IMAGE_DEFAULT: React.ReactNode;
PRESENTED_IMAGE_SIMPLE: React.ReactNode;
}
declare const Empty: EmptyType;
export default Empty;

View File

@ -1,30 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
var empty_1 = tslib_1.__importDefault(require("./empty"));
var simple_1 = tslib_1.__importDefault(require("./simple"));
var defaultEmptyImg = (0, jsx_runtime_1.jsx)(empty_1.default, {});
var simpleEmptyImg = (0, jsx_runtime_1.jsx)(simple_1.default, {});
var Empty = function (props) {
var _a;
var className = props.className, _b = props.image, image = _b === void 0 ? defaultEmptyImg : _b, description = props.description, children = props.children, imageStyle = props.imageStyle, restProps = tslib_1.__rest(props, ["className", "image", "description", "children", "imageStyle"]);
var des = typeof description !== 'undefined' ? description : '暂无数据';
var alt = typeof des === 'string' ? des : 'empty';
var imageNode = null;
if (typeof image === 'string') {
imageNode = (0, jsx_runtime_1.jsx)("img", { alt: alt, src: image });
}
else {
imageNode = image;
}
var prefixCls = 'oak';
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: (0, classnames_1.default)("".concat(prefixCls, "-empty"), (_a = {},
_a["".concat(prefixCls, "-empty-normal")] = image === simpleEmptyImg,
_a), className) }, restProps, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-empty-image"), style: imageStyle }, { children: imageNode })), des && (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-empty-description") }, { children: des })), children && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-empty-footer") }, { children: children })))] })));
};
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
exports.default = Empty;

View File

@ -1,146 +0,0 @@
.oak-empty {
margin: 0 8px;
font-size: 14px;
line-height: 1.5715;
text-align: center;
&-image {
height: 100px;
margin-bottom: 8px;
img {
height: 100%;
}
svg {
height: 100%;
margin: auto;
}
}
&-footer {
margin-top: 16px;
}
&-normal {
margin: 32px 0;
color: var(--oak-text-color-disabled);
.oak-empty-image {
height: 40px;
}
}
&-small {
margin: 8px 0;
color: var(--oak-text-color-disabled);
.oak-empty-image {
height: 35px;
}
}
}
.oak-empty-img-default {
&-ellipse {
fill: #f5f5f5;
fill-opacity: 0.8;
}
&-path {
&-1 {
fill: #aeb8c2;
}
&-2 {
fill: url('#linearGradient-1');
}
&-3 {
fill: #f5f5f7;
}
&-4 {
fill: #dce0e6;
}
&-5 {
fill: #dce0e6;
}
}
&-g {
fill: var(--oak-font-white-1);
}
}
.oak-empty-img-default-dark {
&-ellipse {
fill: var(--oak-font-white-1);
fill-opacity: 0.08;
}
&-path {
&-1 {
fill: #262626;
}
&-2 {
fill: url('#linearGradient-1');
}
&-3 {
fill: #595959;
}
&-4 {
fill: #434343;
}
&-5 {
fill: #595959;
}
}
&-g {
fill: #434343;
}
}
.oak-empty-img-simple {
&-ellipse {
fill: #f5f5f5;
}
&-g {
stroke: #d9d9d9;
}
&-path {
fill: #fafafa;
}
}
.oak-empty-img-simple-dark {
&-ellipse {
fill: var(--oak-font-white-1);
fill-opacity: 0.08;
}
&-g {
stroke: #434343;
}
&-path {
fill: #262626;
stroke: #434343;
}
}

View File

@ -1,4 +0,0 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,12 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
require("./index.less");
var Empty = function () {
var prefixCls = 'oak';
var themeMode = document.documentElement.getAttribute('theme-mode');
var themePrefixCls = "".concat(prefixCls, "-empty-img-simple") + (themeMode === 'dark' ? '-dark' : '');
return ((0, jsx_runtime_1.jsx)("svg", tslib_1.__assign({ className: themePrefixCls, width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg" }, { children: (0, jsx_runtime_1.jsxs)("g", tslib_1.__assign({ transform: "translate(0 1)", fill: "none", fillRule: "evenodd" }, { children: [(0, jsx_runtime_1.jsx)("ellipse", { className: "".concat(themePrefixCls, "-ellipse"), cx: "32", cy: "33", rx: "32", ry: "7" }), (0, jsx_runtime_1.jsxs)("g", tslib_1.__assign({ className: "".concat(themePrefixCls, "-g"), fillRule: "nonzero" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), (0, jsx_runtime_1.jsx)("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", className: "".concat(themePrefixCls, "-path") })] }))] })) })));
};
exports.default = Empty;

View File

@ -1,19 +0,0 @@
import React from 'react';
import './index.less';
declare type Item = {
text: React.ReactNode;
image: React.ReactNode;
};
declare type GridProps = {
column?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
gutter?: number;
style?: React.CSSProperties;
className?: string;
imageClassName?: string;
textClassName?: string;
children?: React.ReactNode;
list: Array<Item>;
onChange?: (index: number, event?: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
};
declare const _default: React.MemoExoticComponent<(props: GridProps) => JSX.Element>;
export default _default;

View File

@ -1,22 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
var prefixCls = 'oak';
exports.default = (0, react_1.memo)(function (props) {
var style = props.style, className = props.className, _a = props.column, column = _a === void 0 ? 4 : _a, _b = props.gutter, gutter = _b === void 0 ? 0 : _b, list = props.list, onChange = props.onChange, imageClassName = props.imageClassName, textClassName = props.textClassName;
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-grid"), style: {
gap: gutter,
} }, { children: list === null || list === void 0 ? void 0 : list.map(function (ele, index) {
var _a;
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: (0, classnames_1.default)(className, "".concat(prefixCls, "-grid-item"), (_a = {},
_a["".concat(prefixCls, "-grid-item-column-").concat(column)] = column,
_a)), style: style, onClick: onChange ? function (event) { return onChange(index, event); } : undefined }, { children: [typeof ele.image === 'string' ? ((0, jsx_runtime_1.jsx)("img", { className: (0, classnames_1.default)("".concat(prefixCls, "-grid-item-image"), imageClassName), src: ele.image })) : (ele.image), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-grid-item-text") }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: (0, classnames_1.default)("".concat(prefixCls, "-grid-item-title"), textClassName), style: {
paddingTop: 8,
marginBottom: 4,
} }, { children: ele.text })) }))] }), index));
}) })));
});

View File

@ -1,69 +0,0 @@
.oak-grid {
flex-wrap: wrap;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: flex;
box-sizing: border-box;
&-item {
display: flex;
flex-direction: column;
padding-left: 0px;
padding-right: 0px;
align-items: center;
justify-content: center;
text-align: center;
padding-bottom: 12px;
padding-top: 12px;
&-column {
&-1 {
flex-basis: 100%;
}
&-2 {
flex-basis: 50%;
}
&-3 {
flex-basis: 33.33%;
}
&-4 {
flex-basis: 25%;
}
&-5 {
flex-basis: 20%;
}
&-6 {
flex-basis: 16.66%;
}
&-7 {
flex-basis: 14.28%;
}
&-8 {
flex-basis: 12.5%;
}
}
&-image {
display: block;
height: 42px;
width: 100%;
}
&-title {
color: #000000e6;
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
}
}

View File

@ -1,20 +0,0 @@
import React from 'react';
import './index.less';
declare type PageHeaderProps = {
style?: React.CSSProperties;
className?: string;
title?: React.ReactNode;
showBack?: boolean;
onBack?: () => void;
backIcon?: React.ReactNode;
delta?: number;
extra?: React.ReactNode;
subTitle?: React.ReactNode;
contentMargin?: boolean;
contentStyle?: React.CSSProperties;
contentClassName?: string;
tags?: React.ReactNode;
children?: React.ReactNode;
};
declare const _default: React.MemoExoticComponent<(props: PageHeaderProps) => JSX.Element>;
export default _default;

View File

@ -1,25 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var react_router_dom_1 = require("react-router-dom");
var tdesign_react_1 = require("tdesign-react");
var tdesign_icons_react_1 = require("tdesign-icons-react");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
exports.default = (0, react_1.memo)(function (props) {
var _a;
var style = props.style, className = props.className, children = props.children, title = props.title, subTitle = props.subTitle, extra = props.extra, showBack = props.showBack, onBack = props.onBack, backIcon = props.backIcon, delta = props.delta, _b = props.contentMargin, contentMargin = _b === void 0 ? true : _b, contentStyle = props.contentStyle, contentClassName = props.contentClassName, tags = props.tags;
var prefixCls = 'oak';
var navigate = (0, react_router_dom_1.useNavigate)();
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ style: style, className: (0, classnames_1.default)("".concat(prefixCls, "-pageHeader"), className) }, { children: [(title || showBack || subTitle || tags || extra) && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-pageHeader-header") }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Row, { children: [(0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, tslib_1.__assign({ flex: "auto" }, { children: [showBack && ((0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ shape: "square", variant: "text", className: "".concat(prefixCls, "-pageHeader-header-back"), onClick: function () {
if (typeof onBack === 'function') {
onBack();
return;
}
navigate(delta || -1);
} }, { children: backIcon || ((0, jsx_runtime_1.jsx)(tdesign_icons_react_1.ArrowLeftIcon, { className: "".concat(prefixCls, "-pageHeader-header-backIcon") })) }))), title && ((0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: "".concat(prefixCls, "-pageHeader-header-title") }, { children: title }))), subTitle && ((0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: "".concat(prefixCls, "-pageHeader-header-subTitle") }, { children: subTitle }))), tags] })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Col, tslib_1.__assign({ flex: "auto" }, { children: extra }))] }) }))), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: contentStyle, className: (0, classnames_1.default)("".concat(prefixCls, "-pageHeader-content"), contentClassName, (_a = {},
_a["".concat(prefixCls, "-pageHeader-content-margin")] = contentMargin,
_a)) }, { children: children }))] })));
});

View File

@ -1,58 +0,0 @@
.oak-pageHeader {
display: flex;
flex-direction: column;
&-header {
margin: 0;
font-size: 0;
height: auto;
line-height: inherit;
min-height: inherit;
position: relative;
padding: 10px 20px;
color: #000;
background: var(--oak-bg-color-container);
&-backIcon {
width: 16px;
height: 16px;
}
&-title {
display: inline-block;
vertical-align: middle;
font-size: 16px;
font-weight: 700;
margin-right: 20px;
max-width: 70%;
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
height: 30px;
line-height: 30px;
}
&-subTitle {
font-size: 12px;
display: inline-block;
vertical-align: middle;
margin-right: 20px;
}
&-back {
margin-right: 24px;
}
}
&-content {
display: flex;
flex-direction: column;
&-margin {
margin: 20px;
}
}
}

View File

@ -1,92 +0,0 @@
import React from 'react';
import './index.less';
declare type SearchProps = {
/**
*
* @default ''
*/
action?: React.ReactNode;
/**
*
* @default false
*/
center?: boolean;
/**
*
* @default false
*/
disabled?: boolean;
/**
*
* @default false
*/
focus?: boolean;
/**
*
* @default ''
*/
label?: string;
/**
*
*/
leftIcon?: React.ReactNode;
/**
*
* @default ''
*/
placeholder?: string;
/**
*
*/
rightIcon?: React.ReactNode;
/**
*
* @default 'square'
*/
shape?: 'square' | 'round';
/**
*
* @default ''
*/
value?: string;
/**
*
* @default ''
*/
defaultValue?: string;
/**
*
* @default ''
*/
onActionClick?: (e?: React.MouseEvent<HTMLButtonElement> | React.MouseEvent<HTMLElement, MouseEvent>) => void;
/**
*
* @default ''
*/
onBlur?: (value: string, e?: React.FocusEvent<HTMLDivElement>) => void;
/**
*
* @default ''
*/
onChange?: (value: string, e?: React.FormEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>) => void;
/**
*
* @default ''
*/
onClear?: (e: React.MouseEvent<SVGSVGElement>) => void;
/**
*
* @default ''
*/
onFocus?: (value: string, e?: React.FocusEvent<HTMLDivElement>) => void;
/**
*
* @default ''
*/
onSubmit?: (value: string, e?: React.KeyboardEvent<HTMLDivElement> | React.FocusEvent<HTMLInputElement, Element>) => void;
style?: React.CSSProperties;
className?: string;
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
};
declare const Search: (props: SearchProps) => JSX.Element;
export default Search;

View File

@ -1,55 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var tdesign_icons_react_1 = require("tdesign-icons-react");
var tdesign_react_1 = require("tdesign-react");
require("./index.less");
var Search = function (props) {
var _a = props.className, className = _a === void 0 ? '' : _a, _b = props.style, style = _b === void 0 ? {} : _b, _c = props.action, action = _c === void 0 ? '' : _c, center = props.center, disabled = props.disabled, focus = props.focus, label = props.label, leftIcon = props.leftIcon, placeholder = props.placeholder, rightIcon = props.rightIcon, _d = props.shape, shape = _d === void 0 ? 'square' : _d, _e = props.value, value = _e === void 0 ? '' : _e, onActionClick = props.onActionClick, onBlur = props.onBlur, onChange = props.onChange, onClear = props.onClear, onFocus = props.onFocus, onSubmit = props.onSubmit, onClick = props.onClick;
var prefixCls = 'oak';
var inputRef = (0, react_1.useRef)(null);
var _f = tslib_1.__read((0, react_1.useState)(focus), 2), focusState = _f[0], setFocus = _f[1];
function handleBlur(e) {
var _a;
setFocus(false);
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
var value = e.currentTarget.value;
onBlur && onBlur(value, e);
}
function handleClear(e) {
onClear && onClear(e);
onChange && onChange('');
}
function handleAction(e) {
onActionClick && onActionClick(e);
}
function handleChange(e) {
var value = e.currentTarget.value;
onChange && onChange(value, e);
}
function handleFocus(e) {
var value = e.currentTarget.value;
onFocus && onFocus(value, e);
}
function handleSubmit(e) {
var value = e.currentTarget.value;
onSubmit && onSubmit(value, e);
}
function handleClick() {
var _a;
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
setFocus(true);
}
var shapeStyle = { borderRadius: shape === 'square' ? 'none' : '50px' };
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search ").concat(focusState ? "".concat(prefixCls, "-search-is-focused") : '', " ").concat(className), style: tslib_1.__assign({}, style), onClick: onClick }, { children: [label && ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__label-text"), style: {
marginLeft: '0px',
paddingRight: '8px',
color: 'rgba(0,0,0,0.9)',
whiteSpace: 'nowrap',
} }, { children: label }))), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__form"), style: tslib_1.__assign({}, shapeStyle) }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__box") }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__icon-search") }, { children: leftIcon })), (0, jsx_runtime_1.jsx)("input", { style: { textAlign: center ? 'center' : 'unset' }, ref: inputRef, type: "text", autoFocus: focusState, disabled: disabled, value: value, placeholder: placeholder, className: "".concat(prefixCls, "-search__input"), onBlur: handleBlur, onChange: handleChange,
// onFocus={handleFocus}
onSubmit: handleSubmit }), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__icon-close") }, { children: [value.length > 0 && ((0, jsx_runtime_1.jsx)(tdesign_icons_react_1.CloseCircleFilledIcon, { onClick: handleClear })), rightIcon] }))] })), (0, jsx_runtime_1.jsxs)("label", tslib_1.__assign({ className: "".concat(prefixCls, "-search__label"), style: tslib_1.__assign({}, shapeStyle), onClick: handleClick }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: "".concat(prefixCls, "-search__label-icon-search") }, { children: leftIcon })), (0, jsx_runtime_1.jsx)("span", tslib_1.__assign({ className: "".concat(prefixCls, "-search__label-text") }, { children: placeholder }))] }))] })), focusState && action && ((0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ className: "".concat(prefixCls, "-search__cancel-button"), variant: "text", theme: "primary", onClick: handleAction }, { children: action })))] })));
};
exports.default = Search;

View File

@ -1,118 +0,0 @@
// @import 'tdesign-mobile-react/es/style/index.css'; // 少量公共样式
.oak-search {
display: flex;
padding: 5px 10px;
background-color: #fff;
align-items: center;
box-sizing: border-box;
&__form {
position: relative;
flex: auto;
background-color: #f5f5f5;
border-radius: 4px;
}
&__box {
position: relative;
width: 100%;
height: 100%;
padding-left: 36px;
padding-right: 32px;
border-radius: inherit;
box-sizing: border-box;
z-index: 1;
}
&__label {
position: absolute;
display: flex;
top: 0;
right: 0;
bottom: 0;
left: 0;
font-size: 0;
color: #0006;
background-color: #f5f5f5;
align-items: center;
justify-content: center;
vertical-align: middle;
z-index: 2;
&-text {
display: inline-block;
font-size: 16px;
color: #0006;
margin-left: 8px;
vertical-align: middle;
}
}
&__input {
font-size: 16px;
color: #000000e6;
width: 100%;
height: 40px;
background-color: #f5f5f5;
padding: 0 16px;
border: 0;
outline: none;
/* stylelint-disable-next-line */
input::-webkit-input-placeholder,
input::placeholder {
color: rgba(0, 0, 0, 0.4);
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button,
input::-webkit-search-results-button,
input::-webkit-search-results-decoration {
display: none;
}
}
&__icon-search {
position: absolute;
top: 50%;
transform: translateX(-100%) translateY(-50%);
font-size: 24px;
line-height: 1;
color: #0006;
}
&__label-icon-search {
font-size: 24px;
line-height: 24px;
}
&__icon-close {
position: absolute;
top: 50%;
transform: translateX(0) translateY(-50%);
right: 12px;
font-size: 24px;
line-height: 1;
color: #0006;
}
&__cancel-button {
display: none;
margin-left: 5px;
margin-right: -5px;
}
&.oak-search-is-focused {
.oak-search {
&__cancel-button {
display: block;
}
&__label {
display: none;
}
}
}
}

View File

@ -1,22 +0,0 @@
import React from 'react';
import './index.less';
declare type Item = {
value: string;
icon: React.ReactNode;
text: React.ReactNode;
count?: number;
};
declare type TabBarProps = {
style?: React.CSSProperties;
className?: string;
iconClassName?: string;
textClassName?: string;
children?: React.ReactNode;
list: Array<Item>;
onChange?: (value: string, event?: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
fixed?: boolean;
bordered?: boolean;
value?: string;
};
declare const _default: React.MemoExoticComponent<(props: TabBarProps) => JSX.Element>;
export default _default;

View File

@ -1,25 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
var prefixCls = 'oak';
exports.default = (0, react_1.memo)(function (props) {
var _a;
var style = props.style, className = props.className, list = props.list, onChange = props.onChange, iconClassName = props.iconClassName, textClassName = props.textClassName, _b = props.fixed, fixed = _b === void 0 ? true : _b, _c = props.bordered, bordered = _c === void 0 ? false : _c, _d = props.value, value = _d === void 0 ? '' : _d;
var length = list === null || list === void 0 ? void 0 : list.length;
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: (0, classnames_1.default)("".concat(prefixCls, "-tabBar"), (_a = {},
_a["".concat(prefixCls, "-tabBar--fixed")] = fixed,
_a["".concat(prefixCls, "-tabBar--bordered")] = bordered,
_a)) }, { children: list === null || list === void 0 ? void 0 : list.map(function (ele, index) {
var _a;
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: (0, classnames_1.default)(className, "".concat(prefixCls, "-tabBar-item"), (_a = {},
_a["".concat(prefixCls, "-tabBar-item-column-").concat(length)] = length,
_a["".concat(prefixCls, "-tabBar-item-checked")] = value === ele.value,
_a)), style: style, onClick: onChange
? function (event) { return onChange(ele.value, event); }
: undefined }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: (0, classnames_1.default)("".concat(prefixCls, "-tabBar-item-icon"), iconClassName) }, { children: typeof ele.icon === 'string' ? ((0, jsx_runtime_1.jsx)("img", { className: (0, classnames_1.default)("".concat(prefixCls, "-tabBar-item-image"), iconClassName), src: ele.icon })) : (ele.icon) })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: (0, classnames_1.default)("".concat(prefixCls, "-tabBar-item-text"), textClassName) }, { children: ele.text }))] }), index));
}) })));
});

View File

@ -1,105 +0,0 @@
.oak-tabBar {
flex-wrap: nowrap;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: flex;
box-sizing: border-box;
background-color: #fff;
height: 48px;
position: relative;
width: 100%;
&--fixed {
bottom: 0;
left: 0;
position: fixed;
}
&--bordered {
::before {
border-top: 1px solid #e7e7e7;
top: 0;
}
::after {
border-bottom: 1px solid #e7e7e7;
bottom: 0;
}
}
&-item {
display: flex;
flex-direction: column;
padding-left: 0px;
padding-right: 0px;
align-items: center;
justify-content: center;
text-align: center;
color: #0009;
::after {
border-left: 1px solid #e7e7e7;
}
:first-child::before {
border: unset;
}
&-column {
&-1 {
flex-basis: 100%;
}
&-2 {
flex-basis: 50%;
}
&-3 {
flex-basis: 33.33%;
}
&-4 {
flex-basis: 25%;
}
&-5 {
flex-basis: 20%;
}
&-6 {
flex-basis: 16.66%;
}
&-7 {
flex-basis: 14.28%;
}
&-8 {
flex-basis: 12.5%;
}
}
&-checked {
color: var(--oak-brand-color);
}
&-image {
display: block;
height: 24px;
width: 100%;
}
&-icon {}
&-text {
font-size: 10px;
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
}
}

View File

@ -1,23 +0,0 @@
import React from 'react';
import './index.less';
declare type HTMLHeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
declare type TypographyProps = {
theme?: 'default' | 'secondary' | 'primary' | 'danger' | 'warning' | 'success' | 'placeholder' | 'disabled' | 'brand' | 'anti' | 'link';
size?: 'small' | 'medium' | 'large';
variant?: 'link' | 'mark' | 'body' | 'title' | 'headline' | 'display' | HTMLHeadingElement;
children?: React.ReactNode;
italic?: boolean;
strong?: boolean;
disabled?: boolean;
underline?: boolean;
delete?: boolean;
code?: boolean;
keyboard?: boolean;
mark?: boolean;
link?: boolean;
onClick?: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
style?: React.CSSProperties;
className?: string;
};
declare const _default: React.MemoExoticComponent<(props: TypographyProps) => JSX.Element>;
export default _default;

View File

@ -1,30 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var classnames_1 = tslib_1.__importDefault(require("classnames"));
require("./index.less");
var headingElement = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
exports.default = (0, react_1.memo)(function (props) {
var _a;
var children = props.children, _b = props.size, size = _b === void 0 ? 'medium' : _b, _c = props.theme, theme = _c === void 0 ? 'default' : _c, _d = props.variant, variant = _d === void 0 ? 'title' : _d, _e = props.italic, italic = _e === void 0 ? false : _e, _f = props.strong, strong = _f === void 0 ? false : _f, _g = props.disabled, disabled = _g === void 0 ? false : _g, _h = props.underline, underline = _h === void 0 ? false : _h, _j = props.delete, delete2 = _j === void 0 ? false : _j, _k = props.code, code = _k === void 0 ? false : _k, _l = props.keyboard, keyboard = _l === void 0 ? false : _l, _m = props.mark, mark = _m === void 0 ? false : _m, _o = props.link, link = _o === void 0 ? false : _o, onClick = props.onClick, style = props.style, className = props.className;
var prefixCls = 'oak';
var isHeadingElement = headingElement.includes(variant);
var Component = isHeadingElement
? variant
: 'span';
return ((0, jsx_runtime_1.jsx)(Component, tslib_1.__assign({ style: style, onClick: !disabled ? onClick : undefined, className: (0, classnames_1.default)("".concat(prefixCls, "-typography"), className, (_a = {},
_a["".concat(prefixCls, "-typography-").concat(variant, "-").concat(size)] = !isHeadingElement,
_a["".concat(prefixCls, "-typography-color-").concat(theme)] = !disabled,
_a["".concat(prefixCls, "-typography-italic")] = italic,
_a["".concat(prefixCls, "-typography-underline")] = underline,
_a["".concat(prefixCls, "-typography-delete")] = delete2,
_a["".concat(prefixCls, "-typography-strong")] = strong,
_a["".concat(prefixCls, "-typography-keyboard")] = keyboard,
_a["".concat(prefixCls, "-typography-code")] = code,
_a["".concat(prefixCls, "-typography-mark")] = mark,
_a["".concat(prefixCls, "-typography-link")] = link,
_a["".concat(prefixCls, "-typography-disabled")] = disabled,
_a)) }, { children: children })));
});

View File

@ -1,208 +0,0 @@
.oak-typography {
overflow-wrap: break-word;
&-link {
color: var(--oak-brand-color);
outline: none;
cursor: pointer;
transition: color .3s;
text-decoration: none;
background-color: transparent;
}
&-italic {
font-style: italic;
}
&-strong {
font-weight: 600;
}
&-underline {
text-decoration: underline;
}
&-delete {
text-decoration: line-through;
}
&-code {
margin: 0 0.2em;
padding: 0.2em 0.4em 0.1em;
font-size: 85%;
background: rgba(150, 150, 150, .1);
border: 1px solid rgba(100, 100, 100, .2);
border-radius: 3px;
}
&-keyboard {
margin: 0 0.2em;
padding: 0.15em 0.4em 0.1em;
font-size: 90%;
background: rgba(150, 150, 150, .06);
border: 1px solid rgba(100, 100, 100, .2);
border-bottom-width: 2px;
border-radius: 3px;
}
&-mark {
padding: 0;
background-color: #ffe58f;
}
&-disabled {
cursor: not-allowed;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
&-link {
&-small {
font-size: var(--oak-font-size-link-small);
line-height: var(--oak-line-height-link-small);
}
&-medium {
font-size: var(--oak-font-size-link-medium);
line-height: var(--oak-line-height-link-medium);
}
&-large {
font-size: var(--oak-font-size-link-large);
line-height: var(--oak-line-height-link-large);
}
}
&-mark {
&-small {
font-size: var(--oak-font-size-mark-small);
line-height: var(--oak-line-height-mark-small);
}
&-medium {
font-size: var(--oak-font-size-mark-medium);
line-height: var(--oak-line-height-mark-medium);
}
&-large {
font-size: var(--oak-font-size-body-large);
line-height: var(--oak-line-height-body-large);
}
}
&-body {
&-small {
font-size: var(--oak-font-size-body-small);
line-height: var(--oak-line-height-body-small);
}
&-medium {
font-size: var(--oak-font-size-body-medium);
line-height: var(--oak-line-height-body-medium);
}
&-large {
font-size: var(--oak-font-size-body-large);
line-height: var(--oak-line-height-body-large);
}
}
&-title {
&-small {
font-size: var(--oak-font-size-title-small);
line-height: var(--oak-line-height-title-small);
}
&-medium {
font-size: var(--oak-font-size-title-medium);
line-height: var(--oak-line-height-title-medium);
}
&-large {
font-size: var(--oak-font-size-title-large);
line-height: var(--oak-line-height-title-large);
}
}
&-headline {
&-small {
font-size: var(--oak-font-size-headline-small);
line-height: var(--oak-line-height-headline-small);
}
&-medium {
font-size: var(--oak-font-size-headline-medium);
line-height: var(--oak-line-height-headline-medium);
}
&-large {
font-size: var(--oak-font-size-headline-large);
line-height: var(--oak-line-height-headline-large);
}
}
&-display {
&-small {
font-size: 40px;
line-height: 48px;
}
&-medium {
font-size: var(--oak-font-size-display-medium);
line-height: var(--oak-line-height-display-medium);
}
&-large {
font-size: var(--oak-font-size-display-large);
line-height: var(--oak-line-height-display-large);
}
}
&-color {
&-default {
color: var(--oak-text-color-primary);
}
&-secondary {
color: var(--oak-text-color-secondary);
}
&-primary {
color: var(--oak-brand-color);
}
&-danger {
color: var(--oak-error-color);
}
&-warning {
color: var(--oak-warning-color);
}
&-success {
color: var(--oak-success-color);
}
&-link {
color: var(--oak-text-color-link);
}
&-placeholder {
color: var(--oak-text-color-placeholder);
}
&-disabled {
color: var(--oak-text-color-disabled);
}
&-anti {
color: var(--oak-text-color-anti);
}
&-brand {
color: var(--oak-text-color-brand);
}
}
}

View File

@ -1,7 +0,0 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Account(props: {
account: Required<Config>['Account'];
setValue: (path: string, value: any) => void;
removeItem: (path: string, index: number) => void;
}): JSX.Element;

View File

@ -1,33 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var tdesign_react_1 = require("tdesign-react");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var FormItem = tdesign_react_1.Form.FormItem;
var TabPanel = tdesign_react_1.Tabs.TabPanel;
function TencentAccount(props) {
var accounts = props.accounts, setValue = props.setValue, removeItem = props.removeItem;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, tslib_1.__assign({ align: "stretch" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Divider, tslib_1.__assign({ align: "left", className: web_module_less_1.default.title }, { children: "\u817E\u8BAF\u4E91\u914D\u7F6E" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Tabs, tslib_1.__assign({ placement: 'top', size: 'medium', disabled: false, theme: "normal", addable: accounts.length > 0 }, { children: accounts.length > 0 ? accounts.map(function (ele, idx) {
console.log(ele);
return ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: idx, label: "\u5E10\u53F7".concat(idx + 1), removable: true, onRemove: function () { return removeItem('', idx); } }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: false, labelAlign: "left", labelWidth: "100px", layout: "vertical", preventSubmitDefault: true, resetType: "empty", showErrorMessage: true, submitWithWarningMessage: false, style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretId", name: "secretId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.secretId, onChange: function (value) { return setValue("".concat(idx, ".secretId"), value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretKey", name: "secretKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.secretKey, onChange: function (value) { return setValue("".concat(idx, ".secretKey"), value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "region", name: "region", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165region", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.region, onChange: function (value) { return setValue("".concat(idx, ".region"), value); } }) }) }))] })) }), idx));
}) : ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: 0, label: "\u65B0\u5EFA\u5E10\u53F7" }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", labelWidth: "100px", layout: "vertical", style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretId", name: "secretId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.secretId", value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretKey", name: "secretKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.secretKey", value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "region", name: "region", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165region", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.region", value); } }) }) }))] })) }), 0)) }))] })));
}
function QiniuAccount(props) {
var accounts = props.accounts, setValue = props.setValue, removeItem = props.removeItem;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, tslib_1.__assign({ align: "stretch" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Divider, tslib_1.__assign({ align: "left", className: web_module_less_1.default.title }, { children: "\u4E03\u725B\u4E91\u914D\u7F6E" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Tabs, tslib_1.__assign({ placement: 'top', size: 'medium', disabled: false, theme: "normal", addable: accounts.length > 0 }, { children: accounts.length > 0 ? accounts.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: idx, label: "\u5E10\u53F7".concat(idx + 1), removable: true, onRemove: function () { return removeItem('', idx); } }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: false, labelAlign: "left", labelWidth: "100px", layout: "vertical", preventSubmitDefault: true, resetType: "empty", showErrorMessage: true, submitWithWarningMessage: false, style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKey", name: "accessKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.accessKey, onChange: function (value) { return setValue("".concat(idx, ".accessKey"), value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretKey", name: "secretKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.secretKey, onChange: function (value) { return setValue("".concat(idx, ".secretKey"), value); } }) }) }))] })) }), idx)); }) : ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: 0, label: "\u65B0\u5EFA\u5E10\u53F7" }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", labelWidth: "100px", layout: "vertical", style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKey", name: "accessKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.accessKey", value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "secretKey", name: "secretKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165secretKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.secretKey", value); } }) }) }))] })) }), 0)) }))] })));
}
function AliAccount(props) {
var accounts = props.accounts, setValue = props.setValue, removeItem = props.removeItem;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, tslib_1.__assign({ align: "stretch" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Divider, tslib_1.__assign({ align: "left", className: web_module_less_1.default.title }, { children: "\u963F\u91CC\u4E91\u914D\u7F6E" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Tabs, tslib_1.__assign({ placement: 'top', size: 'medium', disabled: false, theme: "normal", addable: accounts.length > 0 }, { children: accounts.length > 0 ? accounts.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: idx, label: "\u5E10\u53F7".concat(idx + 1), removable: true, onRemove: function () { return removeItem('', idx); } }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: false, labelAlign: "left", labelWidth: "100px", layout: "vertical", preventSubmitDefault: true, resetType: "empty", showErrorMessage: true, submitWithWarningMessage: false, style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKeyId", name: "accessKeyId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKeyId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.accessKeyId, onChange: function (value) { return setValue("".concat(idx, ".accessKeyId"), value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKeySecret", name: "accessKeySecret", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKeySecret", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.accessKeySecret, onChange: function (value) { return setValue("".concat(idx, ".accessKeySecret"), value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "regionId", name: "regionId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165regionId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.regionId, onChange: function (value) { return setValue("".concat(idx, ".regionId"), value); } }) }) }))] })) }), idx)); }) : ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: 0, label: "\u65B0\u5EFA\u5E10\u53F7" }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", labelWidth: "100px", layout: "vertical", style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKeyId", name: "accessKeyId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKeyId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.accessKeyId", value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "accessKeySecret", name: "accessKeySecret", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165accessKeySecret", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.accessKeySecret", value); } }) }) })), (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "regionId", name: "regionId", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165regionId", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.regionId", value); } }) }) }))] })) }), 0)) }))] })));
}
function AmapAccount(props) {
var accounts = props.accounts, setValue = props.setValue, removeItem = props.removeItem;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, tslib_1.__assign({ align: "stretch" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Divider, tslib_1.__assign({ align: "left", className: web_module_less_1.default.title }, { children: "\u9AD8\u5FB7\u4E91\u914D\u7F6E" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Tabs, tslib_1.__assign({ placement: 'top', size: 'medium', disabled: false, theme: "normal", addable: accounts.length > 0 }, { children: accounts.length > 0 ? accounts.map(function (ele, idx) { return ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: idx, label: "\u5E10\u53F7".concat(idx + 1), removable: true, onRemove: function () { return removeItem('', idx); } }, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Form, tslib_1.__assign({ colon: false, labelAlign: "left", labelWidth: "100px", layout: "vertical", preventSubmitDefault: true, resetType: "empty", showErrorMessage: true, submitWithWarningMessage: false, style: { marginTop: 10 } }, { children: (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "webApiKey", name: "webApiKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165webApiKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: ele.webApiKey, onChange: function (value) { return setValue("".concat(idx, ".webApiKey"), value); } }) }) })) })) }), idx)); }) : ((0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ value: 0, label: "\u65B0\u5EFA\u5E10\u53F7" }, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Form, tslib_1.__assign({ colon: true, labelAlign: "left", labelWidth: "100px", layout: "vertical", style: { marginTop: 10 } }, { children: (0, jsx_runtime_1.jsx)(FormItem, tslib_1.__assign({ label: "webApiKey", name: "webApiKey", successBorder: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Input, { align: "left", autoWidth: false, autofocus: false, clearable: false, placeholder: "\u8BF7\u8F93\u5165webApiKey", readonly: false, showClearIconOnEmpty: false, size: "medium", status: "default", type: "text", value: "", onChange: function (value) { return setValue("0.webApiKey", value); } }) }) })) })) }), 0)) }))] })));
}
function Account(props) {
var account = props.account, setValue = props.setValue, removeItem = props.removeItem;
var tencent = account.tencent, qiniu = account.qiniu, ali = account.ali, amap = account.amap;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Col, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Row, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Card, tslib_1.__assign({ className: web_module_less_1.default.tips }, { children: "\u6BCF\u79CD\u4E91\u5382\u5546\u5747\u53EF\u914D\u7F6E\u591A\u4E2A\u5E10\u53F7\uFF0C\u76F8\u5E94\u7684\u670D\u52A1\u6240\u4F7F\u7528\u7684\u5E10\u53F7\u8BF7\u51C6\u786E\u5BF9\u5E94" })) }), (0, jsx_runtime_1.jsx)(TencentAccount, { accounts: tencent || [], setValue: function (path, value) { return setValue("tencent.".concat(path), value); }, removeItem: function (path, index) { return removeItem("tencent", index); } }), (0, jsx_runtime_1.jsx)(QiniuAccount, { accounts: qiniu || [], setValue: function (path, value) { return setValue("qiniu.".concat(path), value); }, removeItem: function (path, index) { return removeItem("qiniu", index); } }), (0, jsx_runtime_1.jsx)(AliAccount, { accounts: ali || [], setValue: function (path, value) { return setValue("ali.".concat(path), value); }, removeItem: function (path, index) { return removeItem("ali", index); } }), (0, jsx_runtime_1.jsx)(AmapAccount, { accounts: amap || [], setValue: function (path, value) { return setValue("amap.".concat(path), value); }, removeItem: function (path, index) { return removeItem("amap", index); } })] }));
}
exports.default = Account;

View File

@ -1,16 +0,0 @@
.label {
color: var(--oak-text-color-primary);
font-size: var(--oak-font-size-headline-medium);
line-height: var(--oak-line-height-headline-medium);
}
.tips {
color: var(--oak-gray-color-6);
font-size: var(--oak-font-size-mark-small);
}
.title {
margin-bottom: 0px;
margin-top:36px;
}

View File

@ -1,3 +0,0 @@
/// <reference types="react" />
declare const _default: import("react").ComponentType<any>;
export default _default;

View File

@ -1,75 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var lodash_1 = require("oak-domain/lib/utils/lodash");
exports.default = OakComponent({
isList: false,
properties: {
config: Object,
entity: String,
name: String,
entityId: String,
},
data: {
initialConfig: {},
dirty: false,
currentConfig: {},
},
observers: {
config: function (config) {
this.setState({
initialConfig: config,
dirty: false,
currentConfig: (0, lodash_1.cloneDeep)(config),
});
}
},
methods: {
setValue: function (path, value) {
var currentConfig = this.state.currentConfig;
var newConfig = (0, lodash_1.cloneDeep)(currentConfig);
(0, lodash_1.set)(newConfig, path, value);
this.setState({
currentConfig: newConfig,
dirty: true,
});
},
removeItem: function (path, index) {
var currentConfig = this.state.currentConfig;
var array = (0, lodash_1.get)(currentConfig, path);
array.splice(index, 1);
var newConfig = (0, lodash_1.cloneDeep)(currentConfig);
this.setState({
currentConfig: newConfig,
dirty: true,
});
},
resetConfig: function () {
var initialConfig = this.state.initialConfig;
this.setState({
dirty: false,
currentConfig: (0, lodash_1.cloneDeep)(initialConfig),
});
},
updateConfig: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var currentConfig, _a, entity, entityId;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
currentConfig = this.state.currentConfig;
_a = this.props, entity = _a.entity, entityId = _a.entityId;
return [4 /*yield*/, this.features.config.updateConfig(entity, entityId, currentConfig)];
case 1:
_b.sent();
this.setMessage({
content: '操作成功',
type: 'success',
});
return [2 /*return*/];
}
});
});
}
},
});

View File

@ -1,38 +0,0 @@
.container {
background: var(--oak-bg-color-container);
box-shadow: 0 2px 3px #0000001a;
border-radius: 3px;
padding: 30px 32px;
}
.padding {
background-color: var(--oak-bg-color-page);
width: 100%;
height: 77px;
}
.ctrl {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10px;
border: solid 0.4px;
border-radius: 3px;
border-color: var(--oak-component-border);
position: absolute;
z-index: 10;
background-color: var(--oak-bg-color-container-hover);
width: calc(100vw - 138px);
top: 85px;
height: 55px;
text {
color: var(--oak-text-color-secondary);
.weight {
font-weight: bold;
color: var(--oak-text-color-primary);
text-decoration: underline;
}
}
}

View File

@ -1,2 +0,0 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var tdesign_react_1 = require("tdesign-react");
var TabPanel = tdesign_react_1.Tabs.TabPanel;
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var index_1 = tslib_1.__importDefault(require("./account/index"));
function render() {
var _this = this;
var _a = this.props, entity = _a.entity, name = _a.name;
var _b = this.state, currentConfig = _b.currentConfig, dirty = _b.dirty;
var account = currentConfig.Account;
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: web_module_less_1.default.padding }), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.ctrl }, { children: [(0, jsx_runtime_1.jsxs)("text", { children: ["\u60A8\u6B63\u5728\u66F4\u65B0", (0, jsx_runtime_1.jsx)("text", tslib_1.__assign({ className: web_module_less_1.default.weight }, { children: entity })), "\u5BF9\u8C61", (0, jsx_runtime_1.jsx)("text", tslib_1.__assign({ className: web_module_less_1.default.weight }, { children: name })), "\u7684\u914D\u7F6E\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C"] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ disabled: !dirty, theme: "primary", onClick: function () { return _this.resetConfig(); }, style: {
marginRight: 10,
} }, { children: "\u91CD\u7F6E" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ disabled: !dirty, theme: "danger", onClick: function () { return _this.updateConfig(); } }, { children: "\u786E\u5B9A" }))] })] })), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsx)(tdesign_react_1.Tabs, tslib_1.__assign({ placement: 'left' }, { children: (0, jsx_runtime_1.jsx)(TabPanel, tslib_1.__assign({ label: "\u4E91\u5E73\u53F0\u5E10\u53F7", style: {
marginLeft: 20,
} }, { children: (0, jsx_runtime_1.jsx)(index_1.default, { account: account || {}, setValue: function (path, value) { return _this.setValue("Account.".concat(path), value); }, removeItem: function (path, index) { return _this.removeItem("Account.".concat(path), index); } }) })) })) }))] }));
}
exports.default = render;

View File

@ -1 +0,0 @@
export {};

View File

@ -1,35 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var mockId_1 = require("oak-frontend-base/lib/utils/mockId");
var extraFile_1 = require("../../../utils/extraFile");
OakComponent({
entity: 'extraFile',
isList: false,
formData: function (_a) {
var extraFile = _a.data, features = _a.features;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var application, isTmp;
var _b;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, features.application.getApplication()];
case 1:
application = _c.sent();
isTmp = (extraFile === null || extraFile === void 0 ? void 0 : extraFile.id) && (0, mockId_1.isMockId)(extraFile.id);
return [2 /*return*/, {
src: extraFile && (0, extraFile_1.composeFileUrl)(extraFile, (_b = application === null || application === void 0 ? void 0 : application.system) === null || _b === void 0 ? void 0 : _b.config),
isTmp: isTmp,
}];
}
});
});
},
properties: {
// 图片显示模式
mode: {
type: String,
value: 'aspectFit',
},
},
});

View File

@ -1 +0,0 @@
{}

View File

@ -1,11 +0,0 @@
/** index.wxss **/
.image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 1rpx solid #eee;
border-radius: 4rpx;
}

View File

@ -1,2 +0,0 @@
<!-- index.wxml -->
<image src="{{src}}" mode="{{mode}}" class="image l-class"/>

View File

@ -1,2 +0,0 @@
/// <reference types="react" />
export default function render(): JSX.Element;

View File

@ -1,7 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
function render() {
return ((0, jsx_runtime_1.jsx)("div", { children: "react" }));
}
exports.default = render;

View File

@ -1,9 +0,0 @@
.container {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: 'center';
align-items: 'center';
}

View File

@ -1,3 +0,0 @@
/// <reference types="react" />
declare const _default: import("react").ComponentType<any>;
export default _default;

View File

@ -1,523 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var types_1 = require("oak-domain/lib/types");
var mockId_1 = require("oak-frontend-base/lib/utils/mockId");
var index_1 = tslib_1.__importDefault(require("../../../utils/dialog/index"));
var extraFile_1 = require("../../../utils/extraFile");
exports.default = OakComponent({
entity: 'extraFile',
isList: true,
formData: function (_a) {
var _b, _c;
var originalFiles = _a.data, features = _a.features;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var application, number2, files;
var _this = this;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
case 0: return [4 /*yield*/, features.application.getApplication()];
case 1:
application = _d.sent();
number2 = this.props.maxNumber;
files = originalFiles;
if (this.props.tag1) {
files = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag1) === _this.props.tag1; });
}
if (this.props.tag2) {
files = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.tag2) === _this.props.tag2; });
}
if (typeof number2 === 'number' &&
(number2 === 0 || (files === null || files === void 0 ? void 0 : files.length) >= number2)) {
return [2 /*return*/, {
files: files,
disableInsert: true,
systemConfig: (_b = application === null || application === void 0 ? void 0 : application.system) === null || _b === void 0 ? void 0 : _b.config,
originalFiles: originalFiles,
}];
}
return [2 /*return*/, {
files: files,
disableInsert: false,
systemConfig: (_c = application === null || application === void 0 ? void 0 : application.system) === null || _c === void 0 ? void 0 : _c.config,
originalFiles: originalFiles,
}];
}
});
});
},
data: {
selected: -1,
// 根据 size 不同,计算的图片显示大小不同
itemSizePercentage: '',
newUploadFiles: [],
},
externalClasses: ['l-class', 'l-item-class'],
properties: {
oakFullpath: String,
oakParent: String,
oakPath: String,
autoUpload: {
type: Boolean,
value: false,
},
maxNumber: {
type: Number,
value: 20,
},
selectCount: {
//小程序独有 文件一次选择几个
type: Number,
value: 1,
},
sourceType: {
type: Array,
value: ['album', 'camera'],
},
mediaType: {
//小程序独有 文件上传类型
type: Array,
value: ['image'],
},
accept: {
// web独有 文件上传类型
type: String,
value: 'image/*',
},
// 图片显示模式
mode: {
type: String,
value: 'aspectFit',
},
// 图片是否可预览
preview: {
type: Boolean,
value: true,
},
// 每行可显示的个数
size: {
type: Number,
value: 3,
},
// 图片是否可删除
disableDelete: {
type: Boolean,
value: false,
},
type: String,
origin: String,
tag1: String,
tag2: String,
entity: String,
entityId: String,
},
methods: {
/**
* 获取组件内部节点位置信息单个
* @param component 组件实例
* @param selector {String} css选择器
* @returns boundingClientRect() 回调函数的值
*/
getNodeRectFromComponent: function (component, selector) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve) {
component
.createSelectorQuery()
.select(selector)
.boundingClientRect(function (res) {
resolve(res);
})
.exec();
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
},
/**
// * px 转 rpx
// * @param px 像素值
// */
px2rpx: function (px) {
var windowWidth = wx.getSystemInfoSync().windowWidth;
return (750 / windowWidth) * px;
},
onPick: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, selectCount, mediaType, sourceType, _b, errMsg, tempFiles, err_1;
var _this = this;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
_a = this.props, selectCount = _a.selectCount, mediaType = _a.mediaType, sourceType = _a.sourceType;
_c.label = 1;
case 1:
_c.trys.push([1, 6, , 7]);
return [4 /*yield*/, wx.chooseMedia({
count: selectCount,
mediaType: mediaType,
sourceType: sourceType,
})];
case 2:
_b = _c.sent(), errMsg = _b.errMsg, tempFiles = _b.tempFiles;
if (!(errMsg !== 'chooseMedia:ok')) return [3 /*break*/, 3];
this.triggerEvent('error', {
level: 'warning',
msg: errMsg,
});
return [3 /*break*/, 5];
case 3: return [4 /*yield*/, Promise.all(tempFiles.map(function (tempExtraFile) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var tempFilePath, thumbTempFilePath, fileType, size, filePath, fileFullName;
return tslib_1.__generator(this, function (_a) {
tempFilePath = tempExtraFile.tempFilePath, thumbTempFilePath = tempExtraFile.thumbTempFilePath, fileType = tempExtraFile.fileType, size = tempExtraFile.size;
filePath = tempFilePath || thumbTempFilePath;
fileFullName = filePath.match(/[^/]+(?!.*\/)/g)[0];
this.pushExtraFile({
name: fileFullName,
fileType: fileType,
size: size,
extra1: filePath,
});
return [2 /*return*/];
});
}); }))];
case 4:
_c.sent();
_c.label = 5;
case 5: return [3 /*break*/, 7];
case 6:
err_1 = _c.sent();
console.error(err_1);
if (err_1.errMsg !== 'chooseMedia:fail cancel') {
this.triggerEvent('error', {
level: 'error',
msg: err_1.errMsg,
});
}
return [3 /*break*/, 7];
case 7: return [2 /*return*/];
}
});
});
},
onWebPick: function (uploadFiles, callback) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.all(uploadFiles.map(function (uploadFile) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var name, fileType, size, raw;
return tslib_1.__generator(this, function (_a) {
name = uploadFile.name, fileType = uploadFile.type, size = uploadFile.size, raw = uploadFile.raw;
this.pushExtraFile({
name: name,
fileType: fileType,
size: size,
extra1: raw,
}, callback);
return [2 /*return*/];
});
}); }))];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
},
pushExtraFile: function (options, callback) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, type, origin, tag1, tag2, entity, entityId, autoUpload, name, extra1, fileType, size, extension, filename, updateData, bucket, _b, _c, _d, ele, error_1, err_2, ele;
var _e, _f;
var _this = this;
return tslib_1.__generator(this, function (_g) {
switch (_g.label) {
case 0:
_a = this.props, type = _a.type, origin = _a.origin, tag1 = _a.tag1, tag2 = _a.tag2, entity = _a.entity, entityId = _a.entityId, autoUpload = _a.autoUpload;
name = options.name, extra1 = options.extra1, fileType = options.fileType, size = options.size;
extension = name.substring(name.lastIndexOf('.') + 1);
filename = name.substring(0, name.lastIndexOf('.'));
(0, assert_1.default)(entity, '必须传入entity');
(0, assert_1.default)(origin === 'qiniu', '目前只支持七牛上传'); // 目前只支持七牛上传
_e = {
extra1: extra1,
origin: origin,
type: type || 'file',
tag1: tag1,
tag2: tag2
};
return [4 /*yield*/, generateNewId()];
case 1:
updateData = (_e.objectId = _g.sent(),
_e.entity = entity,
_e.filename = filename,
_e.size = size,
_e.extension = extension,
_e.fileType = fileType,
_e);
if (!autoUpload) return [3 /*break*/, 11];
_g.label = 2;
case 2:
_g.trys.push([2, 9, , 10]);
if (callback) {
callback(updateData, 'uploading');
}
return [4 /*yield*/, this.features.extraFile.upload(updateData)];
case 3:
bucket = (_g.sent()).bucket;
_g.label = 4;
case 4:
_g.trys.push([4, 7, , 8]);
_c = (_b = Object).assign;
_d = [updateData];
_f = {
bucket: bucket,
extra1: null
};
return [4 /*yield*/, generateNewId()];
case 5:
_c.apply(_b, _d.concat([(_f.id = _g.sent(),
_f.entityId = entityId,
_f)]));
return [4 /*yield*/, this.addExtraFile(updateData)];
case 6:
_g.sent();
if (callback) {
callback(updateData, 'success');
}
ele = {
updateData: updateData,
};
this.pushNode(undefined, ele);
return [3 /*break*/, 8];
case 7:
error_1 = _g.sent();
if (callback) {
callback(updateData, 'failed');
}
return [3 /*break*/, 8];
case 8: return [3 /*break*/, 10];
case 9:
err_2 = _g.sent();
if (callback) {
callback(updateData, 'failed');
}
return [3 /*break*/, 10];
case 10: return [3 /*break*/, 12];
case 11:
ele = {
updateData: updateData,
beforeExecute: function (updateData) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var bucket;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.features.extraFile.upload(updateData)];
case 1:
bucket = (_a.sent()).bucket;
Object.assign(updateData, {
bucket: bucket,
extra1: null,
});
return [2 /*return*/];
}
});
}); },
};
this.pushNode(undefined, ele);
_g.label = 12;
case 12: return [2 /*return*/];
}
});
});
},
onItemTapped: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, files, systemConfig, index, imageUrl, urls, detail, result;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.state, files = _a.files, systemConfig = _a.systemConfig;
index = event.currentTarget.dataset.index;
imageUrl = (0, extraFile_1.composeFileUrl)(files[index], systemConfig);
urls = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return !!ele; }).map(function (ele) { return (0, extraFile_1.composeFileUrl)(ele, systemConfig); });
detail = {
all: files,
index: index,
urls: urls,
current: imageUrl,
};
this.triggerEvent('tap', detail);
if (!this.props.preview) return [3 /*break*/, 2];
return [4 /*yield*/, wx.previewImage({
urls: urls,
current: imageUrl,
})];
case 1:
result = _b.sent();
this.triggerEvent('preview', detail);
_b.label = 2;
case 2: return [2 /*return*/];
}
});
});
},
onDelete: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var originalFiles, _a, value, index, id, findIndex, result, confirm_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
originalFiles = this.state.originalFiles;
_a = event.currentTarget.dataset, value = _a.value, index = _a.index;
id = value.id;
findIndex = originalFiles === null || originalFiles === void 0 ? void 0 : originalFiles.findIndex(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.id) === id; });
if (!(0, mockId_1.isMockId)(id)) return [3 /*break*/, 1];
this.removeNode('', "".concat(findIndex));
return [3 /*break*/, 3];
case 1: return [4 /*yield*/, wx.showModal({
title: '确认删除吗',
content: '删除现有文件',
})];
case 2:
result = _b.sent();
confirm_1 = result.confirm;
if (confirm_1) {
this.removeNode('', "".concat(findIndex));
}
_b.label = 3;
case 3: return [2 /*return*/];
}
});
});
},
onWebDelete: function (value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var originalFiles, id, findIndex, confirm_2;
var _this = this;
return tslib_1.__generator(this, function (_a) {
originalFiles = this.state.originalFiles;
id = value.id;
findIndex = originalFiles === null || originalFiles === void 0 ? void 0 : originalFiles.findIndex(function (ele) { return (ele === null || ele === void 0 ? void 0 : ele.id) === id; });
if ((0, mockId_1.isMockId)(id)) {
this.removeNode('', "".concat(findIndex));
}
else {
confirm_2 = index_1.default.confirm({
header: '确认删除当前文件?',
body: '删除后,文件不可恢复',
title: '确认删除当前文件?',
content: '删除后,文件不可恢复',
cancelBtn: '取消',
confirmBtn: '确定',
onConfirm: function () {
_this.removeNode('', "".concat(findIndex));
confirm_2.hide();
},
onCancel: function () {
confirm_2.hide();
},
onClose: function () {
confirm_2.hide();
},
});
}
return [2 /*return*/];
});
});
},
addExtraFile: function (extraFile) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var result, _a, _b, _c, error_2;
var _d;
return tslib_1.__generator(this, function (_e) {
switch (_e.label) {
case 0:
_e.trys.push([0, 3, , 4]);
_b = (_a = this.features.cache).operate;
_c = ['extraFile'];
_d = {
action: 'create',
data: extraFile
};
return [4 /*yield*/, generateNewId()];
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([(_d.id = _e.sent(),
_d)]))];
case 2:
result = _e.sent();
return [2 /*return*/, result];
case 3:
error_2 = _e.sent();
if (error_2.constructor.name ===
types_1.OakUnloggedInException.name) {
this.navigateTo({
url: '/login',
}, undefined);
return [2 /*return*/];
}
throw error_2;
case 4: return [2 /*return*/];
}
});
});
},
setNewUploadFiles: function (file, status) {
var filename = file.filename, size = file.size, id = file.id;
var newUploadFiles = this.state.newUploadFiles;
var file2 = newUploadFiles.find(function (ele) { return (ele.filename = filename && ele.size === size); });
Object.assign(file2, {
status: status,
id: id,
});
this.setState({
newUploadFiles: newUploadFiles,
});
},
customDelete: function (index) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var newUploadFiles, arr;
return tslib_1.__generator(this, function (_a) {
newUploadFiles = this.state.newUploadFiles;
arr = tslib_1.__spreadArray([], tslib_1.__read(newUploadFiles), false);
arr.splice(index, 1);
this.setState({
newUploadFiles: arr,
});
return [2 /*return*/];
});
});
},
},
observers: {
maxNumber: function () {
this.reRender();
},
/**
* size 属性变化时重新调整图片大小
* @param size 新值
*/
size: function (size) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var res, widthRpx, itemSizePercentage;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!size) {
this.setState({ itemSizePercentage: '' });
return [2 /*return*/];
}
return [4 /*yield*/, this.getNodeRectFromComponent(this, '.file-list__container')];
case 1:
res = _a.sent();
widthRpx = this.px2rpx(res.right - res.left);
itemSizePercentage = (10 / size) * 10 - (20 / widthRpx) * 100 + '%;';
this.setState({ itemSizePercentage: itemSizePercentage });
return [2 /*return*/];
}
});
});
},
},
});

View File

@ -1,9 +0,0 @@
{
"component": true,
"usingComponents": {
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon"
},
"componentGenerics": {
"item": true
}
}

View File

@ -1,110 +0,0 @@
@import "../../../config/styles/mp/index.less";
@import "../../../config/styles/mp/mixins.less";
.file-list__container {
position: relative;
display: flex;
flex-wrap: wrap;
}
.file-list__item {
position: relative;
width: 220rpx;
padding-bottom: 220rpx;
height: 0;
}
// size 不同时,对应的图片间距设置
// size 仅支持 1-10
each(range(2, 10), {
@valuePlusOne : @value+1;
.file-list__item--@{value}:nth-of-type(n+@{valuePlusOne}) {
margin-top : 20rpx;
}
.file-list__item--@{value}:not(:nth-of-type(@{value}n+1)) {
margin-left : 20rpx;
}
}) // 当 size 为 null每行会显示 3 张图片
.file-list__item--null:nth-of-type(n+4) {
margin-top: 20rpx;
}
.file-list__item--null:not(:nth-of-type(3n+1)) {
margin-left: 20rpx;
}
.file-list__image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 1rpx solid #eee;
border-radius: 4rpx;
}
.file-list__item--selected {
width: 100%;
height: 100%;
z-index: 10;
background-color: #000;
filter: Alpha(Opacity=50);
opacity: 0.5;
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
.file-list__remove {
position: absolute;
right: 10rpx;
top: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background: rgb(0 0 0 / 40%);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.file-list__item--add {
border: 1rpx solid #eee;
border-radius: 4rpx;
background-color: white;
}
.file-list__image--add {
visibility: hidden;
position: absolute;
width: 50%;
height: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
align-items: center;
justify-content: center;
display: flex;
}
.file-list__item-slot-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.file-list__item-slot-wrapper:empty+.file-list__image--add {
visibility: visible;
}

View File

@ -1,20 +0,0 @@
<view class="file-list__container l-class">
<block wx:for="{{files}}" wx:key="index">
<block wx:if="{{item}}">
<view class="file-list__item file-list__item--{{size}} l-item-class" style="{{itemSizePercentage?'width:'+itemSizePercentage+'padding-bottom:'+itemSizePercentage:'xxx'}}">
<item data-index="{{index}}" bind:tap="onItemTapped" mode="{{mode}}" oakValue="{{item}}" oakPath="{{index}}" oakParent="{{oakFullpath}}" />
<view wx:if="{{!disableDelete}}" mut-bind:tap="onDelete" class="file-list__remove" data-value="{{item}}" data-index="{{ index }}">
<t-icon name="close" color="#ffffff" size="18" />
</view>
</view>
</block>
</block>
<view class="file-list__item file-list__item--add file-list__item--{{size}} l-item-class" style="{{itemSizePercentage?'width:'+itemSizePercentage+'padding-bottom:'+itemSizePercentage:''}}" wx:if="{{!disableInsert}}" bind:tap="onPick">
<view class="file-list__item-slot-wrapper">
<slot />
</view>
<view class="file-list__image--add">
<t-icon name="add" size="80" />
</view>
</view>
</view>

View File

@ -1,4 +0,0 @@
{
"waiting": "等待中",
"success": "上传成功"
}

View File

@ -1,2 +0,0 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,101 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var tdesign_react_1 = require("tdesign-react");
var extraFile_1 = require("../../../utils/extraFile");
function extraFileToUploadFile(extraFile, systemConfig) {
return Object.assign({}, extraFile, {
url: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
name: extraFile.filename,
});
}
function render() {
var _this = this;
var _a = this.props, _b = _a.accept, accept = _b === void 0 ? 'image/*' : _b, _c = _a.maxNumber, maxNumber = _c === void 0 ? 20 : _c, _d = _a.multiple, multiple = _d === void 0 ? true : _d, _e = _a.useMockProgress, useMockProgress = _e === void 0 ? false : _e, _f = _a.draggable, draggable = _f === void 0 ? false : _f, _g = _a.showUploadProgress, showUploadProgress = _g === void 0 ? false : _g, _h = _a.theme, theme = _h === void 0 ? 'image' : _h, tips = _a.tips, placeholder = _a.placeholder, beforeUpload = _a.beforeUpload, disabled = _a.disabled, style = _a.style, className = _a.className, sizeLimit = _a.sizeLimit;
var _j = this.state, files = _j.files, systemConfig = _j.systemConfig, newUploadFiles = _j.newUploadFiles;
return ((0, jsx_runtime_1.jsxs)(tdesign_react_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Upload, tslib_1.__assign({ sizeLimit: sizeLimit, className: className, style: style, disabled: disabled, beforeUpload: beforeUpload, placeholder: placeholder, tips: tips, multiple: multiple, autoUpload: false, draggable: draggable, useMockProgress: useMockProgress, max: maxNumber, accept: accept, showUploadProgress: showUploadProgress, theme: theme, files: theme === 'custom'
? []
: (files || []).map(function (ele) {
return extraFileToUploadFile(ele, systemConfig);
}), onChange: function (uploadFiles) {
var arr = (uploadFiles === null || uploadFiles === void 0 ? void 0 : uploadFiles.filter(function (ele) { return !ele.id; })) || [];
_this.setState({
newUploadFiles: arr,
});
if (theme !== 'custom') {
_this.onWebPick(arr);
}
}, onRemove: function (_a) {
var file = _a.file, index = _a.index, e = _a.e;
_this.onWebDelete(file, index);
}, onPreview: function (_a) {
var file = _a.file, e = _a.e;
} }, { children: theme === 'custom' && ((0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ variant: "outline", theme: "default" }, { children: "\u9009\u62E9\u6587\u4EF6" }))) })), theme === 'custom' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Table, { data: newUploadFiles || [], rowKey: "id", columns: [
{
align: 'center',
colKey: 'tableIndex',
title: '序号',
cell: function (_a) {
var row = _a.row, rowIndex = _a.rowIndex;
return rowIndex + 1;
},
width: 100,
},
{
colKey: 'name',
title: '文件名',
},
{
colKey: 'size',
title: '文件大小',
cell: function (_a) {
var row = _a.row;
var b = (row === null || row === void 0 ? void 0 : row.size) / 1024;
return (0, extraFile_1.bytesToSize)(b);
},
},
{
colKey: 'status',
title: '状态',
cell: function (_a) {
var row = _a.row;
var cpn;
switch (row.status) {
case 'success':
cpn = ((0, jsx_runtime_1.jsx)(tdesign_react_1.Tag, tslib_1.__assign({ theme: "success", variant: "light" }, { children: "success" })));
break;
case 'uploading':
cpn = ((0, jsx_runtime_1.jsx)(tdesign_react_1.Loading, { loading: true, text: "uploading..." }));
break;
default:
cpn = ((0, jsx_runtime_1.jsx)(tdesign_react_1.Tag, tslib_1.__assign({ theme: "warning", variant: "light" }, { children: "waiting" })));
break;
}
return cpn;
},
},
{
colKey: 'op',
width: 300,
title: '操作',
align: 'center',
cell: function (_a) {
var row = _a.row, rowIndex = _a.rowIndex;
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !row.id && ((0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "primary", variant: "text", onClick: function () {
_this.customDelete(rowIndex);
} }, { children: "\u5220\u9664" }))) }));
},
fixed: 'right',
},
] }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { display: 'flex', justifyContent: 'flex-end' } }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Space, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "default", onClick: function () {
_this.setState({
newUploadFiles: [],
});
} }, { children: "\u5168\u90E8\u6E05\u7A7A" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ onClick: function () {
_this.onWebPick(newUploadFiles, function (file, status) {
_this.setNewUploadFiles(file, status);
});
} }, { children: "\u4E0A\u4F20" }))] }) }))] }))] })));
}
exports.default = render;

View File

@ -1,9 +0,0 @@
.container {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: 'center';
align-items: 'center';
}

View File

@ -1,36 +0,0 @@
"use strict";
Component({
properties: {
actions: Array,
actionDescriptions: Object,
show: {
type: Boolean,
value: false,
}
},
methods: {
onClick: function (touch) {
var index = touch.currentTarget.dataset.index;
var actions = this.data.actions;
var action = actions[index];
this.triggerEvent('click', { action: action });
},
closeDrawer: function () {
this.triggerEvent('close');
}
},
observers: {
actions: function (actions) {
var actionDescriptions = this.data.actionDescriptions;
var actionss = actions.map(function (action) { return actionDescriptions[action]; });
this.setData({ actionss: actionss });
},
},
lifetimes: {
ready: function () {
var _a = this.data, actions = _a.actions, actionDescriptions = _a.actionDescriptions;
var actionss = actions.map(function (action) { return actionDescriptions[action]; });
this.setData({ actionss: actionss });
}
}
});

View File

@ -1,10 +0,0 @@
{
"component": true,
"usingComponents": {
"t-button": "../../../miniprogram_npm/tdesign/button/button",
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon",
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup",
"t-grid": "../../../miniprogram_npm/tdesign/grid/grid",
"t-grid-item": "../../../miniprogram_npm/tdesign/grid/grid-item"
}
}

View File

@ -1,55 +0,0 @@
@import "../../../config/styles/mp/index.less";
@import "../../../config/styles/mp/mixins.less";
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.grid-item {
min-width: 25%;
padding: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
}
.block {
width: 176rpx;
height: 176rpx;
background: #fff;
color: #333;
display: flex;
}
.block--bottom {
width: 100vw;
height: 35vh;
border-top-left-radius: 16rpx;
border-top-right-radius: 16rpx;
}
.btn-box {
display: flex;
flex: 1;
flex-direction: column;
padding: 32rpx;
}
.five-grid {
position: unset;
}
.external-class-content {
padding: 32rpx 0 !important;
}
.image-icon {
width: 96rpx !important;
height: 96rpx !important;
}
.image {
width: 100%;
height: 100%;
}

View File

@ -1,13 +0,0 @@
<t-popup placement="bottom" visible="{{show}}" bind:visible-change="closeDrawer" close-btn="true">
<view class="block block--bottom">
<view class="btn-box">
<t-grid t-class="five-grid" column="{{5}}">
<block wx:for="{{actionss}}" wx:key="index">
<t-grid-item bind:tap="onClick" data-index="{{index}}" text="{{item.label}}" t-class-text="text" t-class-image="image-icon" t-class-content="external-class-content">
<t-icon class="image" name="{{item.icon.name}}" slot="image" />
</t-grid-item>
</block>
</t-grid>
</view>
</view>
</t-popup>

View File

@ -1,3 +0,0 @@
/// <reference types="react" />
declare const _default: import("react").ComponentType<any>;
export default _default;

View File

@ -1,65 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
isList: true,
data: {
visible: false,
dialogVisible: false,
},
methods: {
printDebugStore: function () {
console.log(this.features.cache.getFullData());
},
printCachedStore: function () {
console.log(this.features.cache.getCachedData());
},
printRunningTree: function () {
console.log(this.features.runningTree.getRoot());
},
resetInitialData: function () {
this.features.cache.resetInitialData();
this.features.token.logout();
},
setVisible: function (visible) {
this.setState({
visible: visible,
});
},
handlePopup: function () {
this.setVisible(true);
},
onVisibleChange: function (e) {
this.setVisible(e.detail.visible);
},
//小程序重置
handleReset: function () {
this.resetInitialData();
var pages = getCurrentPages(); //获取加载的页面
var currentPage = pages[pages.length - 1]; //获取当前页面的对象
var url = currentPage.route; //当前页面url
var options = currentPage.options; //如果要获取url中所带的参数可以查看options
this.redirectTo({
url: url
.replace('/pages', '')
.replace('pages', '')
.replace('/index', ''),
}, options);
this.closeDialog();
},
showDialog: function () {
this.setState({
dialogVisible: true,
});
},
closeDialog: function () {
this.setState({
dialogVisible: false,
});
},
downloadEnv: function () {
var data = this.features.localStorage.loadAll();
},
uploadEnv: function () {
}
},
});

View File

@ -1,8 +0,0 @@
{
"component": true,
"usingComponents": {
"t-button": "../../../miniprogram_npm/tdesign/button/button",
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup",
"t-dialog": "../../../miniprogram_npm/tdesign/dialog/dialog"
}
}

Some files were not shown because too many files have changed in this diff Show More