@mmlogic/components 0.5.14 → 0.5.16
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/{cell-renderer-mjS630f1.js → cell-renderer-CLVKTVVQ.js} +105 -1
- package/dist/cjs/{client-layout-CqVuJumR.js → client-layout-Eg2VwW-7.js} +2 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_25.cjs.entry.js → mrd-boolean-field_28.cjs.entry.js} +1168 -314
- package/dist/cjs/mrd-merge-view.cjs.entry.js +4 -4
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/fields/mrd-textarea-field/mrd-textarea-field.js +47 -2
- package/dist/collection/components/form/mrd-field/mrd-field.css +69 -0
- package/dist/collection/components/form/mrd-field/mrd-field.js +95 -25
- package/dist/collection/components/form/mrd-form/mrd-form.css +29 -0
- package/dist/collection/components/form/mrd-form/mrd-form.js +44 -8
- package/dist/collection/components/layout/mrd-layout-section/field-value.js +19 -2
- package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +10 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +4 -3
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +169 -18
- package/dist/collection/components/memo/mrd-memo-container/mrd-memo-container.css +204 -0
- package/dist/collection/components/memo/mrd-memo-container/mrd-memo-container.js +769 -0
- package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.css +164 -0
- package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.js +559 -0
- package/dist/collection/components/memo/mrd-memo-view/mrd-memo-view.css +108 -0
- package/dist/collection/components/memo/mrd-memo-view/mrd-memo-view.js +204 -0
- package/dist/collection/components/merge/mrd-merge-view/mrd-merge-view.js +2 -2
- package/dist/collection/components/table/mrd-table/mrd-table.js +9 -6
- package/dist/collection/dev/app.js +30 -15
- package/dist/collection/dev/example-data.js +15 -1
- package/dist/collection/types/client-layout.js +1 -0
- package/dist/collection/utils/i18n.js +104 -0
- package/dist/collection/utils/query-params.js +9 -0
- package/dist/components/client-layout.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-memo-container.d.ts +11 -0
- package/dist/components/mrd-memo-container.js +1 -0
- package/dist/components/mrd-memo-container2.js +1 -0
- package/dist/components/mrd-memo-list.d.ts +11 -0
- package/dist/components/mrd-memo-list.js +1 -0
- package/dist/components/mrd-memo-list2.js +1 -0
- package/dist/components/mrd-memo-view.d.ts +11 -0
- package/dist/components/mrd-memo-view.js +1 -0
- package/dist/components/mrd-memo-view2.js +1 -0
- package/dist/components/mrd-merge-view.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/query-params.js +1 -1
- package/dist/components/table-query.js +1 -0
- package/dist/esm/{cell-renderer-BDY8UXkH.js → cell-renderer-4NKEzZWw.js} +105 -1
- package/dist/esm/{client-layout-Bc42CfJB.js → client-layout-BJkVeSq6.js} +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_25.entry.js → mrd-boolean-field_28.entry.js} +1166 -315
- package/dist/esm/mrd-merge-view.entry.js +4 -4
- package/dist/mosterdcomponents/{cell-renderer-B8u5BCK-.js.map → cell-renderer-CMUxFREW.js.map} +1 -1
- package/dist/mosterdcomponents/client-layout-BJkVeSq6.js.map +1 -0
- package/dist/mosterdcomponents/{field-helpers-CNQcI3Hf.js.map → field-helpers-BWAp5fD8.js.map} +1 -1
- package/dist/mosterdcomponents/{file-upload-common-C9wp47CB.js.map → file-upload-common-DDWuC9-3.js.map} +1 -1
- package/dist/mosterdcomponents/i18n-OzbszktW.js.map +1 -0
- package/dist/mosterdcomponents/index-CkcFwdPc.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-8a7fa81d.entry.js +3 -0
- package/dist/mosterdcomponents/{p-Bc42CfJB.js → p-BJkVeSq6.js} +1 -1
- package/dist/mosterdcomponents/p-BMx6VAJ6.js +1 -0
- package/dist/mosterdcomponents/{p-e8b0880f.entry.js → p-e68dfbb0.entry.js} +1 -1
- package/dist/mosterdcomponents/query-params-3TXd5CUO.js.map +1 -0
- package/dist/mosterdcomponents/table-query-DJq1uKqJ.js.map +1 -0
- package/dist/mosterdcomponents/{validation-CjjTt66G.js.map → validation-B_0Lx9DE.js.map} +1 -1
- package/dist/types/components/fields/mrd-textarea-field/mrd-textarea-field.d.ts +10 -0
- package/dist/types/components/form/mrd-field/mrd-field.d.ts +16 -0
- package/dist/types/components/form/mrd-form/mrd-form.d.ts +6 -0
- package/dist/types/components/layout/mrd-layout-section/field-value.d.ts +4 -0
- package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +3 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +25 -1
- package/dist/types/components/memo/mrd-memo-container/mrd-memo-container.d.ts +173 -0
- package/dist/types/components/memo/mrd-memo-list/mrd-memo-list.d.ts +91 -0
- package/dist/types/components/memo/mrd-memo-view/mrd-memo-view.d.ts +33 -0
- package/dist/types/components.d.ts +571 -1
- package/dist/types/types/client-layout.d.ts +1 -0
- package/dist/types/utils/query-params.d.ts +16 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/client-layout-Bc42CfJB.js.map +0 -1
- package/dist/mosterdcomponents/i18n-ydNM87-Q.js.map +0 -1
- package/dist/mosterdcomponents/index-DhffneUF.js.map +0 -1
- package/dist/mosterdcomponents/p-Dkm4WxMy.js +0 -1
- package/dist/mosterdcomponents/p-c834951a.entry.js +0 -3
- package/dist/mosterdcomponents/query-params-BZbQoeYF.js.map +0 -1
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import DOMPurify from "dompurify";
|
|
3
|
+
import { t } from "../../../utils/i18n";
|
|
4
|
+
import { formatDateTime } from "../../../utils/format";
|
|
5
|
+
import { buildListPath } from "../../../utils/query-params";
|
|
6
|
+
import { buildSortParam, buildTableQueryParams, parseDefaultSort } from "../../table/mrd-table/table-query";
|
|
7
|
+
/** Plain-text length above which a card's body is clamped with a show-more toggle. */
|
|
8
|
+
const BODY_PREVIEW_THRESHOLD = 220;
|
|
9
|
+
/**
|
|
10
|
+
* Card-view body for a `commons.memo` collection — the alternative to the flat
|
|
11
|
+
* `mrd-table` a `mrd-memo-container` can switch to. Deliberately simpler than
|
|
12
|
+
* `mrd-table`'s virtual-scroll internals: memo cards accumulate via a plain
|
|
13
|
+
* "load more" affordance rather than windowed rendering, since a bounded card
|
|
14
|
+
* list of notes doesn't need that complexity.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors `mrd-table`'s external contract for the parts a host / mrd-layout-
|
|
17
|
+
* section already knows how to drive — `init()`, `setPage()`, the `mrdLoadPage`
|
|
18
|
+
* event shape `{ page, sort, path, qs }` — so no new host-side wiring is needed
|
|
19
|
+
* to feed it data.
|
|
20
|
+
*
|
|
21
|
+
* There is no separate memo detail page: clicking a card opens mrd-memo-
|
|
22
|
+
* container's quick-edit dialog directly (mrdEdit), the same dialog "New memo"
|
|
23
|
+
* uses for creation.
|
|
24
|
+
*/
|
|
25
|
+
export class MrdMemoList {
|
|
26
|
+
constructor() {
|
|
27
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
28
|
+
this.item = null;
|
|
29
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
30
|
+
this.parentId = '';
|
|
31
|
+
/** Records per page (must match API page size). */
|
|
32
|
+
this.pageSize = 20;
|
|
33
|
+
this.locale = navigator.language;
|
|
34
|
+
/** When true, cards are not clickable (no mrdEdit) — matches mrd-table's own
|
|
35
|
+
* readOnly gating on its create action. */
|
|
36
|
+
this.readOnly = false;
|
|
37
|
+
/** listItems of the FIELD bound to the `labels` slot, resolved by mrd-layout-section
|
|
38
|
+
* from its own items array, same reason mrd-memo-view needs it. */
|
|
39
|
+
this.labelsListItems = null;
|
|
40
|
+
/** False when the list is already scoped to its own container (a company's own
|
|
41
|
+
* memo tab) — showing "belongs to: <this same company>" on every card there
|
|
42
|
+
* would be redundant. True everywhere else (top-level VIEW, or a RELATED_VIEW
|
|
43
|
+
* scoped by a different relation, e.g. a person's authored-memos list). */
|
|
44
|
+
this.showContainerLink = true;
|
|
45
|
+
this.rows = [];
|
|
46
|
+
this.loading = false;
|
|
47
|
+
this.exhausted = false;
|
|
48
|
+
this.started = false;
|
|
49
|
+
this.expandedHrefs = new Set();
|
|
50
|
+
this.nextPage = 0;
|
|
51
|
+
this.loadMore = () => {
|
|
52
|
+
if (this.loading || this.exhausted)
|
|
53
|
+
return;
|
|
54
|
+
this.emitLoadPage(this.nextPage);
|
|
55
|
+
};
|
|
56
|
+
this.toggleExpanded = (e, href) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
const next = new Set(this.expandedHrefs);
|
|
59
|
+
if (next.has(href))
|
|
60
|
+
next.delete(href);
|
|
61
|
+
else
|
|
62
|
+
next.add(href);
|
|
63
|
+
this.expandedHrefs = next;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
buildDataPath() {
|
|
67
|
+
var _a, _b, _c, _d, _e;
|
|
68
|
+
return buildListPath({
|
|
69
|
+
isRelatedView: ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === 'RELATED_VIEW',
|
|
70
|
+
fromClass: (_b = this.item) === null || _b === void 0 ? void 0 : _b.fromClass,
|
|
71
|
+
parentId: this.parentId,
|
|
72
|
+
dataClass: (_d = (_c = this.item) === null || _c === void 0 ? void 0 : _c.dataClass) !== null && _d !== void 0 ? _d : (_e = this.item) === null || _e === void 0 ? void 0 : _e.relatedClass,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
sortParam() {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
const { field, dir } = parseDefaultSort((_c = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.defaultSort) !== null && _c !== void 0 ? _c : '');
|
|
78
|
+
return buildSortParam(field, dir);
|
|
79
|
+
}
|
|
80
|
+
emitLoadPage(page) {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
this.loading = true;
|
|
83
|
+
this.mrdLoadPage.emit({
|
|
84
|
+
page,
|
|
85
|
+
sort: this.sortParam(),
|
|
86
|
+
path: this.buildDataPath(),
|
|
87
|
+
qs: buildTableQueryParams({
|
|
88
|
+
page,
|
|
89
|
+
sort: this.sortParam(),
|
|
90
|
+
filterClass: (_a = this.item) === null || _a === void 0 ? void 0 : _a.filterClass,
|
|
91
|
+
viewFilters: (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.view) === null || _c === void 0 ? void 0 : _c.filter,
|
|
92
|
+
activeFilters: [],
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Reset and request page 0. Call after setting all props, mirrors mrd-table.init(). */
|
|
97
|
+
async init() {
|
|
98
|
+
this.rows = [];
|
|
99
|
+
this.loading = false;
|
|
100
|
+
this.exhausted = false;
|
|
101
|
+
this.started = true;
|
|
102
|
+
this.nextPage = 0;
|
|
103
|
+
this.emitLoadPage(0);
|
|
104
|
+
}
|
|
105
|
+
/** Inject the rows for a page (0-based); page 0 replaces, later pages append. */
|
|
106
|
+
async setPage(pageNumber, rows, hasNext) {
|
|
107
|
+
this.loading = false;
|
|
108
|
+
this.rows = pageNumber === 0 ? rows : [...this.rows, ...rows];
|
|
109
|
+
this.nextPage = pageNumber + 1;
|
|
110
|
+
this.exhausted = hasNext !== undefined ? !hasNext : rows.length < this.pageSize;
|
|
111
|
+
}
|
|
112
|
+
/** Optimistically merge an edit into the matching row — mrdUpdateObject's PATCH
|
|
113
|
+
* is fire-and-forget on the host side, so this is what makes an edit visible
|
|
114
|
+
* immediately rather than only after the next full reload. */
|
|
115
|
+
async patchRow(href, values) {
|
|
116
|
+
this.rows = this.rows.map(row => { var _a, _b; return ((_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href) === href ? Object.assign(Object.assign({}, row), values) : row; });
|
|
117
|
+
}
|
|
118
|
+
/** Optimistically drop a deleted row — mrdDeleteObject's DELETE is fire-and-
|
|
119
|
+
* forget on the host side, same reasoning as patchRow(). */
|
|
120
|
+
async removeRow(href) {
|
|
121
|
+
this.rows = this.rows.filter(row => { var _a, _b; return ((_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href) !== href; });
|
|
122
|
+
}
|
|
123
|
+
/** Value of a value-slot: reads row[field] via the slot→field map. */
|
|
124
|
+
slotValue(row, slot) {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
127
|
+
if (!field)
|
|
128
|
+
return undefined;
|
|
129
|
+
return row[field];
|
|
130
|
+
}
|
|
131
|
+
/** Relation link for a relation-slot: reads row._links[field]. */
|
|
132
|
+
slotLink(row, slot) {
|
|
133
|
+
var _a, _b, _c;
|
|
134
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
135
|
+
if (!field)
|
|
136
|
+
return undefined;
|
|
137
|
+
const links = ((_c = row === null || row === void 0 ? void 0 : row._links) !== null && _c !== void 0 ? _c : {});
|
|
138
|
+
return links[field];
|
|
139
|
+
}
|
|
140
|
+
plainTextLength(row) {
|
|
141
|
+
const raw = this.slotValue(row, 'body');
|
|
142
|
+
if (raw == null || raw === '')
|
|
143
|
+
return 0;
|
|
144
|
+
return String(raw).replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim().length;
|
|
145
|
+
}
|
|
146
|
+
renderContainer(row) {
|
|
147
|
+
if (!this.showContainerLink)
|
|
148
|
+
return null;
|
|
149
|
+
const link = this.slotLink(row, 'container');
|
|
150
|
+
if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
|
|
151
|
+
return null;
|
|
152
|
+
return (h("button", { type: "button", class: "mrd-memo-list__card-container", onClick: e => { e.stopPropagation(); this.mrdNavigate.emit({ href: link.href, label: link.name }); } }, link.name));
|
|
153
|
+
}
|
|
154
|
+
renderLabels(row) {
|
|
155
|
+
const raw = this.slotValue(row, 'labels');
|
|
156
|
+
const keys = Array.isArray(raw) ? raw.map(String) : (raw != null && raw !== '' ? [String(raw)] : []);
|
|
157
|
+
if (!keys.length)
|
|
158
|
+
return null;
|
|
159
|
+
return (h("div", { class: "mrd-memo-list__labels" }, keys.map(key => {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const listItem = ((_a = this.labelsListItems) !== null && _a !== void 0 ? _a : []).find(li => li.key === key);
|
|
162
|
+
const label = (_b = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _b !== void 0 ? _b : key;
|
|
163
|
+
if ((listItem === null || listItem === void 0 ? void 0 : listItem.color) && (listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor)) {
|
|
164
|
+
return (h("span", { key: key, class: "mrd-memo-list__badge", style: { color: listItem.color, backgroundColor: listItem.backgroundColor } }, label));
|
|
165
|
+
}
|
|
166
|
+
return h("span", { key: key, class: "mrd-memo-list__badge mrd-memo-list__badge--plain" }, label);
|
|
167
|
+
})));
|
|
168
|
+
}
|
|
169
|
+
renderBody(row, href) {
|
|
170
|
+
const raw = this.slotValue(row, 'body');
|
|
171
|
+
if (raw == null || raw === '')
|
|
172
|
+
return null;
|
|
173
|
+
const expanded = this.expandedHrefs.has(href);
|
|
174
|
+
const needsToggle = this.plainTextLength(row) > BODY_PREVIEW_THRESHOLD;
|
|
175
|
+
return (h("div", { class: "mrd-memo-list__card-body-wrap" }, h("div", { class: {
|
|
176
|
+
'mrd-memo-list__card-body': true,
|
|
177
|
+
'mrd-memo-list__card-body--clamped': needsToggle && !expanded,
|
|
178
|
+
}, innerHTML: DOMPurify.sanitize(String(raw)) }), needsToggle && (h("button", { type: "button", class: "mrd-memo-list__card-toggle", onClick: e => this.toggleExpanded(e, href) }, t(expanded ? 'textblock_show_less' : 'textblock_show_more', this.locale)))));
|
|
179
|
+
}
|
|
180
|
+
renderCard(row, index) {
|
|
181
|
+
var _a, _b, _c;
|
|
182
|
+
const titleRaw = this.slotValue(row, 'title');
|
|
183
|
+
const title = titleRaw != null && titleRaw !== '' ? String(titleRaw) : null;
|
|
184
|
+
const dateRaw = this.slotValue(row, 'date');
|
|
185
|
+
const author = this.slotLink(row, 'author');
|
|
186
|
+
const important = !!this.slotValue(row, 'important');
|
|
187
|
+
const href = (_c = (_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : '';
|
|
188
|
+
return (h("div", { key: href || index, class: { 'mrd-memo-list__card': true, 'mrd-memo-list__card--readonly': this.readOnly }, role: this.readOnly ? undefined : 'button', tabIndex: this.readOnly ? undefined : 0, onClick: () => {
|
|
189
|
+
if (!this.readOnly)
|
|
190
|
+
this.mrdEdit.emit({ row });
|
|
191
|
+
}, onKeyDown: e => {
|
|
192
|
+
if (this.readOnly)
|
|
193
|
+
return;
|
|
194
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
this.mrdEdit.emit({ row });
|
|
197
|
+
}
|
|
198
|
+
} }, h("div", { class: "mrd-memo-list__card-header" }, title && h("span", { class: "mrd-memo-list__card-title" }, title), important && (h("span", { class: "mrd-memo-list__card-important", title: t('memo_important', this.locale) }, h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 21 12 17.27 5.82 21 7 14.14l-5-4.87 7.1-1.01z" }))))), this.renderBody(row, href), this.renderLabels(row), h("div", { class: "mrd-memo-list__card-meta" }, (author === null || author === void 0 ? void 0 : author.name) && h("span", { class: "mrd-memo-list__card-author" }, author.name), dateRaw != null && dateRaw !== '' && (h("span", { class: "mrd-memo-list__card-date" }, formatDateTime(dateRaw, this.locale)))), this.renderContainer(row)));
|
|
199
|
+
}
|
|
200
|
+
render() {
|
|
201
|
+
return (h(Host, { key: '18294fc609b741d38f9933d3ae01d20d6dda5ec5' }, h("div", { key: 'ac6c1adc6575ae1edb2cd507c8ac31b1f28ea35c', class: "mrd-memo-list" }, this.rows.map((row, i) => this.renderCard(row, i)), this.started && !this.loading && this.rows.length === 0 && (h("div", { key: '271281b2e087f8fd55dc51b32b1fe4cce387cdcb', class: "mrd-memo-list__empty" }, t('no_results', this.locale))), !this.exhausted && this.rows.length > 0 && (h("button", { key: '24861c35323d759d69bfd4f358657fe201ca7727', type: "button", class: "mrd-memo-list__load-more", disabled: this.loading, onClick: this.loadMore }, t('load_more', this.locale))))));
|
|
202
|
+
}
|
|
203
|
+
static get is() { return "mrd-memo-list"; }
|
|
204
|
+
static get encapsulation() { return "scoped"; }
|
|
205
|
+
static get originalStyleUrls() {
|
|
206
|
+
return {
|
|
207
|
+
"$": ["mrd-memo-list.scss"]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
static get styleUrls() {
|
|
211
|
+
return {
|
|
212
|
+
"$": ["mrd-memo-list.css"]
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
static get properties() {
|
|
216
|
+
return {
|
|
217
|
+
"item": {
|
|
218
|
+
"type": "unknown",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "ClientLayoutItem | null",
|
|
222
|
+
"resolved": "ClientLayoutItem | null",
|
|
223
|
+
"references": {
|
|
224
|
+
"ClientLayoutItem": {
|
|
225
|
+
"location": "import",
|
|
226
|
+
"path": "../../../types/client-layout",
|
|
227
|
+
"id": "src/types/client-layout.ts::ClientLayoutItem",
|
|
228
|
+
"referenceLocation": "ClientLayoutItem"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config)."
|
|
237
|
+
},
|
|
238
|
+
"getter": false,
|
|
239
|
+
"setter": false,
|
|
240
|
+
"defaultValue": "null"
|
|
241
|
+
},
|
|
242
|
+
"archetype": {
|
|
243
|
+
"type": "unknown",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "ClientArchetype",
|
|
247
|
+
"resolved": "ClientArchetype",
|
|
248
|
+
"references": {
|
|
249
|
+
"ClientArchetype": {
|
|
250
|
+
"location": "import",
|
|
251
|
+
"path": "../../../types/client-layout",
|
|
252
|
+
"id": "src/types/client-layout.ts::ClientArchetype",
|
|
253
|
+
"referenceLocation": "ClientArchetype"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"required": true,
|
|
258
|
+
"optional": false,
|
|
259
|
+
"docs": {
|
|
260
|
+
"tags": [],
|
|
261
|
+
"text": "Resolved `commons.memo` archetype binding."
|
|
262
|
+
},
|
|
263
|
+
"getter": false,
|
|
264
|
+
"setter": false
|
|
265
|
+
},
|
|
266
|
+
"parentId": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "string",
|
|
271
|
+
"resolved": "string",
|
|
272
|
+
"references": {}
|
|
273
|
+
},
|
|
274
|
+
"required": false,
|
|
275
|
+
"optional": false,
|
|
276
|
+
"docs": {
|
|
277
|
+
"tags": [],
|
|
278
|
+
"text": "Parent record id \u2014 required for RELATED_VIEW path building."
|
|
279
|
+
},
|
|
280
|
+
"getter": false,
|
|
281
|
+
"setter": false,
|
|
282
|
+
"reflect": false,
|
|
283
|
+
"attribute": "parent-id",
|
|
284
|
+
"defaultValue": "''"
|
|
285
|
+
},
|
|
286
|
+
"pageSize": {
|
|
287
|
+
"type": "number",
|
|
288
|
+
"mutable": false,
|
|
289
|
+
"complexType": {
|
|
290
|
+
"original": "number",
|
|
291
|
+
"resolved": "number",
|
|
292
|
+
"references": {}
|
|
293
|
+
},
|
|
294
|
+
"required": false,
|
|
295
|
+
"optional": false,
|
|
296
|
+
"docs": {
|
|
297
|
+
"tags": [],
|
|
298
|
+
"text": "Records per page (must match API page size)."
|
|
299
|
+
},
|
|
300
|
+
"getter": false,
|
|
301
|
+
"setter": false,
|
|
302
|
+
"reflect": false,
|
|
303
|
+
"attribute": "page-size",
|
|
304
|
+
"defaultValue": "20"
|
|
305
|
+
},
|
|
306
|
+
"locale": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"mutable": false,
|
|
309
|
+
"complexType": {
|
|
310
|
+
"original": "string",
|
|
311
|
+
"resolved": "string",
|
|
312
|
+
"references": {}
|
|
313
|
+
},
|
|
314
|
+
"required": false,
|
|
315
|
+
"optional": false,
|
|
316
|
+
"docs": {
|
|
317
|
+
"tags": [],
|
|
318
|
+
"text": ""
|
|
319
|
+
},
|
|
320
|
+
"getter": false,
|
|
321
|
+
"setter": false,
|
|
322
|
+
"reflect": false,
|
|
323
|
+
"attribute": "locale",
|
|
324
|
+
"defaultValue": "navigator.language"
|
|
325
|
+
},
|
|
326
|
+
"readOnly": {
|
|
327
|
+
"type": "boolean",
|
|
328
|
+
"mutable": false,
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "boolean",
|
|
331
|
+
"resolved": "boolean",
|
|
332
|
+
"references": {}
|
|
333
|
+
},
|
|
334
|
+
"required": false,
|
|
335
|
+
"optional": false,
|
|
336
|
+
"docs": {
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": "When true, cards are not clickable (no mrdEdit) \u2014 matches mrd-table's own\nreadOnly gating on its create action."
|
|
339
|
+
},
|
|
340
|
+
"getter": false,
|
|
341
|
+
"setter": false,
|
|
342
|
+
"reflect": false,
|
|
343
|
+
"attribute": "read-only",
|
|
344
|
+
"defaultValue": "false"
|
|
345
|
+
},
|
|
346
|
+
"labelsListItems": {
|
|
347
|
+
"type": "unknown",
|
|
348
|
+
"mutable": false,
|
|
349
|
+
"complexType": {
|
|
350
|
+
"original": "ClientListValue[] | null",
|
|
351
|
+
"resolved": "ClientListValue[] | null",
|
|
352
|
+
"references": {
|
|
353
|
+
"ClientListValue": {
|
|
354
|
+
"location": "import",
|
|
355
|
+
"path": "../../../types/client-layout",
|
|
356
|
+
"id": "src/types/client-layout.ts::ClientListValue",
|
|
357
|
+
"referenceLocation": "ClientListValue"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"required": false,
|
|
362
|
+
"optional": false,
|
|
363
|
+
"docs": {
|
|
364
|
+
"tags": [],
|
|
365
|
+
"text": "listItems of the FIELD bound to the `labels` slot, resolved by mrd-layout-section\nfrom its own items array, same reason mrd-memo-view needs it."
|
|
366
|
+
},
|
|
367
|
+
"getter": false,
|
|
368
|
+
"setter": false,
|
|
369
|
+
"defaultValue": "null"
|
|
370
|
+
},
|
|
371
|
+
"showContainerLink": {
|
|
372
|
+
"type": "boolean",
|
|
373
|
+
"mutable": false,
|
|
374
|
+
"complexType": {
|
|
375
|
+
"original": "boolean",
|
|
376
|
+
"resolved": "boolean",
|
|
377
|
+
"references": {}
|
|
378
|
+
},
|
|
379
|
+
"required": false,
|
|
380
|
+
"optional": false,
|
|
381
|
+
"docs": {
|
|
382
|
+
"tags": [],
|
|
383
|
+
"text": "False when the list is already scoped to its own container (a company's own\nmemo tab) \u2014 showing \"belongs to: <this same company>\" on every card there\nwould be redundant. True everywhere else (top-level VIEW, or a RELATED_VIEW\nscoped by a different relation, e.g. a person's authored-memos list)."
|
|
384
|
+
},
|
|
385
|
+
"getter": false,
|
|
386
|
+
"setter": false,
|
|
387
|
+
"reflect": false,
|
|
388
|
+
"attribute": "show-container-link",
|
|
389
|
+
"defaultValue": "true"
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
static get states() {
|
|
394
|
+
return {
|
|
395
|
+
"rows": {},
|
|
396
|
+
"loading": {},
|
|
397
|
+
"exhausted": {},
|
|
398
|
+
"started": {},
|
|
399
|
+
"expandedHrefs": {}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
static get events() {
|
|
403
|
+
return [{
|
|
404
|
+
"method": "mrdLoadPage",
|
|
405
|
+
"name": "mrdLoadPage",
|
|
406
|
+
"bubbles": true,
|
|
407
|
+
"cancelable": true,
|
|
408
|
+
"composed": true,
|
|
409
|
+
"docs": {
|
|
410
|
+
"tags": [],
|
|
411
|
+
"text": "Fired when a page needs fetching; same shape as mrd-table's mrdLoadPage minus `qs`'s\ncolumn-filter support (cards have no filter UI) \u2014 host calls setPage() with the result."
|
|
412
|
+
},
|
|
413
|
+
"complexType": {
|
|
414
|
+
"original": "{ page: number; sort: string; path: string; qs: string }",
|
|
415
|
+
"resolved": "{ page: number; sort: string; path: string; qs: string; }",
|
|
416
|
+
"references": {}
|
|
417
|
+
}
|
|
418
|
+
}, {
|
|
419
|
+
"method": "mrdEdit",
|
|
420
|
+
"name": "mrdEdit",
|
|
421
|
+
"bubbles": true,
|
|
422
|
+
"cancelable": true,
|
|
423
|
+
"composed": true,
|
|
424
|
+
"docs": {
|
|
425
|
+
"tags": [],
|
|
426
|
+
"text": "A card was clicked (and not read-only). mrd-memo-container opens its quick-\nedit dialog pre-filled from `row` \u2014 no navigation, no detail page."
|
|
427
|
+
},
|
|
428
|
+
"complexType": {
|
|
429
|
+
"original": "{ row: Record<string, unknown> }",
|
|
430
|
+
"resolved": "{ row: Record<string, unknown>; }",
|
|
431
|
+
"references": {
|
|
432
|
+
"Record": {
|
|
433
|
+
"location": "global",
|
|
434
|
+
"id": "global::Record"
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
"method": "mrdNavigate",
|
|
440
|
+
"name": "mrdNavigate",
|
|
441
|
+
"bubbles": true,
|
|
442
|
+
"cancelable": true,
|
|
443
|
+
"composed": true,
|
|
444
|
+
"docs": {
|
|
445
|
+
"tags": [],
|
|
446
|
+
"text": "The container link on a card was clicked \u2014 this is real navigation (to the\ncontainer record), unrelated to mrdEdit."
|
|
447
|
+
},
|
|
448
|
+
"complexType": {
|
|
449
|
+
"original": "{ href?: string; label: string }",
|
|
450
|
+
"resolved": "{ href?: string | undefined; label: string; }",
|
|
451
|
+
"references": {}
|
|
452
|
+
}
|
|
453
|
+
}];
|
|
454
|
+
}
|
|
455
|
+
static get methods() {
|
|
456
|
+
return {
|
|
457
|
+
"init": {
|
|
458
|
+
"complexType": {
|
|
459
|
+
"signature": "() => Promise<void>",
|
|
460
|
+
"parameters": [],
|
|
461
|
+
"references": {
|
|
462
|
+
"Promise": {
|
|
463
|
+
"location": "global",
|
|
464
|
+
"id": "global::Promise"
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
"return": "Promise<void>"
|
|
468
|
+
},
|
|
469
|
+
"docs": {
|
|
470
|
+
"text": "Reset and request page 0. Call after setting all props, mirrors mrd-table.init().",
|
|
471
|
+
"tags": []
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
"setPage": {
|
|
475
|
+
"complexType": {
|
|
476
|
+
"signature": "(pageNumber: number, rows: Record<string, unknown>[], hasNext?: boolean) => Promise<void>",
|
|
477
|
+
"parameters": [{
|
|
478
|
+
"name": "pageNumber",
|
|
479
|
+
"type": "number",
|
|
480
|
+
"docs": ""
|
|
481
|
+
}, {
|
|
482
|
+
"name": "rows",
|
|
483
|
+
"type": "Record<string, unknown>[]",
|
|
484
|
+
"docs": ""
|
|
485
|
+
}, {
|
|
486
|
+
"name": "hasNext",
|
|
487
|
+
"type": "boolean | undefined",
|
|
488
|
+
"docs": ""
|
|
489
|
+
}],
|
|
490
|
+
"references": {
|
|
491
|
+
"Promise": {
|
|
492
|
+
"location": "global",
|
|
493
|
+
"id": "global::Promise"
|
|
494
|
+
},
|
|
495
|
+
"Record": {
|
|
496
|
+
"location": "global",
|
|
497
|
+
"id": "global::Record"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
"return": "Promise<void>"
|
|
501
|
+
},
|
|
502
|
+
"docs": {
|
|
503
|
+
"text": "Inject the rows for a page (0-based); page 0 replaces, later pages append.",
|
|
504
|
+
"tags": []
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"patchRow": {
|
|
508
|
+
"complexType": {
|
|
509
|
+
"signature": "(href: string, values: Record<string, unknown>) => Promise<void>",
|
|
510
|
+
"parameters": [{
|
|
511
|
+
"name": "href",
|
|
512
|
+
"type": "string",
|
|
513
|
+
"docs": ""
|
|
514
|
+
}, {
|
|
515
|
+
"name": "values",
|
|
516
|
+
"type": "{ [x: string]: unknown; }",
|
|
517
|
+
"docs": ""
|
|
518
|
+
}],
|
|
519
|
+
"references": {
|
|
520
|
+
"Promise": {
|
|
521
|
+
"location": "global",
|
|
522
|
+
"id": "global::Promise"
|
|
523
|
+
},
|
|
524
|
+
"Record": {
|
|
525
|
+
"location": "global",
|
|
526
|
+
"id": "global::Record"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
"return": "Promise<void>"
|
|
530
|
+
},
|
|
531
|
+
"docs": {
|
|
532
|
+
"text": "Optimistically merge an edit into the matching row \u2014 mrdUpdateObject's PATCH\nis fire-and-forget on the host side, so this is what makes an edit visible\nimmediately rather than only after the next full reload.",
|
|
533
|
+
"tags": []
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"removeRow": {
|
|
537
|
+
"complexType": {
|
|
538
|
+
"signature": "(href: string) => Promise<void>",
|
|
539
|
+
"parameters": [{
|
|
540
|
+
"name": "href",
|
|
541
|
+
"type": "string",
|
|
542
|
+
"docs": ""
|
|
543
|
+
}],
|
|
544
|
+
"references": {
|
|
545
|
+
"Promise": {
|
|
546
|
+
"location": "global",
|
|
547
|
+
"id": "global::Promise"
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
"return": "Promise<void>"
|
|
551
|
+
},
|
|
552
|
+
"docs": {
|
|
553
|
+
"text": "Optimistically drop a deleted row \u2014 mrdDeleteObject's DELETE is fire-and-\nforget on the host side, same reasoning as patchRow().",
|
|
554
|
+
"tags": []
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.mrd-memo-view {
|
|
7
|
+
max-width: 720px;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--mrd-space-3);
|
|
11
|
+
}
|
|
12
|
+
.mrd-memo-view__header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: baseline;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
gap: var(--mrd-space-3);
|
|
17
|
+
}
|
|
18
|
+
.mrd-memo-view__title {
|
|
19
|
+
font-size: var(--mrd-font-size-2xl);
|
|
20
|
+
font-weight: var(--mrd-font-weight-bold);
|
|
21
|
+
color: var(--mrd-color-neutral-900);
|
|
22
|
+
letter-spacing: -0.02em;
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
.mrd-memo-view__important {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: var(--mrd-space-1);
|
|
29
|
+
font-size: var(--mrd-font-size-xs);
|
|
30
|
+
font-weight: var(--mrd-font-weight-semibold);
|
|
31
|
+
color: var(--mrd-color-warning);
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
letter-spacing: 0.04em;
|
|
34
|
+
}
|
|
35
|
+
.mrd-memo-view__important svg {
|
|
36
|
+
width: 0.875rem;
|
|
37
|
+
height: 0.875rem;
|
|
38
|
+
}
|
|
39
|
+
.mrd-memo-view__meta {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: var(--mrd-space-2);
|
|
43
|
+
font-size: var(--mrd-font-size-sm);
|
|
44
|
+
color: var(--mrd-color-neutral-400);
|
|
45
|
+
}
|
|
46
|
+
.mrd-memo-view__meta-author {
|
|
47
|
+
background: none;
|
|
48
|
+
border: none;
|
|
49
|
+
padding: 0;
|
|
50
|
+
font-family: var(--mrd-font-family);
|
|
51
|
+
font-size: inherit;
|
|
52
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
53
|
+
color: var(--mrd-color-neutral-500);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
.mrd-memo-view__meta-author:hover {
|
|
57
|
+
color: var(--mrd-color-primary);
|
|
58
|
+
text-decoration: underline;
|
|
59
|
+
}
|
|
60
|
+
.mrd-memo-view__meta-date::before {
|
|
61
|
+
content: "·";
|
|
62
|
+
margin-right: var(--mrd-space-2);
|
|
63
|
+
}
|
|
64
|
+
.mrd-memo-view__meta-author + .mrd-memo-view__meta-date::before {
|
|
65
|
+
content: "·";
|
|
66
|
+
}
|
|
67
|
+
.mrd-memo-view__labels {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
gap: var(--mrd-space-2);
|
|
71
|
+
}
|
|
72
|
+
.mrd-memo-view__badge {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
height: 1.375rem;
|
|
76
|
+
padding: 0 var(--mrd-space-2);
|
|
77
|
+
border-radius: var(--mrd-border-radius-full, 999px);
|
|
78
|
+
font-size: var(--mrd-font-size-xs);
|
|
79
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
80
|
+
}
|
|
81
|
+
.mrd-memo-view__badge--plain {
|
|
82
|
+
background: var(--mrd-color-neutral-100);
|
|
83
|
+
color: var(--mrd-color-neutral-600);
|
|
84
|
+
}
|
|
85
|
+
.mrd-memo-view__container-link {
|
|
86
|
+
align-self: flex-start;
|
|
87
|
+
background: none;
|
|
88
|
+
border: none;
|
|
89
|
+
padding: 0;
|
|
90
|
+
font-family: var(--mrd-font-family);
|
|
91
|
+
font-size: var(--mrd-font-size-sm);
|
|
92
|
+
font-weight: var(--mrd-font-weight-semibold);
|
|
93
|
+
color: var(--mrd-color-primary);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
.mrd-memo-view__container-link:hover {
|
|
97
|
+
text-decoration: underline;
|
|
98
|
+
}
|
|
99
|
+
.mrd-memo-view__divider {
|
|
100
|
+
height: var(--mrd-border-width);
|
|
101
|
+
background: var(--mrd-color-neutral-200);
|
|
102
|
+
}
|
|
103
|
+
.mrd-memo-view__body {
|
|
104
|
+
font-size: var(--mrd-font-size-base);
|
|
105
|
+
color: var(--mrd-color-neutral-800);
|
|
106
|
+
line-height: var(--mrd-line-height-relaxed);
|
|
107
|
+
word-break: break-word;
|
|
108
|
+
}
|