@abtnode/ux 1.16.37 → 1.16.38-beta-20250110-003414-d3c1bfbd

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.
@@ -53,7 +53,8 @@ function BlockletEnvironment({
53
53
  rectLogoUrl,
54
54
  faviconUrl,
55
55
  splashPortraitUrl,
56
- splashLandscapeUrl
56
+ splashLandscapeUrl,
57
+ ogImageUrl
57
58
  } = useAppLogo({
58
59
  blocklet
59
60
  });
@@ -342,6 +343,37 @@ function BlockletEnvironment({
342
343
  minHeight: 900,
343
344
  allowSVG: false
344
345
  })]
346
+ }), /*#__PURE__*/_jsxs(Grid, {
347
+ item: true,
348
+ xs: 12,
349
+ lg: 4,
350
+ children: [/*#__PURE__*/_jsx(Box, {
351
+ className: "config-label",
352
+ fontSize: 14,
353
+ mb: 1,
354
+ sx: {
355
+ flexGrow: 0,
356
+ width: 'auto'
357
+ },
358
+ children: t('blocklet.config.ogImage')
359
+ }), /*#__PURE__*/_jsx(Box, {
360
+ mb: 1.5,
361
+ className: "config-desc",
362
+ children: t('blocklet.config.ogImageDesc')
363
+ }), /*#__PURE__*/_jsx(LogoUploader, {
364
+ did: blocklet.meta.did,
365
+ width: 400,
366
+ height: 210,
367
+ type: "og-image",
368
+ prefix: prefix,
369
+ url: ogImageUrl,
370
+ enabled: hasPermission,
371
+ headers: getSessionInHeader,
372
+ aspectRatio: 40 / 21,
373
+ minWidth: 1200,
374
+ minHeight: 630,
375
+ allowSVG: false
376
+ })]
345
377
  })]
346
378
  }), /*#__PURE__*/_jsx(Box, {
347
379
  className: "config-form",
@@ -116,7 +116,7 @@ export default function LogoUploader({
116
116
  // infer props for Uploader
117
117
  LogoUploader.propTypes = {
118
118
  url: PropTypes.string.isRequired,
119
- type: PropTypes.oneOf(['square', 'rect', 'favicon', 'splash-portrait', 'splash-landscape']).isRequired,
119
+ type: PropTypes.oneOf(['square', 'rect', 'favicon', 'splash-portrait', 'splash-landscape', 'og-image']).isRequired,
120
120
  did: PropTypes.string.isRequired,
121
121
  prefix: PropTypes.string.isRequired,
122
122
  headers: PropTypes.func,
@@ -163,7 +163,7 @@ function Header({
163
163
  });
164
164
  return;
165
165
  }
166
- } else {
166
+ } else if (!params.blockletDocker?.dockerImage) {
167
167
  _params.blockletComponents = [];
168
168
  }
169
169
  _params.blockletTitle = (_params.blockletTitle || '').trim();
@@ -175,6 +175,13 @@ function Header({
175
175
  _params.blockletIntroduction = (_params.blockletIntroduction || '').trim();
176
176
  _params.note = (_params.note || '').trim();
177
177
  _params.blockletComponents = (_params?.blockletComponents || []).filter(x => x.included).map(x => pick(x, ['did', 'required'])).map(JSON.stringify);
178
+ if (_params.contentType !== 'docker') {
179
+ _params.blockletDocker = {
180
+ dockerImage: '',
181
+ dockerArgs: [],
182
+ dockerEnvs: []
183
+ };
184
+ }
178
185
  try {
179
186
  await api.createRelease({
180
187
  input: {
@@ -27,6 +27,7 @@ import ResourceUpload from './resource-upload';
27
27
  import StopBox from './stop-box';
28
28
  import Version from './version';
29
29
  import preserveOriginalStrings from '../utils/preserve-original-strings';
30
+ import ResourceDocker from './resource-docker';
30
31
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
31
32
  const addComponentTabs = ({
32
33
  tabs,
@@ -55,7 +56,7 @@ const addComponentTabs = ({
55
56
  });
56
57
  };
57
58
  const pickParams = (baseParams, app) => {
58
- const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletVideos', 'blockletScreenshots', 'blockletResourceType', 'blockletSupport', 'blockletHomepage', 'blockletCommunity', 'blockletRepository', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource', 'autoUpload', 'possibleSameStore', 'note']);
59
+ const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletVideos', 'blockletScreenshots', 'blockletResourceType', 'blockletSupport', 'blockletHomepage', 'blockletCommunity', 'blockletRepository', 'blockletDocker', 'contentType', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource', 'autoUpload', 'possibleSameStore', 'note']);
59
60
  if (!params.blockletComponents) {
60
61
  params.blockletComponents = (app.children || []).map(x => ({
61
62
  did: x.meta.did,
@@ -68,7 +69,6 @@ const pickParams = (baseParams, app) => {
68
69
  included: true
69
70
  }));
70
71
  }
71
- params.resourceFromSelect = !params.uploadedResource;
72
72
  return params;
73
73
  };
74
74
  const stepsToLabel = {
@@ -107,12 +107,17 @@ export default function CreateRelease({
107
107
  publishedStoreIds: [],
108
108
  connectedStores: [],
109
109
  uploadedResource: '',
110
+ contentType: 'blocklet',
110
111
  blockletResourceType: '',
111
112
  blockletSupport: '',
112
113
  blockletCommunity: '',
113
114
  blockletHomepage: '',
114
115
  blockletRepository: '',
115
- resourceFromSelect: true
116
+ blockletDocker: {
117
+ dockerImage: '',
118
+ dockerArgs: [],
119
+ dockerEnvs: []
120
+ }
116
121
  });
117
122
  const [paramsErrTip, setParamsErrTip] = useSetState({});
118
123
  const [loading, setLoading] = useState(false);
@@ -152,7 +157,8 @@ export default function CreateRelease({
152
157
  const setSelectedResourceIds = useCallback((...args) => {
153
158
  _setSelectedResourceIds(...args);
154
159
  setParamsErrTip({
155
- blockletResource: ''
160
+ blockletResource: '',
161
+ blockletDocker: ''
156
162
  });
157
163
  // eslint-disable-next-line react-hooks/exhaustive-deps
158
164
  }, []);
@@ -313,6 +319,21 @@ export default function CreateRelease({
313
319
  updateParamsByUrl();
314
320
  }
315
321
  }, [projectId, initUrl, mode, updateParamsByUrl]);
322
+ useEffect(() => {
323
+ if (params.contentType === 'docker') {
324
+ setParams({
325
+ resourceFromSelect: false
326
+ });
327
+ } else if (params.contentType === 'blocklet') {
328
+ setParams({
329
+ resourceFromSelect: true
330
+ });
331
+ } else if (params.contentType === 'upload') {
332
+ setParams({
333
+ resourceFromSelect: false
334
+ });
335
+ }
336
+ }, [params.contentType, setParams]);
316
337
  const hasSelectedResources = useMemo(() => {
317
338
  return !!Object.keys(selectedResourceIds).find(key => {
318
339
  if (selectedResourceIds[key].length) {
@@ -500,27 +521,35 @@ export default function CreateRelease({
500
521
  flex: 1
501
522
  },
502
523
  children: [/*#__PURE__*/_jsxs(RadioGroup, {
503
- onChange: () => setParams({
504
- resourceFromSelect: !params.resourceFromSelect
524
+ onChange: e => setParams({
525
+ contentType: e.target.value
505
526
  }),
506
527
  children: [/*#__PURE__*/_jsx(FormControlLabel, {
507
- value: "select",
528
+ value: "blocklet",
508
529
  disabled: readOnly,
509
530
  control: /*#__PURE__*/_jsx(Radio, {
510
531
  size: "small",
511
- checked: params.resourceFromSelect
532
+ checked: params.contentType === 'blocklet'
512
533
  }),
513
534
  label: t('blocklet.publish.resourceSelect')
514
535
  }), /*#__PURE__*/_jsx(FormControlLabel, {
515
- value: "select",
536
+ value: "upload",
516
537
  disabled: readOnly,
517
538
  control: /*#__PURE__*/_jsx(Radio, {
518
539
  size: "small",
519
- checked: !params.resourceFromSelect
540
+ checked: params.contentType === 'upload'
520
541
  }),
521
542
  label: t('blocklet.publish.resourceUpload')
543
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
544
+ value: "docker",
545
+ disabled: readOnly,
546
+ control: /*#__PURE__*/_jsx(Radio, {
547
+ size: "small",
548
+ checked: params.contentType === 'docker'
549
+ }),
550
+ label: t('blocklet.publish.resourceDocker')
522
551
  })]
523
- }), params.resourceFromSelect && /*#__PURE__*/_jsxs(_Fragment, {
552
+ }), params.contentType === 'blocklet' && /*#__PURE__*/_jsxs(_Fragment, {
524
553
  children: [!componentDid && /*#__PURE__*/_jsx(Tabs, {
525
554
  tabs: tabs,
526
555
  current: tab,
@@ -552,7 +581,7 @@ export default function CreateRelease({
552
581
  id: releaseId
553
582
  }
554
583
  })]
555
- }), !params.resourceFromSelect && /*#__PURE__*/_jsx(ResourceUpload, {
584
+ }), params.contentType === 'upload' && /*#__PURE__*/_jsx(ResourceUpload, {
556
585
  app: blocklet,
557
586
  readOnly: readOnly,
558
587
  projectId: projectId === UNOWNED_DID ? '' : projectId,
@@ -560,6 +589,15 @@ export default function CreateRelease({
560
589
  error: paramsErrTip.blockletResource,
561
590
  setParams: setParams,
562
591
  setParamsErrTip: setParamsErrTip
592
+ }), params.contentType === 'docker' && /*#__PURE__*/_jsx(ResourceDocker, {
593
+ app: blocklet,
594
+ readOnly: readOnly,
595
+ projectId: projectId === UNOWNED_DID ? '' : projectId,
596
+ params: params,
597
+ error: paramsErrTip.blockletResource,
598
+ setParams: setParams,
599
+ setParamsErrTip: setParamsErrTip,
600
+ paramsErrTip: paramsErrTip
563
601
  })]
564
602
  })
565
603
  })
@@ -29,7 +29,7 @@ export default function ReleaseStepper({
29
29
  return paramsErrTip?.blockletTitle || paramsErrTip?.projectId || paramsErrTip?.blockletDescription || paramsErrTip?.blockletHomepage || paramsErrTip?.blockletSupport || paramsErrTip?.blockletCommunity || paramsErrTip?.blockletRepository;
30
30
  }
31
31
  if (step === 2) {
32
- return paramsErrTip?.blockletResource;
32
+ return paramsErrTip?.blockletResource || paramsErrTip?.blockletDocker || paramsErrTip?.dockerImageName;
33
33
  }
34
34
  if (step >= 4) {
35
35
  return paramsErrTip?.blockletVersion || paramsErrTip?.note;
@@ -160,6 +160,8 @@ ReleaseStepper.propTypes = {
160
160
  blockletHomepage: PropTypes.string,
161
161
  blockletSupport: PropTypes.string,
162
162
  blockletCommunity: PropTypes.string,
163
- blockletRepository: PropTypes.string
163
+ blockletRepository: PropTypes.string,
164
+ blockletDocker: PropTypes.object,
165
+ dockerImageName: PropTypes.string
164
166
  }).isRequired
165
167
  };
@@ -0,0 +1,442 @@
1
+ import { Box, IconButton, InputAdornment, MenuItem, Select, TextField, Typography } from '@mui/material';
2
+ import Dialog from '@arcblock/ux/lib/Dialog';
3
+ import IOSSwitch from '@arcblock/ux/lib/Switch';
4
+ import { Icon } from '@iconify/react';
5
+ import PropTypes from 'prop-types';
6
+ import { notAllowUseCustomDockerArgs, allowDockerArgs, dockerArgsValidator, dockerArgsToCamelCase } from '@abtnode/docker-utils';
7
+ import { useState } from 'react';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ function ResourceDockerInputItem({
10
+ index,
11
+ item,
12
+ dockerParams,
13
+ setDockerParams,
14
+ dataKey,
15
+ t,
16
+ readOnly
17
+ }) {
18
+ const value = item?.value || '';
19
+ const [showDialog, setShowDialog] = useState(false);
20
+ const handleDelete = () => {
21
+ dockerParams[dataKey]?.splice(index, 1);
22
+ setDockerParams({
23
+ ...dockerParams,
24
+ [dataKey]: [...dockerParams[dataKey]]
25
+ });
26
+ };
27
+ const handleSetCustom = (_, checked) => {
28
+ if (dockerParams[dataKey]?.[index]) {
29
+ if (!checked) {
30
+ dockerParams[dataKey][index].value = dockerParams[dataKey][index].custom || '';
31
+ dockerParams[dataKey][index].custom = '';
32
+ } else {
33
+ dockerParams[dataKey][index].custom = dockerParams[dataKey][index].value;
34
+ dockerParams[dataKey][index].value = `$${dockerArgsToCamelCase(item.key)}`;
35
+ }
36
+ }
37
+ setDockerParams({
38
+ ...dockerParams,
39
+ [dataKey]: [...dockerParams[dataKey]]
40
+ });
41
+ };
42
+ const handleSetSecure = (_, v) => {
43
+ dockerParams[dataKey][index] = {
44
+ ...dockerParams[dataKey][index],
45
+ secure: v
46
+ };
47
+ setDockerParams({
48
+ ...dockerParams,
49
+ [dataKey]: [...dockerParams[dataKey]]
50
+ });
51
+ };
52
+ const handleSetShared = (_, v) => {
53
+ dockerParams[dataKey][index] = {
54
+ ...dockerParams[dataKey][index],
55
+ shared: v
56
+ };
57
+ setDockerParams({
58
+ ...dockerParams,
59
+ [dataKey]: [...dockerParams[dataKey]]
60
+ });
61
+ };
62
+ const handleSetRequired = (_, v) => {
63
+ dockerParams[dataKey][index] = {
64
+ ...dockerParams[dataKey][index],
65
+ required: v
66
+ };
67
+ setDockerParams({
68
+ ...dockerParams,
69
+ [dataKey]: [...dockerParams[dataKey]]
70
+ });
71
+ };
72
+ const handleSetDescription = e => {
73
+ dockerParams[dataKey][index] = {
74
+ ...dockerParams[dataKey][index],
75
+ description: e.target.value
76
+ };
77
+ setDockerParams({
78
+ ...dockerParams,
79
+ [dataKey]: [...dockerParams[dataKey]]
80
+ });
81
+ };
82
+ const handleSetPath = e => {
83
+ dockerParams[dataKey][index] = {
84
+ ...dockerParams[dataKey][index],
85
+ path: e.target.value
86
+ };
87
+ setDockerParams({
88
+ ...dockerParams,
89
+ [dataKey]: [...dockerParams[dataKey]]
90
+ });
91
+ };
92
+ const handleSetPrefix = e => {
93
+ dockerParams[dataKey][index] = {
94
+ ...dockerParams[dataKey][index],
95
+ prefix: e.target.value
96
+ };
97
+ setDockerParams({
98
+ ...dockerParams,
99
+ [dataKey]: [...dockerParams[dataKey]]
100
+ });
101
+ };
102
+ const handleSetType = e => {
103
+ const type = e.target.value === 'web' ? 'web' : 'docker';
104
+ if (type === 'web') {
105
+ dockerParams.dockerArgs.forEach(v => {
106
+ v.type = 'docker';
107
+ });
108
+ }
109
+ dockerParams.dockerArgs[index] = {
110
+ ...dockerParams.dockerArgs[index],
111
+ type,
112
+ path: '/',
113
+ protocol: 'http',
114
+ prefix: '/',
115
+ name: 'publicUrl',
116
+ port: 'BLOCKLET_PORT'
117
+ };
118
+ setDockerParams({
119
+ ...dockerParams,
120
+ dockerArgs: [...dockerParams.dockerArgs]
121
+ });
122
+ };
123
+ const handleSetName = e => {
124
+ if (dockerParams[dataKey]?.[index]) {
125
+ dockerParams[dataKey][index].name = e.target.value;
126
+ }
127
+ setDockerParams({
128
+ ...dockerParams,
129
+ [dataKey]: [...dockerParams[dataKey]]
130
+ });
131
+ };
132
+ const handleChangeValue = e => {
133
+ if (dockerParams[dataKey]?.[index]) {
134
+ dockerParams[dataKey][index].value = e.target.value;
135
+ }
136
+ setDockerParams({
137
+ ...dockerParams,
138
+ [dataKey]: [...dockerParams[dataKey]]
139
+ });
140
+ };
141
+ const isCustomValue = value === `$${dockerArgsToCamelCase(item.key)}` || item.custom;
142
+ const isNotAllowDockerArgs = dataKey === 'dockerArgs' && !allowDockerArgs[item.key];
143
+ const isNotAllowUseCustom = notAllowUseCustomDockerArgs[item.key];
144
+ const isEnv = dataKey === 'dockerEnvs';
145
+ const isPublish = item.key === '--publish';
146
+ let title = item.key;
147
+ if (isPublish && item.type === 'web') {
148
+ title = '--publish (Web)';
149
+ } else if (isEnv) {
150
+ title = `--env ${item.key}`;
151
+ }
152
+ return /*#__PURE__*/_jsxs(Box, {
153
+ sx: {
154
+ display: 'flex',
155
+ flexDirection: 'row',
156
+ gap: 2,
157
+ alignItems: 'center'
158
+ },
159
+ children: [/*#__PURE__*/_jsx(Box, {
160
+ sx: {
161
+ width: 250
162
+ },
163
+ children: /*#__PURE__*/_jsx(Typography, {
164
+ sx: {
165
+ textOverflow: 'ellipsis',
166
+ width: '100%',
167
+ overflow: 'hidden'
168
+ },
169
+ children: title
170
+ })
171
+ }), /*#__PURE__*/_jsxs(Box, {
172
+ sx: {
173
+ display: 'flex',
174
+ flexDirection: 'column',
175
+ gap: 1,
176
+ flex: 1
177
+ },
178
+ children: [/*#__PURE__*/_jsx(TextField, {
179
+ disabled: readOnly || isCustomValue || isNotAllowDockerArgs,
180
+ placeholder: "",
181
+ value: isCustomValue ? `$${dockerArgsToCamelCase(item.key)}` : value,
182
+ sx: {
183
+ flex: 1
184
+ },
185
+ InputProps: {
186
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
187
+ position: "end",
188
+ sx: {
189
+ zoom: 0.9
190
+ },
191
+ children: [(!(isNotAllowUseCustom || isNotAllowDockerArgs) || isEnv || isPublish) && /*#__PURE__*/_jsx(IconButton, {
192
+ onClick: () => setShowDialog(true),
193
+ children: /*#__PURE__*/_jsx(Icon, {
194
+ icon: "icon-park-outline:setting-config"
195
+ })
196
+ }), !readOnly && /*#__PURE__*/_jsx(IconButton, {
197
+ onClick: handleDelete,
198
+ color: isNotAllowDockerArgs ? 'error' : 'default',
199
+ children: /*#__PURE__*/_jsx(Icon, {
200
+ icon: "ic:round-delete"
201
+ })
202
+ })]
203
+ })
204
+ },
205
+ error: isNotAllowDockerArgs,
206
+ onChange: handleChangeValue
207
+ }), isNotAllowDockerArgs && /*#__PURE__*/_jsx(Typography, {
208
+ variant: "caption",
209
+ color: "error",
210
+ children: t('blocklet.publish.docker.noAllowTheArg')
211
+ }), item.key === '--publish' && /*#__PURE__*/_jsx(Typography, {
212
+ variant: "caption",
213
+ color: "text.secondary",
214
+ children: t('blocklet.publish.docker.publishTips')
215
+ }), item.key === '--volume' && dockerArgsValidator[item.key](value) && /*#__PURE__*/_jsx(Typography, {
216
+ variant: "caption",
217
+ color: "error",
218
+ children: t('blocklet.publish.docker.volumeTips')
219
+ })]
220
+ }), showDialog && /*#__PURE__*/_jsx(Dialog, {
221
+ open: true,
222
+ fullWidth: true,
223
+ maxWidth: "sm",
224
+ PaperProps: {
225
+ style: {
226
+ minHeight: 0
227
+ }
228
+ },
229
+ title: isEnv ? t('blocklet.publish.docker.modifyEnv') : t('blocklet.publish.docker.modifyParam'),
230
+ onClose: () => setShowDialog(false),
231
+ children: /*#__PURE__*/_jsxs(Box, {
232
+ sx: {
233
+ display: 'flex',
234
+ flexDirection: 'column',
235
+ gap: 1,
236
+ paddingBottom: 2
237
+ },
238
+ children: [isNotAllowUseCustom || isNotAllowDockerArgs || isEnv ? null : /*#__PURE__*/_jsxs(Box, {
239
+ sx: {
240
+ width: '100%',
241
+ display: 'flex',
242
+ flexDirection: 'row',
243
+ alignItems: 'center',
244
+ justifyContent: 'space-between'
245
+ },
246
+ children: [/*#__PURE__*/_jsx(Typography, {
247
+ children: t('blocklet.publish.docker.needCustomInput')
248
+ }), /*#__PURE__*/_jsx(IOSSwitch, {
249
+ disabled: readOnly,
250
+ checked: isCustomValue,
251
+ onChange: handleSetCustom,
252
+ sx: {
253
+ zoom: 0.9
254
+ }
255
+ })]
256
+ }), isEnv && /*#__PURE__*/_jsxs(Box, {
257
+ sx: {
258
+ width: '100%',
259
+ display: 'flex',
260
+ flexDirection: 'row',
261
+ alignItems: 'center',
262
+ justifyContent: 'space-between'
263
+ },
264
+ children: [/*#__PURE__*/_jsx(Typography, {
265
+ children: t('blocklet.publish.docker.secure')
266
+ }), /*#__PURE__*/_jsx(IOSSwitch, {
267
+ disabled: readOnly,
268
+ checked: item.secure,
269
+ onChange: handleSetSecure,
270
+ sx: {
271
+ zoom: 0.9
272
+ }
273
+ })]
274
+ }), isEnv && /*#__PURE__*/_jsxs(Box, {
275
+ sx: {
276
+ width: '100%',
277
+ display: 'flex',
278
+ flexDirection: 'row',
279
+ alignItems: 'center',
280
+ justifyContent: 'space-between'
281
+ },
282
+ children: [/*#__PURE__*/_jsx(Typography, {
283
+ children: t('blocklet.publish.docker.shared')
284
+ }), /*#__PURE__*/_jsx(IOSSwitch, {
285
+ disabled: readOnly,
286
+ checked: item.shared,
287
+ onChange: handleSetShared,
288
+ sx: {
289
+ zoom: 0.9
290
+ }
291
+ })]
292
+ }), isEnv && /*#__PURE__*/_jsxs(Box, {
293
+ sx: {
294
+ width: '100%',
295
+ display: 'flex',
296
+ flexDirection: 'row',
297
+ alignItems: 'center',
298
+ justifyContent: 'space-between'
299
+ },
300
+ children: [/*#__PURE__*/_jsx(Typography, {
301
+ children: t('blocklet.publish.docker.required')
302
+ }), /*#__PURE__*/_jsx(IOSSwitch, {
303
+ disabled: readOnly,
304
+ checked: item.required,
305
+ onChange: handleSetRequired,
306
+ sx: {
307
+ zoom: 0.9
308
+ }
309
+ })]
310
+ }), isEnv && /*#__PURE__*/_jsxs(Box, {
311
+ sx: {
312
+ mt: 1,
313
+ width: '100%',
314
+ display: 'flex',
315
+ flexDirection: 'row',
316
+ alignItems: 'center',
317
+ justifyContent: 'space-between'
318
+ },
319
+ children: [/*#__PURE__*/_jsx(Typography, {
320
+ sx: {
321
+ flex: 1
322
+ },
323
+ children: t('blocklet.publish.docker.description')
324
+ }), /*#__PURE__*/_jsx(TextField, {
325
+ disabled: readOnly,
326
+ value: item.description,
327
+ onChange: handleSetDescription,
328
+ sx: {
329
+ flex: 1
330
+ },
331
+ label: t('blocklet.publish.docker.description')
332
+ })]
333
+ }), isPublish && /*#__PURE__*/_jsxs(Box, {
334
+ sx: {
335
+ mt: 1,
336
+ width: '100%',
337
+ display: 'flex',
338
+ flexDirection: 'row',
339
+ alignItems: 'center',
340
+ justifyContent: 'space-between'
341
+ },
342
+ children: [/*#__PURE__*/_jsx(Typography, {
343
+ sx: {
344
+ flex: 1
345
+ },
346
+ children: t('blocklet.publish.docker.portType')
347
+ }), /*#__PURE__*/_jsxs(Select, {
348
+ value: item.type || 'docker',
349
+ onChange: handleSetType,
350
+ children: [/*#__PURE__*/_jsx(MenuItem, {
351
+ value: "docker",
352
+ children: "Docker"
353
+ }), /*#__PURE__*/_jsx(MenuItem, {
354
+ value: "web",
355
+ children: "Web"
356
+ })]
357
+ })]
358
+ }), isPublish && item.type === 'web' && /*#__PURE__*/_jsxs(Box, {
359
+ sx: {
360
+ mt: 1,
361
+ width: '100%',
362
+ display: 'flex',
363
+ flexDirection: 'row',
364
+ alignItems: 'center',
365
+ justifyContent: 'space-between'
366
+ },
367
+ children: [/*#__PURE__*/_jsx(Typography, {
368
+ sx: {
369
+ flex: 1
370
+ },
371
+ children: t('blocklet.publish.docker.path')
372
+ }), /*#__PURE__*/_jsx(TextField, {
373
+ disabled: readOnly,
374
+ value: item.path,
375
+ onChange: handleSetPath,
376
+ sx: {
377
+ flex: 1
378
+ },
379
+ label: t('blocklet.publish.docker.path')
380
+ })]
381
+ }), isPublish && item.type === 'web' && /*#__PURE__*/_jsxs(Box, {
382
+ sx: {
383
+ mt: 1,
384
+ width: '100%',
385
+ display: 'flex',
386
+ flexDirection: 'row',
387
+ alignItems: 'center',
388
+ justifyContent: 'space-between'
389
+ },
390
+ children: [/*#__PURE__*/_jsx(Typography, {
391
+ sx: {
392
+ flex: 1
393
+ },
394
+ children: t('blocklet.publish.docker.name')
395
+ }), /*#__PURE__*/_jsx(TextField, {
396
+ disabled: readOnly,
397
+ value: item.name,
398
+ onChange: handleSetName,
399
+ sx: {
400
+ flex: 1
401
+ },
402
+ label: t('blocklet.publish.docker.name')
403
+ })]
404
+ }), isPublish && item.type === 'web' && /*#__PURE__*/_jsxs(Box, {
405
+ sx: {
406
+ mt: 1,
407
+ width: '100%',
408
+ display: 'flex',
409
+ flexDirection: 'row',
410
+ alignItems: 'center',
411
+ justifyContent: 'space-between'
412
+ },
413
+ children: [/*#__PURE__*/_jsx(Typography, {
414
+ sx: {
415
+ flex: 1
416
+ },
417
+ children: t('blocklet.publish.docker.prefix')
418
+ }), /*#__PURE__*/_jsx(TextField, {
419
+ disabled: readOnly,
420
+ value: item.prefix,
421
+ onChange: handleSetPrefix,
422
+ sx: {
423
+ flex: 1
424
+ },
425
+ label: t('blocklet.publish.docker.prefix')
426
+ })]
427
+ })]
428
+ })
429
+ })]
430
+ });
431
+ }
432
+ ResourceDockerInputItem.propTypes = {
433
+ dockerParams: PropTypes.object.isRequired,
434
+ setDockerParams: PropTypes.func.isRequired,
435
+ dataKey: PropTypes.string.isRequired,
436
+ item: PropTypes.object.isRequired,
437
+ t: PropTypes.func.isRequired,
438
+ readOnly: PropTypes.bool.isRequired,
439
+ index: PropTypes.number.isRequired
440
+ };
441
+ ResourceDockerInputItem.defaultProps = {};
442
+ export default ResourceDockerInputItem;