origam 2.41.0 → 2.41.1
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 +49 -0
- package/dist/src/components/Alert/OrigamAlert.vue +1 -2
- package/dist/src/components/Audio/OrigamAudio.vue +15 -14
- package/dist/src/components/Badge/OrigamBadge.vue +6 -1
- package/dist/src/components/Bracket/OrigamBracket.vue +5 -5
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +1 -2
- package/dist/src/components/Btn/OrigamBtn.vue +14 -15
- package/dist/src/components/Card/OrigamCard.vue +2 -1
- package/dist/src/components/Carousel/OrigamCarousel.vue +14 -13
- package/dist/src/components/Chart/OrigamChartBullet.vue +4 -1
- package/dist/src/components/Chart/OrigamChartPictorial.vue +3 -6
- package/dist/src/components/Chart/OrigamChartPolar.vue +2 -1
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +3 -1
- package/dist/src/components/Chart/OrigamChartSankey.vue +9 -167
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +14 -12
- package/dist/src/components/Chart/OrigamChartSunburst.vue +10 -2
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +39 -36
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +3 -4
- package/dist/src/components/Chip/OrigamChip.vue +2 -3
- package/dist/src/components/Chip/OrigamChipGroup.vue +2 -3
- package/dist/src/components/Clipboard/OrigamClipboard.vue +1 -1
- package/dist/src/components/Code/OrigamCode.vue +4 -2
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +5 -1
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +1 -2
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +1 -2
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +6 -2
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +2 -4
- package/dist/src/components/Counter/OrigamCounter.vue +1 -0
- package/dist/src/components/DataTable/OrigamDataTable.vue +2 -3
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +1 -2
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +3 -2
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +2 -3
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +43 -39
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +3 -4
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +1 -1
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1 -2
- package/dist/src/components/Dialog/OrigamDialog.vue +1 -2
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +2 -3
- package/dist/src/components/Field/OrigamField.vue +2 -6
- package/dist/src/components/FileField/OrigamFileField.vue +23 -6
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +3 -4
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +3 -4
- package/dist/src/components/Form/OrigamForm.vue +0 -2
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +7 -7
- package/dist/src/components/Input/OrigamInput.vue +3 -11
- package/dist/src/components/List/OrigamListGroup.vue +2 -3
- package/dist/src/components/List/OrigamListItem.vue +4 -5
- package/dist/src/components/Media/OrigamMediaController.vue +12 -13
- package/dist/src/components/Media/OrigamMediaScrubber.vue +15 -12
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +4 -5
- package/dist/src/components/Menu/OrigamMenu.vue +1 -2
- package/dist/src/components/NumberField/OrigamNumberField.vue +7 -10
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +7 -1
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1 -1
- package/dist/src/components/Pagination/OrigamPagination.vue +4 -5
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +1 -4
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +9 -7
- package/dist/src/components/Radio/OrigamRadioBtn.vue +2 -3
- package/dist/src/components/RatingField/OrigamRatingField.vue +1 -2
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +2 -3
- package/dist/src/components/Select/OrigamSelect.vue +135 -105
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +7 -2
- package/dist/src/components/Slide/OrigamSlideGroup.vue +7 -10
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +9 -10
- package/dist/src/components/Stepper/OrigamStepper.vue +7 -11
- package/dist/src/components/Stepper/OrigamStepperItem.vue +2 -3
- package/dist/src/components/Switch/OrigamSwitch.vue +0 -9
- package/dist/src/components/Tabs/OrigamTabs.vue +1 -1
- package/dist/src/components/TextField/OrigamTextField.vue +2 -5
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +3 -2
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +13 -14
- package/dist/src/components/Transition/OrigamExpandX.vue +4 -10
- package/dist/src/components/Transition/OrigamExpandY.vue +4 -10
- package/dist/src/components/Transition/OrigamSnack.vue +2 -8
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +24 -18
- package/dist/src/components/Video/OrigamVideo.vue +14 -19
- package/dist/src/components/Window/OrigamWindow.vue +2 -3
- package/dist/src/composables/Audio/use-waveform.composable.cjs +24 -19
- package/dist/src/composables/Audio/use-waveform.composable.js +24 -19
- package/dist/src/composables/Calendar/calendar.composable.cjs +11 -11
- package/dist/src/composables/Calendar/calendar.composable.js +1 -1
- package/dist/src/composables/Chart/chart.composable.cjs +541 -415
- package/dist/src/composables/Chart/chart.composable.d.ts +2 -5
- package/dist/src/composables/Chart/chart.composable.js +392 -338
- package/dist/src/composables/Code/code.composable.cjs +4 -4
- package/dist/src/composables/Code/code.composable.js +1 -1
- package/dist/src/composables/Commons/color.composable.cjs +106 -48
- package/dist/src/composables/Commons/color.composable.js +55 -48
- package/dist/src/composables/Commons/display.composable.cjs +7 -1
- package/dist/src/composables/Commons/display.composable.js +2 -2
- package/dist/src/composables/Commons/dragResizer.composable.cjs +11 -10
- package/dist/src/composables/Commons/dragResizer.composable.js +2 -1
- package/dist/src/composables/Commons/group.composable.cjs +17 -14
- package/dist/src/composables/Commons/group.composable.js +19 -15
- package/dist/src/composables/Commons/nested.composable.cjs +16 -16
- package/dist/src/composables/Commons/nested.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nested.composable.js +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.cjs +3 -3
- package/dist/src/composables/Commons/nestedItem.composable.d.ts +1 -1
- package/dist/src/composables/Commons/nestedItem.composable.js +1 -1
- package/dist/src/composables/Commons/size.composable.cjs +1 -1
- package/dist/src/composables/Commons/size.composable.js +1 -1
- package/dist/src/composables/Commons/stateEffect.composable.cjs +54 -32
- package/dist/src/composables/Commons/stateEffect.composable.js +43 -33
- package/dist/src/composables/Commons/teleport.composable.cjs +2 -1
- package/dist/src/composables/Commons/teleport.composable.js +4 -1
- package/dist/src/composables/Commons/touch.composable.cjs +77 -33
- package/dist/src/composables/Commons/touch.composable.js +77 -33
- package/dist/src/composables/Commons/vModel.composable.cjs +1 -1
- package/dist/src/composables/Commons/vModel.composable.js +1 -1
- package/dist/src/composables/Commons/validation.composable.cjs +1 -1
- package/dist/src/composables/Commons/validation.composable.js +1 -1
- package/dist/src/composables/Commons/velocity.composable.cjs +5 -1
- package/dist/src/composables/Commons/velocity.composable.js +5 -1
- package/dist/src/composables/DataTable/headers.composable.cjs +36 -30
- package/dist/src/composables/DataTable/headers.composable.d.ts +1 -1
- package/dist/src/composables/DataTable/headers.composable.js +29 -23
- package/dist/src/composables/DataTable/headersCell.composable.cjs +2 -2
- package/dist/src/composables/DataTable/headersCell.composable.js +1 -1
- package/dist/src/composables/DataTable/select.composable.cjs +4 -4
- package/dist/src/composables/DataTable/select.composable.js +1 -1
- package/dist/src/composables/DataTable/sort.composable.cjs +6 -6
- package/dist/src/composables/DataTable/sort.composable.js +1 -1
- package/dist/src/composables/Form/form.composable.cjs +1 -1
- package/dist/src/composables/Form/form.composable.js +3 -1
- package/dist/src/composables/Masonry/masonry.composable.cjs +29 -20
- package/dist/src/composables/Masonry/masonry.composable.d.ts +0 -14
- package/dist/src/composables/Masonry/masonry.composable.js +29 -20
- package/dist/src/composables/NumberFormat/number-format.composable.cjs +28 -23
- package/dist/src/composables/NumberFormat/number-format.composable.js +28 -23
- package/dist/src/composables/Parallax/parallax.composable.cjs +9 -9
- package/dist/src/composables/Parallax/parallax.composable.js +3 -3
- package/dist/src/composables/Parallax/transform.composable.cjs +14 -13
- package/dist/src/composables/Parallax/transform.composable.js +2 -1
- package/dist/src/composables/PasswordField/passwordStrength.composable.cjs +2 -2
- package/dist/src/composables/PasswordField/passwordStrength.composable.js +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.cjs +1 -1
- package/dist/src/composables/QrCode/qr-code.composable.js +1 -1
- package/dist/src/composables/Sheet/sheetSwipe.composable.cjs +3 -4
- package/dist/src/composables/Sheet/sheetSwipe.composable.js +4 -4
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.cjs +31 -31
- package/dist/src/composables/TextareaField/textarea-field-rich.composable.js +1 -1
- package/dist/src/composables/Watermark/watermark.composable.cjs +1 -1
- package/dist/src/composables/Watermark/watermark.composable.js +1 -1
- package/dist/src/consts/Audio/audio.const.cjs +5 -4
- package/dist/src/consts/Audio/audio.const.d.ts +2 -1
- package/dist/src/consts/Audio/audio.const.js +2 -1
- package/dist/src/consts/Blockquote/blockquote.const.cjs +3 -3
- package/dist/src/consts/Blockquote/blockquote.const.js +1 -1
- package/dist/src/consts/Bracket/bracket.const.cjs +4 -3
- package/dist/src/consts/Bracket/bracket.const.js +2 -1
- package/dist/src/consts/Code/code.const.cjs +3 -3
- package/dist/src/consts/Code/code.const.d.ts +1 -1
- package/dist/src/consts/Code/code.const.js +1 -1
- package/dist/src/consts/Commons/autocomplete.const.cjs +2 -2
- package/dist/src/consts/Commons/autocomplete.const.d.ts +1 -1
- package/dist/src/consts/Commons/autocomplete.const.js +1 -1
- package/dist/src/consts/Commons/display.const.cjs +2 -2
- package/dist/src/consts/Commons/display.const.js +1 -1
- package/dist/src/consts/Commons/hotkey.const.cjs +2 -2
- package/dist/src/consts/Commons/hotkey.const.js +1 -1
- package/dist/src/consts/Commons/margin.const.cjs +1 -1
- package/dist/src/consts/Commons/margin.const.js +1 -1
- package/dist/src/consts/Commons/padding.const.cjs +1 -1
- package/dist/src/consts/Commons/padding.const.js +1 -1
- package/dist/src/consts/Commons/rounded.const.cjs +6 -2
- package/dist/src/consts/Commons/rounded.const.js +6 -2
- package/dist/src/consts/EmptyState/empty-state.const.cjs +12 -12
- package/dist/src/consts/EmptyState/empty-state.const.js +6 -6
- package/dist/src/consts/PasswordField/password-field.const.cjs +1 -1
- package/dist/src/consts/PasswordField/password-field.const.js +1 -1
- package/dist/src/consts/QrCode/qr-code.const.cjs +2 -2
- package/dist/src/consts/QrCode/qr-code.const.js +1 -1
- package/dist/src/consts/TextField/text-field.const.cjs +21 -21
- package/dist/src/consts/TextField/text-field.const.js +1 -1
- package/dist/src/consts/TextareaField/textarea-field.const.cjs +32 -4
- package/dist/src/consts/TextareaField/textarea-field.const.d.ts +1 -0
- package/dist/src/consts/TextareaField/textarea-field.const.js +29 -1
- package/dist/src/directives/Contrast/contrast.directive.cjs +5 -3
- package/dist/src/directives/Contrast/contrast.directive.js +5 -3
- package/dist/src/directives/Intersect/intersect.directive.cjs +2 -1
- package/dist/src/directives/Intersect/intersect.directive.js +2 -1
- package/dist/src/interfaces/Chart/chart.interface.d.ts +70 -1
- package/dist/src/interfaces/ColorPicker/color-picker.interface.d.ts +1 -1
- package/dist/src/interfaces/Commons/border.interface.d.ts +11 -10
- package/dist/src/interfaces/Commons/filters.interface.d.ts +7 -0
- package/dist/src/interfaces/Commons/margin.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/padding.interface.d.ts +12 -11
- package/dist/src/interfaces/Commons/ripple.interface.d.ts +1 -3
- package/dist/src/interfaces/Commons/rounded.interface.d.ts +10 -9
- package/dist/src/interfaces/DataTable/sort.interface.d.ts +6 -0
- package/dist/src/interfaces/Grid/grid.interface.d.ts +4 -4
- package/dist/src/interfaces/SliderField/slider-field.interface.d.ts +4 -4
- package/dist/src/origam-core.cjs +51 -33
- package/dist/src/origam-core.js +21 -27
- package/dist/src/types/Commons/box-value.type.cjs +1 -0
- package/dist/src/types/Commons/box-value.type.d.ts +1 -0
- package/dist/src/types/Commons/box-value.type.js +0 -0
- package/dist/src/types/Commons/location.type.d.ts +13 -0
- package/dist/src/types/Commons/point.type.d.ts +1 -1
- package/dist/src/types/DataTable/data-table.type.d.ts +1 -0
- package/dist/src/types/Grid/grid.type.d.ts +7 -0
- package/dist/src/types/SliderField/slider-field.type.d.ts +8 -0
- package/dist/src/utils/Bracket/bracket-surface.util.cjs +9 -2
- package/dist/src/utils/Bracket/bracket-surface.util.js +9 -2
- package/dist/src/utils/Calendar/rrule.util.cjs +12 -7
- package/dist/src/utils/Calendar/rrule.util.js +12 -7
- package/dist/src/utils/Chart/chart-point.util.cjs +15 -0
- package/dist/src/utils/Chart/chart-point.util.d.ts +11 -0
- package/dist/src/utils/Chart/chart-point.util.js +8 -0
- package/dist/src/utils/Chart/sankey-layout.util.cjs +144 -0
- package/dist/src/utils/Chart/sankey-layout.util.d.ts +27 -0
- package/dist/src/utils/Chart/sankey-layout.util.js +130 -0
- package/dist/src/utils/Code/parse-highlight-lines.util.cjs +17 -14
- package/dist/src/utils/Code/parse-highlight-lines.util.js +17 -14
- package/dist/src/utils/CommandPalette/fuzzy-match.util.cjs +13 -9
- package/dist/src/utils/CommandPalette/fuzzy-match.util.js +13 -9
- package/dist/src/utils/Commons/anchor.util.cjs +6 -1
- package/dist/src/utils/Commons/anchor.util.js +6 -1
- package/dist/src/utils/Commons/apply-mask.util.cjs +11 -14
- package/dist/src/utils/Commons/apply-mask.util.js +7 -10
- package/dist/src/utils/Commons/apply-theme.util.cjs +6 -4
- package/dist/src/utils/Commons/apply-theme.util.js +6 -4
- package/dist/src/utils/Commons/bindProps.util.cjs +3 -5
- package/dist/src/utils/Commons/bindProps.util.js +3 -5
- package/dist/src/utils/Commons/color.util.cjs +43 -36
- package/dist/src/utils/Commons/color.util.js +44 -31
- package/dist/src/utils/Commons/commons.util.cjs +3 -3
- package/dist/src/utils/Commons/commons.util.js +3 -3
- package/dist/src/utils/Commons/console.util.cjs +6 -0
- package/dist/src/utils/Commons/console.util.d.ts +11 -0
- package/dist/src/utils/Commons/console.util.js +5 -0
- package/dist/src/utils/Commons/date.util.cjs +2 -27
- package/dist/src/utils/Commons/date.util.js +2 -27
- package/dist/src/utils/Commons/display.util.cjs +10 -1
- package/dist/src/utils/Commons/display.util.d.ts +8 -1
- package/dist/src/utils/Commons/display.util.js +9 -1
- package/dist/src/utils/Commons/eventListener.util.cjs +1 -2
- package/dist/src/utils/Commons/eventListener.util.js +1 -2
- package/dist/src/utils/Commons/filters.util.cjs +48 -34
- package/dist/src/utils/Commons/filters.util.d.ts +3 -8
- package/dist/src/utils/Commons/filters.util.js +47 -34
- package/dist/src/utils/Commons/forwardRefs.util.cjs +44 -40
- package/dist/src/utils/Commons/forwardRefs.util.js +44 -40
- package/dist/src/utils/Commons/group.util.cjs +1 -1
- package/dist/src/utils/Commons/group.util.js +1 -1
- package/dist/src/utils/Commons/hotkey.util.cjs +65 -61
- package/dist/src/utils/Commons/hotkey.util.js +56 -53
- package/dist/src/utils/Commons/hover.util.cjs +2 -2
- package/dist/src/utils/Commons/hover.util.js +2 -2
- package/dist/src/utils/Commons/locale.util.cjs +1 -1
- package/dist/src/utils/Commons/locale.util.js +1 -1
- package/dist/src/utils/Commons/location.util.cjs +87 -92
- package/dist/src/utils/Commons/location.util.js +75 -83
- package/dist/src/utils/Commons/nested.util.cjs +11 -11
- package/dist/src/utils/Commons/nested.util.js +1 -1
- package/dist/src/utils/Commons/point.util.cjs +16 -14
- package/dist/src/utils/Commons/point.util.js +13 -8
- package/dist/src/utils/Commons/ripple.util.cjs +4 -4
- package/dist/src/utils/Commons/ripple.util.js +4 -4
- package/dist/src/utils/Commons/scroll.util.cjs +9 -6
- package/dist/src/utils/Commons/scroll.util.js +9 -6
- package/dist/src/utils/Commons/token-name.util.cjs +22 -21
- package/dist/src/utils/Commons/token-name.util.js +22 -21
- package/dist/src/utils/Commons/validate-pattern.util.cjs +6 -6
- package/dist/src/utils/Commons/validate-pattern.util.js +1 -1
- package/dist/src/utils/DataTable/headers.util.cjs +20 -26
- package/dist/src/utils/DataTable/headers.util.js +18 -26
- package/dist/src/utils/DataTable/sort.util.cjs +41 -47
- package/dist/src/utils/DataTable/sort.util.d.ts +2 -7
- package/dist/src/utils/DataTable/sort.util.js +49 -47
- package/dist/src/utils/List/list-item.util.cjs +6 -1
- package/dist/src/utils/List/list-item.util.js +6 -1
- package/dist/src/utils/Parallax/parallax-element.util.cjs +13 -14
- package/dist/src/utils/Parallax/parallax-element.util.js +10 -11
- package/dist/src/utils/Slide/slide-group.util.cjs +4 -4
- package/dist/src/utils/Slide/slide-group.util.js +4 -4
- package/dist/src/utils/TextareaField/html-to-markdown.util.cjs +5 -36
- package/dist/src/utils/TextareaField/html-to-markdown.util.js +5 -36
- package/dist/src/utils/TextareaField/sanitize-html.util.cjs +18 -22
- package/dist/src/utils/TextareaField/sanitize-html.util.js +19 -23
- package/dist/src/utils/index.cjs +11 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ exports.resetCodeHighlighterForTesting = resetCodeHighlighterForTesting;
|
|
|
7
7
|
exports.useCode = useCode;
|
|
8
8
|
var _vue = require("vue");
|
|
9
9
|
var _code = require("../../consts/Code/code.const.cjs");
|
|
10
|
-
var
|
|
10
|
+
var _code2 = require("../../enums/Code/code.enum.cjs");
|
|
11
11
|
let _highlighterPromise = null;
|
|
12
12
|
let _highlighterReady = false;
|
|
13
13
|
let _highlighterUnavailable = false;
|
|
@@ -63,9 +63,9 @@ function resolveLang(lang, hasCustomHighlighter, extraLangs) {
|
|
|
63
63
|
if (extraLangs?.includes(lang)) return lang;
|
|
64
64
|
if (!_unsupportedLangWarned.has(lang)) {
|
|
65
65
|
_unsupportedLangWarned.add(lang);
|
|
66
|
-
console.warn(`[origam] OrigamCode: lang="${lang}" is not in the bundled grammar set. Falling back to "${
|
|
66
|
+
console.warn(`[origam] OrigamCode: lang="${lang}" is not in the bundled grammar set. Falling back to "${_code2.CODE_LANG.PLAINTEXT}". Supported: ${[..._code.SUPPORTED_LANGS, ...(extraLangs ?? [])].join(", ")}. Add it with createOrigam({ code: { langs } }) or supply a code.highlighter.`);
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return _code2.CODE_LANG.PLAINTEXT;
|
|
69
69
|
}
|
|
70
70
|
function useCode() {
|
|
71
71
|
const codeOptions = (0, _vue.inject)(_code.ORIGAM_CODE_KEY);
|
|
@@ -100,7 +100,7 @@ function useCode() {
|
|
|
100
100
|
}
|
|
101
101
|
html = highlighter.codeToHtml(code, {
|
|
102
102
|
...opts,
|
|
103
|
-
lang:
|
|
103
|
+
lang: _code2.CODE_LANG.PLAINTEXT
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
lruSet(key, html);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
2
|
import { CODE_CACHE_MAX_ENTRIES, CODE_DARK_THEME as DARK_THEME, CODE_LIGHT_THEME as LIGHT_THEME, ORIGAM_CODE_KEY, SUPPORTED_LANGS } from "../../consts/Code/code.const.js";
|
|
3
|
-
import { CODE_LANG } from "../../enums/
|
|
3
|
+
import { CODE_LANG } from "../../enums/Code/code.enum.js";
|
|
4
4
|
let _highlighterPromise = null;
|
|
5
5
|
let _highlighterReady = false;
|
|
6
6
|
let _highlighterUnavailable = false;
|
|
@@ -7,6 +7,102 @@ exports.useColor = useColor;
|
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _color = require("../../utils/Commons/color.util.cjs");
|
|
9
9
|
var _gradient = require("../../utils/Commons/gradient.util.cjs");
|
|
10
|
+
function resolveBackground(background) {
|
|
11
|
+
const none = {
|
|
12
|
+
bgDecl: null,
|
|
13
|
+
bgIntentFg: null,
|
|
14
|
+
bgIsGradient: false
|
|
15
|
+
};
|
|
16
|
+
if (!background) return none;
|
|
17
|
+
if ((0, _gradient.isGradient)(background)) {
|
|
18
|
+
const grad = (0, _gradient.resolveGradient)(background);
|
|
19
|
+
return grad ? {
|
|
20
|
+
bgDecl: `background-image: ${grad}`,
|
|
21
|
+
bgIntentFg: null,
|
|
22
|
+
bgIsGradient: true
|
|
23
|
+
} : none;
|
|
24
|
+
}
|
|
25
|
+
if ((0, _color.isIntent)(background)) {
|
|
26
|
+
const m = (0, _color.tokenStylesForIntent)(background, "default");
|
|
27
|
+
return {
|
|
28
|
+
bgDecl: `background-color: ${m["background-color"]}`,
|
|
29
|
+
bgIntentFg: m.color,
|
|
30
|
+
bgIsGradient: false
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (background === "transparent") {
|
|
34
|
+
return {
|
|
35
|
+
bgDecl: `background-color: ${background}`,
|
|
36
|
+
bgIntentFg: null,
|
|
37
|
+
bgIsGradient: false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (typeof background === "string" && (0, _color.isCssColor)(background)) {
|
|
41
|
+
return {
|
|
42
|
+
bgDecl: `background-color: ${background}`,
|
|
43
|
+
bgIntentFg: null,
|
|
44
|
+
bgIsGradient: false
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return none;
|
|
48
|
+
}
|
|
49
|
+
function resolveTextGradient(text) {
|
|
50
|
+
const grad = (0, _gradient.resolveGradient)(text);
|
|
51
|
+
if (!grad) return {
|
|
52
|
+
fgDecl: null,
|
|
53
|
+
gradientStyles: []
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
fgDecl: "color: transparent",
|
|
57
|
+
gradientStyles: [`background-image: ${grad}`, "background-clip: text", "-webkit-background-clip: text"]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function resolveIntentText(colors, bgIntentFg) {
|
|
61
|
+
if (bgIntentFg && (0, _color.isIntent)(colors.background) && colors.text === colors.background) {
|
|
62
|
+
return `color: ${bgIntentFg}`;
|
|
63
|
+
}
|
|
64
|
+
return `color: ${(0, _color.tokenForegroundForIntent)(colors.text)}`;
|
|
65
|
+
}
|
|
66
|
+
function resolveAutoContrast(background) {
|
|
67
|
+
if (typeof background === "string" && background !== "transparent" && (0, _color.isParsableColor)(background)) {
|
|
68
|
+
const parsed = (0, _color.parseColor)(background);
|
|
69
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${(0, _color.getForeground)(parsed)}`;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function resolveForeground(colors, bgDecl, bgIntentFg, bgIsGradient) {
|
|
74
|
+
const {
|
|
75
|
+
background,
|
|
76
|
+
text
|
|
77
|
+
} = colors;
|
|
78
|
+
if (text) {
|
|
79
|
+
if ((0, _gradient.isGradient)(text)) return resolveTextGradient(text);
|
|
80
|
+
if ((0, _color.isIntent)(text)) return {
|
|
81
|
+
fgDecl: resolveIntentText(colors, bgIntentFg),
|
|
82
|
+
gradientStyles: []
|
|
83
|
+
};
|
|
84
|
+
if (typeof text === "string" && (0, _color.isCssColor)(text)) return {
|
|
85
|
+
fgDecl: `color: ${text}`,
|
|
86
|
+
gradientStyles: []
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
fgDecl: null,
|
|
90
|
+
gradientStyles: []
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (bgIntentFg && !bgIsGradient) return {
|
|
94
|
+
fgDecl: `color: ${bgIntentFg}`,
|
|
95
|
+
gradientStyles: []
|
|
96
|
+
};
|
|
97
|
+
if (bgDecl && !bgIsGradient) return {
|
|
98
|
+
fgDecl: resolveAutoContrast(background),
|
|
99
|
+
gradientStyles: []
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
fgDecl: null,
|
|
103
|
+
gradientStyles: []
|
|
104
|
+
};
|
|
105
|
+
}
|
|
10
106
|
function useColor(colors) {
|
|
11
107
|
const colorClasses = (0, _vue.computed)(() => {
|
|
12
108
|
const classes = [];
|
|
@@ -19,54 +115,16 @@ function useColor(colors) {
|
|
|
19
115
|
return classes;
|
|
20
116
|
});
|
|
21
117
|
const colorStyles = (0, _vue.computed)(() => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
} else if ((0, _color.isIntent)(colors.value.background)) {
|
|
34
|
-
const m = (0, _color.tokenStylesForIntent)(colors.value.background, "default");
|
|
35
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
36
|
-
bgIntentFg = m.color;
|
|
37
|
-
} else if (colors.value.background === "transparent") {
|
|
38
|
-
bgDecl = `background-color: ${colors.value.background}`;
|
|
39
|
-
} else if (typeof colors.value.background === "string" && (0, _color.isCssColor)(colors.value.background)) {
|
|
40
|
-
bgDecl = `background-color: ${colors.value.background}`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
let fgDecl = null;
|
|
44
|
-
if (colors.value.text) {
|
|
45
|
-
if ((0, _gradient.isGradient)(colors.value.text)) {
|
|
46
|
-
const grad = (0, _gradient.resolveGradient)(colors.value.text);
|
|
47
|
-
if (grad) {
|
|
48
|
-
fgDecl = "color: transparent";
|
|
49
|
-
styles.push(`background-image: ${grad}`);
|
|
50
|
-
styles.push("background-clip: text");
|
|
51
|
-
styles.push("-webkit-background-clip: text");
|
|
52
|
-
}
|
|
53
|
-
} else if ((0, _color.isIntent)(colors.value.text)) {
|
|
54
|
-
if (bgIntentFg && (0, _color.isIntent)(colors.value.background) && colors.value.text === colors.value.background) {
|
|
55
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
56
|
-
} else {
|
|
57
|
-
fgDecl = `color: ${(0, _color.tokenForegroundForIntent)(colors.value.text)}`;
|
|
58
|
-
}
|
|
59
|
-
} else if (typeof colors.value.text === "string" && (0, _color.isCssColor)(colors.value.text)) {
|
|
60
|
-
fgDecl = `color: ${colors.value.text}`;
|
|
61
|
-
}
|
|
62
|
-
} else if (bgIntentFg && !bgIsGradient) {
|
|
63
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
64
|
-
} else if (bgDecl && !bgIsGradient && colors.value.background && typeof colors.value.background === "string" && colors.value.background !== "transparent" && (0, _color.isParsableColor)(colors.value.background)) {
|
|
65
|
-
const parsed = (0, _color.parseColor)(colors.value.background);
|
|
66
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
67
|
-
fgDecl = `color: ${(0, _color.getForeground)(parsed)}`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
118
|
+
const {
|
|
119
|
+
bgDecl,
|
|
120
|
+
bgIntentFg,
|
|
121
|
+
bgIsGradient
|
|
122
|
+
} = resolveBackground(colors.value.background);
|
|
123
|
+
const {
|
|
124
|
+
fgDecl,
|
|
125
|
+
gradientStyles
|
|
126
|
+
} = resolveForeground(colors.value, bgDecl, bgIntentFg, bgIsGradient);
|
|
127
|
+
const styles = [...gradientStyles];
|
|
70
128
|
if (bgDecl) styles.push(bgDecl);
|
|
71
129
|
if (fgDecl) styles.push(fgDecl);
|
|
72
130
|
return styles;
|
|
@@ -10,6 +10,58 @@ import {
|
|
|
10
10
|
tokenStylesForIntent
|
|
11
11
|
} from "../../utils/Commons/color.util.js";
|
|
12
12
|
import { isGradient, resolveGradient } from "../../utils/Commons/gradient.util.js";
|
|
13
|
+
function resolveBackground(background) {
|
|
14
|
+
const none = { bgDecl: null, bgIntentFg: null, bgIsGradient: false };
|
|
15
|
+
if (!background) return none;
|
|
16
|
+
if (isGradient(background)) {
|
|
17
|
+
const grad = resolveGradient(background);
|
|
18
|
+
return grad ? { bgDecl: `background-image: ${grad}`, bgIntentFg: null, bgIsGradient: true } : none;
|
|
19
|
+
}
|
|
20
|
+
if (isIntent(background)) {
|
|
21
|
+
const m = tokenStylesForIntent(background, "default");
|
|
22
|
+
return { bgDecl: `background-color: ${m["background-color"]}`, bgIntentFg: m.color, bgIsGradient: false };
|
|
23
|
+
}
|
|
24
|
+
if (background === "transparent") {
|
|
25
|
+
return { bgDecl: `background-color: ${background}`, bgIntentFg: null, bgIsGradient: false };
|
|
26
|
+
}
|
|
27
|
+
if (typeof background === "string" && isCssColor(background)) {
|
|
28
|
+
return { bgDecl: `background-color: ${background}`, bgIntentFg: null, bgIsGradient: false };
|
|
29
|
+
}
|
|
30
|
+
return none;
|
|
31
|
+
}
|
|
32
|
+
function resolveTextGradient(text) {
|
|
33
|
+
const grad = resolveGradient(text);
|
|
34
|
+
if (!grad) return { fgDecl: null, gradientStyles: [] };
|
|
35
|
+
return {
|
|
36
|
+
fgDecl: "color: transparent",
|
|
37
|
+
gradientStyles: [`background-image: ${grad}`, "background-clip: text", "-webkit-background-clip: text"]
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function resolveIntentText(colors, bgIntentFg) {
|
|
41
|
+
if (bgIntentFg && isIntent(colors.background) && colors.text === colors.background) {
|
|
42
|
+
return `color: ${bgIntentFg}`;
|
|
43
|
+
}
|
|
44
|
+
return `color: ${tokenForegroundForIntent(colors.text)}`;
|
|
45
|
+
}
|
|
46
|
+
function resolveAutoContrast(background) {
|
|
47
|
+
if (typeof background === "string" && background !== "transparent" && isParsableColor(background)) {
|
|
48
|
+
const parsed = parseColor(background);
|
|
49
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${getForeground(parsed)}`;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function resolveForeground(colors, bgDecl, bgIntentFg, bgIsGradient) {
|
|
54
|
+
const { background, text } = colors;
|
|
55
|
+
if (text) {
|
|
56
|
+
if (isGradient(text)) return resolveTextGradient(text);
|
|
57
|
+
if (isIntent(text)) return { fgDecl: resolveIntentText(colors, bgIntentFg), gradientStyles: [] };
|
|
58
|
+
if (typeof text === "string" && isCssColor(text)) return { fgDecl: `color: ${text}`, gradientStyles: [] };
|
|
59
|
+
return { fgDecl: null, gradientStyles: [] };
|
|
60
|
+
}
|
|
61
|
+
if (bgIntentFg && !bgIsGradient) return { fgDecl: `color: ${bgIntentFg}`, gradientStyles: [] };
|
|
62
|
+
if (bgDecl && !bgIsGradient) return { fgDecl: resolveAutoContrast(background), gradientStyles: [] };
|
|
63
|
+
return { fgDecl: null, gradientStyles: [] };
|
|
64
|
+
}
|
|
13
65
|
export function useColor(colors) {
|
|
14
66
|
const colorClasses = computed(() => {
|
|
15
67
|
const classes = [];
|
|
@@ -22,54 +74,9 @@ export function useColor(colors) {
|
|
|
22
74
|
return classes;
|
|
23
75
|
});
|
|
24
76
|
const colorStyles = computed(() => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let bgIsGradient = false;
|
|
29
|
-
if (colors.value.background) {
|
|
30
|
-
if (isGradient(colors.value.background)) {
|
|
31
|
-
const grad = resolveGradient(colors.value.background);
|
|
32
|
-
if (grad) {
|
|
33
|
-
bgDecl = `background-image: ${grad}`;
|
|
34
|
-
bgIsGradient = true;
|
|
35
|
-
}
|
|
36
|
-
} else if (isIntent(colors.value.background)) {
|
|
37
|
-
const m = tokenStylesForIntent(colors.value.background, "default");
|
|
38
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
39
|
-
bgIntentFg = m.color;
|
|
40
|
-
} else if (colors.value.background === "transparent") {
|
|
41
|
-
bgDecl = `background-color: ${colors.value.background}`;
|
|
42
|
-
} else if (typeof colors.value.background === "string" && isCssColor(colors.value.background)) {
|
|
43
|
-
bgDecl = `background-color: ${colors.value.background}`;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
let fgDecl = null;
|
|
47
|
-
if (colors.value.text) {
|
|
48
|
-
if (isGradient(colors.value.text)) {
|
|
49
|
-
const grad = resolveGradient(colors.value.text);
|
|
50
|
-
if (grad) {
|
|
51
|
-
fgDecl = "color: transparent";
|
|
52
|
-
styles.push(`background-image: ${grad}`);
|
|
53
|
-
styles.push("background-clip: text");
|
|
54
|
-
styles.push("-webkit-background-clip: text");
|
|
55
|
-
}
|
|
56
|
-
} else if (isIntent(colors.value.text)) {
|
|
57
|
-
if (bgIntentFg && isIntent(colors.value.background) && colors.value.text === colors.value.background) {
|
|
58
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
59
|
-
} else {
|
|
60
|
-
fgDecl = `color: ${tokenForegroundForIntent(colors.value.text)}`;
|
|
61
|
-
}
|
|
62
|
-
} else if (typeof colors.value.text === "string" && isCssColor(colors.value.text)) {
|
|
63
|
-
fgDecl = `color: ${colors.value.text}`;
|
|
64
|
-
}
|
|
65
|
-
} else if (bgIntentFg && !bgIsGradient) {
|
|
66
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
67
|
-
} else if (bgDecl && !bgIsGradient && colors.value.background && typeof colors.value.background === "string" && colors.value.background !== "transparent" && isParsableColor(colors.value.background)) {
|
|
68
|
-
const parsed = parseColor(colors.value.background);
|
|
69
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
70
|
-
fgDecl = `color: ${getForeground(parsed)}`;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
77
|
+
const { bgDecl, bgIntentFg, bgIsGradient } = resolveBackground(colors.value.background);
|
|
78
|
+
const { fgDecl, gradientStyles } = resolveForeground(colors.value, bgDecl, bgIntentFg, bgIsGradient);
|
|
79
|
+
const styles = [...gradientStyles];
|
|
73
80
|
if (bgDecl) styles.push(bgDecl);
|
|
74
81
|
if (fgDecl) styles.push(fgDecl);
|
|
75
82
|
return styles;
|
|
@@ -54,7 +54,13 @@ function createDisplay(options, ssr) {
|
|
|
54
54
|
const lg = width.value < thresholds.xl && !(md || sm || xs);
|
|
55
55
|
const xl = width.value < thresholds.xxl && !(lg || md || sm || xs);
|
|
56
56
|
const xxl = width.value >= thresholds.xxl;
|
|
57
|
-
const name =
|
|
57
|
+
const name = (0, _display2.getBreakpointName)({
|
|
58
|
+
xs,
|
|
59
|
+
sm,
|
|
60
|
+
md,
|
|
61
|
+
lg,
|
|
62
|
+
xl
|
|
63
|
+
});
|
|
58
64
|
const breakpointValue = typeof mobileBreakpoint === "number" ? mobileBreakpoint : thresholds[mobileBreakpoint];
|
|
59
65
|
const mobile = width.value < breakpointValue;
|
|
60
66
|
state.xs = xs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, inject, reactive, shallowRef, toRefs, watchEffect } from "vue";
|
|
2
2
|
import { IN_BROWSER } from "../../consts/Commons/commons.const.js";
|
|
3
3
|
import { ORIGAM_DISPLAY_KEY } from "../../consts/Commons/display.const.js";
|
|
4
|
-
import { getClientHeight, getClientWidth, getPlatform, parseDisplayOptions } from "../../utils/Commons/display.util.js";
|
|
4
|
+
import { getBreakpointName, getClientHeight, getClientWidth, getPlatform, parseDisplayOptions } from "../../utils/Commons/display.util.js";
|
|
5
5
|
import { getCurrentInstanceName } from "../../utils/Commons/getCurrentInstance.util.js";
|
|
6
6
|
export function useDisplay(props = {}, name = getCurrentInstanceName()) {
|
|
7
7
|
const display = inject(ORIGAM_DISPLAY_KEY);
|
|
@@ -38,7 +38,7 @@ export function createDisplay(options, ssr) {
|
|
|
38
38
|
const lg = width.value < thresholds.xl && !(md || sm || xs);
|
|
39
39
|
const xl = width.value < thresholds.xxl && !(lg || md || sm || xs);
|
|
40
40
|
const xxl = width.value >= thresholds.xxl;
|
|
41
|
-
const name =
|
|
41
|
+
const name = getBreakpointName({ xs, sm, md, lg, xl });
|
|
42
42
|
const breakpointValue = typeof mobileBreakpoint === "number" ? mobileBreakpoint : thresholds[mobileBreakpoint];
|
|
43
43
|
const mobile = width.value < breakpointValue;
|
|
44
44
|
state.xs = xs;
|
|
@@ -6,46 +6,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useDragResizer = useDragResizer;
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _eventListener = require("./eventListener.composable.cjs");
|
|
9
|
-
var
|
|
10
|
-
var _commons = require("../../
|
|
9
|
+
var _drag = require("../../enums/Commons/drag.enum.cjs");
|
|
10
|
+
var _commons = require("../../enums/Commons/commons.enum.cjs");
|
|
11
|
+
var _commons2 = require("../../utils/Commons/commons.util.cjs");
|
|
11
12
|
function useDragResizer(el, value, min, max, axis) {
|
|
12
13
|
const resizing = (0, _vue.ref)(false);
|
|
13
14
|
const removeListeners = [];
|
|
14
15
|
const onUnmountedCleanupFns = [];
|
|
15
|
-
(0,
|
|
16
|
+
(0, _commons2.tryOnScopeDispose)(() => {
|
|
16
17
|
onUnmountedCleanupFns.forEach(fn => fn());
|
|
17
18
|
});
|
|
18
19
|
const isHorizontal = (0, _vue.computed)(() => {
|
|
19
|
-
return axis ===
|
|
20
|
+
return axis === _drag.AXIS.X;
|
|
20
21
|
});
|
|
21
22
|
const onDragEnd = () => {
|
|
22
23
|
removeListeners.forEach(fn => fn());
|
|
23
24
|
resizing.value = false;
|
|
24
25
|
};
|
|
25
26
|
const moveHandler = (start, initialStart) => e => {
|
|
26
|
-
const clickOffset = (0,
|
|
27
|
+
const clickOffset = (0, _commons2.getPosition)(e, isHorizontal.value ? _commons.CLIENT_POSITION.X : _commons.CLIENT_POSITION.Y);
|
|
27
28
|
const delta = clickOffset - start;
|
|
28
|
-
value.value = (0,
|
|
29
|
+
value.value = (0, _commons2.clamp)(initialStart + delta, (0, _vue.toValue)(min), (0, _vue.toValue)(max));
|
|
29
30
|
};
|
|
30
31
|
const onMouseDown = e => {
|
|
31
32
|
e.preventDefault();
|
|
32
33
|
e.stopPropagation();
|
|
33
|
-
const start = (0,
|
|
34
|
+
const start = (0, _commons2.getPosition)(e, isHorizontal.value ? _commons.CLIENT_POSITION.X : _commons.CLIENT_POSITION.Y);
|
|
34
35
|
const initialStart = value.value;
|
|
35
36
|
resizing.value = true;
|
|
36
37
|
const onMouseMove = moveHandler(start, initialStart);
|
|
37
38
|
const onMouseUp = onDragEnd;
|
|
38
|
-
removeListeners.push(...[(0,
|
|
39
|
+
removeListeners.push(...[(0, _commons2.addWindowListener)("mousemove", onMouseMove, onUnmountedCleanupFns), (0, _commons2.addWindowListener)("mouseup", onMouseUp, onUnmountedCleanupFns)]);
|
|
39
40
|
};
|
|
40
41
|
const onTouchStart = e => {
|
|
41
42
|
e.preventDefault();
|
|
42
43
|
e.stopPropagation();
|
|
43
|
-
const start = (0,
|
|
44
|
+
const start = (0, _commons2.getPosition)(e, isHorizontal.value ? _commons.CLIENT_POSITION.X : _commons.CLIENT_POSITION.Y);
|
|
44
45
|
const initialStart = value.value;
|
|
45
46
|
resizing.value = true;
|
|
46
47
|
const onTouchMove = moveHandler(start, initialStart);
|
|
47
48
|
const onTouchEnd = onDragEnd;
|
|
48
|
-
removeListeners.push(...[(0,
|
|
49
|
+
removeListeners.push(...[(0, _commons2.addWindowListener)("touchmove", onTouchMove, onUnmountedCleanupFns), (0, _commons2.addWindowListener)("touchend", onTouchEnd, onUnmountedCleanupFns), (0, _commons2.addWindowListener)("touchcancel", onTouchEnd, onUnmountedCleanupFns)]);
|
|
49
50
|
};
|
|
50
51
|
if (el) {
|
|
51
52
|
(0, _eventListener.useEventListener)(el, "mousedown", onMouseDown);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, ref, toValue } from "vue";
|
|
2
2
|
import { useEventListener } from "./eventListener.composable.js";
|
|
3
|
-
import { AXIS
|
|
3
|
+
import { AXIS } from "../../enums/Commons/drag.enum.js";
|
|
4
|
+
import { CLIENT_POSITION } from "../../enums/Commons/commons.enum.js";
|
|
4
5
|
import { addWindowListener, clamp, getPosition, tryOnScopeDispose } from "../../utils/Commons/commons.util.js";
|
|
5
6
|
export function useDragResizer(el, value, min, max, axis) {
|
|
6
7
|
const resizing = ref(false);
|
|
@@ -53,23 +53,26 @@ function useGroup(props, injectKey) {
|
|
|
53
53
|
(0, _vue.onBeforeUnmount)(() => {
|
|
54
54
|
isUnmounted = true;
|
|
55
55
|
});
|
|
56
|
+
const selectMultiple = (id, value) => {
|
|
57
|
+
const internalValue = selected.value.slice();
|
|
58
|
+
const index = internalValue.findIndex(v => v === id);
|
|
59
|
+
const isSelected = ~index;
|
|
60
|
+
const newValue = value ?? !isSelected;
|
|
61
|
+
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
62
|
+
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
63
|
+
if (index < 0 && newValue) internalValue.push(id);else if (index >= 0 && !newValue) internalValue.splice(index, 1);
|
|
64
|
+
selected.value = internalValue;
|
|
65
|
+
};
|
|
66
|
+
const selectSingle = (id, value) => {
|
|
67
|
+
const isSelected = selected.value.includes(id);
|
|
68
|
+
if (props.mandatory && isSelected) return;
|
|
69
|
+
const shouldSelect = value ?? !isSelected;
|
|
70
|
+
selected.value = shouldSelect ? [id] : [];
|
|
71
|
+
};
|
|
56
72
|
const select = (id, value) => {
|
|
57
73
|
const item = items.find(item2 => item2.id === id);
|
|
58
74
|
if (value && item?.disabled) return;
|
|
59
|
-
if (props.multiple)
|
|
60
|
-
const internalValue = selected.value.slice();
|
|
61
|
-
const index = internalValue.findIndex(v => v === id);
|
|
62
|
-
const isSelected = ~index;
|
|
63
|
-
const newValue = value !== void 0 ? value : !isSelected;
|
|
64
|
-
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
65
|
-
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
66
|
-
if (index < 0 && newValue) internalValue.push(id);else if (index >= 0 && !newValue) internalValue.splice(index, 1);
|
|
67
|
-
selected.value = internalValue;
|
|
68
|
-
} else {
|
|
69
|
-
const isSelected = selected.value.includes(id);
|
|
70
|
-
if (props.mandatory && isSelected) return;
|
|
71
|
-
selected.value = (value !== void 0 ? value : !isSelected) ? [id] : [];
|
|
72
|
-
}
|
|
75
|
+
if (props.multiple) selectMultiple(id, value);else selectSingle(id, value);
|
|
73
76
|
};
|
|
74
77
|
const step = offset => {
|
|
75
78
|
if (props.multiple) (0, _console.consoleWarn)('This method is not supported when using "multiple" prop');
|
|
@@ -53,24 +53,28 @@ export function useGroup(props, injectKey) {
|
|
|
53
53
|
onBeforeUnmount(() => {
|
|
54
54
|
isUnmounted = true;
|
|
55
55
|
});
|
|
56
|
+
const selectMultiple = (id, value) => {
|
|
57
|
+
const internalValue = selected.value.slice();
|
|
58
|
+
const index = internalValue.findIndex((v) => v === id);
|
|
59
|
+
const isSelected = ~index;
|
|
60
|
+
const newValue = value ?? !isSelected;
|
|
61
|
+
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
62
|
+
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
63
|
+
if (index < 0 && newValue) internalValue.push(id);
|
|
64
|
+
else if (index >= 0 && !newValue) internalValue.splice(index, 1);
|
|
65
|
+
selected.value = internalValue;
|
|
66
|
+
};
|
|
67
|
+
const selectSingle = (id, value) => {
|
|
68
|
+
const isSelected = selected.value.includes(id);
|
|
69
|
+
if (props.mandatory && isSelected) return;
|
|
70
|
+
const shouldSelect = value ?? !isSelected;
|
|
71
|
+
selected.value = shouldSelect ? [id] : [];
|
|
72
|
+
};
|
|
56
73
|
const select = (id, value) => {
|
|
57
74
|
const item = items.find((item2) => item2.id === id);
|
|
58
75
|
if (value && item?.disabled) return;
|
|
59
|
-
if (props.multiple)
|
|
60
|
-
|
|
61
|
-
const index = internalValue.findIndex((v) => v === id);
|
|
62
|
-
const isSelected = ~index;
|
|
63
|
-
const newValue = value !== void 0 ? value : !isSelected;
|
|
64
|
-
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
65
|
-
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
66
|
-
if (index < 0 && newValue) internalValue.push(id);
|
|
67
|
-
else if (index >= 0 && !newValue) internalValue.splice(index, 1);
|
|
68
|
-
selected.value = internalValue;
|
|
69
|
-
} else {
|
|
70
|
-
const isSelected = selected.value.includes(id);
|
|
71
|
-
if (props.mandatory && isSelected) return;
|
|
72
|
-
selected.value = (value !== void 0 ? value : !isSelected) ? [id] : [];
|
|
73
|
-
}
|
|
76
|
+
if (props.multiple) selectMultiple(id, value);
|
|
77
|
+
else selectSingle(id, value);
|
|
74
78
|
};
|
|
75
79
|
const step = (offset) => {
|
|
76
80
|
if (props.multiple) consoleWarn('This method is not supported when using "multiple" prop');
|
|
@@ -7,9 +7,9 @@ exports.useNested = void 0;
|
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _vModel = require("./vModel.composable.cjs");
|
|
9
9
|
var _nested = require("../../consts/Commons/nested.const.cjs");
|
|
10
|
-
var
|
|
10
|
+
var _nested2 = require("../../enums/Commons/nested.enum.cjs");
|
|
11
11
|
var _getCurrentInstance = require("../../utils/Commons/getCurrentInstance.util.cjs");
|
|
12
|
-
var
|
|
12
|
+
var _nested3 = require("../../utils/Commons/nested.util.cjs");
|
|
13
13
|
const useNested = props => {
|
|
14
14
|
let isUnmounted = false;
|
|
15
15
|
let openedTouchedBeforeMount = false;
|
|
@@ -27,27 +27,27 @@ const useNested = props => {
|
|
|
27
27
|
const selectStrategy = (0, _vue.computed)(() => {
|
|
28
28
|
if (typeof props.selectStrategy === "object") return props.selectStrategy;
|
|
29
29
|
switch (props.selectStrategy) {
|
|
30
|
-
case
|
|
31
|
-
return (0,
|
|
32
|
-
case
|
|
33
|
-
return (0,
|
|
34
|
-
case
|
|
35
|
-
return (0,
|
|
36
|
-
case
|
|
37
|
-
return (0,
|
|
38
|
-
case
|
|
30
|
+
case _nested2.SELECT_STRATEGY.SINGLE_LEAF:
|
|
31
|
+
return (0, _nested3.leafSingleSelectStrategy)(props.mandatory);
|
|
32
|
+
case _nested2.SELECT_STRATEGY.LEAF:
|
|
33
|
+
return (0, _nested3.leafSelectStrategy)(props.mandatory);
|
|
34
|
+
case _nested2.SELECT_STRATEGY.INDEPENDENT:
|
|
35
|
+
return (0, _nested3.independentSelectStrategy)(props.mandatory);
|
|
36
|
+
case _nested2.SELECT_STRATEGY.SINGLE_INDEPENDENT:
|
|
37
|
+
return (0, _nested3.independentSingleSelectStrategy)(props.mandatory);
|
|
38
|
+
case _nested2.SELECT_STRATEGY.CLASSIC:
|
|
39
39
|
default:
|
|
40
|
-
return (0,
|
|
40
|
+
return (0, _nested3.classicSelectStrategy)(props.mandatory);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
const openStrategy = (0, _vue.computed)(() => {
|
|
44
44
|
if (typeof props.openStrategy === "object") return props.openStrategy;
|
|
45
45
|
switch (props.openStrategy) {
|
|
46
|
-
case
|
|
46
|
+
case _nested2.OPEN_STRATEGY.LIST:
|
|
47
47
|
return _nested.LIST_OPEN_STRATEGY;
|
|
48
|
-
case
|
|
48
|
+
case _nested2.OPEN_STRATEGY.SINGLE:
|
|
49
49
|
return _nested.SINGLE_OPEN_STRATEGY;
|
|
50
|
-
case
|
|
50
|
+
case _nested2.OPEN_STRATEGY.MULTIPLE:
|
|
51
51
|
default:
|
|
52
52
|
return _nested.MULTIPLE_OPEN_STRATEGY;
|
|
53
53
|
}
|
|
@@ -75,7 +75,7 @@ const useNested = props => {
|
|
|
75
75
|
const arr = [];
|
|
76
76
|
if (selected.value) {
|
|
77
77
|
for (const [key, value] of selected.value.entries()) {
|
|
78
|
-
if (value ===
|
|
78
|
+
if (value === _nested2.SELECTED.ON) arr.push(key);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return arr;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, onBeforeUnmount, onMounted, provide, ref, shallowRef, watch } from "vue";
|
|
2
2
|
import { useVModel } from "./vModel.composable.js";
|
|
3
3
|
import { LIST_OPEN_STRATEGY, MULTIPLE_OPEN_STRATEGY, ORIGAM_NESTED_KEY, SINGLE_OPEN_STRATEGY } from "../../consts/Commons/nested.const.js";
|
|
4
|
-
import { OPEN_STRATEGY, SELECTED, SELECT_STRATEGY } from "../../enums/
|
|
4
|
+
import { OPEN_STRATEGY, SELECTED, SELECT_STRATEGY } from "../../enums/Commons/nested.enum.js";
|
|
5
5
|
import { getCurrentInstance } from "../../utils/Commons/getCurrentInstance.util.js";
|
|
6
6
|
import { classicSelectStrategy, independentSelectStrategy, independentSingleSelectStrategy, leafSelectStrategy, leafSingleSelectStrategy } from "../../utils/Commons/nested.util.js";
|
|
7
7
|
export const useNested = (props) => {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useNestedItem = useNestedItem;
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _nested = require("../../consts/Commons/nested.const.cjs");
|
|
9
|
-
var
|
|
9
|
+
var _nested2 = require("../../enums/Commons/nested.enum.cjs");
|
|
10
10
|
var _getCurrentInstance = require("../../utils/Commons/getCurrentInstance.util.cjs");
|
|
11
11
|
function useNestedItem(id, isGroup) {
|
|
12
12
|
const parent = (0, _vue.inject)(_nested.ORIGAM_NESTED_KEY, _nested.EMPTY_NESTED);
|
|
@@ -32,8 +32,8 @@ function useNestedItem(id, isGroup) {
|
|
|
32
32
|
parent.root.select(computedId.value, selected, e);
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
isSelected: (0, _vue.computed)(() => Boolean(parent?.root?.selected.value.get((0, _vue.toRaw)(computedId.value)) ===
|
|
36
|
-
isIndeterminate: (0, _vue.computed)(() => Boolean(parent?.root?.selected.value.get(computedId.value) ===
|
|
35
|
+
isSelected: (0, _vue.computed)(() => Boolean(parent?.root?.selected.value.get((0, _vue.toRaw)(computedId.value)) === _nested2.SELECTED.ON)),
|
|
36
|
+
isIndeterminate: (0, _vue.computed)(() => Boolean(parent?.root?.selected.value.get(computedId.value) === _nested2.SELECTED.INDETERMINATE)),
|
|
37
37
|
isLeaf: (0, _vue.computed)(() => Boolean(!parent?.root?.children.value.get(computedId.value))),
|
|
38
38
|
isGroupActivator: parent?.isGroupActivator
|
|
39
39
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, inject, onBeforeUnmount, provide, toRaw } from "vue";
|
|
2
2
|
import { EMPTY_NESTED, ORIGAM_NESTED_KEY } from "../../consts/Commons/nested.const.js";
|
|
3
|
-
import { SELECTED } from "../../enums/
|
|
3
|
+
import { SELECTED } from "../../enums/Commons/nested.enum.js";
|
|
4
4
|
import { getUid } from "../../utils/Commons/getCurrentInstance.util.js";
|
|
5
5
|
export function useNestedItem(id, isGroup) {
|
|
6
6
|
const parent = inject(ORIGAM_NESTED_KEY, EMPTY_NESTED);
|
|
@@ -19,7 +19,7 @@ function useSize(props, name = (0, _getCurrentInstance.getCurrentInstanceName)()
|
|
|
19
19
|
const sizeClasses = (0, _vue.computed)(() => {
|
|
20
20
|
const size = (0, _vue.isRef)(props) ? props.value : props.size;
|
|
21
21
|
const classes = [];
|
|
22
|
-
if (size && _size.SIZES_ARRAY.includes(size)) {
|
|
22
|
+
if (typeof size === "string" && _size.SIZES_ARRAY.includes(size)) {
|
|
23
23
|
classes.push(`${name}--size-${size}`);
|
|
24
24
|
const utilityRung = LEGACY_SIZE_TO_UTILITY[size];
|
|
25
25
|
if (utilityRung) {
|
|
@@ -13,7 +13,7 @@ export function useSize(props, name = getCurrentInstanceName()) {
|
|
|
13
13
|
const sizeClasses = computed(() => {
|
|
14
14
|
const size = isRef(props) ? props.value : props.size;
|
|
15
15
|
const classes = [];
|
|
16
|
-
if (size && SIZES_ARRAY.includes(size)) {
|
|
16
|
+
if (typeof size === "string" && SIZES_ARRAY.includes(size)) {
|
|
17
17
|
classes.push(`${name}--size-${size}`);
|
|
18
18
|
const utilityRung = LEGACY_SIZE_TO_UTILITY[size];
|
|
19
19
|
if (utilityRung) {
|