Merge branch 'develop' into feature/fix-hide/show-header

# Conflicts:
#	web/ASC.Web.Components/src/components/drop-down/index.js
This commit is contained in:
Artem Tarasov 2020-12-15 16:33:01 +03:00
commit 91bce60705
41 changed files with 489 additions and 216 deletions

View File

@ -39,6 +39,7 @@ namespace ASC.Api.Core
[Scope]
public class ApiContext : ICloneable
{
private static int MaxCount = 1000;
public IHttpContextAccessor HttpContextAccessor { get; set; }
public Tenant tenant;
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor.HttpContext); } }
@ -48,14 +49,14 @@ namespace ASC.Api.Core
if (httpContextAccessor == null || httpContextAccessor.HttpContext == null) return;
HttpContextAccessor = httpContextAccessor;
Count = 0;
Count = MaxCount;
var query = HttpContextAccessor.HttpContext.Request.Query;
//Try parse values
var count = query.GetRequestValue("count");
if (!string.IsNullOrEmpty(count) && ulong.TryParse(count, out var countParsed))
{
//Count specified and valid
Count = (long)countParsed;
Count = Math.Min((long)countParsed, MaxCount);
}
var startIndex = query.GetRequestValue("startIndex");

View File

@ -245,12 +245,15 @@ namespace ASC.Core.Data
public Tenant GetTenant(string domain)
{
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException("domain");
domain = domain.ToLowerInvariant();
return TenantsQuery()
.Where(r => r.Alias == domain.ToLowerInvariant() || r.MappedDomain == domain.ToLowerInvariant())
.Where(r => r.Alias == domain || r.MappedDomain == domain)
.OrderBy(a => a.Status == TenantStatus.Restoring ? TenantStatus.Active : a.Status)
.ThenByDescending(a => a.Status == TenantStatus.Restoring ? 0 : a.Id)
.Select(FromDbTenantToTenant)
.Select(FromDbTenantToTenant)
.Take(1)
.FirstOrDefault();
}

View File

@ -13,7 +13,7 @@
"express": "^4.17.1",
"filenamify-url": "^2.1.1",
"moment": "^2.26.0",
"nconf": "^0.10.0",
"nconf": "^0.11.0",
"node-cache": "^5.1.0",
"request": "^2.88.2",
"winston": "^3.3.3",

View File

@ -29,10 +29,17 @@ ajv@^6.12.3:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
ansi-styles@^4.0.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
dependencies:
color-convert "^2.0.1"
array-flatten@1.1.1:
version "1.1.1"
@ -127,24 +134,19 @@ bytes@3.1.0:
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==
camelcase@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=
caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
cliui@^3.0.3:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
clone@2.x:
version "2.1.2"
@ -156,11 +158,6 @@ co@^4.6.0:
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=
code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
color-convert@^1.9.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
@ -168,12 +165,19 @@ color-convert@^1.9.1:
dependencies:
color-name "1.1.3"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@^1.0.0:
color-name@^1.0.0, color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
@ -287,11 +291,6 @@ debug@2.6.9, debug@^2.6.9:
dependencies:
ms "2.0.0"
decamelize@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
@ -320,6 +319,11 @@ ee-first@1.1.1:
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
enabled@2.0.x:
version "2.0.0"
resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2"
@ -335,6 +339,11 @@ es6-promise@^4.0.3:
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
@ -523,6 +532,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
@ -632,14 +646,9 @@ inherits@2.0.3:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
ini@^1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
invert-kv@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY=
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
ipaddr.js@1.9.1:
version "1.9.1"
@ -651,12 +660,10 @@ is-arrayish@^0.3.1:
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
is-fullwidth-code-point@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs=
dependencies:
number-is-nan "^1.0.0"
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
is-stream@^1.0.1:
version "1.1.0"
@ -742,13 +749,6 @@ kuler@^2.0.0:
resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3"
integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==
lcid@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=
dependencies:
invert-kv "^1.0.0"
logform@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.2.0.tgz#40f036d19161fc76b68ab50fdc7fe495544492f2"
@ -827,19 +827,19 @@ ms@2.1.1:
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
nconf@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/nconf/-/nconf-0.10.0.tgz#da1285ee95d0a922ca6cee75adcf861f48205ad2"
integrity sha512-fKiXMQrpP7CYWJQzKkPPx9hPgmq+YLDyxcG9N8RpiE9FoCkCbzD0NyW0YhE3xn3Aupe7nnDeIx4PFzYehpHT9Q==
nconf@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/nconf/-/nconf-0.11.0.tgz#585fb59ec1360b8179361fb7a2dae4f71cd2ebaa"
integrity sha512-c4W7QqYF6p5BC7J/eVTOvtUlQgvS5CgbJ11xgjhSr8yyius7km7xgdIYHkFLR4TWY1HjsFkia/3l5OprGqCHvA==
dependencies:
async "^1.4.0"
ini "^1.3.0"
secure-keys "^1.0.0"
yargs "^3.19.0"
yargs "^16.1.1"
negotiator@0.6.2:
version "0.6.2"
@ -858,11 +858,6 @@ normalize-url@^4.3.0:
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
number-is-nan@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=
oauth-sign@~0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
@ -894,13 +889,6 @@ one-time@^1.0.0:
dependencies:
fn.name "1.x.x"
os-locale@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=
dependencies:
lcid "^1.0.0"
parseurl@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
@ -1066,6 +1054,11 @@ request@^2.81.0, request@^2.88.2:
tunnel-agent "^0.6.0"
uuid "^3.3.2"
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
rimraf@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
@ -1171,14 +1164,14 @@ stack-trace@0.0.x:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=
string-width@^4.1.0, string-width@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5"
integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==
dependencies:
code-point-at "^1.0.0"
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
string_decoder@^1.1.1:
version "1.3.0"
@ -1194,12 +1187,12 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=
strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==
dependencies:
ansi-regex "^2.0.0"
ansi-regex "^5.0.0"
strip-outer@^1.0.1:
version "1.0.1"
@ -1330,11 +1323,6 @@ which@^2.0.1:
dependencies:
isexe "^2.0.0"
window-size@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
integrity sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=
winston-daily-rotate-file@^4.4.2:
version "4.5.0"
resolved "https://registry.yarnpkg.com/winston-daily-rotate-file/-/winston-daily-rotate-file-4.5.0.tgz#3914ac57c4bdae1138170bec85af0c2217b253b1"
@ -1368,36 +1356,42 @@ winston@^3.3.3:
triple-beam "^1.3.0"
winston-transport "^4.4.0"
wrap-ansi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
y18n@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
integrity sha1-bRX7qITAhnnA136I53WegR4H+kE=
y18n@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18"
integrity sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==
yargs@^3.19.0:
version "3.32.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
integrity sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=
yargs-parser@^20.2.2:
version "20.2.4"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
yargs@^16.1.1:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
camelcase "^2.0.1"
cliui "^3.0.3"
decamelize "^1.1.1"
os-locale "^1.4.0"
string-width "^1.0.1"
window-size "^0.1.4"
y18n "^3.2.0"
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"
yauzl@^2.10.0:
version "2.10.0"

View File

@ -113,6 +113,7 @@ class AddGroupsPanelComponent extends React.Component {
onClick={this.onClosePanels}
visible={visible}
zIndex={zIndex}
isAside={true}
/>
<Aside className="header_aside-panel">
<StyledContent>

View File

@ -111,6 +111,7 @@ class AddUsersPanelComponent extends React.Component {
onClick={this.onClosePanels}
visible={visible}
zIndex={zIndex}
isAside={true}
/>
<Aside className="header_aside-panel">
<StyledContent>

View File

@ -132,6 +132,7 @@ class EmbeddingPanelComponent extends React.Component {
onClick={this.onClosePanels}
visible={visible}
zIndex={zIndex}
isAside={true}
/>
<Aside className="header_aside-panel">
<StyledContent>

View File

@ -233,7 +233,12 @@ class NewFilesPanelComponent extends React.Component {
return (
<StyledAsidePanel visible={visible}>
<Backdrop onClick={onClose} visible={visible} zIndex={zIndex} />
<Backdrop
onClick={onClose}
visible={visible}
zIndex={zIndex}
isAside={true}
/>
<Aside className="header_aside-panel" visible={visible}>
<StyledContent>
<StyledHeaderContent>

View File

@ -681,7 +681,12 @@ class SharingPanelComponent extends React.Component {
return (
<StyledAsidePanel visible={visible}>
<Backdrop onClick={this.onClose} visible={visible} zIndex={zIndex} />
<Backdrop
onClick={this.onClose}
visible={visible}
zIndex={zIndex}
isAside={true}
/>
<Aside className="header_aside-panel" visible={visible}>
<StyledContent>
<StyledHeaderContent>

View File

@ -40,7 +40,9 @@ namespace ASC.Files.Core
IEnumerable<Tag> GetTags(T entryID, FileEntryType entryType, TagType tagType);
IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<T>> fileEntries);
IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<T>> fileEntries);
IDictionary<object, Tag> GetTags(Guid subject, IEnumerable<TagType> tagType, IEnumerable<FileEntry<T>> fileEntries);
IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<T>> fileEntries);

View File

@ -107,6 +107,40 @@ namespace ASC.Files.Core.Data
return FromQuery(q);
}
public IDictionary<object, Tag> GetTags(Guid subject, IEnumerable<TagType> tagType, IEnumerable<FileEntry<T>> fileEntries)
{
var filesId = new HashSet<string>();
var foldersId = new HashSet<string>();
foreach(var f in fileEntries)
{
var id = MappingID(f.ID).ToString();
if (f.FileEntryType == FileEntryType.File)
{
filesId.Add(id);
}
else if (f.FileEntryType == FileEntryType.Folder)
{
foldersId.Add(id);
}
}
var q = Query(FilesDbContext.Tag)
.Where(r => tagType.Contains(r.Flag))
.Join(FilesDbContext.TagLink, r => r.Id, l => l.TagId, (tag, link) => new TagLinkData { Tag = tag, Link = link })
.Where(r => r.Link.TenantId == r.Tag.TenantId)
.Where(r => r.Link.EntryType == FileEntryType.File && filesId.Contains(r.Link.EntryId)
|| r.Link.EntryType == FileEntryType.Folder && foldersId.Contains(r.Link.EntryId));
if (subject != Guid.Empty)
{
q.Where(r => r.Link.CreateBy == subject);
}
return FromQuery(q)
.ToDictionary(r=> r.EntryId);
}
public IEnumerable<Tag> GetTags(TagType tagType, IEnumerable<FileEntry<T>> fileEntries)
{
@ -408,18 +442,27 @@ namespace ASC.Files.Core.Data
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<T>> fileEntries)
{
List<Tag> result;
var tags = fileEntries.Select(r => new DbFilesTagLink
{
TenantId = TenantID,
EntryId = MappingID(r.ID).ToString(),
EntryType = (r.FileEntryType == FileEntryType.File) ? FileEntryType.File : FileEntryType.Folder
})
.ToList();
var entryIds = tags.Select(r => r.EntryId).ToList();
var entryTypes = tags.Select(r => (int)r.EntryType).Distinct().ToList();
List<Tag> result;
var tags = new List<DbFilesTagLink>();
var entryIds = new HashSet<string>();
var entryTypes = new HashSet<int>();
foreach (var r in fileEntries)
{
var id = MappingID(r.ID).ToString();
var entryType = (r.FileEntryType == FileEntryType.File) ? FileEntryType.File : FileEntryType.Folder;
tags.Add(new DbFilesTagLink
{
TenantId = TenantID,
EntryId = id,
EntryType = entryType
});
entryIds.Add(id);
entryTypes.Add((int)entryType);
}
var sqlQuery = Query(FilesDbContext.Tag)
.Join(FilesDbContext.TagLink, r => r.Id, l => l.TagId, (tag, link) => new TagLinkData { Tag = tag, Link = link })
@ -427,7 +470,7 @@ namespace ASC.Files.Core.Data
.Where(r => r.Tag.Flag == TagType.New)
.Where(x => x.Link.EntryId != null)
//.Where(r => tags.Any(t => t.TenantId == r.Link.TenantId && t.EntryId == r.Link.EntryId && t.EntryType == (int)r.Link.EntryType)); ;
.Where(r => entryIds.Any(t => t == r.Link.EntryId) && entryTypes.Any(t => t == (int)r.Link.EntryType));
.Where(r => entryIds.Any(t => t == r.Link.EntryId) && entryTypes.Contains((int)r.Link.EntryType));
if (subject != Guid.Empty)
{

View File

@ -400,8 +400,12 @@ namespace ASC.Files.Thirdparty
public IEnumerable<Tag> GetTags(string[] names, TagType tagType)
{
return new List<Tag>();
}
}
public IDictionary<object, Tag> GetTags(Guid subject, IEnumerable<TagType> tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return new Dictionary<object, Tag>();
}
public IEnumerable<Tag> GetNewTags(Guid subject, IEnumerable<FileEntry<string>> fileEntries)

View File

@ -127,8 +127,13 @@ namespace ASC.Files.Thirdparty.ProviderDao
public IEnumerable<Tag> GetTags(string entryID, FileEntryType entryType, TagType tagType)
{
return TagDao.GetTags(entryID, entryType, tagType);
}
}
public IDictionary<object, Tag> GetTags(Guid subject, IEnumerable<TagType> tagType, IEnumerable<FileEntry<string>> fileEntries)
{
return TagDao.GetTags(subject, tagType, fileEntries);
}
#endregion
}
}

View File

@ -741,35 +741,42 @@ namespace ASC.Web.Files.Utils
{
var tagDao = DaoFactory.GetTagDao<T>();
var tagsFavorite = tagDao.GetTags(AuthContext.CurrentAccount.ID, TagType.Favorite, files);
var tagsTemplate = tagDao.GetTags(AuthContext.CurrentAccount.ID, TagType.Template, files);
var tags = tagDao.GetTags(AuthContext.CurrentAccount.ID, new[] { TagType.Favorite, TagType.Template, TagType.Locked }, files);
var tagsNew = tagDao.GetNewTags(AuthContext.CurrentAccount.ID, files);
var tagsLocked = tagDao.GetTags(TagType.Locked, files.ToArray());
foreach (var file in files)
{
if (tagsFavorite.Any(r => r.EntryId.Equals(file.ID)))
foreach(var t in tags)
{
file.IsFavorite = true;
}
if (!t.Key.Equals(file.ID)) continue;
if (tagsTemplate.Any(r => r.EntryId.Equals(file.ID)))
{
file.IsTemplate = true;
if (t.Value.TagType == TagType.Favorite)
{
file.IsFavorite = true;
continue;
}
if (t.Value.TagType == TagType.Template)
{
file.IsTemplate = true;
continue;
}
if (t.Value.TagType == TagType.Locked)
{
var lockedBy = t.Value.Owner;
file.Locked = lockedBy != Guid.Empty;
file.LockedBy = lockedBy != Guid.Empty && lockedBy != AuthContext.CurrentAccount.ID
? Global.GetUserName(lockedBy)
: null;
continue;
}
}
if (tagsNew.Any(r => r.EntryId.Equals(file.ID)))
{
file.IsNew = true;
}
var tagLocked = tagsLocked.FirstOrDefault(t => t.EntryId.Equals(file.ID));
var lockedBy = tagLocked != null ? tagLocked.Owner : Guid.Empty;
file.Locked = lockedBy != Guid.Empty;
file.LockedBy = lockedBy != Guid.Empty && lockedBy != AuthContext.CurrentAccount.ID
? Global.GetUserName(lockedBy)
: null;
}
}

View File

@ -304,6 +304,7 @@ class ProfileInfo extends React.PureComponent {
scaledOptions={false}
size="content"
className="language-combo"
showDisabledItems={true}
/>
<HelpButton
place="bottom"

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.292",
"version": "1.0.294",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -101,7 +101,12 @@ class AdvancedSelector extends React.Component {
<Selector {...this.props} displayType={displayType} />
) : (
<>
<Backdrop onClick={this.onClose} visible={isOpen} zIndex={310} />
<Backdrop
onClick={this.onClose}
visible={isOpen}
zIndex={310}
isAside={true}
/>
<Aside visible={isOpen} scale={false} className="aside-container">
<Selector {...this.props} displayType={displayType} />
</Aside>

View File

@ -101,7 +101,10 @@ const StyledFilterInput = styled.div`
.dropdown-style {
position: relative;
z-index: 190;
.backdrop-active {
z-index: 190;
}
.drop-down {
padding: 16px;

View File

@ -27,9 +27,11 @@ const Layout = (props) => {
setIsTabletView(isTablet);
let mediaQuery = window.matchMedia("(max-width: 1024px)");
mediaQuery.addEventListener("change", isViewChangeHandler);
//mediaQuery.addEventListener("change", isViewChangeHandler);
mediaQuery.addListener(isViewChangeHandler);
//mediaQuery.removeEventListener("change", isViewChangeHandler);
return () => mediaQuery.removeEventListener("change", isViewChangeHandler);
return () => mediaQuery.removeListener(isViewChangeHandler);
}, []);
useEffect(() => {

View File

@ -124,7 +124,11 @@ class NavMenu extends React.Component {
<StyledContainer isLoaded={isLoaded}>
<Toast />
<Backdrop visible={isBackdropVisible} onClick={this.backdropClick} />
<Backdrop
visible={isBackdropVisible}
onClick={this.backdropClick}
withBackground={true}
/>
{isLoaded && isAuthenticated ? (
<>

View File

@ -126,6 +126,7 @@ class SelectedFrame extends React.Component {
if (this.container.childNodes[childItem].nodeType === 1) {
const item = this.container.childNodes[childItem];
const currentItem = item.childNodes[0];
if (!currentItem) return;
const itemHeight = currentItem.offsetHeight;
const itemOffsetTop = item.offsetTop;

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.493",
"version": "1.0.495",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",

View File

@ -14,10 +14,10 @@ import { Backdrop } from "asc-web-components";
### Properties
| Props | Type | Required | Values | Default | Description |
| ----------- | :------------: | :------: | :----: | :-----: | ----------------- |
| `className` | `string` | - | - | - | Accepts class |
| `id` | `string` | - | - | - | Accepts id |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `visible` | `bool` | - | - | `false` | Display or not |
| `zIndex` | `number` | - | - | `100` | CSS z-index |
| Props | Type | Required | Values | Default | Description |
| ----------- | :-------------: | :------: | :----: | :-----: | ----------------- |
| `className` | `string, array` | - | - | - | Accepts class |
| `id` | `string` | - | - | - | Accepts id |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `visible` | `bool` | - | - | `false` | Display or not |
| `zIndex` | `number` | - | - | `100` | CSS z-index |

View File

@ -25,14 +25,23 @@ describe("<Backdrop />", () => {
expect(wrapper.prop("id")).toEqual("testId");
});
it("accepts className", () => {
it("accepts className string", () => {
const wrapper = mount(<Backdrop {...baseProps} className="test" />);
expect(wrapper.prop("className")).toEqual("test");
});
it("accepts className array", () => {
const testArr = ["test", "backdrop-active"];
const wrapper = mount(<Backdrop {...baseProps} className={["test"]} />);
expect(wrapper.prop("className")).toEqual(expect.arrayContaining(testArr));
});
it("accepts style", () => {
const wrapper = mount(<Backdrop {...baseProps} style={{ color: "red" }} />);
const wrapper = mount(
<Backdrop {...baseProps} style={{ color: "red" }} visible={true} />
);
expect(wrapper.getDOMNode().style).toHaveProperty("color", "red");
});

View File

@ -3,7 +3,8 @@ import PropTypes from "prop-types";
import styled from "styled-components";
const StyledBackdrop = styled.div`
background-color: rgba(6, 22, 38, 0.1);
background-color: ${(props) =>
props.needBackground ? "rgba(6, 22, 38, 0.1)" : "unset"};
display: ${(props) => (props.visible ? "block" : "none")};
height: 100vh;
position: fixed;
@ -11,24 +12,112 @@ const StyledBackdrop = styled.div`
z-index: ${(props) => props.zIndex};
left: 0;
top: 0;
cursor: ${(props) => (props.needBackground ? "pointer" : "default")}; ;
`;
const Backdrop = (props) => {
//console.log("Backdrop render");
return <StyledBackdrop {...props} />;
};
class Backdrop extends React.Component {
constructor(props) {
super(props);
this.state = {
needBackdrop: false,
needBackground: false,
};
this.backdropRef = React.createRef();
}
componentDidUpdate(prevProps) {
if (
prevProps.visible !== this.props.visible ||
prevProps.isAside !== this.props.isAside ||
prevProps.withBackground !== this.props.withBackground
) {
this.checkingExistBackdrop();
}
}
componentDidMount() {
this.checkingExistBackdrop();
}
checkingExistBackdrop = () => {
const { visible, isAside, withBackground } = this.props;
if (visible) {
const isTablet = window.innerWidth < 1024;
const backdrops = document.querySelectorAll(".backdrop-active");
const needBackdrop =
backdrops.length < 1 || (isAside && backdrops.length <= 1);
let needBackground = needBackdrop && (isTablet || withBackground);
if (isAside && needBackdrop) needBackground = true;
this.setState({
needBackdrop: needBackdrop,
needBackground: needBackground,
});
} else {
this.setState({
needBackground: false,
needBackdrop: false,
});
}
};
modifyClassName = () => {
const { className } = this.props;
let modifiedClass = "backdrop-active";
if (className) {
if (typeof className !== "string") {
if (!className.includes(modifiedClass)) {
modifiedClass = className.push(modifiedClass);
} else {
modifiedClass = className;
}
} else {
modifiedClass += ` ${className}`;
}
}
return modifiedClass;
};
render() {
const { needBackdrop, needBackground } = this.state;
const { isAside, visible } = this.props;
const modifiedClassName = this.modifyClassName();
return visible && (needBackdrop || isAside) ? (
<StyledBackdrop
{...this.props}
ref={this.backdropRef}
className={modifiedClassName}
needBackground={needBackground}
visible={visible}
/>
) : null;
}
}
Backdrop.propTypes = {
visible: PropTypes.bool,
zIndex: PropTypes.number,
className: PropTypes.string,
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
id: PropTypes.string,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
withBackground: PropTypes.bool,
isAside: PropTypes.bool,
};
Backdrop.defaultProps = {
visible: false,
zIndex: 200,
withBackground: false,
isAside: false,
};
export default Backdrop;

View File

@ -129,3 +129,4 @@ To use Combobox as a toggle button, you must declare it according to the paramet
| `size` | `oneOf` | - | `base`, `middle`, `big`, `huge`, `content` | `base` | Select component width, one of default |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `toggleAction` | `func` | - | - | - | The event will be raised when using `displayType: toggle` when clicking on a component |
| `showDisabledItems` | `bool` | - | - | `false` | Display disabled items or not when displayType !== toggle |

View File

@ -105,6 +105,7 @@ class ComboBox extends React.Component {
displayType,
toggleAction,
textOverflow,
showDisabledItems,
} = this.props;
const { isOpen, selectedOption } = this.state;
@ -159,6 +160,7 @@ class ComboBox extends React.Component {
clickOutsideAction={this.handleClickOutside}
{...dropDownMaxHeightProp}
{...dropDownManualWidthProp}
showDisabledItems={showDisabledItems}
>
{advancedOptions
? advancedOptions
@ -212,6 +214,7 @@ ComboBox.defaultProps = {
scaledOptions: false,
size: "base",
disableIconClick: true,
showDisabledItems: false,
};
export default ComboBox;

View File

@ -230,7 +230,12 @@ class ContextMenuButton extends React.Component {
</DropDown>
) : (
<>
<Backdrop onClick={this.onClose} visible={isOpen} zIndex={310} />
<Backdrop
onClick={this.onClose}
visible={isOpen}
zIndex={310}
isAside={true}
/>
<Aside visible={isOpen} scale={false} zIndex={310}>
<Content>
<Header>

View File

@ -27,3 +27,4 @@ In particular case, state is created containing options for particular Row eleme
| `options` | `array` | - | - | `[ ]` | DropDownItems collection |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `targetAreaId` | `string` | - | - | - | Id of container apply to |
| `withBackdrop` | `bool` | - | - | `true` | Used to display backdrop |

View File

@ -72,7 +72,11 @@ describe("<ContextMenu />", () => {
it("accepts style", () => {
const wrapper = mount(
<ContextMenu {...baseProps} style={{ color: "red" }} />
<ContextMenu
{...baseProps}
style={{ color: "red" }}
withBackdrop={false}
/>
);
wrapper.setState({ visible: true });

View File

@ -81,7 +81,7 @@ class ContextMenu extends React.PureComponent {
render() {
//console.log('ContextMenu render', this.props);
const { visible } = this.state;
const { options, id, className, style } = this.props;
const { options, id, className, style, withBackdrop } = this.props;
return (
((visible && options) || null) && (
@ -91,6 +91,7 @@ class ContextMenu extends React.PureComponent {
style={style}
open={visible}
clickOutsideAction={this.handleClick}
withBackdrop={withBackdrop}
>
{options.map((item) => {
if (item && item.key !== undefined) {
@ -115,11 +116,13 @@ ContextMenu.propTypes = {
className: PropTypes.string,
id: PropTypes.string,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
withBackdrop: PropTypes.bool,
};
ContextMenu.defaultProps = {
options: [],
id: "contextMenu",
withBackdrop: true,
};
export default ContextMenu;

View File

@ -374,7 +374,11 @@ class DatePicker extends Component {
{isOpen ? (
displayType === "dropdown" ? (
<DropDownStyle>
<DropDown className="drop-down" open={isOpen}>
<DropDown
className="drop-down"
open={isOpen}
clickOutsideAction={this.onClose}
>
{this.renderBody()}
</DropDown>
</DropDownStyle>
@ -384,6 +388,7 @@ class DatePicker extends Component {
onClick={this.onClose}
visible={isOpen}
zIndex={zIndex}
isAside={true}
/>
<Aside visible={isOpen} scale={false} zIndex={zIndex}>
<Content>

View File

@ -34,3 +34,4 @@ When using component, it should be noted that parent must have CSS property _pos
| `open` | `bool` | - | - | `false` | Tells when the dropdown should be opened |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `withBackdrop` | `bool` | - | - | `true` | Used to display backdrop |
| `showDisabledItems` | `bool` | - | - | `false` | Display disabled items or not |

View File

@ -8,6 +8,8 @@ const baseProps = {
directionX: "left",
directionY: "bottom",
manualWidth: "100%",
showDisabledItems: true,
withBackdrop: false,
};
const baseChildren = <div label="1"></div>;
@ -25,6 +27,20 @@ describe("<DropDown />", () => {
expect(wrapper.prop("open")).toEqual(true);
});
it("showDisabledItems", () => {
const wrapper = mount(
<DropDown {...baseProps} open showDisabledItems={false} />
);
expect(wrapper.prop("showDisabledItems")).toEqual(false);
});
it("render with backdrop", () => {
const wrapper = mount(<DropDown {...baseProps} open withBackdrop={true} />);
expect(wrapper.prop("withBackdrop")).toEqual(true);
});
it("directionX right", () => {
const wrapper = mount(<DropDown {...baseProps} directionX="right" />);

View File

@ -4,6 +4,7 @@ import PropTypes from "prop-types";
import CustomScrollbarsVirtualList from "../scrollbar/custom-scrollbars-virtual-list";
import DropDownItem from "../drop-down-item";
import Backdrop from "../backdrop";
import Box from "../box";
import { VariableSizeList } from "react-window";
import onClickOutside from "react-onclickoutside";
@ -41,7 +42,7 @@ const StyledDropdown = styled.div`
css`
left: ${(props) => (props.manualX ? props.manualX : "0px")};
`}
z-index: 150;
z-index: 200;
display: ${(props) =>
props.open ? (props.columnCount ? "block" : "table") : "none"};
background: #ffffff;
@ -157,10 +158,32 @@ class DropDown extends React.PureComponent {
return isTablet ? 36 : 32;
};
hideDisabledItems = () => {
if (React.Children.count(this.props.children) > 0) {
const { children } = this.props;
const enabledChildren = React.Children.map(children, (child) => {
if (child && !child.props.disabled) return child;
});
const sizeEnabledChildren = enabledChildren.length;
const cleanChildren = React.Children.map(
enabledChildren,
(child, index) => {
if (!child.props.isSeparator) return child;
if (index !== 0 && index !== sizeEnabledChildren - 1) return child;
}
);
return cleanChildren;
}
};
render() {
const { maxHeight, children } = this.props;
const { maxHeight, children, showDisabledItems } = this.props;
const { directionX, directionY, width } = this.state;
let cleanChildren;
const rowHeights = React.Children.map(children, (child) =>
this.getItemHeight(child)
);
@ -172,6 +195,9 @@ class DropDown extends React.PureComponent {
? { height: calculatedHeight + "px" }
: {};
//console.log("DropDown render", this.props);
if (!showDisabledItems) cleanChildren = this.hideDisabledItems();
return (
<StyledDropdown
ref={this.dropDownRef}
@ -191,6 +217,8 @@ class DropDown extends React.PureComponent {
>
{Row}
</VariableSizeList>
) : cleanChildren ? (
cleanChildren
) : (
children
)}
@ -216,26 +244,31 @@ DropDown.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
withBackdrop: PropTypes.bool,
columnCount: PropTypes.number,
showDisabledItems: PropTypes.bool,
};
DropDown.defaultProps = {
directionX: "left",
directionY: "bottom",
withBackdrop: false,
showDisabledItems: false,
};
const EnhancedComponent = onClickOutside(DropDown);
class DropDownContainer extends React.Component {
toggleDropDown = (e) => {
this.props.clickOutsideAction({}, !this.props.open);
};
render() {
const { withBackdrop = false, open } = this.props;
const isTablet = window.innerWidth < 1024; //TODO: Make some better
const { withBackdrop = true, open } = this.props;
return (
<>
{withBackdrop ? (
<Backdrop visible={open} zIndex={199} onClick={this.toggleDropDown} />
) : null}
<EnhancedComponent disableOnClickOutside={true} {...this.props} />
{withBackdrop && open && isTablet && (
<Backdrop visible zIndex={149} onClick={this.toggleDropDown} />
)}
</>
);
}

View File

@ -138,9 +138,8 @@ class GroupButton extends React.Component {
}
clickOutsideAction = (e) => {
this.state.isOpen &&
!this.ref.current.contains(e.target) &&
this.setIsOpen(false);
this.state.isOpen && !this.ref.current.contains(e.target);
this.setIsOpen(false);
};
checkboxChange = (e) => {
@ -223,6 +222,7 @@ class GroupButton extends React.Component {
manualY="72px"
open={this.state.isOpen}
clickOutsideAction={this.clickOutsideAction}
showDisabledItems={true}
>
{React.Children.map(children, (child) => (
<DropDownItem

View File

@ -208,30 +208,34 @@ class GroupButtonsMenu extends React.Component {
return (
<StyledGroupButtonsMenu id="groupMenuOuter" visible={visible}>
<GroupMenuWrapper id="groupMenu">
{priorityItems.map((item, i) => (
<GroupButton
key={`navItem-${i}`}
label={item.label}
isDropdown={item.isDropdown}
isSeparator={item.isSeparator}
isSelect={item.isSelect}
onSelect={item.onSelect}
selected={selected}
fontWeight={item.fontWeight}
disabled={item.disabled}
onClick={this.groupButtonClick}
data-index={i}
activated={item.activated}
checked={checked}
dropDownMaxHeight={item.dropDownMaxHeight}
hovered={item.hovered}
isIndeterminate={isIndeterminate}
onChange={onChange}
opened={item.opened}
>
{item.children}
</GroupButton>
))}
{priorityItems.length &&
priorityItems.map((item, i) => {
//if (item.disabled) return;
return (
<GroupButton
key={`navItem-${i}`}
label={item.label}
isDropdown={item.isDropdown}
isSeparator={item.isSeparator}
isSelect={item.isSelect}
onSelect={item.onSelect}
selected={selected}
fontWeight={item.fontWeight}
disabled={item.disabled}
onClick={this.groupButtonClick}
data-index={i}
activated={item.activated}
checked={checked}
dropDownMaxHeight={item.dropDownMaxHeight}
hovered={item.hovered}
isIndeterminate={isIndeterminate}
onChange={onChange}
opened={item.opened}
>
{item.children}
</GroupButton>
);
})}
</GroupMenuWrapper>
{moreItems.length > 0 && (
<GroupButton id="moreMenu" isDropdown={true} label={moreLabel}>

View File

@ -193,7 +193,12 @@ class HelpButton extends React.Component {
)}
{displayType === "aside" && (
<>
<Backdrop onClick={this.onClose} visible={isOpen} zIndex={zIndex} />
<Backdrop
onClick={this.onClose}
visible={isOpen}
zIndex={zIndex}
isAside={true}
/>
<Aside visible={isOpen} scale={false} zIndex={zIndex}>
<Content>
{helpButtonHeaderContent && (

View File

@ -117,11 +117,13 @@ class MainButton extends React.PureComponent {
if (props.opened) handleAnyClick(true, this.handleClick);
}
handleClick = (e) =>
this.state.isOpen &&
!this.ref.current.contains(e.target) &&
handleClick = (e) => {
if (!this.state.isOpen && this.ref.current.contains(e.target)) return;
this.toggle(false);
};
stopAction = (e) => e.preventDefault();
toggle = (isOpen) => this.setState({ isOpen: isOpen });
componentWillUnmount() {

View File

@ -177,7 +177,7 @@ class ModalDialog extends React.Component {
});
return this.state.displayType === "modal" ? (
<Backdrop visible={visible} zIndex={zIndex}>
<Backdrop visible={visible} zIndex={zIndex} withBackground={true}>
<Dialog className={className} id={id} style={style}>
<Content contentHeight={contentHeight} contentWidth={contentWidth}>
<StyledHeader>
@ -195,7 +195,12 @@ class ModalDialog extends React.Component {
</Backdrop>
) : (
<Box className={className} id={id} style={style}>
<Backdrop visible={visible} onClick={onClose} zIndex={zIndex} />
<Backdrop
visible={visible}
onClick={onClose}
zIndex={zIndex}
isAside={true}
/>
<Aside
visible={visible}
scale={scale}

View File

@ -39,9 +39,8 @@ const StyledPage = styled.div`
margin-right: 8px;
.manualWidth {
> div:last-of-type {
width: 120%;
}
.dropdown-container {
width: 110%;
}
}
`;