@bpmn-io/form-js-playground 1.13.1 → 1.13.2

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.
@@ -67519,7 +67519,7 @@
67519
67519
  key
67520
67520
  }) => key);
67521
67521
  const evaluatedDataSource = useExpressionEvaluation(dataSource);
67522
- const data = Array.isArray(evaluatedDataSource) ? evaluatedDataSource.filter(i => i !== undefined) : [];
67522
+ const data = Array.isArray(evaluatedDataSource) ? evaluatedDataSource.filter(entry => !isNil(entry) || typeof entry !== 'object') : [];
67523
67523
  const sortedData = sortBy === null ? data : sortByColumn(data, sortBy.key, sortBy.direction);
67524
67524
 
67525
67525
  /** @type {unknown[][]} */
@@ -67529,12 +67529,6 @@
67529
67529
  p(() => {
67530
67530
  setCurrentPage(0);
67531
67531
  }, [rowCount, sortBy]);
67532
- const serializeCellData = cellData => {
67533
- if (cellData !== null && typeof cellData === 'object') {
67534
- return JSON.stringify(cellData);
67535
- }
67536
- return cellData;
67537
- };
67538
67532
 
67539
67533
  /** @param {string} key */
67540
67534
  function toggleSortBy(key) {
@@ -67804,6 +67798,17 @@
67804
67798
  }
67805
67799
  return `Click to sort by ${label} ascending`;
67806
67800
  }
67801
+
67802
+ /**
67803
+ * @param {unknown} cellData
67804
+ * @returns string
67805
+ */
67806
+ function serializeCellData(cellData) {
67807
+ if (cellData !== null && typeof cellData === 'object') {
67808
+ return JSON.stringify(cellData);
67809
+ }
67810
+ return `${cellData || ''}`;
67811
+ }
67807
67812
  const FILE_PICKER_FILE_KEY_PREFIX = 'files::';
67808
67813
  const type$1 = 'filepicker';
67809
67814
  const ids$1 = new Ids();
@@ -67989,6 +67994,7 @@
67989
67994
  /**
67990
67995
  * @typedef DocumentMetadata
67991
67996
  * @property {string} documentId
67997
+ * @property {string} contentHash
67992
67998
  * @property {Object} metadata
67993
67999
  * @property {string|undefined} [metadata.contentType]
67994
68000
  * @property {string} metadata.fileName
@@ -68148,7 +68154,11 @@
68148
68154
  const [hasError, setHasError] = h(false);
68149
68155
  const ref = _$1(null);
68150
68156
  const isInViewport = useInViewport(ref);
68151
- const fullUrl = endpoint.replace(DOCUMENT_ID_PLACEHOLDER, documentMetadata.documentId);
68157
+ const fullUrl = buildUrl({
68158
+ baseUrl: endpoint,
68159
+ documentId: documentMetadata.documentId,
68160
+ contentHash: documentMetadata.contentHash
68161
+ });
68152
68162
  const singleDocumentContainerClassName = `fjs-${type$k}-single-document-container`;
68153
68163
  const errorMessageId = `${domId}-error-message`;
68154
68164
  const errorMessage = 'Unable to download document';
@@ -68258,12 +68268,16 @@
68258
68268
 
68259
68269
  /**
68260
68270
  *
68261
- * @param {import("preact").RefObject<HTMLElement>} ref
68271
+ * @param {import("preact").RefObject<HTMLElement|null>} ref
68262
68272
  * @returns boolean
68263
68273
  */
68264
68274
  function useInViewport(ref) {
68265
68275
  const [isInViewport, setIsInViewport] = h(false);
68266
68276
  p(() => {
68277
+ const container = ref.current;
68278
+ if (!container) {
68279
+ return;
68280
+ }
68267
68281
  const observer = new IntersectionObserver(([entry]) => {
68268
68282
  if (entry.isIntersecting) {
68269
68283
  setIsInViewport(true);
@@ -68271,18 +68285,39 @@
68271
68285
  }, {
68272
68286
  threshold: 0
68273
68287
  });
68274
- if (ref.current) {
68275
- observer.observe(ref.current);
68276
- }
68288
+ observer.observe(container);
68277
68289
  return () => {
68278
- if (ref.current) {
68279
- observer.unobserve(ref.current);
68290
+ if (container) {
68291
+ observer.unobserve(container);
68280
68292
  }
68281
68293
  };
68282
68294
  }, [ref]);
68283
68295
  return isInViewport;
68284
68296
  }
68285
68297
 
68298
+ /**
68299
+ * This solution should be a temporary fix, we should try to remove it via: https://github.com/bpmn-io/form-js/issues/1341
68300
+ *
68301
+ * @param {Object} options
68302
+ * @param {string} options.baseUrl
68303
+ * @param {string} options.documentId
68304
+ * @param {string} [options.contentHash]
68305
+ *
68306
+ * @returns {string}
68307
+ */
68308
+ function buildUrl(options) {
68309
+ const {
68310
+ baseUrl,
68311
+ documentId,
68312
+ contentHash
68313
+ } = options;
68314
+ const finalUrl = new URL(baseUrl.replace(DOCUMENT_ID_PLACEHOLDER, documentId));
68315
+ if (contentHash !== undefined) {
68316
+ finalUrl.searchParams.set('contentHash', contentHash);
68317
+ }
68318
+ return decodeURI(finalUrl.toString());
68319
+ }
68320
+
68286
68321
  /**
68287
68322
  * This file must not be changed or exchanged.
68288
68323
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "A form-js playground",
5
5
  "files": [
6
6
  "dist"
@@ -45,8 +45,8 @@
45
45
  "url": "https://github.com/bpmn-io"
46
46
  },
47
47
  "dependencies": {
48
- "@bpmn-io/form-js-editor": "^1.13.1",
49
- "@bpmn-io/form-js-viewer": "^1.13.1",
48
+ "@bpmn-io/form-js-editor": "^1.13.2",
49
+ "@bpmn-io/form-js-viewer": "^1.13.2",
50
50
  "@codemirror/autocomplete": "^6.18.3",
51
51
  "@codemirror/commands": "^6.7.1",
52
52
  "@codemirror/lang-json": "^6.0.1",
@@ -71,5 +71,5 @@
71
71
  "rollup-plugin-css-only": "^4.5.2",
72
72
  "style-loader": "^4.0.0"
73
73
  },
74
- "gitHead": "bc8a9709133f283c7152ea62331bf2ff5cca0251"
74
+ "gitHead": "325bb666c75b05cd1a51c19a0d1fc437d2b71e2c"
75
75
  }