@openg2p/registry-widgets 0.2.0 → 1.0.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/README.md +110 -12
- package/dist/components/SectionRenderer.d.ts.map +1 -1
- package/dist/hooks/useWidgetTheme.d.ts +19 -0
- package/dist/hooks/useWidgetTheme.d.ts.map +1 -0
- package/dist/index.esm.js +53 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -13
- package/dist/index.js.map +1 -1
- package/dist/theme/index.d.ts +101 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/widgets/HeaderSectionWidget.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4201,6 +4201,15 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4201
4201
|
text-overflow: ellipsis !important;
|
|
4202
4202
|
white-space: nowrap !important;
|
|
4203
4203
|
}
|
|
4204
|
+
/* Readonly: prevent flex row from overflowing panel */
|
|
4205
|
+
.${sectionClassId} .TextDisplayWidget {
|
|
4206
|
+
min-width: 0 !important;
|
|
4207
|
+
overflow: hidden !important;
|
|
4208
|
+
}
|
|
4209
|
+
.${sectionClassId} .TextDisplayWidget > .flex-1 {
|
|
4210
|
+
min-width: 0 !important;
|
|
4211
|
+
overflow: hidden !important;
|
|
4212
|
+
}
|
|
4204
4213
|
/* Readonly value text truncation */
|
|
4205
4214
|
.${sectionClassId} .TextDisplayWidget > .flex-1 > .text-gray-900 {
|
|
4206
4215
|
overflow: hidden;
|
|
@@ -4531,11 +4540,11 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4531
4540
|
fontSize: '14px',
|
|
4532
4541
|
color: '#000000',
|
|
4533
4542
|
fontWeight: 'normal',
|
|
4534
|
-
}, children: crViewData.approvedDate }))] })] })] })), mode === 'RegistryView' && !hideEditButton && (jsxRuntimeExports.jsx("hr", { className: "border-gray-300 w-full", style: { height: '1px', marginTop: !isEditMode ? '
|
|
4543
|
+
}, children: crViewData.approvedDate }))] })] })] })), mode === 'RegistryView' && !hideEditButton && (jsxRuntimeExports.jsx("hr", { className: "border-gray-300 w-full", style: { height: '1px', marginTop: !isEditMode ? '10px' : 0, marginBottom: '14px' } })), mode === 'RegistryView' && !isEditMode && !hideEditButton && (jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center", style: { marginBottom: '20px' }, children: jsxRuntimeExports.jsxs("button", { onClick: handleEdit, className: "font-normal inline-flex items-center gap-2 bg-transparent border-0 p-0 cursor-pointer hover:opacity-80", style: {
|
|
4535
4544
|
fontFamily: 'Roboto, sans-serif',
|
|
4536
4545
|
fontSize: '16px',
|
|
4537
4546
|
color: 'rgba(0, 0, 0, 0.50)'
|
|
4538
|
-
}, children: [
|
|
4547
|
+
}, children: [translate('common.editDetails') || 'Edit Details', jsxRuntimeExports.jsx("img", { src: img$8, alt: "right-arrow", className: "w-3.5 h-3.5 brightness-0 opacity-50" })] }) }))] })] })) })] }));
|
|
4539
4548
|
};
|
|
4540
4549
|
|
|
4541
4550
|
/**
|
|
@@ -8936,6 +8945,17 @@ const DEFAULT_STATUS_COLORS = {
|
|
|
8936
8945
|
inactive: '#D97706',
|
|
8937
8946
|
archived: '#6B7280',
|
|
8938
8947
|
};
|
|
8948
|
+
const DEFAULT_LABELS = {
|
|
8949
|
+
functionalId: 'Functional Record ID',
|
|
8950
|
+
status: 'Record Status',
|
|
8951
|
+
statusReason: 'Status Reason',
|
|
8952
|
+
select: 'Select',
|
|
8953
|
+
enterReason: 'Enter Reason',
|
|
8954
|
+
createdBy: 'Created by',
|
|
8955
|
+
createdAt: 'Created at',
|
|
8956
|
+
lastApprovedBy: 'Last Approved by',
|
|
8957
|
+
lastApprovedAt: 'Last Approved at',
|
|
8958
|
+
};
|
|
8939
8959
|
// ── Hook: load data-source options for a single field ────────────
|
|
8940
8960
|
// Options are loaded in both view and edit modes because view mode
|
|
8941
8961
|
// needs them to resolve display labels (e.g. "active" → "Active").
|
|
@@ -8999,6 +9019,21 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
8999
9019
|
const values = reactRedux.useSelector((state) => state.widget.values);
|
|
9000
9020
|
const isReadonly = widgetConfig['widget-readonly'] !== false;
|
|
9001
9021
|
const dataPath = widgetConfig['widget-data-path'];
|
|
9022
|
+
// ── Resolve labels ──────────────────────────────────────────────
|
|
9023
|
+
// Priority: widget-labels override → translateConfig(English default) → English default
|
|
9024
|
+
// The host's locale JSON files should use the English text as keys,
|
|
9025
|
+
// e.g. { "Functional Record ID": "ID fonctionnel" }
|
|
9026
|
+
const configLabels = widgetConfig['widget-labels'];
|
|
9027
|
+
const getLabel = React.useCallback((key) => {
|
|
9028
|
+
const englishDefault = DEFAULT_LABELS[key] || key;
|
|
9029
|
+
if (configLabels?.[key]) {
|
|
9030
|
+
const translated = translateConfig(configLabels[key]);
|
|
9031
|
+
if (translated && translated !== configLabels[key])
|
|
9032
|
+
return translated;
|
|
9033
|
+
}
|
|
9034
|
+
const translated = translateConfig(englishDefault);
|
|
9035
|
+
return translated || englishDefault;
|
|
9036
|
+
}, [configLabels, translateConfig]);
|
|
9002
9037
|
// ── Per-field config map ──────────────────────────────────────
|
|
9003
9038
|
const fieldConfigMap = React.useMemo(() => {
|
|
9004
9039
|
return widgetConfig['widget-field-config'] || {};
|
|
@@ -9046,7 +9081,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9046
9081
|
const lastApprovedAt = findValue('lastApprovedAt') || '';
|
|
9047
9082
|
// ── Format options ────────────────────────────────────────────
|
|
9048
9083
|
const format = (widgetConfig['widget-data-format'] || {});
|
|
9049
|
-
const imageSize = format.imageSize ||
|
|
9084
|
+
const imageSize = format.imageSize || 120;
|
|
9050
9085
|
const nameColor = format.nameColor || '#ED7C22';
|
|
9051
9086
|
const statusColors = {
|
|
9052
9087
|
...DEFAULT_STATUS_COLORS,
|
|
@@ -9096,7 +9131,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9096
9131
|
flex-direction: row;
|
|
9097
9132
|
align-items: flex-start;
|
|
9098
9133
|
gap: 1rem;
|
|
9099
|
-
flex: 1 1
|
|
9134
|
+
flex: 1 1 50%;
|
|
9100
9135
|
min-width: 0;
|
|
9101
9136
|
}
|
|
9102
9137
|
|
|
@@ -9104,7 +9139,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9104
9139
|
display: flex;
|
|
9105
9140
|
flex-direction: column;
|
|
9106
9141
|
gap: 0.5rem;
|
|
9107
|
-
flex:
|
|
9142
|
+
flex: 1 1 40%;
|
|
9108
9143
|
min-width: 220px;
|
|
9109
9144
|
}
|
|
9110
9145
|
|
|
@@ -9158,19 +9193,19 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9158
9193
|
display: flex;
|
|
9159
9194
|
align-items: flex-start;
|
|
9160
9195
|
gap: 0.5rem;
|
|
9161
|
-
font-size:
|
|
9196
|
+
font-size: 1rem;
|
|
9162
9197
|
line-height: 1.6;
|
|
9163
9198
|
}
|
|
9164
9199
|
|
|
9165
9200
|
.${cls} .hdr-field-label {
|
|
9166
|
-
color:
|
|
9167
|
-
font-weight:
|
|
9201
|
+
color: rgba(0, 0, 0, 0.5);
|
|
9202
|
+
font-weight: 400;
|
|
9168
9203
|
white-space: nowrap;
|
|
9169
9204
|
}
|
|
9170
9205
|
|
|
9171
9206
|
.${cls} .hdr-field-value {
|
|
9172
9207
|
color: #111827;
|
|
9173
|
-
font-weight:
|
|
9208
|
+
font-weight: 500;
|
|
9174
9209
|
}
|
|
9175
9210
|
|
|
9176
9211
|
.${cls} .hdr-status-badge {
|
|
@@ -9186,18 +9221,18 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9186
9221
|
display: flex;
|
|
9187
9222
|
align-items: baseline;
|
|
9188
9223
|
gap: 0.35rem;
|
|
9189
|
-
font-size:
|
|
9224
|
+
font-size: 1rem;
|
|
9190
9225
|
line-height: 1.6;
|
|
9191
9226
|
}
|
|
9192
9227
|
|
|
9193
9228
|
.${cls} .hdr-meta-label {
|
|
9194
|
-
color:
|
|
9229
|
+
color: rgba(0, 0, 0, 0.5);
|
|
9195
9230
|
font-weight: 400;
|
|
9196
9231
|
}
|
|
9197
9232
|
|
|
9198
9233
|
.${cls} .hdr-meta-value {
|
|
9199
9234
|
color: #111827;
|
|
9200
|
-
font-weight:
|
|
9235
|
+
font-weight: 500;
|
|
9201
9236
|
}
|
|
9202
9237
|
|
|
9203
9238
|
.${cls} .hdr-select {
|
|
@@ -9248,7 +9283,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9248
9283
|
.parentElement?.querySelector('.hdr-avatar-placeholder');
|
|
9249
9284
|
if (placeholder)
|
|
9250
9285
|
placeholder.style.display = 'flex';
|
|
9251
|
-
} })) : null, jsxRuntimeExports.jsx("div", { className: "hdr-avatar-placeholder", style: { display: imageUrl ? 'none' : 'flex' }, children: jsxRuntimeExports.jsx("img", { src: img$f, alt: "Profile Placeholder" }) })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-info", children: [displayName && jsxRuntimeExports.jsx("div", { className: "hdr-name", children: displayName }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: "#9CA3AF" }), jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [
|
|
9286
|
+
} })) : null, jsxRuntimeExports.jsx("div", { className: "hdr-avatar-placeholder", style: { display: imageUrl ? 'none' : 'flex' }, children: jsxRuntimeExports.jsx("img", { src: img$f, alt: "Profile Placeholder" }) })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-info", children: [displayName && jsxRuntimeExports.jsx("div", { className: "hdr-name", children: displayName }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: "#9CA3AF" }), jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [getLabel('functionalId'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: functionalId || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: isReadonly ? statusColor : '#F59E0B' }), jsxRuntimeExports.jsx("span", { className: "hdr-field-label", children: getLabel('status') }), isReadonly ? (statusLabel ? (jsxRuntimeExports.jsx("span", { className: "hdr-status-badge", style: { backgroundColor: statusColor }, children: statusLabel })) : (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: "-" }))) : (jsxRuntimeExports.jsxs("select", { className: "hdr-select", value: statusValue, onChange: (e) => updateFieldValue('status', e.target.value), children: [jsxRuntimeExports.jsx("option", { value: "", children: getLabel('select') }), statusOptions.map((opt) => (jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value)))] }))] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: isReadonly ? '#9CA3AF' : '#F59E0B' }), jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [getLabel('statusReason'), " :"] }), isReadonly ? (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: statusReason || '-' })) : (jsxRuntimeExports.jsx("input", { type: "text", className: "hdr-input", value: statusReason, placeholder: getLabel('enterReason'), onChange: (e) => updateFieldValue('statusReason', e.target.value) }))] })] })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-right", children: [jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [getLabel('createdBy'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: createdBy || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [getLabel('createdAt'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: createdAt || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [getLabel('lastApprovedBy'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedBy || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [getLabel('lastApprovedAt'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedAt || '-' })] })] })] })] }));
|
|
9252
9287
|
};
|
|
9253
9288
|
|
|
9254
9289
|
/**
|
|
@@ -9346,8 +9381,13 @@ var enTranslations = {
|
|
|
9346
9381
|
"common.uploadFile": "Upload File",
|
|
9347
9382
|
"common.maxFileSize": "Maximum file size: {{size}} MB",
|
|
9348
9383
|
"common.edit": "Edit",
|
|
9384
|
+
"common.editDetails": "Edit Details",
|
|
9349
9385
|
"common.save": "Save",
|
|
9350
9386
|
"common.cancel": "Cancel",
|
|
9387
|
+
"common.previous": "Prev",
|
|
9388
|
+
"common.next": "Next",
|
|
9389
|
+
"common.sectionSaved": "Saved",
|
|
9390
|
+
"common.sectionModified": "Modified and not saved",
|
|
9351
9391
|
"common.supportedDocuments": "Supported Documents",
|
|
9352
9392
|
"table.addRecord": "Add New Record",
|
|
9353
9393
|
"table.confirm": "Confirm Action",
|