@civicactions/cmsds-open-data-components 3.0.0-alpha.3 → 3.0.0-alpha.4
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/main.css +33 -10
- package/dist/main.css.map +1 -1
- package/dist/main.js +124 -171
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +0 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/assets/frequencyMap.js +0 -22
- package/lib/assets/icons/close.js +0 -33
- package/lib/assets/icons/close.jsx +0 -24
- package/lib/assets/icons/copy.js +0 -33
- package/lib/assets/icons/copy.jsx +0 -23
- package/lib/assets/icons/download.js +0 -33
- package/lib/assets/icons/download.jsx +0 -23
- package/lib/assets/icons/settings.js +0 -34
- package/lib/assets/icons/settings.jsx +0 -24
- package/lib/assets/images/CMSGovLogo-O.png +0 -0
- package/lib/assets/images/CMSgov@2x-white-O.png +0 -0
- package/lib/assets/metadataMapping.js +0 -161
- package/lib/assets/metadataMapping.jsx +0 -110
- package/lib/commands/index.js +0 -7
- package/lib/commands/templates/footer.js +0 -61
- package/lib/commands/templates/header.js +0 -84
- package/lib/commands/templates/page_not_found.js +0 -14
- package/lib/components/ApiDocumentation/index.js +0 -24
- package/lib/components/Breadcrumb/index.js +0 -47
- package/lib/components/DataTableDensity/datatabledensity.test.js +0 -30
- package/lib/components/DataTableDensity/index.js +0 -47
- package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +0 -49
- package/lib/components/DataTableRowChanger/index.js +0 -46
- package/lib/components/DatasetAdditionalInformation/index.js +0 -59
- package/lib/components/DatasetDownloads/datasetdownloads.test.js +0 -30
- package/lib/components/DatasetDownloads/index.js +0 -34
- package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +0 -103
- package/lib/components/DatasetSearchFacets/index.js +0 -104
- package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +0 -44
- package/lib/components/DatasetSearchListItem/index.js +0 -86
- package/lib/components/DatasetTags/datasettags.test.js +0 -40
- package/lib/components/DatasetTags/index.js +0 -38
- package/lib/components/Hero/index.js +0 -92
- package/lib/components/ManageColumns/index.js +0 -36
- package/lib/components/NavBar/index.js +0 -55
- package/lib/components/NavLink/index.js +0 -60
- package/lib/components/NavLink/navlink.test.js +0 -35
- package/lib/components/Pagination/index.js +0 -263
- package/lib/components/Pagination/pagination.test.js +0 -541
- package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +0 -20
- package/lib/components/ResourceConditionField/index.js +0 -246
- package/lib/components/ResourceFilter/index.js +0 -174
- package/lib/components/ResourceFilter/resourcefilter.test.js +0 -440
- package/lib/components/ResourceFooter/index.js +0 -34
- package/lib/components/ResourceHeader/index.js +0 -149
- package/lib/components/ResourceInformation/index.js +0 -37
- package/lib/components/ResourcePreview/index.js +0 -139
- package/lib/components/SearchModal/index.js +0 -116
- package/lib/components/SubMenu/index.js +0 -86
- package/lib/components/TransformedDate/index.js +0 -34
- package/lib/components/useAddLoginLink/index.js +0 -44
- package/lib/components/useScrollToTop/index.js +0 -22
- package/lib/index.js +0 -247
- package/lib/templates/APIPage/index.js +0 -30
- package/lib/templates/Dataset/DatasetBody.js +0 -189
- package/lib/templates/Dataset/index.js +0 -83
- package/lib/templates/DatasetSearch/datasetsearch.test.js +0 -122
- package/lib/templates/DatasetSearch/index.js +0 -356
- package/lib/templates/DrupalPage/index.js +0 -37
- package/lib/templates/FilteredResource/FilteredResourceBody.js +0 -160
- package/lib/templates/FilteredResource/QueryBuilder.js +0 -235
- package/lib/templates/FilteredResource/QueryRow.js +0 -175
- package/lib/templates/FilteredResource/QueryTitle.js +0 -89
- package/lib/templates/FilteredResource/functions.js +0 -142
- package/lib/templates/FilteredResource/index.js +0 -95
- package/lib/templates/Footer/footer.test.js +0 -48
- package/lib/templates/Footer/index.js +0 -366
- package/lib/templates/PageNotFound/index.js +0 -25
- package/lib/templates/header/index.js +0 -112
- package/lib/templates/mobile_header/index.js +0 -199
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _designSystem = require("@cmsgov/design-system");
|
|
17
|
-
|
|
18
|
-
var _reactDatepicker = _interopRequireDefault(require("react-datepicker"));
|
|
19
|
-
|
|
20
|
-
var _close = _interopRequireDefault(require("../../assets/icons/close"));
|
|
21
|
-
|
|
22
|
-
require("react-datepicker/dist/react-datepicker.css");
|
|
23
|
-
|
|
24
|
-
function convertUTCToLocalDate(date) {
|
|
25
|
-
if (!date) {
|
|
26
|
-
return date;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
date = new Date(date);
|
|
30
|
-
date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
31
|
-
return date;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function buildOperatorOptions(type) {
|
|
35
|
-
switch (type) {
|
|
36
|
-
case 'text': // Will change from text to string in future update
|
|
37
|
-
|
|
38
|
-
case 'string':
|
|
39
|
-
return [{
|
|
40
|
-
label: 'Is',
|
|
41
|
-
value: '='
|
|
42
|
-
}, {
|
|
43
|
-
label: 'Contains',
|
|
44
|
-
value: 'like'
|
|
45
|
-
}, {
|
|
46
|
-
label: 'Is Not',
|
|
47
|
-
value: '<>'
|
|
48
|
-
}, {
|
|
49
|
-
label: 'Or',
|
|
50
|
-
value: 'in'
|
|
51
|
-
}];
|
|
52
|
-
|
|
53
|
-
case 'date':
|
|
54
|
-
return [{
|
|
55
|
-
label: 'Is',
|
|
56
|
-
value: '='
|
|
57
|
-
}, {
|
|
58
|
-
label: 'Is Not',
|
|
59
|
-
value: '<>'
|
|
60
|
-
}, {
|
|
61
|
-
label: 'Greater Than',
|
|
62
|
-
value: '>'
|
|
63
|
-
}, {
|
|
64
|
-
label: 'Less Than',
|
|
65
|
-
value: '<'
|
|
66
|
-
}];
|
|
67
|
-
|
|
68
|
-
default:
|
|
69
|
-
// These 2 should be safe for all data types
|
|
70
|
-
return [{
|
|
71
|
-
label: 'Is',
|
|
72
|
-
value: '='
|
|
73
|
-
}, {
|
|
74
|
-
label: 'Is Not',
|
|
75
|
-
value: '<>'
|
|
76
|
-
}];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function cleanText(value, operator) {
|
|
81
|
-
var newValue = value;
|
|
82
|
-
|
|
83
|
-
if (Array.isArray(newValue)) {
|
|
84
|
-
newValue = newValue.join(',');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return newValue.replace(/(^\%+|\%+$)/gm, '');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var ResourceConditionField = function ResourceConditionField(_ref) {
|
|
91
|
-
var data = _ref.data,
|
|
92
|
-
index = _ref.index,
|
|
93
|
-
remove = _ref.remove,
|
|
94
|
-
schema = _ref.schema,
|
|
95
|
-
update = _ref.update;
|
|
96
|
-
var fields = schema.fields;
|
|
97
|
-
|
|
98
|
-
var _React$useState = _react["default"].useState(data.value ? new Date(data.value) : new Date()),
|
|
99
|
-
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
100
|
-
startDate = _React$useState2[0],
|
|
101
|
-
setStartDate = _React$useState2[1];
|
|
102
|
-
|
|
103
|
-
var _React$useState3 = _react["default"].useState(Object.keys(fields).map(function (key) {
|
|
104
|
-
return {
|
|
105
|
-
label: fields[key].description ? fields[key].description : key,
|
|
106
|
-
value: key
|
|
107
|
-
};
|
|
108
|
-
})),
|
|
109
|
-
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
110
|
-
propertyOptions = _React$useState4[0],
|
|
111
|
-
setPropertyOptions = _React$useState4[1];
|
|
112
|
-
|
|
113
|
-
var _React$useState5 = _react["default"].useState(data.property),
|
|
114
|
-
_React$useState6 = (0, _slicedToArray2["default"])(_React$useState5, 2),
|
|
115
|
-
property = _React$useState6[0],
|
|
116
|
-
setProperty = _React$useState6[1];
|
|
117
|
-
|
|
118
|
-
var _React$useState7 = _react["default"].useState(data.operator),
|
|
119
|
-
_React$useState8 = (0, _slicedToArray2["default"])(_React$useState7, 2),
|
|
120
|
-
operator = _React$useState8[0],
|
|
121
|
-
setOperator = _React$useState8[1];
|
|
122
|
-
|
|
123
|
-
var _React$useState9 = _react["default"].useState([{
|
|
124
|
-
label: '--',
|
|
125
|
-
value: ''
|
|
126
|
-
}]),
|
|
127
|
-
_React$useState10 = (0, _slicedToArray2["default"])(_React$useState9, 2),
|
|
128
|
-
operatorOptions = _React$useState10[0],
|
|
129
|
-
setOperatorOptions = _React$useState10[1];
|
|
130
|
-
|
|
131
|
-
var _React$useState11 = _react["default"].useState(data.value),
|
|
132
|
-
_React$useState12 = (0, _slicedToArray2["default"])(_React$useState11, 2),
|
|
133
|
-
value = _React$useState12[0],
|
|
134
|
-
setValue = _React$useState12[1];
|
|
135
|
-
|
|
136
|
-
_react["default"].useEffect(function () {
|
|
137
|
-
if (property) {
|
|
138
|
-
var opOptions = buildOperatorOptions(fields[property].mysql_type ? fields[property].mysql_type : fields[property].type).map(function (opt) {
|
|
139
|
-
return {
|
|
140
|
-
label: opt.label,
|
|
141
|
-
value: opt.value
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
update(index, 'property', property);
|
|
145
|
-
|
|
146
|
-
if (!operator) {
|
|
147
|
-
setOperator(opOptions[0].value);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
setOperatorOptions(opOptions);
|
|
151
|
-
|
|
152
|
-
if (fields[property].mysql_type && fields[property].mysql_type === 'date' || fields[property].type === 'date') {
|
|
153
|
-
setValue(startDate.toJSON().slice(0, 10));
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
update(index, 'property', property);
|
|
157
|
-
setOperator('');
|
|
158
|
-
setValue('');
|
|
159
|
-
setOperatorOptions([{
|
|
160
|
-
label: '--',
|
|
161
|
-
value: ''
|
|
162
|
-
}]);
|
|
163
|
-
}
|
|
164
|
-
}, [property, operator]);
|
|
165
|
-
|
|
166
|
-
_react["default"].useEffect(function () {
|
|
167
|
-
if (operator) {
|
|
168
|
-
update(index, 'operator', operator);
|
|
169
|
-
} else {
|
|
170
|
-
update(index, 'operator', '');
|
|
171
|
-
}
|
|
172
|
-
}, [operator]);
|
|
173
|
-
|
|
174
|
-
_react["default"].useEffect(function () {
|
|
175
|
-
if (value) {
|
|
176
|
-
update(index, 'value', value);
|
|
177
|
-
} else {
|
|
178
|
-
update(index, 'value', '');
|
|
179
|
-
}
|
|
180
|
-
}, [value]);
|
|
181
|
-
|
|
182
|
-
return /*#__PURE__*/_react["default"].createElement("fieldset", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
183
|
-
className: "ds-l-form-row"
|
|
184
|
-
}, /*#__PURE__*/_react["default"].createElement(_designSystem.Dropdown, {
|
|
185
|
-
options: [{
|
|
186
|
-
label: 'Select column',
|
|
187
|
-
value: ''
|
|
188
|
-
}].concat((0, _toConsumableArray2["default"])(propertyOptions)),
|
|
189
|
-
value: property,
|
|
190
|
-
onChange: function onChange(e) {
|
|
191
|
-
return setProperty(e.target.value);
|
|
192
|
-
},
|
|
193
|
-
label: "Filter column",
|
|
194
|
-
labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
|
|
195
|
-
name: "column_name_".concat(index),
|
|
196
|
-
className: "ds-l-col--6"
|
|
197
|
-
}), /*#__PURE__*/_react["default"].createElement(_designSystem.Dropdown, {
|
|
198
|
-
options: (0, _toConsumableArray2["default"])(operatorOptions),
|
|
199
|
-
value: operator,
|
|
200
|
-
disabled: !property ? true : false,
|
|
201
|
-
onChange: function onChange(e) {
|
|
202
|
-
return setOperator(e.target.value);
|
|
203
|
-
},
|
|
204
|
-
labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
|
|
205
|
-
size: "small",
|
|
206
|
-
label: "Filter operator",
|
|
207
|
-
name: "filter_operator_".concat(index),
|
|
208
|
-
className: "ds-l-col--3"
|
|
209
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
210
|
-
className: "ds-l-form-row"
|
|
211
|
-
}, property && (fields[property].mysql_type === 'date' || fields[property].type === 'date') ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
212
|
-
className: "ds-u-clearfix ds-l-col--11"
|
|
213
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactDatepicker["default"], {
|
|
214
|
-
selected: convertUTCToLocalDate(startDate),
|
|
215
|
-
onChange: function onChange(date) {
|
|
216
|
-
setStartDate(date);
|
|
217
|
-
setValue(date.toJSON().slice(0, 10));
|
|
218
|
-
},
|
|
219
|
-
showMonthDropdown: true,
|
|
220
|
-
showYearDropdown: true,
|
|
221
|
-
dropdownMode: "select",
|
|
222
|
-
className: "ds-c-field"
|
|
223
|
-
})) : /*#__PURE__*/_react["default"].createElement(_designSystem.TextField, {
|
|
224
|
-
hint: operator.toLowerCase() === 'in' ? "Separate values with a comma." : '',
|
|
225
|
-
value: cleanText(value, operator),
|
|
226
|
-
disabled: !property ? true : false,
|
|
227
|
-
onChange: function onChange(e) {
|
|
228
|
-
return setValue(e.target.value);
|
|
229
|
-
},
|
|
230
|
-
label: "Filter value",
|
|
231
|
-
labelClassName: "ds-u-margin-top--0",
|
|
232
|
-
name: "filter_value_".concat(index),
|
|
233
|
-
className: "ds-l-col--11"
|
|
234
|
-
}), /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
|
|
235
|
-
className: "ds-l-col--1",
|
|
236
|
-
variation: "transparent",
|
|
237
|
-
"aria-label": "Remove filter",
|
|
238
|
-
onClick: function onClick(e) {
|
|
239
|
-
e.preventDefault();
|
|
240
|
-
remove(index);
|
|
241
|
-
}
|
|
242
|
-
}, /*#__PURE__*/_react["default"].createElement(_close["default"], null))));
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
var _default = ResourceConditionField;
|
|
246
|
-
exports["default"] = _default;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
|
-
var _qs = _interopRequireDefault(require("qs"));
|
|
19
|
-
|
|
20
|
-
var _designSystem = require("@cmsgov/design-system");
|
|
21
|
-
|
|
22
|
-
var _ResourceConditionField = _interopRequireDefault(require("../ResourceConditionField"));
|
|
23
|
-
|
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
|
|
28
|
-
var ResourceFilter = function ResourceFilter(_ref) {
|
|
29
|
-
var id = _ref.id,
|
|
30
|
-
filterOpen = _ref.filterOpen,
|
|
31
|
-
setFilterOpen = _ref.setFilterOpen,
|
|
32
|
-
defaultCondition = _ref.defaultCondition,
|
|
33
|
-
resource = _ref.resource,
|
|
34
|
-
includeSearchParams = _ref.includeSearchParams;
|
|
35
|
-
var setConditions = resource.setConditions,
|
|
36
|
-
schema = resource.schema,
|
|
37
|
-
conditions = resource.conditions;
|
|
38
|
-
|
|
39
|
-
var _React$useState = _react["default"].useState(conditions && conditions.length ? conditions : [_objectSpread({}, defaultCondition)]),
|
|
40
|
-
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
41
|
-
formConditions = _React$useState2[0],
|
|
42
|
-
setFormConditions = _React$useState2[1];
|
|
43
|
-
|
|
44
|
-
_react["default"].useEffect(function () {
|
|
45
|
-
if (includeSearchParams) {
|
|
46
|
-
var url = new URL(window.location);
|
|
47
|
-
|
|
48
|
-
var urlString = _qs["default"].stringify({
|
|
49
|
-
conditions: conditions
|
|
50
|
-
}, {
|
|
51
|
-
encodeValuesOnly: true,
|
|
52
|
-
addQueryPrefix: true
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
window.history.pushState({}, '', "".concat(url.origin).concat(url.pathname).concat(urlString));
|
|
56
|
-
}
|
|
57
|
-
}, [conditions]);
|
|
58
|
-
|
|
59
|
-
function removeByIndex(index) {
|
|
60
|
-
var newConditions = (0, _toConsumableArray2["default"])(formConditions);
|
|
61
|
-
newConditions.splice(index, 1);
|
|
62
|
-
setFormConditions(newConditions);
|
|
63
|
-
setConditions(newConditions);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function updateByIndex(index, key, value) {
|
|
67
|
-
var newConditions = (0, _toConsumableArray2["default"])(formConditions);
|
|
68
|
-
newConditions[index][key] = value;
|
|
69
|
-
setFormConditions(newConditions);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function removeAll() {
|
|
73
|
-
setFormConditions([]);
|
|
74
|
-
setConditions([]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function submitFilters(e) {
|
|
78
|
-
e.preventDefault();
|
|
79
|
-
|
|
80
|
-
if (formConditions.length) {
|
|
81
|
-
var updatedConditions = formConditions.filter(function (cond) {
|
|
82
|
-
if (cond.property) {
|
|
83
|
-
return cond;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return false;
|
|
87
|
-
}).map(function (cond) {
|
|
88
|
-
if (cond.operator === '=' || cond.operator === '<>') {
|
|
89
|
-
if (Array.isArray(cond.value)) {
|
|
90
|
-
cond.value = cond.value.join();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
cond.value = cond.value.replace(/(^\%+|\%+$)/gm, '');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (cond.operator.toLowerCase() === 'like') {
|
|
97
|
-
if (Array.isArray(cond.value)) {
|
|
98
|
-
cond.value = cond.value.join();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
var cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, '');
|
|
102
|
-
cond.value = "%".concat(cleanedValue, "%");
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (cond.operator.toLowerCase() === 'in') {
|
|
106
|
-
if (!Array.isArray(cond.value)) {
|
|
107
|
-
cond.value = cond.value.split(',');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (Array.isArray(cond.value)) {
|
|
112
|
-
cond.value = cond.value.map(function (v) {
|
|
113
|
-
return v.trim().replace(/(^\%+|\%+$)/gm, '');
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return cond;
|
|
118
|
-
});
|
|
119
|
-
setConditions(updatedConditions);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return /*#__PURE__*/_react["default"].createElement(_designSystem.HelpDrawer, {
|
|
124
|
-
footerTitle: "Update actions",
|
|
125
|
-
footerBody: /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
|
|
126
|
-
className: "ds-u-margin-right--1",
|
|
127
|
-
onClick: function onClick(e) {
|
|
128
|
-
return submitFilters(e, formConditions);
|
|
129
|
-
}
|
|
130
|
-
}, "Update table"),
|
|
131
|
-
heading: "Add filters",
|
|
132
|
-
className: "dc-c-filterd-resouce-drawer",
|
|
133
|
-
onCloseClick: function onCloseClick() {
|
|
134
|
-
setFilterOpen(!filterOpen);
|
|
135
|
-
}
|
|
136
|
-
}, /*#__PURE__*/_react["default"].createElement("form", {
|
|
137
|
-
onSubmit: function onSubmit(e) {
|
|
138
|
-
return submitFilters(e, formConditions);
|
|
139
|
-
}
|
|
140
|
-
}, Object.keys(schema).length && formConditions.map(function (f, index) {
|
|
141
|
-
return /*#__PURE__*/_react["default"].createElement(_ResourceConditionField["default"], {
|
|
142
|
-
key: index,
|
|
143
|
-
data: f,
|
|
144
|
-
index: index,
|
|
145
|
-
remove: removeByIndex,
|
|
146
|
-
schema: schema[id],
|
|
147
|
-
update: updateByIndex
|
|
148
|
-
});
|
|
149
|
-
}), /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
|
|
150
|
-
className: "ds-u-margin-right--1",
|
|
151
|
-
variation: "transparent",
|
|
152
|
-
onClick: function onClick(e) {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
setFormConditions([].concat((0, _toConsumableArray2["default"])(formConditions), [_objectSpread({}, defaultCondition)]));
|
|
155
|
-
}
|
|
156
|
-
}, "+ Add another filter")), formConditions.length > 1 ? /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
|
|
157
|
-
variation: "transparent",
|
|
158
|
-
onClick: function onClick(e) {
|
|
159
|
-
e.preventDefault();
|
|
160
|
-
removeAll();
|
|
161
|
-
}
|
|
162
|
-
}, "Remove all filters") : '');
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
ResourceFilter.defaultProps = {
|
|
166
|
-
defaultCondition: {
|
|
167
|
-
property: '',
|
|
168
|
-
value: '',
|
|
169
|
-
operator: ''
|
|
170
|
-
},
|
|
171
|
-
includeSearchParams: true
|
|
172
|
-
};
|
|
173
|
-
var _default = ResourceFilter;
|
|
174
|
-
exports["default"] = _default;
|