docs(changeset): Added refs and exports, isEmpty

This commit is contained in:
Hein
2025-10-29 14:56:59 +02:00
parent 615b89360a
commit 54deac6ccc
10 changed files with 245 additions and 186 deletions

View File

@@ -2,12 +2,14 @@
import React, { useCallback, useEffect } from 'react';
import type { APIOptions } from '../../utils/types';
import type { GridlerColumn } from '../Column';
import { GoAPIHeaders, type GoAPIOperation } from '../../utils/golang-restapi-v2';
import { useGridlerStore } from '../GridlerStore';
export interface GlidlerAPIAdaptorForGoLangv2Props<T = unknown> extends APIOptions {
filter?: string;
hotfields?: Array<string>;
initialData?: Array<T>;
options?: Array<GoAPIOperation>;
}
@@ -24,6 +26,7 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG
const useAPIQuery: (index: number) => Promise<any> = useCallback(
async (index: number) => {
const columns = getState('columns');
const colSort = getState('colSort');
const pageSize = getState('pageSize');
const colFilters = getState('colFilters');
@@ -66,6 +69,21 @@ function _GlidlerAPIAdaptorForGoLangv2<T = unknown>(props: GlidlerAPIAdaptorForG
}
}
const col_ids =
columns
?.filter((col) => !col.virtual)
?.map((col: GridlerColumn) => {
return col.id;
}) ?? [];
if (props.hotfields && props.hotfields.length > 0) {
col_ids?.push(props.hotfields.join(','));
}
if (col_ids && col_ids.length > 0) {
head.set(`x-select-fields`, col_ids.join(','));
}
const currentRequestIndex = _active_requests?.findIndex((f) => f.page === index) ?? -1;
_active_requests?.forEach((r) => {
if ((r.page >= 0 && r.page < index - 2) || (index >= 0 && r.page > index + 2)) {