@simai-studio/view 1.1.0 → 1.3.0
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 +5 -5
- package/dist/package-receipt.json +322 -81
- package/dist/set.json +35 -2
- package/dist/smart/rule.js +94 -0
- package/dist/smart/rule.js.gz +0 -0
- package/dist/smart/view/component.json +1 -1
- package/dist/smart/view/component.json.gz +0 -0
- package/dist/smart/view/js/view.js +1 -1
- package/dist/smart/view/js/view.js.gz +0 -0
- package/dist/smart/view/js/view.min.js +1 -1
- package/dist/smart/view/js/view.min.js.gz +0 -0
- package/dist/smart/view/smart.manifest.json +1 -1
- package/dist/smart/view/smart.manifest.json.gz +0 -0
- package/dist/smart/view/static/default/open-record.html +1 -1
- package/dist/smart/view/static/default/open-record.html.gz +0 -0
- package/dist/smart/view/static/default/reference.html +1 -1
- package/dist/smart/view/static/default/reference.html.gz +0 -0
- package/dist/smart/view-flow/component.json +620 -0
- package/dist/smart/view-flow/component.json.gz +0 -0
- package/dist/smart/view-flow/css/view-flow.css +570 -0
- package/dist/smart/view-flow/css/view-flow.css.gz +0 -0
- package/dist/smart/view-flow/css/view-flow.min.css +3 -0
- package/dist/smart/view-flow/css/view-flow.min.css.gz +0 -0
- package/dist/smart/view-flow/examples.json +452 -0
- package/dist/smart/view-flow/examples.json.gz +0 -0
- package/dist/smart/view-flow/js/view-flow.js +7406 -0
- package/dist/smart/view-flow/js/view-flow.js.gz +0 -0
- package/dist/smart/view-flow/js/view-flow.min.js +749 -0
- package/dist/smart/view-flow/js/view-flow.min.js.gz +0 -0
- package/dist/smart/view-flow/lang/en.json +24 -0
- package/dist/smart/view-flow/lang/en.json.gz +0 -0
- package/dist/smart/view-flow/lang/ru.json +24 -0
- package/dist/smart/view-flow/lang/ru.json.gz +0 -0
- package/dist/smart/view-flow/probe.json +149 -0
- package/dist/smart/view-flow/probe.json.gz +0 -0
- package/dist/smart/view-flow/smart.manifest.json +486 -0
- package/dist/smart/view-flow/smart.manifest.json.gz +0 -0
- package/dist/smart/view-flow/static/default/answered.html +57 -0
- package/dist/smart/view-flow/static/default/answered.html.gz +0 -0
- package/dist/smart/view-flow/static/default/ask.html +146 -0
- package/dist/smart/view-flow/static/default/ask.html.gz +0 -0
- package/dist/smart/view-flow/static/default/expired.html +16 -0
- package/dist/smart/view-flow/static/default/expired.html.gz +0 -0
- package/dist/smart/view-flow/static/default/groups.html +44 -0
- package/dist/smart/view-flow/static/default/groups.html.gz +0 -0
- package/dist/smart/view-flow/static/default/reference.html +72 -0
- package/dist/smart/view-flow/static/default/reference.html.gz +0 -0
- package/dist/smart/view-flow/static/default/untitled.html +41 -0
- package/dist/smart/view-flow/static/default/untitled.html.gz +0 -0
- package/dist/smart/view-flow/static/sheets.json +443 -0
- package/dist/smart/view-flow/static/sheets.json.gz +0 -0
- package/dist/smart/view-flow/template/default.css +180 -0
- package/dist/smart/view-flow/template/default.css.gz +0 -0
- package/dist/smart/view-flow/template/default.js +136 -0
- package/dist/smart/view-flow/template/default.js.gz +0 -0
- package/dist/smart/view-properties/component.json +8 -1
- package/dist/smart/view-properties/component.json.gz +0 -0
- package/dist/smart/view-properties/css/view-properties.css +367 -0
- package/dist/smart/view-properties/css/view-properties.css.gz +0 -0
- package/dist/smart/view-properties/css/view-properties.min.css +1 -0
- package/dist/smart/view-properties/css/view-properties.min.css.gz +0 -0
- package/dist/smart/view-properties/js/view-properties.js +1755 -169
- package/dist/smart/view-properties/js/view-properties.js.gz +0 -0
- package/dist/smart/view-properties/js/view-properties.min.js +491 -378
- package/dist/smart/view-properties/js/view-properties.min.js.gz +0 -0
- package/dist/smart/view-properties/smart.manifest.json +38 -3
- package/dist/smart/view-properties/smart.manifest.json.gz +0 -0
- package/dist/smart/view-properties/template/default.js +1 -77
- package/dist/smart/view-properties/template/default.js.gz +0 -0
- package/dist/smart/view-table/js/view-table.js +2 -0
- package/dist/smart/view-table/js/view-table.js.gz +0 -0
- package/dist/smart/view-table/js/view-table.min.js +2 -0
- package/dist/smart/view-table/js/view-table.min.js.gz +0 -0
- package/package.json +1 -1
|
@@ -2037,6 +2037,7 @@ function renderChoiceEdit(field, value, host) {
|
|
|
2037
2037
|
name=${fieldName(field)}
|
|
2038
2038
|
?required=${Boolean(field.required)}
|
|
2039
2039
|
value=${value ?? ''}
|
|
2040
|
+
placeholder=${field.placeholder || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
2040
2041
|
aria-label=${field.label || field.key || ''}
|
|
2041
2042
|
.options=${editOptions(field, value, false)}
|
|
2042
2043
|
@change=${event => host.setFieldValue(field, event.detail?.value ?? null)}
|
|
@@ -2090,6 +2091,7 @@ function renderChoicesEdit(field, value, host) {
|
|
|
2090
2091
|
search="false"
|
|
2091
2092
|
name=${fieldName(field)}
|
|
2092
2093
|
?required=${Boolean(field.required)}
|
|
2094
|
+
placeholder=${field.placeholder || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
2093
2095
|
aria-label=${field.label || field.key || ''}
|
|
2094
2096
|
.options=${editOptions(field, value, true)}
|
|
2095
2097
|
@change=${event => {
|
|
@@ -7581,28 +7583,257 @@ function fieldConditions(field, values) {
|
|
|
7581
7583
|
|
|
7582
7584
|
/***/ },
|
|
7583
7585
|
|
|
7584
|
-
/***/ "
|
|
7586
|
+
/***/ "f44b979883f0"
|
|
7587
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7588
|
+
|
|
7589
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7590
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7591
|
+
/* harmony export */ add: () => (/* binding */ add),
|
|
7592
|
+
/* harmony export */ compare: () => (/* binding */ compare),
|
|
7593
|
+
/* harmony export */ decimalString: () => (/* binding */ decimalString),
|
|
7594
|
+
/* harmony export */ editableDecimal: () => (/* binding */ editableDecimal),
|
|
7595
|
+
/* harmony export */ formatDecimal: () => (/* binding */ formatDecimal),
|
|
7596
|
+
/* harmony export */ fractionDigits: () => (/* binding */ fractionDigits),
|
|
7597
|
+
/* harmony export */ multiply: () => (/* binding */ multiply),
|
|
7598
|
+
/* harmony export */ readDecimal: () => (/* binding */ readDecimal),
|
|
7599
|
+
/* harmony export */ round: () => (/* binding */ round),
|
|
7600
|
+
/* harmony export */ share: () => (/* binding */ share),
|
|
7601
|
+
/* harmony export */ toDecimal: () => (/* binding */ toDecimal)
|
|
7602
|
+
/* harmony export */ });
|
|
7603
|
+
// Decimal numbers as strings, never as floats (Larena property types standard,
|
|
7604
|
+
// notes of 2026-11-03: «Arithmetic is on decimal digits, never on floats»;
|
|
7605
|
+
// «Never a float on the wire»). A money amount, a percent and every cell a row
|
|
7606
|
+
// computes are read, multiplied, summed and rounded here on BigInt units, so
|
|
7607
|
+
// 0.1 + 0.2 is 0.3 and 2 499,99 stays 2 499,99 however many rows add up to it.
|
|
7608
|
+
//
|
|
7609
|
+
// A decimal is {units, scale}: the value is units / 10^scale. The canonical
|
|
7610
|
+
// string has an optional minus, the integer digits without leading zeros and
|
|
7611
|
+
// the fraction digits as written ("1500.50", "0.5", "-3"); "-0" is "0".
|
|
7612
|
+
const TYPED = /^([+-]?)(\d*)(?:[.,](\d*))?$/u; // Spaces a person or a formatter puts between groups of digits: the plain
|
|
7613
|
+
// space, the no-break space and the narrow no-break space ru-RU writes.
|
|
7614
|
+
|
|
7615
|
+
const GROUP_SPACES = /[\s ']/gu;
|
|
7616
|
+
/**
|
|
7617
|
+
* What a person typed, read as a decimal: `{ok: true, value}` with the
|
|
7618
|
+
* canonical string (null for nothing typed), or `{ok: false}` for text that is
|
|
7619
|
+
* not a number. A comma and a point both separate the fraction; spaces between
|
|
7620
|
+
* groups go.
|
|
7621
|
+
*/
|
|
7622
|
+
|
|
7623
|
+
function readDecimal(text) {
|
|
7624
|
+
if (text === null || typeof text === 'undefined') return {
|
|
7625
|
+
ok: true,
|
|
7626
|
+
value: null
|
|
7627
|
+
};
|
|
7628
|
+
|
|
7629
|
+
if (typeof text === 'number') {
|
|
7630
|
+
// A JSON integer is taken as its digits (property types standard §5); a
|
|
7631
|
+
// float is not a decimal and is refused rather than guessed at.
|
|
7632
|
+
return Number.isSafeInteger(text) ? {
|
|
7633
|
+
ok: true,
|
|
7634
|
+
value: String(text)
|
|
7635
|
+
} : {
|
|
7636
|
+
ok: false
|
|
7637
|
+
};
|
|
7638
|
+
}
|
|
7639
|
+
|
|
7640
|
+
const plain = String(text).replace(GROUP_SPACES, '');
|
|
7641
|
+
if (plain === '') return {
|
|
7642
|
+
ok: true,
|
|
7643
|
+
value: null
|
|
7644
|
+
};
|
|
7645
|
+
const match = TYPED.exec(plain);
|
|
7646
|
+
if (!match) return {
|
|
7647
|
+
ok: false
|
|
7648
|
+
};
|
|
7649
|
+
const [, sign, whole, fraction] = match;
|
|
7650
|
+
if (whole === '' && (fraction ?? '') === '') return {
|
|
7651
|
+
ok: false
|
|
7652
|
+
};
|
|
7653
|
+
const integer = whole.replace(/^0+(?=\d)/u, '') || '0';
|
|
7654
|
+
const digits = fraction ?? '';
|
|
7655
|
+
const zero = /^0*$/u.test(integer + digits);
|
|
7656
|
+
const value = `${sign === '-' && !zero ? '-' : ''}${integer}${digits ? `.${digits}` : ''}`;
|
|
7657
|
+
return {
|
|
7658
|
+
ok: true,
|
|
7659
|
+
value
|
|
7660
|
+
};
|
|
7661
|
+
}
|
|
7662
|
+
/** The decimal of a canonical string or a JSON integer, or null. */
|
|
7663
|
+
|
|
7664
|
+
function toDecimal(value) {
|
|
7665
|
+
if (value && typeof value === 'object' && typeof value.units === 'bigint') return value;
|
|
7666
|
+
const read = readDecimal(value);
|
|
7667
|
+
if (!read.ok || read.value === null) return null;
|
|
7668
|
+
const negative = read.value.startsWith('-');
|
|
7669
|
+
const [whole, fraction = ''] = read.value.replace('-', '').split('.');
|
|
7670
|
+
const units = BigInt(whole + fraction) * (negative ? -1n : 1n);
|
|
7671
|
+
return {
|
|
7672
|
+
units,
|
|
7673
|
+
scale: fraction.length
|
|
7674
|
+
};
|
|
7675
|
+
}
|
|
7676
|
+
/** How many digits a decimal string has after its point. */
|
|
7677
|
+
|
|
7678
|
+
function fractionDigits(value) {
|
|
7679
|
+
const read = readDecimal(value);
|
|
7680
|
+
if (!read.ok || read.value === null) return 0;
|
|
7681
|
+
const at = read.value.indexOf('.');
|
|
7682
|
+
return at === -1 ? 0 : read.value.length - at - 1;
|
|
7683
|
+
}
|
|
7684
|
+
const POWERS = new Map();
|
|
7685
|
+
|
|
7686
|
+
const power = n => {
|
|
7687
|
+
if (!POWERS.has(n)) POWERS.set(n, 10n ** BigInt(n));
|
|
7688
|
+
return POWERS.get(n);
|
|
7689
|
+
};
|
|
7690
|
+
|
|
7691
|
+
function rescale(decimal, scale) {
|
|
7692
|
+
return decimal.scale === scale ? decimal : {
|
|
7693
|
+
units: decimal.units * power(scale - decimal.scale),
|
|
7694
|
+
scale
|
|
7695
|
+
};
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7698
|
+
function multiply(a, b) {
|
|
7699
|
+
return {
|
|
7700
|
+
units: a.units * b.units,
|
|
7701
|
+
scale: a.scale + b.scale
|
|
7702
|
+
};
|
|
7703
|
+
}
|
|
7704
|
+
function add(a, b) {
|
|
7705
|
+
const scale = Math.max(a.scale, b.scale);
|
|
7706
|
+
return {
|
|
7707
|
+
units: rescale(a, scale).units + rescale(b, scale).units,
|
|
7708
|
+
scale
|
|
7709
|
+
};
|
|
7710
|
+
}
|
|
7711
|
+
/** A share: 20 percent is 0.2 (property types standard, rows: «A percent operand counts as its share»). */
|
|
7712
|
+
|
|
7713
|
+
function share(decimal) {
|
|
7714
|
+
return {
|
|
7715
|
+
units: decimal.units,
|
|
7716
|
+
scale: decimal.scale + 2
|
|
7717
|
+
};
|
|
7718
|
+
}
|
|
7719
|
+
/** Rounded half away from zero to `scale` digits after the point. */
|
|
7720
|
+
|
|
7721
|
+
function round(decimal, scale) {
|
|
7722
|
+
if (decimal.scale <= scale) return rescale(decimal, scale);
|
|
7723
|
+
const divisor = power(decimal.scale - scale);
|
|
7724
|
+
const negative = decimal.units < 0n;
|
|
7725
|
+
const magnitude = negative ? -decimal.units : decimal.units;
|
|
7726
|
+
let units = magnitude / divisor;
|
|
7727
|
+
if (magnitude % divisor * 2n >= divisor) units += 1n;
|
|
7728
|
+
return {
|
|
7729
|
+
units: negative ? -units : units,
|
|
7730
|
+
scale
|
|
7731
|
+
};
|
|
7732
|
+
}
|
|
7733
|
+
function compare(a, b) {
|
|
7734
|
+
const scale = Math.max(a.scale, b.scale);
|
|
7735
|
+
const left = rescale(a, scale).units;
|
|
7736
|
+
const right = rescale(b, scale).units;
|
|
7737
|
+
return left === right ? 0 : left < right ? -1 : 1;
|
|
7738
|
+
}
|
|
7739
|
+
/** The canonical string of a decimal, with exactly its scale's digits after the point. */
|
|
7740
|
+
|
|
7741
|
+
function decimalString(decimal) {
|
|
7742
|
+
const negative = decimal.units < 0n;
|
|
7743
|
+
const digits = (negative ? -decimal.units : decimal.units).toString().padStart(decimal.scale + 1, '0');
|
|
7744
|
+
const whole = decimal.scale ? digits.slice(0, -decimal.scale) : digits;
|
|
7745
|
+
const fraction = decimal.scale ? digits.slice(-decimal.scale) : '';
|
|
7746
|
+
const zero = decimal.units === 0n;
|
|
7747
|
+
return `${negative && !zero ? '-' : ''}${whole}${fraction ? `.${fraction}` : ''}`;
|
|
7748
|
+
} // The separators of a locale, read once from Intl and kept: a decimal is
|
|
7749
|
+
// formatted from its digits, so no amount passes through a float to be shown.
|
|
7750
|
+
|
|
7751
|
+
const SEPARATORS = new Map();
|
|
7752
|
+
|
|
7753
|
+
function separators(locale) {
|
|
7754
|
+
if (!SEPARATORS.has(locale)) {
|
|
7755
|
+
let group = ' ';
|
|
7756
|
+
let point = '.';
|
|
7757
|
+
|
|
7758
|
+
try {
|
|
7759
|
+
for (const part of new Intl.NumberFormat(locale).formatToParts(12345.6)) {
|
|
7760
|
+
if (part.type === 'group') group = part.value;
|
|
7761
|
+
if (part.type === 'decimal') point = part.value;
|
|
7762
|
+
}
|
|
7763
|
+
} catch {// An unknown locale keeps the defaults.
|
|
7764
|
+
}
|
|
7765
|
+
|
|
7766
|
+
SEPARATORS.set(locale, {
|
|
7767
|
+
group,
|
|
7768
|
+
point
|
|
7769
|
+
});
|
|
7770
|
+
}
|
|
7771
|
+
|
|
7772
|
+
return SEPARATORS.get(locale);
|
|
7773
|
+
}
|
|
7774
|
+
/**
|
|
7775
|
+
* A decimal string as a person reads it in `locale`: groups of three, the
|
|
7776
|
+
* locale's point, and at least `minFraction` digits after it («1 500,50»).
|
|
7777
|
+
* Groups start at four digits, as the standard reads money («1 500,50 ₽»).
|
|
7778
|
+
*/
|
|
7779
|
+
|
|
7780
|
+
|
|
7781
|
+
function formatDecimal(value, locale, {
|
|
7782
|
+
minFraction = 0
|
|
7783
|
+
} = {}) {
|
|
7784
|
+
const decimal = toDecimal(value);
|
|
7785
|
+
if (!decimal) return '';
|
|
7786
|
+
const text = decimalString(decimal.scale < minFraction ? rescale(decimal, minFraction) : decimal);
|
|
7787
|
+
const negative = text.startsWith('-');
|
|
7788
|
+
const [whole, fraction] = text.replace('-', '').split('.');
|
|
7789
|
+
const {
|
|
7790
|
+
group,
|
|
7791
|
+
point
|
|
7792
|
+
} = separators(locale);
|
|
7793
|
+
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/gu, group);
|
|
7794
|
+
return `${negative ? '−' : ''}${grouped}${fraction ? `${point}${fraction}` : ''}`;
|
|
7795
|
+
}
|
|
7796
|
+
/** A decimal string as typed in an input: the locale's point, no groups («1500,5»). */
|
|
7797
|
+
|
|
7798
|
+
function editableDecimal(value, locale) {
|
|
7799
|
+
const read = readDecimal(value);
|
|
7800
|
+
if (!read.ok || read.value === null) return '';
|
|
7801
|
+
return read.value.replace('.', separators(locale).point);
|
|
7802
|
+
}
|
|
7803
|
+
|
|
7804
|
+
/***/ },
|
|
7805
|
+
|
|
7806
|
+
/***/ "62c5c417c97d"
|
|
7585
7807
|
(module, __webpack_exports__, __webpack_require__) {
|
|
7586
7808
|
|
|
7587
7809
|
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
7588
7810
|
__webpack_require__.r(__webpack_exports__);
|
|
7589
7811
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7590
|
-
/* harmony export */
|
|
7812
|
+
/* harmony export */ renderFieldValue: () => (/* binding */ renderFieldValue)
|
|
7591
7813
|
/* harmony export */ });
|
|
7592
7814
|
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2a080a730149");
|
|
7593
|
-
/* harmony import */ var
|
|
7594
|
-
/* harmony import */ var
|
|
7595
|
-
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([lit__WEBPACK_IMPORTED_MODULE_0__,
|
|
7596
|
-
([lit__WEBPACK_IMPORTED_MODULE_0__,
|
|
7815
|
+
/* harmony import */ var _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("e5483002f3ea");
|
|
7816
|
+
/* harmony import */ var _set_fields_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("db94c32f22be");
|
|
7817
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__, _set_fields_js__WEBPACK_IMPORTED_MODULE_2__]);
|
|
7818
|
+
([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__, _set_fields_js__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
|
|
7597
7819
|
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lit__WEBPACK_IMPORTED_MODULE_0__);
|
|
7598
7820
|
|
|
7599
7821
|
|
|
7600
|
-
//
|
|
7601
|
-
//
|
|
7602
|
-
//
|
|
7603
|
-
//
|
|
7604
|
-
//
|
|
7605
|
-
//
|
|
7822
|
+
// One field's value, shown or edited, drawn by the SIMAI Framework field
|
|
7823
|
+
// renderers. Moved out of the record component's template (sf-view-properties
|
|
7824
|
+
// 1.10.0) so that every view of the set that draws a field draws it the same
|
|
7825
|
+
// way: sf-view-properties and sf-view-flow import this, and neither
|
|
7826
|
+
// has field code of its own (reuse rule, naming decision 2026-11-02).
|
|
7827
|
+
//
|
|
7828
|
+
// `context` is what the caller's template reads:
|
|
7829
|
+
// component changeField(field, value), reportFieldError(field, message),
|
|
7830
|
+
// openReference(field, value); with the uploads and the
|
|
7831
|
+
// picker methods when canUploadFiles / canPickRecords
|
|
7832
|
+
// changed a Map of the values typed and not saved yet, by key
|
|
7833
|
+
// size '1' or '1/2', the renderers' size
|
|
7834
|
+
// viewHost the host the view renderers read (formatFieldValue)
|
|
7835
|
+
// emptyText what an empty value reads as
|
|
7836
|
+
// canUploadFiles, canPickRecords whether the host offers those
|
|
7606
7837
|
|
|
7607
7838
|
function renderFieldValue(context, field, editing, {
|
|
7608
7839
|
disabled = false
|
|
@@ -7625,20 +7856,35 @@ function renderFieldValue(context, field, editing, {
|
|
|
7625
7856
|
setFieldOptionSearch: (target, text) => context.component.setFieldOptionSearch(target, text),
|
|
7626
7857
|
loadFieldOptions: (target, request) => context.component.loadFieldOptions(target, request)
|
|
7627
7858
|
} : {})
|
|
7628
|
-
}; //
|
|
7859
|
+
}; // Money, a percent, rows and the compound fields are the set's own
|
|
7860
|
+
// (js/set-fields.js, Larena addendum of 2026-11-03): drawn from Framework
|
|
7861
|
+
// controls, with the edit host above, before the Framework renderers are
|
|
7862
|
+
// asked for a type they do not draw.
|
|
7863
|
+
|
|
7864
|
+
const own = (0,_set_fields_js__WEBPACK_IMPORTED_MODULE_2__.renderSetField)(field, context.changed.has(key) && editing ? context.changed.get(key) : field.value, editing, editHost, {
|
|
7865
|
+
node: context.component,
|
|
7866
|
+
size: context.size,
|
|
7867
|
+
viewHost: context.viewHost,
|
|
7868
|
+
disabled
|
|
7869
|
+
});
|
|
7870
|
+
|
|
7871
|
+
if (own !== null) {
|
|
7872
|
+
return own === lit__WEBPACK_IMPORTED_MODULE_0__.nothing ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-property-view-empty color-on-surface-variant">${context.emptyText}</span>` : own;
|
|
7873
|
+
} // A datetime and a time of day are the renderer set's: sf-input-date in
|
|
7629
7874
|
// mode datetime and time, one control each (SIMAI Framework duplication
|
|
7630
7875
|
// audit A-14). This view drew its own pair -- the day in a datepicker and
|
|
7631
7876
|
// the time in a masked field -- which cut the day short in a half-width
|
|
7632
7877
|
// field and held half-typed entries of its own.
|
|
7633
7878
|
|
|
7634
|
-
|
|
7879
|
+
|
|
7880
|
+
const content = editing ? (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__.renderEditField)(field, context.changed.has(key) ? context.changed.get(key) : field.value, editHost, // A field its condition turns off is drawn disabled where the set
|
|
7635
7881
|
// draws disabled apart from read-only (a choice as buttons).
|
|
7636
7882
|
{
|
|
7637
7883
|
size: context.size,
|
|
7638
7884
|
...(disabled ? {
|
|
7639
7885
|
disabled: true
|
|
7640
7886
|
} : {})
|
|
7641
|
-
}) : (0,
|
|
7887
|
+
}) : (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__.renderViewField)(field, field.value, context.viewHost, {
|
|
7642
7888
|
size: context.size
|
|
7643
7889
|
});
|
|
7644
7890
|
const reference = ['record', 'relation', 'user'].includes(field.propertyType || field.type) && field.value && typeof field.value === 'object';
|
|
@@ -7665,7 +7911,7 @@ function renderFieldValue(context, field, editing, {
|
|
|
7665
7911
|
|
|
7666
7912
|
|
|
7667
7913
|
if (editing && (content === null || typeof content === 'undefined' || content === lit__WEBPACK_IMPORTED_MODULE_0__.nothing)) {
|
|
7668
|
-
const shown = (0,
|
|
7914
|
+
const shown = (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_1__.renderViewField)(field, field.value, context.viewHost, {
|
|
7669
7915
|
size: context.size
|
|
7670
7916
|
});
|
|
7671
7917
|
|
|
@@ -7679,165 +7925,1496 @@ function renderFieldValue(context, field, editing, {
|
|
|
7679
7925
|
}
|
|
7680
7926
|
|
|
7681
7927
|
return content;
|
|
7682
|
-
}
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
// arrangement being edited.
|
|
7928
|
+
}
|
|
7929
|
+
__webpack_async_result__();
|
|
7930
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
7686
7931
|
|
|
7932
|
+
/***/ },
|
|
7687
7933
|
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
} // The chooser names the layers this person may write and nothing else. A layer
|
|
7691
|
-
// they may not write is drawn disabled with the host's own reason on it rather
|
|
7692
|
-
// than left out, because a «Для всех» that is simply absent reads as a feature
|
|
7693
|
-
// the product does not have.
|
|
7694
|
-
// The controls of the arranging mode live in the bar at the foot (owner,
|
|
7695
|
-
// 2026-10-08), where saving, cancelling and deleting live when a group is being
|
|
7696
|
-
// edited: the foot is where a mode's own answers belong, and a band of them
|
|
7697
|
-
// under the head pushed the record down by a row it did not need.
|
|
7934
|
+
/***/ "d69ebe7e288e"
|
|
7935
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7698
7936
|
|
|
7937
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7938
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
7939
|
+
/* harmony export */ currencyOf: () => (/* binding */ currencyOf),
|
|
7940
|
+
/* harmony export */ formatMoney: () => (/* binding */ formatMoney),
|
|
7941
|
+
/* harmony export */ moneyParts: () => (/* binding */ moneyParts),
|
|
7942
|
+
/* harmony export */ percentText: () => (/* binding */ percentText)
|
|
7943
|
+
/* harmony export */ });
|
|
7944
|
+
/* harmony import */ var _decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f44b979883f0");
|
|
7945
|
+
// Money and percent as a person reads them, from decimal strings, never a
|
|
7946
|
+
// float: the currency's sign and minor units come from Intl, the digits from
|
|
7947
|
+
// ./decimal.js. Pure, so the unit suite reads it without a browser.
|
|
7699
7948
|
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
// has it -- a standalone «Настроить вид» link stood as its own band under the
|
|
7703
|
-
// head and was one of the two empty-looking rows the owner saw.
|
|
7949
|
+
const CURRENCY = new Map();
|
|
7950
|
+
/** {sign, before, minor}: the sign a locale writes, whether before the amount, and the ISO 4217 minor units. */
|
|
7704
7951
|
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
// for everyone is written for everyone, a personal one for its person --
|
|
7708
|
-
// so the «Персональный / Для всех» toggle that stood beside the chooser
|
|
7709
|
-
// said the same thing twice and is gone (owner, 2026-10-14).
|
|
7710
|
-
// Which named view is being arranged, chosen, made, renamed and removed in
|
|
7711
|
-
// the Framework's profile picker (owner, 2026-10-14) -- the one the admin
|
|
7712
|
-
// menu's profiles use.
|
|
7952
|
+
function currencyOf(code, locale) {
|
|
7953
|
+
const id = `${code}|${locale}`;
|
|
7713
7954
|
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7955
|
+
if (!CURRENCY.has(id)) {
|
|
7956
|
+
let sign = code;
|
|
7957
|
+
let before = false;
|
|
7958
|
+
let minor = 2;
|
|
7959
|
+
|
|
7960
|
+
try {
|
|
7961
|
+
const format = new Intl.NumberFormat(locale, {
|
|
7962
|
+
style: 'currency',
|
|
7963
|
+
currency: code,
|
|
7964
|
+
currencyDisplay: 'narrowSymbol'
|
|
7965
|
+
});
|
|
7966
|
+
const parts = format.formatToParts(1);
|
|
7967
|
+
const at = parts.findIndex(part => part.type === 'currency');
|
|
7968
|
+
sign = parts[at]?.value ?? code;
|
|
7969
|
+
before = at < parts.findIndex(part => part.type === 'integer');
|
|
7970
|
+
minor = format.resolvedOptions().maximumFractionDigits;
|
|
7971
|
+
} catch {// A code Intl does not know keeps its letters and two minor digits.
|
|
7731
7972
|
}
|
|
7732
|
-
}}
|
|
7733
|
-
@sf-profile-picker-select=${event => context.component.selectViewProfile(event.detail.id)}
|
|
7734
|
-
@sf-profile-picker-create=${event => context.component.createViewProfile(event.detail.label, {
|
|
7735
|
-
shared: event.detail.shared
|
|
7736
|
-
})}
|
|
7737
|
-
@sf-profile-picker-rename=${event => context.component.renameViewProfile(event.detail.id, event.detail.label)}
|
|
7738
|
-
@sf-profile-picker-delete=${event => context.component.deleteViewProfile(event.detail.id)}
|
|
7739
|
-
></sf-profile-picker>`;
|
|
7740
|
-
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
7741
|
-
<div class="sf-property-view-actions sf-property-view-configure-bar flex items-cross-center gap-2 flex-wrap"
|
|
7742
|
-
data-configuring="true" role="group"
|
|
7743
|
-
aria-label=${context.configureText}>
|
|
7744
|
-
${chooser}
|
|
7745
|
-
<span class="grow"></span>
|
|
7746
|
-
${context.resetAsked ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
7747
|
-
<span class="sf-property-view-reset-ask color-error">${context.resetViewAskText}</span>
|
|
7748
|
-
<sf-button
|
|
7749
|
-
appearance="link"
|
|
7750
|
-
size=${context.size}
|
|
7751
|
-
status="error"
|
|
7752
|
-
text=${context.resetViewText}
|
|
7753
|
-
data-action="reset-view-confirm"
|
|
7754
|
-
@click=${() => context.component.resetView()}
|
|
7755
|
-
></sf-button>
|
|
7756
|
-
<sf-button
|
|
7757
|
-
appearance="outline"
|
|
7758
|
-
size=${context.size}
|
|
7759
|
-
text=${context.cancelConfiguringText}
|
|
7760
|
-
data-action="reset-view-cancel"
|
|
7761
|
-
@click=${() => context.component.cancelReset()}
|
|
7762
|
-
></sf-button>` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
7763
|
-
<!-- Reset, cancel, done: the further a control reaches, the
|
|
7764
|
-
quieter it is drawn. Reset takes the whole layer away
|
|
7765
|
-
and asks first; cancel puts back the arrangement this
|
|
7766
|
-
mode was entered with; done keeps what is there. -->
|
|
7767
|
-
<sf-button
|
|
7768
|
-
appearance="link"
|
|
7769
|
-
size=${context.size}
|
|
7770
|
-
text=${context.resetViewText}
|
|
7771
|
-
data-action="reset-view"
|
|
7772
|
-
@click=${() => context.component.askReset()}
|
|
7773
|
-
></sf-button>
|
|
7774
|
-
<sf-button
|
|
7775
|
-
appearance="outline"
|
|
7776
|
-
size=${context.size}
|
|
7777
|
-
text=${context.cancelConfiguringText}
|
|
7778
|
-
data-action="cancel-configuring"
|
|
7779
|
-
@click=${() => context.component.cancelConfiguringView()}
|
|
7780
|
-
></sf-button>
|
|
7781
|
-
<sf-button
|
|
7782
|
-
appearance="default"
|
|
7783
|
-
size=${context.size}
|
|
7784
|
-
text=${context.doneConfiguringText}
|
|
7785
|
-
data-action="done-configuring"
|
|
7786
|
-
@click=${() => context.component.stopConfiguringView()}
|
|
7787
|
-
></sf-button>`}
|
|
7788
|
-
</div>
|
|
7789
|
-
`;
|
|
7790
|
-
} // Width, template variant and hint sit behind the field's own settings rather
|
|
7791
|
-
// than under every field at once. Drawn under each field they were four controls
|
|
7792
|
-
// per row, so a group of eight fields was thirty-two controls and the
|
|
7793
|
-
// arrangement -- the thing being edited -- could no longer be read.
|
|
7794
7973
|
|
|
7974
|
+
CURRENCY.set(id, {
|
|
7975
|
+
sign,
|
|
7976
|
+
before,
|
|
7977
|
+
minor
|
|
7978
|
+
});
|
|
7979
|
+
}
|
|
7795
7980
|
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7981
|
+
return CURRENCY.get(id);
|
|
7982
|
+
}
|
|
7983
|
+
/** An amount with its currency, as a person reads it: «1 500,50 ₽», «$1,500.50». */
|
|
7984
|
+
|
|
7985
|
+
function formatMoney(amount, code, locale) {
|
|
7986
|
+
if (!code) return (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.formatDecimal)(amount, locale);
|
|
7987
|
+
const {
|
|
7988
|
+
sign,
|
|
7989
|
+
before,
|
|
7990
|
+
minor
|
|
7991
|
+
} = currencyOf(code, locale);
|
|
7992
|
+
const number = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.formatDecimal)(amount, locale, {
|
|
7993
|
+
minFraction: minor
|
|
7994
|
+
});
|
|
7995
|
+
if (!number) return '';
|
|
7996
|
+
return before ? `${sign}${number}` : `${number} ${sign}`;
|
|
7997
|
+
}
|
|
7998
|
+
/** A money value as {amount, currency}; a field that fixes the currency takes a bare amount. */
|
|
7999
|
+
|
|
8000
|
+
function moneyParts(value, fixed) {
|
|
8001
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
8002
|
+
return {
|
|
8003
|
+
amount: value.amount ?? null,
|
|
8004
|
+
currency: fixed || (value.currency ?? null)
|
|
8005
|
+
};
|
|
8006
|
+
}
|
|
8007
|
+
|
|
8008
|
+
if (value === null || typeof value === 'undefined' || value === '') return {
|
|
8009
|
+
amount: null,
|
|
8010
|
+
currency: fixed || null
|
|
8011
|
+
};
|
|
8012
|
+
return {
|
|
8013
|
+
amount: value,
|
|
8014
|
+
currency: fixed || null
|
|
8015
|
+
};
|
|
8016
|
+
}
|
|
8017
|
+
function percentText(value, locale) {
|
|
8018
|
+
const number = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.formatDecimal)(value, locale);
|
|
8019
|
+
if (!number) return ''; // ru-RU writes «12,5 %», en «12.5%»: the space is the locale's, read from Intl.
|
|
8020
|
+
|
|
8021
|
+
let spaced = false;
|
|
8022
|
+
|
|
8023
|
+
try {
|
|
8024
|
+
spaced = new Intl.NumberFormat(locale, {
|
|
8025
|
+
style: 'percent'
|
|
8026
|
+
}).formatToParts(0.5).some(part => part.type === 'literal' && /\s/u.test(part.value));
|
|
8027
|
+
} catch {
|
|
8028
|
+
spaced = false;
|
|
8029
|
+
}
|
|
8030
|
+
|
|
8031
|
+
return `${number}${spaced ? ' ' : ''}%`;
|
|
8032
|
+
}
|
|
8033
|
+
|
|
8034
|
+
/***/ },
|
|
8035
|
+
|
|
8036
|
+
/***/ "06dfc7b3b9d9"
|
|
8037
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8038
|
+
|
|
8039
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8040
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8041
|
+
/* harmony export */ REQUISITE_PARTS: () => (/* binding */ REQUISITE_PARTS),
|
|
8042
|
+
/* harmony export */ innValid: () => (/* binding */ innValid),
|
|
8043
|
+
/* harmony export */ ogrnValid: () => (/* binding */ ogrnValid),
|
|
8044
|
+
/* harmony export */ requisiteErrors: () => (/* binding */ requisiteErrors)
|
|
8045
|
+
/* harmony export */ });
|
|
8046
|
+
// The checks of Russian requisites (Larena property types standard, notes of
|
|
8047
|
+
// 2026-11-03, `ru.requisites@1`): each part on its own, and the parts that go
|
|
8048
|
+
// together, together. The server checks the same and is the authority; these
|
|
8049
|
+
// are here so a person sees a mistyped ИНН under the field instead of a refused
|
|
8050
|
+
// save after it.
|
|
8051
|
+
//
|
|
8052
|
+
// Every check answers the key of the words that explain the mistake, or null.
|
|
8053
|
+
const REQUISITE_PARTS = Object.freeze(['inn', 'kpp', 'ogrn', 'bik', 'account', 'corr_account']);
|
|
8054
|
+
|
|
8055
|
+
const digitsOf = text => [...text].map(Number);
|
|
8056
|
+
|
|
8057
|
+
const weighted = (digits, weights) => weights.reduce((sum, weight, index) => sum + weight * digits[index], 0);
|
|
8058
|
+
|
|
8059
|
+
function innValid(inn) {
|
|
8060
|
+
if (!/^\d{10}$|^\d{12}$/u.test(inn)) return false;
|
|
8061
|
+
const d = digitsOf(inn);
|
|
8062
|
+
if (inn.length === 10) return weighted(d, [2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11 % 10 === d[9];
|
|
8063
|
+
const eleventh = weighted(d, [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11 % 10;
|
|
8064
|
+
const twelfth = weighted(d, [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]) % 11 % 10;
|
|
8065
|
+
return eleventh === d[10] && twelfth === d[11];
|
|
8066
|
+
}
|
|
8067
|
+
function ogrnValid(ogrn) {
|
|
8068
|
+
if (!/^\d{13}$|^\d{15}$/u.test(ogrn)) return false;
|
|
8069
|
+
const body = BigInt(ogrn.slice(0, -1));
|
|
8070
|
+
const modulus = ogrn.length === 13 ? 11n : 13n;
|
|
8071
|
+
return Number(body % modulus % 10n) === Number(ogrn.at(-1));
|
|
8072
|
+
} // An account is checked with the БИК by the Bank of Russia key: the three
|
|
8073
|
+
// digits that come before it, then its twenty, weighted 7, 1, 3 in turn, add up
|
|
8074
|
+
// to a multiple of ten. A settlement account takes the БИК's last three digits;
|
|
8075
|
+
// a correspondent account takes «0» and the БИК's fifth and sixth.
|
|
8076
|
+
|
|
8077
|
+
function accountKeyValid(prefix, account) {
|
|
8078
|
+
const digits = digitsOf(prefix + account);
|
|
8079
|
+
const sum = digits.reduce((total, digit, index) => total + digit * [7, 1, 3][index % 3], 0);
|
|
8080
|
+
return sum % 10 === 0;
|
|
8081
|
+
}
|
|
8082
|
+
/** The mistakes of a requisites value, part by part: {inn: 'innWrong', …}. */
|
|
8083
|
+
|
|
8084
|
+
|
|
8085
|
+
function requisiteErrors(value, parts = REQUISITE_PARTS) {
|
|
8086
|
+
const errors = {};
|
|
8087
|
+
|
|
8088
|
+
const has = part => parts.includes(part);
|
|
8089
|
+
|
|
8090
|
+
const of = part => String(value?.[part] ?? '');
|
|
8091
|
+
|
|
8092
|
+
const inn = of('inn');
|
|
8093
|
+
const kpp = of('kpp');
|
|
8094
|
+
const ogrn = of('ogrn');
|
|
8095
|
+
const bik = of('bik');
|
|
8096
|
+
const account = of('account');
|
|
8097
|
+
const corr = of('corr_account');
|
|
8098
|
+
|
|
8099
|
+
if (has('inn')) {
|
|
8100
|
+
// The ИНН is required (the standard): a value without one is no value.
|
|
8101
|
+
if (!inn) errors.inn = 'innRequired';else if (!/^\d{10}$|^\d{12}$/u.test(inn)) errors.inn = 'innLength';else if (!innValid(inn)) errors.inn = 'innWrong';
|
|
8102
|
+
}
|
|
8103
|
+
|
|
8104
|
+
const person = inn.length === 12;
|
|
8105
|
+
const organization = inn.length === 10;
|
|
8106
|
+
|
|
8107
|
+
if (has('kpp') && kpp) {
|
|
8108
|
+
if (!/^\d{4}[\dA-Z]{2}\d{3}$/u.test(kpp)) errors.kpp = 'kppWrong';else if (person) errors.kpp = 'kppPerson';
|
|
8109
|
+
}
|
|
8110
|
+
|
|
8111
|
+
if (has('ogrn') && ogrn) {
|
|
8112
|
+
if (!/^\d{13}$|^\d{15}$/u.test(ogrn)) errors.ogrn = 'ogrnLength';else if (!ogrnValid(ogrn)) errors.ogrn = 'ogrnWrong';else if (organization && ogrn.length !== 13) errors.ogrn = 'ogrnOrganization';else if (person && ogrn.length !== 15) errors.ogrn = 'ogrnPerson';
|
|
8113
|
+
}
|
|
8114
|
+
|
|
8115
|
+
const bikRight = /^04\d{7}$/u.test(bik);
|
|
8116
|
+
if (has('bik') && bik && !bikRight) errors.bik = 'bikWrong';
|
|
8117
|
+
|
|
8118
|
+
if (has('account') && account) {
|
|
8119
|
+
if (!/^\d{20}$/u.test(account)) errors.account = 'accountLength';else if (bikRight && !accountKeyValid(bik.slice(-3), account)) errors.account = 'accountKey';
|
|
8120
|
+
}
|
|
8121
|
+
|
|
8122
|
+
if (has('corr_account') && corr) {
|
|
8123
|
+
if (!/^\d{20}$/u.test(corr)) errors.corr_account = 'accountLength';else if (!corr.startsWith('301')) errors.corr_account = 'corrStart';else if (bikRight && !accountKeyValid(`0${bik.slice(4, 6)}`, corr)) errors.corr_account = 'accountKey';
|
|
8124
|
+
}
|
|
8125
|
+
|
|
8126
|
+
return errors;
|
|
8127
|
+
}
|
|
8128
|
+
|
|
8129
|
+
/***/ },
|
|
8130
|
+
|
|
8131
|
+
/***/ "ebc72103d8b6"
|
|
8132
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8133
|
+
|
|
8134
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8135
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8136
|
+
/* harmony export */ NUMERIC: () => (/* binding */ NUMERIC),
|
|
8137
|
+
/* harmony export */ cellDecimal: () => (/* binding */ cellDecimal),
|
|
8138
|
+
/* harmony export */ columnCurrency: () => (/* binding */ columnCurrency),
|
|
8139
|
+
/* harmony export */ columnOf: () => (/* binding */ columnOf),
|
|
8140
|
+
/* harmony export */ columnsOf: () => (/* binding */ columnsOf),
|
|
8141
|
+
/* harmony export */ computeRow: () => (/* binding */ computeRow),
|
|
8142
|
+
/* harmony export */ rowTotals: () => (/* binding */ rowTotals),
|
|
8143
|
+
/* harmony export */ rowsOf: () => (/* binding */ rowsOf)
|
|
8144
|
+
/* harmony export */ });
|
|
8145
|
+
/* harmony import */ var _decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f44b979883f0");
|
|
8146
|
+
/* harmony import */ var _money_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("d69ebe7e288e");
|
|
8147
|
+
|
|
8148
|
+
// Rows over columns (Larena property types standard, notes of 2026-11-03,
|
|
8149
|
+
// `items@1`): the columns as the set reads them, the computed cells of a row
|
|
8150
|
+
// and the totals under summed columns, on decimal strings. Pure, so the unit
|
|
8151
|
+
// suite reads it without a browser.
|
|
8152
|
+
|
|
8153
|
+
const NUMERIC = new Set(['integer', 'number', 'percent', 'money']); // A column as the set reads it: its settings beside its own keys, its type
|
|
8154
|
+
// under the name the renderers address (`propertyType`).
|
|
8155
|
+
|
|
8156
|
+
function columnOf(column) {
|
|
8157
|
+
const {
|
|
8158
|
+
settings,
|
|
8159
|
+
...own
|
|
8160
|
+
} = column ?? {};
|
|
8161
|
+
const type = own.propertyType || own.type;
|
|
8162
|
+
return { ...(settings && typeof settings === 'object' ? settings : {}),
|
|
8163
|
+
...own,
|
|
8164
|
+
propertyType: type,
|
|
8165
|
+
type
|
|
8166
|
+
};
|
|
8167
|
+
}
|
|
8168
|
+
function columnsOf(field) {
|
|
8169
|
+
return (Array.isArray(field.columns) ? field.columns : []).map(columnOf).filter(column => column.key);
|
|
8170
|
+
}
|
|
8171
|
+
function rowsOf(value) {
|
|
8172
|
+
return Array.isArray(value) ? value.map(row => row && typeof row === 'object' ? row : {}) : [];
|
|
8173
|
+
} // The decimal a numeric cell holds, or null.
|
|
8174
|
+
|
|
8175
|
+
function cellDecimal(column, cell) {
|
|
8176
|
+
if (cell === null || typeof cell === 'undefined' || cell === '') return null;
|
|
8177
|
+
if (column.propertyType === 'money') return (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.toDecimal)((0,_money_js__WEBPACK_IMPORTED_MODULE_1__.moneyParts)(cell, column.currency).amount);
|
|
8178
|
+
return (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.toDecimal)(cell);
|
|
8179
|
+
} // The currency a money column's cells are in: its own, else the one money
|
|
8180
|
+
// operand's when it is computed.
|
|
8181
|
+
|
|
8182
|
+
function columnCurrency(column, columns) {
|
|
8183
|
+
if (column.currency) return column.currency;
|
|
8184
|
+
|
|
8185
|
+
if (column.compute?.of) {
|
|
8186
|
+
const operand = columns.find(one => column.compute.of.includes(one.key) && one.propertyType === 'money');
|
|
8187
|
+
return operand?.currency ?? null;
|
|
8188
|
+
}
|
|
8189
|
+
|
|
8190
|
+
return null;
|
|
8191
|
+
}
|
|
8192
|
+
/**
|
|
8193
|
+
* A row with its computed cells worked out from the cells typed: a product of
|
|
8194
|
+
* two or three operands, a percent counting as its share, rounded half away
|
|
8195
|
+
* from zero to the currency's minor units or the column's `scale` (2 by
|
|
8196
|
+
* default). A computed cell whose operands are not all there is no cell. The
|
|
8197
|
+
* keys follow the columns, the computed ones last. The server works the same
|
|
8198
|
+
* out and is the authority.
|
|
8199
|
+
*/
|
|
8200
|
+
|
|
8201
|
+
function computeRow(row, columns, locale = 'en') {
|
|
8202
|
+
const typed = {};
|
|
8203
|
+
const computed = {};
|
|
8204
|
+
|
|
8205
|
+
for (const column of columns) {
|
|
8206
|
+
if (column.compute) continue;
|
|
8207
|
+
if (Object.hasOwn(row, column.key) && row[column.key] !== null && row[column.key] !== '') typed[column.key] = row[column.key];
|
|
8208
|
+
}
|
|
8209
|
+
|
|
8210
|
+
for (const column of columns) {
|
|
8211
|
+
if (!column.compute || column.compute.op !== 'multiply' || !Array.isArray(column.compute.of)) continue;
|
|
8212
|
+
let product = null;
|
|
8213
|
+
let currency = null;
|
|
8214
|
+
|
|
8215
|
+
for (const key of column.compute.of) {
|
|
8216
|
+
const operand = columns.find(one => one.key === key);
|
|
8217
|
+
const decimal = operand ? cellDecimal(operand, typed[key]) : null;
|
|
8218
|
+
|
|
8219
|
+
if (!decimal) {
|
|
8220
|
+
product = null;
|
|
8221
|
+
break;
|
|
8222
|
+
}
|
|
8223
|
+
|
|
8224
|
+
if (operand.propertyType === 'money') currency = (0,_money_js__WEBPACK_IMPORTED_MODULE_1__.moneyParts)(typed[key], operand.currency).currency;
|
|
8225
|
+
const factor = operand.propertyType === 'percent' ? (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.share)(decimal) : decimal;
|
|
8226
|
+
product = product ? (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.multiply)(product, factor) : factor;
|
|
8227
|
+
}
|
|
8228
|
+
|
|
8229
|
+
if (!product) continue;
|
|
8230
|
+
|
|
8231
|
+
if (column.propertyType === 'money') {
|
|
8232
|
+
const code = column.currency || currency;
|
|
8233
|
+
const scale = code ? (0,_money_js__WEBPACK_IMPORTED_MODULE_1__.currencyOf)(code, locale).minor : 2;
|
|
8234
|
+
computed[column.key] = {
|
|
8235
|
+
amount: (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.decimalString)((0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.round)(product, scale)),
|
|
8236
|
+
currency: code
|
|
8237
|
+
};
|
|
8238
|
+
} else {
|
|
8239
|
+
const scale = column.propertyType === 'integer' ? 0 : Number.isInteger(column.scale) ? column.scale : 2;
|
|
8240
|
+
computed[column.key] = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.decimalString)((0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.round)(product, scale));
|
|
8241
|
+
}
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8244
|
+
return { ...typed,
|
|
8245
|
+
...computed
|
|
8246
|
+
};
|
|
8247
|
+
}
|
|
8248
|
+
/** The sums of the columns marked `total: "sum"`, as decimals by key. */
|
|
8249
|
+
|
|
8250
|
+
function rowTotals(rows, columns) {
|
|
8251
|
+
const totals = {};
|
|
8252
|
+
|
|
8253
|
+
for (const column of columns) {
|
|
8254
|
+
if (column.total !== 'sum' || !NUMERIC.has(column.propertyType)) continue;
|
|
8255
|
+
let sum = {
|
|
8256
|
+
units: 0n,
|
|
8257
|
+
scale: 0
|
|
8258
|
+
};
|
|
8259
|
+
|
|
8260
|
+
for (const row of rows) {
|
|
8261
|
+
const decimal = cellDecimal(column, row[column.key]);
|
|
8262
|
+
if (decimal) sum = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_0__.add)(sum, decimal);
|
|
8263
|
+
}
|
|
8264
|
+
|
|
8265
|
+
totals[column.key] = sum;
|
|
8266
|
+
}
|
|
8267
|
+
|
|
8268
|
+
return totals;
|
|
8269
|
+
}
|
|
8270
|
+
|
|
8271
|
+
/***/ },
|
|
8272
|
+
|
|
8273
|
+
/***/ "db94c32f22be"
|
|
8274
|
+
(module, __webpack_exports__, __webpack_require__) {
|
|
8275
|
+
|
|
8276
|
+
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
8277
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8278
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8279
|
+
/* harmony export */ SET_FIELD_TYPES: () => (/* binding */ SET_FIELD_TYPES),
|
|
8280
|
+
/* harmony export */ drawsSetField: () => (/* binding */ drawsSetField),
|
|
8281
|
+
/* harmony export */ renderSetField: () => (/* binding */ renderSetField),
|
|
8282
|
+
/* harmony export */ setFieldText: () => (/* binding */ setFieldText)
|
|
8283
|
+
/* harmony export */ });
|
|
8284
|
+
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2a080a730149");
|
|
8285
|
+
/* harmony import */ var _set_fields_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("f59c8bcdc90a");
|
|
8286
|
+
/* harmony import */ var _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("e5483002f3ea");
|
|
8287
|
+
/* harmony import */ var _core_js_page_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("43090d1c8307");
|
|
8288
|
+
/* harmony import */ var _decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("f44b979883f0");
|
|
8289
|
+
/* harmony import */ var _money_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("d69ebe7e288e");
|
|
8290
|
+
/* harmony import */ var _rows_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("ebc72103d8b6");
|
|
8291
|
+
/* harmony import */ var _requisites_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("06dfc7b3b9d9");
|
|
8292
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__, _core_js_page_language__WEBPACK_IMPORTED_MODULE_3__]);
|
|
8293
|
+
([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__, _core_js_page_language__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
|
|
8294
|
+
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lit__WEBPACK_IMPORTED_MODULE_0__);
|
|
8295
|
+
/* harmony import */ var _core_js_page_language__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__);
|
|
8296
|
+
|
|
8297
|
+
|
|
8298
|
+
|
|
8299
|
+
|
|
8300
|
+
|
|
8301
|
+
|
|
8302
|
+
|
|
8303
|
+
// The property types the set draws itself, beside the SIMAI Framework field
|
|
8304
|
+
// renderers it draws every other type with (Larena addendum of 2026-11-03 to
|
|
8305
|
+
// the general components task, msg-bf1ad4f3ae00420bb752; Larena property types
|
|
8306
|
+
// standard, notes of 2026-11-03):
|
|
8307
|
+
//
|
|
8308
|
+
// money {amount, currency}: an amount and its ISO 4217 currency
|
|
8309
|
+
// percent a decimal with a % after it
|
|
8310
|
+
// items rows over the field's columns: a table editor, a card a row on a phone
|
|
8311
|
+
// compound a fixed set of parts with one value object, checked together
|
|
8312
|
+
// ru.requisites the compound of a Russian organisation's or person's requisites
|
|
8313
|
+
//
|
|
8314
|
+
// Each is drawn from Framework controls (sf-input with `text-end`, sf-dropdown,
|
|
8315
|
+
// sf-button-icon, sf-button) and, inside a row or a compound, by the Framework
|
|
8316
|
+
// renderers for the types they already draw. Every number is a decimal string
|
|
8317
|
+
// (./decimal.js): nothing here writes a float.
|
|
8318
|
+
//
|
|
8319
|
+
// A control writes what was typed. An entry that is not a value yet -- text
|
|
8320
|
+
// that is not a number, more digits after the point than the currency has, a
|
|
8321
|
+
// ИНН whose control digit is wrong -- is written as typed and reported through
|
|
8322
|
+
// setFieldError, which holds both saves while it stands (port 1.16.0, as a
|
|
8323
|
+
// masked string does), and the control says what is wrong under itself once
|
|
8324
|
+
// the person has left it.
|
|
8325
|
+
|
|
8326
|
+
const TEXT = {
|
|
8327
|
+
en: {
|
|
8328
|
+
currency: 'Currency',
|
|
8329
|
+
notNumber: 'Enter a number',
|
|
8330
|
+
fractionMax: 'At most {n} digits after the point',
|
|
8331
|
+
fractionNone: 'A whole amount, no digits after the point',
|
|
8332
|
+
chooseCurrency: 'Choose a currency',
|
|
8333
|
+
range: 'From {min} to {max}',
|
|
8334
|
+
atLeast: 'At least {min}',
|
|
8335
|
+
atMost: 'At most {max}',
|
|
8336
|
+
addRow: 'Add a row',
|
|
8337
|
+
removeRow: 'Remove the row',
|
|
8338
|
+
rowUp: 'Move the row up',
|
|
8339
|
+
rowDown: 'Move the row down',
|
|
8340
|
+
row: 'Row {n}',
|
|
8341
|
+
total: 'Total',
|
|
8342
|
+
cellsWrong: 'Some cells are not filled in correctly',
|
|
8343
|
+
rows: '{n} rows',
|
|
8344
|
+
row1: '1 row',
|
|
8345
|
+
inn: 'INN',
|
|
8346
|
+
kpp: 'KPP',
|
|
8347
|
+
ogrn: 'OGRN',
|
|
8348
|
+
bik: 'BIK',
|
|
8349
|
+
account: 'Account',
|
|
8350
|
+
corr_account: 'Correspondent account',
|
|
8351
|
+
innRequired: 'The INN is required',
|
|
8352
|
+
innLength: '10 digits for an organisation, 12 for a person',
|
|
8353
|
+
innWrong: 'The INN control digits do not match',
|
|
8354
|
+
kppWrong: 'Nine characters: four digits, two digits or letters, three digits',
|
|
8355
|
+
kppPerson: 'A person\'s INN has no KPP',
|
|
8356
|
+
ogrnLength: '13 digits (OGRN) or 15 (OGRNIP)',
|
|
8357
|
+
ogrnWrong: 'The control digit does not match',
|
|
8358
|
+
ogrnOrganization: 'An organisation has a 13-digit OGRN',
|
|
8359
|
+
ogrnPerson: 'A person has a 15-digit OGRNIP',
|
|
8360
|
+
bikWrong: 'Nine digits starting with 04',
|
|
8361
|
+
accountLength: '20 digits',
|
|
8362
|
+
accountKey: 'The account does not match the BIK',
|
|
8363
|
+
corrStart: 'A correspondent account starts with 301'
|
|
8364
|
+
},
|
|
8365
|
+
ru: {
|
|
8366
|
+
currency: 'Валюта',
|
|
8367
|
+
notNumber: 'Введите число',
|
|
8368
|
+
fractionMax: 'Не больше {n} знаков после запятой',
|
|
8369
|
+
fractionNone: 'Целая сумма, без знаков после запятой',
|
|
8370
|
+
chooseCurrency: 'Выберите валюту',
|
|
8371
|
+
range: 'От {min} до {max}',
|
|
8372
|
+
atLeast: 'Не меньше {min}',
|
|
8373
|
+
atMost: 'Не больше {max}',
|
|
8374
|
+
addRow: 'Добавить строку',
|
|
8375
|
+
removeRow: 'Удалить строку',
|
|
8376
|
+
rowUp: 'Поднять строку',
|
|
8377
|
+
rowDown: 'Опустить строку',
|
|
8378
|
+
row: 'Строка {n}',
|
|
8379
|
+
total: 'Итого',
|
|
8380
|
+
cellsWrong: 'Не все ячейки заполнены верно',
|
|
8381
|
+
rows: '{n} строк',
|
|
8382
|
+
row1: '1 строка',
|
|
8383
|
+
inn: 'ИНН',
|
|
8384
|
+
kpp: 'КПП',
|
|
8385
|
+
ogrn: 'ОГРН',
|
|
8386
|
+
bik: 'БИК',
|
|
8387
|
+
account: 'Расчётный счёт',
|
|
8388
|
+
corr_account: 'Корр. счёт',
|
|
8389
|
+
innRequired: 'ИНН обязателен',
|
|
8390
|
+
innLength: '10 цифр у организации, 12 у физлица',
|
|
8391
|
+
innWrong: 'Не сходятся контрольные цифры ИНН',
|
|
8392
|
+
kppWrong: 'Девять знаков: четыре цифры, две цифры или буквы, три цифры',
|
|
8393
|
+
kppPerson: 'У ИНН физлица нет КПП',
|
|
8394
|
+
ogrnLength: '13 цифр (ОГРН) или 15 (ОГРНИП)',
|
|
8395
|
+
ogrnWrong: 'Не сходится контрольная цифра',
|
|
8396
|
+
ogrnOrganization: 'У организации ОГРН из 13 цифр',
|
|
8397
|
+
ogrnPerson: 'У физлица ОГРНИП из 15 цифр',
|
|
8398
|
+
bikWrong: 'Девять цифр, начиная с 04',
|
|
8399
|
+
accountLength: '20 цифр',
|
|
8400
|
+
accountKey: 'Счёт не сходится с БИК',
|
|
8401
|
+
corrStart: 'Корр. счёт начинается с 301'
|
|
8402
|
+
}
|
|
8403
|
+
};
|
|
8404
|
+
const WORDS_OF = 'sf-view-properties';
|
|
8405
|
+
|
|
8406
|
+
function word(node, key, vars = {}) {
|
|
8407
|
+
let text = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageText)(TEXT, key, node, WORDS_OF);
|
|
8408
|
+
|
|
8409
|
+
for (const [name, value] of Object.entries(vars)) text = text.replaceAll(`{${name}}`, String(value));
|
|
8410
|
+
|
|
8411
|
+
return text;
|
|
8412
|
+
} // ru counts: 1 строка, 2–4 строки, 5+ строк.
|
|
8413
|
+
|
|
8414
|
+
|
|
8415
|
+
function rowsWord(node, count) {
|
|
8416
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
8417
|
+
if (count === 1) return word(node, 'row1');
|
|
8418
|
+
|
|
8419
|
+
if (locale.startsWith('ru')) {
|
|
8420
|
+
const tens = count % 100;
|
|
8421
|
+
const ones = count % 10;
|
|
8422
|
+
if (ones >= 2 && ones <= 4 && (tens < 12 || tens > 14)) return `${count} строки`;
|
|
8423
|
+
}
|
|
8424
|
+
|
|
8425
|
+
return word(node, 'rows', {
|
|
8426
|
+
n: count
|
|
8427
|
+
});
|
|
8428
|
+
}
|
|
8429
|
+
|
|
8430
|
+
const SET_FIELD_TYPES = Object.freeze(['money', 'percent', 'items', 'compound', 'ru.requisites']); // --- Currencies -------------------------------------------------------------
|
|
8431
|
+
// The currencies a money field offers when it does not fix one: the ones a
|
|
8432
|
+
// Russian-language business meets most, and the value's own currency first
|
|
8433
|
+
// when it is none of them. A field that fixes `currency` offers no choice.
|
|
8434
|
+
|
|
8435
|
+
const OFFERED_CURRENCIES = ['RUB', 'USD', 'EUR', 'CNY', 'KZT', 'BYN', 'AED', 'TRY', 'GBP', 'JPY']; // --- What a person is typing -------------------------------------------------
|
|
8436
|
+
// The text in a decimal input while it is being typed. The value written is
|
|
8437
|
+
// canonical («12.5»); drawn back as such it would move the caret under the
|
|
8438
|
+
// person typing «12,50». So the typed text is kept per control and shown while
|
|
8439
|
+
// it still reads as the value, and dropped when the control is left.
|
|
8440
|
+
|
|
8441
|
+
const DRAFTS = new WeakMap();
|
|
8442
|
+
|
|
8443
|
+
const draftsOf = node => {
|
|
8444
|
+
if (!DRAFTS.has(node)) DRAFTS.set(node, new Map());
|
|
8445
|
+
return DRAFTS.get(node);
|
|
8446
|
+
}; // The controls a person has left: a message stands under a control only then,
|
|
8447
|
+
// as a masked string's does.
|
|
8448
|
+
|
|
8449
|
+
|
|
8450
|
+
const LEFT = new WeakMap();
|
|
8451
|
+
|
|
8452
|
+
const leftOf = node => {
|
|
8453
|
+
if (!LEFT.has(node)) LEFT.set(node, new Set());
|
|
8454
|
+
return LEFT.get(node);
|
|
8455
|
+
};
|
|
8456
|
+
|
|
8457
|
+
const redraw = node => node?.requestComponentUpdate?.('changed');
|
|
8458
|
+
|
|
8459
|
+
function shownText(node, path, value, locale) {
|
|
8460
|
+
const draft = draftsOf(node).get(path);
|
|
8461
|
+
const read = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(value);
|
|
8462
|
+
if (!read.ok) return String(value ?? '');
|
|
8463
|
+
|
|
8464
|
+
if (typeof draft === 'string') {
|
|
8465
|
+
const typed = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(draft);
|
|
8466
|
+
if (typed.ok && typed.value === read.value) return draft;
|
|
8467
|
+
}
|
|
8468
|
+
|
|
8469
|
+
return (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.editableDecimal)(read.value, locale);
|
|
8470
|
+
} // The mistake of a typed decimal, or null: not a number, more digits after the
|
|
8471
|
+
// point than allowed, outside the bounds.
|
|
8472
|
+
|
|
8473
|
+
|
|
8474
|
+
function decimalError(node, raw, {
|
|
8475
|
+
maxFraction = null,
|
|
8476
|
+
min = null,
|
|
8477
|
+
max = null
|
|
8478
|
+
} = {}) {
|
|
8479
|
+
const read = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(raw);
|
|
8480
|
+
if (!read.ok) return word(node, 'notNumber');
|
|
8481
|
+
if (read.value === null) return null;
|
|
8482
|
+
|
|
8483
|
+
if (maxFraction !== null && (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.fractionDigits)(read.value) > maxFraction) {
|
|
8484
|
+
return maxFraction === 0 ? word(node, 'fractionNone') : word(node, 'fractionMax', {
|
|
8485
|
+
n: maxFraction
|
|
8486
|
+
});
|
|
8487
|
+
}
|
|
8488
|
+
|
|
8489
|
+
const value = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.toDecimal)(read.value);
|
|
8490
|
+
const low = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.toDecimal)(min);
|
|
8491
|
+
const high = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.toDecimal)(max);
|
|
8492
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
8493
|
+
|
|
8494
|
+
if (low && (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.compare)(value, low) < 0 || high && (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.compare)(value, high) > 0) {
|
|
8495
|
+
if (low && high) return word(node, 'range', {
|
|
8496
|
+
min: (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.formatDecimal)(min, locale),
|
|
8497
|
+
max: (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.formatDecimal)(max, locale)
|
|
8498
|
+
});
|
|
8499
|
+
return low ? word(node, 'atLeast', {
|
|
8500
|
+
min: (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.formatDecimal)(min, locale)
|
|
8501
|
+
}) : word(node, 'atMost', {
|
|
8502
|
+
max: (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.formatDecimal)(max, locale)
|
|
8503
|
+
});
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8506
|
+
return null;
|
|
8507
|
+
}
|
|
8508
|
+
/**
|
|
8509
|
+
* One decimal input: sf-input with the decimal keyboard and `text-end` (a % or
|
|
8510
|
+
* a currency sign). `write(text, error)` gets what was typed -- canonical when
|
|
8511
|
+
* it reads as a number -- and the mistake, or null.
|
|
8512
|
+
*/
|
|
8513
|
+
|
|
8514
|
+
|
|
8515
|
+
function decimalInput(node, {
|
|
8516
|
+
path,
|
|
8517
|
+
value,
|
|
8518
|
+
size,
|
|
8519
|
+
label,
|
|
8520
|
+
required,
|
|
8521
|
+
textEnd,
|
|
8522
|
+
placeholder,
|
|
8523
|
+
check,
|
|
8524
|
+
write
|
|
8525
|
+
}) {
|
|
8526
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
8527
|
+
const text = shownText(node, path, value, locale);
|
|
8528
|
+
const error = check(text);
|
|
8529
|
+
const shown = error && leftOf(node).has(path) ? error : '';
|
|
8530
|
+
|
|
8531
|
+
const typed = event => {
|
|
8532
|
+
const raw = event.target?.value ?? '';
|
|
8533
|
+
draftsOf(node).set(path, raw);
|
|
8534
|
+
const read = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(raw);
|
|
8535
|
+
write(read.ok ? read.value : raw, check(raw));
|
|
8536
|
+
};
|
|
8537
|
+
|
|
8538
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8539
|
+
<sf-input
|
|
8540
|
+
class="sf-view-fields-decimal"
|
|
8541
|
+
size=${size}
|
|
8542
|
+
appearance="bordered"
|
|
8543
|
+
inputmode="decimal"
|
|
8544
|
+
value=${text}
|
|
8545
|
+
text-end=${textEnd || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8546
|
+
placeholder=${placeholder || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8547
|
+
?required=${Boolean(required)}
|
|
8548
|
+
?invalid=${Boolean(shown)}
|
|
8549
|
+
error-message=${shown || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8550
|
+
aria-label=${label || ''}
|
|
8551
|
+
data-path=${path}
|
|
8552
|
+
@input=${typed}
|
|
8553
|
+
@change=${typed}
|
|
8554
|
+
@focusout=${() => {
|
|
8555
|
+
draftsOf(node).delete(path);
|
|
8556
|
+
leftOf(node).add(path);
|
|
8557
|
+
redraw(node);
|
|
8558
|
+
}}
|
|
8559
|
+
></sf-input>
|
|
8560
|
+
`;
|
|
8561
|
+
} // --- percent -------------------------------------------------------------------
|
|
8562
|
+
|
|
8563
|
+
|
|
8564
|
+
function percentBounds(field) {
|
|
8565
|
+
// 0 and 100 when the field sets none (property types standard §2).
|
|
8566
|
+
return {
|
|
8567
|
+
min: field.min ?? '0',
|
|
8568
|
+
max: field.max ?? '100'
|
|
8569
|
+
};
|
|
8570
|
+
}
|
|
8571
|
+
|
|
8572
|
+
function renderPercentEdit(field, value, host, ctx) {
|
|
8573
|
+
const {
|
|
8574
|
+
min,
|
|
8575
|
+
max
|
|
8576
|
+
} = percentBounds(field);
|
|
8577
|
+
return decimalInput(ctx.node, {
|
|
8578
|
+
path: ctx.path ?? String(field.key ?? ''),
|
|
8579
|
+
value,
|
|
8580
|
+
size: ctx.size,
|
|
8581
|
+
label: field.label || field.key,
|
|
8582
|
+
required: field.required,
|
|
8583
|
+
textEnd: '%',
|
|
8584
|
+
placeholder: field.placeholder,
|
|
8585
|
+
check: text => decimalError(ctx.node, text, {
|
|
8586
|
+
min,
|
|
8587
|
+
max
|
|
8588
|
+
}),
|
|
8589
|
+
write: (next, error) => {
|
|
8590
|
+
host.setFieldValue(field, next);
|
|
8591
|
+
host.setFieldError?.(field, error);
|
|
8592
|
+
}
|
|
8593
|
+
});
|
|
8594
|
+
}
|
|
8595
|
+
|
|
8596
|
+
function renderPercentView(field, value, ctx) {
|
|
8597
|
+
const text = (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.percentText)(value, (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(ctx.node));
|
|
8598
|
+
return text ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view">${text}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing;
|
|
8599
|
+
} // --- money ---------------------------------------------------------------------
|
|
8600
|
+
|
|
8601
|
+
|
|
8602
|
+
function renderMoneyEdit(field, value, host, ctx) {
|
|
8603
|
+
const node = ctx.node;
|
|
8604
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
8605
|
+
const path = ctx.path ?? String(field.key ?? '');
|
|
8606
|
+
const fixed = typeof field.currency === 'string' && field.currency ? field.currency : null;
|
|
8607
|
+
const parts = (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.moneyParts)(value, fixed); // A currency chosen before an amount is typed waits here: a value is an
|
|
8608
|
+
// amount and its currency, never a currency alone.
|
|
8609
|
+
|
|
8610
|
+
const currencyPath = `${path}#currency`;
|
|
8611
|
+
const currency = parts.currency || draftsOf(node).get(currencyPath) || null;
|
|
8612
|
+
const minor = currency ? (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.currencyOf)(currency, locale).minor : null;
|
|
8613
|
+
|
|
8614
|
+
const check = text => {
|
|
8615
|
+
const error = decimalError(node, text, {
|
|
8616
|
+
maxFraction: minor,
|
|
8617
|
+
min: field.min ?? null,
|
|
8618
|
+
max: field.max ?? null
|
|
8619
|
+
});
|
|
8620
|
+
if (error) return error;
|
|
8621
|
+
return (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(text).value !== null && !currency ? word(node, 'chooseCurrency') : null;
|
|
8622
|
+
};
|
|
8623
|
+
|
|
8624
|
+
const write = (amount, error, code = currency) => {
|
|
8625
|
+
host.setFieldValue(field, amount === null ? null : {
|
|
8626
|
+
amount,
|
|
8627
|
+
currency: code
|
|
8628
|
+
});
|
|
8629
|
+
host.setFieldError?.(field, error);
|
|
8630
|
+
};
|
|
8631
|
+
|
|
8632
|
+
const amount = decimalInput(node, {
|
|
8633
|
+
path,
|
|
8634
|
+
value: parts.amount,
|
|
8635
|
+
size: ctx.size,
|
|
8636
|
+
label: field.label || field.key,
|
|
8637
|
+
required: field.required,
|
|
8638
|
+
textEnd: fixed ? (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.currencyOf)(fixed, locale).sign : '',
|
|
8639
|
+
placeholder: field.placeholder,
|
|
8640
|
+
check,
|
|
8641
|
+
write
|
|
8642
|
+
});
|
|
8643
|
+
if (fixed) return amount;
|
|
8644
|
+
const offered = [...new Set([...(currency ? [currency] : []), ...OFFERED_CURRENCIES])];
|
|
8645
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8646
|
+
<span class="sf-view-fields-money flex gap-1/3 min-w-0">
|
|
8647
|
+
${amount}
|
|
8648
|
+
<sf-dropdown
|
|
8649
|
+
class="sf-view-fields-currency"
|
|
8650
|
+
size=${ctx.size}
|
|
8651
|
+
appearance="outlined"
|
|
8652
|
+
mode="select"
|
|
8653
|
+
search="false"
|
|
8654
|
+
value=${currency ?? ''}
|
|
8655
|
+
placeholder=${word(node, 'currency')}
|
|
8656
|
+
aria-label=${word(node, 'currency')}
|
|
8657
|
+
.options=${offered.map(code => ({
|
|
8658
|
+
type: 'text',
|
|
8659
|
+
size: '1',
|
|
8660
|
+
value: code,
|
|
8661
|
+
text: `${code} ${(0,_money_js__WEBPACK_IMPORTED_MODULE_5__.currencyOf)(code, locale).sign === code ? '' : (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.currencyOf)(code, locale).sign}`.trim(),
|
|
8662
|
+
selected: code === currency
|
|
8663
|
+
}))}
|
|
8664
|
+
@change=${event => {
|
|
8665
|
+
const code = event.detail?.value || null;
|
|
8666
|
+
draftsOf(node).set(currencyPath, code);
|
|
8667
|
+
const typed = parts.amount;
|
|
8668
|
+
|
|
8669
|
+
if (typed !== null && typed !== '') {
|
|
8670
|
+
const nextMinor = code ? (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.currencyOf)(code, locale).minor : null;
|
|
8671
|
+
const error = decimalError(node, typed, {
|
|
8672
|
+
maxFraction: nextMinor,
|
|
8673
|
+
min: field.min ?? null,
|
|
8674
|
+
max: field.max ?? null
|
|
8675
|
+
}) || (code ? null : word(node, 'chooseCurrency'));
|
|
8676
|
+
write((0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(typed).ok ? (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.readDecimal)(typed).value : typed, error, code);
|
|
8677
|
+
} else {
|
|
8678
|
+
redraw(node);
|
|
8679
|
+
}
|
|
8680
|
+
}}
|
|
8681
|
+
></sf-dropdown>
|
|
8682
|
+
</span>
|
|
8683
|
+
`;
|
|
8684
|
+
}
|
|
8685
|
+
|
|
8686
|
+
function moneyText(field, value, locale) {
|
|
8687
|
+
const fixed = typeof field.currency === 'string' && field.currency ? field.currency : null;
|
|
8688
|
+
const {
|
|
8689
|
+
amount,
|
|
8690
|
+
currency
|
|
8691
|
+
} = (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.moneyParts)(value, fixed);
|
|
8692
|
+
return amount === null ? '' : (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.formatMoney)(amount, currency, locale);
|
|
8693
|
+
}
|
|
8694
|
+
|
|
8695
|
+
function renderMoneyView(field, value, ctx) {
|
|
8696
|
+
const text = moneyText(field, value, (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(ctx.node));
|
|
8697
|
+
return text ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view sf-view-fields-amount">${text}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing;
|
|
8698
|
+
} // --- number inside a row -----------------------------------------------------------
|
|
8699
|
+
// A number cell of a row is a decimal string as a money amount is: the
|
|
8700
|
+
// Framework's number editor writes a float, which the rows refuse. An integer
|
|
8701
|
+
// cell is the Framework's own.
|
|
8702
|
+
|
|
8703
|
+
|
|
8704
|
+
function renderDecimalEdit(field, value, host, ctx) {
|
|
8705
|
+
return decimalInput(ctx.node, {
|
|
8706
|
+
path: ctx.path ?? String(field.key ?? ''),
|
|
8707
|
+
value,
|
|
8708
|
+
size: ctx.size,
|
|
8709
|
+
label: field.label || field.key,
|
|
8710
|
+
required: field.required,
|
|
8711
|
+
textEnd: field.unit || '',
|
|
8712
|
+
placeholder: field.placeholder,
|
|
8713
|
+
check: text => decimalError(ctx.node, text, {
|
|
8714
|
+
min: field.min ?? null,
|
|
8715
|
+
max: field.max ?? null
|
|
8716
|
+
}),
|
|
8717
|
+
write: (next, error) => {
|
|
8718
|
+
host.setFieldValue(field, next);
|
|
8719
|
+
host.setFieldError?.(field, error);
|
|
8720
|
+
}
|
|
8721
|
+
});
|
|
8722
|
+
}
|
|
8723
|
+
|
|
8724
|
+
function decimalText(field, value, locale) {
|
|
8725
|
+
const text = (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.formatDecimal)(value, locale);
|
|
8726
|
+
return text && field.unit ? `${text} ${field.unit}` : text;
|
|
8727
|
+
} // --- items: rows over columns ------------------------------------------------------
|
|
8728
|
+
|
|
8729
|
+
|
|
8730
|
+
function cellText(column, cell, columns, locale, viewHost) {
|
|
8731
|
+
if (cell === null || typeof cell === 'undefined' || cell === '') return null;
|
|
8732
|
+
|
|
8733
|
+
switch (column.propertyType) {
|
|
8734
|
+
case 'money':
|
|
8735
|
+
{
|
|
8736
|
+
const {
|
|
8737
|
+
amount,
|
|
8738
|
+
currency
|
|
8739
|
+
} = (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.moneyParts)(cell, (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnCurrency)(column, columns));
|
|
8740
|
+
return amount === null ? null : (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.formatMoney)(amount, currency, locale);
|
|
8741
|
+
}
|
|
8742
|
+
|
|
8743
|
+
case 'percent':
|
|
8744
|
+
return (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.percentText)(cell, locale);
|
|
8745
|
+
|
|
8746
|
+
case 'number':
|
|
8747
|
+
return decimalText(column, cell, locale);
|
|
8748
|
+
|
|
8749
|
+
default:
|
|
8750
|
+
{
|
|
8751
|
+
const shown = (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__.renderViewField)({ ...column,
|
|
8752
|
+
value: cell
|
|
8753
|
+
}, cell, viewHost, {
|
|
8754
|
+
size: '1'
|
|
8755
|
+
});
|
|
8756
|
+
return shown === null || shown === lit__WEBPACK_IMPORTED_MODULE_0__.nothing ? null : shown;
|
|
8757
|
+
}
|
|
8758
|
+
}
|
|
8759
|
+
}
|
|
8760
|
+
|
|
8761
|
+
function totalText(column, total, columns, locale) {
|
|
8762
|
+
if (column.propertyType === 'money') {
|
|
8763
|
+
const currency = (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnCurrency)(column, columns);
|
|
8764
|
+
return (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.formatMoney)((0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.decimalString)(total), currency, locale);
|
|
8765
|
+
}
|
|
8766
|
+
|
|
8767
|
+
if (column.propertyType === 'percent') return (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.percentText)((0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.decimalString)(total), locale);
|
|
8768
|
+
return decimalText(column, (0,_decimal_js__WEBPACK_IMPORTED_MODULE_4__.decimalString)(total), locale);
|
|
8769
|
+
} // A column's share of the row: text widest, a yes-or-no narrowest.
|
|
8770
|
+
|
|
8771
|
+
|
|
8772
|
+
function track(column) {
|
|
8773
|
+
switch (column.propertyType) {
|
|
8774
|
+
case 'boolean':
|
|
8775
|
+
return 'minmax(4rem, auto)';
|
|
8776
|
+
// Wide enough for the control's own padding, a suffix (% or a currency
|
|
8777
|
+
// sign) and the digits a person types: a 5.5rem percent showed «2 %» for 20.
|
|
8778
|
+
|
|
8779
|
+
case 'integer':
|
|
8780
|
+
return 'minmax(5.5rem, 0.6fr)';
|
|
8781
|
+
|
|
8782
|
+
case 'percent':
|
|
8783
|
+
return 'minmax(6.5rem, 0.6fr)';
|
|
8784
|
+
|
|
8785
|
+
case 'number':
|
|
8786
|
+
return 'minmax(6.5rem, 0.7fr)';
|
|
8787
|
+
|
|
8788
|
+
case 'money':
|
|
8789
|
+
return column.currency ? 'minmax(9rem, 0.9fr)' : 'minmax(13rem, 1.2fr)';
|
|
8790
|
+
|
|
8791
|
+
case 'date':
|
|
8792
|
+
return 'minmax(9rem, 0.8fr)';
|
|
8793
|
+
|
|
8794
|
+
case 'choice':
|
|
8795
|
+
return 'minmax(8rem, 1fr)';
|
|
8796
|
+
|
|
8797
|
+
default:
|
|
8798
|
+
return 'minmax(10rem, 2fr)';
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8801
|
+
|
|
8802
|
+
function itemsSummary(field, rows, columns, ctx) {
|
|
8803
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(ctx.node);
|
|
8804
|
+
const totals = (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.rowTotals)(rows, columns);
|
|
8805
|
+
const first = columns.find(column => Object.hasOwn(totals, column.key) && column.propertyType === 'money') ?? columns.find(column => Object.hasOwn(totals, column.key));
|
|
8806
|
+
const count = rowsWord(ctx.node, rows.length);
|
|
8807
|
+
return first ? `${count}, ${word(ctx.node, 'total').toLowerCase()} ${totalText(first, totals[first.key], columns, locale)}` : count;
|
|
8808
|
+
}
|
|
8809
|
+
|
|
8810
|
+
function renderItemsTable(field, rows, columns, ctx, {
|
|
8811
|
+
editing,
|
|
8812
|
+
host
|
|
8813
|
+
}) {
|
|
8814
|
+
const node = ctx.node;
|
|
8815
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
8816
|
+
const key = String(field.key ?? '');
|
|
8817
|
+
const minRows = Number.isInteger(field.minRows) ? field.minRows : 0;
|
|
8818
|
+
const maxRows = Number.isInteger(field.maxRows) ? field.maxRows : 1000; // Fewer rows than the field asks for are drawn as empty rows to fill in,
|
|
8819
|
+
// and written only once something is typed in them.
|
|
8820
|
+
|
|
8821
|
+
const drawn = editing ? [...rows, ...Array.from({
|
|
8822
|
+
length: Math.max(0, minRows - rows.length)
|
|
8823
|
+
}, () => ({}))] : rows;
|
|
8824
|
+
const totals = (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.rowTotals)(rows, columns);
|
|
8825
|
+
const hasTotals = Object.keys(totals).length > 0;
|
|
8826
|
+
const template = `${columns.map(track).join(' ')}${editing ? ' auto' : ''}`; // Every cell's mistake, by row and column, reported as one for the field:
|
|
8827
|
+
// the field holds the save while any cell does.
|
|
8828
|
+
|
|
8829
|
+
const errors = cellErrorsOf(node, key);
|
|
8830
|
+
|
|
8831
|
+
const reportCells = () => {
|
|
8832
|
+
const any = [...errors.values()].some(Boolean);
|
|
8833
|
+
host.setFieldError?.(field, any ? word(node, 'cellsWrong') : null);
|
|
8834
|
+
};
|
|
8835
|
+
|
|
8836
|
+
const writeRows = next => {
|
|
8837
|
+
const computed = next.map(row => (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.computeRow)(row, columns, locale));
|
|
8838
|
+
host.setFieldValue(field, computed.length ? computed : null);
|
|
8839
|
+
};
|
|
8840
|
+
|
|
8841
|
+
const writeCell = (index, column, cell) => {
|
|
8842
|
+
const next = drawn.map(row => ({ ...row
|
|
8843
|
+
}));
|
|
8844
|
+
if (cell === null || typeof cell === 'undefined' || cell === '') delete next[index][column.key];else next[index][column.key] = cell;
|
|
8845
|
+
writeRows(next.slice(0, Math.max(rows.length, index + 1)));
|
|
8846
|
+
}; // Rows move: what was typed in a cell and is not a value yet goes with the
|
|
8847
|
+
// cell's place, so the drafts of this field are dropped.
|
|
8848
|
+
|
|
8849
|
+
|
|
8850
|
+
const reshape = next => {
|
|
8851
|
+
for (const path of [...draftsOf(node).keys()]) if (path.startsWith(`${key}[`)) draftsOf(node).delete(path);
|
|
8852
|
+
|
|
8853
|
+
for (const path of [...leftOf(node)]) if (path.startsWith(`${key}[`)) leftOf(node).delete(path);
|
|
8854
|
+
|
|
8855
|
+
errors.clear();
|
|
8856
|
+
reportCells();
|
|
8857
|
+
writeRows(next);
|
|
8858
|
+
};
|
|
8859
|
+
|
|
8860
|
+
const cell = (row, index, column) => {
|
|
8861
|
+
const path = `${key}[${index}].${column.key}`;
|
|
8862
|
+
const value = row[column.key];
|
|
8863
|
+
|
|
8864
|
+
if (!editing || column.compute || field.readonly === true || column.readonly === true) {
|
|
8865
|
+
const text = cellText(column, column.compute && editing ? (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.computeRow)(row, columns, locale)[column.key] : value, columns, locale, ctx.viewHost);
|
|
8866
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-text ${column.compute ? 'color-on-surface-variant' : ''}" data-computed=${column.compute ? 'true' : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}>${text ?? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="color-on-surface-variant">—</span>`}</span>`;
|
|
8867
|
+
}
|
|
8868
|
+
|
|
8869
|
+
const cellField = { ...column,
|
|
8870
|
+
key: path,
|
|
8871
|
+
label: column.label || column.key,
|
|
8872
|
+
value
|
|
8873
|
+
};
|
|
8874
|
+
const cellHost = {
|
|
8875
|
+
setFieldValue: (_target, next) => writeCell(index, column, next),
|
|
8876
|
+
setFieldError: (_target, message) => {
|
|
8877
|
+
errors.set(path, message || null);
|
|
8878
|
+
reportCells();
|
|
8879
|
+
}
|
|
8880
|
+
};
|
|
8881
|
+
const cellCtx = { ...ctx,
|
|
8882
|
+
path
|
|
8883
|
+
};
|
|
8884
|
+
|
|
8885
|
+
switch (column.propertyType) {
|
|
8886
|
+
case 'money':
|
|
8887
|
+
return renderMoneyEdit({ ...cellField,
|
|
8888
|
+
currency: column.currency
|
|
8889
|
+
}, value, cellHost, cellCtx);
|
|
8890
|
+
|
|
8891
|
+
case 'percent':
|
|
8892
|
+
return renderPercentEdit(cellField, value, cellHost, cellCtx);
|
|
8893
|
+
|
|
8894
|
+
case 'number':
|
|
8895
|
+
return renderDecimalEdit(cellField, value, cellHost, cellCtx);
|
|
8896
|
+
|
|
8897
|
+
default:
|
|
8898
|
+
{
|
|
8899
|
+
const control = (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__.renderEditField)(cellField, value, cellHost, {
|
|
8900
|
+
size: ctx.size
|
|
8901
|
+
});
|
|
8902
|
+
return control ?? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-text">${cellText(column, value, columns, locale, ctx.viewHost) ?? '—'}</span>`;
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8905
|
+
};
|
|
8906
|
+
|
|
8907
|
+
const rowActions = index => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8908
|
+
<span class="sf-view-items-actions flex items-cross-center gap-1/4" role="cell">
|
|
8909
|
+
<sf-button-icon size="1/2" appearance="link" scheme="secondary" icon="keyboard_arrow_up"
|
|
8910
|
+
data-action="row-up" ?disabled=${index === 0 || index >= rows.length}
|
|
8911
|
+
title=${word(node, 'rowUp')} aria-label=${word(node, 'rowUp')}
|
|
8912
|
+
@click=${() => {
|
|
8913
|
+
const next = rows.slice();
|
|
8914
|
+
[next[index - 1], next[index]] = [next[index], next[index - 1]];
|
|
8915
|
+
reshape(next);
|
|
8916
|
+
}}></sf-button-icon>
|
|
8917
|
+
<sf-button-icon size="1/2" appearance="link" scheme="secondary" icon="keyboard_arrow_down"
|
|
8918
|
+
data-action="row-down" ?disabled=${index >= rows.length - 1}
|
|
8919
|
+
title=${word(node, 'rowDown')} aria-label=${word(node, 'rowDown')}
|
|
8920
|
+
@click=${() => {
|
|
8921
|
+
const next = rows.slice();
|
|
8922
|
+
[next[index + 1], next[index]] = [next[index], next[index + 1]];
|
|
8923
|
+
reshape(next);
|
|
8924
|
+
}}></sf-button-icon>
|
|
8925
|
+
<sf-button-icon size="1/2" appearance="link" scheme="secondary" icon="delete"
|
|
8926
|
+
data-action="row-remove" ?disabled=${drawn.length <= minRows || index >= rows.length}
|
|
8927
|
+
title=${word(node, 'removeRow')} aria-label=${word(node, 'removeRow')}
|
|
8928
|
+
@click=${() => reshape(rows.filter((_row, at) => at !== index))}></sf-button-icon>
|
|
8929
|
+
</span>
|
|
8930
|
+
`;
|
|
8931
|
+
|
|
8932
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8933
|
+
<span class="sf-view-items-box">
|
|
8934
|
+
<span class="sf-view-items ${editing ? 'sf-view-items--edit' : ''}" data-items=${key} role="table"
|
|
8935
|
+
aria-label=${field.label || key} style=${`--sf-view-items-columns: ${template}`}>
|
|
8936
|
+
<span class="sf-view-items-head" role="row">
|
|
8937
|
+
${columns.map(column => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-heading ${_rows_js__WEBPACK_IMPORTED_MODULE_6__.NUMERIC.has(column.propertyType) ? 'sf-view-items-numeric' : ''}" role="columnheader">${column.label || column.key}${editing && column.required && !column.compute ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="color-error" aria-hidden="true"> *</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}</span>`)}
|
|
8938
|
+
${editing ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-heading" role="columnheader"></span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8939
|
+
</span>
|
|
8940
|
+
${drawn.map((row, index) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8941
|
+
<span class="sf-view-items-row" role="row" data-row=${index} aria-label=${word(node, 'row', {
|
|
8942
|
+
n: index + 1
|
|
8943
|
+
})}>
|
|
8944
|
+
${columns.map(column => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8945
|
+
<span class="sf-view-items-cell ${_rows_js__WEBPACK_IMPORTED_MODULE_6__.NUMERIC.has(column.propertyType) ? 'sf-view-items-numeric' : ''}" role="cell" data-column=${column.key}>
|
|
8946
|
+
<span class="sf-view-items-cell-label color-on-surface-variant" aria-hidden="true">${column.label || column.key}</span>
|
|
8947
|
+
${cell(row, index, column)}
|
|
8948
|
+
</span>`)}
|
|
8949
|
+
${editing ? rowActions(index) : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8950
|
+
</span>`)}
|
|
8951
|
+
${hasTotals && rows.length ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8952
|
+
<span class="sf-view-items-row sf-view-items-totals" role="row" data-totals="true">
|
|
8953
|
+
${columns.map((column, at) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8954
|
+
<span class="sf-view-items-cell ${_rows_js__WEBPACK_IMPORTED_MODULE_6__.NUMERIC.has(column.propertyType) ? 'sf-view-items-numeric' : ''} ${Object.hasOwn(totals, column.key) ? '' : 'sf-view-items-cell--blank'}" role="cell" data-column=${column.key}>
|
|
8955
|
+
${Object.hasOwn(totals, column.key) ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-cell-label color-on-surface-variant" aria-hidden="true">${word(node, 'total')}: ${column.label || column.key}</span><span class="sf-view-items-text sf-view-items-total">${totalText(column, totals[column.key], columns, locale)}</span>` : at === 0 ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-view-items-text sf-view-items-total-word">${word(node, 'total')}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8956
|
+
</span>`)}
|
|
8957
|
+
${editing ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span role="cell"></span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8958
|
+
</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8959
|
+
${editing ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8960
|
+
<span class="sf-view-items-foot flex items-cross-center gap-1">
|
|
8961
|
+
<sf-button appearance="outline" size=${ctx.size} icon="add" text=${word(node, 'addRow')}
|
|
8962
|
+
data-action="row-add" ?disabled=${drawn.length >= maxRows}
|
|
8963
|
+
@click=${() => reshape([...drawn, {}])}></sf-button>
|
|
8964
|
+
</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8965
|
+
</span>
|
|
8966
|
+
</span>
|
|
8967
|
+
`;
|
|
8968
|
+
}
|
|
8969
|
+
|
|
8970
|
+
const CELL_ERRORS = new WeakMap();
|
|
8971
|
+
|
|
8972
|
+
function cellErrorsOf(node, key) {
|
|
8973
|
+
if (!CELL_ERRORS.has(node)) CELL_ERRORS.set(node, new Map());
|
|
8974
|
+
const all = CELL_ERRORS.get(node);
|
|
8975
|
+
if (!all.has(key)) all.set(key, new Map());
|
|
8976
|
+
return all.get(key);
|
|
8977
|
+
}
|
|
8978
|
+
|
|
8979
|
+
function renderItemsEdit(field, value, host, ctx) {
|
|
8980
|
+
return renderItemsTable(field, (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.rowsOf)(value), (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnsOf)(field), ctx, {
|
|
8981
|
+
editing: true,
|
|
8982
|
+
host
|
|
8983
|
+
});
|
|
8984
|
+
}
|
|
8985
|
+
|
|
8986
|
+
function renderItemsView(field, value, ctx) {
|
|
8987
|
+
const rows = (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.rowsOf)(value);
|
|
8988
|
+
if (!rows.length) return lit__WEBPACK_IMPORTED_MODULE_0__.nothing;
|
|
8989
|
+
if (ctx.summary) return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view">${itemsSummary(field, rows, (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnsOf)(field), ctx)}</span>`;
|
|
8990
|
+
return renderItemsTable(field, rows, (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnsOf)(field), ctx, {
|
|
8991
|
+
editing: false,
|
|
8992
|
+
host: null
|
|
8993
|
+
});
|
|
8994
|
+
} // --- compound: a fixed set of parts, one value --------------------------------------
|
|
8995
|
+
// The parts of a requisites field, in the standard's order, of those the field
|
|
8996
|
+
// names (`parts`; all six when it names none). Each is typed as digits, the КПП
|
|
8997
|
+
// as digits and capital letters.
|
|
8998
|
+
|
|
8999
|
+
|
|
9000
|
+
const REQUISITE_LENGTH = {
|
|
9001
|
+
inn: 12,
|
|
9002
|
+
kpp: 9,
|
|
9003
|
+
ogrn: 15,
|
|
9004
|
+
bik: 9,
|
|
9005
|
+
account: 20,
|
|
9006
|
+
corr_account: 20
|
|
9007
|
+
};
|
|
9008
|
+
|
|
9009
|
+
function requisiteParts(field) {
|
|
9010
|
+
const named = Array.isArray(field.parts) ? field.parts.map(String) : _requisites_js__WEBPACK_IMPORTED_MODULE_7__.REQUISITE_PARTS;
|
|
9011
|
+
return _requisites_js__WEBPACK_IMPORTED_MODULE_7__.REQUISITE_PARTS.filter(part => named.includes(part));
|
|
9012
|
+
}
|
|
9013
|
+
|
|
9014
|
+
function compoundParts(field) {
|
|
9015
|
+
return (Array.isArray(field.parts) ? field.parts : []).map(part => part && typeof part === 'object' ? { ...part,
|
|
9016
|
+
propertyType: part.propertyType || part.type
|
|
9017
|
+
} : null).filter(part => part?.key);
|
|
9018
|
+
}
|
|
9019
|
+
|
|
9020
|
+
function objectOf(value) {
|
|
9021
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
9022
|
+
} // The value written: the parts in their order, an empty part no key, and
|
|
9023
|
+
// nothing at all when every part is empty.
|
|
9024
|
+
|
|
9025
|
+
|
|
9026
|
+
function compoundValue(order, value) {
|
|
9027
|
+
const next = {};
|
|
9028
|
+
|
|
9029
|
+
for (const part of order) {
|
|
9030
|
+
const one = value[part];
|
|
9031
|
+
if (one !== null && typeof one !== 'undefined' && one !== '') next[part] = one;
|
|
9032
|
+
}
|
|
9033
|
+
|
|
9034
|
+
return Object.keys(next).length ? next : null;
|
|
9035
|
+
}
|
|
9036
|
+
|
|
9037
|
+
function renderRequisitesEdit(field, value, host, ctx) {
|
|
9038
|
+
const node = ctx.node;
|
|
9039
|
+
const key = String(field.key ?? '');
|
|
9040
|
+
const parts = requisiteParts(field);
|
|
9041
|
+
const held = objectOf(value);
|
|
9042
|
+
const errors = (0,_requisites_js__WEBPACK_IMPORTED_MODULE_7__.requisiteErrors)(held, parts);
|
|
9043
|
+
|
|
9044
|
+
const write = (part, text) => {
|
|
9045
|
+
const cleaned = part === 'kpp' ? text.replace(/\s/gu, '').toUpperCase() : text.replace(/\D/gu, '');
|
|
9046
|
+
const next = compoundValue(parts, { ...held,
|
|
9047
|
+
[part]: cleaned
|
|
9048
|
+
});
|
|
9049
|
+
const mistakes = (0,_requisites_js__WEBPACK_IMPORTED_MODULE_7__.requisiteErrors)(next ?? {}, parts); // Nothing typed in a field that is not required is no mistake.
|
|
9050
|
+
|
|
9051
|
+
const blank = next === null && field.required !== true;
|
|
9052
|
+
host.setFieldValue(field, next);
|
|
9053
|
+
host.setFieldError?.(field, !blank && Object.keys(mistakes).length ? word(node, mistakes[Object.keys(mistakes)[0]]) : null);
|
|
9054
|
+
};
|
|
9055
|
+
|
|
9056
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9057
|
+
<span class="sf-view-fields-compound grid gap-1 w-full min-w-0" data-compound=${key}>
|
|
9058
|
+
${parts.map(part => {
|
|
9059
|
+
const path = `${key}.${part}`;
|
|
9060
|
+
const left = leftOf(node).has(path);
|
|
9061
|
+
const blank = Object.keys(held).length === 0 && field.required !== true;
|
|
9062
|
+
const message = left && !blank && errors[part] ? word(node, errors[part]) : '';
|
|
9063
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9064
|
+
<span class="sf-view-fields-part flex flex-col gap-1/4 min-w-0 ${part === 'account' || part === 'corr_account' ? 'sf-view-fields-part--wide' : ''}" data-part=${part}>
|
|
9065
|
+
<span class="sf-view-fields-part-label color-on-surface-variant">${word(node, part)}${part === 'inn' && field.required ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="color-error" aria-hidden="true"> *</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}</span>
|
|
9066
|
+
<sf-input
|
|
9067
|
+
size=${ctx.size}
|
|
9068
|
+
appearance="bordered"
|
|
9069
|
+
inputmode=${part === 'kpp' ? 'text' : 'numeric'}
|
|
9070
|
+
maxlength=${String(REQUISITE_LENGTH[part])}
|
|
9071
|
+
value=${String(held[part] ?? '')}
|
|
9072
|
+
?required=${part === 'inn' && field.required === true}
|
|
9073
|
+
?invalid=${Boolean(message)}
|
|
9074
|
+
error-message=${message || lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
9075
|
+
aria-label=${`${field.label || key}: ${word(node, part)}`}
|
|
9076
|
+
@input=${event => write(part, String(event.target?.value ?? ''))}
|
|
9077
|
+
@change=${event => write(part, String(event.target?.value ?? ''))}
|
|
9078
|
+
@focusout=${() => {
|
|
9079
|
+
leftOf(node).add(path);
|
|
9080
|
+
redraw(node);
|
|
9081
|
+
}}
|
|
9082
|
+
></sf-input>
|
|
9083
|
+
</span>`;
|
|
9084
|
+
})}
|
|
9085
|
+
</span>
|
|
9086
|
+
`;
|
|
9087
|
+
}
|
|
9088
|
+
|
|
9089
|
+
function requisitesText(field, value, node) {
|
|
9090
|
+
const held = objectOf(value);
|
|
9091
|
+
return requisiteParts(field).filter(part => held[part]).map(part => `${word(node, part)} ${held[part]}`).join(', ');
|
|
9092
|
+
}
|
|
9093
|
+
|
|
9094
|
+
function renderRequisitesView(field, value, ctx) {
|
|
9095
|
+
const text = requisitesText(field, value, ctx.node);
|
|
9096
|
+
return text ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view">${text}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing;
|
|
9097
|
+
}
|
|
9098
|
+
|
|
9099
|
+
function renderCompoundEdit(field, value, host, ctx) {
|
|
9100
|
+
const node = ctx.node;
|
|
9101
|
+
const key = String(field.key ?? '');
|
|
9102
|
+
const parts = compoundParts(field);
|
|
9103
|
+
const order = parts.map(part => part.key);
|
|
9104
|
+
const held = objectOf(value);
|
|
9105
|
+
const errors = cellErrorsOf(node, key);
|
|
9106
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9107
|
+
<span class="sf-view-fields-compound grid gap-1 w-full min-w-0" data-compound=${key}>
|
|
9108
|
+
${parts.map(part => {
|
|
9109
|
+
const path = `${key}.${part.key}`;
|
|
9110
|
+
const partField = { ...part,
|
|
9111
|
+
key: path,
|
|
9112
|
+
label: part.label || part.key,
|
|
9113
|
+
readonly: field.readonly === true || part.readonly === true
|
|
9114
|
+
};
|
|
9115
|
+
const partHost = {
|
|
9116
|
+
setFieldValue: (_target, next) => host.setFieldValue(field, compoundValue(order, { ...held,
|
|
9117
|
+
[part.key]: next
|
|
9118
|
+
})),
|
|
9119
|
+
setFieldError: (_target, message) => {
|
|
9120
|
+
errors.set(path, message || null);
|
|
9121
|
+
const first = [...errors.values()].find(Boolean);
|
|
9122
|
+
host.setFieldError?.(field, first ?? null);
|
|
9123
|
+
}
|
|
9124
|
+
};
|
|
9125
|
+
const partCtx = { ...ctx,
|
|
9126
|
+
path
|
|
9127
|
+
};
|
|
9128
|
+
const control = SET_CONTROLS[part.propertyType]?.edit(partField, held[part.key], partHost, partCtx) ?? (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__.renderEditField)(partField, held[part.key], partHost, {
|
|
9129
|
+
size: ctx.size
|
|
9130
|
+
});
|
|
9131
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9132
|
+
<span class="sf-view-fields-part flex flex-col gap-1/4 min-w-0 ${part.width === 'full' ? 'sf-view-fields-part--wide' : ''}" data-part=${part.key}>
|
|
9133
|
+
<span class="sf-view-fields-part-label color-on-surface-variant">${partField.label}${part.required ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="color-error" aria-hidden="true"> *</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}</span>
|
|
9134
|
+
${control ?? lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
9135
|
+
</span>`;
|
|
9136
|
+
})}
|
|
9137
|
+
</span>
|
|
9138
|
+
`;
|
|
9139
|
+
}
|
|
9140
|
+
|
|
9141
|
+
function renderCompoundView(field, value, ctx) {
|
|
9142
|
+
const held = objectOf(value);
|
|
9143
|
+
const shown = compoundParts(field).filter(part => held[part.key] !== null && typeof held[part.key] !== 'undefined' && held[part.key] !== '');
|
|
9144
|
+
if (!shown.length) return lit__WEBPACK_IMPORTED_MODULE_0__.nothing;
|
|
9145
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view sf-view-fields-compound-view">${shown.map((part, at) => {
|
|
9146
|
+
const own = SET_CONTROLS[part.propertyType]?.view({ ...part
|
|
9147
|
+
}, held[part.key], ctx);
|
|
9148
|
+
const content = own ?? (0,_field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__.renderViewField)({ ...part
|
|
9149
|
+
}, held[part.key], ctx.viewHost, {
|
|
9150
|
+
size: ctx.size
|
|
9151
|
+
}) ?? String(held[part.key]);
|
|
9152
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`${at ? ', ' : ''}<span class="color-on-surface-variant">${part.label || part.key}</span> ${content}`;
|
|
9153
|
+
})}</span>`;
|
|
9154
|
+
} // --- the map ---------------------------------------------------------------------
|
|
9155
|
+
|
|
9156
|
+
|
|
9157
|
+
const SET_CONTROLS = {
|
|
9158
|
+
money: {
|
|
9159
|
+
edit: renderMoneyEdit,
|
|
9160
|
+
view: renderMoneyView
|
|
9161
|
+
},
|
|
9162
|
+
percent: {
|
|
9163
|
+
edit: renderPercentEdit,
|
|
9164
|
+
view: renderPercentView
|
|
9165
|
+
},
|
|
9166
|
+
items: {
|
|
9167
|
+
edit: renderItemsEdit,
|
|
9168
|
+
view: renderItemsView
|
|
9169
|
+
},
|
|
9170
|
+
compound: {
|
|
9171
|
+
edit: renderCompoundEdit,
|
|
9172
|
+
view: renderCompoundView
|
|
9173
|
+
},
|
|
9174
|
+
'ru.requisites': {
|
|
9175
|
+
edit: renderRequisitesEdit,
|
|
9176
|
+
view: renderRequisitesView
|
|
9177
|
+
}
|
|
9178
|
+
};
|
|
9179
|
+
/** Whether the set draws this property type itself. */
|
|
9180
|
+
|
|
9181
|
+
function drawsSetField(field) {
|
|
9182
|
+
return Object.hasOwn(SET_CONTROLS, String(field?.propertyType || field?.type || ''));
|
|
9183
|
+
}
|
|
9184
|
+
/**
|
|
9185
|
+
* A field of a type the set draws, edited or shown. `ctx` is {node, size,
|
|
9186
|
+
* viewHost, disabled}: the element whose page language the words follow, the
|
|
9187
|
+
* size on the ladder, the host's formatFieldValue, and whether a condition
|
|
9188
|
+
* turns the field off. A field the person may not change is shown, as the
|
|
9189
|
+
* Framework renderers show one.
|
|
9190
|
+
*/
|
|
9191
|
+
|
|
9192
|
+
function renderSetField(field, value, editing, host, ctx) {
|
|
9193
|
+
const control = SET_CONTROLS[String(field.propertyType || field.type)];
|
|
9194
|
+
if (!control) return null;
|
|
9195
|
+
const formatted = !editing ? ctx.viewHost?.formatFieldValue?.(field, value) : null;
|
|
9196
|
+
if (typeof formatted === 'string' && formatted !== '') return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-field-view">${formatted}</span>`;
|
|
9197
|
+
|
|
9198
|
+
if (editing && field.readonly !== true && ctx.disabled !== true && host?.setFieldValue) {
|
|
9199
|
+
return control.edit(field, value, host, ctx);
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9202
|
+
return control.view(field, value, ctx);
|
|
9203
|
+
}
|
|
9204
|
+
/** A field's value as one line of text: «1 500,50 ₽», «2 строки, итого 2 499,99 ₽». */
|
|
9205
|
+
|
|
9206
|
+
function setFieldText(field, value, node) {
|
|
9207
|
+
const locale = (0,_core_js_page_language__WEBPACK_IMPORTED_MODULE_3__.pageLocale)(node);
|
|
9208
|
+
|
|
9209
|
+
switch (String(field?.propertyType || field?.type || '')) {
|
|
9210
|
+
case 'money':
|
|
9211
|
+
return moneyText(field, value, locale);
|
|
9212
|
+
|
|
9213
|
+
case 'percent':
|
|
9214
|
+
return (0,_money_js__WEBPACK_IMPORTED_MODULE_5__.percentText)(value, locale);
|
|
9215
|
+
|
|
9216
|
+
case 'items':
|
|
9217
|
+
{
|
|
9218
|
+
const rows = (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.rowsOf)(value);
|
|
9219
|
+
return rows.length ? itemsSummary(field, rows, (0,_rows_js__WEBPACK_IMPORTED_MODULE_6__.columnsOf)(field), {
|
|
9220
|
+
node
|
|
9221
|
+
}) : '';
|
|
9222
|
+
}
|
|
9223
|
+
|
|
9224
|
+
case 'ru.requisites':
|
|
9225
|
+
return requisitesText(field, value, node);
|
|
9226
|
+
|
|
9227
|
+
default:
|
|
9228
|
+
return null;
|
|
9229
|
+
}
|
|
9230
|
+
}
|
|
9231
|
+
__webpack_async_result__();
|
|
9232
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
9233
|
+
|
|
9234
|
+
/***/ },
|
|
9235
|
+
|
|
9236
|
+
/***/ "40b137e60526"
|
|
9237
|
+
(module, __webpack_exports__, __webpack_require__) {
|
|
9238
|
+
|
|
9239
|
+
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
9240
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9241
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9242
|
+
/* harmony export */ renderPropertyViewTemplate: () => (/* binding */ renderPropertyViewTemplate)
|
|
9243
|
+
/* harmony export */ });
|
|
9244
|
+
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2a080a730149");
|
|
9245
|
+
/* harmony import */ var _default_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("9e9dad7bcc09");
|
|
9246
|
+
/* harmony import */ var _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("e5483002f3ea");
|
|
9247
|
+
/* harmony import */ var _field_value_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("62c5c417c97d");
|
|
9248
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__, _field_value_js__WEBPACK_IMPORTED_MODULE_3__]);
|
|
9249
|
+
([lit__WEBPACK_IMPORTED_MODULE_0__, _field_renderers_index_js__WEBPACK_IMPORTED_MODULE_2__, _field_value_js__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
|
|
9250
|
+
/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lit__WEBPACK_IMPORTED_MODULE_0__);
|
|
9251
|
+
|
|
9252
|
+
|
|
9253
|
+
|
|
9254
|
+
// The arrangement, drawn in the component's own light DOM. Not in a shadow root:
|
|
9255
|
+
// the field controls are Smart elements whose stylesheets are document-level, and
|
|
9256
|
+
// a document stylesheet does not cross a shadow boundary. sf-view slots its
|
|
9257
|
+
// children for exactly this reason and says so beside the slot; the first version
|
|
9258
|
+
// of this composite built them inside a shadow root and every control came out
|
|
9259
|
+
// with its markup and none of its CSS.
|
|
9260
|
+
// While the view is being configured every entry is listed, hidden and rare ones
|
|
9261
|
+
// included: a hidden field a person cannot see is a field they cannot show again,
|
|
9262
|
+
// and «показать редкие поля» is a reading choice rather than part of the
|
|
9263
|
+
// arrangement being edited.
|
|
9264
|
+
|
|
9265
|
+
function listed(context, entries) {
|
|
9266
|
+
return context.configuring ? entries ?? [] : context.visible(entries);
|
|
9267
|
+
} // The chooser names the layers this person may write and nothing else. A layer
|
|
9268
|
+
// they may not write is drawn disabled with the host's own reason on it rather
|
|
9269
|
+
// than left out, because a «Для всех» that is simply absent reads as a feature
|
|
9270
|
+
// the product does not have.
|
|
9271
|
+
// The controls of the arranging mode live in the bar at the foot (owner,
|
|
9272
|
+
// 2026-10-08), where saving, cancelling and deleting live when a group is being
|
|
9273
|
+
// edited: the foot is where a mode's own answers belong, and a band of them
|
|
9274
|
+
// under the head pushed the record down by a row it did not need.
|
|
9275
|
+
|
|
9276
|
+
|
|
9277
|
+
function renderConfigureBar(context) {
|
|
9278
|
+
if (!context.canConfigureView) return lit__WEBPACK_IMPORTED_MODULE_0__.nothing; // Not configuring: nothing is drawn. Entering is the «⋯» menu's, as the mockup
|
|
9279
|
+
// has it -- a standalone «Настроить вид» link stood as its own band under the
|
|
9280
|
+
// head and was one of the two empty-looking rows the owner saw.
|
|
9281
|
+
|
|
9282
|
+
if (!context.configuring) return lit__WEBPACK_IMPORTED_MODULE_0__.nothing; // One row of controls and nothing else: the view being arranged and the
|
|
9283
|
+
// way out. Whose copy is written follows from the view itself -- a view
|
|
9284
|
+
// for everyone is written for everyone, a personal one for its person --
|
|
9285
|
+
// so the «Персональный / Для всех» toggle that stood beside the chooser
|
|
9286
|
+
// said the same thing twice and is gone (owner, 2026-10-14).
|
|
9287
|
+
// Which named view is being arranged, chosen, made, renamed and removed in
|
|
9288
|
+
// the Framework's profile picker (owner, 2026-10-14) -- the one the admin
|
|
9289
|
+
// menu's profiles use.
|
|
9290
|
+
|
|
9291
|
+
const writable = context.editableLayers ?? [];
|
|
9292
|
+
const chooser = (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9293
|
+
<sf-profile-picker
|
|
9294
|
+
size=${context.size}
|
|
9295
|
+
data-action="view-profile"
|
|
9296
|
+
label=${context.viewProfileLabel}
|
|
9297
|
+
current=${context.viewProfile ?? ''}
|
|
9298
|
+
.profiles=${(context.viewProfiles ?? []).map(profile => ({
|
|
9299
|
+
id: profile.id,
|
|
9300
|
+
label: profile.label,
|
|
9301
|
+
shared: Boolean(profile.shared),
|
|
9302
|
+
editable: writable.includes(profile.shared ? 'shared' : 'personal') && (!profile.shared || context.canDeleteViewProfile(profile.id))
|
|
9303
|
+
}))}
|
|
9304
|
+
.rights=${{
|
|
9305
|
+
create: {
|
|
9306
|
+
personal: writable.includes('personal'),
|
|
9307
|
+
shared: writable.includes('shared')
|
|
9308
|
+
}
|
|
9309
|
+
}}
|
|
9310
|
+
@sf-profile-picker-select=${event => context.component.selectViewProfile(event.detail.id)}
|
|
9311
|
+
@sf-profile-picker-create=${event => context.component.createViewProfile(event.detail.label, {
|
|
9312
|
+
shared: event.detail.shared
|
|
9313
|
+
})}
|
|
9314
|
+
@sf-profile-picker-rename=${event => context.component.renameViewProfile(event.detail.id, event.detail.label)}
|
|
9315
|
+
@sf-profile-picker-delete=${event => context.component.deleteViewProfile(event.detail.id)}
|
|
9316
|
+
></sf-profile-picker>`;
|
|
9317
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9318
|
+
<div class="sf-property-view-actions sf-property-view-configure-bar flex items-cross-center gap-2 flex-wrap"
|
|
9319
|
+
data-configuring="true" role="group"
|
|
9320
|
+
aria-label=${context.configureText}>
|
|
9321
|
+
${chooser}
|
|
9322
|
+
<span class="grow"></span>
|
|
9323
|
+
${context.resetAsked ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9324
|
+
<span class="sf-property-view-reset-ask color-error">${context.resetViewAskText}</span>
|
|
9325
|
+
<sf-button
|
|
9326
|
+
appearance="link"
|
|
9327
|
+
size=${context.size}
|
|
9328
|
+
status="error"
|
|
9329
|
+
text=${context.resetViewText}
|
|
9330
|
+
data-action="reset-view-confirm"
|
|
9331
|
+
@click=${() => context.component.resetView()}
|
|
9332
|
+
></sf-button>
|
|
9333
|
+
<sf-button
|
|
9334
|
+
appearance="outline"
|
|
9335
|
+
size=${context.size}
|
|
9336
|
+
text=${context.cancelConfiguringText}
|
|
9337
|
+
data-action="reset-view-cancel"
|
|
9338
|
+
@click=${() => context.component.cancelReset()}
|
|
9339
|
+
></sf-button>` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9340
|
+
<!-- Reset, cancel, done: the further a control reaches, the
|
|
9341
|
+
quieter it is drawn. Reset takes the whole layer away
|
|
9342
|
+
and asks first; cancel puts back the arrangement this
|
|
9343
|
+
mode was entered with; done keeps what is there. -->
|
|
9344
|
+
<sf-button
|
|
9345
|
+
appearance="link"
|
|
9346
|
+
size=${context.size}
|
|
9347
|
+
text=${context.resetViewText}
|
|
9348
|
+
data-action="reset-view"
|
|
9349
|
+
@click=${() => context.component.askReset()}
|
|
9350
|
+
></sf-button>
|
|
9351
|
+
<sf-button
|
|
9352
|
+
appearance="outline"
|
|
9353
|
+
size=${context.size}
|
|
9354
|
+
text=${context.cancelConfiguringText}
|
|
9355
|
+
data-action="cancel-configuring"
|
|
9356
|
+
@click=${() => context.component.cancelConfiguringView()}
|
|
9357
|
+
></sf-button>
|
|
9358
|
+
<sf-button
|
|
9359
|
+
appearance="default"
|
|
9360
|
+
size=${context.size}
|
|
9361
|
+
text=${context.doneConfiguringText}
|
|
9362
|
+
data-action="done-configuring"
|
|
9363
|
+
@click=${() => context.component.stopConfiguringView()}
|
|
9364
|
+
></sf-button>`}
|
|
9365
|
+
</div>
|
|
9366
|
+
`;
|
|
9367
|
+
} // Width, template variant and hint sit behind the field's own settings rather
|
|
9368
|
+
// than under every field at once. Drawn under each field they were four controls
|
|
9369
|
+
// per row, so a group of eight fields was thirty-two controls and the
|
|
9370
|
+
// arrangement -- the thing being edited -- could no longer be read.
|
|
9371
|
+
|
|
9372
|
+
|
|
9373
|
+
function renderFieldSettings(context, field, key) {
|
|
9374
|
+
const variants = Array.isArray(field.variantOptions) ? field.variantOptions : [];
|
|
9375
|
+
return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
9376
|
+
<sf-popover placement="bottom-end" width="16rem" label=${context.fieldSettingsText}
|
|
9377
|
+
data-settings-for=${key}>
|
|
9378
|
+
<sf-button-icon
|
|
9379
|
+
slot="trigger"
|
|
9380
|
+
size="1/2"
|
|
9381
|
+
appearance="link"
|
|
9382
|
+
scheme="secondary"
|
|
9383
|
+
icon="settings"
|
|
9384
|
+
data-action="field-settings"
|
|
9385
|
+
title=${context.fieldSettingsText}
|
|
9386
|
+
aria-label=${context.fieldSettingsText}
|
|
9387
|
+
></sf-button-icon>
|
|
9388
|
+
<div slot="content" class="flex flex-col gap-1 p-1">
|
|
9389
|
+
<label class="sf-property-view-settings-row sf-property-view-settings-row--stacked flex flex-col gap-1/4">
|
|
9390
|
+
<span class="sf-property-view-settings-label color-on-surface-variant">${context.fieldLabelText}</span>
|
|
9391
|
+
<sf-input
|
|
9392
|
+
size="1/2"
|
|
9393
|
+
appearance="bordered"
|
|
9394
|
+
data-action="field-label"
|
|
9395
|
+
aria-label=${context.fieldLabelText}
|
|
9396
|
+
placeholder=${String(field.label ?? key)}
|
|
9397
|
+
value=${String(field.label ?? '')}
|
|
9398
|
+
@change=${event => context.component.setFieldView(key, {
|
|
9399
|
+
label: String(event.target?.value ?? '').trim() || null
|
|
9400
|
+
})}
|
|
9401
|
+
></sf-input>
|
|
9402
|
+
</label>
|
|
9403
|
+
<label class="sf-property-view-settings-row sf-property-view-settings-row--stacked flex flex-col gap-1/4">
|
|
9404
|
+
<span class="sf-property-view-settings-label color-on-surface-variant">${context.hintText}</span>
|
|
9405
|
+
<sf-input
|
|
9406
|
+
size="1/2"
|
|
9407
|
+
appearance="bordered"
|
|
9408
|
+
data-action="hint"
|
|
9409
|
+
aria-label=${context.hintText}
|
|
9410
|
+
placeholder=${context.hintText}
|
|
9411
|
+
value=${String(field.hint ?? '')}
|
|
9412
|
+
@change=${event => context.component.setFieldView(key, {
|
|
9413
|
+
hint: event.target?.value ?? ''
|
|
9414
|
+
})}
|
|
9415
|
+
></sf-input>
|
|
9416
|
+
</label>
|
|
9417
|
+
${variants.length ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
7841
9418
|
<label class="sf-property-view-settings-row flex items-cross-center justify-between gap-1">
|
|
7842
9419
|
<span class="sf-property-view-settings-label color-on-surface-variant">${context.variantText}</span>
|
|
7843
9420
|
<sf-dropdown
|
|
@@ -8038,7 +9615,7 @@ function renderField(context, field, editing, sectionKey = '', groupKey = '') {
|
|
|
8038
9615
|
${field.rare ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-property-view-rare color-on-surface-variant">${context.rareText}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8039
9616
|
${field.inherited && !editing ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<span class="sf-property-view-inherited color-on-surface-variant">${context.inheritedText}</span>` : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
8040
9617
|
</div>
|
|
8041
|
-
${editing || context.configuring || field.readonly === true || !context.mayEdit || context.openAll ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<div class="sf-property-view-field-value min-w-0 flex items-cross-center gap-2 flex-wrap">${renderFieldValue(context, field, editing, {
|
|
9618
|
+
${editing || context.configuring || field.readonly === true || !context.mayEdit || context.openAll ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`<div class="sf-property-view-field-value min-w-0 flex items-cross-center gap-2 flex-wrap">${(0,_field_value_js__WEBPACK_IMPORTED_MODULE_3__.renderFieldValue)(context, field, editing, {
|
|
8042
9619
|
disabled
|
|
8043
9620
|
})}</div>` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html)`
|
|
8044
9621
|
<button
|
|
@@ -8060,7 +9637,7 @@ function renderField(context, field, editing, sectionKey = '', groupKey = '') {
|
|
|
8060
9637
|
context.component.editGroup(sectionKey, groupKey);
|
|
8061
9638
|
}}
|
|
8062
9639
|
>
|
|
8063
|
-
${renderFieldValue(context, field, editing)}
|
|
9640
|
+
${(0,_field_value_js__WEBPACK_IMPORTED_MODULE_3__.renderFieldValue)(context, field, editing)}
|
|
8064
9641
|
<i class="sf-icon sf-icon--size-1/2 sf-property-view-pen" aria-hidden="true">edit</i>
|
|
8065
9642
|
</button>`}
|
|
8066
9643
|
${context.configuring ? renderFieldActions(context, field, key) : lit__WEBPACK_IMPORTED_MODULE_0__.nothing}
|
|
@@ -9380,6 +10957,15 @@ function settingSetters(Class, manifest) {
|
|
|
9380
10957
|
return Class;
|
|
9381
10958
|
}
|
|
9382
10959
|
|
|
10960
|
+
/***/ },
|
|
10961
|
+
|
|
10962
|
+
/***/ "f59c8bcdc90a"
|
|
10963
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
10964
|
+
|
|
10965
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10966
|
+
// extracted by mini-css-extract-plugin
|
|
10967
|
+
|
|
10968
|
+
|
|
9383
10969
|
/***/ },
|
|
9384
10970
|
|
|
9385
10971
|
/***/ "9e9dad7bcc09"
|
|
@@ -10358,7 +11944,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"$comment":"Dated aliases of sf-view-
|
|
|
10358
11944
|
/***/ "3ea81f4c3c20"
|
|
10359
11945
|
(module) {
|
|
10360
11946
|
|
|
10361
|
-
module.exports = /*#__PURE__*/JSON.parse('{"id":"smart.view-properties","tag":"sf-view-properties","version":"1.
|
|
11947
|
+
module.exports = /*#__PURE__*/JSON.parse('{"id":"smart.view-properties","tag":"sf-view-properties","version":"1.11.0","kind":"leaf","implements":["record-view@1"],"settings":{"add-field-text":{"type":"string","default-from":"runtime.add-field-text"},"add-group-text":{"type":"string","default-from":"runtime.add-group-text"},"add-section-text":{"type":"string","default-from":"runtime.add-section-text"},"back-label":{"type":"string","default-from":"runtime.back-label"},"cancel-configuring-text":{"type":"string","default-from":"runtime.cancel-configuring-text"},"cancel-name-text":{"type":"string","default-from":"runtime.cancel-name-text"},"cancel-text":{"type":"string","default-from":"runtime.cancel-text"},"changed-text":{"type":"string","default-from":"runtime.changed-text"},"close-label":{"type":"string","default-from":"runtime.close-label"},"collection":{"type":"string","default":""},"collection-icon":{"type":"icon","default":""},"collection-label":{"type":"string","default":""},"configure-hint-narrow-text":{"type":"string","default-from":"runtime.configure-hint-narrow-text"},"configure-hint-text":{"type":"string","default-from":"runtime.configure-hint-text"},"configure-text":{"type":"string","default-from":"runtime.configure-text"},"conflict-text":{"type":"string","default-from":"runtime.conflict-text"},"copy-link-label":{"type":"string","default-from":"runtime.copy-link-label"},"delete-text":{"type":"string","default-from":"runtime.delete-text"},"done-configuring-text":{"type":"string","default-from":"runtime.done-configuring-text"},"edit-text":{"type":"string","default-from":"runtime.edit-text"},"empty-record-text":{"type":"string","default-from":"runtime.empty-record-text"},"empty-text":{"type":"string","default-from":"runtime.empty-text"},"errors-text":{"type":"string","default-from":"runtime.errors-text"},"favourite":{"type":"boolean","default":false},"favourite-label":{"type":"string","default-from":"runtime.favourite-label"},"field-label-text":{"type":"string","default-from":"runtime.field-label-text"},"field-settings-text":{"type":"string","default-from":"runtime.field-settings-text"},"hidden-text":{"type":"string","default-from":"runtime.hidden-text"},"hide-rare-text":{"type":"string","default-from":"runtime.hide-rare-text"},"hint-text":{"type":"string","default-from":"runtime.hint-text"},"in-this-group-text":{"type":"string","default-from":"runtime.in-this-group-text"},"inherited-text":{"type":"string","default-from":"runtime.inherited-text"},"link-copied-label":{"type":"string","default-from":"runtime.link-copied-label"},"menu-label":{"type":"string","default-from":"runtime.menu-label"},"move-down-text":{"type":"string","default-from":"runtime.move-down-text"},"move-up-text":{"type":"string","default-from":"runtime.move-up-text"},"new-group-title":{"type":"string","default-from":"runtime.new-group-title"},"new-section-title":{"type":"string","default-from":"runtime.new-section-title"},"no-match-text":{"type":"string","default-from":"runtime.no-match-text"},"open-full-label":{"type":"string","default-from":"runtime.open-full-label"},"panel":{"type":"boolean","default":false},"panel-label":{"type":"string","default":""},"panel-size":{"type":"enum","values":["1/2","1","2","full"],"default":"1"},"size":{"type":"enum","values":["1","1/2"],"default":"1"},"mode":{"type":"enum","values":["view","auto","edit","create"],"default":"auto"},"panel-width":{"type":"string","default":""},"personal-layer-text":{"type":"string","default-from":"runtime.personal-layer-text"},"rare-text":{"type":"string","default-from":"runtime.rare-text"},"record-id":{"type":"id","default":""},"remove-field-text":{"type":"string","default-from":"runtime.remove-field-text"},"remove-group-text":{"type":"string","default-from":"runtime.remove-group-text"},"remove-section-text":{"type":"string","default-from":"runtime.remove-section-text"},"rename-text":{"type":"string","default-from":"runtime.rename-text"},"reset-view-ask-text":{"type":"string","default-from":"runtime.reset-view-ask-text"},"reset-view-text":{"type":"string","default-from":"runtime.reset-view-text"},"save-name-text":{"type":"string","default-from":"runtime.save-name-text"},"save-text":{"type":"string","default-from":"runtime.save-text"},"section-icon-text":{"type":"string","default-from":"runtime.section-icon-text"},"section-icons":{"type":"string","default":""},"sections-as":{"type":"enum","values":["list","tabs"],"default":"list"},"sections-label":{"type":"string","default-from":"runtime.sections-label"},"shared-layer-text":{"type":"string","default-from":"runtime.shared-layer-text"},"show-rare":{"type":"boolean","default":false},"show-rare-text":{"type":"string","default-from":"runtime.show-rare-text"},"shown-text":{"type":"string","default-from":"runtime.shown-text"},"unplaced-hint-text":{"type":"string","default-from":"runtime.unplaced-hint-text"},"unplaced-title":{"type":"string","default-from":"runtime.unplaced-title"},"variant-text":{"type":"string","default-from":"runtime.variant-text"},"view-conflict-text":{"type":"string","default-from":"runtime.view-conflict-text"},"view-denied-text":{"type":"string","default-from":"runtime.view-denied-text"},"width-text":{"type":"string","default-from":"runtime.width-text"},"view-profile-label":{"type":"string","default-from":"runtime.view-profile-label"},"add-view-text":{"type":"string","default-from":"runtime.add-view-text"},"new-view-text":{"type":"string","default-from":"runtime.new-view-text"},"delete-view-text":{"type":"string","default-from":"runtime.delete-view-text"},"last-shared-view-text":{"type":"string","default-from":"runtime.last-shared-view-text"},"full":{"type":"boolean","default":false},"open":{"type":"boolean","default":true}},"values":{"revision":{"type":"string"},"section":{"type":"string"}},"events":{"close":{"carries":{"reason":{"type":"enum","values":["close","escape","cancelled","deleted","api"]},"record_id":{"type":"id","nullable":true},"unsaved_fields":{"type":"list"}},"cancelable":true},"open-full":{"carries":{"id":"id","address":"string","record_id":{"type":"id","nullable":true}}},"saved":{"carries":{"id":"id","revision":{"type":"string","optional":true}}},"failed":{"carries":{"reason":"string","message":{"type":"string","optional":true}}},"open":{"carries":{"field":"string","value":"object","answer":"string"}},"delete":{"carries":{"collection":"string","revision":"string","answer":"string","record_id":{"type":"id","nullable":true}}},"created":{"carries":{"collection":{"type":"string","nullable":true},"record_id":{"type":"id","nullable":true}}},"cancel":{"carries":{"mode":{"type":"enum","values":["auto","edit","create"]},"scope":{"type":"enum","values":["group"],"optional":true},"section":{"type":"string","optional":true},"group":{"type":"string","optional":true}}},"state":{"carries":{"state":"string","message":"string"},"own-verb":true},"address-copy":{"carries":{},"own-verb":true},"favourite":{"carries":{"collection":{"type":"string","nullable":true},"favourite":"boolean","record_id":{"type":"id","nullable":true}},"own-verb":true}},"actions":{"refresh":{},"load":{"with":{"reason":{"type":"string","optional":true}}},"edit-group":{"with":{"section":"string","group":"string"}},"cancel-edit":{},"save-group":{"with":{"options":{"type":"object","optional":true}},"concurrency":"drop"},"select-section":{"with":{"key":"string"}},"close-panel":{"with":{"reason":{"type":"string","optional":true}}},"copy-address":{},"open-full-page":{},"confirm-save":{},"cancel-confirmation":{}},"port":{"id":"simai.property-view-port","version":"1.17.0","contract":"src/core/contracts/ports/simai.property-view-port/1.17.0/port.json"},"presentation":{"skeleton":{"file":"skeleton.html","late":[]}},"css-variables":{"--sf-property-view--sections-width":{"type":"length","state":"default"},"--sf-property-view--title-size":{"type":"length","state":"default"},"--sf-property-view--label-size":{"type":"length","state":"default"},"--sf-property-view--value-size":{"type":"length","state":"default"},"--sf-property-view--group-size":{"type":"length","state":"default"},"--sf-property-view--edge-room":{"type":"length","state":"open"}},"host-states":{"data-state":"string","aria-busy":"string"}}');
|
|
10362
11948
|
|
|
10363
11949
|
/***/ },
|
|
10364
11950
|
|