@praxisui/table 8.0.0-beta.81 → 8.0.0-beta.84

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.
@@ -34844,37 +34844,54 @@ class PraxisFilter {
34844
34844
  controlTypeToken === normalizeControlTypeToken(INLINE_SENTIMENT_CONTROL_TYPE);
34845
34845
  const isInlineColorLabelExplicit = controlType === INLINE_COLOR_LABEL_CONTROL_TYPE ||
34846
34846
  controlTypeToken === normalizeControlTypeToken(INLINE_COLOR_LABEL_CONTROL_TYPE);
34847
- const shouldUseInlineSearchableSelect = this.useInlineSearchableSelectVariant && isSearchableSelect;
34848
- const shouldUseInlineAsyncSelect = this.useInlineSearchableSelectVariant && (isAsyncSelect || (isSelect && hasRemoteOptions));
34849
- const shouldUseInlineAutocomplete = this.useInlineSearchableSelectVariant && isAutocomplete;
34847
+ const isMultipleSelection = meta?.multiple === true ||
34848
+ normalizeControlTypeToken(meta?.selectionMode || '') === 'multiple';
34849
+ const shouldUseInlineSearchableSelect = this.useInlineSearchableSelectVariant &&
34850
+ !isMultipleSelection &&
34851
+ isSearchableSelect;
34852
+ const shouldUseInlineAsyncSelect = this.useInlineSearchableSelectVariant &&
34853
+ !isMultipleSelection &&
34854
+ (isAsyncSelect || (isSelect && hasRemoteOptions));
34855
+ const shouldUseInlineAutocomplete = this.useInlineSearchableSelectVariant &&
34856
+ !isMultipleSelection &&
34857
+ isAutocomplete;
34850
34858
  const shouldUseInlineEntityLookup = isEntityLookup;
34851
34859
  const shouldUseInlineSelect = this.useInlineSelectVariant &&
34860
+ !isMultipleSelection &&
34852
34861
  isSelect &&
34853
34862
  !hasRemoteOptions;
34854
34863
  const shouldUseInlineMultiSelect = this.useInlineMultiSelectVariant &&
34855
34864
  (controlType === FieldControlType.MULTI_SELECT ||
34856
34865
  controlTypeToken === 'multiselect');
34857
34866
  const shouldUseInlineInput = this.useInlineInputVariant &&
34867
+ !isMultipleSelection &&
34858
34868
  (controlType === FieldControlType.INPUT ||
34859
34869
  controlType === FieldControlType.SEARCH_INPUT ||
34860
34870
  normalizedControlType === 'input' ||
34861
34871
  normalizedControlType === 'search' ||
34862
34872
  controlTypeToken === 'searchinput');
34863
- const shouldUseInlineNumber = this.useInlineInputVariant && isNumeric && !isCurrency && !isPriceRange;
34864
- const shouldUseInlineCurrency = this.useInlineInputVariant && isCurrency;
34865
- const shouldUseInlineCurrencyRange = this.useInlineRangeVariant && isPriceRange;
34873
+ const shouldUseInlineNumber = this.useInlineInputVariant &&
34874
+ !isMultipleSelection &&
34875
+ isNumeric &&
34876
+ !isCurrency &&
34877
+ !isPriceRange;
34878
+ const shouldUseInlineCurrency = this.useInlineInputVariant && !isMultipleSelection && isCurrency;
34879
+ const shouldUseInlineCurrencyRange = this.useInlineRangeVariant && !isMultipleSelection && isPriceRange;
34866
34880
  const shouldUseInlineRating = isInlineRatingExplicit;
34867
34881
  const shouldUseInlineDistanceRadius = isInlineDistanceRadiusExplicit;
34868
34882
  const shouldUseInlineToggle = this.useInlineToggleVariant &&
34883
+ !isMultipleSelection &&
34869
34884
  (controlType === FieldControlType.TOGGLE ||
34870
34885
  normalizedControlType === 'toggle' ||
34871
34886
  controlTypeToken === 'switch');
34872
34887
  const shouldUseInlineYearRange = isInlineYearRangeExplicit ||
34873
34888
  (this.useInlineRangeVariant &&
34889
+ !isMultipleSelection &&
34874
34890
  isYearRange &&
34875
34891
  normalizeControlTypeToken(meta?.mode || '') === 'range');
34876
34892
  const shouldUseInlineMonthRange = isInlineMonthRangeExplicit ||
34877
34893
  (this.useInlineRangeVariant &&
34894
+ !isMultipleSelection &&
34878
34895
  isMonthRange &&
34879
34896
  normalizeControlTypeToken(meta?.mode || '') === 'range');
34880
34897
  const periodRangeGranularity = isInlinePeriodRangeExplicit
@@ -34888,9 +34905,11 @@ class PraxisFilter {
34888
34905
  shouldUseInlineYearRange ||
34889
34906
  shouldUseInlineMonthRange;
34890
34907
  const shouldUseInlineRange = this.useInlineRangeVariant &&
34908
+ !isMultipleSelection &&
34891
34909
  (controlType === FieldControlType.RANGE_SLIDER ||
34892
34910
  controlTypeToken === 'rangeslider');
34893
34911
  const shouldUseInlineDate = this.useInlineDateVariant &&
34912
+ !isMultipleSelection &&
34894
34913
  (controlType === FieldControlType.DATE_PICKER ||
34895
34914
  controlType === FieldControlType.DATE_INPUT ||
34896
34915
  normalizedControlType === 'date' ||
@@ -34901,6 +34920,7 @@ class PraxisFilter {
34901
34920
  controlTypeToken === 'datepicker' ||
34902
34921
  controlTypeToken === 'materialdatepicker');
34903
34922
  const shouldUseInlineDateRange = this.useInlineDateRangeVariant &&
34923
+ !isMultipleSelection &&
34904
34924
  (controlType === FieldControlType.DATE_RANGE ||
34905
34925
  controlType === FieldControlType.DATE_TIME_RANGE ||
34906
34926
  normalizedControlType === 'daterange' ||
@@ -35005,7 +35025,7 @@ class PraxisFilter {
35005
35025
  inlineQuickPresets,
35006
35026
  inlineQuickPresetsApplyMode,
35007
35027
  shortcuts,
35008
- updateOn: 'change',
35028
+ updateOn: isMultipleSelection ? (meta.updateOn ?? 'blur') : 'change',
35009
35029
  density: 'compact',
35010
35030
  });
35011
35031
  };
@@ -38734,12 +38754,12 @@ class PraxisTable {
38734
38754
  }
38735
38755
  }
38736
38756
  async ensureAiAssistantRecordSurfaceContext() {
38737
- const selectedRows = this.getSelectedRowsSnapshot()
38757
+ const candidateRows = this.getAiAssistantRecordSurfaceProbeRows()
38738
38758
  .slice(0, PraxisTable.AI_SELECTION_ROW_LIMIT);
38739
- if (!selectedRows.length) {
38759
+ if (!candidateRows.length) {
38740
38760
  return;
38741
38761
  }
38742
- await Promise.all(selectedRows.map((row) => this.ensureAiAssistantRowCapabilitySnapshot(row)));
38762
+ await Promise.all(candidateRows.map((row) => this.ensureAiAssistantRowCapabilitySnapshot(row)));
38743
38763
  }
38744
38764
  getAiAssistantRecordSurfacesContext() {
38745
38765
  const configuredPack = this.aiContext?.recordSurfaces ?? null;
@@ -38880,12 +38900,12 @@ class PraxisTable {
38880
38900
  };
38881
38901
  }
38882
38902
  buildAiAssistantResourceSurfaceContexts() {
38883
- const selectedRows = this.getSelectedRowsSnapshot();
38884
- if (!selectedRows.length || !this.resourcePath) {
38903
+ const candidateRows = this.getAiAssistantRecordSurfaceProbeRows();
38904
+ if (!candidateRows.length || !this.resourcePath) {
38885
38905
  return [];
38886
38906
  }
38887
38907
  const surfacesById = new Map();
38888
- for (const row of selectedRows) {
38908
+ for (const row of candidateRows) {
38889
38909
  const snapshot = this.getCachedRowCapabilitySnapshot(row);
38890
38910
  for (const surface of snapshot?.surfaces ?? []) {
38891
38911
  if (!this.isRowSurfaceAction(surface)) {
@@ -38900,6 +38920,15 @@ class PraxisTable {
38900
38920
  }
38901
38921
  return [...surfacesById.values()];
38902
38922
  }
38923
+ getAiAssistantRecordSurfaceProbeRows() {
38924
+ const selectedRows = this.getSelectedRowsSnapshot();
38925
+ if (selectedRows.length) {
38926
+ return selectedRows;
38927
+ }
38928
+ return Array.isArray(this.dataSource?.data)
38929
+ ? this.dataSource.data.filter(Boolean).slice(0, PraxisTable.AI_SELECTION_ROW_LIMIT)
38930
+ : [];
38931
+ }
38903
38932
  buildRecordRelatedSurfaceContextFromResourceSurface(surface, sourceWidget = this.resolveAiAssistantOwnerId()) {
38904
38933
  const id = String(surface.id || '').trim();
38905
38934
  return {
@@ -39578,7 +39607,7 @@ class PraxisTable {
39578
39607
  if (this.aiAdapter || this.aiAdapterLoadStarted)
39579
39608
  return;
39580
39609
  this.aiAdapterLoadStarted = true;
39581
- import('./praxisui-table-table-ai.adapter-D8fQSvC3.mjs')
39610
+ import('./praxisui-table-table-ai.adapter-BJA9_YlX.mjs')
39582
39611
  .then(({ TableAiAdapter }) => {
39583
39612
  this.aiAdapter = new TableAiAdapter(this);
39584
39613
  this.initializeAiAssistantController();
@@ -39760,7 +39789,7 @@ class PraxisTable {
39760
39789
  initializeAiAssistantController() {
39761
39790
  if (!this.aiAdapter || this.aiAssistantController)
39762
39791
  return;
39763
- import('./praxisui-table-table-agentic-authoring-turn-flow-CyJJHpMr.mjs')
39792
+ import('./praxisui-table-table-agentic-authoring-turn-flow-DMglW7f1.mjs')
39764
39793
  .then(({ TableAgenticAuthoringTurnFlow }) => {
39765
39794
  if (this.aiAssistantController || !this.aiAdapter)
39766
39795
  return;
@@ -44120,12 +44149,20 @@ class PraxisTable {
44120
44149
  action,
44121
44150
  selected: rows.length,
44122
44151
  }, { actionId: action, throttleKey: `praxis-table:toolbar-bulk-emit:${action}` });
44152
+ const selectedIds = rows
44153
+ .map((row) => this.getRowId(row))
44154
+ .filter((id) => id !== undefined && id !== null);
44123
44155
  if (this.resolveActionGlobalActionRef(safeActionConfig)) {
44124
44156
  await this.executeConfiguredGlobalAction(safeActionConfig, {
44125
44157
  sourceId: this.tableId || this.componentInstanceId || 'praxis-table',
44126
44158
  output: 'bulkAction',
44127
44159
  payload: rows,
44128
- runtime: { selection: rows },
44160
+ runtime: {
44161
+ selection: rows,
44162
+ selectedRows: rows,
44163
+ selectedIds,
44164
+ idField: this.getIdField(),
44165
+ },
44129
44166
  meta: { actionId: action, actionConfig: safeActionConfig },
44130
44167
  });
44131
44168
  if (!this.shouldEmitLocalForGlobalAction(safeActionConfig)) {
@@ -56458,9 +56495,9 @@ const PRAXIS_TABLE_COMPONENT_METADATA = {
56458
56495
  },
56459
56496
  {
56460
56497
  name: 'aiContext',
56461
- type: '{ recordSurfaces?: RecordRelatedSurfaceContextPack | null } | null',
56498
+ type: 'TableAiContext | null',
56462
56499
  label: 'Contexto semântico para IA',
56463
- description: 'Contexto governado pelo host para grounding do assistente, incluindo superfícies relacionadas ao registro derivadas da composição dinâmica.',
56500
+ description: 'Contexto governado pelo host para grounding do assistente, incluindo superfícies relacionadas ao registro e destinos de navegação declarados pelo host.',
56464
56501
  default: null,
56465
56502
  },
56466
56503
  {
@@ -57425,8 +57462,9 @@ const TABLE_AI_CAPABILITIES = {
57425
57462
  { path: 'actions.row.actions[].effects[].globalAction.payload', category: 'actions', valueKind: 'object', description: 'Payload estruturado da GlobalActionRef dentro do efeito runtime por linha.', dependsOn: 'actions.row.actions[].effects[].globalAction.[actionId]' },
57426
57463
  { path: 'actions.bulk.enabled', category: 'actions', valueKind: 'boolean', description: 'Habilita ações em lote.', critical: true, intentExamples: ['ativar ações em lote', 'permitir excluir em massa'], safetyNotes: 'Combine com selection.persistSelection e limites de maxSelections.' },
57427
57464
  { path: 'actions.bulk.position', category: 'actions', valueKind: 'enum', allowedValues: ENUMS.bulkActionPosition, description: 'Posição das ações em lote.', dependsOn: 'actions.bulk.enabled' },
57465
+ { path: 'actions.bulk.actions[]', category: 'actions', valueKind: 'array', description: 'Ações curadas para operar sobre a seleção atual da tabela. Use para criar botões em lote com GlobalActionRef governada.', dependsOn: 'actions.bulk.enabled', intentExamples: ['adicionar botão para agir sobre selecionados', 'criar ação em lote para abrir rota com a seleção atual'] },
57428
57466
  { path: 'actions.bulk.actions[].globalAction.[actionId]', category: 'actions', valueKind: 'string', description: 'Identificador canônico de global action para a ação em lote.', dependsOn: 'actions.bulk.enabled', intentExamples: ['disparar ação global com a seleção atual', 'abrir surface corporativa a partir do bulk action'] },
57429
- { path: 'actions.bulk.actions[].globalAction.payload', category: 'actions', valueKind: 'object', description: 'Payload estruturado da global action em lote. Deve permanecer alinhado ao schema da action escolhida e ao contexto da seleção atual.', dependsOn: 'actions.bulk.actions[].globalAction.[actionId]' },
57467
+ { path: 'actions.bulk.actions[].globalAction.payload', category: 'actions', valueKind: 'object', description: 'Payload estruturado da global action em lote. Deve permanecer alinhado ao schema da action escolhida e ao contexto da seleção atual; para `navigation.openRoute`, use templates como `${runtime.selectedIds}` quando precisar enviar os IDs selecionados.', dependsOn: 'actions.bulk.actions[].globalAction.[actionId]' },
57430
57468
  { path: 'actions.bulk.actions[].effects', category: 'actions', valueKind: 'array', description: 'Array canonico de efeitos runtime da acao em lote, alinhado com PraxisRuntimeGlobalActionEffect.', dependsOn: 'actions.bulk.enabled' },
57431
57469
  { path: 'actions.bulk.actions[].effects[].kind', category: 'actions', valueKind: 'enum', allowedValues: ['global-action'], description: 'Tipo de efeito runtime da acao em lote. Neste corte, apenas global-action e suportado.', dependsOn: 'actions.bulk.actions[].effects' },
57432
57470
  { path: 'actions.bulk.actions[].effects[].globalAction.[actionId]', category: 'actions', valueKind: 'string', description: 'Identificador canonico da GlobalActionRef dentro do efeito runtime em lote.', dependsOn: 'actions.bulk.actions[].effects[].kind' },
@@ -57752,6 +57790,7 @@ const TABLE_COMPONENT_EDIT_PLAN_ALLOWED_CHANGE_KINDS = [
57752
57790
  'configure_toolbar',
57753
57791
  'add_toolbar_action',
57754
57792
  'add_row_action',
57793
+ 'add_bulk_action',
57755
57794
  'configure_export',
57756
57795
  'set_table_density',
57757
57796
  'set_toolbar_visibility',
@@ -57786,6 +57825,7 @@ const TABLE_COMPONENT_EDIT_PLAN_OPERATION_IDS = [
57786
57825
  'toolbar.configure',
57787
57826
  'toolbar.action.add',
57788
57827
  'rowAction.add',
57828
+ 'bulkAction.add',
57789
57829
  'export.configure',
57790
57830
  'appearance.density.set',
57791
57831
  'toolbar.visibility.set',
@@ -57821,6 +57861,7 @@ const TABLE_COMPONENT_EDIT_PLAN_EXPECTED_PATHS = {
57821
57861
  configure_toolbar: 'toolbar',
57822
57862
  add_toolbar_action: 'toolbar.actions[]',
57823
57863
  add_row_action: 'actions.row.actions[]',
57864
+ add_bulk_action: 'actions.bulk.actions[]',
57824
57865
  configure_export: 'export',
57825
57866
  set_table_density: 'appearance.density',
57826
57867
  set_toolbar_visibility: 'toolbar.visible',
@@ -57855,6 +57896,7 @@ const TABLE_COMPONENT_EDIT_PLAN_OPERATION_ID_TO_CHANGE_KIND = {
57855
57896
  'toolbar.configure': 'configure_toolbar',
57856
57897
  'toolbar.action.add': 'add_toolbar_action',
57857
57898
  'rowAction.add': 'add_row_action',
57899
+ 'bulkAction.add': 'add_bulk_action',
57858
57900
  'export.configure': 'configure_export',
57859
57901
  'appearance.density.set': 'set_table_density',
57860
57902
  'toolbar.visibility.set': 'set_toolbar_visibility',
@@ -57889,6 +57931,7 @@ const TABLE_COMPONENT_EDIT_PLAN_OPERATION_VALUE_KEYS = {
57889
57931
  'toolbar.configure': '',
57890
57932
  'toolbar.action.add': '',
57891
57933
  'rowAction.add': '',
57934
+ 'bulkAction.add': '',
57892
57935
  'export.configure': '',
57893
57936
  'appearance.density.set': 'density',
57894
57937
  'toolbar.visibility.set': 'visible',
@@ -58324,6 +58367,27 @@ function compileTableComponentEditPlan(plan, currentConfig) {
58324
58367
  failureCodes,
58325
58368
  };
58326
58369
  }
58370
+ if (plan.changeKind === 'add_bulk_action') {
58371
+ const action = valueValidation.value;
58372
+ const currentBulkActions = currentConfig.actions?.bulk;
58373
+ const existingActions = Array.isArray(currentBulkActions?.actions)
58374
+ ? [...currentBulkActions.actions]
58375
+ : [];
58376
+ return {
58377
+ patch: {
58378
+ actions: {
58379
+ bulk: {
58380
+ ...currentBulkActions,
58381
+ enabled: true,
58382
+ actions: mergeActionPatchesById(existingActions, [action]),
58383
+ },
58384
+ },
58385
+ },
58386
+ explanation: plan.explanation || defaultExplanation(plan.changeKind, field, valueValidation.value),
58387
+ warnings,
58388
+ failureCodes,
58389
+ };
58390
+ }
58327
58391
  if (plan.changeKind === 'configure_advanced_filters') {
58328
58392
  return {
58329
58393
  patch: {
@@ -58970,6 +59034,9 @@ function validateValueForChangeKind(changeKind, rawValue, allowedValues) {
58970
59034
  if (changeKind === 'add_row_action') {
58971
59035
  return validateRowActionValue(rawValue);
58972
59036
  }
59037
+ if (changeKind === 'add_bulk_action') {
59038
+ return validateBulkActionValue(rawValue);
59039
+ }
58973
59040
  if (changeKind === 'configure_export') {
58974
59041
  return validateObjectValue(rawValue, 'export configuration');
58975
59042
  }
@@ -59057,6 +59124,35 @@ function validateRowActionValue(rawValue) {
59057
59124
  failureCodes: [],
59058
59125
  };
59059
59126
  }
59127
+ function validateBulkActionValue(rawValue) {
59128
+ const value = coerceRecord(rawValue);
59129
+ if (!value) {
59130
+ return { failureCodes: ['bulk action must be object'] };
59131
+ }
59132
+ const id = normalizeText(value['id']);
59133
+ const label = normalizeText(value['label']);
59134
+ const action = normalizeText(value['action']);
59135
+ const failureCodes = [];
59136
+ if (!id)
59137
+ failureCodes.push('bulk action id is required');
59138
+ if (!label)
59139
+ failureCodes.push('bulk action label is required');
59140
+ if (!action)
59141
+ failureCodes.push('bulk action action is required');
59142
+ if (failureCodes.length > 0) {
59143
+ return { failureCodes };
59144
+ }
59145
+ return {
59146
+ value: {
59147
+ icon: normalizeText(value['icon']) || 'done_all',
59148
+ ...value,
59149
+ id,
59150
+ label,
59151
+ action,
59152
+ },
59153
+ failureCodes: [],
59154
+ };
59155
+ }
59060
59156
  function validateRecordSurfaceValue(rawValue) {
59061
59157
  const surface = coerceRecord(rawValue);
59062
59158
  if (!surface)
@@ -59282,6 +59378,10 @@ function defaultExplanation(changeKind, field, value) {
59282
59378
  const action = coerceRecord(value);
59283
59379
  return `Acao ${normalizeText(action?.['label']) || normalizeText(action?.['id']) || 'de linha'} adicionada as linhas da tabela.`;
59284
59380
  }
59381
+ if (changeKind === 'add_bulk_action') {
59382
+ const action = coerceRecord(value);
59383
+ return `Acao ${normalizeText(action?.['label']) || normalizeText(action?.['id']) || 'em lote'} adicionada a selecao da tabela.`;
59384
+ }
59285
59385
  if (changeKind === 'set_table_density') {
59286
59386
  return `Densidade da tabela atualizada para ${String(value)}.`;
59287
59387
  }