assui 3.1.38 → 3.1.39
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/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/label-condition-select-input/index.d.ts +41 -0
- package/es/label-condition-select-input/index.js +137 -0
- package/es/label-condition-select-input/style/index.css +1259 -0
- package/es/label-condition-select-input/style/index.d.ts +3 -0
- package/es/label-condition-select-input/style/index.js +3 -0
- package/es/label-condition-select-input/style/index.less +32 -0
- package/es/label-customize-range-picker/index.js +23 -10
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -1
- package/lib/label-condition-select-input/index.d.ts +41 -0
- package/lib/label-condition-select-input/index.js +181 -0
- package/lib/label-condition-select-input/style/index.css +1259 -0
- package/lib/label-condition-select-input/style/index.d.ts +3 -0
- package/lib/label-condition-select-input/style/index.js +8 -0
- package/lib/label-condition-select-input/style/index.less +32 -0
- package/lib/label-customize-range-picker/index.js +23 -10
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -78,3 +78,5 @@ export { default as BeautifulDnd } from './beautiful-dnd';
|
|
|
78
78
|
export { default as Resizable } from './resizable';
|
|
79
79
|
export type { FlexProps } from './flex';
|
|
80
80
|
export { default as Flex } from './flex';
|
|
81
|
+
export type { LabelConditionSelectInputProps } from './label-condition-select-input';
|
|
82
|
+
export { default as LabelConditionSelectInput } from './label-condition-select-input';
|
package/es/index.js
CHANGED
|
@@ -39,4 +39,5 @@ export { default as LabelCustomizeRangePicker } from './label-customize-range-pi
|
|
|
39
39
|
export { default as RichTextEditor } from './rich-text-editor';
|
|
40
40
|
export { default as BeautifulDnd } from './beautiful-dnd';
|
|
41
41
|
export { default as Resizable } from './resizable';
|
|
42
|
-
export { default as Flex } from './flex';
|
|
42
|
+
export { default as Flex } from './flex';
|
|
43
|
+
export { default as LabelConditionSelectInput } from './label-condition-select-input';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LabelConditionInputProps } from '../label-condition-input';
|
|
3
|
+
import type { LabelSelectProps } from '../label-select';
|
|
4
|
+
export declare enum InputTypeEnum {
|
|
5
|
+
CONDITION_INPUT = "conditionInput",
|
|
6
|
+
SELECT = "select"
|
|
7
|
+
}
|
|
8
|
+
declare type SelectOptionsType = {
|
|
9
|
+
value: number;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export interface MainSelectOptionsType extends SelectOptionsType {
|
|
13
|
+
children?: SelectOptionsType[];
|
|
14
|
+
}
|
|
15
|
+
export interface ValueType {
|
|
16
|
+
selectValue?: number | string | null;
|
|
17
|
+
inputValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'];
|
|
18
|
+
}
|
|
19
|
+
export interface LabelConditionSelectInputProps {
|
|
20
|
+
value?: ValueType;
|
|
21
|
+
/** 不需要展示联动输入框的字段值 */
|
|
22
|
+
hiddenInputKeys?: ValueType['selectValue'][];
|
|
23
|
+
/** selectProps */
|
|
24
|
+
selectProps?: LabelSelectProps;
|
|
25
|
+
/** 联动inputProps */
|
|
26
|
+
conditionInputProps?: LabelConditionInputProps;
|
|
27
|
+
/** 联动selectProps */
|
|
28
|
+
conditionSelectProps?: LabelSelectProps;
|
|
29
|
+
/** onChange */
|
|
30
|
+
onChange?: (value: ValueType) => void;
|
|
31
|
+
/** 输入框类型 */
|
|
32
|
+
inputType?: InputTypeEnum;
|
|
33
|
+
/** select options */
|
|
34
|
+
optionsList: MainSelectOptionsType[];
|
|
35
|
+
/** label */
|
|
36
|
+
label?: React.ReactNode;
|
|
37
|
+
/** 样式 */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
declare const LabelConditionSelect: (props: LabelConditionSelectInputProps) => JSX.Element;
|
|
41
|
+
export default LabelConditionSelect;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = this && this.__read || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o),
|
|
17
|
+
r,
|
|
18
|
+
ar = [],
|
|
19
|
+
e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
22
|
+
ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
e = {
|
|
26
|
+
error: error
|
|
27
|
+
};
|
|
28
|
+
} finally {
|
|
29
|
+
try {
|
|
30
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
31
|
+
} finally {
|
|
32
|
+
if (e) throw e.error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
import isNil from 'lodash/isNil';
|
|
38
|
+
import classNames from 'classnames';
|
|
39
|
+
import React, { useEffect, useState } from 'react';
|
|
40
|
+
import useControllableValue from "ahooks/es/useControllableValue";
|
|
41
|
+
import LabelConditionInput from '../label-condition-input';
|
|
42
|
+
import LabelSelect from '../label-select';
|
|
43
|
+
export var InputTypeEnum;
|
|
44
|
+
(function (InputTypeEnum) {
|
|
45
|
+
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
46
|
+
InputTypeEnum["SELECT"] = "select";
|
|
47
|
+
})(InputTypeEnum || (InputTypeEnum = {}));
|
|
48
|
+
var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
49
|
+
var value = props.value,
|
|
50
|
+
_a = props.hiddenInputKeys,
|
|
51
|
+
hiddenInputKeys = _a === void 0 ? [] : _a,
|
|
52
|
+
selectProps = props.selectProps,
|
|
53
|
+
conditionInputProps = props.conditionInputProps,
|
|
54
|
+
conditionSelectProps = props.conditionSelectProps,
|
|
55
|
+
_b = props.inputType,
|
|
56
|
+
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
57
|
+
_c = props.optionsList,
|
|
58
|
+
optionsList = _c === void 0 ? [] : _c,
|
|
59
|
+
label = props.label,
|
|
60
|
+
className = props.className;
|
|
61
|
+
var isInput = inputType === InputTypeEnum.CONDITION_INPUT;
|
|
62
|
+
var _d = __read(useControllableValue(props), 2),
|
|
63
|
+
selectInputValue = _d[0],
|
|
64
|
+
setSelectInputValue = _d[1];
|
|
65
|
+
var _e = __read(useState([]), 2),
|
|
66
|
+
subSelectOptions = _e[0],
|
|
67
|
+
setSubSelectOptions = _e[1];
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (value && value.selectValue && optionsList.length) {
|
|
70
|
+
var _a = __read(optionsList.filter(function (item) {
|
|
71
|
+
return item.value === value.selectValue;
|
|
72
|
+
}), 1),
|
|
73
|
+
selectValueItem = _a[0];
|
|
74
|
+
if (selectValueItem && selectValueItem.children) {
|
|
75
|
+
setSubSelectOptions(selectValueItem.children);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, [value, optionsList]);
|
|
79
|
+
var onSelectChange = function onSelectChange(selectValue) {
|
|
80
|
+
var inputValue = isInput ? '' : undefined;
|
|
81
|
+
setSelectInputValue({
|
|
82
|
+
selectValue: selectValue,
|
|
83
|
+
inputValue: inputValue
|
|
84
|
+
});
|
|
85
|
+
if (isInput || isNil(selectValue)) {
|
|
86
|
+
setSubSelectOptions([]);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var _a = __read(optionsList.filter(function (item) {
|
|
90
|
+
return item.value === selectValue;
|
|
91
|
+
}), 1),
|
|
92
|
+
selectValueItem = _a[0];
|
|
93
|
+
if (selectValueItem.children) {
|
|
94
|
+
setSubSelectOptions(selectValueItem.children);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var onInputChange = function onInputChange(inputValue) {
|
|
98
|
+
setSelectInputValue({
|
|
99
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
100
|
+
inputValue: inputValue
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
104
|
+
setSelectInputValue({
|
|
105
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
106
|
+
inputValue: inputValue
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
// 是否展示输入框
|
|
110
|
+
var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
111
|
+
var typeInput = isInput ? /*#__PURE__*/React.createElement(LabelConditionInput, __assign({}, conditionInputProps, {
|
|
112
|
+
onChange: onInputChange,
|
|
113
|
+
className: "label-condition-select-second-input",
|
|
114
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue
|
|
115
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: "label-condition-select-second-select"
|
|
117
|
+
}, /*#__PURE__*/React.createElement(LabelSelect, __assign({}, conditionSelectProps, {
|
|
118
|
+
onChange: onTypeSelectChange,
|
|
119
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
120
|
+
options: subSelectOptions
|
|
121
|
+
})));
|
|
122
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: classNames('label-condition-select', className)
|
|
124
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: classNames('label-condition-select-selector', {
|
|
126
|
+
'label-condition-select-two-select-selector': !isInput,
|
|
127
|
+
'label-condition-select-only-selector': !isShowInput
|
|
128
|
+
})
|
|
129
|
+
}, /*#__PURE__*/React.createElement(LabelSelect, __assign({
|
|
130
|
+
label: label
|
|
131
|
+
}, selectProps, {
|
|
132
|
+
onChange: onSelectChange,
|
|
133
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
134
|
+
options: optionsList
|
|
135
|
+
}))), isShowInput && typeInput);
|
|
136
|
+
};
|
|
137
|
+
export default LabelConditionSelect;
|