0.0.398 • Published 12 days ago

@gusmano/reext v0.0.398

Weekly downloads
-
License
MIT
Repository
-
Last release
12 days ago

React ReExt - React Components for ExtJS

Unleash the power of Sencha Ext JS in React

React ReExt provides React components for the Sencha ExtJS Framework.

Examples

classic toolkit with classic theme

Getting Starting using the VS Code Extension

The best way to get started with React ReExt is to use the ReExt Designer Extension in VS Code

Download the ReExt Designer VS Code Extension

To install the ReExt Designer Extension in VS Code, click on the Extensions Activity Bar item, then click the '...' menu in the upper right corner of the Extensions View, and select 'Install from VSIX...'

Quick Start - not using VS Code Extension

(takes less than 1 minute to run)

Note: Quick Start assumes npm is installed. To install npm, install Node.js

The commands can be run all at one time.

MacOS

Copy and paste the commands below into a MacOS terminal window.

Vite

npm create vite@latest reextvite -- --template react-swc
cd reextvite
npm install @gusmano/reext@latest
cp node_modules/@gusmano/reext/dist/example/ReExtData.json src/ReExtData.json
cp node_modules/@gusmano/reext/dist/example/App.jsx src/App.jsx
cp node_modules/@gusmano/reext/dist/example/main.jsx src/main.jsx
npx vite --open

Create React App

npx create-react-app reextcra
cd reextcra
npm install @gusmano/reext@latest
cp node_modules/@gusmano/reext/dist/example/ReExtData.json src/ReExtData.json
cp node_modules/@gusmano/reext/dist/example/App.jsx src/App.js
cp node_modules/@gusmano/reext/dist/example/main.jsx src/index.js
npm start

Windows

Copy and paste the commands below into a Windows Command Prompt window.

Vite

npm create vite@latest reextvite -- --template react-swc
cd reextvite
npm install @gusmano/reext@latest
xcopy node_modules\@gusmano\reext\dist\example\ReExtData.json src\ReExtData.json /Y
xcopy node_modules\@gusmano\reext\dist\example\App.jsx src\App.jsx /Y
xcopy node_modules\@gusmano\reext\dist\example\main.jsx src\index.js /Y
npx vite --open

Create React App

npx create-react-app reextcra
cd reextcra
npm install @gusmano/reext@latest
xcopy node_modules\@gusmano\reext\dist\example\ReExtData.json src\ReExtData.json /Y
xcopy node_modules\@gusmano\reext\dist\example\App.jsx src\App.js /Y
xcopy node_modules\@gusmano\reext\dist\example\main.jsx src\index.js /Y
npm start

Step by Step Guide - not using VS Code Extension

Create a React application

create react app

https://create-react-app.dev/docs/getting-started/

npx create-react-app reextcra

vite

https://vitejs.dev/guide/

npm create vite@latest reextvite -- --template react-swc

Installation

Use the package manager npm to install React ReExt.

npm install @gusmano/reext

Installing the Sencha ExtJS SDK

IMPORTANT-EXTJS FRAMEWORK REQUIREMENT:

React ReExt is dependent on Sencha ExtJS, and to run the framework locally you must have the framework installed in the public folder of your React project.

The Quick Start application is configured to run the Sencha ExtJS version 7.0.0 GPL from a remote server.

This is for demo purposes only and is not configured for Licensed development.

A licenced Commercial version of the framework can be acquired from the Sencha Support Portal - This can be done using the ReExt Designer VS Code Extension.

React ReExt can be configured to use any commercially available version of the Sencha Ext JS framework (7x and above).

For more information, download the ReExt Designer VS Code Extension (above), or contact Marc Gusmano at marcgusmano@gmail.com.

React ReExt has been tested with the latest version of the Sencha Ext JS framework, which at the time of this publishing is Sencha ExtJS version 7.8.0.

To purchase a commercial version of Sencha ExtJS, to to https://store.sencha.com/.

React version

React ReExt has been tested with the latest version of React, which at the time of this publishing is React 18.2.0.

Usage - ReExtProvider:

In main.jsx or index.js you use the ReExtProvider component:

import { ReExtProvider } from '@gusmano/reext';

var ReExtData = {
    "sdkversion": "7.8.0",
    "toolkit": "classic",
    "theme": "classic",
    "debug": false,
    "urlbase": "./",
    "location": "remote"
}

reactroot.render(
    <ReExtProvider splash={true} ReExtData={ReExtData}>
        <App />
    </ReExtProvider>
)

Usage - Example Code:

import React, { useState, useRef } from 'react';
import ReExt from '@gusmano/reext';

const App=()=>{
 const [labelcmp, setLabelCmp] = useState(null);
 const labelcmpRef = useRef();
 labelcmpRef.current = labelcmp;
 const [labeltext, setLabelText] = useState('initial text');
 const [row, setRow] = useState(null);

 return (
  <div style={{
   boxSizing:'border-box',height:'100%',
   display:'flex',flexDirection:'column'
  }}>
   <ReExt xtype='logo'/>
   <div style={{display:'flex'}}>
    <ReExt xtype='button'
     config={{text:'click me',width:100,ariaLabel:'demobutton'}}
     onTap={()=>{
      labelcmpRef.current.setHtml('set using method call');
      setLabelText('set using state');
     }}
    />
   </div>
   <ReExt xtype='grid'
    style={{height:300}}
    config={{
     title: 'grid',
     columns: [
      {text:'Name',dataIndex:'name',width:200},
      {text:'Email',dataIndex:'email',flex:1},
      {text:'Phone',dataIndex:'phone',width:200}
     ],
     data: [
      {name:'Lisa',email:'lisa@simpsons.com',phone:'555-111-1224'},
      {name:'Bart',email:'bart@simpsons.com',phone:'555-222-1234'},
      {name:'Homer',email:'homer@simpsons.com',phone:'555-333-1244'},
      {name:'Marge',email:'marge@simpsons.com',phone:'555-444-1254'}
     ]
    }}
    onSelect={(grid, selected)=>{
     var row = selected[0].data
     setRow(row)
     var rowString = JSON.stringify(row)
     labelcmpRef.current.setHtml(rowString)
     setLabelText(rowString)
    }}
   />
   <div style={{flex:1,padding:20,border:'1px solid gray'}}>
    {row !== null &&
     <>
     <ReExt xtype='label' config={{html: `name: ${row.name}`}}/>
     <ReExt xtype='label' config={{html: `email: ${row.email}`}}/>
     <ReExt xtype='label' config={{html: `phone: ${row.phone}`}}/>
     </>
    }
   </div>
   <div style={{flex:1,padding:20,border:'1px solid gray'}}>
    <ReExt xtype='label'
     config={{html:'initial text'}}
     ready={(cmp)=>{
      setLabelCmp(cmp)
     }}
    />
    <ReExt xtype='label'
     config={{html:labeltext}}
    />
   </div>
  </div>
 )
}
export default App

Run the React application

Create React App

npm start

Vite

npx vite --open

Documentation

The React ReExt Component

The ReExt React component has 5 static props (only xtype is required) and any number of optional event props

Example of a React ReExt button

<ReExt xtype='button'
 className='okbutton'
 style={{color:'green'}}
 config={{text:'OK'}}
 ready={(cmp)=>{console.log(cmp)}}
 onTap={(button,e,eOpts)=>{console.log(`${button.text}`)}}
/>

In the above example, here are the links to the ExtJS documentation

  • xtype='button'
  • config={{text:'click me'}}
  • onTap={(button,e,eOpts)=>{console.log(${button.text})}}/a>

More details on the the React ReExt props

  • xtype (required): the xtype of the component as defined in https://docs.sencha.com/extjs/7.0.0/
  • className (optional): the css class to be attached to the parent div of the underlying Ext JS component (each underlying ExtJS component is wrapped with a parent div that is width:'100%' and height: '100%' - unless overwritten in the className or style config)
  • style (optional): the css style to be attached to the parent div of the ExtJS component
  • config (optional): a JavaScript object with the configs of the component as defined in https://docs.sencha.com/extjs/7.0.0/
  • ready(cmp) (optional): the event that is fired by the ReExt component when the underlying ExtJS component is created. The value of this config is a function in your React hosting component with the parameter being the created ExtJS object.
  • storeloaded(store, cmp) (optional): the event that is fired by the ReExt component when the async store associated with the component is loaded.
  • 'on' props (optional): a prop that corresponds to an event fired by the ExtJS component; follow the pattern of 'on' with the first letter of the event capitalized. (ie, the button xtype has a tap event, and the corresponding prop is onTap). The value of this prop is a function in your React hosting component.

Custom ExtJS Components

To include custom ExtJS components as modules to be imported into your React application, the ExtJS runtime needs to be fully loaded - this will ensure that the Ext.define calls will succeed.

React ReExt includes an async function named ReExtLoader that ensures that the ExtJS runtime is loaded before any React components are included.

Also, an optional Fill method is available that will add css styles to the html, body and root elements to allow for using 100% of the browser client area.

Here is an example of using these functions in the loading sequence for your React app. (main.jsx or index.js)

import React from 'react'
import ReactDOM from 'react-dom/client'
import { ReExtLoader, Fill } from '@gusmano/reext'

(async () => {
 Fill();
 await ReExtLoader(); // can pass a parameter '-debug'
 const { default: App } = await import('./App');
 ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
   <App/>
  </React.StrictMode>
 )
})();

Custom ExtJS components can now be added as an import.

in src/App.jsx

import './List.jsx'
...
return (
 <ReExt xtype='mainlist'
  style={{flex:2,border:'1px solid gray'}}
  onSelect={(sender, record)=>{console.log('row selected',record[0])}}
 />
)

./List.jsx

import './store/Personnel'

Ext.define('ReExt.view.main.List', {
 extend: 'Ext.grid.Grid',
 xtype: 'mainlist',
 store: {type: 'personnel'},
 columns: [
  {text: 'Name',dataIndex: 'name'}
 ]
})

./store/Personnel.jsx

Ext.define('ReExt.store.Personnel', {
 extend: 'Ext.data.Store',
 alias: 'store.personnel',
 data: { items: [
 {name:'Jean Luc',email:"jeanluc@enterprise.com",phone:"555-111-1111"},
 {name:'Worf',email:"worf@enterprise.com",phone:"555-222-2222"},
 {name:'Deanna',email:"deanna@enterprise.com",phone:"555-333-3333"},
 {name:'Data',email:"data@enterprise.com",phone:"555-444-4444"}
 ]},
 proxy: {
  type: 'memory',
  reader: {
   type: 'json',
   rootProperty: 'items'
  }
 }
});

License

Trial

0.0.398

12 days ago

0.0.395

13 days ago

0.0.392

13 days ago

0.0.397

13 days ago

0.0.391

13 days ago

0.0.390

13 days ago

0.0.389

13 days ago

0.0.388

13 days ago

0.0.387

13 days ago

0.0.384

14 days ago

0.0.383

14 days ago

0.0.382

14 days ago

0.0.381

14 days ago

0.0.386

13 days ago

0.0.385

14 days ago

0.0.380

14 days ago

0.0.379

14 days ago

0.0.378

15 days ago

0.0.376

15 days ago

0.0.375

15 days ago

0.0.374

15 days ago

0.0.369

16 days ago

0.0.368

16 days ago

0.0.367

16 days ago

0.0.366

16 days ago

0.0.365

16 days ago

0.0.373

16 days ago

0.0.372

16 days ago

0.0.371

16 days ago

0.0.370

16 days ago

0.0.364

22 days ago

0.0.359

24 days ago

0.0.358

24 days ago

0.0.357

24 days ago

0.0.356

24 days ago

0.0.355

24 days ago

0.0.361

24 days ago

0.0.360

24 days ago

0.0.363

23 days ago

0.0.354

30 days ago

0.0.353

30 days ago

0.0.351

1 month ago

0.0.352

1 month ago

0.0.350

1 month ago

0.0.348

1 month ago

0.0.349

1 month ago

0.0.347

1 month ago

0.0.346

1 month ago

0.0.345

1 month ago

0.0.344

1 month ago

0.0.342

1 month ago

0.0.341

1 month ago

0.0.340

1 month ago

0.0.315

1 month ago

0.0.314

1 month ago

0.0.313

1 month ago

0.0.312

1 month ago

0.0.319

1 month ago

0.0.317

1 month ago

0.0.316

1 month ago

0.0.311

1 month ago

0.0.326

1 month ago

0.0.325

1 month ago

0.0.324

1 month ago

0.0.323

1 month ago

0.0.329

1 month ago

0.0.328

1 month ago

0.0.327

1 month ago

0.0.322

1 month ago

0.0.321

1 month ago

0.0.320

1 month ago

0.0.337

1 month ago

0.0.336

1 month ago

0.0.335

1 month ago

0.0.334

1 month ago

0.0.339

1 month ago

0.0.338

1 month ago

0.0.333

1 month ago

0.0.332

1 month ago

0.0.331

1 month ago

0.0.330

1 month ago

0.0.310

1 month ago

0.0.309

2 months ago

0.0.308

2 months ago

0.0.307

2 months ago

0.0.306

2 months ago

0.0.304

3 months ago

0.0.305

3 months ago

0.0.303

3 months ago

0.0.302

3 months ago

0.0.301

3 months ago

0.0.300

3 months ago

0.0.285

3 months ago

0.0.284

3 months ago

0.0.283

3 months ago

0.0.282

3 months ago

0.0.289

3 months ago

0.0.288

3 months ago

0.0.287

3 months ago

0.0.286

3 months ago

0.0.295

3 months ago

0.0.294

3 months ago

0.0.293

3 months ago

0.0.299

3 months ago

0.0.298

3 months ago

0.0.297

3 months ago

0.0.292

3 months ago

0.0.291

3 months ago

0.0.290

3 months ago

0.0.279

3 months ago

0.0.278

3 months ago

0.0.277

3 months ago

0.0.276

3 months ago

0.0.275

3 months ago

0.0.281

3 months ago

0.0.280

3 months ago

0.0.274

3 months ago

0.0.273

3 months ago

0.0.272

3 months ago

0.0.271

3 months ago

0.0.270

3 months ago

0.0.269

3 months ago

0.0.259

4 months ago

0.0.258

4 months ago

0.0.257

4 months ago

0.0.268

4 months ago

0.0.263

4 months ago

0.0.262

4 months ago

0.0.261

4 months ago

0.0.260

4 months ago

0.0.267

4 months ago

0.0.266

4 months ago

0.0.265

4 months ago

0.0.264

4 months ago

0.0.252

4 months ago

0.0.256

4 months ago

0.0.255

4 months ago

0.0.254

4 months ago

0.0.253

4 months ago

0.0.251

4 months ago

0.0.250

4 months ago

0.0.249

5 months ago

0.0.248

5 months ago

0.0.247

5 months ago

0.0.246

5 months ago

0.0.245

5 months ago

0.0.240

5 months ago

0.0.244

5 months ago

0.0.242

5 months ago

0.0.239

5 months ago

0.0.238

5 months ago

0.0.237

5 months ago

0.0.236

5 months ago

0.0.235

5 months ago

0.0.234

5 months ago

0.0.233

5 months ago

0.0.232

5 months ago

0.0.231

5 months ago

0.0.230

5 months ago

0.0.229

5 months ago

0.0.228

5 months ago

0.0.227

5 months ago

0.0.226

5 months ago

0.0.225

5 months ago

0.0.224

6 months ago

0.0.223

6 months ago

0.0.222

6 months ago

0.0.221

6 months ago

0.0.220

6 months ago

0.0.219

6 months ago

0.0.218

6 months ago

0.0.217

6 months ago

0.0.216

6 months ago

0.0.215

6 months ago

0.0.214

6 months ago

0.0.212

6 months ago

0.0.211

6 months ago

0.0.210

6 months ago

0.0.209

6 months ago

0.0.208

6 months ago

0.0.207

6 months ago

0.0.206

6 months ago

0.0.205

6 months ago

0.0.204

6 months ago

0.0.203

6 months ago

0.0.202

6 months ago

0.0.201

6 months ago

0.0.200

6 months ago

0.0.199

6 months ago

0.0.198

6 months ago

0.0.197

6 months ago

0.0.196

6 months ago

0.0.195

6 months ago

0.0.194

6 months ago

0.0.193

6 months ago

0.0.192

6 months ago

0.0.191

6 months ago

0.0.190

6 months ago

0.0.189

6 months ago

0.0.188

6 months ago

0.0.187

6 months ago

0.0.186

6 months ago

0.0.184

6 months ago

0.0.183

6 months ago

0.0.182

6 months ago

0.0.181

6 months ago

0.0.180

6 months ago

0.0.179

6 months ago

0.0.177

6 months ago

0.0.176

6 months ago

0.0.175

6 months ago

0.0.174

6 months ago

0.0.173

6 months ago

0.0.172

6 months ago

0.0.171

6 months ago

0.0.170

6 months ago

0.0.169

6 months ago

0.0.168

6 months ago

0.0.167

6 months ago

0.0.166

6 months ago

0.0.165

6 months ago

0.0.164

6 months ago

0.0.163

6 months ago

0.0.162

6 months ago

0.0.161

6 months ago

0.0.160

6 months ago

0.0.159

6 months ago

0.0.158

6 months ago

0.0.157

6 months ago

0.0.156

6 months ago

0.0.155

6 months ago

0.0.154

6 months ago

0.0.153

6 months ago

0.0.152

6 months ago

0.0.151

6 months ago

0.0.150

6 months ago

0.0.149

6 months ago

0.0.148

6 months ago

0.0.147

6 months ago

0.0.146

6 months ago

0.0.145

6 months ago

0.0.144

6 months ago

0.0.142

6 months ago

0.0.141

6 months ago

0.0.140

6 months ago

0.0.139

6 months ago

0.0.138

6 months ago

0.0.137

6 months ago

0.0.136

6 months ago

0.0.134

6 months ago

0.0.133

6 months ago

0.0.132

6 months ago

0.0.131

6 months ago

0.0.130

6 months ago

0.0.129

6 months ago

0.0.128

6 months ago

0.0.127

6 months ago

0.0.126

6 months ago

0.0.125

6 months ago

0.0.124

6 months ago

0.0.123

6 months ago

0.0.122

6 months ago

0.0.121

6 months ago

0.0.120

6 months ago

0.0.119

6 months ago

0.0.118

6 months ago

0.0.117

6 months ago

0.0.116

6 months ago

0.0.115

6 months ago

0.0.114

6 months ago

0.0.112

6 months ago

0.0.111

6 months ago

0.0.110

6 months ago

0.0.109

6 months ago

0.0.108

6 months ago

0.0.107

6 months ago

0.0.106

6 months ago

0.0.105

6 months ago

0.0.104

6 months ago

0.0.103

6 months ago

0.0.102

6 months ago

0.0.100

6 months ago

0.0.99

6 months ago

0.0.98

6 months ago

0.0.97

6 months ago

0.0.96

6 months ago

0.0.95

6 months ago

0.0.94

6 months ago

0.0.93

6 months ago

0.0.92

6 months ago

0.0.91

6 months ago

0.0.90

6 months ago

0.0.89

6 months ago

0.0.88

6 months ago

0.0.87

6 months ago

0.0.86

6 months ago

0.0.85

6 months ago

0.0.84

6 months ago

0.0.83

6 months ago

0.0.82

6 months ago

0.0.81

6 months ago

0.0.80

6 months ago

0.0.79

6 months ago

0.0.78

6 months ago

0.0.77

6 months ago

0.0.76

6 months ago

0.0.75

6 months ago

0.0.74

6 months ago

0.0.73

6 months ago

0.0.72

6 months ago

0.0.71

6 months ago

0.0.70

6 months ago

0.0.69

6 months ago

0.0.68

6 months ago

0.0.67

6 months ago

0.0.66

6 months ago

0.0.65

6 months ago

0.0.64

6 months ago

0.0.63

6 months ago

0.0.62

6 months ago

0.0.61

6 months ago

0.0.60

6 months ago

0.0.59

6 months ago

0.0.58

6 months ago

0.0.57

6 months ago

0.0.56

6 months ago

0.0.55

6 months ago

0.0.54

6 months ago

0.0.53

6 months ago

0.0.52

6 months ago

0.0.51

6 months ago

0.0.50

6 months ago

0.0.49

6 months ago

0.0.48

6 months ago

0.0.47

6 months ago

0.0.46

6 months ago

0.0.45

6 months ago

0.0.44

6 months ago

0.0.43

6 months ago

0.0.42

6 months ago

0.0.41

6 months ago

0.0.40

6 months ago

0.0.39

6 months ago

0.0.38

6 months ago

0.0.37

6 months ago

0.0.36

6 months ago

0.0.35

6 months ago

0.0.34

6 months ago

0.0.33

6 months ago

0.0.32

6 months ago

0.0.31

6 months ago

0.0.30

6 months ago

0.0.29

6 months ago

0.0.28

6 months ago

0.0.27

6 months ago

0.0.26

6 months ago

0.0.25

6 months ago

0.0.24

6 months ago

0.0.23

6 months ago

0.0.22

6 months ago

0.0.21

6 months ago

0.0.20

6 months ago

0.0.19

6 months ago

0.0.18

6 months ago

0.0.17

6 months ago

0.0.16

6 months ago

0.0.15

6 months ago

0.0.14

6 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago