@opentiny/vue-renderless 3.14.1 → 3.15.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/LICENSE +22 -0
- package/action-menu/index.js +44 -0
- package/action-menu/vue.js +25 -8
- package/calendar-view/index.js +21 -13
- package/calendar-view/vue.js +6 -3
- package/cascader/index.js +1 -1
- package/cascader-select/index.js +5 -0
- package/cascader-select/vue.js +3 -1
- package/common/deps/vue-popper.js +22 -2
- package/common/index.js +15 -2
- package/common/runtime.js +1 -1
- package/dept/index.js +8 -1
- package/dept/vue.js +10 -1
- package/dialog-box/index.js +12 -6
- package/dialog-box/vue.js +1 -1
- package/dropdown-item/mf.js +2 -2
- package/file-upload/index.js +0 -1
- package/grid/utils/dom.js +30 -10
- package/image/index.js +4 -0
- package/image/vue.js +6 -3
- package/image-viewer/vue.js +3 -1
- package/input/index.js +6 -1
- package/input/vue.js +9 -5
- package/modal/index.js +1 -1
- package/numeric/index.js +5 -18
- package/numeric/vue.js +3 -12
- package/option-group/index.js +13 -0
- package/option-group/vue.js +19 -6
- package/package.json +7 -7
- package/picker/index.js +27 -6
- package/picker/vue.js +2 -2
- package/popconfirm/index.js +6 -0
- package/popconfirm/vue.js +11 -3
- package/popover/index.js +4 -1
- package/popover/vue.js +2 -1
- package/quarter-panel/index.js +61 -0
- package/quarter-panel/vue.js +46 -0
- package/select/index.js +99 -30
- package/select/vue.js +26 -12
- package/skeleton/vue.js +2 -2
- package/skeleton-item/vue.js +1 -1
- package/statistic/index.js +22 -0
- package/statistic/vue.js +20 -0
- package/tabs/index.js +55 -14
- package/tall-storage/index.js +1 -1
- package/time-picker-mobile/index.js +10 -1
- package/time-picker-mobile/vue.js +5 -3
- package/time-spinner/index.js +52 -1
- package/time-spinner/vue.js +4 -2
- package/timeline-item/index.js +14 -1
- package/timeline-item/vue.js +7 -4
- package/tree/index.js +8 -4
- package/tree/vue.js +3 -3
- package/tree-node/index.js +2 -2
- package/types/action-menu.type.d.ts +49 -13
- package/types/date-table.type.d.ts +13 -0
- package/types/dialog-box.type.d.ts +1 -1
- package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-a2dc0099.d.ts → form.type-8e30b25c.d.ts} +1 -0
- package/types/form.type.d.ts +1 -1
- package/types/image.type.d.ts +4 -0
- package/types/input.type.d.ts +3 -1
- package/types/numeric.type.d.ts +4 -5
- package/types/popconfirm.type.d.ts +8 -0
- package/types/popover.type.d.ts +2 -2
- package/types/skeleton.type.d.ts +1 -1
- package/types/statistic.type.d.ts +56 -0
- package/types/tag.type.d.ts +4 -1
- package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/transfer.type.d.ts +3 -3
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-6d6e3d0e.d.ts → upload-list.type-f34997c8.d.ts} +3 -3
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/credit-card/index.js +0 -93
- package/credit-card/vue.js +0 -62
- package/credit-card-form/index.js +0 -112
- package/credit-card-form/vue.js +0 -119
- package/detail-page/index.js +0 -79
- package/detail-page/vue.js +0 -78
- package/slide-bar/index.js +0 -67
- package/slide-bar/vue.js +0 -32
package/input/vue.js
CHANGED
|
@@ -95,8 +95,8 @@ const initState = ({
|
|
|
95
95
|
checkedLabel: "",
|
|
96
96
|
enteredTextarea: false,
|
|
97
97
|
sheetvalue: props.modelValue,
|
|
98
|
-
inputSize: computed(() => props.size || state.formItemSize),
|
|
99
|
-
inputSizeMf: computed(() => props.size || (parent.tinyForm || {}).size),
|
|
98
|
+
inputSize: computed(() => props.size || state.formItemSize || (parent.tinyForm || {}).size),
|
|
99
|
+
inputSizeMf: computed(() => props.size || state.formItemSize || (parent.tinyForm || {}).size),
|
|
100
100
|
showClear: computed(
|
|
101
101
|
() => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
|
|
102
102
|
),
|
|
@@ -179,7 +179,9 @@ const mergeApi = ({
|
|
|
179
179
|
nextTick,
|
|
180
180
|
parent,
|
|
181
181
|
state,
|
|
182
|
-
vm
|
|
182
|
+
vm,
|
|
183
|
+
mode,
|
|
184
|
+
constants
|
|
183
185
|
}) => {
|
|
184
186
|
const { storageData, isMemoryStorage, addMemory, searchMemory, selectedMemory } = storages;
|
|
185
187
|
return Object.assign(api2, {
|
|
@@ -208,7 +210,9 @@ const mergeApi = ({
|
|
|
208
210
|
api: api2,
|
|
209
211
|
hiddenTextarea: null,
|
|
210
212
|
props,
|
|
211
|
-
state
|
|
213
|
+
state,
|
|
214
|
+
mode,
|
|
215
|
+
constants
|
|
212
216
|
}),
|
|
213
217
|
setNativeInputValue: setNativeInputValue({ api: api2, state }),
|
|
214
218
|
handleCompositionEnd: handleCompositionEnd({ api: api2, state }),
|
|
@@ -300,7 +304,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, toRefs, w
|
|
|
300
304
|
initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm, nextTick });
|
|
301
305
|
const storages = useStorageBox({ api: api2, props, reactive, toRefs });
|
|
302
306
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
303
|
-
mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm });
|
|
307
|
+
mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm, mode, constants });
|
|
304
308
|
initWatch({ watch, state, api: api2, props, nextTick, emit, componentName, eventName });
|
|
305
309
|
onMounted(() => {
|
|
306
310
|
api2.setNativeInputValue();
|
package/modal/index.js
CHANGED
package/numeric/index.js
CHANGED
|
@@ -16,14 +16,11 @@ const initService = (service) => {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
const getDecimal = (props) => (value) => getMiniDecimal(value, props.plugin);
|
|
19
|
-
const watchValue = ({ api, props, state
|
|
19
|
+
const watchValue = ({ api, props, state }) => (value) => {
|
|
20
20
|
if (value === state.currentValue) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
api.setCurrentValue(value, props.changeCompat);
|
|
24
|
-
nextTick(() => {
|
|
25
|
-
api.dispatchDisplayedValue();
|
|
26
|
-
});
|
|
27
24
|
};
|
|
28
25
|
const toPrecision = (state) => ({ num, precision }) => {
|
|
29
26
|
if (precision === void 0) {
|
|
@@ -132,10 +129,10 @@ const focus = (vm) => () => {
|
|
|
132
129
|
vm.$refs.input.focus();
|
|
133
130
|
};
|
|
134
131
|
const getEmitValue = (args) => {
|
|
135
|
-
let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal } = args;
|
|
132
|
+
let { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal, emptyValue } = args;
|
|
136
133
|
let { max, min, api, props, format, plugin, stringMode } = args;
|
|
137
134
|
if (!newVal && newVal !== 0) {
|
|
138
|
-
emitValue = allowEmpty ?
|
|
135
|
+
emitValue = allowEmpty ? emptyValue : defaultVal;
|
|
139
136
|
} else if (bigNew.isNaN()) {
|
|
140
137
|
emitValue = oldVal;
|
|
141
138
|
} else {
|
|
@@ -166,7 +163,7 @@ const setCurrentValue = ({
|
|
|
166
163
|
props,
|
|
167
164
|
state
|
|
168
165
|
}) => (newVal, emitChangeFlag = true) => {
|
|
169
|
-
const { max, min, allowEmpty, validateEvent, stringMode, plugin } = props;
|
|
166
|
+
const { max, min, allowEmpty, validateEvent, stringMode, plugin, emptyValue } = props;
|
|
170
167
|
const { format } = state;
|
|
171
168
|
const oldVal = state.currentValue;
|
|
172
169
|
const bigNew = api.getDecimal(newVal);
|
|
@@ -176,7 +173,7 @@ const setCurrentValue = ({
|
|
|
176
173
|
state.userInput = state.currentValue;
|
|
177
174
|
return;
|
|
178
175
|
}
|
|
179
|
-
let args = { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal };
|
|
176
|
+
let args = { newVal, emitValue, allowEmpty, defaultVal, bigNew, oldVal, emptyValue };
|
|
180
177
|
Object.assign(args, { max, min, api, props, format, plugin, stringMode });
|
|
181
178
|
let ret = getEmitValue(args);
|
|
182
179
|
newVal = ret.newVal;
|
|
@@ -321,14 +318,6 @@ const getUnitPrecision = ({
|
|
|
321
318
|
rounding = isNumber(format.rounding) ? format.rounding : serFra.rounding;
|
|
322
319
|
return __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, defaultFmt), { fraction, rounding }), serFmt), format);
|
|
323
320
|
};
|
|
324
|
-
const dispatchDisplayedValue = ({ state, api, dispatch }) => () => {
|
|
325
|
-
if (state.isDisplayOnly) {
|
|
326
|
-
dispatch("FormItem", "displayed-value-changed", { type: "numeric", val: api.getDisplayedValue() });
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
const getDisplayedValue = ({ state, props }) => () => {
|
|
330
|
-
return state.displayValue || state.displayValue === 0 ? state.displayValue + " " + (props.unit || "") : "-";
|
|
331
|
-
};
|
|
332
321
|
const getDisplayOnlyText = ({ parent, state, props }) => () => {
|
|
333
322
|
const showEmptyValue = props.showEmptyValue || (parent.tinyForm || {}).showEmptyValue;
|
|
334
323
|
if (showEmptyValue) {
|
|
@@ -356,13 +345,11 @@ const handleChange = ({ state, emit }) => () => {
|
|
|
356
345
|
};
|
|
357
346
|
export {
|
|
358
347
|
decrease,
|
|
359
|
-
dispatchDisplayedValue,
|
|
360
348
|
displayValue,
|
|
361
349
|
filterValue,
|
|
362
350
|
focus,
|
|
363
351
|
getDecimal,
|
|
364
352
|
getDisplayOnlyText,
|
|
365
|
-
getDisplayedValue,
|
|
366
353
|
getNumPecision,
|
|
367
354
|
getPrecision,
|
|
368
355
|
getUnitPrecision,
|
package/numeric/vue.js
CHANGED
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
getDecimal,
|
|
24
24
|
unmounted,
|
|
25
25
|
initService,
|
|
26
|
-
dispatchDisplayedValue,
|
|
27
|
-
getDisplayedValue,
|
|
28
26
|
getDisplayOnlyText,
|
|
29
27
|
filterValue,
|
|
30
28
|
handleClear,
|
|
@@ -112,10 +110,8 @@ const initApi = ({
|
|
|
112
110
|
handleInputChange: handleInputChange({ api: api2, state, props }),
|
|
113
111
|
mouseEvent: mouseEvent({ api: api2, props, state }),
|
|
114
112
|
handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
|
|
115
|
-
watchValue: watchValue({ api: api2, props, state
|
|
113
|
+
watchValue: watchValue({ api: api2, props, state }),
|
|
116
114
|
setCurrentValue: setCurrentValue({ api: api2, constants, dispatch, emit, props, state }),
|
|
117
|
-
dispatchDisplayedValue: dispatchDisplayedValue({ api: api2, state, dispatch }),
|
|
118
|
-
getDisplayedValue: getDisplayedValue({ state, props }),
|
|
119
115
|
getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
|
|
120
116
|
filterValue: filterValue({ state }),
|
|
121
117
|
handleClear: handleClear({ state, emit }),
|
|
@@ -124,7 +120,6 @@ const initApi = ({
|
|
|
124
120
|
api2.getDecimal(0);
|
|
125
121
|
};
|
|
126
122
|
const initWatch = ({
|
|
127
|
-
state,
|
|
128
123
|
watch,
|
|
129
124
|
props,
|
|
130
125
|
api: api2
|
|
@@ -139,7 +134,6 @@ const initWatch = ({
|
|
|
139
134
|
{ immediate: true }
|
|
140
135
|
);
|
|
141
136
|
watch(() => props.modelValue, api2.watchValue, { immediate: true });
|
|
142
|
-
watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
|
|
143
137
|
};
|
|
144
138
|
const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reactive, watch, inject }, { parent, emit, vm, constants, dispatch, service, nextTick }) => {
|
|
145
139
|
const api2 = {};
|
|
@@ -147,11 +141,8 @@ const renderless = (props, { computed, onMounted, onUpdated, onUnmounted, reacti
|
|
|
147
141
|
const state = initState({ reactive, computed, props, api: api2, constants, $service, parent });
|
|
148
142
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
149
143
|
initApi({ api: api2, props, state, parent, vm, emit, dispatch, constants, nextTick });
|
|
150
|
-
initWatch({
|
|
151
|
-
onMounted(
|
|
152
|
-
api2.dispatchDisplayedValue();
|
|
153
|
-
api2.mounted();
|
|
154
|
-
});
|
|
144
|
+
initWatch({ watch, props, api: api2 });
|
|
145
|
+
onMounted(api2.mounted);
|
|
155
146
|
onUpdated(api2.updated);
|
|
156
147
|
onUnmounted(api2.unmounted);
|
|
157
148
|
return api2;
|
package/option-group/index.js
CHANGED
|
@@ -10,6 +10,19 @@ const queryChange = ({ select, state, vm }) => () => {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
+
const observeCallback = ({ state, api }) => (mutationsList) => {
|
|
14
|
+
for (let mutation of mutationsList) {
|
|
15
|
+
if (mutation.type === "childList") {
|
|
16
|
+
if (state.timer) {
|
|
17
|
+
clearTimeout(state.timer);
|
|
18
|
+
}
|
|
19
|
+
state.timer = setTimeout(() => {
|
|
20
|
+
api.queryChange();
|
|
21
|
+
}, 100);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
13
25
|
export {
|
|
26
|
+
observeCallback,
|
|
14
27
|
queryChange
|
|
15
28
|
};
|
package/option-group/vue.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { queryChange } from "./index";
|
|
2
|
+
import { queryChange, observeCallback } from "./index";
|
|
3
3
|
const api = ["state", "queryChange"];
|
|
4
|
-
const renderless = (props, { onMounted, reactive, watch, inject }, { broadcast, vm }) => {
|
|
4
|
+
const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject }, { broadcast, vm }) => {
|
|
5
5
|
const select = inject("select");
|
|
6
6
|
const constants = select._constants;
|
|
7
7
|
const state = reactive({
|
|
8
|
-
visible: true
|
|
8
|
+
visible: true,
|
|
9
|
+
timer: null
|
|
9
10
|
});
|
|
10
|
-
const api2 = {
|
|
11
|
+
const api2 = {};
|
|
12
|
+
Object.assign(api2, {
|
|
11
13
|
state,
|
|
12
|
-
queryChange: queryChange({ select, state, vm })
|
|
13
|
-
|
|
14
|
+
queryChange: queryChange({ select, state, vm }),
|
|
15
|
+
observeCallback: observeCallback({ state, api: api2 })
|
|
16
|
+
});
|
|
14
17
|
watch(
|
|
15
18
|
() => props.disabled,
|
|
16
19
|
(value) => {
|
|
@@ -19,11 +22,21 @@ const renderless = (props, { onMounted, reactive, watch, inject }, { broadcast,
|
|
|
19
22
|
{ immediate: true }
|
|
20
23
|
);
|
|
21
24
|
onMounted(() => {
|
|
25
|
+
if (select.filterable) {
|
|
26
|
+
const config = { attributes: false, childList: true, subtree: false };
|
|
27
|
+
api2.observer = new MutationObserver(api2.observeCallback);
|
|
28
|
+
if (vm.$refs.selectGroup) {
|
|
29
|
+
api2.observer.observe(vm.$refs.selectGroup, config);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
22
32
|
if (props.disabled) {
|
|
23
33
|
broadcast(constants.COMPONENT_NAME.Option, constants.EVENT_NAME.handleGroupDisabled, props.disabled);
|
|
24
34
|
}
|
|
25
35
|
select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
|
|
26
36
|
});
|
|
37
|
+
onBeforeUnmount(() => {
|
|
38
|
+
api2.observer && api2.observer.disconnect();
|
|
39
|
+
});
|
|
27
40
|
return api2;
|
|
28
41
|
};
|
|
29
42
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.1",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
"url": "https://github.com/opentiny/tiny-vue/issues"
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsup",
|
|
29
|
-
"build:fast": "npm run build && npm run release",
|
|
30
|
-
"postversion": "pnpm build",
|
|
31
|
-
"release": "esno ./scripts/postbuild.ts && shx cp README.md dist"
|
|
32
|
-
},
|
|
33
27
|
"dependencies": {
|
|
34
28
|
"xss": "1.0.11",
|
|
35
29
|
"color": "4.2.3"
|
|
@@ -37,5 +31,11 @@
|
|
|
37
31
|
"devDependencies": {
|
|
38
32
|
"esno": "^0.16.3",
|
|
39
33
|
"tsup": "7.2.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
37
|
+
"build:fast": "npm run build && npm run release",
|
|
38
|
+
"postversion": "pnpm build",
|
|
39
|
+
"release": "esno ./scripts/postbuild.ts && shx cp README.md dist"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/picker/index.js
CHANGED
|
@@ -10,7 +10,16 @@ import { formatDate, parseDate, isDateObject, getWeekNumber, prevDate, nextDate
|
|
|
10
10
|
import { extend } from "../common/object";
|
|
11
11
|
import globalTimezone from "./timezone";
|
|
12
12
|
const iso8601Reg = /^\d{4}-\d{2}-\d{2}(.)\d{2}:\d{2}:\d{2}(.+)$/;
|
|
13
|
-
const getPanel = ({
|
|
13
|
+
const getPanel = ({
|
|
14
|
+
DatePanel,
|
|
15
|
+
DateRangePanel,
|
|
16
|
+
MonthRangePanel,
|
|
17
|
+
YearRangePanel,
|
|
18
|
+
TimePanel,
|
|
19
|
+
TimeRangePanel,
|
|
20
|
+
QuarterPanel,
|
|
21
|
+
TimeSelect
|
|
22
|
+
}) => (type) => {
|
|
14
23
|
if (type === DATEPICKER.DateRange || type === DATEPICKER.DateTimeRange) {
|
|
15
24
|
return DateRangePanel;
|
|
16
25
|
} else if (type === DATEPICKER.MonthRange) {
|
|
@@ -23,14 +32,18 @@ const getPanel = ({ DatePanel, DateRangePanel, MonthRangePanel, YearRangePanel,
|
|
|
23
32
|
return TimePanel;
|
|
24
33
|
} else if (type === DATEPICKER.TimeSelect) {
|
|
25
34
|
return TimeSelect;
|
|
35
|
+
} else if (type === DATEPICKER.Quarter) {
|
|
36
|
+
return QuarterPanel;
|
|
26
37
|
}
|
|
27
38
|
return DatePanel;
|
|
28
39
|
};
|
|
29
|
-
const watchMobileVisible = ({ api, props, state }) => ([dateMobileVisible, timeMobileVisible]) => {
|
|
40
|
+
const watchMobileVisible = ({ api, props, state, nextTick }) => ([dateMobileVisible, timeMobileVisible]) => {
|
|
30
41
|
if (dateMobileVisible || timeMobileVisible) {
|
|
31
42
|
state.valueOnOpen = Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue;
|
|
32
43
|
} else {
|
|
33
|
-
|
|
44
|
+
nextTick(() => {
|
|
45
|
+
api.emitChange(props.modelValue);
|
|
46
|
+
});
|
|
34
47
|
}
|
|
35
48
|
};
|
|
36
49
|
const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick }) => (value) => {
|
|
@@ -41,7 +54,9 @@ const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick })
|
|
|
41
54
|
state.valueOnOpen = Array.isArray(props.modelValue) ? [...props.modelValue] : props.modelValue;
|
|
42
55
|
} else {
|
|
43
56
|
api.hidePicker();
|
|
44
|
-
nextTick(() =>
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
api.emitChange(props.modelValue);
|
|
59
|
+
});
|
|
45
60
|
state.userInput = null;
|
|
46
61
|
if (props.validateEvent) {
|
|
47
62
|
dispatch("FormItem", "form.blur");
|
|
@@ -132,7 +147,9 @@ const parsedValue = ({ api, props, state, t }) => () => {
|
|
|
132
147
|
return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
|
|
133
148
|
});
|
|
134
149
|
} else {
|
|
135
|
-
|
|
150
|
+
if (state.valueFormat !== DATEPICKER.TimesTamp) {
|
|
151
|
+
date = formatDate(date, state.valueFormat, t);
|
|
152
|
+
}
|
|
136
153
|
}
|
|
137
154
|
}
|
|
138
155
|
const result = api.parseAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
|
|
@@ -313,7 +330,11 @@ const typeValueResolveMap = ({ api, props, t }) => () => ({
|
|
|
313
330
|
years: getDatesOfTypeValueResolveMap(api),
|
|
314
331
|
yearrange: getDatesOfTypeValueResolveMap(api),
|
|
315
332
|
number: getNumberOfTypeValueResolveMap(),
|
|
316
|
-
dates: getDatesOfTypeValueResolveMap(api)
|
|
333
|
+
dates: getDatesOfTypeValueResolveMap(api),
|
|
334
|
+
quarter: {
|
|
335
|
+
formatter: (value) => `${value.getFullYear()}-Q${DATEPICKER.MonthQuarterMap[value.getMonth()]}`,
|
|
336
|
+
parser: api.dateParser
|
|
337
|
+
}
|
|
317
338
|
});
|
|
318
339
|
const firstInputId = ({ props, state }) => () => {
|
|
319
340
|
const obj = {};
|
package/picker/vue.js
CHANGED
|
@@ -189,7 +189,7 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent
|
|
|
189
189
|
displayValue: displayValue({ api: api2, props, state }),
|
|
190
190
|
handlePick: handlePick({ api: api2, state }),
|
|
191
191
|
watchPickerVisible: watchPickerVisible({ api: api2, vm, dispatch, emit, props, state, nextTick }),
|
|
192
|
-
watchMobileVisible: watchMobileVisible({ api: api2, props, state }),
|
|
192
|
+
watchMobileVisible: watchMobileVisible({ api: api2, props, state, nextTick }),
|
|
193
193
|
formatToString: formatToString({ api: api2, state }),
|
|
194
194
|
watchIsRange: watchIsRange({ api: api2, state, TimePanel, TimeRangePanel }),
|
|
195
195
|
mountPicker: mountPicker({ api: api2, vm, props, state, updatePopper }),
|
|
@@ -198,7 +198,7 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils, parent
|
|
|
198
198
|
computedTriggerClass: computedTriggerClass({ props, state }),
|
|
199
199
|
computedHaveTrigger: computedHaveTrigger({ props }),
|
|
200
200
|
setInputPaddingLeft: setInputPaddingLeft({ props, state, vm, nextTick }),
|
|
201
|
-
formatInputValue: formatInputValue({ props, state
|
|
201
|
+
formatInputValue: formatInputValue({ props, state })
|
|
202
202
|
});
|
|
203
203
|
initApi2({ api: api2, props, state, t, parent });
|
|
204
204
|
initMobileApi({ api: api2, props, state, t, parent });
|
package/popconfirm/index.js
CHANGED
|
@@ -24,8 +24,14 @@ const handleEmit = ({ state, emit, vm }) => (type) => {
|
|
|
24
24
|
emit(type, state);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
const handleDocumentClick = ({ vm, api }) => (event) => {
|
|
28
|
+
if (vm.$refs.popover.handleDocumentClick(event)) {
|
|
29
|
+
api.hide();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
27
32
|
export {
|
|
28
33
|
confirm,
|
|
34
|
+
handleDocumentClick,
|
|
29
35
|
handleEmit,
|
|
30
36
|
hide,
|
|
31
37
|
show
|
package/popconfirm/vue.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
2
|
+
import { on, off } from "../common/deps/dom";
|
|
3
|
+
import { show, hide, confirm, handleEmit, handleDocumentClick } from "./index";
|
|
3
4
|
const api = ["state", "show", "hide", "confirm", "handleEmit"];
|
|
4
|
-
const renderless = (props, { computed, reactive }, { emit, constants, designConfig, vm }) => {
|
|
5
|
+
const renderless = (props, { computed, reactive, onMounted, onBeforeUnmount }, { emit, constants, designConfig, vm }) => {
|
|
5
6
|
var _a;
|
|
6
7
|
const api2 = {};
|
|
7
8
|
const designIcon = (_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a[props.type];
|
|
@@ -17,7 +18,14 @@ const renderless = (props, { computed, reactive }, { emit, constants, designConf
|
|
|
17
18
|
show: show({ state, emit, props }),
|
|
18
19
|
hide: hide({ state, emit }),
|
|
19
20
|
confirm: confirm({ state, api: api2 }),
|
|
20
|
-
handleEmit: handleEmit({ state, emit, vm })
|
|
21
|
+
handleEmit: handleEmit({ state, emit, vm }),
|
|
22
|
+
handleDocumentClick: handleDocumentClick({ api: api2, vm })
|
|
23
|
+
});
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
props.closeOnClickOutside && on(document, "click", api2.handleDocumentClick);
|
|
26
|
+
});
|
|
27
|
+
onBeforeUnmount(() => {
|
|
28
|
+
props.closeOnClickOutside && off(document, "click", api2.handleDocumentClick);
|
|
21
29
|
});
|
|
22
30
|
return api2;
|
|
23
31
|
};
|
package/popover/index.js
CHANGED
|
@@ -127,7 +127,10 @@ const handleDocumentClick = ({ vm, state }) => (event) => {
|
|
|
127
127
|
target = state.webCompEventTarget;
|
|
128
128
|
}
|
|
129
129
|
if (!$el || !reference || $el.contains(target) || reference.contains(target) || !popperElm || popperElm.contains(target)) {
|
|
130
|
-
return;
|
|
130
|
+
return false;
|
|
131
|
+
} else {
|
|
132
|
+
state.showPopper = false;
|
|
133
|
+
return true;
|
|
131
134
|
}
|
|
132
135
|
state.showPopper = false;
|
|
133
136
|
};
|
package/popover/vue.js
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { modifyDate, nextYear, prevYear } from "../common/deps/date-util";
|
|
3
|
+
import { DATEPICKER } from "../common";
|
|
4
|
+
const getTarget = (event) => {
|
|
5
|
+
let target = event.target;
|
|
6
|
+
const tagName = target.tagName;
|
|
7
|
+
if (tagName === "A") {
|
|
8
|
+
target = target.parentNode.parentNode;
|
|
9
|
+
}
|
|
10
|
+
if (tagName === "DIV") {
|
|
11
|
+
target = target.parentNode;
|
|
12
|
+
}
|
|
13
|
+
if (target.tagName !== "TD") {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
const handleQuarterTableClick = ({ state, emit }) => (event) => {
|
|
19
|
+
const target = getTarget(event);
|
|
20
|
+
const currentDate = new Date(state.date.getFullYear(), DATEPICKER.QuarterMap[target.cellIndex], 1);
|
|
21
|
+
state.value = currentDate;
|
|
22
|
+
emit("pick", currentDate);
|
|
23
|
+
};
|
|
24
|
+
const showYearPicker = ({ state }) => () => state.currentView = DATEPICKER.Year;
|
|
25
|
+
const cusPrevYear = ({ state }) => () => {
|
|
26
|
+
if (state.currentView === DATEPICKER.Year) {
|
|
27
|
+
state.startYear = state.startYear - DATEPICKER.PanelYearNum;
|
|
28
|
+
} else {
|
|
29
|
+
state.date = prevYear(state.date);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const cusNextYear = ({ state }) => () => {
|
|
33
|
+
if (state.currentView === DATEPICKER.Year) {
|
|
34
|
+
state.startYear = state.startYear + DATEPICKER.PanelYearNum;
|
|
35
|
+
} else {
|
|
36
|
+
state.date = nextYear(state.date);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const handleYearPick = ({ state }) => (value) => {
|
|
40
|
+
state.currentView = DATEPICKER.Quarter;
|
|
41
|
+
state.date = modifyDate(state.date, value, state.date.getMonth(), state.date.getDate());
|
|
42
|
+
};
|
|
43
|
+
const getYearLabel = ({ state, t }) => () => {
|
|
44
|
+
return state.date.getFullYear();
|
|
45
|
+
};
|
|
46
|
+
const getCellStyle = ({ api, props, state }) => (cell) => {
|
|
47
|
+
const year = state.date.getFullYear();
|
|
48
|
+
const quarter = cell.text.slice(1) - 1;
|
|
49
|
+
const style = {};
|
|
50
|
+
style.current = state.value && state.value.getFullYear() === year && state.value.getMonth() === DATEPICKER.QuarterMap[quarter];
|
|
51
|
+
return style;
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
cusNextYear,
|
|
55
|
+
cusPrevYear,
|
|
56
|
+
getCellStyle,
|
|
57
|
+
getYearLabel,
|
|
58
|
+
handleQuarterTableClick,
|
|
59
|
+
handleYearPick,
|
|
60
|
+
showYearPicker
|
|
61
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { DATEPICKER } from "../common";
|
|
3
|
+
import {
|
|
4
|
+
handleQuarterTableClick,
|
|
5
|
+
showYearPicker,
|
|
6
|
+
handleYearPick,
|
|
7
|
+
cusPrevYear,
|
|
8
|
+
cusNextYear,
|
|
9
|
+
getYearLabel,
|
|
10
|
+
getCellStyle
|
|
11
|
+
} from "./index";
|
|
12
|
+
const api = [
|
|
13
|
+
"state",
|
|
14
|
+
"handleQuarterTableClick",
|
|
15
|
+
"showYearPicker",
|
|
16
|
+
"handleYearPick",
|
|
17
|
+
"cusPrevYear",
|
|
18
|
+
"cusNextYear",
|
|
19
|
+
"getCellStyle"
|
|
20
|
+
];
|
|
21
|
+
const renderless = (props, { reactive, computed }, { emit, t }) => {
|
|
22
|
+
const api2 = {};
|
|
23
|
+
const state = reactive({
|
|
24
|
+
date: /* @__PURE__ */ new Date(),
|
|
25
|
+
visible: false,
|
|
26
|
+
currentView: DATEPICKER.Quarter,
|
|
27
|
+
yearLabel: computed(() => api2.getYearLabel()),
|
|
28
|
+
startYear: Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 10) * 10,
|
|
29
|
+
rows: [{ text: "Q1" }, { text: "Q2" }, { text: "Q3" }, { text: "Q4" }]
|
|
30
|
+
});
|
|
31
|
+
Object.assign(api2, {
|
|
32
|
+
state,
|
|
33
|
+
handleQuarterTableClick: handleQuarterTableClick({ state, emit }),
|
|
34
|
+
showYearPicker: showYearPicker({ state }),
|
|
35
|
+
handleYearPick: handleYearPick({ state }),
|
|
36
|
+
cusPrevYear: cusPrevYear({ state }),
|
|
37
|
+
cusNextYear: cusNextYear({ state }),
|
|
38
|
+
getYearLabel: getYearLabel({ state, t }),
|
|
39
|
+
getCellStyle: getCellStyle({ api: api2, props, state })
|
|
40
|
+
});
|
|
41
|
+
return api2;
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
api,
|
|
45
|
+
renderless
|
|
46
|
+
};
|