@examind/block-sdk 0.1.38 → 0.1.40

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.js CHANGED
@@ -218,13 +218,33 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
218
218
  return `<x-financial-statement id="${node.id}" data-x-prompt data-x-points="${node.points}">${children.join("")}</x-financial-statement>`;
219
219
  }
220
220
  processHeaderSection(node) {
221
+ return node.columnHeaders.length < 2 ? this.processSimpleHeaderSection(node) : this.processColumnHeaderSection(node);
222
+ }
223
+ processSimpleHeaderSection(node) {
221
224
  return `<x-header>${createHtmlFromNestedEditor(node.header, {
222
225
  parentNode: node
223
- })}${this.processColumnHeadersSection(node)}</x-header>`;
224
- }
225
- processColumnHeadersSection(node) {
226
- if (node.columnHeaders.length < 2) return "";
227
- return `<div style="display:flex; width:100%; margin-top: 16px;"><div style="flex:1; font-weight:bold; text-align:left;">${node.columnHeaders[0]}</div><div style="flex:1; font-weight:bold; text-align:right;">${node.columnHeaders[1]}</div></div>`;
226
+ })}</x-header>`;
227
+ }
228
+ processColumnHeaderSection(node) {
229
+ return [
230
+ "<x-header>",
231
+ '<div style="text-align: left; font-weight: normal;">',
232
+ "<div>",
233
+ createHtmlFromNestedEditor(node.header, {
234
+ parentNode: node
235
+ }),
236
+ "</div>",
237
+ '<div style="display:flex; width:100%; margin-top: 16px;">',
238
+ '<div style="flex:1; font-weight:bold;">',
239
+ node.columnHeaders[0],
240
+ "</div>",
241
+ '<div style="flex:1; font-weight:bold; text-align:right;">',
242
+ node.columnHeaders[1],
243
+ "</div>",
244
+ "</div>",
245
+ "</div>",
246
+ "</x-header>"
247
+ ].join("");
228
248
  }
229
249
  processRowsSection(node) {
230
250
  const rowElements = [];
@@ -1414,11 +1434,8 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
1414
1434
  const contentDiv = headerElement.querySelector(
1415
1435
  'div > div:not([style*="display:flex"])'
1416
1436
  );
1417
- if (contentDiv && contentDiv instanceof import_node_html_parser7.HTMLElement) {
1418
- const contentDivClone = contentDiv.clone();
1419
- contentDivClone.setAttribute("style", "text-align: left;");
1420
- return createNestedEditorFromHtml(contentDivClone);
1421
- }
1437
+ if (contentDiv && contentDiv instanceof import_node_html_parser7.HTMLElement)
1438
+ return createNestedEditorFromHtml(contentDiv);
1422
1439
  }
1423
1440
  return createNestedEditorFromHtml(headerElement);
1424
1441
  }
package/dist/index.mjs CHANGED
@@ -191,13 +191,33 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
191
191
  return `<x-financial-statement id="${node.id}" data-x-prompt data-x-points="${node.points}">${children.join("")}</x-financial-statement>`;
192
192
  }
193
193
  processHeaderSection(node) {
194
+ return node.columnHeaders.length < 2 ? this.processSimpleHeaderSection(node) : this.processColumnHeaderSection(node);
195
+ }
196
+ processSimpleHeaderSection(node) {
194
197
  return `<x-header>${createHtmlFromNestedEditor(node.header, {
195
198
  parentNode: node
196
- })}${this.processColumnHeadersSection(node)}</x-header>`;
197
- }
198
- processColumnHeadersSection(node) {
199
- if (node.columnHeaders.length < 2) return "";
200
- return `<div style="display:flex; width:100%; margin-top: 16px;"><div style="flex:1; font-weight:bold; text-align:left;">${node.columnHeaders[0]}</div><div style="flex:1; font-weight:bold; text-align:right;">${node.columnHeaders[1]}</div></div>`;
199
+ })}</x-header>`;
200
+ }
201
+ processColumnHeaderSection(node) {
202
+ return [
203
+ "<x-header>",
204
+ '<div style="text-align: left; font-weight: normal;">',
205
+ "<div>",
206
+ createHtmlFromNestedEditor(node.header, {
207
+ parentNode: node
208
+ }),
209
+ "</div>",
210
+ '<div style="display:flex; width:100%; margin-top: 16px;">',
211
+ '<div style="flex:1; font-weight:bold;">',
212
+ node.columnHeaders[0],
213
+ "</div>",
214
+ '<div style="flex:1; font-weight:bold; text-align:right;">',
215
+ node.columnHeaders[1],
216
+ "</div>",
217
+ "</div>",
218
+ "</div>",
219
+ "</x-header>"
220
+ ].join("");
201
221
  }
202
222
  processRowsSection(node) {
203
223
  const rowElements = [];
@@ -1387,11 +1407,8 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
1387
1407
  const contentDiv = headerElement.querySelector(
1388
1408
  'div > div:not([style*="display:flex"])'
1389
1409
  );
1390
- if (contentDiv && contentDiv instanceof HTMLElement7) {
1391
- const contentDivClone = contentDiv.clone();
1392
- contentDivClone.setAttribute("style", "text-align: left;");
1393
- return createNestedEditorFromHtml(contentDivClone);
1394
- }
1410
+ if (contentDiv && contentDiv instanceof HTMLElement7)
1411
+ return createNestedEditorFromHtml(contentDiv);
1395
1412
  }
1396
1413
  return createNestedEditorFromHtml(headerElement);
1397
1414
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@examind/block-sdk",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "@comment version": [
5
5
  "Don't specify package version here. It will be injected by publish workflow."
6
6
  ],
@@ -21,7 +21,7 @@
21
21
  "peerDependencies": {
22
22
  "nanoid": ">=3.0.0",
23
23
  "node-html-parser": ">=6.0.0",
24
- "@examind/block-types": "^0.1.38"
24
+ "@examind/block-types": "^0.1.40"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "^9.17.0",
@@ -36,7 +36,7 @@
36
36
  "tsup": "^8.3.5",
37
37
  "typescript": "^5.7.2",
38
38
  "typescript-eslint": "^8.18.2",
39
- "@examind/block-types": "0.1.38"
39
+ "@examind/block-types": "0.1.40"
40
40
  },
41
41
  "dependencies": {
42
42
  "lodash-es": "4.17.21"