@masterteam/work-center 0.0.94 → 0.0.96

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/work-center",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/work-center",
6
6
  "linkDirectory": false,
@@ -20,12 +20,12 @@
20
20
  "rxjs": "^7.8.2",
21
21
  "tailwindcss": "^4.2.2",
22
22
  "tailwindcss-primeui": "^0.6.1",
23
- "@masterteam/components": "^0.0.325",
23
+ "@masterteam/discussion": "^0.0.26",
24
+ "@masterteam/client-components": "^0.0.105",
24
25
  "@masterteam/icons": "^0.0.17",
25
- "@masterteam/client-components": "^0.0.104",
26
- "@masterteam/forms": "^0.0.168",
27
- "@masterteam/structure-builder": "^0.0.64",
28
- "@masterteam/discussion": "^0.0.26"
26
+ "@masterteam/components": "^0.0.328",
27
+ "@masterteam/forms": "^0.0.169",
28
+ "@masterteam/structure-builder": "^0.0.64"
29
29
  },
30
30
  "sideEffects": false,
31
31
  "exports": {
@@ -12,6 +12,8 @@ import { LoadingStateShape } from '@masterteam/components';
12
12
  import { ModalRef } from '@masterteam/components/dialog';
13
13
  import { DrawerController } from '@masterteam/components/dynamic-drawer';
14
14
  import { ModalService } from '@masterteam/components/modal';
15
+ import { OptionItem } from '@masterteam/components/tabs';
16
+ import { MTIcon } from '@masterteam/icons';
15
17
  import * as rxjs from 'rxjs';
16
18
  import { Observable } from 'rxjs';
17
19
  import { ClientInstancePreviewConfig } from '@masterteam/client-components/client-instance-preview';
@@ -615,6 +617,72 @@ interface WorkCenterTypeComponentInputs {
615
617
  */
616
618
  declare const WORK_CENTER_TYPE_COMPONENTS: InjectionToken<Record<string, Type<unknown>>>;
617
619
 
620
+ /** What a host's `when` sees of the item — same shape the footer action
621
+ * handlers get. */
622
+ interface WorkCenterExtraTabItem {
623
+ type: string | null;
624
+ context: Record<string, unknown> | null;
625
+ }
626
+ /**
627
+ * A host tab added to the built-in `ProcessStep` / `ProcessRequest` bodies.
628
+ *
629
+ * `component` is mounted with the same inputs as a `WORK_CENTER_TYPE_COMPONENTS`
630
+ * entry (`details`, `lookups`, `readOnly`), the first time its tab opens, and
631
+ * then kept (hidden, not destroyed) like the built-in tabs.
632
+ */
633
+ interface WorkCenterExtraTab {
634
+ /** The tab's value — must not collide with a built-in tab. */
635
+ key: string;
636
+ /** Transloco key, translated by the host type on every language change. */
637
+ label: string;
638
+ icon?: MTIcon;
639
+ /**
640
+ * The built-in tab to insert after: `form` / `levelDetails` (ProcessStep),
641
+ * `requestDetails` (ProcessRequest), `approvals`, `schema`, `discussion`.
642
+ * Missing, or naming a tab this item doesn't show, places it right after the
643
+ * item's first tab.
644
+ */
645
+ after?: string;
646
+ /** Show the tab only for matching items. */
647
+ when: (item: WorkCenterExtraTabItem) => boolean;
648
+ component: Type<unknown>;
649
+ }
650
+ /**
651
+ * Host-side extra tabs for the built-in request bodies.
652
+ *
653
+ * `WORK_CENTER_TYPE_COMPONENTS` can only replace a body wholesale, so adding one
654
+ * tab to an approval meant rebuilding the form, level details, approvals, steps
655
+ * and discussion around it. This token adds a tab and leaves everything else to
656
+ * the built-in body. Strictly additive: providing nothing changes nothing.
657
+ *
658
+ * Gate `when` on what actually identifies the item (e.g. its component type),
659
+ * not on `operationKey` alone - that one is shared by every request of the same
660
+ * kind across all component types.
661
+ *
662
+ * @example
663
+ * providers: [
664
+ * {
665
+ * provide: WORK_CENTER_EXTRA_TABS,
666
+ * useValue: [
667
+ * {
668
+ * key: 'kpiMeasures',
669
+ * label: 'workCenter.kpiMeasures.tab',
670
+ * after: 'levelDetails',
671
+ * when: ({ context }) => context?.['componentType'] === 'PerformanceIndicator',
672
+ * component: KpiApprovalMeasuresTab,
673
+ * },
674
+ * ],
675
+ * },
676
+ * ]
677
+ */
678
+ declare const WORK_CENTER_EXTRA_TABS: InjectionToken<WorkCenterExtraTab[]>;
679
+ /** The registered tabs that apply to this item, in registration order. */
680
+ declare function resolveWorkCenterExtraTabs(tabs: readonly WorkCenterExtraTab[] | null, details: WorkCenterItemBasicInfoData): WorkCenterExtraTab[];
681
+ /** Splices the extra tabs into a built-in tab list (see `after`). */
682
+ declare function insertWorkCenterExtraTabs<T extends {
683
+ value?: unknown;
684
+ }>(options: readonly T[], tabs: readonly WorkCenterExtraTab[], translate: (key: string) => string): (T | OptionItem)[];
685
+
618
686
  /**
619
687
  * What a host action handler receives: the clicked footer action plus the
620
688
  * item it was resolved for (`GET workcenter/runtime/item-actions`).
@@ -1149,5 +1217,5 @@ declare class WorkCenterState {
1149
1217
 
1150
1218
  declare const APP_STATES: (typeof WorkCenterState)[];
1151
1219
 
1152
- export { APP_STATES, ApplyColumnFilters, ApplyHeaderFilters, ClearAllFilters, EnterArea, HydrateFromContext, LoadRuntime, SCHEDULE_PUBLISH_GROUP_ORDER, SCHEDULE_PUBLISH_OPERATION_KEY, SelectCard, SetGroupBy, SetLookups, SetParams, WORK_CENTER_ACTION_HANDLERS, WORK_CENTER_EMPTY_LABEL, WORK_CENTER_GROUP_NONE, WORK_CENTER_LEVEL_GROUP_FIELD, WORK_CENTER_LEVEL_NAME_KEY, WORK_CENTER_MAX_FILTERS, WORK_CENTER_MAX_PAGE_SIZE, WORK_CENTER_MAX_SORT, WORK_CENTER_QUERY_VERSION, WORK_CENTER_TYPE_COMPONENTS, WorkCenterActionKey, WorkCenterClientFormModal, WorkCenterFacade, WorkCenterItemModal, WorkCenterItemModalRoute, WorkCenterPage, WorkCenterSchedulePublishType, WorkCenterState, decodeWorkCenterRouteContextKey, encodeWorkCenterRouteContextKey, groupSchedulePublishRows, isSchedulePublishConflictRow, matchesSchedulePublishSearch, parseSchedulePublishChangedFields, readSchedulePublishChanges, resolveWorkCenterActionHandler, schedulePublishRowKey, sortSchedulePublishRows, summarizeSchedulePublish, windowSchedulePublishRows };
1153
- export type { ApiEnvelope, SchedulePublishDiff, SchedulePublishDiffRow, SchedulePublishFieldChange, SchedulePublishFormLoadResponse, SchedulePublishGroup, SchedulePublishGroupKey, SchedulePublishState, SchedulePublishSummary, TranslatableDto, WorkCenterActionHandler, WorkCenterActionHandlerContext, WorkCenterArea, WorkCenterAreaState, WorkCenterBootstrapInputs, WorkCenterClientFormModalData, WorkCenterClientFormModalOptions, WorkCenterColumnsConfig, WorkCenterContext, WorkCenterFilterOperator, WorkCenterFilterRule, WorkCenterHydratePatch, WorkCenterItemActionAfterSuccess, WorkCenterItemActionExecutionResult, WorkCenterItemActionsData, WorkCenterItemBasicInfoData, WorkCenterItemContextKey, WorkCenterItemModalComponentInput, WorkCenterItemModalOptions, WorkCenterLoadReason, WorkCenterLookups, WorkCenterPreviewLevelTarget, WorkCenterRuntimeCard, WorkCenterRuntimeFilterSchema, WorkCenterRuntimeItemAction, WorkCenterRuntimeOperatorOption, WorkCenterRuntimePagination, WorkCenterRuntimeProperty, WorkCenterRuntimeRequest, WorkCenterRuntimeResponseData, WorkCenterRuntimeSelectedCard, WorkCenterRuntimeStatsItem, WorkCenterRuntimeWarningDto, WorkCenterSortRule, WorkCenterStateModel, WorkCenterTypeComponentInputs };
1220
+ export { APP_STATES, ApplyColumnFilters, ApplyHeaderFilters, ClearAllFilters, EnterArea, HydrateFromContext, LoadRuntime, SCHEDULE_PUBLISH_GROUP_ORDER, SCHEDULE_PUBLISH_OPERATION_KEY, SelectCard, SetGroupBy, SetLookups, SetParams, WORK_CENTER_ACTION_HANDLERS, WORK_CENTER_EMPTY_LABEL, WORK_CENTER_EXTRA_TABS, WORK_CENTER_GROUP_NONE, WORK_CENTER_LEVEL_GROUP_FIELD, WORK_CENTER_LEVEL_NAME_KEY, WORK_CENTER_MAX_FILTERS, WORK_CENTER_MAX_PAGE_SIZE, WORK_CENTER_MAX_SORT, WORK_CENTER_QUERY_VERSION, WORK_CENTER_TYPE_COMPONENTS, WorkCenterActionKey, WorkCenterClientFormModal, WorkCenterFacade, WorkCenterItemModal, WorkCenterItemModalRoute, WorkCenterPage, WorkCenterSchedulePublishType, WorkCenterState, decodeWorkCenterRouteContextKey, encodeWorkCenterRouteContextKey, groupSchedulePublishRows, insertWorkCenterExtraTabs, isSchedulePublishConflictRow, matchesSchedulePublishSearch, parseSchedulePublishChangedFields, readSchedulePublishChanges, resolveWorkCenterActionHandler, resolveWorkCenterExtraTabs, schedulePublishRowKey, sortSchedulePublishRows, summarizeSchedulePublish, windowSchedulePublishRows };
1221
+ export type { ApiEnvelope, SchedulePublishDiff, SchedulePublishDiffRow, SchedulePublishFieldChange, SchedulePublishFormLoadResponse, SchedulePublishGroup, SchedulePublishGroupKey, SchedulePublishState, SchedulePublishSummary, TranslatableDto, WorkCenterActionHandler, WorkCenterActionHandlerContext, WorkCenterArea, WorkCenterAreaState, WorkCenterBootstrapInputs, WorkCenterClientFormModalData, WorkCenterClientFormModalOptions, WorkCenterColumnsConfig, WorkCenterContext, WorkCenterExtraTab, WorkCenterExtraTabItem, WorkCenterFilterOperator, WorkCenterFilterRule, WorkCenterHydratePatch, WorkCenterItemActionAfterSuccess, WorkCenterItemActionExecutionResult, WorkCenterItemActionsData, WorkCenterItemBasicInfoData, WorkCenterItemContextKey, WorkCenterItemModalComponentInput, WorkCenterItemModalOptions, WorkCenterLoadReason, WorkCenterLookups, WorkCenterPreviewLevelTarget, WorkCenterRuntimeCard, WorkCenterRuntimeFilterSchema, WorkCenterRuntimeItemAction, WorkCenterRuntimeOperatorOption, WorkCenterRuntimePagination, WorkCenterRuntimeProperty, WorkCenterRuntimeRequest, WorkCenterRuntimeResponseData, WorkCenterRuntimeSelectedCard, WorkCenterRuntimeStatsItem, WorkCenterRuntimeWarningDto, WorkCenterSortRule, WorkCenterStateModel, WorkCenterTypeComponentInputs };