@fieldia/core 0.23.0 → 0.25.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 +211 -3
- package/package.json +1 -1
- package/schema/page.schema.json +1051 -325
- package/src/index.d.mts +9 -2
- package/src/index.d.ts +9 -2
- package/src/index.js +31 -1
- package/src/index.js.map +1 -1
- package/src/index.mjs +12 -2
- package/src/index.mjs.map +1 -1
- package/src/lib/format/actions.d.mts +31 -1
- package/src/lib/format/actions.d.ts +31 -1
- package/src/lib/format/actions.js +1 -0
- package/src/lib/format/actions.js.map +1 -1
- package/src/lib/format/actions.mjs +1 -0
- package/src/lib/format/actions.mjs.map +1 -1
- package/src/lib/format/autofill-group.d.mts +12 -0
- package/src/lib/format/autofill-group.d.ts +12 -0
- package/src/lib/format/autofill-group.js +23 -0
- package/src/lib/format/autofill-group.js.map +1 -0
- package/src/lib/format/autofill-group.mjs +19 -0
- package/src/lib/format/autofill-group.mjs.map +1 -0
- package/src/lib/format/autofill.d.mts +14 -0
- package/src/lib/format/autofill.d.ts +14 -0
- package/src/lib/format/autofill.js +54 -0
- package/src/lib/format/autofill.js.map +1 -0
- package/src/lib/format/autofill.mjs +48 -0
- package/src/lib/format/autofill.mjs.map +1 -0
- package/src/lib/format/bulk-edit.d.mts +18 -0
- package/src/lib/format/bulk-edit.d.ts +18 -0
- package/src/lib/format/bulk-edit.js +26 -0
- package/src/lib/format/bulk-edit.js.map +1 -0
- package/src/lib/format/bulk-edit.mjs +21 -0
- package/src/lib/format/bulk-edit.mjs.map +1 -0
- package/src/lib/format/duplicate-kinds.d.mts +10 -0
- package/src/lib/format/duplicate-kinds.d.ts +10 -0
- package/src/lib/format/duplicate-kinds.js +14 -0
- package/src/lib/format/duplicate-kinds.js.map +1 -0
- package/src/lib/format/duplicate-kinds.mjs +10 -0
- package/src/lib/format/duplicate-kinds.mjs.map +1 -0
- package/src/lib/format/duplicates.d.mts +22 -0
- package/src/lib/format/duplicates.d.ts +22 -0
- package/src/lib/format/duplicates.js +24 -0
- package/src/lib/format/duplicates.js.map +1 -0
- package/src/lib/format/duplicates.mjs +21 -0
- package/src/lib/format/duplicates.mjs.map +1 -0
- package/src/lib/format/field.d.mts +291 -34
- package/src/lib/format/field.d.ts +291 -34
- package/src/lib/format/field.js +19 -4
- package/src/lib/format/field.js.map +1 -1
- package/src/lib/format/field.mjs +17 -2
- package/src/lib/format/field.mjs.map +1 -1
- package/src/lib/format/import-fields.d.mts +18 -0
- package/src/lib/format/import-fields.d.ts +18 -0
- package/src/lib/format/import-fields.js +26 -0
- package/src/lib/format/import-fields.js.map +1 -0
- package/src/lib/format/import-fields.mjs +21 -0
- package/src/lib/format/import-fields.mjs.map +1 -0
- package/src/lib/format/layout.d.mts +7357 -3127
- package/src/lib/format/layout.d.ts +7357 -3127
- package/src/lib/format/layout.js +108 -32
- package/src/lib/format/layout.js.map +1 -1
- package/src/lib/format/layout.mjs +107 -32
- package/src/lib/format/layout.mjs.map +1 -1
- package/src/lib/format/layout.types.d.mts +5 -2
- package/src/lib/format/layout.types.d.ts +5 -2
- package/src/lib/format/page.d.mts +1080 -106
- package/src/lib/format/page.d.ts +1080 -106
- package/src/lib/format/page.js +25 -0
- package/src/lib/format/page.js.map +1 -1
- package/src/lib/format/page.mjs +26 -1
- package/src/lib/format/page.mjs.map +1 -1
- package/src/lib/format/phone.d.mts +27 -0
- package/src/lib/format/phone.d.ts +27 -0
- package/src/lib/format/phone.js +43 -0
- package/src/lib/format/phone.js.map +1 -0
- package/src/lib/format/phone.mjs +39 -0
- package/src/lib/format/phone.mjs.map +1 -0
- package/src/lib/format/references.d.mts +39 -0
- package/src/lib/format/references.d.ts +39 -0
- package/src/lib/format/references.js +263 -20
- package/src/lib/format/references.js.map +1 -1
- package/src/lib/format/references.mjs +263 -20
- package/src/lib/format/references.mjs.map +1 -1
- package/src/lib/format/slots-options.d.mts +26 -0
- package/src/lib/format/slots-options.d.ts +26 -0
- package/src/lib/format/slots-options.js +35 -0
- package/src/lib/format/slots-options.js.map +1 -0
- package/src/lib/format/slots-options.mjs +31 -0
- package/src/lib/format/slots-options.mjs.map +1 -0
- package/src/lib/format/translate.js +8 -4
- package/src/lib/format/translate.js.map +1 -1
- package/src/lib/format/translate.mjs +8 -4
- package/src/lib/format/translate.mjs.map +1 -1
- package/src/lib/format/upgrade.d.mts +8 -3
- package/src/lib/format/upgrade.d.ts +8 -3
- package/src/lib/format/upgrade.js +8 -3
- package/src/lib/format/upgrade.js.map +1 -1
- package/src/lib/format/upgrade.mjs +8 -3
- package/src/lib/format/upgrade.mjs.map +1 -1
- package/src/lib/format/version.d.mts +2 -2
- package/src/lib/format/version.d.ts +2 -2
- package/src/lib/format/version.js +2 -2
- package/src/lib/format/version.js.map +1 -1
- package/src/lib/format/version.mjs +2 -2
- package/src/lib/format/version.mjs.map +1 -1
- package/src/lib/format/zoned.d.mts +8 -0
- package/src/lib/format/zoned.d.ts +8 -0
- package/src/lib/format/zoned.js +36 -0
- package/src/lib/format/zoned.js.map +1 -0
- package/src/lib/format/zoned.mjs +33 -0
- package/src/lib/format/zoned.mjs.map +1 -0
- package/src/lib/record/check.d.mts +6 -1
- package/src/lib/record/check.d.ts +6 -1
- package/src/lib/record/check.js +12 -4
- package/src/lib/record/check.js.map +1 -1
- package/src/lib/record/check.mjs +12 -4
- package/src/lib/record/check.mjs.map +1 -1
- package/src/lib/record/data-source.d.mts +309 -3
- package/src/lib/record/data-source.d.ts +309 -3
- package/src/lib/record/data-source.js +16 -0
- package/src/lib/record/data-source.js.map +1 -1
- package/src/lib/record/data-source.mjs +15 -0
- package/src/lib/record/data-source.mjs.map +1 -1
- package/src/lib/record/form.d.mts +116 -25
- package/src/lib/record/form.d.ts +116 -25
- package/src/lib/record/form.js +457 -78
- package/src/lib/record/form.js.map +1 -1
- package/src/lib/record/form.mjs +457 -78
- package/src/lib/record/form.mjs.map +1 -1
- package/src/lib/record/input-rules.d.mts +51 -9
- package/src/lib/record/input-rules.d.ts +51 -9
- package/src/lib/record/input-rules.js +119 -20
- package/src/lib/record/input-rules.js.map +1 -1
- package/src/lib/record/input-rules.mjs +118 -19
- package/src/lib/record/input-rules.mjs.map +1 -1
- package/src/lib/record/inputs.js +4 -2
- package/src/lib/record/inputs.js.map +1 -1
- package/src/lib/record/inputs.mjs +4 -2
- package/src/lib/record/inputs.mjs.map +1 -1
- package/src/lib/record/limits.d.mts +1 -1
- package/src/lib/record/limits.d.ts +1 -1
- package/src/lib/record/limits.js +4 -2
- package/src/lib/record/limits.js.map +1 -1
- package/src/lib/record/limits.mjs +4 -2
- package/src/lib/record/limits.mjs.map +1 -1
- package/src/lib/record/locales/ar.js +3 -2
- package/src/lib/record/locales/ar.js.map +1 -1
- package/src/lib/record/locales/ar.mjs +3 -2
- package/src/lib/record/locales/ar.mjs.map +1 -1
- package/src/lib/record/locales/de.js +3 -2
- package/src/lib/record/locales/de.js.map +1 -1
- package/src/lib/record/locales/de.mjs +3 -2
- package/src/lib/record/locales/de.mjs.map +1 -1
- package/src/lib/record/locales/fr.js +3 -2
- package/src/lib/record/locales/fr.js.map +1 -1
- package/src/lib/record/locales/fr.mjs +3 -2
- package/src/lib/record/locales/fr.mjs.map +1 -1
- package/src/lib/record/memory-data-source.d.mts +20 -2
- package/src/lib/record/memory-data-source.d.ts +20 -2
- package/src/lib/record/memory-data-source.js +153 -35
- package/src/lib/record/memory-data-source.js.map +1 -1
- package/src/lib/record/memory-data-source.mjs +154 -36
- package/src/lib/record/memory-data-source.mjs.map +1 -1
- package/src/lib/record/memory-duplicates.d.mts +19 -0
- package/src/lib/record/memory-duplicates.d.ts +19 -0
- package/src/lib/record/memory-duplicates.js +78 -0
- package/src/lib/record/memory-duplicates.js.map +1 -0
- package/src/lib/record/memory-duplicates.mjs +74 -0
- package/src/lib/record/memory-duplicates.mjs.map +1 -0
- package/src/lib/record/memory-schedules.d.mts +45 -0
- package/src/lib/record/memory-schedules.d.ts +45 -0
- package/src/lib/record/memory-schedules.js +81 -0
- package/src/lib/record/memory-schedules.js.map +1 -0
- package/src/lib/record/memory-schedules.mjs +78 -0
- package/src/lib/record/memory-schedules.mjs.map +1 -0
- package/src/lib/record/messages.d.mts +3 -1
- package/src/lib/record/messages.d.ts +3 -1
- package/src/lib/record/messages.js +3 -2
- package/src/lib/record/messages.js.map +1 -1
- package/src/lib/record/messages.mjs +3 -2
- package/src/lib/record/messages.mjs.map +1 -1
- package/src/lib/record/periods.d.mts +47 -0
- package/src/lib/record/periods.d.ts +47 -0
- package/src/lib/record/periods.js +86 -0
- package/src/lib/record/periods.js.map +1 -0
- package/src/lib/record/periods.mjs +79 -0
- package/src/lib/record/periods.mjs.map +1 -0
- package/src/lib/record/rules.js +5 -6
- package/src/lib/record/rules.js.map +1 -1
- package/src/lib/record/rules.mjs +5 -6
- package/src/lib/record/rules.mjs.map +1 -1
- package/src/lib/record/run.d.mts +75 -9
- package/src/lib/record/run.d.ts +75 -9
- package/src/lib/record/run.js +169 -26
- package/src/lib/record/run.js.map +1 -1
- package/src/lib/record/run.mjs +170 -27
- package/src/lib/record/run.mjs.map +1 -1
- package/src/lib/record/search.d.mts +13 -3
- package/src/lib/record/search.d.ts +13 -3
- package/src/lib/record/search.js +11 -4
- package/src/lib/record/search.js.map +1 -1
- package/src/lib/record/search.mjs +11 -4
- package/src/lib/record/search.mjs.map +1 -1
- package/src/lib/record/waits.d.mts +32 -0
- package/src/lib/record/waits.d.ts +32 -0
- package/src/lib/record/waits.js +89 -0
- package/src/lib/record/waits.js.map +1 -0
- package/src/lib/record/waits.mjs +85 -0
- package/src/lib/record/waits.mjs.map +1 -0
- package/src/lib/record/zones.d.mts +57 -0
- package/src/lib/record/zones.d.ts +57 -0
- package/src/lib/record/zones.js +147 -0
- package/src/lib/record/zones.js.map +1 -0
- package/src/lib/record/zones.mjs +132 -0
- package/src/lib/record/zones.mjs.map +1 -0
- package/src/runtime.d.mts +19 -9
- package/src/runtime.d.ts +19 -9
- package/src/runtime.js +37 -2
- package/src/runtime.js.map +1 -1
- package/src/runtime.mjs +9 -2
- package/src/runtime.mjs.map +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a box is filled in with by the browser — its autocomplete purpose,
|
|
3
|
+
* from the WHATWG HTML standard's list ("Autofilling form controls: the
|
|
4
|
+
* autocomplete attribute") — and the keyboard a phone shows for it.
|
|
5
|
+
*
|
|
6
|
+
* A field placed on a page may name its purpose (`autocomplete`): one of the
|
|
7
|
+
* names below, after which `section-…` and `shipping` or `billing` may come
|
|
8
|
+
* first, `home`, `work`, `mobile`, `fax` or `pager` before a phone, an email
|
|
9
|
+
* or an `impp`, and `webauthn` last — "shipping postal-code", "work email" —
|
|
10
|
+
* or `off`, so the browser offers nothing. An address in parts names each
|
|
11
|
+
* part's own purpose, so its field gives only the group: "shipping",
|
|
12
|
+
* "section-home billing", or `off`. Written in small letters.
|
|
13
|
+
*/
|
|
14
|
+
import { autofillGroupProblem } from './autofill-group.mjs';
|
|
15
|
+
export { INPUT_MODES } from './autofill-group.mjs';
|
|
16
|
+
/** The purposes a box may name, but a phone's, an email's and an instant messenger's (`AUTOFILL_CONTACT`). */
|
|
17
|
+
export const AUTOFILL_NAMES = [
|
|
18
|
+
'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname',
|
|
19
|
+
'username', 'new-password', 'current-password', 'one-time-code', 'organization-title', 'organization',
|
|
20
|
+
'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3',
|
|
21
|
+
'address-level2', 'address-level1', 'country', 'country-name', 'postal-code',
|
|
22
|
+
'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month',
|
|
23
|
+
'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount',
|
|
24
|
+
'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo',
|
|
25
|
+
];
|
|
26
|
+
/** The purposes that may say whose they are (`home`, `work`, `mobile`, `fax`, `pager` before them). */
|
|
27
|
+
export const AUTOFILL_CONTACT = ['tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'email', 'impp'];
|
|
28
|
+
const GROUP = '(?:section-\\S*(?: +(?:shipping|billing))?|shipping|billing)';
|
|
29
|
+
const PURPOSE = `(?:${AUTOFILL_NAMES.join('|')}|(?:(?:home|work|mobile|fax|pager) +)?(?:${AUTOFILL_CONTACT.join('|')}))`;
|
|
30
|
+
/** A purpose as a page may write it: `on`, `off`, a group alone (an address's), or a purpose with its group first and `webauthn` last. */
|
|
31
|
+
export const AUTOFILL = new RegExp(`^(?:on|off|${GROUP}|(?:${GROUP} +)?${PURPOSE}(?: +webauthn)?)$`);
|
|
32
|
+
/**
|
|
33
|
+
* Why a field placed on a page cannot name this purpose, or null when it can: one the standard does not list, a group
|
|
34
|
+
* with no purpose on a box, a purpose on an address in parts (`parts`), which names each part's own.
|
|
35
|
+
*/
|
|
36
|
+
export function autofillProblem(value, parts = false) {
|
|
37
|
+
if (!AUTOFILL.test(value)) {
|
|
38
|
+
return `"${value}" is no purpose a browser fills in: use one of the HTML standard's, in small letters, such as "email", "given-name", "shipping postal-code" or "off"`;
|
|
39
|
+
}
|
|
40
|
+
return autofillGroupProblem(value, parts);
|
|
41
|
+
}
|
|
42
|
+
/** The purpose itself, its group and whose it is left out: "shipping work tel" is "tel"; empty for `on`, `off` and a group alone. */
|
|
43
|
+
export function autofillPurpose(value) {
|
|
44
|
+
const words = value.split(/ +/).filter((word) => word !== 'webauthn');
|
|
45
|
+
const last = words[words.length - 1] ?? '';
|
|
46
|
+
return AUTOFILL_NAMES.includes(last) || AUTOFILL_CONTACT.includes(last) ? last : '';
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=autofill.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofill.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/autofill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,8GAA8G;AAC9G,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU;IAC1G,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc;IACrG,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB;IACvG,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa;IAC5E,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc;IACzG,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,sBAAsB,EAAE,oBAAoB;IAChF,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO;CACxE,CAAC;AAEX,uGAAuG;AACvG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAE7L,MAAM,KAAK,GAAG,8DAA8D,CAAC;AAC7E,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,4CAA4C,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;AAEzH,0IAA0I;AAC1I,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,cAAc,KAAK,OAAO,KAAK,OAAO,OAAO,mBAAmB,CAAC,CAAC;AAErG;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,KAAK,GAAG,KAAK;IAC1D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,KAAK,sJAAsJ,CAAC;IACzK,CAAC;IACD,OAAO,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,qIAAqI;AACrI,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,OAAQ,cAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAK,gBAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACpI,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Field } from './field.mjs';
|
|
2
|
+
import type { ListNode } from './layout.mjs';
|
|
3
|
+
import type { Page } from './page.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* The kinds of field one value can set in many records at once (a list's
|
|
6
|
+
* `bulkEdit`): words, numbers, money, yes or no, a day, a choice and a link.
|
|
7
|
+
* Never a table of lines, links, files, formatted text, JSON or properties,
|
|
8
|
+
* which one value would wipe or cannot say.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BULK_KINDS: ReadonlySet<string>;
|
|
11
|
+
/** Whether a field can be set in many records at once: of such a kind, neither read-only nor worked out from others. */
|
|
12
|
+
export declare function bulkSettable(def: Field | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The fields a list's Edit offers, in order: none unless the list says
|
|
15
|
+
* `bulkEdit`; with true, its columns that can be set; with a list, those of
|
|
16
|
+
* it that can.
|
|
17
|
+
*/
|
|
18
|
+
export declare function bulkEditFields(page: Page, list: ListNode): string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Field } from './field';
|
|
2
|
+
import type { ListNode } from './layout';
|
|
3
|
+
import type { Page } from './page';
|
|
4
|
+
/**
|
|
5
|
+
* The kinds of field one value can set in many records at once (a list's
|
|
6
|
+
* `bulkEdit`): words, numbers, money, yes or no, a day, a choice and a link.
|
|
7
|
+
* Never a table of lines, links, files, formatted text, JSON or properties,
|
|
8
|
+
* which one value would wipe or cannot say.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BULK_KINDS: ReadonlySet<string>;
|
|
11
|
+
/** Whether a field can be set in many records at once: of such a kind, neither read-only nor worked out from others. */
|
|
12
|
+
export declare function bulkSettable(def: Field | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The fields a list's Edit offers, in order: none unless the list says
|
|
15
|
+
* `bulkEdit`; with true, its columns that can be set; with a list, those of
|
|
16
|
+
* it that can.
|
|
17
|
+
*/
|
|
18
|
+
export declare function bulkEditFields(page: Page, list: ListNode): string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BULK_KINDS = void 0;
|
|
4
|
+
exports.bulkSettable = bulkSettable;
|
|
5
|
+
exports.bulkEditFields = bulkEditFields;
|
|
6
|
+
/**
|
|
7
|
+
* The kinds of field one value can set in many records at once (a list's
|
|
8
|
+
* `bulkEdit`): words, numbers, money, yes or no, a day, a choice and a link.
|
|
9
|
+
* Never a table of lines, links, files, formatted text, JSON or properties,
|
|
10
|
+
* which one value would wipe or cannot say.
|
|
11
|
+
*/
|
|
12
|
+
exports.BULK_KINDS = new Set(['char', 'text', 'integer', 'float', 'monetary', 'boolean', 'date', 'datetime', 'selection', 'many2one']);
|
|
13
|
+
/** Whether a field can be set in many records at once: of such a kind, neither read-only nor worked out from others. */
|
|
14
|
+
function bulkSettable(def) {
|
|
15
|
+
return !!def && exports.BULK_KINDS.has(def.type) && def.readonly !== true && !def.compute;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The fields a list's Edit offers, in order: none unless the list says
|
|
19
|
+
* `bulkEdit`; with true, its columns that can be set; with a list, those of
|
|
20
|
+
* it that can.
|
|
21
|
+
*/
|
|
22
|
+
function bulkEditFields(page, list) {
|
|
23
|
+
const named = list.bulkEdit === true ? list.columns : Array.isArray(list.bulkEdit) ? list.bulkEdit : [];
|
|
24
|
+
return [...new Set(named)].filter((name) => bulkSettable(page.fields[name]));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=bulk-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-edit.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/bulk-edit.ts"],"names":[],"mappings":";;;AAaA,oCAEC;AAOD,wCAGC;AArBD;;;;;GAKG;AACU,QAAA,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjK,wHAAwH;AACxH,SAAgB,YAAY,CAAC,GAAsB;IACjD,OAAO,CAAC,CAAC,GAAG,IAAI,kBAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAU,EAAE,IAAc;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxG,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds of field one value can set in many records at once (a list's
|
|
3
|
+
* `bulkEdit`): words, numbers, money, yes or no, a day, a choice and a link.
|
|
4
|
+
* Never a table of lines, links, files, formatted text, JSON or properties,
|
|
5
|
+
* which one value would wipe or cannot say.
|
|
6
|
+
*/
|
|
7
|
+
export const BULK_KINDS = new Set(['char', 'text', 'integer', 'float', 'monetary', 'boolean', 'date', 'datetime', 'selection', 'many2one']);
|
|
8
|
+
/** Whether a field can be set in many records at once: of such a kind, neither read-only nor worked out from others. */
|
|
9
|
+
export function bulkSettable(def) {
|
|
10
|
+
return !!def && BULK_KINDS.has(def.type) && def.readonly !== true && !def.compute;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The fields a list's Edit offers, in order: none unless the list says
|
|
14
|
+
* `bulkEdit`; with true, its columns that can be set; with a list, those of
|
|
15
|
+
* it that can.
|
|
16
|
+
*/
|
|
17
|
+
export function bulkEditFields(page, list) {
|
|
18
|
+
const named = list.bulkEdit === true ? list.columns : Array.isArray(list.bulkEdit) ? list.bulkEdit : [];
|
|
19
|
+
return [...new Set(named)].filter((name) => bulkSettable(page.fields[name]));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=bulk-edit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-edit.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/bulk-edit.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjK,wHAAwH;AACxH,MAAM,UAAU,YAAY,CAAC,GAAsB;IACjD,OAAO,CAAC,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AACpF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,IAAc;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxG,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Field } from './field.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* The kinds of field a record is compared by, for possible duplicates (`duplicates` on a page): words (a name, a
|
|
4
|
+
* phone, an email, an id), a number (an id kept as one), a day (a birthday), a choice or a link (a company). Never a
|
|
5
|
+
* table, links, a file, formatted text or JSON, whose likeness is no one value's. Apart from the format's schema
|
|
6
|
+
* (duplicates.ts), so the page's quick check carries no validation library.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DUPLICATE_KINDS: ReadonlySet<string>;
|
|
9
|
+
/** Whether records may be compared by this field: of such a kind. */
|
|
10
|
+
export declare const comparable: (def: Field | undefined) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Field } from './field';
|
|
2
|
+
/**
|
|
3
|
+
* The kinds of field a record is compared by, for possible duplicates (`duplicates` on a page): words (a name, a
|
|
4
|
+
* phone, an email, an id), a number (an id kept as one), a day (a birthday), a choice or a link (a company). Never a
|
|
5
|
+
* table, links, a file, formatted text or JSON, whose likeness is no one value's. Apart from the format's schema
|
|
6
|
+
* (duplicates.ts), so the page's quick check carries no validation library.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DUPLICATE_KINDS: ReadonlySet<string>;
|
|
9
|
+
/** Whether records may be compared by this field: of such a kind. */
|
|
10
|
+
export declare const comparable: (def: Field | undefined) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.comparable = exports.DUPLICATE_KINDS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The kinds of field a record is compared by, for possible duplicates (`duplicates` on a page): words (a name, a
|
|
6
|
+
* phone, an email, an id), a number (an id kept as one), a day (a birthday), a choice or a link (a company). Never a
|
|
7
|
+
* table, links, a file, formatted text or JSON, whose likeness is no one value's. Apart from the format's schema
|
|
8
|
+
* (duplicates.ts), so the page's quick check carries no validation library.
|
|
9
|
+
*/
|
|
10
|
+
exports.DUPLICATE_KINDS = new Set(['char', 'text', 'integer', 'float', 'date', 'selection', 'many2one']);
|
|
11
|
+
/** Whether records may be compared by this field: of such a kind. */
|
|
12
|
+
const comparable = (def) => !!def && exports.DUPLICATE_KINDS.has(def.type);
|
|
13
|
+
exports.comparable = comparable;
|
|
14
|
+
//# sourceMappingURL=duplicate-kinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicate-kinds.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/duplicate-kinds.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACU,QAAA,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnI,qEAAqE;AAC9D,MAAM,UAAU,GAAG,CAAC,GAAsB,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,uBAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAAzF,QAAA,UAAU,cAA+E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds of field a record is compared by, for possible duplicates (`duplicates` on a page): words (a name, a
|
|
3
|
+
* phone, an email, an id), a number (an id kept as one), a day (a birthday), a choice or a link (a company). Never a
|
|
4
|
+
* table, links, a file, formatted text or JSON, whose likeness is no one value's. Apart from the format's schema
|
|
5
|
+
* (duplicates.ts), so the page's quick check carries no validation library.
|
|
6
|
+
*/
|
|
7
|
+
export const DUPLICATE_KINDS = new Set(['char', 'text', 'integer', 'float', 'date', 'selection', 'many2one']);
|
|
8
|
+
/** Whether records may be compared by this field: of such a kind. */
|
|
9
|
+
export const comparable = (def) => !!def && DUPLICATE_KINDS.has(def.type);
|
|
10
|
+
//# sourceMappingURL=duplicate-kinds.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicate-kinds.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/duplicate-kinds.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnI,qEAAqE;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAsB,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Possible duplicates (`duplicates` on a record's page): while a person types a record — and again as it is saved —
|
|
4
|
+
* the page asks the data source's `duplicates` whether records like it exist already, by the fields named here: the
|
|
5
|
+
* same phone, the same email, the same tax or national id, a name close enough. What matched is said under the field
|
|
6
|
+
* it matched on, with Open it, "It's someone new" and Merge. Without the source's `duplicates`, nothing is asked and
|
|
7
|
+
* nothing shows.
|
|
8
|
+
*
|
|
9
|
+
* "duplicates": { "fields": ["name", "phone", "email", "vat"] }
|
|
10
|
+
* "duplicates": { "fields": ["phone", "email"], "on": "save" }
|
|
11
|
+
*
|
|
12
|
+
* `on`: `type` (the default) asks as a field named here is typed in, a moment after the typing stops, as a saved
|
|
13
|
+
* record is opened, and as the record is saved; `save` only as it is saved.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PageDuplicatesSchema: z.ZodObject<{
|
|
16
|
+
fields: z.ZodArray<z.ZodString>;
|
|
17
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
type: "type";
|
|
19
|
+
save: "save";
|
|
20
|
+
}>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export type PageDuplicates = z.infer<typeof PageDuplicatesSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Possible duplicates (`duplicates` on a record's page): while a person types a record — and again as it is saved —
|
|
4
|
+
* the page asks the data source's `duplicates` whether records like it exist already, by the fields named here: the
|
|
5
|
+
* same phone, the same email, the same tax or national id, a name close enough. What matched is said under the field
|
|
6
|
+
* it matched on, with Open it, "It's someone new" and Merge. Without the source's `duplicates`, nothing is asked and
|
|
7
|
+
* nothing shows.
|
|
8
|
+
*
|
|
9
|
+
* "duplicates": { "fields": ["name", "phone", "email", "vat"] }
|
|
10
|
+
* "duplicates": { "fields": ["phone", "email"], "on": "save" }
|
|
11
|
+
*
|
|
12
|
+
* `on`: `type` (the default) asks as a field named here is typed in, a moment after the typing stops, as a saved
|
|
13
|
+
* record is opened, and as the record is saved; `save` only as it is saved.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PageDuplicatesSchema: z.ZodObject<{
|
|
16
|
+
fields: z.ZodArray<z.ZodString>;
|
|
17
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
type: "type";
|
|
19
|
+
save: "save";
|
|
20
|
+
}>>;
|
|
21
|
+
}, z.z.core.$strict>;
|
|
22
|
+
export type PageDuplicates = z.infer<typeof PageDuplicatesSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageDuplicatesSchema = void 0;
|
|
4
|
+
const z = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Possible duplicates (`duplicates` on a record's page): while a person types a record — and again as it is saved —
|
|
7
|
+
* the page asks the data source's `duplicates` whether records like it exist already, by the fields named here: the
|
|
8
|
+
* same phone, the same email, the same tax or national id, a name close enough. What matched is said under the field
|
|
9
|
+
* it matched on, with Open it, "It's someone new" and Merge. Without the source's `duplicates`, nothing is asked and
|
|
10
|
+
* nothing shows.
|
|
11
|
+
*
|
|
12
|
+
* "duplicates": { "fields": ["name", "phone", "email", "vat"] }
|
|
13
|
+
* "duplicates": { "fields": ["phone", "email"], "on": "save" }
|
|
14
|
+
*
|
|
15
|
+
* `on`: `type` (the default) asks as a field named here is typed in, a moment after the typing stops, as a saved
|
|
16
|
+
* record is opened, and as the record is saved; `save` only as it is saved.
|
|
17
|
+
*/
|
|
18
|
+
exports.PageDuplicatesSchema = z
|
|
19
|
+
.strictObject({
|
|
20
|
+
fields: z.array(z.string().min(1)).min(1),
|
|
21
|
+
on: z.enum(['type', 'save'], { error: 'on is "type" (asked as the fields are typed in, and as the record is saved) or "save" (as it is saved)' }).optional(),
|
|
22
|
+
})
|
|
23
|
+
.meta({ id: 'PageDuplicates' });
|
|
24
|
+
//# sourceMappingURL=duplicates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicates.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/duplicates.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AAEzB;;;;;;;;;;;;GAYG;AACU,QAAA,oBAAoB,GAAG,CAAC;KAClC,YAAY,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,wGAAwG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC7J,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Possible duplicates (`duplicates` on a record's page): while a person types a record — and again as it is saved —
|
|
4
|
+
* the page asks the data source's `duplicates` whether records like it exist already, by the fields named here: the
|
|
5
|
+
* same phone, the same email, the same tax or national id, a name close enough. What matched is said under the field
|
|
6
|
+
* it matched on, with Open it, "It's someone new" and Merge. Without the source's `duplicates`, nothing is asked and
|
|
7
|
+
* nothing shows.
|
|
8
|
+
*
|
|
9
|
+
* "duplicates": { "fields": ["name", "phone", "email", "vat"] }
|
|
10
|
+
* "duplicates": { "fields": ["phone", "email"], "on": "save" }
|
|
11
|
+
*
|
|
12
|
+
* `on`: `type` (the default) asks as a field named here is typed in, a moment after the typing stops, as a saved
|
|
13
|
+
* record is opened, and as the record is saved; `save` only as it is saved.
|
|
14
|
+
*/
|
|
15
|
+
export const PageDuplicatesSchema = z
|
|
16
|
+
.strictObject({
|
|
17
|
+
fields: z.array(z.string().min(1)).min(1),
|
|
18
|
+
on: z.enum(['type', 'save'], { error: 'on is "type" (asked as the fields are typed in, and as the record is saved) or "save" (as it is saved)' }).optional(),
|
|
19
|
+
})
|
|
20
|
+
.meta({ id: 'PageDuplicates' });
|
|
21
|
+
//# sourceMappingURL=duplicates.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicates.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/duplicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,YAAY,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,wGAAwG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC7J,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC"}
|