0.10.312 • Published 4 months ago

json-object-editor v0.10.312

Weekly downloads
2,452
License
(c) Copyright 201...
Repository
bitbucket
Last release
4 months ago

Json Object Editor

JOE is software that allows you to manage data models via JSON objects. There are two flavors, the client-side version and nodejs server platform.

SERVER/PLATFORM mode

check port 2099
/JOE/
/JsonObjectEditor/docs.html
*Should auto-open on start

Json Object Editor (Universal-esque software) (requires connection to a mongo server for full functionality)

JOE server instantiation (add to entry point js file)

var joe = require('json-object-editor');
or here's a custom example
var joe = require('json-object-editor')({
	name:'name_your_joe' (JOE),
	joedb:'local_custom_database_name' // {{mongoURL}}' if using mongolab or remote mongodb,
	port:'4099', (2099)
	socketPort:'4098', (2098)
	sitesPort:'4100' (2100),
	clusters:1,
	hostname:'server name if not localhost'(localhost)
});

$J (universal) Shorthand JOE

$J to access helper funtions on client and server. (callbacks are optional)
$J.get(itemId,[callback])
$J.schema(schemaname,[callback])

Client-Side (front end only)

js client only instantiation

var specs = {
	fields:{
		species:{label:'Species',type:'select', values:['cat','dog','rat','thing'], onchange:adjustSchema},
		gender:{type:'select', values:['male','female']},
		legs:{label:'# of Legs',type:'int', onblur:logit},
		weight:{label:' Weight (lbs)',type:'number', onblur:logit},
		name:{label:' pet Name', onkeyup:logValue},
		//id:{label:'ID',type:'text', locked:true},
		id:{label:'ID',type:'guid'},
		
	//example of select that takes function (function is passed item)	
		animalLink:{label:'Link to other animal',type:'select', values:getAnimals},
		hiddenizer:{hidden:true}
	},
	schemas:{
		animal:animalschema,
		thing:thingschema			
	},
	container:string ('body'),
    compact:false,
    useBackButton:true,
	autosave:2000,
    listSubMenu:{filters:{}},
    useHashlink:true,
    title:'${itemtype} | ${display}'
}
var JOE = new JsonObjectEditor(specs);
JOE.init();

##JOE CONFIG ##specs

  • useBackButton:false if true, back button moves through joe panels when joe has history to go to (is open).
  • useHashlink:false, true or a template for hashlinks. default template is '${schemaname}${_id}' default server tempalte is '${schema_name}/${_id}' ##SCHEMA CONFIG ###fields Properties for all Fields

  • label / display: what the field should display as *If the field type is boolean, label controls checkbox/boolean label

  • value: default value if not one in object
  • default: default value for field || function(object)
  • type: what type of field should JOE show
  • hidden: boolean / function, value will be added (but unsees by user)
  • locked: boolean
  • condition: boolean
  • width: used for layout control. - can use pixels or percentages (as string)
  • comment: a commentthat shows up at the beginning of the field
  • tooltip: hover/clickable tooltip that shows up next to name

field types:

  • rendering: for css html and js
  • text: default single line text. - autocomplete: boolean // obj of specs (template, idprop) - values:array of possibilities -maxlength:string
  • int: integer field
  • number: number (float) field
  • select: select list. - multiple(bool) - values(array of objects, {value:"",name/display:""), can be a function - disabled:boolean(func acceptable) - idprop: string of prop name
  • geo: shows a map - takes a string array "lat,lon" - center:lat,lon, center of map - zoom: zoom level (higher zooms in more) - returns "lat,lon" -image : shows an image and HxW as th image url is typed in.
  • multisorter : allows arrays of objects to be selected and sorted in right bin. - values(array of objects, {value:"",name/display:""), can be a function
  • content : show content on in the editor
    • run: function to be run(current_object,field_properties)
    • template: html template for fillTemplate(template,current_object);
  • objectlist : a table of objects with editable properties
    • properties: array of objects|strings for the object property names -name: value in object -display: header in objectList
    • max: integer, number or items that can be added. use zero for infinite.
    • hideHeadings: don't show table headings
  • objectReference : a list of object ids
    • template
    • autocomplete_template
    • idprop
    • values
    • max(0 unlimited)
    • sortable(true)
  • code : - language
  • boolean: - label:controls checkbox label
  • preview : -content: string or function(current joe object) to replace everything on page (template). -bodycontent: same as content, only replaces body content. -url: preview page if not the default one. - encoded: boolean, if pre uriencoded labels:

  • pass an object instead of a string to the fields array.

{label:'Name of the following properties section'}

##page sections {section_start: 'SectionName', section_label:'Section Name with Labels', condition:function(item){ return item.show;} }, {section_end: 'CreativeBrief'}

  • pass an object instead of a string to the fields array. these show up on the details view as anchors.
  • Object Properties
    • section_start: name/id of section
    • 'section_label:use instead of section_start for display name
    • section_end: name/id of section(str)
    • template: html template for fillTemplate(template,current_object);

##page sidebar {sidebar_start: 'SectionName', sidebar_label:'Section Name with Labels', condition:function(item){ return item.show;} }, {sidebar_end: 'CreativeBrief'}

  • pass an object instead of a string to the fields array. these show up on the details view as anchors.
  • Object Properties
    • sidebar_start: name/id of sidebar
    • sidebar_label:use instead of sidebar_start for display name
    • sidebar_end: name/id of sidebar(str)
    • template: html template for fillTemplate(template,current_object);

###defaultProfile overwrites the default profile

#schemas

a list of schema objects that can configure the editor fields, these can be given properties that are delegated to all the corresponding fields.

var animalschema = 
{
	title:'Animal', *what shows as the panel header* 
	fields:['id','name','legs','species','weight','color','gender','animalLink'], *list of visible fields*
	_listID:'id', *the id for finding the object*
	_listTitle:'${name} ${species}', *how to display items in the list*
	menu:[array of menu buttons],
	listMenuTitle: (string) template forjoe window title in list view,
	listmenu:[array of menu buttons] (multi-edit and select all always show),
	/*callback:function(obj){
		alert(obj.name);
	},*/
	onblur:logit,
	hideNumbers:boolean *toggle list numbers*
	multipleCallback:function to be called after a multi-edit. passed list of edited items.
	onUpdate: callback for after update. passed single edited items.
	onMultipleUpdate:callback for after multi update.passed list of edited items.
            filters: array of objects
}

##Table View - add tableView object to a schema; -cols = strings||objects -string is the name and value -display/header is the column title -property/name = object property ###Pre-formating you can preformat at the joe call or schema level. The data item will be affected by the passed function (which should return the preformated item).

##menu## an array of menu buttons

//the default save button
//this is the dom object, 
//use _joe.current.object for current object
condition:function(field,object) to call
self = Joe object
var __saveBtn__ = {name:'save',label:'Save', action:'_joe.updateObject(this);', css:'joe-save-button'};

##itemMenu## as array of buttons for each item in list views - name - action (action string) - url (instead of js action) - condition

##itemExpander## template or run for content to be shown under the main list item block.

###Addition properties Changing the schema on the fly?

_joe.resetSchema(new schema name);

css (included) options

  • joe-left-button
  • joe-right-button

##FIELDS

{extend:'name',specs:{display:'Request Title'}},//extends the field 'name' with the specs provided.

##usage

a | adding a new object

_joe.show({},{schema:'animal',callback:addAnimal); 
//or goJoe(object,specs)

...
function addAnimal(obj){
	animals.push(obj);
}

b | viewing a list of objects

goJoe([array of objects],specs:{schema,subsets,subset})
goJoe.show(animals,{schema:'animal',subsets:[{name:'Two-Legged',filter:{legs:2}}]});
//use the specs property subset to pre-select a subset by name

properties

  • _listWindowTitle: the title of the window (can be passed in with the schema);
  • _listCount: added to the current object and can be used in the title.
  • _listTitle:'${name} ${species}', how to display items in the list
  • _icon: str template for a list item icon (standard min 50x50), 'http://www.icons.com/${itemname}', can be obj with width, height, url
  • listSubMenu:a function or object that represents the list submenu
  • stripeColor:string or function that returns valid css color descriptor.
  • bgColor:string or function that returns valid css color descriptor.
  • subsets: name:string, filter:object
  • subMenu:a function or object that represents the single item submenu

  • _listTemplate: html template that uses ${var} to write out the item properties for the list item. - standard css class joe-panel-content-option

###c | Conditional select that changes the item schema

fields:{
	species:{label:'Species',type:'select', values:['cat','dog','rat','thing'], onchange:adjustSchema},
	[field_id]:{
		
		+label : STR
		+type : STR
		value : STR (default value)
		+values : ARRAY/FUNC (for select)
		
		//modifiers
		+hidden:BOOL/STRING(name of field that toggles this) //don't show, but value is passed
		+locked:BOOL // show, but uneditable
		//events
		+onchange : FUNC
		+onblur : FUNC
		+onkeypress : FUNC
		+rerender : STRING // name of field to rerender
	}
}

function adjustSchema(dom){
	var species = $(dom).val();
	if(species == "thing"){
		JOE.resetSchema('thing')
	}
	else{
		JOE.resetSchema('animal')
	
	}
}

###d | duplicating an item

//duplicates the currently active object (being edited)
_joe.duplicateObject(specs);

specs

  • deletes:array of properties to clear for new item - note that you will need to delete guid/id fields or the id will be the same.

e | exporting an object in pretty format json (or minified)

JOE.exportJSON = function(object,objvarname,minify)

##Useful Functions _joe.reload(hideMessage,specs)

  • use specs.overwreite object to extend reloaded object.

_joe.constructObjectFromFields()

0.10.300

7 months ago

0.10.310

7 months ago

0.10.312

4 months ago

0.10.311

4 months ago

0.10.226

1 year ago

0.10.227

1 year ago

0.10.224

1 year ago

0.10.225

1 year ago

0.10.222

1 year ago

0.10.223

1 year ago

0.10.220

1 year ago

0.10.210

1 year ago

0.10.201

2 years ago

0.10.200

2 years ago

0.10.110

2 years ago

0.10.120

2 years ago

0.10.0

3 years ago

0.9.901

4 years ago

0.9.891

4 years ago

0.9.89

4 years ago

0.9.88

4 years ago

0.9.87

4 years ago

0.9.85

4 years ago

0.9.86

4 years ago

0.9.83

4 years ago

0.9.82

4 years ago

0.9.81

4 years ago

0.9.80

4 years ago

0.9.79

4 years ago

0.9.78

4 years ago

0.9.75

4 years ago

0.9.76

4 years ago

0.9.77

4 years ago

0.9.73

4 years ago

0.9.72

4 years ago

0.9.71

4 years ago

0.9.7

4 years ago

0.9.69

4 years ago

0.9.67

4 years ago

0.9.68

4 years ago

0.9.66

4 years ago

0.9.65

4 years ago

0.9.64

4 years ago

0.9.63

4 years ago

0.9.61

4 years ago

0.9.62

4 years ago

0.9.60

4 years ago

0.9.59

4 years ago

0.9.58

4 years ago

0.9.57

5 years ago

0.9.55

5 years ago

0.9.53

5 years ago

0.9.54

5 years ago

0.9.41

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.993

5 years ago

0.8.992

5 years ago

0.8.990

6 years ago

0.8.984

6 years ago

0.8.983

6 years ago

0.8.982

6 years ago

0.8.981

6 years ago

0.8.980

6 years ago

0.8.979

6 years ago

0.8.978

6 years ago

0.8.977

6 years ago

0.8.976

6 years ago

0.8.975

6 years ago

0.8.974

6 years ago

0.8.972

6 years ago

0.8.971

6 years ago

0.8.970

6 years ago

0.8.963

6 years ago

0.8.962

6 years ago

0.8.961

6 years ago

0.8.960

6 years ago

0.8.952

6 years ago

0.8.951

6 years ago

0.8.950

6 years ago

0.8.934

6 years ago

0.8.933

6 years ago

0.8.932

6 years ago

0.8.931

6 years ago

0.8.930

6 years ago

0.8.925

6 years ago

0.8.924

6 years ago

0.8.923

6 years ago

0.8.922

6 years ago

0.8.921

6 years ago

0.8.920

6 years ago

0.8.912

6 years ago

0.8.911

6 years ago

0.8.910

6 years ago

0.8.901

6 years ago

0.8.900

6 years ago

0.8.893

6 years ago

0.8.892

6 years ago

0.8.891

6 years ago

0.8.890

6 years ago

0.8.883

6 years ago

0.8.882

6 years ago

0.8.881

6 years ago

0.8.880

6 years ago

0.8.872

6 years ago

0.8.871

6 years ago

0.8.870

6 years ago

0.8.865

6 years ago

0.8.864

6 years ago

0.8.863

6 years ago

0.8.862

6 years ago

0.8.861

6 years ago

0.8.860

6 years ago

0.8.853

6 years ago

0.8.851

6 years ago

0.8.850

6 years ago

0.8.843

6 years ago

0.8.842

6 years ago

0.8.841

6 years ago

0.8.840

6 years ago

0.8.830

6 years ago

0.8.824

6 years ago

0.8.823

6 years ago

0.8.822

6 years ago

0.8.821

6 years ago

0.8.820

6 years ago

0.8.811

6 years ago

0.8.810

6 years ago

0.8.800

6 years ago

0.8.750

6 years ago

0.8.740

6 years ago

0.8.730

6 years ago

0.8.720

6 years ago

0.8.710

6 years ago

0.8.700

7 years ago

0.8.601

7 years ago

0.8.600

7 years ago

0.8.551

7 years ago

0.8.550

7 years ago

0.8.541

7 years ago

0.8.540

7 years ago

0.8.533

7 years ago

0.8.532

7 years ago

0.8.531

7 years ago

0.8.530

7 years ago

0.8.521

7 years ago

0.8.520

7 years ago

0.8.512

7 years ago

0.8.511

7 years ago

0.8.510

7 years ago

0.8.502

7 years ago

0.8.501

7 years ago

0.8.500

7 years ago

0.8.469

7 years ago

0.8.468

7 years ago

0.8.467

7 years ago

0.8.466

7 years ago

0.8.465

8 years ago

0.8.464

8 years ago

0.8.463

8 years ago

0.8.462

8 years ago

0.8.461

8 years ago

0.8.460

8 years ago

0.8.453

8 years ago

0.8.452

8 years ago

0.8.451

8 years ago

0.8.450

8 years ago

0.8.442

8 years ago

0.8.441

8 years ago

0.8.440

8 years ago

0.8.438

8 years ago

0.8.437

8 years ago

0.8.436

8 years ago

0.8.434

8 years ago

0.8.433

8 years ago

0.8.431

8 years ago

0.8.430

8 years ago

0.8.429

8 years ago

0.8.428

8 years ago

0.8.427

8 years ago

0.8.426

8 years ago

0.8.425

8 years ago

0.8.424

8 years ago

0.8.423

8 years ago

0.8.422

8 years ago

0.8.421

8 years ago

0.8.420

8 years ago

0.8.414

8 years ago

0.8.413

8 years ago

0.8.412

8 years ago

0.8.411

8 years ago

0.8.410

8 years ago

0.8.407

8 years ago

0.8.406

8 years ago

0.8.404

8 years ago

0.8.403

8 years ago

0.8.402

8 years ago

0.8.401

8 years ago

0.8.400

8 years ago

0.8.336

8 years ago

0.8.335

8 years ago

0.8.334

8 years ago

0.8.333

8 years ago

0.8.332

8 years ago

0.8.331

8 years ago

0.8.330

8 years ago

0.8.320

8 years ago

0.8.313

8 years ago

0.8.312

8 years ago

0.8.311

8 years ago

0.8.310

8 years ago

0.8.303

8 years ago

0.8.302

8 years ago

0.8.301

8 years ago

0.8.300

8 years ago

0.8.282

8 years ago

0.8.281

8 years ago

0.8.280

8 years ago

0.8.279

8 years ago

0.8.277

8 years ago

0.8.276

8 years ago

0.8.275

8 years ago

0.8.274

8 years ago

0.8.273

8 years ago

0.8.272

8 years ago

0.8.271

8 years ago

0.8.267

8 years ago

0.8.266

8 years ago

0.8.265

8 years ago

0.8.264

8 years ago

0.8.263

8 years ago

0.8.262

8 years ago

0.8.261

8 years ago

0.8.260

8 years ago

0.8.251

8 years ago

0.8.250

8 years ago

0.8.249

8 years ago

0.8.248

8 years ago

0.8.247

8 years ago

0.8.246

8 years ago

0.8.245

8 years ago

0.8.240

8 years ago

0.8.232

8 years ago

0.8.231

8 years ago

0.8.230

8 years ago

0.8.220

8 years ago

0.8.211

8 years ago

0.8.200

8 years ago

0.8.191

8 years ago

0.8.190

8 years ago

0.8.182

8 years ago

0.8.181

8 years ago

0.8.180

9 years ago

0.8.175

9 years ago

0.8.174

9 years ago

0.8.173

9 years ago

0.8.172

9 years ago

0.8.171

9 years ago

0.8.170

9 years ago

0.8.162

9 years ago

0.8.161

9 years ago

0.8.160

9 years ago

0.8.141

9 years ago

0.8.140

9 years ago

0.8.135

9 years ago

0.8.134

9 years ago

0.8.133

9 years ago

0.8.132

9 years ago

0.8.131

9 years ago

0.8.130

9 years ago

0.8.120

9 years ago

0.8.112

9 years ago

0.8.111

9 years ago

0.8.110

9 years ago

0.8.100

9 years ago

0.8.4

9 years ago

0.8.3

9 years ago

0.8.2

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.999

9 years ago

0.7.998

9 years ago

0.7.997

9 years ago

0.7.996

9 years ago

0.7.995

9 years ago

0.7.992

9 years ago

0.7.991

9 years ago

0.7.990

9 years ago

0.7.982

9 years ago

0.7.981

9 years ago

0.7.980

9 years ago

0.7.970

9 years ago

0.7.963

9 years ago

0.7.962

9 years ago

0.7.961

9 years ago

0.7.953

9 years ago

0.7.952

9 years ago

0.7.951

9 years ago

0.7.950

9 years ago

0.7.940

9 years ago

0.7.932

9 years ago

0.7.926

9 years ago

0.7.925

9 years ago

0.7.922

9 years ago

0.7.921

9 years ago

0.7.920

9 years ago

0.7.906

9 years ago

0.7.905

9 years ago

0.7.904

9 years ago

0.7.900

9 years ago

0.7.851

9 years ago

0.7.850

9 years ago

0.7.840

9 years ago

0.7.810

9 years ago

0.7.800

9 years ago

0.7.742

9 years ago

0.7.741

9 years ago

0.7.740

9 years ago

0.7.730

9 years ago

0.7.720

9 years ago

0.7.717

9 years ago

0.7.716

9 years ago

0.7.715

9 years ago

0.7.714

9 years ago

0.7.713

9 years ago

0.7.712

9 years ago

0.7.711

9 years ago

0.7.710

9 years ago

0.7.705

9 years ago

0.7.704

9 years ago

0.7.703

9 years ago

0.7.702

9 years ago

0.7.701

9 years ago

0.7.700

9 years ago

0.7.61

9 years ago

0.7.6

9 years ago

0.7.53

9 years ago

0.7.52

9 years ago

0.7.51

9 years ago

0.7.5

9 years ago

0.7.47

9 years ago

0.7.451

9 years ago

0.7.45

9 years ago

0.7.44

9 years ago

0.7.42

9 years ago

0.7.41

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.241

9 years ago

0.7.24

9 years ago

0.7.23

9 years ago

0.7.22

9 years ago

0.7.21

9 years ago

0.7.2

9 years ago

0.7.13

9 years ago

0.7.12

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.93

9 years ago

0.6.92

9 years ago

0.6.91

9 years ago

0.6.9

9 years ago

0.6.81

9 years ago

0.6.8

9 years ago

0.6.7

9 years ago

0.6.61

9 years ago

0.6.6

9 years ago

0.6.5

9 years ago

0.6.49

9 years ago

0.6.48

9 years ago

0.6.47

9 years ago

0.6.46

9 years ago

0.6.45

9 years ago

0.6.44

9 years ago

0.6.43

9 years ago

0.6.42

9 years ago

0.6.41

9 years ago

0.6.4

9 years ago

0.6.32

9 years ago

0.6.31

9 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.11

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.9

9 years ago

0.5.8

9 years ago

0.5.71

9 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.53

9 years ago

0.5.52

9 years ago

0.5.51

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.31

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.41

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.21

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.4

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago