Skip to content
This repository was archived by the owner on Jan 18, 2021. It is now read-only.

Commit fb1064c

Browse files
GitBrentGitBrent
GitBrent
authored and
GitBrent
committed
Updated for 1.5.0 release
1 parent 5286479 commit fb1064c

11 files changed

+90
-70
lines changed

CHANGELOG.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Change Log
22

3-
## [v1.5.0](https://github.com/gitbrent/sprestlib/tree/v1.5.0) (2018-02-??)
3+
## [v1.5.0](https://github.com/gitbrent/sprestlib/tree/v1.5.0) (2018-02-16)
44
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v1.4.0...v1.5.0)
55

66
**Implemented Enhancements:**
77
- Form binding/population spun off into separate `sprestlib-ui.js` library
8-
- Added new dist file - minified library: `sprestlib.min.js`
8+
- Created a separate demo page for `sprestlib-ui.js` library
9+
- Added new dist file (minified library): `sprestlib.min.js`
910

1011
**Fixed Bugs:**
1112
- Selecting the same field name twice results in undefined [\#15](https://github.com/gitbrent/sprestlib/issues/15) ([gitbrent](https://github.com/gitbrent))
13+
- Fixed a null-check defect in REST result parsing
14+
1215

1316

1417

@@ -25,6 +28,7 @@
2528

2629

2730

31+
2832
## [v1.3.0](https://github.com/gitbrent/sprestlib/tree/v1.3.0) (2017-11-27)
2933
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v1.2.1...v1.3.0)
3034

@@ -37,6 +41,7 @@
3741

3842

3943

44+
4045
## [v1.2.1](https://github.com/gitbrent/sprestlib/tree/v1.2.1) (2017-10-12)
4146
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v1.2.0...v1.2.1)
4247

@@ -46,6 +51,7 @@
4651

4752

4853

54+
4955
## [v1.2.0](https://github.com/gitbrent/sprestlib/tree/v1.2.0) (2017-10-05)
5056
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v1.1.0...v1.2.0)
5157

@@ -58,6 +64,7 @@
5864

5965

6066

67+
6168
## [v1.1.0](https://github.com/gitbrent/sprestlib/tree/v1.1.0) (2017-09-07)
6269
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v1.0.0...v1.1.0)
6370

@@ -68,6 +75,7 @@
6875

6976

7077

78+
7179
## [v1.0.0](https://github.com/gitbrent/sprestlib/tree/v1.0.0) (2017-08-08)
7280
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v0.12.0...v1.0.0)
7381

@@ -76,12 +84,18 @@
7684
- Node connectivity to SharePoint (Office 365) works now
7785
- Last bit of cleanup work to arrive at v1.0.0
7886

87+
88+
89+
7990
## [v0.12.0](https://github.com/gitbrent/sprestlib/tree/v0.12.0) (2017-07-05)
8091
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v0.11.0...v0.12.0)
8192

8293
**Fixed Bugs:**
8394
- Lots of code cleanup and bug fixes
8495

96+
97+
98+
8599
## [v0.11.0](https://github.com/gitbrent/sprestlib/tree/v0.11.0) (2017-06-25)
86100
[Full Changelog](https://github.com/gitbrent/sprestlib/compare/v0.10.0...v0.11.0)
87101

@@ -96,11 +110,17 @@
96110
- Added sprestlib.bundle.js file (using gulp)
97111
- Added bower support
98112

113+
114+
115+
99116
## [v0.10.0](https://github.com/gitbrent/sprestlib/tree/v1.0.0) (2017-05-11)
100117

101118
**Code Cleanup**
102119
**New Features**
103120

121+
122+
123+
104124
## [v0.9.0](https://github.com/gitbrent/sprestlib/tree/v1.0.0) (2017-01-31)
105125

106126
**Initial Release**

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ to load the SpRestLib bundle script dynamically:
173173
```javascript
174174
// 1: Load SpRestLib via CDN
175175
var script = document.createElement('script');
176-
script.src = "https://cdn.rawgit.com/gitbrent/SpRestLib/v1.4.0/dist/sprestlib.bundle.js";
176+
script.src = "https://cdn.rawgit.com/gitbrent/SpRestLib/v1.5.0/dist/sprestlib.bundle.js";
177177
document.getElementsByTagName('head')[0].appendChild(script);
178178

179-
// 2: Try some library methods
179+
// 2: Test drive some library methods
180+
// Show current user info
180181
sprLib.user().info().then( objUser => (console.table ? console.table([objUser]) : console.log(objUser)) );
182+
// Show all Lists/Libraries on the current Site
181183
sprLib.site().lists().then( arrLists => (console.table ? console.table(arrLists) : console.log(arrLists)) );
182184
```
183185

dist/sprestlib-ui.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sprestlib-ui.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sprestlib-ui.js

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
(function(){
3131
// APP VERSION/BUILD
32-
var APP_VER = "1.0.0-beta";
33-
var APP_BLD = "20180114";
32+
var APP_VER = "1.0.0";
33+
var APP_BLD = "20180216";
3434
var SPRLIB_REQ = "1.4.0+";
3535
var DEBUG = false; // (verbose mode/lots of logging)
3636
// APP MESSAGE STRINGS (Internationalization)
@@ -163,9 +163,8 @@
163163
==================================================================================================
164164
*/
165165

166-
// TODO: Unimplemented/undocumented/undemoed
166+
// TODO: Unimplemented/undocumented/undemoed... need to: Validate/Update/Document
167167
function doParseFormIntoJson(inModel, inEleId) {
168-
// TODO: Validate/Update/Document for post-1.0.0
169168
var objReturn = {
170169
jsonSpData: {},
171170
jsonFormat: {}
@@ -195,49 +194,49 @@
195194
var dataName = ( inModel.listCols[strCol] ? inModel.listCols[strCol].dataName : strCol );
196195

197196
// C: Handle various element types
198-
// TODO: add new HTML5 tags
199-
200-
// CASE: <checkbox>
201-
if ( $(this).is(':checkbox') ) {
202-
objReturn.jsonSpData[dataName] = $(this).prop('checked');
203-
objReturn.jsonFormat[strCol] = APP_STRINGS[APP_OPTS.language][$(this).prop('checked').toString()];
204-
}
205-
// CASE: <jquery-ui datepicker>
206-
else if ( $(this).val() && $(this).hasClass('hasDatepicker') ) {
207-
objReturn.jsonSpData[dataName] = $(this).datepicker('getDate').toISOString();
208-
objReturn.jsonFormat[strCol] = ( inModel.listCols[strCol].dateFormat ? bdeLib.localDateStrFromSP(null,$(this).datepicker('getDate'),inModel.listCols[strCol].dateFormat) : $(this).datepicker('getDate').toISOString() );
209-
}
210-
// CASE: <select:single>
211-
else if ( $(this).val() && $(this).prop('type') == 'select-one' ) {
212-
objReturn.jsonSpData[dataName] = ($(this).data('type') && ($(this).data('type') == 'num' || $(this).data('type') == 'pct')) ? Number($(this).val()) : $(this).val().toString();
213-
objReturn.jsonFormat[strCol] = objReturn.jsonSpData[dataName];
214-
}
215-
// CASE: <select:multiple>
216-
else if ( $(this).val() && $(this).prop('type') == 'select-multiple' ) {
217-
// TODO: This is for multi-lookup! Multi-choice w/b different - add code!
218-
// EX: (SP2013/16): { "SkillsId": { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":[1,2,3] } }
219-
var arrIds = [];
220-
$.each($(this).val(), function(i,val){ arrIds.push( Number(val) ); });
221-
objReturn.jsonSpData[dataName] = { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":arrIds };
222-
objReturn.jsonFormat[strCol] = arrIds.toString();
223-
}
224-
// CASE: <radiobutton>
225-
else if ( $(this).val() && $(this).is(':radio') ) {
226-
// TODO: FUTURE: Add radiobutton, get value by name or whatever
227-
}
228-
// CASE: <textarea>
229-
else if ( $(this).text() && $(this).prop('tagName').toUpperCase() == 'TEXTAREA' ) {
230-
objReturn.jsonSpData[dataName] = $(this).text();
231-
objReturn.jsonFormat[strCol] = $(this).text();
232-
}
233-
// CASE: (everything else - excluding buttons)
234-
else if ( $(this).val() && $(this).prop('type') != 'submit' && $(this).prop('type') != 'reset' && $(this).prop('type') != 'button' ) {
235-
objReturn.jsonSpData[dataName] = $(this).val();
236-
objReturn.jsonFormat[strCol] = $(this).val();
237-
}
238-
// CASE: No value
239-
else {
240-
objReturn.jsonFormat[strCol] = '';
197+
{
198+
// CASE: <checkbox>
199+
if ( $(this).is(':checkbox') ) {
200+
objReturn.jsonSpData[dataName] = $(this).prop('checked');
201+
objReturn.jsonFormat[strCol] = APP_STRINGS[APP_OPTS.language][$(this).prop('checked').toString()];
202+
}
203+
// CASE: <jquery-ui datepicker>
204+
else if ( $(this).val() && $(this).hasClass('hasDatepicker') ) {
205+
objReturn.jsonSpData[dataName] = $(this).datepicker('getDate').toISOString();
206+
objReturn.jsonFormat[strCol] = ( inModel.listCols[strCol].dateFormat ? bdeLib.localDateStrFromSP(null,$(this).datepicker('getDate'),inModel.listCols[strCol].dateFormat) : $(this).datepicker('getDate').toISOString() );
207+
}
208+
// CASE: <select:single>
209+
else if ( $(this).val() && $(this).prop('type') == 'select-one' ) {
210+
objReturn.jsonSpData[dataName] = ($(this).data('type') && ($(this).data('type') == 'num' || $(this).data('type') == 'pct')) ? Number($(this).val()) : $(this).val().toString();
211+
objReturn.jsonFormat[strCol] = objReturn.jsonSpData[dataName];
212+
}
213+
// CASE: <select:multiple>
214+
else if ( $(this).val() && $(this).prop('type') == 'select-multiple' ) {
215+
// TODO: This is for multi-lookup! Multi-choice w/b different - add code!
216+
// EX: (SP2013/16): { "SkillsId": { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":[1,2,3] } }
217+
var arrIds = [];
218+
$.each($(this).val(), function(i,val){ arrIds.push( Number(val) ); });
219+
objReturn.jsonSpData[dataName] = { "__metadata":{"type":"Collection(Edm.Int32)"}, "results":arrIds };
220+
objReturn.jsonFormat[strCol] = arrIds.toString();
221+
}
222+
// CASE: <radiobutton>
223+
else if ( $(this).val() && $(this).is(':radio') ) {
224+
// TODO: FUTURE: Add radiobutton, get value by name or whatever
225+
}
226+
// CASE: <textarea>
227+
else if ( $(this).text() && $(this).prop('tagName').toUpperCase() == 'TEXTAREA' ) {
228+
objReturn.jsonSpData[dataName] = $(this).text();
229+
objReturn.jsonFormat[strCol] = $(this).text();
230+
}
231+
// CASE: (everything else - excluding buttons)
232+
else if ( $(this).val() && $(this).prop('type') != 'submit' && $(this).prop('type') != 'reset' && $(this).prop('type') != 'button' ) {
233+
objReturn.jsonSpData[dataName] = $(this).val();
234+
objReturn.jsonFormat[strCol] = $(this).val();
235+
}
236+
// CASE: No value
237+
else {
238+
objReturn.jsonFormat[strCol] = '';
239+
}
241240
}
242241

243242
// D: Special Cases:
@@ -327,11 +326,10 @@
327326
}
328327
});
329328
}
330-
331-
// 2: If a column is in a [select] text/value, then add it to cols!
332-
if ( objTagData.text && objTagData.cols.indexOf(objTagData.text) == -1 ) arrColNames.push(objTagData.text);
333-
if ( objTagData.value && objTagData.cols.indexOf(objTagData.value) == -1 ) arrColNames.push(objTagData.value);
334329
}
330+
// If a column is in a [select] text/value, then those 2 are the query cols
331+
if ( objTagData.text ) arrColNames.push(objTagData.text);
332+
if ( objTagData.value ) arrColNames.push(objTagData.value);
335333

336334
if ( objTagData.filter ) {
337335
// A: Param Check (NOTE: Dont use "!$(tag).filter.val" as actual value may be [false] or ""!)
@@ -369,6 +367,7 @@
369367
}
370368

371369
$.each(objTagData.data, function(i,data){
370+
console.log(data);
372371
$(tag).append('<option value="'+ data[objTagData.value] +'">'+ data[objTagData.text] +'</option>');
373372
});
374373
}
@@ -493,7 +492,7 @@
493492
+ strErr +'</td></tr>'
494493
);
495494
}
496-
// TODO: show error in tag
495+
// TODO: show error in tags other than table
497496
console.error(strErr);
498497
});
499498
});

dist/sprestlib.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sprestlib.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sprestlib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ var NODEJS = ( typeof module !== 'undefined' && module.exports );
3232

3333
(function(){
3434
// APP VERSION/BUILD
35-
var APP_VER = "1.5.0-beta";
36-
var APP_BLD = "20180211";
35+
var APP_VER = "1.5.0";
36+
var APP_BLD = "20180216";
3737
var DEBUG = false; // (verbose mode/lots of logging)
3838
// ENUMERATIONS
3939
var ENUM_PRINCIPALTYPES = {

dist/sprestlib.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/jquery.min.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sprestlib",
3-
"version": "1.5.0-beta",
3+
"version": "1.5.0",
44
"author": {
55
"name": "Brent Ely",
66
"url": "https://github.com/gitbrent/"
@@ -25,12 +25,11 @@
2525
"url": "git+https://github.com/gitbrent/sprestlib.git"
2626
},
2727
"keywords": [
28-
"sharepoint-group-library",
29-
"javascript-odata",
3028
"javascript-odata-library",
3129
"javascript-rest-library",
3230
"javascript-sp-web-services",
3331
"sharepoint-javascript",
32+
"sharepoint-javascript-app",
3433
"sharepoint-javascript-framework",
3534
"sharepoint-javascript-library",
3635
"sharepoint-javascript-rest",
@@ -44,7 +43,9 @@
4443
"sharepoint-rest",
4544
"sharepoint-rest-api",
4645
"sharepoint-rest-library",
46+
"sharepoint-site",
4747
"sharepoint-user-library",
48+
"sharepoint-users",
4849
"sharepoint-web-services",
4950
"sharepoint-web-services-library",
5051
"sp2013",

0 commit comments

Comments
 (0)