viewkitjs 0.0.0-stage → 0.19.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/CHANGELOG.md +53 -0
- package/LICENSE.md +7 -0
- package/README.md +36 -2
- package/fields/CHANGELOG.md +1299 -0
- package/fields/NOTICE.md +12 -0
- package/fields/README.md +134 -0
- package/fields/dist/accept.d.ts +39 -0
- package/fields/dist/accept.js +309 -0
- package/fields/dist/actor.d.ts +16 -0
- package/fields/dist/actor.js +44 -0
- package/fields/dist/bands.d.ts +5 -0
- package/fields/dist/bands.js +12 -0
- package/fields/dist/close.d.ts +19 -0
- package/fields/dist/close.js +1 -0
- package/fields/dist/codecs.d.ts +32 -0
- package/fields/dist/codecs.js +119 -0
- package/fields/dist/conventions.d.ts +61 -0
- package/fields/dist/conventions.js +97 -0
- package/fields/dist/countries.d.ts +11 -0
- package/fields/dist/countries.js +98 -0
- package/fields/dist/creatable.d.ts +85 -0
- package/fields/dist/creatable.js +188 -0
- package/fields/dist/date-codec.d.ts +17 -0
- package/fields/dist/date-codec.js +41 -0
- package/fields/dist/definitions.d.ts +2 -0
- package/fields/dist/definitions.js +2 -0
- package/fields/dist/derived.d.ts +84 -0
- package/fields/dist/derived.js +126 -0
- package/fields/dist/design/category-colors.d.ts +17 -0
- package/fields/dist/design/category-colors.js +41 -0
- package/fields/dist/design/stage-marks.d.ts +26 -0
- package/fields/dist/design/stage-marks.js +1 -0
- package/fields/dist/design/status-slots.d.ts +34 -0
- package/fields/dist/design/status-slots.js +72 -0
- package/fields/dist/domain.d.ts +6 -0
- package/fields/dist/domain.js +34 -0
- package/fields/dist/entities.d.ts +67 -0
- package/fields/dist/entities.js +528 -0
- package/fields/dist/equality.d.ts +41 -0
- package/fields/dist/equality.js +114 -0
- package/fields/dist/errors.d.ts +3 -0
- package/fields/dist/errors.js +6 -0
- package/fields/dist/format/time.d.ts +25 -0
- package/fields/dist/format/time.js +77 -0
- package/fields/dist/formula.d.ts +54 -0
- package/fields/dist/formula.js +510 -0
- package/fields/dist/index.d.ts +35 -0
- package/fields/dist/index.js +32 -0
- package/fields/dist/kit.d.ts +23 -0
- package/fields/dist/kit.js +25 -0
- package/fields/dist/labels.d.ts +3 -0
- package/fields/dist/labels.js +5 -0
- package/fields/dist/link.d.ts +33 -0
- package/fields/dist/link.js +58 -0
- package/fields/dist/location.d.ts +26 -0
- package/fields/dist/location.js +92 -0
- package/fields/dist/markdown.d.ts +7 -0
- package/fields/dist/markdown.js +64 -0
- package/fields/dist/messages.d.ts +374 -0
- package/fields/dist/messages.js +332 -0
- package/fields/dist/name.d.ts +23 -0
- package/fields/dist/name.js +53 -0
- package/fields/dist/normalize.d.ts +6 -0
- package/fields/dist/normalize.js +17 -0
- package/fields/dist/optimistic.d.ts +37 -0
- package/fields/dist/optimistic.js +56 -0
- package/fields/dist/options.d.ts +26 -0
- package/fields/dist/options.js +31 -0
- package/fields/dist/parse-number.d.ts +55 -0
- package/fields/dist/parse-number.js +142 -0
- package/fields/dist/phone.d.ts +47 -0
- package/fields/dist/phone.js +121 -0
- package/fields/dist/places/format.d.ts +29 -0
- package/fields/dist/places/format.js +97 -0
- package/fields/dist/places/formats.d.ts +25 -0
- package/fields/dist/places/formats.js +260 -0
- package/fields/dist/places/index.d.ts +13 -0
- package/fields/dist/places/index.js +21 -0
- package/fields/dist/places/load-regions.d.ts +7 -0
- package/fields/dist/places/load-regions.js +65 -0
- package/fields/dist/places/regions/AD.d.ts +4 -0
- package/fields/dist/places/regions/AD.js +11 -0
- package/fields/dist/places/regions/AE.d.ts +4 -0
- package/fields/dist/places/regions/AE.js +11 -0
- package/fields/dist/places/regions/AM.d.ts +4 -0
- package/fields/dist/places/regions/AM.js +15 -0
- package/fields/dist/places/regions/AR.d.ts +4 -0
- package/fields/dist/places/regions/AR.js +28 -0
- package/fields/dist/places/regions/AU.d.ts +4 -0
- package/fields/dist/places/regions/AU.js +13 -0
- package/fields/dist/places/regions/BB.d.ts +4 -0
- package/fields/dist/places/regions/BB.js +15 -0
- package/fields/dist/places/regions/BR.d.ts +4 -0
- package/fields/dist/places/regions/BR.js +31 -0
- package/fields/dist/places/regions/BS.d.ts +4 -0
- package/fields/dist/places/regions/BS.js +23 -0
- package/fields/dist/places/regions/BY.d.ts +4 -0
- package/fields/dist/places/regions/BY.js +11 -0
- package/fields/dist/places/regions/CA.d.ts +4 -0
- package/fields/dist/places/regions/CA.js +17 -0
- package/fields/dist/places/regions/CL.d.ts +4 -0
- package/fields/dist/places/regions/CL.js +20 -0
- package/fields/dist/places/regions/CN.d.ts +4 -0
- package/fields/dist/places/regions/CN.js +38 -0
- package/fields/dist/places/regions/CO.d.ts +4 -0
- package/fields/dist/places/regions/CO.js +37 -0
- package/fields/dist/places/regions/CR.d.ts +4 -0
- package/fields/dist/places/regions/CR.js +11 -0
- package/fields/dist/places/regions/CU.d.ts +4 -0
- package/fields/dist/places/regions/CU.js +20 -0
- package/fields/dist/places/regions/CV.d.ts +4 -0
- package/fields/dist/places/regions/CV.js +13 -0
- package/fields/dist/places/regions/EE.d.ts +4 -0
- package/fields/dist/places/regions/EE.js +19 -0
- package/fields/dist/places/regions/EG.d.ts +4 -0
- package/fields/dist/places/regions/EG.js +31 -0
- package/fields/dist/places/regions/ES.d.ts +4 -0
- package/fields/dist/places/regions/ES.js +56 -0
- package/fields/dist/places/regions/FM.d.ts +4 -0
- package/fields/dist/places/regions/FM.js +8 -0
- package/fields/dist/places/regions/HK.d.ts +4 -0
- package/fields/dist/places/regions/HK.js +7 -0
- package/fields/dist/places/regions/HN.d.ts +4 -0
- package/fields/dist/places/regions/HN.js +22 -0
- package/fields/dist/places/regions/ID.d.ts +4 -0
- package/fields/dist/places/regions/ID.js +38 -0
- package/fields/dist/places/regions/IE.d.ts +4 -0
- package/fields/dist/places/regions/IE.js +30 -0
- package/fields/dist/places/regions/IN.d.ts +4 -0
- package/fields/dist/places/regions/IN.js +40 -0
- package/fields/dist/places/regions/IQ.d.ts +4 -0
- package/fields/dist/places/regions/IQ.js +23 -0
- package/fields/dist/places/regions/IR.d.ts +4 -0
- package/fields/dist/places/regions/IR.js +35 -0
- package/fields/dist/places/regions/IT.d.ts +4 -0
- package/fields/dist/places/regions/IT.js +115 -0
- package/fields/dist/places/regions/JM.d.ts +4 -0
- package/fields/dist/places/regions/JM.js +18 -0
- package/fields/dist/places/regions/JP.d.ts +4 -0
- package/fields/dist/places/regions/JP.js +51 -0
- package/fields/dist/places/regions/KN.d.ts +4 -0
- package/fields/dist/places/regions/KN.js +6 -0
- package/fields/dist/places/regions/KP.d.ts +4 -0
- package/fields/dist/places/regions/KP.js +17 -0
- package/fields/dist/places/regions/KR.d.ts +4 -0
- package/fields/dist/places/regions/KR.js +21 -0
- package/fields/dist/places/regions/KY.d.ts +4 -0
- package/fields/dist/places/regions/KY.js +7 -0
- package/fields/dist/places/regions/KZ.d.ts +4 -0
- package/fields/dist/places/regions/KZ.js +24 -0
- package/fields/dist/places/regions/MN.d.ts +4 -0
- package/fields/dist/places/regions/MN.js +26 -0
- package/fields/dist/places/regions/MX.d.ts +4 -0
- package/fields/dist/places/regions/MX.js +36 -0
- package/fields/dist/places/regions/MY.d.ts +4 -0
- package/fields/dist/places/regions/MY.js +20 -0
- package/fields/dist/places/regions/MZ.d.ts +4 -0
- package/fields/dist/places/regions/MZ.js +15 -0
- package/fields/dist/places/regions/NG.d.ts +4 -0
- package/fields/dist/places/regions/NG.js +41 -0
- package/fields/dist/places/regions/NI.d.ts +4 -0
- package/fields/dist/places/regions/NI.js +21 -0
- package/fields/dist/places/regions/NR.d.ts +4 -0
- package/fields/dist/places/regions/NR.js +18 -0
- package/fields/dist/places/regions/PA.d.ts +4 -0
- package/fields/dist/places/regions/PA.js +18 -0
- package/fields/dist/places/regions/PE.d.ts +4 -0
- package/fields/dist/places/regions/PE.js +30 -0
- package/fields/dist/places/regions/PG.d.ts +4 -0
- package/fields/dist/places/regions/PG.js +26 -0
- package/fields/dist/places/regions/PH.d.ts +4 -0
- package/fields/dist/places/regions/PH.js +86 -0
- package/fields/dist/places/regions/PW.d.ts +4 -0
- package/fields/dist/places/regions/PW.js +20 -0
- package/fields/dist/places/regions/RO.d.ts +4 -0
- package/fields/dist/places/regions/RO.js +46 -0
- package/fields/dist/places/regions/RU.d.ts +4 -0
- package/fields/dist/places/regions/RU.js +89 -0
- package/fields/dist/places/regions/SO.d.ts +4 -0
- package/fields/dist/places/regions/SO.js +22 -0
- package/fields/dist/places/regions/SR.d.ts +4 -0
- package/fields/dist/places/regions/SR.js +14 -0
- package/fields/dist/places/regions/SV.d.ts +4 -0
- package/fields/dist/places/regions/SV.js +18 -0
- package/fields/dist/places/regions/TH.d.ts +4 -0
- package/fields/dist/places/regions/TH.js +81 -0
- package/fields/dist/places/regions/TR.d.ts +4 -0
- package/fields/dist/places/regions/TR.js +85 -0
- package/fields/dist/places/regions/TV.d.ts +4 -0
- package/fields/dist/places/regions/TV.js +13 -0
- package/fields/dist/places/regions/TW.d.ts +4 -0
- package/fields/dist/places/regions/TW.js +26 -0
- package/fields/dist/places/regions/UA.d.ts +4 -0
- package/fields/dist/places/regions/UA.js +31 -0
- package/fields/dist/places/regions/US.d.ts +4 -0
- package/fields/dist/places/regions/US.js +66 -0
- package/fields/dist/places/regions/UY.d.ts +4 -0
- package/fields/dist/places/regions/UY.js +23 -0
- package/fields/dist/places/regions/UZ.d.ts +4 -0
- package/fields/dist/places/regions/UZ.js +18 -0
- package/fields/dist/places/regions/VE.d.ts +4 -0
- package/fields/dist/places/regions/VE.js +29 -0
- package/fields/dist/places/regions/VN.d.ts +4 -0
- package/fields/dist/places/regions/VN.js +67 -0
- package/fields/dist/query/board.d.ts +28 -0
- package/fields/dist/query/board.js +44 -0
- package/fields/dist/query/buckets.d.ts +95 -0
- package/fields/dist/query/buckets.js +453 -0
- package/fields/dist/query/change.d.ts +8 -0
- package/fields/dist/query/change.js +43 -0
- package/fields/dist/query/collate.d.ts +10 -0
- package/fields/dist/query/collate.js +22 -0
- package/fields/dist/query/column-state.d.ts +25 -0
- package/fields/dist/query/column-state.js +10 -0
- package/fields/dist/query/date.d.ts +82 -0
- package/fields/dist/query/date.js +254 -0
- package/fields/dist/query/evaluate.d.ts +69 -0
- package/fields/dist/query/evaluate.js +84 -0
- package/fields/dist/query/figure-kinds.d.ts +26 -0
- package/fields/dist/query/figure-kinds.js +27 -0
- package/fields/dist/query/figures.d.ts +69 -0
- package/fields/dist/query/figures.js +169 -0
- package/fields/dist/query/filter.d.ts +138 -0
- package/fields/dist/query/filter.js +475 -0
- package/fields/dist/query/fold.d.ts +1 -0
- package/fields/dist/query/fold.js +4 -0
- package/fields/dist/query/group.d.ts +15 -0
- package/fields/dist/query/group.js +7 -0
- package/fields/dist/query/hold.d.ts +35 -0
- package/fields/dist/query/hold.js +70 -0
- package/fields/dist/query/index.d.ts +25 -0
- package/fields/dist/query/index.js +25 -0
- package/fields/dist/query/kit.d.ts +57 -0
- package/fields/dist/query/kit.js +29 -0
- package/fields/dist/query/layer.d.ts +35 -0
- package/fields/dist/query/layer.js +51 -0
- package/fields/dist/query/link.d.ts +8 -0
- package/fields/dist/query/link.js +18 -0
- package/fields/dist/query/list-link.d.ts +65 -0
- package/fields/dist/query/list-link.js +174 -0
- package/fields/dist/query/location.d.ts +20 -0
- package/fields/dist/query/location.js +36 -0
- package/fields/dist/query/name.d.ts +6 -0
- package/fields/dist/query/name.js +23 -0
- package/fields/dist/query/number.d.ts +94 -0
- package/fields/dist/query/number.js +180 -0
- package/fields/dist/query/option-counts.d.ts +38 -0
- package/fields/dist/query/option-counts.js +89 -0
- package/fields/dist/query/range.d.ts +22 -0
- package/fields/dist/query/range.js +79 -0
- package/fields/dist/query/read-rule.d.ts +3 -0
- package/fields/dist/query/read-rule.js +13 -0
- package/fields/dist/query/search.d.ts +20 -0
- package/fields/dist/query/search.js +77 -0
- package/fields/dist/query/set-aside.d.ts +82 -0
- package/fields/dist/query/set-aside.js +172 -0
- package/fields/dist/query/settings.d.ts +94 -0
- package/fields/dist/query/settings.js +195 -0
- package/fields/dist/query/sort.d.ts +32 -0
- package/fields/dist/query/sort.js +270 -0
- package/fields/dist/query/text.d.ts +55 -0
- package/fields/dist/query/text.js +80 -0
- package/fields/dist/range.d.ts +25 -0
- package/fields/dist/range.js +63 -0
- package/fields/dist/registry.d.ts +114 -0
- package/fields/dist/registry.js +864 -0
- package/fields/dist/relation.d.ts +84 -0
- package/fields/dist/relation.js +106 -0
- package/fields/dist/root-domain.d.ts +4 -0
- package/fields/dist/root-domain.js +12 -0
- package/fields/dist/settlement.d.ts +4 -0
- package/fields/dist/settlement.js +11 -0
- package/fields/dist/spec-changes.d.ts +20 -0
- package/fields/dist/spec-changes.js +170 -0
- package/fields/dist/testing/backend.d.ts +75 -0
- package/fields/dist/testing/backend.js +1 -0
- package/fields/dist/testing/cases.d.ts +14 -0
- package/fields/dist/testing/cases.js +327 -0
- package/fields/dist/testing/compare.d.ts +39 -0
- package/fields/dist/testing/compare.js +123 -0
- package/fields/dist/testing/index.d.ts +7 -0
- package/fields/dist/testing/index.js +5 -0
- package/fields/dist/testing/memory.d.ts +4 -0
- package/fields/dist/testing/memory.js +90 -0
- package/fields/dist/testing/now.d.ts +4 -0
- package/fields/dist/testing/now.js +2 -0
- package/fields/dist/testing/query-of.d.ts +8 -0
- package/fields/dist/testing/query-of.js +16 -0
- package/fields/dist/testing/question.d.ts +3 -0
- package/fields/dist/testing/question.js +10 -0
- package/fields/dist/testing/reader.d.ts +11 -0
- package/fields/dist/testing/reader.js +12 -0
- package/fields/dist/testing/reference.d.ts +20 -0
- package/fields/dist/testing/reference.js +58 -0
- package/fields/dist/testing/runner.d.ts +32 -0
- package/fields/dist/testing/runner.js +145 -0
- package/fields/dist/testing/samples.d.ts +5 -0
- package/fields/dist/testing/samples.js +338 -0
- package/fields/dist/testing/speed.d.ts +35 -0
- package/fields/dist/testing/speed.js +134 -0
- package/fields/dist/testing/sweep.d.ts +11 -0
- package/fields/dist/testing/sweep.js +154 -0
- package/fields/dist/testing/text-order.d.ts +8 -0
- package/fields/dist/testing/text-order.js +73 -0
- package/fields/dist/testing/worked-out.d.ts +16 -0
- package/fields/dist/testing/worked-out.js +234 -0
- package/fields/dist/types.d.ts +722 -0
- package/fields/dist/types.js +1 -0
- package/fields/dist/value-list.d.ts +56 -0
- package/fields/dist/value-list.js +75 -0
- package/fields/dist/write-result.d.ts +49 -0
- package/fields/dist/write-result.js +34 -0
- package/fields/dist/zod.d.ts +29 -0
- package/fields/dist/zod.js +419 -0
- package/fields/docs/getting-started.md +147 -0
- package/fields/docs/guides/checking-definitions.md +517 -0
- package/fields/docs/guides/contact-values.md +466 -0
- package/fields/docs/guides/conventions.md +312 -0
- package/fields/docs/guides/derived-fields.md +701 -0
- package/fields/docs/guides/field-types.md +665 -0
- package/fields/docs/guides/names-and-places.md +356 -0
- package/fields/docs/guides/narrowing-names.md +146 -0
- package/fields/docs/guides/options.md +348 -0
- package/fields/docs/guides/queries.md +1055 -0
- package/fields/docs/guides/the-index.md +415 -0
- package/fields/docs/guides/validation-and-acceptance.md +314 -0
- package/fields/docs/guides/who-may-change.md +299 -0
- package/fields/docs/index.md +47 -0
- package/fields/docs/reference/definitions.md +22 -0
- package/fields/docs/reference/design-category-colors.md +8 -0
- package/fields/docs/reference/design-stage-marks.md +4 -0
- package/fields/docs/reference/design-status-slots.md +6 -0
- package/fields/docs/reference/fields.md +275 -0
- package/fields/docs/reference/format-time.md +9 -0
- package/fields/docs/reference/phone.md +17 -0
- package/fields/docs/reference/places.md +9 -0
- package/fields/docs/reference/query.md +295 -0
- package/fields/docs/reference/root-domain.md +5 -0
- package/fields/docs/reference/testing.md +87 -0
- package/fields/docs/reference/types.md +95 -0
- package/fields/skills/viewkit/SKILL.md +377 -0
- package/package.json +261 -3
- package/postgres/CHANGELOG.md +676 -0
- package/postgres/README.md +35 -0
- package/postgres/dist/access.d.ts +131 -0
- package/postgres/dist/access.js +168 -0
- package/postgres/dist/actor.d.ts +3 -0
- package/postgres/dist/actor.js +6 -0
- package/postgres/dist/bounds.d.ts +16 -0
- package/postgres/dist/bounds.js +69 -0
- package/postgres/dist/calendar.d.ts +31 -0
- package/postgres/dist/calendar.js +64 -0
- package/postgres/dist/check.d.ts +53 -0
- package/postgres/dist/check.js +326 -0
- package/postgres/dist/counts.d.ts +44 -0
- package/postgres/dist/counts.js +96 -0
- package/postgres/dist/cursor.d.ts +26 -0
- package/postgres/dist/cursor.js +210 -0
- package/postgres/dist/date-groups.d.ts +45 -0
- package/postgres/dist/date-groups.js +176 -0
- package/postgres/dist/definitions/build.d.ts +28 -0
- package/postgres/dist/definitions/build.js +174 -0
- package/postgres/dist/definitions/float.d.ts +55 -0
- package/postgres/dist/definitions/float.js +108 -0
- package/postgres/dist/definitions/formula-forms.d.ts +29 -0
- package/postgres/dist/definitions/formula-forms.js +209 -0
- package/postgres/dist/definitions/formula.d.ts +14 -0
- package/postgres/dist/definitions/formula.js +209 -0
- package/postgres/dist/definitions/index.d.ts +3 -0
- package/postgres/dist/definitions/index.js +2 -0
- package/postgres/dist/definitions/json.d.ts +14 -0
- package/postgres/dist/definitions/json.js +68 -0
- package/postgres/dist/definitions/label.d.ts +8 -0
- package/postgres/dist/definitions/label.js +35 -0
- package/postgres/dist/definitions/lookup.d.ts +8 -0
- package/postgres/dist/definitions/lookup.js +88 -0
- package/postgres/dist/definitions/money.d.ts +29 -0
- package/postgres/dist/definitions/money.js +80 -0
- package/postgres/dist/definitions/place.d.ts +50 -0
- package/postgres/dist/definitions/place.js +38 -0
- package/postgres/dist/definitions/relations.d.ts +9 -0
- package/postgres/dist/definitions/relations.js +48 -0
- package/postgres/dist/definitions/rollup.d.ts +17 -0
- package/postgres/dist/definitions/rollup.js +343 -0
- package/postgres/dist/definitions/storage.d.ts +120 -0
- package/postgres/dist/definitions/storage.js +334 -0
- package/postgres/dist/definitions/stored.d.ts +3 -0
- package/postgres/dist/definitions/stored.js +72 -0
- package/postgres/dist/definitions/user.d.ts +7 -0
- package/postgres/dist/definitions/user.js +42 -0
- package/postgres/dist/double.d.ts +6 -0
- package/postgres/dist/double.js +10 -0
- package/postgres/dist/field-values.d.ts +16 -0
- package/postgres/dist/field-values.js +75 -0
- package/postgres/dist/figures.d.ts +37 -0
- package/postgres/dist/figures.js +88 -0
- package/postgres/dist/filled.d.ts +7 -0
- package/postgres/dist/filled.js +47 -0
- package/postgres/dist/fold.d.ts +15 -0
- package/postgres/dist/fold.js +21 -0
- package/postgres/dist/groups.d.ts +85 -0
- package/postgres/dist/groups.js +189 -0
- package/postgres/dist/ids.d.ts +8 -0
- package/postgres/dist/ids.js +16 -0
- package/postgres/dist/index.d.ts +21 -0
- package/postgres/dist/index.js +20 -0
- package/postgres/dist/kept.d.ts +36 -0
- package/postgres/dist/kept.js +43 -0
- package/postgres/dist/keyed.d.ts +48 -0
- package/postgres/dist/keyed.js +269 -0
- package/postgres/dist/lanes.d.ts +26 -0
- package/postgres/dist/lanes.js +69 -0
- package/postgres/dist/limits.d.ts +12 -0
- package/postgres/dist/limits.js +1 -0
- package/postgres/dist/map.d.ts +198 -0
- package/postgres/dist/map.js +475 -0
- package/postgres/dist/page.d.ts +116 -0
- package/postgres/dist/page.js +577 -0
- package/postgres/dist/parts.d.ts +10 -0
- package/postgres/dist/parts.js +82 -0
- package/postgres/dist/phone.d.ts +28 -0
- package/postgres/dist/phone.js +54 -0
- package/postgres/dist/predicates.d.ts +8 -0
- package/postgres/dist/predicates.js +35 -0
- package/postgres/dist/range-groups.d.ts +22 -0
- package/postgres/dist/range-groups.js +97 -0
- package/postgres/dist/records.d.ts +24 -0
- package/postgres/dist/records.js +183 -0
- package/postgres/dist/refusals.d.ts +38 -0
- package/postgres/dist/refusals.js +46 -0
- package/postgres/dist/relations.d.ts +23 -0
- package/postgres/dist/relations.js +71 -0
- package/postgres/dist/rules.d.ts +60 -0
- package/postgres/dist/rules.js +218 -0
- package/postgres/dist/search-indexes.d.ts +62 -0
- package/postgres/dist/search-indexes.js +189 -0
- package/postgres/dist/search.d.ts +56 -0
- package/postgres/dist/search.js +152 -0
- package/postgres/dist/several.d.ts +49 -0
- package/postgres/dist/several.js +174 -0
- package/postgres/dist/sort.d.ts +104 -0
- package/postgres/dist/sort.js +368 -0
- package/postgres/dist/sql.d.ts +60 -0
- package/postgres/dist/sql.js +247 -0
- package/postgres/dist/statement.d.ts +4 -0
- package/postgres/dist/statement.js +7 -0
- package/postgres/dist/steps.d.ts +18 -0
- package/postgres/dist/steps.js +18 -0
- package/postgres/dist/users.d.ts +35 -0
- package/postgres/dist/users.js +33 -0
- package/postgres/dist/value-rows.d.ts +23 -0
- package/postgres/dist/value-rows.js +64 -0
- package/postgres/dist/values.d.ts +56 -0
- package/postgres/dist/values.js +160 -0
- package/postgres/dist/view-counts.d.ts +14 -0
- package/postgres/dist/view-counts.js +50 -0
- package/postgres/dist/walker.d.ts +12 -0
- package/postgres/dist/walker.js +18 -0
- package/postgres/docs/guides/definitions.md +221 -0
- package/postgres/docs/guides/field-map.md +705 -0
- package/postgres/docs/guides/test-kit.md +110 -0
- package/postgres/docs/index.md +11 -0
- package/postgres/docs/reference/definitions.md +41 -0
- package/postgres/docs/reference/postgres.md +108 -0
- package/views/CHANGELOG.md +3582 -0
- package/views/README.md +104 -0
- package/views/dist/atoms/Avatar.d.ts +2 -0
- package/views/dist/atoms/Avatar.js +13 -0
- package/views/dist/atoms/CellMore.d.ts +2 -0
- package/views/dist/atoms/CellMore.js +4 -0
- package/views/dist/atoms/CommandMenu.d.ts +2 -0
- package/views/dist/atoms/CommandMenu.js +24 -0
- package/views/dist/atoms/DisabledReason.d.ts +13 -0
- package/views/dist/atoms/DisabledReason.js +27 -0
- package/views/dist/atoms/DrillRows.d.ts +3 -0
- package/views/dist/atoms/DrillRows.js +27 -0
- package/views/dist/atoms/List.d.ts +2 -0
- package/views/dist/atoms/List.js +6 -0
- package/views/dist/atoms/LoadMore.d.ts +2 -0
- package/views/dist/atoms/LoadMore.js +35 -0
- package/views/dist/atoms/Loading.d.ts +8 -0
- package/views/dist/atoms/Loading.js +10 -0
- package/views/dist/atoms/PanelRows.d.ts +5 -0
- package/views/dist/atoms/PanelRows.js +38 -0
- package/views/dist/atoms/PanelSearch.d.ts +2 -0
- package/views/dist/atoms/PanelSearch.js +23 -0
- package/views/dist/atoms/Pill.d.ts +2 -0
- package/views/dist/atoms/Pill.js +25 -0
- package/views/dist/atoms/PlatformMark.d.ts +2 -0
- package/views/dist/atoms/PlatformMark.js +4 -0
- package/views/dist/atoms/RangeCalendar.d.ts +8 -0
- package/views/dist/atoms/RangeCalendar.js +30 -0
- package/views/dist/atoms/RelationLink.d.ts +2 -0
- package/views/dist/atoms/RelationLink.js +6 -0
- package/views/dist/atoms/RelationRoles.d.ts +2 -0
- package/views/dist/atoms/RelationRoles.js +6 -0
- package/views/dist/atoms/Row.d.ts +3 -0
- package/views/dist/atoms/Row.js +31 -0
- package/views/dist/atoms/RowMenu.d.ts +2 -0
- package/views/dist/atoms/RowMenu.js +116 -0
- package/views/dist/atoms/SelectionSheet.d.ts +3 -0
- package/views/dist/atoms/SelectionSheet.js +31 -0
- package/views/dist/atoms/StatusBadge.d.ts +2 -0
- package/views/dist/atoms/StatusBadge.js +7 -0
- package/views/dist/atoms/StatusMarker.d.ts +2 -0
- package/views/dist/atoms/StatusMarker.js +21 -0
- package/views/dist/atoms/Tag.d.ts +2 -0
- package/views/dist/atoms/Tag.js +14 -0
- package/views/dist/atoms/TickBox.d.ts +2 -0
- package/views/dist/atoms/TickBox.js +8 -0
- package/views/dist/atoms/ToolbarButton.d.ts +2 -0
- package/views/dist/atoms/ToolbarButton.js +50 -0
- package/views/dist/atoms/defaults.d.ts +2 -0
- package/views/dist/atoms/defaults.js +51 -0
- package/views/dist/atoms/tones.d.ts +5 -0
- package/views/dist/atoms/tones.js +28 -0
- package/views/dist/atoms/types.d.ts +496 -0
- package/views/dist/atoms/types.js +3 -0
- package/views/dist/cells/cell-format.d.ts +147 -0
- package/views/dist/cells/cell-format.js +16 -0
- package/views/dist/cells/cell-title.d.ts +20 -0
- package/views/dist/cells/cell-title.js +8 -0
- package/views/dist/cells/cell-values.d.ts +28 -0
- package/views/dist/cells/cell-values.js +107 -0
- package/views/dist/cells/index.d.ts +4 -0
- package/views/dist/cells/index.js +4 -0
- package/views/dist/cells/legacy-field.d.ts +52 -0
- package/views/dist/cells/legacy-field.js +164 -0
- package/views/dist/cells/relation-wrap.d.ts +3 -0
- package/views/dist/cells/relation-wrap.js +26 -0
- package/views/dist/cells/use-cell-format.d.ts +5 -0
- package/views/dist/cells/use-cell-format.js +10 -0
- package/views/dist/contract.d.ts +1337 -0
- package/views/dist/contract.js +1824 -0
- package/views/dist/display/actor.d.ts +4 -0
- package/views/dist/display/actor.js +26 -0
- package/views/dist/display/boolean.d.ts +18 -0
- package/views/dist/display/boolean.js +50 -0
- package/views/dist/display/breakdown.d.ts +15 -0
- package/views/dist/display/breakdown.js +32 -0
- package/views/dist/display/converted.d.ts +19 -0
- package/views/dist/display/converted.js +12 -0
- package/views/dist/display/currency.d.ts +9 -0
- package/views/dist/display/currency.js +29 -0
- package/views/dist/display/date.d.ts +12 -0
- package/views/dist/display/date.js +28 -0
- package/views/dist/display/display-cores.d.ts +31 -0
- package/views/dist/display/display-cores.js +57 -0
- package/views/dist/display/entity-chip.d.ts +29 -0
- package/views/dist/display/entity-chip.js +8 -0
- package/views/dist/display/fit-values.d.ts +34 -0
- package/views/dist/display/fit-values.js +45 -0
- package/views/dist/display/format.d.ts +66 -0
- package/views/dist/display/format.js +206 -0
- package/views/dist/display/index.d.ts +9 -0
- package/views/dist/display/index.js +8 -0
- package/views/dist/display/link-click.d.ts +11 -0
- package/views/dist/display/link-click.js +3 -0
- package/views/dist/display/link.d.ts +29 -0
- package/views/dist/display/link.js +56 -0
- package/views/dist/display/location.d.ts +8 -0
- package/views/dist/display/location.js +22 -0
- package/views/dist/display/multi-value.d.ts +18 -0
- package/views/dist/display/multi-value.js +93 -0
- package/views/dist/display/name.d.ts +6 -0
- package/views/dist/display/name.js +14 -0
- package/views/dist/display/number.d.ts +11 -0
- package/views/dist/display/number.js +27 -0
- package/views/dist/display/options.d.ts +167 -0
- package/views/dist/display/options.js +1 -0
- package/views/dist/display/percent.d.ts +4 -0
- package/views/dist/display/percent.js +41 -0
- package/views/dist/display/phone.d.ts +11 -0
- package/views/dist/display/phone.js +49 -0
- package/views/dist/display/range.d.ts +6 -0
- package/views/dist/display/range.js +19 -0
- package/views/dist/display/relation.d.ts +4 -0
- package/views/dist/display/relation.js +44 -0
- package/views/dist/display/rich-text.d.ts +10 -0
- package/views/dist/display/rich-text.js +46 -0
- package/views/dist/display/select.d.ts +6 -0
- package/views/dist/display/select.js +40 -0
- package/views/dist/display/status-steps.d.ts +8 -0
- package/views/dist/display/status-steps.js +18 -0
- package/views/dist/display/text-class.d.ts +23 -0
- package/views/dist/display/text-class.js +5 -0
- package/views/dist/display/text.d.ts +19 -0
- package/views/dist/display/text.js +8 -0
- package/views/dist/display/use-display-options.d.ts +2 -0
- package/views/dist/display/use-display-options.js +14 -0
- package/views/dist/display/user.d.ts +11 -0
- package/views/dist/display/user.js +10 -0
- package/views/dist/display/value-list.d.ts +10 -0
- package/views/dist/display/value-list.js +12 -0
- package/views/dist/display/viewer.d.ts +4 -0
- package/views/dist/display/viewer.js +12 -0
- package/views/dist/display/web-href.d.ts +16 -0
- package/views/dist/display/web-href.js +19 -0
- package/views/dist/editors/BodyFrame.d.ts +30 -0
- package/views/dist/editors/BodyFrame.js +86 -0
- package/views/dist/editors/ChipsEditor.d.ts +76 -0
- package/views/dist/editors/ChipsEditor.js +118 -0
- package/views/dist/editors/DateEditor.d.ts +42 -0
- package/views/dist/editors/DateEditor.js +298 -0
- package/views/dist/editors/EditorPanel.d.ts +71 -0
- package/views/dist/editors/EditorPanel.js +158 -0
- package/views/dist/editors/LocationEditor.d.ts +33 -0
- package/views/dist/editors/LocationEditor.js +320 -0
- package/views/dist/editors/NameEditor.d.ts +29 -0
- package/views/dist/editors/NameEditor.js +119 -0
- package/views/dist/editors/NumberEditor.d.ts +90 -0
- package/views/dist/editors/NumberEditor.js +126 -0
- package/views/dist/editors/RangeEditor.d.ts +51 -0
- package/views/dist/editors/RangeEditor.js +125 -0
- package/views/dist/editors/RelationEditor.d.ts +52 -0
- package/views/dist/editors/RelationEditor.js +55 -0
- package/views/dist/editors/RelationSetEditor.d.ts +63 -0
- package/views/dist/editors/RelationSetEditor.js +222 -0
- package/views/dist/editors/SelectEditor.d.ts +104 -0
- package/views/dist/editors/SelectEditor.js +154 -0
- package/views/dist/editors/TextEditor.d.ts +61 -0
- package/views/dist/editors/TextEditor.js +102 -0
- package/views/dist/editors/ValueListEditor.d.ts +51 -0
- package/views/dist/editors/ValueListEditor.js +239 -0
- package/views/dist/editors/body-panel.d.ts +11 -0
- package/views/dist/editors/body-panel.js +11 -0
- package/views/dist/editors/body-step.d.ts +12 -0
- package/views/dist/editors/body-step.js +6 -0
- package/views/dist/editors/edit-cores.d.ts +86 -0
- package/views/dist/editors/edit-cores.js +39 -0
- package/views/dist/editors/edit-session.d.ts +113 -0
- package/views/dist/editors/edit-session.js +97 -0
- package/views/dist/editors/escape-rule.d.ts +34 -0
- package/views/dist/editors/escape-rule.js +15 -0
- package/views/dist/editors/inner-escape.d.ts +12 -0
- package/views/dist/editors/inner-escape.js +10 -0
- package/views/dist/editors/keep-inside.d.ts +12 -0
- package/views/dist/editors/keep-inside.js +20 -0
- package/views/dist/editors/leave-scope.d.ts +31 -0
- package/views/dist/editors/leave-scope.js +29 -0
- package/views/dist/editors/link-roles.d.ts +9 -0
- package/views/dist/editors/link-roles.js +19 -0
- package/views/dist/editors/number-body.d.ts +30 -0
- package/views/dist/editors/number-body.js +38 -0
- package/views/dist/editors/number-step.d.ts +39 -0
- package/views/dist/editors/number-step.js +47 -0
- package/views/dist/editors/open-value.d.ts +22 -0
- package/views/dist/editors/open-value.js +37 -0
- package/views/dist/editors/open-values.d.ts +32 -0
- package/views/dist/editors/open-values.js +33 -0
- package/views/dist/editors/option-add-flow.d.ts +66 -0
- package/views/dist/editors/option-add-flow.js +155 -0
- package/views/dist/editors/parts-body.d.ts +68 -0
- package/views/dist/editors/parts-body.js +117 -0
- package/views/dist/editors/picker-slot.d.ts +25 -0
- package/views/dist/editors/picker-slot.js +37 -0
- package/views/dist/editors/relation-kinds.d.ts +7 -0
- package/views/dist/editors/relation-kinds.js +21 -0
- package/views/dist/editors/relation-links-body.d.ts +36 -0
- package/views/dist/editors/relation-links-body.js +22 -0
- package/views/dist/editors/relation-panel.d.ts +69 -0
- package/views/dist/editors/relation-panel.js +40 -0
- package/views/dist/editors/relation-picker.d.ts +63 -0
- package/views/dist/editors/relation-picker.js +58 -0
- package/views/dist/editors/relation-source.d.ts +67 -0
- package/views/dist/editors/relation-source.js +108 -0
- package/views/dist/editors/tab-ends.d.ts +7 -0
- package/views/dist/editors/tab-ends.js +10 -0
- package/views/dist/editors/text-body.d.ts +16 -0
- package/views/dist/editors/text-body.js +30 -0
- package/views/dist/editors/values-body.d.ts +47 -0
- package/views/dist/editors/values-body.js +140 -0
- package/views/dist/field-row/FieldNoteLine.d.ts +14 -0
- package/views/dist/field-row/FieldNoteLine.js +15 -0
- package/views/dist/field-row/FieldRow.d.ts +81 -0
- package/views/dist/field-row/FieldRow.js +232 -0
- package/views/dist/field-row/FieldRowLane.d.ts +19 -0
- package/views/dist/field-row/FieldRowLane.js +21 -0
- package/views/dist/field-row/drawn-text.d.ts +7 -0
- package/views/dist/field-row/drawn-text.js +27 -0
- package/views/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
- package/views/dist/field-row/editors/RowChipsEditor.js +27 -0
- package/views/dist/field-row/editors/RowDateEditor.d.ts +16 -0
- package/views/dist/field-row/editors/RowDateEditor.js +18 -0
- package/views/dist/field-row/editors/RowEditor.d.ts +39 -0
- package/views/dist/field-row/editors/RowEditor.js +66 -0
- package/views/dist/field-row/editors/RowNameEditor.d.ts +7 -0
- package/views/dist/field-row/editors/RowNameEditor.js +23 -0
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowNumberEditor.js +34 -0
- package/views/dist/field-row/editors/RowPlaceEditor.d.ts +9 -0
- package/views/dist/field-row/editors/RowPlaceEditor.js +20 -0
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +7 -0
- package/views/dist/field-row/editors/RowRangeEditor.js +25 -0
- package/views/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
- package/views/dist/field-row/editors/RowRelationEditor.js +80 -0
- package/views/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
- package/views/dist/field-row/editors/RowSelectEditor.js +26 -0
- package/views/dist/field-row/editors/RowTextEditor.d.ts +15 -0
- package/views/dist/field-row/editors/RowTextEditor.js +25 -0
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +6 -0
- package/views/dist/field-row/editors/RowValueListEditor.js +34 -0
- package/views/dist/field-row/editors/host.d.ts +65 -0
- package/views/dist/field-row/editors/host.js +1 -0
- package/views/dist/field-row/editors/row-frame.d.ts +2 -0
- package/views/dist/field-row/editors/row-frame.js +1 -0
- package/views/dist/field-row/editors/row-session.d.ts +63 -0
- package/views/dist/field-row/editors/row-session.js +102 -0
- package/views/dist/field-row/field-row-button.d.ts +40 -0
- package/views/dist/field-row/field-row-button.js +18 -0
- package/views/dist/field-row/field-row-checkbox.d.ts +9 -0
- package/views/dist/field-row/field-row-checkbox.js +7 -0
- package/views/dist/field-row/index.d.ts +5 -0
- package/views/dist/field-row/index.js +5 -0
- package/views/dist/field-row/row-target.d.ts +20 -0
- package/views/dist/field-row/row-target.js +3 -0
- package/views/dist/field-row/useFieldWrite.d.ts +45 -0
- package/views/dist/field-row/useFieldWrite.js +233 -0
- package/views/dist/field-row/useRowSettlement.d.ts +33 -0
- package/views/dist/field-row/useRowSettlement.js +23 -0
- package/views/dist/fields/binding.d.ts +96 -0
- package/views/dist/fields/binding.js +128 -0
- package/views/dist/fields/currency.d.ts +82 -0
- package/views/dist/fields/currency.js +41 -0
- package/views/dist/fields/denomination.d.ts +42 -0
- package/views/dist/fields/denomination.js +11 -0
- package/views/dist/fields/edit-core-types.d.ts +40 -0
- package/views/dist/fields/edit-core-types.js +29 -0
- package/views/dist/fields/format-knobs.d.ts +34 -0
- package/views/dist/fields/format-knobs.js +36 -0
- package/views/dist/fields/menus.d.ts +30 -0
- package/views/dist/fields/menus.js +1 -0
- package/views/dist/fields/money.d.ts +65 -0
- package/views/dist/fields/money.js +88 -0
- package/views/dist/fields/number-edit.d.ts +17 -0
- package/views/dist/fields/number-edit.js +21 -0
- package/views/dist/fields/option-add.d.ts +25 -0
- package/views/dist/fields/option-add.js +9 -0
- package/views/dist/fields/prepare-write.d.ts +55 -0
- package/views/dist/fields/prepare-write.js +72 -0
- package/views/dist/fields/range-unit.d.ts +7 -0
- package/views/dist/fields/range-unit.js +13 -0
- package/views/dist/fields/relation-source-types.d.ts +66 -0
- package/views/dist/fields/relation-source-types.js +1 -0
- package/views/dist/fields/write-target.d.ts +56 -0
- package/views/dist/fields/write-target.js +10 -0
- package/views/dist/figures.d.ts +9 -0
- package/views/dist/figures.js +1 -0
- package/views/dist/filters/date-filter.d.ts +2 -0
- package/views/dist/filters/date-filter.js +1 -0
- package/views/dist/filters/filter-model.d.ts +181 -0
- package/views/dist/filters/filter-model.js +41 -0
- package/views/dist/filters/filter-tree.d.ts +146 -0
- package/views/dist/filters/filter-tree.js +256 -0
- package/views/dist/filters/number-filter.d.ts +2 -0
- package/views/dist/filters/number-filter.js +1 -0
- package/views/dist/filters/range-filter.d.ts +2 -0
- package/views/dist/filters/range-filter.js +1 -0
- package/views/dist/filters/registry.d.ts +103 -0
- package/views/dist/filters/registry.js +8 -0
- package/views/dist/filters/relation-filter.d.ts +16 -0
- package/views/dist/filters/relation-filter.js +63 -0
- package/views/dist/filters/text-filter.d.ts +2 -0
- package/views/dist/filters/text-filter.js +1 -0
- package/views/dist/grid/chrome/GridAddColumn.d.ts +23 -0
- package/views/dist/grid/chrome/GridAddColumn.js +106 -0
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +36 -0
- package/views/dist/grid/chrome/GridAggregateMenu.js +60 -0
- package/views/dist/grid/chrome/GridCellEditors.d.ts +81 -0
- package/views/dist/grid/chrome/GridCellEditors.js +156 -0
- package/views/dist/grid/chrome/GridCellOutline.d.ts +53 -0
- package/views/dist/grid/chrome/GridCellOutline.js +36 -0
- package/views/dist/grid/chrome/GridChipsEditor.d.ts +40 -0
- package/views/dist/grid/chrome/GridChipsEditor.js +39 -0
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +13 -0
- package/views/dist/grid/chrome/GridColumnColorSection.js +40 -0
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +27 -0
- package/views/dist/grid/chrome/GridColumnDateSection.js +23 -0
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +23 -0
- package/views/dist/grid/chrome/GridColumnDurationSection.js +24 -0
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +113 -0
- package/views/dist/grid/chrome/GridColumnMenu.js +149 -0
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +29 -0
- package/views/dist/grid/chrome/GridColumnNumberSection.js +27 -0
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +16 -0
- package/views/dist/grid/chrome/GridColumnPercentSection.js +16 -0
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +38 -0
- package/views/dist/grid/chrome/GridColumnSortSection.js +33 -0
- package/views/dist/grid/chrome/GridDateEditor.d.ts +41 -0
- package/views/dist/grid/chrome/GridDateEditor.js +26 -0
- package/views/dist/grid/chrome/GridFlyout.d.ts +44 -0
- package/views/dist/grid/chrome/GridFlyout.js +80 -0
- package/views/dist/grid/chrome/GridFooter.d.ts +40 -0
- package/views/dist/grid/chrome/GridFooter.js +55 -0
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +47 -0
- package/views/dist/grid/chrome/GridGroupMenu.js +101 -0
- package/views/dist/grid/chrome/GridHeader.d.ts +83 -0
- package/views/dist/grid/chrome/GridHeader.js +58 -0
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
- package/views/dist/grid/chrome/GridLongTextEditor.js +73 -0
- package/views/dist/grid/chrome/GridMenuRow.d.ts +15 -0
- package/views/dist/grid/chrome/GridMenuRow.js +15 -0
- package/views/dist/grid/chrome/GridNameEditor.d.ts +24 -0
- package/views/dist/grid/chrome/GridNameEditor.js +25 -0
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +56 -0
- package/views/dist/grid/chrome/GridNumberEditor.js +42 -0
- package/views/dist/grid/chrome/GridPager.d.ts +7 -0
- package/views/dist/grid/chrome/GridPager.js +34 -0
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +29 -0
- package/views/dist/grid/chrome/GridPlaceEditor.js +26 -0
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +35 -0
- package/views/dist/grid/chrome/GridRangeEditor.js +32 -0
- package/views/dist/grid/chrome/GridRelationEditor.d.ts +47 -0
- package/views/dist/grid/chrome/GridRelationEditor.js +99 -0
- package/views/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
- package/views/dist/grid/chrome/GridResizeHandle.js +19 -0
- package/views/dist/grid/chrome/GridRow.d.ts +32 -0
- package/views/dist/grid/chrome/GridRow.js +171 -0
- package/views/dist/grid/chrome/GridRowActions.d.ts +37 -0
- package/views/dist/grid/chrome/GridRowActions.js +36 -0
- package/views/dist/grid/chrome/GridRowCells.d.ts +4 -0
- package/views/dist/grid/chrome/GridRowCells.js +157 -0
- package/views/dist/grid/chrome/GridRowGlyph.d.ts +14 -0
- package/views/dist/grid/chrome/GridRowGlyph.js +18 -0
- package/views/dist/grid/chrome/GridSelectEditor.d.ts +35 -0
- package/views/dist/grid/chrome/GridSelectEditor.js +58 -0
- package/views/dist/grid/chrome/GridStructure.d.ts +64 -0
- package/views/dist/grid/chrome/GridStructure.js +87 -0
- package/views/dist/grid/chrome/GridTable.d.ts +4 -0
- package/views/dist/grid/chrome/GridTable.js +394 -0
- package/views/dist/grid/chrome/GridTableSurface.d.ts +80 -0
- package/views/dist/grid/chrome/GridTableSurface.js +39 -0
- package/views/dist/grid/chrome/GridTextEditor.d.ts +49 -0
- package/views/dist/grid/chrome/GridTextEditor.js +51 -0
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +38 -0
- package/views/dist/grid/chrome/GridValueListEditor.js +29 -0
- package/views/dist/grid/chrome/StuckMarker.d.ts +26 -0
- package/views/dist/grid/chrome/StuckMarker.js +44 -0
- package/views/dist/grid/chrome/cell-clipboard.d.ts +10 -0
- package/views/dist/grid/chrome/cell-clipboard.js +28 -0
- package/views/dist/grid/chrome/cell-cut-off.d.ts +11 -0
- package/views/dist/grid/chrome/cell-cut-off.js +20 -0
- package/views/dist/grid/chrome/cells.d.ts +23 -0
- package/views/dist/grid/chrome/cells.js +19 -0
- package/views/dist/grid/chrome/checks.d.ts +56 -0
- package/views/dist/grid/chrome/checks.js +48 -0
- package/views/dist/grid/chrome/column-glyph.d.ts +16 -0
- package/views/dist/grid/chrome/column-glyph.js +52 -0
- package/views/dist/grid/chrome/editors.d.ts +9 -0
- package/views/dist/grid/chrome/editors.js +10 -0
- package/views/dist/grid/chrome/grid-add-column-items.d.ts +13 -0
- package/views/dist/grid/chrome/grid-add-column-items.js +47 -0
- package/views/dist/grid/chrome/grid-body-place.d.ts +4 -0
- package/views/dist/grid/chrome/grid-body-place.js +15 -0
- package/views/dist/grid/chrome/grid-button.d.ts +32 -0
- package/views/dist/grid/chrome/grid-button.js +12 -0
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +96 -0
- package/views/dist/grid/chrome/grid-cell-classes.js +70 -0
- package/views/dist/grid/chrome/grid-cell-link.d.ts +13 -0
- package/views/dist/grid/chrome/grid-cell-link.js +9 -0
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +78 -0
- package/views/dist/grid/chrome/grid-column-menu-items.js +292 -0
- package/views/dist/grid/chrome/grid-columns-template.d.ts +45 -0
- package/views/dist/grid/chrome/grid-columns-template.js +18 -0
- package/views/dist/grid/chrome/grid-edit-escape.d.ts +4 -0
- package/views/dist/grid/chrome/grid-edit-escape.js +12 -0
- package/views/dist/grid/chrome/grid-edit-session.d.ts +67 -0
- package/views/dist/grid/chrome/grid-edit-session.js +141 -0
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +7 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-figure-value.d.ts +25 -0
- package/views/dist/grid/chrome/grid-figure-value.js +40 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +15 -0
- package/views/dist/grid/chrome/grid-fitted-box.js +26 -0
- package/views/dist/grid/chrome/grid-group-menu-items.d.ts +38 -0
- package/views/dist/grid/chrome/grid-group-menu-items.js +92 -0
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +31 -0
- package/views/dist/grid/chrome/grid-group-menu-parts.js +21 -0
- package/views/dist/grid/chrome/grid-hover.d.ts +74 -0
- package/views/dist/grid/chrome/grid-hover.js +150 -0
- package/views/dist/grid/chrome/grid-lab.d.ts +7 -0
- package/views/dist/grid/chrome/grid-lab.js +7 -0
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +65 -0
- package/views/dist/grid/chrome/grid-menu-focus.js +160 -0
- package/views/dist/grid/chrome/grid-menu-search.d.ts +7 -0
- package/views/dist/grid/chrome/grid-menu-search.js +7 -0
- package/views/dist/grid/chrome/grid-pages.d.ts +15 -0
- package/views/dist/grid/chrome/grid-pages.js +9 -0
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +49 -0
- package/views/dist/grid/chrome/grid-row-menu-items.js +159 -0
- package/views/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
- package/views/dist/grid/chrome/grid-row-menu-key.js +36 -0
- package/views/dist/grid/chrome/grid-row-props.d.ts +155 -0
- package/views/dist/grid/chrome/grid-row-props.js +1 -0
- package/views/dist/grid/chrome/grid-row-window.d.ts +78 -0
- package/views/dist/grid/chrome/grid-row-window.js +280 -0
- package/views/dist/grid/chrome/grid-rows-menu.d.ts +42 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +85 -0
- package/views/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
- package/views/dist/grid/chrome/grid-scroll-owner.js +75 -0
- package/views/dist/grid/chrome/grid-styles.d.ts +50 -0
- package/views/dist/grid/chrome/grid-styles.js +11 -0
- package/views/dist/grid/chrome/grid-table-props.d.ts +310 -0
- package/views/dist/grid/chrome/grid-table-props.js +1 -0
- package/views/dist/grid/chrome/grid-wait.d.ts +22 -0
- package/views/dist/grid/chrome/grid-wait.js +4 -0
- package/views/dist/grid/chrome/useBarRoom.d.ts +19 -0
- package/views/dist/grid/chrome/useBarRoom.js +96 -0
- package/views/dist/grid/chrome/useGridBandFigures.d.ts +26 -0
- package/views/dist/grid/chrome/useGridBandFigures.js +50 -0
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
- package/views/dist/grid/chrome/useGridBatchApi.js +36 -0
- package/views/dist/grid/chrome/useGridBoxes.d.ts +22 -0
- package/views/dist/grid/chrome/useGridBoxes.js +22 -0
- package/views/dist/grid/chrome/useGridCellPick.d.ts +30 -0
- package/views/dist/grid/chrome/useGridCellPick.js +77 -0
- package/views/dist/grid/chrome/useGridColumnLayout.d.ts +32 -0
- package/views/dist/grid/chrome/useGridColumnLayout.js +251 -0
- package/views/dist/grid/chrome/useGridFocus.d.ts +48 -0
- package/views/dist/grid/chrome/useGridFocus.js +129 -0
- package/views/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
- package/views/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +65 -0
- package/views/dist/grid/chrome/useGridKeyboard.js +463 -0
- package/views/dist/grid/chrome/useGridLongPress.d.ts +30 -0
- package/views/dist/grid/chrome/useGridLongPress.js +98 -0
- package/views/dist/grid/chrome/useGridPartColumns.d.ts +5 -0
- package/views/dist/grid/chrome/useGridPartColumns.js +9 -0
- package/views/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
- package/views/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
- package/views/dist/grid/chrome/useGridRailReveal.js +67 -0
- package/views/dist/grid/chrome/useGridRangeActions.d.ts +51 -0
- package/views/dist/grid/chrome/useGridRangeActions.js +199 -0
- package/views/dist/grid/chrome/useGridRangeGestures.d.ts +33 -0
- package/views/dist/grid/chrome/useGridRangeGestures.js +241 -0
- package/views/dist/grid/chrome/useGridRecorder.d.ts +16 -0
- package/views/dist/grid/chrome/useGridRecorder.js +144 -0
- package/views/dist/grid/chrome/useGridRowOpener.d.ts +41 -0
- package/views/dist/grid/chrome/useGridRowOpener.js +83 -0
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
- package/views/dist/grid/chrome/useGridScaleStyles.js +28 -0
- package/views/dist/grid/chrome/useGridScrollArea.d.ts +47 -0
- package/views/dist/grid/chrome/useGridScrollArea.js +120 -0
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +81 -0
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +336 -0
- package/views/dist/grid/chrome/useGridTableSelection.d.ts +31 -0
- package/views/dist/grid/chrome/useGridTableSelection.js +55 -0
- package/views/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
- package/views/dist/grid/chrome/useHeaderDragReorder.js +218 -0
- package/views/dist/grid/core/clipboard-model.d.ts +123 -0
- package/views/dist/grid/core/clipboard-model.js +388 -0
- package/views/dist/grid/core/column-values.d.ts +27 -0
- package/views/dist/grid/core/column-values.js +76 -0
- package/views/dist/grid/core/commit-model.d.ts +48 -0
- package/views/dist/grid/core/commit-model.js +3 -0
- package/views/dist/grid/core/coordinates.d.ts +48 -0
- package/views/dist/grid/core/coordinates.js +27 -0
- package/views/dist/grid/core/edge-scroll.d.ts +21 -0
- package/views/dist/grid/core/edge-scroll.js +23 -0
- package/views/dist/grid/core/edit-values.d.ts +9 -0
- package/views/dist/grid/core/edit-values.js +1 -0
- package/views/dist/grid/core/editing-controller.d.ts +146 -0
- package/views/dist/grid/core/editing-controller.js +563 -0
- package/views/dist/grid/core/editing-model.d.ts +113 -0
- package/views/dist/grid/core/editing-model.js +168 -0
- package/views/dist/grid/core/flat-rows.d.ts +35 -0
- package/views/dist/grid/core/flat-rows.js +20 -0
- package/views/dist/grid/core/grid-aria.d.ts +31 -0
- package/views/dist/grid/core/grid-aria.js +41 -0
- package/views/dist/grid/core/grid-focus.d.ts +60 -0
- package/views/dist/grid/core/grid-focus.js +171 -0
- package/views/dist/grid/core/grid-recorder.d.ts +111 -0
- package/views/dist/grid/core/grid-recorder.js +223 -0
- package/views/dist/grid/core/grid-scale.d.ts +14 -0
- package/views/dist/grid/core/grid-scale.js +8 -0
- package/views/dist/grid/core/nav.d.ts +94 -0
- package/views/dist/grid/core/nav.js +92 -0
- package/views/dist/grid/core/part-edits.d.ts +18 -0
- package/views/dist/grid/core/part-edits.js +48 -0
- package/views/dist/grid/core/pending-reconciliation.d.ts +53 -0
- package/views/dist/grid/core/pending-reconciliation.js +60 -0
- package/views/dist/grid/core/range-model.d.ts +25 -0
- package/views/dist/grid/core/range-model.js +59 -0
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +15 -0
- package/views/dist/grid/core/row-opened-from.d.ts +21 -0
- package/views/dist/grid/core/row-opened-from.js +11 -0
- package/views/dist/grid/core/row-window.d.ts +40 -0
- package/views/dist/grid/core/row-window.js +43 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +101 -0
- package/views/dist/grid/core/spreadsheet-operations.js +282 -0
- package/views/dist/grid/core/useGridEditing.d.ts +72 -0
- package/views/dist/grid/core/useGridEditing.js +105 -0
- package/views/dist/grid/core/useGridRange.d.ts +22 -0
- package/views/dist/grid/core/useGridRange.js +27 -0
- package/views/dist/grid/core/value-equality.d.ts +72 -0
- package/views/dist/grid/core/value-equality.js +104 -0
- package/views/dist/grid/core/write-states.d.ts +20 -0
- package/views/dist/grid/core/write-states.js +21 -0
- package/views/dist/grid/grid-format-props.d.ts +26 -0
- package/views/dist/grid/grid-format-props.js +65 -0
- package/views/dist/grid/index.d.ts +23 -0
- package/views/dist/grid/index.js +7 -0
- package/views/dist/grid/useGridTablePrefs.d.ts +48 -0
- package/views/dist/grid/useGridTablePrefs.js +47 -0
- package/views/dist/grid/useGridTableSettings.d.ts +60 -0
- package/views/dist/grid/useGridTableSettings.js +61 -0
- package/views/dist/grid-lab.d.ts +18 -0
- package/views/dist/grid-lab.js +16 -0
- package/views/dist/grouping/sort-groups.d.ts +17 -0
- package/views/dist/grouping/sort-groups.js +33 -0
- package/views/dist/grouping/types.d.ts +10 -0
- package/views/dist/grouping/types.js +1 -0
- package/views/dist/index.d.ts +31 -0
- package/views/dist/index.js +30 -0
- package/views/dist/internal/chip.d.ts +4 -0
- package/views/dist/internal/chip.js +3 -0
- package/views/dist/internal/count.d.ts +3 -0
- package/views/dist/internal/count.js +3 -0
- package/views/dist/internal/cx.d.ts +3 -0
- package/views/dist/internal/cx.js +3 -0
- package/views/dist/internal/reset.d.ts +9 -0
- package/views/dist/internal/reset.js +1 -0
- package/views/dist/internal/use-idle-write.d.ts +1 -0
- package/views/dist/internal/use-idle-write.js +13 -0
- package/views/dist/internal/viewport.d.ts +3 -0
- package/views/dist/internal/viewport.js +15 -0
- package/views/dist/internal/zone-clock.d.ts +20 -0
- package/views/dist/internal/zone-clock.js +77 -0
- package/views/dist/model/aggregates.d.ts +61 -0
- package/views/dist/model/aggregates.js +134 -0
- package/views/dist/model/body-frame.d.ts +34 -0
- package/views/dist/model/body-frame.js +15 -0
- package/views/dist/model/card-density.d.ts +8 -0
- package/views/dist/model/card-density.js +10 -0
- package/views/dist/model/card-layout.d.ts +85 -0
- package/views/dist/model/card-layout.js +90 -0
- package/views/dist/model/column-capabilities.d.ts +193 -0
- package/views/dist/model/column-capabilities.js +280 -0
- package/views/dist/model/column-filters.d.ts +109 -0
- package/views/dist/model/column-filters.js +348 -0
- package/views/dist/model/column-format.d.ts +103 -0
- package/views/dist/model/column-format.js +1 -0
- package/views/dist/model/column-from.d.ts +28 -0
- package/views/dist/model/column-from.js +165 -0
- package/views/dist/model/column-inspect.d.ts +28 -0
- package/views/dist/model/column-inspect.js +17 -0
- package/views/dist/model/column-knobs.d.ts +20 -0
- package/views/dist/model/column-knobs.js +16 -0
- package/views/dist/model/column-mark.d.ts +13 -0
- package/views/dist/model/column-mark.js +10 -0
- package/views/dist/model/column-money.d.ts +13 -0
- package/views/dist/model/column-money.js +27 -0
- package/views/dist/model/column-order.d.ts +36 -0
- package/views/dist/model/column-order.js +68 -0
- package/views/dist/model/column-schema.d.ts +355 -0
- package/views/dist/model/column-schema.js +1 -0
- package/views/dist/model/column-sort.d.ts +28 -0
- package/views/dist/model/column-sort.js +25 -0
- package/views/dist/model/column-state.d.ts +72 -0
- package/views/dist/model/column-state.js +92 -0
- package/views/dist/model/column-types.d.ts +97 -0
- package/views/dist/model/column-types.js +50 -0
- package/views/dist/model/column-warnings.d.ts +44 -0
- package/views/dist/model/column-warnings.js +24 -0
- package/views/dist/model/density.d.ts +3 -0
- package/views/dist/model/density.js +13 -0
- package/views/dist/model/field-type-of.d.ts +21 -0
- package/views/dist/model/field-type-of.js +11 -0
- package/views/dist/model/filter-capabilities.d.ts +1 -0
- package/views/dist/model/filter-capabilities.js +1 -0
- package/views/dist/model/index.d.ts +38 -0
- package/views/dist/model/index.js +20 -0
- package/views/dist/model/one-value.d.ts +6 -0
- package/views/dist/model/one-value.js +5 -0
- package/views/dist/model/part-columns.d.ts +17 -0
- package/views/dist/model/part-columns.js +69 -0
- package/views/dist/model/part-rows.d.ts +21 -0
- package/views/dist/model/part-rows.js +35 -0
- package/views/dist/model/part-write.d.ts +11 -0
- package/views/dist/model/part-write.js +52 -0
- package/views/dist/model/place-parts.d.ts +6 -0
- package/views/dist/model/place-parts.js +14 -0
- package/views/dist/model/preferences.d.ts +131 -0
- package/views/dist/model/preferences.js +67 -0
- package/views/dist/model/prefs-buckets.d.ts +145 -0
- package/views/dist/model/prefs-buckets.js +68 -0
- package/views/dist/model/relation-filters.d.ts +64 -0
- package/views/dist/model/relation-filters.js +93 -0
- package/views/dist/model/render-count.d.ts +8 -0
- package/views/dist/model/render-count.js +35 -0
- package/views/dist/model/row-icon.d.ts +29 -0
- package/views/dist/model/row-icon.js +5 -0
- package/views/dist/model/settings-columns.d.ts +34 -0
- package/views/dist/model/settings-columns.js +146 -0
- package/views/dist/model/settings-look.d.ts +17 -0
- package/views/dist/model/settings-look.js +23 -0
- package/views/dist/model/view-rules.d.ts +92 -0
- package/views/dist/model/view-rules.js +300 -0
- package/views/dist/panels/availability.d.ts +26 -0
- package/views/dist/panels/availability.js +28 -0
- package/views/dist/panels/customize-body.d.ts +45 -0
- package/views/dist/panels/customize-body.js +292 -0
- package/views/dist/panels/filter/DateFilterBody.d.ts +44 -0
- package/views/dist/panels/filter/DateFilterBody.js +84 -0
- package/views/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
- package/views/dist/panels/filter/DateFilterCalendar.js +37 -0
- package/views/dist/panels/filter/DateFilterInput.d.ts +16 -0
- package/views/dist/panels/filter/DateFilterInput.js +36 -0
- package/views/dist/panels/filter/FilterIcon.d.ts +7 -0
- package/views/dist/panels/filter/FilterIcon.js +15 -0
- package/views/dist/panels/filter/MenuSelect.d.ts +12 -0
- package/views/dist/panels/filter/MenuSelect.js +50 -0
- package/views/dist/panels/filter/NumberFilterBody.d.ts +21 -0
- package/views/dist/panels/filter/NumberFilterBody.js +75 -0
- package/views/dist/panels/filter/RangeFilterBody.d.ts +19 -0
- package/views/dist/panels/filter/RangeFilterBody.js +78 -0
- package/views/dist/panels/filter/RelationFilterBody.d.ts +17 -0
- package/views/dist/panels/filter/RelationFilterBody.js +20 -0
- package/views/dist/panels/filter/TextFilterBody.d.ts +31 -0
- package/views/dist/panels/filter/TextFilterBody.js +43 -0
- package/views/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
- package/views/dist/panels/filter/TimeScopeDetail.js +47 -0
- package/views/dist/panels/filter/details.d.ts +21 -0
- package/views/dist/panels/filter/details.js +100 -0
- package/views/dist/panels/filter/filter-list.d.ts +23 -0
- package/views/dist/panels/filter/filter-list.js +38 -0
- package/views/dist/panels/group-sort.d.ts +24 -0
- package/views/dist/panels/group-sort.js +58 -0
- package/views/dist/panels/index.d.ts +31 -0
- package/views/dist/panels/index.js +22 -0
- package/views/dist/panels/labels.d.ts +37 -0
- package/views/dist/panels/labels.js +166 -0
- package/views/dist/panels/model.d.ts +429 -0
- package/views/dist/panels/model.js +95 -0
- package/views/dist/panels/panel-button.d.ts +50 -0
- package/views/dist/panels/panel-button.js +21 -0
- package/views/dist/panels/quick/model.d.ts +102 -0
- package/views/dist/panels/quick/model.js +102 -0
- package/views/dist/panels/react/GroupBucketsList.d.ts +16 -0
- package/views/dist/panels/react/GroupBucketsList.js +44 -0
- package/views/dist/panels/react/LayoutColumnsList.d.ts +24 -0
- package/views/dist/panels/react/LayoutColumnsList.js +101 -0
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
- package/views/dist/panels/react/PopoverColumnDetail.js +24 -0
- package/views/dist/panels/react/chrome.d.ts +20 -0
- package/views/dist/panels/react/chrome.js +9 -0
- package/views/dist/panels/react/column-refusals.d.ts +7 -0
- package/views/dist/panels/react/column-refusals.js +14 -0
- package/views/dist/panels/react/customize-body.d.ts +15 -0
- package/views/dist/panels/react/customize-body.js +63 -0
- package/views/dist/panels/react/customize.d.ts +33 -0
- package/views/dist/panels/react/customize.js +113 -0
- package/views/dist/panels/react/drag-kit.d.ts +55 -0
- package/views/dist/panels/react/drag-kit.js +89 -0
- package/views/dist/panels/react/drag-load.d.ts +8 -0
- package/views/dist/panels/react/drag-load.js +24 -0
- package/views/dist/panels/react/drag.d.ts +2 -0
- package/views/dist/panels/react/drag.js +5 -0
- package/views/dist/panels/react/field-editor.d.ts +10 -0
- package/views/dist/panels/react/field-editor.js +1 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +24 -0
- package/views/dist/panels/react/filter/FilterEditor.js +344 -0
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +15 -0
- package/views/dist/panels/react/filter/FilterFieldList.js +57 -0
- package/views/dist/panels/react/filter/FilterValueBody.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterValueBody.js +22 -0
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +22 -0
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +186 -0
- package/views/dist/panels/react/filter/editor-ctx.d.ts +98 -0
- package/views/dist/panels/react/filter/editor-ctx.js +131 -0
- package/views/dist/panels/react/filter/filter-body.d.ts +19 -0
- package/views/dist/panels/react/filter/filter-body.js +72 -0
- package/views/dist/panels/react/filter/filter-part-body.d.ts +20 -0
- package/views/dist/panels/react/filter/filter-part-body.js +23 -0
- package/views/dist/panels/react/filter/rule-writes.d.ts +56 -0
- package/views/dist/panels/react/filter/rule-writes.js +152 -0
- package/views/dist/panels/react/filter-panel.d.ts +18 -0
- package/views/dist/panels/react/filter-panel.js +48 -0
- package/views/dist/panels/react/layout-detail.d.ts +4 -0
- package/views/dist/panels/react/layout-detail.js +29 -0
- package/views/dist/panels/react/order-details.d.ts +32 -0
- package/views/dist/panels/react/order-details.js +89 -0
- package/views/dist/panels/react/panel-header.d.ts +10 -0
- package/views/dist/panels/react/panel-header.js +20 -0
- package/views/dist/panels/react/panel-sheet.d.ts +23 -0
- package/views/dist/panels/react/panel-sheet.js +24 -0
- package/views/dist/panels/react/popover.d.ts +71 -0
- package/views/dist/panels/react/popover.js +47 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +12 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +148 -0
- package/views/dist/panels/react/quick/QuickFiltersReminder.d.ts +13 -0
- package/views/dist/panels/react/quick/QuickFiltersReminder.js +46 -0
- package/views/dist/panels/react/root-list.d.ts +6 -0
- package/views/dist/panels/react/root-list.js +31 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +24 -0
- package/views/dist/panels/react/sort/SortEditor.js +290 -0
- package/views/dist/panels/react/sort/SortFieldList.d.ts +12 -0
- package/views/dist/panels/react/sort/SortFieldList.js +34 -0
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +17 -0
- package/views/dist/panels/react/sort/use-sort-drag.js +39 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +62 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +240 -0
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +30 -0
- package/views/dist/panels/react/toolbar/Toolbar.js +113 -0
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.d.ts +25 -0
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +85 -0
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.d.ts +20 -0
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +78 -0
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.d.ts +21 -0
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +126 -0
- package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarButton.js +9 -0
- package/views/dist/panels/react/toolbar/ToolbarFilter.d.ts +28 -0
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +42 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.d.ts +12 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +30 -0
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +19 -0
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +281 -0
- package/views/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
- package/views/dist/panels/react/toolbar/ToolbarNew.js +31 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +29 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +14 -0
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +16 -0
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ToolbarSave.js +42 -0
- package/views/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +84 -0
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +14 -0
- package/views/dist/panels/react/toolbar/ToolbarSort.js +29 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +18 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +81 -0
- package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
- package/views/dist/panels/react/toolbar/ToolbarViews.js +29 -0
- package/views/dist/panels/react/toolbar/bar-writes.d.ts +31 -0
- package/views/dist/panels/react/toolbar/bar-writes.js +82 -0
- package/views/dist/panels/react/toolbar/context.d.ts +83 -0
- package/views/dist/panels/react/toolbar/context.js +74 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +54 -0
- package/views/dist/panels/react/toolbar/panel-part.js +49 -0
- package/views/dist/panels/react/toolbar/panel-state.d.ts +9 -0
- package/views/dist/panels/react/toolbar/panel-state.js +12 -0
- package/views/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
- package/views/dist/panels/react/toolbar/use-box-narrow.js +18 -0
- package/views/dist/panels/react/toolbar/use-give-way.d.ts +4 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +110 -0
- package/views/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
- package/views/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
- package/views/dist/panels/react/view-actions.d.ts +4 -0
- package/views/dist/panels/react/view-actions.js +47 -0
- package/views/dist/panels/react/view-footer.d.ts +20 -0
- package/views/dist/panels/react/view-footer.js +41 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +5 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +137 -0
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
- package/views/dist/panels/react/views-row/HScrollRow.js +42 -0
- package/views/dist/panels/react/views-row/PillGroup.d.ts +30 -0
- package/views/dist/panels/react/views-row/PillGroup.js +85 -0
- package/views/dist/panels/react/views-row/ViewAxes.d.ts +9 -0
- package/views/dist/panels/react/views-row/ViewAxes.js +16 -0
- package/views/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
- package/views/dist/panels/react/views-row/ViewCreatePill.js +28 -0
- package/views/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
- package/views/dist/panels/react/views-row/ViewPicker.js +112 -0
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
- package/views/dist/panels/react/views-row/ViewPickerRow.js +47 -0
- package/views/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
- package/views/dist/panels/react/views-row/ViewTabs.js +29 -0
- package/views/dist/panels/react/views-row/in-frame.d.ts +8 -0
- package/views/dist/panels/react/views-row/in-frame.js +9 -0
- package/views/dist/panels/react/views-row/menu-classes.d.ts +6 -0
- package/views/dist/panels/react/views-row/menu-classes.js +3 -0
- package/views/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
- package/views/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
- package/views/dist/panels/react.d.ts +67 -0
- package/views/dist/panels/react.js +58 -0
- package/views/dist/panels/settings/axes.d.ts +28 -0
- package/views/dist/panels/settings/axes.js +71 -0
- package/views/dist/panels/settings/filter-groups.d.ts +58 -0
- package/views/dist/panels/settings/filter-groups.js +305 -0
- package/views/dist/panels/settings/filters.d.ts +20 -0
- package/views/dist/panels/settings/filters.js +128 -0
- package/views/dist/panels/settings/group-buckets.d.ts +24 -0
- package/views/dist/panels/settings/group-buckets.js +69 -0
- package/views/dist/panels/settings/input.d.ts +84 -0
- package/views/dist/panels/settings/input.js +1 -0
- package/views/dist/panels/settings/layout.d.ts +5 -0
- package/views/dist/panels/settings/layout.js +259 -0
- package/views/dist/panels/settings/order.d.ts +21 -0
- package/views/dist/panels/settings/order.js +227 -0
- package/views/dist/panels/settings/settings-panels.d.ts +21 -0
- package/views/dist/panels/settings/settings-panels.js +33 -0
- package/views/dist/panels/settings/sort-keys.d.ts +25 -0
- package/views/dist/panels/settings/sort-keys.js +74 -0
- package/views/dist/panels/settings/sorts.d.ts +33 -0
- package/views/dist/panels/settings/sorts.js +135 -0
- package/views/dist/panels/sort-body-options.d.ts +4 -0
- package/views/dist/panels/sort-body-options.js +10 -0
- package/views/dist/panels/toolbar/clear.d.ts +9 -0
- package/views/dist/panels/toolbar/clear.js +33 -0
- package/views/dist/panels/toolbar/counts.d.ts +21 -0
- package/views/dist/panels/toolbar/counts.js +29 -0
- package/views/dist/panels/toolbar/edit-view.d.ts +5 -0
- package/views/dist/panels/toolbar/edit-view.js +18 -0
- package/views/dist/panels/toolbar/filter-words.d.ts +42 -0
- package/views/dist/panels/toolbar/filter-words.js +145 -0
- package/views/dist/panels/toolbar/model.d.ts +74 -0
- package/views/dist/panels/toolbar/model.js +110 -0
- package/views/dist/panels/use-filter-opened.d.ts +8 -0
- package/views/dist/panels/use-filter-opened.js +11 -0
- package/views/dist/panels/view-state.d.ts +38 -0
- package/views/dist/panels/view-state.js +1 -0
- package/views/dist/panels/views-row/model.d.ts +141 -0
- package/views/dist/panels/views-row/model.js +24 -0
- package/views/dist/provider/ViewsProvider.d.ts +103 -0
- package/views/dist/provider/ViewsProvider.js +75 -0
- package/views/dist/provider/components.d.ts +1375 -0
- package/views/dist/provider/components.js +5 -0
- package/views/dist/provider/context.d.ts +58 -0
- package/views/dist/provider/context.js +10 -0
- package/views/dist/provider/desktop.d.ts +12 -0
- package/views/dist/provider/desktop.js +25 -0
- package/views/dist/provider/icons.d.ts +6 -0
- package/views/dist/provider/icons.js +1 -0
- package/views/dist/provider/menu-groups.d.ts +9 -0
- package/views/dist/provider/menu-groups.js +44 -0
- package/views/dist/provider/missing-slot.d.ts +10 -0
- package/views/dist/provider/missing-slot.js +15 -0
- package/views/dist/provider/plain-input.d.ts +9 -0
- package/views/dist/provider/plain-input.js +7 -0
- package/views/dist/provider/ports.d.ts +57 -0
- package/views/dist/provider/ports.js +9 -0
- package/views/dist/react.d.ts +14 -0
- package/views/dist/react.js +5 -0
- package/views/dist/selection/SelectCheckbox.d.ts +19 -0
- package/views/dist/selection/SelectCheckbox.js +11 -0
- package/views/dist/selection/SelectionBar.d.ts +18 -0
- package/views/dist/selection/SelectionBar.js +100 -0
- package/views/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/views/dist/selection/SelectionBarPhone.js +14 -0
- package/views/dist/selection/bar-overflow.d.ts +12 -0
- package/views/dist/selection/bar-overflow.js +55 -0
- package/views/dist/selection/bar-parts.d.ts +17 -0
- package/views/dist/selection/bar-parts.js +19 -0
- package/views/dist/selection/bar-room.d.ts +7 -0
- package/views/dist/selection/bar-room.js +3 -0
- package/views/dist/selection/index.d.ts +9 -0
- package/views/dist/selection/index.js +7 -0
- package/views/dist/selection/model.d.ts +55 -0
- package/views/dist/selection/model.js +86 -0
- package/views/dist/selection/row-click.d.ts +35 -0
- package/views/dist/selection/row-click.js +20 -0
- package/views/dist/selection/types.d.ts +21 -0
- package/views/dist/selection/types.js +1 -0
- package/views/dist/selection/useCheckDragSelect.d.ts +61 -0
- package/views/dist/selection/useCheckDragSelect.js +166 -0
- package/views/dist/selection/useListSelection.d.ts +39 -0
- package/views/dist/selection/useListSelection.js +48 -0
- package/views/dist/selection/useListSelectionShortcuts.d.ts +7 -0
- package/views/dist/selection/useListSelectionShortcuts.js +14 -0
- package/views/dist/selection/useRestIntent.d.ts +18 -0
- package/views/dist/selection/useRestIntent.js +35 -0
- package/views/dist/selection/verbs.d.ts +41 -0
- package/views/dist/selection/verbs.js +1 -0
- package/views/docs/contract.md +1181 -0
- package/views/docs/getting-started.md +250 -0
- package/views/docs/guides/atoms.md +305 -0
- package/views/docs/guides/cells.md +302 -0
- package/views/docs/guides/columns.md +413 -0
- package/views/docs/guides/display.md +205 -0
- package/views/docs/guides/editors.md +496 -0
- package/views/docs/guides/ports.md +246 -0
- package/views/docs/guides/selection.md +284 -0
- package/views/docs/guides/the-grid.md +736 -0
- package/views/docs/guides/the-provider.md +478 -0
- package/views/docs/index.md +54 -0
- package/views/docs/install.md +74 -0
- package/views/docs/reference/cells.md +28 -0
- package/views/docs/reference/display.md +46 -0
- package/views/docs/reference/editors-chips.md +6 -0
- package/views/docs/reference/editors-date.md +8 -0
- package/views/docs/reference/editors-location.md +12 -0
- package/views/docs/reference/editors-name.md +8 -0
- package/views/docs/reference/editors-number.md +13 -0
- package/views/docs/reference/editors-open-values.md +10 -0
- package/views/docs/reference/editors-panel.md +12 -0
- package/views/docs/reference/editors-range.md +8 -0
- package/views/docs/reference/editors-relation.md +12 -0
- package/views/docs/reference/editors-select.md +9 -0
- package/views/docs/reference/editors-session.md +13 -0
- package/views/docs/reference/editors-text.md +9 -0
- package/views/docs/reference/editors-value-list.md +6 -0
- package/views/docs/reference/editors.md +5 -0
- package/views/docs/reference/field-row.md +16 -0
- package/views/docs/reference/grid.md +64 -0
- package/views/docs/reference/panels-react.md +172 -0
- package/views/docs/reference/panels.md +220 -0
- package/views/docs/reference/react.md +164 -0
- package/views/docs/reference/selection.md +41 -0
- package/views/docs/reference/views.md +638 -0
- package/views/docs/reshaping.md +19 -0
- package/views/skills/views/SKILL.md +103 -0
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
# Queries
|
|
2
|
+
|
|
3
|
+
`viewkitjs/fields/query` answers a saved view over the rows a list already holds: which rows pass its filter, in what order they come, and which groups they fall into. A view is data keyed by field, never a function, so a host can keep it in a row and translate the same rules for its database; this page is the in-memory side.
|
|
4
|
+
|
|
5
|
+
## The registries and the rows
|
|
6
|
+
|
|
7
|
+
Every example on this page reads three registries: deals, the companies they belong to, and people. A reader tells the evaluator how to find a field's definition and a row's value. `read` hands back the value as the cell draws it, so a rule compares what is on screen. A relation reads as `{ id, label }`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import assert from "node:assert/strict";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import {
|
|
13
|
+
checkFilterTree,
|
|
14
|
+
defineConventions,
|
|
15
|
+
defineFields,
|
|
16
|
+
defineIndex,
|
|
17
|
+
entityDef,
|
|
18
|
+
FieldDefinitionError,
|
|
19
|
+
type FieldDef,
|
|
20
|
+
type LocationValue,
|
|
21
|
+
type NameValue,
|
|
22
|
+
type RangeValue,
|
|
23
|
+
} from "viewkitjs/fields";
|
|
24
|
+
import {
|
|
25
|
+
countMatching,
|
|
26
|
+
evaluateView,
|
|
27
|
+
hasActiveRules,
|
|
28
|
+
recordReaderFor,
|
|
29
|
+
type FilterNode,
|
|
30
|
+
type FilterTree,
|
|
31
|
+
type ViewFieldReader,
|
|
32
|
+
} from "viewkitjs/fields/query";
|
|
33
|
+
|
|
34
|
+
const DEAL_FIELDS = defineFields({
|
|
35
|
+
entity: "deal",
|
|
36
|
+
identity: "title",
|
|
37
|
+
fields: {
|
|
38
|
+
title: { type: "text", label: "Title" },
|
|
39
|
+
value: { type: "currency", label: "Value", code: { field: "currency" } },
|
|
40
|
+
currency: {
|
|
41
|
+
type: "select",
|
|
42
|
+
label: "Currency",
|
|
43
|
+
options: [
|
|
44
|
+
{ value: "EUR", label: "EUR" },
|
|
45
|
+
{ value: "RON", label: "RON" },
|
|
46
|
+
{ value: "USD", label: "USD" },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
stage: {
|
|
50
|
+
type: "status",
|
|
51
|
+
label: "Stage",
|
|
52
|
+
options: [
|
|
53
|
+
{ value: "new", label: "New", slot: "pending" },
|
|
54
|
+
{ value: "won", label: "Won", slot: "success" },
|
|
55
|
+
{ value: "lost", label: "Lost", slot: "error" },
|
|
56
|
+
{ value: "paused", label: "Paused", slot: "warning" },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
closeOn: { type: "date", label: "Close on" },
|
|
60
|
+
company: { type: "relation", label: "Company", relation: { kind: "company" }, nullable: true },
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const COMPANY_FIELDS = defineFields({
|
|
65
|
+
entity: "company",
|
|
66
|
+
identity: "name",
|
|
67
|
+
fields: {
|
|
68
|
+
name: { type: "text", label: "Name" },
|
|
69
|
+
employees: {
|
|
70
|
+
type: "range",
|
|
71
|
+
label: "Employees",
|
|
72
|
+
of: "number",
|
|
73
|
+
presets: [
|
|
74
|
+
{ key: "small", label: "1–50", low: 1, high: 50 },
|
|
75
|
+
{ key: "mid", label: "51–500", low: 51, high: 500 },
|
|
76
|
+
{ key: "large", label: "501+", low: 501, high: null },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
hq: { type: "location", label: "Head office", parts: ["city", "region", "postalCode", "countryCode"] },
|
|
80
|
+
profile: { type: "url", label: "Profile" },
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const PERSON_FIELDS = defineFields({
|
|
85
|
+
entity: "person",
|
|
86
|
+
identity: "name",
|
|
87
|
+
fields: {
|
|
88
|
+
name: { type: "name", label: "Name" },
|
|
89
|
+
company: { type: "relation", label: "Company", relation: { kind: "company" }, nullable: true },
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
type Link = { id: string; label: string };
|
|
94
|
+
type Deal = {
|
|
95
|
+
id: string;
|
|
96
|
+
title: string;
|
|
97
|
+
value: number | null;
|
|
98
|
+
currency: string | null;
|
|
99
|
+
stage: string;
|
|
100
|
+
closeOn: string | null;
|
|
101
|
+
company: Link | null;
|
|
102
|
+
};
|
|
103
|
+
type Company = { id: string; name: string; employees: RangeValue | null; hq: LocationValue | null; profile: string | null };
|
|
104
|
+
type Person = { id: string; name: NameValue | null };
|
|
105
|
+
|
|
106
|
+
const ACME: Link = { id: "c1", label: "Acme" };
|
|
107
|
+
const STEFAN: Link = { id: "c2", label: "Ștefan & Co" };
|
|
108
|
+
const GLOBEX: Link = { id: "c3", label: "Globex" };
|
|
109
|
+
const LUMEN: Link = { id: "c4", label: "Lumen" };
|
|
110
|
+
|
|
111
|
+
const DEALS: Deal[] = [
|
|
112
|
+
{ id: "d1", title: "Acme renewal", value: 12000, currency: "EUR", stage: "new", closeOn: "2026-03-06", company: ACME },
|
|
113
|
+
{ id: "d2", title: "Ștefan & Co pilot", value: 5000, currency: "RON", stage: "won", closeOn: "2026-02-20", company: STEFAN },
|
|
114
|
+
{ id: "d3", title: "Globex expansion", value: 900, currency: "EUR", stage: "lost", closeOn: "2026-03-03", company: GLOBEX },
|
|
115
|
+
{ id: "d4", title: "Birch audit", value: 30000, currency: "RON", stage: "new", closeOn: null, company: null },
|
|
116
|
+
{ id: "d5", title: "Lumen trial", value: 99.996, currency: null, stage: "new", closeOn: "2026-04-15", company: LUMEN },
|
|
117
|
+
{ id: "d6", title: "Orchard import", value: null, currency: "EUR", stage: "won", closeOn: "2026-03-02", company: ACME },
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
const COMPANIES: Company[] = [
|
|
121
|
+
{
|
|
122
|
+
id: "c1",
|
|
123
|
+
name: "Acme",
|
|
124
|
+
employees: { low: 200, high: 500 },
|
|
125
|
+
hq: { city: "Bucharest", region: "Bucharest", postalCode: "010011", countryCode: "RO" },
|
|
126
|
+
profile: "https://www.linkedin.com/company/acme",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "c2",
|
|
130
|
+
name: "Ștefan & Co",
|
|
131
|
+
employees: { low: 10, high: 50 },
|
|
132
|
+
hq: { city: "Cluj-Napoca", region: "Cluj", postalCode: "400001", countryCode: "RO" },
|
|
133
|
+
profile: "https://stefan.example",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "c3",
|
|
137
|
+
name: "Globex",
|
|
138
|
+
employees: { low: 1000, high: null },
|
|
139
|
+
hq: { city: "Springfield", region: "Oregon", postalCode: "97477", countryCode: "US" },
|
|
140
|
+
profile: null,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "c4",
|
|
144
|
+
name: "Lumen",
|
|
145
|
+
employees: { low: null, high: null },
|
|
146
|
+
hq: { city: "Palo Alto", region: "California", postalCode: "94301", countryCode: "US" },
|
|
147
|
+
profile: "https://x.com/lumen",
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
const PEOPLE: Person[] = [
|
|
152
|
+
{ id: "p1", name: { full: "Ana Pop", given: "Ana", family: "Pop" } },
|
|
153
|
+
{ id: "p2", name: { full: null, given: "Ștefan", family: "Ionescu" } },
|
|
154
|
+
{ id: "p3", name: { full: "Nagy Imre", given: "Imre", family: "Nagy" } },
|
|
155
|
+
{ id: "p4", name: { full: "Mira", given: null, family: null } },
|
|
156
|
+
{ id: "p5", name: null },
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
/** A reader over plain rows: the field from its registry, the value from the row's own key. */
|
|
160
|
+
function readerOf<Row extends { id: string }>(fields: Readonly<Record<string, FieldDef>>): ViewFieldReader<Row> {
|
|
161
|
+
return {
|
|
162
|
+
fieldOf: (key) => fields[key],
|
|
163
|
+
read: (row, key) => (row as Record<string, unknown>)[key],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const deals = readerOf<Deal>(DEAL_FIELDS);
|
|
168
|
+
const companies = readerOf<Company>(COMPANY_FIELDS);
|
|
169
|
+
const people = readerOf<Person>(PERSON_FIELDS);
|
|
170
|
+
|
|
171
|
+
const ids = (rows: readonly { id: string }[]) => rows.map((row) => row.id);
|
|
172
|
+
/** Wednesday 4 March 2026, 09:00 UTC: the "now" every date example is read at. */
|
|
173
|
+
const now = new Date("2026-03-04T09:00:00.000Z");
|
|
174
|
+
|
|
175
|
+
const treeOf = (...items: readonly FilterNode[]): FilterTree => ({ op: "and", items });
|
|
176
|
+
/** The ids of the rows one rule keeps, read at `now`. */
|
|
177
|
+
function kept<Row extends { id: string }>(rows: readonly Row[], reader: ViewFieldReader<Row>, rule: FilterNode): string[] {
|
|
178
|
+
return ids(rows.filter((row) => countMatching([row], treeOf(rule), reader, { now }) === 1));
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Rules, groups and the tree
|
|
183
|
+
|
|
184
|
+
A `FilterRule` is one field, one operator and one value. A `FilterGroup` combines its items with `and`, `or` or `not`, and groups nest. A `FilterTree` is the root: an `and` or an `or` over its rules and groups. `countMatching` says how many rows pass a tree.
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
const openOrBig: FilterTree = {
|
|
188
|
+
op: "and",
|
|
189
|
+
items: [
|
|
190
|
+
{ fieldKey: "stage", operator: "is_none_of", value: ["lost"] },
|
|
191
|
+
{
|
|
192
|
+
op: "or",
|
|
193
|
+
items: [
|
|
194
|
+
{ fieldKey: "currency", operator: "is_any_of", value: ["EUR"] },
|
|
195
|
+
{ fieldKey: "value", operator: "gte", value: 10000 },
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
// d1 is in euros, d4 is big, d6 is in euros; d3 is lost.
|
|
201
|
+
assert.equal(countMatching(DEALS, openOrBig, deals), 3);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`treeDepth` counts a tree's levels. A panel caps how deep a person can nest at `FILTER_TREE_MAX_UI_DEPTH`; the evaluator reads a tree of any depth.
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
import { FILTER_TREE_MAX_UI_DEPTH, treeDepth } from "viewkitjs/fields/query";
|
|
208
|
+
|
|
209
|
+
assert.equal(treeDepth(openOrBig), 2);
|
|
210
|
+
assert.equal(FILTER_TREE_MAX_UI_DEPTH, 3);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
A `not` group holds when its items do not all hold: it is `not (a and b)`. Over one rule, it is the rule turned round.
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
const notNew: FilterTree = {
|
|
217
|
+
op: "and",
|
|
218
|
+
items: [{ op: "not", items: [{ fieldKey: "stage", operator: "is_any_of", value: ["new"] }] }],
|
|
219
|
+
};
|
|
220
|
+
assert.equal(countMatching(DEALS, notNew, deals), 3);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
A rule still being typed has no opinion: a text operator with an empty box, a number rule whose value is `null`, a list rule with nothing picked. So does a rule on a field the reader does not know. A group drops such items before it combines the rest, so a half-typed rule inside a `not` never empties the list. `hasActiveRules` says whether a tree has any rule that narrows anything.
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
const stillTyping: FilterTree = {
|
|
227
|
+
op: "and",
|
|
228
|
+
items: [
|
|
229
|
+
{ op: "not", items: [{ fieldKey: "title", operator: "contains", value: "" }] },
|
|
230
|
+
{ fieldKey: "value", operator: "gt", value: null },
|
|
231
|
+
{ fieldKey: "budget", operator: "gt", value: 100 },
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
assert.equal(countMatching(DEALS, stillTyping, deals), DEALS.length);
|
|
235
|
+
assert.equal(hasActiveRules(stillTyping, deals.fieldOf), false);
|
|
236
|
+
assert.equal(hasActiveRules(openOrBig, deals.fieldOf), true);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
A `FilterRelationRule` reads across a relation: any, none or every of the far records where its own tree holds. The far records are not among the rows in memory, so unless the reader hands them in the evaluator has no opinion on it and every row stays. A database adapter answers it.
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
const atBigCompanies: FilterTree = {
|
|
243
|
+
op: "and",
|
|
244
|
+
items: [
|
|
245
|
+
{
|
|
246
|
+
fieldKey: "company",
|
|
247
|
+
quantifier: "any",
|
|
248
|
+
where: { op: "and", items: [{ fieldKey: "employees", operator: "at_least", value: 500 }] },
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
};
|
|
252
|
+
assert.equal(countMatching(DEALS, atBigCompanies, deals), DEALS.length);
|
|
253
|
+
assert.equal(hasActiveRules(atBigCompanies, deals.fieldOf), false);
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
A reader that holds the far records hands them in with `related(row, fieldKey)`: each far row read as a record of its own, `recordReaderFor(farRow, farReader)`. The evaluator then answers the rule as a database does, judging each far record by the rule's own tree. "Every" is true for a row with no far records, because none of them fails.
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
const companyById = new Map(COMPANIES.map((company) => [company.id, company]));
|
|
260
|
+
const dealsWithCompanies: ViewFieldReader<Deal> = {
|
|
261
|
+
...deals,
|
|
262
|
+
related: (deal, key) => {
|
|
263
|
+
if (key !== "company") return undefined;
|
|
264
|
+
const company = deal.company ? companyById.get(deal.company.id) : undefined;
|
|
265
|
+
return company ? [recordReaderFor(company, companies)] : [];
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
const atAcme = (quantifier: "any" | "none" | "every"): FilterTree =>
|
|
269
|
+
treeOf({ fieldKey: "company", quantifier, where: treeOf({ fieldKey: "name", operator: "is", value: "Acme" }) });
|
|
270
|
+
const keptBy = (filter: FilterTree) => ids(evaluateView(DEALS, { filter, sorts: [], group: null }, dealsWithCompanies).rows);
|
|
271
|
+
assert.deepEqual(keptBy(atAcme("any")), ["d1", "d6"]);
|
|
272
|
+
assert.deepEqual(keptBy(atAcme("none")), ["d2", "d3", "d4", "d5"]);
|
|
273
|
+
// d4 has no company, so no company of it fails.
|
|
274
|
+
assert.deepEqual(keptBy(atAcme("every")), ["d1", "d4", "d6"]);
|
|
275
|
+
assert.equal(hasActiveRules(atAcme("any"), deals.fieldOf, true), true);
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## The operators a field offers
|
|
279
|
+
|
|
280
|
+
`operatorsForField(field, part?)` lists the operators a field offers, the first being the one a panel opens on. A derived field offers its result's, and a currency result of one amount per code offers none. Text opens on `contains` and a date on `is_relative`, because those are what people reach for first. `FILTER_OPERATORS` holds each type's set; `operatorsFor(type, part?)` gives it in the order a panel offers, and `defaultOperator(type, part?)` is that order's first.
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
import {
|
|
284
|
+
defaultOperator,
|
|
285
|
+
FILTER_OPERATORS,
|
|
286
|
+
filterValueSchema,
|
|
287
|
+
operatorsForField,
|
|
288
|
+
ruleIsActive,
|
|
289
|
+
} from "viewkitjs/fields/query";
|
|
290
|
+
|
|
291
|
+
assert.deepEqual(operatorsForField(DEAL_FIELDS.title), [
|
|
292
|
+
"contains",
|
|
293
|
+
"is",
|
|
294
|
+
"is_not",
|
|
295
|
+
"not_contains",
|
|
296
|
+
"starts_with",
|
|
297
|
+
"ends_with",
|
|
298
|
+
"is_empty",
|
|
299
|
+
"is_not_empty",
|
|
300
|
+
]);
|
|
301
|
+
assert.deepEqual(operatorsForField(DEAL_FIELDS.stage), ["is_any_of", "is_none_of", "is_empty", "is_not_empty"]);
|
|
302
|
+
assert.deepEqual(operatorsForField(COMPANY_FIELDS.employees), [
|
|
303
|
+
"overlaps",
|
|
304
|
+
"within",
|
|
305
|
+
"includes",
|
|
306
|
+
"at_least",
|
|
307
|
+
"at_most",
|
|
308
|
+
"is_empty",
|
|
309
|
+
"is_not_empty",
|
|
310
|
+
]);
|
|
311
|
+
assert.equal(defaultOperator("date"), "is_relative");
|
|
312
|
+
assert.equal(defaultOperator("number"), "eq");
|
|
313
|
+
assert.equal(FILTER_OPERATORS.text[0], "is");
|
|
314
|
+
assert.equal(defaultOperator("text"), "contains");
|
|
315
|
+
assert.deepEqual(FILTER_OPERATORS.rich_text, ["contains", "not_contains", "is_empty", "is_not_empty"]);
|
|
316
|
+
|
|
317
|
+
// A total the host works out per currency: no single number to compare, so nothing to filter on.
|
|
318
|
+
const totals: FieldDef = {
|
|
319
|
+
key: "totals",
|
|
320
|
+
type: "formula",
|
|
321
|
+
label: "Totals",
|
|
322
|
+
from: "the deals' values",
|
|
323
|
+
result: { type: "currency", code: { perCode: true } },
|
|
324
|
+
};
|
|
325
|
+
assert.deepEqual(operatorsForField(totals), []);
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
`filterValueSchema(type, operator, part?)` is the Zod schema of the value a rule stores, for a route that saves a view. It accepts the value of a rule still being typed and refuses a wrong one: `null` is a number box left empty, `"100"` is no number. `ruleIsActive(type, rule)` is the same judgement the evaluator makes before it reads a rule.
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
assert.equal(filterValueSchema("currency", "gt").safeParse(null).success, true);
|
|
332
|
+
assert.equal(filterValueSchema("currency", "gt").safeParse("100").success, false);
|
|
333
|
+
assert.equal(filterValueSchema("currency", "between").safeParse([100, 500]).success, true);
|
|
334
|
+
assert.equal(filterValueSchema("date", "is_relative").safeParse({ direction: "past", unit: "week" }).success, true);
|
|
335
|
+
assert.equal(filterValueSchema("date", "is").safeParse("soon").success, false);
|
|
336
|
+
assert.equal(ruleIsActive("currency", { fieldKey: "value", operator: "gt", value: null }), false);
|
|
337
|
+
assert.equal(ruleIsActive("select", { fieldKey: "stage", operator: "is_empty", value: null }), true);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Checking a tree against its entity
|
|
341
|
+
|
|
342
|
+
The evaluator forgives: a rule it cannot read keeps the row. A saved view deserves a stricter look. `checkFilterTree(tree, entity, index, at)` holds every rule to an entity of the index, and throws a `FieldDefinitionError` naming `at` for a field the entity does not have, an operator its type does not offer, a part its type does not have, or a rule across something that is not a relation. A rule across a relation is held to the far entity.
|
|
343
|
+
|
|
344
|
+
```ts
|
|
345
|
+
const DEAL = entityDef(DEAL_FIELDS);
|
|
346
|
+
const INDEX = defineIndex([DEAL, entityDef(COMPANY_FIELDS), entityDef(PERSON_FIELDS)]);
|
|
347
|
+
|
|
348
|
+
checkFilterTree(openOrBig, DEAL, INDEX, "deals view");
|
|
349
|
+
checkFilterTree(atBigCompanies, DEAL, INDEX, "deals view");
|
|
350
|
+
|
|
351
|
+
assert.throws(
|
|
352
|
+
() => checkFilterTree(treeOf({ fieldKey: "budget", operator: "gt", value: 1 }), DEAL, INDEX, "deals view"),
|
|
353
|
+
FieldDefinitionError
|
|
354
|
+
);
|
|
355
|
+
assert.throws(
|
|
356
|
+
() => checkFilterTree(treeOf({ fieldKey: "stage", operator: "contains", value: "new" }), DEAL, INDEX, "deals view"),
|
|
357
|
+
/"contains" is not an operator for deal\.stage/
|
|
358
|
+
);
|
|
359
|
+
assert.throws(
|
|
360
|
+
() => checkFilterTree(treeOf({ fieldKey: "title", part: "given", operator: "is", value: "Acme" }), DEAL, INDEX, "deals view"),
|
|
361
|
+
/"given" is not a part of deal\.title/
|
|
362
|
+
);
|
|
363
|
+
assert.throws(
|
|
364
|
+
() =>
|
|
365
|
+
checkFilterTree(
|
|
366
|
+
treeOf({ fieldKey: "company", quantifier: "any", where: treeOf({ fieldKey: "stage", operator: "is_any_of", value: ["new"] }) }),
|
|
367
|
+
DEAL,
|
|
368
|
+
INDEX,
|
|
369
|
+
"deals view"
|
|
370
|
+
),
|
|
371
|
+
/the filter names "stage", which company does not have/
|
|
372
|
+
);
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## Text rules
|
|
376
|
+
|
|
377
|
+
A text rule compares its query, trimmed, with the value as the cell draws it, ignoring case and diacritics (see [Folding and collation](#folding-and-collation)). `is_empty` asks about the value as it stands: absent, or blank once trimmed. The text operators also serve `url`, `domain`, `email`, `phone` and `name`; `rich_text` offers only `contains`, `not_contains` and the empties.
|
|
378
|
+
|
|
379
|
+
```ts
|
|
380
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "title", operator: "contains", value: " ACME " }), ["d1"]);
|
|
381
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "title", operator: "starts_with", value: "stefan" }), ["d2"]);
|
|
382
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "title", operator: "ends_with", value: "audit" }), ["d4"]);
|
|
383
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "title", operator: "is", value: "lumen trial" }), ["d5"]);
|
|
384
|
+
assert.deepEqual(kept([{ ...DEALS[0], title: " " }], deals, { fieldKey: "title", operator: "is_empty", value: null }), ["d1"]);
|
|
385
|
+
assert.deepEqual(FILTER_OPERATORS.email, FILTER_OPERATORS.text);
|
|
386
|
+
assert.deepEqual(FILTER_OPERATORS.name, FILTER_OPERATORS.text);
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Number rules
|
|
390
|
+
|
|
391
|
+
A number rule compares the number the cell draws. Equality rounds both sides to the column's decimals, two unless the reader's `decimalsOf` says otherwise, so `= 100` finds an amount that reads `100.00` after a conversion. The decimals the grid rounds a field to are `ruleDecimalsOf(field)`'s; a reader of your own, or a server that translates rules, hands those. The comparisons need no rounding. `between` takes its two bounds in either order. Zero is a value: only an absent number is empty.
|
|
392
|
+
|
|
393
|
+
```ts
|
|
394
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "eq", value: 100 }), ["d5"]);
|
|
395
|
+
const threeDecimals: ViewFieldReader<Deal> = { ...deals, decimalsOf: (key) => (key === "value" ? 3 : undefined) };
|
|
396
|
+
assert.equal(countMatching(DEALS, treeOf({ fieldKey: "value", operator: "eq", value: 100 }), threeDecimals), 0);
|
|
397
|
+
|
|
398
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "between", value: [20000, 1000] }), ["d1", "d2"]);
|
|
399
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "lt", value: 1000 }), ["d3", "d5"]);
|
|
400
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "is_empty", value: null }), ["d6"]);
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
A rule over a currency column compares the number alone: `lt 1000` above keeps 900 EUR and the 99.996 whose code nobody states alike. A reader that converts its amounts into one currency makes the number comparable, and says so through `codeOf` (see [A currency column of mixed codes](#a-currency-column-of-mixed-codes)).
|
|
404
|
+
|
|
405
|
+
## Date rules
|
|
406
|
+
|
|
407
|
+
A date rule compares calendar days, never instants. `is_relative` stores its intent, a direction and a unit, and resolves it against `now` each time, so "past week" still means the past week tomorrow. `this` is the calendar period around today, the week running Monday to Sunday. `past` and `next` reach one unit back or forward from today, both ends included. The other operators take day keys, `YYYY-MM-DD`; `is_between` takes a pair in either order, and filters nothing until both days are picked: an end left empty, `""` or null, leaves the rule unfinished and every row stays. `is_not` keeps every row but that day's, the rows with no date included, as every "not" rule keeps an empty value.
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
// This week is Monday 2 to Sunday 8 March.
|
|
411
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_relative", value: { direction: "this", unit: "week" } }), ["d1", "d3", "d6"]);
|
|
412
|
+
// The past week is 25 February to 4 March.
|
|
413
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_relative", value: { direction: "past", unit: "week" } }), ["d3", "d6"]);
|
|
414
|
+
// The next month is 4 March to 4 April.
|
|
415
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_relative", value: { direction: "next", unit: "month" } }), ["d1"]);
|
|
416
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_before", value: "2026-03-01" }), ["d2"]);
|
|
417
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_between", value: ["2026-03-31", "2026-03-01"] }), ["d1", "d3", "d6"]);
|
|
418
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_empty", value: null }), ["d4"]);
|
|
419
|
+
// Every deal but the one closing on 3 March, the one with no close date (d4) included.
|
|
420
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "closeOn", operator: "is_not", value: "2026-03-03" }), ["d1", "d2", "d4", "d5", "d6"]);
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Which day an instant falls on, and which day is today, are the host's: the conventions' `timeZone`, UTC when it states none, never the machine's. `resolveRelativeWindow` shows the window a relative rule means. At 22:30 UTC on 1 March it is already 2 March in Bucharest.
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
import { resolveRelativeWindow } from "viewkitjs/fields/query";
|
|
427
|
+
|
|
428
|
+
const lateEvening = new Date("2026-03-01T22:30:00.000Z");
|
|
429
|
+
const bucharest = defineConventions({ timeZone: "Europe/Bucharest" });
|
|
430
|
+
assert.deepEqual(resolveRelativeWindow("this", "day", lateEvening), { from: "2026-03-01", to: "2026-03-01" });
|
|
431
|
+
assert.deepEqual(resolveRelativeWindow("this", "day", lateEvening, bucharest), { from: "2026-03-02", to: "2026-03-02" });
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
## Range rules
|
|
435
|
+
|
|
436
|
+
A range value is `{ low, high }`, both ends included and a `null` end open. `overlaps` (the default) keeps a range that shares any part with the bounds, `within` one that lies entirely inside them, `includes` one that holds a number, and `at_least` and `at_most` hold its low or its high end to a bound. A two-box operator carries its bounds as a pair, and a `null` bound is open: `[600, null]` is "600 and up". A range with neither end is empty.
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "overlaps", value: [40, 300] }), ["c1", "c2"]);
|
|
440
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "overlaps", value: [600, null] }), ["c3"]);
|
|
441
|
+
// Globex's open high end is not within 600.
|
|
442
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "within", value: [null, 600] }), ["c1", "c2"]);
|
|
443
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "includes", value: 1200 }), ["c3"]);
|
|
444
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "at_least", value: 100 }), ["c1", "c3"]);
|
|
445
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "employees", operator: "is_empty", value: null }), ["c4"]);
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## A rule's part
|
|
449
|
+
|
|
450
|
+
A name, a place, a link and a range are values with parts, and a rule may read one of them by `part` (a range's `low` or `high` end, read as a number). `FILTER_PARTS` lists each type's parts and `filterPartsFor(type)` reads it. A rule naming a part its type does not have cannot be read, so it has no opinion and the row stays; `checkFilterTree` refuses it.
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
import { FILTER_PARTS, filterPartsFor } from "viewkitjs/fields/query";
|
|
454
|
+
|
|
455
|
+
assert.deepEqual(filterPartsFor("name"), ["full", "given", "family"]);
|
|
456
|
+
assert.deepEqual(filterPartsFor("location"), ["countryCode", "region", "city", "postalCode"]);
|
|
457
|
+
assert.deepEqual(FILTER_PARTS.url, ["platform"]);
|
|
458
|
+
assert.deepEqual(FILTER_PARTS.text, []);
|
|
459
|
+
assert.equal(countMatching(DEALS, treeOf({ fieldKey: "title", part: "given", operator: "is", value: "Acme" }), deals), DEALS.length);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Name rules
|
|
463
|
+
|
|
464
|
+
A name takes the text operators. On a part, the rule reads that part. With no part, it reads every part and the name as it is written, so `is "stefan ionescu"` finds a name that stores only its given and family parts. Across the parts, a rule that looks for something holds when some part has it, and `is_not` and `not_contains` hold when no part has it. The empties ask about the whole name.
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", operator: "contains", value: "stefan" }), ["p2"]);
|
|
468
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", operator: "is", value: "stefan ionescu" }), ["p2"]);
|
|
469
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", part: "family", operator: "is", value: "nagy" }), ["p3"]);
|
|
470
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", part: "given", operator: "starts_with", value: "a" }), ["p1"]);
|
|
471
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", operator: "not_contains", value: "pop" }), ["p2", "p3", "p4", "p5"]);
|
|
472
|
+
assert.deepEqual(kept(PEOPLE, people, { fieldKey: "name", operator: "is_empty", value: null }), ["p5"]);
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Location rules
|
|
476
|
+
|
|
477
|
+
A place offers nothing as a whole: a rule reads it only through a part. Its country takes the options' operators over country codes; its region, city and postal code take text's, the city opening on `contains` and the postal code on `starts_with`. A place with no country is none of the picked codes.
|
|
478
|
+
|
|
479
|
+
```ts
|
|
480
|
+
assert.deepEqual(operatorsForField(COMPANY_FIELDS.hq), []);
|
|
481
|
+
assert.deepEqual(operatorsForField(COMPANY_FIELDS.hq, "countryCode"), ["is_any_of", "is_none_of", "is_empty", "is_not_empty"]);
|
|
482
|
+
assert.equal(operatorsForField(COMPANY_FIELDS.hq, "city")[0], "contains");
|
|
483
|
+
assert.equal(operatorsForField(COMPANY_FIELDS.hq, "postalCode")[0], "starts_with");
|
|
484
|
+
|
|
485
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "hq", part: "countryCode", operator: "is_any_of", value: ["RO"] }), ["c1", "c2"]);
|
|
486
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "hq", part: "countryCode", operator: "is_none_of", value: ["RO"] }), ["c3", "c4"]);
|
|
487
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "hq", part: "city", operator: "contains", value: "cluj" }), ["c2"]);
|
|
488
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "hq", part: "postalCode", operator: "starts_with", value: "94" }), ["c4"]);
|
|
489
|
+
// No part: no opinion.
|
|
490
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "hq", operator: "contains", value: "cluj" }), ["c1", "c2", "c3", "c4"]);
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### Link rules
|
|
494
|
+
|
|
495
|
+
A `url` field's one part is `platform`: the key of the platform its address belongs to, read with the library's platforms and any the conventions add. An address no platform claims is `"website"`. A text rule on the part reads those keys, and its empties ask whether the value holds any link at all.
|
|
496
|
+
|
|
497
|
+
```ts
|
|
498
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "profile", part: "platform", operator: "is", value: "linkedin" }), ["c1"]);
|
|
499
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "profile", part: "platform", operator: "is", value: "x" }), ["c4"]);
|
|
500
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "profile", part: "platform", operator: "is", value: "website" }), ["c2"]);
|
|
501
|
+
assert.deepEqual(kept(COMPANIES, companies, { fieldKey: "profile", part: "platform", operator: "is_empty", value: null }), ["c3"]);
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
## Sorts
|
|
505
|
+
|
|
506
|
+
A `SortSpec` names a field and a direction. In a list of them the first decides and a tie falls to the next; a spec naming a field the reader does not know is skipped. Empty values sort last in both directions, because the direction flips values, not absence. Two rows that compare equal keep the order they arrived in. `compareBy(sorts, reader, conventions?)` is the comparator `evaluateView` sorts with, for a host that sorts without evaluating a whole view.
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
import { compareBy, type SortSpec } from "viewkitjs/fields/query";
|
|
510
|
+
|
|
511
|
+
const sortedBy = <Row extends { id: string }>(rows: readonly Row[], sorts: readonly SortSpec[], reader: ViewFieldReader<Row>) =>
|
|
512
|
+
ids([...rows].sort(compareBy(sorts, reader)));
|
|
513
|
+
|
|
514
|
+
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "closeOn", direction: "desc" }], deals), ["d5", "d1", "d3", "d6", "d2", "d4"]);
|
|
515
|
+
// A status sorts in its own order, new before won before lost; the close date breaks the tie.
|
|
516
|
+
assert.deepEqual(
|
|
517
|
+
sortedBy(DEALS, [{ fieldKey: "budget", direction: "asc" }, { fieldKey: "stage", direction: "asc" }, { fieldKey: "closeOn", direction: "asc" }], deals),
|
|
518
|
+
["d1", "d5", "d4", "d2", "d6", "d3"]
|
|
519
|
+
);
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
A name, a place and a range sort more than one way, chosen by the spec's `by`. `SORT_ORDERS` lists each type's orders, the default first, and `sortOrdersFor(type)` reads it. A name sorts by its full name as written (`full`), by family name then given (`family`), or by given name then family (`given`); a name without the part asked for comes after the rest, in either direction, as an empty one does. A place sorts by its city (the default), its region, its country's name or its postal code. A range sorts by its low end (the default) or by its high end (`high`). A relation or a user sorts by its records' names: each value's names are put in A-to-Z order, then two values compare name by name, the one whose names run out first coming first, so "Ops" comes before "Ops, Sales", which comes before "Sales". Descending reverses the values, never the names inside one.
|
|
523
|
+
|
|
524
|
+
```ts
|
|
525
|
+
import { SORT_ORDERS, sortOrdersFor } from "viewkitjs/fields/query";
|
|
526
|
+
|
|
527
|
+
assert.deepEqual(SORT_ORDERS.name, ["full", "family", "given"]);
|
|
528
|
+
assert.deepEqual(sortOrdersFor("location"), ["city", "region", "countryCode", "postalCode"]);
|
|
529
|
+
assert.deepEqual(sortOrdersFor("range"), ["low", "high"]);
|
|
530
|
+
|
|
531
|
+
assert.deepEqual(sortedBy(PEOPLE, [{ fieldKey: "name", direction: "asc" }], people), ["p1", "p4", "p3", "p2", "p5"]);
|
|
532
|
+
// Mira has no family name: she trails whichever way, and the empty name comes last.
|
|
533
|
+
assert.deepEqual(sortedBy(PEOPLE, [{ fieldKey: "name", direction: "asc", by: "family" }], people), ["p2", "p3", "p1", "p4", "p5"]);
|
|
534
|
+
assert.deepEqual(sortedBy(PEOPLE, [{ fieldKey: "name", direction: "desc", by: "family" }], people), ["p1", "p3", "p2", "p4", "p5"]);
|
|
535
|
+
assert.deepEqual(sortedBy(COMPANIES, [{ fieldKey: "hq", direction: "asc" }], companies), ["c1", "c2", "c4", "c3"]);
|
|
536
|
+
assert.deepEqual(sortedBy(COMPANIES, [{ fieldKey: "hq", direction: "desc", by: "region" }], companies), ["c3", "c2", "c4", "c1"]);
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
## A currency column of mixed codes
|
|
540
|
+
|
|
541
|
+
1000 RON is not more than 900 EUR, so a currency column whose rows carry different codes sorts clustered by code, and by amount inside each code. The deals' `value` names its code in the sibling select `currency`, whose option order says which code leads: EUR, then RON. A row whose code nothing states is a cluster of its own after every known code, and empty amounts still come last. A descending sort asks for bigger amounts, not for the currencies backwards, so the clusters keep their order.
|
|
542
|
+
|
|
543
|
+
```ts
|
|
544
|
+
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "asc" }], deals), ["d3", "d1", "d2", "d4", "d5", "d6"]);
|
|
545
|
+
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "desc" }], deals), ["d1", "d3", "d4", "d2", "d5", "d6"]);
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
The library converts nothing. A reader that converts inside `read` knows the one currency its numbers came out in, and says so with `codeOf`; the column then sorts as the plain numbers it draws.
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
const TO_EUR: Record<string, number> = { EUR: 1, RON: 0.2 };
|
|
552
|
+
const inEuros: ViewFieldReader<Deal> = {
|
|
553
|
+
...deals,
|
|
554
|
+
read: (row, key) =>
|
|
555
|
+
key === "value" && row.value !== null ? row.value * (TO_EUR[row.currency ?? ""] ?? 1) : deals.read(row, key),
|
|
556
|
+
codeOf: (_row, key) => (key === "value" ? "EUR" : undefined),
|
|
557
|
+
};
|
|
558
|
+
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "asc" }], inEuros), ["d5", "d3", "d2", "d4", "d1", "d6"]);
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## Groups and buckets
|
|
562
|
+
|
|
563
|
+
A `GroupSpec` splits a list into sections by one field. `canGroupBy(type, by?)` says whether a type can: a select, a status, a relation, a user, an actor, a yes or no, a date and a range group as a whole, a multiselect under every value it holds, so a row tagged twice sits in both buckets, and a many relation by its first link; text, numbers and names do not. A place groups only by one part, named by `by`, which `groupOrdersFor(type)` lists. `bucketRows(rows, spec, field, read, options?)` makes the buckets, each with its key, its label, its rows and whether it is hidden.
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
import {
|
|
567
|
+
bucketRows,
|
|
568
|
+
canGroupBy,
|
|
569
|
+
groupOrdersFor,
|
|
570
|
+
UNCATEGORIZED_KEY,
|
|
571
|
+
UNGROUPED_KEY,
|
|
572
|
+
type GroupSpec,
|
|
573
|
+
type ViewBucket,
|
|
574
|
+
} from "viewkitjs/fields/query";
|
|
575
|
+
|
|
576
|
+
assert.equal(canGroupBy("status"), true);
|
|
577
|
+
assert.equal(canGroupBy("text"), false);
|
|
578
|
+
assert.equal(canGroupBy("name"), false);
|
|
579
|
+
assert.equal(canGroupBy("location"), false);
|
|
580
|
+
assert.equal(canGroupBy("location", "city"), true);
|
|
581
|
+
assert.deepEqual(groupOrdersFor("location"), ["city", "region", "countryCode"]);
|
|
582
|
+
|
|
583
|
+
const byStage: GroupSpec = { fieldKey: "stage", order: { mode: "lifecycle", dir: "asc" }, buckets: [] };
|
|
584
|
+
const shape = <Row extends { id: string }>(buckets: readonly ViewBucket<Row>[]) =>
|
|
585
|
+
buckets.map((b) => [b.key, b.label, ids(b.items), b.hidden]);
|
|
586
|
+
const stageOf = (deal: Deal) => deal.stage;
|
|
587
|
+
|
|
588
|
+
assert.deepEqual(shape(bucketRows(DEALS, byStage, DEAL_FIELDS.stage, stageOf)), [
|
|
589
|
+
["new", "New", ["d1", "d4", "d5"], false],
|
|
590
|
+
["won", "Won", ["d2", "d6"], false],
|
|
591
|
+
["lost", "Lost", ["d3"], false],
|
|
592
|
+
["paused", "Paused", [], false],
|
|
593
|
+
]);
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
A closed select, a status, a closed multiselect, a yes or no and a range with presets start with a bucket for every value the field declares, so an empty stage still has a section. `hideEmpty` flags a bucket no row holds as hidden. It is flagged, never dropped, so a host can list it where its reader can show it again. A spec's own `buckets` place a value at a position and say whether it shows.
|
|
597
|
+
|
|
598
|
+
```ts
|
|
599
|
+
const tidy = bucketRows(DEALS, { ...byStage, hideEmpty: true }, DEAL_FIELDS.stage, stageOf);
|
|
600
|
+
assert.deepEqual(tidy.map((b) => [b.key, b.hidden]), [["new", false], ["won", false], ["lost", false], ["paused", true]]);
|
|
601
|
+
|
|
602
|
+
const lostFirstHidden = bucketRows(
|
|
603
|
+
DEALS,
|
|
604
|
+
{ ...byStage, buckets: [{ value: "lost", visible: false, position: 0 }] },
|
|
605
|
+
DEAL_FIELDS.stage,
|
|
606
|
+
stageOf
|
|
607
|
+
);
|
|
608
|
+
assert.deepEqual(lostFirstHidden.map((b) => [b.key, b.hidden]), [["lost", true], ["new", false], ["won", false], ["paused", false]]);
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
The order's `mode` decides how the buckets without a position come: `lifecycle` in the field's own order, `name` by label in the conventions' alphabet, `count` by how many rows each holds (a tie by name, or by date in a date group), and `manual` by the spec's positions alone, the unplaced trailing by name (by date in a date group) with no direction applied. `dir` turns `lifecycle`, `name` and `count` round.
|
|
612
|
+
|
|
613
|
+
```ts
|
|
614
|
+
const keysOf = (spec: GroupSpec) => bucketRows(DEALS, spec, DEAL_FIELDS.stage, stageOf).map((b) => b.key);
|
|
615
|
+
|
|
616
|
+
assert.deepEqual(keysOf({ ...byStage, order: { mode: "name", dir: "asc" } }), ["lost", "new", "paused", "won"]);
|
|
617
|
+
assert.deepEqual(keysOf({ ...byStage, order: { mode: "count", dir: "desc" } }), ["new", "won", "lost", "paused"]);
|
|
618
|
+
assert.deepEqual(keysOf({ ...byStage, order: { mode: "lifecycle", dir: "desc" } }), ["paused", "lost", "won", "new"]);
|
|
619
|
+
assert.deepEqual(
|
|
620
|
+
keysOf({ ...byStage, order: { mode: "manual", dir: "desc" }, buckets: [{ value: "won", visible: true, position: 0 }] }),
|
|
621
|
+
["won", "lost", "new", "paused"]
|
|
622
|
+
);
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
The empty bucket's key is `UNCATEGORIZED_KEY`, `""`, and it always comes last. A relation groups by the far record's `id` and heads its bucket with the `label` the value carries. A type that cannot group gives back one bucket, keyed `UNGROUPED_KEY`, holding every row.
|
|
626
|
+
|
|
627
|
+
```ts
|
|
628
|
+
const byCompany: GroupSpec = { fieldKey: "company", order: { mode: "name", dir: "desc" }, buckets: [] };
|
|
629
|
+
assert.deepEqual(shape(bucketRows(DEALS, byCompany, DEAL_FIELDS.company, (deal) => deal.company)), [
|
|
630
|
+
["c2", "Ștefan & Co", ["d2"], false],
|
|
631
|
+
["c4", "Lumen", ["d5"], false],
|
|
632
|
+
["c3", "Globex", ["d3"], false],
|
|
633
|
+
["c1", "Acme", ["d1", "d6"], false],
|
|
634
|
+
[UNCATEGORIZED_KEY, "None", ["d4"], false],
|
|
635
|
+
]);
|
|
636
|
+
|
|
637
|
+
const byTitle = bucketRows(DEALS, { fieldKey: "title", order: { mode: "name", dir: "asc" }, buckets: [] }, DEAL_FIELDS.title, (deal) => deal.title);
|
|
638
|
+
assert.deepEqual(shape(byTitle), [[UNGROUPED_KEY, "", ids(DEALS), false]]);
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
A place groups by the part `by` names, its country headed by the country's name. A range groups by the preset its low end falls in.
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
const byCountry: GroupSpec = { fieldKey: "hq", by: "countryCode", order: { mode: "name", dir: "asc" }, buckets: [] };
|
|
645
|
+
assert.deepEqual(shape(bucketRows(COMPANIES, byCountry, COMPANY_FIELDS.hq, (company) => company.hq)), [
|
|
646
|
+
["RO", "Romania", ["c1", "c2"], false],
|
|
647
|
+
["US", "United States", ["c3", "c4"], false],
|
|
648
|
+
]);
|
|
649
|
+
|
|
650
|
+
const bySize: GroupSpec = { fieldKey: "employees", order: { mode: "lifecycle", dir: "asc" }, buckets: [] };
|
|
651
|
+
assert.deepEqual(shape(bucketRows(COMPANIES, bySize, COMPANY_FIELDS.employees, (company) => company.employees)), [
|
|
652
|
+
["small", "1–50", ["c2"], false],
|
|
653
|
+
["mid", "51–500", ["c1"], false],
|
|
654
|
+
["large", "501+", ["c3"], false],
|
|
655
|
+
[UNCATEGORIZED_KEY, "None", ["c4"], false],
|
|
656
|
+
]);
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### Dates by granularity
|
|
660
|
+
|
|
661
|
+
A date groups by its `granularity`: `day`, `week` (keyed by its Monday), `month` (the default) or `year`, in the calendar; or `relative` and `due`, rolling windows around today. `relative` looks back: Today, Yesterday, the last 7 days, the last 30, then a month for a year back, then a year, and any day after today is Upcoming. `due` looks ahead, for a date people wait for: Overdue, Today, Tomorrow, the next 7 days, the next 30, then months, then years. A date bucket is ordered by the first day it holds. Labels are written in the conventions' locale, and today is the host's.
|
|
662
|
+
|
|
663
|
+
```ts
|
|
664
|
+
const byClose = (granularity: GroupSpec["granularity"]): GroupSpec => ({
|
|
665
|
+
fieldKey: "closeOn",
|
|
666
|
+
granularity,
|
|
667
|
+
order: { mode: "name", dir: "asc" },
|
|
668
|
+
buckets: [],
|
|
669
|
+
});
|
|
670
|
+
const closeOf = (deal: Deal) => deal.closeOn;
|
|
671
|
+
|
|
672
|
+
assert.deepEqual(shape(bucketRows(DEALS, byClose("month"), DEAL_FIELDS.closeOn, closeOf)), [
|
|
673
|
+
["2026-02", "February 2026", ["d2"], false],
|
|
674
|
+
["2026-03", "March 2026", ["d1", "d3", "d6"], false],
|
|
675
|
+
["2026-04", "April 2026", ["d5"], false],
|
|
676
|
+
[UNCATEGORIZED_KEY, "No date", ["d4"], false],
|
|
677
|
+
]);
|
|
678
|
+
assert.deepEqual(
|
|
679
|
+
bucketRows(DEALS, byClose("week"), DEAL_FIELDS.closeOn, closeOf).map((b) => [b.key, b.label]),
|
|
680
|
+
[["2026-02-16", "Week of 16 Feb 2026"], ["2026-03-02", "Week of 2 Mar 2026"], ["2026-04-13", "Week of 13 Apr 2026"], ["", "No date"]]
|
|
681
|
+
);
|
|
682
|
+
assert.deepEqual(shape(bucketRows(DEALS, byClose("due"), DEAL_FIELDS.closeOn, closeOf, { now })), [
|
|
683
|
+
["due:overdue", "Overdue", ["d2", "d3", "d6"], false],
|
|
684
|
+
["due:next_7_days", "Next 7 days", ["d1"], false],
|
|
685
|
+
["due:m:2026-04", "April 2026", ["d5"], false],
|
|
686
|
+
[UNCATEGORIZED_KEY, "No date", ["d4"], false],
|
|
687
|
+
]);
|
|
688
|
+
assert.deepEqual(
|
|
689
|
+
bucketRows(DEALS, byClose("relative"), DEAL_FIELDS.closeOn, closeOf, { now }).map((b) => [b.label, ids(b.items)]),
|
|
690
|
+
[["Last 30 days", ["d2"]], ["Last 7 days", ["d6"]], ["Yesterday", ["d3"]], ["Upcoming", ["d1", "d5"]], ["No date", ["d4"]]]
|
|
691
|
+
);
|
|
692
|
+
const inRomanian = bucketRows(DEALS, byClose("month"), DEAL_FIELDS.closeOn, closeOf, { conventions: defineConventions({ locale: "ro" }) });
|
|
693
|
+
assert.equal(inRomanian[1].label, "martie 2026");
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
`dateBucketKey(day, granularity, now?, conventions?)` gives the key a calendar day lands in, so per-day totals from a server fold onto the same buckets. `dateBucketRange(key, granularity, now?, conventions?)` gives the days a bucket holds, from its first day up to but not including `to`.
|
|
697
|
+
|
|
698
|
+
```ts
|
|
699
|
+
import { dateBucketKey, dateBucketRange } from "viewkitjs/fields/query";
|
|
700
|
+
|
|
701
|
+
assert.equal(dateBucketKey("2026-03-06", "week"), "2026-03-02");
|
|
702
|
+
assert.equal(dateBucketKey("2026-03-06", "due", now), "due:next_7_days");
|
|
703
|
+
assert.deepEqual(dateBucketRange("2026-03-02", "week"), { from: "2026-03-02", to: "2026-03-09" });
|
|
704
|
+
assert.deepEqual(dateBucketRange("due:next_7_days", "due", now), { from: "2026-03-06", to: "2026-03-12" });
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
## The board
|
|
708
|
+
|
|
709
|
+
A board lays records out by one field: a column per value, and a card moved between columns changes that value. A record must hold one value of it, so a board can be laid out by a status, a select, a yes or no, a single relation or a user. A date, a multiselect and a many relation cannot. `canBoardBy(field)` asks of a field, a derived one by its result, and `canBoardByType(type)` of a type alone. `defaultBoardField(fields, preferred?)` picks the field a board opens on: `preferred` when it can lay a board out, else the first status, then select, yes or no, relation and user.
|
|
710
|
+
|
|
711
|
+
```ts
|
|
712
|
+
import { boardAxis, canBoardBy, canBoardByType, defaultBoardField, type BoardLaneSpec } from "viewkitjs/fields/query";
|
|
713
|
+
|
|
714
|
+
assert.equal(canBoardBy(DEAL_FIELDS.stage), true);
|
|
715
|
+
assert.equal(canBoardBy(DEAL_FIELDS.closeOn), false);
|
|
716
|
+
assert.equal(canBoardByType("multiselect"), false);
|
|
717
|
+
assert.equal(defaultBoardField(Object.values(DEAL_FIELDS))?.key, "stage");
|
|
718
|
+
assert.equal(defaultBoardField(Object.values(DEAL_FIELDS), "company")?.key, "company");
|
|
719
|
+
assert.equal(defaultBoardField(Object.values(DEAL_FIELDS), "title")?.key, "stage");
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
`boardAxis(field, lanes)` is the spec `bucketRows` builds the columns from. An option field opens in its own order, as does a relation that names a `sortBy`; any other by name. The reader's hidden and placed columns are kept per field, so hiding Lost on a board by stage survives a visit to the board by company.
|
|
723
|
+
|
|
724
|
+
```ts
|
|
725
|
+
const lanes: BoardLaneSpec[] = [
|
|
726
|
+
{ fieldKey: "stage", value: "lost", visible: false, position: 3 },
|
|
727
|
+
{ fieldKey: "company", value: "c1", visible: false, position: 0 },
|
|
728
|
+
];
|
|
729
|
+
const stageAxis = boardAxis(DEAL_FIELDS.stage, lanes);
|
|
730
|
+
assert.deepEqual(stageAxis.order, { mode: "lifecycle", dir: "asc" });
|
|
731
|
+
assert.deepEqual(stageAxis.buckets, [{ value: "lost", visible: false, position: 3 }]);
|
|
732
|
+
|
|
733
|
+
const columns = bucketRows(DEALS, stageAxis, DEAL_FIELDS.stage, stageOf);
|
|
734
|
+
assert.deepEqual(columns.map((c) => [c.key, c.items.length, c.hidden]), [
|
|
735
|
+
["lost", 1, true],
|
|
736
|
+
["new", 3, false],
|
|
737
|
+
["won", 2, false],
|
|
738
|
+
["paused", 0, false],
|
|
739
|
+
]);
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
## `evaluateView` and its reader
|
|
743
|
+
|
|
744
|
+
`evaluateView(rows, query, reader, options?)` runs a whole `ViewQuery`: it filters, sorts, and then groups the sorted rows, so each bucket's rows keep the sort. It returns the rows and the buckets, `null` when the query has no group or groups by a field the reader does not know. Pass `now` and `conventions` so today and every day are the host's.
|
|
745
|
+
|
|
746
|
+
The reader is the one `compareBy` takes. `fieldOf(key)` gives a field's definition and `read(row, key)` its value as drawn. `decimalsOf(key)` gives a number column's decimals for equality, and `codeOf(row, key)` the currency a converted amount is in. A rollup with a breakdown is filtered, sorted and grouped by its headline.
|
|
747
|
+
|
|
748
|
+
```ts
|
|
749
|
+
import type { ViewQuery } from "viewkitjs/fields/query";
|
|
750
|
+
|
|
751
|
+
const openDeals: ViewQuery = {
|
|
752
|
+
filter: treeOf({ fieldKey: "stage", operator: "is_none_of", value: ["lost"] }),
|
|
753
|
+
sorts: [{ fieldKey: "closeOn", direction: "asc" }],
|
|
754
|
+
group: { fieldKey: "company", order: { mode: "name", dir: "asc" }, buckets: [] },
|
|
755
|
+
};
|
|
756
|
+
const view = evaluateView(DEALS, openDeals, deals, { now });
|
|
757
|
+
assert.deepEqual(ids(view.rows), ["d2", "d6", "d1", "d5", "d4"]);
|
|
758
|
+
assert.deepEqual(view.buckets?.map((b) => [b.label, ids(b.items)]), [
|
|
759
|
+
["Acme", ["d6", "d1"]],
|
|
760
|
+
["Lumen", ["d5"]],
|
|
761
|
+
["Ștefan & Co", ["d2"]],
|
|
762
|
+
["None", ["d4"]],
|
|
763
|
+
]);
|
|
764
|
+
|
|
765
|
+
assert.equal(evaluateView(DEALS, { ...openDeals, group: null }, deals).buckets, null);
|
|
766
|
+
assert.equal(evaluateView(DEALS, { ...openDeals, group: { ...byStage, fieldKey: "budget" } }, deals).buckets, null);
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
## Manual order
|
|
770
|
+
|
|
771
|
+
A list can keep the order its reader dragged rows into. `applyManualOrder(rows, positions, rowId)` puts the rows that have a position first, by position, and keeps every other row in the order it came. A view asks for it with `rowOrderMode: "manual"` and `itemPositions`, and `evaluateView` needs `rowId` among its options to apply it. Under manual order the view's sorts are not applied, so a manual view without `rowId` keeps the rows in the order the filter left them.
|
|
772
|
+
|
|
773
|
+
```ts
|
|
774
|
+
import { applyManualOrder } from "viewkitjs/fields/query";
|
|
775
|
+
|
|
776
|
+
const dragged = [
|
|
777
|
+
{ recordId: "d5", position: 2 },
|
|
778
|
+
{ recordId: "d3", position: 1 },
|
|
779
|
+
];
|
|
780
|
+
assert.deepEqual(ids(applyManualOrder(DEALS, dragged, (deal) => deal.id)), ["d3", "d5", "d1", "d2", "d4", "d6"]);
|
|
781
|
+
|
|
782
|
+
const manual = evaluateView(
|
|
783
|
+
DEALS,
|
|
784
|
+
{ ...openDeals, group: null, rowOrderMode: "manual", itemPositions: dragged },
|
|
785
|
+
deals,
|
|
786
|
+
{ rowId: (deal) => deal.id }
|
|
787
|
+
);
|
|
788
|
+
// d3 is lost and filtered out; d5 leads; the rest keep their order, unsorted.
|
|
789
|
+
assert.deepEqual(ids(manual.rows), ["d5", "d1", "d2", "d4", "d6"]);
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
## Search, option counts and figures
|
|
793
|
+
|
|
794
|
+
These are the answers a database is held to: the test kit compares a translator's search, counts and figures with them over the same rows.
|
|
795
|
+
|
|
796
|
+
A `ViewQuery` may carry a `search`: the text a person typed and the fields it reads. Each word of the text must appear in some field it names, case and accents ignored, so words from two fields find a row that holds them both. A word loses what is not a letter or a digit at its ends, and a token with none is no word: "Acme - London" searches as "Acme London", "Pop, Ana" as "Pop Ana". A text-like field is searched by its own `contains` rule, a place by its text, an option by its label, a link or an actor by its name; numbers, dates, yes or no and ranges never are. When the host names each row's id (`rowId`), the whole text pasted as an id finds that row too. `matchesSearch(row, search, reader, options?)` asks it of one row.
|
|
797
|
+
|
|
798
|
+
`countOptions(rows, { filter, search }, fieldKey, reader, options?)` gives the number beside each option of a filter field: the rows the list keeps with that field's own rules left out, so the picker counts its alternatives as if none were picked while every other rule still narrows. A row counts once under every option it holds, and under the empty key `""` when it holds none. `withoutOwnRules(filter, fieldKey)` is the tree it counts under: a rule on the field under `or` or `not` is an alternative, not a restriction, and stays.
|
|
799
|
+
|
|
800
|
+
`evaluateView` answers the figures of the keys named in `options.figures`, for the kept rows and for each bucket, in the shape a database answers: the rows, and each key's sum, count, smallest and largest of its numbers, and `filled`, its values present by Filled's rules, for a key of any type. `figureFor(kind, figures, key)` reads a figure from it, Filled from `filled`. `figureOfValues(kind, values, reading)` is one column's figure the way a grid shows it, filled and unique included.
|
|
801
|
+
|
|
802
|
+
```ts
|
|
803
|
+
import { countOptions, figureFor, matchesSearch, withoutOwnRules } from "viewkitjs/fields/query";
|
|
804
|
+
|
|
805
|
+
const pilot = { text: "stefan pilot", fields: ["title", "company"] };
|
|
806
|
+
assert.deepEqual(ids(DEALS.filter((deal) => matchesSearch(deal, pilot, deals))), ["d2"]);
|
|
807
|
+
const pasted = { text: "D4", fields: ["title"] };
|
|
808
|
+
assert.deepEqual(ids(DEALS.filter((deal) => matchesSearch(deal, pasted, deals, { rowId: (deal) => deal.id }))), ["d4"]);
|
|
809
|
+
assert.deepEqual(
|
|
810
|
+
ids(evaluateView(DEALS, { ...openDeals, group: null, sorts: [], search: { text: "acme", fields: ["company"] } }, deals).rows),
|
|
811
|
+
["d1", "d6"]
|
|
812
|
+
);
|
|
813
|
+
|
|
814
|
+
const wonInEuros = treeOf(
|
|
815
|
+
{ fieldKey: "stage", operator: "is_any_of", value: ["won"] },
|
|
816
|
+
{ fieldKey: "currency", operator: "is_any_of", value: ["EUR"] }
|
|
817
|
+
);
|
|
818
|
+
assert.deepEqual(withoutOwnRules(wonInEuros, "stage").items.length, 1);
|
|
819
|
+
assert.deepEqual(countOptions(DEALS, { filter: wonInEuros }, "stage", deals), { new: 1, won: 1, lost: 1, paused: 0, "": 0 });
|
|
820
|
+
|
|
821
|
+
const euroDeals = evaluateView(
|
|
822
|
+
DEALS,
|
|
823
|
+
{ filter: treeOf({ fieldKey: "currency", operator: "is_any_of", value: ["EUR"] }), sorts: [], group: null },
|
|
824
|
+
deals,
|
|
825
|
+
{ figures: ["value"] }
|
|
826
|
+
);
|
|
827
|
+
assert.deepEqual(euroDeals.figures, { rows: 3, fields: { value: { sum: 12900, count: 2, min: 900, max: 12000, filled: 2 } } });
|
|
828
|
+
assert.equal(figureFor("avg", euroDeals.figures!, "value"), 6450);
|
|
829
|
+
const euroTitles = evaluateView(DEALS, { filter: treeOf({ fieldKey: "currency", operator: "is_any_of", value: ["EUR"] }), sorts: [], group: null }, deals, { figures: ["title"] });
|
|
830
|
+
assert.equal(figureFor("filled", euroTitles.figures!, "title"), 3);
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
## The query kit
|
|
834
|
+
|
|
835
|
+
`createQueryKit(conventions)` binds a host's conventions once. Each method is the bare function of the same name with the conventions filled in: `evaluateView`, `countMatching`, `countOptions`, `countHoldValues`, `matchesSearch`, `bucketRows`, `compareBy`, the rule labels `textRuleLabel`, `numberRuleLabel` and `dateRuleLabel`, and `parseNumber`. `kit.with(overrides)` is a new kit over `conventions.with(overrides)`, for the part that changes per request. It lives in the query entry, apart from the root's `createFieldKit`, so a bundle that only validates never loads the evaluator.
|
|
836
|
+
|
|
837
|
+
```ts
|
|
838
|
+
import { createQueryKit } from "viewkitjs/fields/query";
|
|
839
|
+
|
|
840
|
+
const kit = createQueryKit(defineConventions({ timeZone: "Europe/Bucharest", decimal: "," }));
|
|
841
|
+
assert.equal(kit.conventions.timeZone, "Europe/Bucharest");
|
|
842
|
+
assert.equal(kit.parseNumber("1.234,5"), 1234.5);
|
|
843
|
+
assert.equal(kit.textRuleLabel({ operator: "contains", query: "acme" }), 'contains "acme"');
|
|
844
|
+
assert.equal(kit.numberRuleLabel({ operator: "between", value: 100, value2: 500 }), "100 – 500");
|
|
845
|
+
assert.equal(kit.countMatching(DEALS, openOrBig, deals), 3);
|
|
846
|
+
|
|
847
|
+
const romanian = kit.with({ locale: "ro" });
|
|
848
|
+
assert.equal(romanian.conventions.timeZone, "Europe/Bucharest");
|
|
849
|
+
assert.equal(romanian.conventions.locale, "ro");
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
## A list's settings
|
|
853
|
+
|
|
854
|
+
A list's settings are one value, `ListSettings`: what a link carries, what a saved view keeps and what an agent sets. `listSettingsSchema` checks it the same way everywhere and refuses what no list can hold, each with its reason. A saved view never keeps the search: `settingsForSaving` gives what it keeps.
|
|
855
|
+
|
|
856
|
+
```ts
|
|
857
|
+
import { listSettingsSchema, settingsForSaving, type ListSettings } from "viewkitjs/fields/query";
|
|
858
|
+
|
|
859
|
+
const dealsTable: ListSettings = {
|
|
860
|
+
search: "acme",
|
|
861
|
+
layout: "table",
|
|
862
|
+
filter: { op: "and", items: [{ fieldKey: "stage", operator: "is_none_of", value: ["lost"] }] },
|
|
863
|
+
sorts: [
|
|
864
|
+
{ fieldKey: "value", direction: "desc" },
|
|
865
|
+
{ fieldKey: "title", direction: "asc" },
|
|
866
|
+
],
|
|
867
|
+
group: { fieldKey: "stage", order: { mode: "lifecycle", dir: "asc" }, buckets: [] },
|
|
868
|
+
columns: [{ key: "title", visible: true }, { key: "value", visible: true, figure: "sum" }],
|
|
869
|
+
look: { density: "compact" },
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
assert.deepEqual(listSettingsSchema.parse(dealsTable), dealsTable);
|
|
873
|
+
const fourSorts = ["a", "b", "c", "d"].map((fieldKey) => ({ fieldKey, direction: "asc" as const }));
|
|
874
|
+
assert.equal(listSettingsSchema.safeParse({ ...dealsTable, sorts: fourSorts }).success, false);
|
|
875
|
+
assert.equal("search" in settingsForSaving(dealsTable), false);
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
## A quick-filter hold
|
|
879
|
+
|
|
880
|
+
A quick filter narrows a list on top of its view. What it holds is a `ListHold`, a value of its own beside the settings and never inside them: it puts nothing on the filter bar, a saved view never keeps it, a link never carries it, and each app keeps it where it likes. It is a list of held fields, each with the values held on it: `[{ "fieldKey": "currency", "values": ["EUR"] }]`. A held value is an option key as the option counts name it: an option's value, a related record's id, `"true"` or `"false"` for yes or no, and `""` for no value. A row stays when it holds any of a field's held values, and only when it passes every held field. `listHoldSchema` checks a hold the same way everywhere, refusing an unknown key and a field held twice.
|
|
881
|
+
|
|
882
|
+
A `ViewQuery` takes the hold beside its filter and its search. `withHold(filter, hold, fieldOf)` is the filter a list answers under it, the held fields written as ordinary rules after an `and` view's own, or beside any other view kept whole as one group, and `heldInForce` names the held fields that narrow: a field the list doesn't know, or one whose values aren't options, narrows nothing.
|
|
883
|
+
|
|
884
|
+
`countHoldValues(rows, { filter, search, hold }, fieldKey, reader, options?)` counts each value a quick filter offers. Unlike `countOptions`, which counts a filter picker's alternatives with the field's own rules left out, it counts under the whole view and the search, so a value the view rules out counts 0, and under the other fields' holds, never the field's own: the count beside a value is the rows a press on it shows.
|
|
885
|
+
|
|
886
|
+
```ts
|
|
887
|
+
import { countHoldValues, listHoldSchema, withHold, type ListHold } from "viewkitjs/fields/query";
|
|
888
|
+
|
|
889
|
+
const euros: ListHold = listHoldSchema.parse([{ fieldKey: "currency", values: ["EUR"] }]);
|
|
890
|
+
const openList: ViewQuery = { ...openDeals, group: null };
|
|
891
|
+
assert.deepEqual(ids(evaluateView(DEALS, { ...openList, hold: euros }, deals).rows), ["d6", "d1"]);
|
|
892
|
+
assert.equal(withHold(openList.filter, euros, deals.fieldOf).items.length, 2);
|
|
893
|
+
assert.equal(listHoldSchema.safeParse([...euros, ...euros]).success, false);
|
|
894
|
+
|
|
895
|
+
const wonInEurosHeld: ListHold = [...euros, { fieldKey: "stage", values: ["won"] }];
|
|
896
|
+
assert.deepEqual(ids(evaluateView(DEALS, { ...openList, hold: wonInEurosHeld }, deals).rows), ["d6"]);
|
|
897
|
+
assert.deepEqual(countHoldValues(DEALS, { filter: openList.filter, hold: wonInEurosHeld }, "stage", deals), {
|
|
898
|
+
new: 1,
|
|
899
|
+
won: 1,
|
|
900
|
+
lost: 0,
|
|
901
|
+
paused: 0,
|
|
902
|
+
"": 0,
|
|
903
|
+
});
|
|
904
|
+
assert.deepEqual(countOptions(DEALS, { filter: openList.filter }, "stage", deals), { new: 3, won: 2, lost: 1, paused: 0, "": 0 });
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
## What no longer fits
|
|
908
|
+
|
|
909
|
+
A field can go, or change type, after a view names it. Such a rule is never dropped quietly and never refused: it is **set aside**, kept where it sits, marked with its reason, and it filters nothing. Every reading of a list's settings, a link's, a saved view's and an agent's alike, goes through `readListSettings(settings, fields)`, after the schema. `listFieldsOf(entity, index)` hands it a list's fields, and a relation's far fields for the rules across it. The reasons are `missing-field`, `unfit-operator` and `unfit-part`. A rule merely inactive, such as a between with one end still empty, fits, and is never set aside.
|
|
910
|
+
|
|
911
|
+
The read marks the value it returns, never the one handed in. A rule set aside only in memory therefore filters again once a field left out by a fault is back, while saving the value read saves the mark. A saved set-aside rule never filters again by itself, even once its field is back: the reading says it `fits` again, and a person puts it back with `putBackRule` or removes it with `removeSetAsideRule`, each by the path the reading gave.
|
|
912
|
+
|
|
913
|
+
```ts
|
|
914
|
+
import { listFieldsOf } from "viewkitjs/fields";
|
|
915
|
+
import { putBackRule, readListSettings, removeSetAsideRule } from "viewkitjs/fields/query";
|
|
916
|
+
|
|
917
|
+
const notLost: FilterNode = { fieldKey: "stage", operator: "is_none_of", value: ["lost"] };
|
|
918
|
+
const likely: FilterNode = { fieldKey: "probability", operator: "gt", value: 50 };
|
|
919
|
+
const likelyDeals: ListSettings = { ...dealsTable, filter: treeOf(notLost, likely) };
|
|
920
|
+
|
|
921
|
+
// Deals have no probability field: the rule is set aside, kept and named, and the list answers as if it weren't there.
|
|
922
|
+
const read = readListSettings(likelyDeals, listFieldsOf(DEAL, INDEX));
|
|
923
|
+
assert.deepEqual(
|
|
924
|
+
read.setAside.map(({ path, reason, fits }) => ({ path, reason, fits })),
|
|
925
|
+
[{ path: [1], reason: "missing-field", fits: false }]
|
|
926
|
+
);
|
|
927
|
+
assert.deepEqual(read.settings.filter.items[1], { ...likely, setAside: { reason: "missing-field" } });
|
|
928
|
+
assert.equal("setAside" in likelyDeals.filter.items[1]!, false);
|
|
929
|
+
const rowsUnder = (filter: FilterTree) => ids(evaluateView(DEALS, { filter, sorts: [], group: null }, deals).rows);
|
|
930
|
+
assert.deepEqual(rowsUnder(read.settings.filter), rowsUnder(treeOf(notLost)));
|
|
931
|
+
|
|
932
|
+
// Saved, the mark stays until a person acts on it.
|
|
933
|
+
const saved = settingsForSaving(read.settings);
|
|
934
|
+
assert.deepEqual(putBackRule(saved, [1]).filter.items[1], likely);
|
|
935
|
+
assert.deepEqual(removeSetAsideRule(saved, [1]).filter.items, [notLost]);
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
A sort, the group and the board's field are set aside the same way when their field is gone, and a sort or the group when its `by` names an order its field no longer has (`unfit-part`). A set-aside sort orders nothing and the next one decides, a set-aside group leaves the list ungrouped, and a board whose field is set aside opens as if nobody had picked (`defaultBoardField(fields)`), its lanes kept. The reading lists them beside the rules (`setAsideSorts` by index, `setAsideGroup`, `setAsideBoardField`), and a person puts each back (`putBackSort`, `putBackGroup`, `putBackBoardField`) or removes it (`removeSetAsideSort`, `removeSetAsideGroup`, `removeSetAsideBoardField`). A column on a missing field drops, as it is visibly gone; the calendar's field is the app's.
|
|
939
|
+
|
|
940
|
+
```ts
|
|
941
|
+
import { putBackSort } from "viewkitjs/fields/query";
|
|
942
|
+
|
|
943
|
+
const byProbability: ListSettings = {
|
|
944
|
+
...dealsTable,
|
|
945
|
+
sorts: [{ fieldKey: "probability", direction: "desc" }, ...dealsTable.sorts],
|
|
946
|
+
group: { ...dealsTable.group!, fieldKey: "probability" },
|
|
947
|
+
};
|
|
948
|
+
const readAxes = readListSettings(byProbability, listFieldsOf(DEAL, INDEX));
|
|
949
|
+
assert.deepEqual(
|
|
950
|
+
readAxes.setAsideSorts.map(({ index, reason }) => ({ index, reason })),
|
|
951
|
+
[{ index: 0, reason: "missing-field" }]
|
|
952
|
+
);
|
|
953
|
+
assert.equal(readAxes.setAsideGroup?.reason, "missing-field");
|
|
954
|
+
const axesQuery = { filter: readAxes.settings.filter, sorts: readAxes.settings.sorts, group: readAxes.settings.group };
|
|
955
|
+
assert.equal(evaluateView(DEALS, axesQuery, deals).buckets, null);
|
|
956
|
+
assert.deepEqual(putBackSort(settingsForSaving(readAxes.settings), 0).sorts[0], byProbability.sorts[0]);
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
## A person's changes and their own layer
|
|
960
|
+
|
|
961
|
+
What a person changed over a saved view is a `ListSettingsChange`: only the parts that differ, each replacing the view's part whole, with `null` removing a part the settings may leave out. `settingsChange` works it out and `applySettingsChange` puts it back over the view; where an app keeps it (a draft on its server, the link) is its own. A quick pick is an ordinary change to the filter.
|
|
962
|
+
|
|
963
|
+
A person's own layer, `ListPersonalLayer`, is how they read a shared view: their column widths, the groups they folded, the layout they read it in on a phone and their own look. Nothing in it changes what the view shows, and its schema refuses a filter, a sort or a group. `seenListSettings` applies a change, then a layer, over a view: the settings that person sees, the same in every app.
|
|
964
|
+
|
|
965
|
+
```ts
|
|
966
|
+
import {
|
|
967
|
+
applySettingsChange,
|
|
968
|
+
listPersonalLayerSchema,
|
|
969
|
+
seenListSettings,
|
|
970
|
+
settingsChange,
|
|
971
|
+
} from "viewkitjs/fields/query";
|
|
972
|
+
|
|
973
|
+
const dealsView: ListSettings = {
|
|
974
|
+
layout: "table",
|
|
975
|
+
filter: { op: "and", items: [{ fieldKey: "stage", operator: "is_none_of", value: ["lost"] }] },
|
|
976
|
+
sorts: [{ fieldKey: "value", direction: "desc" }],
|
|
977
|
+
group: null,
|
|
978
|
+
columns: [{ key: "title", visible: true, width: 240 }, { key: "value", visible: true }],
|
|
979
|
+
look: { density: "default" },
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
const myDeals: ListSettings = { ...dealsView, search: "acme", sorts: [{ fieldKey: "title", direction: "asc" }] };
|
|
983
|
+
const myChange = settingsChange(dealsView, myDeals);
|
|
984
|
+
assert.deepEqual(myChange, { search: "acme", sorts: [{ fieldKey: "title", direction: "asc" }] });
|
|
985
|
+
assert.deepEqual(applySettingsChange(dealsView, myChange), myDeals);
|
|
986
|
+
|
|
987
|
+
const myLayer = listPersonalLayerSchema.parse({ widths: { title: 320 }, look: { density: "compact" }, phoneLayout: "list" });
|
|
988
|
+
const mySeen = seenListSettings(dealsView, myChange, myLayer, { phone: true });
|
|
989
|
+
assert.equal(mySeen.settings.layout, "list");
|
|
990
|
+
assert.equal(mySeen.settings.look.density, "compact");
|
|
991
|
+
assert.equal(mySeen.settings.columns[0]?.width, 320);
|
|
992
|
+
assert.deepEqual(mySeen.settings.filter, dealsView.filter);
|
|
993
|
+
assert.equal(listPersonalLayerSchema.safeParse({ sorts: [] }).success, false);
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
## A list's link
|
|
997
|
+
|
|
998
|
+
A link carries the saved view it starts from (`view`), the search (`q`) and, where the app switches carrying changes on, what changed over that view (`change`), so it stays short as the view changes. A list with no saved views hands its defaults as the base and carries what differs from them. Without carrying changes a link holds the view and the search only. Changes too long for a link are left out whole, and the writer says so. Opening a link shows what it says, whatever the app kept; it reads a whole address, a query string or its parameters, and reads the settings through `readListSettings`, so a rule naming a field the list no longer has is set aside, never dropped.
|
|
999
|
+
|
|
1000
|
+
```ts
|
|
1001
|
+
import { openListLink, readListLink, writeListLink } from "viewkitjs/fields/query";
|
|
1002
|
+
|
|
1003
|
+
const linkedView = { view: "open-deals", base: dealsView, settings: myDeals };
|
|
1004
|
+
assert.equal(writeListLink("tab=2", linkedView).params.toString(), "tab=2&view=open-deals&q=acme");
|
|
1005
|
+
|
|
1006
|
+
const { params: carried, problem } = writeListLink("tab=2", linkedView, { carryChanges: true });
|
|
1007
|
+
assert.equal(problem, undefined);
|
|
1008
|
+
assert.equal(carried.get("view"), "open-deals");
|
|
1009
|
+
assert.deepEqual(readListLink(carried).change, myChange);
|
|
1010
|
+
const opened = openListLink(carried, () => dealsView, listFieldsOf(DEAL, INDEX));
|
|
1011
|
+
assert.deepEqual(opened.settings, myDeals);
|
|
1012
|
+
assert.deepEqual(opened.setAside, []);
|
|
1013
|
+
|
|
1014
|
+
// A link naming a field the deals no longer have: its rule is set aside, never dropped.
|
|
1015
|
+
const stale = { ...myDeals, filter: treeOf(notLost, likely) };
|
|
1016
|
+
const staleLink = writeListLink("", { view: "open-deals", base: dealsView, settings: stale }, { carryChanges: true });
|
|
1017
|
+
const staleOpened = openListLink(staleLink.params, () => dealsView, listFieldsOf(DEAL, INDEX));
|
|
1018
|
+
assert.deepEqual(staleOpened.setAside.map(({ path, reason }) => ({ path, reason })), [{ path: [1], reason: "missing-field" }]);
|
|
1019
|
+
|
|
1020
|
+
assert.equal(readListLink("https://app.example/deals?view=open-deals#top").view, "open-deals");
|
|
1021
|
+
const broken = readListLink("view=open-deals&change=%25%25");
|
|
1022
|
+
assert.equal(broken.problem, "the link's changes can't be read");
|
|
1023
|
+
assert.deepEqual(broken.change, {});
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
## Folding and collation
|
|
1027
|
+
|
|
1028
|
+
Every text rule folds both sides the same way before it compares them: `foldText` decomposes the text, drops the Latin combining marks and lowercases it. Ș with a comma below, Ş with a cedilla and a plain S all fold to `s`. Only the Combining Diacritical Marks block is dropped, so the vowel signs of scripts where they are letters stay.
|
|
1029
|
+
|
|
1030
|
+
```ts
|
|
1031
|
+
import { foldText } from "viewkitjs/fields/query";
|
|
1032
|
+
|
|
1033
|
+
assert.equal(foldText("Ștefan"), "stefan");
|
|
1034
|
+
assert.equal(foldText("Şerban"), "serban");
|
|
1035
|
+
assert.equal(foldText("Café"), "cafe");
|
|
1036
|
+
assert.equal(foldText("हिंदी"), "हिंदी".normalize("NFD"));
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
Order is the host's alphabet, the conventions' `locale`, never the runtime's. The sort and the bucket labels share one collator, so a list and its groups agree. It compares at base strength: case and accents never split two equal names, and such a tie keeps the rows in the order they came. In English Șerban sorts among the s names, before Sorin; in Romanian Ș is a letter of its own, after S.
|
|
1040
|
+
|
|
1041
|
+
```ts
|
|
1042
|
+
type Contact = { id: string; first: string };
|
|
1043
|
+
const CONTACT_FIELDS = defineFields({ entity: "person", identity: "first", fields: { first: { type: "text", label: "First name" } } });
|
|
1044
|
+
const contacts = readerOf<Contact>(CONTACT_FIELDS);
|
|
1045
|
+
const CONTACTS: Contact[] = [
|
|
1046
|
+
{ id: "a", first: "Sorin" },
|
|
1047
|
+
{ id: "b", first: "Șerban" },
|
|
1048
|
+
{ id: "c", first: "ana" },
|
|
1049
|
+
{ id: "d", first: "Ana" },
|
|
1050
|
+
];
|
|
1051
|
+
const byFirst: ViewQuery = { filter: treeOf(), sorts: [{ fieldKey: "first", direction: "asc" }], group: null };
|
|
1052
|
+
|
|
1053
|
+
assert.deepEqual(ids(kit.evaluateView(CONTACTS, byFirst, contacts).rows), ["c", "d", "b", "a"]);
|
|
1054
|
+
assert.deepEqual(ids(romanian.evaluateView(CONTACTS, byFirst, contacts).rows), ["c", "d", "a", "b"]);
|
|
1055
|
+
```
|