overview-components 1.1.119 → 1.1.121
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/dist/components/components-settings/data-grid-settings.d.ts +9 -0
- package/dist/components/components-settings/data-grid-settings.d.ts.map +1 -1
- package/dist/components/components-settings/data-grid-settings.js +75 -10
- package/dist/components/components-settings/data-grid-settings.js.map +1 -1
- package/dist/components/components-settings/section-tab-settings.d.ts.map +1 -1
- package/dist/components/components-settings/section-tab-settings.js +2 -1
- package/dist/components/components-settings/section-tab-settings.js.map +1 -1
- package/dist/components/lit-case-variables-tab.d.ts +13 -0
- package/dist/components/lit-case-variables-tab.d.ts.map +1 -1
- package/dist/components/lit-case-variables-tab.js +466 -214
- package/dist/components/lit-case-variables-tab.js.map +1 -1
- package/dist/components/lit-data-grid-tanstack.d.ts +8 -0
- package/dist/components/lit-data-grid-tanstack.d.ts.map +1 -1
- package/dist/components/lit-data-grid-tanstack.js +49 -21
- package/dist/components/lit-data-grid-tanstack.js.map +1 -1
- package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts +30 -28
- package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts.map +1 -1
- package/dist/schemas/lit-case-variables-tab-cell.schema.js +43 -57
- package/dist/schemas/lit-case-variables-tab-cell.schema.js.map +1 -1
- package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts +30 -28
- package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts.map +1 -1
- package/dist/schemas/lit-case-variables-tab.schema.d.ts +60 -56
- package/dist/schemas/lit-case-variables-tab.schema.d.ts.map +1 -1
- package/dist/schemas/lit-data-grid-tanstack.schema.d.ts +14 -0
- package/dist/schemas/lit-data-grid-tanstack.schema.d.ts.map +1 -1
- package/dist/schemas/lit-data-grid-tanstack.schema.js +6 -0
- package/dist/schemas/lit-data-grid-tanstack.schema.js.map +1 -1
- package/dist/shared/lit-checkbox.d.ts +1 -0
- package/dist/shared/lit-checkbox.d.ts.map +1 -1
- package/dist/shared/lit-checkbox.js +4 -1
- package/dist/shared/lit-checkbox.js.map +1 -1
- package/dist/shared/simple-popper.d.ts +2 -0
- package/dist/shared/simple-popper.d.ts.map +1 -1
- package/dist/shared/simple-popper.js +14 -0
- package/dist/shared/simple-popper.js.map +1 -1
- package/dist/utils/formatNumber.d.ts +1 -1
- package/dist/utils/formatNumber.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
57
57
|
this.sortableGroupId = `group-${Math.random().toString(36).substring(2, 9)}`;
|
|
58
58
|
this.activeSettingsCell = null;
|
|
59
59
|
this.settingsPopperOpen = false;
|
|
60
|
+
this.conditionSubFolders = new Map();
|
|
60
61
|
this.language = 'cs';
|
|
61
62
|
this.BREAKPOINTS = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
62
63
|
this.closeSettingsPopper = () => {
|
|
@@ -181,7 +182,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
181
182
|
};
|
|
182
183
|
this.getCellValue = (cell) => {
|
|
183
184
|
const rawValue = cell?.[`value_${this.userLang}`] || cell?.value || '';
|
|
184
|
-
const value =
|
|
185
|
+
const value = this.formatDisplayValue(rawValue);
|
|
185
186
|
return html `<div>${this.getHeader(cell)}</div>
|
|
186
187
|
<div
|
|
187
188
|
style="${styleMap(this.computeValueStyles(cell))}"
|
|
@@ -202,6 +203,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
202
203
|
</div> `;
|
|
203
204
|
};
|
|
204
205
|
this.getCellCurrency = (cell) => {
|
|
206
|
+
const resolvedCurrency = this.resolveCurrencyType(cell);
|
|
205
207
|
return html `<div>${this.getHeader(cell)}</div>
|
|
206
208
|
<div
|
|
207
209
|
style="${styleMap(this.computeValueStyles(cell))}"
|
|
@@ -210,7 +212,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
210
212
|
${cell?.value
|
|
211
213
|
? formatCurrency(cell.value, {
|
|
212
214
|
locale: this.userLang || 'cs',
|
|
213
|
-
currency:
|
|
215
|
+
currency: resolvedCurrency,
|
|
214
216
|
numberOfDecimal: typeof cell.numberOfDecimal === 'number' ? cell.numberOfDecimal : 2,
|
|
215
217
|
})
|
|
216
218
|
: ''}
|
|
@@ -251,14 +253,14 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
251
253
|
};
|
|
252
254
|
this.getInlineCellValue = (cell) => {
|
|
253
255
|
let rawValue = cell?.[`value_${this.userLang}`] || cell?.value || '';
|
|
254
|
-
let value =
|
|
256
|
+
let value = this.formatDisplayValue(rawValue);
|
|
255
257
|
// Format value based on cell.type
|
|
256
258
|
switch (cell.type) {
|
|
257
259
|
case 'currency':
|
|
258
260
|
value = cell?.value
|
|
259
261
|
? formatCurrency(cell.value, {
|
|
260
262
|
locale: this.userLang || 'cs',
|
|
261
|
-
currency: cell
|
|
263
|
+
currency: this.resolveCurrencyType(cell),
|
|
262
264
|
numberOfDecimal: typeof cell.numberOfDecimal === 'number' ? cell.numberOfDecimal : 2,
|
|
263
265
|
})
|
|
264
266
|
: '';
|
|
@@ -284,7 +286,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
284
286
|
value = `${Math.round(progressNumeric * 100)}%`;
|
|
285
287
|
break;
|
|
286
288
|
default:
|
|
287
|
-
value =
|
|
289
|
+
value = this.formatDisplayValue(rawValue);
|
|
288
290
|
}
|
|
289
291
|
return html `
|
|
290
292
|
<div style="display: flex;align-items: center; justify-content: end; gap: 0.5rem;">
|
|
@@ -316,6 +318,166 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
316
318
|
`;
|
|
317
319
|
};
|
|
318
320
|
}
|
|
321
|
+
normalizeConditions(formatting) {
|
|
322
|
+
if (!formatting)
|
|
323
|
+
return [];
|
|
324
|
+
// Backward compat: single object → wrap in array
|
|
325
|
+
const arr = Array.isArray(formatting) ? formatting : [formatting];
|
|
326
|
+
// Ensure every condition has 'enabled' as boolean (tweakpane requires a concrete type)
|
|
327
|
+
return arr.map((c) => ({
|
|
328
|
+
...c,
|
|
329
|
+
enabled: typeof c.enabled === 'boolean' ? c.enabled : true,
|
|
330
|
+
}));
|
|
331
|
+
}
|
|
332
|
+
createDefaultCondition(cell) {
|
|
333
|
+
return {
|
|
334
|
+
enabled: true,
|
|
335
|
+
variable: cell.field,
|
|
336
|
+
operator: this.getDefaultOperatorForCell(cell),
|
|
337
|
+
value: '',
|
|
338
|
+
cellVariant: 'default',
|
|
339
|
+
valueVariant: 'default',
|
|
340
|
+
progressColor: 'primary',
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
rebuildConditionFolders(parentFolder, config, cell) {
|
|
344
|
+
// Dispose old sub-folders for this cell
|
|
345
|
+
const key = cell.field;
|
|
346
|
+
const oldFolders = this.conditionSubFolders.get(key) || [];
|
|
347
|
+
for (const f of oldFolders) {
|
|
348
|
+
try {
|
|
349
|
+
f.dispose();
|
|
350
|
+
}
|
|
351
|
+
catch (_e) { /* already disposed */ }
|
|
352
|
+
}
|
|
353
|
+
this.conditionSubFolders.set(key, []);
|
|
354
|
+
// Clean up tracked inputs for this cell's conditions
|
|
355
|
+
for (const [k] of this.operatorInputs) {
|
|
356
|
+
if (k.startsWith(`${key}_condition_`)) {
|
|
357
|
+
this.operatorInputs.delete(k);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
for (const [k] of this.conditionValueInputs) {
|
|
361
|
+
if (k.startsWith(`${key}_condition_`)) {
|
|
362
|
+
this.conditionValueInputs.delete(k);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const conditions = config.conditions;
|
|
366
|
+
const folders = [];
|
|
367
|
+
conditions.forEach((conditionObj, idx) => {
|
|
368
|
+
const subFolder = parentFolder.addFolder({
|
|
369
|
+
title: `${msg('Podmínka')} ${idx + 1}`,
|
|
370
|
+
expanded: idx === conditions.length - 1,
|
|
371
|
+
});
|
|
372
|
+
folders.push(subFolder);
|
|
373
|
+
this.buildSingleConditionFolder(subFolder, conditionObj, config, cell, idx);
|
|
374
|
+
// Delete condition button
|
|
375
|
+
const deleteBtn = subFolder.addButton({ title: msg('Smazat podmínku') });
|
|
376
|
+
deleteBtn.on('click', () => {
|
|
377
|
+
this.removeConditionFromCell(cell, idx);
|
|
378
|
+
config.conditions = this.normalizeConditions(this.rows.find((c) => c.field === cell.field)?.conditionalFormatting);
|
|
379
|
+
this.rebuildConditionFolders(parentFolder, config, cell);
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
this.conditionSubFolders.set(key, folders);
|
|
383
|
+
}
|
|
384
|
+
buildSingleConditionFolder(folder, conditionObj, _config, cell, conditionIndex) {
|
|
385
|
+
// Enable toggle
|
|
386
|
+
const enabledInput = folder.addBinding(conditionObj, 'enabled', {
|
|
387
|
+
label: msg('Povolit'),
|
|
388
|
+
});
|
|
389
|
+
enabledInput.on('change', (ev) => {
|
|
390
|
+
this.setConditionalFormatting(cell, conditionIndex, 'enabled', ev.value);
|
|
391
|
+
});
|
|
392
|
+
// Variable selector
|
|
393
|
+
const variableOptions = this.getAllAvailableVariables();
|
|
394
|
+
if (variableOptions.length > 0) {
|
|
395
|
+
if (!conditionObj.variable) {
|
|
396
|
+
conditionObj.variable = cell.field;
|
|
397
|
+
this.setConditionalFormatting(cell, conditionIndex, 'variable', cell.field);
|
|
398
|
+
}
|
|
399
|
+
const variableInput = folder.addBinding(conditionObj, 'variable', {
|
|
400
|
+
view: 'list',
|
|
401
|
+
label: msg('Proměnná'),
|
|
402
|
+
options: variableOptions,
|
|
403
|
+
});
|
|
404
|
+
variableInput.on('change', (ev) => {
|
|
405
|
+
this.setConditionalFormatting(cell, conditionIndex, 'variable', ev.value);
|
|
406
|
+
this.updateConditionalFormattingOperators(folder, conditionObj, cell, conditionIndex, ev.value);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
// Operator
|
|
410
|
+
const variableType = this.getVariableTypeByField(conditionObj.variable);
|
|
411
|
+
const tempCell = { ...cell, field: conditionObj.variable, type: variableType };
|
|
412
|
+
const operatorOptions = this.getOperatorOptionsForCell(tempCell);
|
|
413
|
+
const operatorInput = folder.addBinding(conditionObj, 'operator', {
|
|
414
|
+
view: 'list',
|
|
415
|
+
label: msg('Operátor'),
|
|
416
|
+
options: operatorOptions,
|
|
417
|
+
});
|
|
418
|
+
operatorInput.on('change', (ev) => {
|
|
419
|
+
this.setConditionalFormatting(cell, conditionIndex, 'operator', ev.value);
|
|
420
|
+
});
|
|
421
|
+
const operatorKey = `${cell.field}_condition_${conditionIndex}_operator`;
|
|
422
|
+
this.operatorInputs.set(operatorKey, operatorInput);
|
|
423
|
+
// Value input
|
|
424
|
+
this.addConditionalFormattingValueInput(folder, conditionObj, cell, conditionIndex, conditionObj.variable);
|
|
425
|
+
// Cell Variant
|
|
426
|
+
const cellVariantOptions = [
|
|
427
|
+
{ text: msg('Výchozí'), value: 'default' },
|
|
428
|
+
{ text: msg('Primární'), value: 'primary' },
|
|
429
|
+
{ text: msg('Úspěch'), value: 'success' },
|
|
430
|
+
{ text: msg('Varování'), value: 'warning' },
|
|
431
|
+
{ text: msg('Chyba'), value: 'error' },
|
|
432
|
+
{ text: msg('Informace'), value: 'info' },
|
|
433
|
+
];
|
|
434
|
+
const cellVariantInput = folder.addBinding(conditionObj, 'cellVariant', {
|
|
435
|
+
view: 'list',
|
|
436
|
+
label: msg('Styl buňky'),
|
|
437
|
+
options: cellVariantOptions,
|
|
438
|
+
});
|
|
439
|
+
cellVariantInput.on('change', (ev) => {
|
|
440
|
+
this.setConditionalFormatting(cell, conditionIndex, 'cellVariant', ev.value);
|
|
441
|
+
});
|
|
442
|
+
this.colorizeVariantSelect(cellVariantInput, cellVariantOptions, conditionObj, 'cellVariant');
|
|
443
|
+
// Value Variant
|
|
444
|
+
const valueVariantOptions = [
|
|
445
|
+
{ text: msg('Výchozí'), value: 'default' },
|
|
446
|
+
{ text: msg('Primární'), value: 'primary' },
|
|
447
|
+
{ text: msg('Úspěch'), value: 'success' },
|
|
448
|
+
{ text: msg('Varování'), value: 'warning' },
|
|
449
|
+
{ text: msg('Chyba'), value: 'error' },
|
|
450
|
+
{ text: msg('Informace'), value: 'info' },
|
|
451
|
+
];
|
|
452
|
+
const valueVariantInput = folder.addBinding(conditionObj, 'valueVariant', {
|
|
453
|
+
view: 'list',
|
|
454
|
+
label: msg('Barva hodnoty'),
|
|
455
|
+
options: valueVariantOptions,
|
|
456
|
+
});
|
|
457
|
+
valueVariantInput.on('change', (ev) => {
|
|
458
|
+
this.setConditionalFormatting(cell, conditionIndex, 'valueVariant', ev.value);
|
|
459
|
+
});
|
|
460
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, conditionObj, 'valueVariant');
|
|
461
|
+
// Progress Color (only for progress type)
|
|
462
|
+
if (cell.type === 'progress') {
|
|
463
|
+
const progressColorOptions = [
|
|
464
|
+
{ text: msg('Primární'), value: 'primary' },
|
|
465
|
+
{ text: msg('Úspěch'), value: 'success' },
|
|
466
|
+
{ text: msg('Varování'), value: 'warning' },
|
|
467
|
+
{ text: msg('Chyba'), value: 'error' },
|
|
468
|
+
{ text: msg('Informace'), value: 'info' },
|
|
469
|
+
];
|
|
470
|
+
const progressColorInput = folder.addBinding(conditionObj, 'progressColor', {
|
|
471
|
+
view: 'list',
|
|
472
|
+
label: msg('Barva Progressu'),
|
|
473
|
+
options: progressColorOptions,
|
|
474
|
+
});
|
|
475
|
+
progressColorInput.on('change', (ev) => {
|
|
476
|
+
this.setConditionalFormatting(cell, conditionIndex, 'progressColor', ev.value);
|
|
477
|
+
});
|
|
478
|
+
this.colorizeVariantSelect(progressColorInput, progressColorOptions, conditionObj, 'progressColor');
|
|
479
|
+
}
|
|
480
|
+
}
|
|
319
481
|
createCellSettingsConfig(cell) {
|
|
320
482
|
// If cell type is 'select' or 'multiselect', set cellType to 'string'
|
|
321
483
|
let cellType = cell.type || 'string';
|
|
@@ -345,14 +507,8 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
345
507
|
buttonFullWidth: cell.buttonFullWidth ?? false,
|
|
346
508
|
currencyType: cell.currencyType || 'CZK',
|
|
347
509
|
customCSS: JSON.stringify(cell.cellStyle || {}),
|
|
348
|
-
// Conditional formatting -
|
|
349
|
-
|
|
350
|
-
conditionVariable: cell.conditionalFormatting?.variable ?? '',
|
|
351
|
-
conditionOperator: cell.conditionalFormatting?.operator ?? '',
|
|
352
|
-
conditionValue: cell.conditionalFormatting?.value ?? '',
|
|
353
|
-
conditionCellVariant: cell.conditionalFormatting?.cellVariant ?? 'default',
|
|
354
|
-
conditionValueVariant: cell.conditionalFormatting?.valueVariant ?? 'default',
|
|
355
|
-
conditionProgressColor: cell.conditionalFormatting?.progressColor ?? 'primary',
|
|
510
|
+
// Conditional formatting - array of conditions (backward compat: wrap single object)
|
|
511
|
+
conditions: this.normalizeConditions(cell.conditionalFormatting),
|
|
356
512
|
// Conditional hide cell settings
|
|
357
513
|
hideConditionEnabled: !!cell.hideCondition?.enabled,
|
|
358
514
|
hideConditionVariable: cell.hideCondition?.variable ?? '',
|
|
@@ -448,19 +604,15 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
448
604
|
}
|
|
449
605
|
return undefined;
|
|
450
606
|
}
|
|
451
|
-
updateConditionalFormattingOperators(folder,
|
|
452
|
-
// Get the type of the selected variable to ensure correct operators
|
|
607
|
+
updateConditionalFormattingOperators(folder, conditionObj, cell, conditionIndex, variableName) {
|
|
453
608
|
const variableType = this.getVariableTypeByField(variableName);
|
|
454
|
-
// Create a temporary cell object with the new variable and its type
|
|
455
609
|
const tempCell = { ...cell, field: variableName, type: variableType };
|
|
456
610
|
const newOperatorOptions = this.getOperatorOptionsForCell(tempCell);
|
|
457
|
-
|
|
458
|
-
const operatorKey = `${cell.field}_condition_operator`;
|
|
611
|
+
const operatorKey = `${cell.field}_condition_${conditionIndex}_operator`;
|
|
459
612
|
const existingOperatorInput = this.operatorInputs.get(operatorKey);
|
|
460
613
|
let insertIndex = -1;
|
|
461
614
|
if (existingOperatorInput) {
|
|
462
615
|
try {
|
|
463
|
-
// Find the index of the existing operator input
|
|
464
616
|
insertIndex = folder.children.indexOf(existingOperatorInput);
|
|
465
617
|
existingOperatorInput.dispose();
|
|
466
618
|
this.operatorInputs.delete(operatorKey);
|
|
@@ -469,24 +621,20 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
469
621
|
console.warn('Could not dispose existing operator binding:', error);
|
|
470
622
|
}
|
|
471
623
|
}
|
|
472
|
-
// Reset operator to default for new variable type
|
|
473
624
|
const defaultOperator = this.getDefaultOperatorForCell(tempCell);
|
|
474
|
-
|
|
475
|
-
this.setConditionalFormatting(cell, 'operator', defaultOperator);
|
|
476
|
-
|
|
477
|
-
const operatorInput = folder.addBinding(config, 'conditionOperator', {
|
|
625
|
+
conditionObj.operator = defaultOperator;
|
|
626
|
+
this.setConditionalFormatting(cell, conditionIndex, 'operator', defaultOperator);
|
|
627
|
+
const operatorInput = folder.addBinding(conditionObj, 'operator', {
|
|
478
628
|
view: 'list',
|
|
479
629
|
label: msg('Operátor'),
|
|
480
630
|
options: newOperatorOptions,
|
|
481
|
-
index: insertIndex >= 0 ? insertIndex : undefined,
|
|
631
|
+
index: insertIndex >= 0 ? insertIndex : undefined,
|
|
482
632
|
});
|
|
483
633
|
operatorInput.on('change', (ev) => {
|
|
484
|
-
this.setConditionalFormatting(cell, 'operator', ev.value);
|
|
634
|
+
this.setConditionalFormatting(cell, conditionIndex, 'operator', ev.value);
|
|
485
635
|
});
|
|
486
|
-
// Store the new operator input for future disposal
|
|
487
636
|
this.operatorInputs.set(operatorKey, operatorInput);
|
|
488
|
-
|
|
489
|
-
this.addConditionalFormattingValueInput(folder, config, cell, variableName);
|
|
637
|
+
this.addConditionalFormattingValueInput(folder, conditionObj, cell, conditionIndex, variableName);
|
|
490
638
|
}
|
|
491
639
|
updateHideConditionOperators(folder, config, cell, variableName) {
|
|
492
640
|
// Get the type of the selected variable to ensure correct operators
|
|
@@ -577,14 +725,12 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
577
725
|
// Store the new value input for future disposal
|
|
578
726
|
this.hideValueInputs.set(valueKey, hideValueInput);
|
|
579
727
|
}
|
|
580
|
-
addConditionalFormattingValueInput(folder,
|
|
581
|
-
|
|
582
|
-
const valueKey = `${cell.field}_condition_value`;
|
|
728
|
+
addConditionalFormattingValueInput(folder, conditionObj, cell, conditionIndex, variableName) {
|
|
729
|
+
const valueKey = `${cell.field}_condition_${conditionIndex}_value`;
|
|
583
730
|
const existingValueInput = this.conditionValueInputs.get(valueKey);
|
|
584
731
|
let insertIndex = -1;
|
|
585
732
|
if (existingValueInput) {
|
|
586
733
|
try {
|
|
587
|
-
// Find the index of the existing value input
|
|
588
734
|
insertIndex = folder.children.indexOf(existingValueInput);
|
|
589
735
|
existingValueInput.dispose();
|
|
590
736
|
this.conditionValueInputs.delete(valueKey);
|
|
@@ -593,20 +739,17 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
593
739
|
console.warn('Could not dispose existing condition value binding:', error);
|
|
594
740
|
}
|
|
595
741
|
}
|
|
596
|
-
// Get the type and valueOptions of the selected variable
|
|
597
742
|
const variableType = this.getVariableTypeByField(variableName);
|
|
598
743
|
const valueOptions = this.getValueOptionsByField(variableName);
|
|
599
744
|
let conditionValueInput;
|
|
600
|
-
// If variable is type 'select' or 'multiselect' and has valueOptions, create a dropdown
|
|
601
745
|
if ((variableType === 'select' || variableType === 'multiselect') &&
|
|
602
746
|
valueOptions &&
|
|
603
747
|
valueOptions.length > 0) {
|
|
604
|
-
// Convert valueOptions from {label, value} to {text, value} for Tweakpane
|
|
605
748
|
const tweakpaneOptions = valueOptions.map((opt) => ({
|
|
606
749
|
text: opt.label,
|
|
607
750
|
value: opt.value,
|
|
608
751
|
}));
|
|
609
|
-
conditionValueInput = folder.addBinding(
|
|
752
|
+
conditionValueInput = folder.addBinding(conditionObj, 'value', {
|
|
610
753
|
view: 'list',
|
|
611
754
|
label: msg('Hodnota'),
|
|
612
755
|
options: tweakpaneOptions,
|
|
@@ -614,16 +757,14 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
614
757
|
});
|
|
615
758
|
}
|
|
616
759
|
else {
|
|
617
|
-
|
|
618
|
-
conditionValueInput = folder.addBinding(config, 'conditionValue', {
|
|
760
|
+
conditionValueInput = folder.addBinding(conditionObj, 'value', {
|
|
619
761
|
label: msg('Hodnota'),
|
|
620
762
|
index: insertIndex >= 0 ? insertIndex : undefined,
|
|
621
763
|
});
|
|
622
764
|
}
|
|
623
765
|
conditionValueInput.on('change', (ev) => {
|
|
624
|
-
this.setConditionalFormatting(cell, 'value', ev.value);
|
|
766
|
+
this.setConditionalFormatting(cell, conditionIndex, 'value', ev.value);
|
|
625
767
|
});
|
|
626
|
-
// Store the new value input for future disposal
|
|
627
768
|
this.conditionValueInputs.set(valueKey, conditionValueInput);
|
|
628
769
|
}
|
|
629
770
|
getBreakpoint() {
|
|
@@ -713,24 +854,44 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
713
854
|
});
|
|
714
855
|
return variables.sort((a, b) => a.text.localeCompare(b.text));
|
|
715
856
|
}
|
|
716
|
-
setConditionalFormatting(cell, property, value) {
|
|
717
|
-
// Update the cell in the rows array
|
|
857
|
+
setConditionalFormatting(cell, conditionIndex, property, value) {
|
|
718
858
|
this.rows = this.rows.map((c) => {
|
|
719
859
|
if (c.field === cell.field) {
|
|
720
860
|
const updatedCell = { ...c };
|
|
721
|
-
//
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
};
|
|
861
|
+
// Normalize to array
|
|
862
|
+
const conditions = this.normalizeConditions(updatedCell.conditionalFormatting).map((cond) => ({ ...cond }));
|
|
863
|
+
// Ensure index exists
|
|
864
|
+
if (!conditions[conditionIndex]) {
|
|
865
|
+
conditions[conditionIndex] = this.createDefaultCondition(cell);
|
|
727
866
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
867
|
+
conditions[conditionIndex][property] = value;
|
|
868
|
+
updatedCell.conditionalFormatting = conditions;
|
|
869
|
+
return updatedCell;
|
|
870
|
+
}
|
|
871
|
+
return c;
|
|
872
|
+
});
|
|
873
|
+
this.handleSettingsChanged(this.rows);
|
|
874
|
+
}
|
|
875
|
+
addConditionToCell(cell) {
|
|
876
|
+
this.rows = this.rows.map((c) => {
|
|
877
|
+
if (c.field === cell.field) {
|
|
878
|
+
const updatedCell = { ...c };
|
|
879
|
+
const conditions = this.normalizeConditions(updatedCell.conditionalFormatting).map((cond) => ({ ...cond }));
|
|
880
|
+
conditions.push(this.createDefaultCondition(cell));
|
|
881
|
+
updatedCell.conditionalFormatting = conditions;
|
|
882
|
+
return updatedCell;
|
|
883
|
+
}
|
|
884
|
+
return c;
|
|
885
|
+
});
|
|
886
|
+
this.handleSettingsChanged(this.rows);
|
|
887
|
+
}
|
|
888
|
+
removeConditionFromCell(cell, conditionIndex) {
|
|
889
|
+
this.rows = this.rows.map((c) => {
|
|
890
|
+
if (c.field === cell.field) {
|
|
891
|
+
const updatedCell = { ...c };
|
|
892
|
+
const conditions = this.normalizeConditions(updatedCell.conditionalFormatting).map((cond) => ({ ...cond }));
|
|
893
|
+
conditions.splice(conditionIndex, 1);
|
|
894
|
+
updatedCell.conditionalFormatting = conditions;
|
|
734
895
|
return updatedCell;
|
|
735
896
|
}
|
|
736
897
|
return c;
|
|
@@ -847,6 +1008,89 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
847
1008
|
this.settingsPopperOpen = true;
|
|
848
1009
|
}
|
|
849
1010
|
}
|
|
1011
|
+
getVariantColor(variant) {
|
|
1012
|
+
const entry = LitCaseVariablesTab.VARIANT_CSS_VARS[variant];
|
|
1013
|
+
if (!entry)
|
|
1014
|
+
return '#9ca3af';
|
|
1015
|
+
const styles = getComputedStyle(this);
|
|
1016
|
+
return styles.getPropertyValue(entry.var).trim() || entry.fallback;
|
|
1017
|
+
}
|
|
1018
|
+
colorizeVariantSelect(binding, options, config, configKey) {
|
|
1019
|
+
const el = binding.element;
|
|
1020
|
+
if (!el)
|
|
1021
|
+
return;
|
|
1022
|
+
const selectEl = el.querySelector('select');
|
|
1023
|
+
if (!selectEl)
|
|
1024
|
+
return;
|
|
1025
|
+
// Hide the native select
|
|
1026
|
+
const valueContainer = el.querySelector('.tp-lblv_v');
|
|
1027
|
+
if (!valueContainer)
|
|
1028
|
+
return;
|
|
1029
|
+
selectEl.style.display = 'none';
|
|
1030
|
+
// Also hide the dropdown arrow
|
|
1031
|
+
const arrow = valueContainer.querySelector('.tp-lstv_m');
|
|
1032
|
+
if (arrow)
|
|
1033
|
+
arrow.style.display = 'none';
|
|
1034
|
+
// Create swatches container
|
|
1035
|
+
const swatchContainer = document.createElement('div');
|
|
1036
|
+
swatchContainer.style.cssText = 'display:flex;gap:4px;flex-wrap:wrap;align-items:center;';
|
|
1037
|
+
const borderVarMap = {
|
|
1038
|
+
default: 'var(--text-secondary, #9ca3af)',
|
|
1039
|
+
primary: 'var(--color-primary-main, #76b703)',
|
|
1040
|
+
secondary: 'var(--color-secondary-main, #6b7280)',
|
|
1041
|
+
success: 'var(--color-success-main, #22c55e)',
|
|
1042
|
+
warning: 'var(--color-warning-main, #f59e0b)',
|
|
1043
|
+
error: 'var(--color-error-main, #ef4444)',
|
|
1044
|
+
info: 'var(--color-info-main, #3b82f6)',
|
|
1045
|
+
custom: 'var(--color-primary-main, #8b5cf6)',
|
|
1046
|
+
ai: 'var(--color-primary-main, #a855f7)',
|
|
1047
|
+
};
|
|
1048
|
+
options.forEach((opt) => {
|
|
1049
|
+
const color = this.getVariantColor(opt.value);
|
|
1050
|
+
const borderColor = borderVarMap[opt.value] || 'var(--text-secondary, #9ca3af)';
|
|
1051
|
+
const isCustom = opt.value === 'custom';
|
|
1052
|
+
// Wrapper for positioning the tooltip
|
|
1053
|
+
const wrapper = document.createElement('div');
|
|
1054
|
+
wrapper.style.cssText = 'position:relative;display:inline-flex;';
|
|
1055
|
+
const swatch = document.createElement('div');
|
|
1056
|
+
swatch.dataset.value = opt.value;
|
|
1057
|
+
if (isCustom) {
|
|
1058
|
+
swatch.style.cssText = `
|
|
1059
|
+
width:16px;height:16px;border-radius:50%;cursor:pointer;
|
|
1060
|
+
background:conic-gradient(#ef4444,#f59e0b,#22c55e,#3b82f6,#8b5cf6,#ef4444);
|
|
1061
|
+
border:2px dashed var(--text-secondary, #9ca3af);transition:box-shadow .15s;flex-shrink:0;
|
|
1062
|
+
`;
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
swatch.style.cssText = `
|
|
1066
|
+
width:16px;height:16px;border-radius:50%;background:${color};cursor:pointer;
|
|
1067
|
+
border:2px solid ${borderColor};transition:box-shadow .15s;flex-shrink:0;
|
|
1068
|
+
`;
|
|
1069
|
+
}
|
|
1070
|
+
// Tooltip using SimpleTooltip component
|
|
1071
|
+
const tip = document.createElement('simple-tooltip');
|
|
1072
|
+
tip.textContent = opt.text;
|
|
1073
|
+
tip.placement = 'top';
|
|
1074
|
+
tip.offset = 6;
|
|
1075
|
+
tip.openDelayMs = 200;
|
|
1076
|
+
tip.target = swatch;
|
|
1077
|
+
wrapper.appendChild(tip);
|
|
1078
|
+
if (config[configKey] === opt.value) {
|
|
1079
|
+
swatch.style.boxShadow = `0 0 0 2px #fff, 0 0 0 4px ${borderColor}`;
|
|
1080
|
+
}
|
|
1081
|
+
swatch.addEventListener('click', () => {
|
|
1082
|
+
config[configKey] = opt.value;
|
|
1083
|
+
binding.refresh();
|
|
1084
|
+
swatchContainer.querySelectorAll('[data-value]').forEach((s) => {
|
|
1085
|
+
s.style.boxShadow = 'none';
|
|
1086
|
+
});
|
|
1087
|
+
swatch.style.boxShadow = `0 0 0 2px #fff, 0 0 0 4px ${borderColor}`;
|
|
1088
|
+
});
|
|
1089
|
+
wrapper.appendChild(swatch);
|
|
1090
|
+
swatchContainer.appendChild(wrapper);
|
|
1091
|
+
});
|
|
1092
|
+
valueContainer.appendChild(swatchContainer);
|
|
1093
|
+
}
|
|
850
1094
|
// Sanitize field name for use in CSS selectors
|
|
851
1095
|
sanitizeFieldName(field) {
|
|
852
1096
|
return field.replace(/[^a-zA-Z0-9-_]/g, '-');
|
|
@@ -948,6 +1192,27 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
948
1192
|
container: container,
|
|
949
1193
|
title: `${cell.headerName || cell.field}`,
|
|
950
1194
|
});
|
|
1195
|
+
// Apply app theme CSS variables to Tweakpane
|
|
1196
|
+
const styles = getComputedStyle(this);
|
|
1197
|
+
const bgPaper = styles.getPropertyValue('--background-paper').trim() || '#fff';
|
|
1198
|
+
const bgDefault = styles.getPropertyValue('--background-default').trim() || '#fff';
|
|
1199
|
+
const textPrimary = styles.getPropertyValue('--text-primary').trim() || '#111827';
|
|
1200
|
+
const textSecondary = styles.getPropertyValue('--text-secondary').trim() || '#5d6371';
|
|
1201
|
+
const colorDivider = styles.getPropertyValue('--color-divider').trim() || '#e5e7eb';
|
|
1202
|
+
const containerEl = container;
|
|
1203
|
+
containerEl.style.setProperty('--tp-base-background-color', bgPaper);
|
|
1204
|
+
containerEl.style.setProperty('--tp-base-shadow-color', 'rgba(0,0,0,0)');
|
|
1205
|
+
containerEl.style.setProperty('--tp-button-background-color', bgDefault);
|
|
1206
|
+
containerEl.style.setProperty('--tp-button-foreground-color', textPrimary);
|
|
1207
|
+
containerEl.style.setProperty('--tp-container-background-color', colorDivider);
|
|
1208
|
+
containerEl.style.setProperty('--tp-container-background-color-hover', colorDivider);
|
|
1209
|
+
containerEl.style.setProperty('--tp-container-foreground-color', textPrimary);
|
|
1210
|
+
containerEl.style.setProperty('--tp-input-background-color', bgDefault);
|
|
1211
|
+
containerEl.style.setProperty('--tp-input-foreground-color', textPrimary);
|
|
1212
|
+
containerEl.style.setProperty('--tp-label-foreground-color', textSecondary);
|
|
1213
|
+
containerEl.style.setProperty('--tp-monitor-background-color', colorDivider);
|
|
1214
|
+
containerEl.style.setProperty('--tp-monitor-foreground-color', textSecondary);
|
|
1215
|
+
containerEl.style.setProperty('--tp-groove-foreground-color', colorDivider);
|
|
951
1216
|
const config = this.createCellSettingsConfig(cell);
|
|
952
1217
|
// Add size controls for desktop and mobile (only if not in grid variables mode)
|
|
953
1218
|
if (!this.gridVariables) {
|
|
@@ -1072,6 +1337,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1072
1337
|
hideCssInput();
|
|
1073
1338
|
}
|
|
1074
1339
|
});
|
|
1340
|
+
this.colorizeVariantSelect(cellVariantInput, cellVariantOptions, config, 'cellVariant');
|
|
1075
1341
|
// Add cell type-specific controls
|
|
1076
1342
|
this.addCellTypeSpecificControls(pane, config, cell);
|
|
1077
1343
|
// Add conditional formatting section
|
|
@@ -1079,106 +1345,16 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1079
1345
|
title: msg('Podmíněné formátování buněk'),
|
|
1080
1346
|
expanded: false,
|
|
1081
1347
|
});
|
|
1082
|
-
//
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
this.
|
|
1088
|
-
|
|
1089
|
-
// Variable selector - compare against variables from grid (including current cell)
|
|
1090
|
-
const variableOptions = this.getAllAvailableVariables();
|
|
1091
|
-
if (variableOptions.length > 0) {
|
|
1092
|
-
// Set default variable to current cell's field if not already set
|
|
1093
|
-
if (!config.conditionVariable) {
|
|
1094
|
-
config.conditionVariable = cell.field;
|
|
1095
|
-
this.setConditionalFormatting(cell, 'variable', cell.field);
|
|
1096
|
-
}
|
|
1097
|
-
const conditionVariableInput = conditionFolder.addBinding(config, 'conditionVariable', {
|
|
1098
|
-
view: 'list',
|
|
1099
|
-
label: msg('Proměnná'),
|
|
1100
|
-
options: variableOptions,
|
|
1101
|
-
});
|
|
1102
|
-
conditionVariableInput.on('change', (ev) => {
|
|
1103
|
-
this.setConditionalFormatting(cell, 'variable', ev.value);
|
|
1104
|
-
// Update operators when variable changes
|
|
1105
|
-
this.updateConditionalFormattingOperators(conditionFolder, config, cell, ev.value);
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1108
|
-
// Condition operator - use operators based on cell type
|
|
1109
|
-
// Get the actual cell/variable to determine correct operators
|
|
1110
|
-
const conditionVariableType = this.getVariableTypeByField(config.conditionVariable);
|
|
1111
|
-
const tempConditionCell = {
|
|
1112
|
-
...cell,
|
|
1113
|
-
field: config.conditionVariable,
|
|
1114
|
-
type: conditionVariableType,
|
|
1115
|
-
};
|
|
1116
|
-
const operatorOptions = this.getOperatorOptionsForCell(tempConditionCell);
|
|
1117
|
-
const operatorInput = conditionFolder.addBinding(config, 'conditionOperator', {
|
|
1118
|
-
view: 'list',
|
|
1119
|
-
label: msg('Operátor'),
|
|
1120
|
-
options: operatorOptions,
|
|
1121
|
-
});
|
|
1122
|
-
operatorInput.on('change', (ev) => {
|
|
1123
|
-
this.setConditionalFormatting(cell, 'operator', ev.value);
|
|
1124
|
-
});
|
|
1125
|
-
// Store the operator input for future disposal
|
|
1126
|
-
const operatorKey = `${cell.field}_condition_operator`;
|
|
1127
|
-
this.operatorInputs.set(operatorKey, operatorInput);
|
|
1128
|
-
// Condition value - dynamic input based on variable type
|
|
1129
|
-
this.addConditionalFormattingValueInput(conditionFolder, config, cell, config.conditionVariable);
|
|
1130
|
-
// Conditional Cell Variant
|
|
1131
|
-
const conditionCellVariantOptions = [
|
|
1132
|
-
{ text: msg('Výchozí'), value: 'default' },
|
|
1133
|
-
{ text: msg('Primární'), value: 'primary' },
|
|
1134
|
-
{ text: msg('Úspěch'), value: 'success' },
|
|
1135
|
-
{ text: msg('Varování'), value: 'warning' },
|
|
1136
|
-
{ text: msg('Chyba'), value: 'error' },
|
|
1137
|
-
{ text: msg('Informace'), value: 'info' },
|
|
1138
|
-
];
|
|
1139
|
-
const conditionCellVariantInput = conditionFolder.addBinding(config, 'conditionCellVariant', {
|
|
1140
|
-
view: 'list',
|
|
1141
|
-
label: msg('Styl buňky'),
|
|
1142
|
-
options: conditionCellVariantOptions,
|
|
1143
|
-
});
|
|
1144
|
-
conditionCellVariantInput.on('change', (ev) => {
|
|
1145
|
-
this.setConditionalFormatting(cell, 'cellVariant', ev.value);
|
|
1146
|
-
});
|
|
1147
|
-
// Conditional Value Variant
|
|
1148
|
-
const conditionValueVariantOptions = [
|
|
1149
|
-
{ text: msg('Výchozí'), value: 'default' },
|
|
1150
|
-
{ text: msg('Primární'), value: 'primary' },
|
|
1151
|
-
{ text: msg('Úspěch'), value: 'success' },
|
|
1152
|
-
{ text: msg('Varování'), value: 'warning' },
|
|
1153
|
-
{ text: msg('Chyba'), value: 'error' },
|
|
1154
|
-
{ text: msg('Informace'), value: 'info' },
|
|
1155
|
-
];
|
|
1156
|
-
const conditionValueVariantInput = conditionFolder.addBinding(config, 'conditionValueVariant', {
|
|
1157
|
-
view: 'list',
|
|
1158
|
-
label: msg('Barva hodnoty'),
|
|
1159
|
-
options: conditionValueVariantOptions,
|
|
1160
|
-
});
|
|
1161
|
-
conditionValueVariantInput.on('change', (ev) => {
|
|
1162
|
-
this.setConditionalFormatting(cell, 'valueVariant', ev.value);
|
|
1348
|
+
// "Add Condition" button
|
|
1349
|
+
const addConditionBtn = conditionFolder.addButton({ title: `+ ${msg('Přidat podmínku')}` });
|
|
1350
|
+
addConditionBtn.on('click', () => {
|
|
1351
|
+
this.addConditionToCell(cell);
|
|
1352
|
+
// Rebuild conditions UI
|
|
1353
|
+
config.conditions = this.normalizeConditions(this.rows.find((c) => c.field === cell.field)?.conditionalFormatting);
|
|
1354
|
+
this.rebuildConditionFolders(conditionFolder, config, cell);
|
|
1163
1355
|
});
|
|
1164
|
-
//
|
|
1165
|
-
|
|
1166
|
-
const conditionProgressColorOptions = [
|
|
1167
|
-
{ text: msg('Primární'), value: 'primary' },
|
|
1168
|
-
{ text: msg('Úspěch'), value: 'success' },
|
|
1169
|
-
{ text: msg('Varování'), value: 'warning' },
|
|
1170
|
-
{ text: msg('Chyba'), value: 'error' },
|
|
1171
|
-
{ text: msg('Informace'), value: 'info' },
|
|
1172
|
-
];
|
|
1173
|
-
const conditionProgressColorInput = conditionFolder.addBinding(config, 'conditionProgressColor', {
|
|
1174
|
-
view: 'list',
|
|
1175
|
-
label: msg('Barva Progressu'),
|
|
1176
|
-
options: conditionProgressColorOptions,
|
|
1177
|
-
});
|
|
1178
|
-
conditionProgressColorInput.on('change', (ev) => {
|
|
1179
|
-
this.setConditionalFormatting(cell, 'progressColor', ev.value);
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1356
|
+
// Build initial condition sub-folders
|
|
1357
|
+
this.rebuildConditionFolders(conditionFolder, config, cell);
|
|
1182
1358
|
// Add conditional hide section
|
|
1183
1359
|
const hideFolder = pane.addFolder({
|
|
1184
1360
|
title: msg('Podmíněné skrytí buněk'),
|
|
@@ -1318,6 +1494,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1318
1494
|
this.setValueVariant(ev.value, cell);
|
|
1319
1495
|
}
|
|
1320
1496
|
});
|
|
1497
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, config, 'valueVariant');
|
|
1321
1498
|
}
|
|
1322
1499
|
addLinkControls(pane, config, cell) {
|
|
1323
1500
|
// Link Type selector
|
|
@@ -1370,6 +1547,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1370
1547
|
this.setValueVariant(ev.value, cell);
|
|
1371
1548
|
}
|
|
1372
1549
|
});
|
|
1550
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, config, 'valueVariant');
|
|
1373
1551
|
}
|
|
1374
1552
|
addButtonControls(pane, config, cell) {
|
|
1375
1553
|
// Button Variant
|
|
@@ -1387,20 +1565,22 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1387
1565
|
this.setButtonVariant(cell, ev.value);
|
|
1388
1566
|
});
|
|
1389
1567
|
// Button Color
|
|
1568
|
+
const buttonColorOptions = [
|
|
1569
|
+
{ text: msg('Primární'), value: 'primary' },
|
|
1570
|
+
{ text: msg('Druhé'), value: 'secondary' },
|
|
1571
|
+
{ text: msg('Chyba'), value: 'error' },
|
|
1572
|
+
{ text: msg('Varování'), value: 'warning' },
|
|
1573
|
+
{ text: msg('AI'), value: 'ai' },
|
|
1574
|
+
];
|
|
1390
1575
|
const colorInput = pane.addBinding(config, 'buttonColor', {
|
|
1391
1576
|
view: 'list',
|
|
1392
1577
|
label: msg('Barva tlačítka'),
|
|
1393
|
-
options:
|
|
1394
|
-
{ text: msg('Primární'), value: 'primary' },
|
|
1395
|
-
{ text: msg('Druhé'), value: 'secondary' },
|
|
1396
|
-
{ text: msg('Chyba'), value: 'error' },
|
|
1397
|
-
{ text: msg('Varování'), value: 'warning' },
|
|
1398
|
-
{ text: msg('AI'), value: 'ai' },
|
|
1399
|
-
],
|
|
1578
|
+
options: buttonColorOptions,
|
|
1400
1579
|
});
|
|
1401
1580
|
colorInput.on('change', (ev) => {
|
|
1402
1581
|
this.setButtonColor(cell, ev.value);
|
|
1403
1582
|
});
|
|
1583
|
+
this.colorizeVariantSelect(colorInput, buttonColorOptions, config, 'buttonColor');
|
|
1404
1584
|
// Button Full Width
|
|
1405
1585
|
const fullWidthInput = pane.addBinding(config, 'buttonFullWidth', {
|
|
1406
1586
|
label: msg('Tlačítko na celou šířku'),
|
|
@@ -1460,6 +1640,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1460
1640
|
this.setValueVariant(ev.value, cell);
|
|
1461
1641
|
}
|
|
1462
1642
|
});
|
|
1643
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, config, 'valueVariant');
|
|
1463
1644
|
// Number of Decimals
|
|
1464
1645
|
const decimalInput = pane.addBinding(config, 'numberOfDecimal', {
|
|
1465
1646
|
label: msg('Počet desetinných míst'),
|
|
@@ -1471,26 +1652,35 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1471
1652
|
this.setNumberOfDecimal(cell, ev.value);
|
|
1472
1653
|
});
|
|
1473
1654
|
// Currency Type
|
|
1655
|
+
const currencyOptions = [
|
|
1656
|
+
{ text: 'CZK', value: 'CZK' },
|
|
1657
|
+
{ text: 'EUR', value: 'EUR' },
|
|
1658
|
+
{ text: 'USD', value: 'USD' },
|
|
1659
|
+
{ text: 'GBP', value: 'GBP' },
|
|
1660
|
+
{ text: 'CHF', value: 'CHF' },
|
|
1661
|
+
{ text: 'PLN', value: 'PLN' },
|
|
1662
|
+
{ text: 'HUF', value: 'HUF' },
|
|
1663
|
+
{ text: 'JPY', value: 'JPY' },
|
|
1664
|
+
{ text: 'AUD', value: 'AUD' },
|
|
1665
|
+
{ text: 'CAD', value: 'CAD' },
|
|
1666
|
+
{ text: 'NOK', value: 'NOK' },
|
|
1667
|
+
{ text: 'SEK', value: 'SEK' },
|
|
1668
|
+
{ text: 'DKK', value: 'DKK' },
|
|
1669
|
+
{ text: 'CNY', value: 'CNY' },
|
|
1670
|
+
{ text: 'RUB', value: 'RUB' },
|
|
1671
|
+
];
|
|
1672
|
+
// Add variables as currency source options
|
|
1673
|
+
const variableOptions = this.getAllAvailableVariables();
|
|
1674
|
+
variableOptions.forEach((v) => {
|
|
1675
|
+
currencyOptions.push({
|
|
1676
|
+
text: `${v.text}`,
|
|
1677
|
+
value: `var:${v.value}`,
|
|
1678
|
+
});
|
|
1679
|
+
});
|
|
1474
1680
|
const currencyInput = pane.addBinding(config, 'currencyType', {
|
|
1475
1681
|
view: 'list',
|
|
1476
1682
|
label: msg('Typ měny'),
|
|
1477
|
-
options:
|
|
1478
|
-
{ text: 'CZK', value: 'CZK' },
|
|
1479
|
-
{ text: 'EUR', value: 'EUR' },
|
|
1480
|
-
{ text: 'USD', value: 'USD' },
|
|
1481
|
-
{ text: 'GBP', value: 'GBP' },
|
|
1482
|
-
{ text: 'CHF', value: 'CHF' },
|
|
1483
|
-
{ text: 'PLN', value: 'PLN' },
|
|
1484
|
-
{ text: 'HUF', value: 'HUF' },
|
|
1485
|
-
{ text: 'JPY', value: 'JPY' },
|
|
1486
|
-
{ text: 'AUD', value: 'AUD' },
|
|
1487
|
-
{ text: 'CAD', value: 'CAD' },
|
|
1488
|
-
{ text: 'NOK', value: 'NOK' },
|
|
1489
|
-
{ text: 'SEK', value: 'SEK' },
|
|
1490
|
-
{ text: 'DKK', value: 'DKK' },
|
|
1491
|
-
{ text: 'CNY', value: 'CNY' },
|
|
1492
|
-
{ text: 'RUB', value: 'RUB' },
|
|
1493
|
-
],
|
|
1683
|
+
options: currencyOptions,
|
|
1494
1684
|
});
|
|
1495
1685
|
currencyInput.on('change', (ev) => {
|
|
1496
1686
|
this.setCurrencyType(cell, ev.value);
|
|
@@ -1526,23 +1716,26 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1526
1716
|
this.setValueVariant(ev.value, cell);
|
|
1527
1717
|
}
|
|
1528
1718
|
});
|
|
1719
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, config, 'valueVariant');
|
|
1529
1720
|
}
|
|
1530
1721
|
addProgressControls(pane, config, cell) {
|
|
1531
1722
|
// Progress Color
|
|
1723
|
+
const progressColorOptions = [
|
|
1724
|
+
{ text: msg('Primární'), value: 'primary' },
|
|
1725
|
+
{ text: msg('Úspěch'), value: 'success' },
|
|
1726
|
+
{ text: msg('Varování'), value: 'warning' },
|
|
1727
|
+
{ text: msg('Chyba'), value: 'error' },
|
|
1728
|
+
{ text: msg('Informace'), value: 'info' },
|
|
1729
|
+
];
|
|
1532
1730
|
const progressColorInput = pane.addBinding(config, 'progressColor', {
|
|
1533
1731
|
view: 'list',
|
|
1534
1732
|
label: msg('Barva postupu'),
|
|
1535
|
-
options:
|
|
1536
|
-
{ text: msg('Primární'), value: 'primary' },
|
|
1537
|
-
{ text: msg('Úspěch'), value: 'success' },
|
|
1538
|
-
{ text: msg('Varování'), value: 'warning' },
|
|
1539
|
-
{ text: msg('Chyba'), value: 'error' },
|
|
1540
|
-
{ text: msg('Informace'), value: 'info' },
|
|
1541
|
-
],
|
|
1733
|
+
options: progressColorOptions,
|
|
1542
1734
|
});
|
|
1543
1735
|
progressColorInput.on('change', (ev) => {
|
|
1544
1736
|
this.setProgressColor(cell, ev.value);
|
|
1545
1737
|
});
|
|
1738
|
+
this.colorizeVariantSelect(progressColorInput, progressColorOptions, config, 'progressColor');
|
|
1546
1739
|
// Value Variant (for progress text color if needed)
|
|
1547
1740
|
const valueVariantOptions = [
|
|
1548
1741
|
{ text: msg('Výchozí'), value: 'default' },
|
|
@@ -1565,6 +1758,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1565
1758
|
this.setValueVariant(ev.value, cell);
|
|
1566
1759
|
}
|
|
1567
1760
|
});
|
|
1761
|
+
this.colorizeVariantSelect(valueVariantInput, valueVariantOptions, config, 'valueVariant');
|
|
1568
1762
|
}
|
|
1569
1763
|
getVariableValue(fieldName) {
|
|
1570
1764
|
// First check in variables array for a matching field
|
|
@@ -1587,9 +1781,6 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1587
1781
|
return '';
|
|
1588
1782
|
}
|
|
1589
1783
|
evaluateCondition(variableField, conditionValue, operator) {
|
|
1590
|
-
if (this.enableSettings) {
|
|
1591
|
-
return false; // Disable conditional formatting when in settings mode
|
|
1592
|
-
}
|
|
1593
1784
|
// Get the value of the selected variable
|
|
1594
1785
|
const variableValue = this.getVariableValue(variableField);
|
|
1595
1786
|
// For isEmpty/isNotEmpty operators, check the raw value first
|
|
@@ -1792,15 +1983,18 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1792
1983
|
if (cell.cellCustomStyles && cell.cellStyle) {
|
|
1793
1984
|
styles = { ...styles, ...cell.cellStyle };
|
|
1794
1985
|
}
|
|
1795
|
-
// 1. Conditional formatting cell variant (highest priority)
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1986
|
+
// 1. Conditional formatting cell variant (highest priority, first match wins)
|
|
1987
|
+
const conditions = this.normalizeConditions(cell.conditionalFormatting);
|
|
1988
|
+
for (const condition of conditions) {
|
|
1989
|
+
if (condition?.enabled && condition?.variable) {
|
|
1990
|
+
const conditionMet = this.evaluateCondition(condition.variable, condition.value, condition.operator);
|
|
1991
|
+
if (conditionMet &&
|
|
1992
|
+
condition.cellVariant &&
|
|
1993
|
+
condition.cellVariant !== 'default') {
|
|
1994
|
+
const conditionalCellStyle = this.getCellVariantStyle(condition.cellVariant);
|
|
1995
|
+
styles = { ...styles, ...conditionalCellStyle };
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1804
1998
|
}
|
|
1805
1999
|
}
|
|
1806
2000
|
return styles;
|
|
@@ -1857,15 +2051,18 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1857
2051
|
if (cell.valueCustomStyles && cell.valueStyle) {
|
|
1858
2052
|
styles = { ...styles, ...cell.valueStyle };
|
|
1859
2053
|
}
|
|
1860
|
-
// 1. Conditional formatting value variant (highest priority)
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
2054
|
+
// 1. Conditional formatting value variant (highest priority, first match wins)
|
|
2055
|
+
const conditions = this.normalizeConditions(cell.conditionalFormatting);
|
|
2056
|
+
for (const condition of conditions) {
|
|
2057
|
+
if (condition?.enabled && condition?.variable) {
|
|
2058
|
+
const conditionMet = this.evaluateCondition(condition.variable, condition.value, condition.operator);
|
|
2059
|
+
if (conditionMet &&
|
|
2060
|
+
condition.valueVariant &&
|
|
2061
|
+
condition.valueVariant !== 'default') {
|
|
2062
|
+
const conditionalValueStyle = this.getValueVariantStyle(condition.valueVariant);
|
|
2063
|
+
styles = { ...styles, ...conditionalValueStyle };
|
|
2064
|
+
break;
|
|
2065
|
+
}
|
|
1869
2066
|
}
|
|
1870
2067
|
}
|
|
1871
2068
|
return styles;
|
|
@@ -1887,12 +2084,15 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
1887
2084
|
// 2. Cell progressColor property
|
|
1888
2085
|
// 3. Default 'primary' color (lowest)
|
|
1889
2086
|
let progressColor = cell.progressColor || 'primary';
|
|
1890
|
-
// 1. Conditional formatting progressColor (highest priority)
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
2087
|
+
// 1. Conditional formatting progressColor (highest priority, first match wins)
|
|
2088
|
+
const conditions = this.normalizeConditions(cell.conditionalFormatting);
|
|
2089
|
+
for (const condition of conditions) {
|
|
2090
|
+
if (condition?.enabled && condition?.variable) {
|
|
2091
|
+
const conditionMet = this.evaluateCondition(condition.variable, condition.value, condition.operator);
|
|
2092
|
+
if (conditionMet && condition.progressColor) {
|
|
2093
|
+
progressColor = condition.progressColor;
|
|
2094
|
+
break;
|
|
2095
|
+
}
|
|
1896
2096
|
}
|
|
1897
2097
|
}
|
|
1898
2098
|
return progressColor;
|
|
@@ -2131,6 +2331,15 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2131
2331
|
}
|
|
2132
2332
|
toggleCustomPopover() {
|
|
2133
2333
|
this.isOpen = !this.isOpen;
|
|
2334
|
+
if (this.isOpen) {
|
|
2335
|
+
this.updateComplete.then(() => {
|
|
2336
|
+
setTimeout(() => {
|
|
2337
|
+
const input = this.shadowRoot?.querySelector('#variable-filter-input') ||
|
|
2338
|
+
document.querySelector('#variable-filter-input');
|
|
2339
|
+
input?.focus();
|
|
2340
|
+
}, 100);
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2134
2343
|
}
|
|
2135
2344
|
get existingFields() {
|
|
2136
2345
|
return this.rows.flat().map((cell) => cell.field);
|
|
@@ -2175,6 +2384,26 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2175
2384
|
// Return static href as-is
|
|
2176
2385
|
return href;
|
|
2177
2386
|
}
|
|
2387
|
+
formatDisplayValue(rawValue) {
|
|
2388
|
+
if (Array.isArray(rawValue)) {
|
|
2389
|
+
return rawValue.map((v) => String(v ?? '')).join(', ');
|
|
2390
|
+
}
|
|
2391
|
+
return typeof rawValue === 'string' ? rawValue : String(rawValue ?? '');
|
|
2392
|
+
}
|
|
2393
|
+
resolveCurrencyType(cell) {
|
|
2394
|
+
const currencyType = cell.currencyType || 'CZK';
|
|
2395
|
+
if (currencyType.startsWith('var:')) {
|
|
2396
|
+
const variableField = currencyType.substring(4);
|
|
2397
|
+
const variable = this.variables.find((v) => v.field === variableField)
|
|
2398
|
+
|| this.rows.find((c) => c.field === variableField);
|
|
2399
|
+
const resolved = String(variable?.value || '').toUpperCase();
|
|
2400
|
+
if (LitCaseVariablesTab.SUPPORTED_CURRENCIES.includes(resolved)) {
|
|
2401
|
+
return resolved;
|
|
2402
|
+
}
|
|
2403
|
+
return 'CZK';
|
|
2404
|
+
}
|
|
2405
|
+
return currencyType;
|
|
2406
|
+
}
|
|
2178
2407
|
render() {
|
|
2179
2408
|
if (this.hideTabWhen)
|
|
2180
2409
|
return null;
|
|
@@ -2265,6 +2494,8 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2265
2494
|
.placement=${'top-end'}
|
|
2266
2495
|
.manualOpening=${true}
|
|
2267
2496
|
.maxWidthAsTarget=${false}
|
|
2497
|
+
.minWidth=${'400px'}
|
|
2498
|
+
.minHeight=${'300px'}
|
|
2268
2499
|
.onClose=${() => this.closePopover()}
|
|
2269
2500
|
>
|
|
2270
2501
|
<div
|
|
@@ -2272,6 +2503,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2272
2503
|
style="position: sticky; top: 0; z-index: 1;"
|
|
2273
2504
|
>
|
|
2274
2505
|
<lit-input
|
|
2506
|
+
id="variable-filter-input"
|
|
2275
2507
|
.value=${this.filterText}
|
|
2276
2508
|
.onInput=${(value) => {
|
|
2277
2509
|
this.filterText = value?.toLowerCase?.() || '';
|
|
@@ -2300,7 +2532,12 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2300
2532
|
return 1;
|
|
2301
2533
|
if (!aIsUnderscore && bIsUnderscore)
|
|
2302
2534
|
return -1;
|
|
2303
|
-
|
|
2535
|
+
const lang = this.userLang || 'cs';
|
|
2536
|
+
const aItem = this.variables.find((v) => v.field === a);
|
|
2537
|
+
const bItem = this.variables.find((v) => v.field === b);
|
|
2538
|
+
const aName = aItem?.[`tvar_name_${lang}`] || a;
|
|
2539
|
+
const bName = bItem?.[`tvar_name_${lang}`] || b;
|
|
2540
|
+
return aName.localeCompare(bName, lang);
|
|
2304
2541
|
})
|
|
2305
2542
|
.map((key) => html `
|
|
2306
2543
|
<lit-menu-item
|
|
@@ -2322,7 +2559,7 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2322
2559
|
${isEqual(filteredKeys.length, 0)
|
|
2323
2560
|
? html `
|
|
2324
2561
|
<div
|
|
2325
|
-
style="display: flex;flex-direction: column; align-items: center"
|
|
2562
|
+
style="display: flex;flex-direction: column; align-items: center; justify-content: center; height: 15.625rem;"
|
|
2326
2563
|
>
|
|
2327
2564
|
<div style="max-height: 7.125rem; max-width: 7.125rem">
|
|
2328
2565
|
<not-found></not-found>
|
|
@@ -2347,6 +2584,17 @@ export class LitCaseVariablesTab extends LitElement {
|
|
|
2347
2584
|
`;
|
|
2348
2585
|
}
|
|
2349
2586
|
}
|
|
2587
|
+
LitCaseVariablesTab.VARIANT_CSS_VARS = {
|
|
2588
|
+
default: { var: '--background-paper', fallback: '#9ca3af' },
|
|
2589
|
+
primary: { var: '--color-primary-light', fallback: '#76b703' },
|
|
2590
|
+
secondary: { var: '--color-secondary-light', fallback: '#6b7280' },
|
|
2591
|
+
success: { var: '--color-success-light', fallback: '#22c55e' },
|
|
2592
|
+
warning: { var: '--color-warning-light', fallback: '#f59e0b' },
|
|
2593
|
+
error: { var: '--color-error-light', fallback: '#ef4444' },
|
|
2594
|
+
info: { var: '--color-info-light', fallback: '#3b82f6' },
|
|
2595
|
+
custom: { var: '--color-primary-light', fallback: '#8b5cf6' },
|
|
2596
|
+
ai: { var: '--color-primary-light', fallback: '#a855f7' },
|
|
2597
|
+
};
|
|
2350
2598
|
LitCaseVariablesTab.styles = [
|
|
2351
2599
|
// styles,
|
|
2352
2600
|
css `
|
|
@@ -2566,6 +2814,10 @@ LitCaseVariablesTab.styles = [
|
|
|
2566
2814
|
}
|
|
2567
2815
|
`,
|
|
2568
2816
|
];
|
|
2817
|
+
LitCaseVariablesTab.SUPPORTED_CURRENCIES = [
|
|
2818
|
+
'CZK', 'EUR', 'USD', 'GBP', 'CHF', 'PLN', 'HUF',
|
|
2819
|
+
'JPY', 'AUD', 'CAD', 'NOK', 'SEK', 'DKK', 'CNY', 'RUB',
|
|
2820
|
+
];
|
|
2569
2821
|
__decorate([
|
|
2570
2822
|
property({ type: Array })
|
|
2571
2823
|
], LitCaseVariablesTab.prototype, "rows", void 0);
|