@stonecrop/aform 0.16.2 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aform.d.ts +42 -0
- package/dist/aform.js +1216 -3802
- package/dist/aform.js.map +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/types/index.d.ts +37 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +7 -7
- package/src/components/form/ACurrencyInput.vue +357 -0
- package/src/components/form/ADatePicker.vue +1 -1
- package/src/components/form/AFormLink.vue +79 -12
- package/src/components/form/AQuantityInput.vue +4 -4
- package/src/index.ts +3 -0
- package/src/types/index.ts +39 -0
package/dist/aform.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ACheckbox from './components/form/ACheckbox.vue';
|
|
2
|
+
import ACurrencyInput from './components/form/ACurrencyInput.vue';
|
|
2
3
|
import ADate from './components/form/ADate.vue';
|
|
3
4
|
import ADatePicker from './components/form/ADatePicker.vue';
|
|
4
5
|
import ADateRange from './components/form/ADateRange.vue';
|
|
@@ -25,6 +26,8 @@ import type { ValueField } from '@stonecrop/schema';
|
|
|
25
26
|
|
|
26
27
|
export { ACheckbox }
|
|
27
28
|
|
|
29
|
+
export { ACurrencyInput }
|
|
30
|
+
|
|
28
31
|
export { ADate }
|
|
29
32
|
|
|
30
33
|
export { ADatePicker }
|
|
@@ -139,6 +142,45 @@ export declare type ComponentProps = {
|
|
|
139
142
|
errors?: string[];
|
|
140
143
|
};
|
|
141
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Type-specific configuration for ACurrencyInput, passed via the field's `options` property.
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export declare interface CurrencyOptions {
|
|
150
|
+
/** Currency doctype name, used for FK resolution via `aformLinkResolver`. The currency picker is embedded, so it renders no navigate button. */
|
|
151
|
+
doctype?: string;
|
|
152
|
+
/** The record's base currency — fixed, not user-editable. A bare id resolves to displayText via `aformLinkResolver`. */
|
|
153
|
+
baseCurrency?: AFormLinkValue | string;
|
|
154
|
+
/** Exchange rate lookup for each non-base currency id, relative to `baseCurrency` (which is implicitly `1`) */
|
|
155
|
+
exchangeRates?: Record<string, number>;
|
|
156
|
+
/** Decimal places to round the derived `baseAmount` to — the base currency's scale (JPY carries 0, most carry 2, KWD 3). Applies only to `baseAmount`; the entered `amount` is left as typed. Omit to round only enough to shed binary floating-point noise, which never discards a digit the rate actually produced. A non-integer or out-of-range value falls back to that default. */
|
|
157
|
+
precision?: number;
|
|
158
|
+
/** Search function backing the `currency` autocomplete dropdown — see AFormLink's `filterFunction` */
|
|
159
|
+
filterFunction?: string | ((search: string) => AFormLinkValue[] | Promise<AFormLinkValue[]>);
|
|
160
|
+
/** Whether `filterFunction` results should show a loading state — see AFormLink's `isAsync` */
|
|
161
|
+
isAsync?: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The value shape for ACurrencyInput — an amount paired with its currency (an
|
|
166
|
+
* {@link AFormLinkValue} FK reference), plus the derived base-currency-equivalent amount.
|
|
167
|
+
* `exchangeRate` is carried on the value so it round-trips with the record even though it is
|
|
168
|
+
* never directly edited by the user.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
export declare interface CurrencyValue {
|
|
172
|
+
/** The entered amount, in `currency` units */
|
|
173
|
+
amount: number;
|
|
174
|
+
/** FK reference to the Currency doctype the user entered `amount` in */
|
|
175
|
+
currency: AFormLinkValue;
|
|
176
|
+
/** `amount` converted into `baseCurrency` units — `amount * exchangeRate` */
|
|
177
|
+
baseAmount: number;
|
|
178
|
+
/** The record's base currency — fixed, not user-editable */
|
|
179
|
+
baseCurrency: AFormLinkValue;
|
|
180
|
+
/** Multiplier from `currency` to `baseCurrency` — hidden from the UI, drives `baseAmount` */
|
|
181
|
+
exchangeRate: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
142
184
|
/**
|
|
143
185
|
* Deserializes a stringified function expression into a typed callable.
|
|
144
186
|
*
|