@milaboratories/milaboratories.ui-examples.model 1.3.15 → 1.3.16

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.
@@ -1,16 +1,16 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.ui-examples.model@1.3.15 build /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
3
+ > @milaboratories/milaboratories.ui-examples.model@1.3.16 build /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
4
4
  > ts-builder build --target block-model && block-tools build-model
5
5
 
6
6
  Building block-model project...
7
7
  ↳ rollup -c /configs/rollup.block-model.config.js
8
8
  
9
9
  ./src/index.ts → dist, dist...
10
- created dist, dist in 3.7s
10
+ created dist, dist in 3.8s
11
11
  
12
12
  ./src/index.ts → dist...
13
13
  (!) Circular dependency
14
14
  ../../../../sdk/model/dist/components/PFrameForGraphs.js -> ../../../../sdk/model/dist/pframe_utils/columns.js -> ../../../../sdk/model/dist/components/PFrameForGraphs.js
15
- created dist in 4.4s
15
+ created dist in 4.7s
16
16
  Build completed successfully
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.ui-examples.model@1.3.15 lint /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
3
+ > @milaboratories/milaboratories.ui-examples.model@1.3.16 lint /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
4
4
  > eslint .
5
5
 
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.ui-examples.model@1.3.15 type-check /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
3
+ > @milaboratories/milaboratories.ui-examples.model@1.3.16 type-check /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
4
4
  > ts-builder types --target block-model
5
5
 
6
6
  ↳ tsc --noEmit --project ./tsconfig.json --customConditions ,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @milaboratories/milaboratories.ui-examples.model
2
2
 
3
+ ## 1.3.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [88f33fa]
8
+ - @platforma-sdk/model@1.49.0
9
+
3
10
  ## 1.3.15
4
11
 
5
12
  ### Patch Changes
package/dist/bundle.js CHANGED
@@ -7378,7 +7378,7 @@
7378
7378
  }
7379
7379
  }
7380
7380
 
7381
- var version = "1.48.14";
7381
+ var version = "1.49.0";
7382
7382
 
7383
7383
  const PlatformaSDKVersion = version;
7384
7384
 
@@ -7398,52 +7398,52 @@
7398
7398
  * to call {@link done()} at the end of configuration. Value returned by this builder must be
7399
7399
  * exported as constant with name "platforma" from the "config" module. */
7400
7400
  class BlockModel {
7401
- _renderingMode;
7402
- _initialArgs;
7403
- _initialUiState;
7404
- _outputs;
7405
- _inputsValid;
7406
- _sections;
7407
- _title;
7408
- _enrichmentTargets;
7409
- _featureFlags;
7410
- constructor(_renderingMode, _initialArgs, _initialUiState, _outputs, _inputsValid, _sections, _title, _enrichmentTargets, _featureFlags) {
7411
- this._renderingMode = _renderingMode;
7412
- this._initialArgs = _initialArgs;
7413
- this._initialUiState = _initialUiState;
7414
- this._outputs = _outputs;
7415
- this._inputsValid = _inputsValid;
7416
- this._sections = _sections;
7417
- this._title = _title;
7418
- this._enrichmentTargets = _enrichmentTargets;
7419
- this._featureFlags = _featureFlags;
7420
- }
7421
- static INITIAL_BLOCK_FEATURE_FLAGS = {
7422
- supportsLazyState: true,
7423
- requiresUIAPIVersion: 1,
7424
- requiresModelAPIVersion: 1,
7425
- };
7401
+ config;
7402
+ constructor(config) {
7403
+ this.config = config;
7404
+ }
7405
+ static get INITIAL_BLOCK_FEATURE_FLAGS() {
7406
+ return {
7407
+ supportsLazyState: true,
7408
+ requiresUIAPIVersion: 1,
7409
+ requiresModelAPIVersion: 1,
7410
+ };
7411
+ }
7426
7412
  static create(renderingMode = 'Heavy') {
7427
- return new BlockModel(renderingMode, undefined, {}, {}, getImmediate(true), getImmediate([]), undefined, undefined, { ...BlockModel.INITIAL_BLOCK_FEATURE_FLAGS });
7413
+ return new BlockModel({
7414
+ renderingMode,
7415
+ initialUiState: {},
7416
+ outputs: {},
7417
+ inputsValid: getImmediate(true),
7418
+ sections: getImmediate([]),
7419
+ featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,
7420
+ });
7428
7421
  }
7429
7422
  output(key, cfgOrRf, flags = {}) {
7430
7423
  if (typeof cfgOrRf === 'function') {
7431
7424
  const handle = `output#${key}`;
7432
7425
  tryRegisterCallback(handle, () => cfgOrRf(new RenderCtx()));
7433
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
7434
- ...this._outputs,
7435
- [key]: {
7436
- __renderLambda: true,
7437
- handle,
7438
- ...flags,
7426
+ return new BlockModel({
7427
+ ...this.config,
7428
+ outputs: {
7429
+ ...this.config.outputs,
7430
+ [key]: {
7431
+ __renderLambda: true,
7432
+ handle,
7433
+ ...flags,
7434
+ },
7439
7435
  },
7440
- }, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7436
+ });
7437
+ }
7438
+ else {
7439
+ return new BlockModel({
7440
+ ...this.config,
7441
+ outputs: {
7442
+ ...this.config.outputs,
7443
+ [key]: cfgOrRf,
7444
+ },
7445
+ });
7441
7446
  }
7442
- else
7443
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
7444
- ...this._outputs,
7445
- [key]: cfgOrRf,
7446
- }, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7447
7447
  }
7448
7448
  /** Shortcut for {@link output} with retentive flag set to true. */
7449
7449
  retentiveOutput(key, rf) {
@@ -7452,13 +7452,20 @@
7452
7452
  argsValid(cfgOrRf) {
7453
7453
  if (typeof cfgOrRf === 'function') {
7454
7454
  tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));
7455
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, {
7456
- __renderLambda: true,
7457
- handle: 'inputsValid',
7458
- }, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7455
+ return new BlockModel({
7456
+ ...this.config,
7457
+ inputsValid: {
7458
+ __renderLambda: true,
7459
+ handle: 'inputsValid',
7460
+ },
7461
+ });
7462
+ }
7463
+ else {
7464
+ return new BlockModel({
7465
+ ...this.config,
7466
+ inputsValid: cfgOrRf,
7467
+ });
7459
7468
  }
7460
- else
7461
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, cfgOrRf, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7462
7469
  }
7463
7470
  sections(arrOrCfgOrRf) {
7464
7471
  if (Array.isArray(arrOrCfgOrRf)) {
@@ -7466,34 +7473,82 @@
7466
7473
  }
7467
7474
  else if (typeof arrOrCfgOrRf === 'function') {
7468
7475
  tryRegisterCallback('sections', () => arrOrCfgOrRf(new RenderCtx()));
7469
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, { __renderLambda: true, handle: 'sections' }, this._title, this._enrichmentTargets, this._featureFlags);
7476
+ return new BlockModel({
7477
+ ...this.config,
7478
+ sections: {
7479
+ __renderLambda: true,
7480
+ handle: 'sections',
7481
+ },
7482
+ });
7483
+ }
7484
+ else {
7485
+ return new BlockModel({
7486
+ ...this.config,
7487
+ sections: arrOrCfgOrRf,
7488
+ });
7470
7489
  }
7471
- else
7472
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, arrOrCfgOrRf, this._title, this._enrichmentTargets, this._featureFlags);
7473
7490
  }
7474
7491
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
7475
7492
  title(rf) {
7476
7493
  tryRegisterCallback('title', () => rf(new RenderCtx()));
7477
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, { __renderLambda: true, handle: 'title' }, this._enrichmentTargets, this._featureFlags);
7494
+ return new BlockModel({
7495
+ ...this.config,
7496
+ title: {
7497
+ __renderLambda: true,
7498
+ handle: 'title',
7499
+ },
7500
+ });
7501
+ }
7502
+ subtitle(rf) {
7503
+ tryRegisterCallback('subtitle', () => rf(new RenderCtx()));
7504
+ return new BlockModel({
7505
+ ...this.config,
7506
+ subtitle: {
7507
+ __renderLambda: true,
7508
+ handle: 'subtitle',
7509
+ },
7510
+ });
7511
+ }
7512
+ tags(rf) {
7513
+ tryRegisterCallback('tags', () => rf(new RenderCtx()));
7514
+ return new BlockModel({
7515
+ ...this.config,
7516
+ tags: {
7517
+ __renderLambda: true,
7518
+ handle: 'tags',
7519
+ },
7520
+ });
7478
7521
  }
7479
7522
  /**
7480
7523
  * Sets initial args for the block, this value must be specified.
7481
7524
  * @deprecated use {@link withArgs}
7482
7525
  * */
7483
7526
  initialArgs(value) {
7484
- return new BlockModel(this._renderingMode, value, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7527
+ return this.withArgs(value);
7485
7528
  }
7486
7529
  /** Sets initial args for the block, this value must be specified. */
7487
- withArgs(initialValue) {
7488
- return new BlockModel(this._renderingMode, initialValue, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7530
+ withArgs(initialArgs) {
7531
+ return new BlockModel({
7532
+ ...this.config,
7533
+ initialArgs,
7534
+ });
7489
7535
  }
7490
7536
  /** Defines type and sets initial value for block UiState. */
7491
- withUiState(initialValue) {
7492
- return new BlockModel(this._renderingMode, this._initialArgs, initialValue, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7537
+ withUiState(initialUiState) {
7538
+ return new BlockModel({
7539
+ ...this.config,
7540
+ initialUiState,
7541
+ });
7493
7542
  }
7494
7543
  /** Sets or overrides feature flags for the block. */
7495
7544
  withFeatureFlags(flags) {
7496
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, { ...this._featureFlags, ...flags });
7545
+ return new BlockModel({
7546
+ ...this.config,
7547
+ featureFlags: {
7548
+ ...this.config.featureFlags,
7549
+ ...flags,
7550
+ },
7551
+ });
7497
7552
  }
7498
7553
  /**
7499
7554
  * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
@@ -7501,43 +7556,50 @@
7501
7556
  */
7502
7557
  enriches(lambda) {
7503
7558
  tryRegisterCallback('enrichmentTargets', lambda);
7504
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, { __renderLambda: true, handle: 'enrichmentTargets' }, this._featureFlags);
7559
+ return new BlockModel({
7560
+ ...this.config,
7561
+ enrichmentTargets: {
7562
+ __renderLambda: true,
7563
+ handle: 'enrichmentTargets',
7564
+ },
7565
+ });
7505
7566
  }
7506
7567
  /** Renders all provided block settings into a pre-configured platforma API
7507
7568
  * instance, that can be used in frontend to interact with block state, and
7508
7569
  * other features provided by the platforma to the block. */
7509
- done(apiVersion) {
7510
- const requiresUIAPIVersion = apiVersion ?? 1;
7570
+ done(apiVersion = 1) {
7511
7571
  return this.withFeatureFlags({
7512
- ...this._featureFlags,
7513
- requiresUIAPIVersion,
7514
- })._done(requiresUIAPIVersion);
7572
+ ...this.config.featureFlags,
7573
+ requiresUIAPIVersion: apiVersion,
7574
+ }).#done();
7515
7575
  }
7516
- _done(apiVersion) {
7517
- if (this._initialArgs === undefined)
7576
+ #done() {
7577
+ if (this.config.initialArgs === undefined)
7518
7578
  throw new Error('Initial arguments not set.');
7519
7579
  const config = {
7520
7580
  v3: {
7521
7581
  sdkVersion: PlatformaSDKVersion,
7522
- renderingMode: this._renderingMode,
7523
- initialArgs: this._initialArgs,
7524
- initialUiState: this._initialUiState,
7525
- inputsValid: this._inputsValid,
7526
- sections: this._sections,
7527
- title: this._title,
7528
- outputs: this._outputs,
7529
- enrichmentTargets: this._enrichmentTargets,
7530
- featureFlags: this._featureFlags,
7582
+ renderingMode: this.config.renderingMode,
7583
+ initialArgs: this.config.initialArgs,
7584
+ initialUiState: this.config.initialUiState,
7585
+ inputsValid: this.config.inputsValid,
7586
+ sections: this.config.sections,
7587
+ title: this.config.title,
7588
+ subtitle: this.config.subtitle,
7589
+ tags: this.config.tags,
7590
+ outputs: this.config.outputs,
7591
+ enrichmentTargets: this.config.enrichmentTargets,
7592
+ featureFlags: this.config.featureFlags,
7531
7593
  },
7532
7594
  // fields below are added to allow previous desktop versions read generated configs
7533
7595
  sdkVersion: PlatformaSDKVersion,
7534
- renderingMode: this._renderingMode,
7535
- initialArgs: this._initialArgs,
7536
- inputsValid: downgradeCfgOrLambda(this._inputsValid),
7537
- sections: downgradeCfgOrLambda(this._sections),
7538
- outputs: Object.fromEntries(Object.entries(this._outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)])),
7596
+ renderingMode: this.config.renderingMode,
7597
+ initialArgs: this.config.initialArgs,
7598
+ inputsValid: downgradeCfgOrLambda(this.config.inputsValid),
7599
+ sections: downgradeCfgOrLambda(this.config.sections),
7600
+ outputs: Object.fromEntries(Object.entries(this.config.outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)])),
7539
7601
  };
7540
- globalThis.platformaApiVersion = apiVersion;
7602
+ globalThis.platformaApiVersion = this.config.featureFlags.requiresUIAPIVersion;
7541
7603
  if (!isInUI())
7542
7604
  // we are in the configuration rendering routine, not in actual UI
7543
7605
  return { config };