@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.6 → 1.2.0-alpha.8

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.
Files changed (19) hide show
  1. package/dist/openapi-k8s-toolkit.es.js +267 -214
  2. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  3. package/dist/openapi-k8s-toolkit.umd.js +276 -213
  4. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  5. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/EnrichedTable.d.ts +2 -2
  6. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.d.ts +3 -3
  7. package/dist/types/components/organisms/DynamicComponents/types.d.ts +2 -2
  8. package/dist/types/localTypes/bff/table.d.ts +2 -2
  9. package/dist/types/localTypes/richTable.d.ts +4 -2
  10. package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/utils.d.ts → utils/converterBytes/converterBytes.d.ts} +1 -1
  11. package/dist/types/utils/converterBytes/index.d.ts +1 -0
  12. package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/utils.d.ts → utils/converterCores/converterCores.d.ts} +1 -1
  13. package/dist/types/utils/converterCores/index.d.ts +1 -0
  14. package/dist/types/utils/index.d.ts +2 -0
  15. package/package.json +1 -1
  16. /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/types.d.ts → localTypes/factories/converterBytes.d.ts} +0 -0
  17. /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/types.d.ts → localTypes/factories/converterCores.d.ts} +0 -0
  18. /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/utilts.test.d.ts → utils/converterBytes/converterBytes.test.d.ts} +0 -0
  19. /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/utilts.test.d.ts → utils/converterCores/converterCores.test.d.ts} +0 -0
@@ -33965,6 +33965,220 @@ const isFlatObject = (obj) => {
33965
33965
  });
33966
33966
  };
33967
33967
 
33968
+ const UNIT_FACTORS = {
33969
+ B: 1,
33970
+ kB: 1e3,
33971
+ MB: 1e6,
33972
+ GB: 1e9,
33973
+ TB: 1e12,
33974
+ PB: 1e15,
33975
+ EB: 1e18,
33976
+ KiB: 1024,
33977
+ MiB: 1024 ** 2,
33978
+ GiB: 1024 ** 3,
33979
+ TiB: 1024 ** 4,
33980
+ PiB: 1024 ** 5,
33981
+ EiB: 1024 ** 6
33982
+ };
33983
+ const ALIASES = (() => {
33984
+ const siPairs = [
33985
+ [["b", "byte", "bytes"], "B"],
33986
+ [["k", "kb", "kB", "KB"], "kB"],
33987
+ [["m", "mb", "MB"], "MB"],
33988
+ [["g", "gb", "GB"], "GB"],
33989
+ [["t", "tb, TB".replace(",", "")], "TB"],
33990
+ [["p", "pb", "PB"], "PB"],
33991
+ [["e", "eb", "EB"], "EB"]
33992
+ ];
33993
+ const iecPairs = [
33994
+ [["ki", "kib", "Ki", "KiB"], "KiB"],
33995
+ [["mi", "mib", "Mi", "MiB"], "MiB"],
33996
+ [["gi", "gib", "Gi", "GiB"], "GiB"],
33997
+ [["ti", "tib", "Ti", "TiB"], "TiB"],
33998
+ [["pi", "pib", "Pi", "PiB"], "PiB"],
33999
+ [["ei", "eib", "Ei", "EiB"], "EiB"]
34000
+ ];
34001
+ const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
34002
+ const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
34003
+ return Object.fromEntries([...entries, ...canon]);
34004
+ })();
34005
+ const normalizeUnit = (u) => {
34006
+ const key = String(u).trim().toLowerCase();
34007
+ const canon = ALIASES[key];
34008
+ if (!canon) {
34009
+ console.error(`Unknown unit: "${u}"`);
34010
+ return "GB";
34011
+ }
34012
+ return canon;
34013
+ };
34014
+ const convertBytes = (bytes, unit, opts) => {
34015
+ if (!Number.isFinite(bytes)) {
34016
+ console.error("bytes must be a finite number");
34017
+ return -1;
34018
+ }
34019
+ if (bytes < 0) {
34020
+ console.error("bytes must be >= 0");
34021
+ return -1;
34022
+ }
34023
+ const canon = normalizeUnit(unit);
34024
+ const factor = UNIT_FACTORS[canon];
34025
+ const value = bytes / factor;
34026
+ return opts?.format ? `${value.toLocaleString(opts.locale, {
34027
+ minimumFractionDigits: 0,
34028
+ maximumFractionDigits: opts?.precision ?? 2
34029
+ })} ${canon}` : value;
34030
+ };
34031
+ const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
34032
+ if (!Number.isFinite(bytes)) {
34033
+ console.error("bytes must be a finite number");
34034
+ return "infinite";
34035
+ }
34036
+ if (bytes < 0) {
34037
+ console.error("bytes must be >= 0");
34038
+ return "less then zero";
34039
+ }
34040
+ const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
34041
+ const base = standard === "iec" ? 1024 : 1e3;
34042
+ const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
34043
+ const unit = ladder[Math.max(0, idx)];
34044
+ return String(convertBytes(bytes, unit, { format: true, precision, locale }));
34045
+ };
34046
+ const toBytes = (value, from) => {
34047
+ if (!Number.isFinite(value)) {
34048
+ console.error("value must be a finite number");
34049
+ return -1;
34050
+ }
34051
+ if (value < 0) {
34052
+ console.error("value must be >= 0");
34053
+ return -1;
34054
+ }
34055
+ const canon = normalizeUnit(from);
34056
+ const factor = UNIT_FACTORS[canon];
34057
+ return value * factor;
34058
+ };
34059
+ const convertStorage = (value, from, to, opts) => {
34060
+ const bytes = toBytes(value, from);
34061
+ if (bytes < 0) return -1;
34062
+ return convertBytes(bytes, to, opts);
34063
+ };
34064
+ const parseValueWithUnit = (input) => {
34065
+ const trimmed = input.trim();
34066
+ if (!trimmed) return null;
34067
+ const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
34068
+ if (!match) return null;
34069
+ const [, numPart, unitPart] = match;
34070
+ const value = Number(numPart);
34071
+ if (!Number.isFinite(value)) return null;
34072
+ if (unitPart) {
34073
+ return { value, unit: unitPart };
34074
+ }
34075
+ return { value };
34076
+ };
34077
+
34078
+ const CORE_UNIT_FACTORS = {
34079
+ core: 1,
34080
+ mcore: 1e-3,
34081
+ ucore: 1e-6,
34082
+ ncore: 1e-9
34083
+ };
34084
+ const CORE_ALIASES = (() => {
34085
+ const corePairs = [
34086
+ // plain cores
34087
+ [["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
34088
+ // millicores
34089
+ [["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
34090
+ // microcores
34091
+ [["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
34092
+ // nanocores
34093
+ [["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
34094
+ ];
34095
+ const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
34096
+ const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
34097
+ return Object.fromEntries([...entries, ...canon]);
34098
+ })();
34099
+ const normalizeCoreUnit = (u) => {
34100
+ const key = String(u).trim().toLowerCase();
34101
+ const canon = CORE_ALIASES[key];
34102
+ if (!canon) {
34103
+ console.error(`Unknown core unit: "${u}"`);
34104
+ return "core";
34105
+ }
34106
+ return canon;
34107
+ };
34108
+ const convertCores = (cores, unit, opts) => {
34109
+ if (!Number.isFinite(cores)) {
34110
+ console.error("cores must be a finite number");
34111
+ return -1;
34112
+ }
34113
+ if (cores < 0) {
34114
+ console.error("cores must be >= 0");
34115
+ return -1;
34116
+ }
34117
+ const canon = normalizeCoreUnit(unit);
34118
+ const factor = CORE_UNIT_FACTORS[canon];
34119
+ const value = cores / factor;
34120
+ if (!opts?.format) return value;
34121
+ return `${value.toLocaleString(opts.locale, {
34122
+ minimumFractionDigits: 0,
34123
+ maximumFractionDigits: opts?.precision ?? 2
34124
+ })} ${canon}`;
34125
+ };
34126
+ const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
34127
+ if (!Number.isFinite(cores)) {
34128
+ console.error("cores must be a finite number");
34129
+ return "infinite";
34130
+ }
34131
+ if (cores < 0) {
34132
+ console.error("cores must be >= 0");
34133
+ return "less then zero";
34134
+ }
34135
+ if (cores === 0) {
34136
+ return "0 core";
34137
+ }
34138
+ let targetUnit;
34139
+ if (cores >= 1) {
34140
+ targetUnit = "core";
34141
+ } else if (cores >= 1e-3) {
34142
+ targetUnit = "mcore";
34143
+ } else if (cores >= 1e-6) {
34144
+ targetUnit = "ucore";
34145
+ } else {
34146
+ targetUnit = "ncore";
34147
+ }
34148
+ return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
34149
+ };
34150
+ const toCores = (value, from) => {
34151
+ if (!Number.isFinite(value)) {
34152
+ console.error("value must be a finite number");
34153
+ return -1;
34154
+ }
34155
+ if (value < 0) {
34156
+ console.error("value must be >= 0");
34157
+ return -1;
34158
+ }
34159
+ const canon = normalizeCoreUnit(from);
34160
+ const factor = CORE_UNIT_FACTORS[canon];
34161
+ return value * factor;
34162
+ };
34163
+ const convertCompute = (value, from, to, opts) => {
34164
+ const cores = toCores(value, from);
34165
+ if (cores < 0) return -1;
34166
+ return convertCores(cores, to, opts);
34167
+ };
34168
+ const parseCoresWithUnit = (input) => {
34169
+ const trimmed = input.trim();
34170
+ if (!trimmed) return null;
34171
+ const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
34172
+ if (!match) return null;
34173
+ const [, numPart, unitPart] = match;
34174
+ const value = Number(numPart);
34175
+ if (!Number.isFinite(value)) return null;
34176
+ if (unitPart) {
34177
+ return { value, unit: unitPart };
34178
+ }
34179
+ return { value };
34180
+ };
34181
+
33968
34182
  const DynamicRendererInner = ({
33969
34183
  items,
33970
34184
  components
@@ -44831,111 +45045,6 @@ const Annotations = ({
44831
45045
  ] });
44832
45046
  };
44833
45047
 
44834
- const UNIT_FACTORS = {
44835
- B: 1,
44836
- kB: 1e3,
44837
- MB: 1e6,
44838
- GB: 1e9,
44839
- TB: 1e12,
44840
- PB: 1e15,
44841
- EB: 1e18,
44842
- KiB: 1024,
44843
- MiB: 1024 ** 2,
44844
- GiB: 1024 ** 3,
44845
- TiB: 1024 ** 4,
44846
- PiB: 1024 ** 5,
44847
- EiB: 1024 ** 6
44848
- };
44849
- const ALIASES = (() => {
44850
- const siPairs = [
44851
- [["b", "byte", "bytes"], "B"],
44852
- [["k", "kb", "kB", "KB"], "kB"],
44853
- [["m", "mb", "MB"], "MB"],
44854
- [["g", "gb", "GB"], "GB"],
44855
- [["t", "tb, TB".replace(",", "")], "TB"],
44856
- [["p", "pb", "PB"], "PB"],
44857
- [["e", "eb", "EB"], "EB"]
44858
- ];
44859
- const iecPairs = [
44860
- [["ki", "kib", "Ki", "KiB"], "KiB"],
44861
- [["mi", "mib", "Mi", "MiB"], "MiB"],
44862
- [["gi", "gib", "Gi", "GiB"], "GiB"],
44863
- [["ti", "tib", "Ti", "TiB"], "TiB"],
44864
- [["pi", "pib", "Pi", "PiB"], "PiB"],
44865
- [["ei", "eib", "Ei", "EiB"], "EiB"]
44866
- ];
44867
- const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
44868
- const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
44869
- return Object.fromEntries([...entries, ...canon]);
44870
- })();
44871
- const normalizeUnit = (u) => {
44872
- const key = String(u).trim().toLowerCase();
44873
- const canon = ALIASES[key];
44874
- if (!canon) {
44875
- console.error(`Unknown unit: "${u}"`);
44876
- return "GB";
44877
- }
44878
- return canon;
44879
- };
44880
- const convertBytes = (bytes, unit, opts) => {
44881
- if (!Number.isFinite(bytes)) {
44882
- console.error("bytes must be a finite number");
44883
- return -1;
44884
- }
44885
- if (bytes < 0) {
44886
- console.error("bytes must be >= 0");
44887
- return -1;
44888
- }
44889
- const canon = normalizeUnit(unit);
44890
- const factor = UNIT_FACTORS[canon];
44891
- const value = bytes / factor;
44892
- return opts?.format ? `${value.toLocaleString(opts.locale, {
44893
- minimumFractionDigits: 0,
44894
- maximumFractionDigits: opts?.precision ?? 2
44895
- })} ${canon}` : value;
44896
- };
44897
- const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
44898
- if (!Number.isFinite(bytes)) {
44899
- console.error("bytes must be a finite number");
44900
- return "infinite";
44901
- }
44902
- if (bytes < 0) {
44903
- console.error("bytes must be >= 0");
44904
- return "less then zero";
44905
- }
44906
- const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
44907
- const base = standard === "iec" ? 1024 : 1e3;
44908
- const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
44909
- const unit = ladder[Math.max(0, idx)];
44910
- return String(convertBytes(bytes, unit, { format: true, precision, locale }));
44911
- };
44912
- const toBytes = (value, from) => {
44913
- if (!Number.isFinite(value)) {
44914
- console.error("value must be a finite number");
44915
- return -1;
44916
- }
44917
- if (value < 0) {
44918
- console.error("value must be >= 0");
44919
- return -1;
44920
- }
44921
- const canon = normalizeUnit(from);
44922
- const factor = UNIT_FACTORS[canon];
44923
- return value * factor;
44924
- };
44925
- const parseValueWithUnit = (input) => {
44926
- const trimmed = input.trim();
44927
- if (!trimmed) return null;
44928
- const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
44929
- if (!match) return null;
44930
- const [, numPart, unitPart] = match;
44931
- const value = Number(numPart);
44932
- if (!Number.isFinite(value)) return null;
44933
- if (unitPart) {
44934
- return { value, unit: unitPart };
44935
- }
44936
- return { value };
44937
- };
44938
-
44939
45048
  const ConverterBytes = ({ data }) => {
44940
45049
  const {
44941
45050
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -45034,105 +45143,6 @@ const ConverterBytes = ({ data }) => {
45034
45143
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: result });
45035
45144
  };
45036
45145
 
45037
- const CORE_UNIT_FACTORS = {
45038
- core: 1,
45039
- mcore: 1e-3,
45040
- ucore: 1e-6,
45041
- ncore: 1e-9
45042
- };
45043
- const CORE_ALIASES = (() => {
45044
- const corePairs = [
45045
- // plain cores
45046
- [["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
45047
- // millicores
45048
- [["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
45049
- // microcores
45050
- [["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
45051
- // nanocores
45052
- [["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
45053
- ];
45054
- const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
45055
- const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
45056
- return Object.fromEntries([...entries, ...canon]);
45057
- })();
45058
- const normalizeCoreUnit = (u) => {
45059
- const key = String(u).trim().toLowerCase();
45060
- const canon = CORE_ALIASES[key];
45061
- if (!canon) {
45062
- console.error(`Unknown core unit: "${u}"`);
45063
- return "core";
45064
- }
45065
- return canon;
45066
- };
45067
- const convertCores = (cores, unit, opts) => {
45068
- if (!Number.isFinite(cores)) {
45069
- console.error("cores must be a finite number");
45070
- return -1;
45071
- }
45072
- if (cores < 0) {
45073
- console.error("cores must be >= 0");
45074
- return -1;
45075
- }
45076
- const canon = normalizeCoreUnit(unit);
45077
- const factor = CORE_UNIT_FACTORS[canon];
45078
- const value = cores / factor;
45079
- if (!opts?.format) return value;
45080
- return `${value.toLocaleString(opts.locale, {
45081
- minimumFractionDigits: 0,
45082
- maximumFractionDigits: opts?.precision ?? 2
45083
- })} ${canon}`;
45084
- };
45085
- const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
45086
- if (!Number.isFinite(cores)) {
45087
- console.error("cores must be a finite number");
45088
- return "infinite";
45089
- }
45090
- if (cores < 0) {
45091
- console.error("cores must be >= 0");
45092
- return "less then zero";
45093
- }
45094
- if (cores === 0) {
45095
- return "0 core";
45096
- }
45097
- let targetUnit;
45098
- if (cores >= 1) {
45099
- targetUnit = "core";
45100
- } else if (cores >= 1e-3) {
45101
- targetUnit = "mcore";
45102
- } else if (cores >= 1e-6) {
45103
- targetUnit = "ucore";
45104
- } else {
45105
- targetUnit = "ncore";
45106
- }
45107
- return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
45108
- };
45109
- const toCores = (value, from) => {
45110
- if (!Number.isFinite(value)) {
45111
- console.error("value must be a finite number");
45112
- return -1;
45113
- }
45114
- if (value < 0) {
45115
- console.error("value must be >= 0");
45116
- return -1;
45117
- }
45118
- const canon = normalizeCoreUnit(from);
45119
- const factor = CORE_UNIT_FACTORS[canon];
45120
- return value * factor;
45121
- };
45122
- const parseCoresWithUnit = (input) => {
45123
- const trimmed = input.trim();
45124
- if (!trimmed) return null;
45125
- const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
45126
- if (!match) return null;
45127
- const [, numPart, unitPart] = match;
45128
- const value = Number(numPart);
45129
- if (!Number.isFinite(value)) return null;
45130
- if (unitPart) {
45131
- return { value, unit: unitPart };
45132
- }
45133
- return { value };
45134
- };
45135
-
45136
45146
  const ConverterCores = ({ data }) => {
45137
45147
  const {
45138
45148
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -47052,7 +47062,7 @@ const getEnrichedColumns = ({
47052
47062
  additionalPrinterColumnsTrimLengths,
47053
47063
  additionalPrinterColumnsColWidths,
47054
47064
  additionalPrinterColumnsKeyTypeProps,
47055
- additionalPrinterColumnsDisableSortersAndFilters,
47065
+ additionalPrinterColumnsCustomSortersAndFilters,
47056
47066
  theme,
47057
47067
  getRowKey
47058
47068
  // for factory search
@@ -47061,7 +47071,10 @@ const getEnrichedColumns = ({
47061
47071
  return void 0;
47062
47072
  }
47063
47073
  return columns.map((el, colIndex) => {
47064
- const isSortersAndFitlersDisabled = additionalPrinterColumnsDisableSortersAndFilters?.some((key) => key === el.key);
47074
+ const possibleAdditionalPrinterColumnsCustomSortersAndFiltersType = additionalPrinterColumnsCustomSortersAndFilters?.find(({ key }) => key === el.key)?.type;
47075
+ const isSortersAndFiltersDisabled = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "disabled";
47076
+ const isSortersAndFiltersCPU = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "cpu";
47077
+ const isSortersAndFiltersMemory = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "memory";
47065
47078
  const possibleUndefinedValue = additionalPrinterColumnsUndefinedValues?.find(({ key }) => key === el.key)?.value;
47066
47079
  const possibleTrimLength = additionalPrinterColumnsTrimLengths?.find(({ key }) => key === el.key)?.value;
47067
47080
  const possibleColWidth = additionalPrinterColumnsColWidths?.find(({ key }) => key === el.key)?.value;
@@ -47075,6 +47088,36 @@ const getEnrichedColumns = ({
47075
47088
  if (!cell) return "";
47076
47089
  return (cell.innerText || cell.textContent || "").trim().toLowerCase();
47077
47090
  };
47091
+ const getMemoryInBytes = (record) => {
47092
+ const text = getCellTextFromDOM(record);
47093
+ if (!text) return 0;
47094
+ const parsed = parseValueWithUnit(text);
47095
+ if (!parsed) return 0;
47096
+ if (parsed.unit) {
47097
+ const bytes = toBytes(parsed.value, parsed.unit);
47098
+ return bytes >= 0 ? bytes : 0;
47099
+ }
47100
+ return parsed.value;
47101
+ };
47102
+ const getCpuInCores = (record) => {
47103
+ const text = getCellTextFromDOM(record);
47104
+ if (!text) return 0;
47105
+ const parsed = parseCoresWithUnit(text);
47106
+ if (!parsed) return 0;
47107
+ if (parsed.unit) {
47108
+ const cores = toCores(parsed.value, parsed.unit);
47109
+ return cores >= 0 ? cores : 0;
47110
+ }
47111
+ return parsed.value;
47112
+ };
47113
+ const safeNumericCompare = (a, b) => {
47114
+ const aNaN = Number.isNaN(a);
47115
+ const bNaN = Number.isNaN(b);
47116
+ if (aNaN && bNaN) return 0;
47117
+ if (aNaN) return 1;
47118
+ if (bNaN) return -1;
47119
+ return a - b;
47120
+ };
47078
47121
  return {
47079
47122
  ...el,
47080
47123
  render: (value, record) => getCellRender({
@@ -47095,7 +47138,7 @@ const getEnrichedColumns = ({
47095
47138
  };
47096
47139
  },
47097
47140
  filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
47098
- if (isSortersAndFitlersDisabled) {
47141
+ if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
47099
47142
  return null;
47100
47143
  }
47101
47144
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -47110,13 +47153,13 @@ const getEnrichedColumns = ({
47110
47153
  );
47111
47154
  },
47112
47155
  filterIcon: (filtered) => {
47113
- if (isSortersAndFitlersDisabled) {
47156
+ if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
47114
47157
  return null;
47115
47158
  }
47116
47159
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } });
47117
47160
  },
47118
47161
  onFilter: (value, record) => {
47119
- if (isSortersAndFitlersDisabled) {
47162
+ if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
47120
47163
  return false;
47121
47164
  }
47122
47165
  if (useFactorySearch) {
@@ -47143,7 +47186,17 @@ const getEnrichedColumns = ({
47143
47186
  }
47144
47187
  return false;
47145
47188
  },
47146
- sorter: isSortersAndFitlersDisabled ? false : (a, b) => {
47189
+ sorter: isSortersAndFiltersDisabled ? false : (a, b) => {
47190
+ if (isSortersAndFiltersMemory) {
47191
+ const aBytes = getMemoryInBytes(a);
47192
+ const bBytes = getMemoryInBytes(b);
47193
+ return safeNumericCompare(aBytes, bBytes);
47194
+ }
47195
+ if (isSortersAndFiltersCPU) {
47196
+ const aCores = getCpuInCores(a);
47197
+ const bCores = getCpuInCores(b);
47198
+ return safeNumericCompare(aCores, bCores);
47199
+ }
47147
47200
  if (useFactorySearch) {
47148
47201
  const aText = getCellTextFromDOM(a);
47149
47202
  const bText = getCellTextFromDOM(b);
@@ -47279,7 +47332,7 @@ const EnrichedTable = ({
47279
47332
  additionalPrinterColumnsTrimLengths,
47280
47333
  additionalPrinterColumnsColWidths,
47281
47334
  additionalPrinterColumnsKeyTypeProps,
47282
- additionalPrinterColumnsDisableSortersAndFilters,
47335
+ additionalPrinterColumnsCustomSortersAndFilters,
47283
47336
  selectData,
47284
47337
  withoutControls = false,
47285
47338
  tableProps
@@ -47295,7 +47348,7 @@ const EnrichedTable = ({
47295
47348
  additionalPrinterColumnsTrimLengths,
47296
47349
  additionalPrinterColumnsColWidths,
47297
47350
  additionalPrinterColumnsKeyTypeProps,
47298
- additionalPrinterColumnsDisableSortersAndFilters,
47351
+ additionalPrinterColumnsCustomSortersAndFilters,
47299
47352
  theme,
47300
47353
  getRowKey: rowKey
47301
47354
  // for factory search
@@ -47666,7 +47719,7 @@ const EnrichedTableProvider = ({
47666
47719
  additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
47667
47720
  additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
47668
47721
  additionalPrinterColumnsKeyTypeProps: preparedProps.additionalPrinterColumnsKeyTypeProps,
47669
- additionalPrinterColumnsDisableSortersAndFilters: preparedProps.additionalPrinterColumnsDisableSortersAndFilters,
47722
+ additionalPrinterColumnsCustomSortersAndFilters: preparedProps.additionalPrinterColumnsCustomSortersAndFilters,
47670
47723
  selectData,
47671
47724
  tableProps,
47672
47725
  withoutControls
@@ -54946,5 +54999,5 @@ const useInfiniteSentinel = (sentinelRef, hasMore, onNeedMore) => {
54946
54999
  }, [sentinelRef, hasMore, onNeedMore]);
54947
55000
  };
54948
55001
 
54949
- export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useSmartResourceParams };
55002
+ export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useSmartResourceParams };
54950
55003
  //# sourceMappingURL=openapi-k8s-toolkit.es.js.map