@akinon/akifilter 0.3.1 → 0.4.1
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 → cjs/components}/AppliedFilters/AppliedFilterItem.d.ts +1 -0
- package/dist/cjs/components/AppliedFilters/AppliedFilterItem.d.ts.map +1 -0
- package/dist/cjs/components/AppliedFilters/AppliedFilterItem.js +53 -0
- package/dist/cjs/components/AppliedFilters/common.d.ts +6 -0
- package/dist/cjs/components/AppliedFilters/common.d.ts.map +1 -0
- package/dist/cjs/components/AppliedFilters/common.js +33 -0
- package/dist/{components → cjs/components}/AppliedFilters/index.d.ts +1 -0
- package/dist/cjs/components/AppliedFilters/index.d.ts.map +1 -0
- package/dist/cjs/components/AppliedFilters/index.js +26 -0
- package/dist/cjs/components/AppliedFilters/styles.css +65 -0
- package/dist/cjs/components/ConditionalFilters/index.d.ts.map +1 -0
- package/dist/cjs/components/ConditionalFilters/index.js +32 -0
- package/dist/cjs/components/FilterContext/index.d.ts.map +1 -0
- package/dist/cjs/components/FilterContext/index.js +85 -0
- package/dist/{components → cjs/components}/SelectShownFilters/index.d.ts +1 -0
- package/dist/cjs/components/SelectShownFilters/index.d.ts.map +1 -0
- package/dist/cjs/components/SelectShownFilters/index.js +111 -0
- package/dist/cjs/components/SelectShownFilters/styles.css +99 -0
- package/dist/cjs/components/ShownFilters/index.d.ts.map +1 -0
- package/dist/cjs/components/ShownFilters/index.js +46 -0
- package/dist/cjs/components/index.d.ts.map +1 -0
- package/dist/cjs/components/index.js +21 -0
- package/dist/cjs/constants/index.d.ts.map +1 -0
- package/dist/cjs/constants/index.js +58 -0
- package/dist/cjs/i18n/index.d.ts.map +1 -0
- package/dist/cjs/i18n/index.js +14 -0
- package/dist/cjs/i18n/translations/en.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/en.js +6 -0
- package/dist/cjs/i18n/translations/tr.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/tr.js +6 -0
- package/dist/cjs/index.css +67 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +1 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/index.js +40 -0
- package/dist/esm/components/AppliedFilters/AppliedFilterItem.d.ts +12 -0
- package/dist/esm/components/AppliedFilters/AppliedFilterItem.d.ts.map +1 -0
- package/dist/esm/components/AppliedFilters/AppliedFilterItem.js +49 -0
- package/dist/esm/components/AppliedFilters/common.d.ts +6 -0
- package/dist/esm/components/AppliedFilters/common.d.ts.map +1 -0
- package/dist/esm/components/AppliedFilters/common.js +28 -0
- package/dist/esm/components/AppliedFilters/index.d.ts +4 -0
- package/dist/esm/components/AppliedFilters/index.d.ts.map +1 -0
- package/dist/esm/components/AppliedFilters/index.js +22 -0
- package/dist/esm/components/AppliedFilters/styles.css +65 -0
- package/dist/esm/components/ConditionalFilters/index.d.ts +3 -0
- package/dist/esm/components/ConditionalFilters/index.d.ts.map +1 -0
- package/dist/esm/components/ConditionalFilters/index.js +28 -0
- package/dist/esm/components/FilterContext/index.d.ts +45 -0
- package/dist/esm/components/FilterContext/index.d.ts.map +1 -0
- package/dist/esm/components/FilterContext/index.js +80 -0
- package/dist/esm/components/SelectShownFilters/index.d.ts +7 -0
- package/dist/esm/components/SelectShownFilters/index.d.ts.map +1 -0
- package/dist/esm/components/SelectShownFilters/index.js +107 -0
- package/dist/esm/components/SelectShownFilters/styles.css +99 -0
- package/dist/esm/components/ShownFilters/index.d.ts +3 -0
- package/dist/esm/components/ShownFilters/index.d.ts.map +1 -0
- package/dist/esm/components/ShownFilters/index.js +42 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.d.ts.map +1 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/constants/index.d.ts +56 -0
- package/dist/esm/constants/index.d.ts.map +1 -0
- package/dist/esm/constants/index.js +55 -0
- package/dist/esm/i18n/index.d.ts +5 -0
- package/dist/esm/i18n/index.d.ts.map +1 -0
- package/dist/esm/i18n/index.js +11 -0
- package/dist/esm/i18n/translations/en.d.ts +5 -0
- package/dist/esm/i18n/translations/en.d.ts.map +1 -0
- package/dist/esm/i18n/translations/en.js +4 -0
- package/dist/esm/i18n/translations/tr.d.ts +5 -0
- package/dist/esm/i18n/translations/tr.d.ts.map +1 -0
- package/dist/esm/i18n/translations/tr.js +4 -0
- package/dist/esm/index.css +67 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +30 -0
- package/dist/esm/utils/index.d.ts +25 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +35 -0
- package/package.json +18 -7
- package/dist/Utils/index.d.ts.map +0 -1
- package/dist/components/AppliedFilters/AppliedFilterItem.d.ts.map +0 -1
- package/dist/components/AppliedFilters/common.d.ts +0 -7
- package/dist/components/AppliedFilters/common.d.ts.map +0 -1
- package/dist/components/AppliedFilters/index.d.ts.map +0 -1
- package/dist/components/ConditionalFilters/index.d.ts.map +0 -1
- package/dist/components/FilterContext/index.d.ts.map +0 -1
- package/dist/components/SelectShownFilters/index.d.ts.map +0 -1
- package/dist/components/ShownFilters/index.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/translations/en.d.ts.map +0 -1
- package/dist/i18n/translations/tr.d.ts.map +0 -1
- package/dist/index.cjs +0 -31
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16212
- /package/dist/{components → cjs/components}/ConditionalFilters/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/FilterContext/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ShownFilters/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/index.d.ts +0 -0
- /package/dist/{constants → cjs/constants}/index.d.ts +0 -0
- /package/dist/{i18n → cjs/i18n}/index.d.ts +0 -0
- /package/dist/{i18n → cjs/i18n}/translations/en.d.ts +0 -0
- /package/dist/{i18n → cjs/i18n}/translations/tr.d.ts +0 -0
- /package/dist/{Utils → cjs/utils}/index.d.ts +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import './styles.css';
|
|
2
|
+
import { FormBuilderWatch } from '@akinon/akiform-builder';
|
|
3
|
+
import { Icon } from '@akinon/icons';
|
|
4
|
+
import { Input } from '@akinon/ui-input';
|
|
5
|
+
import { Pagination } from '@akinon/ui-pagination';
|
|
6
|
+
import { Divider } from '@akinon/ui-divider';
|
|
7
|
+
import { Modal } from '@akinon/ui-modal';
|
|
8
|
+
import { Space } from '@akinon/ui-space';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { useFilterContext } from '../FilterContext';
|
|
11
|
+
// import {
|
|
12
|
+
// getModalFormInitialValues,
|
|
13
|
+
// getModalFormMeta,
|
|
14
|
+
// transformFiltersFormMetaFieldsToModalFormMetaFields
|
|
15
|
+
// } from './common';
|
|
16
|
+
// import useOnModalCancel from './hooks/useOnModalCancel';
|
|
17
|
+
// TODO includeFileFilter
|
|
18
|
+
/**
|
|
19
|
+
* Via this component, user can select which filters to show in the UI from applicableFilters.
|
|
20
|
+
*/
|
|
21
|
+
export const SelectShownFilters = () => {
|
|
22
|
+
const [search, setSearch] = useState('');
|
|
23
|
+
const [pagination, setPagination] = useState({
|
|
24
|
+
current: 1,
|
|
25
|
+
pageSize: 60
|
|
26
|
+
});
|
|
27
|
+
const { state, dispatch } = useFilterContext();
|
|
28
|
+
const { applicableFilters, shownFilters } = state;
|
|
29
|
+
// create checkbox form item for each filter, which will determine whether to show it or not
|
|
30
|
+
const modalFormItems = [];
|
|
31
|
+
applicableFilters.forEach((filter) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (search &&
|
|
34
|
+
!((_a = filter.placeholder) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(search.toLowerCase())) &&
|
|
35
|
+
!filter.label.toLowerCase().includes(search.toLowerCase())) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
modalFormItems.push({
|
|
39
|
+
key: filter.key,
|
|
40
|
+
label: filter.placeholder || filter.label || filter.key,
|
|
41
|
+
type: 'checkbox',
|
|
42
|
+
value: shownFilters.includes(filter.key),
|
|
43
|
+
props: {
|
|
44
|
+
labelRightAligned: true
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
const modalFormItemsPaginated = modalFormItems.slice((pagination.current - 1) * pagination.pageSize, pagination.current * pagination.pageSize);
|
|
49
|
+
// export const transformFiltersFormMetaFieldsToModalFormMetaFields = (filtersFormMetaFields) =>
|
|
50
|
+
// filtersFormMetaFields.map((metaField) => ({
|
|
51
|
+
// key: metaField.key,
|
|
52
|
+
// widget: WidgetType.CHECKBOX,
|
|
53
|
+
// children: metaField.placeholder,
|
|
54
|
+
// }));
|
|
55
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
56
|
+
// const onModalCancel = useOnModalCancel({
|
|
57
|
+
// setCurrentFiltersFormMeta,
|
|
58
|
+
// modalForm,
|
|
59
|
+
// setIsModalOpen,
|
|
60
|
+
// staticFiltersFormMetaFields,
|
|
61
|
+
// dynamicFiltersFormMetaFields
|
|
62
|
+
// });
|
|
63
|
+
// const modalFormInitialValues = getModalFormInitialValues(
|
|
64
|
+
// currentFiltersFormMeta
|
|
65
|
+
// );
|
|
66
|
+
// const modalFormMetaFields =
|
|
67
|
+
// transformFiltersFormMetaFieldsToModalFormMetaFields([
|
|
68
|
+
// ...staticFiltersFormMetaFields,
|
|
69
|
+
// ...dynamicFiltersFormMetaFields
|
|
70
|
+
// ]);
|
|
71
|
+
const handleOpenModalIconClick = () => {
|
|
72
|
+
setIsModalOpen(true);
|
|
73
|
+
};
|
|
74
|
+
const onModalCancel = () => {
|
|
75
|
+
setIsModalOpen(false);
|
|
76
|
+
};
|
|
77
|
+
const handleModalFormValuesChange = (allValues) => {
|
|
78
|
+
// select true values from allValues
|
|
79
|
+
const shownFilters = Object.keys(allValues).filter(key => allValues[key] === true);
|
|
80
|
+
dispatch({
|
|
81
|
+
type: 'SET_SHOWN_FILTERS',
|
|
82
|
+
payload: { shownFilters }
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
// const addFileToFilters = selectFile => {
|
|
86
|
+
// setFilters({
|
|
87
|
+
// pagePath: mainPath,
|
|
88
|
+
// filters: { ...pageFilters, filter_file: selectFile.file }
|
|
89
|
+
// });
|
|
90
|
+
// };
|
|
91
|
+
return (React.createElement(Space, { className: "filter-options" },
|
|
92
|
+
React.createElement("div", { className: "filter-options__item", onClick: handleOpenModalIconClick },
|
|
93
|
+
React.createElement(Icon, { icon: "filter" })),
|
|
94
|
+
React.createElement(Modal, { className: "filter-options__modal", onCancel: onModalCancel, open: isModalOpen, destroyOnClose: true, footer: null, width: '80%', "data-testid": "filter-options-modal" },
|
|
95
|
+
React.createElement("div", { className: "filter-options__modal-header" },
|
|
96
|
+
React.createElement("div", { className: "filter-options__modal-header-banner" }),
|
|
97
|
+
React.createElement("h1", { className: "filter-options__modal-header-title" }, "Select Shown Filters")),
|
|
98
|
+
React.createElement(Divider, null),
|
|
99
|
+
React.createElement("div", { className: "filter-options__modal-control" },
|
|
100
|
+
React.createElement(Input, { placeholder: "Search", onChange: e => setSearch(e.target.value), className: "filter-options__modal-search" }),
|
|
101
|
+
React.createElement("div", { className: "filter-options__modal-pagination" },
|
|
102
|
+
React.createElement(Pagination, { current: pagination.current, pageSize: pagination.pageSize, total: modalFormItems.length, onChange: (page, pageSize) => {
|
|
103
|
+
setPagination({ current: page, pageSize });
|
|
104
|
+
}, showSizeChanger: false, simple: true }))),
|
|
105
|
+
React.createElement("div", { className: "filter-options__modal-form" },
|
|
106
|
+
React.createElement(FormBuilderWatch, { builderFields: modalFormItemsPaginated, handleChange: handleModalFormValuesChange, isDebounced: false })))));
|
|
107
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.filter-options .filter-options__item {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
height: 36px;
|
|
6
|
+
width: 36px;
|
|
7
|
+
background-color: #4482ff;
|
|
8
|
+
color: var(--color-neutral-50);
|
|
9
|
+
border-radius: 5px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.filter-options .filter-options__filter-modal-open-icon {
|
|
14
|
+
color: white;
|
|
15
|
+
font-size: 23px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.filter-options .filter-options__modal-header {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.filter-options .filter-options__modal-header-banner {
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 0;
|
|
27
|
+
width: 4px;
|
|
28
|
+
height: 16px;
|
|
29
|
+
background-color: #ff5163;
|
|
30
|
+
left: -22px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.filter-options .filter-options__modal-header-title {
|
|
34
|
+
font-size: 20px;
|
|
35
|
+
color: white;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
margin: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.filter-options .filter-options__modal-divider.akinon-divider-horizontal {
|
|
41
|
+
background-color: #363d51;
|
|
42
|
+
width: calc(100% + 44px);
|
|
43
|
+
margin: 15px;
|
|
44
|
+
margin-left: -22px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.filter-options .filter-options__modal-control {
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
align-items: center;
|
|
51
|
+
margin-bottom: 15px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.filter-options .filter-options__modal-search {
|
|
55
|
+
width: 250px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.filter-options .filter-options__modal-form.akinon-form {
|
|
59
|
+
margin: 32px 44px 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.filter-options .filter-options__export-item {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
align-items: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.filter-options .filter-options__export-icon {
|
|
70
|
+
color: white;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.filter-options .filter-options__export-label.akinon-typography {
|
|
74
|
+
text-transform: uppercase;
|
|
75
|
+
color: white;
|
|
76
|
+
font-size: 11px;
|
|
77
|
+
font-weight: bold;
|
|
78
|
+
line-height: 14px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.filter-options__modal.akinon-modal .akinon-checkbox-wrapper {
|
|
82
|
+
color: white;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.filter-options__modal.akinon-modal
|
|
86
|
+
.akinon-checkbox-checked
|
|
87
|
+
.akinon-checkbox-inner {
|
|
88
|
+
background-color: #6c7ebe;
|
|
89
|
+
border-color: #6c7ebe;
|
|
90
|
+
|
|
91
|
+
&:hover {
|
|
92
|
+
border-color: #6c7ebe;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.filter-options__modal-form .akinon-form {
|
|
97
|
+
display: grid;
|
|
98
|
+
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ShownFilters/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,YAAY,yBAkExB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FormBuilderWatch } from '@akinon/akiform-builder';
|
|
2
|
+
import { Paragraph } from '@akinon/ui-typography';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useFilterContext } from '../FilterContext';
|
|
6
|
+
export const ShownFilters = () => {
|
|
7
|
+
const { state, dispatch } = useFilterContext();
|
|
8
|
+
const { applicableFilters, shownFilters, appliedFilters, recreateShownFiltersCount } = state;
|
|
9
|
+
// derive form items from applicableFilters and shownFilters
|
|
10
|
+
const shownApplicableFilters = applicableFilters.filter(filter => shownFilters.includes(filter.key));
|
|
11
|
+
// create form items from shownApplicableFilters and appliedFilters.
|
|
12
|
+
// the shownApplicableFilters determines the schema of the form items and
|
|
13
|
+
// appliedFilters determines the values of the form items
|
|
14
|
+
const formItems = shownApplicableFilters.map(filter => {
|
|
15
|
+
return Object.assign(Object.assign({}, filter), { value: appliedFilters[filter.key], props: Object.assign(Object.assign({}, ((filter === null || filter === void 0 ? void 0 : filter.props) || {})), { labelRightAligned: true }) });
|
|
16
|
+
});
|
|
17
|
+
// remove the label from the form items since label is not used in design
|
|
18
|
+
formItems.forEach(item => {
|
|
19
|
+
if (item.type === 'checkbox')
|
|
20
|
+
return;
|
|
21
|
+
delete item.label;
|
|
22
|
+
});
|
|
23
|
+
const handleChange = (changedValues) => {
|
|
24
|
+
// for datepicker values, convert them to string
|
|
25
|
+
Object.keys(changedValues).forEach(key => {
|
|
26
|
+
if (changedValues[key] &&
|
|
27
|
+
typeof changedValues[key].isValid === 'function' &&
|
|
28
|
+
typeof changedValues[key].format === 'function') {
|
|
29
|
+
changedValues[key] = dayjs(changedValues[key]).format('YYYY-MM-DD');
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
dispatch({
|
|
33
|
+
type: 'SET_APPLIED_FILTERS',
|
|
34
|
+
payload: {
|
|
35
|
+
appliedFilters: changedValues
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return (React.createElement("div", { className: "shown-filters", "data-testid": "shown-filters" },
|
|
40
|
+
React.createElement(Paragraph, { className: "akinon-filter__header" }, "MAIN FILTERS"),
|
|
41
|
+
React.createElement(FormBuilderWatch, { key: recreateShownFiltersCount, builderFields: formItems, handleChange: handleChange, isDebounced: true })));
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const defaultDateFormat = "DD/MM/YYYY";
|
|
2
|
+
export declare const defaultDateValueFormat = "YYYY-MM-DD";
|
|
3
|
+
export declare const defaultTimeFormat = "HH:mm";
|
|
4
|
+
export declare const defaultTimeFormatWithSeconds = "HH:mm:ss";
|
|
5
|
+
export declare const defaultTimeFormatWithTimeZone = "HH:mm:ssZZ";
|
|
6
|
+
export declare const timeFormatWithTimeZone = "HH:mmZ";
|
|
7
|
+
export declare const timeFormatWithDateAndTime = "LLL";
|
|
8
|
+
export declare const dateWithMonthName = "DD MMMM";
|
|
9
|
+
export declare const dateWithMonthNameAndYear = "DD MMMM YYYY";
|
|
10
|
+
export declare const overallDateFormat = "DD-MM-YYYY HH:mm:ss";
|
|
11
|
+
export declare const dateTimeLocalSecondsFormat = "YYYY-MM-DDTHH:mm:ss.SSS";
|
|
12
|
+
export declare const fullDateTimeWithZoneFormat = "YYYY-MM-DDTHH:mm:ss.SSS\\Z";
|
|
13
|
+
export declare const defaultDateTimeValueFormat = "YYYY-MM-DD HH:mm:ss";
|
|
14
|
+
export declare const defaultDateTimeFormat = "DD/MM/YYYY HH:mm";
|
|
15
|
+
export declare const defaultDateTimeFormatIntl: {
|
|
16
|
+
year: string;
|
|
17
|
+
month: string;
|
|
18
|
+
day: string;
|
|
19
|
+
hour: string;
|
|
20
|
+
minute: string;
|
|
21
|
+
hour12: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const defaultDateTimeFormatWithTimeZone = "YYYY-MM-DD HH:mmZ";
|
|
24
|
+
export declare const dateTimeFormat = "YYYY-MM-DD HH:mm";
|
|
25
|
+
export declare const tokenHeaderKEY = "Bearer";
|
|
26
|
+
export declare const tokenStorageKey = "tkn";
|
|
27
|
+
export declare const googleMapApiKey = "AIzaSyB7GLs4svXGax91fiW-gH1wInjmde7cEHk";
|
|
28
|
+
export declare const permissionSlugSuffix = "-v2";
|
|
29
|
+
export declare const readResponseMessageKey = "readResponseMessages";
|
|
30
|
+
export declare const platformLanguage = "platform_language";
|
|
31
|
+
export declare const contextChannel = "contextChannel";
|
|
32
|
+
export declare const allowedFileTypes = ".xls, .csv";
|
|
33
|
+
export declare const allowedFileTypesAndXlsx: string;
|
|
34
|
+
export declare const allowedImageTypes = ".png,.jpeg,.jpg,.bmp";
|
|
35
|
+
export declare const allowedHtmlTypes = ".html";
|
|
36
|
+
export declare const omsDashboardStorageKeyName = "oms_dashboardFilters";
|
|
37
|
+
export declare const dateManipulationKeys: {
|
|
38
|
+
END_OF: string;
|
|
39
|
+
SUBTRACT: string;
|
|
40
|
+
ADD: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const sampleDate = "2022-01-01";
|
|
43
|
+
export declare const defaultRowKey = "id";
|
|
44
|
+
export declare const Breakpoint: {
|
|
45
|
+
MOBILE: string;
|
|
46
|
+
TABLET: string;
|
|
47
|
+
DESKTOP: string;
|
|
48
|
+
LARGE_DESKTOP: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const defaultBreakpoints: {
|
|
51
|
+
MOBILE: number;
|
|
52
|
+
TABLET: number;
|
|
53
|
+
DESKTOP: number;
|
|
54
|
+
LARGE_DESKTOP: number;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,eAAO,MAAM,iBAAiB,UAAU,CAAC;AACzC,eAAO,MAAM,4BAA4B,aAAa,CAAC;AACvD,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAC1D,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAC/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AACvD,eAAO,MAAM,0BAA0B,4BAA4B,CAAC;AACpE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,eAAO,MAAM,0BAA0B,wBAA8D,CAAC;AACtG,eAAO,MAAM,qBAAqB,qBAA8C,CAAC;AACjF,eAAO,MAAM,yBAAyB;;;;;;;CAOrC,CAAC;AAEF,eAAO,MAAM,iCAAiC,sBAAwD,CAAC;AACvG,eAAO,MAAM,cAAc,qBAAmD,CAAC;AAE/E,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,eAAO,MAAM,eAAe,4CAA4C,CAAC;AAEzE,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C,eAAO,MAAM,uBAAuB,QAA+B,CAAC;AAEpE,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAExD,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AAEjE,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC,eAAO,MAAM,UAAU;;;;;CAKtB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const defaultDateFormat = 'DD/MM/YYYY';
|
|
2
|
+
export const defaultDateValueFormat = 'YYYY-MM-DD';
|
|
3
|
+
export const defaultTimeFormat = 'HH:mm';
|
|
4
|
+
export const defaultTimeFormatWithSeconds = 'HH:mm:ss';
|
|
5
|
+
export const defaultTimeFormatWithTimeZone = 'HH:mm:ssZZ';
|
|
6
|
+
export const timeFormatWithTimeZone = 'HH:mmZ';
|
|
7
|
+
export const timeFormatWithDateAndTime = 'LLL';
|
|
8
|
+
export const dateWithMonthName = 'DD MMMM';
|
|
9
|
+
export const dateWithMonthNameAndYear = 'DD MMMM YYYY';
|
|
10
|
+
export const overallDateFormat = 'DD-MM-YYYY HH:mm:ss';
|
|
11
|
+
export const dateTimeLocalSecondsFormat = 'YYYY-MM-DDTHH:mm:ss.SSS';
|
|
12
|
+
export const fullDateTimeWithZoneFormat = 'YYYY-MM-DDTHH:mm:ss.SSS\\Z';
|
|
13
|
+
export const defaultDateTimeValueFormat = `${defaultDateValueFormat} ${defaultTimeFormatWithSeconds}`;
|
|
14
|
+
export const defaultDateTimeFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
|
|
15
|
+
export const defaultDateTimeFormatIntl = {
|
|
16
|
+
year: 'numeric',
|
|
17
|
+
month: 'numeric',
|
|
18
|
+
day: 'numeric',
|
|
19
|
+
hour: 'numeric',
|
|
20
|
+
minute: 'numeric',
|
|
21
|
+
hour12: false
|
|
22
|
+
};
|
|
23
|
+
export const defaultDateTimeFormatWithTimeZone = `${defaultDateValueFormat} ${timeFormatWithTimeZone}`;
|
|
24
|
+
export const dateTimeFormat = `${defaultDateValueFormat} ${defaultTimeFormat}`;
|
|
25
|
+
export const tokenHeaderKEY = 'Bearer';
|
|
26
|
+
export const tokenStorageKey = 'tkn';
|
|
27
|
+
export const googleMapApiKey = 'AIzaSyB7GLs4svXGax91fiW-gH1wInjmde7cEHk';
|
|
28
|
+
export const permissionSlugSuffix = '-v2';
|
|
29
|
+
export const readResponseMessageKey = 'readResponseMessages';
|
|
30
|
+
export const platformLanguage = 'platform_language';
|
|
31
|
+
export const contextChannel = 'contextChannel';
|
|
32
|
+
export const allowedFileTypes = '.xls, .csv';
|
|
33
|
+
export const allowedFileTypesAndXlsx = allowedFileTypes + ', .xlsx';
|
|
34
|
+
export const allowedImageTypes = '.png,.jpeg,.jpg,.bmp';
|
|
35
|
+
export const allowedHtmlTypes = '.html';
|
|
36
|
+
export const omsDashboardStorageKeyName = 'oms_dashboardFilters';
|
|
37
|
+
export const dateManipulationKeys = {
|
|
38
|
+
END_OF: 'endOf',
|
|
39
|
+
SUBTRACT: 'subtract',
|
|
40
|
+
ADD: 'add'
|
|
41
|
+
};
|
|
42
|
+
export const sampleDate = '2022-01-01';
|
|
43
|
+
export const defaultRowKey = 'id';
|
|
44
|
+
export const Breakpoint = {
|
|
45
|
+
MOBILE: 'MOBILE',
|
|
46
|
+
TABLET: 'TABLET',
|
|
47
|
+
DESKTOP: 'DESKTOP',
|
|
48
|
+
LARGE_DESKTOP: 'LARGE_DESKTOP'
|
|
49
|
+
};
|
|
50
|
+
export const defaultBreakpoints = {
|
|
51
|
+
MOBILE: 576,
|
|
52
|
+
TABLET: 768,
|
|
53
|
+
DESKTOP: 992,
|
|
54
|
+
LARGE_DESKTOP: 1200
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;CAOf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Akilocale } from '@akinon/akilocale';
|
|
2
|
+
import en_filter from './translations/en';
|
|
3
|
+
import tr_filter from './translations/tr';
|
|
4
|
+
export const i18n = Akilocale.createInstance({
|
|
5
|
+
debug: true,
|
|
6
|
+
fallbackLng: 'en',
|
|
7
|
+
translations: {
|
|
8
|
+
en: en_filter,
|
|
9
|
+
tr: tr_filter
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/en.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;CAEF,CAAC;AAEX,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/tr.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;CAEF,CAAC;AAEX,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.akinon-filter {
|
|
2
|
+
background-color: var(--color-ebonyClay-400);
|
|
3
|
+
padding: 1.25rem 1.5rem 1.5rem;
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.akinon-filter .akinon-filter__title {
|
|
8
|
+
margin: 0;
|
|
9
|
+
font-weight: 500 !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.akinon-filter .akinon-filter__top {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
16
|
+
margin-bottom: 1rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.akinon-filter .akinon-filter__header {
|
|
20
|
+
color: var(--color-gray-500);
|
|
21
|
+
margin: 1.25rem 0 0.5rem !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Overriding this here is questionable? */
|
|
25
|
+
.akinon-filter .akinon-form {
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: 1fr 1fr 1fr 1fr;
|
|
28
|
+
gap: 0.5rem 0.75rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.akinon-filter .akinon-checkbox-wrapper {
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 3px 10px;
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
list-style: none;
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
background-color: #2b344c;
|
|
41
|
+
background-image: none;
|
|
42
|
+
border-width: 2px;
|
|
43
|
+
border-style: solid;
|
|
44
|
+
border-color: #262e47;
|
|
45
|
+
border-radius: 6px;
|
|
46
|
+
span {
|
|
47
|
+
color: var(--color-gray-500) !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.akinon-filter .akinon-picker {
|
|
52
|
+
background-color: var(--color-ebonyClay-475);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.akinon-filter .akinon-picker,
|
|
56
|
+
.akinon-filter .akinon-input-number,
|
|
57
|
+
[class^='antd-item'] {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.akinon-filter .akinon-form-item-control-input-content > * {
|
|
62
|
+
align-items: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.akinon-filter .shown-filters * {
|
|
66
|
+
font-weight: 700 !important;
|
|
67
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import type { FormField } from '@akinon/akiform-builder';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { FilterState } from './components/FilterContext';
|
|
5
|
+
export type FilterProps = {
|
|
6
|
+
filterSchema: FormField[];
|
|
7
|
+
useAppliedFilters: [
|
|
8
|
+
FilterState['appliedFilters'],
|
|
9
|
+
React.Dispatch<React.SetStateAction<FilterState['appliedFilters']>>
|
|
10
|
+
];
|
|
11
|
+
conditionalFiltersSchema?: FormField[];
|
|
12
|
+
customMainPath?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const Akifilter: ({ filterSchema, useAppliedFilters, customMainPath, conditionalFiltersSchema }: FilterProps) => React.JSX.Element;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAWzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAY9D,MAAM,MAAM,WAAW,GAAG;IAExB,YAAY,EAAE,SAAS,EAAE,CAAC;IAG1B,iBAAiB,EAAE;QACjB,WAAW,CAAC,gBAAgB,CAAC;QAC7B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACpE,CAAC;IAEF,wBAAwB,CAAC,EAAE,SAAS,EAAE,CAAC;IAEvC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,SAAS,kFAKnB,WAAW,sBAqBb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { Title } from '@akinon/ui-typography';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
5
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
6
|
+
import localeData from 'dayjs/plugin/localeData';
|
|
7
|
+
import weekday from 'dayjs/plugin/weekday';
|
|
8
|
+
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
9
|
+
import weekYear from 'dayjs/plugin/weekYear';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { AppliedFilters, ConditionalFilters, FilterContextProvider, SelectShownFilters, ShownFilters } from './components';
|
|
12
|
+
import { i18n } from './i18n';
|
|
13
|
+
// TODO: Whats this dayjs block doing here?
|
|
14
|
+
// extend dayjs with plugins so datepicker value can be set outside
|
|
15
|
+
dayjs.extend(customParseFormat);
|
|
16
|
+
dayjs.extend(advancedFormat);
|
|
17
|
+
dayjs.extend(weekday);
|
|
18
|
+
dayjs.extend(localeData);
|
|
19
|
+
dayjs.extend(weekOfYear);
|
|
20
|
+
dayjs.extend(weekYear);
|
|
21
|
+
export const Akifilter = ({ filterSchema, useAppliedFilters, customMainPath, conditionalFiltersSchema }) => {
|
|
22
|
+
return (React.createElement("div", { className: "akinon-filter" },
|
|
23
|
+
React.createElement(FilterContextProvider, { filterSchema: filterSchema, customMainPath: customMainPath, useAppliedFilters: useAppliedFilters, conditionalFiltersSchema: conditionalFiltersSchema },
|
|
24
|
+
React.createElement("div", { className: "akinon-filter__top" },
|
|
25
|
+
React.createElement(Title, { className: "akinon-filter__title", level: 4 }, i18n.t('title')),
|
|
26
|
+
React.createElement(SelectShownFilters, null)),
|
|
27
|
+
React.createElement(AppliedFilters, null),
|
|
28
|
+
React.createElement(ShownFilters, null),
|
|
29
|
+
React.createElement(ConditionalFilters, null))));
|
|
30
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface TreeNode {
|
|
2
|
+
value: any;
|
|
3
|
+
children?: TreeNode[];
|
|
4
|
+
}
|
|
5
|
+
interface Params {
|
|
6
|
+
tree: TreeNode[];
|
|
7
|
+
nodeValue: any;
|
|
8
|
+
}
|
|
9
|
+
export declare function getTreeNodeByValue({ tree, nodeValue }: Params): TreeNode | null;
|
|
10
|
+
/**
|
|
11
|
+
* To understand this fragmentation, you need to know that the path is built as follows:
|
|
12
|
+
*
|
|
13
|
+
* `appPath = /{appLanguage}/{apiLanguage}/{rootPath}/{subPath}`
|
|
14
|
+
*
|
|
15
|
+
* `mainPath = rootPath + subPath`
|
|
16
|
+
*/
|
|
17
|
+
export declare const getPathFragments: (path: any) => {
|
|
18
|
+
appLanguage: any;
|
|
19
|
+
apiLanguage: any;
|
|
20
|
+
rootPath: string;
|
|
21
|
+
subPath: string;
|
|
22
|
+
mainPath: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IAChB,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,UAAU,MAAM;IACd,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,EACV,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAiB1B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SAAU,GAAG;;;;;;CAUzC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isEmpty } from 'lodash';
|
|
2
|
+
export function getTreeNodeByValue({ tree, nodeValue }) {
|
|
3
|
+
if (isEmpty(tree) || isEmpty(nodeValue)) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
for (const node of tree) {
|
|
7
|
+
if (node.value === nodeValue) {
|
|
8
|
+
return node;
|
|
9
|
+
}
|
|
10
|
+
if (node.children) {
|
|
11
|
+
const childNode = getTreeNodeByValue({ tree: node.children, nodeValue });
|
|
12
|
+
if (childNode) {
|
|
13
|
+
return childNode;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* To understand this fragmentation, you need to know that the path is built as follows:
|
|
21
|
+
*
|
|
22
|
+
* `appPath = /{appLanguage}/{apiLanguage}/{rootPath}/{subPath}`
|
|
23
|
+
*
|
|
24
|
+
* `mainPath = rootPath + subPath`
|
|
25
|
+
*/
|
|
26
|
+
export const getPathFragments = (path) => {
|
|
27
|
+
const pathSlices = path.split('/');
|
|
28
|
+
return {
|
|
29
|
+
appLanguage: pathSlices[1],
|
|
30
|
+
apiLanguage: pathSlices[2],
|
|
31
|
+
rootPath: `/${pathSlices[3]}`,
|
|
32
|
+
subPath: `/${pathSlices.slice(4).join('/')}`,
|
|
33
|
+
mainPath: `/${pathSlices.slice(3).join('/')}`
|
|
34
|
+
};
|
|
35
|
+
};
|