geomui 0.5.25 → 0.5.26

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.
@@ -19,8 +19,14 @@ let inputComment = "";
19
19
  function paramChange() {
20
20
  dispatch("paramChg", { foo: "bla" });
21
21
  }
22
- function tolerantApply(ipVal) {
22
+ function tolerantApply(iPartName, ipVal) {
23
23
  let rMsg = "";
24
+ let applyWarn1 = false;
25
+ if (iPartName !== pDef.partName) {
26
+ rMsg += `warn361: read partName: '${iPartName}' expected partName: '${pDef.partName}'
27
+ `;
28
+ applyWarn1 = true;
29
+ }
24
30
  let cover = 0;
25
31
  let uncover = 0;
26
32
  let equal = 0;
@@ -46,7 +52,7 @@ function tolerantApply(ipVal) {
46
52
  `;
47
53
  }
48
54
  }
49
- const rApplyWarn = notInScope > 0 ? true : false;
55
+ const applyWarn2 = notInScope > 0 ? true : false;
50
56
  const loadDate = (/* @__PURE__ */ new Date()).toLocaleTimeString();
51
57
  rMsg += `Params loaded at ${loadDate} :`;
52
58
  rMsg += ` def-nb: ${Object.keys(pDef.params).length}`;
@@ -55,6 +61,7 @@ function tolerantApply(ipVal) {
55
61
  rMsg += ` load-nb: ${Object.keys(ipVal).length}`;
56
62
  rMsg += `, equal-nb: ${equal}, changed-nb: ${cover - equal}`;
57
63
  rMsg += `, out-of-scope: ${notInScope}`;
64
+ const rApplyWarn = applyWarn1 || applyWarn2;
58
65
  return [rMsg, rApplyWarn];
59
66
  }
60
67
  let loadMsg = "";
@@ -70,7 +77,7 @@ function initParams2() {
70
77
  }
71
78
  }
72
79
  if (Object.keys(pVal2).length > 0) {
73
- [loadMsg, applyWarn] = tolerantApply(pVal2);
80
+ [loadMsg, applyWarn] = tolerantApply(pDef.partName, pVal2);
74
81
  }
75
82
  }
76
83
  }
@@ -84,7 +91,7 @@ onMount(() => {
84
91
  function loadParams(iStr) {
85
92
  try {
86
93
  const [paramJson] = parseParamFile(iStr);
87
- [loadMsg, applyWarn] = tolerantApply(paramJson.pVal);
94
+ [loadMsg, applyWarn] = tolerantApply(paramJson.partName, paramJson.pVal);
88
95
  inputComment = paramJson.comment;
89
96
  paramChange();
90
97
  } catch (emsg) {
@@ -118,7 +125,7 @@ function loadDefaults() {
118
125
  for (const p of pDef.params) {
119
126
  pInit[p.name] = p.init;
120
127
  }
121
- [loadMsg, applyWarn] = tolerantApply(pInit);
128
+ [loadMsg, applyWarn] = tolerantApply(pDef.partName, pInit);
122
129
  }
123
130
  let locStorRname;
124
131
  function loadLocStor() {
@@ -144,7 +151,12 @@ function saveInLocStor() {
144
151
  const storeKey = `${pDef.partName}_${locStorWname}`;
145
152
  const re2 = /\..*$/;
146
153
  const lastModif = (/* @__PURE__ */ new Date()).toISOString().replace(re2, "");
147
- const storeAllStr = createParamFile(lastModif, $storePV[pDef.partName], inputComment);
154
+ const storeAllStr = createParamFile(
155
+ lastModif,
156
+ pDef.partName,
157
+ $storePV[pDef.partName],
158
+ inputComment
159
+ );
148
160
  if (browser) {
149
161
  window.localStorage.setItem(storeKey, storeAllStr);
150
162
  }
@@ -182,6 +194,51 @@ let modalImg = false;
182
194
  function showSvg() {
183
195
  modalImg = true;
184
196
  }
197
+ function makeHTable(iParams) {
198
+ const rHTable = [];
199
+ const sectionMain = {
200
+ sectionName: "main",
201
+ sectionID: "g0main",
202
+ sectionVisible: false,
203
+ params: []
204
+ };
205
+ let section = sectionMain;
206
+ let sectionID = 0;
207
+ for (const param of iParams) {
208
+ if (param.pType === PType.eSectionSeparator) {
209
+ rHTable.push(section);
210
+ sectionID += 1;
211
+ const sectionNew = {
212
+ sectionName: param.name,
213
+ sectionID: `g${sectionID}${param.name}`,
214
+ sectionVisible: true,
215
+ params: []
216
+ };
217
+ section = sectionNew;
218
+ } else {
219
+ section.params.push(param);
220
+ }
221
+ }
222
+ rHTable.push(section);
223
+ return rHTable;
224
+ }
225
+ function makeHTableVis(iHTable) {
226
+ const rVis = {};
227
+ for (const section of iHTable) {
228
+ rVis[section.sectionID] = section.sectionVisible;
229
+ }
230
+ return rVis;
231
+ }
232
+ let htable;
233
+ let htableVis;
234
+ let prePartName = "";
235
+ $: {
236
+ htable = makeHTable(pDef.params);
237
+ if (prePartName !== pDef.partName) {
238
+ prePartName = pDef.partName;
239
+ htableVis = makeHTableVis(htable);
240
+ }
241
+ }
185
242
  </script>
186
243
 
187
244
  <section>
@@ -223,6 +280,7 @@ function showSvg() {
223
280
  <table>
224
281
  <thead>
225
282
  <tr>
283
+ <td>&#35;</td>
226
284
  <td>Parameter name</td>
227
285
  <td>Value</td>
228
286
  <td>Unit</td>
@@ -232,52 +290,69 @@ function showSvg() {
232
290
  <td>Step</td>
233
291
  </tr>
234
292
  </thead>
235
- <tbody>
236
- {#each pDef.params as param}
237
- <tr class:changed={$storePV[pDef.partName][param.name] !== param.init}>
238
- <td><button on:click={() => paramPict(param.name)}>{param.name}</button></td
293
+ {#each htable as sect, sidx}
294
+ <tr class="separator">
295
+ <td>{sidx + 1}</td>
296
+ <td colspan="4">{sect.sectionName}</td>
297
+ <td colspan="3">
298
+ <label>
299
+ <input type="checkbox" bind:checked={htableVis[sect.sectionID]} />
300
+ <span> </span></label
239
301
  >
240
- <td>
241
- {#if param.pType === PType.eNumber}
242
- <input
243
- type="number"
244
- bind:value={$storePV[pDef.partName][param.name]}
245
- min={param.min}
246
- max={param.max}
247
- step={param.step}
248
- on:change={paramChange}
249
- class="input-number"
250
- />
251
- <input
252
- type="range"
253
- bind:value={$storePV[pDef.partName][param.name]}
254
- min={param.min}
255
- max={param.max}
256
- step={param.step}
257
- on:change={paramChange}
258
- />
259
- {:else if param.pType === PType.eCheckbox}
260
- <select bind:value={$storePV[pDef.partName][param.name]}>
261
- {#each ['Off', 'On'] as one, idx}
262
- <option value={idx}>{one}</option>
263
- {/each}
264
- </select>
265
- {:else}
266
- <select bind:value={$storePV[pDef.partName][param.name]}>
267
- {#each param.dropdown as one, idx}
268
- <option value={idx}>{one}</option>
269
- {/each}
270
- </select>
271
- {/if}
272
- </td>
273
- <td>{param.unit}</td>
274
- <td>{param.init}</td>
275
- <td>{param.min}</td>
276
- <td>{param.max}</td>
277
- <td>{param.step}</td>
278
- </tr>
279
- {/each}
280
- </tbody>
302
+ </td>
303
+ </tr>
304
+ <tbody class:collaps={htableVis[sect.sectionID]}>
305
+ {#each sect.params as param, pidx}
306
+ <tr class:changed={$storePV[pDef.partName][param.name] !== param.init}>
307
+ <td>{sidx + 1}.{pidx + 1}</td>
308
+ <td
309
+ ><button on:click={() => paramPict(param.name)}>{param.name}</button
310
+ ></td
311
+ >
312
+ <td>
313
+ {#if param.pType === PType.eNumber}
314
+ <input
315
+ type="number"
316
+ bind:value={$storePV[pDef.partName][param.name]}
317
+ min={param.min}
318
+ max={param.max}
319
+ step={param.step}
320
+ on:change={paramChange}
321
+ class="input-number"
322
+ />
323
+ <input
324
+ type="range"
325
+ bind:value={$storePV[pDef.partName][param.name]}
326
+ min={param.min}
327
+ max={param.max}
328
+ step={param.step}
329
+ on:change={paramChange}
330
+ />
331
+ {:else if param.pType === PType.eCheckbox}
332
+ <select bind:value={$storePV[pDef.partName][param.name]}>
333
+ {#each ['Off', 'On'] as one, idx}
334
+ <option value={idx}>{one}</option>
335
+ {/each}
336
+ </select>
337
+ {:else if param.pType === PType.eDropdown}
338
+ <select bind:value={$storePV[pDef.partName][param.name]}>
339
+ {#each param.dropdown as one, idx}
340
+ <option value={idx}>{one}</option>
341
+ {/each}
342
+ </select>
343
+ {:else}
344
+ unknown
345
+ {/if}
346
+ </td>
347
+ <td>{param.unit}</td>
348
+ <td>{param.init}</td>
349
+ <td>{param.min}</td>
350
+ <td>{param.max}</td>
351
+ <td>{param.step}</td>
352
+ </tr>
353
+ {/each}
354
+ </tbody>
355
+ {/each}
281
356
  </table>
282
357
  <div class="comment">
283
358
  <label for="inComment">Comment:</label>
@@ -374,11 +449,59 @@ section > main > table > tbody {
374
449
  background-color: #eee;
375
450
  }
376
451
 
452
+ section > main > table > tbody.collaps {
453
+ visibility: collapse;
454
+ }
455
+
377
456
  section > main > table > tbody > tr.changed {
378
457
  background-color: #ded;
379
458
  }
380
459
 
460
+ section > main > table > tr.separator {
461
+ font-weight: 700;
462
+ background-color: Tan;
463
+ }
464
+
465
+ tr.separator > td {
466
+ text-align: center;
467
+ }
468
+
469
+ tr.separator > td > label > input[type=checkbox] {
470
+ display: none;
471
+ }
472
+
473
+ tr.separator > td > label > span {
474
+ height: 8px;
475
+ width: 50px;
476
+ border: 1px solid grey;
477
+ border-radius: 6px;
478
+ background-color: LightBlue;
479
+ position: relative;
480
+ display: inline-block;
481
+ }
482
+
483
+ tr.separator > td > label > span::after {
484
+ content: "";
485
+ position: absolute;
486
+ width: 8px;
487
+ height: 8px;
488
+ border-radius: 50%;
489
+ background-color: grey;
490
+ top: 0;
491
+ left: 1px;
492
+ display: inline-block;
493
+ }
494
+
495
+ tr.separator > td > label > input[type=checkbox]:checked + span {
496
+ background: DarkBlue;
497
+ }
498
+
499
+ tr.separator > td > label > input[type=checkbox]:checked + span::after {
500
+ left: 37px;
501
+ }
502
+
381
503
  section > main > table > thead > tr > td,
504
+ section > main > table > tr > td,
382
505
  section > main > table > tbody > tr > td {
383
506
  padding-left: 0.4rem;
384
507
  padding-right: 0.4rem;
@@ -104,11 +104,18 @@ async function downloadExport(iExportFace) {
104
104
  fgeom,
105
105
  simTime,
106
106
  $storePV[pDef.partName],
107
+ pDef,
107
108
  exportFormat
108
109
  );
109
110
  download_binFile(fName, fContent);
110
111
  } else {
111
- const fContent = fileTextContent(fgeom, $storePV[pDef.partName], nFace, exportFormat);
112
+ const fContent = fileTextContent(
113
+ fgeom,
114
+ $storePV[pDef.partName],
115
+ pDef,
116
+ nFace,
117
+ exportFormat
118
+ );
112
119
  download_textFile(fName, fContent, fMime);
113
120
  }
114
121
  }
@@ -15,7 +15,7 @@ function downloadParams(iPartName, idparams, iComment) {
15
15
  const re2 = /\..*$/;
16
16
  const datestr = new Date().toISOString().replace(re1, '').replace(re2, '').replace('T', '_');
17
17
  const file_name = `px_${iPartName}_${datestr}.json`;
18
- const file_content = createParamFile(datestr, idparams, iComment);
18
+ const file_content = createParamFile(datestr, iPartName, idparams, iComment);
19
19
  download_file(file_name, file_content);
20
20
  //console.log(`dbg343: ${file_name}`);
21
21
  }
@@ -34,6 +34,7 @@ $table-head: #ddd;
34
34
  //$table-body: lightSkyBlue;
35
35
  $table-body: #eee;
36
36
  $table-line-changed: #ded;
37
+ $table-line-separator: Tan;
37
38
 
38
39
  $warning-message: orange;
39
40
  $warn-calc-warning: orange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geomui",
3
- "version": "0.5.25",
3
+ "version": "0.5.26",
4
4
  "description": "The svelte-library of the webapp-UI of Parametrix",
5
5
  "private": false,
6
6
  "repository": {
@@ -39,31 +39,31 @@
39
39
  "svelte": "^4.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "geometrix": "^0.5.20"
42
+ "geometrix": "^0.5.23"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@sveltejs/adapter-auto": "^3.1.1",
46
46
  "@sveltejs/adapter-static": "^3.0.1",
47
- "@sveltejs/kit": "^2.5.1",
47
+ "@sveltejs/kit": "^2.5.2",
48
48
  "@sveltejs/package": "^2.2.7",
49
49
  "@sveltejs/vite-plugin-svelte": "^3.0.2",
50
50
  "@typescript-eslint/eslint-plugin": "^7.0.1",
51
51
  "@typescript-eslint/parser": "^7.0.1",
52
- "designix": "^0.5.21",
53
- "eslint": "^8.56.0",
52
+ "designix": "^0.5.24",
53
+ "eslint": "^8.57.0",
54
54
  "eslint-config-prettier": "^9.1.0",
55
55
  "eslint-plugin-svelte": "^2.35.1",
56
56
  "npm-run-all": "^4.1.5",
57
57
  "prettier": "^3.2.5",
58
- "prettier-plugin-svelte": "^3.2.1",
58
+ "prettier-plugin-svelte": "^3.2.2",
59
59
  "publint": "^0.2.7",
60
60
  "sass": "^1.71.1",
61
61
  "shx": "^0.3.4",
62
- "svelte": "^4.2.11",
63
- "svelte-check": "^3.6.4",
62
+ "svelte": "^4.2.12",
63
+ "svelte-check": "^3.6.6",
64
64
  "tslib": "^2.6.2",
65
- "typescript": "^5.3.3",
66
- "vite": "^5.1.4",
65
+ "typescript": "^5.4.2",
66
+ "vite": "^5.1.5",
67
67
  "vitest": "^1.3.1"
68
68
  },
69
69
  "exports": {