spectramicro-filter
v1.1.19
Published
Spectramicro Search v2 Application
Downloads
92
Readme
This is spectramicro filter
Usage
import FilterComponent from "spectramicro-filter";
// Invoked on API request
const onRequest = () => {};
// Invoked on API success
const onRequestSuccess = (data) => {
// data = api success response
};
// Invoked on API error
const onRequestFailure = (err) => {
// err = api error response
};
// Invoked on change of filter
const onFormValuesChange = (current, allData) => {
// current = filterId:value of a selected filter
// allData = all filter values
};
// Invoked Form Submit
const onFormSubmit = (data) => {
// data = all filter values on submit
};
// Extended Props for Antd Select Component
const selectProps = {
// bordered: false
// ...
};
// NOTE: To extend props for specific filter id, use as follows:
// const selectProps = {
// app_filter: {
// bordered: false
// ...
// }
// }
// Configuration
const filterConfig = {
baseUrl: "",
formItemLayout: null,
formLayout: "vertical",
labelSuffix: "",
showFormAction: true,
selectType: {
app_filter: {
showSelectAll: false,
},
},
appId: "PRISM",
filterIds: ["app_filter", "table_filter"],
// loadFilterParams: {
// resultset_meta_filter: {
// filters: [
// {
// field: "app",
// operator: "equals",
// value: ["abc"],
// },
// ],
// q: "123"
// },
// },
limit: 100,
interDependent: {
app_filter: "table_filter",
// resultset_meta_filter: "resultset_meta_filter_rt",
},
};
// Render Method
<FilterComponent
config={filterConfig}
onRequest={onRequest}
onRequestSuccess={onRequestSuccess}
onRequestFailure={onRequestFailure}
onFormValuesChange={onFormValuesChange}
onFormSubmit={onFormSubmit}
selectProps={selectProps}
reset
/>;