@k-int/stripes-kint-components 2.2.0 → 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/CHANGELOG.md +21 -0
- package/es/index.js +124 -4
- package/es/lib/ActionList/ActionList.js +7 -2
- package/es/lib/ActionList/ActionListFieldArray.js +49 -10
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +2 -2
- package/es/lib/CustomProperties/Config/{CustomPropertiesView.js → CustomPropertyView.js} +5 -5
- package/es/lib/CustomProperties/Config/index.js +6 -4
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +72 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +133 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +279 -0
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +370 -0
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +156 -0
- package/es/lib/CustomProperties/Edit/index.js +51 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +216 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +236 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +159 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +119 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +173 -0
- package/es/lib/CustomProperties/Filter/index.js +59 -0
- package/es/lib/CustomProperties/Filter/useOperators.js +138 -0
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +97 -0
- package/es/lib/CustomProperties/Filter/useValueProps.js +101 -0
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +73 -0
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +187 -0
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +204 -0
- package/es/lib/CustomProperties/View/index.js +35 -0
- package/es/lib/CustomProperties/index.js +125 -0
- package/es/lib/EditableRefdataList/EditableRefdataList.js +12 -16
- package/es/lib/FormModal/FormModal.js +18 -4
- package/es/lib/QueryTypedown/QueryTypedown.js +9 -4
- package/es/lib/constants/customProperties.js +4 -1
- package/es/lib/hooks/index.js +16 -0
- package/es/lib/hooks/typedownHooks/useTypedownData.js +9 -2
- package/es/lib/hooks/useAvailableCustomProperties.js +106 -0
- package/es/lib/hooks/useInvalidateRefdata.js +53 -0
- package/es/lib/hooks/useMutateRefdataValue.js +11 -6
- package/es/lib/hooks/useRefdata.js +1 -3
- package/es/lib/utils/groupCustomPropertiesByCtx.js +69 -0
- package/es/lib/utils/index.js +24 -0
- package/es/lib/utils/refdataQueryKey.js +48 -0
- package/es/lib/utils/typedownQueryKey.js +48 -0
- package/es/lib/utils/validators.js +60 -1
- package/git_translate.sh +8 -0
- package/package.json +1 -1
- package/src/index.js +27 -3
- package/src/lib/ActionList/ActionList.js +5 -2
- package/src/lib/ActionList/ActionListFieldArray.js +31 -8
- package/src/lib/ActionList/README.md +23 -20
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +2 -2
- package/src/lib/CustomProperties/Config/{CustomPropertiesView.js → CustomPropertyView.js} +3 -3
- package/src/lib/CustomProperties/Config/index.js +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +35 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +85 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +194 -0
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +299 -0
- package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +131 -0
- package/src/lib/CustomProperties/Edit/index.js +5 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +125 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +148 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +113 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +74 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +122 -0
- package/src/lib/CustomProperties/Filter/index.js +6 -0
- package/src/lib/CustomProperties/Filter/useOperators.js +55 -0
- package/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +35 -0
- package/src/lib/CustomProperties/Filter/useValueProps.js +45 -0
- package/src/lib/CustomProperties/View/CustomPropertiesView.js +36 -0
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +112 -0
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +177 -0
- package/src/lib/CustomProperties/View/index.js +3 -0
- package/src/lib/CustomProperties/index.js +30 -0
- package/src/lib/EditableRefdataList/EditableRefdataList.js +13 -10
- package/src/lib/FormModal/FormModal.js +37 -17
- package/src/lib/QueryTypedown/QueryTypedown.js +3 -1
- package/src/lib/constants/customProperties.js +1 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/typedownHooks/useTypedownData.js +9 -3
- package/src/lib/hooks/useAvailableCustomProperties.js +40 -0
- package/src/lib/hooks/useInvalidateRefdata.js +11 -0
- package/src/lib/hooks/useMutateRefdataValue.js +7 -3
- package/src/lib/hooks/useRefdata.js +2 -3
- package/src/lib/utils/groupCustomPropertiesByCtx.js +13 -0
- package/src/lib/utils/index.js +5 -0
- package/src/lib/utils/refdataQueryKey.js +9 -0
- package/src/lib/utils/typedownQueryKey.js +9 -0
- package/src/lib/utils/validators.js +40 -0
- package/translate.sh +63 -0
- package/translations/stripes-kint-components/ar.json +105 -0
- package/translations/stripes-kint-components/ca.json +1 -0
- package/translations/stripes-kint-components/cs_CZ.json +105 -0
- package/translations/stripes-kint-components/da.json +1 -0
- package/translations/stripes-kint-components/de.json +105 -0
- package/translations/stripes-kint-components/en.json +54 -2
- package/translations/stripes-kint-components/es.json +105 -0
- package/translations/stripes-kint-components/fr.json +105 -0
- package/translations/stripes-kint-components/he.json +1 -0
- package/translations/stripes-kint-components/hi_IN.json +105 -0
- package/translations/stripes-kint-components/hu.json +105 -0
- package/translations/stripes-kint-components/it_IT.json +105 -0
- package/translations/stripes-kint-components/ja.json +105 -0
- package/translations/stripes-kint-components/ko.json +105 -0
- package/translations/stripes-kint-components/nb.json +1 -0
- package/translations/stripes-kint-components/nn.json +1 -0
- package/translations/stripes-kint-components/pl.json +105 -0
- package/translations/stripes-kint-components/pt_PT.json +105 -0
- package/translations/stripes-kint-components/ru.json +105 -0
- package/translations/stripes-kint-components/sv.json +105 -0
- package/translations/stripes-kint-components/ur.json +1 -0
- package/translations/stripes-kint-components/zh_CN.json +105 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _useOperators = _interopRequireDefault(require("./useOperators"));
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
|
|
19
|
+
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."); }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
|
|
29
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
30
|
+
return a;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var useParseActiveFilterStrings = function useParseActiveFilterStrings(filterStrings) {
|
|
34
|
+
var operators = (0, _useOperators.default)().map(function (o) {
|
|
35
|
+
return o.value;
|
|
36
|
+
});
|
|
37
|
+
var numberOfFilters = 0;
|
|
38
|
+
var filters = filterStrings.map(function (filter) {
|
|
39
|
+
var customProperty;
|
|
40
|
+
var rules = filter.split('||').map(function (ruleString) {
|
|
41
|
+
var _operators$find;
|
|
42
|
+
|
|
43
|
+
// ruleString is constructed in this.handleSubmit passed to CustomPropertyFiltersForm
|
|
44
|
+
// and has shape "customProperties.foo.value!=42"
|
|
45
|
+
var _ruleString$split = ruleString.split('.value'),
|
|
46
|
+
_ruleString$split2 = _slicedToArray(_ruleString$split, 2),
|
|
47
|
+
customPropertyPath = _ruleString$split2[0],
|
|
48
|
+
rule = _ruleString$split2[1];
|
|
49
|
+
|
|
50
|
+
customProperty = customPropertyPath.replace('customProperties.', '');
|
|
51
|
+
var operator = (_operators$find = operators.find(function (o) {
|
|
52
|
+
return rule.startsWith(o);
|
|
53
|
+
})) !== null && _operators$find !== void 0 ? _operators$find : '';
|
|
54
|
+
var value = rule.substring(operator.length);
|
|
55
|
+
numberOfFilters += 1;
|
|
56
|
+
return {
|
|
57
|
+
operator: operator,
|
|
58
|
+
value: value
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
customProperty: customProperty,
|
|
63
|
+
rules: rules
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
filters: filters,
|
|
68
|
+
numberOfFilters: numberOfFilters
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
__signature__(useParseActiveFilterStrings, "useOperators{}", function () {
|
|
73
|
+
return [_useOperators.default];
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
var _default = useParseActiveFilterStrings;
|
|
77
|
+
var _default2 = _default;
|
|
78
|
+
exports.default = _default2;
|
|
79
|
+
;
|
|
80
|
+
|
|
81
|
+
(function () {
|
|
82
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
83
|
+
|
|
84
|
+
if (!reactHotLoader) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
reactHotLoader.register(useParseActiveFilterStrings, "useParseActiveFilterStrings", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js");
|
|
89
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js");
|
|
90
|
+
})();
|
|
91
|
+
|
|
92
|
+
;
|
|
93
|
+
|
|
94
|
+
(function () {
|
|
95
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
96
|
+
leaveModule && leaveModule(module);
|
|
97
|
+
})();
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _components = require("@folio/stripes/components");
|
|
11
|
+
|
|
12
|
+
var CUSTPROP_TYPES = _interopRequireWildcard(require("../../constants/customProperties"));
|
|
13
|
+
|
|
14
|
+
var _validators = require("../../utils/validators");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
(function () {
|
|
21
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
22
|
+
enterModule && enterModule(module);
|
|
23
|
+
})();
|
|
24
|
+
|
|
25
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
26
|
+
return a;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var REFDATA = CUSTPROP_TYPES.REFDATA_CLASS_NAME,
|
|
30
|
+
DECIMAL = CUSTPROP_TYPES.DECIMAL_CLASS_NAME,
|
|
31
|
+
INTEGER = CUSTPROP_TYPES.INTEGER_CLASS_NAME,
|
|
32
|
+
DATE = CUSTPROP_TYPES.DATE_CLASS_NAME,
|
|
33
|
+
TEXT = CUSTPROP_TYPES.TEXT_CLASS_NAME;
|
|
34
|
+
|
|
35
|
+
var useValueProps = function useValueProps(custPropDefinition) {
|
|
36
|
+
var props = {
|
|
37
|
+
validate: _validators.required
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
switch (custPropDefinition.type) {
|
|
41
|
+
case INTEGER:
|
|
42
|
+
case DECIMAL:
|
|
43
|
+
props.component = _components.TextField;
|
|
44
|
+
props.type = 'number';
|
|
45
|
+
props.validate = _validators.invalidNumber;
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case REFDATA:
|
|
49
|
+
props.component = _components.Select;
|
|
50
|
+
props.dataOptions = custPropDefinition.category.values.map(function (rdv) {
|
|
51
|
+
return {
|
|
52
|
+
label: rdv.label,
|
|
53
|
+
value: rdv.id
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
props.placeholder = ' ';
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case DATE:
|
|
60
|
+
props.component = _components.Datepicker;
|
|
61
|
+
props.backendDateStandard = 'YYYY-MM-DD';
|
|
62
|
+
props.timeZone = 'UTC';
|
|
63
|
+
props.usePortal = true;
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case TEXT:
|
|
67
|
+
default:
|
|
68
|
+
props.component = _components.TextField;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return props;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var _default = useValueProps;
|
|
76
|
+
var _default2 = _default;
|
|
77
|
+
exports.default = _default2;
|
|
78
|
+
;
|
|
79
|
+
|
|
80
|
+
(function () {
|
|
81
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
82
|
+
|
|
83
|
+
if (!reactHotLoader) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
reactHotLoader.register(REFDATA, "REFDATA", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
88
|
+
reactHotLoader.register(DECIMAL, "DECIMAL", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
89
|
+
reactHotLoader.register(INTEGER, "INTEGER", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
90
|
+
reactHotLoader.register(DATE, "DATE", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
91
|
+
reactHotLoader.register(TEXT, "TEXT", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
92
|
+
reactHotLoader.register(useValueProps, "useValueProps", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
93
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Filter/useValueProps.js");
|
|
94
|
+
})();
|
|
95
|
+
|
|
96
|
+
;
|
|
97
|
+
|
|
98
|
+
(function () {
|
|
99
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
100
|
+
leaveModule && leaveModule(module);
|
|
101
|
+
})();
|
|
@@ -0,0 +1,73 @@
|
|
|
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 _CustomPropertiesViewCtx = _interopRequireDefault(require("./CustomPropertiesViewCtx"));
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
(function () {
|
|
17
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
18
|
+
enterModule && enterModule(module);
|
|
19
|
+
})();
|
|
20
|
+
|
|
21
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var CustomPropertiesView = function CustomPropertiesView(_ref) {
|
|
26
|
+
var _ref$contexts = _ref.contexts,
|
|
27
|
+
contexts = _ref$contexts === void 0 ? [] : _ref$contexts,
|
|
28
|
+
customProperties = _ref.customProperties,
|
|
29
|
+
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
30
|
+
id = _ref.id,
|
|
31
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
32
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides;
|
|
33
|
+
return contexts.map(function (ctx) {
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesViewCtx.default, {
|
|
35
|
+
ctx: ctx,
|
|
36
|
+
customProperties: customProperties,
|
|
37
|
+
customPropertiesEndpoint: customPropertiesEndpoint,
|
|
38
|
+
id: id,
|
|
39
|
+
labelOverrides: labelOverrides
|
|
40
|
+
}, "customPropertiesView-".concat(ctx));
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
CustomPropertiesView.propTypes = {
|
|
45
|
+
contexts: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
46
|
+
customProperties: _propTypes.default.object,
|
|
47
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
48
|
+
id: _propTypes.default.string,
|
|
49
|
+
labelOverrides: _propTypes.default.object,
|
|
50
|
+
nameOverride: _propTypes.default.string
|
|
51
|
+
};
|
|
52
|
+
var _default = CustomPropertiesView;
|
|
53
|
+
var _default2 = _default;
|
|
54
|
+
exports.default = _default2;
|
|
55
|
+
;
|
|
56
|
+
|
|
57
|
+
(function () {
|
|
58
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
59
|
+
|
|
60
|
+
if (!reactHotLoader) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
reactHotLoader.register(CustomPropertiesView, "CustomPropertiesView", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertiesView.js");
|
|
65
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertiesView.js");
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
;
|
|
69
|
+
|
|
70
|
+
(function () {
|
|
71
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
72
|
+
leaveModule && leaveModule(module);
|
|
73
|
+
})();
|
|
@@ -0,0 +1,187 @@
|
|
|
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 _reactIntl = require("react-intl");
|
|
11
|
+
|
|
12
|
+
var _components = require("@folio/stripes/components");
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../hooks");
|
|
15
|
+
|
|
16
|
+
var _CustomPropertyCard = _interopRequireDefault(require("./CustomPropertyCard"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
(function () {
|
|
23
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
24
|
+
enterModule && enterModule(module);
|
|
25
|
+
})();
|
|
26
|
+
|
|
27
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
28
|
+
|
|
29
|
+
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."); }
|
|
30
|
+
|
|
31
|
+
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); }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
37
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
|
+
|
|
39
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
40
|
+
return a;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var CustomPropertiesViewCtx = function CustomPropertiesViewCtx(_ref) {
|
|
44
|
+
var _custprops$filter$len, _custprops$filter, _Object$entries$filte, _Object$entries, _Object$entries$filte2;
|
|
45
|
+
|
|
46
|
+
var ctx = _ref.ctx,
|
|
47
|
+
customProperties = _ref.customProperties,
|
|
48
|
+
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
49
|
+
id = _ref.id,
|
|
50
|
+
labelOverrides = _ref.labelOverrides;
|
|
51
|
+
|
|
52
|
+
// Deal with all the possible label override options
|
|
53
|
+
var getAccordionLabel = function getAccordionLabel() {
|
|
54
|
+
var _labelOverrides$defau;
|
|
55
|
+
|
|
56
|
+
// Special case for null context
|
|
57
|
+
if (ctx === 'isNull') {
|
|
58
|
+
var _labelOverrides$noCon;
|
|
59
|
+
|
|
60
|
+
return (_labelOverrides$noCon = labelOverrides.noContext) !== null && _labelOverrides$noCon !== void 0 ? _labelOverrides$noCon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
61
|
+
id: "stripes-kint-components.customProperties"
|
|
62
|
+
});
|
|
63
|
+
} // Label overrides for specific contexts
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if (labelOverrides[ctx]) {
|
|
67
|
+
return labelOverrides[ctx];
|
|
68
|
+
} // Label override for default title, taking ctx into account
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
|
|
72
|
+
return labelOverrides.defaultTitle(ctx);
|
|
73
|
+
} // Label override for default title or finally built in default
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
return (_labelOverrides$defau = labelOverrides.defaultTitle) !== null && _labelOverrides$defau !== void 0 ? _labelOverrides$defau : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
77
|
+
id: "stripes-kint-components.customProperties.ctx.title",
|
|
78
|
+
values: {
|
|
79
|
+
ctx: ctx
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var _useCustomProperties = (0, _hooks.useCustomProperties)({
|
|
85
|
+
ctx: ctx,
|
|
86
|
+
endpoint: customPropertiesEndpoint,
|
|
87
|
+
returnQueryObject: true,
|
|
88
|
+
options: {
|
|
89
|
+
sort: [{
|
|
90
|
+
path: 'retired'
|
|
91
|
+
}, // Place retired custprops at the end
|
|
92
|
+
{
|
|
93
|
+
path: 'primary',
|
|
94
|
+
direction: 'desc'
|
|
95
|
+
}, // Primary properties should display before optional
|
|
96
|
+
{
|
|
97
|
+
path: 'label'
|
|
98
|
+
} // Within those groups, sort by label
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
custprops = _useCustomProperties.data,
|
|
103
|
+
isLoading = _useCustomProperties.isLoading;
|
|
104
|
+
|
|
105
|
+
if (isLoading) {
|
|
106
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
107
|
+
closedByDefault: true,
|
|
108
|
+
displayWhenClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
109
|
+
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}),
|
|
110
|
+
id: "".concat(id, "-accordion-").concat(ctx),
|
|
111
|
+
label: getAccordionLabel(),
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
113
|
+
});
|
|
114
|
+
} // We need to display any set properties, along with any non-set primary properties
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
var primaryCount = (_custprops$filter$len = custprops === null || custprops === void 0 ? void 0 : (_custprops$filter = custprops.filter(function (cp) {
|
|
118
|
+
return cp.primary === true;
|
|
119
|
+
})) === null || _custprops$filter === void 0 ? void 0 : _custprops$filter.length) !== null && _custprops$filter$len !== void 0 ? _custprops$filter$len : 0;
|
|
120
|
+
var optionalCount = (_Object$entries$filte = (_Object$entries = Object.entries(customProperties)) === null || _Object$entries === void 0 ? void 0 : (_Object$entries$filte2 = _Object$entries.filter(function (_ref2) {
|
|
121
|
+
var _cp$, _cp$$type, _cp$2, _cp$2$type, _cp$3, _cp$3$type;
|
|
122
|
+
|
|
123
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
124
|
+
_key = _ref3[0],
|
|
125
|
+
cp = _ref3[1];
|
|
126
|
+
|
|
127
|
+
return (((_cp$ = cp[0]) === null || _cp$ === void 0 ? void 0 : (_cp$$type = _cp$.type) === null || _cp$$type === void 0 ? void 0 : _cp$$type.ctx) === ctx || ctx === 'isNull' && !((_cp$2 = cp[0]) !== null && _cp$2 !== void 0 && (_cp$2$type = _cp$2.type) !== null && _cp$2$type !== void 0 && _cp$2$type.ctx)) && // Either the ctx string matches, or isNull matches blank
|
|
128
|
+
((_cp$3 = cp[0]) === null || _cp$3 === void 0 ? void 0 : (_cp$3$type = _cp$3.type) === null || _cp$3$type === void 0 ? void 0 : _cp$3$type.primary) === false // Only count non-primary set custprops
|
|
129
|
+
;
|
|
130
|
+
})) === null || _Object$entries$filte2 === void 0 ? void 0 : _Object$entries$filte2.length) !== null && _Object$entries$filte !== void 0 ? _Object$entries$filte : 0;
|
|
131
|
+
return primaryCount + optionalCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
132
|
+
closedByDefault: true,
|
|
133
|
+
displayWhenClosed: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Badge, {
|
|
134
|
+
children: primaryCount + optionalCount
|
|
135
|
+
}),
|
|
136
|
+
displayWhenOpen: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Badge, {
|
|
137
|
+
children: primaryCount + optionalCount
|
|
138
|
+
}),
|
|
139
|
+
id: "".concat(id, "-accordion-").concat(ctx),
|
|
140
|
+
label: getAccordionLabel(),
|
|
141
|
+
children: custprops.map(function (cp, index) {
|
|
142
|
+
var _customProperties$cp$;
|
|
143
|
+
|
|
144
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyCard.default, {
|
|
145
|
+
ctx: ctx,
|
|
146
|
+
customProperty: customProperties === null || customProperties === void 0 ? void 0 : (_customProperties$cp$ = customProperties[cp.name]) === null || _customProperties$cp$ === void 0 ? void 0 : _customProperties$cp$[0],
|
|
147
|
+
customPropertyDefinition: cp,
|
|
148
|
+
index: index,
|
|
149
|
+
labelOverrides: labelOverrides
|
|
150
|
+
}, "custom-property-card-".concat(ctx, "[").concat(index, "]"));
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
__signature__(CustomPropertiesViewCtx, "useCustomProperties{{ data: custprops, isLoading }}", function () {
|
|
156
|
+
return [_hooks.useCustomProperties];
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
CustomPropertiesViewCtx.propTypes = {
|
|
160
|
+
ctx: _propTypes.default.string,
|
|
161
|
+
customProperties: _propTypes.default.object,
|
|
162
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
163
|
+
id: _propTypes.default.string,
|
|
164
|
+
labelOverrides: _propTypes.default.object
|
|
165
|
+
};
|
|
166
|
+
var _default = CustomPropertiesViewCtx;
|
|
167
|
+
var _default2 = _default;
|
|
168
|
+
exports.default = _default2;
|
|
169
|
+
;
|
|
170
|
+
|
|
171
|
+
(function () {
|
|
172
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
173
|
+
|
|
174
|
+
if (!reactHotLoader) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
reactHotLoader.register(CustomPropertiesViewCtx, "CustomPropertiesViewCtx", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js");
|
|
179
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js");
|
|
180
|
+
})();
|
|
181
|
+
|
|
182
|
+
;
|
|
183
|
+
|
|
184
|
+
(function () {
|
|
185
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
186
|
+
leaveModule && leaveModule(module);
|
|
187
|
+
})();
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactIntl = require("react-intl");
|
|
13
|
+
|
|
14
|
+
var _components = require("@folio/stripes/components");
|
|
15
|
+
|
|
16
|
+
var CUSTPROP_TYPES = _interopRequireWildcard(require("../../constants/customProperties"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
(function () {
|
|
27
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
28
|
+
enterModule && enterModule(module);
|
|
29
|
+
})();
|
|
30
|
+
|
|
31
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
32
|
+
return a;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var CustomPropertyCard = function CustomPropertyCard(_ref) {
|
|
36
|
+
var _labelOverrides$value, _labelOverrides$inter3, _labelOverrides$visib, _labelOverrides$publi;
|
|
37
|
+
|
|
38
|
+
var ctx = _ref.ctx,
|
|
39
|
+
customProperty = _ref.customProperty,
|
|
40
|
+
customPropertyDefinition = _ref.customPropertyDefinition,
|
|
41
|
+
index = _ref.index,
|
|
42
|
+
labelOverrides = _ref.labelOverrides;
|
|
43
|
+
// We only need to display primary and set properties
|
|
44
|
+
var toDisplay = !!(customPropertyDefinition.primary || customProperty);
|
|
45
|
+
|
|
46
|
+
if (!toDisplay) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var internalFalse = (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === false || (customProperty === null || customProperty === void 0 ? void 0 : customProperty.internal) === undefined && customPropertyDefinition.defaultInternal === false; // Deal with all the possible label override options
|
|
51
|
+
|
|
52
|
+
var getRetiredCardTitle = function getRetiredCardTitle() {
|
|
53
|
+
var _labelOverrides$retir;
|
|
54
|
+
|
|
55
|
+
// Label override for default card title,
|
|
56
|
+
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
57
|
+
return labelOverrides.retiredName(customPropertyDefinition);
|
|
58
|
+
} // Label override for default title or finally built in default
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return (_labelOverrides$retir = labelOverrides.retiredName) !== null && _labelOverrides$retir !== void 0 ? _labelOverrides$retir : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
62
|
+
id: "stripes-kint-components.customProperty.retiredName",
|
|
63
|
+
values: {
|
|
64
|
+
name: customPropertyDefinition.label
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var getInternalLabel = function getInternalLabel() {
|
|
70
|
+
var _labelOverrides$inter2;
|
|
71
|
+
|
|
72
|
+
if (internalFalse) {
|
|
73
|
+
var _labelOverrides$inter;
|
|
74
|
+
|
|
75
|
+
return (_labelOverrides$inter = labelOverrides.internalFalse) !== null && _labelOverrides$inter !== void 0 ? _labelOverrides$inter : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
76
|
+
id: "stripes-kint-components.customProperty.internalFalse"
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (_labelOverrides$inter2 = labelOverrides.internalTrue) !== null && _labelOverrides$inter2 !== void 0 ? _labelOverrides$inter2 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
81
|
+
id: "stripes-kint-components.customProperty.internalTrue"
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var renderValue = function renderValue() {
|
|
86
|
+
var _customProperty$value, _customProperty$value2, _customProperty$value3;
|
|
87
|
+
|
|
88
|
+
if (!customProperty) {
|
|
89
|
+
var _labelOverrides$notSe;
|
|
90
|
+
|
|
91
|
+
return (_labelOverrides$notSe = labelOverrides.notSet) !== null && _labelOverrides$notSe !== void 0 ? _labelOverrides$notSe : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
92
|
+
id: "stripes-kint-components.customProperty.notSet"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
switch (customPropertyDefinition.type) {
|
|
97
|
+
case CUSTPROP_TYPES.REFDATA_CLASS_NAME:
|
|
98
|
+
return (_customProperty$value = (_customProperty$value2 = customProperty.value) === null || _customProperty$value2 === void 0 ? void 0 : _customProperty$value2.label) !== null && _customProperty$value !== void 0 ? _customProperty$value : (_customProperty$value3 = customProperty.value) === null || _customProperty$value3 === void 0 ? void 0 : _customProperty$value3.value;
|
|
99
|
+
|
|
100
|
+
case CUSTPROP_TYPES.DECIMAL_CLASS_NAME:
|
|
101
|
+
case CUSTPROP_TYPES.INTEGER_CLASS_NAME:
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
103
|
+
value: customProperty.value
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
case CUSTPROP_TYPES.DATE_CLASS_NAME:
|
|
107
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormattedUTCDate, {
|
|
108
|
+
value: customProperty.value
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
case CUSTPROP_TYPES.TEXT_CLASS_NAME:
|
|
112
|
+
default:
|
|
113
|
+
return customProperty.value;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Card, {
|
|
118
|
+
headerStart: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
120
|
+
children: customPropertyDefinition.retired ? getRetiredCardTitle() : customPropertyDefinition.label
|
|
121
|
+
}), customPropertyDefinition.description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.InfoPopover, {
|
|
122
|
+
content: customPropertyDefinition.description
|
|
123
|
+
}) : null]
|
|
124
|
+
}),
|
|
125
|
+
id: "customproperty-card-".concat(index),
|
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
127
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
128
|
+
xs: 6,
|
|
129
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
130
|
+
label: (_labelOverrides$value = labelOverrides.value) !== null && _labelOverrides$value !== void 0 ? _labelOverrides$value : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
131
|
+
id: "stripes-kint-components.customProperty.value"
|
|
132
|
+
}),
|
|
133
|
+
children: renderValue()
|
|
134
|
+
})
|
|
135
|
+
}), customProperty !== null && customProperty !== void 0 && customProperty.internalNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
136
|
+
xs: 6,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
138
|
+
label: (_labelOverrides$inter3 = labelOverrides.internalNote) !== null && _labelOverrides$inter3 !== void 0 ? _labelOverrides$inter3 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
139
|
+
id: "stripes-kint-components.customProperty.internalNote"
|
|
140
|
+
}),
|
|
141
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
142
|
+
style: {
|
|
143
|
+
whiteSpace: 'pre-wrap'
|
|
144
|
+
},
|
|
145
|
+
children: customProperty.internalNote
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
}) : null]
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
150
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
151
|
+
xs: 6,
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
153
|
+
label: (_labelOverrides$visib = labelOverrides.visibility) !== null && _labelOverrides$visib !== void 0 ? _labelOverrides$visib : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
154
|
+
id: "stripes-kint-components.customProperty.visibility"
|
|
155
|
+
}),
|
|
156
|
+
children: getInternalLabel()
|
|
157
|
+
})
|
|
158
|
+
}), internalFalse && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
159
|
+
xs: 6,
|
|
160
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
161
|
+
label: (_labelOverrides$publi = labelOverrides.publicNote) !== null && _labelOverrides$publi !== void 0 ? _labelOverrides$publi : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
162
|
+
id: "stripes-kint-components.customProperty.publicNote"
|
|
163
|
+
}),
|
|
164
|
+
children: customProperty !== null && customProperty !== void 0 && customProperty.publicNote ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
165
|
+
style: {
|
|
166
|
+
whiteSpace: 'pre-wrap'
|
|
167
|
+
},
|
|
168
|
+
children: customProperty.publicNote
|
|
169
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoValue, {})
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
})]
|
|
173
|
+
}, "customPropertyCard-".concat(ctx, "[").concat(index, "]"));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
CustomPropertyCard.propTypes = {
|
|
177
|
+
ctx: _propTypes.default.string,
|
|
178
|
+
customProperty: _propTypes.default.object,
|
|
179
|
+
customPropertyDefinition: _propTypes.default.object,
|
|
180
|
+
index: _propTypes.default.number,
|
|
181
|
+
labelOverrides: _propTypes.default.object
|
|
182
|
+
};
|
|
183
|
+
var _default = CustomPropertyCard;
|
|
184
|
+
var _default2 = _default;
|
|
185
|
+
exports.default = _default2;
|
|
186
|
+
;
|
|
187
|
+
|
|
188
|
+
(function () {
|
|
189
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
190
|
+
|
|
191
|
+
if (!reactHotLoader) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
reactHotLoader.register(CustomPropertyCard, "CustomPropertyCard", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertyCard.js");
|
|
196
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/View/CustomPropertyCard.js");
|
|
197
|
+
})();
|
|
198
|
+
|
|
199
|
+
;
|
|
200
|
+
|
|
201
|
+
(function () {
|
|
202
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
203
|
+
leaveModule && leaveModule(module);
|
|
204
|
+
})();
|