tntd 3.0.0-beta.19 → 3.0.0-beta.20
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/array-input/index.js +57 -42
- package/es/array-input/index.js.map +1 -1
- package/es/array-input/index.less +4 -1
- package/es/locale/en_US.js +3 -0
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +3 -0
- package/es/locale/zh_CN.js.map +1 -1
- package/es/table/expand.less +12 -14
- package/es/table/hooks/use-expand-fixed.js +4 -2
- package/es/table/hooks/use-expand-fixed.js.map +1 -1
- package/es/table/table.js +15 -82
- package/es/table/table.js.map +1 -1
- package/es/tntd-action/Action.js +1 -1
- package/es/tntd-action/Action.js.map +1 -1
- package/lib/array-input/index.d.ts +1 -12
- package/lib/array-input/index.d.ts.map +1 -1
- package/lib/array-input/index.js +62 -55
- package/lib/array-input/index.js.map +1 -1
- package/lib/array-input/index.less +4 -1
- package/lib/locale/default.d.ts +3 -0
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +3 -0
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +3 -0
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/table/expand.less +12 -14
- package/lib/table/hooks/use-expand-fixed.d.ts.map +1 -1
- package/lib/table/hooks/use-expand-fixed.js +6 -4
- package/lib/table/hooks/use-expand-fixed.js.map +1 -1
- package/lib/table/table.d.ts +1 -2
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +15 -78
- package/lib/table/table.js.map +1 -1
- package/lib/tntd-action/Action.d.ts +1 -1
- package/lib/tntd-action/Action.js +1 -1
- package/lib/tntd-action/Action.js.map +1 -1
- package/package.json +2 -2
- package/es/array-input/1.png +0 -1
- package/es/array-input/111.gif +0 -0
- package/es/array-input/icon.js +0 -25
- package/es/array-input/icon.js.map +0 -1
- package/es/query-form/Field/Composition/FieldPopover.js +0 -328
- package/es/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/es/query-form/Field/Composition/FieldPopover.less +0 -35
- package/es/query-form/Field/Composition/Select.js +0 -107
- package/es/query-form/Field/Composition/Select.js.map +0 -1
- package/es/query-form/Field/Composition/index.js +0 -210
- package/es/query-form/Field/Composition/index.js.map +0 -1
- package/es/query-form/Field/Composition/index.less +0 -114
- package/es/query-form/Field/Composition/utils.js +0 -132
- package/es/query-form/Field/Composition/utils.js.map +0 -1
- package/es/query-form2/Field/Checkbox.js +0 -23
- package/es/query-form2/Field/Checkbox.js.map +0 -1
- package/es/query-form2/Field/Composition/FieldPopover.js +0 -308
- package/es/query-form2/Field/Composition/FieldPopover.js.map +0 -1
- package/es/query-form2/Field/Composition/FieldPopover.less +0 -35
- package/es/query-form2/Field/Composition/Select.js +0 -104
- package/es/query-form2/Field/Composition/Select.js.map +0 -1
- package/es/query-form2/Field/Composition/index.js +0 -299
- package/es/query-form2/Field/Composition/index.js.map +0 -1
- package/es/query-form2/Field/Composition/index.less +0 -114
- package/es/query-form2/Field/Composition/utils.js +0 -19
- package/es/query-form2/Field/Composition/utils.js.map +0 -1
- package/es/query-form2/Field/Select.js +0 -59
- package/es/query-form2/Field/Select.js.map +0 -1
- package/es/query-form2/Field/SelectInput.js +0 -87
- package/es/query-form2/Field/SelectInput.js.map +0 -1
- package/es/query-form2/Field/fieldsMap.js +0 -28
- package/es/query-form2/Field/fieldsMap.js.map +0 -1
- package/es/query-form2/Field/index.js +0 -117
- package/es/query-form2/Field/index.js.map +0 -1
- package/es/query-form2/createActions.js +0 -47
- package/es/query-form2/createActions.js.map +0 -1
- package/es/query-form2/index.js +0 -345
- package/es/query-form2/index.js.map +0 -1
- package/es/query-form2/index.less +0 -136
- package/es/query-form2/useForm.js +0 -6
- package/es/query-form2/useForm.js.map +0 -1
- package/lib/array-input/1.png +0 -1
- package/lib/array-input/111.gif +0 -0
- package/lib/array-input/icon.d.ts +0 -4
- package/lib/array-input/icon.d.ts.map +0 -1
- package/lib/array-input/icon.js +0 -32
- package/lib/array-input/icon.js.map +0 -1
- 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 -368
- package/lib/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/lib/query-form/Field/Composition/FieldPopover.less +0 -35
- 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 -131
- package/lib/query-form/Field/Composition/Select.js.map +0 -1
- package/lib/query-form/Field/Composition/index.d.ts +0 -10
- package/lib/query-form/Field/Composition/index.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/index.js +0 -257
- package/lib/query-form/Field/Composition/index.js.map +0 -1
- package/lib/query-form/Field/Composition/index.less +0 -114
- package/lib/query-form/Field/Composition/utils.d.ts +0 -22
- package/lib/query-form/Field/Composition/utils.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/utils.js +0 -147
- package/lib/query-form/Field/Composition/utils.js.map +0 -1
- package/lib/query-form2/Field/Checkbox.d.ts +0 -8
- package/lib/query-form2/Field/Checkbox.d.ts.map +0 -1
- package/lib/query-form2/Field/Checkbox.js +0 -28
- package/lib/query-form2/Field/Checkbox.js.map +0 -1
- package/lib/query-form2/Field/Composition/FieldPopover.d.ts +0 -19
- package/lib/query-form2/Field/Composition/FieldPopover.d.ts.map +0 -1
- package/lib/query-form2/Field/Composition/FieldPopover.js +0 -347
- package/lib/query-form2/Field/Composition/FieldPopover.js.map +0 -1
- package/lib/query-form2/Field/Composition/FieldPopover.less +0 -35
- package/lib/query-form2/Field/Composition/Select.d.ts +0 -4
- package/lib/query-form2/Field/Composition/Select.d.ts.map +0 -1
- package/lib/query-form2/Field/Composition/Select.js +0 -128
- package/lib/query-form2/Field/Composition/Select.js.map +0 -1
- package/lib/query-form2/Field/Composition/index.d.ts +0 -14
- package/lib/query-form2/Field/Composition/index.d.ts.map +0 -1
- package/lib/query-form2/Field/Composition/index.js +0 -349
- package/lib/query-form2/Field/Composition/index.js.map +0 -1
- package/lib/query-form2/Field/Composition/index.less +0 -114
- package/lib/query-form2/Field/Composition/utils.d.ts +0 -6
- package/lib/query-form2/Field/Composition/utils.d.ts.map +0 -1
- package/lib/query-form2/Field/Composition/utils.js +0 -27
- package/lib/query-form2/Field/Composition/utils.js.map +0 -1
- package/lib/query-form2/Field/Select.d.ts +0 -4
- package/lib/query-form2/Field/Select.d.ts.map +0 -1
- package/lib/query-form2/Field/Select.js +0 -80
- package/lib/query-form2/Field/Select.js.map +0 -1
- package/lib/query-form2/Field/SelectInput.d.ts +0 -4
- package/lib/query-form2/Field/SelectInput.d.ts.map +0 -1
- package/lib/query-form2/Field/SelectInput.js +0 -100
- package/lib/query-form2/Field/SelectInput.js.map +0 -1
- package/lib/query-form2/Field/fieldsMap.d.ts +0 -27
- package/lib/query-form2/Field/fieldsMap.d.ts.map +0 -1
- package/lib/query-form2/Field/fieldsMap.js +0 -35
- package/lib/query-form2/Field/fieldsMap.js.map +0 -1
- package/lib/query-form2/Field/index.d.ts +0 -14
- package/lib/query-form2/Field/index.d.ts.map +0 -1
- package/lib/query-form2/Field/index.js +0 -147
- package/lib/query-form2/Field/index.js.map +0 -1
- package/lib/query-form2/createActions.d.ts +0 -14
- package/lib/query-form2/createActions.d.ts.map +0 -1
- package/lib/query-form2/createActions.js +0 -54
- package/lib/query-form2/createActions.js.map +0 -1
- package/lib/query-form2/index.d.ts +0 -36
- package/lib/query-form2/index.d.ts.map +0 -1
- package/lib/query-form2/index.js +0 -385
- package/lib/query-form2/index.js.map +0 -1
- package/lib/query-form2/index.less +0 -136
- package/lib/query-form2/useForm.d.ts +0 -13
- package/lib/query-form2/useForm.d.ts.map +0 -1
- package/lib/query-form2/useForm.js +0 -13
- package/lib/query-form2/useForm.js.map +0 -1
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatLabel = formatLabel;
|
|
7
|
-
exports.getLabelByValue = getLabelByValue;
|
|
8
|
-
exports.getLabelFromOptions = getLabelFromOptions;
|
|
9
|
-
exports.highlightSubstring = highlightSubstring;
|
|
10
|
-
exports.parseArrayToObject = parseArrayToObject;
|
|
11
|
-
exports.parseObjectToArray = parseObjectToArray;
|
|
12
|
-
var _flatten2 = _interopRequireDefault(require("lodash/flatten"));
|
|
13
|
-
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
14
|
-
var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
-
function highlightSubstring(str, substring) {
|
|
19
|
-
var highlighted = "<span class=\"tnt-highlight\">".concat(substring, "</span>");
|
|
20
|
-
return str.replace(new RegExp(substring, 'g'), highlighted);
|
|
21
|
-
}
|
|
22
|
-
function getLabelFromOptions(key, options) {
|
|
23
|
-
var fieldNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
24
|
-
label: 'label',
|
|
25
|
-
value: 'value'
|
|
26
|
-
};
|
|
27
|
-
var labelValue = key;
|
|
28
|
-
if (options) {
|
|
29
|
-
var target = options === null || options === void 0 ? void 0 : options.find(function (item) {
|
|
30
|
-
var valueKey = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value;
|
|
31
|
-
var itemValue = item instanceof Object ? item[valueKey] : item;
|
|
32
|
-
return itemValue === key;
|
|
33
|
-
});
|
|
34
|
-
labelValue = target instanceof Object ? target === null || target === void 0 ? void 0 : target[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label] : target;
|
|
35
|
-
}
|
|
36
|
-
return labelValue;
|
|
37
|
-
}
|
|
38
|
-
function getLabelByValue(_ref) {
|
|
39
|
-
var value = _ref.value,
|
|
40
|
-
options = _ref.options,
|
|
41
|
-
_ref$fieldNames = _ref.fieldNames,
|
|
42
|
-
fieldNames = _ref$fieldNames === void 0 ? {
|
|
43
|
-
label: 'label',
|
|
44
|
-
value: 'value'
|
|
45
|
-
} : _ref$fieldNames;
|
|
46
|
-
var getLabel = function getLabel(value) {
|
|
47
|
-
var target = options === null || options === void 0 ? void 0 : options.find(function (item) {
|
|
48
|
-
var valueKey = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value;
|
|
49
|
-
var itemValue = item instanceof Object ? item[valueKey] : item;
|
|
50
|
-
return itemValue === value;
|
|
51
|
-
});
|
|
52
|
-
return target instanceof Object ? target === null || target === void 0 ? void 0 : target[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label] : target;
|
|
53
|
-
};
|
|
54
|
-
if ((0, _isArray2["default"])(value)) {
|
|
55
|
-
return value.map(getLabel).join(' | ');
|
|
56
|
-
} else {
|
|
57
|
-
return getLabel(value);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function formatLabel(reactDom) {
|
|
61
|
-
return (0, _flatten2["default"])(_react["default"].Children.map(reactDom.props.children, function (child) {
|
|
62
|
-
if (_react["default"].isValidElement(child)) {
|
|
63
|
-
return formatLabel(child);
|
|
64
|
-
} else if ((0, _isString2["default"])(child)) {
|
|
65
|
-
return child;
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
})).join('');
|
|
69
|
-
}
|
|
70
|
-
function parseObjectToArray(value, data) {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
return (_b = (_a = Object.keys(value)) === null || _a === void 0 ? void 0 : _a.map(function (key) {
|
|
73
|
-
var _a, _b, _c;
|
|
74
|
-
var target = data === null || data === void 0 ? void 0 : data.find(function (item) {
|
|
75
|
-
var _a;
|
|
76
|
-
return ((_a = item.props) === null || _a === void 0 ? void 0 : _a.name) === key;
|
|
77
|
-
});
|
|
78
|
-
if (!target) return null;
|
|
79
|
-
var dataItem = (target === null || target === void 0 ? void 0 : target.props) || {};
|
|
80
|
-
var _ref2 = dataItem || {},
|
|
81
|
-
type = _ref2.type,
|
|
82
|
-
component = _ref2.component,
|
|
83
|
-
setLabel = _ref2.setLabel,
|
|
84
|
-
fieldProps = _ref2.props,
|
|
85
|
-
propsTitle = _ref2.propsTitle,
|
|
86
|
-
title = _ref2.title,
|
|
87
|
-
name = _ref2.name;
|
|
88
|
-
var _propsTitle = propsTitle || title || name;
|
|
89
|
-
var _ref3 = fieldProps || {},
|
|
90
|
-
options = _ref3.options,
|
|
91
|
-
format = _ref3.format;
|
|
92
|
-
var fieldNames = ((_a = dataItem === null || dataItem === void 0 ? void 0 : dataItem.props) === null || _a === void 0 ? void 0 : _a.fieldNames) || {
|
|
93
|
-
label: 'label',
|
|
94
|
-
value: 'value'
|
|
95
|
-
};
|
|
96
|
-
var labelValue = value[key];
|
|
97
|
-
if (!type && component) {
|
|
98
|
-
if (!setLabel) {
|
|
99
|
-
console.error('自定义组件需要传入setLabel()方法');
|
|
100
|
-
}
|
|
101
|
-
} else if (setLabel) {
|
|
102
|
-
// setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
|
|
103
|
-
labelValue = setLabel(labelValue);
|
|
104
|
-
} else if (options) {
|
|
105
|
-
if (type === 'selectInput') {
|
|
106
|
-
var selectKey = (_b = Object.keys(labelValue)) === null || _b === void 0 ? void 0 : _b[0];
|
|
107
|
-
if (!selectKey) {
|
|
108
|
-
// 17. inputSelect组件,初始值{},展示undefined:undefined
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
var inputValue = labelValue[selectKey];
|
|
112
|
-
var selectLabel = (_c = options === null || options === void 0 ? void 0 : options.find(function (v) {
|
|
113
|
-
return v.value === selectKey;
|
|
114
|
-
})) === null || _c === void 0 ? void 0 : _c.label;
|
|
115
|
-
return {
|
|
116
|
-
key: key,
|
|
117
|
-
value: value[key],
|
|
118
|
-
closable: true,
|
|
119
|
-
label: selectLabel + ':' + inputValue
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
labelValue = getLabelByValue({
|
|
123
|
-
value: labelValue,
|
|
124
|
-
options: options,
|
|
125
|
-
fieldNames: fieldNames
|
|
126
|
-
});
|
|
127
|
-
} else if (type === 'dateRange' && format) {
|
|
128
|
-
labelValue = [(0, _moment["default"])(labelValue[0]).format(format), (0, _moment["default"])(labelValue[1]).format(format)].join('~');
|
|
129
|
-
} else if (type === 'date' && format) {
|
|
130
|
-
labelValue = (0, _moment["default"])(labelValue).format(format);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
key: key,
|
|
134
|
-
value: value[key],
|
|
135
|
-
closable: true,
|
|
136
|
-
label: _propsTitle + ':' + labelValue
|
|
137
|
-
};
|
|
138
|
-
})) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
|
|
139
|
-
return !!item;
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
function parseArrayToObject(value) {
|
|
143
|
-
return value === null || value === void 0 ? void 0 : value.reduce(function (acc, v) {
|
|
144
|
-
acc[v.key] = v.value;
|
|
145
|
-
return acc;
|
|
146
|
-
}, {});
|
|
147
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/utils.js"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,mCAAmD;AACnD,oDAA2B;AAE3B,SAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS;IAC/C,MAAM,WAAW,GAAG,+BAA+B,SAAS,SAAS,CAAA;IACrE,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,WAAW,CA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,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAA;QACpB,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AALD,gDAKC","sourcesContent":["import React from 'react'\nimport { isArray, isString, flatten } from 'lodash'\nimport moment from 'moment'\n\nexport function highlightSubstring(str, substring) {\n const highlighted = `<span class=\"tnt-highlight\">${substring}</span>`\n return str.replace(new RegExp(substring, 'g'), highlighted)\n}\n\nexport function getLabelFromOptions(\n key,\n options,\n fieldNames = {\n label: 'label',\n value: 'value',\n }\n) {\n let labelValue = key\n if (options) {\n const target = options?.find((item) => {\n const valueKey = fieldNames?.value\n const itemValue = item instanceof Object ? item[valueKey] : item\n return itemValue === key\n })\n labelValue = target instanceof Object ? target?.[fieldNames?.label] : target\n }\n return labelValue\n}\n\nexport function getLabelByValue({\n value,\n options,\n fieldNames = {\n label: 'label',\n value: 'value',\n },\n}) {\n const getLabel = (value) => {\n const target = options?.find((item) => {\n const valueKey = fieldNames?.value\n const itemValue = item instanceof Object ? item[valueKey] : item\n return itemValue === value\n })\n return target instanceof Object ? target?.[fieldNames?.label] : target\n }\n if (isArray(value)) {\n return value.map(getLabel).join(' | ')\n } else {\n return getLabel(value)\n }\n}\n\nexport function formatLabel(reactDom) {\n return flatten(\n React.Children.map(reactDom.props.children, (child) => {\n if (React.isValidElement(child)) {\n return formatLabel(child)\n } else if (isString(child)) {\n return child\n }\n return ''\n })\n ).join('')\n}\n\nexport function parseObjectToArray(value, data) {\n return Object.keys(value)\n ?.map((key) => {\n const target = data?.find((item) => item.props?.name === key)\n if (!target) return null\n const dataItem = target?.props || {}\n const {\n type,\n component,\n setLabel,\n props: fieldProps,\n propsTitle,\n title,\n name,\n } = dataItem || {}\n const _propsTitle = propsTitle || title || name\n const { options, format } = fieldProps || {}\n const fieldNames = dataItem?.props?.fieldNames || {\n label: 'label',\n value: 'value',\n }\n let labelValue = value[key]\n if (!type && component) {\n if (!setLabel) {\n console.error('自定义组件需要传入setLabel()方法')\n }\n } else if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n labelValue = setLabel(labelValue)\n } else if (options) {\n if (type === 'selectInput') {\n const selectKey = Object.keys(labelValue)?.[0]\n if (!selectKey) {\n // 17. inputSelect组件,初始值{},展示undefined:undefined\n return false\n }\n const inputValue = labelValue[selectKey]\n const selectLabel = options?.find((v) => v.value === selectKey)?.label\n return {\n key,\n value: value[key],\n closable: true,\n label: selectLabel + ':' + inputValue,\n }\n }\n labelValue = getLabelByValue({ value: labelValue, options, fieldNames })\n } else if (type === 'dateRange' && format) {\n labelValue = [\n moment(labelValue[0]).format(format),\n moment(labelValue[1]).format(format),\n ].join('~')\n } else if (type === 'date' && format) {\n labelValue = moment(labelValue).format(format)\n }\n return {\n key,\n value: value[key],\n closable: true,\n label: _propsTitle + ':' + labelValue,\n }\n })\n ?.filter((item) => !!item)\n}\n\nexport function parseArrayToObject(value) {\n return value?.reduce((acc, v) => {\n acc[v.key] = v.value\n return acc\n }, {})\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/query-form2/Field/Checkbox.js"],"names":[],"mappings":"AAIe;;;;sBAQd"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _checkbox = _interopRequireDefault(require("../../checkbox"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
13
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
14
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
15
|
-
}
|
|
16
|
-
return t;
|
|
17
|
-
};
|
|
18
|
-
var _default = exports["default"] = function _default(_a) {
|
|
19
|
-
var value = _a.value,
|
|
20
|
-
_onChange = _a.onChange,
|
|
21
|
-
props = __rest(_a, ["value", "onChange"]);
|
|
22
|
-
return _react["default"].createElement(_checkbox["default"], Object.assign({}, props, {
|
|
23
|
-
checked: value,
|
|
24
|
-
onChange: function onChange(evt) {
|
|
25
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(evt.target.checked);
|
|
26
|
-
}
|
|
27
|
-
}));
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form2/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,8DAAqC;AAErC,kBAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,8BAAC,kBAAQ,oBACH,KAAK,IACT,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,IACD,CACH,CAAA;CAAA,CAAA","sourcesContent":["import React from 'react'\n\nimport Checkbox from '../../checkbox'\n\nexport default ({ value, onChange, ...props }) => (\n <Checkbox\n {...props}\n checked={value}\n onChange={(evt) => {\n onChange?.(evt.target.checked)\n }}\n />\n)\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare var _default: React.ForwardRefExoticComponent<Pick<{
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
visible: any;
|
|
4
|
-
setVisible: any;
|
|
5
|
-
searchText: any;
|
|
6
|
-
children: any;
|
|
7
|
-
value: any;
|
|
8
|
-
regex: any;
|
|
9
|
-
fieldItems: any;
|
|
10
|
-
propItem: any;
|
|
11
|
-
setFieldItem: any;
|
|
12
|
-
onChange: any;
|
|
13
|
-
form: any;
|
|
14
|
-
locale: any;
|
|
15
|
-
clsPrefix: any;
|
|
16
|
-
}, string | number> & React.RefAttributes<any>>;
|
|
17
|
-
export default _default;
|
|
18
|
-
import React from "react";
|
|
19
|
-
//# sourceMappingURL=FieldPopover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldPopover.d.ts","sourceRoot":"","sources":["../../../../src/query-form2/Field/Composition/FieldPopover.js"],"names":[],"mappings":""}
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _popover = _interopRequireDefault(require("../../../popover"));
|
|
12
|
-
var _Select = _interopRequireDefault(require("./Select"));
|
|
13
|
-
var _utils = require("./utils");
|
|
14
|
-
var _fieldsMap = _interopRequireWildcard(require("../fieldsMap"));
|
|
15
|
-
require("./FieldPopover.less");
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
-
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."); }
|
|
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
|
-
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; }
|
|
23
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
28
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
29
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
30
|
-
}
|
|
31
|
-
return t;
|
|
32
|
-
};
|
|
33
|
-
var isInput = function isInput(type) {
|
|
34
|
-
return ['input', 'string', 'search', 'number', 'inputNumber'].includes(type);
|
|
35
|
-
};
|
|
36
|
-
var FieldPopover = function FieldPopover(_a, ref) {
|
|
37
|
-
var visible = _a.visible,
|
|
38
|
-
setVisible = _a.setVisible,
|
|
39
|
-
searchText = _a.searchText,
|
|
40
|
-
children = _a.children,
|
|
41
|
-
value = _a.value,
|
|
42
|
-
regex = _a.regex,
|
|
43
|
-
fieldItems = _a.fieldItems,
|
|
44
|
-
propItem = _a.propItem,
|
|
45
|
-
setFieldItem = _a.setFieldItem,
|
|
46
|
-
onChange = _a.onChange,
|
|
47
|
-
form = _a.form,
|
|
48
|
-
locale = _a.locale,
|
|
49
|
-
clsPrefix = _a.clsPrefix,
|
|
50
|
-
props = __rest(_a, ["visible", "setVisible", "searchText", "children", "value", "regex", "fieldItems", "propItem", "setFieldItem", "onChange", "form", "locale", "clsPrefix"]);
|
|
51
|
-
var _useState = (0, _react.useState)(undefined),
|
|
52
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
-
searchTarget = _useState2[0],
|
|
54
|
-
setSearchTarget = _useState2[1];
|
|
55
|
-
var _useState3 = (0, _react.useState)(false),
|
|
56
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
-
popoverContent = _useState4[0],
|
|
58
|
-
setPopoverContent = _useState4[1];
|
|
59
|
-
var onPropsClick = function onPropsClick(props) {
|
|
60
|
-
var _ref = props || {},
|
|
61
|
-
_ref$type = _ref.type,
|
|
62
|
-
type = _ref$type === void 0 ? 'input' : _ref$type;
|
|
63
|
-
var copyValue = (0, _cloneDeep2["default"])(value);
|
|
64
|
-
if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(function (v) {
|
|
65
|
-
return v.key === props.name;
|
|
66
|
-
}))) {
|
|
67
|
-
copyValue.push({
|
|
68
|
-
key: props.name,
|
|
69
|
-
value: type === 'array' ? [] : '',
|
|
70
|
-
closable: false,
|
|
71
|
-
label: (props.propsTitle || props.title || props.name) + ':'
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
setFieldItem(props);
|
|
75
|
-
if (isInput(type)) {
|
|
76
|
-
var target = copyValue.find(function (v) {
|
|
77
|
-
return v.key === props.name;
|
|
78
|
-
});
|
|
79
|
-
onChange(target, true);
|
|
80
|
-
close();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
setVisible(true);
|
|
84
|
-
setPopoverContent(true);
|
|
85
|
-
onChange(copyValue);
|
|
86
|
-
};
|
|
87
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
88
|
-
return {
|
|
89
|
-
onPropsClick: onPropsClick
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
var onSelectChange = function onSelectChange(v, isMultiple) {
|
|
93
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
94
|
-
var _ref2 = propItem || (v === null || v === void 0 ? void 0 : v.propItem) || {},
|
|
95
|
-
fieldProps = _ref2.props; // 直接搜索拿v.xx的值
|
|
96
|
-
var copyValue = (0, _cloneDeep2["default"])(value || []);
|
|
97
|
-
var index;
|
|
98
|
-
if (v === null || v === void 0 ? void 0 : v.propItem) {
|
|
99
|
-
var _index = copyValue.findIndex(function (vv) {
|
|
100
|
-
var _a;
|
|
101
|
-
return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
|
|
102
|
-
});
|
|
103
|
-
if (_index > -1) {
|
|
104
|
-
index = _index;
|
|
105
|
-
} else {
|
|
106
|
-
copyValue.push({
|
|
107
|
-
key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
|
|
108
|
-
value: isMultiple ? [] : '',
|
|
109
|
-
label: (((_b = v.propItem) === null || _b === void 0 ? void 0 : _b.propsTitle) || ((_c = v.propItem) === null || _c === void 0 ? void 0 : _c.title) || ((_d = v.propItem) === null || _d === void 0 ? void 0 : _d.name)) + ':'
|
|
110
|
-
});
|
|
111
|
-
index = copyValue.length - 1;
|
|
112
|
-
}
|
|
113
|
-
setFieldItem(v.propItem);
|
|
114
|
-
} else {
|
|
115
|
-
index = copyValue.findIndex(function (v) {
|
|
116
|
-
return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
if (isMultiple) {
|
|
120
|
-
if (!((_f = (_e = copyValue[index]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.length)) {
|
|
121
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
|
|
122
|
-
copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
|
|
123
|
-
} else {
|
|
124
|
-
if (((_g = copyValue[index].value) === null || _g === void 0 ? void 0 : _g.indexOf(v.value)) > -1) {
|
|
125
|
-
copyValue[index].value = copyValue[index].value.filter(function (val) {
|
|
126
|
-
return val !== v.value;
|
|
127
|
-
});
|
|
128
|
-
var _regex = new RegExp("\\|?".concat(v.label), 'g'); //new RegExp(`\\|?${variable}`, 'g')
|
|
129
|
-
var result = copyValue[index].label.replace(_regex, '');
|
|
130
|
-
copyValue[index].label = result;
|
|
131
|
-
} else {
|
|
132
|
-
copyValue[index].value.push(v.value);
|
|
133
|
-
copyValue[index].label += ' | ' + (v === null || v === void 0 ? void 0 : v.label);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
|
|
138
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
|
|
139
|
-
close();
|
|
140
|
-
}
|
|
141
|
-
copyValue[index].closable = true;
|
|
142
|
-
onChange(copyValue, false, true);
|
|
143
|
-
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
144
|
-
};
|
|
145
|
-
var onFieldChange = function onFieldChange() {
|
|
146
|
-
var _a, _b;
|
|
147
|
-
var _ref3 = propItem || {},
|
|
148
|
-
type = _ref3.type,
|
|
149
|
-
component = _ref3.component,
|
|
150
|
-
fieldProps = _ref3.props,
|
|
151
|
-
setLabel = _ref3.setLabel;
|
|
152
|
-
var _ref4 = fieldProps || {},
|
|
153
|
-
options = _ref4.options;
|
|
154
|
-
var copyValue = (0, _cloneDeep2["default"])(value);
|
|
155
|
-
var index = copyValue.findIndex(function (v) {
|
|
156
|
-
return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
|
|
157
|
-
});
|
|
158
|
-
copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
|
|
159
|
-
if (type === 'date') {
|
|
160
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (arguments.length <= 1 ? undefined : arguments[1]);
|
|
161
|
-
close();
|
|
162
|
-
} else if (type === 'dateRange') {
|
|
163
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a.join('~'));
|
|
164
|
-
if ((_b = arguments.length <= 1 ? undefined : arguments[1]) === null || _b === void 0 ? void 0 : _b[1]) {
|
|
165
|
-
close();
|
|
166
|
-
}
|
|
167
|
-
} else if (type === 'selectInput') {
|
|
168
|
-
var key = (0, _get2["default"])(Object.keys(arguments.length <= 0 ? undefined : arguments[0]), '0');
|
|
169
|
-
var val = (0, _get2["default"])(arguments.length <= 0 ? undefined : arguments[0], key);
|
|
170
|
-
var label = (0, _utils.getLabelFromOptions)(key, options);
|
|
171
|
-
copyValue[index].label = "".concat(label, ": ").concat(val);
|
|
172
|
-
} else if (type === 'checkbox') {
|
|
173
|
-
copyValue[index].label = "".concat(copyValue[index].label.match(/(.*:)/)[0], " ").concat((arguments.length <= 0 ? undefined : arguments[0]) ? local.Yes : local.No);
|
|
174
|
-
close();
|
|
175
|
-
} else if (!type && component) {
|
|
176
|
-
if (setLabel) {
|
|
177
|
-
// setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
|
|
178
|
-
copyValue[index].label = setLabel(arguments.length <= 0 ? undefined : arguments[0]);
|
|
179
|
-
} else {
|
|
180
|
-
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + ((arguments.length <= 1 ? undefined : arguments[1]) || (arguments.length <= 0 ? undefined : arguments[0]));
|
|
181
|
-
}
|
|
182
|
-
close();
|
|
183
|
-
}
|
|
184
|
-
copyValue[index].closable = true;
|
|
185
|
-
onChange(copyValue, false, true);
|
|
186
|
-
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
187
|
-
};
|
|
188
|
-
var close = function close() {
|
|
189
|
-
setVisible(false);
|
|
190
|
-
setPopoverContent(false);
|
|
191
|
-
};
|
|
192
|
-
var handleVisibleChange = function handleVisibleChange() {
|
|
193
|
-
if (!visible && !regex.test(searchText)) {
|
|
194
|
-
setVisible(true);
|
|
195
|
-
} else {
|
|
196
|
-
close();
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
(0, _react.useEffect)(function () {
|
|
200
|
-
var bool1 = false,
|
|
201
|
-
bool2 = false;
|
|
202
|
-
if (searchText && !propItem) {
|
|
203
|
-
fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.forEach(function (v) {
|
|
204
|
-
var _ref5 = v.props || {},
|
|
205
|
-
name = _ref5.name,
|
|
206
|
-
propsTitle = _ref5.propsTitle,
|
|
207
|
-
title = _ref5.title,
|
|
208
|
-
type = _ref5.type,
|
|
209
|
-
props = _ref5.props;
|
|
210
|
-
var _propsTitle = propsTitle || title || name;
|
|
211
|
-
if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
|
|
212
|
-
bool1 = true;
|
|
213
|
-
}
|
|
214
|
-
var sOptions = type !== 'select' ? [] : (props === null || props === void 0 ? void 0 : props.options) || [];
|
|
215
|
-
var fieldNames = props === null || props === void 0 ? void 0 : props.fieldNames;
|
|
216
|
-
var target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(function (item) {
|
|
217
|
-
var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
218
|
-
var label = item instanceof Object ? item[labelKey] : item + '';
|
|
219
|
-
return (label === null || label === void 0 ? void 0 : label.indexOf(searchText)) > -1;
|
|
220
|
-
});
|
|
221
|
-
if (target) {
|
|
222
|
-
bool2 = true;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
setSearchTarget(!bool2 && !bool1 ? null : {
|
|
226
|
-
propsTitle: bool1,
|
|
227
|
-
propsValue: bool2
|
|
228
|
-
});
|
|
229
|
-
} else {
|
|
230
|
-
setSearchTarget(undefined);
|
|
231
|
-
}
|
|
232
|
-
}, [fieldItems, searchText, propItem]);
|
|
233
|
-
var renderFirstOptions = function renderFirstOptions(menu) {
|
|
234
|
-
return _react["default"].createElement("div", null, (!searchText || (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsTitle)) && _react["default"].createElement("label", null, locale.propTitle), _react["default"].createElement("ul", {
|
|
235
|
-
className: "ant-select-dropdown-menu"
|
|
236
|
-
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
|
|
237
|
-
var _ref6 = v.props || {},
|
|
238
|
-
name = _ref6.name,
|
|
239
|
-
propsTitle = _ref6.propsTitle,
|
|
240
|
-
title = _ref6.title,
|
|
241
|
-
type = _ref6.type,
|
|
242
|
-
props = _ref6.props;
|
|
243
|
-
var _propsTitle = propsTitle || title || name;
|
|
244
|
-
if (searchText) {
|
|
245
|
-
if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
|
|
246
|
-
return _react["default"].createElement("li", {
|
|
247
|
-
className: "ant-select-dropdown-menu-item",
|
|
248
|
-
key: name,
|
|
249
|
-
value: name,
|
|
250
|
-
onMouseDown: function onMouseDown(e) {
|
|
251
|
-
return e.preventDefault();
|
|
252
|
-
},
|
|
253
|
-
onClick: function onClick() {
|
|
254
|
-
onPropsClick(v.props);
|
|
255
|
-
}
|
|
256
|
-
}, _react["default"].createElement("span", {
|
|
257
|
-
dangerouslySetInnerHTML: {
|
|
258
|
-
__html: (0, _utils.highlightSubstring)(_propsTitle, searchText)
|
|
259
|
-
}
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
return _react["default"].createElement("li", {
|
|
265
|
-
className: "ant-select-dropdown-menu-item",
|
|
266
|
-
key: name,
|
|
267
|
-
value: name,
|
|
268
|
-
onMouseDown: function onMouseDown(e) {
|
|
269
|
-
return e.preventDefault();
|
|
270
|
-
},
|
|
271
|
-
onClick: function onClick() {
|
|
272
|
-
onPropsClick(v.props);
|
|
273
|
-
}
|
|
274
|
-
}, _propsTitle);
|
|
275
|
-
})), searchText && _react["default"].createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && _react["default"].createElement("label", null, locale.propValue), _react["default"].createElement("ul", {
|
|
276
|
-
className: "ant-select-dropdown-menu"
|
|
277
|
-
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
|
|
278
|
-
var _ref7 = v.props || {},
|
|
279
|
-
name = _ref7.name,
|
|
280
|
-
propsTitle = _ref7.propsTitle,
|
|
281
|
-
type = _ref7.type,
|
|
282
|
-
props = _ref7.props;
|
|
283
|
-
var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
|
|
284
|
-
return v.key === name;
|
|
285
|
-
});
|
|
286
|
-
if (type === 'select' && props && props.options && props.options.length > 0) {
|
|
287
|
-
return _react["default"].createElement(_Select["default"], Object.assign({
|
|
288
|
-
key: name
|
|
289
|
-
}, props, {
|
|
290
|
-
searchText: searchText,
|
|
291
|
-
propItem: v.props,
|
|
292
|
-
onChange: onSelectChange,
|
|
293
|
-
value: target === null || target === void 0 ? void 0 : target.value
|
|
294
|
-
}));
|
|
295
|
-
}
|
|
296
|
-
return;
|
|
297
|
-
}))));
|
|
298
|
-
};
|
|
299
|
-
var renderSecondOptions = function renderSecondOptions() {
|
|
300
|
-
var _a;
|
|
301
|
-
var _ref8 = propItem || {},
|
|
302
|
-
name = _ref8.name,
|
|
303
|
-
propsTitle = _ref8.propsTitle,
|
|
304
|
-
title = _ref8.title,
|
|
305
|
-
type = _ref8.type,
|
|
306
|
-
className = _ref8.className,
|
|
307
|
-
component = _ref8.component,
|
|
308
|
-
fieldProps = _ref8.props;
|
|
309
|
-
var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
|
|
310
|
-
return v.key === name;
|
|
311
|
-
});
|
|
312
|
-
var Field = component || _fieldsMap["default"][type];
|
|
313
|
-
return _react["default"].createElement("div", {
|
|
314
|
-
onClick: function onClick(e) {
|
|
315
|
-
return e.stopPropagation();
|
|
316
|
-
},
|
|
317
|
-
className: className
|
|
318
|
-
}, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
|
|
319
|
-
propItem: propItem,
|
|
320
|
-
onChange: onSelectChange,
|
|
321
|
-
value: target === null || target === void 0 ? void 0 : target.value
|
|
322
|
-
})) : _react["default"].createElement("div", {
|
|
323
|
-
className: "".concat(clsPrefix, "-field-popover-content"),
|
|
324
|
-
onClick: function onClick(e) {
|
|
325
|
-
return e.stopPropagation();
|
|
326
|
-
}
|
|
327
|
-
}, _react["default"].createElement(Field, Object.assign({
|
|
328
|
-
form: form,
|
|
329
|
-
value: target === null || target === void 0 ? void 0 : target.value
|
|
330
|
-
}, fieldProps, {
|
|
331
|
-
style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
|
|
332
|
-
width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || (0, _fieldsMap.getFieldWidth)(type)
|
|
333
|
-
}),
|
|
334
|
-
close: close,
|
|
335
|
-
onChange: onFieldChange
|
|
336
|
-
}))));
|
|
337
|
-
};
|
|
338
|
-
return _react["default"].createElement(_popover["default"], Object.assign({
|
|
339
|
-
trigger: "click",
|
|
340
|
-
visible: visible,
|
|
341
|
-
placement: "bottom",
|
|
342
|
-
overlayClassName: "".concat(clsPrefix, "-field-popover"),
|
|
343
|
-
content: !popoverContent ? renderFirstOptions() : renderSecondOptions(),
|
|
344
|
-
onVisibleChange: handleVisibleChange
|
|
345
|
-
}, props), children);
|
|
346
|
-
};
|
|
347
|
-
var _default = exports["default"] = (0, _react.forwardRef)(FieldPopover);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form2/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,mCAAkC;AAClC,+DAAsC;AACtC,sDAAgC;AAChC,mCAAiE;AACjE,mCAA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,CAAC,CAAC,CACnB,8BAAC,gBAAS,oBAAK,UAAU,IAAE,QAAQ,EAAE,QAAQ,EAAG,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IAAI,CACnG,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAE,GAAG,SAAS,wBAAwB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;gBACvF,8BAAC,KAAK,kBACJ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IAChB,UAAU,IACd,KAAK,kCACA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KACpB,KAAK,EAAE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,KAAK,KAAI,IAAA,yBAAa,EAAC,IAAI,CAAC,KAExD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,IACvB,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,8BAAC,iBAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,QAAQ,EAClB,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAC9C,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,EACvE,eAAe,EAAE,mBAAmB,IAChC,KAAK,GAER,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CAAA;AACD,kBAAe,IAAA,kBAAU,EAAC,YAAY,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react'\nimport { cloneDeep } from 'lodash'\nimport Popover from '../../../popover'\nimport SelectOpt from './Select'\nimport { highlightSubstring, getLabelFromOptions } from './utils'\nimport { get } from 'lodash'\n\nimport fieldsMap, { getFieldWidth } from '../fieldsMap'\nimport './FieldPopover.less'\nconst isInput = (type) => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type)\n\nconst FieldPopover = ({\n visible,\n setVisible,\n searchText,\n children,\n value,\n regex,\n fieldItems,\n propItem,\n setFieldItem,\n onChange,\n form,\n locale,\n clsPrefix,\n ...props\n}, ref) => {\n\n const [searchTarget, setSearchTarget] = useState(undefined)\n const [popoverContent, setPopoverContent] = useState(false)\n\n const onPropsClick = (props) => {\n const { type = 'input' } = props || {}\n const copyValue = cloneDeep(value)\n if (!copyValue?.find((v) => v.key === props.name)) {\n copyValue.push({\n key: props.name,\n value: type === 'array' ? [] : '',\n closable: false,\n label: (props.propsTitle || props.title || props.name) + ':',\n })\n }\n setFieldItem(props)\n if (isInput(type)) {\n const target = copyValue.find((v) => v.key === props.name)\n onChange(target, true)\n close()\n return\n }\n setVisible(true)\n setPopoverContent(true)\n onChange(copyValue)\n }\n\n useImperativeHandle(ref, () => ({\n onPropsClick,\n }))\n\n const onSelectChange = (v, isMultiple) => {\n const { props: fieldProps } = propItem || v?.propItem || {} // 直接搜索拿v.xx的值\n const copyValue = cloneDeep(value || [])\n let index\n if (v?.propItem) {\n const _index = copyValue.findIndex((vv) => vv.key === v.propItem?.name)\n if (_index > -1) {\n index = _index\n } else {\n copyValue.push({\n key: v.propItem?.name,\n value: isMultiple ? [] : '',\n label: (v.propItem?.propsTitle || v.propItem?.title || v.propItem?.name) + ':',\n })\n index = copyValue.length - 1\n }\n setFieldItem(v.propItem)\n } else {\n index = copyValue.findIndex((v) => v.key === propItem?.name)\n }\n\n if (isMultiple) {\n if (!copyValue[index]?.value?.length) {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + v?.label\n copyValue[index].value = [v?.value]\n } else {\n if (copyValue[index].value?.indexOf(v.value) > -1) {\n copyValue[index].value = copyValue[index].value.filter((val) => val !== v.value)\n const regex = new RegExp(`\\\\|?${v.label}`, 'g') //new RegExp(`\\\\|?${variable}`, 'g')\n const result = copyValue[index].label.replace(regex, '')\n copyValue[index].label = result\n } else {\n copyValue[index].value.push(v.value)\n copyValue[index].label += ' | ' + v?.label\n }\n }\n } else {\n copyValue[index].value = v?.value\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + v?.label\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type, component, props: fieldProps, setLabel } = propItem || {}\n const { options } = fieldProps || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n if (type === 'date') {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + args[1]\n close()\n } else if (type === 'dateRange') {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + args[1]?.join('~')\n \n if (args[1]?.[1]) {\n close()\n }\n } else if (type === 'selectInput') {\n const key = get(Object.keys(args[0]), '0')\n const val = get(args[0], key)\n const label = getLabelFromOptions(key, options)\n copyValue[index].label = `${label}: ${val}`\n } else if (type === 'checkbox') {\n copyValue[index].label = `${copyValue[index].label.match(/(.*:)/)[0]} ${args[0] ? local.Yes : local.No\n }`\n close()\n } else if (!type && component) {\n if (setLabel) {\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n copyValue[index].label = setLabel(args[0])\n } else {\n copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (args[1] || args[0])\n }\n close()\n }\n copyValue[index].closable = true\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const close = () => {\n setVisible(false)\n setPopoverContent(false)\n }\n const handleVisibleChange = () => {\n if (!visible && !regex.test(searchText)) {\n setVisible(true)\n } else {\n close()\n }\n }\n\n useEffect(() => {\n let bool1 = false, bool2 = false;\n \n if (searchText && !propItem) {\n fieldItems?.forEach((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (_propsTitle?.indexOf(searchText) > -1) {\n bool1 = true\n }\n const sOptions = type !== 'select' ? [] : props?.options || []\n const fieldNames = props?.fieldNames\n const target = sOptions?.find((item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n return label?.indexOf(searchText) > -1\n })\n if (target) {\n bool2 = true\n }\n })\n setSearchTarget(!bool2 && !bool1 ? null : { propsTitle: bool1, propsValue: bool2 })\n } else {\n setSearchTarget(undefined)\n }\n }, [fieldItems, searchText, propItem])\n\n const renderFirstOptions = (menu) => {\n return (\n <div>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (searchText) {\n if (_propsTitle?.indexOf(searchText) > -1) {\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n ></span>\n </li>\n )\n }\n return null\n }\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n {_propsTitle}\n </li>\n )\n })}\n </ul>\n {/* 可以对下拉框值筛选 */}\n {searchText && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {fieldItems?.map((v) => {\n const { name, propsTitle, type, props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select' && props && props.options && props.options.length > 0) {\n return (\n <SelectOpt\n key={name}\n {...props}\n searchText={searchText}\n propItem={v.props}\n onChange={onSelectChange}\n value={target?.value}\n />\n )\n }\n return\n })}\n </ul>\n </div>\n )}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type,\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type]\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt {...fieldProps} propItem={propItem} onChange={onSelectChange} value={target?.value} />\n ) : (\n <div className={`${clsPrefix}-field-popover-content`} onClick={(e) => e.stopPropagation()}>\n <Field\n form={form}\n value={target?.value}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: fieldProps?.style?.width || getFieldWidth(type),\n }}\n close={close}\n onChange={onFieldChange}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\n placement=\"bottom\"\n overlayClassName={`${clsPrefix}-field-popover`}\n content={!popoverContent ? renderFirstOptions() : renderSecondOptions()}\n onVisibleChange={handleVisibleChange}\n {...props}\n >\n {children}\n </Popover>\n )\n}\nexport default forwardRef(FieldPopover)\n"]}
|