anysystem-design 0.0.18 → 0.0.20

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 (47) hide show
  1. package/dist/{combobox-Dj9kDXdY.js → combobox-DcjIgW1K.js} +1 -1
  2. package/dist/components/AutoComplete/AutoCompleteBase.js +3 -3
  3. package/dist/components/AutoComplete/AutoCompleteMultiple.js +4 -4
  4. package/dist/components/Checkbox/CheckboxBase.d.ts +1 -0
  5. package/dist/components/Checkbox/CheckboxBase.js +18 -15
  6. package/dist/components/Container/Container.js +1 -1
  7. package/dist/components/DataTable/DataTable.d.ts +12 -0
  8. package/dist/components/DataTable/DataTable.js +54 -0
  9. package/dist/components/DataTable/components/DataTableBody.d.ts +4 -0
  10. package/dist/components/DataTable/components/DataTableBody.js +11 -0
  11. package/dist/components/DataTable/components/DataTableCell.d.ts +10 -0
  12. package/dist/components/DataTable/components/DataTableCell.js +18 -0
  13. package/dist/components/DataTable/components/DataTableHead.d.ts +4 -0
  14. package/dist/components/DataTable/components/DataTableHead.js +25 -0
  15. package/dist/components/DataTable/components/DataTableHeadCell.d.ts +8 -0
  16. package/dist/components/DataTable/components/DataTableHeadCell.js +5 -0
  17. package/dist/components/DataTable/components/DataTableRow.d.ts +9 -0
  18. package/dist/components/DataTable/components/DataTableRow.js +22 -0
  19. package/dist/components/DataTable/components/FieldSelectbox.d.ts +4 -0
  20. package/dist/components/DataTable/components/FieldSelectbox.js +104 -0
  21. package/dist/components/DataTable/contexts/DataTableContext.d.ts +12 -0
  22. package/dist/components/DataTable/contexts/DataTableContext.js +13 -0
  23. package/dist/components/DataTable/index.d.ts +2 -0
  24. package/dist/components/DataTable/index.js +4 -0
  25. package/dist/components/DataTable/libs/helper.d.ts +4 -0
  26. package/dist/components/DataTable/libs/helper.js +32 -0
  27. package/dist/components/DataTable/libs/type.d.ts +25 -0
  28. package/dist/components/DataTable/libs/type.js +1 -0
  29. package/dist/components/DatePicker/DatePicker.js +1 -1
  30. package/dist/components/Icon/Icon.js +1 -1
  31. package/dist/components/Label/Label.js +3 -3
  32. package/dist/components/Modal/Modal.js +1 -1
  33. package/dist/components/Navbar/Navbar.js +15 -15
  34. package/dist/components/PasswordInput/PasswordInput.js +1 -1
  35. package/dist/components/RadioGroup/RadioGroup.js +7 -6
  36. package/dist/components/Selectbox/SelectboxBase.js +4 -4
  37. package/dist/components/Selectbox/SelectboxMultiple.js +3 -3
  38. package/dist/components/index.d.ts +2 -0
  39. package/dist/components/index.js +12 -10
  40. package/dist/{index-bj2cEeS0.js → index-BVp57yIc.js} +10 -24
  41. package/dist/{index-Bv0kHmgl.js → index-CBEJ8A3p.js} +3 -3
  42. package/dist/{index-C197ia6B.js → index-DUypCuzD.js} +7 -4
  43. package/dist/index.css +1 -1
  44. package/dist/index.js +25 -23
  45. package/dist/{listbox-ClkgDv_m.js → listbox-T8TrOULl.js} +1 -1
  46. package/dist/use-by-comparator-CVuf9KBq.js +16 -0
  47. package/package.json +1 -1
@@ -3,7 +3,7 @@ import * as oe from "react";
3
3
  import $, { useRef as W, useEffect as He, createContext as ve, useReducer as Ke, createRef as Ue, useCallback as Te, useMemo as G, useId as ce, useContext as be, useState as Ge, Fragment as De } from "react";
4
4
  import { r as X } from "./index-DsprzSCj.js";
5
5
  import { w as qe, T as Je } from "./use-resolve-button-type-DkEA2l9L.js";
6
- import { u as Ye } from "./index-bj2cEeS0.js";
6
+ import { u as Ye } from "./use-by-comparator-CVuf9KBq.js";
7
7
  import { K as Qe, l as Xe, T as Ze, z as et, j as tt, u as nt, I as ge } from "./label-9PX7EyLe.js";
8
8
  import { o as x, n as q, M as Re, W as se, u as ee, H as re, y as de, p as ot, D as xe, s as it, b as Ee } from "./use-sync-refs-TDnk3jQt.js";
9
9
  import { v as st, y as rt, x as lt, R as at, f as ut, g as ye, l as Ce, k as ct, h as dt, i as _, j as Me } from "./calculate-active-index-xXUBsarF.js";
@@ -1,10 +1,10 @@
1
1
  import { jsx as a, jsxs as f } from "react/jsx-runtime";
2
2
  import c, { Fragment as p } from "react";
3
3
  import { t as y } from "../../bundle-mjs-SHnj3fHy.js";
4
- import { H as b } from "../../index-bj2cEeS0.js";
5
- import { c as x } from "../../index-Bv0kHmgl.js";
4
+ import { H as b } from "../../index-BVp57yIc.js";
5
+ import { c as x } from "../../index-CBEJ8A3p.js";
6
6
  import { getValue as u } from "../Selectbox/helper.js";
7
- import { N as w, G as C, H as E, z as N, K as L } from "../../combobox-Dj9kDXdY.js";
7
+ import { N as w, G as C, H as E, z as N, K as L } from "../../combobox-DcjIgW1K.js";
8
8
  import { X as S } from "../../transition-6o20faRl.js";
9
9
  const H = (t, r) => r.type === "SEARCH" ? {
10
10
  ...t,
@@ -2,11 +2,11 @@ import { jsx as l, jsxs as m } from "react/jsx-runtime";
2
2
  import p, { Fragment as h } from "react";
3
3
  import { _ as x } from "../../lodash-XYp3qmxI.js";
4
4
  import { t as v } from "../../bundle-mjs-SHnj3fHy.js";
5
- import { H as b } from "../../index-bj2cEeS0.js";
6
- import { c as C } from "../../index-Bv0kHmgl.js";
7
- import { a as w } from "../../index-C197ia6B.js";
5
+ import { H as b } from "../../index-BVp57yIc.js";
6
+ import { c as C } from "../../index-CBEJ8A3p.js";
7
+ import { d as w } from "../../index-DUypCuzD.js";
8
8
  import { getValue as o } from "../Selectbox/helper.js";
9
- import { N, G as S, H as L, z as T, K as q } from "../../combobox-Dj9kDXdY.js";
9
+ import { N, G as S, H as L, z as T, K as q } from "../../combobox-DcjIgW1K.js";
10
10
  import { X as A } from "../../transition-6o20faRl.js";
11
11
  const R = (r, t) => {
12
12
  if (t.type === "SEARCH")
@@ -4,5 +4,6 @@ export type CheckboxBaseProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
4
  className?: string;
5
5
  isError?: boolean;
6
6
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
7
+ intermediate?: boolean;
7
8
  };
8
9
  export declare const CheckboxBase: React.FC<CheckboxBaseProps>;
@@ -1,29 +1,32 @@
1
- import { jsxs as o, jsx as l } from "react/jsx-runtime";
2
- import { A as t } from "../../index-C197ia6B.js";
3
- import { t as c } from "../../bundle-mjs-SHnj3fHy.js";
4
- const f = ({
5
- className: a,
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import { b as n, c } from "../../index-DUypCuzD.js";
3
+ import { t as s } from "../../bundle-mjs-SHnj3fHy.js";
4
+ const m = ({
5
+ className: t,
6
6
  isError: d,
7
- inputProps: r,
8
- ...e
7
+ inputProps: l,
8
+ intermediate: a = !1,
9
+ ...r
9
10
  }) => /* @__PURE__ */ o("div", { className: "relative h-5 w-5 overflow-hidden rounded", children: [
10
- /* @__PURE__ */ l(
11
+ /* @__PURE__ */ e(
11
12
  "input",
12
13
  {
13
14
  type: "checkbox",
14
- className: c(
15
- "relative z-10",
15
+ className: s(
16
+ "relative z-20",
16
17
  "peer block h-full w-full cursor-pointer appearance-none rounded border-2 border-gray-400 focus:outline-4 focus:outline-blue-500",
17
18
  "checked:border-primary-600",
19
+ a && "border-primary-600",
18
20
  d && "border-red-500",
19
- a
21
+ t
20
22
  ),
21
- value: (r == null ? void 0 : r.value) || (e == null ? void 0 : e.value) || "",
22
- ...e
23
+ value: (l == null ? void 0 : l.value) || (r == null ? void 0 : r.value) || "",
24
+ ...r
23
25
  }
24
26
  ),
25
- /* @__PURE__ */ l("span", { className: "absolute left-1/2 top-1/2 hidden h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 peer-checked:z-10 peer-checked:flex dark:fill-primary-600", children: /* @__PURE__ */ l(t, { className: "h-full w-full rounded" }) })
27
+ a === !0 && /* @__PURE__ */ e("span", { className: "absolute left-1/2 top-1/2 flex h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 dark:fill-primary-600", children: /* @__PURE__ */ e(n, { className: "h-full w-full rounded" }) }),
28
+ /* @__PURE__ */ e("span", { className: "absolute left-1/2 top-1/2 hidden h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 peer-checked:z-10 peer-checked:flex dark:fill-primary-600", children: /* @__PURE__ */ e(c, { className: "h-full w-full rounded" }) })
26
29
  ] });
27
30
  export {
28
- f as CheckboxBase
31
+ m as CheckboxBase
29
32
  };
@@ -3,7 +3,7 @@ import { t as r } from "../../bundle-mjs-SHnj3fHy.js";
3
3
  const l = ({
4
4
  className: e,
5
5
  ...t
6
- }) => /* @__PURE__ */ m("div", { className: r("mx-auto w-full max-w-lg pt-8 px-4", e), children: t == null ? void 0 : t.children });
6
+ }) => /* @__PURE__ */ m("div", { className: r("mx-auto w-full max-w-lg px-4 py-8", e), children: t == null ? void 0 : t.children });
7
7
  export {
8
8
  l as Container
9
9
  };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { DataTableField } from './libs/type';
3
+
4
+ export type DataTableProps = {
5
+ data: object[];
6
+ fields: DataTableField[];
7
+ selectable?: boolean;
8
+ chooseFieldable?: boolean;
9
+ name?: string;
10
+ };
11
+ declare const DataTable: React.FC<DataTableProps>;
12
+ export default DataTable;
@@ -0,0 +1,54 @@
1
+ import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
+ import h from "react";
3
+ import { _ as u } from "../../lodash-XYp3qmxI.js";
4
+ import { DataTableProvider as D } from "./contexts/DataTableContext.js";
5
+ import s from "./components/DataTableHead.js";
6
+ import c from "./components/DataTableBody.js";
7
+ import n from "./components/FieldSelectbox.js";
8
+ import { useLocalStorage as S } from "../../hooks/useLocalStorage.js";
9
+ const w = (e, l) => l.type === "SELECT_ALL" ? {
10
+ ...e,
11
+ DTChecked: e.DTChecked.every((r) => r === !0) ? e.DTChecked.map(() => !1) : e.DTChecked.map(() => !0)
12
+ } : l.type === "SELECT_ROW" ? {
13
+ ...e,
14
+ DTChecked: e.DTChecked.map((r, d) => d === l.index ? !r : r)
15
+ } : l.type === "SELECT_FIELDKEY" ? {
16
+ ...e,
17
+ DTShowFields: e.DTShowFields.includes(l.fieldKey) ? e.DTShowFields.filter((r) => r !== l.fieldKey) : u.uniq([...e.DTShowFields, l.fieldKey])
18
+ } : l.type === "SET_FIELD" ? {
19
+ ...e,
20
+ DTShowFields: l.fields.map((r) => r.key)
21
+ } : e, v = ({
22
+ name: e = "",
23
+ data: l,
24
+ fields: r,
25
+ selectable: d = !1,
26
+ chooseFieldable: T = !1
27
+ }) => {
28
+ const [f, p] = S(
29
+ `tableName-path-${window.location.pathname.replace(/\//g, "-")}-name-${e}`,
30
+ r.every((o) => !(o != null && o.default)) ? r.map((o) => o.key) : r.filter((o) => o.default === !0).map((o) => o.key)
31
+ ), [i, t] = h.useReducer(w, {
32
+ DTData: l,
33
+ DTChecked: new Array(l.length).fill(!1),
34
+ DTShowFields: f
35
+ });
36
+ return h.useEffect(() => {
37
+ p(i.DTShowFields);
38
+ }, [i.DTShowFields]), /* @__PURE__ */ a(
39
+ D,
40
+ {
41
+ value: { selectable: d, fields: r, chooseFieldable: T, state: i, dispatch: t },
42
+ children: /* @__PURE__ */ m("div", { className: "relative w-full", children: [
43
+ /* @__PURE__ */ m("table", { className: "table", children: [
44
+ /* @__PURE__ */ a(s, {}),
45
+ /* @__PURE__ */ a(c, {})
46
+ ] }),
47
+ /* @__PURE__ */ a(n, {})
48
+ ] })
49
+ }
50
+ );
51
+ };
52
+ export {
53
+ v as default
54
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const DataTableBody: React.FC;
4
+ export default DataTableBody;
@@ -0,0 +1,11 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import r from "react";
3
+ import m from "./DataTableRow.js";
4
+ import { DataTableContext as n } from "../contexts/DataTableContext.js";
5
+ const p = () => {
6
+ const { state: t } = r.useContext(n);
7
+ return /* @__PURE__ */ o("tbody", { children: t.DTData && t.DTData.map((e, a) => /* @__PURE__ */ o(m, { row: e, index: a }, a)) });
8
+ };
9
+ export {
10
+ p as default
11
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { ValueKey, ValueNode } from '../libs/type';
3
+
4
+ export type DataTableCellProps = {
5
+ children?: React.ReactNode;
6
+ data?: object;
7
+ field?: string | ValueNode | ValueKey;
8
+ };
9
+ declare const DataTableCell: React.FC<DataTableCellProps>;
10
+ export default DataTableCell;
@@ -0,0 +1,18 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { _ as n } from "../../../lodash-XYp3qmxI.js";
3
+ import { getValueByKey as f } from "../libs/helper.js";
4
+ const m = ({
5
+ children: e,
6
+ data: o,
7
+ field: i
8
+ }) => {
9
+ if (e)
10
+ return /* @__PURE__ */ t("td", { children: e });
11
+ if (typeof o != "object" || !i)
12
+ return /* @__PURE__ */ t("td", {});
13
+ const r = f(o, i);
14
+ return r ? n.isArray(r) ? /* @__PURE__ */ t("td", { children: r.join(",") }) : /* @__PURE__ */ t("td", { children: r }) : /* @__PURE__ */ t("td", {});
15
+ };
16
+ export {
17
+ m as default
18
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const DataTableHead: React.FC;
4
+ export default DataTableHead;
@@ -0,0 +1,25 @@
1
+ import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { DataTableContext as h } from "../contexts/DataTableContext.js";
4
+ import { CheckboxBase as m } from "../../Checkbox/CheckboxBase.js";
5
+ import n from "./DataTableHeadCell.js";
6
+ const D = () => {
7
+ const { fields: r, selectable: s, state: t, dispatch: d } = o.useContext(h), l = o.useMemo(
8
+ () => r.filter((e) => t.DTShowFields.includes(e.key)),
9
+ [r, t.DTShowFields]
10
+ );
11
+ return /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ c("tr", { children: [
12
+ s && /* @__PURE__ */ a("th", { className: "w-8 p-2", children: /* @__PURE__ */ a(
13
+ m,
14
+ {
15
+ checked: t.DTChecked.every((e) => e === !0),
16
+ intermediate: t.DTChecked.some((e) => e === !0) && !t.DTChecked.every((e) => e === !0),
17
+ onChange: () => d({ type: "SELECT_ALL" })
18
+ }
19
+ ) }),
20
+ l.map((e, i) => /* @__PURE__ */ a(n, { field: e }, i))
21
+ ] }) });
22
+ };
23
+ export {
24
+ D as default
25
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { DataTableField } from '../libs/type';
3
+
4
+ export type DataTableHeadCellProps = {
5
+ field: DataTableField;
6
+ };
7
+ declare const DataTableHeadCell: React.FC<DataTableHeadCellProps>;
8
+ export default DataTableHeadCell;
@@ -0,0 +1,5 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ const t = ({ field: e }) => /* @__PURE__ */ a("th", { children: e.label });
3
+ export {
4
+ t as default
5
+ };
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type DataRowProps = {
4
+ children?: React.ReactNode;
5
+ row?: object;
6
+ index: number;
7
+ };
8
+ declare const DataTableRow: React.FC<DataRowProps>;
9
+ export default DataTableRow;
@@ -0,0 +1,22 @@
1
+ import { jsxs as d, jsx as e, Fragment as f } from "react/jsx-runtime";
2
+ import n from "react";
3
+ import { _ as p } from "../../../lodash-XYp3qmxI.js";
4
+ import { DataTableContext as h } from "../contexts/DataTableContext.js";
5
+ import { CheckboxBase as C } from "../../Checkbox/CheckboxBase.js";
6
+ import b from "./DataTableCell.js";
7
+ const j = ({ row: a, children: o, index: l }) => {
8
+ const { selectable: s, fields: m, state: r, dispatch: i } = n.useContext(h);
9
+ return /* @__PURE__ */ d("tr", { children: [
10
+ s && /* @__PURE__ */ e("td", { className: "w-[50px]", children: /* @__PURE__ */ e(
11
+ C,
12
+ {
13
+ checked: !!r.DTChecked[l],
14
+ onChange: () => i({ type: "SELECT_ROW", index: l })
15
+ }
16
+ ) }),
17
+ o || (p.isPlainObject(a) ? m.filter((t) => r.DTShowFields.includes(t.key)).map((t, c) => /* @__PURE__ */ e(b, { data: a, field: t.value }, c)) : /* @__PURE__ */ e(f, {}))
18
+ ] });
19
+ };
20
+ export {
21
+ j as default
22
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ declare const FieldSelectbox: React.FC;
4
+ export default FieldSelectbox;
@@ -0,0 +1,104 @@
1
+ import { jsxs as n, jsx as t, Fragment as c } from "react/jsx-runtime";
2
+ import w, { Fragment as k } from "react";
3
+ import { A as N, a as T } from "../../../index-DUypCuzD.js";
4
+ import { t as m } from "../../../bundle-mjs-SHnj3fHy.js";
5
+ import { u as C, a as D, b as S, c as j, d as M, e as R } from "../../../calculate-active-index-xXUBsarF.js";
6
+ import { DataTableContext as A } from "../contexts/DataTableContext.js";
7
+ import { o as E, f as P, s as U, a as _ } from "../../../floating-ui.react-dom-YTFlGVA5.js";
8
+ import { M as z, U as B, G, V as I } from "../../../listbox-T8TrOULl.js";
9
+ import { X as V } from "../../../transition-6o20faRl.js";
10
+ const W = () => {
11
+ const { fields: a, state: l, dispatch: d } = w.useContext(A), { refs: r, x: u, y: p, strategy: f, floatingStyles: y, context: o } = C({
12
+ open: !0,
13
+ middleware: [E(10), P(), U()],
14
+ whileElementsMounted: _,
15
+ placement: "bottom-end"
16
+ }), h = D(o, { move: !1 }), g = S(o), x = j(o), v = M(o, { role: "tooltip" }), { getReferenceProps: b, getFloatingProps: F } = R([
17
+ h,
18
+ g,
19
+ x,
20
+ v
21
+ ]);
22
+ return /* @__PURE__ */ n(
23
+ z,
24
+ {
25
+ className: "absolute right-2 top-2",
26
+ as: "div",
27
+ value: a.filter((s) => l.DTShowFields.includes(s.key)),
28
+ multiple: !0,
29
+ onChange: (s) => {
30
+ const i = s.map((e) => e.key);
31
+ d({
32
+ type: "SET_FIELD",
33
+ fields: s.length === 0 ? a.every((e) => !(e != null && e.default)) ? a : a.filter((e) => !!(e != null && e.default)) : a.filter((e) => i.includes(e.key))
34
+ });
35
+ },
36
+ ref: r.setReference,
37
+ ...b(),
38
+ children: [
39
+ /* @__PURE__ */ t(B, { className: "relative z-10 inline-flex justify-between !p-0 focus:outline-none", children: /* @__PURE__ */ t(
40
+ N,
41
+ {
42
+ className: "h-5 w-5 text-gray-400",
43
+ "aria-hidden": "true"
44
+ }
45
+ ) }),
46
+ /* @__PURE__ */ t(
47
+ V,
48
+ {
49
+ as: k,
50
+ enter: "transition duration-100 ease-out",
51
+ enterFrom: "scale-95 transform opacity-0",
52
+ enterTo: "scale-100 transform opacity-100",
53
+ leave: "transition duration-75 ease-in",
54
+ leaveFrom: "scale-100 transform opacity-100",
55
+ leaveTo: "scale-95 transform opacity-0",
56
+ children: /* @__PURE__ */ t(
57
+ G,
58
+ {
59
+ className: "absolute !z-[999] mt-2 inline-block w-48 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
60
+ ref: r.setFloating,
61
+ style: y,
62
+ ...F({
63
+ style: {
64
+ position: f,
65
+ top: p ?? "",
66
+ left: u ?? ""
67
+ }
68
+ }),
69
+ children: /* @__PURE__ */ t("div", { className: "flex flex-col px-1 py-1", children: a.map((s) => {
70
+ var i;
71
+ return /* @__PURE__ */ t(
72
+ I,
73
+ {
74
+ className: m(
75
+ "relative flex cursor-pointer select-none justify-between px-3 py-2 text-black hover:bg-primary-100"
76
+ ),
77
+ value: s,
78
+ children: /* @__PURE__ */ n(c, { children: [
79
+ /* @__PURE__ */ t("span", { className: "pl-6", children: s.label }),
80
+ (i = l.DTShowFields) != null && i.includes(s.key) ? /* @__PURE__ */ t(
81
+ "span",
82
+ {
83
+ className: m(
84
+ "absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600"
85
+ ),
86
+ children: /* @__PURE__ */ t(T, { className: "h-4 w-5", "aria-hidden": "true" })
87
+ }
88
+ ) : /* @__PURE__ */ t(c, {})
89
+ ] })
90
+ },
91
+ s.key
92
+ );
93
+ }) })
94
+ }
95
+ )
96
+ }
97
+ )
98
+ ]
99
+ }
100
+ );
101
+ };
102
+ export {
103
+ W as default
104
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { DataTableField, State, Action } from '../libs/type';
3
+
4
+ export type DataTableContextType = {
5
+ selectable: boolean;
6
+ chooseFieldable: boolean;
7
+ fields: DataTableField[];
8
+ state: State;
9
+ dispatch: React.Dispatch<Action>;
10
+ };
11
+ export declare const DataTableContext: React.Context<DataTableContextType>;
12
+ export declare const DataTableProvider: React.Provider<DataTableContextType>;
@@ -0,0 +1,13 @@
1
+ import e from "react";
2
+ const t = e.createContext({
3
+ selectable: !1,
4
+ chooseFieldable: !1,
5
+ fields: [],
6
+ state: { DTChecked: [], DTData: [], DTShowFields: [] },
7
+ dispatch: () => {
8
+ }
9
+ }), o = t.Provider;
10
+ export {
11
+ t as DataTableContext,
12
+ o as DataTableProvider
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './DataTable';
2
+ export { default as default } from './DataTable';
@@ -0,0 +1,4 @@
1
+ import { default as o } from "./DataTable.js";
2
+ export {
3
+ o as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { ValueKey, ValueNode } from './type';
2
+
3
+ export declare const isValueKey: (key: string) => key is ValueKey;
4
+ export declare const getValueByKey: (data: unknown, key: ValueKey | ValueNode | string) => unknown;
@@ -0,0 +1,32 @@
1
+ import { _ as t } from "../../../lodash-XYp3qmxI.js";
2
+ const y = (e) => e.startsWith("$"), f = (e, i) => {
3
+ if (!t.isPlainObject(e) && !t.isArray(e))
4
+ return e;
5
+ if (typeof i == "function")
6
+ return i(e);
7
+ if (!y(i))
8
+ return i;
9
+ const s = i.replace(/^\$\./, "").split(".").reduce(
10
+ (r, n) => {
11
+ var u;
12
+ return !t.isPlainObject(r.data) && !t.isArray(r.data) ? { ...r, key: "" } : t.isArray(r.data) ? {
13
+ ...r,
14
+ isArray: !0,
15
+ key: r.key + "." + n
16
+ } : n === "@" ? {
17
+ ...r,
18
+ key: "$",
19
+ isArray: !1
20
+ } : {
21
+ ...r,
22
+ data: (u = r == null ? void 0 : r.data) == null ? void 0 : u[n]
23
+ };
24
+ },
25
+ { data: e, isArray: !1, key: "" }
26
+ );
27
+ return s.isArray === !0 ? t.map(s.data, (r) => f(r, s.key)) : s.data;
28
+ };
29
+ export {
30
+ f as getValueByKey,
31
+ y as isValueKey
32
+ };
@@ -0,0 +1,25 @@
1
+ export type ValueKey = `$${string}`;
2
+ export type ValueNode = (row: object) => React.ReactNode | string;
3
+ export type State = {
4
+ DTData: object[];
5
+ DTChecked: boolean[];
6
+ DTShowFields: string[];
7
+ };
8
+ export type Action = {
9
+ type: "SELECT_ALL";
10
+ } | {
11
+ type: "SELECT_ROW";
12
+ index: number;
13
+ } | {
14
+ type: "SELECT_FIELDKEY";
15
+ fieldKey: string;
16
+ } | {
17
+ type: "SET_FIELD";
18
+ fields: DataTableField[];
19
+ };
20
+ export type DataTableField = {
21
+ key: string;
22
+ label: string;
23
+ value: ValueKey | ValueNode | string;
24
+ default?: boolean;
25
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as j, jsxs as Ne, Fragment as ct } from "react/jsx-runtime";
2
2
  import { t as We } from "../../bundle-mjs-SHnj3fHy.js";
3
- import { b as Hn, c as In } from "../../index-C197ia6B.js";
3
+ import { e as Hn, f as In } from "../../index-DUypCuzD.js";
4
4
  import Ln, { createContext as wa, forwardRef as pa, useRef as Qe, useReducer as An, useEffect as Fe, Fragment as ga, isValidElement as jn, cloneElement as Gn, createElement as qn, useContext as Dt, useId as $n, useMemo as br, useState as _a, useCallback as Vn, useLayoutEffect as ba } from "react";
5
5
  import { u as Qn, a as Bn, o as zn, f as Zn, s as Xn } from "../../floating-ui.react-dom-YTFlGVA5.js";
6
6
  //! moment.js
@@ -1,5 +1,5 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { I as s } from "../../index-C197ia6B.js";
2
+ import { I as s } from "../../index-DUypCuzD.js";
3
3
  const m = ({ name: o, ...t }) => {
4
4
  const n = s[o];
5
5
  return /* @__PURE__ */ r(n, { ...t });
@@ -1,7 +1,7 @@
1
1
  import { jsxs as r, jsx as l } from "react/jsx-runtime";
2
2
  import { t as s } from "../../bundle-mjs-SHnj3fHy.js";
3
- import { b as m } from "../../index-Bv0kHmgl.js";
4
- const b = ({
3
+ import { F as m } from "../../index-CBEJ8A3p.js";
4
+ const h = ({
5
5
  label: t,
6
6
  className: i,
7
7
  htmlFor: d,
@@ -43,5 +43,5 @@ const b = ({
43
43
  ] })
44
44
  ] });
45
45
  export {
46
- b as default
46
+ h as default
47
47
  };
@@ -258,7 +258,7 @@ const Dt = ({ open: e = !1, title: t, buttons: n, children: o, className: r, siz
258
258
  leave: "duration-200 ease-in",
259
259
  leaveFrom: "opacity-100",
260
260
  leaveTo: "opacity-0",
261
- children: /* @__PURE__ */ h("div", { className: "fixed inset-0 bg-black/25 dark:bg-gray-600/25" })
261
+ children: /* @__PURE__ */ h("div", { className: "fixed inset-0 bg-black/25 dark:bg-gray-500/85" })
262
262
  }
263
263
  ),
264
264
  /* @__PURE__ */ h("div", { className: "fixed inset-0 overflow-y-auto", children: /* @__PURE__ */ h(
@@ -1,32 +1,32 @@
1
- import { jsx as r, jsxs as a } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
2
  import s from "../Icon/Icon.js";
3
- const c = ({ title: l, menuRef: e, children: i }) => /* @__PURE__ */ r("header", { className: "sticky top-0 z-10 flex h-[56px] w-full bg-white shadow dark:bg-gray-900 dark:text-white", children: /* @__PURE__ */ a("div", { className: "relative flex h-full w-full flex-auto items-center justify-between", children: [
4
- /* @__PURE__ */ r("div", { className: "absolute left-1/2 top-1/2 hidden -translate-x-1/2 -translate-y-1/2 transform lg:block", children: i }),
5
- /* @__PURE__ */ a(
3
+ const c = ({ title: l, menuRef: e, children: i }) => /* @__PURE__ */ t("header", { className: "sticky top-0 z-10 flex h-[56px] w-full bg-white shadow dark:bg-gray-900 dark:text-white", children: /* @__PURE__ */ r("div", { className: "relative flex h-full w-full flex-auto items-center justify-between", children: [
4
+ /* @__PURE__ */ t("div", { className: "absolute left-1/2 top-1/2 hidden -translate-x-1/2 -translate-y-1/2 transform lg:block", children: i }),
5
+ /* @__PURE__ */ r(
6
6
  "button",
7
7
  {
8
- className: "hidden w-[320px] items-center h-full justify-start gap-4 px-7 py-2 hover:bg-primary-100 dark:hover:bg-primary-700 lg:flex",
8
+ className: "hidden w-[320px] items-center h-full justify-start gap-4 px-7 py-2 hover:bg-primary-100 dark:hover:bg-gray-700 lg:flex",
9
9
  onClick: () => {
10
- var t;
11
- return (t = e == null ? void 0 : e.current) == null ? void 0 : t.toggleMenu();
10
+ var a;
11
+ return (a = e == null ? void 0 : e.current) == null ? void 0 : a.toggleMenu();
12
12
  },
13
13
  children: [
14
- /* @__PURE__ */ r(s, { name: "AiOutlineMenu" }),
15
- /* @__PURE__ */ r("span", { className: "font-bold", children: l || "Home" })
14
+ /* @__PURE__ */ t(s, { name: "AiOutlineMenu" }),
15
+ /* @__PURE__ */ t("span", { className: "font-bold", children: l || "Home" })
16
16
  ]
17
17
  }
18
18
  ),
19
- /* @__PURE__ */ a(
19
+ /* @__PURE__ */ r(
20
20
  "button",
21
21
  {
22
- className: "flex items-center justify-start gap-4 px-4 py-2 hover:bg-primary-100 dark:hover:bg-primary-700 lg:hidden",
22
+ className: "flex items-center justify-start gap-4 px-4 py-2 hover:bg-primary-100 dark:hover:bg-gray-700 lg:hidden",
23
23
  onClick: () => {
24
- var t;
25
- return (t = e == null ? void 0 : e.current) == null ? void 0 : t.toggleSmMenu();
24
+ var a;
25
+ return (a = e == null ? void 0 : e.current) == null ? void 0 : a.toggleSmMenu();
26
26
  },
27
27
  children: [
28
- /* @__PURE__ */ r(s, { name: "AiOutlineMenu" }),
29
- /* @__PURE__ */ r("span", { className: "font-bold", children: l || "Home" })
28
+ /* @__PURE__ */ t(s, { name: "AiOutlineMenu" }),
29
+ /* @__PURE__ */ t("span", { className: "font-bold", children: l || "Home" })
30
30
  ]
31
31
  }
32
32
  )
@@ -1,7 +1,7 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import r from "react";
3
3
  import { t as d } from "../../bundle-mjs-SHnj3fHy.js";
4
- import { F as u, a as l } from "../../index-Bv0kHmgl.js";
4
+ import { a as u, b as l } from "../../index-CBEJ8A3p.js";
5
5
  const p = ({ type: o = "password", ...a }, n) => {
6
6
  const t = r.useRef(null), [s, f] = r.useState(o !== "password");
7
7
  return r.useImperativeHandle(