pywebexec 2.4.26__py3-none-any.whl → 2.4.28__py3-none-any.whl

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.
@@ -190,7 +190,9 @@
190
190
  height: 24px;
191
191
  min-height: 24px;
192
192
  max-height: 300px;
193
- overflow-y: auto;
193
+ min-width: 130px;
194
+ overflow: auto;
195
+ white-space: nowrap;
194
196
  resize: both;
195
197
  max-width: 700px;
196
198
  border-radius: 15px;
@@ -60,25 +60,28 @@ function extractKeys(obj, formkeys, formoptions, prefix = '') {
60
60
  return result;
61
61
  }
62
62
 
63
+ // Helper function to get schema and check for properties
64
+ function getSchemaForKey(schema, keyPath) {
65
+ const keys = keyPath.split('.');
66
+ let current = schema.properties;
67
+ for (const key of keys) {
68
+ if (current.properties) {
69
+ current = current.properties;
70
+ }
71
+ if (!current || !current[key]) return null;
72
+ current = current[key];
73
+ }
74
+ return current;
75
+ }
63
76
 
64
77
  // Convert objects to JSON strings where schema type is object without properties
65
78
  function convertObjectsToJsonStrings(obj, schema, prefix = '') {
66
- // Helper function to get schema type and check for properties
67
- function getSchemaTypeForKey(schema, keyPath) {
68
- const keys = keyPath.split('.');
69
- let current = schema.properties;
70
- for (const key of keys) {
71
- if (!current || !current[key]) return null;
72
- current = current[key];
73
- }
74
- return current;
75
- }
76
79
 
77
80
  for (const key in obj) {
78
81
  const keyPath = prefix ? `${prefix}.${key}` : key;
79
- const schemaType = getSchemaTypeForKey(schema, keyPath);
82
+ const schemaKey = getSchemaForKey(schema, keyPath);
80
83
 
81
- if (schemaType && schemaType.type === 'object' && !schemaType.properties) {
84
+ if (schemaKey && schemaKey.type === 'object' && !schemaKey.properties) {
82
85
  if (typeof obj[key] === 'object' && obj[key] !== null) {
83
86
  obj[key] = JSON.stringify(obj[key], null, 2);
84
87
  }
@@ -148,11 +151,31 @@ function expandFieldset(fieldsetClass) {
148
151
  schemaForm.querySelector(`fieldset.${fieldsetClass} > div`).style.display = 'inline-flex';
149
152
  }
150
153
 
151
- function orderCheckboxes() {
154
+ function setNestedValue(obj, keyPath, value) {
155
+ const keys = keyPath.split('.');
156
+ let current = obj;
157
+ for (let i = 0; i < keys.length - 1; i++) {
158
+ if (current[keys[i]] === undefined) {
159
+ current[keys[i]] = {};
160
+ }
161
+ current = current[keys[i]];
162
+ }
163
+ current[keys[keys.length - 1]] = value;
164
+ }
165
+
166
+ function orderCheckboxes(schema) {
167
+ let use_default = false;
168
+ if (! value) {
169
+ value = {};
170
+ use_default = true;
171
+ }
152
172
  schemaForm.querySelectorAll('.checkboxes > ul').forEach(checkboxes => {
153
173
  const key = checkboxes.getAttribute('name');
154
174
  const cboxes = checkboxes
155
175
  const matchingElements = [];
176
+ if (use_default) {
177
+ setNestedValue(value, key, getSchemaForKey(schema, key).default);
178
+ }
156
179
  if (! value || ! value[key] || !value[key].length) {
157
180
  return;
158
181
  }
@@ -441,14 +464,14 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
441
464
  err.classList.add('alert');
442
465
  err.style.display = 'none';
443
466
  schemaForm.appendChild(err);
444
- cboxes = schemaForm.querySelector('.checkboxes > ul');
445
- orderCheckboxes();
467
+ orderCheckboxes(schema);
446
468
  validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
447
469
  schemaForm.querySelectorAll('textarea').forEach(txt => {
448
- txt.style.height = "0";
449
- setTimeout(() => adjustTxtHeight(txt), 1);
470
+ txt.style.height = "0";
471
+ txt.style.width = "0";
472
+ setTimeout(() => adjustTxtSize(txt), 1);
450
473
  txt.setAttribute("spellcheck", "false");
451
- txt.addEventListener("input", () => adjustTxtHeight(txt));
474
+ txt.addEventListener("input", () => adjustTxtSize(txt));
452
475
  });
453
476
  schemaForm.addEventListener('input', (e) => {
454
477
  validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
@@ -467,7 +490,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
467
490
  return jsform;
468
491
  }
469
492
 
470
- function adjustTxtHeight(txt) {
493
+ function adjustTxtSize(txt) {
471
494
  if (txt.value.includes('\n')) {
472
495
  delta = 2;
473
496
  } else {
@@ -475,6 +498,8 @@ function adjustTxtHeight(txt) {
475
498
  }
476
499
  txt.style.height = "0";
477
500
  txt.style.height = `${txt.scrollHeight+delta}px`;
501
+ txt.style.width = "0";
502
+ txt.style.width = `${txt.scrollWidth+10}px`;
478
503
  }
479
504
 
480
505
  async function getSwaggerSpec() {
@@ -443,7 +443,7 @@ jsonform.elementTypes = {
443
443
  editor.renderer.setShowPrintMargin(false);
444
444
  editor.setTheme("ace/theme/"+(formElement.aceTheme||"twilight"));
445
445
  editor.setOptions({
446
- placeholder: formElement.placeholder || '',
446
+ placeholder: formElement.placeholder || (node.schemaElement && node.schemaElement.example) || '',
447
447
  maxLines: 30,
448
448
  })
449
449
  if (formElement.aceMode) {
@@ -2479,7 +2479,7 @@ formNode.prototype.computeInitialValues = function (values, ignoreDefaultValues)
2479
2479
  // be a complex structure that needs to be pushed down the subtree.
2480
2480
  // The easiest way is probably to generate a "values" object and
2481
2481
  // compute initial values from that object
2482
- // fjo start: TODO convert this.key to be used in values
2482
+ // fjo start: add default values
2483
2483
  else if (this.schemaElement['default']) {
2484
2484
  values = {};
2485
2485
  setNestedValue(values, this.key, this.schemaElement['default']);
pywebexec/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.4.26'
21
- __version_tuple__ = version_tuple = (2, 4, 26)
20
+ __version__ = version = '2.4.28'
21
+ __version_tuple__ = version_tuple = (2, 4, 28)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.4.26
3
+ Version: 2.4.28
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -2,8 +2,8 @@ pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
2
2
  pywebexec/host_ip.py,sha256=oiCMlo2o3AkkgXDarUSx8T3FWXKI0vk1-EPnx5FGBd8,1332
3
3
  pywebexec/pywebexec.py,sha256=avBfvbhLbjvrJ168bBmQVrm-DjbjGJoAapHHIEAD6V4,48515
4
4
  pywebexec/swagger.yaml,sha256=I_oLpp7Hqel8SDEEykvpmCT-Gv3ytGlziq9bvQOrtZY,7598
5
- pywebexec/version.py,sha256=DEW-zqTuw6CpAcJrPVgerckV49xZ9fYuk1UMTA7hHKc,513
6
- pywebexec/static/css/form.css,sha256=J-rczuvU3S11GscC5NTkrqhAbdLbGkWkK8GcisBrxOs,9017
5
+ pywebexec/version.py,sha256=bbq2FSCzcXGxzgbq3wH_4_DBJn7-tef7JTibaKvxIJg,513
6
+ pywebexec/static/css/form.css,sha256=7N8-xP58JF6EM9ekDzkYBisTDWbZqe8Fyhhk5vt0jc0,9062
7
7
  pywebexec/static/css/markdown.css,sha256=br4-iK9wigTs54N2KHtjgZ4KLH0THVSvJo-XZAdMHiE,1970
8
8
  pywebexec/static/css/style.css,sha256=TX60M-mzIPTGVDmaypRCOcyxc8A7dOjx-p1_bpJ6t9M,11772
9
9
  pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
@@ -36,7 +36,7 @@ pywebexec/static/images/swagger-ui.svg,sha256=FR0yeOVwe4zCYKZAjCGcT_m0Mf25NexIVa
36
36
  pywebexec/static/js/exceljs.min.js,sha256=fknaaFiOJQ27i7oZDSyqirN4fMAoS9odiy-AXE33Qsk,947702
37
37
  pywebexec/static/js/executables.js,sha256=xD4rauofJUymUWyu3oUzUAm9djy4gp6G-Gh9tFBtlBI,11996
38
38
  pywebexec/static/js/popup.js,sha256=X-Q__R0jeZFO_I8EWucP1KkUJa9-Atz8bdnyWp6ibzY,11376
39
- pywebexec/static/js/schemaform.js,sha256=Da35GSO2D305UQOFftKvr_K53mR1vxQ93lF0g75FjTE,16514
39
+ pywebexec/static/js/schemaform.js,sha256=xPm7acOHS09zb_GBkiltWGpj1XPpuOiDGRRRXP00FPY,17101
40
40
  pywebexec/static/js/script.js,sha256=2Jys1IpB94ygkjnpFkUvcZdchM-gZrfPOFuS74SxgZI,21508
41
41
  pywebexec/static/js/swagger-form.js,sha256=CLcSHMhk5P4-_2MIRBoJLgEnIj_9keDDSzUugXHZjio,4565
42
42
  pywebexec/static/js/tablefilter.js,sha256=YuFc4Q7OOld6tX3v4HhG5lSToEJczQM9RlU2-pITSms,11099
@@ -71,14 +71,14 @@ pywebexec/static/jsonform/deps/ace/theme-github_light_default.js,sha256=4-_JXMA3
71
71
  pywebexec/static/jsonform/deps/ace/theme-twilight.js,sha256=3FCPUePtyW8RjnVAC51dgwKyNVpB7liV9AjEy4uEP8c,3474
72
72
  pywebexec/static/jsonform/deps/ace/worker-json.js,sha256=FalZfSbOglLQIOUYUprFqETrljooqsGwM5Tey7vhbxs,24390
73
73
  pywebexec/static/jsonform/deps/img/glyphicons-halflings.png,sha256=hpJM0AbbMLnU8UGOBs172D7vK-dooQ8n0s_ybml3zO0,13826
74
- pywebexec/static/jsonform/lib/jsonform.js,sha256=nHBZ1DqjRAKhPQRdplifXfQhr_SPmKrFoM2cU0NmJf0,140356
74
+ pywebexec/static/jsonform/lib/jsonform.js,sha256=JBkMyBV8slZA4pdV5rYxX0KpydVfEMN_oxVNCwn9ux0,140386
75
75
  pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  pywebexec/templates/index.html,sha256=sTytur1jHuEAMTvuNqMEB3i3NNFoJRbYQgfmvDrAuJQ,4286
77
77
  pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
78
78
  pywebexec/templates/swagger_ui.html,sha256=O7p8rsXUNo3PN5LttXfQudwUKUvBPSbXoVVU9ANJ9vM,1321
79
- pywebexec-2.4.26.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
- pywebexec-2.4.26.dist-info/METADATA,sha256=0fi4mhkJ8iHOntymbv-myomQVW5Ly6zE6k78rwyUoFk,13016
81
- pywebexec-2.4.26.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
- pywebexec-2.4.26.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
- pywebexec-2.4.26.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
- pywebexec-2.4.26.dist-info/RECORD,,
79
+ pywebexec-2.4.28.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
+ pywebexec-2.4.28.dist-info/METADATA,sha256=14szX7vfy4pbjv0knpIOk0eVQYq47J11ejVM_vWJL3c,13016
81
+ pywebexec-2.4.28.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
+ pywebexec-2.4.28.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
+ pywebexec-2.4.28.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
+ pywebexec-2.4.28.dist-info/RECORD,,