UNPKG

denwa-react-shared

Version:
124 lines (123 loc) 3.57 kB
import { G as e, J as t, K as n, X as r, n as i, t as a } from "./styles.module-DO7uqbNP.js"; import { jsx as o, jsxs as s } from "react/jsx-runtime"; import { useDebounce as c } from "react-use"; import { createElement as l, useMemo as u, useState as d } from "react"; import { Button as f, Flex as p, Input as m, Segmented as h, Select as g, Tooltip as _, theme as v } from "antd"; import { PlusOutlined as y, RedoOutlined as b } from "@ant-design/icons"; //#region src/shared/ui/admin-table/table-search.tsx var x = ({ datePickerComponent: r, searchText: f, noDateText: _, emptyText: y, searchSelect: b, radioOptions: x, searchOptions: S, searchType: C, textSearchValue: w = "", dateSearchValue: T, numberSearchValue: E, multiselectSearchValue: D, multiselectOptions: O, onChangeSearch: k, onChangeTextSearch: A, onChangeRadioSearch: j, onChangeDateSearch: M, onChangeNumberSearch: N, onChangeMultiselectSearch: P }) => { let [F, I] = d(w), { token: { borderRadius: L, colorBgBase: R, paddingXXS: z } } = v.useToken(), { isMobileMaxWidth: B } = e(), { isSmallMaxWidth: V } = n(), H = u(() => V ? 2 : B ? 5 : 15, [B, V]); c(() => { A?.(F); }, t.milliseconds.milliseconds500, [F]); let U = () => { I(""); }; return /* @__PURE__ */ s(p, { className: a.flex, gap: "small", style: { padding: z, borderRadius: L, background: R }, children: [/* @__PURE__ */ o(g, { defaultValue: b, value: b, style: { width: 120, minWidth: 120 }, options: S, onChange: (e) => { k(e), U(); } }), { text: /* @__PURE__ */ o(m, { placeholder: f, value: F, allowClear: !0, onChange: (e) => { I(e.target.value.replace(/"/g, "")); } }), radio: /* @__PURE__ */ o(h, { options: x, defaultValue: "all", onChange: j }), date: l(r, { noDateText: _, currentValue: T ?? "", onChangeDate: (e) => { M?.(e); } }), number: /* @__PURE__ */ o(i, { emptyText: y, value: E, placeholder: f, min: 0, max: 2147483647, onChange: (e) => { !e && e !== 0 || N?.(+e); } }), multiselect: /* @__PURE__ */ o(g, { className: a.select, mode: "multiple", placeholder: f, maxTagCount: 1, maxTagTextLength: H, showSearch: !1, allowClear: !0, options: O, value: D, onChange: P }) }[C]] }); }, S = ({ sortTooltipText: e, updateDataText: t, refreshText: n, createText: i, createNewElementText: c, order: l, orderOptions: u, createButtonTooltip: d, searchProps: m, isCanCreate: h, isHiddenCreate: v, onCreate: S, onRefetch: C, onChangeOrder: w }) => /* @__PURE__ */ s(p, { gap: "middle", justify: "space-between", wrap: "wrap", style: { marginBottom: r.OFFSET[1] }, children: [/* @__PURE__ */ s(p, { align: "center", gap: "middle", wrap: "wrap", children: [/* @__PURE__ */ o(x, { ...m }), /* @__PURE__ */ o(_, { title: e, children: /* @__PURE__ */ o(g, { className: a.sort, value: l, options: u, onChange: w }) })] }), /* @__PURE__ */ s(p, { className: a.buttonsContainer, gap: "small", align: "center", children: [C && /* @__PURE__ */ o(_, { title: t, children: /* @__PURE__ */ o(f, { className: a.button, icon: /* @__PURE__ */ o(b, {}), onClick: C, children: n }) }), !v && h && /* @__PURE__ */ o(_, { title: d ?? c, children: /* @__PURE__ */ o(f, { className: a.button, type: "primary", icon: /* @__PURE__ */ o(y, {}), onClick: S, children: i }) })] })] }); //#endregion export { S as TableHead };