1 /*! JointJS v0.9.0 - JavaScript diagramming library 2014-05-13
4 This Source Code Form is subject to the terms of the Mozilla Public
5 License, v. 2.0. If a copy of the MPL was not distributed with this
6 file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 if (typeof exports === 'object') {
11 util: require('../src/core').util,
14 Element: require('../src/joint.dia.element').Element,
15 Link: require('../src/joint.dia.link').Link
21 joint.shapes.erd = {};
23 joint.shapes.erd.Entity = joint.dia.Element.extend({
25 markup: '<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>',
27 defaults: joint.util.deepSupplement({
30 size: { width: 150, height: 60 },
33 fill: '#2ECC71', stroke: '#27AE60', 'stroke-width': 2,
34 points: '100,0 100,60 0,60 0,0'
37 fill: '#2ECC71', stroke: '#27AE60', 'stroke-width': 2,
38 points: '95,5 95,55 5,55 5,5',
43 'font-family': 'Arial', 'font-size': 14,
44 ref: '.outer', 'ref-x': .5, 'ref-y': .5,
45 'x-alignment': 'middle', 'y-alignment': 'middle'
49 }, joint.dia.Element.prototype.defaults)
52 joint.shapes.erd.WeakEntity = joint.shapes.erd.Entity.extend({
54 defaults: joint.util.deepSupplement({
56 type: 'erd.WeakEntity',
59 '.inner' : { display: 'auto' },
60 text: { text: 'Weak Entity' }
63 }, joint.shapes.erd.Entity.prototype.defaults)
66 joint.shapes.erd.Relationship = joint.dia.Element.extend({
68 markup: '<g class="rotatable"><g class="scalable"><polygon class="outer"/><polygon class="inner"/></g><text/></g>',
70 defaults: joint.util.deepSupplement({
72 type: 'erd.Relationship',
73 size: { width: 80, height: 80 },
76 fill: '#3498DB', stroke: '#2980B9', 'stroke-width': 2,
77 points: '40,0 80,40 40,80 0,40'
80 fill: '#3498DB', stroke: '#2980B9', 'stroke-width': 2,
81 points: '40,5 75,40 40,75 5,40',
86 'font-family': 'Arial', 'font-size': 12,
87 ref: '.', 'ref-x': .5, 'ref-y': .5,
88 'x-alignment': 'middle', 'y-alignment': 'middle'
92 }, joint.dia.Element.prototype.defaults)
95 joint.shapes.erd.IdentifyingRelationship = joint.shapes.erd.Relationship.extend({
97 defaults: joint.util.deepSupplement({
99 type: 'erd.IdentifyingRelationship',
102 '.inner': { display: 'auto' },
103 text: { text: 'Identifying' }
106 }, joint.shapes.erd.Relationship.prototype.defaults)
109 joint.shapes.erd.Attribute = joint.dia.Element.extend({
111 markup: '<g class="rotatable"><g class="scalable"><ellipse class="outer"/><ellipse class="inner"/></g><text/></g>',
113 defaults: joint.util.deepSupplement({
115 type: 'erd.Attribute',
116 size: { width: 100, height: 50 },
119 transform: 'translate(50, 25)'
122 stroke: '#D35400', 'stroke-width': 2,
123 cx: 0, cy: 0, rx: 50, ry: 25,
127 stroke: '#D35400', 'stroke-width': 2,
128 cx: 0, cy: 0, rx: 45, ry: 20,
129 fill: 'transparent', display: 'none'
132 'font-family': 'Arial', 'font-size': 14,
133 ref: '.', 'ref-x': .5, 'ref-y': .5,
134 'x-alignment': 'middle', 'y-alignment': 'middle'
138 }, joint.dia.Element.prototype.defaults)
142 joint.shapes.erd.Multivalued = joint.shapes.erd.Attribute.extend({
144 defaults: joint.util.deepSupplement({
146 type: 'erd.Multivalued',
149 '.inner': { display: 'block' },
150 text: { text: 'multivalued' }
152 }, joint.shapes.erd.Attribute.prototype.defaults)
155 joint.shapes.erd.Derived = joint.shapes.erd.Attribute.extend({
157 defaults: joint.util.deepSupplement({
162 '.outer': { 'stroke-dasharray': '3,5' },
163 text: { text: 'derived' }
166 }, joint.shapes.erd.Attribute.prototype.defaults)
169 joint.shapes.erd.Key = joint.shapes.erd.Attribute.extend({
171 defaults: joint.util.deepSupplement({
176 ellipse: { 'stroke-width': 4 },
177 text: { text: 'key', 'font-weight': 'bold', 'text-decoration': 'underline' }
179 }, joint.shapes.erd.Attribute.prototype.defaults)
182 joint.shapes.erd.Normal = joint.shapes.erd.Attribute.extend({
184 defaults: joint.util.deepSupplement({
188 attrs: { text: { text: 'Normal' }}
190 }, joint.shapes.erd.Attribute.prototype.defaults)
193 joint.shapes.erd.ISA = joint.dia.Element.extend({
195 markup: '<g class="rotatable"><g class="scalable"><polygon/></g><text/></g>',
197 defaults: joint.util.deepSupplement({
200 size: { width: 100, height: 50 },
203 points: '0,0 50,50 100,0',
204 fill: '#F1C40F', stroke: '#F39C12', 'stroke-width': 2
208 ref: '.', 'ref-x': .5, 'ref-y': .3,
209 'x-alignment': 'middle', 'y-alignment': 'middle'
213 }, joint.dia.Element.prototype.defaults)
217 joint.shapes.erd.Line = joint.dia.Link.extend({
219 defaults: { type: "erd.Line" },
221 cardinality: function(value) {
222 this.set('labels', [{ position: -20, attrs: { text: { dy: -8, text: value }}}]);
226 if (typeof exports === 'object') {
228 module.exports = joint.shapes.erd;