@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
|
@@ -6,7 +6,7 @@ import { ChoiceLabel } from "./choice-label.mjs";
|
|
|
6
6
|
import { normalizeChoiceOptions } from "./choice-options.mjs";
|
|
7
7
|
import { useChoiceState, choiceLimit } from "./choice-state.mjs";
|
|
8
8
|
import { checkboxGroupKey } from "./context.mjs";
|
|
9
|
-
import
|
|
9
|
+
import Checkbox from "./presentation.mjs";
|
|
10
10
|
import { checkboxGroupProps } from "./props.mjs";
|
|
11
11
|
import { useCheckboxGroupMethods } from "./use-checkbox-group-methods.mjs";
|
|
12
12
|
import { useChoiceForm } from "./use-choice-form.mjs";
|
|
@@ -75,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
75
75
|
"aria-disabled": unref(mergedDisabled) || void 0
|
|
76
76
|
}), [
|
|
77
77
|
props.options !== void 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(normalizedOptions.value, (option) => {
|
|
78
|
-
return openBlock(), createBlock(unref(
|
|
78
|
+
return openBlock(), createBlock(unref(Checkbox), {
|
|
79
79
|
key: `${typeof option.value}:${String(option.value)}`,
|
|
80
80
|
"edit-mode": "direct",
|
|
81
81
|
value: option.value,
|
package/es/checkbox/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withInstall } from "../_utils/global-config.mjs";
|
|
2
2
|
import CheckboxGroup from "./group-presentation.mjs";
|
|
3
|
-
import _Checkbox from "./
|
|
3
|
+
import _Checkbox from "./base.mjs";
|
|
4
4
|
import { checkboxGroupProps, checkboxProps } from "./props.mjs";
|
|
5
5
|
const Checkbox = withInstall(
|
|
6
6
|
_Checkbox,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withFieldPresentation } from "../_components/field-presentation/with-field-presentation.mjs";
|
|
2
2
|
import _sfc_main from "./checkbox.vue.mjs";
|
|
3
|
-
const
|
|
3
|
+
const Checkbox = withFieldPresentation(_sfc_main, { methods: ["toggle", "focus", "blur"] });
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
Checkbox as default
|
|
6
6
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:root,
|
|
5
5
|
:where([data-c-theme]) {
|
|
6
6
|
--c-checkbox-control-color: var(--c-sys-color-content-secondary);
|
|
7
|
-
--c-checkbox-control-color-checked: var(--c-sys-color-
|
|
7
|
+
--c-checkbox-control-color-checked: var(--c-sys-color-action-primary);
|
|
8
8
|
--c-checkbox-control-color-disabled: var(--c-sys-color-content-disabled);
|
|
9
9
|
--c-checkbox-control-color-error: var(--c-sys-color-content-danger);
|
|
10
10
|
--c-checkbox-control-size: 14px;
|
|
@@ -52,9 +52,12 @@ function useCountdown(props, emit) {
|
|
|
52
52
|
let resumeOnActivate = false;
|
|
53
53
|
let generation = 0;
|
|
54
54
|
let handle;
|
|
55
|
-
function
|
|
55
|
+
function updateDisplay() {
|
|
56
56
|
timeData.value = splitTime(remaining);
|
|
57
57
|
showTime.value = parseFormat(props.format, timeData.value);
|
|
58
|
+
}
|
|
59
|
+
function display() {
|
|
60
|
+
updateDisplay();
|
|
58
61
|
emit("change", timeData.value);
|
|
59
62
|
}
|
|
60
63
|
function cancel() {
|
|
@@ -91,9 +94,11 @@ function useCountdown(props, emit) {
|
|
|
91
94
|
}
|
|
92
95
|
function pause() {
|
|
93
96
|
resumeOnActivate = false;
|
|
94
|
-
|
|
97
|
+
const wasRunning = running;
|
|
98
|
+
if (wasRunning) remaining = Math.max(0, deadline - performance.now());
|
|
95
99
|
running = false;
|
|
96
100
|
cancel();
|
|
101
|
+
if (wasRunning && mounted) updateDisplay();
|
|
97
102
|
}
|
|
98
103
|
function reset() {
|
|
99
104
|
if (!mounted) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, normalizeProps, guardReactiveProps, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import Button from "../button/base.mjs";
|
|
3
3
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
4
4
|
import { usePanelActionsLocale } from "./presentation/use-panel-actions-locale.mjs";
|
|
5
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, createBlock, withCtx, resolveDynamicComponent, createTextVNode, toDisplayString } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import Button from "../button/base.mjs";
|
|
3
3
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
...{ name: createNamespace("date-shortcuts").name },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent } from "vue";
|
|
2
2
|
import { Link } from "../../../link/index.mjs";
|
|
3
|
-
import
|
|
3
|
+
import Button from "../../../button/base.mjs";
|
|
4
4
|
import useDatePickerTransform from "../hooks/use-inject-datepicker-transform.mjs";
|
|
5
5
|
import { createNamespace } from "../../../_utils/global-config.mjs";
|
|
6
6
|
const _sfc_main = defineComponent({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createNamespace } from "../../../_utils/global-config.mjs";
|
|
2
2
|
import { defineComponent } from "vue";
|
|
3
|
-
import
|
|
3
|
+
import Button from "../../../button/base.mjs";
|
|
4
4
|
import RenderFunction from "../../../_components/render-function.mjs";
|
|
5
5
|
import { isFunction } from "../../../_utils/is.mjs";
|
|
6
6
|
import useDatePickerTransform from "../hooks/use-inject-datepicker-transform.mjs";
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
--c-date-picker-shortcuts-placement-item-margin-vertical: 5px;
|
|
100
100
|
--c-date-picker-shortcuts-inline-item-margin-vertical: 5px;
|
|
101
101
|
--c-date-picker-shortcuts-inline-item-margin-right: var(--c-spacing-5);
|
|
102
|
-
--c-date-picker-shortcuts-active-text-color: var(--c-sys-color-
|
|
102
|
+
--c-date-picker-shortcuts-active-text-color: var(--c-sys-color-action-primary);
|
|
103
103
|
--c-date-picker-transition-duration-1: var(--c-transition-duration-1);
|
|
104
104
|
--c-date-picker-transition-timing-function-linear: var(--c-transition-timing-function-linear);
|
|
105
105
|
}
|
package/es/dialog/Dialog.vue.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import IconHover from "../_components/IconHover.vue.mjs";
|
|
|
10
10
|
import { getPrefixCls, createNamespace } from "../_utils/global-config.mjs";
|
|
11
11
|
import { isNumber } from "../_utils/is.mjs";
|
|
12
12
|
import { useModalSurface } from "../_utils/modal-surface.mjs";
|
|
13
|
-
import
|
|
13
|
+
import Button from "../button/base.mjs";
|
|
14
14
|
import { useI18n } from "../locale/index.mjs";
|
|
15
15
|
import { dialogProps } from "./props.mjs";
|
|
16
16
|
import { useDialog } from "./use-dialog.mjs";
|
|
@@ -16,6 +16,7 @@ import { provideFormErrorDescription } from "./error-description.mjs";
|
|
|
16
16
|
import { provideFormItemLabel } from "./label-context.mjs";
|
|
17
17
|
import { resolveFormItemStatus } from "./item-decoration.mjs";
|
|
18
18
|
import { formItemProps } from "./item-props.mjs";
|
|
19
|
+
import { VALIDATE_STATUSES } from "./types.mjs";
|
|
19
20
|
import { useFormItemLayout } from "./use-form-item-layout.mjs";
|
|
20
21
|
import { getFinalValidateStatus, getFinalValidateMessage } from "./utils.mjs";
|
|
21
22
|
import { hasValidateTrigger } from "./validate-trigger.mjs";
|
|
@@ -137,14 +138,38 @@ const _sfc_main = defineComponent({
|
|
|
137
138
|
const isRequired = computed(
|
|
138
139
|
() => mergedRules.value.some((item) => item.required)
|
|
139
140
|
);
|
|
140
|
-
const formItemCtx =
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const formItemCtx = inject(formItemInjectionKey, void 0);
|
|
142
|
+
const feedbackOwner = Symbol("form-item-feedback");
|
|
143
|
+
const feedbackSources = /* @__PURE__ */ new Map();
|
|
144
|
+
const updateValidateState = (field2, { status, message }, owner = feedbackOwner) => {
|
|
145
|
+
let sources = feedbackSources.get(field2);
|
|
146
|
+
if (!sources) {
|
|
147
|
+
sources = /* @__PURE__ */ new Map();
|
|
148
|
+
feedbackSources.set(field2, sources);
|
|
149
|
+
}
|
|
150
|
+
if (status || message) {
|
|
151
|
+
sources.delete(owner);
|
|
152
|
+
sources.set(owner, { status, message });
|
|
153
|
+
} else sources.delete(owner);
|
|
154
|
+
let effective = { status: "", message: "" };
|
|
155
|
+
for (const candidate of sources.values()) {
|
|
156
|
+
const rank = candidate.status ? VALIDATE_STATUSES.indexOf(candidate.status) : -1;
|
|
157
|
+
const currentRank = effective.status ? VALIDATE_STATUSES.indexOf(effective.status) : -1;
|
|
158
|
+
if (rank >= currentRank) effective = candidate;
|
|
159
|
+
}
|
|
160
|
+
if (!sources.size) feedbackSources.delete(field2);
|
|
161
|
+
validateStatus[field2] = effective.status;
|
|
162
|
+
validateMessage[field2] = effective.message;
|
|
144
163
|
if (props.noStyle) {
|
|
145
|
-
formItemCtx?.updateValidateState(field2,
|
|
164
|
+
formItemCtx?.updateValidateState(field2, effective, feedbackOwner);
|
|
146
165
|
}
|
|
147
166
|
};
|
|
167
|
+
watch(() => props.noStyle, (noStyle) => {
|
|
168
|
+
if (!formItemCtx) return;
|
|
169
|
+
for (const name of Object.keys(validateStatus)) {
|
|
170
|
+
formItemCtx.updateValidateState(name, noStyle ? { status: validateStatus[name], message: validateMessage[name] ?? "" } : { status: "", message: "" }, feedbackOwner);
|
|
171
|
+
}
|
|
172
|
+
}, { flush: "sync" });
|
|
148
173
|
const computedFeedback = computed(
|
|
149
174
|
() => props.feedback && computedValidateStatus.value ? computedValidateStatus.value : void 0
|
|
150
175
|
);
|
|
@@ -359,8 +384,6 @@ const _sfc_main = defineComponent({
|
|
|
359
384
|
validateDisabled.value = false;
|
|
360
385
|
for (const name of Object.keys(validateStatus)) {
|
|
361
386
|
updateValidateState(name, { status: "", message: "" });
|
|
362
|
-
delete validateStatus[name];
|
|
363
|
-
delete validateMessage[name];
|
|
364
387
|
}
|
|
365
388
|
captureInitialValue();
|
|
366
389
|
registerCurrentField();
|
|
@@ -374,6 +397,11 @@ const _sfc_main = defineComponent({
|
|
|
374
397
|
active = false;
|
|
375
398
|
fieldMounted = false;
|
|
376
399
|
validation.invalidate();
|
|
400
|
+
if (props.noStyle && formItemCtx) {
|
|
401
|
+
for (const name of Object.keys(validateStatus)) {
|
|
402
|
+
formItemCtx.updateValidateState(name, { status: "", message: "" }, feedbackOwner);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
377
405
|
unregisterCurrentField();
|
|
378
406
|
});
|
|
379
407
|
const cls = computed(() => [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, Fragment, createBlock, resolveDynamicComponent, mergeProps, withCtx, normalizeClass, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString,
|
|
1
|
+
import { defineComponent, ref, openBlock, createElementBlock, Fragment, createBlock, resolveDynamicComponent, mergeProps, unref, withCtx, normalizeClass, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString, withModifiers, createVNode } from "vue";
|
|
2
2
|
import { IconQuestionCircle } from "@cedar-design/icons-vue";
|
|
3
3
|
import { Tooltip } from "../tooltip/index.mjs";
|
|
4
|
+
import { focusExplicitSlider } from "./focus-explicit-label.mjs";
|
|
4
5
|
import { formItemDecorationProps } from "./item-decoration.mjs";
|
|
5
6
|
import { useFormLabelMeasurement } from "./use-form-label-width.mjs";
|
|
6
7
|
const _hoisted_1 = ["aria-label"];
|
|
@@ -28,7 +29,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
29
|
ref_key: "labelRef",
|
|
29
30
|
ref: labelRef,
|
|
30
31
|
class: __props.labelClass
|
|
31
|
-
}, __props.attrs), {
|
|
32
|
+
}, __props.attrs, { onClick: unref(focusExplicitSlider) }), {
|
|
32
33
|
default: withCtx(() => [
|
|
33
34
|
__props.required && __props.asteriskPosition === "start" ? (openBlock(), createElementBlock("strong", {
|
|
34
35
|
key: 0,
|
|
@@ -60,7 +61,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
61
|
createTextVNode(" " + toDisplayString(__props.showColon ? ":" : ""), 1)
|
|
61
62
|
]),
|
|
62
63
|
_: 3
|
|
63
|
-
}, 16, ["class"])),
|
|
64
|
+
}, 16, ["class", "onClick"])),
|
|
64
65
|
__props.tooltip ? (openBlock(), createBlock(unref(Tooltip), {
|
|
65
66
|
key: 0,
|
|
66
67
|
content: __props.tooltip,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function focusExplicitSlider(event) {
|
|
2
|
+
if (event.defaultPrevented || event.button !== 0) return;
|
|
3
|
+
const label = event.currentTarget;
|
|
4
|
+
if (!label || label.nodeType !== 1 || label.tagName !== "LABEL") return;
|
|
5
|
+
const origin = event.target;
|
|
6
|
+
const interactive = origin?.nodeType === 1 ? origin.closest('a[href],button,input,select,textarea,[contenteditable]:not([contenteditable="false"]),[role="button"],[role="link"],[role="checkbox"],[role="radio"],[role="switch"],[role="textbox"],[role="combobox"],[role="slider"]') : null;
|
|
7
|
+
if (interactive && interactive !== label && label.contains(interactive)) return;
|
|
8
|
+
const id = label.getAttribute("for");
|
|
9
|
+
if (!id || label.control) return;
|
|
10
|
+
const root = label.getRootNode();
|
|
11
|
+
if (typeof root.getElementById !== "function") return;
|
|
12
|
+
const target = root.getElementById(id);
|
|
13
|
+
if (!target) return;
|
|
14
|
+
const previous = root.activeElement;
|
|
15
|
+
const previousDocument = label.ownerDocument.activeElement;
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
if (event.defaultPrevented || !label.isConnected || label.getAttribute("for") !== id || root.getElementById(id) !== target || root.activeElement !== previous || label.ownerDocument.activeElement !== previousDocument) return;
|
|
18
|
+
const sliders = target.matches('[role="slider"]') ? [target] : Array.from(target.querySelectorAll('[role="slider"]'));
|
|
19
|
+
if (sliders.length !== 1) return;
|
|
20
|
+
const slider = sliders[0];
|
|
21
|
+
if (target !== slider && !Array.from(target.classList).some((name) => name.endsWith("-slider") && slider.classList.contains(`${name}__thumb`))) return;
|
|
22
|
+
if (slider.tabIndex < 0 || slider.getAttribute("aria-disabled") === "true" || slider.closest('[inert], [aria-hidden="true"]')) return;
|
|
23
|
+
slider.focus();
|
|
24
|
+
}, 0);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
focusExplicitSlider
|
|
28
|
+
};
|
package/es/form/style/index.css
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
--c-form-status-validating-focus-bg: var(--c-color-bg-2);
|
|
77
77
|
--c-form-status-validating-border-color: transparent;
|
|
78
78
|
--c-form-status-validating-hover-border-color: transparent;
|
|
79
|
-
--c-form-status-validating-focus-border-color: var(--c-sys-color-
|
|
79
|
+
--c-form-status-validating-focus-border-color: var(--c-sys-color-action-primary);
|
|
80
80
|
--c-form-status-validating-focus-shadow-size: var(--c-shadow-distance-none);
|
|
81
81
|
--c-form-status-validating-focus-shadow-color: var(--c-color-primary-light-2);
|
|
82
82
|
--c-form-status-validating-tip-text-color: var(--c-sys-color-content-brand);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withPropsDefaultsSetter } from "../_utils/maple/components.mjs";
|
|
2
|
+
import _sfc_main from "./input.vue.mjs";
|
|
3
|
+
import { inputProps } from "./props.mjs";
|
|
4
|
+
const SearchInput = withPropsDefaultsSetter(_sfc_main, inputProps);
|
|
5
|
+
export {
|
|
6
|
+
SearchInput as default
|
|
7
|
+
};
|
package/es/input/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { withInstall } from "../_utils/global-config.mjs";
|
|
2
|
-
import
|
|
3
|
-
import _sfc_main
|
|
4
|
-
import _sfc_main$
|
|
5
|
-
import _sfc_main$
|
|
2
|
+
import SearchInput from "./base.mjs";
|
|
3
|
+
import _sfc_main from "./InputGroup.vue.mjs";
|
|
4
|
+
import _sfc_main$2 from "./InputGroupLabel.vue.mjs";
|
|
5
|
+
import _sfc_main$1 from "./InputPassword.vue.mjs";
|
|
6
6
|
import { inputGroupProps, inputPasswordProps, inputProps } from "./props.mjs";
|
|
7
7
|
const Input = withInstall(
|
|
8
|
-
|
|
9
|
-
Object.assign(
|
|
10
|
-
Password: _sfc_main$
|
|
11
|
-
Group: _sfc_main
|
|
12
|
-
GroupLabel: _sfc_main$
|
|
8
|
+
SearchInput,
|
|
9
|
+
Object.assign(SearchInput, {
|
|
10
|
+
Password: _sfc_main$1,
|
|
11
|
+
Group: _sfc_main,
|
|
12
|
+
GroupLabel: _sfc_main$2
|
|
13
13
|
}),
|
|
14
|
-
{ components: [_sfc_main, _sfc_main$1, _sfc_main$2
|
|
14
|
+
{ components: [SearchInput, _sfc_main, _sfc_main$1, _sfc_main$2] }
|
|
15
15
|
);
|
|
16
16
|
const _InputComponent = Input;
|
|
17
|
-
const _InputPasswordComponent = _sfc_main$
|
|
18
|
-
const _InputGroupComponent = _sfc_main
|
|
19
|
-
const _InputGroupLabelComponent = _sfc_main$
|
|
17
|
+
const _InputPasswordComponent = _sfc_main$1;
|
|
18
|
+
const _InputGroupComponent = _sfc_main;
|
|
19
|
+
const _InputGroupLabelComponent = _sfc_main$2;
|
|
20
20
|
export {
|
|
21
21
|
Input,
|
|
22
|
-
_sfc_main
|
|
23
|
-
_sfc_main$
|
|
24
|
-
_sfc_main$
|
|
22
|
+
_sfc_main as InputGroup,
|
|
23
|
+
_sfc_main$2 as InputGroupLabel,
|
|
24
|
+
_sfc_main$1 as InputPassword,
|
|
25
25
|
_InputComponent,
|
|
26
26
|
_InputGroupComponent,
|
|
27
27
|
_InputGroupLabelComponent,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:root,
|
|
5
5
|
:where([data-c-theme]) {
|
|
6
6
|
--c-layout-border-color: var(--c-color-border-2);
|
|
7
|
-
--c-layout-focus-color: var(--c-sys-color-
|
|
7
|
+
--c-layout-focus-color: var(--c-sys-color-action-primary);
|
|
8
8
|
--c-layout-trigger-height: var(--c-size-12);
|
|
9
9
|
--c-layout-font-color: var(--c-color-text-1);
|
|
10
10
|
--c-layout-sider-background-light: var(--c-color-bg-2);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--c-nav-menu-light-item-bg-hover: var(--c-color-fill-2);
|
|
10
10
|
--c-nav-menu-light-item-bg-selected: var(--c-color-fill-2);
|
|
11
11
|
--c-nav-menu-light-item-text-color: var(--c-color-text-2);
|
|
12
|
-
--c-nav-menu-light-item-text-color-selected: var(--c-sys-color-
|
|
12
|
+
--c-nav-menu-light-item-text-color-selected: var(--c-sys-color-action-primary);
|
|
13
13
|
--c-nav-menu-light-item-text-color-disabled: var(--c-color-text-4);
|
|
14
14
|
--c-nav-menu-row-height: 40px;
|
|
15
15
|
--c-nav-menu-row-height-xs: 28px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref, withKeys, withModifiers } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import SearchInput from "../input/base.mjs";
|
|
3
3
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
4
|
__name: "PageInput",
|
|
5
5
|
props: {
|
|
@@ -12,7 +12,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
setup(__props, { emit: __emit }) {
|
|
13
13
|
const emit = __emit;
|
|
14
14
|
return (_ctx, _cache) => {
|
|
15
|
-
return openBlock(), createBlock(unref(
|
|
15
|
+
return openBlock(), createBlock(unref(SearchInput), {
|
|
16
16
|
"edit-mode": "direct",
|
|
17
17
|
"model-value": __props.modelValue,
|
|
18
18
|
size: __props.size,
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
--c-pagination-touch-size: 44px;
|
|
22
22
|
--c-pagination-focus-width: 2px;
|
|
23
23
|
--c-pagination-focus-offset: 1px;
|
|
24
|
-
--c-pagination-focus-color: var(--c-sys-color-
|
|
24
|
+
--c-pagination-focus-color: var(--c-sys-color-action-primary);
|
|
25
25
|
--c-pagination-item-background: transparent;
|
|
26
26
|
--c-pagination-hover-background: var(--c-color-fill-1);
|
|
27
27
|
--c-pagination-active-background: var(--c-color-primary-light-1);
|
|
28
|
-
--c-pagination-active-color: var(--c-sys-color-
|
|
28
|
+
--c-pagination-active-color: var(--c-sys-color-action-primary);
|
|
29
29
|
--c-pagination-disabled-color: var(--c-color-text-4);
|
|
30
30
|
--c-pagination-disabled-background: var(--c-color-fill-1);
|
|
31
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { peopleSelectEmits } from "./emits.mjs";
|
|
2
2
|
import { useEmptyValues } from "../_utils/empty-value.mjs";
|
|
3
|
-
import { defineComponent, computed, ref,
|
|
3
|
+
import { defineComponent, computed, ref, onMounted, watch, onBeforeUnmount, h } from "vue";
|
|
4
4
|
import { useAsyncData } from "@cedar-design/use-vue";
|
|
5
5
|
import { useFieldPresentation } from "../_components/field-presentation/context.mjs";
|
|
6
6
|
import { usePresentationForm } from "../_components/field-presentation/form-bridge.mjs";
|
|
@@ -8,6 +8,7 @@ import { createNamespace } from "../_utils/global-config.mjs";
|
|
|
8
8
|
import _sfc_main from "./Person.vue.mjs";
|
|
9
9
|
import Presented from "./presentation.mjs";
|
|
10
10
|
import { peopleSelectProps } from "./props.mjs";
|
|
11
|
+
import { useSelectedPeople } from "./selection.mjs";
|
|
11
12
|
const _PeopleSelect = defineComponent({
|
|
12
13
|
name: createNamespace("people-select").name,
|
|
13
14
|
inheritAttrs: false,
|
|
@@ -38,44 +39,16 @@ const _PeopleSelect = defineComponent({
|
|
|
38
39
|
const options = computed(
|
|
39
40
|
() => Array.isArray(props.options) ? props.options : source.data.value
|
|
40
41
|
);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const person = options.value.find(
|
|
46
|
-
(person2) => person2.value === value.value
|
|
47
|
-
);
|
|
48
|
-
if (person) selectedCache.value = person;
|
|
49
|
-
else if (selectedCache.value?.value !== value.value)
|
|
50
|
-
selectedCache.value = void 0;
|
|
51
|
-
},
|
|
52
|
-
{ immediate: true }
|
|
53
|
-
);
|
|
54
|
-
const selected = computed(() => {
|
|
55
|
-
const current = options.value.find(
|
|
56
|
-
(person) => person.value === value.value
|
|
57
|
-
);
|
|
58
|
-
if (current) return current;
|
|
59
|
-
if (typeof props.fallbackOption === "function" && value.value != null) {
|
|
60
|
-
return props.fallbackOption(value.value);
|
|
61
|
-
}
|
|
62
|
-
if (props.fallbackOption !== false && props.label)
|
|
63
|
-
return {
|
|
64
|
-
...selectedCache.value,
|
|
65
|
-
value: value.value ?? "",
|
|
66
|
-
label: props.label
|
|
67
|
-
};
|
|
68
|
-
if (props.fallbackOption !== false && selectedCache.value?.value === value.value)
|
|
69
|
-
return selectedCache.value;
|
|
70
|
-
return {
|
|
71
|
-
value: value.value ?? "",
|
|
72
|
-
label: props.fallbackOption === false ? props.defaultText : props.label || value.value || props.defaultText
|
|
73
|
-
};
|
|
42
|
+
const selection = useSelectedPeople(props, value, options);
|
|
43
|
+
const selected = computed(() => selection.people.value[0] ?? {
|
|
44
|
+
value: "",
|
|
45
|
+
label: props.label || props.defaultText
|
|
74
46
|
});
|
|
75
47
|
const readScope = computed(() => ({
|
|
76
48
|
value: value.value,
|
|
77
|
-
text: emptyPolicy.isEmpty(value.value) ? emptyPolicy.emptyText.value :
|
|
78
|
-
person: selected.value
|
|
49
|
+
text: emptyPolicy.isEmpty(value.value) ? emptyPolicy.emptyText.value : selection.people.value.map((person) => person.label).join(", "),
|
|
50
|
+
person: selected.value,
|
|
51
|
+
...props.multiple ? { people: selection.people.value } : {}
|
|
79
52
|
}));
|
|
80
53
|
const childOptions = options;
|
|
81
54
|
async function load(query) {
|
|
@@ -111,15 +84,15 @@ const _PeopleSelect = defineComponent({
|
|
|
111
84
|
if (emptyPolicy.isEmpty(value.value)) {
|
|
112
85
|
return emptyPolicy.emptyText.value;
|
|
113
86
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
_sfc_main,
|
|
121
|
-
|
|
122
|
-
person
|
|
87
|
+
const renderPerson = (person) => {
|
|
88
|
+
const scope = {
|
|
89
|
+
person,
|
|
90
|
+
disabled: form.mergedDisabled.value || !person.value || !!person.disabled
|
|
91
|
+
};
|
|
92
|
+
const actions = slots.actions ? slots.actions(scope) : props.renderActions?.(scope);
|
|
93
|
+
return h(_sfc_main, {
|
|
94
|
+
key: person.value,
|
|
95
|
+
person,
|
|
123
96
|
showAvatar: props.showAvatar,
|
|
124
97
|
disabled: scope.disabled,
|
|
125
98
|
showPhone: props.showPhone,
|
|
@@ -127,9 +100,9 @@ const _PeopleSelect = defineComponent({
|
|
|
127
100
|
call: props.call,
|
|
128
101
|
chat: props.chat,
|
|
129
102
|
onActionError: (error, action) => emit("action-error", error, action)
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
);
|
|
103
|
+
}, actions == null ? void 0 : { default: () => actions });
|
|
104
|
+
};
|
|
105
|
+
return props.multiple ? h("span", { class: "c-people-select-people" }, selection.people.value.map(renderPerson)) : renderPerson(selected.value);
|
|
133
106
|
};
|
|
134
107
|
const personSlots = () => ({
|
|
135
108
|
...slots,
|
|
@@ -151,8 +124,8 @@ const _PeopleSelect = defineComponent({
|
|
|
151
124
|
ref: control,
|
|
152
125
|
modelValue: value.value,
|
|
153
126
|
options: childOptions.value,
|
|
154
|
-
label: selected.value.label,
|
|
155
|
-
fallbackOption: props.fallbackOption === false ? false :
|
|
127
|
+
label: props.multiple ? "" : selected.value.label,
|
|
128
|
+
fallbackOption: props.fallbackOption === false ? false : selection.resolve,
|
|
156
129
|
loading: props.loading || source.loading.value,
|
|
157
130
|
filterOption: props.filterOption ?? !remote.value,
|
|
158
131
|
"onUpdate:modelValue": update,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, reactive, openBlock, createElementBlock, normalizeClass, unref, createCommentVNode, createElementVNode, toDisplayString, withModifiers, renderSlot, createBlock, withCtx } from "vue";
|
|
2
2
|
import { usePeopleTexts } from "./use-people-texts.mjs";
|
|
3
|
-
import
|
|
3
|
+
import Button from "../button/base.mjs";
|
|
4
4
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
5
5
|
const _hoisted_1 = ["src"];
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const identity = (value) => value === null || typeof value === "string";
|
|
1
|
+
const identity = (value) => value === null || typeof value === "string" || Array.isArray(value) && value.every((id) => typeof id === "string");
|
|
2
2
|
const peopleSelectEmits = {
|
|
3
3
|
"update:modelValue": identity,
|
|
4
4
|
"update:open": (open) => typeof open === "boolean",
|
|
@@ -2,6 +2,8 @@ import { defineComponent, ref, computed, inject, createVNode, mergeProps } from
|
|
|
2
2
|
import { selectionEditorSurface } from "../_components/selected-options/context.mjs";
|
|
3
3
|
import { useFormItem } from "../_hooks/use-form-item.mjs";
|
|
4
4
|
import { Select } from "../select/index.mjs";
|
|
5
|
+
import { peopleSelectEmits } from "./emits.mjs";
|
|
6
|
+
import { peopleText } from "./selection.mjs";
|
|
5
7
|
import { peopleSelectProps } from "./props.mjs";
|
|
6
8
|
import { createNamespace } from "../_utils/global-config.mjs";
|
|
7
9
|
const {
|
|
@@ -11,12 +13,7 @@ const Base = /* @__PURE__ */ defineComponent({
|
|
|
11
13
|
name,
|
|
12
14
|
inheritAttrs: false,
|
|
13
15
|
props: peopleSelectProps,
|
|
14
|
-
emits:
|
|
15
|
-
"update:modelValue": (value) => value === null || typeof value === "string",
|
|
16
|
-
change: (value) => value === null || typeof value === "string",
|
|
17
|
-
clear: () => true,
|
|
18
|
-
search: (query) => typeof query === "string"
|
|
19
|
-
},
|
|
16
|
+
emits: peopleSelectEmits,
|
|
20
17
|
setup(props, {
|
|
21
18
|
emit,
|
|
22
19
|
attrs,
|
|
@@ -42,10 +39,10 @@ const Base = /* @__PURE__ */ defineComponent({
|
|
|
42
39
|
...option
|
|
43
40
|
})));
|
|
44
41
|
const blocked = () => mergedDisabled.value || mergedReadonly.value || props.loading;
|
|
45
|
-
const label = computed(() => (
|
|
42
|
+
const label = computed(() => peopleText(value.value, props));
|
|
46
43
|
const commit = (next) => {
|
|
47
44
|
if (blocked()) return;
|
|
48
|
-
const text = next === null ? null : typeof next === "string" ? next : "";
|
|
45
|
+
const text = next === null ? null : props.multiple ? Array.isArray(next) ? next.filter((id) => typeof id === "string") : [] : typeof next === "string" ? next : "";
|
|
49
46
|
if (props.modelValue === void 0) localValue.value = text;
|
|
50
47
|
emit("update:modelValue", text);
|
|
51
48
|
emit("change", text);
|
|
@@ -56,6 +53,7 @@ const Base = /* @__PURE__ */ defineComponent({
|
|
|
56
53
|
name: props.name
|
|
57
54
|
}, {
|
|
58
55
|
"placeholder": props.placeholder,
|
|
56
|
+
"multiple": props.multiple,
|
|
59
57
|
"clearable": props.clearable,
|
|
60
58
|
"emptyValue": props.emptyValue,
|
|
61
59
|
"filterable": props.filterable,
|
|
@@ -2,9 +2,11 @@ import { h } from "vue";
|
|
|
2
2
|
import { withFieldPresentation } from "../_components/field-presentation/with-field-presentation.mjs";
|
|
3
3
|
import _sfc_main from "../_components/selected-options/SelectionEditor.vue.mjs";
|
|
4
4
|
import Base from "./people-select.mjs";
|
|
5
|
+
import { peopleText } from "./selection.mjs";
|
|
5
6
|
const Presented = withFieldPresentation(Base, {
|
|
7
|
+
selectionConfirmation: "update",
|
|
6
8
|
methods: ["focus", "blur"],
|
|
7
|
-
text:
|
|
9
|
+
text: peopleText,
|
|
8
10
|
editor: ({ props, attrs, value, update, emit, slots, disabled, readonly }) => h(
|
|
9
11
|
_sfc_main,
|
|
10
12
|
{ kind: "people-select" },
|
|
@@ -4,6 +4,8 @@ import { selectProps } from "../select/props.mjs";
|
|
|
4
4
|
import { fieldPresentationProps } from "../_components/field-presentation/props.mjs";
|
|
5
5
|
const peopleSelectProps = {
|
|
6
6
|
...fieldLoadingProps,
|
|
7
|
+
/** 弹出编辑是否需要确认;未设置时单选即提交,多选保留确认。 */
|
|
8
|
+
needConfirm: { type: Boolean, default: void 0 },
|
|
7
9
|
...fieldPresentationProps,
|
|
8
10
|
emptyValue: emptyValueProp(),
|
|
9
11
|
/** Reactive display data for a selected value absent from options. */
|
|
@@ -41,9 +43,13 @@ const peopleSelectProps = {
|
|
|
41
43
|
type: String,
|
|
42
44
|
default: "-"
|
|
43
45
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
multiple: selectProps.multiple,
|
|
47
|
+
modelValue: { type: [String, Array], default: void 0 },
|
|
48
|
+
/** 非受控初始选中人员 ID 或 ID 数组,仅创建时读取。 */
|
|
49
|
+
defaultValue: {
|
|
50
|
+
type: [String, Array],
|
|
51
|
+
default: (props) => props.multiple ? [] : ""
|
|
52
|
+
},
|
|
47
53
|
isLabel: {
|
|
48
54
|
type: Boolean,
|
|
49
55
|
default: false
|