@cedar-design/ui-vue 1.1.0 → 1.1.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/es/_components/field-presentation/EditorPanel.vue.mjs +1 -1
- package/es/_components/field-presentation/editor-pending.mjs +4 -0
- package/es/_components/field-presentation/with-field-presentation.mjs +33 -7
- package/es/_components/picker-field/PickerField.vue.mjs +6 -12
- package/es/_components/picker-field/range-labels.mjs +16 -0
- package/es/_components/selected-options/style/index.css +33 -15
- package/es/_components/selection-field/use-selection-session.mjs +1 -0
- package/es/_components/virtual-list-v2/VirtualList2.vue.mjs +21 -3
- package/es/_utils/modal-focus.mjs +9 -2
- package/es/_utils/modal-surface.mjs +9 -3
- package/es/anchor/style/index.css +1 -1
- package/es/auto-complete/auto-complete.mjs +2 -2
- package/es/auto-complete/presentation.mjs +1 -0
- package/es/auto-complete/props.mjs +2 -0
- package/es/auto-complete/style/index.css +7 -2
- package/es/back-top/style/index.css +1 -1
- package/es/button/base.mjs +6 -0
- package/es/button/index.mjs +8 -8
- package/es/button/style/index.css +1 -1
- package/es/card/Card.vue.mjs +46 -12
- package/es/carousel/style/index.css +1 -1
- package/es/cascader/CascaderMenu.vue.mjs +2 -2
- package/es/cascader/cascader-option.mjs +11 -6
- package/es/cascader/field-adapter.mjs +1 -0
- package/es/cascader/props.mjs +2 -0
- package/es/cascader/style/index.css +36 -9
- package/es/cascader/use-cascader-focus.mjs +9 -6
- package/es/cedar.css +187 -79
- package/es/cedar.esm.js +21694 -21413
- package/es/checkbox/base.mjs +6 -0
- package/es/checkbox/checkbox-group.vue.mjs +2 -2
- package/es/checkbox/index.mjs +1 -1
- package/es/checkbox/presentation.mjs +2 -2
- package/es/checkbox/style/index.css +1 -1
- package/es/countdown/use-countdown.mjs +7 -2
- package/es/date/DatePanelActions.vue.mjs +1 -1
- package/es/date/DateShortcuts.vue.mjs +1 -1
- package/es/date/picker/panels/Footer2.vue.mjs +1 -1
- package/es/date/picker/panels/Shortcuts2.vue.mjs +1 -1
- package/es/date/picker/style/index.css +1 -1
- package/es/dialog/Dialog.vue.mjs +1 -1
- package/es/ellipsis/style/index.css +1 -1
- package/es/form/FormItem2.vue.mjs +35 -7
- package/es/form/FormItemLabel.vue.mjs +4 -3
- package/es/form/focus-explicit-label.mjs +28 -0
- package/es/form/style/index.css +1 -1
- package/es/input/base.mjs +7 -0
- package/es/input/index.mjs +16 -16
- package/es/layout/style/index.css +1 -1
- package/es/nav-menu/style/index.css +1 -1
- package/es/pagination/PageInput.vue.mjs +2 -2
- package/es/pagination/style/index.css +2 -2
- package/es/people-select/PeopleSelect.mjs +23 -50
- package/es/people-select/Person.vue.mjs +1 -1
- package/es/people-select/emits.mjs +1 -1
- package/es/people-select/people-select.mjs +6 -8
- package/es/people-select/presentation.mjs +3 -1
- package/es/people-select/props.mjs +9 -3
- package/es/people-select/selection.mjs +43 -0
- package/es/people-select/style/index.css +6 -0
- package/es/progress/style/index.css +2 -2
- package/es/radio/style/index.css +1 -1
- package/es/rate/style/index.css +1 -1
- package/es/ripple/index.mjs +57 -1
- package/es/scheduler/style/index.css +1 -1
- package/es/search/HistoryContent.vue.mjs +3 -3
- package/es/search/props.mjs +0 -1
- package/es/search/search.vue.mjs +1 -1
- package/es/select/props.mjs +2 -0
- package/es/select/select.mjs +10 -4
- package/es/select/style/index.css +22 -12
- package/es/select/use-select-controller.mjs +14 -2
- package/es/slider/Slider.vue.mjs +39 -21
- package/es/slider/SliderInput.vue.mjs +4 -2
- package/es/slider/style/index.css +2 -2
- package/es/steps/style/index.css +10 -10
- package/es/switch/Switch.vue.mjs +6 -1
- package/es/switch/style/index.css +1 -1
- package/es/table/structural-slot.mjs +17 -0
- package/es/table/style/index.css +2 -2
- package/es/table/table-tbody.mjs +2 -1
- package/es/table/table-td.mjs +3 -2
- package/es/table/table-th.mjs +3 -2
- package/es/table/table-thead.mjs +2 -1
- package/es/table/table-tr.mjs +3 -2
- package/es/table/table.mjs +22 -5
- package/es/tabs/style/index.css +1 -1
- package/es/time/picker/Panel2.vue.mjs +1 -1
- package/es/time/picker/RangePanel2.vue.mjs +1 -1
- package/es/tree/style/index.css +1 -1
- package/es/tree-select/panel.mjs +3 -1
- package/es/tree-select/presentation.mjs +1 -0
- package/es/tree-select/props.mjs +2 -0
- package/es/tree-select/style/index.css +49 -7
- package/es/trigger/interaction.mjs +1 -1
- package/es/trigger/popup-move-focus.mjs +6 -6
- package/es/trigger/position.mjs +41 -3
- package/es/trigger/positioner.mjs +28 -5
- package/es/trigger/trigger.mjs +1 -1
- package/es/upload/composables/use-upload-queue.mjs +9 -1
- package/es/upload/composables/use-uploader.mjs +31 -11
- package/es/upload/upload.vue.mjs +10 -2
- package/lib/_components/field-presentation/EditorPanel.vue.js +3 -3
- package/lib/_components/field-presentation/editor-pending.js +4 -0
- package/lib/_components/field-presentation/with-field-presentation.js +32 -6
- package/lib/_components/picker-field/PickerField.vue.js +6 -12
- package/lib/_components/picker-field/range-labels.js +16 -0
- package/lib/_components/selected-options/style/index.css +33 -15
- package/lib/_components/selection-field/use-selection-session.js +1 -0
- package/lib/_components/virtual-list-v2/VirtualList2.vue.js +20 -2
- package/lib/_utils/modal-focus.js +9 -2
- package/lib/_utils/modal-surface.js +9 -3
- package/lib/anchor/style/index.css +1 -1
- package/lib/auto-complete/auto-complete.js +2 -2
- package/lib/auto-complete/presentation.js +1 -0
- package/lib/auto-complete/props.js +2 -0
- package/lib/auto-complete/style/index.css +7 -2
- package/lib/back-top/style/index.css +1 -1
- package/lib/button/base.js +6 -0
- package/lib/button/index.js +4 -4
- package/lib/button/style/index.css +1 -1
- package/lib/card/Card.vue.js +47 -13
- package/lib/carousel/style/index.css +1 -1
- package/lib/cascader/CascaderMenu.vue.js +2 -2
- package/lib/cascader/cascader-option.js +11 -6
- package/lib/cascader/field-adapter.js +1 -0
- package/lib/cascader/props.js +2 -0
- package/lib/cascader/style/index.css +36 -9
- package/lib/cascader/use-cascader-focus.js +9 -6
- package/lib/cedar.cjs.js +1149 -738
- package/lib/cedar.css +187 -79
- package/lib/checkbox/base.js +6 -0
- package/lib/checkbox/index.js +4 -4
- package/lib/checkbox/presentation.js +2 -2
- package/lib/checkbox/style/index.css +1 -1
- package/lib/countdown/use-countdown.js +7 -2
- package/lib/date/DatePanelActions.vue.js +3 -3
- package/lib/date/DateShortcuts.vue.js +2 -2
- package/lib/date/picker/panels/Footer2.vue.js +2 -2
- package/lib/date/picker/panels/Shortcuts2.vue.js +2 -2
- package/lib/date/picker/style/index.css +1 -1
- package/lib/dialog/Dialog.vue.js +3 -3
- package/lib/ellipsis/style/index.css +1 -1
- package/lib/form/FormItem2.vue.js +35 -7
- package/lib/form/FormItemLabel.vue.js +3 -2
- package/lib/form/focus-explicit-label.js +28 -0
- package/lib/form/style/index.css +1 -1
- package/lib/input/base.js +7 -0
- package/lib/input/index.js +4 -4
- package/lib/layout/style/index.css +1 -1
- package/lib/nav-menu/style/index.css +1 -1
- package/lib/pagination/PageInput.vue.js +2 -2
- package/lib/pagination/style/index.css +2 -2
- package/lib/people-select/PeopleSelect.js +22 -49
- package/lib/people-select/Person.vue.js +3 -3
- package/lib/people-select/emits.js +1 -1
- package/lib/people-select/people-select.js +6 -8
- package/lib/people-select/presentation.js +3 -1
- package/lib/people-select/props.js +9 -3
- package/lib/people-select/selection.js +43 -0
- package/lib/people-select/style/index.css +6 -0
- package/lib/progress/style/index.css +2 -2
- package/lib/radio/style/index.css +1 -1
- package/lib/rate/style/index.css +1 -1
- package/lib/ripple/index.js +57 -1
- package/lib/scheduler/style/index.css +1 -1
- package/lib/search/HistoryContent.vue.js +4 -4
- package/lib/search/props.js +0 -1
- package/lib/search/search.vue.js +2 -2
- package/lib/select/props.js +2 -0
- package/lib/select/select.js +10 -4
- package/lib/select/style/index.css +22 -12
- package/lib/select/use-select-controller.js +14 -2
- package/lib/slider/Slider.vue.js +38 -20
- package/lib/slider/SliderInput.vue.js +4 -2
- package/lib/slider/style/index.css +2 -2
- package/lib/steps/style/index.css +10 -10
- package/lib/switch/Switch.vue.js +5 -0
- package/lib/switch/style/index.css +1 -1
- package/lib/table/structural-slot.js +17 -0
- package/lib/table/style/index.css +2 -2
- package/lib/table/table-tbody.js +2 -1
- package/lib/table/table-td.js +3 -2
- package/lib/table/table-th.js +3 -2
- package/lib/table/table-thead.js +2 -1
- package/lib/table/table-tr.js +3 -2
- package/lib/table/table.js +21 -4
- package/lib/tabs/style/index.css +1 -1
- package/lib/time/picker/Panel2.vue.js +2 -2
- package/lib/time/picker/RangePanel2.vue.js +2 -2
- package/lib/tree/style/index.css +1 -1
- package/lib/tree-select/panel.js +3 -1
- package/lib/tree-select/presentation.js +1 -0
- package/lib/tree-select/props.js +2 -0
- package/lib/tree-select/style/index.css +49 -7
- package/lib/trigger/popup-move-focus.js +6 -6
- package/lib/trigger/position.js +40 -2
- package/lib/trigger/positioner.js +27 -4
- package/lib/trigger/trigger.js +1 -1
- package/lib/upload/composables/use-upload-queue.js +9 -1
- package/lib/upload/composables/use-uploader.js +31 -11
- package/lib/upload/upload.vue.js +9 -1
- package/package.json +6 -6
- package/types/_components/field-presentation/editor-pending.d.ts +3 -0
- package/types/_components/field-presentation/with-field-presentation.d.ts +2 -0
- package/types/_components/picker-field/range-labels.d.ts +1 -0
- package/types/_utils/modal-focus.d.ts +1 -0
- package/types/auto-complete/auto-complete.d.ts +9 -0
- package/types/auto-complete/index.d.ts +30 -0
- package/types/auto-complete/presentation.d.ts +9 -0
- package/types/auto-complete/props.d.ts +5 -0
- package/types/button/base.d.ts +266 -0
- package/types/button/index.d.ts +5 -1
- package/types/cascader/Cascader.vue.d.ts +9 -0
- package/types/cascader/index.d.ts +30 -0
- package/types/cascader/presentation.d.ts +15 -0
- package/types/cascader/props.d.ts +5 -0
- package/types/cascader/use-cascader-controller.d.ts +4 -0
- package/types/checkbox/base.d.ts +361 -0
- package/types/checkbox/index.d.ts +5 -1
- package/types/date/picker/DateRangePicker.vue.d.ts +12 -496
- package/types/date/picker/DateRangePickerPanel.vue.d.ts +12 -496
- package/types/date/picker/Picker.vue.d.ts +12 -496
- package/types/date/picker/PickerPanel.vue.d.ts +12 -496
- package/types/date/picker/panels/Footer.vue.d.ts +3 -124
- package/types/date/picker/panels/Shortcuts.vue.d.ts +3 -124
- package/types/date/picker/panels/date/Index.vue.d.ts +3 -124
- package/types/date/picker/panels/week/Index.vue.d.ts +3 -124
- package/types/form/FormItemLabel.vue.d.ts +2 -2
- package/types/form/context.d.ts +1 -1
- package/types/form/focus-explicit-label.d.ts +2 -0
- package/types/input/base.d.ts +481 -0
- package/types/input/index.d.ts +5 -1
- package/types/people-select/PeopleSelect.d.ts +38 -16
- package/types/people-select/emits.d.ts +3 -2
- package/types/people-select/index.d.ts +135 -63
- package/types/people-select/people-select.d.ts +47 -16
- package/types/people-select/presentation.d.ts +46 -16
- package/types/people-select/props.d.ts +17 -6
- package/types/people-select/selection.d.ts +11 -0
- package/types/people-select/types.d.ts +5 -1
- package/types/popconfirm/Popconfirm.vue.d.ts +2 -0
- package/types/popconfirm/index.d.ts +8 -0
- package/types/select/index.d.ts +30 -0
- package/types/select/native-editor-owner.d.ts +1 -0
- package/types/select/props.d.ts +5 -0
- package/types/select/select.d.ts +9 -0
- package/types/select/use-select-controller.d.ts +5 -0
- package/types/slider/SliderInput.vue.d.ts +4 -0
- package/types/table/structural-slot.d.ts +3 -0
- package/types/table/table-operation-td.d.ts +2 -0
- package/types/time/picker/Panel.vue.d.ts +3 -124
- package/types/time/picker/RangePanel.vue.d.ts +6 -248
- package/types/time/presentation/TimePanelContent.vue.d.ts +9 -372
- package/types/transfer/Transfer.vue.d.ts +4 -0
- package/types/transfer/TransferView.vue.d.ts +2 -0
- package/types/transfer/index.d.ts +16 -0
- package/types/transfer/presentation.d.ts +4 -0
- package/types/tree/BaseNode.vue.d.ts +2 -0
- package/types/tree/TransitionNodeList.vue.d.ts +2 -0
- package/types/tree-select/TreeSelect.vue.d.ts +13 -0
- package/types/tree-select/index.d.ts +50 -0
- package/types/tree-select/presentation.d.ts +13 -0
- package/types/tree-select/props.d.ts +5 -0
- package/types/trigger/position.d.ts +1 -0
- package/types/typography/EditContent.vue.d.ts +6 -0
- package/types/upload/composables/use-upload-queue.d.ts +1 -0
- package/types/upload/composables/use-uploader.d.ts +2 -0
- package/types/upload/upload.vue.d.ts +3 -3
- package/umd/_components/selected-options/style/index.css +33 -15
- package/umd/anchor/style/index.css +1 -1
- package/umd/auto-complete/style/index.css +7 -2
- package/umd/back-top/style/index.css +1 -1
- package/umd/button/style/index.css +1 -1
- package/umd/carousel/style/index.css +1 -1
- package/umd/cascader/style/index.css +36 -9
- package/umd/cedar.css +187 -79
- package/umd/cedar.js +6 -6
- package/umd/checkbox/style/index.css +1 -1
- package/umd/date/picker/style/index.css +1 -1
- package/umd/ellipsis/style/index.css +1 -1
- package/umd/form/style/index.css +1 -1
- package/umd/layout/style/index.css +1 -1
- package/umd/nav-menu/style/index.css +1 -1
- package/umd/pagination/style/index.css +2 -2
- package/umd/people-select/style/index.css +6 -0
- package/umd/progress/style/index.css +2 -2
- package/umd/radio/style/index.css +1 -1
- package/umd/rate/style/index.css +1 -1
- package/umd/scheduler/style/index.css +1 -1
- package/umd/select/style/index.css +22 -12
- package/umd/slider/style/index.css +2 -2
- package/umd/steps/style/index.css +10 -10
- package/umd/switch/style/index.css +1 -1
- package/umd/table/style/index.css +2 -2
- package/umd/tabs/style/index.css +1 -1
- package/umd/tree/style/index.css +1 -1
- package/umd/tree-select/style/index.css +49 -7
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { shallowRef, watch, computed } from "vue";
|
|
2
|
+
function personIds(value) {
|
|
3
|
+
return Array.isArray(value) ? value : value == null ? [] : [value];
|
|
4
|
+
}
|
|
5
|
+
function useSelectedPeople(props, value, options) {
|
|
6
|
+
const cache = shallowRef(/* @__PURE__ */ new Map());
|
|
7
|
+
watch([options, value], () => {
|
|
8
|
+
const next = /* @__PURE__ */ new Map();
|
|
9
|
+
for (const id of personIds(value.value)) {
|
|
10
|
+
const person = options.value.find((option) => option.value === id) ?? cache.value.get(id);
|
|
11
|
+
if (person) next.set(id, person);
|
|
12
|
+
}
|
|
13
|
+
cache.value = next;
|
|
14
|
+
}, { immediate: true, flush: "sync" });
|
|
15
|
+
function resolve(id) {
|
|
16
|
+
const current = options.value.find((option) => option.value === id);
|
|
17
|
+
if (current) return current;
|
|
18
|
+
if (typeof props.fallbackOption === "function") return props.fallbackOption(id);
|
|
19
|
+
if (props.fallbackOption !== false) {
|
|
20
|
+
if (!props.multiple && props.label) return { ...cache.value.get(id), value: id, label: props.label };
|
|
21
|
+
const cached = cache.value.get(id);
|
|
22
|
+
if (cached) return cached;
|
|
23
|
+
}
|
|
24
|
+
return { value: id, label: props.fallbackOption === false ? props.defaultText ?? "-" : !props.multiple && props.label || id || (props.defaultText ?? "-") };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
people: computed(() => personIds(value.value).map(resolve)),
|
|
28
|
+
resolve
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function peopleText(value, props) {
|
|
32
|
+
return personIds(value).map((id) => {
|
|
33
|
+
const option = Array.isArray(props.options) ? props.options.find((person) => person.value === id) : void 0;
|
|
34
|
+
if (option) return option.label;
|
|
35
|
+
if (typeof props.fallbackOption === "function") return props.fallbackOption(id).label;
|
|
36
|
+
return !props.multiple && props.label || id || (props.defaultText ?? "-");
|
|
37
|
+
}).join(", ");
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
peopleText,
|
|
41
|
+
personIds,
|
|
42
|
+
useSelectedPeople
|
|
43
|
+
};
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
--c-progress-font-size: var(--c-sys-font-size-sm);
|
|
7
7
|
--c-progress-text-color: var(--c-sys-color-content-secondary);
|
|
8
8
|
--c-progress-track-color: var(--c-sys-color-state-hover);
|
|
9
|
-
--c-progress-default-color: var(--c-sys-color-
|
|
10
|
-
--c-progress-primary-color: var(--c-sys-color-
|
|
9
|
+
--c-progress-default-color: var(--c-sys-color-action-primary);
|
|
10
|
+
--c-progress-primary-color: var(--c-sys-color-action-primary);
|
|
11
11
|
--c-progress-secondary-color: var(--c-sys-color-content-secondary);
|
|
12
12
|
--c-progress-tertiary-color: var(--c-sys-color-content-tertiary);
|
|
13
13
|
--c-progress-info-color: var(--c-sys-color-content-info);
|
package/es/radio/style/index.css
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
--c-radio-control-size: 14px;
|
|
8
8
|
--c-radio-control-color-disabled: var(--c-sys-color-content-disabled);
|
|
9
9
|
--c-radio-control-color-error: var(--c-sys-color-content-danger);
|
|
10
|
-
--c-radio-control-color-checked: var(--c-sys-color-
|
|
10
|
+
--c-radio-control-color-checked: var(--c-sys-color-action-primary);
|
|
11
11
|
--c-radio-action-padding: calc((var(--c-internal-radio-mask-height) / 2) - (var(--c-radio-control-size) / 2));
|
|
12
12
|
--c-radio-label-text-color: var(--c-sys-color-content-primary);
|
|
13
13
|
--c-radio-label-text-color-disabled: var(--c-sys-color-content-disabled);
|
package/es/rate/style/index.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
--c-rate-disabled-color: var(--c-sys-color-content-disabled);
|
|
7
7
|
--c-rate-error-color: var(--c-sys-color-content-danger);
|
|
8
8
|
--c-rate-active-scale: 1.2;
|
|
9
|
-
--c-rate-focus-color: var(--c-sys-color-
|
|
9
|
+
--c-rate-focus-color: var(--c-sys-color-action-primary);
|
|
10
10
|
--c-rate-focus-width: 2px;
|
|
11
11
|
--c-rate-focus-offset: 2px;
|
|
12
12
|
--c-rate-size: var(--c-font-size-title-3);
|
package/es/ripple/index.mjs
CHANGED
|
@@ -8,6 +8,12 @@ const waves = /* @__PURE__ */ new WeakMap();
|
|
|
8
8
|
function ownedRipples(element) {
|
|
9
9
|
return Array.from(element.children).filter((child) => waves.has(child));
|
|
10
10
|
}
|
|
11
|
+
function stopObserverIfIdle(element, state) {
|
|
12
|
+
if (!state.tasker && !ownedRipples(element).length) {
|
|
13
|
+
state.migrationObserver?.disconnect();
|
|
14
|
+
state.migrationObserver = void 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
11
17
|
function transitionTime(element, property) {
|
|
12
18
|
const style = element.ownerDocument.defaultView?.getComputedStyle(element);
|
|
13
19
|
if (!style) {
|
|
@@ -47,6 +53,8 @@ function clearTasks(element) {
|
|
|
47
53
|
if (!state) {
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
56
|
+
state.migrationObserver?.disconnect();
|
|
57
|
+
state.migrationObserver = void 0;
|
|
50
58
|
state.timers.forEach((timer) => window.clearTimeout(timer));
|
|
51
59
|
state.timers.clear();
|
|
52
60
|
state.tasker = null;
|
|
@@ -104,18 +112,25 @@ function createRipple(event) {
|
|
|
104
112
|
if (!_ripple) {
|
|
105
113
|
return;
|
|
106
114
|
}
|
|
115
|
+
syncOwnerDocument(this);
|
|
107
116
|
_ripple.removeRipple();
|
|
108
117
|
if (_ripple.disabled || _ripple.tasker || !context.enableRipple) {
|
|
109
118
|
return;
|
|
110
119
|
}
|
|
120
|
+
watchOwnerDuringGesture(this, _ripple);
|
|
111
121
|
const task = () => {
|
|
112
122
|
const current = () => this._ripple === _ripple && !_ripple.disabled && context.enableRipple;
|
|
113
123
|
if (!current()) {
|
|
124
|
+
if (this._ripple === _ripple) {
|
|
125
|
+
_ripple.tasker = null;
|
|
126
|
+
stopObserverIfIdle(this, _ripple);
|
|
127
|
+
}
|
|
114
128
|
return;
|
|
115
129
|
}
|
|
116
130
|
_ripple.tasker = null;
|
|
117
131
|
const { x, y, centerX, centerY, size } = computeRippleStyles(this, event);
|
|
118
132
|
if (!current()) {
|
|
133
|
+
if (this._ripple === _ripple) clearTasks(this);
|
|
119
134
|
return;
|
|
120
135
|
}
|
|
121
136
|
const ripple = this.ownerDocument.createElement("div");
|
|
@@ -128,6 +143,7 @@ function createRipple(event) {
|
|
|
128
143
|
ripple.dataset.createdAt = String(performance.now());
|
|
129
144
|
setStyles(this);
|
|
130
145
|
if (!current()) {
|
|
146
|
+
if (this._ripple === _ripple) clearTasks(this);
|
|
131
147
|
return;
|
|
132
148
|
}
|
|
133
149
|
this.appendChild(ripple);
|
|
@@ -135,6 +151,7 @@ function createRipple(event) {
|
|
|
135
151
|
waves.set(ripple, wave);
|
|
136
152
|
const expansion = transitionTime(ripple, "transform");
|
|
137
153
|
if (!current() || waves.get(ripple) !== wave) {
|
|
154
|
+
if (!current() && this._ripple === _ripple) clearTasks(this);
|
|
138
155
|
return;
|
|
139
156
|
}
|
|
140
157
|
wave.expandUntil += expansion;
|
|
@@ -143,10 +160,12 @@ function createRipple(event) {
|
|
|
143
160
|
() => {
|
|
144
161
|
const wave2 = waves.get(ripple);
|
|
145
162
|
if (!wave2 || !current()) {
|
|
163
|
+
if (!current() && this._ripple === _ripple) clearTasks(this);
|
|
146
164
|
return;
|
|
147
165
|
}
|
|
148
166
|
const expansion2 = transitionTime(ripple, "transform");
|
|
149
167
|
if (!current() || waves.get(ripple) !== wave2) {
|
|
168
|
+
if (!current() && this._ripple === _ripple) clearTasks(this);
|
|
150
169
|
return;
|
|
151
170
|
}
|
|
152
171
|
wave2.expandUntil = performance.now() + expansion2;
|
|
@@ -166,6 +185,7 @@ function removeRipple() {
|
|
|
166
185
|
const task = () => {
|
|
167
186
|
const ripples = ownedRipples(this);
|
|
168
187
|
if (!ripples.length) {
|
|
188
|
+
stopObserverIfIdle(this, _ripple);
|
|
169
189
|
return;
|
|
170
190
|
}
|
|
171
191
|
const lastRipple = ripples[ripples.length - 1];
|
|
@@ -190,7 +210,10 @@ function removeRipple() {
|
|
|
190
210
|
() => {
|
|
191
211
|
waves.delete(lastRipple);
|
|
192
212
|
lastRipple.remove();
|
|
193
|
-
if (!ownedRipples(this).length)
|
|
213
|
+
if (!ownedRipples(this).length) {
|
|
214
|
+
restoreStyles(this);
|
|
215
|
+
stopObserverIfIdle(this, _ripple);
|
|
216
|
+
}
|
|
194
217
|
},
|
|
195
218
|
Math.max(MINIMUM_REMOVAL_DELAY, transitionTime(lastRipple, "opacity"))
|
|
196
219
|
);
|
|
@@ -209,6 +232,7 @@ function forbidRippleTask() {
|
|
|
209
232
|
_ripple.timers.delete(_ripple.tasker);
|
|
210
233
|
}
|
|
211
234
|
_ripple.tasker = null;
|
|
235
|
+
stopObserverIfIdle(this, _ripple);
|
|
212
236
|
}
|
|
213
237
|
function createTouchRipple(event) {
|
|
214
238
|
if (this._ripple) {
|
|
@@ -244,6 +268,9 @@ function removeKeyboardRipple(event) {
|
|
|
244
268
|
}
|
|
245
269
|
const releaseGroups = /* @__PURE__ */ new WeakMap();
|
|
246
270
|
const releaseEvents = ["touchend", "mouseup", "touchcancel", "dragend"];
|
|
271
|
+
function releaseOnMovedHost() {
|
|
272
|
+
if (this._ripple && this._ripple.document !== this.ownerDocument) syncOwnerDocument(this);
|
|
273
|
+
}
|
|
247
274
|
function bindListeners(el) {
|
|
248
275
|
const state = el._ripple;
|
|
249
276
|
if (!state || state.listening || state.disabled) return;
|
|
@@ -251,6 +278,9 @@ function bindListeners(el) {
|
|
|
251
278
|
el.addEventListener("touchstart", createTouchRipple, { passive: true });
|
|
252
279
|
el.addEventListener("mousedown", createMouseRipple, { passive: true });
|
|
253
280
|
el.addEventListener("touchmove", forbidRippleTask, { passive: true });
|
|
281
|
+
el.addEventListener("mouseup", releaseOnMovedHost);
|
|
282
|
+
el.addEventListener("touchend", releaseOnMovedHost);
|
|
283
|
+
el.addEventListener("touchcancel", releaseOnMovedHost);
|
|
254
284
|
el.addEventListener("dragstart", removeRipple, { passive: true });
|
|
255
285
|
el.addEventListener("keydown", createKeyboardRipple);
|
|
256
286
|
el.addEventListener("keyup", removeKeyboardRipple);
|
|
@@ -282,6 +312,9 @@ function unbindListeners(el) {
|
|
|
282
312
|
el.removeEventListener("touchstart", createTouchRipple);
|
|
283
313
|
el.removeEventListener("mousedown", createMouseRipple);
|
|
284
314
|
el.removeEventListener("touchmove", forbidRippleTask);
|
|
315
|
+
el.removeEventListener("mouseup", releaseOnMovedHost);
|
|
316
|
+
el.removeEventListener("touchend", releaseOnMovedHost);
|
|
317
|
+
el.removeEventListener("touchcancel", releaseOnMovedHost);
|
|
285
318
|
el.removeEventListener("dragstart", removeRipple);
|
|
286
319
|
const group = releaseGroups.get(state.document);
|
|
287
320
|
if (group && group.hosts.delete(el) && !group.hosts.size) {
|
|
@@ -292,6 +325,28 @@ function unbindListeners(el) {
|
|
|
292
325
|
releaseGroups.delete(state.document);
|
|
293
326
|
}
|
|
294
327
|
}
|
|
328
|
+
function syncOwnerDocument(el) {
|
|
329
|
+
const state = el._ripple;
|
|
330
|
+
if (!state || state.document === el.ownerDocument) return;
|
|
331
|
+
clearTasks(el);
|
|
332
|
+
unbindListeners(el);
|
|
333
|
+
state.document = el.ownerDocument;
|
|
334
|
+
bindListeners(el);
|
|
335
|
+
}
|
|
336
|
+
function watchOwnerDuringGesture(el, state) {
|
|
337
|
+
if (state.migrationObserver || typeof MutationObserver === "undefined") return;
|
|
338
|
+
let connected = el.isConnected;
|
|
339
|
+
const observer = new MutationObserver(() => {
|
|
340
|
+
if (el._ripple !== state) return;
|
|
341
|
+
if (state.document !== el.ownerDocument) syncOwnerDocument(el);
|
|
342
|
+
else if (connected && !el.isConnected) clearTasks(el);
|
|
343
|
+
else if (el.isConnected) connected = true;
|
|
344
|
+
});
|
|
345
|
+
const root = el.getRootNode();
|
|
346
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
347
|
+
if (root !== state.document) observer.observe(state.document, { childList: true, subtree: true });
|
|
348
|
+
state.migrationObserver = observer;
|
|
349
|
+
}
|
|
295
350
|
function mounted(el, binding) {
|
|
296
351
|
el._ripple = {
|
|
297
352
|
document: el.ownerDocument,
|
|
@@ -311,6 +366,7 @@ function unmounted(el) {
|
|
|
311
366
|
delete el._ripple;
|
|
312
367
|
}
|
|
313
368
|
function updated(el, binding) {
|
|
369
|
+
syncOwnerDocument(el);
|
|
314
370
|
const newBinding = {
|
|
315
371
|
color: binding.value?.color,
|
|
316
372
|
disabled: binding.value?.disabled
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
--c-scheduler-lane-height: 38px;
|
|
58
58
|
--c-scheduler-font-size: 14px;
|
|
59
59
|
--c-scheduler-line-height: 1.5;
|
|
60
|
-
--c-scheduler-focus-color: var(--c-sys-color-
|
|
60
|
+
--c-scheduler-focus-color: var(--c-sys-color-action-primary);
|
|
61
61
|
--c-scheduler-now-color: var(--c-sys-color-content-danger);
|
|
62
62
|
--c-scheduler-now-width: 2px;
|
|
63
63
|
--c-scheduler-now-z-index: 3;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, useSlots, ref, watch, onBeforeUnmount, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, createBlock, normalizeStyle, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, mergeProps, createSlots, withCtx, normalizeProps, guardReactiveProps, Fragment, renderList } from "vue";
|
|
2
2
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import Button from "../button/base.mjs";
|
|
4
|
+
import SearchInput from "../input/base.mjs";
|
|
5
5
|
import _sfc_main$1 from "./FieldSelect.vue.mjs";
|
|
6
6
|
const _hoisted_1 = ["for"];
|
|
7
7
|
const _hoisted_2 = ["disabled", "onClick"];
|
|
@@ -74,7 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
74
74
|
createTextVNode(toDisplayString(__props.settings.label), 1)
|
|
75
75
|
])
|
|
76
76
|
], 10, _hoisted_1)) : createCommentVNode("", true),
|
|
77
|
-
createVNode(unref(
|
|
77
|
+
createVNode(unref(SearchInput), mergeProps({
|
|
78
78
|
ref_key: "inputRef",
|
|
79
79
|
ref: inputRef,
|
|
80
80
|
loading: __props.settings.loading && __props.settings.loadingMode === "line",
|
package/es/search/props.mjs
CHANGED
package/es/search/search.vue.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { useFieldPresentation } from "../_components/field-presentation/context.
|
|
|
5
5
|
import _sfc_main$1 from "../_components/field-presentation/FieldPresentation.vue.mjs";
|
|
6
6
|
import { useEmptyValues } from "../_utils/empty-value.mjs";
|
|
7
7
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
8
|
-
import
|
|
8
|
+
import Button from "../button/base.mjs";
|
|
9
9
|
import { Icon } from "../icon/index.mjs";
|
|
10
10
|
import _sfc_main$4 from "../input/input.vue.mjs";
|
|
11
11
|
import _sfc_main$2 from "../input/InputGroup.vue.mjs";
|
package/es/select/props.mjs
CHANGED
|
@@ -8,6 +8,8 @@ import { formControlVariants } from "../_utils/form-control.mjs";
|
|
|
8
8
|
import { popupContainerProp } from "../_utils/popup-container.mjs";
|
|
9
9
|
const selectProps = {
|
|
10
10
|
...fieldLoadingProps,
|
|
11
|
+
/** 弹出编辑是否需要确认;未设置时单选即提交,多选保留确认。 */
|
|
12
|
+
needConfirm: { type: Boolean, default: void 0 },
|
|
11
13
|
openTriggerTarget: openTriggerTargetProp,
|
|
12
14
|
/** 异步候选加载器;显式 options 优先,组件管理加载和请求取消。 */
|
|
13
15
|
/** 内置本地过滤是否区分大小写;自定义过滤函数优先。 */
|
package/es/select/select.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import _sfc_main$1 from "../_components/selected-options/SelectionEditor.vue.mjs
|
|
|
8
8
|
import _sfc_main$2 from "../_components/selection-field/MenuPresentation.vue.mjs";
|
|
9
9
|
import _sfc_main$3 from "../_components/selection-field/SelectionField.vue.mjs";
|
|
10
10
|
import { isFunction } from "../_utils/is.mjs";
|
|
11
|
-
import
|
|
11
|
+
import SearchInput from "../input/base.mjs";
|
|
12
12
|
import _sfc_main$4 from "../input/InputFeedback.vue.mjs";
|
|
13
13
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
14
14
|
import { selectEmits } from "./emits.mjs";
|
|
@@ -86,7 +86,7 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
86
86
|
"onRemove": (key) => controller.handleRemove(String(key)),
|
|
87
87
|
"onClear": controller.clearSelection
|
|
88
88
|
}, {
|
|
89
|
-
default: () => [(props.filterable || props.creatable) && createVNode(
|
|
89
|
+
default: () => [(props.filterable || props.creatable) && createVNode(SearchInput, {
|
|
90
90
|
"modelValue": controller.computedInputValue,
|
|
91
91
|
"editMode": "direct",
|
|
92
92
|
"hint": false,
|
|
@@ -152,7 +152,7 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
152
152
|
"disabled": controller.mergedDisabled,
|
|
153
153
|
"readonly": controller.mergedReadonly,
|
|
154
154
|
"limit": props.limit,
|
|
155
|
-
"needConfirm": controller.deferred,
|
|
155
|
+
"needConfirm": controller.deferred && controller.needConfirm,
|
|
156
156
|
"pending": controller.session.pending,
|
|
157
157
|
"error": controller.session.error || controller.presentationError,
|
|
158
158
|
"onOpen": controller.handleOpenChange,
|
|
@@ -175,7 +175,7 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
175
175
|
editMode: "direct",
|
|
176
176
|
readPretty: false,
|
|
177
177
|
beforeCommit: void 0,
|
|
178
|
-
open: void 0,
|
|
178
|
+
open: controller.needConfirm ? void 0 : true,
|
|
179
179
|
defaultOpen: true,
|
|
180
180
|
modelValue: controller.session.value,
|
|
181
181
|
disabled: controller.mergedDisabled || controller.session.pending,
|
|
@@ -184,6 +184,12 @@ const Select = /* @__PURE__ */ defineComponent({
|
|
|
184
184
|
onKeydown: (event) => emit("keydown", event),
|
|
185
185
|
onSearch: (...args) => emit("search", ...args),
|
|
186
186
|
onChange: () => {
|
|
187
|
+
},
|
|
188
|
+
onClear: () => {
|
|
189
|
+
if (!controller.needConfirm) void controller.session.commit();
|
|
190
|
+
},
|
|
191
|
+
onRemove: () => {
|
|
192
|
+
if (!controller.needConfirm) void controller.session.commit();
|
|
187
193
|
}
|
|
188
194
|
}, slots)
|
|
189
195
|
}) : createVNode(_sfc_main$1, {
|
|
@@ -7,28 +7,31 @@
|
|
|
7
7
|
* Popup Box
|
|
8
8
|
**********************************************/
|
|
9
9
|
--c-select-popup-max-height: 200px;
|
|
10
|
-
--c-select-popup-border-radius: var(--c-sys-radius-
|
|
10
|
+
--c-select-popup-border-radius: var(--c-sys-radius-lg);
|
|
11
11
|
--c-select-popup-padding-vertical: var(--c-sys-space-2);
|
|
12
12
|
--c-select-popup-font-size: var(--c-sys-font-size-md);
|
|
13
13
|
--c-select-popup-bg: var(--c-sys-color-surface-overlay);
|
|
14
|
-
--c-select-popup-border-color: var(--c-sys-color-border-
|
|
15
|
-
--c-select-popup-box-shadow: 0
|
|
14
|
+
--c-select-popup-border-color: var(--c-sys-color-border-subtle);
|
|
15
|
+
--c-select-popup-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
16
16
|
/**********************************************
|
|
17
17
|
* Popup Options
|
|
18
18
|
* status: default / disabled / selected / hover
|
|
19
19
|
**********************************************/
|
|
20
20
|
--c-select-popup-option-height: 36px;
|
|
21
21
|
--c-select-popup-option-font-weight-selected: var(--c-sys-font-weight-medium);
|
|
22
|
-
--c-select-popup-option-padding-horizontal: var(--c-sys-space-
|
|
23
|
-
--c-select-popup-
|
|
22
|
+
--c-select-popup-option-padding-horizontal: var(--c-sys-space-4);
|
|
23
|
+
--c-select-popup-padding-horizontal: var(--c-sys-space-3);
|
|
24
|
+
--c-select-popup-option-border-radius: var(--c-sys-radius-lg);
|
|
25
|
+
--c-select-popup-option-bg: transparent;
|
|
24
26
|
--c-select-popup-option-bg-hover: var(--c-sys-color-state-hover);
|
|
25
|
-
--c-select-popup-option-bg-selected:
|
|
26
|
-
--c-select-popup-option-bg-
|
|
27
|
+
--c-select-popup-option-bg-selected: transparent;
|
|
28
|
+
--c-select-popup-option-bg-selected-hover: var(--c-select-popup-option-bg-hover);
|
|
29
|
+
--c-select-popup-option-bg-disabled: transparent;
|
|
27
30
|
--c-select-popup-option-text-color: var(--c-sys-color-content-primary);
|
|
28
31
|
--c-select-popup-option-text-color-hover: var(--c-sys-color-content-primary);
|
|
29
|
-
--c-select-popup-option-text-color-selected: var(--c-sys-color-
|
|
32
|
+
--c-select-popup-option-text-color-selected: var(--c-sys-color-action-primary);
|
|
30
33
|
--c-select-popup-option-text-color-disabled: var(--c-sys-color-content-disabled);
|
|
31
|
-
--c-select-popup-option-check-color: var(--c-sys-color-
|
|
34
|
+
--c-select-popup-option-check-color: var(--c-sys-color-action-primary);
|
|
32
35
|
--c-select-popup-option-check-size: var(--c-sys-font-size-md);
|
|
33
36
|
--c-select-popup-option-check-gap: var(--c-sys-space-4);
|
|
34
37
|
--c-select-popup-group-title-height: 20px;
|
|
@@ -69,6 +72,8 @@
|
|
|
69
72
|
list-style: none;
|
|
70
73
|
}
|
|
71
74
|
.c-select-dropdown-list-wrapper {
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
padding-inline: var(--c-select-popup-padding-horizontal);
|
|
72
77
|
max-height: var(--c-select-popup-max-height);
|
|
73
78
|
overflow-y: auto;
|
|
74
79
|
}
|
|
@@ -80,6 +85,8 @@
|
|
|
80
85
|
box-sizing: border-box;
|
|
81
86
|
width: 100%;
|
|
82
87
|
padding: 0 var(--c-select-popup-option-padding-horizontal);
|
|
88
|
+
border-radius: var(--c-select-popup-option-border-radius);
|
|
89
|
+
transition: background-color var(--c-sys-motion-duration-fast) var(--c-sys-motion-easing-standard), color var(--c-sys-motion-duration-fast) var(--c-sys-motion-easing-standard);
|
|
83
90
|
color: var(--c-select-popup-option-text-color);
|
|
84
91
|
font-size: var(--c-select-popup-font-size);
|
|
85
92
|
line-height: var(--c-select-popup-option-height);
|
|
@@ -119,11 +126,14 @@
|
|
|
119
126
|
font-weight: var(--c-select-popup-option-font-weight-selected);
|
|
120
127
|
background-color: var(--c-select-popup-option-bg-selected);
|
|
121
128
|
}
|
|
122
|
-
.c-select-dropdown .c-select-option-active,
|
|
123
|
-
.c-select-dropdown .c-select-option:not(.c-select-
|
|
129
|
+
.c-select-dropdown .c-select-option-active:not(.c-select-option-selected):not(.c-select-option-disabled),
|
|
130
|
+
.c-select-dropdown .c-select-option:not(.c-select-option-selected):not(.c-select-option-disabled):hover {
|
|
124
131
|
color: var(--c-select-popup-option-text-color-hover);
|
|
125
132
|
background-color: var(--c-select-popup-option-bg-hover);
|
|
126
|
-
|
|
133
|
+
}
|
|
134
|
+
.c-select-dropdown .c-select-option-selected:not(.c-select-option-disabled):hover,
|
|
135
|
+
.c-select-dropdown .c-select-option-selected.c-select-option-active:not(.c-select-option-disabled) {
|
|
136
|
+
background-color: var(--c-select-popup-option-bg-selected-hover);
|
|
127
137
|
}
|
|
128
138
|
.c-select-dropdown .c-select-option-disabled {
|
|
129
139
|
color: var(--c-select-popup-option-text-color-disabled);
|
|
@@ -113,6 +113,7 @@ function useSelectController(props, { emit }) {
|
|
|
113
113
|
() => props.modelValue !== void 0 ? props.modelValue : _value.value
|
|
114
114
|
);
|
|
115
115
|
const deferred = computed(() => editMode.value !== "direct");
|
|
116
|
+
const needConfirm = computed(() => props.needConfirm ?? props.multiple);
|
|
116
117
|
const publish = (value) => {
|
|
117
118
|
_value.value = value;
|
|
118
119
|
emit("update:modelValue", value);
|
|
@@ -334,6 +335,10 @@ function useSelectController(props, { emit }) {
|
|
|
334
335
|
handleOpenChange(false);
|
|
335
336
|
}
|
|
336
337
|
}
|
|
338
|
+
nativeOwner?.onSelect?.(ev);
|
|
339
|
+
if (deferred.value && !needConfirm.value) {
|
|
340
|
+
void session.commit(ev);
|
|
341
|
+
}
|
|
337
342
|
};
|
|
338
343
|
const handleSearch = useFieldSearch(
|
|
339
344
|
() => props.searchDelay,
|
|
@@ -373,6 +378,9 @@ function useSelectController(props, { emit }) {
|
|
|
373
378
|
}
|
|
374
379
|
const newKeys = computedValueObjects.value.map((item) => item.key).filter((_key) => _key !== key);
|
|
375
380
|
session.update(getValueFromValueKeys(newKeys));
|
|
381
|
+
if (deferred.value && !needConfirm.value) {
|
|
382
|
+
void session.commit();
|
|
383
|
+
}
|
|
376
384
|
emit("remove", optionInfo?.value);
|
|
377
385
|
};
|
|
378
386
|
const clearSelection = (e) => {
|
|
@@ -397,6 +405,7 @@ function useSelectController(props, { emit }) {
|
|
|
397
405
|
clearedValue = [];
|
|
398
406
|
}
|
|
399
407
|
session.update(clearedValue);
|
|
408
|
+
if (deferred.value && !needConfirm.value) void session.commit();
|
|
400
409
|
updateInputValue("");
|
|
401
410
|
if (!deferred.value) {
|
|
402
411
|
eventHandlers.value?.onClear?.();
|
|
@@ -502,7 +511,9 @@ function useSelectController(props, { emit }) {
|
|
|
502
511
|
props: shallowReactive(props),
|
|
503
512
|
listboxId,
|
|
504
513
|
activeDescendant: computed(() => computedOpen.value && !loading.value && activeKey.value && enabledOptionKeys.value.includes(activeKey.value) && (optionRefs.value[activeKey.value] || !props.virtualListProps && optionInfoMap.get(activeKey.value)?.ref) ? getOptionId(activeKey.value) : void 0),
|
|
505
|
-
provideNativeEditorOwner: () => provide(selectNativeEditorOwner, { source, selectedOptions: _selectedOption
|
|
514
|
+
provideNativeEditorOwner: () => provide(selectNativeEditorOwner, { source, selectedOptions: _selectedOption, onSelect: (event) => {
|
|
515
|
+
if (!needConfirm.value) void session.commit(event);
|
|
516
|
+
} }),
|
|
506
517
|
loading,
|
|
507
518
|
refresh: source.refresh,
|
|
508
519
|
registerPresentation: presentationState.register,
|
|
@@ -548,7 +559,8 @@ function useSelectController(props, { emit }) {
|
|
|
548
559
|
handleDropdownReachBottom,
|
|
549
560
|
session,
|
|
550
561
|
deferred,
|
|
551
|
-
canConfirm
|
|
562
|
+
canConfirm,
|
|
563
|
+
needConfirm
|
|
552
564
|
};
|
|
553
565
|
}
|
|
554
566
|
export {
|
package/es/slider/Slider.vue.mjs
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, useId, watch, onBeforeUnmount, onDeactivated, openBlock, createElementBlock,
|
|
1
|
+
import { defineComponent, useAttrs, computed, ref, useId, watch, onBeforeUnmount, onDeactivated, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, normalizeStyle, Fragment, renderList, toDisplayString, withModifiers, renderSlot, createCommentVNode, createBlock } from "vue";
|
|
2
2
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
3
3
|
import { positiveLength } from "../_utils/size-length.mjs";
|
|
4
4
|
import { sliderBounds, sliderValues, snap, stepValue } from "./model.mjs";
|
|
5
5
|
import { useFormErrorDescription } from "../form/error-description.mjs";
|
|
6
|
+
import { useFormItemLabel } from "../form/label-context.mjs";
|
|
6
7
|
import { sliderProps } from "./props.mjs";
|
|
7
8
|
import _sfc_main$1 from "./SliderInput.vue.mjs";
|
|
8
9
|
import { useSliderForm } from "./use-slider-form.mjs";
|
|
9
10
|
import { useDirection } from "@cedar-design/use-vue";
|
|
10
|
-
const _hoisted_1 = ["
|
|
11
|
-
const _hoisted_2 = ["
|
|
11
|
+
const _hoisted_1 = ["role", "aria-labelledby"];
|
|
12
|
+
const _hoisted_2 = ["tabindex", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "aria-readonly", "aria-invalid", "aria-describedby", "onPointerdown", "onKeydown", "onFocus", "onMouseenter"];
|
|
13
|
+
const _hoisted_3 = ["id"];
|
|
12
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
-
...{ name: createNamespace("slider").name },
|
|
15
|
+
...{ name: createNamespace("slider").name, inheritAttrs: false },
|
|
14
16
|
__name: "Slider",
|
|
15
17
|
props: sliderProps,
|
|
16
18
|
emits: ["update:modelValue", "change", "start", "end"],
|
|
17
19
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18
20
|
const { n, classes } = createNamespace("slider");
|
|
19
21
|
const props = __props;
|
|
22
|
+
const attrs = useAttrs();
|
|
23
|
+
const formLabel = useFormItemLabel();
|
|
24
|
+
const rangeGroupLabel = computed(() => {
|
|
25
|
+
const label = formLabel?.value;
|
|
26
|
+
return props.range && attrs.role == null && attrs["aria-labelledby"] == null && label?.target && label.target === attrs.id ? label.id : void 0;
|
|
27
|
+
});
|
|
28
|
+
const singleLabelledBy = computed(() => {
|
|
29
|
+
if (props.range) return void 0;
|
|
30
|
+
if (attrs["aria-labelledby"] != null) return attrs["aria-labelledby"];
|
|
31
|
+
const label = formLabel?.value;
|
|
32
|
+
return props.ariaLabel == null && label?.target && label.target === attrs.id ? label.id : void 0;
|
|
33
|
+
});
|
|
20
34
|
const { describe: describeError } = useFormErrorDescription();
|
|
21
35
|
const emit = __emit;
|
|
22
36
|
const { mergedDisabled, mergedReadonly, mergedError, eventHandlers } = useSliderForm(props);
|
|
@@ -290,21 +304,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
290
304
|
onBeforeUnmount(cleanup);
|
|
291
305
|
onDeactivated(cleanup);
|
|
292
306
|
return (_ctx, _cache) => {
|
|
293
|
-
return openBlock(), createElementBlock("div", {
|
|
307
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
294
308
|
ref_key: "root",
|
|
295
|
-
ref: root
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
)
|
|
309
|
+
ref: root
|
|
310
|
+
}, _ctx.$attrs, {
|
|
311
|
+
class: unref(classes)(
|
|
312
|
+
unref(n)(),
|
|
313
|
+
unref(n)(`--${_ctx.orientation}`),
|
|
314
|
+
[isDisabled.value, unref(n)("--disabled")],
|
|
315
|
+
[unref(mergedReadonly), unref(n)("--readonly")],
|
|
316
|
+
[unref(mergedError), unref(n)("--error")],
|
|
317
|
+
[_ctx.marks, unref(n)("--marks")]
|
|
305
318
|
),
|
|
306
|
-
style:
|
|
307
|
-
|
|
319
|
+
style: customStyle.value,
|
|
320
|
+
role: _ctx.$attrs.role ?? (_ctx.range && (rangeGroupLabel.value || typeof _ctx.$attrs["aria-labelledby"] === "string" && _ctx.$attrs["aria-labelledby"].trim()) ? "group" : void 0),
|
|
321
|
+
"aria-labelledby": _ctx.$attrs["aria-labelledby"] ?? rangeGroupLabel.value
|
|
322
|
+
}), [
|
|
308
323
|
createElementVNode("div", {
|
|
309
324
|
ref_key: "track",
|
|
310
325
|
ref: track,
|
|
@@ -343,6 +358,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
343
358
|
role: "slider",
|
|
344
359
|
tabindex: isDisabled.value ? void 0 : 0,
|
|
345
360
|
"aria-label": thumbLabel(index),
|
|
361
|
+
"aria-labelledby": singleLabelledBy.value,
|
|
346
362
|
"aria-valuemin": index === 1 && _ctx.range ? values.value[0] : bounds.value.min,
|
|
347
363
|
"aria-valuemax": index === 0 ? values.value[1] : bounds.value.max,
|
|
348
364
|
"aria-valuenow": values.value[index],
|
|
@@ -372,8 +388,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
372
388
|
id: `${tooltipId}-${index}`,
|
|
373
389
|
class: normalizeClass(unref(n)("tooltip")),
|
|
374
390
|
role: "tooltip"
|
|
375
|
-
}, toDisplayString(format(values.value[index])), 11,
|
|
376
|
-
], 46,
|
|
391
|
+
}, toDisplayString(format(values.value[index])), 11, _hoisted_3)) : createCommentVNode("", true)
|
|
392
|
+
], 46, _hoisted_2);
|
|
377
393
|
}), 128))
|
|
378
394
|
], 34),
|
|
379
395
|
_ctx.showInput ? (openBlock(), createBlock(_sfc_main$1, {
|
|
@@ -387,12 +403,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
387
403
|
readonly: unref(mergedReadonly),
|
|
388
404
|
error: unref(mergedError),
|
|
389
405
|
"aria-label": _ctx.ariaLabel,
|
|
406
|
+
"aria-labelledby": singleLabelledBy.value,
|
|
407
|
+
"aria-describedby": _ctx.$attrs["aria-describedby"],
|
|
390
408
|
"aria-invalid": _ctx.$attrs["aria-invalid"],
|
|
391
409
|
onChange: inputChange,
|
|
392
410
|
onFocus: _cache[2] || (_cache[2] = ($event) => unref(eventHandlers)?.onFocus?.()),
|
|
393
411
|
onBlur: _cache[3] || (_cache[3] = ($event) => unref(eventHandlers)?.onBlur?.())
|
|
394
|
-
}, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "readonly", "error", "aria-label", "aria-invalid"])) : createCommentVNode("", true)
|
|
395
|
-
],
|
|
412
|
+
}, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "readonly", "error", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid"])) : createCommentVNode("", true)
|
|
413
|
+
], 16, _hoisted_1);
|
|
396
414
|
};
|
|
397
415
|
}
|
|
398
416
|
});
|
|
@@ -15,6 +15,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
readonly: Boolean,
|
|
16
16
|
error: Boolean,
|
|
17
17
|
ariaLabel: [String, Array],
|
|
18
|
+
ariaLabelledby: String,
|
|
19
|
+
ariaDescribedby: String,
|
|
18
20
|
ariaInvalid: { type: [String, Boolean], default: void 0 }
|
|
19
21
|
},
|
|
20
22
|
emits: ["change", "focus", "blur"],
|
|
@@ -38,7 +40,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
40
|
disabled: __props.disabled,
|
|
39
41
|
readonly: __props.readonly,
|
|
40
42
|
error: __props.error,
|
|
41
|
-
"input-attrs": { "aria-label": label(0), "aria-invalid": __props.ariaInvalid },
|
|
43
|
+
"input-attrs": { "aria-label": label(0), "aria-labelledby": __props.ariaLabelledby, "aria-describedby": __props.ariaDescribedby, "aria-invalid": __props.ariaInvalid },
|
|
42
44
|
onChange: _cache[0] || (_cache[0] = (value) => emit("change", 0, value ?? void 0)),
|
|
43
45
|
onFocus: _cache[1] || (_cache[1] = ($event) => emit("focus")),
|
|
44
46
|
onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur"))
|
|
@@ -52,7 +54,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
54
|
disabled: __props.disabled,
|
|
53
55
|
readonly: __props.readonly,
|
|
54
56
|
error: __props.error,
|
|
55
|
-
"input-attrs": { "aria-label": label(1), "aria-invalid": __props.ariaInvalid },
|
|
57
|
+
"input-attrs": { "aria-label": label(1), "aria-labelledby": __props.ariaLabelledby, "aria-describedby": __props.ariaDescribedby, "aria-invalid": __props.ariaInvalid },
|
|
56
58
|
onChange: _cache[3] || (_cache[3] = (value) => emit("change", 1, value ?? void 0)),
|
|
57
59
|
onFocus: _cache[4] || (_cache[4] = ($event) => emit("focus")),
|
|
58
60
|
onBlur: _cache[5] || (_cache[5] = ($event) => emit("blur"))
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
}
|
|
4
4
|
:root,
|
|
5
5
|
:where([data-c-theme]) {
|
|
6
|
-
--c-slider-active-color: var(--c-sys-color-
|
|
6
|
+
--c-slider-active-color: var(--c-sys-color-action-primary);
|
|
7
7
|
--c-slider-track-color: var(--c-sys-color-state-hover);
|
|
8
8
|
--c-slider-thumb-color: var(--c-sys-color-surface-default);
|
|
9
|
-
--c-slider-thumb-border-color: var(--c-sys-color-
|
|
9
|
+
--c-slider-thumb-border-color: var(--c-sys-color-action-primary);
|
|
10
10
|
--c-slider-text-color: var(--c-sys-color-content-secondary);
|
|
11
11
|
--c-slider-tooltip-background: var(--c-sys-color-surface-tooltip);
|
|
12
12
|
--c-slider-tooltip-color: var(--c-sys-color-content-on-dark);
|