cozy-ui-plus 12.3.15 → 13.0.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 +23 -0
- package/package.json +3 -3
- package/dist/ListItem/ExpandedAttributes/ExpandedAttribute.js +0 -62
- package/dist/ListItem/ExpandedAttributes/helpers.js +0 -263
- package/dist/ListItem/ExpandedAttributes/index.js +0 -90
- package/dist/ListItem/ListItemBase/Renaming/RenameDialog.js +0 -52
- package/dist/ListItem/ListItemBase/Renaming/RenameInput.js +0 -319
- package/dist/ListItem/ListItemBase/Renaming/helpers.js +0 -73
- package/dist/ListItem/ListItemBase/index.js +0 -151
- package/dist/ListItem/ListItemByDoc/index.js +0 -109
- package/dist/ListItem/ListItemContact/helpers.js +0 -39
- package/dist/ListItem/ListItemContact/index.js +0 -85
- package/dist/ListItem/ListItemContact/useActions.js +0 -28
- package/dist/ListItem/ListItemFile/ExpirationAnnotation.js +0 -54
- package/dist/ListItem/ListItemFile/ItemIcon.js +0 -64
- package/dist/ListItem/ListItemFile/PrimaryText.js +0 -47
- package/dist/ListItem/ListItemFile/SecondaryText.js +0 -41
- package/dist/ListItem/ListItemFile/index.js +0 -96
- package/dist/ListItem/hoc/withListItemLocales.js +0 -320
- package/dist/Qualification/QualificationGrid/helpers.js +0 -16
- package/dist/Qualification/QualificationGrid/index.js +0 -118
- package/dist/Qualification/QualificationGrid/locales/withLocales.js +0 -80
- package/dist/Qualification/QualificationItem/index.js +0 -76
- package/dist/providers/Intent/index.js +0 -130
- package/dist/src/ListItem/ExpandedAttributes/ExpandedAttribute.d.ts +0 -14
- package/dist/src/ListItem/ExpandedAttributes/helpers.d.ts +0 -43
- package/dist/src/ListItem/ExpandedAttributes/helpers.spec.d.ts +0 -1
- package/dist/src/ListItem/ExpandedAttributes/index.d.ts +0 -2
- package/dist/src/ListItem/ListItemBase/Renaming/RenameDialog.d.ts +0 -2
- package/dist/src/ListItem/ListItemBase/Renaming/RenameInput.d.ts +0 -12
- package/dist/src/ListItem/ListItemBase/Renaming/helpers.d.ts +0 -1
- package/dist/src/ListItem/ListItemBase/index.d.ts +0 -2
- package/dist/src/ListItem/ListItemByDoc/index.d.ts +0 -46
- package/dist/src/ListItem/ListItemContact/helpers.d.ts +0 -1
- package/dist/src/ListItem/ListItemContact/helpers.spec.d.ts +0 -1
- package/dist/src/ListItem/ListItemContact/index.d.ts +0 -35
- package/dist/src/ListItem/ListItemContact/useActions.d.ts +0 -2
- package/dist/src/ListItem/ListItemFile/ExpirationAnnotation.d.ts +0 -2
- package/dist/src/ListItem/ListItemFile/ItemIcon.d.ts +0 -12
- package/dist/src/ListItem/ListItemFile/PrimaryText.d.ts +0 -12
- package/dist/src/ListItem/ListItemFile/SecondaryText.d.ts +0 -12
- package/dist/src/ListItem/ListItemFile/index.d.ts +0 -37
- package/dist/src/ListItem/hoc/withListItemLocales.d.ts +0 -12
- package/dist/src/Qualification/QualificationGrid/helpers.d.ts +0 -1
- package/dist/src/Qualification/QualificationGrid/index.d.ts +0 -2
- package/dist/src/Qualification/QualificationGrid/locales/withLocales.d.ts +0 -12
- package/dist/src/Qualification/QualificationItem/index.d.ts +0 -17
- package/dist/src/providers/Intent/index.d.ts +0 -9
- package/src/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +0 -39
- package/src/ListItem/ExpandedAttributes/helpers.js +0 -214
- package/src/ListItem/ExpandedAttributes/helpers.spec.js +0 -175
- package/src/ListItem/ExpandedAttributes/index.jsx +0 -62
- package/src/ListItem/ListItemBase/Renaming/RenameDialog.jsx +0 -38
- package/src/ListItem/ListItemBase/Renaming/RenameInput.jsx +0 -134
- package/src/ListItem/ListItemBase/Renaming/helpers.js +0 -35
- package/src/ListItem/ListItemBase/index.jsx +0 -115
- package/src/ListItem/ListItemByDoc/index.jsx +0 -103
- package/src/ListItem/ListItemContact/helpers.js +0 -28
- package/src/ListItem/ListItemContact/helpers.spec.js +0 -41
- package/src/ListItem/ListItemContact/index.jsx +0 -67
- package/src/ListItem/ListItemContact/useActions.jsx +0 -22
- package/src/ListItem/ListItemFile/ExpirationAnnotation.jsx +0 -39
- package/src/ListItem/ListItemFile/ItemIcon.jsx +0 -55
- package/src/ListItem/ListItemFile/PrimaryText.jsx +0 -38
- package/src/ListItem/ListItemFile/SecondaryText.jsx +0 -36
- package/src/ListItem/ListItemFile/index.jsx +0 -75
- package/src/ListItem/Readme.md +0 -211
- package/src/ListItem/hoc/withListItemLocales.jsx +0 -15
- package/src/ListItem/locales/en.json +0 -75
- package/src/ListItem/locales/fr.json +0 -75
- package/src/ListItem/locales/ru.json +0 -75
- package/src/ListItem/locales/vi.json +0 -75
- package/src/Qualification/QualificationGrid/Readme.md +0 -26
- package/src/Qualification/QualificationGrid/helpers.js +0 -4
- package/src/Qualification/QualificationGrid/index.jsx +0 -93
- package/src/Qualification/QualificationGrid/locales/en.json +0 -15
- package/src/Qualification/QualificationGrid/locales/fr.json +0 -15
- package/src/Qualification/QualificationGrid/locales/ru.json +0 -15
- package/src/Qualification/QualificationGrid/locales/vi.json +0 -15
- package/src/Qualification/QualificationGrid/locales/withLocales.jsx +0 -15
- package/src/Qualification/QualificationItem/Readme.md +0 -8
- package/src/Qualification/QualificationItem/index.jsx +0 -63
- package/src/providers/Intent/index.jsx +0 -83
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.0.0](https://github.com/cozy/cozy-libs/compare/cozy-ui-plus@12.3.15...cozy-ui-plus@13.0.0) (2026-09-10)
|
|
7
|
+
|
|
8
|
+
### chore
|
|
9
|
+
|
|
10
|
+
- **cozy-ui-plus:** Remove unused components ([a8e00f0](https://github.com/cozy/cozy-libs/commit/a8e00f03d886a67325c3ba1e126453d7584b44fe))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **cozy-ui-plus:** The following entry points are removed. There is no
|
|
15
|
+
replacement, they were never consumed.
|
|
16
|
+
|
|
17
|
+
* cozy-ui-plus/dist/ListItem/ListItemBase
|
|
18
|
+
* cozy-ui-plus/dist/ListItem/ListItemByDoc
|
|
19
|
+
* cozy-ui-plus/dist/ListItem/ListItemContact
|
|
20
|
+
* cozy-ui-plus/dist/ListItem/ListItemFile
|
|
21
|
+
* cozy-ui-plus/dist/ListItem/ExpandedAttributes
|
|
22
|
+
* cozy-ui-plus/dist/ListItem/hoc/withListItemLocales
|
|
23
|
+
* cozy-ui-plus/dist/Qualification/QualificationGrid
|
|
24
|
+
* cozy-ui-plus/dist/Qualification/QualificationItem
|
|
25
|
+
* cozy-ui-plus/dist/providers/Intent
|
|
26
|
+
|
|
27
|
+
Use cozy-ui/transpiled/react/ListItem for plain list items.
|
|
28
|
+
|
|
6
29
|
## [12.3.15](https://github.com/cozy/cozy-libs/compare/cozy-ui-plus@12.3.14...cozy-ui-plus@12.3.15) (2026-09-07)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package cozy-ui-plus
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui-plus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Cozy-ui-plus is an extension of cozy-ui and provides components based on cozy-client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"cozy-intent": "^2.31.1",
|
|
39
39
|
"cozy-interapp": "^0.19.0",
|
|
40
40
|
"cozy-logger": "^1.18.1",
|
|
41
|
-
"cozy-sharing": "^37.6.
|
|
41
|
+
"cozy-sharing": "^37.6.1",
|
|
42
42
|
"cozy-stack-client": "^60.21.1",
|
|
43
43
|
"cozy-ui": "^138.1.0",
|
|
44
44
|
"jest": "30.3.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"react-dom": "^16 || ^17 || ^18",
|
|
79
79
|
"twake-i18n": ">=0.3.0"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "b101bc4cb905b32920ef7a22344eb890147eab23"
|
|
82
82
|
}
|
|
@@ -1,62 +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 _twakeIcons = require("@linagora/twake-icons");
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _ListItem = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItem"));
|
|
17
|
-
|
|
18
|
-
var _ListItemIcon = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemIcon"));
|
|
19
|
-
|
|
20
|
-
var _ListItemText = _interopRequireDefault(require("cozy-ui/transpiled/react/ListItemText"));
|
|
21
|
-
|
|
22
|
-
var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typography"));
|
|
23
|
-
|
|
24
|
-
var _twakeI18n = require("twake-i18n");
|
|
25
|
-
|
|
26
|
-
var _helpers = require("./helpers");
|
|
27
|
-
|
|
28
|
-
var ExpandedAttribute = function ExpandedAttribute(_ref) {
|
|
29
|
-
var label = _ref.label,
|
|
30
|
-
value = _ref.value,
|
|
31
|
-
setAlertProps = _ref.setAlertProps;
|
|
32
|
-
|
|
33
|
-
var _useI18n = (0, _twakeI18n.useI18n)(),
|
|
34
|
-
t = _useI18n.t;
|
|
35
|
-
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement(_ListItem.default, {
|
|
37
|
-
className: "u-pl-2",
|
|
38
|
-
button: true,
|
|
39
|
-
onClick: (0, _helpers.copyToClipboard)({
|
|
40
|
-
value: value,
|
|
41
|
-
setAlertProps: setAlertProps,
|
|
42
|
-
t: t
|
|
43
|
-
})
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_twakeIcons.Icon, {
|
|
45
|
-
icon: _twakeIcons.Copy
|
|
46
|
-
})), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
|
|
47
|
-
primary: /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
48
|
-
variant: "caption"
|
|
49
|
-
}, label),
|
|
50
|
-
secondary: /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
51
|
-
variant: "body2"
|
|
52
|
-
}, value)
|
|
53
|
-
}));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
ExpandedAttribute.propTypes = {
|
|
57
|
-
label: _propTypes.default.string,
|
|
58
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
59
|
-
setAlertProps: _propTypes.default.func
|
|
60
|
-
};
|
|
61
|
-
var _default = ExpandedAttribute;
|
|
62
|
-
exports.default = _default;
|
|
@@ -1,263 +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.notExpandedAttributes = exports.normalizeExpandedAttribute = exports.makeLabel = exports.makeDefaultExpandedAttributes = exports.makeAttrsValues = exports.makeAttrsLabelAndFormattedValue = exports.isDate = exports.hasExpandedAttributesDisplayed = exports.hasAllElement = exports.getFormattedValue = exports.getAttrValue = exports.defaultExpandedAttributes = exports.copyToClipboard = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
|
17
|
-
|
|
18
|
-
var _paper = require("cozy-client/dist/models/paper");
|
|
19
|
-
|
|
20
|
-
var normalizeExpandedAttribute = function normalizeExpandedAttribute(attr) {
|
|
21
|
-
return attr.replaceAll(':', '.').replace('flexsearchProps.', '').replace('translated.', '');
|
|
22
|
-
}; // attributes not considered as specific expanded attributes
|
|
23
|
-
// and then fallback to default expanded attributes
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports.normalizeExpandedAttribute = normalizeExpandedAttribute;
|
|
27
|
-
var notExpandedAttributes = {
|
|
28
|
-
'io.cozy.contacts': ['fullname', 'civility', 'note'],
|
|
29
|
-
'io.cozy.files': [].concat((0, _toConsumableArray2.default)(_paper.KNOWN_DATE_METADATA_NAMES.map(function (x) {
|
|
30
|
-
return "metadata.".concat(x);
|
|
31
|
-
})), ['metadata.noticePeriod', 'name', 'flexsearchProps:translated:qualificationLabel', 'flexsearchProps:translated:driverLicense', 'flexsearchProps:translated:paymentProofFamilyAllowance', 'flexsearchProps:translated:caf', 'flexsearchProps:translated:vehicleRegistration', 'flexsearchProps:translated:nationalIdCard', 'flexsearchProps:translated:bankDetails', 'flexsearchProps:translated:paySheet', 'flexsearchProps:translated:passport', 'flexsearchProps:translated:residencePermit'])
|
|
32
|
-
}; // attributes that we want to display if no attribute of the document is related to the search
|
|
33
|
-
|
|
34
|
-
exports.notExpandedAttributes = notExpandedAttributes;
|
|
35
|
-
var defaultExpandedAttributes = {
|
|
36
|
-
'io.cozy.contacts': ['email', 'phone', 'address', 'birthday'],
|
|
37
|
-
'io.cozy.files': [].concat((0, _toConsumableArray2.default)(_paper.KNOWN_INFORMATION_METADATA_NAMES.map(function (x) {
|
|
38
|
-
return "metadata.".concat(x);
|
|
39
|
-
})), (0, _toConsumableArray2.default)(_paper.KNOWN_DATE_METADATA_NAMES.map(function (x) {
|
|
40
|
-
return "metadata.".concat(x);
|
|
41
|
-
}))).filter(function (x) {
|
|
42
|
-
return !notExpandedAttributes['io.cozy.files'].includes(x);
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
exports.defaultExpandedAttributes = defaultExpandedAttributes;
|
|
46
|
-
|
|
47
|
-
var hasAllElement = function hasAllElement(arr1, arr2) {
|
|
48
|
-
return arr1 === null || arr1 === void 0 ? void 0 : arr1.every(function (x) {
|
|
49
|
-
return arr2.includes(x);
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
exports.hasAllElement = hasAllElement;
|
|
54
|
-
|
|
55
|
-
var makeDefaultExpandedAttributes = function makeDefaultExpandedAttributes(doc, expandedAttributes) {
|
|
56
|
-
var doctype = doc === null || doc === void 0 ? void 0 : doc._type;
|
|
57
|
-
if (!doc || !doctype) return undefined; // checks if there are any expanded attributes.
|
|
58
|
-
// If there are none, the default expanded attributes are returned
|
|
59
|
-
|
|
60
|
-
if (!expandedAttributes || hasAllElement(expandedAttributes, notExpandedAttributes[doctype])) {
|
|
61
|
-
return defaultExpandedAttributes[doctype];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return expandedAttributes.map(function (expandedAttribute) {
|
|
65
|
-
return notExpandedAttributes[doctype].includes(expandedAttribute) ? undefined : normalizeExpandedAttribute(expandedAttribute);
|
|
66
|
-
}).filter(function (x) {
|
|
67
|
-
return x;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
exports.makeDefaultExpandedAttributes = makeDefaultExpandedAttributes;
|
|
72
|
-
|
|
73
|
-
var copyToClipboard = function copyToClipboard(_ref) {
|
|
74
|
-
var value = _ref.value,
|
|
75
|
-
setAlertProps = _ref.setAlertProps,
|
|
76
|
-
t = _ref.t;
|
|
77
|
-
return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
78
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
79
|
-
while (1) {
|
|
80
|
-
switch (_context.prev = _context.next) {
|
|
81
|
-
case 0:
|
|
82
|
-
_context.prev = 0;
|
|
83
|
-
_context.next = 3;
|
|
84
|
-
return navigator.clipboard.writeText(value);
|
|
85
|
-
|
|
86
|
-
case 3:
|
|
87
|
-
setAlertProps({
|
|
88
|
-
open: true,
|
|
89
|
-
severity: 'success',
|
|
90
|
-
message: t("ListItem.snackbar.copyToClipboard.success")
|
|
91
|
-
});
|
|
92
|
-
_context.next = 9;
|
|
93
|
-
break;
|
|
94
|
-
|
|
95
|
-
case 6:
|
|
96
|
-
_context.prev = 6;
|
|
97
|
-
_context.t0 = _context["catch"](0);
|
|
98
|
-
setAlertProps({
|
|
99
|
-
open: true,
|
|
100
|
-
severity: 'error',
|
|
101
|
-
message: t("ListItem.snackbar.copyToClipboard.error")
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
case 9:
|
|
105
|
-
case "end":
|
|
106
|
-
return _context.stop();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, _callee, null, [[0, 6]]);
|
|
110
|
-
}));
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
exports.copyToClipboard = copyToClipboard;
|
|
114
|
-
|
|
115
|
-
var isDate = function isDate(value) {
|
|
116
|
-
if (!isNaN(value)) return false;
|
|
117
|
-
var dateTime = new Date(value).getTime();
|
|
118
|
-
var dateParsedValue = Date.parse(value);
|
|
119
|
-
return dateTime === dateParsedValue;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
exports.isDate = isDate;
|
|
123
|
-
|
|
124
|
-
var getAttrValue = function getAttrValue(doc, attrName) {
|
|
125
|
-
var _attrValue$find, _attrValue$find2, _attrValue$find3;
|
|
126
|
-
|
|
127
|
-
var attrValue = (0, _get.default)(doc, attrName);
|
|
128
|
-
if (!attrValue || attrValue.length === 0) return undefined;
|
|
129
|
-
|
|
130
|
-
switch (true) {
|
|
131
|
-
case attrName === 'email':
|
|
132
|
-
return (_attrValue$find = attrValue.find(function (x) {
|
|
133
|
-
return x.primary === true;
|
|
134
|
-
})) === null || _attrValue$find === void 0 ? void 0 : _attrValue$find.address;
|
|
135
|
-
|
|
136
|
-
case attrName === 'address':
|
|
137
|
-
return (_attrValue$find2 = attrValue.find(function (x) {
|
|
138
|
-
return x.primary === true;
|
|
139
|
-
})) === null || _attrValue$find2 === void 0 ? void 0 : _attrValue$find2.formattedAddress;
|
|
140
|
-
|
|
141
|
-
case attrName === 'phone':
|
|
142
|
-
return (_attrValue$find3 = attrValue.find(function (x) {
|
|
143
|
-
return x.primary === true;
|
|
144
|
-
})) === null || _attrValue$find3 === void 0 ? void 0 : _attrValue$find3.number;
|
|
145
|
-
|
|
146
|
-
default:
|
|
147
|
-
return attrValue;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
exports.getAttrValue = getAttrValue;
|
|
152
|
-
|
|
153
|
-
var makeAttrsValues = function makeAttrsValues(doc, expandedAttributes) {
|
|
154
|
-
var attrsValues = expandedAttributes.map(function (attrName) {
|
|
155
|
-
var attrValue = getAttrValue(doc, attrName);
|
|
156
|
-
if (!attrValue) return undefined;
|
|
157
|
-
return {
|
|
158
|
-
attrName: attrName,
|
|
159
|
-
attrValue: attrValue
|
|
160
|
-
};
|
|
161
|
-
}).filter(function (x) {
|
|
162
|
-
return x;
|
|
163
|
-
}).slice(0, 3);
|
|
164
|
-
return attrsValues;
|
|
165
|
-
}; // could be use in apps
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
exports.makeAttrsValues = makeAttrsValues;
|
|
169
|
-
|
|
170
|
-
var hasExpandedAttributesDisplayed = function hasExpandedAttributesDisplayed(_ref3) {
|
|
171
|
-
var doc = _ref3.doc,
|
|
172
|
-
expandedAttributes = _ref3.expandedAttributes;
|
|
173
|
-
var defaultExpandedAttributes = makeDefaultExpandedAttributes(doc, expandedAttributes);
|
|
174
|
-
var attrsValues = makeAttrsValues(doc, defaultExpandedAttributes);
|
|
175
|
-
return (attrsValues === null || attrsValues === void 0 ? void 0 : attrsValues.length) > 0 || false;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
exports.hasExpandedAttributesDisplayed = hasExpandedAttributesDisplayed;
|
|
179
|
-
|
|
180
|
-
var getFormattedValue = function getFormattedValue(_ref4) {
|
|
181
|
-
var attrName = _ref4.attrName,
|
|
182
|
-
attrValue = _ref4.attrValue,
|
|
183
|
-
qualificationLabel = _ref4.qualificationLabel,
|
|
184
|
-
f = _ref4.f,
|
|
185
|
-
lang = _ref4.lang;
|
|
186
|
-
|
|
187
|
-
if (isDate(attrValue)) {
|
|
188
|
-
return (0, _paper.formatDateMetadataValue)(attrValue, {
|
|
189
|
-
f: f,
|
|
190
|
-
lang: lang
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (qualificationLabel) {
|
|
195
|
-
return (0, _paper.formatInformationMetadataValue)(attrValue, {
|
|
196
|
-
lang: lang,
|
|
197
|
-
name: attrName.split('metadata.')[1],
|
|
198
|
-
qualificationLabel: qualificationLabel
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return attrValue;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
exports.getFormattedValue = getFormattedValue;
|
|
206
|
-
|
|
207
|
-
var makeLabel = function makeLabel(_ref5) {
|
|
208
|
-
var attrName = _ref5.attrName,
|
|
209
|
-
qualificationLabel = _ref5.qualificationLabel,
|
|
210
|
-
t = _ref5.t,
|
|
211
|
-
lang = _ref5.lang;
|
|
212
|
-
|
|
213
|
-
if (qualificationLabel) {
|
|
214
|
-
var name = attrName.split('metadata.')[1];
|
|
215
|
-
var label = (0, _paper.getTranslatedNameForInformationMetadata)(name, {
|
|
216
|
-
lang: lang,
|
|
217
|
-
qualificationLabel: qualificationLabel
|
|
218
|
-
});
|
|
219
|
-
return label;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return t("ListItem.attributes.".concat(attrName));
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
exports.makeLabel = makeLabel;
|
|
226
|
-
|
|
227
|
-
var makeAttrsLabelAndFormattedValue = function makeAttrsLabelAndFormattedValue(_ref6) {
|
|
228
|
-
var doc = _ref6.doc,
|
|
229
|
-
expandedAttributes = _ref6.expandedAttributes,
|
|
230
|
-
t = _ref6.t,
|
|
231
|
-
f = _ref6.f,
|
|
232
|
-
lang = _ref6.lang;
|
|
233
|
-
var attrsKeyAndFormattedValue = makeAttrsValues(doc, expandedAttributes);
|
|
234
|
-
return attrsKeyAndFormattedValue.map(function (_ref7) {
|
|
235
|
-
var _doc$metadata, _doc$metadata$qualifi;
|
|
236
|
-
|
|
237
|
-
var attrName = _ref7.attrName,
|
|
238
|
-
attrValue = _ref7.attrValue;
|
|
239
|
-
|
|
240
|
-
var _attrName = attrName.match(/\[.+\]/g) !== null ? attrName.split('[')[0] : attrName;
|
|
241
|
-
|
|
242
|
-
var qualificationLabel = (_doc$metadata = doc.metadata) === null || _doc$metadata === void 0 ? void 0 : (_doc$metadata$qualifi = _doc$metadata.qualification) === null || _doc$metadata$qualifi === void 0 ? void 0 : _doc$metadata$qualifi.label;
|
|
243
|
-
var label = makeLabel({
|
|
244
|
-
attrName: _attrName,
|
|
245
|
-
qualificationLabel: qualificationLabel,
|
|
246
|
-
t: t,
|
|
247
|
-
lang: lang
|
|
248
|
-
});
|
|
249
|
-
var value = getFormattedValue({
|
|
250
|
-
attrName: _attrName,
|
|
251
|
-
attrValue: attrValue,
|
|
252
|
-
qualificationLabel: qualificationLabel,
|
|
253
|
-
f: f,
|
|
254
|
-
lang: lang
|
|
255
|
-
});
|
|
256
|
-
return {
|
|
257
|
-
label: label,
|
|
258
|
-
value: value
|
|
259
|
-
};
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
exports.makeAttrsLabelAndFormattedValue = makeAttrsLabelAndFormattedValue;
|
|
@@ -1,90 +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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
|
-
var _Alert = _interopRequireDefault(require("cozy-ui/transpiled/react/Alert"));
|
|
17
|
-
|
|
18
|
-
var _Snackbar = _interopRequireDefault(require("cozy-ui/transpiled/react/Snackbar"));
|
|
19
|
-
|
|
20
|
-
var _twakeI18n = require("twake-i18n");
|
|
21
|
-
|
|
22
|
-
var _ExpandedAttribute = _interopRequireDefault(require("./ExpandedAttribute"));
|
|
23
|
-
|
|
24
|
-
var _helpers = require("./helpers");
|
|
25
|
-
|
|
26
|
-
var _withListItemLocales = _interopRequireDefault(require("../hoc/withListItemLocales"));
|
|
27
|
-
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
var ExpandedAttributes = function ExpandedAttributes(_ref) {
|
|
33
|
-
var doc = _ref.doc,
|
|
34
|
-
expandedAttributes = _ref.expandedAttributes;
|
|
35
|
-
|
|
36
|
-
var _useI18n = (0, _twakeI18n.useI18n)(),
|
|
37
|
-
t = _useI18n.t,
|
|
38
|
-
f = _useI18n.f,
|
|
39
|
-
lang = _useI18n.lang;
|
|
40
|
-
|
|
41
|
-
var _useState = (0, _react.useState)({
|
|
42
|
-
open: false,
|
|
43
|
-
severity: 'primary',
|
|
44
|
-
message: ''
|
|
45
|
-
}),
|
|
46
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
-
alertProps = _useState2[0],
|
|
48
|
-
setAlertProps = _useState2[1];
|
|
49
|
-
|
|
50
|
-
var attrsLabelAndFormattedValue = (0, _helpers.makeAttrsLabelAndFormattedValue)({
|
|
51
|
-
doc: doc,
|
|
52
|
-
expandedAttributes: expandedAttributes,
|
|
53
|
-
t: t,
|
|
54
|
-
f: f,
|
|
55
|
-
lang: lang
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
var handleClose = function handleClose() {
|
|
59
|
-
return setAlertProps({
|
|
60
|
-
open: false
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, attrsLabelAndFormattedValue.map(function (_ref2, index) {
|
|
65
|
-
var label = _ref2.label,
|
|
66
|
-
value = _ref2.value;
|
|
67
|
-
return /*#__PURE__*/_react.default.createElement(_ExpandedAttribute.default, {
|
|
68
|
-
key: index,
|
|
69
|
-
label: label,
|
|
70
|
-
value: value,
|
|
71
|
-
setAlertProps: setAlertProps
|
|
72
|
-
});
|
|
73
|
-
}), alertProps.open && /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
74
|
-
open: true,
|
|
75
|
-
onClose: handleClose
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement(_Alert.default, {
|
|
77
|
-
variant: "filled",
|
|
78
|
-
severity: alertProps.severity,
|
|
79
|
-
onClose: handleClose
|
|
80
|
-
}, alertProps.message)));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
ExpandedAttributes.propTypes = {
|
|
84
|
-
doc: _propTypes.default.object,
|
|
85
|
-
expandedAttributes: _propTypes.default.array
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var _default = (0, _withListItemLocales.default)(ExpandedAttributes);
|
|
89
|
-
|
|
90
|
-
exports.default = _default;
|
|
@@ -1,52 +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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _Buttons = _interopRequireDefault(require("cozy-ui/transpiled/react/Buttons"));
|
|
15
|
-
|
|
16
|
-
var _CozyDialogs = require("cozy-ui/transpiled/react/CozyDialogs");
|
|
17
|
-
|
|
18
|
-
var _twakeI18n = require("twake-i18n");
|
|
19
|
-
|
|
20
|
-
var _withListItemLocales = _interopRequireDefault(require("../../hoc/withListItemLocales"));
|
|
21
|
-
|
|
22
|
-
var RenameDialog = function RenameDialog(_ref) {
|
|
23
|
-
var onSubmit = _ref.onSubmit,
|
|
24
|
-
onCancel = _ref.onCancel;
|
|
25
|
-
|
|
26
|
-
var _useI18n = (0, _twakeI18n.useI18n)(),
|
|
27
|
-
t = _useI18n.t;
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_CozyDialogs.ConfirmDialog, {
|
|
30
|
-
open: true,
|
|
31
|
-
title: t('ListItem.renameModal.title'),
|
|
32
|
-
content: t('ListItem.renameModal.content'),
|
|
33
|
-
actions: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Buttons.default, {
|
|
34
|
-
variant: "secondary",
|
|
35
|
-
label: t('ListItem.renameModal.cancel'),
|
|
36
|
-
onClick: onCancel
|
|
37
|
-
}), /*#__PURE__*/_react.default.createElement(_Buttons.default, {
|
|
38
|
-
label: t('ListItem.renameModal.submit'),
|
|
39
|
-
onClick: onSubmit
|
|
40
|
-
})),
|
|
41
|
-
onClose: onCancel
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
RenameDialog.propTypes = {
|
|
46
|
-
onSubmit: _propTypes.default.func,
|
|
47
|
-
onCancel: _propTypes.default.func
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var _default = (0, _withListItemLocales.default)(RenameDialog);
|
|
51
|
-
|
|
52
|
-
exports.default = _default;
|