# @ray-js/multi-socket-switch

> 用于排插品类设备处理开关，可支持单开及总开能力

Latest version **0.0.4** (published 2024-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ray-js/multi-socket-switch
pnpm add @ray-js/multi-socket-switch
yarn add @ray-js/multi-socket-switch
bun add @ray-js/multi-socket-switch
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2024-09-24 |
| First published | 2023-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tuyafe |

## Links

- npm: https://www.npmjs.com/package/@ray-js/multi-socket-switch
- npm.io page: https://npm.io/package/@ray-js/multi-socket-switch

## Dependencies (2)

- [clsx](https://npm.io/package/clsx.md) ^1.2.1
- [@ray-js/svg](https://npm.io/package/@ray-js/svg.md) ^0.1.8

## Recent versions

- 0.0.4 (latest) — 2024-09-24
- 0.0.3-beta-3 (beta) — 2023-11-24
- 0.0.3 — 2023-11-24
- 0.0.3-beta-2 — 2023-11-24
- 0.0.3-beta-1 — 2023-11-23
- 0.0.2 — 2023-11-22

## README

English | [简体中文](./README-zh_CN.md)

# @ray-js/multi-socket-switch

[![latest](https://img.shields.io/npm/v/@ray-js/multi-socket-switch/latest.svg)](https://www.npmjs.com/package/@ray-js/multi-socket-switch) [![download](https://img.shields.io/npm/dt/@ray-js/multi-socket-switch.svg)](https://www.npmjs.com/package/@ray-js/multi-socket-switch)

> Used for processing switches for power strips and sockets, supporting single-open and total-open capabilities

## Installation

```sh
$ npm install @ray-js/multi-socket-switch
# or
$ yarn add @ray-js/multi-socket-switch
```

## Usage

Basic usage

```tsx
import MultiSocketSwitch from '@ray-js/multi-socket-switch';
export default () => (
  <MultiSocketSwitch
    style={{ width: 200 }}
    switchList={[
      { dpCode: 'swith_1', dpValue: true },
      { dpCode: 'swith_2', dpValue: true },
      { dpCode: 'swith_3', dpValue: false },
    ]}
    usbData={[
      { dpCode: 'usb_1', dpValue: true },
      { dpCode: 'usb_2', dpValue: false },
    ]}
    deviceId="123456"
  />
);
```

Multiple column usage

```tsx
import MultiSocketSwitch from '@ray-js/multi-socket-switch';
export default () => (
  <MultiSocketSwitch
    style={{ width: 400 }}
    switchList={[
      { dpCode: 'swith_1', dpValue: true },
      { dpCode: 'swith_2', dpValue: true },
      { dpCode: 'swith_3', dpValue: false },
      { dpCode: 'swith_4', dpValue: false },
      { dpCode: 'swith_5', dpValue: true },
      { dpCode: 'swith_6', dpValue: false },
    ]}
    usbData={[
      { dpCode: 'usb_1', dpValue: true },
      { dpCode: 'usb_2', dpValue: false },
    ]}
    usbLayout="horizontal"
    deviceId="123456"
    double
  />
);
```

Horizontal layout

```tsx
import MultiSocketSwitch from '@ray-js/multi-socket-switch';
export default () => (
  <MultiSocketSwitch
    switchList={[
      { dpCode: 'swith_1', dpValue: true },
      { dpCode: 'swith_2', dpValue: true },
    ]}
    usbData={[
      { dpCode: 'usb_1', dpValue: true },
      { dpCode: 'usb_2', dpValue: false },
    ]}
    deviceId="123456"
    layout="horizontal"
    usbLayout="horizontal"
  />
);
```

Custom

```tsx
import MultiSocketSwitch from '@ray-js/multi-socket-switch';
export default () => (
  <MultiSocketSwitch.Container style={{ width: 200 }}>
    <MultiSocketSwitch.MainSwitch value onClick={() => {}} />
    <MultiSocketSwitch.SubSwitch dpCode="switch_1" dpValue onClick={() => {}} />
    <MultiSocketSwitch.SubSwitch dpCode="switch_2" dpValue onClick={() => {}} />
    <MultiSocketSwitch.SubSwitch dpCode="switch_3" dpValue onClick={() => {}} />
  </MultiSocketSwitch.Container>
);
```

```tsx
import MultiSocketSwitch from '@ray-js/multi-socket-switch';
export default () => (
  <MultiSocketSwitch
    style={{ width: 200 }}
    switchList={[
      { dpCode: 'swith_1', dpValue: true },
      { dpCode: 'swith_2', dpValue: true },
      { dpCode: 'swith_3', dpValue: false },
    ]}
    usbData={[
      { dpCode: 'usb_1', dpValue: true },
      { dpCode: 'usb_2', dpValue: false },
    ]}
    deviceId="123456"
  />
);
```

---
_Source: https://npm.io/package/@ray-js/multi-socket-switch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
