jqgrid_utils 1.2.4 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,8 +63,7 @@ A module for Vanilla_website_utils
63
63
  * [Vanilla_website_utils](#module_Vanilla_website_utils)
64
64
  * [module.exports#set_link()](#exp_module_Vanilla_website_utils--module.exports+set_link) ⏏
65
65
  * [module.exports#grid_set_captain()](#exp_module_Vanilla_website_utils--module.exports+grid_set_captain) ⏏
66
- * [module.exports#resize_saved_cell_width()](#exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width) ⏏
67
- * [module.exports#resize_cell()](#exp_module_Vanilla_website_utils--module.exports+resize_cell) ⏏
66
+ * [module.exports#resize_saved_cell_width(col_model, page, grid)](#exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width) ⏏
68
67
  * [module.exports#upsert_row()](#exp_module_Vanilla_website_utils--module.exports+upsert_row) ⏏
69
68
  * [module.exports#insert_row()](#exp_module_Vanilla_website_utils--module.exports+insert_row) ⏏
70
69
  * [module.exports#update_row()](#exp_module_Vanilla_website_utils--module.exports+update_row) ⏏
@@ -76,7 +75,7 @@ A module for Vanilla_website_utils
76
75
  * [module.exports#add_link_details()](#exp_module_Vanilla_website_utils--module.exports+add_link_details) ⏏
77
76
  * [module.exports#add_link_details_separator()](#exp_module_Vanilla_website_utils--module.exports+add_link_details_separator) ⏏
78
77
  * [module.exports#__cell_format()](#exp_module_Vanilla_website_utils--module.exports+__cell_format) ⏏
79
- * [module.exports#subgrid(_id, id, data_url, col_model)](#exp_module_Vanilla_website_utils--module.exports+subgrid) ⏏
78
+ * [module.exports#subgrid(_id, id, data_url, col_model, caption)](#exp_module_Vanilla_website_utils--module.exports+subgrid) ⏏
80
79
  * [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Vanilla_website_utils--module.exports+add_image) ⏏
81
80
 
82
81
  <a name="exp_module_Vanilla_website_utils--module.exports+set_link"></a>
@@ -89,12 +88,19 @@ A module for Vanilla_website_utils
89
88
  **Kind**: Exported function
90
89
  <a name="exp_module_Vanilla_website_utils--module.exports+resize_saved_cell_width"></a>
91
90
 
92
- ### module.exports#resize\_saved\_cell\_width() ⏏
91
+ ### module.exports#resize\_saved\_cell\_width(col_model, page, grid) ⏏
93
92
  **Kind**: Exported function
94
- <a name="exp_module_Vanilla_website_utils--module.exports+resize_cell"></a>
95
93
 
96
- ### module.exports#resize\_cell()
97
- **Kind**: Exported function
94
+ | Param | Type | Default | Description |
95
+ | --- | --- | --- | --- |
96
+ | col_model | <code>object</code> | | the col_model of the grid |
97
+ | page | <code>string</code> | <code>false</code> | the name of the page(optional) |
98
+ | grid | <code>object</code> | <code>false</code> | the grid objec(optional) |
99
+
100
+ **Example**
101
+ ```js
102
+ col_model = await jqu.resize_saved_cell_width(col_model);
103
+ ```
98
104
  <a name="exp_module_Vanilla_website_utils--module.exports+upsert_row"></a>
99
105
 
100
106
  ### module.exports#upsert\_row() ⏏
@@ -133,7 +139,7 @@ A module for Vanilla_website_utils
133
139
  **Kind**: Exported function
134
140
  **Example**
135
141
  ```js
136
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
142
+ example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
137
143
  ```
138
144
  <a name="exp_module_Vanilla_website_utils--module.exports+add_link_details_separator"></a>
139
145
 
@@ -141,7 +147,7 @@ A module for Vanilla_website_utils
141
147
  **Kind**: Exported function
142
148
  **Example**
143
149
  ```js
144
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
150
+ col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
145
151
  ```
146
152
  <a name="exp_module_Vanilla_website_utils--module.exports+__cell_format"></a>
147
153
 
@@ -149,15 +155,16 @@ A module for Vanilla_website_utils
149
155
  **Kind**: Exported function
150
156
  <a name="exp_module_Vanilla_website_utils--module.exports+subgrid"></a>
151
157
 
152
- ### module.exports#subgrid(_id, id, data_url, col_model) ⏏
158
+ ### module.exports#subgrid(_id, id, data_url, col_model, caption) ⏏
153
159
  **Kind**: Exported function
154
160
 
155
161
  | Param | Type | Description |
156
162
  | --- | --- | --- |
157
163
  | _id | <code>string</code> | row_id |
158
164
  | id | <code>string</code> | data id |
159
- | data_url | <code>object</code> | col_model for the table |
160
- | col_model | <code>string</code> | Caption |
165
+ | data_url | <code>string</code> | url to request |
166
+ | col_model | <code>object</code> | col_model for the table |
167
+ | caption | <code>string</code> | Add to the caption of the subgrid |
161
168
 
162
169
  **Example**
163
170
  ```js
@@ -82,9 +82,9 @@ module.exports = class Vanilla_website_utils
82
82
 
83
83
  /**
84
84
  @alias module:Vanilla_website_utils
85
- @param {object} - col_model for the grid
86
- @param {string} - page
87
- @param {object} - grid
85
+ @param {object} - the col_model of the grid
86
+ @param {string} - the name of the page(optional)
87
+ @param {object} - the grid objec(optional)
88
88
  @example
89
89
  * col_model = await jqu.resize_saved_cell_width(col_model);
90
90
  */
@@ -114,9 +114,9 @@ module.exports = class Vanilla_website_utils
114
114
  @alias module:Vanilla_website_utils
115
115
  * resize_cell
116
116
  * call after resize a column
117
- @param {string} - width - the size of the resized column
118
- @param {string} - index - column number what get resized
119
- @param {string} - _page - not in use yet
117
+ @param {string} the width of the resized column
118
+ @param {string} column number what get resized
119
+ @param {string} not in use yet
120
120
  @example
121
121
  * var jqu = new Jqgrid_utils({page:'mypage'});
122
122
  * resizeStop: jqu.resize_cell,
@@ -293,7 +293,7 @@ async hide_del_icon()
293
293
  /**
294
294
  @alias module:Vanilla_website_utils
295
295
  @example
296
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
296
+ * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
297
297
  */
298
298
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
299
299
  {
@@ -365,7 +365,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
365
365
  /**
366
366
  @alias module:Vanilla_website_utils
367
367
  @example
368
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
368
+ * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
369
369
  */
370
370
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
371
371
  {
@@ -454,8 +454,9 @@ __cell_format(cell_value, format)
454
454
  @alias module:Vanilla_website_utils
455
455
  @param {string} - row_id
456
456
  @param {string} - data id
457
+ @param {string} - url to request
457
458
  @param {object} - col_model for the table
458
- @param {string} - Caption
459
+ @param {string} - Add to the caption of the subgrid
459
460
  @example
460
461
  * let data_url = api + '/phone_detail?f=data&_id=';
461
462
  * let col_model_url = api + '/phone_detail?f=col_model';
@@ -505,14 +506,28 @@ async add_image(col_model, edit_field, size, link=false)
505
506
  col_model[i]['height'] = size;
506
507
  col_model[i]['formatter'] = function(cell_val)
507
508
  {
508
- if(link)
509
+ const cell_val2 = cell_val.toLowerCase();
510
+ if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
509
511
  {
510
- return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
512
+ if(cell_val2.endsWith(".png") ||
513
+ cell_val2.endsWith(".jpg") ||
514
+ cell_val2.endsWith(".jpeg") ||
515
+ cell_val2.endsWith(".gif") ||
516
+ cell_val2.endsWith(".svg") ||
517
+ cell_val2.endsWith(".svgz") ||
518
+ cell_val2.endsWith(".webp"))
519
+ {
520
+ if(link)
521
+ {
522
+ return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
523
+ }
524
+ else
525
+ {
526
+ return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
527
+ }
528
+ }
511
529
  }
512
- else
513
- {
514
- return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
515
- }
530
+ return cell_val;
516
531
  };
517
532
  }
518
533
  }
@@ -521,6 +536,9 @@ async add_image(col_model, edit_field, size, link=false)
521
536
 
522
537
 
523
538
 
539
+
540
+
541
+
524
542
  };
525
543
 
526
544
 
package/jqgrid_utils.js CHANGED
@@ -81,9 +81,9 @@ module.exports = class Vanilla_website_utils
81
81
 
82
82
  /**
83
83
  @alias module:Vanilla_website_utils
84
- @param {object} - col_model for the grid
85
- @param {string} - page
86
- @param {object} - grid
84
+ @param {object} - the col_model of the grid
85
+ @param {string} - the name of the page(optional)
86
+ @param {object} - the grid objec(optional)
87
87
  @example
88
88
  * col_model = await jqu.resize_saved_cell_width(col_model);
89
89
  */
@@ -113,9 +113,9 @@ module.exports = class Vanilla_website_utils
113
113
  @alias module:Vanilla_website_utils
114
114
  * resize_cell
115
115
  * call after resize a column
116
- @param {string} - width - the size of the resized column
117
- @param {string} - index - column number what get resized
118
- @param {string} - _page - not in use yet
116
+ @param {string} the width of the resized column
117
+ @param {string} column number what get resized
118
+ @param {string} not in use yet
119
119
  @example
120
120
  * var jqu = new Jqgrid_utils({page:'mypage'});
121
121
  * resizeStop: jqu.resize_cell,
@@ -292,7 +292,7 @@ async hide_del_icon()
292
292
  /**
293
293
  @alias module:Vanilla_website_utils
294
294
  @example
295
- // example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
295
+ * example: col_model = await jqu.add_link_details(col_model,'http://foo.bar'' , 'target_field','target="_blank"',{"key":"field1","key":"field2"});
296
296
  */
297
297
  async add_link_details(col_model, url, edit_field, attr = '', keys, format)
298
298
  {
@@ -364,7 +364,7 @@ async add_link_details(col_model, url, edit_field, attr = '', keys, format)
364
364
  /**
365
365
  @alias module:Vanilla_website_utils
366
366
  @example
367
- // col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
367
+ * col_model = await jqu.add_link_details_separator(col_model, 'https://foo.com' , 'couchdb','target="_blank"',{"mykey":"myval"});
368
368
  */
369
369
  async add_link_details_separator(col_model, url, edit_field, attr = '', keys, format)
370
370
  {
@@ -453,8 +453,9 @@ __cell_format(cell_value, format)
453
453
  @alias module:Vanilla_website_utils
454
454
  @param {string} - row_id
455
455
  @param {string} - data id
456
+ @param {string} - url to request
456
457
  @param {object} - col_model for the table
457
- @param {string} - Caption
458
+ @param {string} - Add to the caption of the subgrid
458
459
  @example
459
460
  * let data_url = api + '/phone_detail?f=data&_id=';
460
461
  * let col_model_url = api + '/phone_detail?f=col_model';
@@ -504,14 +505,28 @@ async add_image(col_model, edit_field, size, link=false)
504
505
  col_model[i]['height'] = size;
505
506
  col_model[i]['formatter'] = function(cell_val)
506
507
  {
507
- if(link)
508
+ const cell_val2 = cell_val.toLowerCase();
509
+ if(cell_val2.startsWith('https://', 0) || cell_val2.startsWith('http://', 0) )
508
510
  {
509
- return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
511
+ if(cell_val2.endsWith(".png") ||
512
+ cell_val2.endsWith(".jpg") ||
513
+ cell_val2.endsWith(".jpeg") ||
514
+ cell_val2.endsWith(".gif") ||
515
+ cell_val2.endsWith(".svg") ||
516
+ cell_val2.endsWith(".svgz") ||
517
+ cell_val2.endsWith(".webp"))
518
+ {
519
+ if(link)
520
+ {
521
+ return '<a target="blank" href="' + cell_val + '"><img src="' + cell_val + '" alt="my image" width="' + size + '" /></a>';
522
+ }
523
+ else
524
+ {
525
+ return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
526
+ }
527
+ }
510
528
  }
511
- else
512
- {
513
- return '<img src="' + cell_val + '" alt="my image" width="' + size + '" />';
514
- }
529
+ return cell_val;
515
530
  };
516
531
  }
517
532
  }
@@ -520,6 +535,9 @@ async add_image(col_model, edit_field, size, link=false)
520
535
 
521
536
 
522
537
 
538
+
539
+
540
+
523
541
  };
524
542
 
525
543
 
package/package.json CHANGED
@@ -29,5 +29,5 @@
29
29
  {
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
31
31
  },
32
- "version": "1.2.4"
32
+ "version": "1.2.7"
33
33
  }