@limetech/lime-elements 39.12.3 → 39.12.5
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/CHANGELOG.md +15 -0
- package/dist/cjs/limel-markdown.cjs.entry.js +813 -2
- package/dist/cjs/limel-table.cjs.entry.js +15 -10
- package/dist/collection/components/markdown/markdown.js +3 -2
- package/dist/collection/components/markdown/morph-dom.js +29 -0
- package/dist/collection/components/table/table.js +15 -10
- package/dist/esm/limel-markdown.entry.js +813 -2
- package/dist/esm/limel-table.entry.js +15 -10
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-537df672.entry.js +1 -0
- package/dist/lime-elements/{p-32ca0084.entry.js → p-57135b6a.entry.js} +1 -1
- package/dist/types/components/markdown/morph-dom.d.ts +12 -0
- package/package.json +2 -1
- package/dist/lime-elements/p-73623bb5.entry.js +0 -1
|
@@ -30686,8 +30686,7 @@ const Table = class {
|
|
|
30686
30686
|
return;
|
|
30687
30687
|
}
|
|
30688
30688
|
if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {
|
|
30689
|
-
this.
|
|
30690
|
-
return;
|
|
30689
|
+
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
30691
30690
|
}
|
|
30692
30691
|
this.tabulator.recalc();
|
|
30693
30692
|
this.tabulator.rowManager.redraw();
|
|
@@ -30915,7 +30914,7 @@ const Table = class {
|
|
|
30915
30914
|
// used since we have our own custom `ajaxRequestFunc`
|
|
30916
30915
|
const remoteUrl = 'https://localhost';
|
|
30917
30916
|
return {
|
|
30918
|
-
|
|
30917
|
+
sortMode: 'remote',
|
|
30919
30918
|
ajaxURL: remoteUrl,
|
|
30920
30919
|
ajaxRequestFunc: this.requestData,
|
|
30921
30920
|
ajaxRequesting: this.handleAjaxRequesting,
|
|
@@ -30954,10 +30953,16 @@ const Table = class {
|
|
|
30954
30953
|
// we always return the existing data from this function, therefore
|
|
30955
30954
|
// relying on the consumer component to handle the loading
|
|
30956
30955
|
// state via the loading prop, if it actually decides to load new data.
|
|
30957
|
-
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
30956
|
+
//
|
|
30957
|
+
// When pagination is enabled, Tabulator's pagination module unwraps
|
|
30958
|
+
// the `{last_page, data}` format. Without pagination, Tabulator
|
|
30959
|
+
// expects a plain array directly.
|
|
30960
|
+
const resolveExistingData = this.pageSize
|
|
30961
|
+
? Promise.resolve({
|
|
30962
|
+
last_page: this.calculatePageCount(),
|
|
30963
|
+
data: this.data,
|
|
30964
|
+
})
|
|
30965
|
+
: Promise.resolve(this.data);
|
|
30961
30966
|
if (!isEqual.isEqual(this.currentLoad, load)) {
|
|
30962
30967
|
this.currentSorting = columnSorters;
|
|
30963
30968
|
this.currentLoad = load;
|
|
@@ -31062,16 +31067,16 @@ const Table = class {
|
|
|
31062
31067
|
render() {
|
|
31063
31068
|
var _a, _b;
|
|
31064
31069
|
const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
|
|
31065
|
-
return (index.h(index.Host, { key: '
|
|
31070
|
+
return (index.h(index.Host, { key: 'e615540df33a213dcdcdecfbaf4a62add8a56343', class: {
|
|
31066
31071
|
'has-low-density': this.layout === 'lowDensity',
|
|
31067
31072
|
'has-pagination-on-top': this.paginationLocation === 'top',
|
|
31068
|
-
} }, index.h("div", { key: '
|
|
31073
|
+
} }, index.h("div", { key: '912374e7d1308708945dde7e94366a9e20ce8236', id: "tabulator-container", class: {
|
|
31069
31074
|
'has-pagination': totalRows > this.pageSize,
|
|
31070
31075
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
31071
31076
|
'has-movable-columns': this.movableColumns,
|
|
31072
31077
|
'has-rowselector': this.selectable,
|
|
31073
31078
|
'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
|
|
31074
|
-
} }, index.h("div", { key: '
|
|
31079
|
+
} }, index.h("div", { key: 'ccfead61db80a9d54631daecb950c352cf41bbc8', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, index.h("limel-spinner", { key: '2f095d05a6d972e008467d54e71520e2848b6d2e', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), index.h("div", { key: '1c200d356c582e35bce4b0f02bfc187e42a072ec', id: "tabulator-table" }))));
|
|
31075
31080
|
}
|
|
31076
31081
|
renderSelectAll() {
|
|
31077
31082
|
var _a, _b, _c;
|
|
@@ -3,6 +3,7 @@ import { markdownToHTML } from "./markdown-parser";
|
|
|
3
3
|
import { globalConfig } from "../../global/config";
|
|
4
4
|
import { ImageIntersectionObserver } from "./image-intersection-observer";
|
|
5
5
|
import { hydrateCustomElements } from "./hydrate-custom-elements";
|
|
6
|
+
import { morphChildren } from "./morph-dom";
|
|
6
7
|
import { DEFAULT_MARKDOWN_WHITELIST } from "./default-whitelist";
|
|
7
8
|
/**
|
|
8
9
|
* The Markdown component receives markdown syntax
|
|
@@ -95,7 +96,7 @@ export class Markdown {
|
|
|
95
96
|
lazyLoadImages: this.lazyLoadImages,
|
|
96
97
|
removeEmptyParagraphs: this.removeEmptyParagraphs,
|
|
97
98
|
});
|
|
98
|
-
this.rootElement
|
|
99
|
+
morphChildren(this.rootElement, html);
|
|
99
100
|
// Hydration parses JSON attribute values (e.g. link='{"href":"..."}')
|
|
100
101
|
// into JS properties. URL sanitization happens here because
|
|
101
102
|
// rehype-sanitize can't inspect values inside JSON strings.
|
|
@@ -119,7 +120,7 @@ export class Markdown {
|
|
|
119
120
|
this.cleanupImageIntersectionObserver();
|
|
120
121
|
}
|
|
121
122
|
render() {
|
|
122
|
-
return (h(Host, { key: '
|
|
123
|
+
return (h(Host, { key: '9d88a42e047b6701215699ab5459af3275e51693' }, h("div", { key: '83a5801839318bf47eeacbf53e320e4628559bfa', id: "markdown", ref: (el) => (this.rootElement = el) })));
|
|
123
124
|
}
|
|
124
125
|
setupImageIntersectionObserver() {
|
|
125
126
|
if (this.lazyLoadImages) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import morphdom from "morphdom";
|
|
2
|
+
/**
|
|
3
|
+
* Morph the children of `container` to match the given HTML string.
|
|
4
|
+
*
|
|
5
|
+
* Uses morphdom to diff the existing DOM against the new HTML and apply
|
|
6
|
+
* only the minimum changes. This preserves existing DOM nodes (including
|
|
7
|
+
* custom elements with internal state) that haven't changed.
|
|
8
|
+
*
|
|
9
|
+
* @param container - The parent element whose children should be morphed.
|
|
10
|
+
* @param html - The new HTML content for the container's children.
|
|
11
|
+
*/
|
|
12
|
+
export function morphChildren(container, html = '') {
|
|
13
|
+
// morphdom's second argument must be a single root element. We wrap
|
|
14
|
+
// the new HTML in a <div> purely to satisfy that requirement — the
|
|
15
|
+
// tag name doesn't matter because childrenOnly makes morphdom skip
|
|
16
|
+
// the root and only diff the children. The container element itself
|
|
17
|
+
// is never compared or replaced, so it can be any element type.
|
|
18
|
+
try {
|
|
19
|
+
morphdom(container, `<div>${html}</div>`, {
|
|
20
|
+
childrenOnly: true,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// Fall back to innerHTML so that content is at least visible,
|
|
25
|
+
// even though custom elements will be destroyed and recreated.
|
|
26
|
+
console.warn('morphdom failed, falling back to innerHTML:', error);
|
|
27
|
+
container.innerHTML = html;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -231,8 +231,7 @@ export class Table {
|
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {
|
|
234
|
-
this.
|
|
235
|
-
return;
|
|
234
|
+
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
236
235
|
}
|
|
237
236
|
this.tabulator.recalc();
|
|
238
237
|
this.tabulator.rowManager.redraw();
|
|
@@ -460,7 +459,7 @@ export class Table {
|
|
|
460
459
|
// used since we have our own custom `ajaxRequestFunc`
|
|
461
460
|
const remoteUrl = 'https://localhost';
|
|
462
461
|
return {
|
|
463
|
-
|
|
462
|
+
sortMode: 'remote',
|
|
464
463
|
ajaxURL: remoteUrl,
|
|
465
464
|
ajaxRequestFunc: this.requestData,
|
|
466
465
|
ajaxRequesting: this.handleAjaxRequesting,
|
|
@@ -499,10 +498,16 @@ export class Table {
|
|
|
499
498
|
// we always return the existing data from this function, therefore
|
|
500
499
|
// relying on the consumer component to handle the loading
|
|
501
500
|
// state via the loading prop, if it actually decides to load new data.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
501
|
+
//
|
|
502
|
+
// When pagination is enabled, Tabulator's pagination module unwraps
|
|
503
|
+
// the `{last_page, data}` format. Without pagination, Tabulator
|
|
504
|
+
// expects a plain array directly.
|
|
505
|
+
const resolveExistingData = this.pageSize
|
|
506
|
+
? Promise.resolve({
|
|
507
|
+
last_page: this.calculatePageCount(),
|
|
508
|
+
data: this.data,
|
|
509
|
+
})
|
|
510
|
+
: Promise.resolve(this.data);
|
|
506
511
|
if (!isEqual(this.currentLoad, load)) {
|
|
507
512
|
this.currentSorting = columnSorters;
|
|
508
513
|
this.currentLoad = load;
|
|
@@ -607,16 +612,16 @@ export class Table {
|
|
|
607
612
|
render() {
|
|
608
613
|
var _a, _b;
|
|
609
614
|
const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
|
|
610
|
-
return (h(Host, { key: '
|
|
615
|
+
return (h(Host, { key: 'e615540df33a213dcdcdecfbaf4a62add8a56343', class: {
|
|
611
616
|
'has-low-density': this.layout === 'lowDensity',
|
|
612
617
|
'has-pagination-on-top': this.paginationLocation === 'top',
|
|
613
|
-
} }, h("div", { key: '
|
|
618
|
+
} }, h("div", { key: '912374e7d1308708945dde7e94366a9e20ce8236', id: "tabulator-container", class: {
|
|
614
619
|
'has-pagination': totalRows > this.pageSize,
|
|
615
620
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
616
621
|
'has-movable-columns': this.movableColumns,
|
|
617
622
|
'has-rowselector': this.selectable,
|
|
618
623
|
'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
|
|
619
|
-
} }, h("div", { key: '
|
|
624
|
+
} }, h("div", { key: 'ccfead61db80a9d54631daecb950c352cf41bbc8', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, h("limel-spinner", { key: '2f095d05a6d972e008467d54e71520e2848b6d2e', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), h("div", { key: '1c200d356c582e35bce4b0f02bfc187e42a072ec', id: "tabulator-table" }))));
|
|
620
625
|
}
|
|
621
626
|
renderSelectAll() {
|
|
622
627
|
var _a, _b, _c;
|