@tsed/react-formio 3.0.0-rc.12 → 3.0.0-rc.14
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.
- package/dist/all.js +2 -0
- package/dist/all.js.map +1 -1
- package/dist/chunks/_baseGet.js +102 -0
- package/dist/chunks/_baseGet.js.map +1 -0
- package/dist/chunks/_baseSlice.js +12 -65
- package/dist/chunks/_baseSlice.js.map +1 -1
- package/dist/chunks/camelCase.js +1 -1
- package/dist/chunks/get.js +16 -0
- package/dist/chunks/get.js.map +1 -0
- package/dist/chunks/index2.js +19746 -22285
- package/dist/chunks/index2.js.map +1 -1
- package/dist/chunks/moment.js +2535 -0
- package/dist/chunks/moment.js.map +1 -0
- package/dist/chunks/omit.js +173 -268
- package/dist/chunks/omit.js.map +1 -1
- package/dist/chunks/toString.js +56 -0
- package/dist/chunks/toString.js.map +1 -0
- package/dist/interfaces/index.d.ts +0 -1
- package/dist/molecules/forms/select/Select.interface.d.ts +0 -4
- package/dist/molecules/table/all.js +2 -0
- package/dist/molecules/table/all.js.map +1 -1
- package/dist/molecules/table/components/DefaultBooleanCell.d.ts +2 -0
- package/dist/molecules/table/components/DefaultBooleanCell.js +12 -0
- package/dist/molecules/table/components/DefaultBooleanCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultCell.d.ts +2 -5
- package/dist/molecules/table/components/DefaultCell.js +8 -6
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- package/dist/molecules/table/components/DefaultDateCell.d.ts +2 -0
- package/dist/molecules/table/components/DefaultDateCell.js +16 -0
- package/dist/molecules/table/components/DefaultDateCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultFilter.d.ts +5 -7
- package/dist/molecules/table/components/DefaultFilter.js +8 -8
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -1
- package/dist/molecules/table/filters/SelectFilter.js +8 -7
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -1
- package/dist/molecules/table/interfaces/extends.d.ts +3 -0
- package/dist/molecules/table/utils/mapFormToColumns.js +38 -27
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +5 -5
- package/dist/organisms/table/forms/components/FormsCell.js +1 -1
- package/package.json +3 -3
- package/src/all.ts +2 -0
- package/src/interfaces/index.ts +0 -1
- package/src/molecules/forms/select/Select.interface.ts +0 -4
- package/src/molecules/table/all.ts +2 -0
- package/src/molecules/table/components/DefaultBooleanCell.spec.tsx +42 -0
- package/src/molecules/table/components/DefaultBooleanCell.tsx +11 -0
- package/src/molecules/table/components/DefaultCell.spec.tsx +32 -0
- package/src/molecules/table/components/DefaultCell.tsx +8 -9
- package/src/molecules/table/components/DefaultDateCell.spec.tsx +43 -0
- package/src/molecules/table/components/DefaultDateCell.tsx +23 -0
- package/src/molecules/table/components/DefaultFilter.tsx +10 -7
- package/src/molecules/table/filters/Filters.d.ts +1 -0
- package/src/molecules/table/filters/SelectFilter.tsx +1 -0
- package/src/molecules/table/interfaces/extends.ts +3 -0
- package/src/molecules/table/utils/mapFormToColumns.spec.tsx +55 -0
- package/src/molecules/table/utils/mapFormToColumns.tsx +27 -22
- package/src/organisms/form/Form.stories.tsx +7 -2
- package/dist/interfaces/QueryOptions.d.ts +0 -23
- package/dist/interfaces/QueryOptions.js +0 -2
- package/dist/interfaces/QueryOptions.js.map +0 -1
- package/src/interfaces/QueryOptions.ts +0 -24
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { a as q, b as p, c as T, d } from "./_baseClone.js";
|
|
2
|
+
var s, g;
|
|
3
|
+
function _() {
|
|
4
|
+
if (g) return s;
|
|
5
|
+
g = 1;
|
|
6
|
+
var t = q(), r = p(), n = "[object Symbol]";
|
|
7
|
+
function i(e) {
|
|
8
|
+
return typeof e == "symbol" || r(e) && t(e) == n;
|
|
9
|
+
}
|
|
10
|
+
return s = i, s;
|
|
11
|
+
}
|
|
12
|
+
var u, c;
|
|
13
|
+
function h() {
|
|
14
|
+
if (c) return u;
|
|
15
|
+
c = 1;
|
|
16
|
+
function t(r, n) {
|
|
17
|
+
for (var i = -1, e = r == null ? 0 : r.length, o = Array(e); ++i < e; )
|
|
18
|
+
o[i] = n(r[i], i, r);
|
|
19
|
+
return o;
|
|
20
|
+
}
|
|
21
|
+
return u = t, u;
|
|
22
|
+
}
|
|
23
|
+
var b, m;
|
|
24
|
+
function v() {
|
|
25
|
+
if (m) return b;
|
|
26
|
+
m = 1;
|
|
27
|
+
var t = T(), r = h(), n = d(), i = _(), e = t ? t.prototype : void 0, o = e ? e.toString : void 0;
|
|
28
|
+
function y(a) {
|
|
29
|
+
if (typeof a == "string")
|
|
30
|
+
return a;
|
|
31
|
+
if (n(a))
|
|
32
|
+
return r(a, y) + "";
|
|
33
|
+
if (i(a))
|
|
34
|
+
return o ? o.call(a) : "";
|
|
35
|
+
var S = a + "";
|
|
36
|
+
return S == "0" && 1 / a == -1 / 0 ? "-0" : S;
|
|
37
|
+
}
|
|
38
|
+
return b = y, b;
|
|
39
|
+
}
|
|
40
|
+
var f, l;
|
|
41
|
+
function M() {
|
|
42
|
+
if (l) return f;
|
|
43
|
+
l = 1;
|
|
44
|
+
var t = v();
|
|
45
|
+
function r(n) {
|
|
46
|
+
return n == null ? "" : t(n);
|
|
47
|
+
}
|
|
48
|
+
return f = r, f;
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
M as a,
|
|
52
|
+
h as b,
|
|
53
|
+
v as c,
|
|
54
|
+
_ as r
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=toString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toString.js","sources":["../../../../node_modules/lodash/isSymbol.js","../../../../node_modules/lodash/_arrayMap.js","../../../../node_modules/lodash/_baseToString.js","../../../../node_modules/lodash/toString.js"],"sourcesContent":["var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_baseToString');\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n"],"names":["baseGetTag","require$$0","isObjectLike","require$$1","symbolTag","isSymbol","value","isSymbol_1","arrayMap","array","iteratee","index","length","result","_arrayMap","Symbol","isArray","require$$2","require$$3","symbolProto","symbolToString","baseToString","_baseToString","toString","toString_1"],"mappings":";;;;;AAAA,MAAIA,IAAaC,EAAA,GACbC,IAAeC,EAAA,GAGfC,IAAY;AAmBhB,WAASC,EAASC,GAAO;AACvB,WAAO,OAAOA,KAAS,YACpBJ,EAAaI,CAAK,KAAKN,EAAWM,CAAK,KAAKF;AAAA,EACjD;AAEA,SAAAG,IAAiBF;;;;;;ACnBjB,WAASG,EAASC,GAAOC,GAAU;AAKjC,aAJIC,IAAQ,IACRC,IAASH,KAAS,OAAO,IAAIA,EAAM,QACnCI,IAAS,MAAMD,CAAM,GAElB,EAAED,IAAQC;AACf,MAAAC,EAAOF,CAAK,IAAID,EAASD,EAAME,CAAK,GAAGA,GAAOF,CAAK;AAErD,WAAOI;AAAA,EACT;AAEA,SAAAC,IAAiBN;;;;;;ACpBjB,MAAIO,IAASd,EAAA,GACTO,IAAWL,EAAA,GACXa,IAAUC,EAAA,GACVZ,IAAWa,EAAA,GAMXC,IAAcJ,IAASA,EAAO,YAAY,QAC1CK,IAAiBD,IAAcA,EAAY,WAAW;AAU1D,WAASE,EAAaf,GAAO;AAE3B,QAAI,OAAOA,KAAS;AAClB,aAAOA;AAET,QAAIU,EAAQV,CAAK;AAEf,aAAOE,EAASF,GAAOe,CAAY,IAAI;AAEzC,QAAIhB,EAASC,CAAK;AAChB,aAAOc,IAAiBA,EAAe,KAAKd,CAAK,IAAI;AAEvD,QAAIO,IAAUP,IAAQ;AACtB,WAAQO,KAAU,OAAQ,IAAIP,KAAU,SAAa,OAAOO;AAAA,EAC9D;AAEA,SAAAS,IAAiBD;;;;;;ACpCjB,MAAIA,IAAepB,EAAA;AAuBnB,WAASsB,EAASjB,GAAO;AACvB,WAAOA,KAAS,OAAO,KAAKe,EAAaf,CAAK;AAAA,EAChD;AAEA,SAAAkB,IAAiBD;;","x_google_ignoreList":[0,1,2,3]}
|
|
@@ -24,10 +24,6 @@ export interface SelectProps<Data = string> extends FormControlProps<Data, Selec
|
|
|
24
24
|
searchEnabled?: boolean;
|
|
25
25
|
customProperties?: Record<string, any>;
|
|
26
26
|
options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated
|
|
29
|
-
*/
|
|
30
|
-
choices?: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
|
|
31
27
|
}
|
|
32
28
|
export interface SelectSingle<Data = string> extends SelectProps<Data> {
|
|
33
29
|
multiple?: false | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "./components/DefaultFilter.js";
|
|
2
2
|
import "./components/DefaultArrowSort.js";
|
|
3
3
|
import "./components/DefaultCell.js";
|
|
4
|
+
import "./components/DefaultBooleanCell.js";
|
|
5
|
+
import "./components/DefaultDateCell.js";
|
|
4
6
|
import "./components/DefaultCellOperations.js";
|
|
5
7
|
import "./components/DefaultOperationButton.js";
|
|
6
8
|
import "./components/DefaultCellHeader.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"all.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent as o } from "../../../registries/components.js";
|
|
3
|
+
function l({ getValue: t, column: { columnDef: e } }) {
|
|
4
|
+
const n = t();
|
|
5
|
+
return /* @__PURE__ */ r("span", { children: String(n ? e.meta?.labels?.yes || "Yes" : e.meta?.labels?.No || "No") });
|
|
6
|
+
}
|
|
7
|
+
o("Cell.boolean", l);
|
|
8
|
+
o("Cell.checkbox", l);
|
|
9
|
+
export {
|
|
10
|
+
l as DefaultCellBoolean
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=DefaultBooleanCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultBooleanCell.js","sources":["../../../../src/molecules/table/components/DefaultBooleanCell.tsx"],"sourcesContent":["import { CellContext } from \"@tanstack/react-table\";\n\nimport { registerComponent } from \"../../../registries/components\";\n\nexport function DefaultCellBoolean<Data extends object>({ getValue, column: { columnDef } }: CellContext<Data, boolean>) {\n const value = getValue();\n return <span>{String(value ? columnDef.meta?.labels?.[\"yes\"] || \"Yes\" : columnDef.meta?.labels?.[\"No\"] || \"No\")}</span>;\n}\n\nregisterComponent(\"Cell.boolean\", DefaultCellBoolean);\nregisterComponent(\"Cell.checkbox\", DefaultCellBoolean);\n"],"names":["DefaultCellBoolean","getValue","columnDef","value","registerComponent"],"mappings":";;AAIO,SAASA,EAAwC,EAAE,UAAAC,GAAU,QAAQ,EAAE,WAAAC,EAAA,KAA2C;AACvH,QAAMC,IAAQF,EAAA;AACd,2BAAQ,QAAA,EAAM,UAAA,OAAOE,IAAQD,EAAU,MAAM,QAAS,OAAU,QAAQA,EAAU,MAAM,QAAS,MAAS,IAAI,GAAE;AAClH;AAEAE,EAAkB,gBAAgBJ,CAAkB;AACpDI,EAAkB,iBAAiBJ,CAAkB;"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
render?: (value: Data) => any;
|
|
4
|
-
}
|
|
5
|
-
export declare function DefaultCell<Data = any>({ value, render }: DefaultCellProps<Data>): JSX.Element;
|
|
1
|
+
import { CellContext } from '@tanstack/react-table';
|
|
2
|
+
export declare function DefaultCell<Data = any>({ getValue, renderValue }: CellContext<Data, any>): JSX.Element;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { registerComponent as
|
|
3
|
-
function
|
|
2
|
+
import { registerComponent as t } from "../../../registries/components.js";
|
|
3
|
+
function l({ getValue: i, renderValue: o }) {
|
|
4
|
+
const r = i();
|
|
4
5
|
if (r === void 0)
|
|
5
6
|
return /* @__PURE__ */ e("span", {});
|
|
6
|
-
const n =
|
|
7
|
-
return r !== n ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ e("span", { children: String(r) });
|
|
7
|
+
const n = o();
|
|
8
|
+
return n != null && r !== n ? /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: String(n) } }) : /* @__PURE__ */ e("span", { children: String(r) });
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
t("Cell", l);
|
|
11
|
+
t("Cell.string", l);
|
|
10
12
|
export {
|
|
11
|
-
|
|
13
|
+
l as DefaultCell
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=DefaultCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCell.js","sources":["../../../../src/molecules/table/components/DefaultCell.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"DefaultCell.js","sources":["../../../../src/molecules/table/components/DefaultCell.tsx"],"sourcesContent":["import type { CellContext } from \"@tanstack/react-table\";\n\nimport { registerComponent } from \"../../../registries/components\";\n\nexport function DefaultCell<Data = any>({ getValue, renderValue }: CellContext<Data, any>): JSX.Element {\n const value = getValue();\n if (value === undefined) {\n return <span></span>;\n }\n\n const rendered = renderValue();\n\n if (rendered != null && value !== rendered) {\n return <div dangerouslySetInnerHTML={{ __html: String(rendered) }} />;\n }\n\n return <span>{String(value)}</span>;\n}\n\nregisterComponent(\"Cell\", DefaultCell);\nregisterComponent(\"Cell.string\", DefaultCell);\n"],"names":["DefaultCell","getValue","renderValue","value","rendered","jsx","registerComponent"],"mappings":";;AAIO,SAASA,EAAwB,EAAE,UAAAC,GAAU,aAAAC,KAAoD;AACtG,QAAMC,IAAQF,EAAA;AACd,MAAIE,MAAU;AACZ,6BAAQ,QAAA,EAAK;AAGf,QAAMC,IAAWF,EAAA;AAEjB,SAAIE,KAAY,QAAQD,MAAUC,IACzB,gBAAAC,EAAC,SAAI,yBAAyB,EAAE,QAAQ,OAAOD,CAAQ,KAAK,IAG9D,gBAAAC,EAAC,QAAA,EAAM,UAAA,OAAOF,CAAK,GAAE;AAC9B;AAEAG,EAAkB,QAAQN,CAAW;AACrCM,EAAkB,eAAeN,CAAW;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { h as o } from "../../../chunks/moment.js";
|
|
3
|
+
import { registerComponent as n } from "../../../registries/components.js";
|
|
4
|
+
function a({ getValue: i, column: { columnDef: l } }) {
|
|
5
|
+
const e = i();
|
|
6
|
+
if (!e)
|
|
7
|
+
return /* @__PURE__ */ t("span", {});
|
|
8
|
+
const r = o.parseZone(e, o.ISO_8601, !0);
|
|
9
|
+
return r.isValid() ? /* @__PURE__ */ t("span", { children: r.format(l.meta?.format || "L") }) : /* @__PURE__ */ t("span", { children: String(e) });
|
|
10
|
+
}
|
|
11
|
+
n("Cell.date", a);
|
|
12
|
+
n("Cell.datetime", a);
|
|
13
|
+
export {
|
|
14
|
+
a as DefaultDateCell
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=DefaultDateCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultDateCell.js","sources":["../../../../src/molecules/table/components/DefaultDateCell.tsx"],"sourcesContent":["import { CellContext } from \"@tanstack/react-table\";\nimport moment from \"moment\";\n\nimport { registerComponent } from \"../../../registries/components\";\n\nexport function DefaultDateCell<Data extends object>({ getValue, column: { columnDef } }: CellContext<Data, string>) {\n const value = getValue();\n\n if (!value) {\n return <span />;\n }\n\n const date = moment.parseZone(value, moment.ISO_8601, true);\n\n if (!date.isValid()) {\n return <span>{String(value)}</span>;\n }\n\n return <span>{date.format(columnDef.meta?.format || \"L\")}</span>;\n}\n\nregisterComponent(\"Cell.date\", DefaultDateCell);\nregisterComponent(\"Cell.datetime\", DefaultDateCell);\n"],"names":["DefaultDateCell","getValue","columnDef","value","date","moment","jsx","registerComponent"],"mappings":";;;AAKO,SAASA,EAAqC,EAAE,UAAAC,GAAU,QAAQ,EAAE,WAAAC,EAAA,KAA0C;AACnH,QAAMC,IAAQF,EAAA;AAEd,MAAI,CAACE;AACH,6BAAQ,QAAA,EAAK;AAGf,QAAMC,IAAOC,EAAO,UAAUF,GAAOE,EAAO,UAAU,EAAI;AAE1D,SAAKD,EAAK,YAIH,gBAAAE,EAAC,UAAM,UAAAF,EAAK,OAAOF,EAAU,MAAM,UAAU,GAAG,EAAA,CAAE,IAHhD,gBAAAI,EAAC,QAAA,EAAM,UAAA,OAAOH,CAAK,GAAE;AAIhC;AAEAI,EAAkB,aAAaP,CAAe;AAC9CO,EAAkB,iBAAiBP,CAAe;"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Header } from '@tanstack/react-table';
|
|
2
|
-
export interface DefaultFilterProps<Data = any> {
|
|
3
|
-
header: Header<Data,
|
|
1
|
+
import { Header, RowData } from '@tanstack/react-table';
|
|
2
|
+
export interface DefaultFilterProps<Data extends RowData = any, TValue = unknown> {
|
|
3
|
+
header: Header<Data, TValue>;
|
|
4
4
|
i18n?: (f: string) => string;
|
|
5
5
|
}
|
|
6
|
-
export interface FilterProps<Data = any, Opts = Record<string, unknown>> {
|
|
7
|
-
header: Header<Data, unknown>;
|
|
6
|
+
export interface FilterProps<Data extends RowData = any, Opts = Record<string, unknown>> extends DefaultFilterProps<Data> {
|
|
8
7
|
options: Opts;
|
|
9
|
-
i18n?: (f: string) => string;
|
|
10
8
|
}
|
|
11
|
-
export declare function DefaultFilter<Data = any
|
|
9
|
+
export declare function DefaultFilter<Data extends RowData = any, TValue = unknown>(props: DefaultFilterProps<Data, TValue>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { registerComponent as
|
|
3
|
-
function
|
|
4
|
-
const {
|
|
5
|
-
filter:
|
|
2
|
+
import { registerComponent as a, getComponent as c } from "../../../registries/components.js";
|
|
3
|
+
function s(n) {
|
|
4
|
+
const { header: t, i18n: o } = n, {
|
|
5
|
+
filter: e = {
|
|
6
6
|
variant: "text"
|
|
7
7
|
}
|
|
8
|
-
} = t.column.columnDef.meta || {}, { variant:
|
|
9
|
-
return e ? /* @__PURE__ */ l("div", { className: "table-cell-header__filter", children: /* @__PURE__ */ l(
|
|
8
|
+
} = t.column.columnDef.meta || {}, { variant: r } = e, i = c([`Filter.${t.column.id}`, `Filter.${r}`, "Filter.text"]);
|
|
9
|
+
return i ? e.disabled ? null : /* @__PURE__ */ l("div", { className: "table-cell-header__filter", children: /* @__PURE__ */ l(i, { header: t, options: e, i18n: o }) }) : (console.warn("Missing filter for `Filter." + t.column.id + "` or `Filter." + r + "`"), null);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
a("Filter", s);
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
s as DefaultFilter
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=DefaultFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultFilter.js","sources":["../../../../src/molecules/table/components/DefaultFilter.tsx"],"sourcesContent":["import \"../interfaces/extends\";\n\nimport { Header } from \"@tanstack/react-table\";\nimport type { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\n\nexport interface DefaultFilterProps<Data = any> {\n header: Header<Data,
|
|
1
|
+
{"version":3,"file":"DefaultFilter.js","sources":["../../../../src/molecules/table/components/DefaultFilter.tsx"],"sourcesContent":["import \"../interfaces/extends\";\n\nimport { Header, RowData } from \"@tanstack/react-table\";\nimport type { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\n\nexport interface DefaultFilterProps<Data extends RowData = any, TValue = unknown> {\n header: Header<Data, TValue>;\n i18n?: (f: string) => string;\n}\n\nexport interface FilterProps<Data extends RowData = any, Opts = Record<string, unknown>> extends DefaultFilterProps<Data> {\n options: Opts;\n}\n\nexport function DefaultFilter<Data extends RowData = any, TValue = unknown>(props: DefaultFilterProps<Data, TValue>) {\n const { header, i18n } = props;\n const {\n filter = {\n variant: \"text\"\n }\n } = header.column.columnDef.meta || {};\n\n const { variant: filterVariant } = filter;\n const Filter = getComponent<ComponentType<FilterProps>>([`Filter.${header.column.id}`, `Filter.${filterVariant}`, \"Filter.text\"]);\n\n if (!Filter) {\n console.warn(\"Missing filter for `Filter.\" + header.column.id + \"` or `Filter.\" + filterVariant + \"`\");\n\n return null;\n }\n\n if (filter.disabled) {\n return null;\n }\n\n return (\n <div className='table-cell-header__filter'>\n <Filter header={header} options={filter} i18n={i18n} />\n </div>\n );\n}\n\nregisterComponent(\"Filter\", DefaultFilter);\n"],"names":["DefaultFilter","props","header","i18n","filter","filterVariant","Filter","getComponent","jsx","registerComponent"],"mappings":";;AAgBO,SAASA,EAA4DC,GAAyC;AACnH,QAAM,EAAE,QAAAC,GAAQ,MAAAC,EAAA,IAASF,GACnB;AAAA,IACJ,QAAAG,IAAS;AAAA,MACP,SAAS;AAAA,IAAA;AAAA,EACX,IACEF,EAAO,OAAO,UAAU,QAAQ,CAAA,GAE9B,EAAE,SAASG,EAAA,IAAkBD,GAC7BE,IAASC,EAAyC,CAAC,UAAUL,EAAO,OAAO,EAAE,IAAI,UAAUG,CAAa,IAAI,aAAa,CAAC;AAEhI,SAAKC,IAMDF,EAAO,WACF,OAIP,gBAAAI,EAAC,OAAA,EAAI,WAAU,6BACb,UAAA,gBAAAA,EAACF,KAAO,QAAAJ,GAAgB,SAASE,GAAQ,MAAAD,EAAA,CAAY,EAAA,CACvD,KAZA,QAAQ,KAAK,gCAAgCD,EAAO,OAAO,KAAK,kBAAkBG,IAAgB,GAAG,GAE9F;AAYX;AAEAI,EAAkB,UAAUT,CAAa;"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
1
|
+
import { jsx as o, Fragment as s } from "react/jsx-runtime";
|
|
2
2
|
import { registerComponent as a, getComponent as p } from "../../../registries/components.js";
|
|
3
3
|
import { useUniqValues as f } from "../hooks/useUniqValues.js";
|
|
4
4
|
function F({ header: t, options: e }) {
|
|
5
|
-
const n = p("Select"), i = t.column.getFilterValue(), c = f({ header: t, filterVariant: "text" }),
|
|
5
|
+
const n = p("Select"), i = t.column.getFilterValue(), c = f({ header: t, filterVariant: "text" }), m = e.layout === "choicesjs" ? {
|
|
6
6
|
placeholder: void 0
|
|
7
7
|
} : {
|
|
8
8
|
placeholder: `Filter by ${t.column.columnDef.header}`
|
|
9
|
-
},
|
|
9
|
+
}, r = [
|
|
10
10
|
{
|
|
11
11
|
label: `Filter by ${t.column.columnDef.header}`,
|
|
12
12
|
value: ""
|
|
13
13
|
}
|
|
14
14
|
].concat(e.options || c.map((l) => ({ label: l, value: l })));
|
|
15
|
-
return /* @__PURE__ */ o(
|
|
15
|
+
return /* @__PURE__ */ o(s, { children: /* @__PURE__ */ o(
|
|
16
16
|
n,
|
|
17
17
|
{
|
|
18
18
|
size: "small",
|
|
19
19
|
...e,
|
|
20
|
-
...
|
|
21
|
-
|
|
20
|
+
...m,
|
|
21
|
+
autoComplete: "off",
|
|
22
|
+
options: r,
|
|
22
23
|
name: `filter_${t.column.id}`,
|
|
23
24
|
"data-testid": `filter_${t.column.id}`,
|
|
24
25
|
value: i,
|
|
25
|
-
onChange: (l,
|
|
26
|
+
onChange: (l, u) => t.column.setFilterValue(u)
|
|
26
27
|
}
|
|
27
28
|
) });
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectFilter.js","sources":["../../../../src/molecules/table/filters/SelectFilter.tsx"],"sourcesContent":["import { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { Select as DefaultSelect } from \"../../forms/select/Select\";\nimport { SelectOptionProps } from \"../../forms/select/Select.interface\";\nimport type { FilterProps } from \"../components/DefaultFilter\";\nimport { useUniqValues } from \"../hooks/useUniqValues\";\nimport { FilterSelectOptions } from \"./Filters\";\n\nexport function SelectFilter<Data = any>({ header, options }: FilterProps<Data, FilterSelectOptions>) {\n const Select = getComponent<typeof DefaultSelect>(\"Select\");\n const columnFilterValue = header.column.getFilterValue();\n const uniqValues = useUniqValues<Data>({ header, filterVariant: \"text\" });\n\n const opts =\n options.layout === \"choicesjs\"\n ? {\n placeholder: undefined\n }\n : {\n placeholder: `Filter by ${header.column.columnDef.header}`\n };\n\n const listOptions = (\n [\n {\n label: `Filter by ${header.column.columnDef.header}`,\n value: \"\"\n }\n ] as SelectOptionProps[]\n ).concat(options.options || uniqValues.map((value: any) => ({ label: value, value })));\n\n return (\n <>\n <Select<string>\n size='small'\n {...(options as any)}\n {...opts}\n options={listOptions}\n name={`filter_${header.column.id}`}\n data-testid={`filter_${header.column.id}`}\n value={columnFilterValue as string}\n onChange={(_, value) => header.column.setFilterValue(value)}\n />\n </>\n );\n}\n\nregisterComponent(\"Filter.select\", SelectFilter);\n"],"names":["SelectFilter","header","options","Select","getComponent","columnFilterValue","uniqValues","useUniqValues","opts","listOptions","value","jsx","Fragment","_","registerComponent"],"mappings":";;;AAOO,SAASA,EAAyB,EAAE,QAAAC,GAAQ,SAAAC,KAAmD;AACpG,QAAMC,IAASC,EAAmC,QAAQ,GACpDC,IAAoBJ,EAAO,OAAO,eAAA,GAClCK,IAAaC,EAAoB,EAAE,QAAAN,GAAQ,eAAe,QAAQ,GAElEO,IACJN,EAAQ,WAAW,cACf;AAAA,IACE,aAAa;AAAA,EAAA,IAEf;AAAA,IACE,aAAa,aAAaD,EAAO,OAAO,UAAU,MAAM;AAAA,EAAA,GAG1DQ,IACJ;AAAA,IACE;AAAA,MACE,OAAO,aAAaR,EAAO,OAAO,UAAU,MAAM;AAAA,MAClD,OAAO;AAAA,IAAA;AAAA,EACT,EAEF,OAAOC,EAAQ,WAAWI,EAAW,IAAI,CAACI,OAAgB,EAAE,OAAOA,GAAO,OAAAA,EAAA,EAAQ,CAAC;AAErF,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA,gBAAAD;AAAA,IAACR;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACJ,GAAID;AAAA,MACJ,GAAGM;AAAA,MACJ,SAASC;AAAA,MACT,MAAM,UAAUR,EAAO,OAAO,EAAE;AAAA,MAChC,eAAa,UAAUA,EAAO,OAAO,EAAE;AAAA,MACvC,OAAOI;AAAA,MACP,UAAU,CAACQ,GAAGH,MAAUT,EAAO,OAAO,eAAeS,CAAK;AAAA,IAAA;AAAA,EAAA,GAE9D;AAEJ;AAEAI,EAAkB,iBAAiBd,CAAY;"}
|
|
1
|
+
{"version":3,"file":"SelectFilter.js","sources":["../../../../src/molecules/table/filters/SelectFilter.tsx"],"sourcesContent":["import { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { Select as DefaultSelect } from \"../../forms/select/Select\";\nimport { SelectOptionProps } from \"../../forms/select/Select.interface\";\nimport type { FilterProps } from \"../components/DefaultFilter\";\nimport { useUniqValues } from \"../hooks/useUniqValues\";\nimport { FilterSelectOptions } from \"./Filters\";\n\nexport function SelectFilter<Data = any>({ header, options }: FilterProps<Data, FilterSelectOptions>) {\n const Select = getComponent<typeof DefaultSelect>(\"Select\");\n const columnFilterValue = header.column.getFilterValue();\n const uniqValues = useUniqValues<Data>({ header, filterVariant: \"text\" });\n\n const opts =\n options.layout === \"choicesjs\"\n ? {\n placeholder: undefined\n }\n : {\n placeholder: `Filter by ${header.column.columnDef.header}`\n };\n\n const listOptions = (\n [\n {\n label: `Filter by ${header.column.columnDef.header}`,\n value: \"\"\n }\n ] as SelectOptionProps[]\n ).concat(options.options || uniqValues.map((value: any) => ({ label: value, value })));\n\n return (\n <>\n <Select<string>\n size='small'\n {...(options as any)}\n {...opts}\n autoComplete='off'\n options={listOptions}\n name={`filter_${header.column.id}`}\n data-testid={`filter_${header.column.id}`}\n value={columnFilterValue as string}\n onChange={(_, value) => header.column.setFilterValue(value)}\n />\n </>\n );\n}\n\nregisterComponent(\"Filter.select\", SelectFilter);\n"],"names":["SelectFilter","header","options","Select","getComponent","columnFilterValue","uniqValues","useUniqValues","opts","listOptions","value","jsx","Fragment","_","registerComponent"],"mappings":";;;AAOO,SAASA,EAAyB,EAAE,QAAAC,GAAQ,SAAAC,KAAmD;AACpG,QAAMC,IAASC,EAAmC,QAAQ,GACpDC,IAAoBJ,EAAO,OAAO,eAAA,GAClCK,IAAaC,EAAoB,EAAE,QAAAN,GAAQ,eAAe,QAAQ,GAElEO,IACJN,EAAQ,WAAW,cACf;AAAA,IACE,aAAa;AAAA,EAAA,IAEf;AAAA,IACE,aAAa,aAAaD,EAAO,OAAO,UAAU,MAAM;AAAA,EAAA,GAG1DQ,IACJ;AAAA,IACE;AAAA,MACE,OAAO,aAAaR,EAAO,OAAO,UAAU,MAAM;AAAA,MAClD,OAAO;AAAA,IAAA;AAAA,EACT,EAEF,OAAOC,EAAQ,WAAWI,EAAW,IAAI,CAACI,OAAgB,EAAE,OAAOA,GAAO,OAAAA,EAAA,EAAQ,CAAC;AAErF,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA,gBAAAD;AAAA,IAACR;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACJ,GAAID;AAAA,MACJ,GAAGM;AAAA,MACJ,cAAa;AAAA,MACb,SAASC;AAAA,MACT,MAAM,UAAUR,EAAO,OAAO,EAAE;AAAA,MAChC,eAAa,UAAUA,EAAO,OAAO,EAAE;AAAA,MACvC,OAAOI;AAAA,MACP,UAAU,CAACQ,GAAGH,MAAUT,EAAO,OAAO,eAAeS,CAAK;AAAA,IAAA;AAAA,EAAA,GAE9D;AAEJ;AAEAI,EAAkB,iBAAiBd,CAAY;"}
|
|
@@ -3,6 +3,9 @@ import { TdHTMLAttributes } from 'react';
|
|
|
3
3
|
import { FilterOptions } from '../filters/Filters';
|
|
4
4
|
declare module "@tanstack/react-table" {
|
|
5
5
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
6
|
+
type?: "string" | "number" | "boolean" | "date" | string;
|
|
7
|
+
format?: string;
|
|
8
|
+
labels?: Record<string, string>;
|
|
6
9
|
filter?: FilterOptions;
|
|
7
10
|
sort?: string;
|
|
8
11
|
cellProps?: TdHTMLAttributes<HTMLTableCellElement>;
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const k = /* @__PURE__ */ x(y), v = {
|
|
1
|
+
import { createColumnHelper as s } from "@tanstack/react-table";
|
|
2
|
+
import { c as p } from "../../../chunks/cloneDeep.js";
|
|
3
|
+
import { g as u } from "../../../chunks/_commonjsHelpers.js";
|
|
4
|
+
import { r as i } from "../../../chunks/get.js";
|
|
5
|
+
import { getComponent as d } from "../../../registries/components.js";
|
|
6
|
+
var f = i();
|
|
7
|
+
const y = /* @__PURE__ */ u(f), C = {
|
|
9
8
|
number: "range",
|
|
10
9
|
currency: "range",
|
|
11
10
|
checkbox: "boolean"
|
|
11
|
+
}, b = {
|
|
12
|
+
date: "date",
|
|
13
|
+
datetime: "date",
|
|
14
|
+
number: "number",
|
|
15
|
+
currency: "currency",
|
|
16
|
+
checkbox: "boolean"
|
|
12
17
|
};
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const t = e,
|
|
17
|
-
let
|
|
18
|
-
return
|
|
18
|
+
function P(a, m = []) {
|
|
19
|
+
const c = s(), r = p(m);
|
|
20
|
+
return a.components.flatMap((e) => e.type === "tabs" ? e.components?.flatMap((t) => t.components) : [e]).filter((e) => e?.tableView).map((e) => {
|
|
21
|
+
const t = e, o = r.findIndex(({ accessorKey: l }) => l === `data.${t.key}`);
|
|
22
|
+
let n = r[o];
|
|
23
|
+
return n && r.splice(o, 1), c.accessor(`data.${t.key}`, {
|
|
19
24
|
header: (t.label || t.title || t.key)?.replace(/:/, ""),
|
|
20
|
-
cell: (m) => /* @__PURE__ */ s(l, { value: m.getValue(), render: (i) => n.asString(i) }),
|
|
21
25
|
meta: {
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
type: b[t.type] || t.type,
|
|
27
|
+
filter: {
|
|
28
|
+
...n?.meta?.filter,
|
|
29
|
+
variant: C[t.type] || "text"
|
|
30
|
+
},
|
|
31
|
+
...n?.meta || {}
|
|
24
32
|
},
|
|
25
|
-
...
|
|
33
|
+
...n || {}
|
|
26
34
|
});
|
|
27
|
-
}).concat(r).map((e, t) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
...e
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
}).concat(r).map((e, t) => {
|
|
36
|
+
const o = d([`Cell.${e.id}`, `Cell.${e.meta?.type}`, "Cell"]);
|
|
37
|
+
return {
|
|
38
|
+
...e,
|
|
39
|
+
meta: {
|
|
40
|
+
...e?.meta,
|
|
41
|
+
order: y(e, "meta.order", t * 10)
|
|
42
|
+
},
|
|
43
|
+
cell: e.cell || o
|
|
44
|
+
};
|
|
45
|
+
}).sort((e, t) => e.meta.order > t.meta.order ? 1 : -1);
|
|
35
46
|
}
|
|
36
47
|
export {
|
|
37
|
-
|
|
48
|
+
P as mapFormToColumns
|
|
38
49
|
};
|
|
39
50
|
//# sourceMappingURL=mapFormToColumns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapFormToColumns.js","sources":["../../../../src/molecules/table/utils/mapFormToColumns.tsx"],"sourcesContent":["import \"../interfaces/extends\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"mapFormToColumns.js","sources":["../../../../src/molecules/table/utils/mapFormToColumns.tsx"],"sourcesContent":["import \"../interfaces/extends\";\n\nimport { ColumnDef, ColumnDefResolved, createColumnHelper } from \"@tanstack/react-table\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport get from \"lodash/get\";\n\nimport type { ComponentType, FormType } from \"../../../interfaces\";\nimport { getComponent } from \"../../../registries/components\";\nimport type { DefaultCell } from \"../components/DefaultCell\";\nimport type { FilterVariants } from \"../filters/Filters.js\";\n\nconst MAP_FILTER_TYPES: Record<string, FilterVariants> = {\n number: \"range\",\n currency: \"range\",\n checkbox: \"boolean\"\n} as const;\n\nconst MAP_TYPES = {\n date: \"date\",\n datetime: \"date\",\n number: \"number\",\n currency: \"currency\",\n checkbox: \"boolean\"\n} as const;\n\nexport function mapFormToColumns<Data = any>(form: FormType, columns: ColumnDefResolved<Data, any>[] = []): ColumnDef<Data, any>[] {\n const columnHelper = createColumnHelper<Data>();\n const columnsToKeep = cloneDeep(columns);\n\n const columnsFromComponents = form.components\n .flatMap((component) => {\n if (component.type === \"tabs\") {\n return component.components?.flatMap((subComponent: ComponentType) => subComponent.components);\n }\n\n return [component];\n })\n .filter((component) => component?.tableView)\n .map((c) => {\n const component = c as ComponentType;\n\n const columnIndex = columnsToKeep.findIndex(({ accessorKey }) => {\n return accessorKey === `data.${component.key}`;\n });\n\n let column = columnsToKeep[columnIndex];\n\n if (column) {\n columnsToKeep.splice(columnIndex, 1);\n }\n\n return columnHelper.accessor(`data.${component.key}` as any, {\n header: (component.label || component.title || component.key)?.replace(/:/, \"\"),\n meta: {\n type: MAP_TYPES[component.type as keyof typeof MAP_TYPES] || component.type,\n filter: {\n ...column?.meta?.filter,\n variant: MAP_FILTER_TYPES[component.type!] || \"text\"\n },\n ...(column?.meta || {})\n },\n ...(column || {})\n });\n });\n\n const mergedColumns = columnsFromComponents.concat(columnsToKeep as any[]).map((column, index) => {\n const Cell = getComponent<typeof DefaultCell>([`Cell.${column.id}`, `Cell.${column.meta?.type}`, \"Cell\"]);\n\n return {\n ...column,\n meta: {\n ...column?.meta,\n order: get(column, \"meta.order\", index * 10)\n },\n cell: column.cell || Cell\n };\n });\n\n return mergedColumns.sort((a, b) => (a.meta.order > b.meta.order ? 1 : -1)) as ColumnDef<Data, any>[];\n}\n"],"names":["MAP_FILTER_TYPES","MAP_TYPES","mapFormToColumns","form","columns","columnHelper","createColumnHelper","columnsToKeep","cloneDeep","component","subComponent","c","columnIndex","accessorKey","column","index","Cell","getComponent","get","a","b"],"mappings":";;;;;;gCAWMA,IAAmD;AAAA,EACvD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AACZ,GAEMC,IAAY;AAAA,EAChB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AACZ;AAEO,SAASC,EAA6BC,GAAgBC,IAA0C,IAA4B;AACjI,QAAMC,IAAeC,EAAA,GACfC,IAAgBC,EAAUJ,CAAO;AAmDvC,SAjD8BD,EAAK,WAChC,QAAQ,CAACM,MACJA,EAAU,SAAS,SACdA,EAAU,YAAY,QAAQ,CAACC,MAAgCA,EAAa,UAAU,IAGxF,CAACD,CAAS,CAClB,EACA,OAAO,CAACA,MAAcA,GAAW,SAAS,EAC1C,IAAI,CAACE,MAAM;AACV,UAAMF,IAAYE,GAEZC,IAAcL,EAAc,UAAU,CAAC,EAAE,aAAAM,QACtCA,MAAgB,QAAQJ,EAAU,GAAG,EAC7C;AAED,QAAIK,IAASP,EAAcK,CAAW;AAEtC,WAAIE,KACFP,EAAc,OAAOK,GAAa,CAAC,GAG9BP,EAAa,SAAS,QAAQI,EAAU,GAAG,IAAW;AAAA,MAC3D,SAASA,EAAU,SAASA,EAAU,SAASA,EAAU,MAAM,QAAQ,KAAK,EAAE;AAAA,MAC9E,MAAM;AAAA,QACJ,MAAMR,EAAUQ,EAAU,IAA8B,KAAKA,EAAU;AAAA,QACvE,QAAQ;AAAA,UACN,GAAGK,GAAQ,MAAM;AAAA,UACjB,SAASd,EAAiBS,EAAU,IAAK,KAAK;AAAA,QAAA;AAAA,QAEhD,GAAIK,GAAQ,QAAQ,CAAA;AAAA,MAAC;AAAA,MAEvB,GAAIA,KAAU,CAAA;AAAA,IAAC,CAChB;AAAA,EACH,CAAC,EAEyC,OAAOP,CAAsB,EAAE,IAAI,CAACO,GAAQC,MAAU;AAChG,UAAMC,IAAOC,EAAiC,CAAC,QAAQH,EAAO,EAAE,IAAI,QAAQA,EAAO,MAAM,IAAI,IAAI,MAAM,CAAC;AAExG,WAAO;AAAA,MACL,GAAGA;AAAA,MACH,MAAM;AAAA,QACJ,GAAGA,GAAQ;AAAA,QACX,OAAOI,EAAIJ,GAAQ,cAAcC,IAAQ,EAAE;AAAA,MAAA;AAAA,MAE7C,MAAMD,EAAO,QAAQE;AAAA,IAAA;AAAA,EAEzB,CAAC,EAEoB,KAAK,CAACG,GAAGC,MAAOD,EAAE,KAAK,QAAQC,EAAE,KAAK,QAAQ,IAAI,EAAG;AAC5E;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as m, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { g as f } from "../../../chunks/_commonjsHelpers.js";
|
|
3
|
-
import {
|
|
3
|
+
import { r as c } from "../../../chunks/index2.js";
|
|
4
4
|
import { Form as p } from "../Form.js";
|
|
5
5
|
var d = c();
|
|
6
6
|
const n = /* @__PURE__ */ f(d);
|
|
@@ -18,13 +18,13 @@ function b({ action: t, ...s }) {
|
|
|
18
18
|
}), s;
|
|
19
19
|
}
|
|
20
20
|
function v({ actionInfo: t, children: s, onSubmit: r, options: e, ...i }) {
|
|
21
|
-
const { form: u, submission:
|
|
22
|
-
const
|
|
23
|
-
return { form: b(t.settingsForm), submission: { data:
|
|
21
|
+
const { form: u, submission: o } = (() => {
|
|
22
|
+
const a = x(i.submission || {}, t.defaults);
|
|
23
|
+
return { form: b(t.settingsForm), submission: { data: a } };
|
|
24
24
|
})();
|
|
25
25
|
return /* @__PURE__ */ m("div", { children: [
|
|
26
26
|
s,
|
|
27
|
-
/* @__PURE__ */ l(p, { form: u, submission:
|
|
27
|
+
/* @__PURE__ */ l(p, { form: u, submission: o, onSubmit: r, options: e }),
|
|
28
28
|
s
|
|
29
29
|
] });
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as e, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { c as t } from "../../../../chunks/index.js";
|
|
3
|
-
import { h as m } from "../../../../chunks/
|
|
3
|
+
import { h as m } from "../../../../chunks/moment.js";
|
|
4
4
|
import { registerComponent as c } from "../../../../registries/components.js";
|
|
5
5
|
import { iconClass as r } from "../../../../utils/iconClass.js";
|
|
6
6
|
import { stopPropagationWrapper as n } from "../../../../utils/stopPropagationWrapper.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.14",
|
|
4
4
|
"description": "Provide a react formio wrapper. Written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tanstack/react-table": ">=8.20.6",
|
|
47
|
-
"@tsed/tailwind-formio": "3.0.0-rc.
|
|
48
|
-
"@tsed/typescript": "3.0.0-rc.
|
|
47
|
+
"@tsed/tailwind-formio": "3.0.0-rc.14",
|
|
48
|
+
"@tsed/typescript": "3.0.0-rc.14",
|
|
49
49
|
"microbundle": "0.13.0",
|
|
50
50
|
"vite": "7.1.5",
|
|
51
51
|
"vitest": "3.2.4"
|
package/src/all.ts
CHANGED
|
@@ -25,6 +25,8 @@ import "./molecules/forms/input-tags/InputTags.interface";
|
|
|
25
25
|
import "./molecules/table/components/DefaultFilter";
|
|
26
26
|
import "./molecules/table/components/DefaultArrowSort";
|
|
27
27
|
import "./molecules/table/components/DefaultCell";
|
|
28
|
+
import "./molecules/table/components/DefaultBooleanCell";
|
|
29
|
+
import "./molecules/table/components/DefaultDateCell";
|
|
28
30
|
import "./molecules/table/components/DefaultCellOperations";
|
|
29
31
|
import "./molecules/table/components/DefaultOperationButton";
|
|
30
32
|
import "./molecules/table/components/DefaultCellHeader";
|
package/src/interfaces/index.ts
CHANGED
|
@@ -28,10 +28,6 @@ export interface SelectProps<Data = string> extends FormControlProps<Data, Selec
|
|
|
28
28
|
searchEnabled?: boolean;
|
|
29
29
|
customProperties?: Record<string, any>;
|
|
30
30
|
options: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated
|
|
33
|
-
*/
|
|
34
|
-
choices?: (SelectOptionBaseProps<Data> | Omit<SelectOptionProps<Data>, "value">)[];
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
export interface SelectSingle<Data = string> extends SelectProps<Data> {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "./components/DefaultFilter";
|
|
2
2
|
import "./components/DefaultArrowSort";
|
|
3
3
|
import "./components/DefaultCell";
|
|
4
|
+
import "./components/DefaultBooleanCell";
|
|
5
|
+
import "./components/DefaultDateCell";
|
|
4
6
|
import "./components/DefaultCellOperations";
|
|
5
7
|
import "./components/DefaultOperationButton";
|
|
6
8
|
import "./components/DefaultCellHeader";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
|
|
3
|
+
import { DefaultCellBoolean } from "./DefaultBooleanCell";
|
|
4
|
+
|
|
5
|
+
function createCellContext(value: boolean, labels?: Record<string, string>) {
|
|
6
|
+
return {
|
|
7
|
+
getValue: () => value,
|
|
8
|
+
column: {
|
|
9
|
+
columnDef: {
|
|
10
|
+
meta: {
|
|
11
|
+
labels
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
} as any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe("DefaultCellBoolean", () => {
|
|
19
|
+
it("should render the default yes label for true values", () => {
|
|
20
|
+
render(<DefaultCellBoolean {...createCellContext(true)} />);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByText("Yes", { selector: "span" })).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should render the default no label for false values", () => {
|
|
26
|
+
render(<DefaultCellBoolean {...createCellContext(false)} />);
|
|
27
|
+
|
|
28
|
+
expect(screen.getByText("No", { selector: "span" })).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should render custom labels from column metadata", () => {
|
|
32
|
+
render(<DefaultCellBoolean {...createCellContext(true, { yes: "Enabled", No: "Disabled" })} />);
|
|
33
|
+
|
|
34
|
+
expect(screen.getByText("Enabled", { selector: "span" })).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should render the custom false label from column metadata", () => {
|
|
38
|
+
render(<DefaultCellBoolean {...createCellContext(false, { yes: "Enabled", No: "Disabled" })} />);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText("Disabled", { selector: "span" })).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CellContext } from "@tanstack/react-table";
|
|
2
|
+
|
|
3
|
+
import { registerComponent } from "../../../registries/components";
|
|
4
|
+
|
|
5
|
+
export function DefaultCellBoolean<Data extends object>({ getValue, column: { columnDef } }: CellContext<Data, boolean>) {
|
|
6
|
+
const value = getValue();
|
|
7
|
+
return <span>{String(value ? columnDef.meta?.labels?.["yes"] || "Yes" : columnDef.meta?.labels?.["No"] || "No")}</span>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
registerComponent("Cell.boolean", DefaultCellBoolean);
|
|
11
|
+
registerComponent("Cell.checkbox", DefaultCellBoolean);
|