tntd 3.0.63 → 3.0.66
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/es/checkbox/checkbox-group.js +3 -3
- package/es/modal/index.less +0 -16
- package/es/modal/modal.js +3 -3
- package/es/modal/modal.js.map +1 -1
- package/es/modal/modal.less +0 -1
- package/es/modal/style/modal.less +28 -0
- package/es/radio/radio-group.js +3 -3
- package/es/table/total-shower.js +3 -3
- package/lib/checkbox/checkbox-group.js +3 -3
- package/lib/modal/index.less +0 -16
- package/lib/modal/modal.js +3 -3
- package/lib/modal/modal.js.map +1 -1
- package/lib/modal/modal.less +0 -1
- package/lib/modal/style/modal.less +28 -0
- package/lib/radio/radio-group.js +3 -3
- package/lib/table/total-shower.js +3 -3
- package/package.json +1 -1
- package/es/query-form/Field/Composition/FieldPopover.js +0 -466
- package/es/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/es/query-form/Field/Composition/FieldPopover.less +0 -41
- package/es/query-form/Field/Composition/Select.js +0 -260
- package/es/query-form/Field/Composition/Select.js.map +0 -1
- package/es/query-form/Field/Composition/SelectInput.js +0 -112
- package/es/query-form/Field/Composition/SelectInput.js.map +0 -1
- package/es/query-form/Field/Composition/ValueTag.js +0 -241
- package/es/query-form/Field/Composition/ValueTag.js.map +0 -1
- package/es/query-form/Field/Composition/index.js +0 -448
- package/es/query-form/Field/Composition/index.js.map +0 -1
- package/es/query-form/Field/Composition/index.less +0 -167
- package/es/query-form/Field/Composition/utils.js +0 -173
- package/es/query-form/Field/Composition/utils.js.map +0 -1
- package/es/query-form-v2/index.less +0 -133
- package/lib/query-form/Field/Composition/FieldPopover.d.ts +0 -19
- package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/FieldPopover.js +0 -466
- package/lib/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/lib/query-form/Field/Composition/FieldPopover.less +0 -41
- package/lib/query-form/Field/Composition/Select.d.ts +0 -4
- package/lib/query-form/Field/Composition/Select.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/Select.js +0 -260
- package/lib/query-form/Field/Composition/Select.js.map +0 -1
- package/lib/query-form/Field/Composition/SelectInput.d.ts +0 -3
- package/lib/query-form/Field/Composition/SelectInput.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/SelectInput.js +0 -112
- package/lib/query-form/Field/Composition/SelectInput.js.map +0 -1
- package/lib/query-form/Field/Composition/ValueTag.d.ts +0 -13
- package/lib/query-form/Field/Composition/ValueTag.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/ValueTag.js +0 -241
- package/lib/query-form/Field/Composition/ValueTag.js.map +0 -1
- package/lib/query-form/Field/Composition/index.d.ts +0 -15
- package/lib/query-form/Field/Composition/index.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/index.js +0 -448
- package/lib/query-form/Field/Composition/index.js.map +0 -1
- package/lib/query-form/Field/Composition/index.less +0 -167
- package/lib/query-form/Field/Composition/utils.d.ts +0 -21
- package/lib/query-form/Field/Composition/utils.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/utils.js +0 -173
- package/lib/query-form/Field/Composition/utils.js.map +0 -1
- package/lib/query-form-v2/index.less +0 -133
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports["default"] = void 0;
|
|
16
|
-
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
17
|
-
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
20
|
-
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
21
|
-
var _ellipsis = _interopRequireDefault(require("../../../ellipsis"));
|
|
22
|
-
var _empty = _interopRequireDefault(require("../../../empty"));
|
|
23
|
-
var _utils = require("./utils");
|
|
24
|
-
function _getRequireWildcardCache(e) {
|
|
25
|
-
if ("function" != typeof WeakMap) return null;
|
|
26
|
-
var r = new WeakMap(),
|
|
27
|
-
t = new WeakMap();
|
|
28
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
29
|
-
return e ? t : r;
|
|
30
|
-
})(e);
|
|
31
|
-
}
|
|
32
|
-
function _interopRequireWildcard(e, r) {
|
|
33
|
-
if (!r && e && e.__esModule) return e;
|
|
34
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
35
|
-
"default": e
|
|
36
|
-
};
|
|
37
|
-
var t = _getRequireWildcardCache(r);
|
|
38
|
-
if (t && t.has(e)) return t.get(e);
|
|
39
|
-
var n = {
|
|
40
|
-
__proto__: null
|
|
41
|
-
},
|
|
42
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
44
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
45
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
46
|
-
}
|
|
47
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
48
|
-
}
|
|
49
|
-
function _interopRequireDefault(obj) {
|
|
50
|
-
return obj && obj.__esModule ? obj : {
|
|
51
|
-
"default": obj
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function _defineProperty(obj, key, value) {
|
|
55
|
-
key = _toPropertyKey(key);
|
|
56
|
-
if (key in obj) {
|
|
57
|
-
Object.defineProperty(obj, key, {
|
|
58
|
-
value: value,
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
obj[key] = value;
|
|
65
|
-
}
|
|
66
|
-
return obj;
|
|
67
|
-
}
|
|
68
|
-
function _toPropertyKey(t) {
|
|
69
|
-
var i = _toPrimitive(t, "string");
|
|
70
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
71
|
-
}
|
|
72
|
-
function _toPrimitive(t, r) {
|
|
73
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
74
|
-
var e = t[Symbol.toPrimitive];
|
|
75
|
-
if (void 0 !== e) {
|
|
76
|
-
var i = e.call(t, r || "default");
|
|
77
|
-
if ("object" != _typeof(i)) return i;
|
|
78
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
79
|
-
}
|
|
80
|
-
return ("string" === r ? String : Number)(t);
|
|
81
|
-
}
|
|
82
|
-
function _slicedToArray(arr, i) {
|
|
83
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
84
|
-
}
|
|
85
|
-
function _nonIterableRest() {
|
|
86
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
87
|
-
}
|
|
88
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
89
|
-
if (!o) return;
|
|
90
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
91
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
92
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
93
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
94
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
95
|
-
}
|
|
96
|
-
function _arrayLikeToArray(arr, len) {
|
|
97
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
98
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
99
|
-
return arr2;
|
|
100
|
-
}
|
|
101
|
-
function _iterableToArrayLimit(r, l) {
|
|
102
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
103
|
-
if (null != t) {
|
|
104
|
-
var e,
|
|
105
|
-
n,
|
|
106
|
-
i,
|
|
107
|
-
u,
|
|
108
|
-
a = [],
|
|
109
|
-
f = !0,
|
|
110
|
-
o = !1;
|
|
111
|
-
try {
|
|
112
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
113
|
-
if (Object(t) !== t) return;
|
|
114
|
-
f = !1;
|
|
115
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
116
|
-
} catch (r) {
|
|
117
|
-
o = !0, n = r;
|
|
118
|
-
} finally {
|
|
119
|
-
try {
|
|
120
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
121
|
-
} finally {
|
|
122
|
-
if (o) throw n;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return a;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function _arrayWithHoles(arr) {
|
|
129
|
-
if (Array.isArray(arr)) return arr;
|
|
130
|
-
}
|
|
131
|
-
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
132
|
-
var t = {};
|
|
133
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
134
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
135
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
136
|
-
}
|
|
137
|
-
return t;
|
|
138
|
-
};
|
|
139
|
-
var _default = exports["default"] = function _default(props) {
|
|
140
|
-
var options = props.options,
|
|
141
|
-
params = props.params,
|
|
142
|
-
_props$queryKey = props.queryKey,
|
|
143
|
-
queryKey = _props$queryKey === void 0 ? 'name' : _props$queryKey,
|
|
144
|
-
_props$fieldNames = props.fieldNames,
|
|
145
|
-
fieldNames = _props$fieldNames === void 0 ? {
|
|
146
|
-
label: 'label',
|
|
147
|
-
value: 'value'
|
|
148
|
-
} : _props$fieldNames,
|
|
149
|
-
loadData = props.loadData,
|
|
150
|
-
onChange = props.onChange,
|
|
151
|
-
_value = props.value,
|
|
152
|
-
mode = props.mode,
|
|
153
|
-
propItem = props.propItem,
|
|
154
|
-
searchText = props.searchText,
|
|
155
|
-
showEmpty = props.showEmpty,
|
|
156
|
-
rest = __rest(props, ["options", "params", "queryKey", "fieldNames", "loadData", "onChange", "value", "mode", "propItem", "searchText", "showEmpty"]);
|
|
157
|
-
var _useState = (0, _react.useState)(options || []),
|
|
158
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
159
|
-
items = _useState2[0],
|
|
160
|
-
setItems = _useState2[1];
|
|
161
|
-
(0, _react.useEffect)(function () {
|
|
162
|
-
if (loadData) {
|
|
163
|
-
loadData(Object.assign(_defineProperty({}, queryKey, searchText), params || {})).then(function (items) {
|
|
164
|
-
setItems(items);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}, [params, searchText]);
|
|
168
|
-
(0, _react.useEffect)(function () {
|
|
169
|
-
setItems(options || []);
|
|
170
|
-
}, [options]);
|
|
171
|
-
var onValueChange = function onValueChange(item) {
|
|
172
|
-
onChange(item, mode === 'multiple' || mode === 'tags');
|
|
173
|
-
};
|
|
174
|
-
var children = items.map(function (item) {
|
|
175
|
-
var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
176
|
-
var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
|
|
177
|
-
var value = item instanceof Object ? item[valueKey] : item;
|
|
178
|
-
var label = item instanceof Object ? item[labelKey] : item + '';
|
|
179
|
-
var disabled = item instanceof Object ? item['disabled'] : false;
|
|
180
|
-
var isSelected = (0, _isArray2["default"])(_value) ? (_value === null || _value === void 0 ? void 0 : _value.indexOf(value)) > -1 : value === _value;
|
|
181
|
-
if (searchText) {
|
|
182
|
-
var isReactDom = _react["default"].isValidElement(label);
|
|
183
|
-
var _label = isReactDom ? (0, _utils.formatLabel)(label) : label;
|
|
184
|
-
if ((_label === null || _label === void 0 ? void 0 : _label.indexOf(searchText)) > -1) {
|
|
185
|
-
return _react["default"].createElement("li", {
|
|
186
|
-
className: (0, _classnames["default"])({
|
|
187
|
-
'ant-select-dropdown-menu-item': true,
|
|
188
|
-
'ant-select-dropdown-menu-item-selected': isSelected,
|
|
189
|
-
'ant-select-dropdown-menu-item-disabled': disabled
|
|
190
|
-
}),
|
|
191
|
-
key: value,
|
|
192
|
-
value: value,
|
|
193
|
-
onMouseDown: function onMouseDown(e) {
|
|
194
|
-
return e.preventDefault();
|
|
195
|
-
},
|
|
196
|
-
onClick: function onClick() {
|
|
197
|
-
!disabled && onValueChange({
|
|
198
|
-
value: value,
|
|
199
|
-
propItem: propItem,
|
|
200
|
-
options: items
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}, !showEmpty && _react["default"].createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), _react["default"].createElement("span", {
|
|
204
|
-
style: {
|
|
205
|
-
display: 'inline-block'
|
|
206
|
-
}
|
|
207
|
-
}, _react["default"].createElement(_ellipsis["default"], {
|
|
208
|
-
widthLimit: 220,
|
|
209
|
-
title: isReactDom ? _react["default"].createElement("span", null, label) : _react["default"].createElement("span", {
|
|
210
|
-
dangerouslySetInnerHTML: {
|
|
211
|
-
__html: (0, _utils.highlightSubstring)(label, searchText)
|
|
212
|
-
}
|
|
213
|
-
})
|
|
214
|
-
})), isSelected && _react["default"].createElement(_icon["default"], {
|
|
215
|
-
type: "check",
|
|
216
|
-
className: "ant-select-selected-icon"
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return _react["default"].createElement("li", {
|
|
222
|
-
className: (0, _classnames["default"])({
|
|
223
|
-
'ant-select-dropdown-menu-item': true,
|
|
224
|
-
'ant-select-dropdown-menu-item-selected': isSelected,
|
|
225
|
-
'ant-select-dropdown-menu-item-disabled': disabled
|
|
226
|
-
}),
|
|
227
|
-
key: value,
|
|
228
|
-
value: value,
|
|
229
|
-
onMouseDown: function onMouseDown(e) {
|
|
230
|
-
return e.preventDefault();
|
|
231
|
-
},
|
|
232
|
-
onClick: function onClick() {
|
|
233
|
-
!disabled && onValueChange({
|
|
234
|
-
value: value,
|
|
235
|
-
options: items
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}, _react["default"].createElement("span", {
|
|
239
|
-
style: {
|
|
240
|
-
display: 'inline-block'
|
|
241
|
-
}
|
|
242
|
-
}, _react["default"].createElement(_ellipsis["default"], {
|
|
243
|
-
widthLimit: 220,
|
|
244
|
-
title: label
|
|
245
|
-
})), isSelected && _react["default"].createElement(_icon["default"], {
|
|
246
|
-
type: "check",
|
|
247
|
-
className: "ant-select-selected-icon"
|
|
248
|
-
}));
|
|
249
|
-
});
|
|
250
|
-
if (showEmpty && !(0, _find2["default"])(children, function (it) {
|
|
251
|
-
return !!it;
|
|
252
|
-
})) {
|
|
253
|
-
children = _react["default"].createElement(_empty["default"], {
|
|
254
|
-
size: "mini"
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
return _react["default"].createElement("ul", {
|
|
258
|
-
className: "ant-select-dropdown-menu"
|
|
259
|
-
}, children);
|
|
260
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"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,QAAQ,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;YAED,wCAAM,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;gBACtC,8BAAC,kBAAQ,IAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,GAAI,CACtC;YACN,UAAU,IAAI,8BAAC,cAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,IAAI,CAAC,IAAA,aAAI,EAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAC9C,QAAQ,GAAG,8BAAC,eAAK,IAAC,IAAI,EAAC,MAAM,GAAG,CAAA;KACjC;IAED,OAAO,sCAAI,SAAS,EAAC,0BAA0B,IAAE,QAAQ,CAAM,CAAA;AACjE,CAAC,CAAA","sourcesContent":["import React, { useState, useEffect } from 'react'\nimport { isArray, find } from 'lodash'\nimport classNames from 'classnames'\nimport Icon from '../../../icon'\nimport Ellipsis from '../../../ellipsis'\nimport Empty from '../../../empty'\nimport { highlightSubstring, formatLabel } from './utils'\n\nexport default (props) => {\n const {\n options,\n params,\n queryKey = 'name',\n fieldNames = {\n label: 'label',\n value: 'value',\n },\n loadData,\n onChange,\n value: _value,\n mode,\n propItem,\n searchText,\n showEmpty,\n ...rest\n } = props\n const [items, setItems] = useState(options || [])\n\n useEffect(() => {\n if (loadData) {\n loadData({\n [queryKey]: searchText,\n ...(params || {}),\n }).then((items) => {\n setItems(items)\n })\n }\n }, [params, searchText])\n\n useEffect(() => {\n setItems(options || [])\n }, [options])\n\n const onValueChange = (item) => {\n onChange(item, mode === 'multiple' || mode === 'tags')\n }\n\n let children = items.map((item) => {\n const labelKey = fieldNames?.label || 'label'\n const valueKey = fieldNames?.value || 'value'\n const value = item instanceof Object ? item[valueKey] : item\n const label = item instanceof Object ? item[labelKey] : item + ''\n const disabled = item instanceof Object ? item['disabled'] : false\n\n const isSelected = isArray(_value) ? _value?.indexOf(value) > -1 : value === _value\n if (searchText) {\n const isReactDom = React.isValidElement(label)\n const _label = isReactDom ? formatLabel(label) : label\n if (_label?.indexOf(searchText) > -1) {\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n 'ant-select-dropdown-menu-item-disabled': disabled,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n !disabled &&\n onValueChange({\n value,\n propItem,\n options: items,\n })\n }}\n >\n {!showEmpty && <span>{propItem?.propsTitle || propItem?.name}: </span>}\n <span style={{ display: 'inline-block' }}>\n <Ellipsis\n widthLimit={220}\n title={\n isReactDom ? (\n <span>{label}</span>\n ) : (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(label, searchText),\n }}\n ></span>\n )\n }\n />\n </span>\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n }\n return null\n }\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n 'ant-select-dropdown-menu-item-disabled': disabled,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n !disabled && onValueChange({ value, options: items })\n }}\n >\n <span style={{ display: 'inline-block' }}>\n <Ellipsis widthLimit={220} title={label} />\n </span>\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n })\n\n if (showEmpty && !find(children, (it) => !!it)) {\n children = <Empty size=\"mini\" />\n }\n\n return <ul className=\"ant-select-dropdown-menu\">{children}</ul>\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/SelectInput.js"],"names":[],"mappings":"AAGA,mEASC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports["default"] = SelectInput;
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
var _SelectInput = _interopRequireDefault(require("../SelectInput"));
|
|
18
|
-
function _interopRequireDefault(obj) {
|
|
19
|
-
return obj && obj.__esModule ? obj : {
|
|
20
|
-
"default": obj
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function _getRequireWildcardCache(e) {
|
|
24
|
-
if ("function" != typeof WeakMap) return null;
|
|
25
|
-
var r = new WeakMap(),
|
|
26
|
-
t = new WeakMap();
|
|
27
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
28
|
-
return e ? t : r;
|
|
29
|
-
})(e);
|
|
30
|
-
}
|
|
31
|
-
function _interopRequireWildcard(e, r) {
|
|
32
|
-
if (!r && e && e.__esModule) return e;
|
|
33
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
34
|
-
"default": e
|
|
35
|
-
};
|
|
36
|
-
var t = _getRequireWildcardCache(r);
|
|
37
|
-
if (t && t.has(e)) return t.get(e);
|
|
38
|
-
var n = {
|
|
39
|
-
__proto__: null
|
|
40
|
-
},
|
|
41
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
43
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
44
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
45
|
-
}
|
|
46
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
47
|
-
}
|
|
48
|
-
function _slicedToArray(arr, i) {
|
|
49
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
50
|
-
}
|
|
51
|
-
function _nonIterableRest() {
|
|
52
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
53
|
-
}
|
|
54
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
55
|
-
if (!o) return;
|
|
56
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
57
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
58
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
59
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
60
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
61
|
-
}
|
|
62
|
-
function _arrayLikeToArray(arr, len) {
|
|
63
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
64
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
65
|
-
return arr2;
|
|
66
|
-
}
|
|
67
|
-
function _iterableToArrayLimit(r, l) {
|
|
68
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
69
|
-
if (null != t) {
|
|
70
|
-
var e,
|
|
71
|
-
n,
|
|
72
|
-
i,
|
|
73
|
-
u,
|
|
74
|
-
a = [],
|
|
75
|
-
f = !0,
|
|
76
|
-
o = !1;
|
|
77
|
-
try {
|
|
78
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
79
|
-
if (Object(t) !== t) return;
|
|
80
|
-
f = !1;
|
|
81
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
82
|
-
} catch (r) {
|
|
83
|
-
o = !0, n = r;
|
|
84
|
-
} finally {
|
|
85
|
-
try {
|
|
86
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
87
|
-
} finally {
|
|
88
|
-
if (o) throw n;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return a;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function _arrayWithHoles(arr) {
|
|
95
|
-
if (Array.isArray(arr)) return arr;
|
|
96
|
-
}
|
|
97
|
-
function SelectInput(props) {
|
|
98
|
-
var value = props.value,
|
|
99
|
-
onChange = props.onChange;
|
|
100
|
-
var _useState = (0, _react.useState)(value),
|
|
101
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
102
|
-
iValue = _useState2[0],
|
|
103
|
-
setIValue = _useState2[1];
|
|
104
|
-
(0, _react.useEffect)(function () {
|
|
105
|
-
setIValue(value);
|
|
106
|
-
}, [value]);
|
|
107
|
-
return _react["default"].createElement(_SelectInput["default"], Object.assign({}, props, {
|
|
108
|
-
value: iValue,
|
|
109
|
-
_onChange: onChange,
|
|
110
|
-
onChange: setIValue
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/SelectInput.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkD;AAClD,iEAA4C;AAE5C,SAAwB,WAAW,CAAC,KAAK;IACvC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAE3C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,8BAAC,qBAAe,oBAAK,KAAK,IAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,IAAI,CAAA;AAChG,CAAC;AATD,8BASC","sourcesContent":["import React, { useEffect, useState } from 'react'\nimport SelectInputBase from '../SelectInput'\n\nexport default function SelectInput(props) {\n const { value, onChange } = props\n const [iValue, setIValue] = useState(value)\n\n useEffect(() => {\n setIValue(value)\n }, [value])\n\n return <SelectInputBase {...props} value={iValue} _onChange={onChange} onChange={setIValue} />\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default function ValueTag({ item, fieldItems, locale, onDelete, value, onChange, clsPrefix, form, handleTag, }: {
|
|
2
|
-
item: any;
|
|
3
|
-
fieldItems: any;
|
|
4
|
-
locale: any;
|
|
5
|
-
onDelete: any;
|
|
6
|
-
value: any;
|
|
7
|
-
onChange: any;
|
|
8
|
-
clsPrefix: any;
|
|
9
|
-
form: any;
|
|
10
|
-
handleTag: any;
|
|
11
|
-
}): React.JSX.Element | null;
|
|
12
|
-
import React from "react";
|
|
13
|
-
//# sourceMappingURL=ValueTag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValueTag.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/ValueTag.js"],"names":[],"mappings":"AAUA;;;;;;;;;;6BAwIC"}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
|
|
6
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7
|
-
return typeof o;
|
|
8
|
-
} : function (o) {
|
|
9
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
|
-
}, _typeof(o);
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports["default"] = ValueTag;
|
|
16
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
17
|
-
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
var _popover = _interopRequireDefault(require("../../../popover"));
|
|
20
|
-
var _tag = _interopRequireDefault(require("../../../tag"));
|
|
21
|
-
var _fieldsMap = _interopRequireDefault(require("../fieldsMap"));
|
|
22
|
-
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
23
|
-
var _Select = _interopRequireDefault(require("./Select"));
|
|
24
|
-
var _utils = require("./utils");
|
|
25
|
-
require("./FieldPopover.less");
|
|
26
|
-
function _getRequireWildcardCache(e) {
|
|
27
|
-
if ("function" != typeof WeakMap) return null;
|
|
28
|
-
var r = new WeakMap(),
|
|
29
|
-
t = new WeakMap();
|
|
30
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
31
|
-
return e ? t : r;
|
|
32
|
-
})(e);
|
|
33
|
-
}
|
|
34
|
-
function _interopRequireWildcard(e, r) {
|
|
35
|
-
if (!r && e && e.__esModule) return e;
|
|
36
|
-
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
37
|
-
"default": e
|
|
38
|
-
};
|
|
39
|
-
var t = _getRequireWildcardCache(r);
|
|
40
|
-
if (t && t.has(e)) return t.get(e);
|
|
41
|
-
var n = {
|
|
42
|
-
__proto__: null
|
|
43
|
-
},
|
|
44
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
46
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
47
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
48
|
-
}
|
|
49
|
-
return n["default"] = e, t && t.set(e, n), n;
|
|
50
|
-
}
|
|
51
|
-
function _interopRequireDefault(obj) {
|
|
52
|
-
return obj && obj.__esModule ? obj : {
|
|
53
|
-
"default": obj
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function _slicedToArray(arr, i) {
|
|
57
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
58
|
-
}
|
|
59
|
-
function _nonIterableRest() {
|
|
60
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
61
|
-
}
|
|
62
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
63
|
-
if (!o) return;
|
|
64
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
65
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
67
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
68
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
69
|
-
}
|
|
70
|
-
function _arrayLikeToArray(arr, len) {
|
|
71
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
72
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
73
|
-
return arr2;
|
|
74
|
-
}
|
|
75
|
-
function _iterableToArrayLimit(r, l) {
|
|
76
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
77
|
-
if (null != t) {
|
|
78
|
-
var e,
|
|
79
|
-
n,
|
|
80
|
-
i,
|
|
81
|
-
u,
|
|
82
|
-
a = [],
|
|
83
|
-
f = !0,
|
|
84
|
-
o = !1;
|
|
85
|
-
try {
|
|
86
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
87
|
-
if (Object(t) !== t) return;
|
|
88
|
-
f = !1;
|
|
89
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
90
|
-
} catch (r) {
|
|
91
|
-
o = !0, n = r;
|
|
92
|
-
} finally {
|
|
93
|
-
try {
|
|
94
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
95
|
-
} finally {
|
|
96
|
-
if (o) throw n;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return a;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function _arrayWithHoles(arr) {
|
|
103
|
-
if (Array.isArray(arr)) return arr;
|
|
104
|
-
}
|
|
105
|
-
function ValueTag(_ref) {
|
|
106
|
-
var item = _ref.item,
|
|
107
|
-
fieldItems = _ref.fieldItems,
|
|
108
|
-
locale = _ref.locale,
|
|
109
|
-
onDelete = _ref.onDelete,
|
|
110
|
-
value = _ref.value,
|
|
111
|
-
onChange = _ref.onChange,
|
|
112
|
-
clsPrefix = _ref.clsPrefix,
|
|
113
|
-
form = _ref.form,
|
|
114
|
-
handleTag = _ref.handleTag;
|
|
115
|
-
var _a;
|
|
116
|
-
var _useState = (0, _react.useState)(),
|
|
117
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
118
|
-
visible = _useState2[0],
|
|
119
|
-
setVisible = _useState2[1];
|
|
120
|
-
var propItem = ((_a = (0, _find2["default"])(fieldItems, function (it) {
|
|
121
|
-
var _a;
|
|
122
|
-
return ((_a = it.props) === null || _a === void 0 ? void 0 : _a.name) === item.key;
|
|
123
|
-
})) === null || _a === void 0 ? void 0 : _a.props) || {};
|
|
124
|
-
var name = propItem.name,
|
|
125
|
-
propsTitle = propItem.propsTitle,
|
|
126
|
-
title = propItem.title,
|
|
127
|
-
_propItem$type = propItem.type,
|
|
128
|
-
type = _propItem$type === void 0 ? 'input' : _propItem$type,
|
|
129
|
-
className = propItem.className,
|
|
130
|
-
component = propItem.component,
|
|
131
|
-
fieldProps = propItem.props,
|
|
132
|
-
_propItem$closable = propItem.closable,
|
|
133
|
-
closable = _propItem$closable === void 0 ? true : _propItem$closable;
|
|
134
|
-
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
135
|
-
setVisible(visible);
|
|
136
|
-
};
|
|
137
|
-
var close = function close() {
|
|
138
|
-
setVisible(false);
|
|
139
|
-
};
|
|
140
|
-
var onFieldChange = function onFieldChange() {
|
|
141
|
-
var _a;
|
|
142
|
-
var copyValue = (0, _cloneDeep2["default"])(value);
|
|
143
|
-
var index = copyValue.findIndex(function (v) {
|
|
144
|
-
return v.key === name;
|
|
145
|
-
});
|
|
146
|
-
copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
|
|
147
|
-
if (['date', 'checkbox'].includes(type) || type === 'dateRange' && ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a[1])) {
|
|
148
|
-
close();
|
|
149
|
-
}
|
|
150
|
-
onChange(copyValue, false, (arguments.length <= 0 ? undefined : arguments[0]) !== undefined, type !== 'selectInput');
|
|
151
|
-
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
152
|
-
};
|
|
153
|
-
var onSelectChange = function onSelectChange(v, isMultiple) {
|
|
154
|
-
var _a, _b, _c;
|
|
155
|
-
var copyValue = (0, _cloneDeep2["default"])(value || []);
|
|
156
|
-
var index = copyValue.findIndex(function (v) {
|
|
157
|
-
return v.key === name;
|
|
158
|
-
});
|
|
159
|
-
if (isMultiple) {
|
|
160
|
-
if (!((_b = (_a = copyValue[index]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
161
|
-
copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
|
|
162
|
-
} else {
|
|
163
|
-
if (((_c = copyValue[index].value) === null || _c === void 0 ? void 0 : _c.indexOf(v.value)) > -1) {
|
|
164
|
-
copyValue[index].value = copyValue[index].value.filter(function (val) {
|
|
165
|
-
return val !== v.value;
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
copyValue[index].value.push(v.value);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
|
|
173
|
-
close();
|
|
174
|
-
}
|
|
175
|
-
onChange(copyValue, false, true);
|
|
176
|
-
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
177
|
-
};
|
|
178
|
-
var renderSecondOptions = function renderSecondOptions() {
|
|
179
|
-
var _a;
|
|
180
|
-
var isSelectInput = type === 'selectInput';
|
|
181
|
-
var Field = isSelectInput ? _SelectInput["default"] : component || _fieldsMap["default"][type] || function () {
|
|
182
|
-
return null;
|
|
183
|
-
};
|
|
184
|
-
return _react["default"].createElement("div", {
|
|
185
|
-
onClick: function onClick(e) {
|
|
186
|
-
return e.stopPropagation();
|
|
187
|
-
},
|
|
188
|
-
className: className
|
|
189
|
-
}, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
|
|
190
|
-
propItem: propItem,
|
|
191
|
-
onChange: onSelectChange,
|
|
192
|
-
value: item === null || item === void 0 ? void 0 : item.value,
|
|
193
|
-
showEmpty: true
|
|
194
|
-
})) : _react["default"].createElement("div", {
|
|
195
|
-
className: "".concat(clsPrefix, "-field-popover-content"),
|
|
196
|
-
onClick: function onClick(e) {
|
|
197
|
-
return e.stopPropagation();
|
|
198
|
-
}
|
|
199
|
-
}, _react["default"].createElement(Field, Object.assign({
|
|
200
|
-
form: form,
|
|
201
|
-
value: item === null || item === void 0 ? void 0 : item.value
|
|
202
|
-
}, fieldProps, {
|
|
203
|
-
style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
|
|
204
|
-
width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || (isSelectInput ? '361px' : '250px')
|
|
205
|
-
}),
|
|
206
|
-
close: close,
|
|
207
|
-
onChange: onFieldChange,
|
|
208
|
-
name: name
|
|
209
|
-
}))));
|
|
210
|
-
};
|
|
211
|
-
var _isInput = (0, _utils.isInput)(type) && !component;
|
|
212
|
-
if ((item === null || item === void 0 ? void 0 : item.value) === undefined) {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
return _react["default"].createElement(_popover["default"], {
|
|
216
|
-
trigger: "click",
|
|
217
|
-
visible: visible && !_isInput,
|
|
218
|
-
onVisibleChange: handleVisibleChange,
|
|
219
|
-
overlayClassName: "".concat(clsPrefix, "-field-popover"),
|
|
220
|
-
content: renderSecondOptions(),
|
|
221
|
-
placement: "bottomLeft"
|
|
222
|
-
}, _react["default"].createElement(_tag["default"], {
|
|
223
|
-
closable: !(closable === false || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.allowClear) === false),
|
|
224
|
-
onClick: function onClick(e) {
|
|
225
|
-
e.preventDefault();
|
|
226
|
-
e.stopPropagation();
|
|
227
|
-
if (!_isInput) {
|
|
228
|
-
setVisible(true);
|
|
229
|
-
} else {
|
|
230
|
-
handleTag((0, _cloneDeep2["default"])(item));
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
onClose: function onClose(e) {
|
|
234
|
-
return onDelete(item.key, e);
|
|
235
|
-
},
|
|
236
|
-
ellipsisOptions: {
|
|
237
|
-
widthLimit: '140px'
|
|
238
|
-
},
|
|
239
|
-
border: false
|
|
240
|
-
}, (0, _utils.getLabel)(item, fieldItems, locale)));
|
|
241
|
-
}
|