export default OakComponent({ entity: 'user', projection: { id: 1, name: 1, password: 1, nickname: 1, extraFile$entity: { $entity: 'extraFile', data: { id: 1, tag1: 1, origin: 1, bucket: 1, objectId: 1, filename: 1, extra1: 1, type: 1, entity: 1, extension: 1, }, filter: { tag1: 'avatar', }, }, userRelation$user: { $entity: 'userRelation', data: { id: 1, entity: 1, entityId: 1, userId: 1, relationId: 1, relation: { id: 1, name: 1, display: 1, relationAuth$destRelation: { $entity: 'relationAuth', data: { id: 1, sourceRelation: { userRelation$relation: { $entity: 'userRelation', data: { id: 1, userId: 1, }, }, }, }, }, }, }, }, }, isList: false, formData({ data: user }) { const { name, nickname, extraFile$entity, $$createAt$$ } = user || {}; const avatar = this.features.extraFile.getUrl(extraFile$entity && extraFile$entity[0]); return { avatar, name, nickname, // isNew: $$createAt$$ === 1, }; }, properties: { entity: '', entityId: '', relations: [], mobile: '', setPasswordConfirm: (value) => { }, passwordRequired: false, isNew: false, }, data: { mode: 'all', pwdMin: 8, pwdMax: 24, needVerify: false, regexs: [], tip: '', }, lifetimes: { async ready() { const system = this.features.application.getApplication().system; const passwordConfig = system?.config.Password; const mode = passwordConfig?.mode ?? 'all'; const pwdMin = passwordConfig?.min ?? 8; const pwdMax = passwordConfig?.max ?? 24; const needVerify = !!passwordConfig?.verify; const regexs = (passwordConfig?.regexs && passwordConfig?.regexs.length > 0) ? passwordConfig?.regexs : []; const tip = passwordConfig?.tip ?? ''; this.setState({ mode, pwdMin, pwdMax, needVerify, regexs, tip, }); } }, });