@k-int/stripes-kint-components 2.3.1 → 2.4.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/CHANGELOG.md +15 -1
- package/es/index.js +26 -2
- package/es/lib/ActionList/ActionListFieldArray.js +3 -4
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +9 -6
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +22 -15
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +3 -2
- package/es/lib/FormModal/FormModal.js +2 -0
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +61 -105
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +146 -0
- package/es/lib/SASQLookupComponent/TableBody/index.js +19 -0
- package/es/lib/SASQLookupComponent/index.js +9 -1
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/utils/highlightString.js +94 -0
- package/es/lib/utils/index.js +23 -1
- package/es/lib/utils/matchString.js +59 -0
- package/package.json +1 -1
- package/src/index.js +6 -1
- package/src/lib/ActionList/ActionListFieldArray.js +2 -3
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +9 -6
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +13 -8
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +2 -2
- package/src/lib/FormModal/FormModal.js +2 -0
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +39 -77
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +96 -0
- package/src/lib/SASQLookupComponent/TableBody/index.js +1 -0
- package/src/lib/SASQLookupComponent/index.js +2 -1
- package/src/lib/SASQRoute/SASQRoute.js +1 -1
- package/src/lib/utils/highlightString.js +42 -0
- package/src/lib/utils/index.js +4 -0
- package/src/lib/utils/matchString.js +14 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _reactRouterDom = require("react-router-dom");
|
|
11
|
+
|
|
12
|
+
var _components = require("@folio/stripes/components");
|
|
13
|
+
|
|
14
|
+
var _NoResultsMessage = _interopRequireDefault(require("../../NoResultsMessage"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
(function () {
|
|
21
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
22
|
+
enterModule && enterModule(module);
|
|
23
|
+
})();
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
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) { _defineProperty(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; }
|
|
28
|
+
|
|
29
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
30
|
+
|
|
31
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
32
|
+
return a;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var TableBody = function TableBody(_ref) {
|
|
36
|
+
var _query$sort;
|
|
37
|
+
|
|
38
|
+
var data = _ref.data,
|
|
39
|
+
error = _ref.error,
|
|
40
|
+
fetchNextPage = _ref.fetchNextPage,
|
|
41
|
+
filterPaneVisible = _ref.filterPaneVisible,
|
|
42
|
+
isError = _ref.isError,
|
|
43
|
+
isLoading = _ref.isLoading,
|
|
44
|
+
match = _ref.match,
|
|
45
|
+
mclProps = _ref.mclProps,
|
|
46
|
+
onSort = _ref.onSort,
|
|
47
|
+
path = _ref.path,
|
|
48
|
+
resultColumns = _ref.resultColumns,
|
|
49
|
+
toggleFilterPane = _ref.toggleFilterPane,
|
|
50
|
+
query = _ref.query;
|
|
51
|
+
var sortOrder = (_query$sort = query.sort) !== null && _query$sort !== void 0 ? _query$sort : '';
|
|
52
|
+
var history = (0, _reactRouterDom.useHistory)();
|
|
53
|
+
var location = (0, _reactRouterDom.useLocation)();
|
|
54
|
+
|
|
55
|
+
var onNeedMoreData = function onNeedMoreData(_askAmount, index) {
|
|
56
|
+
fetchNextPage({
|
|
57
|
+
pageParam: index
|
|
58
|
+
});
|
|
59
|
+
}; // Build the map of column definitions
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var columnMapping = Object.fromEntries(resultColumns.map(function (e) {
|
|
63
|
+
return [e.propertyPath, e.label];
|
|
64
|
+
})); // Build the list of visible columns
|
|
65
|
+
|
|
66
|
+
var visibleColumns = resultColumns.map(function (e) {
|
|
67
|
+
return e.propertyPath;
|
|
68
|
+
});
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, _objectSpread({
|
|
70
|
+
autosize: true,
|
|
71
|
+
columnMapping: columnMapping,
|
|
72
|
+
contentData: data === null || data === void 0 ? void 0 : data.results,
|
|
73
|
+
hasMargin: true,
|
|
74
|
+
isEmptyMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoResultsMessage.default, {
|
|
75
|
+
error: error,
|
|
76
|
+
isError: isError,
|
|
77
|
+
isLoading: isLoading,
|
|
78
|
+
filterPaneIsVisible: filterPaneVisible,
|
|
79
|
+
searchTerm: query.query,
|
|
80
|
+
toggleFilterPane: toggleFilterPane
|
|
81
|
+
}),
|
|
82
|
+
isSelected: function isSelected(_ref2) {
|
|
83
|
+
var _match$params;
|
|
84
|
+
|
|
85
|
+
var item = _ref2.item;
|
|
86
|
+
return item.id === (match === null || match === void 0 ? void 0 : (_match$params = match.params) === null || _match$params === void 0 ? void 0 : _match$params.id);
|
|
87
|
+
},
|
|
88
|
+
onHeaderClick: onSort,
|
|
89
|
+
onNeedMoreData: onNeedMoreData,
|
|
90
|
+
onRowClick: function onRowClick(_e, rowData) {
|
|
91
|
+
history.push("".concat(path, "/").concat(rowData === null || rowData === void 0 ? void 0 : rowData.id).concat(location === null || location === void 0 ? void 0 : location.search));
|
|
92
|
+
},
|
|
93
|
+
pagingType: "click",
|
|
94
|
+
sortDirection: sortOrder.startsWith('-') ? 'descending' : 'ascending',
|
|
95
|
+
sortOrder: sortOrder.replace(/^-/, '').replace(/,.*/, ''),
|
|
96
|
+
totalCount: data.totalRecords,
|
|
97
|
+
visibleColumns: visibleColumns
|
|
98
|
+
}, mclProps));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
__signature__(TableBody, "useHistory{history}\nuseLocation{location}", function () {
|
|
102
|
+
return [_reactRouterDom.useHistory, _reactRouterDom.useLocation];
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
TableBody.propTypes = {
|
|
106
|
+
data: _propTypes.default.shape({
|
|
107
|
+
totalRecords: _propTypes.default.number,
|
|
108
|
+
results: _propTypes.default.arrayOf(_propTypes.default.object)
|
|
109
|
+
}),
|
|
110
|
+
error: _propTypes.default.object,
|
|
111
|
+
fetchNextPage: _propTypes.default.func,
|
|
112
|
+
filterPaneVisible: _propTypes.default.bool,
|
|
113
|
+
history: _propTypes.default.object,
|
|
114
|
+
isError: _propTypes.default.bool,
|
|
115
|
+
isLoading: _propTypes.default.bool,
|
|
116
|
+
location: _propTypes.default.object,
|
|
117
|
+
match: _propTypes.default.object,
|
|
118
|
+
mclProps: _propTypes.default.object,
|
|
119
|
+
onSort: _propTypes.default.func,
|
|
120
|
+
path: _propTypes.default.string.isRequired,
|
|
121
|
+
query: _propTypes.default.object,
|
|
122
|
+
resultColumns: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
123
|
+
toggleFilterPane: _propTypes.default.func
|
|
124
|
+
};
|
|
125
|
+
var _default = TableBody;
|
|
126
|
+
var _default2 = _default;
|
|
127
|
+
exports.default = _default2;
|
|
128
|
+
;
|
|
129
|
+
|
|
130
|
+
(function () {
|
|
131
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
132
|
+
|
|
133
|
+
if (!reactHotLoader) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
reactHotLoader.register(TableBody, "TableBody", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQLookupComponent/TableBody/TableBody.js");
|
|
138
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQLookupComponent/TableBody/TableBody.js");
|
|
139
|
+
})();
|
|
140
|
+
|
|
141
|
+
;
|
|
142
|
+
|
|
143
|
+
(function () {
|
|
144
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
145
|
+
leaveModule && leaveModule(module);
|
|
146
|
+
})();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _TableBody.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _TableBody = _interopRequireDefault(require("./TableBody"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
@@ -3,15 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "SASQLookupComponent", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
9
|
return _SASQLookupComponent.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "TableBody", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _TableBody.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
|
|
13
19
|
var _SASQLookupComponent = _interopRequireDefault(require("./SASQLookupComponent"));
|
|
14
20
|
|
|
21
|
+
var _TableBody = _interopRequireDefault(require("./TableBody"));
|
|
22
|
+
|
|
15
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
24
|
|
|
17
25
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _reactRouterDom = require("react-router-dom");
|
|
13
13
|
|
|
14
|
-
var _SASQLookupComponent =
|
|
14
|
+
var _SASQLookupComponent = require("../SASQLookupComponent");
|
|
15
15
|
|
|
16
16
|
var _SASQViewComponent = _interopRequireDefault(require("../SASQViewComponent"));
|
|
17
17
|
|
|
@@ -60,7 +60,7 @@ var SASQRoute = function SASQRoute(_ref) {
|
|
|
60
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
61
61
|
path: "".concat(path, "/:id?"),
|
|
62
62
|
render: function render(routeProps) {
|
|
63
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.SASQLookupComponent, _objectSpread(_objectSpread(_objectSpread({}, routeProps), {}, {
|
|
64
64
|
fetchParameters: fetchParameters,
|
|
65
65
|
path: path
|
|
66
66
|
}, props), {}, {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.highlightString = exports.boldString = void 0;
|
|
7
|
+
|
|
8
|
+
var _matchString5 = _interopRequireDefault(require("./matchString"));
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
(function () {
|
|
15
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
16
|
+
enterModule && enterModule(module);
|
|
17
|
+
})();
|
|
18
|
+
|
|
19
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
+
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
|
|
23
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
+
|
|
27
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
28
|
+
|
|
29
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
+
|
|
31
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
32
|
+
return a;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var highlightString = function highlightString(match, str) {
|
|
36
|
+
var ignoreNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
37
|
+
|
|
38
|
+
var _matchString = (0, _matchString5.default)(match, str, ignoreNull),
|
|
39
|
+
_matchString2 = _slicedToArray(_matchString, 2),
|
|
40
|
+
parts = _matchString2[0],
|
|
41
|
+
regex = _matchString2[1];
|
|
42
|
+
|
|
43
|
+
return parts.filter(function (part) {
|
|
44
|
+
return part;
|
|
45
|
+
}).map(function (part, i) {
|
|
46
|
+
return regex.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("mark", {
|
|
47
|
+
children: part
|
|
48
|
+
}, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
49
|
+
children: part
|
|
50
|
+
}, i);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.highlightString = highlightString;
|
|
55
|
+
|
|
56
|
+
var boldString = function boldString(match, str) {
|
|
57
|
+
var ignoreNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
58
|
+
|
|
59
|
+
var _matchString3 = (0, _matchString5.default)(match, str, ignoreNull),
|
|
60
|
+
_matchString4 = _slicedToArray(_matchString3, 2),
|
|
61
|
+
parts = _matchString4[0],
|
|
62
|
+
regex = _matchString4[1];
|
|
63
|
+
|
|
64
|
+
return parts.filter(function (part) {
|
|
65
|
+
return part;
|
|
66
|
+
}).map(function (part, i) {
|
|
67
|
+
return regex.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
68
|
+
children: part
|
|
69
|
+
}, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
70
|
+
children: part
|
|
71
|
+
}, i);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.boldString = boldString;
|
|
76
|
+
;
|
|
77
|
+
|
|
78
|
+
(function () {
|
|
79
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
80
|
+
|
|
81
|
+
if (!reactHotLoader) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
reactHotLoader.register(highlightString, "highlightString", "/home/ethan/FolioModules/stripes-kint-components/src/lib/utils/highlightString.js");
|
|
86
|
+
reactHotLoader.register(boldString, "boldString", "/home/ethan/FolioModules/stripes-kint-components/src/lib/utils/highlightString.js");
|
|
87
|
+
})();
|
|
88
|
+
|
|
89
|
+
;
|
|
90
|
+
|
|
91
|
+
(function () {
|
|
92
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
93
|
+
leaveModule && leaveModule(module);
|
|
94
|
+
})();
|
package/es/lib/utils/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "boldString", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _highlightString.boldString;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "buildUrl", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -27,6 +33,18 @@ Object.defineProperty(exports, "groupCustomPropertiesByCtx", {
|
|
|
27
33
|
return _groupCustomPropertiesByCtx.default;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "highlightString", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _highlightString.highlightString;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "matchString", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _matchString.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
Object.defineProperty(exports, "refdataOptions", {
|
|
31
49
|
enumerable: true,
|
|
32
50
|
get: function get() {
|
|
@@ -92,8 +110,12 @@ var _sortByLabel = _interopRequireDefault(require("./sortByLabel"));
|
|
|
92
110
|
|
|
93
111
|
var _toCamelCase = _interopRequireDefault(require("./toCamelCase"));
|
|
94
112
|
|
|
113
|
+
var _matchString = _interopRequireDefault(require("./matchString"));
|
|
114
|
+
|
|
115
|
+
var _highlightString = require("./highlightString");
|
|
116
|
+
|
|
95
117
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
96
118
|
|
|
97
119
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
98
120
|
return a;
|
|
99
|
-
};
|
|
121
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _escapeRegExp = _interopRequireDefault(require("lodash/escapeRegExp"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
(function () {
|
|
13
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
14
|
+
enterModule && enterModule(module);
|
|
15
|
+
})();
|
|
16
|
+
|
|
17
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var matchString = function matchString(match, str) {
|
|
22
|
+
var ignoreNull = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
23
|
+
var regex = new RegExp("".concat(match.split(/(\s+)/).filter(function (h) {
|
|
24
|
+
return h.trim();
|
|
25
|
+
}).map(function (hl) {
|
|
26
|
+
return '(' + (0, _escapeRegExp.default)(hl) + ')';
|
|
27
|
+
}).join('|')), 'gi');
|
|
28
|
+
|
|
29
|
+
if (ignoreNull && !match) {
|
|
30
|
+
var nullRegex = /a^/gi; // Should match nothing
|
|
31
|
+
|
|
32
|
+
return [[str], nullRegex];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return [str.split(regex), regex];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var _default = matchString;
|
|
39
|
+
var _default2 = _default;
|
|
40
|
+
exports.default = _default2;
|
|
41
|
+
;
|
|
42
|
+
|
|
43
|
+
(function () {
|
|
44
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
45
|
+
|
|
46
|
+
if (!reactHotLoader) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
reactHotLoader.register(matchString, "matchString", "/home/ethan/FolioModules/stripes-kint-components/src/lib/utils/matchString.js");
|
|
51
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/utils/matchString.js");
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
;
|
|
55
|
+
|
|
56
|
+
(function () {
|
|
57
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
58
|
+
leaveModule && leaveModule(module);
|
|
59
|
+
})();
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -18,9 +18,12 @@ export {
|
|
|
18
18
|
|
|
19
19
|
// Useful utility functions
|
|
20
20
|
export {
|
|
21
|
+
boldString,
|
|
21
22
|
generateKiwtQuery,
|
|
22
23
|
generateKiwtQueryParams,
|
|
23
24
|
groupCustomPropertiesByCtx,
|
|
25
|
+
highlightString,
|
|
26
|
+
matchString,
|
|
24
27
|
refdataOptions,
|
|
25
28
|
refdataQueryKey,
|
|
26
29
|
selectorSafe,
|
|
@@ -59,6 +62,7 @@ export {
|
|
|
59
62
|
default as QueryTypedown
|
|
60
63
|
} from './lib/QueryTypedown';
|
|
61
64
|
|
|
65
|
+
/* SASQ Stuff */
|
|
62
66
|
// SearchField
|
|
63
67
|
export {
|
|
64
68
|
default as SearchField
|
|
@@ -71,7 +75,8 @@ export {
|
|
|
71
75
|
|
|
72
76
|
// SASQLookupComponent
|
|
73
77
|
export {
|
|
74
|
-
|
|
78
|
+
SASQLookupComponent,
|
|
79
|
+
TableBody as SASQTableBody
|
|
75
80
|
} from './lib/SASQLookupComponent';
|
|
76
81
|
|
|
77
82
|
// SASQViewComponent
|
|
@@ -61,7 +61,7 @@ const ActionListFieldArray = ({
|
|
|
61
61
|
const { actionListActions: _a, ...rowData } = fields.value[index];
|
|
62
62
|
|
|
63
63
|
// Find "edit" entry in actionAssigner
|
|
64
|
-
const editCallback = actionAssigner
|
|
64
|
+
const editCallback = actionAssigner(rowData)?.find(act => act.name === 'edit')?.callback;
|
|
65
65
|
if (editCallback) {
|
|
66
66
|
editCallback(rowData);
|
|
67
67
|
} else {
|
|
@@ -167,7 +167,6 @@ const ActionListFieldArray = ({
|
|
|
167
167
|
key={`action-${action.name}[${data.rowIndex}]`}
|
|
168
168
|
disabled={editing}
|
|
169
169
|
icon={action.icon}
|
|
170
|
-
marginBottom0
|
|
171
170
|
onClick={() => (actionFunction ? actionFunction() : () => null)}
|
|
172
171
|
to={action.to}
|
|
173
172
|
/>
|
|
@@ -229,7 +228,7 @@ const ActionListFieldArray = ({
|
|
|
229
228
|
name: `${fieldName}.${key}`
|
|
230
229
|
}) :
|
|
231
230
|
<Field
|
|
232
|
-
|
|
231
|
+
autoFocus={fieldIndex === 0}
|
|
233
232
|
component={TextField}
|
|
234
233
|
marginBottom0
|
|
235
234
|
name={`${fieldName}.${key}`}
|
|
@@ -78,20 +78,23 @@ const CustomPropertiesSettings = ({
|
|
|
78
78
|
delete: deleteCustProp
|
|
79
79
|
} = useMutateCustomProperties({
|
|
80
80
|
afterQueryCalls: {
|
|
81
|
-
put:
|
|
81
|
+
put: res => {
|
|
82
82
|
setMode(VIEWING);
|
|
83
83
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
84
|
-
|
|
84
|
+
setCustomProperty(res);
|
|
85
|
+
afterQueryCallsSafe.put(res);
|
|
85
86
|
},
|
|
86
|
-
post:
|
|
87
|
+
post: res => {
|
|
87
88
|
setMode(VIEWING);
|
|
88
89
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
89
|
-
|
|
90
|
+
setCustomProperty(res);
|
|
91
|
+
afterQueryCallsSafe.post(res);
|
|
90
92
|
},
|
|
91
|
-
delete:
|
|
93
|
+
delete: res => {
|
|
92
94
|
setMode(VIEWING);
|
|
93
95
|
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
94
|
-
|
|
96
|
+
setCustomProperty();
|
|
97
|
+
afterQueryCallsSafe.delete(res);
|
|
95
98
|
}
|
|
96
99
|
},
|
|
97
100
|
endpoint: customPropertiesEndpoint,
|
|
@@ -69,21 +69,26 @@ const CustomPropertiesViewCtx = ({
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
const countSetProperties = (primary) => (
|
|
73
|
+
Object.entries(customProperties)?.filter(
|
|
74
|
+
([_key, cp]) => (
|
|
75
|
+
(cp[0]?.type?.ctx === ctx || (ctx === 'isNull' && !cp[0]?.type?.ctx)) && // Either the ctx string matches, or isNull matches blank
|
|
76
|
+
cp[0]?.type?.primary === primary // Only count non-primary set custprops
|
|
77
|
+
)
|
|
78
|
+
)?.length ?? 0
|
|
79
|
+
);
|
|
80
|
+
|
|
72
81
|
// We need to display any set properties, along with any non-set primary properties
|
|
73
82
|
const primaryCount = custprops?.filter(cp => cp.primary === true)?.length ?? 0;
|
|
74
|
-
const optionalCount =
|
|
75
|
-
|
|
76
|
-
(cp[0]?.type?.ctx === ctx || (ctx === 'isNull' && !cp[0]?.type?.ctx)) && // Either the ctx string matches, or isNull matches blank
|
|
77
|
-
cp[0]?.type?.primary === false // Only count non-primary set custprops
|
|
78
|
-
)
|
|
79
|
-
)?.length ?? 0;
|
|
83
|
+
const optionalCount = countSetProperties(false);
|
|
84
|
+
const setPrimaryCount = countSetProperties(true);
|
|
80
85
|
|
|
81
86
|
return (
|
|
82
87
|
(primaryCount + optionalCount) > 0 &&
|
|
83
88
|
<Accordion
|
|
84
89
|
closedByDefault
|
|
85
|
-
displayWhenClosed={<Badge>{
|
|
86
|
-
displayWhenOpen={<Badge>{
|
|
90
|
+
displayWhenClosed={<Badge>{setPrimaryCount + optionalCount}</Badge>}
|
|
91
|
+
displayWhenOpen={<Badge>{setPrimaryCount + optionalCount}</Badge>}
|
|
87
92
|
id={`${id}-accordion-${ctx}`}
|
|
88
93
|
label={getAccordionLabel()}
|
|
89
94
|
>
|
|
@@ -16,7 +16,7 @@ import * as CUSTPROP_TYPES from '../../constants/customProperties';
|
|
|
16
16
|
const CustomPropertyCard = ({
|
|
17
17
|
ctx,
|
|
18
18
|
customProperty,
|
|
19
|
-
customPropertyDefinition,
|
|
19
|
+
customPropertyDefinition = {},
|
|
20
20
|
index,
|
|
21
21
|
labelOverrides
|
|
22
22
|
}) => {
|
|
@@ -35,7 +35,7 @@ const CustomPropertyCard = ({
|
|
|
35
35
|
// Label override for default card title,
|
|
36
36
|
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
37
37
|
return (
|
|
38
|
-
labelOverrides.retiredName(customPropertyDefinition)
|
|
38
|
+
labelOverrides.retiredName(customPropertyDefinition.name)
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -31,6 +31,7 @@ const FormModal = ({
|
|
|
31
31
|
<ModalFooter>
|
|
32
32
|
<Button
|
|
33
33
|
buttonStyle="primary"
|
|
34
|
+
marginBottom0
|
|
34
35
|
onClick={handleSubmit}
|
|
35
36
|
>
|
|
36
37
|
{
|
|
@@ -39,6 +40,7 @@ const FormModal = ({
|
|
|
39
40
|
}
|
|
40
41
|
</Button>
|
|
41
42
|
<Button
|
|
43
|
+
marginBottom0
|
|
42
44
|
onClick={handleClose}
|
|
43
45
|
>
|
|
44
46
|
{
|