Merge branch 'develop' into feature/redesign-letters

This commit is contained in:
Ilya Oleshko 2023-10-12 16:17:00 +03:00
commit c0ffc3b40e
14 changed files with 136 additions and 93 deletions

View File

@ -126,6 +126,7 @@ export type FilesSelectorProps = {
isMove?: boolean;
isCopy?: boolean;
isRestoreAll?: boolean;
isSelect?: boolean;
filterParam?: string;
@ -187,4 +188,6 @@ export type FilesSelectorProps = {
socketHelper: any;
socketSubscribersId: Set<string>;
embedded: boolean;
};

View File

@ -8,7 +8,7 @@ import { loadLanguagePath } from "SRC_DIR/helpers/utils";
const newInstance = i18n.createInstance();
const userLng = getCookie(LANGUAGE) || "en";
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings.culture;
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings?.culture;
newInstance
.use(Backend)

View File

@ -46,6 +46,7 @@ const FilesSelector = ({
isMove,
isCopy,
isRestoreAll,
isSelect,
currentFolderId,
fromFolderId,
@ -90,6 +91,8 @@ const FilesSelector = ({
socketHelper,
socketSubscribersId,
setMoveToPublicRoomVisible,
embedded,
}: FilesSelectorProps) => {
const { t } = useTranslation(["Files", "Common", "Translations"]);
@ -427,6 +430,7 @@ const FilesSelector = ({
isCopy,
isRestoreAll,
isMove,
isSelect,
filterParam
);
@ -435,6 +439,7 @@ const FilesSelector = ({
isCopy,
isRestoreAll,
isMove,
isSelect,
filterParam
);
@ -453,7 +458,72 @@ const FilesSelector = ({
includeFolder
);
return (
const SelectorBody = (
<Selector
headerLabel={headerLabel}
withoutBackButton
searchPlaceholder={t("Common:Search")}
searchValue={searchValue}
onSearch={onSearchAction}
onClearSearch={onClearSearchAction}
items={items ? items : []}
onSelect={onSelectAction}
acceptButtonLabel={acceptButtonLabel}
onAccept={onAcceptAction}
withCancelButton
cancelButtonLabel={t("Common:CancelButton")}
onCancel={onCloseAction}
emptyScreenImage={
theme.isBase ? EmptyScreenAltSvgUrl : EmptyScreenAltSvgDarkUrl
}
emptyScreenHeader={t("SelectorEmptyScreenHeader")}
emptyScreenDescription=""
searchEmptyScreenImage={
theme.isBase
? EmptyScreenFilterAltSvgUrl
: EmptyScreenFilterAltDarkSvgUrl
}
searchEmptyScreenHeader={t("Common:NotFoundTitle")}
searchEmptyScreenDescription={t("EmptyFilterDescriptionText")}
withBreadCrumbs
breadCrumbs={breadCrumbs}
onSelectBreadCrumb={onClickBreadCrumb}
isLoading={showLoader}
isBreadCrumbsLoading={showBreadCrumbsLoader}
withSearch={!isRoot && items ? items.length > 0 : !isRoot && isFirstLoad}
rowLoader={
<Loaders.SelectorRowLoader
isMultiSelect={false}
isUser={isRoot}
isContainer={showLoader}
/>
}
searchLoader={<Loaders.SelectorSearchLoader />}
breadCrumbsLoader={<Loaders.SelectorBreadCrumbsLoader />}
alwaysShowFooter={true}
isNextPageLoading={isNextPageLoading}
hasNextPage={hasNextPage}
totalItems={total}
loadNextPage={
isRoot ? null : selectedItemType === "rooms" ? getRoomList : getFileList
}
disableAcceptButton={isDisabled}
withFooterInput={withFooterInput}
withFooterCheckbox={withFooterCheckbox}
footerInputHeader={footerInputHeader}
currentFooterInputValue={currentFooterInputValue}
footerCheckboxLabel={footerCheckboxLabel}
descriptionText={
!filterParam ? "" : descriptionText ?? t("Common:SelectDOCXFormat")
}
acceptButtonId={isMove || isCopy ? "select-file-modal-submit" : ""}
cancelButtonId={isMove || isCopy ? "select-file-modal-cancel" : ""}
/>
);
return embedded ? (
SelectorBody
) : (
<>
<Backdrop
visible={isPanelVisible}
@ -468,72 +538,7 @@ const FilesSelector = ({
zIndex={310}
onClose={onCloseAction}
>
<Selector
headerLabel={headerLabel}
withoutBackButton
searchPlaceholder={t("Common:Search")}
searchValue={searchValue}
onSearch={onSearchAction}
onClearSearch={onClearSearchAction}
items={items ? items : []}
onSelect={onSelectAction}
acceptButtonLabel={acceptButtonLabel}
onAccept={onAcceptAction}
withCancelButton
cancelButtonLabel={t("Common:CancelButton")}
onCancel={onCloseAction}
emptyScreenImage={
theme.isBase ? EmptyScreenAltSvgUrl : EmptyScreenAltSvgDarkUrl
}
emptyScreenHeader={t("SelectorEmptyScreenHeader")}
emptyScreenDescription=""
searchEmptyScreenImage={
theme.isBase
? EmptyScreenFilterAltSvgUrl
: EmptyScreenFilterAltDarkSvgUrl
}
searchEmptyScreenHeader={t("Common:NotFoundTitle")}
searchEmptyScreenDescription={t("EmptyFilterDescriptionText")}
withBreadCrumbs
breadCrumbs={breadCrumbs}
onSelectBreadCrumb={onClickBreadCrumb}
isLoading={showLoader}
isBreadCrumbsLoading={showBreadCrumbsLoader}
withSearch={
!isRoot && items ? items.length > 0 : !isRoot && isFirstLoad
}
rowLoader={
<Loaders.SelectorRowLoader
isMultiSelect={false}
isUser={isRoot}
isContainer={showLoader}
/>
}
searchLoader={<Loaders.SelectorSearchLoader />}
breadCrumbsLoader={<Loaders.SelectorBreadCrumbsLoader />}
alwaysShowFooter={true}
isNextPageLoading={isNextPageLoading}
hasNextPage={hasNextPage}
totalItems={total}
loadNextPage={
isRoot
? null
: selectedItemType === "rooms"
? getRoomList
: getFileList
}
disableAcceptButton={isDisabled}
withFooterInput={withFooterInput}
withFooterCheckbox={withFooterCheckbox}
footerInputHeader={footerInputHeader}
currentFooterInputValue={currentFooterInputValue}
footerCheckboxLabel={footerCheckboxLabel}
descriptionText={
!filterParam ? "" : descriptionText ?? t("Common:SelectDOCXFormat")
}
acceptButtonId={isMove || isCopy ? "select-file-modal-submit" : ""}
cancelButtonId={isMove || isCopy ? "select-file-modal-cancel" : ""}
/>
{SelectorBody}
</Aside>
</>
);

View File

@ -17,6 +17,7 @@ export const getHeaderLabel = (
isCopy?: boolean,
isRestoreAll?: boolean,
isMove?: boolean,
isSelect?: boolean,
filterParam?: string
) => {
if (isMove) return t("Common:MoveTo");
@ -25,6 +26,7 @@ export const getHeaderLabel = (
if (filterParam === FilesSelectorFilterTypes.DOCX)
return t("Translations:CreateMasterFormFromFile");
if (!!filterParam) return t("Common:SelectFile");
if (isSelect) return t("Common:SelectFile");
return t("Common:SaveButton");
};
@ -34,6 +36,7 @@ export const getAcceptButtonLabel = (
isCopy?: boolean,
isRestoreAll?: boolean,
isMove?: boolean,
isSelect?: boolean,
filterParam?: string
) => {
if (isMove) return t("Translations:MoveHere");
@ -42,6 +45,7 @@ export const getAcceptButtonLabel = (
if (filterParam === FilesSelectorFilterTypes.DOCX) return t("Common:Create");
// if (filterParam === FilesSelectorFilterTypes.DOCXF) return t("Common:SubmitToGallery");
if (!!filterParam) return t("Common:SaveButton");
if (isSelect) return t("Common:SelectAction");
return t("Common:SaveHereButton");
};

View File

@ -8,7 +8,7 @@ import { loadLanguagePath } from "SRC_DIR/helpers/utils";
const newInstance = i18n.createInstance();
const userLng = getCookie(LANGUAGE) || "en";
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings.culture;
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings?.culture;
newInstance
.use(Backend)

View File

@ -104,7 +104,11 @@ export const getPasswordErrorMessage = (t, settings) => {
settings ? settings?.minLength : 8
} ${settings?.digits ? t("Common:PasswordLimitDigits") : ""} ${
settings?.upperCase ? t("Common:PasswordLimitUpperCase") : ""
} ${settings?.specSymbols ? t("Common:PasswordLimitSpecialSymbols") : ""}`;
} ${
settings?.specSymbols
? `${t("Common:PasswordLimitSpecialSymbols")} (!@#$%^&*)`
: ""
}`;
};
export const getCategoryType = (location) => {

View File

@ -363,7 +363,10 @@ const CreateUserForm = (props) => {
<SocialButton
iconName={SsoReactSvgUrl}
className="socialButton"
label={capabilities?.ssoLabel || getProviderTranslation("sso", t, false, true)}
label={
capabilities?.ssoLabel ||
getProviderTranslation("sso", t, false, true)
}
onClick={() => (window.location.href = capabilities?.ssoUrl)}
/>
</div>

View File

@ -237,6 +237,7 @@ const SectionHeaderContent = (props) => {
isPublicRoomType,
externalLinks,
moveToPublicRoom,
isFrame,
} = props;
const navigate = useNavigate();
@ -1059,6 +1060,7 @@ const SectionHeaderContent = (props) => {
isPublicRoomType && !isPublicRoom && PublicRoomIconUrl
}
showRootFolderTitle={insideTheRoom}
isFrame={isFrame}
/>
</div>
)}

View File

@ -161,15 +161,10 @@ const Sdk = ({
component = (
<FilesSelector
isPanelVisible={true}
isPanelOpen={true}
embedded
isSelect={true}
onSelectFile={onSelectFile}
filteredType={selectorType}
withSubfolders={false}
displayType="aside"
embedded={true}
searchParam={frameConfig?.filter.search}
ByExtension
{...onCloseCallback}
onClose={onClose}
/>
);
break;

View File

@ -497,7 +497,7 @@ class ContextOptionsStore {
const { setRemoveItem, setDeleteThirdPartyDialogVisible } =
this.dialogsStore;
if (id === this.selectedFolderStore.id) {
if (id === this.selectedFolderStore.id && isFolder) {
this.onClickDeleteSelectedFolder(t, isRoom);
return;

View File

@ -58,24 +58,34 @@ class PasswordInput extends React.Component {
};
testStrength = (value) => {
const { generatorSpecial, passwordSettings } = this.props;
const specSymbols = new RegExp("[" + generatorSpecial + "]");
const { passwordSettings } = this.props;
const capitalRegExp = new RegExp(passwordSettings.upperCaseRegexStr);
const digitalRegExp = new RegExp(passwordSettings.digitsRegexStr);
const specSymbolsRegExp = new RegExp(passwordSettings.specSymbolsRegexStr);
const allowedRegExp = new RegExp(
"^" + passwordSettings.allowedCharactersRegexStr + "{1,}$"
);
let capital;
let digits;
let special;
passwordSettings.upperCase
? (capital = /[A-Z]/.test(value))
? (capital = capitalRegExp.test(value))
: (capital = true);
passwordSettings.digits ? (digits = /\d/.test(value)) : (digits = true);
passwordSettings.digits
? (digits = digitalRegExp.test(value))
: (digits = true);
passwordSettings.specSymbols
? (special = specSymbols.test(value))
? (special = specSymbolsRegExp.test(value))
: (special = true);
const allowedCharacters = allowedRegExp.test(value);
return {
allowed: allowedCharacters,
digits: digits,
capital: capital,
special: special,
@ -89,7 +99,8 @@ class PasswordInput extends React.Component {
passwordValidation.digits &&
passwordValidation.capital &&
passwordValidation.special &&
passwordValidation.length;
passwordValidation.length &&
passwordValidation.allowed;
this.props.onValidateInput &&
this.props.onValidateInput(progressScore, passwordValidation);
@ -550,6 +561,9 @@ PasswordInput.defaultProps = {
upperCase: false,
digits: false,
specSymbols: false,
digitsRegexStr: "(?=.*\\d)",
upperCaseRegexStr: "(?=.*[A-Z])",
specSymbolsRegexStr: "(?=.*[\\x21-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7E])",
},
isfullwidth: false,
};

View File

@ -33,6 +33,9 @@ const Template = ({
settingsUpperCase,
settingsDigits,
settingsSpecSymbols,
settingsDigitsRegexStr,
settingsUpperCaseRegexStr,
settingsSpecSymbolsRegexStr,
tooltipPasswordLength,
onChange,
onValidateInput,
@ -40,14 +43,17 @@ const Template = ({
...args
}) => {
const [value, setValue] = useState("");
const [fakeSettings, setFakSettings] = useState();
const [fakeSettings, setFakeSettings] = useState();
useEffect(() => {
setFakSettings({
setFakeSettings({
minLength: settingMinLength,
upperCase: settingsUpperCase,
digits: settingsDigits,
specSymbols: settingsSpecSymbols,
digitsRegexStr: settingsDigitsRegexStr,
upperCaseRegexStr: settingsUpperCaseRegexStr,
specSymbolsRegexStr: settingsSpecSymbolsRegexStr,
});
setValue("");
}, [
@ -55,6 +61,9 @@ const Template = ({
settingsUpperCase,
settingsDigits,
settingsSpecSymbols,
settingsDigitsRegexStr,
settingsUpperCaseRegexStr,
settingsSpecSymbolsRegexStr,
]);
const onChangeHandler = (e) => {
@ -90,12 +99,13 @@ const Template = ({
};
export const Default = Template.bind({});
Default.args = {
isDisabled: false,
settingMinLength: 6,
settingsUpperCase: false,
settingsDigits: false,
settingsSpecSymbols: false,
settingsUpperCase: true,
settingsDigits: true,
settingsSpecSymbols: true,
simpleView: false,
inputName: "demoPasswordInput",
emailInputName: "demoEmailInput",
@ -109,4 +119,8 @@ Default.args = {
generatorSpecial: "!@#$%^&*",
placeholder: "password",
maxLength: 30,
settingsDigitsRegexStr: "(?=.*\\d)",
settingsUpperCaseRegexStr: "(?=.*[A-Z])",
settingsSpecSymbolsRegexStr:
"(?=.*[\\x21-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7E])",
};

View File

@ -9,7 +9,7 @@ import { loadLanguagePath } from "./helpers/utils";
const newInstance = i18n.createInstance();
const userLng = getCookie(LANGUAGE) || "en";
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings.culture;
const portalLng = window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings?.culture;
newInstance
.use(Backend)

View File

@ -26,7 +26,6 @@
sortorder: "descending", //TODO: ["descending", "ascending"]
sortby: "DateAndTime", //TODO: ["DateAndTime", "AZ", "Type", "Size", "DateAndTimeCreation", "Author"]
search: "",
roomId: null,
withSubfolders: true,
},
keysForReload: [