@asteby/metacore-runtime-react 53.25.0 → 53.27.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 +23 -0
- package/dist/action-modal-dispatcher.d.ts +3 -3
- package/dist/action-modal-dispatcher.d.ts.map +1 -1
- package/dist/action-modal-dispatcher.js +36 -31
- package/dist/action-priority.d.ts +1 -1
- package/dist/activity-diff.d.ts +1 -1
- package/dist/activity-diff.js +1 -1
- package/dist/activity-timeline.d.ts +2 -2
- package/dist/activity-timeline.js +3 -3
- package/dist/activity-value-renderer.d.ts +1 -1
- package/dist/activity-value-renderer.js +3 -3
- package/dist/addon-loader.d.ts +1 -1
- package/dist/addon-loader.js +3 -3
- package/dist/addon-page-host.js +1 -1
- package/dist/addon-page-loader.d.ts +2 -2
- package/dist/addon-page-loader.js +3 -3
- package/dist/api-context.js +4 -4
- package/dist/approval-gate.d.ts +1 -1
- package/dist/approval-gate.js +5 -5
- package/dist/assist-interview.d.ts +1 -1
- package/dist/assist-interview.js +1 -1
- package/dist/attention/index.d.ts +3 -3
- package/dist/attention/index.js +3 -3
- package/dist/attention/use-nav-badges.js +2 -2
- package/dist/attribute-classes.d.ts +1 -1
- package/dist/audit-info.d.ts +1 -1
- package/dist/audit-info.js +5 -5
- package/dist/bulk-image-dialog.d.ts +1 -1
- package/dist/bulk-image-dialog.js +5 -5
- package/dist/bulk-image-import.d.ts +2 -2
- package/dist/bulk-image-import.js +1 -1
- package/dist/bulk-image-target.d.ts +1 -1
- package/dist/bulk-image-target.js +1 -1
- package/dist/bulk-image-wizard.d.ts +1 -1
- package/dist/bulk-image-wizard.js +5 -5
- package/dist/business/catalog-product-search.d.ts +1 -1
- package/dist/business/customer-picker.js +4 -4
- package/dist/business/document-editor-model.d.ts +3 -3
- package/dist/business/document-editor-model.js +4 -4
- package/dist/business/document-editor-panels.d.ts +3 -3
- package/dist/business/document-editor-panels.js +1 -1
- package/dist/business/document-editor.d.ts +2 -2
- package/dist/business/document-editor.js +22 -22
- package/dist/business/document-lines.d.ts +2 -2
- package/dist/business/document-lines.js +3 -3
- package/dist/business/field-errors.d.ts +1 -1
- package/dist/business/field-errors.js +1 -1
- package/dist/business/format.js +1 -1
- package/dist/business/index.d.ts +29 -29
- package/dist/business/index.js +29 -29
- package/dist/business/inspection-checklist.d.ts +1 -1
- package/dist/business/inspection-checklist.js +2 -2
- package/dist/business/inspection.d.ts +1 -1
- package/dist/business/inspection.js +2 -2
- package/dist/business/line-items-editor.d.ts +3 -3
- package/dist/business/line-items-editor.js +5 -5
- package/dist/business/line-items.d.ts +1 -1
- package/dist/business/line-items.js +2 -2
- package/dist/business/line-product-cell.d.ts +2 -2
- package/dist/business/line-product-cell.js +2 -2
- package/dist/business/payment-allocator.d.ts +1 -1
- package/dist/business/payment-allocator.js +2 -2
- package/dist/business/payment-capture.d.ts +1 -1
- package/dist/business/payment-capture.js +3 -3
- package/dist/business/payment.js +1 -1
- package/dist/business/print-send-dialog.js +1 -1
- package/dist/business/product-display.d.ts +1 -1
- package/dist/business/product-options.d.ts +1 -1
- package/dist/business/product-options.js +4 -4
- package/dist/business/product-picker.d.ts +1 -1
- package/dist/business/product-picker.js +3 -3
- package/dist/business/product-search.d.ts +2 -2
- package/dist/business/product-search.js +1 -1
- package/dist/business/refund-destination.d.ts +1 -1
- package/dist/business/refund-destination.js +2 -2
- package/dist/business/refund.js +1 -1
- package/dist/business/relate-documents.js +1 -1
- package/dist/business/return-wizard.d.ts +2 -2
- package/dist/business/return-wizard.js +4 -4
- package/dist/business/return.d.ts +2 -2
- package/dist/business/return.js +2 -2
- package/dist/business/vehicle-picker.js +3 -3
- package/dist/cache-coherence.js +3 -3
- package/dist/capability-providers/index.d.ts +3 -3
- package/dist/capability-providers/index.js +3 -3
- package/dist/capability-providers/provider-sortable-list.d.ts +1 -1
- package/dist/capability-providers/provider-sortable-list.js +1 -1
- package/dist/collection-cell.js +1 -1
- package/dist/column-filter-field.d.ts +1 -1
- package/dist/column-visibility.d.ts +1 -1
- package/dist/custom-stages.d.ts +2 -2
- package/dist/custom-stages.js +1 -1
- package/dist/dashboard-grid.d.ts +1 -1
- package/dist/dashboard-grid.js +3 -3
- package/dist/dialogs/create-record-dialog.d.ts +1 -1
- package/dist/dialogs/create-record-dialog.js +1 -1
- package/dist/dialogs/dynamic-record.d.ts +15 -5
- package/dist/dialogs/dynamic-record.d.ts.map +1 -1
- package/dist/dialogs/dynamic-record.js +47 -41
- package/dist/dialogs/export.d.ts +1 -1
- package/dist/dialogs/export.js +2 -2
- package/dist/dialogs/import.d.ts +1 -1
- package/dist/dialogs/import.js +3 -3
- package/dist/dialogs/inline-relation-rows.d.ts +3 -3
- package/dist/dialogs/inline-relation-rows.js +3 -3
- package/dist/dialogs/inline-relations.d.ts +3 -3
- package/dist/dialogs/inline-relations.js +3 -3
- package/dist/dialogs/normalize-submit.d.ts +1 -1
- package/dist/dialogs/normalize-submit.js +3 -3
- package/dist/dialogs/use-inline-relations.d.ts +1 -1
- package/dist/dialogs/use-inline-relations.js +3 -3
- package/dist/dialogs/view-record-dialog.d.ts +1 -1
- package/dist/dialogs/view-record-dialog.js +1 -1
- package/dist/display-value.js +1 -1
- package/dist/document/action-bar.d.ts +1 -1
- package/dist/document/action-bar.js +1 -1
- package/dist/document/document-header.d.ts +2 -2
- package/dist/document/document-header.js +2 -2
- package/dist/document/document-page.d.ts +3 -3
- package/dist/document/document-page.js +9 -9
- package/dist/document/document-timeline.d.ts +2 -2
- package/dist/document/document-timeline.js +2 -2
- package/dist/document/evaluate.d.ts +1 -1
- package/dist/document/evaluate.js +1 -1
- package/dist/document/format.d.ts +1 -1
- package/dist/document/index.d.ts +13 -13
- package/dist/document/index.js +13 -13
- package/dist/document/registry.d.ts +1 -1
- package/dist/document/secondary-bar.js +2 -2
- package/dist/document/smart-buttons.js +1 -1
- package/dist/document/status-badge.d.ts +1 -1
- package/dist/document/use-document-sources.d.ts +1 -1
- package/dist/document/use-document-sources.js +2 -2
- package/dist/document-form-dialog.d.ts +2 -2
- package/dist/document-form-dialog.js +16 -16
- package/dist/document-template-editor.js +1 -1
- package/dist/dynamic-columns-shim.d.ts +1 -1
- package/dist/dynamic-columns.d.ts +3 -3
- package/dist/dynamic-columns.js +19 -19
- package/dist/dynamic-crud-page.d.ts +2 -2
- package/dist/dynamic-crud-page.js +13 -13
- package/dist/dynamic-date-field.d.ts +1 -1
- package/dist/dynamic-date-field.js +1 -1
- package/dist/dynamic-form-schema.d.ts +2 -2
- package/dist/dynamic-form-schema.js +4 -4
- package/dist/dynamic-form.d.ts +10 -10
- package/dist/dynamic-form.d.ts.map +1 -1
- package/dist/dynamic-form.js +31 -24
- package/dist/dynamic-icon.js +1 -1
- package/dist/dynamic-kanban.d.ts +3 -3
- package/dist/dynamic-kanban.js +25 -25
- package/dist/dynamic-line-items.d.ts +1 -1
- package/dist/dynamic-line-items.d.ts.map +1 -1
- package/dist/dynamic-line-items.js +11 -6
- package/dist/dynamic-multi-select-field.d.ts +1 -1
- package/dist/dynamic-multi-select-field.d.ts.map +1 -1
- package/dist/dynamic-multi-select-field.js +12 -12
- package/dist/dynamic-relation-helpers.d.ts +1 -1
- package/dist/dynamic-relation-helpers.js +2 -2
- package/dist/dynamic-relation.d.ts +2 -2
- package/dist/dynamic-relation.js +15 -15
- package/dist/dynamic-relations.d.ts +2 -2
- package/dist/dynamic-relations.js +1 -1
- package/dist/dynamic-row-actions.d.ts +1 -1
- package/dist/dynamic-row-actions.js +5 -5
- package/dist/dynamic-select-field.d.ts +3 -3
- package/dist/dynamic-select-field.js +11 -11
- package/dist/dynamic-table.d.ts +2 -2
- package/dist/dynamic-table.js +24 -24
- package/dist/dynamic-view.d.ts +4 -4
- package/dist/dynamic-view.js +7 -7
- package/dist/entity-select.js +4 -4
- package/dist/field-validation-ui.d.ts +2 -2
- package/dist/field-widget-registry.d.ts +1 -1
- package/dist/form-layout-ui.d.ts +1 -1
- package/dist/form-layout.d.ts +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/genui/index.d.ts +1 -1
- package/dist/genui/index.js +1 -1
- package/dist/genui/settings-block.d.ts +1 -1
- package/dist/genui/settings-block.js +3 -3
- package/dist/host-api-client.d.ts +28 -1
- package/dist/host-api-client.d.ts.map +1 -1
- package/dist/host-api-client.js +27 -14
- package/dist/host-api.d.ts +23 -1
- package/dist/host-api.d.ts.map +1 -1
- package/dist/host-api.js +79 -4
- package/dist/hotswap-reload-policy.d.ts +1 -1
- package/dist/hotswap-reload-policy.js +1 -1
- package/dist/icon-picker-field.d.ts +1 -1
- package/dist/icon-picker-field.js +3 -3
- package/dist/icon-resolvers.d.ts +1 -1
- package/dist/icon-resolvers.js +1 -1
- package/dist/icon-spec.js +1 -1
- package/dist/index.d.ts +165 -165
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -148
- package/dist/license/index.d.ts +6 -6
- package/dist/license/index.js +6 -6
- package/dist/license/license-expiry-banner.d.ts +1 -1
- package/dist/license/license-expiry-banner.js +3 -3
- package/dist/license/license-gate.d.ts +1 -1
- package/dist/license/license-gate.js +5 -5
- package/dist/license/license-status-badge.d.ts +1 -1
- package/dist/license/license-status-badge.js +1 -1
- package/dist/license/use-license-t.d.ts +1 -1
- package/dist/license/use-license-t.js +1 -1
- package/dist/license/view.d.ts +1 -1
- package/dist/license/view.js +1 -1
- package/dist/list-include.d.ts +1 -1
- package/dist/manifest-hotswap-subscriber.d.ts +1 -1
- package/dist/manifest-hotswap-subscriber.js +1 -1
- package/dist/metadata-cache.d.ts +1 -1
- package/dist/metadata-cache.js +1 -1
- package/dist/model-action-toolbar.d.ts +1 -1
- package/dist/model-action-toolbar.js +7 -7
- package/dist/nav-permissions.d.ts +1 -1
- package/dist/nav-permissions.js +1 -1
- package/dist/navigation-builder.d.ts +1 -1
- package/dist/navigation-builder.js +1 -1
- package/dist/option-display.d.ts +1 -1
- package/dist/option-display.js +2 -2
- package/dist/option-filter.d.ts +1 -1
- package/dist/option-when.d.ts +1 -1
- package/dist/org-runtime-provider.d.ts +2 -2
- package/dist/org-runtime-provider.js +2 -2
- package/dist/permissions-context.d.ts +1 -1
- package/dist/permissions-manager.js +4 -4
- package/dist/primitives/aging.js +1 -1
- package/dist/primitives/allocation.js +1 -1
- package/dist/primitives/approvals.d.ts +1 -1
- package/dist/primitives/contributions.js +1 -1
- package/dist/primitives/document-kinds.d.ts +1 -1
- package/dist/primitives/index.d.ts +7 -7
- package/dist/primitives/index.js +7 -7
- package/dist/primitives/panels.d.ts +1 -1
- package/dist/primitives/use-contributions.d.ts +2 -2
- package/dist/primitives/use-contributions.js +2 -2
- package/dist/print-document-button.d.ts +1 -1
- package/dist/print-document-button.js +1 -1
- package/dist/provenance.js +3 -3
- package/dist/query-batch.d.ts +1 -1
- package/dist/query-batch.js +1 -1
- package/dist/record-actions.d.ts +2 -2
- package/dist/record-actions.js +2 -2
- package/dist/record-history.d.ts +2 -2
- package/dist/record-history.js +3 -3
- package/dist/record-picker-dialog.js +3 -3
- package/dist/record-picker-option.d.ts +1 -1
- package/dist/record-picker-option.js +1 -1
- package/dist/record-picker.d.ts +5 -0
- package/dist/record-picker.d.ts.map +1 -1
- package/dist/record-picker.js +16 -6
- package/dist/record-prefill-bar.js +1 -1
- package/dist/relation-gallery.js +1 -1
- package/dist/requires-addon.d.ts +1 -1
- package/dist/rich-cells.js +2 -2
- package/dist/rich-url.js +1 -1
- package/dist/row-actions-menu.js +5 -5
- package/dist/searchable-select-field.d.ts +33 -0
- package/dist/searchable-select-field.d.ts.map +1 -0
- package/dist/searchable-select-field.js +50 -0
- package/dist/searchable-select.d.ts +45 -0
- package/dist/searchable-select.d.ts.map +1 -0
- package/dist/searchable-select.js +72 -0
- package/dist/server-error.js +2 -2
- package/dist/setup/addon-config-surface.d.ts +3 -3
- package/dist/setup/addon-config-surface.js +10 -10
- package/dist/setup/connector-blocks-model.d.ts +1 -1
- package/dist/setup/connector-blocks.d.ts +1 -1
- package/dist/setup/connector-blocks.js +6 -6
- package/dist/setup/flow-model.d.ts +1 -1
- package/dist/setup/health-card.d.ts +1 -1
- package/dist/setup/health-card.js +2 -2
- package/dist/setup/index.d.ts +12 -12
- package/dist/setup/index.js +12 -12
- package/dist/setup/records-table.d.ts +1 -1
- package/dist/setup/records-table.js +2 -2
- package/dist/setup/setup-flow.d.ts +1 -1
- package/dist/setup/setup-flow.js +7 -7
- package/dist/setup/setup-form-step.d.ts +1 -1
- package/dist/setup/setup-form-step.js +4 -4
- package/dist/setup/step-status-badge.d.ts +1 -1
- package/dist/setup/step-status-badge.js +2 -2
- package/dist/setup/tone.d.ts +1 -1
- package/dist/setup/types.d.ts +2 -2
- package/dist/sidebar-layout-manager.d.ts +1 -1
- package/dist/sidebar-layout-manager.js +2 -2
- package/dist/slot.js +1 -1
- package/dist/slots/addon-slot.js +4 -4
- package/dist/slots/index.d.ts +2 -2
- package/dist/slots/index.js +2 -2
- package/dist/stage-automations.d.ts +2 -2
- package/dist/stage-automations.js +1 -1
- package/dist/stage-layout.js +1 -1
- package/dist/stage-overrides.d.ts +1 -1
- package/dist/stage-overrides.js +1 -1
- package/dist/supervised-action.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/tri-state-boolean.d.ts +2 -2
- package/dist/tri-state-boolean.js +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/upload-field.d.ts +1 -1
- package/dist/upload-field.js +4 -4
- package/dist/use-addon-installed-probe.js +3 -3
- package/dist/use-addon-settings.d.ts +1 -1
- package/dist/use-addon-settings.js +1 -1
- package/dist/use-dynamic-filters.d.ts +2 -2
- package/dist/use-dynamic-filters.js +6 -6
- package/dist/use-edge-device.d.ts +1 -1
- package/dist/use-edge-device.js +2 -2
- package/dist/use-facet-loaders.d.ts +1 -1
- package/dist/use-facet-loaders.js +1 -1
- package/dist/use-flip-animation.d.ts +1 -1
- package/dist/use-flip-animation.js +1 -1
- package/dist/use-host-api-client.d.ts +2 -2
- package/dist/use-host-api-client.d.ts.map +1 -1
- package/dist/use-host-api-client.js +6 -4
- package/dist/use-option-ids.d.ts +1 -1
- package/dist/use-option-ids.js +2 -2
- package/dist/use-options-resolver.d.ts +2 -2
- package/dist/use-options-resolver.js +4 -4
- package/dist/use-org-document-templates.js +1 -1
- package/dist/use-print-document.js +1 -1
- package/dist/use-record-mutation-tick.js +1 -1
- package/dist/validator.d.ts +2 -2
- package/dist/validator.js +1 -1
- package/dist/view-system/card-spec.d.ts +1 -1
- package/dist/view-system/cards-view.d.ts +1 -1
- package/dist/view-system/cards-view.js +2 -2
- package/dist/view-system/index.d.ts +9 -9
- package/dist/view-system/index.js +9 -9
- package/dist/view-system/model-view.d.ts +3 -3
- package/dist/view-system/model-view.js +7 -7
- package/dist/view-system/saved-views.d.ts +1 -1
- package/dist/view-system/use-view-mode.d.ts +1 -1
- package/dist/view-system/view-state.d.ts +1 -1
- package/dist/view-system/view-switcher.d.ts +1 -1
- package/dist/view-system/view-toolbar.d.ts +1 -1
- package/dist/view-system/view-toolbar.js +2 -2
- package/dist/views/calendar-view.d.ts +1 -1
- package/dist/views/calendar-view.js +2 -2
- package/dist/views/chart-view.d.ts +2 -2
- package/dist/views/chart-view.js +2 -2
- package/dist/views/data-source.d.ts +2 -2
- package/dist/views/index.d.ts +3 -3
- package/dist/views/index.js +2 -2
- package/dist/views/map-view.d.ts +1 -1
- package/dist/views/map-view.js +3 -3
- package/dist/views/panels.d.ts +1 -1
- package/dist/views/panels.js +3 -3
- package/dist/views/registry.d.ts +2 -2
- package/dist/views/registry.js +12 -12
- package/dist/views/split-view.d.ts +1 -1
- package/dist/views/split-view.js +4 -4
- package/dist/views/timeline-view.d.ts +1 -1
- package/dist/views/timeline-view.js +3 -3
- package/dist/views/types.d.ts +2 -2
- package/dist/widgets/charts.d.ts +1 -1
- package/dist/widgets/charts.js +2 -2
- package/dist/widgets/lazy-charts.d.ts +1 -1
- package/dist/widgets/lazy-charts.js +2 -2
- package/dist/widgets/renderers.d.ts +2 -2
- package/dist/widgets/renderers.js +2 -2
- package/dist/widgets/widget-card.d.ts +1 -1
- package/dist/widgets/widget-card.js +2 -2
- package/dist/widgets/widget-renderer.d.ts +1 -1
- package/dist/widgets/widget-renderer.js +4 -4
- package/package.json +9 -9
- package/src/__tests__/host-api-client.test.tsx +28 -0
- package/src/__tests__/host-api.test.ts +91 -0
- package/src/__tests__/searchable-select.test.tsx +247 -0
- package/src/action-modal-dispatcher.tsx +16 -0
- package/src/dialogs/dynamic-record.tsx +26 -0
- package/src/dynamic-form.tsx +17 -0
- package/src/dynamic-line-items.tsx +17 -0
- package/src/dynamic-multi-select-field.tsx +5 -4
- package/src/host-api-client.ts +51 -15
- package/src/host-api.ts +81 -3
- package/src/index.ts +2 -1
- package/src/record-picker.tsx +32 -3
- package/src/searchable-select-field.tsx +134 -0
- package/src/searchable-select.ts +87 -0
- package/src/types.ts +12 -0
- package/src/use-host-api-client.ts +5 -3
|
@@ -11,12 +11,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { Input, Textarea, Switch, Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@asteby/metacore-ui/primitives';
|
|
12
12
|
import { useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { Plus, Trash2, Check } from 'lucide-react';
|
|
14
|
-
import { usesTriState } from './nullable-boolean';
|
|
15
|
-
import { TriStateBooleanField } from './tri-state-boolean';
|
|
16
|
-
import { resolveWidget, getItemFields, computeLineItemTotals, applyLineItemRowFormulas, autofillLineFromOption, evaluateBalance, toNumber, getDependsOn, resolveDependsValue, getOptionsConfig, resolveOptionsSource, applyOptionWhen, } from './dynamic-form-schema';
|
|
17
|
-
import { DynamicSelectField, DEFAULT_DEPENDS_HINT } from './dynamic-select-field';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
14
|
+
import { usesTriState } from './nullable-boolean.js';
|
|
15
|
+
import { TriStateBooleanField } from './tri-state-boolean.js';
|
|
16
|
+
import { resolveWidget, getItemFields, computeLineItemTotals, applyLineItemRowFormulas, autofillLineFromOption, evaluateBalance, toNumber, getDependsOn, resolveDependsValue, getOptionsConfig, resolveOptionsSource, applyOptionWhen, } from './dynamic-form-schema.js';
|
|
17
|
+
import { DynamicSelectField, DEFAULT_DEPENDS_HINT } from './dynamic-select-field.js';
|
|
18
|
+
import { SearchableSelectField } from './searchable-select-field.js';
|
|
19
|
+
import { isSearchableSelect } from './searchable-select.js';
|
|
20
|
+
import { getOptionFilter } from './option-filter.js';
|
|
21
|
+
import { useOptionsResolver } from './use-options-resolver.js';
|
|
20
22
|
const fmtNumber = (n) => n.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
21
23
|
/** Numeric columns render right-aligned (debit/credit/amount feel). */
|
|
22
24
|
function isNumericCol(col) {
|
|
@@ -170,6 +172,9 @@ function CellRenderer({ field, value, onChange, onPick, disabled, formValues, ro
|
|
|
170
172
|
// No option applies under the current sibling value → hide the cell.
|
|
171
173
|
if (effectiveOptions && effectiveOptions.length === 0)
|
|
172
174
|
return null;
|
|
175
|
+
if (isSearchableSelect(field, opts?.length ?? 0)) {
|
|
176
|
+
return (_jsx(SearchableSelectField, { id: field.key, ariaLabel: field.label || field.key, options: opts ?? [], value: value, onChange: onChange, placeholder: field.placeholder || undefined, required: !!field.required, disabled: off, invalid: invalid }));
|
|
177
|
+
}
|
|
173
178
|
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: off, children: [_jsx(SelectTrigger, { className: 'w-full' + (invalidCls ? ` ${invalidCls}` : ''), "aria-invalid": invalid || undefined, children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: opts?.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] }));
|
|
174
179
|
}
|
|
175
180
|
case 'switch':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-multi-select-field.d.ts","sourceRoot":"","sources":["../src/dynamic-multi-select-field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-multi-select-field.d.ts","sourceRoot":"","sources":["../src/dynamic-multi-select-field.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,cAAc,CAAA;IACrB,qFAAqF;IACrF,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACnC;;;;OAIG;IACH,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACpG;AAED,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,4BAA4B,+BA6E9G"}
|
|
@@ -23,13 +23,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
// with ONE `?ids=` lookup (useResolveOptionIds): a chip reads "Cargando…" while
|
|
24
24
|
// it resolves and "(registro eliminado)" when the record is gone — never the id.
|
|
25
25
|
import { useMemo, useState } from 'react';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
26
|
+
import { filterSearchableOptions } from './searchable-select.js';
|
|
27
|
+
import { getOptionFilter } from './option-filter.js';
|
|
28
|
+
import { RecordPicker } from './record-picker.js';
|
|
29
|
+
import { OptionLead } from './record-picker-option.js';
|
|
30
|
+
import { useOptionsResolver } from './use-options-resolver.js';
|
|
31
|
+
import { useResolveOptionIds } from './use-option-ids.js';
|
|
32
|
+
import { DELETED_RECORD_LABEL } from './dynamic-select-field.js';
|
|
33
|
+
import { getFieldRef } from './dynamic-form-schema.js';
|
|
33
34
|
export function DynamicMultiSelectField({ field, value, onChange, staticOptions }) {
|
|
34
35
|
const ref = getFieldRef(field);
|
|
35
36
|
const [query, setQuery] = useState('');
|
|
@@ -72,13 +73,12 @@ export function DynamicMultiSelectField({ field, value, onChange, staticOptions
|
|
|
72
73
|
const label = useStatic ? id : !r ? 'Cargando…' : r.status === 'missing' ? DELETED_RECORD_LABEL : id;
|
|
73
74
|
return { id, value: id, label, name: label };
|
|
74
75
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [options, query]);
|
|
76
|
+
// Case/accent-insensitive, by label, code and description (shared with the
|
|
77
|
+
// single searchable select); order kept inside each relevance rank.
|
|
78
|
+
const shown = useMemo(() => filterSearchableOptions(options, query), [options, query]);
|
|
79
79
|
const toggle = (o) => {
|
|
80
80
|
const id = String(o.id);
|
|
81
81
|
onChange(selected.includes(id) ? selected.filter((x) => x !== id) : [...selected, id]);
|
|
82
82
|
};
|
|
83
|
-
return (_jsx(RecordPicker, { multiple: true, slot: "dynamic-multi-select", id: field.key, items: shown, loading: loading, getKey: (o) => String(o.id), getLabel: (o) => o.label, renderLead: (o) => _jsx(OptionLead, { option: o, size: 20 }), getDescription: (o) => o.description, value: selected, selected: selectedItems, onSelect: toggle, onRemove: toggle, query: query, onQueryChange: setQuery, placeholder: loading ? 'Cargando…' : field.placeholder || 'Seleccionar...', searchPlaceholder: "Buscar...", emptyText: "Sin resultados." }));
|
|
83
|
+
return (_jsx(RecordPicker, { multiple: true, slot: "dynamic-multi-select", id: field.key, items: shown, loading: loading, getKey: (o) => String(o.id), getLabel: (o) => o.label, renderLead: (o) => _jsx(OptionLead, { option: o, size: 20 }), getDescription: (o) => o.description, highlightQuery: true, value: selected, selected: selectedItems, onSelect: toggle, onRemove: toggle, query: query, onQueryChange: setQuery, placeholder: loading ? 'Cargando…' : field.placeholder || 'Seleccionar...', searchPlaceholder: "Buscar...", emptyText: "Sin resultados." }));
|
|
84
84
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionFieldDef, ColumnDefinition, TableMetadata } from './types';
|
|
1
|
+
import type { ActionFieldDef, ColumnDefinition, TableMetadata } from './types.js';
|
|
2
2
|
export type DynamicRelationKind = 'one_to_many' | 'many_to_many';
|
|
3
3
|
export declare function isManagedRelationColumn(key: string): boolean;
|
|
4
4
|
export declare function relationMediaKind(col: ColumnDefinition): 'image' | 'file' | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isNilUuid } from './nil-uuid';
|
|
2
|
-
import { humanizeToken } from './dynamic-columns-helpers';
|
|
1
|
+
import { isNilUuid } from './nil-uuid.js';
|
|
2
|
+
import { humanizeToken } from './dynamic-columns-helpers.js';
|
|
3
3
|
// An enum-like column renders a single token value (status/select/option/badge)
|
|
4
4
|
// rather than free text, so an unmatched value should be humanized, not leaked.
|
|
5
5
|
function isEnumLikeColumn(col) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { DynamicRelationKind } from './dynamic-relation-helpers';
|
|
2
|
-
export { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, formatRelationCell, objectLabel, pickOptionLabel, relationRowKey, } from './dynamic-relation-helpers';
|
|
1
|
+
export type { DynamicRelationKind } from './dynamic-relation-helpers.js';
|
|
2
|
+
export { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, formatRelationCell, objectLabel, pickOptionLabel, relationRowKey, } from './dynamic-relation-helpers.js';
|
|
3
3
|
export interface DynamicRelationStrings {
|
|
4
4
|
title: string;
|
|
5
5
|
emptyState: string;
|
package/dist/dynamic-relation.js
CHANGED
|
@@ -10,22 +10,22 @@ import { flexRender, getCoreRowModel, useReactTable, } from '@tanstack/react-tab
|
|
|
10
10
|
import { cn } from '@asteby/metacore-ui/lib';
|
|
11
11
|
import { Button, Skeleton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Dialog, DialogContent, DialogHeader, DialogTitle, Input, MultiSelect, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@asteby/metacore-ui/primitives';
|
|
12
12
|
import { Plus, Trash2, Pencil, Search } from 'lucide-react';
|
|
13
|
-
import { useApi } from './api-context';
|
|
14
|
-
import { useMetadataCache } from './metadata-cache';
|
|
15
|
-
import { cacheScope } from './cache-scope';
|
|
16
|
-
import { OptionsContext } from './options-context';
|
|
17
|
-
import { DynamicForm } from './dynamic-form';
|
|
18
|
-
import { useImageUrl } from './image-url-context';
|
|
19
|
-
import { useTimeZone, useCurrency } from './org-runtime-context';
|
|
20
|
-
import { makeDefaultGetDynamicColumns } from './dynamic-columns';
|
|
21
|
-
import { isColumnVisibleInLineSubtable } from './column-visibility';
|
|
22
|
-
import { useOptionsResolver } from './use-options-resolver';
|
|
23
|
-
import { dedupeById, useInfiniteScrollSentinel } from './use-infinite-scroll';
|
|
13
|
+
import { useApi } from './api-context.js';
|
|
14
|
+
import { useMetadataCache } from './metadata-cache.js';
|
|
15
|
+
import { cacheScope } from './cache-scope.js';
|
|
16
|
+
import { OptionsContext } from './options-context.js';
|
|
17
|
+
import { DynamicForm } from './dynamic-form.js';
|
|
18
|
+
import { useImageUrl } from './image-url-context.js';
|
|
19
|
+
import { useTimeZone, useCurrency } from './org-runtime-context.js';
|
|
20
|
+
import { makeDefaultGetDynamicColumns } from './dynamic-columns.js';
|
|
21
|
+
import { isColumnVisibleInLineSubtable } from './column-visibility.js';
|
|
22
|
+
import { useOptionsResolver } from './use-options-resolver.js';
|
|
23
|
+
import { dedupeById, useInfiniteScrollSentinel } from './use-infinite-scroll.js';
|
|
24
24
|
import { toast } from 'sonner';
|
|
25
|
-
import { RelationGallery } from './relation-gallery';
|
|
26
|
-
import { extractUploadedValue, readImageSize } from './upload-field';
|
|
27
|
-
import { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, pickOptionLabel, relationColumnUi, relationDerivedValues, galleryLeadImage, contiguousPositionUpdates, relationGalleryColumn, relationInitialValues, relationPositionKey, relationPositionSortable, relationRowKey, sortRelationRows, } from './dynamic-relation-helpers';
|
|
28
|
-
export { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, formatRelationCell, objectLabel, pickOptionLabel, relationRowKey, } from './dynamic-relation-helpers';
|
|
25
|
+
import { RelationGallery } from './relation-gallery.js';
|
|
26
|
+
import { extractUploadedValue, readImageSize } from './upload-field.js';
|
|
27
|
+
import { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, pickOptionLabel, relationColumnUi, relationDerivedValues, galleryLeadImage, contiguousPositionUpdates, relationGalleryColumn, relationInitialValues, relationPositionKey, relationPositionSortable, relationRowKey, sortRelationRows, } from './dynamic-relation-helpers.js';
|
|
28
|
+
export { buildCreatePayload, buildPivotAttachPayload, buildPivotRowIndex, buildRelationFilterParams, deriveRelationFormFields, diffSelection, extractSelectedTargetIds, formatRelationCell, objectLabel, pickOptionLabel, relationRowKey, } from './dynamic-relation-helpers.js';
|
|
29
29
|
const DEFAULT_STRINGS = {
|
|
30
30
|
title: '',
|
|
31
31
|
emptyState: 'No hay registros relacionados.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type DynamicRelationStrings } from './dynamic-relation';
|
|
2
|
-
import type { RelationMeta } from './types';
|
|
1
|
+
import { type DynamicRelationStrings } from './dynamic-relation.js';
|
|
2
|
+
import type { RelationMeta } from './types.js';
|
|
3
3
|
export interface DynamicRelationsProps {
|
|
4
4
|
/**
|
|
5
5
|
* The parent record. Its `id` (or `parentIdKey`) seeds every child list's
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
// is scoped by the FK AND every scope column.
|
|
14
14
|
import { useMemo } from 'react';
|
|
15
15
|
import { cn } from '@asteby/metacore-ui/lib';
|
|
16
|
-
import { DynamicRelation } from './dynamic-relation';
|
|
16
|
+
import { DynamicRelation } from './dynamic-relation.js';
|
|
17
17
|
/**
|
|
18
18
|
* Normalizes the parent id off the record, tolerating a custom `parentIdKey`.
|
|
19
19
|
* Returns `undefined` when unusable so callers can guard rendering.
|
|
@@ -25,11 +25,11 @@ import { useNavigate } from '@tanstack/react-router';
|
|
|
25
25
|
import { useTranslation } from 'react-i18next';
|
|
26
26
|
import { toast } from 'sonner';
|
|
27
27
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@asteby/metacore-ui/primitives';
|
|
28
|
-
import { useApi } from './api-context';
|
|
29
|
-
import { useReasonPrompt } from './reason-prompt';
|
|
30
|
-
import { ActionModalDispatcher } from './action-modal-dispatcher';
|
|
31
|
-
import { DynamicRecordDialog } from './dialogs/dynamic-record';
|
|
32
|
-
import { RequiresAddonDialog, resolveRequiresAddon } from './requires-addon';
|
|
28
|
+
import { useApi } from './api-context.js';
|
|
29
|
+
import { useReasonPrompt } from './reason-prompt.js';
|
|
30
|
+
import { ActionModalDispatcher } from './action-modal-dispatcher.js';
|
|
31
|
+
import { DynamicRecordDialog } from './dialogs/dynamic-record.js';
|
|
32
|
+
import { RequiresAddonDialog, resolveRequiresAddon } from './requires-addon.js';
|
|
33
33
|
/**
|
|
34
34
|
* Destino de una acción link. La query (`?create=…&from_id=…`) va como `search`:
|
|
35
35
|
* metida en `to` el router la tomaba como parte del path y la ruta no casaba.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ResolvedOption } from './use-options-resolver';
|
|
2
|
-
import type { ActionFieldDef } from './types';
|
|
3
|
-
export { OptionLead, OptionThumb } from './record-picker-option';
|
|
1
|
+
import { type ResolvedOption } from './use-options-resolver.js';
|
|
2
|
+
import type { ActionFieldDef } from './types.js';
|
|
3
|
+
export { OptionLead, OptionThumb } from './record-picker-option.js';
|
|
4
4
|
/**
|
|
5
5
|
* Default hint shown when a cascading picker's depended-on field is still
|
|
6
6
|
* empty. Domain-neutral on purpose; a caller may override it per field via
|
|
@@ -25,20 +25,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
25
25
|
// the same ref on screen). While it resolves the trigger reads "Cargando…",
|
|
26
26
|
// never the raw id; an id that no longer exists reads "(registro eliminado)".
|
|
27
27
|
import { useEffect, useRef, useState } from 'react';
|
|
28
|
-
import { getOptionFilter } from './option-filter';
|
|
28
|
+
import { getOptionFilter } from './option-filter.js';
|
|
29
29
|
import { useTranslation } from 'react-i18next';
|
|
30
30
|
import { Badge, Button } from '@asteby/metacore-ui/primitives';
|
|
31
31
|
import { Check, ScanLine } from 'lucide-react';
|
|
32
|
-
import { BarcodeScanner } from './barcode-scanner';
|
|
33
|
-
import { RecordPicker } from './record-picker';
|
|
34
|
-
import { OptionLead } from './record-picker-option';
|
|
35
|
-
import { OptionDisplayRow, OptionDisplayValue, getOptionDisplay, hasOptionDisplays } from './option-display';
|
|
36
|
-
import { recordLabel, requestRecordCreate, requestRecordEdit, withSearchPrefill } from './record-picker-actions';
|
|
37
|
-
import { useOptionsResolver } from './use-options-resolver';
|
|
38
|
-
import { useResolveOptionIds } from './use-option-ids';
|
|
39
|
-
import { useDebouncedValue } from './use-debounced-value';
|
|
40
|
-
import { getDependsOn, getFieldRef, resolveOptionsSource } from './dynamic-form-schema';
|
|
41
|
-
export { OptionLead, OptionThumb } from './record-picker-option';
|
|
32
|
+
import { BarcodeScanner } from './barcode-scanner.js';
|
|
33
|
+
import { RecordPicker } from './record-picker.js';
|
|
34
|
+
import { OptionLead } from './record-picker-option.js';
|
|
35
|
+
import { OptionDisplayRow, OptionDisplayValue, getOptionDisplay, hasOptionDisplays } from './option-display.js';
|
|
36
|
+
import { recordLabel, requestRecordCreate, requestRecordEdit, withSearchPrefill } from './record-picker-actions.js';
|
|
37
|
+
import { useOptionsResolver } from './use-options-resolver.js';
|
|
38
|
+
import { useResolveOptionIds } from './use-option-ids.js';
|
|
39
|
+
import { useDebouncedValue } from './use-debounced-value.js';
|
|
40
|
+
import { getDependsOn, getFieldRef, resolveOptionsSource } from './dynamic-form-schema.js';
|
|
41
|
+
export { OptionLead, OptionThumb } from './record-picker-option.js';
|
|
42
42
|
/**
|
|
43
43
|
* Default hint shown when a cascading picker's depended-on field is still
|
|
44
44
|
* empty. Domain-neutral on purpose; a caller may override it per field via
|
package/dist/dynamic-table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ColumnDef } from '@tanstack/react-table';
|
|
3
|
-
import type { GetDynamicColumns, RowActionPredicate } from './dynamic-columns-shim';
|
|
4
|
-
import type { ActionDefinition } from './types';
|
|
3
|
+
import type { GetDynamicColumns, RowActionPredicate } from './dynamic-columns-shim.js';
|
|
4
|
+
import type { ActionDefinition } from './types.js';
|
|
5
5
|
/** Drops every persisted first-page row set (all scopes). */
|
|
6
6
|
export declare function clearTableDataCache(): void;
|
|
7
7
|
export interface DynamicTableProps {
|
package/dist/dynamic-table.js
CHANGED
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
// column cells are tightly coupled to their design system).
|
|
14
14
|
import { useEffect, useState, useMemo, useCallback, useRef } from 'react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useTimeZone, useCurrency, useNumberLocale } from './org-runtime-context';
|
|
16
|
+
import { useTimeZone, useCurrency, useNumberLocale } from './org-runtime-context.js';
|
|
17
17
|
import { format } from 'date-fns';
|
|
18
18
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
19
19
|
import { flexRender, getCoreRowModel, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
@@ -24,29 +24,29 @@ import { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, Table
|
|
|
24
24
|
import { DataTablePagination, DataTableToolbar, DataTableBulkActions, } from '@asteby/metacore-ui/data-table';
|
|
25
25
|
import { Inbox, Download, Upload, Trash2 } from 'lucide-react';
|
|
26
26
|
import { toast } from 'sonner';
|
|
27
|
-
import { Progress } from './dialogs/_primitives';
|
|
28
|
-
import { useMetadataCache } from './metadata-cache';
|
|
29
|
-
import { cacheScope, onCacheScopeChange, peekCacheScope } from './cache-scope';
|
|
30
|
-
import { useRecordMutationTick } from './use-record-mutation-tick';
|
|
31
|
-
import { useApi, useCurrentBranch } from './api-context';
|
|
32
|
-
import { useReasonPrompt } from './reason-prompt';
|
|
33
|
-
import { defaultGetDynamicColumns, DATE_CELL_TYPES, aggregateOf, formatAggregateTotal } from './dynamic-columns';
|
|
34
|
-
import { useFacetLoaders, isLongTextColumn } from './use-facet-loaders';
|
|
35
|
-
import { translateOptionLabels } from './filter-chips';
|
|
36
|
-
import { withBooleanUnsetOption } from './nullable-boolean';
|
|
37
|
-
import { applyColumnFilterFields } from './column-filter-field';
|
|
38
|
-
import { dedupeById, useInfiniteScrollSentinel } from './use-infinite-scroll';
|
|
39
|
-
import { DYNAMIC_TABLE_CARD_ESTIMATE_PX, DYNAMIC_TABLE_ROW_ESTIMATE_PX, resolveVirtualizeThreshold, } from './table-virtualization';
|
|
40
|
-
import { OptionsContext } from './options-context';
|
|
41
|
-
import { RowActionsModelContext } from './row-actions-menu';
|
|
42
|
-
import { getSearchableColumnKeys } from './column-visibility';
|
|
43
|
-
import { visibleRelationInclude } from './list-include';
|
|
44
|
-
import { useDebouncedValue } from './use-debounced-value';
|
|
45
|
-
import { useCan, usePermissionsActive, useRoleGate, gateTableMetadata, modelCapability } from './permissions-context';
|
|
46
|
-
import { useDynamicRowActions } from './dynamic-row-actions';
|
|
47
|
-
import { ExportDialog } from './dialogs/export';
|
|
48
|
-
import { ImportDialog } from './dialogs/import';
|
|
49
|
-
import { buildListScopeValues, evaluateVisibleWhenForListScope, getVisibleWhen, scopeValueFromFilterToken, } from './dynamic-form-schema';
|
|
27
|
+
import { Progress } from './dialogs/_primitives.js';
|
|
28
|
+
import { useMetadataCache } from './metadata-cache.js';
|
|
29
|
+
import { cacheScope, onCacheScopeChange, peekCacheScope } from './cache-scope.js';
|
|
30
|
+
import { useRecordMutationTick } from './use-record-mutation-tick.js';
|
|
31
|
+
import { useApi, useCurrentBranch } from './api-context.js';
|
|
32
|
+
import { useReasonPrompt } from './reason-prompt.js';
|
|
33
|
+
import { defaultGetDynamicColumns, DATE_CELL_TYPES, aggregateOf, formatAggregateTotal } from './dynamic-columns.js';
|
|
34
|
+
import { useFacetLoaders, isLongTextColumn } from './use-facet-loaders.js';
|
|
35
|
+
import { translateOptionLabels } from './filter-chips.js';
|
|
36
|
+
import { withBooleanUnsetOption } from './nullable-boolean.js';
|
|
37
|
+
import { applyColumnFilterFields } from './column-filter-field.js';
|
|
38
|
+
import { dedupeById, useInfiniteScrollSentinel } from './use-infinite-scroll.js';
|
|
39
|
+
import { DYNAMIC_TABLE_CARD_ESTIMATE_PX, DYNAMIC_TABLE_ROW_ESTIMATE_PX, resolveVirtualizeThreshold, } from './table-virtualization.js';
|
|
40
|
+
import { OptionsContext } from './options-context.js';
|
|
41
|
+
import { RowActionsModelContext } from './row-actions-menu.js';
|
|
42
|
+
import { getSearchableColumnKeys } from './column-visibility.js';
|
|
43
|
+
import { visibleRelationInclude } from './list-include.js';
|
|
44
|
+
import { useDebouncedValue } from './use-debounced-value.js';
|
|
45
|
+
import { useCan, usePermissionsActive, useRoleGate, gateTableMetadata, modelCapability } from './permissions-context.js';
|
|
46
|
+
import { useDynamicRowActions } from './dynamic-row-actions.js';
|
|
47
|
+
import { ExportDialog } from './dialogs/export.js';
|
|
48
|
+
import { ImportDialog } from './dialogs/import.js';
|
|
49
|
+
import { buildListScopeValues, evaluateVisibleWhenForListScope, getVisibleWhen, scopeValueFromFilterToken, } from './dynamic-form-schema.js';
|
|
50
50
|
// ---------------------------------------------------------------------------
|
|
51
51
|
// Row-data cache (perceived performance).
|
|
52
52
|
//
|
package/dist/dynamic-view.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type DynamicTableProps } from './dynamic-table';
|
|
2
|
-
import { type DynamicKanbanProps } from './dynamic-kanban';
|
|
3
|
-
import type { TableMetadata } from './types';
|
|
4
|
-
import type { ViewDataSource } from './views/types';
|
|
1
|
+
import { type DynamicTableProps } from './dynamic-table.js';
|
|
2
|
+
import { type DynamicKanbanProps } from './dynamic-kanban.js';
|
|
3
|
+
import type { TableMetadata } from './types.js';
|
|
4
|
+
import type { ViewDataSource } from './views/types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Pure routing decision: which renderer a `view_type` maps onto. Exported so a
|
|
7
7
|
* host that resolves metadata itself can branch without mounting this wrapper.
|
package/dist/dynamic-view.js
CHANGED
|
@@ -15,13 +15,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
// read this wrapper does to learn `view_type` is served from the same cache —
|
|
16
16
|
// no duplicate network round-trip in practice.
|
|
17
17
|
import { useEffect, useMemo, useState } from 'react';
|
|
18
|
-
import { useApi } from './api-context';
|
|
19
|
-
import { useMetadataCache } from './metadata-cache';
|
|
20
|
-
import { cacheScope } from './cache-scope';
|
|
21
|
-
import { DynamicTable } from './dynamic-table';
|
|
22
|
-
import { DynamicKanban } from './dynamic-kanban';
|
|
23
|
-
import { DeclarativeView, isDeclarativeViewType } from './views/registry';
|
|
24
|
-
import { createApiViewDataSource } from './views/data-source';
|
|
18
|
+
import { useApi } from './api-context.js';
|
|
19
|
+
import { useMetadataCache } from './metadata-cache.js';
|
|
20
|
+
import { cacheScope } from './cache-scope.js';
|
|
21
|
+
import { DynamicTable } from './dynamic-table.js';
|
|
22
|
+
import { DynamicKanban } from './dynamic-kanban.js';
|
|
23
|
+
import { DeclarativeView, isDeclarativeViewType } from './views/registry.js';
|
|
24
|
+
import { createApiViewDataSource } from './views/data-source.js';
|
|
25
25
|
/**
|
|
26
26
|
* Pure routing decision: which renderer a `view_type` maps onto. Exported so a
|
|
27
27
|
* host that resolves metadata itself can branch without mounting this wrapper.
|
package/dist/entity-select.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { RecordPicker, useLatestSearch } from './record-picker';
|
|
3
|
-
import { recordLabel } from './record-picker-actions';
|
|
4
|
-
import { useRecordPickerDialog } from './record-picker-dialog';
|
|
5
|
-
import { useCan } from './permissions-context';
|
|
2
|
+
import { RecordPicker, useLatestSearch } from './record-picker.js';
|
|
3
|
+
import { recordLabel } from './record-picker-actions.js';
|
|
4
|
+
import { useRecordPickerDialog } from './record-picker-dialog.js';
|
|
5
|
+
import { useCan } from './permissions-context.js';
|
|
6
6
|
/** Lowercase model → permission capability namespace (Supplier → supplier). */
|
|
7
7
|
function capabilityNamespace(model) {
|
|
8
8
|
return model.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActionFieldDef } from './types';
|
|
2
|
-
import type { Translate } from './server-error';
|
|
1
|
+
import type { ActionFieldDef } from './types.js';
|
|
2
|
+
import type { Translate } from './server-error.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve a validation path (`customer_id`, `lines.0.unit_price`) to a
|
|
5
5
|
* human label using the action/modal field schema. Nested line-item paths
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { ActionFieldDef } from './types';
|
|
2
|
+
import type { ActionFieldDef } from './types.js';
|
|
3
3
|
export interface FieldWidgetProps {
|
|
4
4
|
/** The served field definition (key, label, type, widget, options…). */
|
|
5
5
|
field: ActionFieldDef;
|
package/dist/form-layout-ui.d.ts
CHANGED
package/dist/form-layout.d.ts
CHANGED
package/dist/form-layout.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// (`dynamic-form.tsx`, `dialogs/dynamic-record.tsx`) share one tested
|
|
14
14
|
// implementation and the modal-render machinery never has to be booted under
|
|
15
15
|
// happy-dom just to assert the grouping (same approach as PR #673).
|
|
16
|
-
import { evaluateVisibleWhen, getVisibleWhen } from './dynamic-form-schema';
|
|
16
|
+
import { evaluateVisibleWhen, getVisibleWhen } from './dynamic-form-schema.js';
|
|
17
17
|
/** The synthetic key of the orphan group (fields with no / unknown `section`). */
|
|
18
18
|
export const DEFAULT_SECTION_KEY = '__default__';
|
|
19
19
|
/** Reads a field's `section` reference, tolerating a camelCase alias. */
|
package/dist/genui/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SettingsBlock, coerceSettings, registerGenUISettingsBlock, settingsToFields, type SettingDefLike } from './settings-block';
|
|
1
|
+
export { SettingsBlock, coerceSettings, registerGenUISettingsBlock, settingsToFields, type SettingDefLike } from './settings-block.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/genui/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SettingsBlock, coerceSettings, registerGenUISettingsBlock, settingsToFields } from './settings-block';
|
|
1
|
+
export { SettingsBlock, coerceSettings, registerGenUISettingsBlock, settingsToFields } from './settings-block.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type GenUIBlockRendererProps } from '@asteby/metacore-genui';
|
|
3
|
-
import type { ActionFieldDef } from '../types';
|
|
3
|
+
import type { ActionFieldDef } from '../types.js';
|
|
4
4
|
export interface SettingDefLike {
|
|
5
5
|
key: string;
|
|
6
6
|
label?: string;
|
|
@@ -14,9 +14,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { registerGenUIBlockRenderer } from '@asteby/metacore-genui';
|
|
17
|
-
import { useApi } from '../api-context';
|
|
18
|
-
import { useAddonSettings } from '../use-addon-settings';
|
|
19
|
-
import { DynamicForm } from '../dynamic-form';
|
|
17
|
+
import { useApi } from '../api-context.js';
|
|
18
|
+
import { useAddonSettings } from '../use-addon-settings.js';
|
|
19
|
+
import { DynamicForm } from '../dynamic-form.js';
|
|
20
20
|
const humanize = (k) => k.replace(/[_.-]+/g, ' ').replace(/^\w/, (c) => c.toUpperCase());
|
|
21
21
|
/**
|
|
22
22
|
* `FromSettings`: projects an addon's setting definitions to form fields.
|
|
@@ -4,6 +4,31 @@ export { ApiError, isAbortError };
|
|
|
4
4
|
export interface HostRequestConfig {
|
|
5
5
|
params?: HostApiParams;
|
|
6
6
|
signal?: AbortSignal;
|
|
7
|
+
/**
|
|
8
|
+
* Extra headers for this call (e.g. `X-Correlation-ID`), merged over the
|
|
9
|
+
* client's `defaultHeaders`. The host drops Authorization, X-Organization-ID
|
|
10
|
+
* and the other headers it owns; they can never be overridden from here.
|
|
11
|
+
*/
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Per-call timeout (ms) for slow operations; overrides `defaultTimeout`.
|
|
15
|
+
* Finite number >= 0, else ignored. The host clamps it to its ceiling, so
|
|
16
|
+
* `0` means that ceiling (never unlimited unless the host allows it).
|
|
17
|
+
* A timeout rejects the call but the server may still have applied it.
|
|
18
|
+
*/
|
|
19
|
+
timeout?: number;
|
|
20
|
+
/**
|
|
21
|
+
* `'network'`: never serve this read from the host's offline cache (use for
|
|
22
|
+
* money-critical reads). Rejects on network failure. Enforced only by hosts
|
|
23
|
+
* that honor it (ops does not yet unless it reads `metacoreFreshness`).
|
|
24
|
+
*/
|
|
25
|
+
freshness?: 'network';
|
|
26
|
+
}
|
|
27
|
+
export interface HostApiClientOptions {
|
|
28
|
+
/** Headers sent on every call; per-call `headers` win over them. */
|
|
29
|
+
defaultHeaders?: Record<string, string>;
|
|
30
|
+
/** Timeout (ms) for every call; a per-call `timeout` wins. */
|
|
31
|
+
defaultTimeout?: number;
|
|
7
32
|
}
|
|
8
33
|
/** Minimal axios-like surface (what DynamicSelectField & co. call). */
|
|
9
34
|
export interface AxiosLikeClient {
|
|
@@ -42,6 +67,8 @@ export interface HostApiClient {
|
|
|
42
67
|
upload<T = unknown>(path: string, file: File | Blob | FormData, fields?: Record<string, string>, opts?: {
|
|
43
68
|
fileField?: string;
|
|
44
69
|
signal?: AbortSignal;
|
|
70
|
+
timeout?: number;
|
|
71
|
+
headers?: Record<string, string>;
|
|
45
72
|
}): Promise<T>;
|
|
46
73
|
/**
|
|
47
74
|
* Axios-like adapter for runtime-react fields that expect `{ data }` with
|
|
@@ -51,5 +78,5 @@ export interface HostApiClient {
|
|
|
51
78
|
axiosLike(): AxiosLikeClient;
|
|
52
79
|
}
|
|
53
80
|
/** Build the client over the host-injected {@link HostApi}. */
|
|
54
|
-
export declare function createHostApiClient(api: HostApi): HostApiClient;
|
|
81
|
+
export declare function createHostApiClient(api: HostApi, options?: HostApiClientOptions): HostApiClient;
|
|
55
82
|
//# sourceMappingURL=host-api-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-api-client.d.ts","sourceRoot":"","sources":["../src/host-api-client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EACH,QAAQ,EACR,YAAY,EAIZ,KAAK,aAAa,EACrB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;AAEjC,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"host-api-client.d.ts","sourceRoot":"","sources":["../src/host-api-client.ts"],"names":[],"mappings":"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"}
|
package/dist/host-api-client.js
CHANGED
|
@@ -32,7 +32,20 @@ function toApiError(e, signal) {
|
|
|
32
32
|
return new ApiError('request failed', { cause: e });
|
|
33
33
|
}
|
|
34
34
|
/** Build the client over the host-injected {@link HostApi}. */
|
|
35
|
-
export function createHostApiClient(api) {
|
|
35
|
+
export function createHostApiClient(api, options = {}) {
|
|
36
|
+
const defaults = options.defaultHeaders;
|
|
37
|
+
const defaultTimeout = options.defaultTimeout;
|
|
38
|
+
// Additive: without defaults or per-call options the config is untouched.
|
|
39
|
+
const cfg = (c) => {
|
|
40
|
+
if (!defaults && defaultTimeout === undefined)
|
|
41
|
+
return c;
|
|
42
|
+
const out = { ...(c ?? {}) };
|
|
43
|
+
if (defaults)
|
|
44
|
+
out.headers = { ...defaults, ...(c?.headers ?? {}) };
|
|
45
|
+
if (defaultTimeout !== undefined && c?.timeout === undefined)
|
|
46
|
+
out.timeout = defaultTimeout;
|
|
47
|
+
return out;
|
|
48
|
+
};
|
|
36
49
|
const run = async (p, signal) => {
|
|
37
50
|
try {
|
|
38
51
|
return await p();
|
|
@@ -43,13 +56,13 @@ export function createHostApiClient(api) {
|
|
|
43
56
|
};
|
|
44
57
|
const body = (p, signal) => run(async () => unwrapEnvelope(await p()), signal);
|
|
45
58
|
const client = {
|
|
46
|
-
get: (path, c) => body(() => api.get(path, c), c?.signal),
|
|
47
|
-
post: (path, b, c) => body(() => api.post(path, b, c), c?.signal),
|
|
48
|
-
put: (path, b, c) => body(() => api.put(path, b, c), c?.signal),
|
|
49
|
-
patch: (path, b, c) => body(() => api.patch(path, b, c), c?.signal),
|
|
50
|
-
delete: (path, c) => body(() => api.delete(path, c), c?.signal),
|
|
51
|
-
list: (path, c) => run(async () => unwrapList(await api.get(path, c)), c?.signal),
|
|
52
|
-
blob: (path, c) => run(() => api.get(path, { ...c, responseType: 'blob' }), c?.signal),
|
|
59
|
+
get: (path, c) => body(() => api.get(path, cfg(c)), c?.signal),
|
|
60
|
+
post: (path, b, c) => body(() => api.post(path, b, cfg(c)), c?.signal),
|
|
61
|
+
put: (path, b, c) => body(() => api.put(path, b, cfg(c)), c?.signal),
|
|
62
|
+
patch: (path, b, c) => body(() => api.patch(path, b, cfg(c)), c?.signal),
|
|
63
|
+
delete: (path, c) => body(() => api.delete(path, cfg(c)), c?.signal),
|
|
64
|
+
list: (path, c) => run(async () => unwrapList(await api.get(path, cfg(c))), c?.signal),
|
|
65
|
+
blob: (path, c) => run(() => api.get(path, { ...cfg(c), responseType: 'blob' }), c?.signal),
|
|
53
66
|
upload: (path, file, fields, opts) => {
|
|
54
67
|
let form;
|
|
55
68
|
if (typeof FormData !== 'undefined' && file instanceof FormData) {
|
|
@@ -61,7 +74,7 @@ export function createHostApiClient(api) {
|
|
|
61
74
|
for (const [k, v] of Object.entries(fields ?? {}))
|
|
62
75
|
form.append(k, v);
|
|
63
76
|
}
|
|
64
|
-
return body(() => api.post(path, form, opts?.signal ? { signal: opts.signal } : undefined), opts?.signal);
|
|
77
|
+
return body(() => api.post(path, form, cfg(opts?.signal || opts?.timeout !== undefined || opts?.headers ? { signal: opts.signal, timeout: opts.timeout, headers: opts.headers } : undefined)), opts?.signal);
|
|
65
78
|
},
|
|
66
79
|
axiosLike: () => {
|
|
67
80
|
// Envelope kept (the runtime-react fields unwrap it themselves),
|
|
@@ -73,11 +86,11 @@ export function createHostApiClient(api) {
|
|
|
73
86
|
return { data };
|
|
74
87
|
}, signal);
|
|
75
88
|
return {
|
|
76
|
-
get: (u, c) => raw(() => api.get(u, c), c?.signal),
|
|
77
|
-
post: (u, b, c) => raw(() => api.post(u, b, c), c?.signal),
|
|
78
|
-
put: (u, b, c) => raw(() => api.put(u, b, c), c?.signal),
|
|
79
|
-
patch: (u, b, c) => raw(() => api.patch(u, b, c), c?.signal),
|
|
80
|
-
delete: (u, c) => raw(() => api.delete(u, c), c?.signal),
|
|
89
|
+
get: (u, c) => raw(() => api.get(u, cfg(c)), c?.signal),
|
|
90
|
+
post: (u, b, c) => raw(() => api.post(u, b, cfg(c)), c?.signal),
|
|
91
|
+
put: (u, b, c) => raw(() => api.put(u, b, cfg(c)), c?.signal),
|
|
92
|
+
patch: (u, b, c) => raw(() => api.patch(u, b, cfg(c)), c?.signal),
|
|
93
|
+
delete: (u, c) => raw(() => api.delete(u, cfg(c)), c?.signal),
|
|
81
94
|
};
|
|
82
95
|
},
|
|
83
96
|
};
|