@nanoporetech-digital/components 8.18.0 → 8.19.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/cjs/{nano-data-table-CiPPql2J.js → nano-data-table-BC1htsdm.js} +47 -7
- package/dist/cjs/nano-data-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-D7SJpZlV.js → table.worker-BXs-g6xI.js} +2 -2
- package/dist/{esm/table.worker-TTndpijX.js → cjs/table.worker-DM_2DNEe.js} +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/collection/components/data-table/table.property-utils.js +35 -0
- package/dist/collection/components/data-table/table.store.js +11 -5
- package/dist/collection/components/data-table/table.utils.js +6 -1
- package/dist/collection/components/data-table/table.worker.js +16 -10
- package/dist/components/nano-data-table.js +46 -6
- package/dist/components/table.worker.js +1 -1
- package/dist/esm/{nano-data-table-BXdzSqWC.js → nano-data-table-Bn4l0Q3q.js} +47 -7
- package/dist/esm/nano-data-table.entry.js +1 -1
- package/dist/esm/{table.worker-DftFV8Z7.js → table.worker-BMDbprO8.js} +2 -2
- package/dist/{nano-components/table.worker-TTndpijX.js → esm/table.worker-DM_2DNEe.js} +1 -1
- package/dist/nano-components/nano-data-table-Bn4l0Q3q.js +4 -0
- package/dist/nano-components/nano-data-table.entry.js +1 -1
- package/dist/nano-components/table.worker-BMDbprO8.js +4 -0
- package/dist/{cjs/table.worker-TTndpijX.js → nano-components/table.worker-DM_2DNEe.js} +1 -1
- package/dist/types/components/data-table/table.property-utils.d.ts +7 -0
- package/dist/types/components/data-table/table.utils.d.ts +2 -1
- package/docs-json.json +2 -2
- package/hydrate/index.js +61 -16
- package/hydrate/index.mjs +61 -16
- package/package.json +2 -2
- package/dist/nano-components/nano-data-table-BXdzSqWC.js +0 -4
- package/dist/nano-components/table.worker-DftFV8Z7.js +0 -4
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/generate-vue-component.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/index.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/output-vue.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/plugin.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/types.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/plugins/stencil/vue-output/utils.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/stencil.config.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/stencil.config.prod.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/testing/mocks/intersection-observer.d.ts +0 -0
- /package/dist/types/builds/{QrfEi4pt → 7a-7ssxC}/0/Digital/nano-components/packages/components/.stencil/wdio.conf.d.ts +0 -0
|
@@ -114,7 +114,7 @@ const createWorkerProxy = (worker, workerMsgId, exportedMethod) => (
|
|
|
114
114
|
})
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
-
const workerPromise = Promise.resolve().then(function () { return require('./table.worker-
|
|
117
|
+
const workerPromise = Promise.resolve().then(function () { return require('./table.worker-BXs-g6xI.js'); }).then(m => m.worker);
|
|
118
118
|
const createWorkerStore = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'createWorkerStore');
|
|
119
119
|
const syncConfigToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncConfigToWorker');
|
|
120
120
|
const syncDataToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncDataToWorker');
|
|
@@ -195,8 +195,9 @@ function storeSetData(host, rows) {
|
|
|
195
195
|
// try our best to discern the column type (from first row) if unset
|
|
196
196
|
if (unknownCols.length && i === 0) {
|
|
197
197
|
store.config.state.columns = cols.map((col) => {
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
const val = getNestedProperty(row, col.prop);
|
|
199
|
+
if (unknownCols.includes(col) && val && !col.type) {
|
|
200
|
+
col.type = getDataType(val);
|
|
200
201
|
if (col.type === 'date')
|
|
201
202
|
dateCols.push(col.prop);
|
|
202
203
|
}
|
|
@@ -207,12 +208,16 @@ function storeSetData(host, rows) {
|
|
|
207
208
|
dateCols.forEach((colName) => {
|
|
208
209
|
// coerce any date type;
|
|
209
210
|
// Date(), timestamp, valid date string
|
|
210
|
-
const
|
|
211
|
-
|
|
211
|
+
const cellValue = getNestedProperty(row, colName);
|
|
212
|
+
const coerceDate = new Date(cellValue);
|
|
213
|
+
if (!!coerceDate && Number(coerceDate)) {
|
|
214
|
+
// Store as a flattened property (e.g., row["user.birthDate"])
|
|
215
|
+
// getNestedProperty will check this first before traversing nested structure
|
|
212
216
|
row[colName] = Number(coerceDate);
|
|
217
|
+
}
|
|
213
218
|
});
|
|
214
219
|
row['__index'] = i;
|
|
215
|
-
row['__uuid'] = math.cyrb53(cols.map((c) => row
|
|
220
|
+
row['__uuid'] = math.cyrb53(cols.map((c) => getNestedProperty(row, c.prop)).join());
|
|
216
221
|
return row;
|
|
217
222
|
});
|
|
218
223
|
store.data.state.rows = rows;
|
|
@@ -261,6 +266,39 @@ async function storeSort(host, prop, order) {
|
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
|
|
269
|
+
// Separate file (so it's safe to import into the worker)
|
|
270
|
+
/**
|
|
271
|
+
* Accesses a nested property using dot notation.
|
|
272
|
+
* @param obj - the object to access
|
|
273
|
+
* @param path - the property path (e.g., 'props.nested.name')
|
|
274
|
+
* @returns the value at the path, or undefined if not found
|
|
275
|
+
*/
|
|
276
|
+
function getNestedProperty(obj, path) {
|
|
277
|
+
if (!obj || path === null || path === undefined)
|
|
278
|
+
return undefined;
|
|
279
|
+
// Convert to string for consistent handling
|
|
280
|
+
const pathStr = String(path);
|
|
281
|
+
// Check for a flattened property first (optimization for transformed values)
|
|
282
|
+
// e.g., obj["user.birthDate"] takes precedence over obj.user.birthDate
|
|
283
|
+
if (obj[pathStr] !== undefined) {
|
|
284
|
+
return obj[pathStr];
|
|
285
|
+
}
|
|
286
|
+
// If the path doesn't contain a dot, just return the direct property
|
|
287
|
+
if (!pathStr.includes('.')) {
|
|
288
|
+
return obj[path];
|
|
289
|
+
}
|
|
290
|
+
// Split the path and traverse the object
|
|
291
|
+
const keys = pathStr.split('.');
|
|
292
|
+
let result = obj;
|
|
293
|
+
for (const key of keys) {
|
|
294
|
+
if (result === null || result === undefined) {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
result = result[key];
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
|
|
264
302
|
/**
|
|
265
303
|
* Get a model object for custom cell / property renderers.
|
|
266
304
|
* @param rowIndex - the current row index being rendered
|
|
@@ -274,7 +312,9 @@ function colDataModel(rowIndex, colIndex) {
|
|
|
274
312
|
const column = columns[colIndex];
|
|
275
313
|
const prop = column?.prop;
|
|
276
314
|
const rowModel = rows[rowIndex];
|
|
277
|
-
const cellModel = rowModel
|
|
315
|
+
const cellModel = rowModel
|
|
316
|
+
? getNestedProperty(rowModel, columns[colIndex].prop)
|
|
317
|
+
: '';
|
|
278
318
|
return {
|
|
279
319
|
prop,
|
|
280
320
|
cellModel,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var nanoDataTable_entry = require('./nano-data-table-
|
|
6
|
+
var nanoDataTable_entry = require('./nano-data-table-BC1htsdm.js');
|
|
7
7
|
require('./index-DGttnXif.js');
|
|
8
8
|
require('./renderer-jVpDRMfV.js');
|
|
9
9
|
require('./math-DIjJ3V87.js');
|
|
@@ -14,7 +14,7 @@ require('./index-CkLcAUj-.js');
|
|
|
14
14
|
|
|
15
15
|
const workerName = 'table.worker';
|
|
16
16
|
const workerMsgId = 'stencil.table.worker';
|
|
17
|
-
const workerPath = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__dirname + '/table.worker-
|
|
17
|
+
const workerPath = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__dirname + '/table.worker-DM_2DNEe.js').href : new URL('table.worker-DM_2DNEe.js', document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || document.baseURI).href);
|
|
18
18
|
exports.worker = void 0;
|
|
19
19
|
try {
|
|
20
20
|
// first try directly starting the worker with the URL
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Custom elements for Nanopore-Digital Web applications
|
|
3
3
|
*/
|
|
4
|
-
(()=>{const n=(n,t)=>{const r=globalThis[t];return null!=r&&n instanceof r},t=r=>{if(null!=r){if(n(r,"ArrayBuffer")||n(r,"MessagePort")||n(r,"ImageBitmap")||n(r,"OffscreenCanvas"))return[r];if("object"==typeof r)return r.constructor===Object&&(r=Object.values(r)),Array.isArray(r)?r.flatMap(t):t(r.buffer)}return[]},r={},e="stencil.table.worker",o=e+".cb";addEventListener("message",(async({data:n})=>{if(n&&n[0]===e){let u,i,c=n[1],s=n[2],f=n[3],a=0,l=f.length;try{for(;a<l;a++)if(Array.isArray(f[a])&&f[a][0]===o){const n=f[a][1];f[a]=(...t)=>{postMessage([o,n,t])}}u=await r[s](...f)}catch(n){u=null,i=n instanceof Error?{isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:{isError:!1,value:n},u=void 0}const p=t(u);postMessage([e,c,u,i],p)}}));var u,i,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var f=s(function(){if(i)return u;i=1;var n=/[\\^$.*+?()[\]{}|]/g,t=RegExp(n.source),r="object"==typeof self&&self&&self.Object===Object&&self,e="object"==typeof c&&c&&c.Object===Object&&c||r||Function("return this")(),o=Object.prototype.toString,s=e.Symbol,f=s?s.prototype:void 0,a=f?f.toString:void 0;return u=function(r){var e;return(r=null==(e=r)?"":function(n){if("string"==typeof n)return n;if(function(n){return"symbol"==typeof n||function(n){return!!n&&"object"==typeof n}(n)&&"[object Symbol]"==o.call(n)}(n))return a?a.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}(e))&&t.test(r)?r.replace(n,"\\$&"):r}}());function a(n,t,r,e){if("object"!=typeof n){if("exists"===t.type)return!!t.key.test(r.join("."))&&!!n;{const o=r.join(".");for(const n of e.ignorePaths)if(n.test(o))return!1;if(e.includePaths){let n=!1;for(const t of e.includePaths)if(t.test(o)){n=!0;break}if(!n)return!1}return!(t.key&&!t.key.test(o))&&function(n,t){return"string"==typeof n?t.checkString(n):"number"==typeof n&&t.checkNumber(n)}(n,t)}}if(Array.isArray(n)){for(const o of n)if(a(o,t,r,e))return!0}else for(const o in n){r.push(o);const u=a(n[o],t,r,e);if(r.pop(),u)return!0}return!1}function l(n,t,r,e){if(t.length>0){let o=!1;for(const u of t)if(a(n,u,[],e)?!u.negate:u.negate){if("OR"===r)return!0;o=!0}else if("AND"===r)return!1;return o}return!0}function p(n,t){const r=[];let e=!1,o=0,u="";for(let i=0;i<n.length;i++){const c=n[i];e?c===u&&(e=!1,u=""):'"'===c||"'"===c?(e=!0,u=c):c.match(t)&&!e&&(r.push(n.slice(o,i).trim()),o=i+1),i===n.length-1&&r.push(n.slice(o).trim())}return r.map((n=>n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n)).filter(Boolean)}const d={"<":function(n){const t=Number(n[0]);return n=>n<t},"<=":function(n){const t=Number(n[0]);return n=>n<=t},"=":function(n){const t=n[0].split(",").filter(Boolean).map(Number);return n=>{for(const r of t)if(n===r)return!0;return!1}},">=":function(n){const t=Number(n[0]);return n=>n>=t},">":function(n){const t=Number(n[0]);return n=>n>t},"..":function(n){const t=Number(n[0]),r=Number(n[1]);return n=>n>=t&&n<=r}};function w(n){const{values:t,operator:r}=function(n){const t=/^\s*\(?\s*(?<startOperator><=|>=|<|=|>|\.\.\s*)?\s*(?<firstValue>-?\d*\.?\d+)\s*(?:(?<afterDots>\.\.)\s*(?<secondValue>-?\d*\.?\d*))?\s*\)?\s*$/.exec(n);if(!t)return{operator:"=",values:[n]};if(!t.groups)throw new Error("unreachable");const{startOperator:r,firstValue:e,afterDots:o,secondValue:u}=t.groups;let i=r;const c=e?[e]:[];return".."===r?i="<=":r||!o||u?o&&(i=".."):i=">=",u&&(Number(u)<Number(e)?c.unshift(u):c.push(u)),{values:c,operator:i||"="}}(n),e=d[r];if(!e)throw new Error(`unknown operator ${r}`);return e(t)}const h={"<":function(n){return t=>t<n[0]},"<=":function(n){return t=>t<=n[0]},"=":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(`^${f(n)}$`,t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},"~":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(f(n),t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},">=":function(n){return t=>t>=n[0]},">":function(n){return t=>t>n[0]},"..":function(n){return t=>t>=n[0]&&t<=n[1]}};function y(n,t){const{values:r,operator:e}=function(n){const t=n.split(".."),r=/^\s*\(?(?<operator><=|<|=|>=|>)?\s*(?<value>\S*)\s*\)?$/.exec(t[0]);if(!r)return{operator:"~",values:[n]};if(!r.groups)throw new Error("unreachable");const{value:e}=r.groups;let{operator:o}=r.groups;const u=t[1]?.trim();let i=[e];return t.length>1&&(o="..",u?e?e<u?i.push(u):i.unshift(u):(i=[u],o="<="):o=">="),{operator:o||"~",values:i}}(n),o=h[e];if(!o)throw new Error(`unreachable unknown operator ${e}`);return o(r,t)}function
|
|
4
|
+
(()=>{const n=(n,t)=>{const r=globalThis[t];return null!=r&&n instanceof r},t=r=>{if(null!=r){if(n(r,"ArrayBuffer")||n(r,"MessagePort")||n(r,"ImageBitmap")||n(r,"OffscreenCanvas"))return[r];if("object"==typeof r)return r.constructor===Object&&(r=Object.values(r)),Array.isArray(r)?r.flatMap(t):t(r.buffer)}return[]},r={},e="stencil.table.worker",o=e+".cb";addEventListener("message",(async({data:n})=>{if(n&&n[0]===e){let u,i,c=n[1],s=n[2],f=n[3],a=0,l=f.length;try{for(;a<l;a++)if(Array.isArray(f[a])&&f[a][0]===o){const n=f[a][1];f[a]=(...t)=>{postMessage([o,n,t])}}u=await r[s](...f)}catch(n){u=null,i=n instanceof Error?{isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:{isError:!1,value:n},u=void 0}const p=t(u);postMessage([e,c,u,i],p)}}));var u,i,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var f=s(function(){if(i)return u;i=1;var n=/[\\^$.*+?()[\]{}|]/g,t=RegExp(n.source),r="object"==typeof self&&self&&self.Object===Object&&self,e="object"==typeof c&&c&&c.Object===Object&&c||r||Function("return this")(),o=Object.prototype.toString,s=e.Symbol,f=s?s.prototype:void 0,a=f?f.toString:void 0;return u=function(r){var e;return(r=null==(e=r)?"":function(n){if("string"==typeof n)return n;if(function(n){return"symbol"==typeof n||function(n){return!!n&&"object"==typeof n}(n)&&"[object Symbol]"==o.call(n)}(n))return a?a.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}(e))&&t.test(r)?r.replace(n,"\\$&"):r}}());function a(n,t,r,e){if("object"!=typeof n){if("exists"===t.type)return!!t.key.test(r.join("."))&&!!n;{const o=r.join(".");for(const n of e.ignorePaths)if(n.test(o))return!1;if(e.includePaths){let n=!1;for(const t of e.includePaths)if(t.test(o)){n=!0;break}if(!n)return!1}return!(t.key&&!t.key.test(o))&&function(n,t){return"string"==typeof n?t.checkString(n):"number"==typeof n&&t.checkNumber(n)}(n,t)}}if(Array.isArray(n)){for(const o of n)if(a(o,t,r,e))return!0}else for(const o in n){r.push(o);const u=a(n[o],t,r,e);if(r.pop(),u)return!0}return!1}function l(n,t,r,e){if(t.length>0){let o=!1;for(const u of t)if(a(n,u,[],e)?!u.negate:u.negate){if("OR"===r)return!0;o=!0}else if("AND"===r)return!1;return o}return!0}function p(n,t){const r=[];let e=!1,o=0,u="";for(let i=0;i<n.length;i++){const c=n[i];e?c===u&&(e=!1,u=""):'"'===c||"'"===c?(e=!0,u=c):c.match(t)&&!e&&(r.push(n.slice(o,i).trim()),o=i+1),i===n.length-1&&r.push(n.slice(o).trim())}return r.map((n=>n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n)).filter(Boolean)}const d={"<":function(n){const t=Number(n[0]);return n=>n<t},"<=":function(n){const t=Number(n[0]);return n=>n<=t},"=":function(n){const t=n[0].split(",").filter(Boolean).map(Number);return n=>{for(const r of t)if(n===r)return!0;return!1}},">=":function(n){const t=Number(n[0]);return n=>n>=t},">":function(n){const t=Number(n[0]);return n=>n>t},"..":function(n){const t=Number(n[0]),r=Number(n[1]);return n=>n>=t&&n<=r}};function w(n){const{values:t,operator:r}=function(n){const t=/^\s*\(?\s*(?<startOperator><=|>=|<|=|>|\.\.\s*)?\s*(?<firstValue>-?\d*\.?\d+)\s*(?:(?<afterDots>\.\.)\s*(?<secondValue>-?\d*\.?\d*))?\s*\)?\s*$/.exec(n);if(!t)return{operator:"=",values:[n]};if(!t.groups)throw new Error("unreachable");const{startOperator:r,firstValue:e,afterDots:o,secondValue:u}=t.groups;let i=r;const c=e?[e]:[];return".."===r?i="<=":r||!o||u?o&&(i=".."):i=">=",u&&(Number(u)<Number(e)?c.unshift(u):c.push(u)),{values:c,operator:i||"="}}(n),e=d[r];if(!e)throw new Error(`unknown operator ${r}`);return e(t)}const h={"<":function(n){return t=>t<n[0]},"<=":function(n){return t=>t<=n[0]},"=":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(`^${f(n)}$`,t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},"~":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(f(n),t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},">=":function(n){return t=>t>=n[0]},">":function(n){return t=>t>n[0]},"..":function(n){return t=>t>=n[0]&&t<=n[1]}};function y(n,t){const{values:r,operator:e}=function(n){const t=n.split(".."),r=/^\s*\(?(?<operator><=|<|=|>=|>)?\s*(?<value>\S*)\s*\)?$/.exec(t[0]);if(!r)return{operator:"~",values:[n]};if(!r.groups)throw new Error("unreachable");const{value:e}=r.groups;let{operator:o}=r.groups;const u=t[1]?.trim();let i=[e];return t.length>1&&(o="..",u?e?e<u?i.push(u):i.unshift(u):(i=[u],o="<="):o=">="),{operator:o||"~",values:i}}(n),o=h[e];if(!o)throw new Error(`unreachable unknown operator ${e}`);return o(r,t)}function g(n,t={}){const{index:r=!1,predicate:e="AND",ignorePaths:o=[],includePaths:u,pathAlias:i={}}=t,c=t.limit||1/0,s=t.caseSensitive?"":"i";let a=t.keywords||[];const d=function(n,t){const{insensitive:r}=t,e={};for(const[t,o]of Object.entries(n))e[t]=o instanceof RegExp?o:new RegExp(`(^|\\.)${f(o)}(\\.|$)`,r);return e}(i,{insensitive:s}),h=o.map((n=>"string"==typeof n?new RegExp(`(^|\\.)${f(n)}(\\.|$)`,s):n)),g=u?u.map((n=>"string"==typeof n?new RegExp(`(^|\\.)${f(n)}(\\.|$)`,s):n)):void 0;"string"==typeof a&&(a=p(a,/[\t\n\r ]/));const b=function(n,t={}){return n.map((n=>function(n,t={}){const{caseSensitive:r,pathAlias:e={}}=t,o=r?"":"i";let u=!1;n.startsWith("-")&&(u=!0,n=n.slice(1));const i=n.indexOf(":");if(-1!==i){const t=n.slice(Math.max(0,i+1));if(i>0){const r=n.slice(0,Math.max(0,i));return"is"===r?{type:"exists",negate:u,key:new RegExp(`(^|\\.)${f(t)}(\\.|$)`,o)}:{type:"matches",negate:u,key:e[r]||new RegExp(`(^|\\.)${f(r)}(\\.|$)`,o),checkNumber:w(t),checkString:y(t,o)}}}return{type:"matches",negate:u,checkNumber:w(n),checkString:y(n,o)}}(n,t)))}(a,{caseSensitive:t.caseSensitive,pathAlias:d});let v=0;if(r){const t=[];for(let r=0;r<n.length&&v<c;r++)l(n[r],b,e,{ignorePaths:h,includePaths:g})&&(v=t.push(r));return t}{const t=[];for(let r=0;r<n.length&&v<c;r++)l(n[r],b,e,{ignorePaths:h,includePaths:g})&&(v=t.push(n[r]));return t}}function b(n,t){if(!n||null==t)return;const r=String(t);if(void 0!==n[r])return n[r];if(!r.includes("."))return n[t];const e=r.split(".");let o=n;for(const n of e){if(null==o)return;o=o[n]}return o}const v=new Map;async function m(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);if(r.searchTerm=t,!t||!t.length)return r.filterRows=r.rows,$(r,r.rows);const e=r.columns.filter((n=>!1!==n.searchable));return r.filterRows=g(r.rows,{keywords:t,predicate:"OR",includePaths:[...e.map((n=>n.prop))],ignorePaths:["__uuid","__index"]}),$(r,r.filterRows)}function E(n,t,r=[],e=!1){return r&&r.length||e||(r=function(n){return n.columns.filter((n=>null!=n.filter)).reduce(((n,t)=>{const{prop:r,filter:e}=t;return n.push({prop:r,filter:e}),n}),[])}(n)),r&&r.length?(r.forEach((n=>{t="boolean"==typeof n.filter?t.filter((t=>b(t,n.prop)===n.filter)):g(t,{predicate:"string"==typeof n.filter?"AND":"OR",keywords:n.filter,includePaths:[n.prop],ignorePaths:["__uuid","__index"]})})),t):t}function k(n,t,r,e){if(!r&&!e){const t=function(n){const t=n.columns.find((n=>!!n.order));if(t){const{prop:n,order:r}=t;return{prop:n,order:r}}return null}(n);t&&({prop:r,order:e}=t)}if(!r||!e||!t.length)return t;const o=n.columns.find((n=>n.prop===r));return o?.sortCompareFn&&"function"==typeof o.sortCompareFn?t.slice().sort(o.sortCompareFn(r,e)):"text"===o?.type&&"string"==typeof b(t[0],r)?t.slice().sort(((n,t)=>{const o=b(n,r),u=b(t,r);return o?u?"asc"===e?o.localeCompare(u):u.localeCompare(o):-1:1})):t.slice().sort(((n,t)=>{const o=b(n,r),u=b(t,r);return[void 0,null].includes(o)?1:[void 0,null].includes(u)?-1:o<u?"asc"===e?-1:1:o>u?"asc"===e?1:-1:0}))}function $(n,t){return k(n,t=E(n,t))}function x(n){return n.map((n=>(n?.sortCompareFn&&"string"==typeof n.sortCompareFn&&(n.sortCompareFn=new Function("return "+n.sortCompareFn)()),n)))}async function N(n){v.delete(n)}r.createWorkerStore=async function(n,t){const r=Date.now().toString(36)+Math.random().toString(36).substring(2);return v.set(r,{rows:n,columns:x(t)}),r},r.destroyWorkerStore=N,r.syncConfigToWorker=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);return r.columns=x(t),r.rows||r.columns||N(n),!0},r.syncDataToWorker=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);return r.rows=t,r.rows||r.columns||N(n),!0},r.workerFilter=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);const e=t&&t.length||!r.searchTerm?r.searchTerm?r.filterRows:r.rows:await m(n,r.searchTerm);return r.filterRows=E(r,e,t,!0),k(r,r.filterRows)},r.workerSearch=m,r.workerSort=async function(n,t,r){const e=v.get(n);if(!e)throw new Error("cannot find worker with ID "+n);return k(e,e.filterRows||e.rows,t,r)}})();
|
|
@@ -89,7 +89,7 @@ export class NanoBreadcrumb {
|
|
|
89
89
|
"references": {
|
|
90
90
|
"Breadcrumb": {
|
|
91
91
|
"location": "local",
|
|
92
|
-
"path": "/builds/
|
|
92
|
+
"path": "/builds/7a-7ssxC/0/Digital/nano-components/packages/components/src/components/breadcrumb/breadcrumb.tsx",
|
|
93
93
|
"id": "src/components/breadcrumb/breadcrumb.tsx::Breadcrumb"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Custom elements for Nanopore-Digital Web applications
|
|
3
|
+
*/
|
|
4
|
+
// Separate file (so it's safe to import into the worker)
|
|
5
|
+
/**
|
|
6
|
+
* Accesses a nested property using dot notation.
|
|
7
|
+
* @param obj - the object to access
|
|
8
|
+
* @param path - the property path (e.g., 'props.nested.name')
|
|
9
|
+
* @returns the value at the path, or undefined if not found
|
|
10
|
+
*/
|
|
11
|
+
export function getNestedProperty(obj, path) {
|
|
12
|
+
if (!obj || path === null || path === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
// Convert to string for consistent handling
|
|
15
|
+
const pathStr = String(path);
|
|
16
|
+
// Check for a flattened property first (optimization for transformed values)
|
|
17
|
+
// e.g., obj["user.birthDate"] takes precedence over obj.user.birthDate
|
|
18
|
+
if (obj[pathStr] !== undefined) {
|
|
19
|
+
return obj[pathStr];
|
|
20
|
+
}
|
|
21
|
+
// If the path doesn't contain a dot, just return the direct property
|
|
22
|
+
if (!pathStr.includes('.')) {
|
|
23
|
+
return obj[path];
|
|
24
|
+
}
|
|
25
|
+
// Split the path and traverse the object
|
|
26
|
+
const keys = pathStr.split('.');
|
|
27
|
+
let result = obj;
|
|
28
|
+
for (const key of keys) {
|
|
29
|
+
if (result === null || result === undefined) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
result = result[key];
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { createStore } from "@stencil/store";
|
|
5
5
|
import { cyrb53 } from "../../utils/math";
|
|
6
6
|
import { createWorkerStore, syncConfigToWorker, syncDataToWorker, workerFilter, workerSearch, workerSort, } from "./table.worker";
|
|
7
|
+
import { getNestedProperty } from "./table.utils";
|
|
7
8
|
function colsToWorker(columns) {
|
|
8
9
|
const safeColumns = JSON.parse(JSON.stringify(columns));
|
|
9
10
|
columns.forEach((c) => {
|
|
@@ -77,8 +78,9 @@ export function storeSetData(host, rows) {
|
|
|
77
78
|
// try our best to discern the column type (from first row) if unset
|
|
78
79
|
if (unknownCols.length && i === 0) {
|
|
79
80
|
store.config.state.columns = cols.map((col) => {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
const val = getNestedProperty(row, col.prop);
|
|
82
|
+
if (unknownCols.includes(col) && val && !col.type) {
|
|
83
|
+
col.type = getDataType(val);
|
|
82
84
|
if (col.type === 'date')
|
|
83
85
|
dateCols.push(col.prop);
|
|
84
86
|
}
|
|
@@ -89,12 +91,16 @@ export function storeSetData(host, rows) {
|
|
|
89
91
|
dateCols.forEach((colName) => {
|
|
90
92
|
// coerce any date type;
|
|
91
93
|
// Date(), timestamp, valid date string
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
+
const cellValue = getNestedProperty(row, colName);
|
|
95
|
+
const coerceDate = new Date(cellValue);
|
|
96
|
+
if (!!coerceDate && Number(coerceDate)) {
|
|
97
|
+
// Store as a flattened property (e.g., row["user.birthDate"])
|
|
98
|
+
// getNestedProperty will check this first before traversing nested structure
|
|
94
99
|
row[colName] = Number(coerceDate);
|
|
100
|
+
}
|
|
95
101
|
});
|
|
96
102
|
row['__index'] = i;
|
|
97
|
-
row['__uuid'] = cyrb53(cols.map((c) => row
|
|
103
|
+
row['__uuid'] = cyrb53(cols.map((c) => getNestedProperty(row, c.prop)).join());
|
|
98
104
|
return row;
|
|
99
105
|
});
|
|
100
106
|
store.data.state.rows = rows;
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import { getRenderingRef, getElement, h, Fragment } from "@stencil/core";
|
|
5
5
|
import { getStore } from "./table.store";
|
|
6
6
|
import { CSSNAMESPACE } from "./table.constants";
|
|
7
|
+
import { getNestedProperty } from "./table.property-utils";
|
|
8
|
+
// Re-export for convenience
|
|
9
|
+
export { getNestedProperty };
|
|
7
10
|
/**
|
|
8
11
|
* Get a model object for custom cell / property renderers.
|
|
9
12
|
* @param rowIndex - the current row index being rendered
|
|
@@ -17,7 +20,9 @@ export function colDataModel(rowIndex, colIndex) {
|
|
|
17
20
|
const column = columns[colIndex];
|
|
18
21
|
const prop = column?.prop;
|
|
19
22
|
const rowModel = rows[rowIndex];
|
|
20
|
-
const cellModel = rowModel
|
|
23
|
+
const cellModel = rowModel
|
|
24
|
+
? getNestedProperty(rowModel, columns[colIndex].prop)
|
|
25
|
+
: '';
|
|
21
26
|
return {
|
|
22
27
|
prop,
|
|
23
28
|
cellModel,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Custom elements for Nanopore-Digital Web applications
|
|
3
3
|
*/
|
|
4
4
|
import { filter as smartFilter } from "smart-array-filter";
|
|
5
|
+
import { getNestedProperty } from "./table.property-utils";
|
|
5
6
|
const dataWorkers = new Map();
|
|
6
7
|
function uid() {
|
|
7
8
|
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
@@ -91,7 +92,7 @@ function filter(workerStore, rows, filters = [], force = false) {
|
|
|
91
92
|
return rows;
|
|
92
93
|
filters.forEach((filter) => {
|
|
93
94
|
if (typeof filter.filter === 'boolean') {
|
|
94
|
-
rows = rows.filter((row) => row
|
|
95
|
+
rows = rows.filter((row) => getNestedProperty(row, filter.prop) === filter.filter);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
98
|
rows = smartFilter(rows, {
|
|
@@ -154,27 +155,32 @@ function sort(workerStore, rows, prop, order) {
|
|
|
154
155
|
return sorted;
|
|
155
156
|
}
|
|
156
157
|
// text sort
|
|
157
|
-
if (col?.type === 'text' &&
|
|
158
|
+
if (col?.type === 'text' &&
|
|
159
|
+
typeof getNestedProperty(rows[0], prop) === 'string') {
|
|
158
160
|
const sorted = rows.slice().sort((a, b) => {
|
|
159
|
-
|
|
161
|
+
const aVal = getNestedProperty(a, prop);
|
|
162
|
+
const bVal = getNestedProperty(b, prop);
|
|
163
|
+
if (!aVal)
|
|
160
164
|
return 1;
|
|
161
|
-
if (!
|
|
165
|
+
if (!bVal)
|
|
162
166
|
return -1;
|
|
163
167
|
return order === 'asc'
|
|
164
|
-
?
|
|
165
|
-
:
|
|
168
|
+
? aVal.localeCompare(bVal)
|
|
169
|
+
: bVal.localeCompare(aVal);
|
|
166
170
|
});
|
|
167
171
|
return sorted;
|
|
168
172
|
}
|
|
169
173
|
// catch-all - number / date / string sort
|
|
170
174
|
const sorted = rows.slice().sort((a, b) => {
|
|
171
|
-
|
|
175
|
+
const aVal = getNestedProperty(a, prop);
|
|
176
|
+
const bVal = getNestedProperty(b, prop);
|
|
177
|
+
if ([undefined, null].includes(aVal))
|
|
172
178
|
return 1;
|
|
173
|
-
if ([undefined, null].includes(
|
|
179
|
+
if ([undefined, null].includes(bVal))
|
|
174
180
|
return -1;
|
|
175
|
-
if (
|
|
181
|
+
if (aVal < bVal)
|
|
176
182
|
return order === 'asc' ? -1 : 1;
|
|
177
|
-
if (
|
|
183
|
+
if (aVal > bVal)
|
|
178
184
|
return order === 'asc' ? 1 : -1;
|
|
179
185
|
return 0;
|
|
180
186
|
});
|
|
@@ -200,8 +200,9 @@ function storeSetData(host, rows) {
|
|
|
200
200
|
// try our best to discern the column type (from first row) if unset
|
|
201
201
|
if (unknownCols.length && i === 0) {
|
|
202
202
|
store.config.state.columns = cols.map((col) => {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
const val = getNestedProperty(row, col.prop);
|
|
204
|
+
if (unknownCols.includes(col) && val && !col.type) {
|
|
205
|
+
col.type = getDataType(val);
|
|
205
206
|
if (col.type === 'date')
|
|
206
207
|
dateCols.push(col.prop);
|
|
207
208
|
}
|
|
@@ -212,12 +213,16 @@ function storeSetData(host, rows) {
|
|
|
212
213
|
dateCols.forEach((colName) => {
|
|
213
214
|
// coerce any date type;
|
|
214
215
|
// Date(), timestamp, valid date string
|
|
215
|
-
const
|
|
216
|
-
|
|
216
|
+
const cellValue = getNestedProperty(row, colName);
|
|
217
|
+
const coerceDate = new Date(cellValue);
|
|
218
|
+
if (!!coerceDate && Number(coerceDate)) {
|
|
219
|
+
// Store as a flattened property (e.g., row["user.birthDate"])
|
|
220
|
+
// getNestedProperty will check this first before traversing nested structure
|
|
217
221
|
row[colName] = Number(coerceDate);
|
|
222
|
+
}
|
|
218
223
|
});
|
|
219
224
|
row['__index'] = i;
|
|
220
|
-
row['__uuid'] = cyrb53(cols.map((c) => row
|
|
225
|
+
row['__uuid'] = cyrb53(cols.map((c) => getNestedProperty(row, c.prop)).join());
|
|
221
226
|
return row;
|
|
222
227
|
});
|
|
223
228
|
store.data.state.rows = rows;
|
|
@@ -266,6 +271,39 @@ async function storeSort(host, prop, order) {
|
|
|
266
271
|
}
|
|
267
272
|
}
|
|
268
273
|
|
|
274
|
+
// Separate file (so it's safe to import into the worker)
|
|
275
|
+
/**
|
|
276
|
+
* Accesses a nested property using dot notation.
|
|
277
|
+
* @param obj - the object to access
|
|
278
|
+
* @param path - the property path (e.g., 'props.nested.name')
|
|
279
|
+
* @returns the value at the path, or undefined if not found
|
|
280
|
+
*/
|
|
281
|
+
function getNestedProperty(obj, path) {
|
|
282
|
+
if (!obj || path === null || path === undefined)
|
|
283
|
+
return undefined;
|
|
284
|
+
// Convert to string for consistent handling
|
|
285
|
+
const pathStr = String(path);
|
|
286
|
+
// Check for a flattened property first (optimization for transformed values)
|
|
287
|
+
// e.g., obj["user.birthDate"] takes precedence over obj.user.birthDate
|
|
288
|
+
if (obj[pathStr] !== undefined) {
|
|
289
|
+
return obj[pathStr];
|
|
290
|
+
}
|
|
291
|
+
// If the path doesn't contain a dot, just return the direct property
|
|
292
|
+
if (!pathStr.includes('.')) {
|
|
293
|
+
return obj[path];
|
|
294
|
+
}
|
|
295
|
+
// Split the path and traverse the object
|
|
296
|
+
const keys = pathStr.split('.');
|
|
297
|
+
let result = obj;
|
|
298
|
+
for (const key of keys) {
|
|
299
|
+
if (result === null || result === undefined) {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
result = result[key];
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
|
|
269
307
|
/**
|
|
270
308
|
* Get a model object for custom cell / property renderers.
|
|
271
309
|
* @param rowIndex - the current row index being rendered
|
|
@@ -279,7 +317,9 @@ function colDataModel(rowIndex, colIndex) {
|
|
|
279
317
|
const column = columns[colIndex];
|
|
280
318
|
const prop = column?.prop;
|
|
281
319
|
const rowModel = rows[rowIndex];
|
|
282
|
-
const cellModel = rowModel
|
|
320
|
+
const cellModel = rowModel
|
|
321
|
+
? getNestedProperty(rowModel, columns[colIndex].prop)
|
|
322
|
+
: '';
|
|
283
323
|
return {
|
|
284
324
|
prop,
|
|
285
325
|
cellModel,
|
|
@@ -5,7 +5,7 @@ import { c as createWorker } from './nano-data-table.js';
|
|
|
5
5
|
|
|
6
6
|
const workerName = 'table.worker';
|
|
7
7
|
const workerMsgId = 'stencil.table.worker';
|
|
8
|
-
const workerPath = new URL('assets/table.worker-
|
|
8
|
+
const workerPath = new URL('assets/table.worker-DM_2DNEe.js', import.meta.url).href;
|
|
9
9
|
let worker;
|
|
10
10
|
try {
|
|
11
11
|
// first try directly starting the worker with the URL
|
|
@@ -112,7 +112,7 @@ const createWorkerProxy = (worker, workerMsgId, exportedMethod) => (
|
|
|
112
112
|
})
|
|
113
113
|
);
|
|
114
114
|
|
|
115
|
-
const workerPromise = import('./table.worker-
|
|
115
|
+
const workerPromise = import('./table.worker-BMDbprO8.js').then(m => m.worker);
|
|
116
116
|
const createWorkerStore = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'createWorkerStore');
|
|
117
117
|
const syncConfigToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncConfigToWorker');
|
|
118
118
|
const syncDataToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncDataToWorker');
|
|
@@ -193,8 +193,9 @@ function storeSetData(host, rows) {
|
|
|
193
193
|
// try our best to discern the column type (from first row) if unset
|
|
194
194
|
if (unknownCols.length && i === 0) {
|
|
195
195
|
store.config.state.columns = cols.map((col) => {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
const val = getNestedProperty(row, col.prop);
|
|
197
|
+
if (unknownCols.includes(col) && val && !col.type) {
|
|
198
|
+
col.type = getDataType(val);
|
|
198
199
|
if (col.type === 'date')
|
|
199
200
|
dateCols.push(col.prop);
|
|
200
201
|
}
|
|
@@ -205,12 +206,16 @@ function storeSetData(host, rows) {
|
|
|
205
206
|
dateCols.forEach((colName) => {
|
|
206
207
|
// coerce any date type;
|
|
207
208
|
// Date(), timestamp, valid date string
|
|
208
|
-
const
|
|
209
|
-
|
|
209
|
+
const cellValue = getNestedProperty(row, colName);
|
|
210
|
+
const coerceDate = new Date(cellValue);
|
|
211
|
+
if (!!coerceDate && Number(coerceDate)) {
|
|
212
|
+
// Store as a flattened property (e.g., row["user.birthDate"])
|
|
213
|
+
// getNestedProperty will check this first before traversing nested structure
|
|
210
214
|
row[colName] = Number(coerceDate);
|
|
215
|
+
}
|
|
211
216
|
});
|
|
212
217
|
row['__index'] = i;
|
|
213
|
-
row['__uuid'] = cyrb53(cols.map((c) => row
|
|
218
|
+
row['__uuid'] = cyrb53(cols.map((c) => getNestedProperty(row, c.prop)).join());
|
|
214
219
|
return row;
|
|
215
220
|
});
|
|
216
221
|
store.data.state.rows = rows;
|
|
@@ -259,6 +264,39 @@ async function storeSort(host, prop, order) {
|
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
266
|
|
|
267
|
+
// Separate file (so it's safe to import into the worker)
|
|
268
|
+
/**
|
|
269
|
+
* Accesses a nested property using dot notation.
|
|
270
|
+
* @param obj - the object to access
|
|
271
|
+
* @param path - the property path (e.g., 'props.nested.name')
|
|
272
|
+
* @returns the value at the path, or undefined if not found
|
|
273
|
+
*/
|
|
274
|
+
function getNestedProperty(obj, path) {
|
|
275
|
+
if (!obj || path === null || path === undefined)
|
|
276
|
+
return undefined;
|
|
277
|
+
// Convert to string for consistent handling
|
|
278
|
+
const pathStr = String(path);
|
|
279
|
+
// Check for a flattened property first (optimization for transformed values)
|
|
280
|
+
// e.g., obj["user.birthDate"] takes precedence over obj.user.birthDate
|
|
281
|
+
if (obj[pathStr] !== undefined) {
|
|
282
|
+
return obj[pathStr];
|
|
283
|
+
}
|
|
284
|
+
// If the path doesn't contain a dot, just return the direct property
|
|
285
|
+
if (!pathStr.includes('.')) {
|
|
286
|
+
return obj[path];
|
|
287
|
+
}
|
|
288
|
+
// Split the path and traverse the object
|
|
289
|
+
const keys = pathStr.split('.');
|
|
290
|
+
let result = obj;
|
|
291
|
+
for (const key of keys) {
|
|
292
|
+
if (result === null || result === undefined) {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
result = result[key];
|
|
296
|
+
}
|
|
297
|
+
return result;
|
|
298
|
+
}
|
|
299
|
+
|
|
262
300
|
/**
|
|
263
301
|
* Get a model object for custom cell / property renderers.
|
|
264
302
|
* @param rowIndex - the current row index being rendered
|
|
@@ -272,7 +310,9 @@ function colDataModel(rowIndex, colIndex) {
|
|
|
272
310
|
const column = columns[colIndex];
|
|
273
311
|
const prop = column?.prop;
|
|
274
312
|
const rowModel = rows[rowIndex];
|
|
275
|
-
const cellModel = rowModel
|
|
313
|
+
const cellModel = rowModel
|
|
314
|
+
? getNestedProperty(rowModel, columns[colIndex].prop)
|
|
315
|
+
: '';
|
|
276
316
|
return {
|
|
277
317
|
prop,
|
|
278
318
|
cellModel,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Custom elements for Nanopore-Digital Web applications
|
|
3
3
|
*/
|
|
4
|
-
export { N as nano_data_table } from './nano-data-table-
|
|
4
|
+
export { N as nano_data_table } from './nano-data-table-Bn4l0Q3q.js';
|
|
5
5
|
import './index-BM3Om9WE.js';
|
|
6
6
|
import './renderer-DpNDfhNy.js';
|
|
7
7
|
import './math-BEqsTfVK.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Custom elements for Nanopore-Digital Web applications
|
|
3
3
|
*/
|
|
4
|
-
import { c as createWorker } from './nano-data-table-
|
|
4
|
+
import { c as createWorker } from './nano-data-table-Bn4l0Q3q.js';
|
|
5
5
|
import './index-BM3Om9WE.js';
|
|
6
6
|
import './renderer-DpNDfhNy.js';
|
|
7
7
|
import './math-BEqsTfVK.js';
|
|
@@ -12,7 +12,7 @@ import './index-BlBZYxu4.js';
|
|
|
12
12
|
|
|
13
13
|
const workerName = 'table.worker';
|
|
14
14
|
const workerMsgId = 'stencil.table.worker';
|
|
15
|
-
const workerPath = new URL('table.worker-
|
|
15
|
+
const workerPath = new URL('table.worker-DM_2DNEe.js', import.meta.url).href;
|
|
16
16
|
let worker;
|
|
17
17
|
try {
|
|
18
18
|
// first try directly starting the worker with the URL
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Custom elements for Nanopore-Digital Web applications
|
|
3
3
|
*/
|
|
4
|
-
(()=>{const n=(n,t)=>{const r=globalThis[t];return null!=r&&n instanceof r},t=r=>{if(null!=r){if(n(r,"ArrayBuffer")||n(r,"MessagePort")||n(r,"ImageBitmap")||n(r,"OffscreenCanvas"))return[r];if("object"==typeof r)return r.constructor===Object&&(r=Object.values(r)),Array.isArray(r)?r.flatMap(t):t(r.buffer)}return[]},r={},e="stencil.table.worker",o=e+".cb";addEventListener("message",(async({data:n})=>{if(n&&n[0]===e){let u,i,c=n[1],s=n[2],f=n[3],a=0,l=f.length;try{for(;a<l;a++)if(Array.isArray(f[a])&&f[a][0]===o){const n=f[a][1];f[a]=(...t)=>{postMessage([o,n,t])}}u=await r[s](...f)}catch(n){u=null,i=n instanceof Error?{isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:{isError:!1,value:n},u=void 0}const p=t(u);postMessage([e,c,u,i],p)}}));var u,i,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var f=s(function(){if(i)return u;i=1;var n=/[\\^$.*+?()[\]{}|]/g,t=RegExp(n.source),r="object"==typeof self&&self&&self.Object===Object&&self,e="object"==typeof c&&c&&c.Object===Object&&c||r||Function("return this")(),o=Object.prototype.toString,s=e.Symbol,f=s?s.prototype:void 0,a=f?f.toString:void 0;return u=function(r){var e;return(r=null==(e=r)?"":function(n){if("string"==typeof n)return n;if(function(n){return"symbol"==typeof n||function(n){return!!n&&"object"==typeof n}(n)&&"[object Symbol]"==o.call(n)}(n))return a?a.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}(e))&&t.test(r)?r.replace(n,"\\$&"):r}}());function a(n,t,r,e){if("object"!=typeof n){if("exists"===t.type)return!!t.key.test(r.join("."))&&!!n;{const o=r.join(".");for(const n of e.ignorePaths)if(n.test(o))return!1;if(e.includePaths){let n=!1;for(const t of e.includePaths)if(t.test(o)){n=!0;break}if(!n)return!1}return!(t.key&&!t.key.test(o))&&function(n,t){return"string"==typeof n?t.checkString(n):"number"==typeof n&&t.checkNumber(n)}(n,t)}}if(Array.isArray(n)){for(const o of n)if(a(o,t,r,e))return!0}else for(const o in n){r.push(o);const u=a(n[o],t,r,e);if(r.pop(),u)return!0}return!1}function l(n,t,r,e){if(t.length>0){let o=!1;for(const u of t)if(a(n,u,[],e)?!u.negate:u.negate){if("OR"===r)return!0;o=!0}else if("AND"===r)return!1;return o}return!0}function p(n,t){const r=[];let e=!1,o=0,u="";for(let i=0;i<n.length;i++){const c=n[i];e?c===u&&(e=!1,u=""):'"'===c||"'"===c?(e=!0,u=c):c.match(t)&&!e&&(r.push(n.slice(o,i).trim()),o=i+1),i===n.length-1&&r.push(n.slice(o).trim())}return r.map((n=>n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n)).filter(Boolean)}const d={"<":function(n){const t=Number(n[0]);return n=>n<t},"<=":function(n){const t=Number(n[0]);return n=>n<=t},"=":function(n){const t=n[0].split(",").filter(Boolean).map(Number);return n=>{for(const r of t)if(n===r)return!0;return!1}},">=":function(n){const t=Number(n[0]);return n=>n>=t},">":function(n){const t=Number(n[0]);return n=>n>t},"..":function(n){const t=Number(n[0]),r=Number(n[1]);return n=>n>=t&&n<=r}};function w(n){const{values:t,operator:r}=function(n){const t=/^\s*\(?\s*(?<startOperator><=|>=|<|=|>|\.\.\s*)?\s*(?<firstValue>-?\d*\.?\d+)\s*(?:(?<afterDots>\.\.)\s*(?<secondValue>-?\d*\.?\d*))?\s*\)?\s*$/.exec(n);if(!t)return{operator:"=",values:[n]};if(!t.groups)throw new Error("unreachable");const{startOperator:r,firstValue:e,afterDots:o,secondValue:u}=t.groups;let i=r;const c=e?[e]:[];return".."===r?i="<=":r||!o||u?o&&(i=".."):i=">=",u&&(Number(u)<Number(e)?c.unshift(u):c.push(u)),{values:c,operator:i||"="}}(n),e=d[r];if(!e)throw new Error(`unknown operator ${r}`);return e(t)}const h={"<":function(n){return t=>t<n[0]},"<=":function(n){return t=>t<=n[0]},"=":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(`^${f(n)}$`,t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},"~":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(f(n),t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},">=":function(n){return t=>t>=n[0]},">":function(n){return t=>t>n[0]},"..":function(n){return t=>t>=n[0]&&t<=n[1]}};function y(n,t){const{values:r,operator:e}=function(n){const t=n.split(".."),r=/^\s*\(?(?<operator><=|<|=|>=|>)?\s*(?<value>\S*)\s*\)?$/.exec(t[0]);if(!r)return{operator:"~",values:[n]};if(!r.groups)throw new Error("unreachable");const{value:e}=r.groups;let{operator:o}=r.groups;const u=t[1]?.trim();let i=[e];return t.length>1&&(o="..",u?e?e<u?i.push(u):i.unshift(u):(i=[u],o="<="):o=">="),{operator:o||"~",values:i}}(n),o=h[e];if(!o)throw new Error(`unreachable unknown operator ${e}`);return o(r,t)}function
|
|
4
|
+
(()=>{const n=(n,t)=>{const r=globalThis[t];return null!=r&&n instanceof r},t=r=>{if(null!=r){if(n(r,"ArrayBuffer")||n(r,"MessagePort")||n(r,"ImageBitmap")||n(r,"OffscreenCanvas"))return[r];if("object"==typeof r)return r.constructor===Object&&(r=Object.values(r)),Array.isArray(r)?r.flatMap(t):t(r.buffer)}return[]},r={},e="stencil.table.worker",o=e+".cb";addEventListener("message",(async({data:n})=>{if(n&&n[0]===e){let u,i,c=n[1],s=n[2],f=n[3],a=0,l=f.length;try{for(;a<l;a++)if(Array.isArray(f[a])&&f[a][0]===o){const n=f[a][1];f[a]=(...t)=>{postMessage([o,n,t])}}u=await r[s](...f)}catch(n){u=null,i=n instanceof Error?{isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:{isError:!1,value:n},u=void 0}const p=t(u);postMessage([e,c,u,i],p)}}));var u,i,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var f=s(function(){if(i)return u;i=1;var n=/[\\^$.*+?()[\]{}|]/g,t=RegExp(n.source),r="object"==typeof self&&self&&self.Object===Object&&self,e="object"==typeof c&&c&&c.Object===Object&&c||r||Function("return this")(),o=Object.prototype.toString,s=e.Symbol,f=s?s.prototype:void 0,a=f?f.toString:void 0;return u=function(r){var e;return(r=null==(e=r)?"":function(n){if("string"==typeof n)return n;if(function(n){return"symbol"==typeof n||function(n){return!!n&&"object"==typeof n}(n)&&"[object Symbol]"==o.call(n)}(n))return a?a.call(n):"";var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}(e))&&t.test(r)?r.replace(n,"\\$&"):r}}());function a(n,t,r,e){if("object"!=typeof n){if("exists"===t.type)return!!t.key.test(r.join("."))&&!!n;{const o=r.join(".");for(const n of e.ignorePaths)if(n.test(o))return!1;if(e.includePaths){let n=!1;for(const t of e.includePaths)if(t.test(o)){n=!0;break}if(!n)return!1}return!(t.key&&!t.key.test(o))&&function(n,t){return"string"==typeof n?t.checkString(n):"number"==typeof n&&t.checkNumber(n)}(n,t)}}if(Array.isArray(n)){for(const o of n)if(a(o,t,r,e))return!0}else for(const o in n){r.push(o);const u=a(n[o],t,r,e);if(r.pop(),u)return!0}return!1}function l(n,t,r,e){if(t.length>0){let o=!1;for(const u of t)if(a(n,u,[],e)?!u.negate:u.negate){if("OR"===r)return!0;o=!0}else if("AND"===r)return!1;return o}return!0}function p(n,t){const r=[];let e=!1,o=0,u="";for(let i=0;i<n.length;i++){const c=n[i];e?c===u&&(e=!1,u=""):'"'===c||"'"===c?(e=!0,u=c):c.match(t)&&!e&&(r.push(n.slice(o,i).trim()),o=i+1),i===n.length-1&&r.push(n.slice(o).trim())}return r.map((n=>n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n)).filter(Boolean)}const d={"<":function(n){const t=Number(n[0]);return n=>n<t},"<=":function(n){const t=Number(n[0]);return n=>n<=t},"=":function(n){const t=n[0].split(",").filter(Boolean).map(Number);return n=>{for(const r of t)if(n===r)return!0;return!1}},">=":function(n){const t=Number(n[0]);return n=>n>=t},">":function(n){const t=Number(n[0]);return n=>n>t},"..":function(n){const t=Number(n[0]),r=Number(n[1]);return n=>n>=t&&n<=r}};function w(n){const{values:t,operator:r}=function(n){const t=/^\s*\(?\s*(?<startOperator><=|>=|<|=|>|\.\.\s*)?\s*(?<firstValue>-?\d*\.?\d+)\s*(?:(?<afterDots>\.\.)\s*(?<secondValue>-?\d*\.?\d*))?\s*\)?\s*$/.exec(n);if(!t)return{operator:"=",values:[n]};if(!t.groups)throw new Error("unreachable");const{startOperator:r,firstValue:e,afterDots:o,secondValue:u}=t.groups;let i=r;const c=e?[e]:[];return".."===r?i="<=":r||!o||u?o&&(i=".."):i=">=",u&&(Number(u)<Number(e)?c.unshift(u):c.push(u)),{values:c,operator:i||"="}}(n),e=d[r];if(!e)throw new Error(`unknown operator ${r}`);return e(t)}const h={"<":function(n){return t=>t<n[0]},"<=":function(n){return t=>t<=n[0]},"=":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(`^${f(n)}$`,t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},"~":function(n,t){const r=p(n[0],",").filter(Boolean).map((n=>new RegExp(f(n),t)));return n=>{for(const t of r)if(t.test(n))return!0;return!1}},">=":function(n){return t=>t>=n[0]},">":function(n){return t=>t>n[0]},"..":function(n){return t=>t>=n[0]&&t<=n[1]}};function y(n,t){const{values:r,operator:e}=function(n){const t=n.split(".."),r=/^\s*\(?(?<operator><=|<|=|>=|>)?\s*(?<value>\S*)\s*\)?$/.exec(t[0]);if(!r)return{operator:"~",values:[n]};if(!r.groups)throw new Error("unreachable");const{value:e}=r.groups;let{operator:o}=r.groups;const u=t[1]?.trim();let i=[e];return t.length>1&&(o="..",u?e?e<u?i.push(u):i.unshift(u):(i=[u],o="<="):o=">="),{operator:o||"~",values:i}}(n),o=h[e];if(!o)throw new Error(`unreachable unknown operator ${e}`);return o(r,t)}function g(n,t={}){const{index:r=!1,predicate:e="AND",ignorePaths:o=[],includePaths:u,pathAlias:i={}}=t,c=t.limit||1/0,s=t.caseSensitive?"":"i";let a=t.keywords||[];const d=function(n,t){const{insensitive:r}=t,e={};for(const[t,o]of Object.entries(n))e[t]=o instanceof RegExp?o:new RegExp(`(^|\\.)${f(o)}(\\.|$)`,r);return e}(i,{insensitive:s}),h=o.map((n=>"string"==typeof n?new RegExp(`(^|\\.)${f(n)}(\\.|$)`,s):n)),g=u?u.map((n=>"string"==typeof n?new RegExp(`(^|\\.)${f(n)}(\\.|$)`,s):n)):void 0;"string"==typeof a&&(a=p(a,/[\t\n\r ]/));const b=function(n,t={}){return n.map((n=>function(n,t={}){const{caseSensitive:r,pathAlias:e={}}=t,o=r?"":"i";let u=!1;n.startsWith("-")&&(u=!0,n=n.slice(1));const i=n.indexOf(":");if(-1!==i){const t=n.slice(Math.max(0,i+1));if(i>0){const r=n.slice(0,Math.max(0,i));return"is"===r?{type:"exists",negate:u,key:new RegExp(`(^|\\.)${f(t)}(\\.|$)`,o)}:{type:"matches",negate:u,key:e[r]||new RegExp(`(^|\\.)${f(r)}(\\.|$)`,o),checkNumber:w(t),checkString:y(t,o)}}}return{type:"matches",negate:u,checkNumber:w(n),checkString:y(n,o)}}(n,t)))}(a,{caseSensitive:t.caseSensitive,pathAlias:d});let v=0;if(r){const t=[];for(let r=0;r<n.length&&v<c;r++)l(n[r],b,e,{ignorePaths:h,includePaths:g})&&(v=t.push(r));return t}{const t=[];for(let r=0;r<n.length&&v<c;r++)l(n[r],b,e,{ignorePaths:h,includePaths:g})&&(v=t.push(n[r]));return t}}function b(n,t){if(!n||null==t)return;const r=String(t);if(void 0!==n[r])return n[r];if(!r.includes("."))return n[t];const e=r.split(".");let o=n;for(const n of e){if(null==o)return;o=o[n]}return o}const v=new Map;async function m(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);if(r.searchTerm=t,!t||!t.length)return r.filterRows=r.rows,$(r,r.rows);const e=r.columns.filter((n=>!1!==n.searchable));return r.filterRows=g(r.rows,{keywords:t,predicate:"OR",includePaths:[...e.map((n=>n.prop))],ignorePaths:["__uuid","__index"]}),$(r,r.filterRows)}function E(n,t,r=[],e=!1){return r&&r.length||e||(r=function(n){return n.columns.filter((n=>null!=n.filter)).reduce(((n,t)=>{const{prop:r,filter:e}=t;return n.push({prop:r,filter:e}),n}),[])}(n)),r&&r.length?(r.forEach((n=>{t="boolean"==typeof n.filter?t.filter((t=>b(t,n.prop)===n.filter)):g(t,{predicate:"string"==typeof n.filter?"AND":"OR",keywords:n.filter,includePaths:[n.prop],ignorePaths:["__uuid","__index"]})})),t):t}function k(n,t,r,e){if(!r&&!e){const t=function(n){const t=n.columns.find((n=>!!n.order));if(t){const{prop:n,order:r}=t;return{prop:n,order:r}}return null}(n);t&&({prop:r,order:e}=t)}if(!r||!e||!t.length)return t;const o=n.columns.find((n=>n.prop===r));return o?.sortCompareFn&&"function"==typeof o.sortCompareFn?t.slice().sort(o.sortCompareFn(r,e)):"text"===o?.type&&"string"==typeof b(t[0],r)?t.slice().sort(((n,t)=>{const o=b(n,r),u=b(t,r);return o?u?"asc"===e?o.localeCompare(u):u.localeCompare(o):-1:1})):t.slice().sort(((n,t)=>{const o=b(n,r),u=b(t,r);return[void 0,null].includes(o)?1:[void 0,null].includes(u)?-1:o<u?"asc"===e?-1:1:o>u?"asc"===e?1:-1:0}))}function $(n,t){return k(n,t=E(n,t))}function x(n){return n.map((n=>(n?.sortCompareFn&&"string"==typeof n.sortCompareFn&&(n.sortCompareFn=new Function("return "+n.sortCompareFn)()),n)))}async function N(n){v.delete(n)}r.createWorkerStore=async function(n,t){const r=Date.now().toString(36)+Math.random().toString(36).substring(2);return v.set(r,{rows:n,columns:x(t)}),r},r.destroyWorkerStore=N,r.syncConfigToWorker=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);return r.columns=x(t),r.rows||r.columns||N(n),!0},r.syncDataToWorker=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);return r.rows=t,r.rows||r.columns||N(n),!0},r.workerFilter=async function(n,t){const r=v.get(n);if(!r)throw new Error("cannot find worker with ID "+n);const e=t&&t.length||!r.searchTerm?r.searchTerm?r.filterRows:r.rows:await m(n,r.searchTerm);return r.filterRows=E(r,e,t,!0),k(r,r.filterRows)},r.workerSearch=m,r.workerSort=async function(n,t,r){const e=v.get(n);if(!e)throw new Error("cannot find worker with ID "+n);return k(e,e.filterRows||e.rows,t,r)}})();
|