moment-parseformat
Advanced tools
Comparing version 0.0.6 to 0.0.8
{ | ||
"name": "bootstrap-editable-table", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"authors": [ | ||
@@ -29,16 +29,16 @@ "Gregor Martynus <gregor@martynus.net>" | ||
"devDependencies": { | ||
"bootstrap-navigable-table": "~0.0.1", | ||
"bootstrap-navigable-table": "~0.0.3", | ||
"bootstrap-expandable-input": "~0.0.3" | ||
}, | ||
"homepage": "https://github.com/gr2m/bootstrap-editable-table", | ||
"_release": "0.0.4", | ||
"_release": "0.1.0", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "0.0.4", | ||
"commit": "6dd746d62c379c23a13c4fe0aa6a57ec71460090" | ||
"tag": "0.1.0", | ||
"commit": "c593e3c757d506560c522cfa15565dcf9055f7d6" | ||
}, | ||
"_source": "git://github.com/gr2m/bootstrap-editable-table.git", | ||
"_target": "~0.0.4", | ||
"_target": "~0.1.0", | ||
"_originalSource": "bootstrap-editable-table", | ||
"_direct": true | ||
} |
@@ -19,8 +19,7 @@ (function ($) { | ||
// | ||
// $table.trigger('get:records', [function(records) {/* ... */}]) | ||
// $table.editableTable('serialize', function(records) {}) | ||
// | ||
// To add one or multiple records, do | ||
// | ||
// $table.trigger('add:record', [record /*, atIndex */]) | ||
// $table.trigger('add:records', [records /*, atIndex */]) | ||
// $table.editableTable('add', recordOrRecords /*, atIndex */ ) | ||
// | ||
@@ -30,6 +29,6 @@ var EditableTable = function (el) { | ||
var defaultValues, removeTimeout; | ||
var api = this; | ||
// 1. cache elements for performance reasons and | ||
// 2. setup event bindings | ||
// 3. setup hooks | ||
function initialize() { | ||
@@ -48,8 +47,34 @@ $table = $(el); | ||
$body.on('DOMNodeRemoved', 'tr', handleRemove); | ||
$table.on('add:record', addRecord); | ||
$table.on('add:records', addRecords); | ||
$table.on('get:records', getRecords); | ||
} | ||
// JS API | ||
// ------ | ||
// | ||
// get & return all records from table | ||
// | ||
api.serialize = function serialize(callback) { | ||
var records = []; | ||
$body.find('tr:not(:last-child)').each(function() { | ||
records.push(serializeRow($(this))); | ||
}); | ||
callback(records); | ||
}; | ||
// | ||
// | ||
// | ||
api.add = function add(records, index) { | ||
index = index || 0; | ||
if (! $.isArray(records)) { | ||
return addRow(record, index); | ||
} | ||
records.forEach(function(record, i) { | ||
addRow(record, i + index); | ||
}); | ||
}; | ||
// Event handlers | ||
@@ -139,36 +164,4 @@ // -------------- | ||
// Hooks | ||
// ----- | ||
// | ||
// | ||
// | ||
function addRecord (event, record, index) { | ||
addRow(record, index); | ||
} | ||
// | ||
// | ||
// | ||
function addRecords (event, records, index) { | ||
index = index || 0; | ||
records.forEach(function(record, i) { | ||
addRow(record, i + index); | ||
}); | ||
} | ||
// | ||
// get & return all records from table | ||
// | ||
function getRecords (event, callback) { | ||
var records = []; | ||
$body.find('tr:not(:last-child)').each(function() { | ||
records.push(serializeRow($(this))); | ||
}); | ||
callback(records); | ||
} | ||
// Internal Methods | ||
@@ -314,2 +307,3 @@ // ---------------- | ||
$.fn.editableTable = function (option) { | ||
var jsApiArgs = Array.prototype.slice.apply(arguments, [1]); | ||
return this.each(function () { | ||
@@ -323,3 +317,3 @@ var $this = $(this); | ||
if (typeof option === 'string') { | ||
api[option].call($this); | ||
api[option].apply($this, jsApiArgs); | ||
} | ||
@@ -326,0 +320,0 @@ }); |
{ | ||
"name": "bootstrap-editable-table", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"authors": [ | ||
@@ -29,5 +29,5 @@ "Gregor Martynus <gregor@martynus.net>" | ||
"devDependencies": { | ||
"bootstrap-navigable-table": "~0.0.1", | ||
"bootstrap-navigable-table": "~0.0.3", | ||
"bootstrap-expandable-input": "~0.0.3" | ||
} | ||
} |
@@ -43,3 +43,3 @@ Editable Table – A bootstrap plugin | ||
<td><input name="email" placeholder="joe@example.com" type="email"></td> | ||
<td><input name="email" placeholder="joe@example.com" type="email"></td> | ||
<td><input name="birthday" placeholder="10/20/2000" type="date"></td> | ||
</tr> | ||
@@ -50,2 +50,15 @@ </tbody> | ||
You can get or add records using the JS API: | ||
```js | ||
// get records out of table | ||
$table.editableTable('serialize', function(records) {}) | ||
// add a new record to the end of the table | ||
$table.editableTable('add', {name: 'Joe', email: 'joe@example.com'}) | ||
// add a new record after the 2nd | ||
$table.editableTable('add', {name: 'Joe', email: 'joe@example.com'}, 1) | ||
// add multiple records at once | ||
$table.editableTable('add', records) | ||
``` | ||
Fine Print | ||
@@ -52,0 +65,0 @@ ---------- |
{ | ||
"name": "moment-parseformat", | ||
"version": "0.0.6", | ||
"version": "0.0.8", | ||
"authors": [ | ||
@@ -23,5 +23,5 @@ "Gregor Martynus <gregor@martynus.net>" | ||
], | ||
"deDependencies": { | ||
"devDependencies": { | ||
"bootstrap": "~3.1.0", | ||
"bootstrap-editable-table": "~0.0.4" | ||
"bootstrap-editable-table": "~0.1.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "dependencies": { |
@@ -1,6 +0,16 @@ | ||
/* global moment */ | ||
'use strict'; | ||
(function(moment){ | ||
'use strict'; | ||
(function (root, factory) { | ||
/* global define */ | ||
if (typeof define === 'function' && define.amd) { | ||
define(['moment'], function (moment) { | ||
moment.parseFormat = factory(moment); | ||
return moment.parseFormat; | ||
}); | ||
} else if (typeof exports === 'object') { | ||
module.exports = factory(require('moment')); | ||
} else { | ||
root.moment.parseFormat = factory(root.moment); | ||
} | ||
})(this, function (/*moment*/) { // jshint ignore:line | ||
var dayNames = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; | ||
@@ -109,3 +119,3 @@ var abbreviatedDayNames = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; | ||
moment.parseFormat = parseDateFormat; | ||
})(moment); | ||
return parseDateFormat; | ||
}); |
{ | ||
"name": "moment-parseformat", | ||
"version": "0.0.6", | ||
"version": "0.0.8", | ||
"description": "A moment.js plugin to extract the format of a date/time string", | ||
@@ -5,0 +5,0 @@ "main": "moment.parseFormat.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39733
2782433