const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_objectWithoutProperties = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_utils = require("../Table/utils.js");
const require_index = require("../Table/index.js");
const require_index$1 = require("../Gallery/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let ahooks = require("ahooks");
//#region src/components/table/View/index.tsx
const _excluded = [
	"dataSource",
	"columns",
	"dispatch",
	"style",
	"filter",
	"sort",
	"buttons",
	"actionButtons",
	"title",
	"summary",
	"onValuesChange",
	"columnSetting",
	"dataSourceGroup",
	"view",
	"gallery",
	"setTableSetting",
	"onDataSourceChange"
];
const View = (props) => {
	const { dataSource, columns, dispatch, style, filter, sort, buttons, actionButtons, title, summary, onValuesChange, columnSetting, dataSourceGroup, view, gallery, setTableSetting, onDataSourceChange } = props, other = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const form = antd.Form.useFormInstance();
	const viewMode = antd.Form.useWatch("view_mode", {
		form,
		preserve: true
	});
	const debouncedFilter = (0, ahooks.useDebounce)(filter, { wait: 200 });
	const memoOnDataSourceChange = (0, ahooks.useMemoizedFn)((v) => onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(v));
	return (0, react.useMemo)(() => {
		return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, viewMode === "grid" && /* @__PURE__ */ react.default.createElement(require_index.default, {
			tableProps: other,
			filter,
			setTableSetting,
			onDataSourceChange: memoOnDataSourceChange
		}), viewMode === "gallery" && /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			loading: other === null || other === void 0 ? void 0 : other.loading,
			gallery,
			pagination: other.pagination,
			filter,
			rowKey: other.rowKey,
			onDataSourceChange: memoOnDataSourceChange
		}));
	}, [
		viewMode,
		require_utils.stringify(other),
		debouncedFilter,
		memoOnDataSourceChange,
		gallery
	]);
};
//#endregion
exports.default = View;
