@apia/uploader-component 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Box, getVariant } from '@apia/theme';
|
|
3
3
|
import { getLabel, parseAsSize } from '@apia/util';
|
|
4
|
+
import { observer } from 'mobx-react-lite';
|
|
4
5
|
|
|
5
6
|
function makeDocTypeTooltip(api, docTypes) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
return /* @__PURE__ */ jsx(DocTypeTooltip, { api, docTypes });
|
|
8
|
+
}
|
|
9
|
+
const DocTypeTooltip = observer(
|
|
10
|
+
({ api, docTypes }) => {
|
|
11
|
+
const docTypesInfo = docTypes || getTooltipsToShow(api);
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Box,
|
|
14
|
+
{
|
|
15
|
+
className: "docTypes__tooltipWrapper",
|
|
16
|
+
...getVariant("layout.common.components.uploader.tooltip"),
|
|
17
|
+
children: docTypesInfo.map((currentDocType) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Box, { className: "head", as: "strong", children: currentDocType.label }),
|
|
19
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
20
|
+
/* @__PURE__ */ jsxs(Box, { as: "strong", children: [
|
|
21
|
+
window.LBL_ALLOWED_EXTENSIONS,
|
|
22
|
+
" "
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", children: [
|
|
25
|
+
currentDocType.extensions.length > 0 ? currentDocType.extensions.join(", ") : getLabel("lblAllDcTypeAcc").text,
|
|
26
|
+
"."
|
|
27
|
+
] })
|
|
18
28
|
] }),
|
|
19
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
30
|
+
/* @__PURE__ */ jsxs(Box, { as: "strong", children: [
|
|
31
|
+
window.LBL_MAX_SIZE,
|
|
32
|
+
" "
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx(Box, { as: "span", children: parseAsSize(currentDocType.maxSize) })
|
|
22
35
|
] })
|
|
23
|
-
] })
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
] }),
|
|
29
|
-
/* @__PURE__ */ jsx(Box, { as: "span", children: parseAsSize(currentDocType.maxSize) })
|
|
30
|
-
] })
|
|
31
|
-
] }, currentDocType.id))
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
}
|
|
36
|
+
] }, currentDocType.id))
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
35
41
|
function buildExtensionsArray(ext) {
|
|
36
42
|
return (ext ?? "").split(";").filter((current) => current !== "").map((current) => `.${current}`);
|
|
37
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeDocTypeTooltip.js","sources":["../../../src/components/utils/makeDocTypeTooltip.tsx"],"sourcesContent":["import { Box, getVariant } from '@apia/theme';\r\nimport { TDocType, UploaderApi } from '@apia/uploader-controller';\r\nimport { getLabel, parseAsSize } from '@apia/util';\r\n\r\nexport function makeDocTypeTooltip(api: UploaderApi, docTypes?: DocTypeInfo[]) {\r\n const docTypesInfo = docTypes || getTooltipsToShow(api);\r\n\r\n
|
|
1
|
+
{"version":3,"file":"makeDocTypeTooltip.js","sources":["../../../src/components/utils/makeDocTypeTooltip.tsx"],"sourcesContent":["import { Box, getVariant } from '@apia/theme';\r\nimport { TDocType, UploaderApi } from '@apia/uploader-controller';\r\nimport { getLabel, parseAsSize } from '@apia/util';\r\nimport { observer } from 'mobx-react-lite';\r\n\r\nexport function makeDocTypeTooltip(api: UploaderApi, docTypes?: DocTypeInfo[]) {\r\n return <DocTypeTooltip api={api} docTypes={docTypes} />;\r\n}\r\n\r\nconst DocTypeTooltip = observer(\r\n ({ api, docTypes }: { api: UploaderApi; docTypes?: DocTypeInfo[] }) => {\r\n const docTypesInfo = docTypes || getTooltipsToShow(api);\r\n\r\n return (\r\n <Box\r\n className=\"docTypes__tooltipWrapper\"\r\n {...getVariant('layout.common.components.uploader.tooltip')}\r\n >\r\n {docTypesInfo.map((currentDocType) => (\r\n <Box key={currentDocType.id}>\r\n <Box className=\"head\" as=\"strong\">\r\n {currentDocType.label}\r\n </Box>\r\n <Box>\r\n <Box as=\"strong\">{window.LBL_ALLOWED_EXTENSIONS} </Box>\r\n <Box as=\"span\">\r\n {currentDocType.extensions.length > 0\r\n ? currentDocType.extensions.join(', ')\r\n : getLabel('lblAllDcTypeAcc').text}\r\n .\r\n </Box>\r\n </Box>\r\n <Box>\r\n <Box as=\"strong\">{window.LBL_MAX_SIZE} </Box>\r\n <Box as=\"span\">{parseAsSize(currentDocType.maxSize)}</Box>\r\n </Box>\r\n </Box>\r\n ))}\r\n </Box>\r\n );\r\n },\r\n);\r\n\r\nexport type DocTypeInfo = {\r\n extensions: string[];\r\n id: string;\r\n maxSize: number;\r\n label: string;\r\n};\r\n\r\nfunction buildExtensionsArray(ext: string) {\r\n return (ext ?? '')\r\n .split(';')\r\n .filter((current) => current !== '')\r\n .map((current) => `.${current}`);\r\n}\r\n\r\nfunction addDocTypeInfoToArray(arr: DocTypeInfo[], docType: TDocType) {\r\n arr.push({\r\n extensions: buildExtensionsArray(docType.docExts),\r\n id: docType.id,\r\n label: docType.title,\r\n maxSize: docType.maxSize,\r\n });\r\n}\r\n\r\nfunction getTooltipsToShow(api: UploaderApi) {\r\n try {\r\n const hasOneClickUpload = api.props.modalConfig.oneClickUpload;\r\n const docTypes = api.state.allowedTypes;\r\n\r\n const docTypesInfo: DocTypeInfo[] = [];\r\n const generic = docTypes.find((c) => String(c.id) === '1');\r\n\r\n if (generic) {\r\n addDocTypeInfoToArray(docTypesInfo, generic);\r\n } else if (hasOneClickUpload) {\r\n const docType = docTypes[0];\r\n addDocTypeInfoToArray(docTypesInfo, docType);\r\n } else {\r\n docTypes.forEach((docType) => {\r\n addDocTypeInfoToArray(docTypesInfo, docType);\r\n });\r\n }\r\n\r\n return docTypesInfo;\r\n } catch (e) {\r\n e;\r\n return [];\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAKO,SAAS,kBAAA,CAAmB,KAAkB,QAAA,EAA0B;AAC7E,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,GAAA,EAAU,QAAA,EAAoB,CAAA;AACvD;AAEA,MAAM,cAAA,GAAiB,QAAA;AAAA,EACrB,CAAC,EAAE,GAAA,EAAK,QAAA,EAAS,KAAsD;AACrE,IAAA,MAAM,YAAA,GAAe,QAAA,IAAY,iBAAA,CAAkB,GAAG,CAAA;AAEtD,IAAA,uBACE,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,0BAAA;AAAA,QACT,GAAG,WAAW,2CAA2C,CAAA;AAAA,QAEzD,QAAA,EAAA,YAAA,CAAa,GAAA,CAAI,CAAC,cAAA,0BAChB,GAAA,EAAA,EACC,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,OAAI,SAAA,EAAU,MAAA,EAAO,EAAA,EAAG,QAAA,EACtB,yBAAe,KAAA,EAClB,CAAA;AAAA,+BACC,GAAA,EAAA,EACC,QAAA,EAAA;AAAA,4BAAA,IAAA,CAAC,GAAA,EAAA,EAAI,IAAG,QAAA,EAAU,QAAA,EAAA;AAAA,cAAA,MAAA,CAAO,sBAAA;AAAA,cAAuB;AAAA,aAAA,EAAC,CAAA;AAAA,4BACjD,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,MAAA,EACL,QAAA,EAAA;AAAA,cAAA,cAA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W,IAAI,KAAA,CAAM,YAAA;AAE3B,IAAA,MAAM,eAA8B,EAAC;AACrC,IAAA,MAAM,OAAA,GAAU,SAAS,IAAA,CAAK,CAAC,MAAM,MAAA,CAAO,CAAA,CAAE,EAAE,CAAA,KAAM,GAAG,CAAA;AAEzD,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,qBAAA,CAAsB,cAAc,OAAO,CAAA;AAAA,eAClC,iBAAA,EAAmB;AAC5B,MAAA,MAAM,OAAA,GAAU,SAAS,CAAC,CAAA;AAC1B,MAAA,qBAAA,CAAsB,cAAc,OAAO,CAAA;AAAA,KAC7C,MAAO;AACL,MAAA,QAAA,CAAS,OAAA,CAAQ,CAAC,OAAA,KAAY;AAC5B,QAAA,qBAAA,CAAsB,cAAc,OAAO,CAAA;AAAA,OAC5C,CAAA;AAAA;AAGH,IAAA,OAAO,YAAA;AAAA,WACA,CAAA,EAAG;AAEV,IAAA,OAAO,EAAC;AAAA;AAEZ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apia/uploader-component",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Alexis Leite <alexisleite@live.com>",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@apia/api": "^5.2.
|
|
34
|
-
"@apia/api2": "^5.2.
|
|
35
|
-
"@apia/components": "^5.2.
|
|
36
|
-
"@apia/icons": "^5.2.
|
|
37
|
-
"@apia/theme": "^5.2.
|
|
38
|
-
"@apia/tree2-component": "^5.2.
|
|
39
|
-
"@apia/uploader-controller": "^5.2.
|
|
40
|
-
"@apia/util": "^5.2.
|
|
33
|
+
"@apia/api": "^5.2.2",
|
|
34
|
+
"@apia/api2": "^5.2.2",
|
|
35
|
+
"@apia/components": "^5.2.2",
|
|
36
|
+
"@apia/icons": "^5.2.2",
|
|
37
|
+
"@apia/theme": "^5.2.2",
|
|
38
|
+
"@apia/tree2-component": "^5.2.2",
|
|
39
|
+
"@apia/uploader-controller": "^5.2.2",
|
|
40
|
+
"@apia/util": "^5.2.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "4d75d1997dd2afd98ff1ae35ede08d96203f7cfc"
|
|
43
43
|
}
|