@superblocksteam/library 2.0.3-next.196 → 2.0.3-next.198

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.
Files changed (22) hide show
  1. package/dist/{allPaths-C_dOrZGg.js → allPaths-BTYAJAA3.js} +2 -2
  2. package/dist/{allPaths-C_dOrZGg.js.map → allPaths-BTYAJAA3.js.map} +1 -1
  3. package/dist/{allPaths-Dgpxk8Um.js → allPaths-k-ermJRk.js} +2 -2
  4. package/dist/{allPaths-Dgpxk8Um.js.map → allPaths-k-ermJRk.js.map} +1 -1
  5. package/dist/{allPathsLoader-ByP0iRQq.js → allPathsLoader-DGPQhqI0.js} +3 -3
  6. package/dist/{allPathsLoader-CW9Ec2JW.js.map → allPathsLoader-DGPQhqI0.js.map} +1 -1
  7. package/dist/{allPathsLoader-CW9Ec2JW.js → allPathsLoader-XDG2QDHX.js} +3 -3
  8. package/dist/{allPathsLoader-ByP0iRQq.js.map → allPathsLoader-XDG2QDHX.js.map} +1 -1
  9. package/dist/{devtools-consolidated-pFTghgz2.js → devtools-consolidated-CuKf4Mw6.js} +2 -2
  10. package/dist/{devtools-consolidated-pFTghgz2.js.map → devtools-consolidated-CuKf4Mw6.js.map} +1 -1
  11. package/dist/{index-DZvnjpQm.js → index-CFz3UGkJ.js} +114 -58
  12. package/dist/{index-DZvnjpQm.js.map → index-CFz3UGkJ.js.map} +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/{splitPathsBySizeLoader-bkDhkrOd.js → splitPathsBySizeLoader-9ypptKho.js} +2 -2
  15. package/dist/{splitPathsBySizeLoader-bkDhkrOd.js.map → splitPathsBySizeLoader-9ypptKho.js.map} +1 -1
  16. package/dist/{splitPathsBySizeLoader-BrImLlIK.js → splitPathsBySizeLoader-CW0AvZcf.js} +2 -2
  17. package/dist/{splitPathsBySizeLoader-BrImLlIK.js.map → splitPathsBySizeLoader-CW0AvZcf.js.map} +1 -1
  18. package/dist-types/lib/user-facing/components/table/column-properties-panel.d.ts +12 -9
  19. package/dist-types/lib/user-facing/components/table/derived-properties.d.ts +1 -0
  20. package/dist-types/lib/user-facing/components/table/index.d.ts +12 -9
  21. package/dist-types/lib/user-facing/components/table/props.d.ts +12 -9
  22. package/package.json +2 -2
@@ -82741,6 +82741,18 @@ const VALIDATORS = {
82741
82741
  }
82742
82742
  }
82743
82743
  };
82744
+ function mergeRelations(existingRelations, relations) {
82745
+ if (!existingRelations || existingRelations.length === 0) {
82746
+ return relations;
82747
+ }
82748
+ if (!relations || relations.length === 0) {
82749
+ return existingRelations;
82750
+ }
82751
+ const mergedRelations = existingRelations && existingRelations.length > 0 ? existingRelations.flatMap(
82752
+ (existing) => relations.map((relation) => [...existing, ...relation])
82753
+ ) : relations;
82754
+ return mergedRelations;
82755
+ }
82744
82756
  function getChildren(input, path2, entity, scopedState) {
82745
82757
  function getChildrenFromSection(section) {
82746
82758
  return Object.keys(section.props).reduce(
@@ -83177,6 +83189,16 @@ class UnionProp extends Prop {
83177
83189
  getProps() {
83178
83190
  const sharedKeys = Object.keys(this.shared);
83179
83191
  const variants = this.variants;
83192
+ const preMergeRelationsMap = variants.reduce(
83193
+ (acc, v2) => {
83194
+ Object.entries(v2).forEach(([key2, prop]) => {
83195
+ if (acc[key2]) return;
83196
+ acc[key2] = prop.getRelations() ?? [];
83197
+ });
83198
+ return acc;
83199
+ },
83200
+ {}
83201
+ );
83180
83202
  const mergedVariants = variants.reduce(
83181
83203
  (acc, v2) => {
83182
83204
  const variantConstants = Object.entries(v2).filter(
@@ -83190,9 +83212,18 @@ class UnionProp extends Prop {
83190
83212
  });
83191
83213
  const filteredVariant = Object.fromEntries(
83192
83214
  Object.entries(v2).filter(([key2]) => !sharedKeys.includes(key2)).map(([key2, prop]) => {
83193
- var _a2;
83194
- const existingRelations = ((_a2 = acc[key2]) == null ? void 0 : _a2.getRelations()) ?? [];
83195
- return [key2, prop.dependsOn([...existingRelations, relations])];
83215
+ const existingRelations = (prop == null ? void 0 : prop.getRelations()) ?? [];
83216
+ const preMergeRelations = preMergeRelationsMap[key2];
83217
+ const existingNonPreMergeRelations = existingRelations.filter(
83218
+ (r2) => !preMergeRelations.some((p) => p === r2)
83219
+ );
83220
+ return [
83221
+ key2,
83222
+ prop.dependsOn([
83223
+ ...existingNonPreMergeRelations,
83224
+ ...mergeRelations(preMergeRelations, [relations])
83225
+ ])
83226
+ ];
83196
83227
  })
83197
83228
  );
83198
83229
  return { ...acc, ...filteredVariant };
@@ -83470,7 +83501,7 @@ function registerStores(stores) {
83470
83501
  internalStores = { ...internalStores, ...stores };
83471
83502
  if (SUPPORTED_MODES.includes("production")) {
83472
83503
  if (Object.keys(internalStores).length === Object.keys(stores).length) {
83473
- import("./devtools-consolidated-pFTghgz2.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83504
+ import("./devtools-consolidated-CuKf4Mw6.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83474
83505
  setRegisteredStores(internalStores);
83475
83506
  initializeCustomDevTools();
83476
83507
  }).catch((error) => {
@@ -83483,7 +83514,7 @@ function registerStores(stores) {
83483
83514
  }
83484
83515
  }
83485
83516
  const DevToolsInternal = React__default.lazy(() => {
83486
- return import("./devtools-consolidated-pFTghgz2.js").then((module2) => ({
83517
+ return import("./devtools-consolidated-CuKf4Mw6.js").then((module2) => ({
83487
83518
  default: module2.CustomDevTools
83488
83519
  }));
83489
83520
  });
@@ -90948,14 +90979,14 @@ function getLoaderFn$1(options) {
90948
90979
  if (!(loader === "all")) return [3, 3];
90949
90980
  return [4, import(
90950
90981
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
90951
- "./allPathsLoader-CW9Ec2JW.js"
90982
+ "./allPathsLoader-DGPQhqI0.js"
90952
90983
  )];
90953
90984
  case 2:
90954
90985
  return [2, _b2.sent().allPathsLoader];
90955
90986
  case 3:
90956
90987
  return [4, import(
90957
90988
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
90958
- "./splitPathsBySizeLoader-bkDhkrOd.js"
90989
+ "./splitPathsBySizeLoader-9ypptKho.js"
90959
90990
  )];
90960
90991
  case 4:
90961
90992
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -135849,20 +135880,31 @@ const textStyleProps = {
135849
135880
  })),
135850
135881
  cellBackground: cellBackgroundProp
135851
135882
  };
135883
+ const computedValueUnion = Prop.union({
135884
+ shared: {
135885
+ isDerived: Prop.boolean().default(false)
135886
+ },
135887
+ variants: [
135888
+ {
135889
+ isDerived: Prop.literal(false)
135890
+ },
135891
+ {
135892
+ isDerived: Prop.literal(true),
135893
+ computedValue: Prop.string().readAndWrite().propertiesPanel({
135894
+ label: "Computed value"
135895
+ // todo: add special control that can use currentRow
135896
+ })
135897
+ }
135898
+ ]
135899
+ }).getProps();
135852
135900
  const textColumnProperties = {
135853
135901
  general: {
135854
- // TODO: bring this back when we are ready
135855
- // computedValue: Prop.string().readAndWrite().propertiesPanel({
135856
- // label: "Computed value",
135857
- // controlType: "COMPUTE_TABLE_VALUE",
135858
- // }),
135859
135902
  displayedValue: Prop.string().readAndWrite().propertiesPanel({
135860
135903
  label: "Displayed value",
135861
135904
  controlType: "COMPUTE_TABLE_VALUE"
135862
135905
  })
135863
135906
  },
135864
135907
  presentation: {
135865
- ...cellIconProps,
135866
135908
  textWrap: Prop.boolean().readAndWrite().propertiesPanel({
135867
135909
  label: "Wrap text",
135868
135910
  controlType: "SWITCH"
@@ -135952,11 +135994,6 @@ const buttonColumnProperties = {
135952
135994
  };
135953
135995
  const numberColumnProperties = {
135954
135996
  general: {
135955
- // TODO: bring this back when we are ready
135956
- // computedValue: Prop.string().readAndWrite().propertiesPanel({
135957
- // label: "Computed value",
135958
- // controlType: "COMPUTE_TABLE_VALUE",
135959
- // }),
135960
135997
  notation: Prop.string().readAndWrite().propertiesPanel({
135961
135998
  label: "Number format",
135962
135999
  controlType: "DROP_DOWN",
@@ -136060,6 +136097,32 @@ const imageColumnProperties = {
136060
136097
  cellBackground: cellBackgroundProp
136061
136098
  }
136062
136099
  };
136100
+ const manageTimezoneUnion = Prop.union({
136101
+ shared: {
136102
+ manageTimezone: Prop.boolean().default(false).readAndWrite().propertiesPanel({
136103
+ label: "Manage timezone",
136104
+ controlType: "SWITCH"
136105
+ })
136106
+ },
136107
+ variants: [
136108
+ {
136109
+ manageTimezone: Prop.literal(false)
136110
+ },
136111
+ {
136112
+ manageTimezone: Prop.literal(true),
136113
+ valueTimezone: Prop.string().readAndWrite().propertiesPanel({
136114
+ label: "Value timezone",
136115
+ controlType: "DROP_DOWN",
136116
+ options: TIMEZONE_OPTIONS
136117
+ }),
136118
+ displayTimezone: Prop.string().readAndWrite().propertiesPanel({
136119
+ label: "Display timezone",
136120
+ controlType: "DROP_DOWN",
136121
+ options: TIMEZONE_OPTIONS
136122
+ })
136123
+ }
136124
+ ]
136125
+ }).getProps();
136063
136126
  const dateColumnProperties = {
136064
136127
  general: {
136065
136128
  inputFormat: Prop.string().readAndWrite().propertiesPanel({
@@ -136072,21 +136135,7 @@ const dateColumnProperties = {
136072
136135
  controlType: "DROP_DOWN",
136073
136136
  options: DATE_OUTPUT_FORMATS
136074
136137
  }),
136075
- // todo: this should actually be a union too (nested unions ?)
136076
- manageTimezone: Prop.boolean().readAndWrite().propertiesPanel({
136077
- label: "Manage timezone",
136078
- controlType: "SWITCH"
136079
- }),
136080
- valueTimezone: Prop.string().readAndWrite().propertiesPanel({
136081
- label: "Value timezone",
136082
- controlType: "DROP_DOWN",
136083
- options: TIMEZONE_OPTIONS
136084
- }),
136085
- displayTimezone: Prop.string().readAndWrite().propertiesPanel({
136086
- label: "Display timezone",
136087
- controlType: "DROP_DOWN",
136088
- options: TIMEZONE_OPTIONS
136089
- })
136138
+ ...manageTimezoneUnion
136090
136139
  },
136091
136140
  presentation: {
136092
136141
  ...cellIconProps,
@@ -136098,13 +136147,7 @@ const dateColumnProperties = {
136098
136147
  }
136099
136148
  };
136100
136149
  const booleanColumnProperties = {
136101
- general: {
136102
- // TODO: bring this back when we are ready
136103
- // computedValue: Prop.string().readAndWrite().propertiesPanel({
136104
- // label: "Computed value",
136105
- // controlType: "COMPUTE_TABLE_VALUE",
136106
- // }),
136107
- },
136150
+ general: {},
136108
136151
  presentation: {
136109
136152
  horizontalAlign: horizontalAlignProp(),
136110
136153
  verticalAlign: verticalAlignProp(),
@@ -136140,26 +136183,14 @@ const booleanColumnProperties = {
136140
136183
  }
136141
136184
  };
136142
136185
  const videoColumnProperties = {
136143
- general: {
136144
- // TODO: bring this back when we are ready
136145
- // computedValue: Prop.string().readAndWrite().propertiesPanel({
136146
- // label: "Computed value",
136147
- // controlType: "COMPUTE_TABLE_VALUE",
136148
- // }),
136149
- },
136186
+ general: {},
136150
136187
  presentation: {
136151
136188
  horizontalAlign: horizontalAlignProp(),
136152
136189
  cellBackground: cellBackgroundProp
136153
136190
  }
136154
136191
  };
136155
136192
  const tagsColumnProperties = {
136156
- general: {
136157
- // TODO: bring this back when we are ready
136158
- // computedValue: Prop.string().readAndWrite().propertiesPanel({
136159
- // label: "Computed value",
136160
- // controlType: "COMPUTE_TABLE_VALUE",
136161
- // }),
136162
- },
136193
+ general: {},
136163
136194
  presentation: {
136164
136195
  horizontalAlign: horizontalAlignProp(),
136165
136196
  verticalAlign: verticalAlignProp(),
@@ -136196,54 +136227,67 @@ const columnPanelConfig = {
136196
136227
  variants: [
136197
136228
  {
136198
136229
  columnType: Prop.unset(),
136230
+ ...computedValueUnion,
136199
136231
  ...textColumnProperties.general
136200
136232
  },
136201
136233
  {
136202
136234
  columnType: Prop.literal(ColumnType.TEXT),
136235
+ ...computedValueUnion,
136203
136236
  ...textColumnProperties.general
136204
136237
  },
136205
136238
  {
136206
136239
  columnType: Prop.literal(ColumnType.NUMBER),
136240
+ ...computedValueUnion,
136207
136241
  ...numberColumnProperties.general
136208
136242
  },
136209
136243
  {
136210
136244
  columnType: Prop.literal(ColumnType.CURRENCY),
136245
+ ...computedValueUnion,
136211
136246
  ...currencyColumnProperties.general
136212
136247
  },
136213
136248
  {
136214
136249
  columnType: Prop.literal(ColumnType.PERCENTAGE),
136250
+ ...computedValueUnion,
136215
136251
  ...percentageColumnProperties.general
136216
136252
  },
136217
136253
  {
136218
136254
  columnType: Prop.literal(ColumnType.IMAGE),
136255
+ ...computedValueUnion,
136219
136256
  ...imageColumnProperties.general
136220
136257
  },
136221
136258
  {
136222
136259
  columnType: Prop.literal(ColumnType.VIDEO),
136260
+ ...computedValueUnion,
136223
136261
  ...videoColumnProperties.general
136224
136262
  },
136225
136263
  {
136226
136264
  columnType: Prop.literal(ColumnType.DATE),
136265
+ ...computedValueUnion,
136227
136266
  ...dateColumnProperties.general
136228
136267
  },
136229
136268
  {
136230
136269
  columnType: Prop.literal(ColumnType.BUTTON),
136270
+ // no computedValue (just buttonLabel)
136231
136271
  ...buttonColumnProperties.general
136232
136272
  },
136233
136273
  {
136234
136274
  columnType: Prop.literal(ColumnType.LINK),
136275
+ // no computedValue (just linkUrl/linkLabel)
136235
136276
  ...linkColumnProperties.general
136236
136277
  },
136237
136278
  {
136238
136279
  columnType: Prop.literal(ColumnType.BOOLEAN),
136280
+ ...computedValueUnion,
136239
136281
  ...booleanColumnProperties.general
136240
136282
  },
136241
136283
  {
136242
136284
  columnType: Prop.literal(ColumnType.TAGS),
136285
+ ...computedValueUnion,
136243
136286
  ...tagsColumnProperties.general
136244
136287
  },
136245
136288
  {
136246
136289
  columnType: Prop.literal(ColumnType.EMAIL),
136290
+ ...computedValueUnion,
136247
136291
  ...emailColumnProperties.general
136248
136292
  }
136249
136293
  ]
@@ -145390,14 +145434,14 @@ function getLoaderFn(options) {
145390
145434
  if (!(loader === "all")) return [3, 3];
145391
145435
  return [4, import(
145392
145436
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
145393
- "./allPathsLoader-ByP0iRQq.js"
145437
+ "./allPathsLoader-XDG2QDHX.js"
145394
145438
  )];
145395
145439
  case 2:
145396
145440
  return [2, _b2.sent().allPathsLoader];
145397
145441
  case 3:
145398
145442
  return [4, import(
145399
145443
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
145400
- "./splitPathsBySizeLoader-BrImLlIK.js"
145444
+ "./splitPathsBySizeLoader-CW0AvZcf.js"
145401
145445
  )];
145402
145446
  case 4:
145403
145447
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -162213,6 +162257,17 @@ function getSelectedRows(props2) {
162213
162257
  const selectedRows = selectedRowIndices.map((ind) => filteredTableData[ind]).filter(Boolean);
162214
162258
  return selectedRows;
162215
162259
  }
162260
+ const isDerivedColumn = (tableData, columnId) => {
162261
+ if (!tableData || tableData.length === 0) {
162262
+ return true;
162263
+ }
162264
+ const firstRow = tableData[0];
162265
+ if (!firstRow) {
162266
+ return true;
162267
+ }
162268
+ const isInRow = columnId in firstRow;
162269
+ return !isInRow;
162270
+ };
162216
162271
  function getFilteredTableData(props2) {
162217
162272
  var _a2;
162218
162273
  if (!props2.tableData) {
@@ -162244,7 +162299,8 @@ function getFilteredTableData(props2) {
162244
162299
  return;
162245
162300
  }
162246
162301
  let computedValues = [];
162247
- if (column2 && column2.computedValue) {
162302
+ if (column2 && column2.computedValue && // ignore computed values for non-derived columns (they can only use displayed values)
162303
+ isDerivedColumn(derivedTableData, columnId)) {
162248
162304
  if (lodashExports.isString(column2.computedValue)) {
162249
162305
  try {
162250
162306
  computedValues = JSON.parse(column2.computedValue);
@@ -197955,4 +198011,4 @@ export {
197955
198011
  SbTimer as y,
197956
198012
  SbApi as z
197957
198013
  };
197958
- //# sourceMappingURL=index-DZvnjpQm.js.map
198014
+ //# sourceMappingURL=index-CFz3UGkJ.js.map