@dataverse-kit/export-engine 1.2.0 → 1.4.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/dist/index.cjs CHANGED
@@ -20278,7 +20278,7 @@ function walkForm(form, entities, gridById) {
20278
20278
  for (const section of sections) {
20279
20279
  for (const row of section.rows ?? []) {
20280
20280
  for (const cell of row.cells ?? []) {
20281
- for (const control of cell.controls ?? []) {
20281
+ for (const control of cellControls(cell)) {
20282
20282
  absorbControl(control, primary, entities, gridById);
20283
20283
  }
20284
20284
  }
@@ -20286,11 +20286,17 @@ function walkForm(form, entities, gridById) {
20286
20286
  }
20287
20287
  const headerCells = form.header?.cells ?? [];
20288
20288
  for (const cell of headerCells) {
20289
- for (const control of cell.controls ?? []) {
20289
+ for (const control of cellControls(cell)) {
20290
20290
  absorbControl(control, primary, entities, gridById);
20291
20291
  }
20292
20292
  }
20293
20293
  }
20294
+ function cellControls(cell) {
20295
+ return [
20296
+ ...cell.control ? [cell.control] : [],
20297
+ ...cell.controls ?? []
20298
+ ];
20299
+ }
20294
20300
  function absorbControl(control, primary, entities, gridById) {
20295
20301
  if (control.dataBinding && primary) {
20296
20302
  absorbBinding(control.dataBinding, primary);
@@ -20816,7 +20822,11 @@ function anyFormHasBindings(forms) {
20816
20822
  for (const section of sections) {
20817
20823
  for (const row of section.rows ?? []) {
20818
20824
  for (const cell of row.cells ?? []) {
20819
- for (const control of cell.controls ?? []) {
20825
+ const controls = [
20826
+ ...cell.control ? [cell.control] : [],
20827
+ ...cell.controls ?? []
20828
+ ];
20829
+ for (const control of controls) {
20820
20830
  if (control.dataBinding) return true;
20821
20831
  if (control.type === "subgrid" && typeof control.properties?.entityName === "string" && control.properties.entityName) {
20822
20832
  return true;
@@ -22541,27 +22551,6 @@ function generatePcfProject(project, options) {
22541
22551
  2
22542
22552
  ) + "\n"
22543
22553
  });
22544
- const platformLibraries = isV9 ? ` <platform-library name="React" version="18.2.0" />
22545
- <platform-library name="Fluent" version="9.46.2" />` : ` <platform-library name="React" version="16.14.0" />
22546
- <platform-library name="Fluent" version="8.29.0" />`;
22547
- const nsAttr = escapeHtml(ns);
22548
- const controlNameAttr = escapeHtml(controlName);
22549
- files.push({
22550
- path: `${controlName}/ControlManifest.Input.xml`,
22551
- content: `<?xml version="1.0" encoding="utf-8" ?>
22552
- <manifest>
22553
- <control namespace="${nsAttr}" constructor="${controlNameAttr}" version="1.0.0" display-name-key="${controlNameAttr}" description-key="${controlNameAttr} PCF Control" control-type="virtual" >
22554
- <external-service-usage enabled="false">
22555
- </external-service-usage>
22556
- <property name="value" display-name-key="Value" description-key="Primary value" of-type="SingleLine.Text" usage="bound" required="false" />
22557
- <resources>
22558
- <code path="index.ts" order="1"/>
22559
- ${platformLibraries}
22560
- </resources>
22561
- </control>
22562
- </manifest>
22563
- `
22564
- });
22565
22554
  const mainForm = project.forms.find((f) => f.type === "main") ?? project.forms[0];
22566
22555
  const mainComponentName = mainForm ? toFormComponentName(mainForm.name) : "div";
22567
22556
  const pcfIndexContent = isV9 ? `import { IInputs, IOutputs } from './generated/ManifestTypes';
@@ -22569,7 +22558,7 @@ import * as React from 'react';
22569
22558
  import * as ReactDOM from 'react-dom';
22570
22559
  import { initializeIcons } from '@fluentui/react';
22571
22560
  import { FluentProvider, webLightTheme } from '@fluentui/react-components';
22572
- import { ${mainComponentName} } from './components/${mainComponentName}';
22561
+ import { ${mainComponentName} } from './src/components/${mainComponentName}';
22573
22562
 
22574
22563
  initializeIcons();
22575
22564
 
@@ -22609,7 +22598,7 @@ export class ${controlName} implements ComponentFramework.ReactControl<IInputs,
22609
22598
  import * as React from 'react';
22610
22599
  import * as ReactDOM from 'react-dom';
22611
22600
  import { initializeIcons, ThemeProvider } from '@fluentui/react';
22612
- import { ${mainComponentName} } from './components/${mainComponentName}';
22601
+ import { ${mainComponentName} } from './src/components/${mainComponentName}';
22613
22602
 
22614
22603
  initializeIcons();
22615
22604
 
@@ -22662,6 +22651,29 @@ export class ${controlName} implements ComponentFramework.ReactControl<IInputs,
22662
22651
  content: file.content
22663
22652
  });
22664
22653
  }
22654
+ const usesGridKit = formFiles.some((f) => f.path.startsWith("src/lib/grid-kit/"));
22655
+ const platformLibraries = isV9 ? ` <platform-library name="React" version="18.2.0" />
22656
+ <platform-library name="Fluent" version="9.46.2" />` : usesGridKit ? ` <platform-library name="React" version="18.2.0" />
22657
+ <platform-library name="Fluent" version="8.115.6" />` : ` <platform-library name="React" version="16.14.0" />
22658
+ <platform-library name="Fluent" version="8.29.0" />`;
22659
+ const nsAttr = escapeHtml(ns);
22660
+ const controlNameAttr = escapeHtml(controlName);
22661
+ files.push({
22662
+ path: `${controlName}/ControlManifest.Input.xml`,
22663
+ content: `<?xml version="1.0" encoding="utf-8" ?>
22664
+ <manifest>
22665
+ <control namespace="${nsAttr}" constructor="${controlNameAttr}" version="1.0.0" display-name-key="${controlNameAttr}" description-key="${controlNameAttr} PCF Control" control-type="virtual" >
22666
+ <external-service-usage enabled="false">
22667
+ </external-service-usage>
22668
+ <property name="value" display-name-key="Value" description-key="Primary value" of-type="SingleLine.Text" usage="bound" required="false" />
22669
+ <resources>
22670
+ <code path="index.ts" order="1"/>
22671
+ ${platformLibraries}
22672
+ </resources>
22673
+ </control>
22674
+ </manifest>
22675
+ `
22676
+ });
22665
22677
  if (includeDataAccessLayer) {
22666
22678
  const dalFiles = generateDataAccessLayer(
22667
22679
  project.forms,
package/dist/index.mjs CHANGED
@@ -20258,7 +20258,7 @@ function walkForm(form, entities, gridById) {
20258
20258
  for (const section of sections) {
20259
20259
  for (const row of section.rows ?? []) {
20260
20260
  for (const cell of row.cells ?? []) {
20261
- for (const control of cell.controls ?? []) {
20261
+ for (const control of cellControls(cell)) {
20262
20262
  absorbControl(control, primary, entities, gridById);
20263
20263
  }
20264
20264
  }
@@ -20266,11 +20266,17 @@ function walkForm(form, entities, gridById) {
20266
20266
  }
20267
20267
  const headerCells = form.header?.cells ?? [];
20268
20268
  for (const cell of headerCells) {
20269
- for (const control of cell.controls ?? []) {
20269
+ for (const control of cellControls(cell)) {
20270
20270
  absorbControl(control, primary, entities, gridById);
20271
20271
  }
20272
20272
  }
20273
20273
  }
20274
+ function cellControls(cell) {
20275
+ return [
20276
+ ...cell.control ? [cell.control] : [],
20277
+ ...cell.controls ?? []
20278
+ ];
20279
+ }
20274
20280
  function absorbControl(control, primary, entities, gridById) {
20275
20281
  if (control.dataBinding && primary) {
20276
20282
  absorbBinding(control.dataBinding, primary);
@@ -20796,7 +20802,11 @@ function anyFormHasBindings(forms) {
20796
20802
  for (const section of sections) {
20797
20803
  for (const row of section.rows ?? []) {
20798
20804
  for (const cell of row.cells ?? []) {
20799
- for (const control of cell.controls ?? []) {
20805
+ const controls = [
20806
+ ...cell.control ? [cell.control] : [],
20807
+ ...cell.controls ?? []
20808
+ ];
20809
+ for (const control of controls) {
20800
20810
  if (control.dataBinding) return true;
20801
20811
  if (control.type === "subgrid" && typeof control.properties?.entityName === "string" && control.properties.entityName) {
20802
20812
  return true;
@@ -22521,27 +22531,6 @@ function generatePcfProject(project, options) {
22521
22531
  2
22522
22532
  ) + "\n"
22523
22533
  });
22524
- const platformLibraries = isV9 ? ` <platform-library name="React" version="18.2.0" />
22525
- <platform-library name="Fluent" version="9.46.2" />` : ` <platform-library name="React" version="16.14.0" />
22526
- <platform-library name="Fluent" version="8.29.0" />`;
22527
- const nsAttr = escapeHtml(ns);
22528
- const controlNameAttr = escapeHtml(controlName);
22529
- files.push({
22530
- path: `${controlName}/ControlManifest.Input.xml`,
22531
- content: `<?xml version="1.0" encoding="utf-8" ?>
22532
- <manifest>
22533
- <control namespace="${nsAttr}" constructor="${controlNameAttr}" version="1.0.0" display-name-key="${controlNameAttr}" description-key="${controlNameAttr} PCF Control" control-type="virtual" >
22534
- <external-service-usage enabled="false">
22535
- </external-service-usage>
22536
- <property name="value" display-name-key="Value" description-key="Primary value" of-type="SingleLine.Text" usage="bound" required="false" />
22537
- <resources>
22538
- <code path="index.ts" order="1"/>
22539
- ${platformLibraries}
22540
- </resources>
22541
- </control>
22542
- </manifest>
22543
- `
22544
- });
22545
22534
  const mainForm = project.forms.find((f) => f.type === "main") ?? project.forms[0];
22546
22535
  const mainComponentName = mainForm ? toFormComponentName(mainForm.name) : "div";
22547
22536
  const pcfIndexContent = isV9 ? `import { IInputs, IOutputs } from './generated/ManifestTypes';
@@ -22549,7 +22538,7 @@ import * as React from 'react';
22549
22538
  import * as ReactDOM from 'react-dom';
22550
22539
  import { initializeIcons } from '@fluentui/react';
22551
22540
  import { FluentProvider, webLightTheme } from '@fluentui/react-components';
22552
- import { ${mainComponentName} } from './components/${mainComponentName}';
22541
+ import { ${mainComponentName} } from './src/components/${mainComponentName}';
22553
22542
 
22554
22543
  initializeIcons();
22555
22544
 
@@ -22589,7 +22578,7 @@ export class ${controlName} implements ComponentFramework.ReactControl<IInputs,
22589
22578
  import * as React from 'react';
22590
22579
  import * as ReactDOM from 'react-dom';
22591
22580
  import { initializeIcons, ThemeProvider } from '@fluentui/react';
22592
- import { ${mainComponentName} } from './components/${mainComponentName}';
22581
+ import { ${mainComponentName} } from './src/components/${mainComponentName}';
22593
22582
 
22594
22583
  initializeIcons();
22595
22584
 
@@ -22642,6 +22631,29 @@ export class ${controlName} implements ComponentFramework.ReactControl<IInputs,
22642
22631
  content: file.content
22643
22632
  });
22644
22633
  }
22634
+ const usesGridKit = formFiles.some((f) => f.path.startsWith("src/lib/grid-kit/"));
22635
+ const platformLibraries = isV9 ? ` <platform-library name="React" version="18.2.0" />
22636
+ <platform-library name="Fluent" version="9.46.2" />` : usesGridKit ? ` <platform-library name="React" version="18.2.0" />
22637
+ <platform-library name="Fluent" version="8.115.6" />` : ` <platform-library name="React" version="16.14.0" />
22638
+ <platform-library name="Fluent" version="8.29.0" />`;
22639
+ const nsAttr = escapeHtml(ns);
22640
+ const controlNameAttr = escapeHtml(controlName);
22641
+ files.push({
22642
+ path: `${controlName}/ControlManifest.Input.xml`,
22643
+ content: `<?xml version="1.0" encoding="utf-8" ?>
22644
+ <manifest>
22645
+ <control namespace="${nsAttr}" constructor="${controlNameAttr}" version="1.0.0" display-name-key="${controlNameAttr}" description-key="${controlNameAttr} PCF Control" control-type="virtual" >
22646
+ <external-service-usage enabled="false">
22647
+ </external-service-usage>
22648
+ <property name="value" display-name-key="Value" description-key="Primary value" of-type="SingleLine.Text" usage="bound" required="false" />
22649
+ <resources>
22650
+ <code path="index.ts" order="1"/>
22651
+ ${platformLibraries}
22652
+ </resources>
22653
+ </control>
22654
+ </manifest>
22655
+ `
22656
+ });
22645
22657
  if (includeDataAccessLayer) {
22646
22658
  const dalFiles = generateDataAccessLayer(
22647
22659
  project.forms,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataverse-kit/export-engine",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",