@lvce-editor/ports-view 0.4.0 → 0.5.0

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.
@@ -2267,16 +2267,8 @@ const cancelButton = {
2267
2267
  onClick: HandleCancelAddPort,
2268
2268
  type: Button
2269
2269
  };
2270
- const getEditor = state => {
2271
- const {
2272
- addPortError,
2273
- addPortValue
2274
- } = state;
2270
+ const getPortInputDom = addPortValue => {
2275
2271
  return [{
2276
- childCount: addPortError ? 4 : 3,
2277
- className: AddPortEditor,
2278
- type: Div
2279
- }, {
2280
2272
  ariaLabel: portNumber(),
2281
2273
  childCount: 0,
2282
2274
  className: AddPortInput,
@@ -2286,13 +2278,27 @@ const getEditor = state => {
2286
2278
  placeholder: portNumber(),
2287
2279
  type: Input,
2288
2280
  value: addPortValue
2289
- }, {
2281
+ }];
2282
+ };
2283
+ const getButtonsDom = addPortValue => {
2284
+ return [{
2290
2285
  childCount: 1,
2291
2286
  className: AddPortButton,
2292
2287
  disabled: addPortValue.length === 0,
2293
2288
  onClick: HandleSubmitAddPort,
2294
2289
  type: Button
2295
- }, text(add()), cancelButton, text(cancel()), ...getErrorDom(addPortError)];
2290
+ }, text(add()), cancelButton, text(cancel())];
2291
+ };
2292
+ const getEditor = state => {
2293
+ const {
2294
+ addPortError,
2295
+ addPortValue
2296
+ } = state;
2297
+ return [{
2298
+ childCount: addPortError ? 4 : 3,
2299
+ className: AddPortEditor,
2300
+ type: Div
2301
+ }, ...getPortInputDom(addPortValue), ...getButtonsDom(addPortValue), ...getErrorDom(addPortError)];
2296
2302
  };
2297
2303
 
2298
2304
  const addButton = {
@@ -2318,9 +2324,13 @@ const getPortsFooterVirtualDom = state => {
2318
2324
  return [footer, footerContent, ...content];
2319
2325
  };
2320
2326
 
2327
+ const getPortStatusText = active => {
2328
+ return active ? '●' : '○';
2329
+ };
2321
2330
  const getPortsStatusVirtualDom = (active, port) => {
2322
2331
  const label = active ? portIsActive(port) : portIsInactive(port);
2323
2332
  const stateClass = active ? PortsStatusIconActive : PortsStatusIconInactive;
2333
+ const statusText = getPortStatusText(active);
2324
2334
  return [{
2325
2335
  ariaLabel: label,
2326
2336
  childCount: 1,
@@ -2333,7 +2343,7 @@ const getPortsStatusVirtualDom = (active, port) => {
2333
2343
  className: mergeClassNames(PortsStatusIcon, stateClass),
2334
2344
  name: `port-status-${port}`,
2335
2345
  type: Span
2336
- }, text(active ? '●' : '○')];
2346
+ }, text(statusText)];
2337
2347
  };
2338
2348
 
2339
2349
  const getRowClassName = port => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ports-view",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Ports View Worker",
5
5
  "repository": {
6
6
  "type": "git",