@lotics/ui 46.8.0 → 46.8.1
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/docs/catalog.md +5 -2
- package/examples/tpl_money.tsx +24 -3
- package/package.json +1 -1
- package/src/charge_lines.tsx +6 -3
package/docs/catalog.md
CHANGED
|
@@ -199,7 +199,10 @@ notion of adjustments or of three sides.
|
|
|
199
199
|
- **The total is the sum of what is on screen.** Never a figure computed off a different array: a
|
|
200
200
|
total that is not the sum of something visible is the one figure a reader cannot check.
|
|
201
201
|
- **The row's verb sits in a fixed slot**, so the money column does not shift between a row that
|
|
202
|
-
can be removed and one that cannot. `locked` turns the editors into values for a settled charge
|
|
202
|
+
can be removed and one that cannot. `locked` turns the editors into values for a settled charge
|
|
203
|
+
and silences EVERY verb on the band — the row's own and both money verbs. A verb on a figure
|
|
204
|
+
nobody can change is a control with nothing behind it, and a disabled one that merely repeats
|
|
205
|
+
the value beside it prints the same number twice on one line.
|
|
203
206
|
- **Below its fork width** the name takes its own line and the arithmetic sits under it — a
|
|
204
207
|
two-line row ON PURPOSE, measured on the band's own container because it lives in drawers as
|
|
205
208
|
often as on pages. The arithmetic RIGHT-ALIGNS to the band there: laid out from the left it
|
|
@@ -1392,7 +1395,7 @@ source (`src/<module>.tsx`/`.ts`) is the API reference.
|
|
|
1392
1395
|
it, and the row's own verb (`action`, usually removal) sits in a slot held open on every row —
|
|
1393
1396
|
both so the money column cannot move between rows. `extra` carries a second control belonging
|
|
1394
1397
|
to the charge (how it was paid); `warning` names a problem on the line that has it; `locked`
|
|
1395
|
-
turns the editors into values for a settled band; `empty` speaks for a record nobody has priced
|
|
1398
|
+
turns the editors into values for a settled band and draws no verb of any kind; `empty` speaks for a record nobody has priced
|
|
1396
1399
|
yet. `formatMoney` is the BAND's, so two lines cannot disagree about a currency, and the `total`
|
|
1397
1400
|
you pass must be the sum of the lines on screen. Below its fork width the row takes two lines
|
|
1398
1401
|
with the arithmetic right-aligned to the band — see § "Money you are PRICING" for the full
|
package/examples/tpl_money.tsx
CHANGED
|
@@ -953,13 +953,34 @@ export function TplMoney() {
|
|
|
953
953
|
stops. The section beat and the heading are what separate them. */}
|
|
954
954
|
<Section>
|
|
955
955
|
<SectionHeading>
|
|
956
|
-
<SectionHeadingTitle description="Locked turns the editors into values once the money is collected — the band stops being a form and becomes the record of what was charged
|
|
956
|
+
<SectionHeadingTitle description="Locked turns the editors into values once the money is collected — the band stops being a form and becomes the record of what was charged. Every verb goes with them: a caller keeps passing the same props, and the band draws none of them.">
|
|
957
957
|
Settled
|
|
958
958
|
</SectionHeadingTitle>
|
|
959
959
|
</SectionHeading>
|
|
960
|
+
{/* The verbs are passed EXACTLY as the editable band passes them, which
|
|
961
|
+
is what a real caller does — the same JSX renders a charge before and
|
|
962
|
+
after the money is collected. The BAND is what decides they are not
|
|
963
|
+
drawn, so this section is also the check on that: a verb surviving
|
|
964
|
+
here is a control acting on a figure nobody can change, and a
|
|
965
|
+
disabled one repeating the value beside it prints the same number
|
|
966
|
+
twice on one line. */}
|
|
960
967
|
<ChargeLines totalLabel="Collected" total={190_000} formatMoney={money}>
|
|
961
|
-
<ChargeLine
|
|
962
|
-
|
|
968
|
+
<ChargeLine
|
|
969
|
+
label="Delivery runs"
|
|
970
|
+
quantity={40}
|
|
971
|
+
unitPrice={4_000}
|
|
972
|
+
locked
|
|
973
|
+
unitPriceActions={<InlineButton title={money(CEILING_RATE)} accessibilityLabel="Apply the ceiling rate" disabled onPress={() => {}} />}
|
|
974
|
+
action={<IconButton icon="x" size="sm" color="danger" tooltip="Remove this charge" onPress={() => {}} />}
|
|
975
|
+
/>
|
|
976
|
+
<ChargeLine
|
|
977
|
+
label="Site cleaning"
|
|
978
|
+
quantity={1}
|
|
979
|
+
unitPrice={30_000}
|
|
980
|
+
locked
|
|
981
|
+
unitPriceActions={<InlineButton title={money(CEILING_RATE)} accessibilityLabel="Apply the ceiling rate" disabled onPress={() => {}} />}
|
|
982
|
+
action={<IconButton icon="x" size="sm" color="danger" tooltip="Remove this charge" onPress={() => {}} />}
|
|
983
|
+
/>
|
|
963
984
|
</ChargeLines>
|
|
964
985
|
</Section>
|
|
965
986
|
|
package/package.json
CHANGED
package/src/charge_lines.tsx
CHANGED
|
@@ -103,7 +103,10 @@ export interface ChargeLineProps {
|
|
|
103
103
|
/** The row's own verb, usually removal. Rendered in a fixed slot so the money
|
|
104
104
|
* column does not move between a row that has one and a row that does not. */
|
|
105
105
|
action?: ReactNode;
|
|
106
|
-
/** Read-only band: editors become values, and
|
|
106
|
+
/** Read-only band: editors become values, and NO verb is drawn — not the row's
|
|
107
|
+
* action and not either money verb. A verb on a figure nobody can change is a
|
|
108
|
+
* control with nothing behind it, and a disabled one that merely repeats the
|
|
109
|
+
* value beside it prints the same number twice. */
|
|
107
110
|
locked?: boolean;
|
|
108
111
|
}
|
|
109
112
|
|
|
@@ -252,7 +255,7 @@ export function ChargeLine(props: ChargeLineProps) {
|
|
|
252
255
|
sharing this column with a row that has none. Width is the verb's own —
|
|
253
256
|
the contract is that a caller passes it on every row and DISABLES it
|
|
254
257
|
where it has nothing to do, which is what keeps the rows equal. */}
|
|
255
|
-
{!priced ? null : unitPriceActions}
|
|
258
|
+
{!priced || locked ? null : unitPriceActions}
|
|
256
259
|
{/* The amount ENDS the expression it derives from. Put it on a second
|
|
257
260
|
line and the reader parses left to right, then jumps back to find the
|
|
258
261
|
answer — and it lands in no column, so the total below closes nothing. */}
|
|
@@ -276,7 +279,7 @@ export function ChargeLine(props: ChargeLineProps) {
|
|
|
276
279
|
{/* The flat line's twin of `unitPriceActions`, on the figure a flat line
|
|
277
280
|
actually edits — its amount. Same contract: pass it on every row and
|
|
278
281
|
disable it where it has nothing to do. */}
|
|
279
|
-
{priced ? null : amountActions}
|
|
282
|
+
{priced || locked ? null : amountActions}
|
|
280
283
|
{/* Held open whether or not this row has a verb, so the money column does
|
|
281
284
|
not shift between a row that can be removed and one that cannot. */}
|
|
282
285
|
<View style={styles.actionSlot}>{locked ? null : action}</View>
|