@blocklet/pages-kit 0.2.367 → 0.2.369

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.
@@ -76,5 +76,5 @@ function AgentSettingsDialog(_a) {
76
76
  throw error;
77
77
  }
78
78
  });
79
- return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ fullWidth: true, maxWidth: "md" }, props, { open: isOpen, onClose: onClose, component: "form", onSubmit: form.handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('settings') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 1, children: agent.config.secrets.map(({ targetInput, hasValue }, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 0.5, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: targetInput.label || targetInput.key }), (0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ type: "password", fullWidth: true, hiddenLabel: true, size: "small", inputProps: { maxLength: 100 }, placeholder: hasValue ? '******' : targetInput.placeholder }, form.register(`secrets.${index}.secret`, { required: true })))] }, targetInput.id))) }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: onClose, children: t('cancel') }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, { type: "submit", variant: "contained", loading: form.formState.isSubmitting, children: t('save') })] })] })));
79
+ return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ fullWidth: true, maxWidth: "md" }, props, { open: isOpen, onClose: onClose, component: "form", onSubmit: form.handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('settings') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, { gap: 1, children: agent.config.secrets.map(({ targetInput, hasValue }, index) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 0.5, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "caption", children: [targetInput.label || targetInput.key, ' ', targetInput.docLink && ((0, jsx_runtime_1.jsx)(material_1.Link, { href: targetInput.docLink, target: "_blank", children: t('docLink') }))] }), (0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({ autoFocus: index === 0, type: "password", fullWidth: true, hiddenLabel: true, size: "small", inputProps: { maxLength: 100 }, placeholder: hasValue ? '******' : targetInput.placeholder }, form.register(`secrets.${index}.secret`, { required: true })))] }, targetInput.id))) }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: onClose, children: t('cancel') }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, { type: "submit", variant: "contained", loading: form.formState.isSubmitting, children: t('save') })] })] })));
80
80
  }
@@ -116,6 +116,7 @@ exports.translations = {
116
116
  },
117
117
  settings: 'Settings',
118
118
  setup: 'Setup',
119
+ docLink: 'Document Link',
119
120
  },
120
121
  zh: {
121
122
  by: '作者',
@@ -231,5 +232,6 @@ exports.translations = {
231
232
  },
232
233
  settings: '设置',
233
234
  setup: '设置',
235
+ docLink: '文档链接',
234
236
  },
235
237
  };
@@ -88,13 +88,13 @@ function AutoForm({ submitText, inlineLabel, autoFillLastForm = true, submitInQu
88
88
  : undefined,
89
89
  }, render: ({ field, fieldState }) => {
90
90
  var _a;
91
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(AgentInputField_1.default, { inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), InputProps: parameter.key === 'question' && submitInQuestionField
91
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "form-item", children: [parameter.label && (0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: parameter.label }), (0, jsx_runtime_1.jsx)(AgentInputField_1.default, { inputProps: { 'data-testid': `runtime-input-${key}` }, inputRef: field.ref, autoFocus: index === 0, size: "small", hiddenLabel: true, fullWidth: true, label: undefined, parameter: parameter, maxRows: !(parameter === null || parameter === void 0 ? void 0 : parameter.type) || (parameter === null || parameter === void 0 ? void 0 : parameter.type) === 'string' ? 5 : undefined, value: field.value || '', onChange: (value) => field.onChange({ target: { value } }), error: Boolean(fieldState.error), helperText: ((_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || (parameter === null || parameter === void 0 ? void 0 : parameter.helper), InputProps: parameter.key === 'question' && submitInQuestionField
92
92
  ? {
93
- endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: { py: 3, mr: -0.75, alignSelf: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { borderRadius: 1.5 }, children: submitText }) })),
93
+ endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: { py: 3, mr: -0.75, alignSelf: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, { "data-testid": "runtime-submit-button", ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { borderRadius: 1.5 }, children: submitText }) })),
94
94
  }
95
95
  : undefined })] }));
96
96
  } }) }, parameter.id));
97
- }), !(submitInQuestionField && (parameters === null || parameters === void 0 ? void 0 : parameters.some((i) => i.key === 'question'))) && ((0, jsx_runtime_1.jsx)(LoadingButton_1.default, { ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { height: 40 }, children: submitText || t('generate') }))] }));
97
+ }), !(submitInQuestionField && (parameters === null || parameters === void 0 ? void 0 : parameters.some((i) => i.key === 'question'))) && ((0, jsx_runtime_1.jsx)(LoadingButton_1.default, { "data-testid": "runtime-submit-button", ref: submitRef, type: "submit", variant: "contained", loading: running, disabled: submitDisabled, sx: { height: 40 }, children: submitText || t('generate') }))] }));
98
98
  }
99
99
  function useInitialFormValues() {
100
100
  const preferences = (0, ComponentPreferences_1.useComponentPreferences)();