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

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.
@@ -47052,16 +47052,29 @@ const getEnrichedColumns = ({
47052
47052
  additionalPrinterColumnsTrimLengths,
47053
47053
  additionalPrinterColumnsColWidths,
47054
47054
  additionalPrinterColumnsKeyTypeProps,
47055
- theme
47055
+ additionalPrinterColumnsDisableSortersAndFilters,
47056
+ theme,
47057
+ getRowKey
47058
+ // for factory search
47056
47059
  }) => {
47057
47060
  if (!columns) {
47058
47061
  return void 0;
47059
47062
  }
47060
- return columns.map((el) => {
47063
+ return columns.map((el, colIndex) => {
47064
+ const isSortersAndFitlersDisabled = additionalPrinterColumnsDisableSortersAndFilters?.some((key) => key === el.key);
47061
47065
  const possibleUndefinedValue = additionalPrinterColumnsUndefinedValues?.find(({ key }) => key === el.key)?.value;
47062
47066
  const possibleTrimLength = additionalPrinterColumnsTrimLengths?.find(({ key }) => key === el.key)?.value;
47063
47067
  const possibleColWidth = additionalPrinterColumnsColWidths?.find(({ key }) => key === el.key)?.value;
47064
47068
  const possibleCustomTypeWithProps = additionalPrinterColumnsKeyTypeProps && el.key ? additionalPrinterColumnsKeyTypeProps[el.key.toString()] : void 0;
47069
+ const useFactorySearch = possibleCustomTypeWithProps?.type === "factory";
47070
+ const colKey = el.key != null && String(el.key) || (Array.isArray(el.dataIndex) ? el.dataIndex.join(".") : String(el.dataIndex ?? colIndex));
47071
+ const getCellTextFromDOM = (record) => {
47072
+ const rowKey = getRowKey(record);
47073
+ const selector = `td[data-rowkey="${String(rowKey)}"][data-colkey="${colKey}"]`;
47074
+ const cell = document.querySelector(selector);
47075
+ if (!cell) return "";
47076
+ return (cell.innerText || cell.textContent || "").trim().toLowerCase();
47077
+ };
47065
47078
  return {
47066
47079
  ...el,
47067
47080
  render: (value, record) => getCellRender({
@@ -47073,18 +47086,43 @@ const getEnrichedColumns = ({
47073
47086
  theme
47074
47087
  }),
47075
47088
  width: possibleColWidth,
47076
- filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
47077
- FilterDropdown,
47078
- {
47079
- setSelectedKeys,
47080
- selectedKeys,
47081
- confirm,
47082
- clearFilters,
47083
- close
47089
+ // for factory search
47090
+ onCell: (record) => {
47091
+ const rowKey = getRowKey(record);
47092
+ return {
47093
+ "data-rowkey": String(rowKey),
47094
+ "data-colkey": String(colKey)
47095
+ };
47096
+ },
47097
+ filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
47098
+ if (isSortersAndFitlersDisabled) {
47099
+ return null;
47084
47100
  }
47085
- ),
47086
- filterIcon: (filtered) => /* @__PURE__ */ jsxRuntimeExports.jsx(SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } }),
47101
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
47102
+ FilterDropdown,
47103
+ {
47104
+ setSelectedKeys,
47105
+ selectedKeys,
47106
+ confirm,
47107
+ clearFilters,
47108
+ close
47109
+ }
47110
+ );
47111
+ },
47112
+ filterIcon: (filtered) => {
47113
+ if (isSortersAndFitlersDisabled) {
47114
+ return null;
47115
+ }
47116
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } });
47117
+ },
47087
47118
  onFilter: (value, record) => {
47119
+ if (isSortersAndFitlersDisabled) {
47120
+ return false;
47121
+ }
47122
+ if (useFactorySearch) {
47123
+ const text = getCellTextFromDOM(record);
47124
+ return text.includes(String(value).toLowerCase());
47125
+ }
47088
47126
  const { dataIndex } = el;
47089
47127
  const entry = Array.isArray(dataIndex) ? lodashExports.get(record, dataIndex) : record[dataIndex];
47090
47128
  if (typeof entry === "object" && !Array.isArray(entry)) {
@@ -47105,7 +47143,12 @@ const getEnrichedColumns = ({
47105
47143
  }
47106
47144
  return false;
47107
47145
  },
47108
- sorter: (a, b) => {
47146
+ sorter: isSortersAndFitlersDisabled ? false : (a, b) => {
47147
+ if (useFactorySearch) {
47148
+ const aText = getCellTextFromDOM(a);
47149
+ const bText = getCellTextFromDOM(b);
47150
+ return aText.localeCompare(bText);
47151
+ }
47109
47152
  const { dataIndex } = el;
47110
47153
  const aEntry = Array.isArray(dataIndex) ? lodashExports.get(a, dataIndex) : a[dataIndex];
47111
47154
  const bEntry = Array.isArray(dataIndex) ? lodashExports.get(b, dataIndex) : b[dataIndex];
@@ -47236,6 +47279,7 @@ const EnrichedTable = ({
47236
47279
  additionalPrinterColumnsTrimLengths,
47237
47280
  additionalPrinterColumnsColWidths,
47238
47281
  additionalPrinterColumnsKeyTypeProps,
47282
+ additionalPrinterColumnsDisableSortersAndFilters,
47239
47283
  selectData,
47240
47284
  withoutControls = false,
47241
47285
  tableProps
@@ -47244,13 +47288,17 @@ const EnrichedTable = ({
47244
47288
  if (!columns) {
47245
47289
  return null;
47246
47290
  }
47291
+ const rowKey = (record) => record.key;
47247
47292
  const enrichedColumns = getEnrichedColumns({
47248
47293
  columns,
47249
47294
  additionalPrinterColumnsUndefinedValues,
47250
47295
  additionalPrinterColumnsTrimLengths,
47251
47296
  additionalPrinterColumnsColWidths,
47252
47297
  additionalPrinterColumnsKeyTypeProps,
47253
- theme
47298
+ additionalPrinterColumnsDisableSortersAndFilters,
47299
+ theme,
47300
+ getRowKey: rowKey
47301
+ // for factory search
47254
47302
  });
47255
47303
  if (!enrichedColumns) {
47256
47304
  return null;
@@ -47276,6 +47324,7 @@ const EnrichedTable = ({
47276
47324
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableComponents.HideableControls, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47277
47325
  Table,
47278
47326
  {
47327
+ rowKey,
47279
47328
  dataSource,
47280
47329
  columns: columnsWithControls,
47281
47330
  pagination: tableProps?.disablePagination ? false : {
@@ -47617,6 +47666,7 @@ const EnrichedTableProvider = ({
47617
47666
  additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
47618
47667
  additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
47619
47668
  additionalPrinterColumnsKeyTypeProps: preparedProps.additionalPrinterColumnsKeyTypeProps,
47669
+ additionalPrinterColumnsDisableSortersAndFilters: preparedProps.additionalPrinterColumnsDisableSortersAndFilters,
47620
47670
  selectData,
47621
47671
  tableProps,
47622
47672
  withoutControls