@wix/bex-core 2.338.0 → 2.340.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/dist/cjs/assets/locale/messages_ar.json +2 -2
- package/dist/cjs/assets/locale/messages_bg.json +2 -2
- package/dist/cjs/assets/locale/messages_ca.json +2 -2
- package/dist/cjs/assets/locale/messages_el.json +2 -2
- package/dist/cjs/assets/locale/messages_en.json +2 -2
- package/dist/cjs/assets/locale/messages_fi.json +2 -2
- package/dist/cjs/assets/locale/messages_he.json +2 -2
- package/dist/cjs/assets/locale/messages_hu.json +2 -2
- package/dist/cjs/assets/locale/messages_lt.json +2 -2
- package/dist/cjs/assets/locale/messages_ms.json +2 -2
- package/dist/cjs/assets/locale/messages_ro.json +2 -2
- package/dist/cjs/assets/locale/messages_sk.json +2 -2
- package/dist/cjs/assets/locale/messages_sl.json +2 -2
- package/dist/cjs/assets/locale/messages_tl.json +2 -2
- package/dist/cjs/assets/locale/version_file +1 -1
- package/dist/cjs/assets/visual-e2e-locale/messages_visuale2e.json +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/translations.js.map +1 -1
- package/dist/cjs/state/CustomFieldModalState.js +53 -4
- package/dist/cjs/state/CustomFieldModalState.js.map +1 -1
- package/dist/cjs/state/ImportState/ImportState.js.map +1 -1
- package/dist/cjs/testkit/createInMemorySchemaSource.js +6 -3
- package/dist/cjs/testkit/createInMemorySchemaSource.js.map +1 -1
- package/dist/cjs/types/FieldsSource.js.map +1 -1
- package/dist/cjs/types/Schema.js.map +1 -1
- package/dist/cjs/types/SchemaSource.js +11 -8
- package/dist/cjs/types/SchemaSource.js.map +1 -1
- package/dist/esm/assets/locale/messages_ar.json +2 -2
- package/dist/esm/assets/locale/messages_bg.json +2 -2
- package/dist/esm/assets/locale/messages_ca.json +2 -2
- package/dist/esm/assets/locale/messages_el.json +2 -2
- package/dist/esm/assets/locale/messages_en.json +2 -2
- package/dist/esm/assets/locale/messages_fi.json +2 -2
- package/dist/esm/assets/locale/messages_he.json +2 -2
- package/dist/esm/assets/locale/messages_hu.json +2 -2
- package/dist/esm/assets/locale/messages_lt.json +2 -2
- package/dist/esm/assets/locale/messages_ms.json +2 -2
- package/dist/esm/assets/locale/messages_ro.json +2 -2
- package/dist/esm/assets/locale/messages_sk.json +2 -2
- package/dist/esm/assets/locale/messages_sl.json +2 -2
- package/dist/esm/assets/locale/messages_tl.json +2 -2
- package/dist/esm/assets/locale/version_file +1 -1
- package/dist/esm/assets/visual-e2e-locale/messages_visuale2e.json +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/state/CustomFieldModalState.js +46 -3
- package/dist/esm/state/CustomFieldModalState.js.map +1 -1
- package/dist/esm/testkit/createInMemorySchemaSource.js +6 -3
- package/dist/esm/testkit/createInMemorySchemaSource.js.map +1 -1
- package/dist/esm/types/SchemaSource.js +2 -4
- package/dist/esm/types/SchemaSource.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/services/translations.d.ts +1 -9
- package/dist/types/services/translations.d.ts.map +1 -1
- package/dist/types/state/CustomFieldModalState.d.ts +15 -2
- package/dist/types/state/CustomFieldModalState.d.ts.map +1 -1
- package/dist/types/state/ImportState/ImportState.d.ts +1 -1
- package/dist/types/testkit/createInMemorySchemaSource.d.ts +4 -3
- package/dist/types/testkit/createInMemorySchemaSource.d.ts.map +1 -1
- package/dist/types/types/FieldsSource.d.ts +56 -19
- package/dist/types/types/FieldsSource.d.ts.map +1 -1
- package/dist/types/types/Schema.d.ts +22 -3
- package/dist/types/types/Schema.d.ts.map +1 -1
- package/dist/types/types/SchemaSource.d.ts +29 -16
- package/dist/types/types/SchemaSource.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/FieldsSource.ts"],"sourcesContent":["import type { Field, PatternsFieldType } from './Field';\nimport type { FieldActions, Schema } from './Schema';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\n\n/** A field the source has archived. Sources without archiving omit `archive`. */\nexport interface ArchivedFieldItem {\n id: string;\n label: string;\n isPii?: boolean;\n}\n\n/** A
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/FieldsSource.ts"],"sourcesContent":["import type { ComponentType } from 'react';\nimport type { Field, PatternsFieldType } from './Field';\nimport type { FieldActions, FieldSettings, Schema } from './Schema';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\n\n/** A field the source has archived. Sources without archiving omit `archive`. */\nexport interface ArchivedFieldItem {\n id: string;\n label: string;\n isPii?: boolean;\n}\n\n/** A `FieldTypeOption` the modal can render: the id and label a source left to\n * the defaults are filled in. */\nexport interface ResolvedFieldTypeOption {\n /** Stored on the draft; the source maps it back to its native type. */\n id: string;\n label: string;\n namePlaceholder?: string;\n subtitle?: string;\n /** Group heading in the type list; types sharing a heading form one group. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source-wide `supportsPii`. */\n supportsPii?: boolean;\n /** Warning to show while the PII toggle is on. Called on every render.\n * Absent ⇒ none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section below the main fields.\n * Absent ⇒ the section holds only what the modal itself puts there. */\n settingsSection?: FieldSettingsSection;\n /** Drives the type icon in the modal. */\n patternsType: PatternsFieldType;\n}\n\n/** Read/write permission defaults a source supports, per audience. */\nexport interface FieldPermissions {\n installedApps?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n siteVisitors?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n}\n\n/** The values the add/edit field modal collects, source-neutral. */\nexport interface FieldDraft {\n type?: string;\n key: string;\n name: string;\n readApps: boolean;\n readUsers: boolean;\n writeApps: boolean;\n writeUsers: boolean;\n containsPii: boolean;\n /** The field this draft was built from, for the source's settings section to\n * read its own values off. Absent for a new field. */\n field?: Field;\n /** What the source's settings section collected, on its way to that source's\n * `addField`/`editField`. */\n settings?: FieldSettings;\n}\n\n/** The add-modal subtitle: a line of text, an optional second note line, and an\n * optional \"learn more\" link. */\nexport interface FieldModalSubtitle {\n text: string;\n note?: string;\n learnMore?: { label: string; href: string };\n}\n\n/** The text a source supplies for the add/edit field modal. */\nexport interface FieldModalText {\n addTitle: string;\n editTitle: string;\n /** Subtitle for the add modal; omit for none. */\n addSubtitle?: FieldModalSubtitle;\n /** Label of the collapsible section below the main fields. */\n settingsLabel?: string;\n}\n\n/** A warning shown under the PII toggle, with an optional action button. */\nexport interface FieldPiiWarning {\n text: string;\n action?: { label: string; onClick: () => void };\n}\n\nexport interface FieldSettingsProps {\n /** The picked field type, or absent before one is picked. */\n fieldType?: string;\n}\n\n/**\n * The collapsible section below the main add/edit field inputs, supplied by the\n * source. The modal renders it, blocks confirm while it has an error, and hands\n * its values to the source's own `addField`/`editField` — it never looks inside.\n */\nexport interface FieldSettingsSection {\n Component: ComponentType<FieldSettingsProps>;\n /** True keeps the modal open on confirm. The section shows the error itself. */\n hasError(fieldType?: string): boolean;\n /** Passed to `FieldActions.addField`/`editField` as-is. */\n getValues(fieldType?: string): FieldSettings;\n /**\n * Fills the inputs when the modal opens: the field being edited, or nothing\n * for a new field. Pushed in rather than read from a prop, so the values are\n * there whether or not the section has been rendered yet.\n */\n setValues(field?: Field): void;\n}\n\n/** Add/edit/delete capability a source exposes. Present ⇒ field management UI shows. */\nexport interface FieldManagement {\n /** False ⇒ the add-field CTA is hidden entirely. */\n canAddFields: boolean;\n /** True ⇒ the add-field CTA renders but is disabled. */\n addFieldDisabled: boolean;\n /** Hint text shown beneath the add-field CTA while it is disabled. */\n addFieldDisabledHint?: string;\n canEditField(field: Field): boolean;\n /** `origin` is the UI surface the delete was triggered from; used for BI. */\n deleteField(fieldId: string, origin: string): Promise<void>;\n\n /** Everything the add/edit field modal shows: its titles, and the field types\n * it offers with what each one brings to it. */\n fieldModal: {\n text: FieldModalText;\n types: ResolvedFieldTypeOption[];\n /** Defaults for the read/write permissions per audience. Absent ⇒ the modal\n * shows no permissions section. */\n permissions?: FieldPermissions;\n /** Whether a field can be marked PII. A field type option overrides it with\n * its own `supportsPii`. */\n supportsPii?: boolean;\n };\n /** Existing field keys, used by the add modal to reject duplicates. */\n existingFieldKeys: string[];\n /** True when no more fields can be added because a limit is reached. */\n maxReached?: boolean;\n addField(draft: FieldDraft): Promise<void>;\n editField(fieldId: string, draft: FieldDraft): Promise<void>;\n /** Current values for an existing field, to prefill the edit modal. */\n getFieldDraft(fieldId: string): FieldDraft | undefined;\n}\n\n/** Archiving capability a source exposes. Present ⇒ archive/restore UI shows. */\nexport interface FieldArchive {\n items: ArchivedFieldItem[];\n shouldDisplay: boolean;\n /** Whether the archived-items panel is currently open. */\n isOpen: boolean;\n openPanel(): void;\n closePanel(): void;\n /** `origin` is the UI surface the action was triggered from; used for BI. */\n archiveField(fieldId: string, origin: string): Promise<void>;\n restoreField(fieldId: string, origin: string): Promise<void>;\n /** Display name for a field, for the confirm-dialog copy. */\n fieldName(fieldId: string): string;\n}\n\n/**\n * The source-neutral fields data a collection reads, implemented by each source\n * adapter. Rendering — field modals, filter elements — is not here; it lives in\n * the collection-page layer.\n */\nexport interface FieldsSource {\n /** Loads the fields (schema/data). The collection runs this once, tracks its\n * status, and shows a retry toast on failure. */\n load(): Promise<void>;\n\n fields: Field[];\n filterableFields: Field[];\n /** The fields the manage-fields panel lists — the source's editable fields. */\n manageableFields: Field[];\n /** Column id for a field. Sources that group fields prefix the group; flat sources use the field key. */\n columnIdForField(field: Field): string;\n /** WQL field path for a filter. Sources that group fields prefix the group; flat sources use the field key. */\n queryFieldId(field: Field): string;\n /** The value to display for a field on a row. */\n getCellValue(row: unknown, field: Field): unknown;\n /** Writes a new value for a field on a row, returning the updated row. Present when cells can be edited in place. */\n setCellValue?(row: unknown, field: Field, value: unknown): unknown;\n\n /** Replaces the source's fields with a freshly-returned map, updating the\n * columns with no refetch. Present when the source holds its fields in a\n * mergeable state (e.g. a loaded schema); used after an import creates fields. */\n mergeFields?(fields: Schema['fields']): void;\n\n /** Field-type definitions the source supports: how a field of that type\n * renders, filters and validates. Built-in types are keyed by their\n * `PatternsFieldType`; consumer-defined types are keyed by the string a field\n * references via `customType`. The add/edit field modal never reads this —\n * see `FieldManagement.fieldModal`. */\n fieldTypes?: FieldTypeDefinition[];\n\n /** Present when fields can be added/edited/deleted. */\n fieldManagement?: FieldManagement;\n\n /** The collection's field-mutation actions (delete/makePrimary/duplicate/…),\n * driving the shared FieldActions menu. Absent ⇒ no per-field action menu. */\n fieldActions?: FieldActions;\n\n /** Present when the source supports archiving fields. */\n archive?: FieldArchive;\n\n /** Present when fields are grouped. Absent ⇒ flat list. */\n groups?: {\n all: string[];\n fieldsForGroup(group: string): Field[];\n };\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/Schema.ts"],"sourcesContent":["import type { Field } from './Field';\nimport type { FiltersMap, OptionalFiltersMap } from '../model';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n CursorQuery,\n CursorQueryResult,\n FetchTotalFn,\n} from '../hooks/paginationModeConfig';\n\n/** Field-management permissions. Absent when the schema's fields cannot be edited. */\nexport interface SchemaPermissions {\n createField: boolean;\n updateField: boolean;\n deleteField: boolean;\n}\n\n/** Item-level CRUD permissions. */\nexport interface ItemPermissions {\n createItem: boolean;\n updateItem: boolean;\n deleteItem: boolean;\n}\n\n/**\n * A source-neutral description of a collection — data only, no behavior.\n * Item access is in `CollectionBackend`, field mutations in `FieldActions`.\n */\nexport interface Schema {\n id: string;\n fields: Record<string, Field | undefined>;\n /** The field that best represents the entity (titles/selections). */\n displayField: string;\n /** The identifier field. */\n idField: string;\n /** Group display order, present when fields carry a `group`. */\n groups?: string[];\n /** Absent when the schema's fields cannot be edited. */\n schemaPermissions?: SchemaPermissions;\n itemPermissions?: ItemPermissions;\n}\n\nexport interface BackupConfig {\n create: () => Promise<{ backupId: string }>;\n waitForCompletion: (\n backupId: string,\n options?: { signal?: AbortSignal },\n ) => Promise<void>;\n cancel?: (backupId: string) => Promise<void>;\n restore?: (backupId: string) => Promise<{ restorationId: string }>;\n waitForRestoration?: (\n restorationId: string,\n options?: { signal?: AbortSignal },\n ) => Promise<void>;\n}\n\nexport interface BulkInsertError {\n rowIndex: number;\n message?: string;\n code?: string;\n}\n\nexport interface BulkInsertResult {\n succeeded?: number;\n failed?: number;\n errors?: BulkInsertError[];\n}\n\n/** Item data access shared by both pagination modes. `find` (on\n * `CollectionBackend`) is the only required call — the rest are capabilities\n * a source provides when it (or its consumer) supports them. */\nexport interface CollectionBackendBase<T = Record<string, unknown>> {\n get?: (entityId: string) => Promise<T>;\n create?: (entity: Partial<T>) => Promise<T>;\n update?: (entity: T) => Promise<T>;\n delete?: (entityId: string) => Promise<void>;\n bulkDelete?: (entityIds: string[]) => Promise<void>;\n move?: (\n id: string,\n params: { moveAfterId: string | null | undefined },\n ) => Promise<void>;\n backup?: BackupConfig;\n bulkInsert?: (entities: Partial<T>[]) => Promise<BulkInsertResult>;\n}\n\n/** Per-call search scope the query layer passes to a backend's `find`. */\nexport interface FindOptions {\n searchableFieldIds?: string[];\n}\n\n/**\n * The query-layer fetch-data fns plus the optional `find` options the runtime\n * already accepts. Kept separate so the shared `OffsetFetchDataFn`/\n * `CursorFetchDataFn` used by `fetchData` stay unchanged.\n */\ntype OffsetFindFn<T, F extends FiltersMap> = (\n query: OffsetQuery<F>,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\ntype CursorFindFn<T, F extends FiltersMap> = (\n query: CursorQuery<F>,\n options?: FindOptions,\n) => Promise<CursorQueryResult<T>>;\n\n/**\n * A source's item data access. The source declares its `paginationMode`\n * (offset by default) together with the matching `find`, same as core's\n * `PaginationModeConfig`.\n */\nexport type CollectionBackend<\n T = Record<string, unknown>,\n F extends FiltersMap = OptionalFiltersMap,\n> = CollectionBackendBase<T> &\n (\n | { paginationMode?: 'offset'; find: OffsetFindFn<T, F> }\n | {\n paginationMode: 'cursor';\n find: CursorFindFn<T, F>;\n fetchTotal?: FetchTotalFn;\n }\n );\n\n/** Field-management actions. All optional — a read-only source provides none. */\nexport interface FieldActions {\n /**\n * Field-mutating actions return the collection's updated fields map so the\n * caller can merge its local state from the response, without reloading the\n * schema. (`renameField` is the exception — nothing consumes its result yet.)\n */\n addField
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/Schema.ts"],"sourcesContent":["import type { Field } from './Field';\nimport type { FiltersMap, OptionalFiltersMap } from '../model';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n CursorQuery,\n CursorQueryResult,\n FetchTotalFn,\n} from '../hooks/paginationModeConfig';\n\n/** Field-management permissions. Absent when the schema's fields cannot be edited. */\nexport interface SchemaPermissions {\n createField: boolean;\n updateField: boolean;\n deleteField: boolean;\n}\n\n/** The per-item delete verdict. */\nexport interface RemoveItemDisabledResult {\n disabled: boolean;\n /** Why the item cannot be deleted — surfaced to the user by consumers. */\n reason?: string;\n}\n\n/** Item-level CRUD permissions. */\nexport interface ItemPermissions<T = Record<string, unknown>> {\n createItem: boolean;\n updateItem: boolean;\n deleteItem: boolean;\n /** Deleting several items in one operation. Absent = follows `deleteItem`. */\n bulkDeleteItems?: boolean;\n /** Per-item refinement of `deleteItem`: disables deleting an item even\n * though `deleteItem` is true, optionally with a reason. Must be pure and\n * synchronous. Absent = all items deletable. */\n isRemoveItemDisabled?: (item: T) => RemoveItemDisabledResult;\n}\n\n/**\n * A source-neutral description of a collection — data only, no behavior.\n * Item access is in `CollectionBackend`, field mutations in `FieldActions`.\n */\nexport interface Schema {\n id: string;\n fields: Record<string, Field | undefined>;\n /** The field that best represents the entity (titles/selections). */\n displayField: string;\n /** The identifier field. */\n idField: string;\n /** Group display order, present when fields carry a `group`. */\n groups?: string[];\n /** Absent when the schema's fields cannot be edited. */\n schemaPermissions?: SchemaPermissions;\n itemPermissions?: ItemPermissions;\n}\n\nexport interface BackupConfig {\n create: () => Promise<{ backupId: string }>;\n waitForCompletion: (\n backupId: string,\n options?: { signal?: AbortSignal },\n ) => Promise<void>;\n cancel?: (backupId: string) => Promise<void>;\n restore?: (backupId: string) => Promise<{ restorationId: string }>;\n waitForRestoration?: (\n restorationId: string,\n options?: { signal?: AbortSignal },\n ) => Promise<void>;\n}\n\nexport interface BulkInsertError {\n rowIndex: number;\n message?: string;\n code?: string;\n}\n\nexport interface BulkInsertResult {\n succeeded?: number;\n failed?: number;\n errors?: BulkInsertError[];\n}\n\n/** Item data access shared by both pagination modes. `find` (on\n * `CollectionBackend`) is the only required call — the rest are capabilities\n * a source provides when it (or its consumer) supports them. */\nexport interface CollectionBackendBase<T = Record<string, unknown>> {\n get?: (entityId: string) => Promise<T>;\n create?: (entity: Partial<T>) => Promise<T>;\n update?: (entity: T) => Promise<T>;\n delete?: (entityId: string) => Promise<void>;\n bulkDelete?: (entityIds: string[]) => Promise<void>;\n move?: (\n id: string,\n params: { moveAfterId: string | null | undefined },\n ) => Promise<void>;\n backup?: BackupConfig;\n bulkInsert?: (entities: Partial<T>[]) => Promise<BulkInsertResult>;\n}\n\n/** Per-call search scope the query layer passes to a backend's `find`. */\nexport interface FindOptions {\n searchableFieldIds?: string[];\n}\n\n/**\n * The query-layer fetch-data fns plus the optional `find` options the runtime\n * already accepts. Kept separate so the shared `OffsetFetchDataFn`/\n * `CursorFetchDataFn` used by `fetchData` stay unchanged.\n */\ntype OffsetFindFn<T, F extends FiltersMap> = (\n query: OffsetQuery<F>,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\ntype CursorFindFn<T, F extends FiltersMap> = (\n query: CursorQuery<F>,\n options?: FindOptions,\n) => Promise<CursorQueryResult<T>>;\n\n/**\n * A source's item data access. The source declares its `paginationMode`\n * (offset by default) together with the matching `find`, same as core's\n * `PaginationModeConfig`.\n */\nexport type CollectionBackend<\n T = Record<string, unknown>,\n F extends FiltersMap = OptionalFiltersMap,\n> = CollectionBackendBase<T> &\n (\n | { paginationMode?: 'offset'; find: OffsetFindFn<T, F> }\n | {\n paginationMode: 'cursor';\n find: CursorFindFn<T, F>;\n fetchTotal?: FetchTotalFn;\n }\n );\n\n/**\n * Whatever the source's settings section collected in the add/edit field modal.\n * The modal and the collection layer only carry it; the source that produced it\n * is the only one that looks inside, so it declares its own shape on `addField`\n * and `editField` (both are methods, so a narrower parameter type is allowed).\n */\nexport type FieldSettings = unknown;\n\n/** Field-management actions. All optional — a read-only source provides none. */\nexport interface FieldActions {\n /**\n * Field-mutating actions return the collection's updated fields map so the\n * caller can merge its local state from the response, without reloading the\n * schema. (`renameField` is the exception — nothing consumes its result yet.)\n */\n addField?(field: Field, settings?: FieldSettings): Promise<Schema['fields']>;\n /**\n * Adds several fields in a single mutation, each under its `field.id` key\n * (callers decide the keys up front — e.g. CSV import uploads values under\n * them), unlike `addField`, which derives a fresh key from the display name.\n */\n addFields?: (fields: Field[]) => Promise<Schema['fields']>;\n editField?(\n fieldId: string,\n updates: Partial<Field>,\n settings?: FieldSettings,\n ): Promise<Schema['fields']>;\n deleteField?: (fieldId: string) => Promise<Schema['fields']>;\n renameField?: (fieldId: string, newName: string) => Promise<void>;\n makePrimary?: (fieldId: string) => Promise<Schema['fields']>;\n duplicateField?: (fieldId: string) => Promise<Schema['fields']>;\n duplicateFieldWithContent?: (fieldId: string) => Promise<Schema['fields']>;\n}\n\n/** Everything a source provides for a collection. */\nexport interface LoadedSchema<T = Record<string, unknown>> {\n schema: Schema;\n backend: CollectionBackend<T>;\n fieldActions?: FieldActions;\n}\n\n/**\n * Loads a collection's `LoadedSchema`. Sources that need dependencies expose a\n * factory that returns this type.\n */\nexport type SchemaLoader<\n T extends Record<string, unknown> = Record<string, unknown>,\n> = (collectionId: string) => Promise<LoadedSchema<T>>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.defineSchemaSource = defineSchemaSource;
|
|
5
5
|
exports.sourceFetchData = sourceFetchData;
|
|
6
|
-
/** A field type
|
|
7
|
-
* `patternsType` — the type is the entry's
|
|
6
|
+
/** A field type the add/edit field modal offers, with everything that type
|
|
7
|
+
* brings to it. Declare one entry per `patternsType` — the type is the entry's
|
|
8
|
+
* identity. Nothing here reaches the table or the filters; that is `fieldTypes`
|
|
9
|
+
* (`FieldTypeDefinition[]`). */
|
|
10
|
+
|
|
11
|
+
/** Everything the add/edit field modal shows for this source. */
|
|
8
12
|
|
|
9
13
|
/** What a caller passes. Only `collectionId` and `loadSchema` are required. */
|
|
10
14
|
|
|
@@ -38,12 +42,10 @@ function defineSchemaSource(input) {
|
|
|
38
42
|
const {
|
|
39
43
|
collectionId,
|
|
40
44
|
paginationMode = 'offset',
|
|
41
|
-
|
|
45
|
+
fieldModal = {},
|
|
42
46
|
fieldTypes = [],
|
|
43
47
|
fieldPermissions,
|
|
44
48
|
supportsPii = false,
|
|
45
|
-
piiWarning,
|
|
46
|
-
fieldModalText,
|
|
47
49
|
references = {}
|
|
48
50
|
} = input;
|
|
49
51
|
let loaded;
|
|
@@ -88,7 +90,10 @@ function defineSchemaSource(input) {
|
|
|
88
90
|
itemKey,
|
|
89
91
|
itemName,
|
|
90
92
|
references,
|
|
91
|
-
|
|
93
|
+
fieldModal: {
|
|
94
|
+
text: fieldModal.text,
|
|
95
|
+
types: fieldModal.types ?? []
|
|
96
|
+
},
|
|
92
97
|
fieldTypes,
|
|
93
98
|
searchableFieldIds,
|
|
94
99
|
canAddFields,
|
|
@@ -96,8 +101,6 @@ function defineSchemaSource(input) {
|
|
|
96
101
|
canDeleteField,
|
|
97
102
|
fieldPermissions,
|
|
98
103
|
supportsPii,
|
|
99
|
-
piiWarning,
|
|
100
|
-
fieldModalText,
|
|
101
104
|
getFieldValue,
|
|
102
105
|
setFieldValue
|
|
103
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sourceFetchData","source","query","backend","schema","loadSchema","visibleColumns","columns","find","searchableFieldIds","length","defineSchemaSource","input","collectionId","paginationMode","creatableFieldTypes","fieldTypes","fieldPermissions","supportsPii","piiWarning","fieldModalText","references","loaded","then","result","catch","error","undefined","s","displayField","itemKey","item","_schema","String","idField","itemName","_schema2","canAddFields","_s$schemaPermissions","schemaPermissions","createField","canEditField","field","_s$schemaPermissions2","updateField","isSystem","canDeleteField","_s$schemaPermissions3","deleteField","getFieldValue","id","setFieldValue","value"],"sources":["../../../src/types/SchemaSource.ts"],"sourcesContent":["import type { Field, PatternsFieldType } from './Field';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\nimport type { Schema, LoadedSchema, FindOptions } from './Schema';\nimport type {\n FieldModalText,\n FieldPermissions,\n FieldPiiWarning,\n} from './FieldsSource';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n} from '../hooks/paginationModeConfig';\n\n/** A field type a source allows creating. Declare one entry per\n * `patternsType` — the type is the entry's identity. */\nexport interface CreatableFieldType {\n patternsType: PatternsFieldType;\n /** Custom display name. Absent ⇒ the UI's standard name for this type. */\n label?: string;\n /** Custom name-input placeholder. Absent ⇒ the UI's standard placeholder. */\n namePlaceholder?: string;\n /** A one-line description shown under the type in the add-field menu. */\n subtitle?: string;\n /** The group heading this type is listed under in the add-field menu, in\n * first-seen order. Types sharing a heading form one group. Absent ⇒\n * ungrouped. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source's `supportsPii`. */\n supportsPii?: boolean;\n}\n\n/** What a caller passes. Only `collectionId` and `loadSchema` are required. */\nexport interface SchemaSourceInput<T> {\n collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n /** Sources for collections this one references, keyed by the referenced\n * collection id. A renderer resolves a reference field through the matching\n * entry — its `loadSchema` gives the referenced schema and `sourceFetchData`\n * queries the referenced items. Default: none. */\n references?: Record<string, SchemaSource<any>>;\n paginationMode?: 'offset';\n /** Stable row identity. Default: `row[idField]`. */\n itemKey?: (item: T) => string;\n /** Row display label. Default: `row[displayField]`. */\n itemName?: (item: T) => string;\n /** Fields free-text search runs against. Default: `[displayField]`. */\n searchableFieldIds?: (schema: Schema) => string[];\n /** Field types the add-field modal offers. Default: none. */\n creatableFieldTypes?: CreatableFieldType[];\n /** Consumer-defined field types. A field with `type: 'CUSTOM'` resolves its\n * definition here by `customType`. Default: none. */\n fieldTypes?: FieldTypeDefinition[];\n /** Default: `schemaPermissions.createField`. */\n canAddFields?: (schema: Schema) => boolean;\n /** Default: `schemaPermissions.updateField && !field.isSystem`. */\n canEditField?: (field: Field, schema: Schema) => boolean;\n /** Default: `schemaPermissions.deleteField && !field.isSystem`. */\n canDeleteField?: (field: Field, schema: Schema) => boolean;\n /** Permission defaults shown in the modal. Absent ⇒ no permissions section. */\n fieldPermissions?: FieldPermissions;\n /** Default: `false`. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** Title and subtitle for the add/edit field modal. Absent ⇒ generic default. */\n fieldModalText?: FieldModalText;\n /** The value of a field on an item. Default: `item[field.id]`. */\n getFieldValue?: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item.\n * Default: `{ ...item, [field.id]: value }`. */\n setFieldValue?: (item: T, field: Field, value: unknown) => T;\n}\n\n/** The resolved source: defaults filled, `loadSchema` memoized. */\nexport interface SchemaSource<T> {\n readonly collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n readonly paginationMode: 'offset';\n /** Stable row identity. */\n itemKey: (item: T) => string;\n /** Row display label. */\n itemName: (item: T) => string;\n /** Sources for referenced collections, keyed by referenced collection id. */\n readonly references: Record<string, SchemaSource<any>>;\n readonly creatableFieldTypes: CreatableFieldType[];\n readonly fieldTypes: FieldTypeDefinition[];\n searchableFieldIds: (schema: Schema) => string[];\n canAddFields: (schema: Schema) => boolean;\n canEditField: (field: Field, schema: Schema) => boolean;\n canDeleteField: (field: Field, schema: Schema) => boolean;\n readonly fieldPermissions?: FieldPermissions;\n readonly supportsPii: boolean;\n readonly piiWarning?: () => FieldPiiWarning | undefined;\n readonly fieldModalText?: FieldModalText;\n /** The value of a field on an item. */\n getFieldValue: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item. */\n setFieldValue: (item: T, field: Field, value: unknown) => T;\n}\n\ntype OffsetFind<T> = (\n query: OffsetQuery,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\n\n/** The collection fetch derived from a source: loads once, then queries the\n * backend's `find`.\n *\n * Free-text search covers the columns the page is showing: the table keeps\n * `query.columns` in sync with them, so the scope comes off the query rather\n * than being threaded in. Falls back to the source's own `searchableFieldIds`\n * before any columns are known (or with no table attached). */\nexport function sourceFetchData<T>(\n source: SchemaSource<T>,\n): (query: OffsetQuery) => Promise<OffsetQueryResult<T>> {\n return async (query) => {\n const { backend, schema } = await source.loadSchema();\n // `columns` is the visible-column list; `fields` is the projection, which a\n // source-driven table doesn't set.\n const visibleColumns = query.columns;\n return (backend.find as OffsetFind<T>)(query, {\n searchableFieldIds: visibleColumns?.length\n ? visibleColumns\n : source.searchableFieldIds(schema),\n });\n };\n}\n\n/** Fills source-neutral defaults over `input` and memoizes the load so the collection\n * query and the table columns share a single fetch. */\nexport function defineSchemaSource<T>(\n input: SchemaSourceInput<T>,\n): SchemaSource<T> {\n const {\n collectionId,\n paginationMode = 'offset',\n creatableFieldTypes = [],\n fieldTypes = [],\n fieldPermissions,\n supportsPii = false,\n piiWarning,\n fieldModalText,\n references = {},\n } = input;\n\n let loaded: Promise<LoadedSchema<T>> | undefined;\n let schema: Schema | undefined;\n\n const loadSchema = () =>\n (loaded ??= input\n .loadSchema()\n .then((result) => {\n schema = result.schema;\n return result;\n })\n .catch((error) => {\n loaded = undefined;\n throw error;\n }));\n\n const searchableFieldIds =\n input.searchableFieldIds ?? ((s) => [s.displayField]);\n\n const itemKey =\n input.itemKey ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.idField ?? '_id'] ?? '',\n ));\n const itemName =\n input.itemName ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.displayField ?? '_id'] ?? '',\n ));\n const canAddFields =\n input.canAddFields ?? ((s) => s.schemaPermissions?.createField ?? false);\n const canEditField =\n input.canEditField ??\n ((field, s) =>\n (s.schemaPermissions?.updateField ?? false) && !field.isSystem);\n const canDeleteField =\n input.canDeleteField ??\n ((field, s) =>\n (s.schemaPermissions?.deleteField ?? false) && !field.isSystem);\n const getFieldValue =\n input.getFieldValue ??\n ((item, field) => (item as Record<string, unknown>)[field.id]);\n const setFieldValue =\n input.setFieldValue ??\n ((item, field, value) => ({ ...item, [field.id]: value } as T));\n\n return {\n collectionId,\n loadSchema,\n paginationMode,\n itemKey,\n itemName,\n references,\n creatableFieldTypes,\n fieldTypes,\n searchableFieldIds,\n canAddFields,\n canEditField,\n canDeleteField,\n fieldPermissions,\n supportsPii,\n piiWarning,\n fieldModalText,\n getFieldValue,\n setFieldValue,\n };\n}\n"],"mappings":"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","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["sourceFetchData","source","query","backend","schema","loadSchema","visibleColumns","columns","find","searchableFieldIds","length","defineSchemaSource","input","collectionId","paginationMode","fieldModal","fieldTypes","fieldPermissions","supportsPii","references","loaded","then","result","catch","error","undefined","s","displayField","itemKey","item","_schema","String","idField","itemName","_schema2","canAddFields","_s$schemaPermissions","schemaPermissions","createField","canEditField","field","_s$schemaPermissions2","updateField","isSystem","canDeleteField","_s$schemaPermissions3","deleteField","getFieldValue","id","setFieldValue","value","text","types"],"sources":["../../../src/types/SchemaSource.ts"],"sourcesContent":["import type { Field, PatternsFieldType } from './Field';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\nimport type { Schema, LoadedSchema, FindOptions } from './Schema';\nimport type {\n FieldModalText,\n FieldPermissions,\n FieldPiiWarning,\n FieldSettingsSection,\n} from './FieldsSource';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n} from '../hooks/paginationModeConfig';\n\n/** A field type the add/edit field modal offers, with everything that type\n * brings to it. Declare one entry per `patternsType` — the type is the entry's\n * identity. Nothing here reaches the table or the filters; that is `fieldTypes`\n * (`FieldTypeDefinition[]`). */\nexport interface FieldTypeOption {\n patternsType: PatternsFieldType;\n /** Custom display name. Absent ⇒ the UI's standard name for this type. */\n label?: string;\n /** Custom name-input placeholder. Absent ⇒ the UI's standard placeholder. */\n namePlaceholder?: string;\n /** A one-line description shown under the type in the add-field menu. */\n subtitle?: string;\n /** The group heading this type is listed under in the add-field menu, in\n * first-seen order. Types sharing a heading form one group. Absent ⇒\n * ungrouped. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source's `supportsPii`. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section in the add/edit field\n * modal. Default: none. */\n settingsSection?: FieldSettingsSection;\n}\n\n/** Everything the add/edit field modal shows for this source. */\nexport interface FieldModalInput {\n /** Title and subtitle. Default: generic titles. */\n text?: FieldModalText;\n /** The types the modal offers, in display order. Default: none. */\n types?: FieldTypeOption[];\n}\n\n/** What a caller passes. Only `collectionId` and `loadSchema` are required. */\nexport interface SchemaSourceInput<T> {\n collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n /** Sources for collections this one references, keyed by the referenced\n * collection id. A renderer resolves a reference field through the matching\n * entry — its `loadSchema` gives the referenced schema and `sourceFetchData`\n * queries the referenced items. Default: none. */\n references?: Record<string, SchemaSource<any>>;\n paginationMode?: 'offset';\n /** Stable row identity. Default: `row[idField]`. */\n itemKey?: (item: T) => string;\n /** Row display label. Default: `row[displayField]`. */\n itemName?: (item: T) => string;\n /** Fields free-text search runs against. Default: `[displayField]`. */\n searchableFieldIds?: (schema: Schema) => string[];\n /** What the add/edit field modal shows. Default: no types, generic titles. */\n fieldModal?: FieldModalInput;\n /** Consumer-defined field types: how a field of that type renders, filters and\n * validates wherever it appears. A field with `type: 'CUSTOM'` resolves its\n * definition here by `customType`. The add/edit field modal never reads this\n * — see `fieldModal`. Default: none. */\n fieldTypes?: FieldTypeDefinition[];\n /** Default: `schemaPermissions.createField`. */\n canAddFields?: (schema: Schema) => boolean;\n /** Default: `schemaPermissions.updateField && !field.isSystem`. */\n canEditField?: (field: Field, schema: Schema) => boolean;\n /** Default: `schemaPermissions.deleteField && !field.isSystem`. */\n canDeleteField?: (field: Field, schema: Schema) => boolean;\n /** Permission defaults shown in the modal. Absent ⇒ no permissions section. */\n fieldPermissions?: FieldPermissions;\n /** Default: `false`. */\n supportsPii?: boolean;\n /** The value of a field on an item. Default: `item[field.id]`. */\n getFieldValue?: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item.\n * Default: `{ ...item, [field.id]: value }`. */\n setFieldValue?: (item: T, field: Field, value: unknown) => T;\n}\n\n/** The resolved source: defaults filled, `loadSchema` memoized. */\nexport interface SchemaSource<T> {\n readonly collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n readonly paginationMode: 'offset';\n /** Stable row identity. */\n itemKey: (item: T) => string;\n /** Row display label. */\n itemName: (item: T) => string;\n /** Sources for referenced collections, keyed by referenced collection id. */\n readonly references: Record<string, SchemaSource<any>>;\n readonly fieldModal: { text?: FieldModalText; types: FieldTypeOption[] };\n readonly fieldTypes: FieldTypeDefinition[];\n searchableFieldIds: (schema: Schema) => string[];\n canAddFields: (schema: Schema) => boolean;\n canEditField: (field: Field, schema: Schema) => boolean;\n canDeleteField: (field: Field, schema: Schema) => boolean;\n readonly fieldPermissions?: FieldPermissions;\n readonly supportsPii: boolean;\n /** The value of a field on an item. */\n getFieldValue: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item. */\n setFieldValue: (item: T, field: Field, value: unknown) => T;\n}\n\ntype OffsetFind<T> = (\n query: OffsetQuery,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\n\n/** The collection fetch derived from a source: loads once, then queries the\n * backend's `find`.\n *\n * Free-text search covers the columns the page is showing: the table keeps\n * `query.columns` in sync with them, so the scope comes off the query rather\n * than being threaded in. Falls back to the source's own `searchableFieldIds`\n * before any columns are known (or with no table attached). */\nexport function sourceFetchData<T>(\n source: SchemaSource<T>,\n): (query: OffsetQuery) => Promise<OffsetQueryResult<T>> {\n return async (query) => {\n const { backend, schema } = await source.loadSchema();\n // `columns` is the visible-column list; `fields` is the projection, which a\n // source-driven table doesn't set.\n const visibleColumns = query.columns;\n return (backend.find as OffsetFind<T>)(query, {\n searchableFieldIds: visibleColumns?.length\n ? visibleColumns\n : source.searchableFieldIds(schema),\n });\n };\n}\n\n/** Fills source-neutral defaults over `input` and memoizes the load so the collection\n * query and the table columns share a single fetch. */\nexport function defineSchemaSource<T>(\n input: SchemaSourceInput<T>,\n): SchemaSource<T> {\n const {\n collectionId,\n paginationMode = 'offset',\n fieldModal = {},\n fieldTypes = [],\n fieldPermissions,\n supportsPii = false,\n references = {},\n } = input;\n\n let loaded: Promise<LoadedSchema<T>> | undefined;\n let schema: Schema | undefined;\n\n const loadSchema = () =>\n (loaded ??= input\n .loadSchema()\n .then((result) => {\n schema = result.schema;\n return result;\n })\n .catch((error) => {\n loaded = undefined;\n throw error;\n }));\n\n const searchableFieldIds =\n input.searchableFieldIds ?? ((s) => [s.displayField]);\n\n const itemKey =\n input.itemKey ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.idField ?? '_id'] ?? '',\n ));\n const itemName =\n input.itemName ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.displayField ?? '_id'] ?? '',\n ));\n const canAddFields =\n input.canAddFields ?? ((s) => s.schemaPermissions?.createField ?? false);\n const canEditField =\n input.canEditField ??\n ((field, s) =>\n (s.schemaPermissions?.updateField ?? false) && !field.isSystem);\n const canDeleteField =\n input.canDeleteField ??\n ((field, s) =>\n (s.schemaPermissions?.deleteField ?? false) && !field.isSystem);\n const getFieldValue =\n input.getFieldValue ??\n ((item, field) => (item as Record<string, unknown>)[field.id]);\n const setFieldValue =\n input.setFieldValue ??\n ((item, field, value) => ({ ...item, [field.id]: value } as T));\n\n return {\n collectionId,\n loadSchema,\n paginationMode,\n itemKey,\n itemName,\n references,\n fieldModal: { text: fieldModal.text, types: fieldModal.types ?? [] },\n fieldTypes,\n searchableFieldIds,\n canAddFields,\n canEditField,\n canDeleteField,\n fieldPermissions,\n supportsPii,\n getFieldValue,\n setFieldValue,\n };\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "All",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cairo.customFields.addCustomField.modal.add.CTA": "Add Field",
|
|
20
20
|
"cairo.import.subtitle": "Add items in bulk by uploading a CSV file.",
|
|
21
21
|
"cairo.tags.manageTags.modal.deleteModal.body.asLabels": "<text>The label <name>\"{name}\"</name> might be in use. Deleting this label will also remove it from all of the items it's assigned to.</text>",
|
|
22
|
-
"cairo.import.progressLabel": "
|
|
22
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
23
23
|
"cairo.import.done": "Done",
|
|
24
24
|
"cairo.tags.loadTags.error.CTA": "Reload Tags",
|
|
25
25
|
"cairo.appliedFilters.filteredBy.label": "Filtered by:",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
"cairo.filtersPanel.date.tomorrow": "Tomorrow",
|
|
606
606
|
"cairo.customFields.restored.success.toast": "{selectedField} was restored.",
|
|
607
607
|
"cairo.appliedFilters.selected": "{num, plural, =0 {No filters selected} one {1 filter selected} other {# filters selected}}",
|
|
608
|
-
"cairo.import.summaryTitle": "
|
|
608
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
609
609
|
"cairo.filtersPanel.date.none": "None",
|
|
610
610
|
"cairo.import.collectionField": "Collection Field",
|
|
611
611
|
"cairo.saveViewModal.cancelButton": "Cancel",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1785923099
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
"cairo.import.back": "Back",
|
|
360
360
|
"cairo.import.progressTitle": "Importing your items...",
|
|
361
361
|
"cairo.import.importing": "Importing",
|
|
362
|
-
"cairo.import.progressLabel": "
|
|
362
|
+
"cairo.import.progressLabel": "Importing rows",
|
|
363
363
|
"cairo.import.failedTitle": "Import failed",
|
|
364
364
|
"cairo.import.tryAgain": "Try Again",
|
|
365
365
|
"cairo.import.genericError": "An unexpected error occurred while importing.",
|
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
"cairo.import.discardChanges.confirm": "Discard",
|
|
516
516
|
"cairo.import.discardChanges.title": "Discard changes?",
|
|
517
517
|
"cairo.import.error.uploadFailed": "Couldn’t upload your file. Check your connection and try again.",
|
|
518
|
-
"cairo.import.summaryTitle": "
|
|
518
|
+
"cairo.import.summaryTitle": "Import Summary",
|
|
519
519
|
"cairo.import.close": "Close",
|
|
520
520
|
"cairo.import.footerText": "Not sure how to prepare CSV file?",
|
|
521
521
|
"cairo.import.skipImportedItems": "Skip imported items"
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAGL,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAGL,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4C9C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAO3E,cAAc,6BAA6B,CAAC"}
|
|
@@ -22,6 +22,10 @@ export class CustomFieldModalState {
|
|
|
22
22
|
this.enableAutoValidation();
|
|
23
23
|
throw new Error('validation');
|
|
24
24
|
}
|
|
25
|
+
if (this.settingsHasError) {
|
|
26
|
+
this.settings.setOn();
|
|
27
|
+
throw new Error('validation');
|
|
28
|
+
}
|
|
25
29
|
try {
|
|
26
30
|
const draft = this.getFormValues();
|
|
27
31
|
// Pure mode (CSV import): hand the draft back; no server mutation, no
|
|
@@ -111,11 +115,14 @@ export class CustomFieldModalState {
|
|
|
111
115
|
selectedFieldType: computed,
|
|
112
116
|
namePlaceholder: computed,
|
|
113
117
|
typeSupportsPii: computed,
|
|
118
|
+
showSettings: computed,
|
|
119
|
+
settingsHasError: computed,
|
|
114
120
|
isSubmitting: computed,
|
|
115
121
|
disabledFields: observable.ref,
|
|
116
122
|
errorToastConfig: observable.ref,
|
|
117
123
|
mode: observable.ref,
|
|
118
124
|
reset: action,
|
|
125
|
+
resetSettingsValues: action,
|
|
119
126
|
setFormValues: action,
|
|
120
127
|
generateUniqueKey: action.bound,
|
|
121
128
|
setKeyFieldIfNotDirty: action.bound,
|
|
@@ -162,6 +169,7 @@ export class CustomFieldModalState {
|
|
|
162
169
|
const { form, settings, disabledFields: { permissions }, } = this;
|
|
163
170
|
form.reset();
|
|
164
171
|
settings.setOff();
|
|
172
|
+
this.resetSettingsValues();
|
|
165
173
|
this.errorToastConfig = undefined;
|
|
166
174
|
this.disableAutoValidation();
|
|
167
175
|
permissions.read.apps = false;
|
|
@@ -169,6 +177,12 @@ export class CustomFieldModalState {
|
|
|
169
177
|
permissions.write.apps = false;
|
|
170
178
|
permissions.write.users = false;
|
|
171
179
|
}
|
|
180
|
+
/** Clears the settings sections back to their defaults. Goes over every type
|
|
181
|
+
* option rather than the picked one: `reset()` runs after the form is
|
|
182
|
+
* cleared, when no type is picked. */
|
|
183
|
+
resetSettingsValues() {
|
|
184
|
+
this.fieldManagement.fieldModal.types.forEach((type) => type.settingsSection?.setValues());
|
|
185
|
+
}
|
|
172
186
|
enableAutoValidation() {
|
|
173
187
|
const { form: { $: { key, name, type }, }, } = this;
|
|
174
188
|
key.enableAutoValidation();
|
|
@@ -192,6 +206,7 @@ export class CustomFieldModalState {
|
|
|
192
206
|
writeApps: writeApps.value,
|
|
193
207
|
writeUsers: writeUsers.value,
|
|
194
208
|
containsPii: containsPii.value,
|
|
209
|
+
settings: this.settingsSection?.getValues(type.value),
|
|
195
210
|
};
|
|
196
211
|
}
|
|
197
212
|
setFormValues(form, params) {
|
|
@@ -204,6 +219,8 @@ export class CustomFieldModalState {
|
|
|
204
219
|
$.writeApps.value = form.writeApps;
|
|
205
220
|
$.writeUsers.value = form.writeUsers;
|
|
206
221
|
$.containsPii.value = form.containsPii;
|
|
222
|
+
// After `$.type.value` above, so it lands on the picked type's section.
|
|
223
|
+
this.settingsSection?.setValues(form.field);
|
|
207
224
|
if (params?.disablePermissionCheckboxes) {
|
|
208
225
|
if (form.readUsers) {
|
|
209
226
|
this.disabledFields.permissions.read.users = true;
|
|
@@ -221,7 +238,7 @@ export class CustomFieldModalState {
|
|
|
221
238
|
}
|
|
222
239
|
setDefaultPermissions() {
|
|
223
240
|
const { form: { $ }, } = this;
|
|
224
|
-
const permissions = this.fieldManagement.permissions;
|
|
241
|
+
const permissions = this.fieldManagement.fieldModal.permissions;
|
|
225
242
|
if (!permissions?.installedApps?.hide) {
|
|
226
243
|
$.readApps.value = !!permissions?.installedApps?.defaultRead;
|
|
227
244
|
$.writeApps.value = !!permissions?.installedApps?.defaultWrite;
|
|
@@ -256,7 +273,7 @@ export class CustomFieldModalState {
|
|
|
256
273
|
return this.modalState.modal.confirming.isLoading;
|
|
257
274
|
}
|
|
258
275
|
get selectedFieldType() {
|
|
259
|
-
return this.fieldManagement.
|
|
276
|
+
return this.fieldManagement.fieldModal.types.find((option) => option.id === this.form.$.type.value);
|
|
260
277
|
}
|
|
261
278
|
get namePlaceholder() {
|
|
262
279
|
return (this.selectedFieldType?.namePlaceholder ??
|
|
@@ -272,8 +289,34 @@ export class CustomFieldModalState {
|
|
|
272
289
|
return false;
|
|
273
290
|
}
|
|
274
291
|
return (this.selectedFieldType?.supportsPii ??
|
|
275
|
-
this.fieldManagement.supportsPii ??
|
|
292
|
+
this.fieldManagement.fieldModal.supportsPii ??
|
|
276
293
|
false);
|
|
277
294
|
}
|
|
295
|
+
/** The picked type's settings section. Editing a field of a type the source
|
|
296
|
+
* can't create finds no entry for it, so it falls back to the first section
|
|
297
|
+
* the source declares — that field still has settings to show. */
|
|
298
|
+
get settingsSection() {
|
|
299
|
+
if (!this.form.$.type.value) {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
return (this.selectedFieldType?.settingsSection ??
|
|
303
|
+
this.fieldManagement.fieldModal.types.find((t) => t.settingsSection)
|
|
304
|
+
?.settingsSection);
|
|
305
|
+
}
|
|
306
|
+
/** Not a computed: the warning may read data the source loaded outside MobX,
|
|
307
|
+
* so it's called afresh on every render. Same fallback as `settingsSection`. */
|
|
308
|
+
get piiWarning() {
|
|
309
|
+
const warning = this.selectedFieldType?.piiWarning ??
|
|
310
|
+
this.fieldManagement.fieldModal.types.find((t) => t.piiWarning)
|
|
311
|
+
?.piiWarning;
|
|
312
|
+
return warning?.();
|
|
313
|
+
}
|
|
314
|
+
get showSettings() {
|
|
315
|
+
return (Boolean(this.fieldManagement.fieldModal.permissions) ||
|
|
316
|
+
Boolean(this.settingsSection));
|
|
317
|
+
}
|
|
318
|
+
get settingsHasError() {
|
|
319
|
+
return Boolean(this.settingsSection?.hasError(this.form.$.type.value));
|
|
320
|
+
}
|
|
278
321
|
}
|
|
279
322
|
//# sourceMappingURL=CustomFieldModalState.js.map
|