one-design-next 0.0.39 → 0.0.40
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/composer/index.d.ts
CHANGED
|
@@ -201,6 +201,14 @@ export interface ComposerProps {
|
|
|
201
201
|
* `SkillItem.initialState='pending'` 插入后会自动打开。
|
|
202
202
|
*/
|
|
203
203
|
renderParamPanel?: (ctx: ComposerParamPanelContext) => React.ReactNode;
|
|
204
|
+
/**
|
|
205
|
+
* 工具栏按钮被点击时触发。
|
|
206
|
+
*
|
|
207
|
+
* - `tool`:被点击的工具类型(`'attachment'` / `'webSearch'` / `'skill'`)。
|
|
208
|
+
* - 对于 `'skill'`:在 skill 弹窗打开时触发(而非选中某个 skill 时)。
|
|
209
|
+
* - 此回调为纯通知性质,不影响组件内部行为(若需阻止,请使用 `disabled` 等控制)。
|
|
210
|
+
*/
|
|
211
|
+
onToolClick?: (tool: ComposerTool) => void;
|
|
204
212
|
className?: string;
|
|
205
213
|
style?: React.CSSProperties;
|
|
206
214
|
}
|
package/dist/composer/index.js
CHANGED
|
@@ -117,6 +117,7 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
117
117
|
_ref$accept = _ref.accept,
|
|
118
118
|
accept = _ref$accept === void 0 ? DEFAULT_ACCEPT : _ref$accept,
|
|
119
119
|
renderParamPanel = _ref.renderParamPanel,
|
|
120
|
+
onToolClick = _ref.onToolClick,
|
|
120
121
|
className = _ref.className,
|
|
121
122
|
style = _ref.style;
|
|
122
123
|
var _useControlledState = useControlledState(defaultValue, valueProp),
|
|
@@ -670,7 +671,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
670
671
|
type: "button",
|
|
671
672
|
onClick: function onClick() {
|
|
672
673
|
var _fileInputRef$current;
|
|
673
|
-
|
|
674
|
+
onToolClick === null || onToolClick === void 0 || onToolClick('attachment');
|
|
675
|
+
(_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 || _fileInputRef$current.click();
|
|
674
676
|
},
|
|
675
677
|
disabled: btnDisabled,
|
|
676
678
|
"data-odn-composer-tool-btn": true,
|
|
@@ -694,7 +696,8 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
694
696
|
}, /*#__PURE__*/React.createElement("button", {
|
|
695
697
|
type: "button",
|
|
696
698
|
onClick: function onClick() {
|
|
697
|
-
|
|
699
|
+
onToolClick === null || onToolClick === void 0 || onToolClick('webSearch');
|
|
700
|
+
setWebSearch(function (v) {
|
|
698
701
|
return !v;
|
|
699
702
|
});
|
|
700
703
|
},
|
|
@@ -726,6 +729,7 @@ export var Composer = /*#__PURE__*/forwardRef(function Composer(_ref, ref) {
|
|
|
726
729
|
visible: !disabled && toolMenuOpen,
|
|
727
730
|
onVisibleChange: function onVisibleChange(v) {
|
|
728
731
|
if (disabled) return;
|
|
732
|
+
if (v) onToolClick === null || onToolClick === void 0 || onToolClick('skill');
|
|
729
733
|
setToolMenuOpen(v);
|
|
730
734
|
},
|
|
731
735
|
popupClassName: "odn-composer-skill-popup",
|