@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
package/es/trigger/trigger.mjs
CHANGED
|
@@ -144,7 +144,7 @@ const _Trigger = /* @__PURE__ */ defineComponent({
|
|
|
144
144
|
});
|
|
145
145
|
return () => {
|
|
146
146
|
const referenceNodes = mergeFirstReferenceClass(slots.default?.() ?? [], visible.value ? props.openedClass : void 0);
|
|
147
|
-
const contentNodes = slots.content?.() ?? [];
|
|
147
|
+
const contentNodes = renderState.rendered.value ? slots.content?.() ?? [] : [];
|
|
148
148
|
const hiddenByEmpty = props.hideEmpty && isEmptyContent(contentNodes);
|
|
149
149
|
nodes.value = referenceNodes;
|
|
150
150
|
return createVNode(Fragment, null, [referenceNodes, createVNode(Teleport, {
|
|
@@ -2,10 +2,13 @@ import { ref, computed, nextTick } from "vue";
|
|
|
2
2
|
function useUploadQueue(options) {
|
|
3
3
|
const inner = ref((options.defaultValue?.() ?? []).map((file) => ({ ...file })));
|
|
4
4
|
const fileList = computed(() => options.modelValue?.() ?? inner.value);
|
|
5
|
+
let revision = 0;
|
|
5
6
|
let pending;
|
|
6
7
|
let pendingBase;
|
|
7
8
|
const mutationList = () => pending && fileList.value === pendingBase ? pending : fileList.value;
|
|
8
9
|
function commit(next, changed) {
|
|
10
|
+
const currentRevision = ++revision;
|
|
11
|
+
const startedActive = options.isActive?.() ?? true;
|
|
9
12
|
pendingBase = fileList.value;
|
|
10
13
|
pending = next;
|
|
11
14
|
if (options.modelValue?.() === void 0) inner.value = next;
|
|
@@ -16,7 +19,7 @@ function useUploadQueue(options) {
|
|
|
16
19
|
}
|
|
17
20
|
});
|
|
18
21
|
options.onUpdateModelValue?.(next);
|
|
19
|
-
options.onChange?.(next, changed);
|
|
22
|
+
if (revision === currentRevision && (!startedActive || (options.isActive?.() ?? true))) options.onChange?.(next, changed);
|
|
20
23
|
}
|
|
21
24
|
function append(files) {
|
|
22
25
|
if (files.length) commit([...mutationList(), ...files], files[0]);
|
|
@@ -55,6 +58,11 @@ function useUploadQueue(options) {
|
|
|
55
58
|
}
|
|
56
59
|
function reset() {
|
|
57
60
|
if (fileList.value.length) commit([]);
|
|
61
|
+
else {
|
|
62
|
+
revision++;
|
|
63
|
+
pending = void 0;
|
|
64
|
+
pendingBase = void 0;
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
return {
|
|
60
68
|
fileList,
|
|
@@ -9,6 +9,7 @@ import { useFilePicker } from "./use-file-picker.mjs";
|
|
|
9
9
|
import { useUploadQueue } from "./use-upload-queue.mjs";
|
|
10
10
|
function useUploader(options) {
|
|
11
11
|
const feedback = usePendingFeedback();
|
|
12
|
+
const preparation = usePendingFeedback();
|
|
12
13
|
let active = true;
|
|
13
14
|
let inactive = false;
|
|
14
15
|
let generation = 0;
|
|
@@ -26,7 +27,8 @@ function useUploader(options) {
|
|
|
26
27
|
modelValue: options.modelValue,
|
|
27
28
|
defaultValue: options.defaultValue,
|
|
28
29
|
onChange: options.onChange,
|
|
29
|
-
onUpdateModelValue: options.onUpdateModelValue
|
|
30
|
+
onUpdateModelValue: options.onUpdateModelValue,
|
|
31
|
+
isActive: () => active && !inactive
|
|
30
32
|
});
|
|
31
33
|
const replacementTarget = ref();
|
|
32
34
|
const metadataVersion = ref(0);
|
|
@@ -164,8 +166,8 @@ function useUploader(options) {
|
|
|
164
166
|
}
|
|
165
167
|
function enqueue(files, rejected, previous) {
|
|
166
168
|
const epoch = generation;
|
|
167
|
-
adding = adding.then(() => prepareFiles(files, rejected, epoch, previous)).catch(() => {
|
|
168
|
-
});
|
|
169
|
+
adding = preparation.track(() => adding.then(() => prepareFiles(files, rejected, epoch, previous)).catch(() => {
|
|
170
|
+
}));
|
|
169
171
|
return adding;
|
|
170
172
|
}
|
|
171
173
|
async function prepareFiles(files, initialRejected, epoch, previous) {
|
|
@@ -177,7 +179,9 @@ function useUploader(options) {
|
|
|
177
179
|
candidates = await feedback.track(() => options.beforeAdd(files));
|
|
178
180
|
for (const file of files) if (!candidates.includes(file)) rejected.push({ file, reason: "before-add" });
|
|
179
181
|
} catch {
|
|
180
|
-
|
|
182
|
+
if (valid(epoch)) {
|
|
183
|
+
reject([...rejected, ...files.map((file) => ({ file, reason: "before-add" }))]);
|
|
184
|
+
}
|
|
181
185
|
return;
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -248,7 +252,15 @@ function useUploader(options) {
|
|
|
248
252
|
return;
|
|
249
253
|
}
|
|
250
254
|
reject(rejected);
|
|
255
|
+
if (!valid(epoch)) {
|
|
256
|
+
items.forEach((item) => release(item.uid));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
251
259
|
if (rejected.some((file) => file.reason === "max-files")) options.onExceed?.(candidates, queue.fileList.value);
|
|
260
|
+
if (!valid(epoch)) {
|
|
261
|
+
items.forEach((item) => release(item.uid));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
252
264
|
if (!items.length) return;
|
|
253
265
|
if (previous) {
|
|
254
266
|
if (!sameTarget(previous)) {
|
|
@@ -268,9 +280,13 @@ function useUploader(options) {
|
|
|
268
280
|
items.forEach((file) => pendingAuto.add(file.uid));
|
|
269
281
|
if (previous) {
|
|
270
282
|
queue.replace(previous, items[0]);
|
|
283
|
+
if (!valid(epoch)) return;
|
|
271
284
|
options.onReplace?.(items[0], previous);
|
|
272
285
|
} else queue.append(items);
|
|
273
|
-
|
|
286
|
+
for (const file of items) {
|
|
287
|
+
if (!valid(epoch)) return;
|
|
288
|
+
options.onRead?.(reactive(file));
|
|
289
|
+
}
|
|
274
290
|
await nextTick();
|
|
275
291
|
}
|
|
276
292
|
async function submit(file) {
|
|
@@ -280,6 +296,7 @@ function useUploader(options) {
|
|
|
280
296
|
}
|
|
281
297
|
async function uploadFile(file) {
|
|
282
298
|
if (attempts.has(file.uid)) return;
|
|
299
|
+
const epoch = generation;
|
|
283
300
|
const attempt = {};
|
|
284
301
|
attempts.set(file.uid, attempt);
|
|
285
302
|
const current = () => active && !inactive && attempts.get(file.uid) === attempt && queue.fileList.value.some(
|
|
@@ -330,7 +347,7 @@ function useUploader(options) {
|
|
|
330
347
|
status: changed.status,
|
|
331
348
|
percent: changed.percent
|
|
332
349
|
});
|
|
333
|
-
options.onProgress?.(changed, event);
|
|
350
|
+
if (valid(epoch) && current()) options.onProgress?.(changed, event);
|
|
334
351
|
};
|
|
335
352
|
const handleSuccess = (response) => {
|
|
336
353
|
if (!current()) return;
|
|
@@ -346,7 +363,7 @@ function useUploader(options) {
|
|
|
346
363
|
percent: changed.percent,
|
|
347
364
|
response
|
|
348
365
|
});
|
|
349
|
-
options.onSuccess?.(changed);
|
|
366
|
+
if (valid(epoch)) options.onSuccess?.(changed);
|
|
350
367
|
};
|
|
351
368
|
const handleError = (error) => {
|
|
352
369
|
if (!current()) return;
|
|
@@ -362,7 +379,7 @@ function useUploader(options) {
|
|
|
362
379
|
percent: changed.percent,
|
|
363
380
|
error
|
|
364
381
|
});
|
|
365
|
-
options.onError?.(changed);
|
|
382
|
+
if (valid(epoch)) options.onError?.(changed);
|
|
366
383
|
};
|
|
367
384
|
const requestOptions = {
|
|
368
385
|
action: options.action?.(),
|
|
@@ -392,7 +409,7 @@ function useUploader(options) {
|
|
|
392
409
|
attempts.delete(file.uid);
|
|
393
410
|
const changed = { ...item, status: "error", percent: 0, error };
|
|
394
411
|
queue.patch(file.uid, changed);
|
|
395
|
-
options.onError?.(changed);
|
|
412
|
+
if (valid(epoch)) options.onError?.(changed);
|
|
396
413
|
}
|
|
397
414
|
}
|
|
398
415
|
function abort(file) {
|
|
@@ -421,7 +438,7 @@ function useUploader(options) {
|
|
|
421
438
|
cancelAttempt(file.uid);
|
|
422
439
|
pendingAuto.delete(file.uid);
|
|
423
440
|
queue.remove(file);
|
|
424
|
-
options.onRemove?.(file);
|
|
441
|
+
if (valid(epoch)) options.onRemove?.(file);
|
|
425
442
|
} catch {
|
|
426
443
|
} finally {
|
|
427
444
|
if (removals.get(file.uid) === token) removals.delete(file.uid);
|
|
@@ -444,8 +461,9 @@ function useUploader(options) {
|
|
|
444
461
|
});
|
|
445
462
|
}
|
|
446
463
|
function reset() {
|
|
447
|
-
feedback.cancel();
|
|
448
464
|
if (disabled.value) return;
|
|
465
|
+
feedback.cancel();
|
|
466
|
+
preparation.cancel();
|
|
449
467
|
generation++;
|
|
450
468
|
replacementTarget.value = void 0;
|
|
451
469
|
adding = Promise.resolve();
|
|
@@ -486,6 +504,8 @@ function useUploader(options) {
|
|
|
486
504
|
});
|
|
487
505
|
return {
|
|
488
506
|
guardPending: feedback.pending,
|
|
507
|
+
/** @internal Coordinates deferred field confirmation with file preparation. */
|
|
508
|
+
editorPending: computed(() => feedback.pending.value || preparation.pending.value),
|
|
489
509
|
fileList: queue.fileList,
|
|
490
510
|
maxReached,
|
|
491
511
|
disabled,
|
package/es/upload/upload.vue.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onBeforeUnmount, openBlock, createElementBlock, unref, normalizeClass, createElementVNode, createVNode, withDirectives, renderSlot, toDisplayString, createCommentVNode, Fragment, renderList, mergeProps, normalizeStyle } from "vue";
|
|
1
|
+
import { defineComponent, ref, inject, watch, onBeforeUnmount, openBlock, createElementBlock, unref, normalizeClass, createElementVNode, createVNode, withDirectives, renderSlot, toDisplayString, createCommentVNode, Fragment, renderList, mergeProps, normalizeStyle } from "vue";
|
|
2
2
|
import _sfc_main$1 from "../_components/pending-feedback/PendingFeedback.vue.mjs";
|
|
3
|
+
import { fieldEditorControlPending } from "../_components/field-presentation/editor-pending.mjs";
|
|
3
4
|
import { IconEye, IconDownload, IconClose, IconRefresh } from "@cedar-design/icons-vue";
|
|
4
5
|
import { createNamespace, formatElevation } from "../_utils/global-config.mjs";
|
|
5
6
|
import { ImagePreviewFn as previewImage } from "../image/preview-api.mjs";
|
|
@@ -133,6 +134,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
});
|
|
137
|
+
const editorPending = inject(fieldEditorControlPending, void 0);
|
|
138
|
+
watch(uploader.editorPending, (value) => {
|
|
139
|
+
if (editorPending) editorPending.value = value;
|
|
140
|
+
}, { flush: "sync" });
|
|
141
|
+
onBeforeUnmount(() => {
|
|
142
|
+
if (editorPending) editorPending.value = false;
|
|
143
|
+
});
|
|
136
144
|
const {
|
|
137
145
|
fileList,
|
|
138
146
|
maxReached,
|
|
@@ -248,7 +256,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
248
256
|
class: normalizeClass(unref(n)("input")),
|
|
249
257
|
type: "file",
|
|
250
258
|
accept: _ctx.accept,
|
|
251
|
-
capture: _ctx.capture,
|
|
259
|
+
capture: _ctx.capture === false ? void 0 : _ctx.capture === true ? "" : _ctx.capture,
|
|
252
260
|
multiple: !unref(replacementTarget) && (_ctx.multiple || _ctx.directory),
|
|
253
261
|
disabled: unref(disabledState),
|
|
254
262
|
webkitdirectory: !unref(replacementTarget) && _ctx.directory || void 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const globalConfig = require("../../_utils/global-config.js");
|
|
5
|
-
const
|
|
5
|
+
const base = require("../../button/base.js");
|
|
6
6
|
const locale_index = require("../../locale/index.js");
|
|
7
7
|
const context = require("./context.js");
|
|
8
8
|
const editorActions = require("./editor-actions.js");
|
|
@@ -124,7 +124,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
124
124
|
}, [
|
|
125
125
|
auxiliaryActions.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(auxiliaryActions.value), { key: 0 })) : vue.createCommentVNode("", true)
|
|
126
126
|
], 2),
|
|
127
|
-
__props.clearable ? (vue.openBlock(), vue.createBlock(vue.unref(
|
|
127
|
+
__props.clearable ? (vue.openBlock(), vue.createBlock(vue.unref(base.default), {
|
|
128
128
|
key: 0,
|
|
129
129
|
variant: "text",
|
|
130
130
|
disabled: __props.disabled || __props.pending,
|
|
@@ -137,7 +137,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
137
137
|
]),
|
|
138
138
|
_: 1
|
|
139
139
|
}, 8, ["disabled"])) : vue.createCommentVNode("", true),
|
|
140
|
-
__props.needConfirm ? (vue.openBlock(), vue.createBlock(vue.unref(
|
|
140
|
+
__props.needConfirm ? (vue.openBlock(), vue.createBlock(vue.unref(base.default), {
|
|
141
141
|
key: 1,
|
|
142
142
|
status: "primary",
|
|
143
143
|
loading: __props.pending,
|
|
@@ -7,6 +7,7 @@ const context$1 = require("../../input/context.js");
|
|
|
7
7
|
const useSelectionSession = require("../selection-field/use-selection-session.js");
|
|
8
8
|
const context = require("./context.js");
|
|
9
9
|
const FieldPresentation_vue_vue_type_script_setup_true_lang = require("./FieldPresentation.vue.js");
|
|
10
|
+
const editorPending = require("./editor-pending.js");
|
|
10
11
|
const formBridge = require("./form-bridge.js");
|
|
11
12
|
function cloneValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
12
13
|
if (value instanceof Date) {
|
|
@@ -25,7 +26,7 @@ function cloneValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
25
26
|
}
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
28
|
-
function sameFieldValue(left, right, seen = /* @__PURE__ */ new WeakMap()) {
|
|
29
|
+
function sameFieldValue(left, right, seen = /* @__PURE__ */ new WeakMap(), reverse = /* @__PURE__ */ new WeakMap()) {
|
|
29
30
|
if (Object.is(left, right)) {
|
|
30
31
|
return true;
|
|
31
32
|
}
|
|
@@ -41,12 +42,16 @@ function sameFieldValue(left, right, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
41
42
|
if (!Array.isArray(left) && Object.getPrototypeOf(left) !== Object.prototype) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
44
|
-
if (seen.
|
|
45
|
-
return
|
|
45
|
+
if (seen.has(left) || reverse.has(right)) {
|
|
46
|
+
return seen.get(left) === right && reverse.get(right) === left;
|
|
46
47
|
}
|
|
47
48
|
seen.set(left, right);
|
|
49
|
+
reverse.set(right, left);
|
|
48
50
|
const keys = Object.keys(left);
|
|
49
|
-
|
|
51
|
+
const result = keys.length === Object.keys(right).length && keys.every((key) => Object.prototype.hasOwnProperty.call(right, key) && sameFieldValue(left[key], right[key], seen, reverse));
|
|
52
|
+
seen.delete(left);
|
|
53
|
+
reverse.delete(right);
|
|
54
|
+
return result;
|
|
50
55
|
}
|
|
51
56
|
function formatFieldValue(value) {
|
|
52
57
|
if (value == null || value === "") {
|
|
@@ -122,6 +127,8 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
122
127
|
readonly: vue.computed(() => props.readonly ?? inputGroup?.readonly.value),
|
|
123
128
|
size: vue.computed(() => props.size ?? inputGroup?.size.value)
|
|
124
129
|
});
|
|
130
|
+
const editorControlPending = vue.ref(false);
|
|
131
|
+
vue.provide(editorPending.fieldEditorControlPending, editorControlPending);
|
|
125
132
|
const inner = vue.shallowRef();
|
|
126
133
|
const host = vue.ref();
|
|
127
134
|
const localValue = vue.shallowRef(props.defaultValue ?? props.modelValue);
|
|
@@ -242,9 +249,22 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
242
249
|
}
|
|
243
250
|
}
|
|
244
251
|
});
|
|
252
|
+
const needConfirm = vue.computed(() => !adapter.selectionConfirmation || (props.needConfirm ?? Boolean(props.multiple)));
|
|
253
|
+
const showConfirm = vue.computed(
|
|
254
|
+
() => needConfirm.value || adapter.selectionConfirmation === "select" && !sameFieldValue(session.draft.value, value.value)
|
|
255
|
+
);
|
|
256
|
+
const completeSelection = () => {
|
|
257
|
+
const candidate = cloneValue(session.draft.value);
|
|
258
|
+
void Promise.resolve(session.commit()).then((accepted) => {
|
|
259
|
+
if (!accepted && open.value && !session.pending.value && sameFieldValue(session.draft.value, candidate)) {
|
|
260
|
+
session.update(value.value);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
};
|
|
245
264
|
const updateDraft = (next) => {
|
|
246
265
|
if (open.value && !blocked.value) {
|
|
247
266
|
session.update(next);
|
|
267
|
+
if (adapter.selectionConfirmation === "update" && !needConfirm.value) completeSelection();
|
|
248
268
|
}
|
|
249
269
|
};
|
|
250
270
|
const clearDraft = () => {
|
|
@@ -253,6 +273,7 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
253
273
|
}
|
|
254
274
|
const fallback = "uncheckedValue" in props ? props.uncheckedValue : typeof props.defaultValue === "boolean" ? false : Array.isArray(value.value) ? [] : props.defaultValue;
|
|
255
275
|
session.update(emptyValue.resolveEmptyValue(props, fallback));
|
|
276
|
+
if (!needConfirm.value) void session.commit();
|
|
256
277
|
};
|
|
257
278
|
const clearReference = async () => {
|
|
258
279
|
if (blocked.value || selectionPaused.value || session.pending.value) {
|
|
@@ -270,8 +291,10 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
270
291
|
state.item?.resetValidation?.();
|
|
271
292
|
};
|
|
272
293
|
const confirm = async (event) => {
|
|
294
|
+
if (editorControlPending.value) return false;
|
|
273
295
|
inner.value?.blur?.();
|
|
274
296
|
await vue.nextTick();
|
|
297
|
+
if (editorControlPending.value) return false;
|
|
275
298
|
return session.commit(event);
|
|
276
299
|
};
|
|
277
300
|
vue.watch(
|
|
@@ -481,6 +504,9 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
481
504
|
(...args) => {
|
|
482
505
|
if (event === "update:modelValue") {
|
|
483
506
|
updateDraft(args[0]);
|
|
507
|
+
} else if (event === "select" && adapter.selectionConfirmation === "select" && !needConfirm.value) {
|
|
508
|
+
emit(event, ...args);
|
|
509
|
+
void session.commit();
|
|
484
510
|
} else if (adapter.commitEvents?.[event]) {
|
|
485
511
|
if (open.value && !blocked.value && !session.pending.value) commitNotifications.set(event, args);
|
|
486
512
|
} else if (event !== "change" && event !== "update:open" && event !== "open-change") {
|
|
@@ -539,12 +565,12 @@ function withFieldPresentation(Base, adapter = {}) {
|
|
|
539
565
|
open: open.value,
|
|
540
566
|
disabled: form.mergedDisabled.value,
|
|
541
567
|
readonly: form.mergedReadonly.value,
|
|
542
|
-
needConfirm:
|
|
568
|
+
needConfirm: showConfirm.value,
|
|
543
569
|
clearable: props.clearable && !selectionPaused.value,
|
|
544
570
|
onClear: clearDraft,
|
|
545
571
|
loading: Boolean(props.loading || adapter.pauseSelectionWhileLoading && source?.loading.value),
|
|
546
572
|
pending: session.pending.value,
|
|
547
|
-
confirmDisabled: selectionPaused.value || !validDraft(session.draft.value),
|
|
573
|
+
confirmDisabled: editorControlPending.value || selectionPaused.value || !validDraft(session.draft.value),
|
|
548
574
|
error: session.error.value || state.item?.message?.value,
|
|
549
575
|
onOpen: setOpen,
|
|
550
576
|
onEditorReady,
|
|
@@ -6,14 +6,13 @@ const FieldDecorator_vue_vue_type_script_setup_true_lang = require("../../field-
|
|
|
6
6
|
const props$1 = require("../../field-decorator/props.js");
|
|
7
7
|
const errorDescription = require("../../form/error-description.js");
|
|
8
8
|
const labelContext = require("../../form/label-context.js");
|
|
9
|
-
const locale_index = require("../../locale/index.js");
|
|
10
|
-
const zhCn = require("../../locale/lang/zh-cn.js");
|
|
11
9
|
const nativeAttrs = require("../../input/native-attrs.js");
|
|
12
10
|
const globalConfig = require("../../_utils/global-config.js");
|
|
13
11
|
const texts = require("../field-presentation/texts.js");
|
|
14
12
|
const openTrigger = require("./open-trigger.js");
|
|
15
13
|
const props = require("./props.js");
|
|
16
14
|
const rangeFieldContext = require("./range-field-context.js");
|
|
15
|
+
const rangeLabels = require("./range-labels.js");
|
|
17
16
|
const _hoisted_1 = ["role", "aria-labelledby"];
|
|
18
17
|
const _hoisted_2 = ["id"];
|
|
19
18
|
const _hoisted_3 = ["id", "value", "placeholder", "disabled", "readonly", "aria-expanded", "aria-invalid", "aria-describedby", "aria-haspopup", "onFocus", "onClick", "onBlur", "onInput", "onCompositionend", "onKeydown"];
|
|
@@ -34,7 +33,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
34
33
|
function inputAttributes(index) {
|
|
35
34
|
const part = { ...props2.inputAttrs?.[index] ?? {} };
|
|
36
35
|
for (const key of ["aria-label", "aria-labelledby"]) {
|
|
37
|
-
if (part[key] === void 0 || part[key] === null)
|
|
36
|
+
if (part[key] === void 0 || part[key] === null) {
|
|
37
|
+
delete part[key];
|
|
38
|
+
}
|
|
38
39
|
}
|
|
39
40
|
const common = nativeAttrs.splitInputAttrs(attrs).native;
|
|
40
41
|
const merged = vue.mergeProps(common, part);
|
|
@@ -76,14 +77,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
76
77
|
});
|
|
77
78
|
const explicitRangeLabel = vue.computed(() => props2.range && formLabel?.value?.target ? groupLabelId.value : void 0);
|
|
78
79
|
const endpointLabelId = (index) => `${generatedId}-range-endpoint-${index}`;
|
|
79
|
-
const
|
|
80
|
-
const endpointLabels = vue.computed(() => {
|
|
81
|
-
const legacy = i18nMessage.value.datePicker?.rangePlaceholder?.[props2.kind] ?? zhCn.default.datePicker.rangePlaceholder[props2.kind];
|
|
82
|
-
return [
|
|
83
|
-
i18nMessage.value.fieldPresentation?.rangeStart ?? legacy[0],
|
|
84
|
-
i18nMessage.value.fieldPresentation?.rangeEnd ?? legacy[1]
|
|
85
|
-
];
|
|
86
|
-
});
|
|
80
|
+
const endpointLabels = rangeLabels.usePickerRangeLabels(() => props2.kind);
|
|
87
81
|
const inputs = [];
|
|
88
82
|
const activeIndex = rangeFieldContext.useRangeFieldIndex(() => props2.disabledParts);
|
|
89
83
|
const active = vue.ref(false);
|
|
@@ -258,7 +252,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
258
252
|
key: 2,
|
|
259
253
|
id: endpointLabelId(index),
|
|
260
254
|
hidden: ""
|
|
261
|
-
}, vue.toDisplayString(endpointLabels
|
|
255
|
+
}, vue.toDisplayString(vue.unref(endpointLabels)[index]), 9, _hoisted_2)) : vue.createCommentVNode("", true),
|
|
262
256
|
vue.createElementVNode("input", vue.mergeProps({ ref_for: true }, inputAttributes(index), {
|
|
263
257
|
id: props2.inputAttrs?.[index]?.id ?? (index === 0 ? controlId.value : controlId.value + "-" + index),
|
|
264
258
|
ref_for: true,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const locale_index = require("../../locale/index.js");
|
|
5
|
+
const zhCn = require("../../locale/lang/zh-cn.js");
|
|
6
|
+
function usePickerRangeLabels(kind) {
|
|
7
|
+
const { i18nMessage } = locale_index.useI18n();
|
|
8
|
+
return vue.computed(() => {
|
|
9
|
+
const legacy = i18nMessage.value.datePicker?.rangePlaceholder?.[kind()] ?? zhCn.default.datePicker.rangePlaceholder[kind()];
|
|
10
|
+
return [
|
|
11
|
+
i18nMessage.value.fieldPresentation?.rangeStart ?? legacy[0],
|
|
12
|
+
i18nMessage.value.fieldPresentation?.rangeEnd ?? legacy[1]
|
|
13
|
+
];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.usePickerRangeLabels = usePickerRangeLabels;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
.c-selected-options__toggle:focus-visible,
|
|
73
73
|
.c-selected-options__clear:focus-visible,
|
|
74
74
|
.c-selected-options__remove:focus-visible {
|
|
75
|
-
outline: 2px solid var(--c-sys-color-
|
|
75
|
+
outline: 2px solid var(--c-sys-color-action-primary);
|
|
76
76
|
outline-offset: 1px;
|
|
77
77
|
}
|
|
78
78
|
.c-selected-options__toggle {
|
|
@@ -208,10 +208,13 @@
|
|
|
208
208
|
white-space: normal;
|
|
209
209
|
overflow-wrap: anywhere;
|
|
210
210
|
}
|
|
211
|
-
.c-selection-editor .c-select-option.c-select-option-selected
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
.c-selection-editor .c-select-option.c-select-option-selected:not(.c-select-option-disabled) {
|
|
212
|
+
background: var(--c-select-popup-option-bg-selected);
|
|
213
|
+
color: var(--c-select-popup-option-text-color-selected);
|
|
214
|
+
}
|
|
215
|
+
.c-selection-editor .c-select-option.c-select-option-selected:not(.c-select-option-disabled):hover,
|
|
216
|
+
.c-selection-editor .c-select-option.c-select-option-selected:not(.c-select-option-disabled).c-select-option-active {
|
|
217
|
+
background: var(--c-select-popup-option-bg-selected-hover);
|
|
215
218
|
}
|
|
216
219
|
.c-selection-editor .c-select-option-disabled {
|
|
217
220
|
opacity: var(--c-selected-options-disabled-opacity);
|
|
@@ -239,9 +242,13 @@
|
|
|
239
242
|
white-space: normal;
|
|
240
243
|
overflow-wrap: anywhere;
|
|
241
244
|
}
|
|
242
|
-
.c-selection-editor .c-cascader-option
|
|
243
|
-
order:
|
|
244
|
-
|
|
245
|
+
.c-selection-editor .c-cascader-option .c-cascader-option-checkbox {
|
|
246
|
+
order: -1;
|
|
247
|
+
flex: none;
|
|
248
|
+
margin-inline-end: var(--c-selection-editor-gap);
|
|
249
|
+
}
|
|
250
|
+
.c-selection-editor .c-cascader-option .c-cascader-option-checkbox .c-checkbox {
|
|
251
|
+
margin-inline-end: 0;
|
|
245
252
|
}
|
|
246
253
|
.c-selection-editor .c-selection-indicator {
|
|
247
254
|
margin: 0;
|
|
@@ -249,11 +256,13 @@
|
|
|
249
256
|
height: var(--c-selection-editor-check-size);
|
|
250
257
|
border-radius: var(--c-selection-editor-radius);
|
|
251
258
|
}
|
|
252
|
-
.c-selection-editor .c-cascader-option.c-cascader-option-selected
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
.c-selection-editor .c-cascader-option.c-cascader-option-selected:not(.c-cascader-option-disabled) {
|
|
260
|
+
background: var(--c-cascader-item-bg-active);
|
|
261
|
+
color: var(--c-cascader-item-text-color-active);
|
|
262
|
+
}
|
|
263
|
+
.c-selection-editor .c-cascader-option.c-cascader-option-selected:not(.c-cascader-option-disabled):hover,
|
|
264
|
+
.c-selection-editor .c-cascader-option.c-cascader-option-selected:not(.c-cascader-option-disabled).c-cascader-option-active {
|
|
265
|
+
background: var(--c-cascader-item-bg-hover);
|
|
257
266
|
}
|
|
258
267
|
.c-selection-editor--mobile {
|
|
259
268
|
width: 100%;
|
|
@@ -268,8 +277,6 @@
|
|
|
268
277
|
.c-selection-editor--mobile .c-select-dropdown .c-select-option,
|
|
269
278
|
.c-selection-editor--mobile .c-cascader-option {
|
|
270
279
|
min-height: var(--c-selection-editor-touch-height);
|
|
271
|
-
border-radius: 0;
|
|
272
|
-
border-bottom: 1px solid var(--c-selection-editor-border);
|
|
273
280
|
font-size: var(--c-selection-editor-touch-font-size);
|
|
274
281
|
}
|
|
275
282
|
.c-selection-editor--mobile .c-selection-indicator {
|
|
@@ -394,3 +401,14 @@
|
|
|
394
401
|
.c-selection-editor--mobile .c-tree-node {
|
|
395
402
|
min-height: var(--c-selection-editor-touch-height);
|
|
396
403
|
}
|
|
404
|
+
.c-selection-editor--select .c-select-dropdown .c-select-dropdown-list-wrapper,
|
|
405
|
+
.c-selection-editor--auto-complete .c-select-dropdown .c-select-dropdown-list-wrapper,
|
|
406
|
+
.c-selection-editor--people-select .c-select-dropdown .c-select-dropdown-list-wrapper {
|
|
407
|
+
padding-inline: var(--c-select-popup-padding-horizontal);
|
|
408
|
+
}
|
|
409
|
+
.c-selection-editor--select.c-selection-editor--mobile .c-select-dropdown .c-select-option,
|
|
410
|
+
.c-selection-editor--auto-complete.c-selection-editor--mobile .c-select-dropdown .c-select-option,
|
|
411
|
+
.c-selection-editor--people-select.c-selection-editor--mobile .c-select-dropdown .c-select-option {
|
|
412
|
+
border-radius: var(--c-select-popup-option-border-radius);
|
|
413
|
+
border-bottom: 0;
|
|
414
|
+
}
|
|
@@ -55,6 +55,7 @@ function useSelectionSession(options) {
|
|
|
55
55
|
if (options.blocked() || settled.value || pending.value || !options.open.value || options.valid?.(draft.value) === false) {
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
|
+
error.value = "";
|
|
58
59
|
const next = options.clone(draft.value);
|
|
59
60
|
const run = ++epoch;
|
|
60
61
|
const finish = (allowed) => {
|
|
@@ -107,6 +107,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
107
107
|
await vue.nextTick();
|
|
108
108
|
updateViewport();
|
|
109
109
|
});
|
|
110
|
+
let retainedInlineOffset;
|
|
111
|
+
let retainedScrollTop;
|
|
110
112
|
let scrollRequest = 0;
|
|
111
113
|
let commandedScroll;
|
|
112
114
|
let mounted = false;
|
|
@@ -117,10 +119,25 @@ const _sfc_main = vue.defineComponent({
|
|
|
117
119
|
vue.onMounted(() => {
|
|
118
120
|
mounted = true;
|
|
119
121
|
});
|
|
120
|
-
vue.onActivated(() => {
|
|
121
|
-
if (
|
|
122
|
+
vue.onActivated(async () => {
|
|
123
|
+
if (disposed) return;
|
|
124
|
+
active = true;
|
|
125
|
+
const element = containerRef.value;
|
|
126
|
+
const request = scrollRequest;
|
|
127
|
+
const retained = retainedScrollTop;
|
|
128
|
+
const retainedInline = retainedInlineOffset;
|
|
129
|
+
retainedScrollTop = void 0;
|
|
130
|
+
retainedInlineOffset = void 0;
|
|
131
|
+
if (element && retainedInline !== void 0 && isCurrent(request, element) && direction.inlineScrollLeft(element) === 0) direction.setInlineScrollLeft(element, retainedInline);
|
|
132
|
+
await vue.nextTick();
|
|
133
|
+
if (element && retained !== void 0 && isCurrent(request, element) && element.scrollTop === 0) {
|
|
134
|
+
element.scrollTop = retained;
|
|
135
|
+
if (virtualEnabled.value) setStart(getStartByScroll(element.scrollTop));
|
|
136
|
+
}
|
|
122
137
|
});
|
|
123
138
|
vue.onDeactivated(() => {
|
|
139
|
+
retainedScrollTop = scrollOffset.value;
|
|
140
|
+
retainedInlineOffset = readingOffset;
|
|
124
141
|
active = false;
|
|
125
142
|
scrollRequest++;
|
|
126
143
|
commandedScroll = void 0;
|
|
@@ -222,6 +239,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
222
239
|
if (is.isNumber(options)) {
|
|
223
240
|
if (Number.isFinite(options)) {
|
|
224
241
|
element.scrollTop = Math.max(0, options);
|
|
242
|
+
scrollOffset.value = element.scrollTop;
|
|
225
243
|
if (virtualEnabled.value) setStart(getStartByScroll(element.scrollTop));
|
|
226
244
|
}
|
|
227
245
|
return;
|
|
@@ -64,6 +64,13 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
64
64
|
element = target;
|
|
65
65
|
if (!target.contains(target.ownerDocument.activeElement)) target.focus({ preventScroll: true });
|
|
66
66
|
}
|
|
67
|
+
function focusAfterEnter() {
|
|
68
|
+
const doc = root()?.ownerDocument;
|
|
69
|
+
const current = doc?.activeElement;
|
|
70
|
+
if (!current || current === doc?.body || current === doc?.documentElement || previous.includes(current)) {
|
|
71
|
+
focus();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
67
74
|
function restore() {
|
|
68
75
|
const focused = owner?.activeElement;
|
|
69
76
|
const target = previous.find(restorable);
|
|
@@ -146,7 +153,7 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
146
153
|
unbind();
|
|
147
154
|
bind();
|
|
148
155
|
}
|
|
149
|
-
if (value) capture();
|
|
156
|
+
if (value && (!captured || root() !== element)) capture();
|
|
150
157
|
}, { flush: "post" });
|
|
151
158
|
vue.onMounted(() => {
|
|
152
159
|
mounted = true;
|
|
@@ -169,6 +176,6 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
169
176
|
unbind();
|
|
170
177
|
restore();
|
|
171
178
|
});
|
|
172
|
-
return { focus, restore, trap };
|
|
179
|
+
return { focus, focusAfterEnter, restore, trap };
|
|
173
180
|
}
|
|
174
181
|
exports.useModalFocus = useModalFocus;
|
|
@@ -46,7 +46,7 @@ function useModalSurface(options) {
|
|
|
46
46
|
mergedZIndex,
|
|
47
47
|
modalDocument
|
|
48
48
|
);
|
|
49
|
-
const { focus, restore } = modalFocus.useModalFocus(
|
|
49
|
+
const { focus, focusAfterEnter, restore } = modalFocus.useModalFocus(
|
|
50
50
|
() => options.root.value?.querySelector("[data-modal-focus-root]") ?? options.root.value,
|
|
51
51
|
() => mergedOpen.value,
|
|
52
52
|
onStackTop,
|
|
@@ -54,7 +54,13 @@ function useModalSurface(options) {
|
|
|
54
54
|
modalDocument
|
|
55
55
|
);
|
|
56
56
|
vue.watch([popupContainerTarget, () => options.popupContainer() === false], () => {
|
|
57
|
-
vue.nextTick(
|
|
57
|
+
vue.nextTick(() => {
|
|
58
|
+
const doc = modalDocument();
|
|
59
|
+
const current = doc?.activeElement;
|
|
60
|
+
if (!current || current === doc?.body || current === doc?.documentElement) {
|
|
61
|
+
focus();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
58
64
|
}, { flush: "post" });
|
|
59
65
|
scrollLock.useScrollLock(
|
|
60
66
|
() => scrollLockTarget.value,
|
|
@@ -128,7 +134,7 @@ function useModalSurface(options) {
|
|
|
128
134
|
vue.onBeforeUnmount(unbind);
|
|
129
135
|
function opened() {
|
|
130
136
|
if (mergedOpen.value) {
|
|
131
|
-
|
|
137
|
+
focusAfterEnter();
|
|
132
138
|
transition.opened();
|
|
133
139
|
}
|
|
134
140
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--c-anchor-title-margin-bottom: var(--c-spacing-1);
|
|
15
15
|
--c-anchor-color-title: var(--c-color-text-2);
|
|
16
16
|
--c-anchor-color-title-hover: rgb(var(--c-primary-5));
|
|
17
|
-
--c-anchor-color-title-active: var(--c-sys-color-
|
|
17
|
+
--c-anchor-color-title-active: var(--c-sys-color-action-primary);
|
|
18
18
|
--c-anchor-font-weight-title-hover: var(--c-font-weight-500);
|
|
19
19
|
--c-anchor-font-weight-title-active: var(--c-font-weight-500);
|
|
20
20
|
--c-anchor-color-bg-title-hover: var(--c-color-fill-2);
|
|
@@ -8,7 +8,7 @@ const useOptionRequest = require("../_hooks/use-option-request.js");
|
|
|
8
8
|
const globalConfig = require("../_utils/global-config.js");
|
|
9
9
|
const is = require("../_utils/is.js");
|
|
10
10
|
const textInputValue = require("../_utils/text-input-value.js");
|
|
11
|
-
const
|
|
11
|
+
const base = require("../input/base.js");
|
|
12
12
|
const useInputForm = require("../input/use-input-form.js");
|
|
13
13
|
const useSelect = require("../select/hooks/use-select.js");
|
|
14
14
|
const Optgroup = require("../select/Optgroup.vue.js");
|
|
@@ -356,7 +356,7 @@ const Base = /* @__PURE__ */ vue.defineComponent({
|
|
|
356
356
|
"aria-activedescendant": computedOpen.value && !loading.value && activeKey.value && enabledOptionKeys.value.includes(activeKey.value) && optionRefs.value[activeKey.value] ? getOptionId(activeKey.value) : void 0,
|
|
357
357
|
autocomplete: "off"
|
|
358
358
|
}));
|
|
359
|
-
const renderInput = (restAttrs) => vue.createVNode(
|
|
359
|
+
const renderInput = (restAttrs) => vue.createVNode(base.default, vue.mergeProps({
|
|
360
360
|
"loading": loading.value,
|
|
361
361
|
"loadingMode": props$1.loadingMode
|
|
362
362
|
}, restAttrs, {
|