@tsed/react-formio 2.2.2 → 2.3.0
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/components/table/components/defaultCell.component.d.ts +1 -0
- package/dist/components/table/filters/selectColumnFilter.component.d.ts +9 -1
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +15 -1
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +1 -0
- package/dist/components/table/table.stories.d.ts +2 -2
- package/dist/components/table/utils/mapFormToColumns.d.ts +2 -2
- package/dist/index.js +52 -25
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +51 -21
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
- package/src/components/pagination/pagination.component.tsx +1 -1
- package/src/components/table/components/defaultCells.component.tsx +12 -3
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +21 -0
- package/src/components/table/filters/selectColumnFilter.component.tsx +38 -12
- package/src/components/table/hooks/useCustomTable.hook.tsx +31 -1
- package/src/components/table/table.component.tsx +1 -0
- package/src/components/table/utils/mapFormToColumns.tsx +5 -4
package/dist/index.modern.js
CHANGED
|
@@ -327,7 +327,9 @@ function Pagination(props) {
|
|
|
327
327
|
}, /*#__PURE__*/React.createElement("span", null, i18n("Page"), "\xA0"), /*#__PURE__*/React.createElement("strong", null, pageIndex + 1, " of ", pageOptions.length)), totalLength !== undefined && /*#__PURE__*/React.createElement("li", {
|
|
328
328
|
className: "mb-3 flex items-center",
|
|
329
329
|
"data-testid": "pagination-total-items"
|
|
330
|
-
}, i18n("Total"), ": ", /*#__PURE__*/React.createElement("strong",
|
|
330
|
+
}, i18n("Total"), ": ", /*#__PURE__*/React.createElement("strong", {
|
|
331
|
+
className: "mx-1"
|
|
332
|
+
}, new Intl.NumberFormat(undefined).format(totalLength)), " ", i18n("items")));
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
function DefaultArrowSort({
|
|
@@ -448,7 +450,10 @@ function DefaultCells({
|
|
|
448
450
|
}
|
|
449
451
|
return /*#__PURE__*/React.createElement("td", _extends({
|
|
450
452
|
colSpan: colspan
|
|
451
|
-
}, cell.getCellProps(
|
|
453
|
+
}, cell.getCellProps({
|
|
454
|
+
className: cell.column.className,
|
|
455
|
+
style: cell.column.style
|
|
456
|
+
}), {
|
|
452
457
|
key: `tableInstance.page.cells.${cell.value || "value"}.${i}`
|
|
453
458
|
}), cell.render("Cell"));
|
|
454
459
|
}));
|
|
@@ -2288,34 +2293,58 @@ function FormSettings(props) {
|
|
|
2288
2293
|
}, i18n("Save settings")));
|
|
2289
2294
|
}
|
|
2290
2295
|
|
|
2291
|
-
function
|
|
2292
|
-
|
|
2293
|
-
|
|
2296
|
+
function useSelectColumnFilter(props) {
|
|
2297
|
+
const {
|
|
2298
|
+
column
|
|
2299
|
+
} = props;
|
|
2294
2300
|
const {
|
|
2295
2301
|
id,
|
|
2296
|
-
preFilteredRows
|
|
2297
|
-
filterValue,
|
|
2298
|
-
setFilter
|
|
2302
|
+
preFilteredRows
|
|
2299
2303
|
} = column;
|
|
2300
2304
|
const {
|
|
2301
2305
|
choices: customChoices
|
|
2302
2306
|
} = column;
|
|
2303
|
-
const
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2307
|
+
const {
|
|
2308
|
+
filterValue,
|
|
2309
|
+
setFilter
|
|
2310
|
+
} = column;
|
|
2311
|
+
const choices = (() => {
|
|
2312
|
+
if (customChoices) {
|
|
2313
|
+
if (typeof customChoices === "function") {
|
|
2314
|
+
return customChoices(props);
|
|
2315
|
+
}
|
|
2316
|
+
return customChoices;
|
|
2317
|
+
}
|
|
2318
|
+
return [...new Set(preFilteredRows.map(row => row.values[id]))].filter(value => value).map(value => ({
|
|
2319
|
+
label: value,
|
|
2320
|
+
value
|
|
2321
|
+
}));
|
|
2322
|
+
})();
|
|
2323
|
+
const onChange = (_, value) => {
|
|
2324
|
+
setFilter(value || undefined);
|
|
2325
|
+
};
|
|
2326
|
+
return {
|
|
2311
2327
|
value: filterValue,
|
|
2328
|
+
onChange,
|
|
2312
2329
|
choices: [{
|
|
2313
2330
|
value: "",
|
|
2314
2331
|
label: "All"
|
|
2315
|
-
}].concat(choices)
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2332
|
+
}].concat(choices)
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
function SelectColumnFilter(props) {
|
|
2336
|
+
const {
|
|
2337
|
+
value,
|
|
2338
|
+
choices,
|
|
2339
|
+
onChange
|
|
2340
|
+
} = useSelectColumnFilter(props);
|
|
2341
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
2342
|
+
key: `filter-${props.column.id}`,
|
|
2343
|
+
name: `filter-${props.column.id}`,
|
|
2344
|
+
size: "sm",
|
|
2345
|
+
value: value,
|
|
2346
|
+
choices: choices,
|
|
2347
|
+
onChange: onChange
|
|
2319
2348
|
});
|
|
2320
2349
|
}
|
|
2321
2350
|
|
|
@@ -7277,6 +7306,7 @@ function mapFormToColumns(form) {
|
|
|
7277
7306
|
const column = {
|
|
7278
7307
|
Header: component.label || component.title || component.key,
|
|
7279
7308
|
accessor: `data.${component.key}`,
|
|
7309
|
+
className: "text-center",
|
|
7280
7310
|
Cell: props => /*#__PURE__*/React.createElement(DefaultCell, _extends({}, props, {
|
|
7281
7311
|
render: value => cmp.asString(value)
|
|
7282
7312
|
}))
|
|
@@ -7419,5 +7449,5 @@ function mapPagination({
|
|
|
7419
7449
|
};
|
|
7420
7450
|
}
|
|
7421
7451
|
|
|
7422
|
-
export { ActionsTable, Alert, ButtonTab, Card, DefaultArrowSort, DefaultCell, DefaultCellHeader, DefaultCellOperations, DefaultColumnFilter, DefaultOperationButton, Form, FormAccess, FormAction, FormBuilder, FormControl, FormEdit, FormEditCTAs, FormParameters, FormSettings, FormsTable, InputTags, InputText, LEFT_PAGE, Loader, Modal, Pagination, RIGHT_PAGE, ReactComponent, RemoveModal, Select, SelectColumnFilter, SliderColumnFilter, SubmissionsTable, Table, Tabs, callLast, defaultDisplayChoices, getOperationCallback, getPageNumbers, iconClass, mapFormToColumns, mapPagination, stopPropagationWrapper, swapElements, useCustomTable, useForm, useFormEdit, useModal, useOperations, useTooltip };
|
|
7452
|
+
export { ActionsTable, Alert, ButtonTab, Card, DefaultArrowSort, DefaultCell, DefaultCellHeader, DefaultCellOperations, DefaultColumnFilter, DefaultOperationButton, Form, FormAccess, FormAction, FormBuilder, FormControl, FormEdit, FormEditCTAs, FormParameters, FormSettings, FormsTable, InputTags, InputText, LEFT_PAGE, Loader, Modal, Pagination, RIGHT_PAGE, ReactComponent, RemoveModal, Select, SelectColumnFilter, SliderColumnFilter, SubmissionsTable, Table, Tabs, callLast, defaultDisplayChoices, getOperationCallback, getPageNumbers, iconClass, mapFormToColumns, mapPagination, stopPropagationWrapper, swapElements, useCustomTable, useForm, useFormEdit, useModal, useOperations, useSelectColumnFilter, useTooltip };
|
|
7423
7453
|
//# sourceMappingURL=index.modern.js.map
|