@cloudbase/weda-ui 3.19.0 → 3.20.1
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/dist/configs/components/wd-form.d.ts +2 -2
- package/dist/configs/components/wd-form.js +2 -2
- package/dist/configs/components/wd-table.d.ts +3 -3
- package/dist/configs/index.d.ts +6 -6
- package/dist/configs/type-utils/type-form.d.ts +2 -2
- package/dist/style/weda-ui.min.css +1 -1
- package/dist/web/components/form-input-hooks/index.d.ts +3 -1
- package/dist/web/components/form-input-hooks/index.js +93 -54
- package/dist/web/components/form-rich-text/index.d.ts +3 -3
- package/dist/web/components/form-rich-text/index.js +8 -4
- package/dist/web/components/formdetail/index.d.ts +1 -1
- package/dist/web/components/formdetail/index.js +28 -42
- package/dist/web/components/richText/index.js +9 -3
- package/dist/web/components/wd-form/contexts/form-field-arr-context.d.ts +21 -0
- package/dist/web/components/wd-form/contexts/form-field-arr-context.js +10 -0
- package/dist/web/components/wd-form/contexts/form-field-context.d.ts +19 -0
- package/dist/web/components/wd-form/contexts/form-field-context.js +10 -0
- package/dist/web/components/wd-form/contexts/form-field-obj-context.d.ts +13 -0
- package/dist/web/components/wd-form/contexts/form-field-obj-context.js +10 -0
- package/dist/web/components/wd-form/index.d.ts +4 -4
- package/dist/web/components/wd-form/index.js +142 -191
- package/dist/web/components/wd-form-item/wd-form-item.d.ts +2 -2
- package/dist/web/components/wd-form-item/wd-form-item.js +96 -14
- package/dist/web/components/wd-form-obj/base-form-obj.js +66 -197
- package/dist/web/components/wd-input/wd-input.js +1 -1
- package/dist/web/components/wd-input-number/wd-input-number.js +43 -17
- package/dist/web/components/wd-rich-text/wd-rich-text.d.ts +1 -1
- package/dist/web/components/wd-rich-text/wd-rich-text.js +7 -3
- package/dist/web/components/wd-select/select/selectUI.js +9 -2
- package/dist/web/utils/widget-api/index.d.ts +0 -14
- package/dist/web/utils/widget-api/index.js +0 -7
- package/package.json +1 -1
|
@@ -10,9 +10,9 @@ import './style';
|
|
|
10
10
|
* 富文本-标准化
|
|
11
11
|
*/
|
|
12
12
|
export const WdRichText = forwardRef(function WdRichText(props, ref) {
|
|
13
|
-
const { classRoot = 'rich-text', events = emptyObject, acceptTypes = ['image/*'], maxSize = 20
|
|
13
|
+
const { classRoot = 'rich-text', events = emptyObject, acceptTypes = ['image/*'], maxSize = 20 } = props;
|
|
14
14
|
const trait = useFormInputTrait({ ...props, inputRef: ref });
|
|
15
|
-
const { value,
|
|
15
|
+
const { value, disabled, readOnly, visible } = trait;
|
|
16
16
|
const formItemProps = {
|
|
17
17
|
...props,
|
|
18
18
|
...trait,
|
|
@@ -20,7 +20,11 @@ export const WdRichText = forwardRef(function WdRichText(props, ref) {
|
|
|
20
20
|
readOnly: false,
|
|
21
21
|
size: 'md',
|
|
22
22
|
};
|
|
23
|
+
const onChange = (value) => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.setValue(value);
|
|
26
|
+
};
|
|
23
27
|
if (!visible)
|
|
24
28
|
return null;
|
|
25
|
-
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, { placeholder: true, events: events, acceptTypes: acceptTypes, maxSize: maxSize, readOnly: readOnly, disabled: disabled, value: value, decorator: null, onChange: onChange }) }));
|
|
29
|
+
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, { placeholder: true, events: events, acceptTypes: acceptTypes, maxSize: maxSize, readOnly: readOnly, disabled: disabled, value: value, decorator: null, onChange: onChange, id: props.id }) }));
|
|
26
30
|
});
|
|
@@ -148,9 +148,16 @@ export function SelectUI(props) {
|
|
|
148
148
|
}
|
|
149
149
|
}, [currentOption, setAllOption]);
|
|
150
150
|
const isMultiple = mode === 'multiple';
|
|
151
|
+
const [selectedItem, setSelectedItem] = useState([]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
// 缓存展示的选中项
|
|
154
|
+
setSelectedItem((selectItem) => {
|
|
155
|
+
const newSelectItem = getSelectedItem(options, value);
|
|
156
|
+
return (newSelectItem === null || newSelectItem === void 0 ? void 0 : newSelectItem.length) ? newSelectItem : selectItem;
|
|
157
|
+
});
|
|
158
|
+
}, [options, value]);
|
|
151
159
|
const readValue = useMemo(() => {
|
|
152
160
|
var _a, _b;
|
|
153
|
-
const selectedItem = getSelectedItem(options, value);
|
|
154
161
|
if (isMultiple) {
|
|
155
162
|
return selectedItem
|
|
156
163
|
.map((i) => textToString(i === null || i === void 0 ? void 0 : i.label) || textToString(i.value) || textToString(value))
|
|
@@ -159,7 +166,7 @@ export function SelectUI(props) {
|
|
|
159
166
|
else {
|
|
160
167
|
return textToString((_a = selectedItem[0]) === null || _a === void 0 ? void 0 : _a.label) || textToString((_b = selectedItem[0]) === null || _b === void 0 ? void 0 : _b.value) || textToString(value);
|
|
161
168
|
}
|
|
162
|
-
}, [isMultiple,
|
|
169
|
+
}, [isMultiple, selectedItem, value]);
|
|
163
170
|
const render = () => {
|
|
164
171
|
if (platform === 'h5') {
|
|
165
172
|
return _jsx(SelectH5, { ...props, readValue: readValue, searchPlaceholder: searchPlaceholder });
|
|
@@ -7,22 +7,8 @@ export declare function useWedaAppContext(): {
|
|
|
7
7
|
export declare const FormDetailStatusContext: import("react").Context<string>;
|
|
8
8
|
export declare const useFormDetailContext: () => string;
|
|
9
9
|
export declare const FormObjContext: import("react").Context<{
|
|
10
|
-
formObjName: string;
|
|
11
10
|
status: 'edit' | 'disabled' | 'readOnly';
|
|
12
|
-
valueChangeFromChild: (params: {
|
|
13
|
-
name: string;
|
|
14
|
-
value: any;
|
|
15
|
-
}) => void;
|
|
16
|
-
addFormItem: (name: string, $widget: IWidget) => () => void;
|
|
17
11
|
}>;
|
|
18
12
|
export declare const useFormObjContext: () => {
|
|
19
|
-
formObjName: string;
|
|
20
13
|
status: 'edit' | 'disabled' | 'readOnly';
|
|
21
|
-
valueChangeFromChild: (params: {
|
|
22
|
-
name: string;
|
|
23
|
-
value: any;
|
|
24
|
-
}) => void;
|
|
25
|
-
addFormItem: (name: string, $widget: IWidget) => () => void;
|
|
26
14
|
};
|
|
27
|
-
export declare const FormObjWidgetContext: import("react").Context<IWidget>;
|
|
28
|
-
export declare const useFormObjWidget: () => IWidget;
|
|
@@ -57,15 +57,8 @@ export const useFormDetailContext = () => {
|
|
|
57
57
|
};
|
|
58
58
|
// 共享嵌套表单状态
|
|
59
59
|
export const FormObjContext = createContext({
|
|
60
|
-
formObjName: '',
|
|
61
60
|
status: 'edit',
|
|
62
|
-
valueChangeFromChild: () => { },
|
|
63
|
-
addFormItem: () => () => { },
|
|
64
61
|
}, 'FormObj');
|
|
65
62
|
export const useFormObjContext = () => {
|
|
66
63
|
return useContext(FormObjContext);
|
|
67
64
|
};
|
|
68
|
-
export const FormObjWidgetContext = createContext(null, 'FormObjWidget');
|
|
69
|
-
export const useFormObjWidget = () => {
|
|
70
|
-
return useContext(FormObjWidgetContext);
|
|
71
|
-
};
|