origam 2.38.1 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +6 -6
|
@@ -194,13 +194,7 @@
|
|
|
194
194
|
</template>
|
|
195
195
|
|
|
196
196
|
<script lang="ts" setup>
|
|
197
|
-
import {
|
|
198
|
-
computed,
|
|
199
|
-
nextTick,
|
|
200
|
-
ref,
|
|
201
|
-
useId,
|
|
202
|
-
watch
|
|
203
|
-
} from "vue";
|
|
197
|
+
import { computed, nextTick, ref, useId, watch } from "vue";
|
|
204
198
|
import OrigamBtn from "../Btn/OrigamBtn.vue";
|
|
205
199
|
import OrigamTextField from "../TextField/OrigamTextField.vue";
|
|
206
200
|
import OrigamTextareaField from "../TextareaField/OrigamTextareaField.vue";
|
|
@@ -209,182 +203,524 @@ import { useLocale } from "../../composables/Commons/locale.composable";
|
|
|
209
203
|
import { useTypography } from "../../composables/Commons/typography.composable";
|
|
210
204
|
import { INLINE_EDIT_ACTION } from "../../enums/InlineEdit/inline-edit.enum";
|
|
211
205
|
import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
|
|
206
|
+
/*********************************************************
|
|
207
|
+
* Global
|
|
208
|
+
*
|
|
209
|
+
* @description
|
|
210
|
+
* Props + defaults for `<OrigamInlineEdit>`. Defaults are inlined
|
|
211
|
+
* here (not pulled from a const) because the Vue SFC compiler
|
|
212
|
+
* analyses `withDefaults` statically and only resolves literals —
|
|
213
|
+
* cf. CLAUDE.md "withDefaults — inline literals only" rule.
|
|
214
|
+
*
|
|
215
|
+
* @description
|
|
216
|
+
* `placeholder` therefore has NO literal default: it is localised,
|
|
217
|
+
* and a `t()` call is not a literal. `resolvedPlaceholder` falls back
|
|
218
|
+
* to `t('origam.inline_edit.placeholder')` instead.
|
|
219
|
+
********************************************************/
|
|
220
|
+
/*********************************************************
|
|
221
|
+
* `tag` default — 'div', not 'span' (arbitrage utilisateur, C6)
|
|
222
|
+
*
|
|
223
|
+
* @description
|
|
224
|
+
* The root used to default to `<span>` (phrasing content) while edit
|
|
225
|
+
* mode renders `<OrigamTextField>` / `<OrigamTextareaField>`, both of
|
|
226
|
+
* which render a `<div>` (`OrigamField`) — a `<div>` is flow content,
|
|
227
|
+
* not phrasing content, so a `<span>` could never legally contain it.
|
|
228
|
+
* `.origam-inline-edit { display: inline-flex }` already overrides
|
|
229
|
+
* the box type regardless of the underlying tag, so switching the
|
|
230
|
+
* default to `<div>` is visually neutral (measured in Chromium — see
|
|
231
|
+
* `packages/tests/e2e/inline-edit-tag.spec.ts`) while making the
|
|
232
|
+
* rendered HTML valid again.
|
|
233
|
+
* @description
|
|
234
|
+
* ⛔ Migration note: a consumer who placed `<origam-inline-edit>`
|
|
235
|
+
* inside a phrasing-only ancestor (`<p>`, `<label>`, …) relied on the
|
|
236
|
+
* OLD default. A `<div>` closes an open `<p>` implicitly when the
|
|
237
|
+
* browser's HTML parser is involved (raw HTML text / SSR markup being
|
|
238
|
+
* parsed on load) — pass `tag="span"` explicitly to keep the previous
|
|
239
|
+
* behaviour; the prop itself did not change, only its default.
|
|
240
|
+
********************************************************/
|
|
212
241
|
const props = defineProps({
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
242
|
+
modelValue: {
|
|
243
|
+
type: [String, Number],
|
|
244
|
+
required: true
|
|
245
|
+
},
|
|
246
|
+
placeholder: {
|
|
247
|
+
type: String,
|
|
248
|
+
required: false,
|
|
249
|
+
default: undefined
|
|
250
|
+
},
|
|
251
|
+
rules: {
|
|
252
|
+
type: Array,
|
|
253
|
+
required: false,
|
|
254
|
+
default: undefined
|
|
255
|
+
},
|
|
256
|
+
validate: {
|
|
257
|
+
type: Function,
|
|
258
|
+
required: false,
|
|
259
|
+
default: undefined
|
|
260
|
+
},
|
|
261
|
+
autoFocus: {
|
|
262
|
+
type: Boolean,
|
|
263
|
+
required: false,
|
|
264
|
+
default: true
|
|
265
|
+
},
|
|
266
|
+
selectOnFocus: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
required: false,
|
|
269
|
+
default: true
|
|
270
|
+
},
|
|
271
|
+
confirmOnBlur: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
required: false,
|
|
274
|
+
default: true
|
|
275
|
+
},
|
|
276
|
+
confirmOnEnter: {
|
|
277
|
+
type: Boolean,
|
|
278
|
+
required: false,
|
|
279
|
+
default: true
|
|
280
|
+
},
|
|
281
|
+
cancelOnEscape: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
required: false,
|
|
284
|
+
default: true
|
|
285
|
+
},
|
|
286
|
+
disabled: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
required: false,
|
|
289
|
+
default: false
|
|
290
|
+
},
|
|
291
|
+
multiline: {
|
|
292
|
+
type: Boolean,
|
|
293
|
+
required: false,
|
|
294
|
+
default: false
|
|
295
|
+
},
|
|
296
|
+
trim: {
|
|
297
|
+
type: Boolean,
|
|
298
|
+
required: false,
|
|
299
|
+
default: true
|
|
300
|
+
},
|
|
301
|
+
inputType: {
|
|
302
|
+
type: String,
|
|
303
|
+
required: false,
|
|
304
|
+
default: "text"
|
|
305
|
+
},
|
|
306
|
+
loadingOnConfirm: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
required: false,
|
|
309
|
+
default: false
|
|
310
|
+
},
|
|
311
|
+
showActions: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
required: false,
|
|
314
|
+
default: false
|
|
315
|
+
},
|
|
316
|
+
id: {
|
|
317
|
+
type: String,
|
|
318
|
+
required: false
|
|
319
|
+
},
|
|
320
|
+
class: {
|
|
321
|
+
type: [
|
|
322
|
+
String,
|
|
323
|
+
Array,
|
|
324
|
+
Object
|
|
325
|
+
],
|
|
326
|
+
required: false
|
|
327
|
+
},
|
|
328
|
+
style: {
|
|
329
|
+
type: [
|
|
330
|
+
String,
|
|
331
|
+
Array,
|
|
332
|
+
Object,
|
|
333
|
+
Boolean,
|
|
334
|
+
null
|
|
335
|
+
],
|
|
336
|
+
required: false,
|
|
337
|
+
skipCheck: true
|
|
338
|
+
},
|
|
339
|
+
tag: {
|
|
340
|
+
type: String,
|
|
341
|
+
required: false,
|
|
342
|
+
default: "div"
|
|
343
|
+
},
|
|
344
|
+
fontSize: {
|
|
345
|
+
type: null,
|
|
346
|
+
required: false
|
|
347
|
+
},
|
|
348
|
+
fontWeight: {
|
|
349
|
+
type: null,
|
|
350
|
+
required: false
|
|
351
|
+
}
|
|
234
352
|
});
|
|
235
|
-
const emit = defineEmits([
|
|
353
|
+
const emit = defineEmits([
|
|
354
|
+
"update:modelValue",
|
|
355
|
+
"edit",
|
|
356
|
+
"cancel",
|
|
357
|
+
"confirm",
|
|
358
|
+
"validate-error"
|
|
359
|
+
]);
|
|
236
360
|
defineSlots();
|
|
361
|
+
/*********************************************************
|
|
362
|
+
* Model — reactive accessor so the composable always reads the
|
|
363
|
+
* up-to-date value (props are not Refs themselves).
|
|
364
|
+
********************************************************/
|
|
237
365
|
const modelRef = computed(() => props.modelValue);
|
|
366
|
+
/*********************************************************
|
|
367
|
+
* i18n — every user-facing string of this component goes through the
|
|
368
|
+
* DS locale provider. Strict `useLocale()` matches the 74 other
|
|
369
|
+
* components; the plugin is already required here anyway, since edit
|
|
370
|
+
* mode renders `OrigamTextField` which calls it strictly too.
|
|
371
|
+
********************************************************/
|
|
238
372
|
const { t } = useLocale();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
onError: (message) => emit("validate-error", message),
|
|
260
|
-
invalidMessage: t("origam.inline_edit.invalid_value")
|
|
373
|
+
/*********************************************************
|
|
374
|
+
* Composable — owns the IDLE → EDITING → VALIDATING state machine.
|
|
375
|
+
* The SFC layer adds DOM glue: focus, keyboard, blur, ARIA wiring.
|
|
376
|
+
********************************************************/
|
|
377
|
+
const { isEditing, draft, error, isPending, edit, confirm, cancel, setValue } = useInlineEdit(modelRef, () => ({
|
|
378
|
+
rules: props.rules,
|
|
379
|
+
validate: props.validate,
|
|
380
|
+
trim: props.trim,
|
|
381
|
+
onConfirm: (value) => {
|
|
382
|
+
// Preserve the original v-model shape (string vs number)
|
|
383
|
+
// when round-tripping through the input. Failed coercion
|
|
384
|
+
// (NaN) falls back to the raw string.
|
|
385
|
+
const normalised = typeof props.modelValue === "number" ? Number(value) : value;
|
|
386
|
+
const out = typeof normalised === "number" && Number.isNaN(normalised) ? value : normalised;
|
|
387
|
+
emit("confirm", out);
|
|
388
|
+
emit("update:modelValue", out);
|
|
389
|
+
},
|
|
390
|
+
onCancel: () => emit("cancel"),
|
|
391
|
+
onError: (message) => emit("validate-error", message),
|
|
392
|
+
invalidMessage: t("origam.inline_edit.invalid_value")
|
|
261
393
|
}));
|
|
394
|
+
/*********************************************************
|
|
395
|
+
* Refs / IDs
|
|
396
|
+
* inputRef points to OrigamTextField or OrigamTextareaField.
|
|
397
|
+
* Both expose .focus() and .select() via forwardRefs() proxying
|
|
398
|
+
* through their internal HTMLInputElement / HTMLTextAreaElement.
|
|
399
|
+
********************************************************/
|
|
262
400
|
const inputRef = ref(null);
|
|
263
401
|
const errorId = `origam-inline-edit-error-${useId()}`;
|
|
402
|
+
/*********************************************************
|
|
403
|
+
* rootRef / rootEl — l'element racine, pas l'instance
|
|
404
|
+
*
|
|
405
|
+
* @description
|
|
406
|
+
* `tag` est une prop : la racine peut etre un element natif (`ref`
|
|
407
|
+
* rend alors l'`Element`) comme un composant (`ref` rend l'instance).
|
|
408
|
+
* `rootEl()` normalise les deux cas en un `HTMLElement | null`, seule
|
|
409
|
+
* forme sur laquelle `.contains()` a un sens. Sert au confinement du
|
|
410
|
+
* focus (#614, `handleFocusOut`) et au rapatriement du focus apres
|
|
411
|
+
* confirmation / annulation.
|
|
412
|
+
********************************************************/
|
|
264
413
|
const rootRef = ref(null);
|
|
265
414
|
const rootEl = () => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
415
|
+
const r = rootRef.value;
|
|
416
|
+
if (!r) return null;
|
|
417
|
+
const el = r instanceof Element ? r : r.$el;
|
|
418
|
+
return el instanceof HTMLElement ? el : null;
|
|
270
419
|
};
|
|
420
|
+
/*********************************************************
|
|
421
|
+
* Derived display state
|
|
422
|
+
********************************************************/
|
|
271
423
|
const displayValue = computed(() => {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
424
|
+
const v = props.modelValue;
|
|
425
|
+
if (v === null || v === undefined) return "";
|
|
426
|
+
return String(v);
|
|
275
427
|
});
|
|
276
428
|
const isEmpty = computed(() => displayValue.value.trim().length === 0);
|
|
277
429
|
const resolvedPlaceholder = computed(() => props.placeholder ?? t("origam.inline_edit.placeholder"));
|
|
278
430
|
const displayAriaLabel = computed(() => {
|
|
279
|
-
|
|
280
|
-
|
|
431
|
+
const label = isEmpty.value ? resolvedPlaceholder.value : displayValue.value;
|
|
432
|
+
return t("origam.inline_edit.edit_aria_label", label);
|
|
281
433
|
});
|
|
434
|
+
/*********************************************************
|
|
435
|
+
* Accessible names
|
|
436
|
+
*
|
|
437
|
+
* @description
|
|
438
|
+
* The pencil button gets the SHORT label, not the same
|
|
439
|
+
* `"Edit {value}"` string as the display affordance: with
|
|
440
|
+
* `showActions`, both are focusable at once and previously carried
|
|
441
|
+
* the IDENTICAL name, so a screen-reader user heard the same command
|
|
442
|
+
* announced twice with no way to tell them apart. The underlying
|
|
443
|
+
* redundancy — two tab stops for one action — is settled at the
|
|
444
|
+
* template level: the pencil carries `tabindex="-1"` + `aria-hidden`,
|
|
445
|
+
* so it stays visible and clickable for mouse users but leaves the
|
|
446
|
+
* keyboard path, where the display affordance already does the job.
|
|
447
|
+
* Nothing disappears on screen. Its `aria-label` is kept as a
|
|
448
|
+
* defensive net for a consumer who strips `aria-hidden`.
|
|
449
|
+
*
|
|
450
|
+
* @description
|
|
451
|
+
* `fieldAriaLabel` closes a harder gap: the edit field had NO
|
|
452
|
+
* accessible name at all. Neither `label` nor `aria-label` reached
|
|
453
|
+
* OrigamTextField / OrigamTextareaField, and `OrigamField` renders a
|
|
454
|
+
* `<label>` only when `props.label || slots.label` is set — so the
|
|
455
|
+
* one naming source left was `placeholder`, the last-resort branch of
|
|
456
|
+
* the accname algorithm, which yields NO name under `placeholder=""`.
|
|
457
|
+
* `aria-label` is neither an `on*` handler nor `class/style/id/data-*`,
|
|
458
|
+
* so `filterInputAttrs` routes it to `inputAttrs` and it lands on the
|
|
459
|
+
* native `<input>` / `<textarea>`, not on the wrapper.
|
|
460
|
+
********************************************************/
|
|
282
461
|
const editActionLabel = computed(() => t("origam.inline_edit.edit"));
|
|
283
462
|
const confirmActionLabel = computed(() => t("origam.inline_edit.confirm"));
|
|
284
463
|
const cancelActionLabel = computed(() => t("origam.inline_edit.cancel"));
|
|
285
464
|
const fieldAriaLabel = computed(() => t("origam.inline_edit.field_aria_label"));
|
|
465
|
+
/*********************************************************
|
|
466
|
+
* Edit / confirm / cancel handlers — own the SFC-level emits.
|
|
467
|
+
********************************************************/
|
|
286
468
|
const handleEnterEdit = () => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
469
|
+
if (props.disabled) return;
|
|
470
|
+
edit();
|
|
471
|
+
emit("edit");
|
|
290
472
|
};
|
|
473
|
+
/*********************************************************
|
|
474
|
+
* noteTransition — la RAISON de la sortie, decidee a l'instant ou
|
|
475
|
+
* elle est demandee
|
|
476
|
+
*
|
|
477
|
+
* @description
|
|
478
|
+
* ⛔ #614. Il faut distinguer deux sorties qui produisent le meme
|
|
479
|
+
* etat final mais appellent des gestes de focus opposes :
|
|
480
|
+
*
|
|
481
|
+
* - Confirmer / Annuler actionnes, ou `Entree` / `Echap` dans le
|
|
482
|
+
* champ : le focus est DANS le composant et l'element qui le
|
|
483
|
+
* porte va etre demonte. Il faut le rapatrier, sinon il retombe
|
|
484
|
+
* sur `<body>` (mesure) et le clavier est largue.
|
|
485
|
+
* - `focusout` sortant : l'utilisateur est parti de lui-meme. Lui
|
|
486
|
+
* reprendre le focus serait un defaut de plus.
|
|
487
|
+
*
|
|
488
|
+
* @description
|
|
489
|
+
* La question « le focus est-il encore chez moi ? » ne peut PAS etre
|
|
490
|
+
* posee plus tard : pendant la phase `focusout`, le navigateur a deja
|
|
491
|
+
* retire le focus a l'ancien element sans l'avoir donne au nouveau,
|
|
492
|
+
* et `activeElement` vaut transitoirement `<body>` — une tabulation
|
|
493
|
+
* sortante se lit alors exactement comme un focus perdu. Mesure a
|
|
494
|
+
* l'appui : le focus revenait sur l'affordance d'affichage au lieu de
|
|
495
|
+
* continuer vers le controle suivant. On tranche donc AU MOMENT de la
|
|
496
|
+
* demande, ou l'information est encore vraie, et on transporte la
|
|
497
|
+
* reponse jusqu'au watcher.
|
|
498
|
+
********************************************************/
|
|
291
499
|
let restoreFocusOnLeave = false;
|
|
292
500
|
const noteTransition = (fromFocusOut) => {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
501
|
+
if (fromFocusOut) {
|
|
502
|
+
restoreFocusOnLeave = false;
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (typeof document === "undefined") {
|
|
506
|
+
restoreFocusOnLeave = false;
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const root = rootEl();
|
|
510
|
+
const active = document.activeElement;
|
|
511
|
+
restoreFocusOnLeave = !!root && !!active && root.contains(active);
|
|
304
512
|
};
|
|
305
513
|
const handleConfirm = () => {
|
|
306
|
-
|
|
307
|
-
|
|
514
|
+
noteTransition(false);
|
|
515
|
+
void confirm();
|
|
308
516
|
};
|
|
309
517
|
const handleCancel = () => {
|
|
310
|
-
|
|
311
|
-
|
|
518
|
+
noteTransition(false);
|
|
519
|
+
cancel();
|
|
312
520
|
};
|
|
521
|
+
/*********************************************************
|
|
522
|
+
* Input / keyboard glue
|
|
523
|
+
* handleInput now receives the new string value directly from
|
|
524
|
+
* OrigamTextField / OrigamTextareaField's @update:model-value emit.
|
|
525
|
+
********************************************************/
|
|
313
526
|
const handleInput = (value) => {
|
|
314
|
-
|
|
527
|
+
setValue(value ?? "");
|
|
315
528
|
};
|
|
529
|
+
/*********************************************************
|
|
530
|
+
* handleKeyDown — les raccourcis appartiennent au CHAMP DE SAISIE
|
|
531
|
+
*
|
|
532
|
+
* @description
|
|
533
|
+
* ⛔ #614. L'ecouteur est pose sur `<origam-text-field>` ; `onKeydown`
|
|
534
|
+
* fait partie des evenements que `filterInputAttrs` route vers la
|
|
535
|
+
* RACINE du champ, pas vers le `<input>`. Un `keydown` emis par les
|
|
536
|
+
* boutons Confirmer / Annuler — rendus DANS le champ, slot
|
|
537
|
+
* `appendInner` — y remontait donc lui aussi, et `Entree` sur
|
|
538
|
+
* ANNULER partait dans la branche `confirmOnEnter`.
|
|
539
|
+
*
|
|
540
|
+
* @description
|
|
541
|
+
* Mesure Chromium d'avant correctif, brouillon « BROUILLON », focus
|
|
542
|
+
* sur le bouton Annuler, `Entree` :
|
|
543
|
+
*
|
|
544
|
+
* valeur committee "Editable value" -> "BROUILLON"
|
|
545
|
+
*
|
|
546
|
+
* Annuler CONFIRMAIT. Et le `preventDefault()` de cette branche tuait
|
|
547
|
+
* au passage l'activation native du bouton, donc son propre `click`
|
|
548
|
+
* n'arrivait jamais.
|
|
549
|
+
*
|
|
550
|
+
* @description
|
|
551
|
+
* `Entree` et `Echap` sont les raccourcis DU CHAMP. On ne les traite
|
|
552
|
+
* donc que lorsque la cible est le controle de saisie lui-meme — ce
|
|
553
|
+
* qui reste vrai pour un `#edit` personnalise, tant qu'il rend un
|
|
554
|
+
* `<input>` ou un `<textarea>`.
|
|
555
|
+
********************************************************/
|
|
316
556
|
const handleKeyDown = (event) => {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
557
|
+
const target = event.target;
|
|
558
|
+
if (!(target instanceof HTMLInputElement) && !(target instanceof HTMLTextAreaElement)) return;
|
|
559
|
+
if (event.key === "Enter" && props.confirmOnEnter && !props.multiline) {
|
|
560
|
+
event.preventDefault();
|
|
561
|
+
handleConfirm();
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (event.key === "Enter" && props.confirmOnEnter && props.multiline && (event.metaKey || event.ctrlKey)) {
|
|
565
|
+
event.preventDefault();
|
|
566
|
+
handleConfirm();
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
if (event.key === "Escape" && props.cancelOnEscape) {
|
|
570
|
+
event.preventDefault();
|
|
571
|
+
handleCancel();
|
|
572
|
+
}
|
|
333
573
|
};
|
|
574
|
+
/*********************************************************
|
|
575
|
+
* handleFocusOut — `confirmOnBlur`, mais au niveau du COMPOSANT
|
|
576
|
+
*
|
|
577
|
+
* @description
|
|
578
|
+
* ⛔ #614 — la version precedente ecoutait `@blur` sur le champ et
|
|
579
|
+
* appelait `handleConfirm()` sans regarder OU partait le focus. Un
|
|
580
|
+
* seul `Tab` depuis le champ suffisait donc a quitter le mode edition
|
|
581
|
+
* et a DEMONTER Confirmer / Annuler avant que le focus puisse les
|
|
582
|
+
* atteindre. Mesure Chromium d'avant correctif, story InlineEdit,
|
|
583
|
+
* `showActions` actif :
|
|
584
|
+
*
|
|
585
|
+
* entree en edition activeElement = input confirmBtn present
|
|
586
|
+
* Tab #1 activeElement = body confirmBtn ABSENT
|
|
587
|
+
* Tab #2 activeElement = button.origam-inline-edit__display
|
|
588
|
+
*
|
|
589
|
+
* Les deux boutons etaient donc inatteignables au clavier seul — la
|
|
590
|
+
* souris y arrivait uniquement grace au `@mousedown.prevent` pose sur
|
|
591
|
+
* chacun d'eux, qui empeche le blur avant le `click`. Il n'existait
|
|
592
|
+
* aucun equivalent clavier de ce garde-fou.
|
|
593
|
+
*
|
|
594
|
+
* @description
|
|
595
|
+
* Le correctif ne supprime PAS le comportement voulu : sortir du mode
|
|
596
|
+
* edition quand l'utilisateur s'en va reste exactement ce que promet
|
|
597
|
+
* `confirmOnBlur`. Il en corrige la portee — « le focus quitte le
|
|
598
|
+
* CHAMP » devient « le focus quitte le COMPOSANT ». C'est la
|
|
599
|
+
* transposition clavier du `@mousedown.prevent` : les deux disent que
|
|
600
|
+
* passer sur un bouton de la barre d'action n'est pas partir.
|
|
601
|
+
*
|
|
602
|
+
* @description
|
|
603
|
+
* Mecanisme de plate-forme, aucune minuterie : `focusout` REMONTE
|
|
604
|
+
* (contrairement a `blur`), et son `relatedTarget` porte deja
|
|
605
|
+
* l'element qui recoit le focus. `relatedTarget === null` (fenetre
|
|
606
|
+
* quittee, zone non focalisable) vaut « parti » — c'est le
|
|
607
|
+
* comportement qu'avait deja `@blur`.
|
|
608
|
+
*
|
|
609
|
+
* @description
|
|
610
|
+
* ⛔ L'ECOUTEUR EST SUR LE CHAMP, PAS SUR LA RACINE — et ce n'est pas
|
|
611
|
+
* un detail. Pose sur la racine il attrape aussi le focusout de
|
|
612
|
+
* l'affordance d'AFFICHAGE au moment ou elle cede la place au champ,
|
|
613
|
+
* et confirme aussitot : le composant rouvrait puis refermait le mode
|
|
614
|
+
* edition dans le meme clic. Mesure Chromium de ce focusout parasite :
|
|
615
|
+
*
|
|
616
|
+
* target = origam-inline-edit-display relatedTarget = null
|
|
617
|
+
* target.isConnected = true document.hasFocus() = true
|
|
618
|
+
*
|
|
619
|
+
* Aucun de ces trois signaux ne le distingue d'un vrai depart : ni
|
|
620
|
+
* `relatedTarget`, ni `isConnected`, ni `hasFocus`. Ce qui le
|
|
621
|
+
* distingue, c'est son ORIGINE — il ne vient pas du sous-arbre
|
|
622
|
+
* d'edition. Ecouter sur le champ le dit sans aucun test : les deux
|
|
623
|
+
* boutons sont rendus DANS le champ (slot `appendInner`), l'affordance
|
|
624
|
+
* d'affichage non. Un seul ecouteur, zero garde compensatoire.
|
|
625
|
+
*
|
|
626
|
+
* @description
|
|
627
|
+
* Reste asynchrone-conscient : tant qu'une promesse de validation est
|
|
628
|
+
* en vol on la laisse atterrir, sinon on double-commit.
|
|
629
|
+
********************************************************/
|
|
334
630
|
const handleFocusOut = (event) => {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
631
|
+
if (!props.confirmOnBlur) return;
|
|
632
|
+
if (!isEditing.value) return;
|
|
633
|
+
if (isPending.value) return;
|
|
634
|
+
const root = rootEl();
|
|
635
|
+
const next = event.relatedTarget;
|
|
636
|
+
if (root && next instanceof Node && root.contains(next)) return;
|
|
637
|
+
noteTransition(true);
|
|
638
|
+
confirm();
|
|
343
639
|
};
|
|
640
|
+
/*********************************************************
|
|
641
|
+
* restoreFocusAfterEdit — ne pas echouer le focus sur `<body>`
|
|
642
|
+
*
|
|
643
|
+
* @description
|
|
644
|
+
* ⛔ #614, seconde moitie. Quitter le mode edition DEMONTE le champ
|
|
645
|
+
* et les deux boutons. Si l'utilisateur venait d'actionner Confirmer
|
|
646
|
+
* ou Annuler au clavier, l'element qui portait le focus disparait
|
|
647
|
+
* sous lui : mesure Chromium, `document.activeElement` retombe sur
|
|
648
|
+
* `body`. Le point d'insertion du clavier est perdu et la tabulation
|
|
649
|
+
* repart du debut du document — atteindre les boutons ne suffit donc
|
|
650
|
+
* pas, encore faut-il ne pas etre largue apres les avoir actionnes.
|
|
651
|
+
*
|
|
652
|
+
* @description
|
|
653
|
+
* La decision — rapatrier ou pas — a ete prise par `noteTransition`
|
|
654
|
+
* AU MOMENT de la demande, pas ici : voir le bloc de ce nom pour la
|
|
655
|
+
* raison (pendant un `focusout`, `activeElement` vaut transitoirement
|
|
656
|
+
* `<body>` et une sortie volontaire se lit comme un focus perdu). Ici
|
|
657
|
+
* il ne reste qu'a attendre que l'affordance d'affichage soit remontee
|
|
658
|
+
* avant de la focaliser.
|
|
659
|
+
********************************************************/
|
|
344
660
|
const restoreFocusAfterEdit = async () => {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
661
|
+
if (!restoreFocusOnLeave) return;
|
|
662
|
+
restoreFocusOnLeave = false;
|
|
663
|
+
await nextTick();
|
|
664
|
+
const target = rootEl()?.querySelector("[data-cy=\"origam-inline-edit-display\"]");
|
|
665
|
+
if (target && typeof target.focus === "function") target.focus();
|
|
350
666
|
};
|
|
667
|
+
/*********************************************************
|
|
668
|
+
* Focus management — auto-focus on transition into edit mode and
|
|
669
|
+
* (optionally) select the text so the user can type a replacement
|
|
670
|
+
* immediately.
|
|
671
|
+
*
|
|
672
|
+
* inputRef now points to OrigamTextField / OrigamTextareaField.
|
|
673
|
+
* Both proxy .focus() and .select() via forwardRefs() through
|
|
674
|
+
* their internal HTMLInputElement / HTMLTextAreaElement.
|
|
675
|
+
********************************************************/
|
|
351
676
|
watch(isEditing, async (next) => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
677
|
+
if (!next) {
|
|
678
|
+
restoreFocusAfterEdit();
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (!props.autoFocus) return;
|
|
682
|
+
await nextTick();
|
|
683
|
+
const el = inputRef.value;
|
|
684
|
+
if (!el) return;
|
|
685
|
+
if (typeof el.focus === "function") el.focus();
|
|
686
|
+
if (props.selectOnFocus && typeof el.select === "function") {
|
|
687
|
+
el.select();
|
|
688
|
+
}
|
|
364
689
|
});
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]);
|
|
690
|
+
/*********************************************************
|
|
691
|
+
* Class & Style
|
|
692
|
+
********************************************************/
|
|
693
|
+
const rootClasses = computed(() => [{
|
|
694
|
+
"origam-inline-edit--editing": isEditing.value,
|
|
695
|
+
"origam-inline-edit--disabled": props.disabled,
|
|
696
|
+
"origam-inline-edit--pending": isPending.value,
|
|
697
|
+
"origam-inline-edit--loading-on-confirm": props.loadingOnConfirm && isPending.value,
|
|
698
|
+
"origam-inline-edit--multiline": props.multiline,
|
|
699
|
+
"origam-inline-edit--has-error": error.value !== null,
|
|
700
|
+
"origam-inline-edit--show-actions": props.showActions
|
|
701
|
+
}, props.class]);
|
|
702
|
+
// __error reads --origam-inline-edit__error---font-{size,weight}.
|
|
703
|
+
// __action-btn reads --origam-inline-edit__action-btn---font-size.
|
|
704
|
+
// Both var sets are declared on the root so they cascade to their
|
|
705
|
+
// respective descendants via normal CSS custom-property inheritance.
|
|
377
706
|
const { typographyStyles: errorTypoStyles } = useTypography(props, "inline-edit__error");
|
|
378
707
|
const { typographyStyles: actionBtnTypoStyles } = useTypography(props, "inline-edit__action-btn");
|
|
379
|
-
const rootStyles = computed(() => [
|
|
708
|
+
const rootStyles = computed(() => [
|
|
709
|
+
props.style,
|
|
710
|
+
errorTypoStyles.value,
|
|
711
|
+
actionBtnTypoStyles.value
|
|
712
|
+
]);
|
|
713
|
+
/*********************************************************
|
|
714
|
+
* Expose
|
|
715
|
+
********************************************************/
|
|
380
716
|
defineExpose({
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
717
|
+
edit: handleEnterEdit,
|
|
718
|
+
confirm: handleConfirm,
|
|
719
|
+
cancel: handleCancel,
|
|
720
|
+
isEditing,
|
|
721
|
+
draft,
|
|
722
|
+
error,
|
|
723
|
+
isPending
|
|
388
724
|
});
|
|
389
725
|
</script>
|
|
390
726
|
|