@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.2 → 1.2.0-alpha.3
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.
- package/README.md +119 -0
- package/dist/openapi-k8s-toolkit.es.js +11637 -11574
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +11635 -11572
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/ConverterBytes.d.ts +11 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/types.d.ts +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/utils.d.ts +17 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/utilts.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TDynamicComponentsAppTypeMap } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Idea:
|
|
5
|
+
* 1. bytesValue may now be:
|
|
6
|
+
* - "1234567890" → raw number (bytes)
|
|
7
|
+
* - "12312312Ki" → number + source unit
|
|
8
|
+
* 2. We parse it using parseValueWithUnit.
|
|
9
|
+
* 3. If the input contains a unit, we treat that as the from-unit (unless overridden with an explicit fromUnit prop).
|
|
10
|
+
* 4. Then:
|
|
11
|
+
* - If there’s a target unit (unit or toUnit), we use convertStorage.
|
|
12
|
+
* - If not, we convert to bytes and auto-scale with formatBytesAuto.
|
|
13
|
+
*/
|
|
3
14
|
export declare const ConverterBytes: FC<{
|
|
4
15
|
data: TDynamicComponentsAppTypeMap['ConverterBytes'];
|
|
5
16
|
}>;
|
package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type TCanonicalUnit = 'B' | 'kB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB';
|
|
2
|
-
export type TUnitInput = TCanonicalUnit | 'k' | 'm' | 'g' | 't' | 'p' | 'e' | 'K' | 'M' | 'G' | 'T' | 'P' | 'E' | 'KB' | 'Mb' | 'MB' | 'Gb' | 'GB' | 'Tb' | 'TB' | 'Pb' | 'PB' | 'Eb' | 'EB' | 'Ki' | 'Mi' | 'Gi' | 'Ti' | 'Pi' | 'Ei' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB';
|
|
2
|
+
export type TUnitInput = TCanonicalUnit | 'b' | 'byte' | 'bytes' | 'k' | 'm' | 'g' | 't' | 'p' | 'e' | 'K' | 'M' | 'G' | 'T' | 'P' | 'E' | 'kb' | 'KB' | 'mb' | 'Mb' | 'MB' | 'gb' | 'Gb' | 'GB' | 'tb' | 'Tb' | 'TB' | 'pb' | 'Pb' | 'PB' | 'eb' | 'Eb' | 'EB' | 'ki' | 'mi' | 'gi' | 'ti' | 'pi' | 'ei' | 'kib' | 'mib' | 'gib' | 'tib' | 'pib' | 'eib' | 'Ki' | 'Mi' | 'Gi' | 'Ti' | 'Pi' | 'Ei' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB';
|
|
3
3
|
export type TConvertOptions = {
|
|
4
4
|
/** If true, returns "12.3 GiB" instead of just 12.3 */
|
|
5
5
|
format?: boolean;
|
package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/utils.d.ts
CHANGED
|
@@ -13,3 +13,20 @@ export declare const formatBytesAuto: (bytes: number, options?: {
|
|
|
13
13
|
precision?: number;
|
|
14
14
|
locale?: string;
|
|
15
15
|
}) => string;
|
|
16
|
+
/** Internal helper: convert value in given unit -> bytes (number) */
|
|
17
|
+
export declare const toBytes: (value: number, from: TUnitInput) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Generic helper: convert value in some unit -> target unit.
|
|
20
|
+
* Uses bytes as intermediate.
|
|
21
|
+
*/
|
|
22
|
+
export declare const convertStorage: (value: number, from: TUnitInput, to: TUnitInput, opts?: TConvertOptions) => number | string;
|
|
23
|
+
/**
|
|
24
|
+
* Try to parse a string like:
|
|
25
|
+
* "12312312Ki"
|
|
26
|
+
* " 12.5 GiB"
|
|
27
|
+
* "1000" (no unit -> unit undefined)
|
|
28
|
+
*/
|
|
29
|
+
export declare const parseValueWithUnit: (input: string) => {
|
|
30
|
+
value: number;
|
|
31
|
+
unit?: TUnitInput | undefined;
|
|
32
|
+
} | null;
|
package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/utilts.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -293,6 +293,10 @@ export type TDynamicComponentsAppTypeMap = {
|
|
|
293
293
|
standard?: 'si' | 'iec';
|
|
294
294
|
notANumberText?: string;
|
|
295
295
|
style?: CSSProperties;
|
|
296
|
+
/** If provided, value is in this unit instead of raw bytes */
|
|
297
|
+
fromUnit?: TUnitInput;
|
|
298
|
+
/** If provided, convert to this explicit unit */
|
|
299
|
+
toUnit?: TUnitInput;
|
|
296
300
|
};
|
|
297
301
|
SecretBase64Plain: {
|
|
298
302
|
id: number | string;
|
package/package.json
CHANGED