rx-compo 1.0.52 → 1.0.54
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/entry/types/index.d.ts +0 -1
- package/es/components/RxButton/index.js +16 -25
- package/es/components/RxCheckbox/index.js +3712 -0
- package/es/components/RxCheckboxGroup/index.js +6430 -0
- package/es/components/RxDatePicker/index.js +13042 -0
- package/es/components/RxInput/index.js +1560 -0
- package/es/components/RxOption/index.js +8859 -0
- package/es/components/RxRadio/index.js +646 -0
- package/es/components/RxRadioButton/index.js +646 -0
- package/es/components/RxRadioGroup/index.js +1117 -0
- package/es/components/RxScrollbar/index.js +867 -0
- package/es/components/RxSelect/index.js +9022 -0
- package/es/components/RxSelectPlus/index.js +17471 -0
- package/es/components/RxSuperCondition/index.js +8690 -0
- package/es/components/RxTooltip/index.js +2470 -0
- package/es/components/index.js +13 -0
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/utils/useContext.d.ts +10 -0
- package/es/utils/useContext.js +13 -0
- package/es/utils/useTextOverflow.d.ts +4 -0
- package/es/utils/useTextOverflow.js +13 -0
- package/es/utils/with-install.d.ts +3 -0
- package/es/utils/with-install.js +7 -0
- package/index.esm.js +43171 -1577
- package/index.js +43192 -1585
- package/lib/components/RxButton/index.js +15 -24
- package/lib/components/RxCheckbox/index.js +3717 -0
- package/lib/components/RxCheckboxGroup/index.js +6435 -0
- package/lib/components/RxDatePicker/index.js +13047 -0
- package/lib/components/RxInput/index.js +1565 -0
- package/lib/components/RxOption/index.js +8864 -0
- package/lib/components/RxRadio/index.js +651 -0
- package/lib/components/RxRadioButton/index.js +651 -0
- package/lib/components/RxRadioGroup/index.js +1122 -0
- package/lib/components/RxScrollbar/index.js +872 -0
- package/lib/components/RxSelect/index.js +9027 -0
- package/lib/components/RxSelectPlus/index.js +17476 -0
- package/lib/components/RxSuperCondition/index.js +8695 -0
- package/lib/components/RxTooltip/index.js +2475 -0
- package/lib/components/index.js +91 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/utils/useContext.d.ts +10 -0
- package/lib/utils/useContext.js +18 -0
- package/lib/utils/useTextOverflow.d.ts +4 -0
- package/lib/utils/useTextOverflow.js +17 -0
- package/lib/utils/with-install.d.ts +3 -0
- package/lib/utils/with-install.js +11 -0
- package/package.json +4 -2
- package/theme-chalk/css/index.css +1 -1
- package/theme-chalk/css/rx-button.css +1 -0
- package/theme-chalk/css/rx-checkbox-group.css +1 -0
- package/theme-chalk/css/rx-checkbox.css +1 -0
- package/theme-chalk/css/rx-date-picker.css +0 -0
- package/theme-chalk/css/rx-input.css +1 -0
- package/theme-chalk/css/rx-option.css +1 -0
- package/theme-chalk/css/rx-radio-button.css +0 -0
- package/theme-chalk/css/rx-radio-group.css +1 -0
- package/theme-chalk/css/rx-radio.css +1 -0
- package/theme-chalk/css/rx-scrollbar.css +0 -0
- package/theme-chalk/css/rx-select.css +1 -0
- package/theme-chalk/css/rx-super-condition.css +0 -0
- package/theme-chalk/css/rx-tooltip.css +0 -0
- package/es/components/RxButton/index.d.ts +0 -3
- package/es/components/RxButton/src/index.d.ts +0 -3
- package/es/components/RxButton/src/index.vue.d.ts +0 -10
- package/es/components/index.d.ts +0 -2
- package/lib/components/RxButton/index.d.ts +0 -3
- package/lib/components/RxButton/src/index.d.ts +0 -3
- package/lib/components/RxButton/src/index.vue.d.ts +0 -10
- package/lib/components/index.d.ts +0 -2
- package/types/components/RxButton/index.d.ts +0 -3
- package/types/components/RxButton/src/index.d.ts +0 -3
- package/types/components/RxButton/src/index.vue.d.ts +0 -10
- package/types/components/index.d.ts +0 -2
- package/types/utils/with-install.d.ts +0 -3
|
@@ -0,0 +1,1117 @@
|
|
|
1
|
+
import { withInstall as withInstall$1 } from 'rx-compo/es/utils/with-install';
|
|
2
|
+
import { warn, inject, ref, computed, unref, getCurrentInstance, onMounted, watch, toRef, onUnmounted, defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withDirectives, isRef, vModelRadio, withModifiers, renderSlot, createTextVNode, toDisplayString, nextTick, normalizeStyle, provide, reactive, toRefs, createBlock, resolveDynamicComponent, withCtx, resolveComponent, mergeProps, createSlots, Fragment, renderList, createCommentVNode } from 'vue';
|
|
3
|
+
import { getCurrentInstance as getCurrentInstance$1, isVue2, ref as ref$1, watch as watch$1, computed as computed$1 } from 'vue-demi';
|
|
4
|
+
|
|
5
|
+
const RxRadioGroupProps = {
|
|
6
|
+
radioGutter: Number,
|
|
7
|
+
radioSpan: Number,
|
|
8
|
+
radioGroupData: {
|
|
9
|
+
type: Array,
|
|
10
|
+
default: []
|
|
11
|
+
},
|
|
12
|
+
value: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ''
|
|
15
|
+
},
|
|
16
|
+
radioType: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'radio'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var _a;
|
|
23
|
+
const isClient$1 = typeof window !== "undefined";
|
|
24
|
+
isClient$1 && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
25
|
+
|
|
26
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
27
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
28
|
+
const NOOP = () => {
|
|
29
|
+
};
|
|
30
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
31
|
+
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
32
|
+
const isString = (val) => typeof val === "string";
|
|
33
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The inverse of `_.toPairs`; this method returns an object composed
|
|
37
|
+
* from key-value `pairs`.
|
|
38
|
+
*
|
|
39
|
+
* @static
|
|
40
|
+
* @memberOf _
|
|
41
|
+
* @since 4.0.0
|
|
42
|
+
* @category Array
|
|
43
|
+
* @param {Array} pairs The key-value pairs.
|
|
44
|
+
* @returns {Object} Returns the new object.
|
|
45
|
+
* @example
|
|
46
|
+
*
|
|
47
|
+
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
48
|
+
* // => { 'a': 1, 'b': 2 }
|
|
49
|
+
*/
|
|
50
|
+
function fromPairs(pairs) {
|
|
51
|
+
var index = -1,
|
|
52
|
+
length = pairs == null ? 0 : pairs.length,
|
|
53
|
+
result = {};
|
|
54
|
+
|
|
55
|
+
while (++index < length) {
|
|
56
|
+
var pair = pairs[index];
|
|
57
|
+
result[pair[0]] = pair[1];
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
63
|
+
const isNumber = (val) => typeof val === "number";
|
|
64
|
+
|
|
65
|
+
class ElementPlusError extends Error {
|
|
66
|
+
constructor(m) {
|
|
67
|
+
super(m);
|
|
68
|
+
this.name = "ElementPlusError";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function debugWarn(scope, message) {
|
|
72
|
+
if (process.env.NODE_ENV !== "production") {
|
|
73
|
+
const error = isString(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
|
|
74
|
+
console.warn(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const epPropKey = "__epPropKey";
|
|
79
|
+
const definePropType = (val) => val;
|
|
80
|
+
const isEpProp = (val) => isObject(val) && !!val[epPropKey];
|
|
81
|
+
const buildProp = (prop, key) => {
|
|
82
|
+
if (!isObject(prop) || isEpProp(prop))
|
|
83
|
+
return prop;
|
|
84
|
+
const { values, required, default: defaultValue, type, validator } = prop;
|
|
85
|
+
const _validator = values || validator ? (val) => {
|
|
86
|
+
let valid = false;
|
|
87
|
+
let allowedValues = [];
|
|
88
|
+
if (values) {
|
|
89
|
+
allowedValues = Array.from(values);
|
|
90
|
+
if (hasOwn(prop, "default")) {
|
|
91
|
+
allowedValues.push(defaultValue);
|
|
92
|
+
}
|
|
93
|
+
valid || (valid = allowedValues.includes(val));
|
|
94
|
+
}
|
|
95
|
+
if (validator)
|
|
96
|
+
valid || (valid = validator(val));
|
|
97
|
+
if (!valid && allowedValues.length > 0) {
|
|
98
|
+
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
99
|
+
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
100
|
+
}
|
|
101
|
+
return valid;
|
|
102
|
+
} : void 0;
|
|
103
|
+
const epProp = {
|
|
104
|
+
type,
|
|
105
|
+
required: !!required,
|
|
106
|
+
validator: _validator,
|
|
107
|
+
[epPropKey]: true
|
|
108
|
+
};
|
|
109
|
+
if (hasOwn(prop, "default"))
|
|
110
|
+
epProp.default = defaultValue;
|
|
111
|
+
return epProp;
|
|
112
|
+
};
|
|
113
|
+
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
114
|
+
key,
|
|
115
|
+
buildProp(option, key)
|
|
116
|
+
]));
|
|
117
|
+
|
|
118
|
+
const withInstall = (main, extra) => {
|
|
119
|
+
main.install = (app) => {
|
|
120
|
+
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
121
|
+
app.component(comp.name, comp);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
if (extra) {
|
|
125
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
126
|
+
main[key] = comp;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return main;
|
|
130
|
+
};
|
|
131
|
+
const withNoopInstall = (component) => {
|
|
132
|
+
component.install = NOOP;
|
|
133
|
+
return component;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const UPDATE_MODEL_EVENT = "update:modelValue";
|
|
137
|
+
const CHANGE_EVENT = "change";
|
|
138
|
+
|
|
139
|
+
const componentSizes = ["", "default", "small", "large"];
|
|
140
|
+
|
|
141
|
+
const mutable = (val) => val;
|
|
142
|
+
|
|
143
|
+
const defaultNamespace = "el";
|
|
144
|
+
const statePrefix = "is-";
|
|
145
|
+
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
146
|
+
let cls = `${namespace}-${block}`;
|
|
147
|
+
if (blockSuffix) {
|
|
148
|
+
cls += `-${blockSuffix}`;
|
|
149
|
+
}
|
|
150
|
+
if (element) {
|
|
151
|
+
cls += `__${element}`;
|
|
152
|
+
}
|
|
153
|
+
if (modifier) {
|
|
154
|
+
cls += `--${modifier}`;
|
|
155
|
+
}
|
|
156
|
+
return cls;
|
|
157
|
+
};
|
|
158
|
+
const namespaceContextKey = Symbol("namespaceContextKey");
|
|
159
|
+
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
160
|
+
const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
|
|
161
|
+
const namespace = computed(() => {
|
|
162
|
+
return unref(derivedNamespace) || defaultNamespace;
|
|
163
|
+
});
|
|
164
|
+
return namespace;
|
|
165
|
+
};
|
|
166
|
+
const useNamespace = (block, namespaceOverrides) => {
|
|
167
|
+
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
168
|
+
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
169
|
+
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
170
|
+
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
171
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
|
|
172
|
+
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
|
|
173
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
|
|
174
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
|
|
175
|
+
const is = (name, ...args) => {
|
|
176
|
+
const state = args.length >= 1 ? args[0] : true;
|
|
177
|
+
return name && state ? `${statePrefix}${name}` : "";
|
|
178
|
+
};
|
|
179
|
+
const cssVar = (object) => {
|
|
180
|
+
const styles = {};
|
|
181
|
+
for (const key in object) {
|
|
182
|
+
if (object[key]) {
|
|
183
|
+
styles[`--${namespace.value}-${key}`] = object[key];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return styles;
|
|
187
|
+
};
|
|
188
|
+
const cssVarBlock = (object) => {
|
|
189
|
+
const styles = {};
|
|
190
|
+
for (const key in object) {
|
|
191
|
+
if (object[key]) {
|
|
192
|
+
styles[`--${namespace.value}-${block}-${key}`] = object[key];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return styles;
|
|
196
|
+
};
|
|
197
|
+
const cssVarName = (name) => `--${namespace.value}-${name}`;
|
|
198
|
+
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
|
|
199
|
+
return {
|
|
200
|
+
namespace,
|
|
201
|
+
b,
|
|
202
|
+
e,
|
|
203
|
+
m,
|
|
204
|
+
be,
|
|
205
|
+
em,
|
|
206
|
+
bm,
|
|
207
|
+
bem,
|
|
208
|
+
is,
|
|
209
|
+
cssVar,
|
|
210
|
+
cssVarName,
|
|
211
|
+
cssVarBlock,
|
|
212
|
+
cssVarBlockName
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const useProp = (name) => {
|
|
217
|
+
const vm = getCurrentInstance();
|
|
218
|
+
return computed(() => {
|
|
219
|
+
var _a, _b;
|
|
220
|
+
return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const defaultIdInjection = {
|
|
225
|
+
prefix: Math.floor(Math.random() * 1e4),
|
|
226
|
+
current: 0
|
|
227
|
+
};
|
|
228
|
+
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
229
|
+
const useIdInjection = () => {
|
|
230
|
+
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
231
|
+
};
|
|
232
|
+
const useId = (deterministicId) => {
|
|
233
|
+
const idInjection = useIdInjection();
|
|
234
|
+
if (!isClient$1 && idInjection === defaultIdInjection) {
|
|
235
|
+
debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
|
236
|
+
usage: app.provide(ID_INJECTION_KEY, {
|
|
237
|
+
prefix: number,
|
|
238
|
+
current: number,
|
|
239
|
+
})`);
|
|
240
|
+
}
|
|
241
|
+
const namespace = useGetDerivedNamespace();
|
|
242
|
+
const idRef = computed(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
243
|
+
return idRef;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const useSizeProp = buildProp({
|
|
247
|
+
type: String,
|
|
248
|
+
values: componentSizes,
|
|
249
|
+
required: false
|
|
250
|
+
});
|
|
251
|
+
const SIZE_INJECTION_KEY = Symbol("size");
|
|
252
|
+
const useGlobalSize = () => {
|
|
253
|
+
const injectedSize = inject(SIZE_INJECTION_KEY, {});
|
|
254
|
+
return computed(() => {
|
|
255
|
+
return unref(injectedSize.size) || "";
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
var _export_sfc = (sfc, props) => {
|
|
260
|
+
const target = sfc.__vccOpts || sfc;
|
|
261
|
+
for (const [key, val] of props) {
|
|
262
|
+
target[key] = val;
|
|
263
|
+
}
|
|
264
|
+
return target;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const formContextKey = Symbol("formContextKey");
|
|
268
|
+
const formItemContextKey = Symbol("formItemContextKey");
|
|
269
|
+
|
|
270
|
+
const useFormSize = (fallback, ignore = {}) => {
|
|
271
|
+
const emptyRef = ref(void 0);
|
|
272
|
+
const size = ignore.prop ? emptyRef : useProp("size");
|
|
273
|
+
const globalConfig = ignore.global ? emptyRef : useGlobalSize();
|
|
274
|
+
const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
|
|
275
|
+
const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
|
|
276
|
+
return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
|
|
277
|
+
};
|
|
278
|
+
const useFormDisabled = (fallback) => {
|
|
279
|
+
const disabled = useProp("disabled");
|
|
280
|
+
const form = inject(formContextKey, void 0);
|
|
281
|
+
return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const useFormItem = () => {
|
|
285
|
+
const form = inject(formContextKey, void 0);
|
|
286
|
+
const formItem = inject(formItemContextKey, void 0);
|
|
287
|
+
return {
|
|
288
|
+
form,
|
|
289
|
+
formItem
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
const useFormItemInputId = (props, {
|
|
293
|
+
formItemContext,
|
|
294
|
+
disableIdGeneration,
|
|
295
|
+
disableIdManagement
|
|
296
|
+
}) => {
|
|
297
|
+
if (!disableIdGeneration) {
|
|
298
|
+
disableIdGeneration = ref(false);
|
|
299
|
+
}
|
|
300
|
+
if (!disableIdManagement) {
|
|
301
|
+
disableIdManagement = ref(false);
|
|
302
|
+
}
|
|
303
|
+
const inputId = ref();
|
|
304
|
+
let idUnwatch = void 0;
|
|
305
|
+
const isLabeledByFormItem = computed(() => {
|
|
306
|
+
var _a;
|
|
307
|
+
return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
|
|
308
|
+
});
|
|
309
|
+
onMounted(() => {
|
|
310
|
+
idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
|
|
311
|
+
const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
|
|
312
|
+
if (newId !== inputId.value) {
|
|
313
|
+
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
314
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
315
|
+
if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
|
|
316
|
+
formItemContext.addInputId(newId);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
inputId.value = newId;
|
|
320
|
+
}
|
|
321
|
+
}, { immediate: true });
|
|
322
|
+
});
|
|
323
|
+
onUnmounted(() => {
|
|
324
|
+
idUnwatch && idUnwatch();
|
|
325
|
+
if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
|
|
326
|
+
inputId.value && formItemContext.removeInputId(inputId.value);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return {
|
|
330
|
+
isLabeledByFormItem,
|
|
331
|
+
inputId
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const radioPropsBase = buildProps({
|
|
336
|
+
size: useSizeProp,
|
|
337
|
+
disabled: Boolean,
|
|
338
|
+
label: {
|
|
339
|
+
type: [String, Number, Boolean],
|
|
340
|
+
default: ""
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
const radioProps = buildProps({
|
|
344
|
+
...radioPropsBase,
|
|
345
|
+
modelValue: {
|
|
346
|
+
type: [String, Number, Boolean],
|
|
347
|
+
default: ""
|
|
348
|
+
},
|
|
349
|
+
name: {
|
|
350
|
+
type: String,
|
|
351
|
+
default: ""
|
|
352
|
+
},
|
|
353
|
+
border: Boolean
|
|
354
|
+
});
|
|
355
|
+
const radioEmits = {
|
|
356
|
+
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
357
|
+
[CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const radioGroupKey = Symbol("radioGroupKey");
|
|
361
|
+
|
|
362
|
+
const useRadio = (props, emit) => {
|
|
363
|
+
const radioRef = ref();
|
|
364
|
+
const radioGroup = inject(radioGroupKey, void 0);
|
|
365
|
+
const isGroup = computed(() => !!radioGroup);
|
|
366
|
+
const modelValue = computed({
|
|
367
|
+
get() {
|
|
368
|
+
return isGroup.value ? radioGroup.modelValue : props.modelValue;
|
|
369
|
+
},
|
|
370
|
+
set(val) {
|
|
371
|
+
if (isGroup.value) {
|
|
372
|
+
radioGroup.changeEvent(val);
|
|
373
|
+
} else {
|
|
374
|
+
emit && emit(UPDATE_MODEL_EVENT, val);
|
|
375
|
+
}
|
|
376
|
+
radioRef.value.checked = props.modelValue === props.label;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
const size = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
|
|
380
|
+
const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
|
|
381
|
+
const focus = ref(false);
|
|
382
|
+
const tabIndex = computed(() => {
|
|
383
|
+
return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
|
|
384
|
+
});
|
|
385
|
+
return {
|
|
386
|
+
radioRef,
|
|
387
|
+
isGroup,
|
|
388
|
+
radioGroup,
|
|
389
|
+
focus,
|
|
390
|
+
size,
|
|
391
|
+
disabled,
|
|
392
|
+
tabIndex,
|
|
393
|
+
modelValue
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const _hoisted_1$3 = ["value", "name", "disabled"];
|
|
398
|
+
const __default__$4 = defineComponent({
|
|
399
|
+
name: "ElRadio"
|
|
400
|
+
});
|
|
401
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
402
|
+
...__default__$4,
|
|
403
|
+
props: radioProps,
|
|
404
|
+
emits: radioEmits,
|
|
405
|
+
setup(__props, { emit }) {
|
|
406
|
+
const props = __props;
|
|
407
|
+
const ns = useNamespace("radio");
|
|
408
|
+
const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
|
|
409
|
+
function handleChange() {
|
|
410
|
+
nextTick(() => emit("change", modelValue.value));
|
|
411
|
+
}
|
|
412
|
+
return (_ctx, _cache) => {
|
|
413
|
+
var _a;
|
|
414
|
+
return openBlock(), createElementBlock("label", {
|
|
415
|
+
class: normalizeClass([
|
|
416
|
+
unref(ns).b(),
|
|
417
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
418
|
+
unref(ns).is("focus", unref(focus)),
|
|
419
|
+
unref(ns).is("bordered", _ctx.border),
|
|
420
|
+
unref(ns).is("checked", unref(modelValue) === _ctx.label),
|
|
421
|
+
unref(ns).m(unref(size))
|
|
422
|
+
])
|
|
423
|
+
}, [
|
|
424
|
+
createElementVNode("span", {
|
|
425
|
+
class: normalizeClass([
|
|
426
|
+
unref(ns).e("input"),
|
|
427
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
428
|
+
unref(ns).is("checked", unref(modelValue) === _ctx.label)
|
|
429
|
+
])
|
|
430
|
+
}, [
|
|
431
|
+
withDirectives(createElementVNode("input", {
|
|
432
|
+
ref_key: "radioRef",
|
|
433
|
+
ref: radioRef,
|
|
434
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
|
|
435
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
436
|
+
value: _ctx.label,
|
|
437
|
+
name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
|
|
438
|
+
disabled: unref(disabled),
|
|
439
|
+
type: "radio",
|
|
440
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
|
|
441
|
+
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
|
|
442
|
+
onChange: handleChange
|
|
443
|
+
}, null, 42, _hoisted_1$3), [
|
|
444
|
+
[vModelRadio, unref(modelValue)]
|
|
445
|
+
]),
|
|
446
|
+
createElementVNode("span", {
|
|
447
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
448
|
+
}, null, 2)
|
|
449
|
+
], 2),
|
|
450
|
+
createElementVNode("span", {
|
|
451
|
+
class: normalizeClass(unref(ns).e("label")),
|
|
452
|
+
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
453
|
+
}, ["stop"]))
|
|
454
|
+
}, [
|
|
455
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
456
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
457
|
+
])
|
|
458
|
+
], 34)
|
|
459
|
+
], 2);
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
|
|
464
|
+
|
|
465
|
+
const radioButtonProps = buildProps({
|
|
466
|
+
...radioPropsBase,
|
|
467
|
+
name: {
|
|
468
|
+
type: String,
|
|
469
|
+
default: ""
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
const _hoisted_1$2 = ["value", "name", "disabled"];
|
|
474
|
+
const __default__$3 = defineComponent({
|
|
475
|
+
name: "ElRadioButton"
|
|
476
|
+
});
|
|
477
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
478
|
+
...__default__$3,
|
|
479
|
+
props: radioButtonProps,
|
|
480
|
+
setup(__props) {
|
|
481
|
+
const props = __props;
|
|
482
|
+
const ns = useNamespace("radio");
|
|
483
|
+
const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
|
|
484
|
+
const activeStyle = computed(() => {
|
|
485
|
+
return {
|
|
486
|
+
backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
|
|
487
|
+
borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
|
|
488
|
+
boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
|
|
489
|
+
color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
|
|
490
|
+
};
|
|
491
|
+
});
|
|
492
|
+
return (_ctx, _cache) => {
|
|
493
|
+
var _a;
|
|
494
|
+
return openBlock(), createElementBlock("label", {
|
|
495
|
+
class: normalizeClass([
|
|
496
|
+
unref(ns).b("button"),
|
|
497
|
+
unref(ns).is("active", unref(modelValue) === _ctx.label),
|
|
498
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
499
|
+
unref(ns).is("focus", unref(focus)),
|
|
500
|
+
unref(ns).bm("button", unref(size))
|
|
501
|
+
])
|
|
502
|
+
}, [
|
|
503
|
+
withDirectives(createElementVNode("input", {
|
|
504
|
+
ref_key: "radioRef",
|
|
505
|
+
ref: radioRef,
|
|
506
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
|
|
507
|
+
class: normalizeClass(unref(ns).be("button", "original-radio")),
|
|
508
|
+
value: _ctx.label,
|
|
509
|
+
type: "radio",
|
|
510
|
+
name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
|
|
511
|
+
disabled: unref(disabled),
|
|
512
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
|
|
513
|
+
onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
|
|
514
|
+
}, null, 42, _hoisted_1$2), [
|
|
515
|
+
[vModelRadio, unref(modelValue)]
|
|
516
|
+
]),
|
|
517
|
+
createElementVNode("span", {
|
|
518
|
+
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
519
|
+
style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
|
|
520
|
+
onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
521
|
+
}, ["stop"]))
|
|
522
|
+
}, [
|
|
523
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
524
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
525
|
+
])
|
|
526
|
+
], 38)
|
|
527
|
+
], 2);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
|
|
532
|
+
|
|
533
|
+
const radioGroupProps = buildProps({
|
|
534
|
+
id: {
|
|
535
|
+
type: String,
|
|
536
|
+
default: void 0
|
|
537
|
+
},
|
|
538
|
+
size: useSizeProp,
|
|
539
|
+
disabled: Boolean,
|
|
540
|
+
modelValue: {
|
|
541
|
+
type: [String, Number, Boolean],
|
|
542
|
+
default: ""
|
|
543
|
+
},
|
|
544
|
+
fill: {
|
|
545
|
+
type: String,
|
|
546
|
+
default: ""
|
|
547
|
+
},
|
|
548
|
+
label: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: void 0
|
|
551
|
+
},
|
|
552
|
+
textColor: {
|
|
553
|
+
type: String,
|
|
554
|
+
default: ""
|
|
555
|
+
},
|
|
556
|
+
name: {
|
|
557
|
+
type: String,
|
|
558
|
+
default: void 0
|
|
559
|
+
},
|
|
560
|
+
validateEvent: {
|
|
561
|
+
type: Boolean,
|
|
562
|
+
default: true
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
const radioGroupEmits = radioEmits;
|
|
566
|
+
|
|
567
|
+
const _hoisted_1$1 = ["id", "aria-label", "aria-labelledby"];
|
|
568
|
+
const __default__$2 = defineComponent({
|
|
569
|
+
name: "ElRadioGroup"
|
|
570
|
+
});
|
|
571
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
572
|
+
...__default__$2,
|
|
573
|
+
props: radioGroupProps,
|
|
574
|
+
emits: radioGroupEmits,
|
|
575
|
+
setup(__props, { emit }) {
|
|
576
|
+
const props = __props;
|
|
577
|
+
const ns = useNamespace("radio");
|
|
578
|
+
const radioId = useId();
|
|
579
|
+
const radioGroupRef = ref();
|
|
580
|
+
const { formItem } = useFormItem();
|
|
581
|
+
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
582
|
+
formItemContext: formItem
|
|
583
|
+
});
|
|
584
|
+
const changeEvent = (value) => {
|
|
585
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
586
|
+
nextTick(() => emit("change", value));
|
|
587
|
+
};
|
|
588
|
+
onMounted(() => {
|
|
589
|
+
const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
|
|
590
|
+
const firstLabel = radios[0];
|
|
591
|
+
if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
|
|
592
|
+
firstLabel.tabIndex = 0;
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
const name = computed(() => {
|
|
596
|
+
return props.name || radioId.value;
|
|
597
|
+
});
|
|
598
|
+
provide(radioGroupKey, reactive({
|
|
599
|
+
...toRefs(props),
|
|
600
|
+
changeEvent,
|
|
601
|
+
name
|
|
602
|
+
}));
|
|
603
|
+
watch(() => props.modelValue, () => {
|
|
604
|
+
if (props.validateEvent) {
|
|
605
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
return (_ctx, _cache) => {
|
|
609
|
+
return openBlock(), createElementBlock("div", {
|
|
610
|
+
id: unref(groupId),
|
|
611
|
+
ref_key: "radioGroupRef",
|
|
612
|
+
ref: radioGroupRef,
|
|
613
|
+
class: normalizeClass(unref(ns).b("group")),
|
|
614
|
+
role: "radiogroup",
|
|
615
|
+
"aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
|
|
616
|
+
"aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
|
|
617
|
+
}, [
|
|
618
|
+
renderSlot(_ctx.$slots, "default")
|
|
619
|
+
], 10, _hoisted_1$1);
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
|
|
624
|
+
|
|
625
|
+
const ElRadio = withInstall(Radio, {
|
|
626
|
+
RadioButton,
|
|
627
|
+
RadioGroup
|
|
628
|
+
});
|
|
629
|
+
const ElRadioGroup = withNoopInstall(RadioGroup);
|
|
630
|
+
const ElRadioButton = withNoopInstall(RadioButton);
|
|
631
|
+
|
|
632
|
+
const rowContextKey = Symbol("rowContextKey");
|
|
633
|
+
|
|
634
|
+
const RowJustify = [
|
|
635
|
+
"start",
|
|
636
|
+
"center",
|
|
637
|
+
"end",
|
|
638
|
+
"space-around",
|
|
639
|
+
"space-between",
|
|
640
|
+
"space-evenly"
|
|
641
|
+
];
|
|
642
|
+
const RowAlign = ["top", "middle", "bottom"];
|
|
643
|
+
const rowProps = buildProps({
|
|
644
|
+
tag: {
|
|
645
|
+
type: String,
|
|
646
|
+
default: "div"
|
|
647
|
+
},
|
|
648
|
+
gutter: {
|
|
649
|
+
type: Number,
|
|
650
|
+
default: 0
|
|
651
|
+
},
|
|
652
|
+
justify: {
|
|
653
|
+
type: String,
|
|
654
|
+
values: RowJustify,
|
|
655
|
+
default: "start"
|
|
656
|
+
},
|
|
657
|
+
align: {
|
|
658
|
+
type: String,
|
|
659
|
+
values: RowAlign,
|
|
660
|
+
default: "top"
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
const __default__$1 = defineComponent({
|
|
665
|
+
name: "ElRow"
|
|
666
|
+
});
|
|
667
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
668
|
+
...__default__$1,
|
|
669
|
+
props: rowProps,
|
|
670
|
+
setup(__props) {
|
|
671
|
+
const props = __props;
|
|
672
|
+
const ns = useNamespace("row");
|
|
673
|
+
const gutter = computed(() => props.gutter);
|
|
674
|
+
provide(rowContextKey, {
|
|
675
|
+
gutter
|
|
676
|
+
});
|
|
677
|
+
const style = computed(() => {
|
|
678
|
+
const styles = {};
|
|
679
|
+
if (!props.gutter) {
|
|
680
|
+
return styles;
|
|
681
|
+
}
|
|
682
|
+
styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
|
|
683
|
+
return styles;
|
|
684
|
+
});
|
|
685
|
+
const rowKls = computed(() => [
|
|
686
|
+
ns.b(),
|
|
687
|
+
ns.is(`justify-${props.justify}`, props.justify !== "start"),
|
|
688
|
+
ns.is(`align-${props.align}`, props.align !== "top")
|
|
689
|
+
]);
|
|
690
|
+
return (_ctx, _cache) => {
|
|
691
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
692
|
+
class: normalizeClass(unref(rowKls)),
|
|
693
|
+
style: normalizeStyle(unref(style))
|
|
694
|
+
}, {
|
|
695
|
+
default: withCtx(() => [
|
|
696
|
+
renderSlot(_ctx.$slots, "default")
|
|
697
|
+
]),
|
|
698
|
+
_: 3
|
|
699
|
+
}, 8, ["class", "style"]);
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
var Row = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/row/src/row.vue"]]);
|
|
704
|
+
|
|
705
|
+
const ElRow = withInstall(Row);
|
|
706
|
+
|
|
707
|
+
const colProps = buildProps({
|
|
708
|
+
tag: {
|
|
709
|
+
type: String,
|
|
710
|
+
default: "div"
|
|
711
|
+
},
|
|
712
|
+
span: {
|
|
713
|
+
type: Number,
|
|
714
|
+
default: 24
|
|
715
|
+
},
|
|
716
|
+
offset: {
|
|
717
|
+
type: Number,
|
|
718
|
+
default: 0
|
|
719
|
+
},
|
|
720
|
+
pull: {
|
|
721
|
+
type: Number,
|
|
722
|
+
default: 0
|
|
723
|
+
},
|
|
724
|
+
push: {
|
|
725
|
+
type: Number,
|
|
726
|
+
default: 0
|
|
727
|
+
},
|
|
728
|
+
xs: {
|
|
729
|
+
type: definePropType([Number, Object]),
|
|
730
|
+
default: () => mutable({})
|
|
731
|
+
},
|
|
732
|
+
sm: {
|
|
733
|
+
type: definePropType([Number, Object]),
|
|
734
|
+
default: () => mutable({})
|
|
735
|
+
},
|
|
736
|
+
md: {
|
|
737
|
+
type: definePropType([Number, Object]),
|
|
738
|
+
default: () => mutable({})
|
|
739
|
+
},
|
|
740
|
+
lg: {
|
|
741
|
+
type: definePropType([Number, Object]),
|
|
742
|
+
default: () => mutable({})
|
|
743
|
+
},
|
|
744
|
+
xl: {
|
|
745
|
+
type: definePropType([Number, Object]),
|
|
746
|
+
default: () => mutable({})
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
const __default__ = defineComponent({
|
|
751
|
+
name: "ElCol"
|
|
752
|
+
});
|
|
753
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
754
|
+
...__default__,
|
|
755
|
+
props: colProps,
|
|
756
|
+
setup(__props) {
|
|
757
|
+
const props = __props;
|
|
758
|
+
const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
|
|
759
|
+
const ns = useNamespace("col");
|
|
760
|
+
const style = computed(() => {
|
|
761
|
+
const styles = {};
|
|
762
|
+
if (gutter.value) {
|
|
763
|
+
styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
|
|
764
|
+
}
|
|
765
|
+
return styles;
|
|
766
|
+
});
|
|
767
|
+
const colKls = computed(() => {
|
|
768
|
+
const classes = [];
|
|
769
|
+
const pos = ["span", "offset", "pull", "push"];
|
|
770
|
+
pos.forEach((prop) => {
|
|
771
|
+
const size = props[prop];
|
|
772
|
+
if (isNumber(size)) {
|
|
773
|
+
if (prop === "span")
|
|
774
|
+
classes.push(ns.b(`${props[prop]}`));
|
|
775
|
+
else if (size > 0)
|
|
776
|
+
classes.push(ns.b(`${prop}-${props[prop]}`));
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
const sizes = ["xs", "sm", "md", "lg", "xl"];
|
|
780
|
+
sizes.forEach((size) => {
|
|
781
|
+
if (isNumber(props[size])) {
|
|
782
|
+
classes.push(ns.b(`${size}-${props[size]}`));
|
|
783
|
+
} else if (isObject(props[size])) {
|
|
784
|
+
Object.entries(props[size]).forEach(([prop, sizeProp]) => {
|
|
785
|
+
classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
if (gutter.value) {
|
|
790
|
+
classes.push(ns.is("guttered"));
|
|
791
|
+
}
|
|
792
|
+
return [ns.b(), classes];
|
|
793
|
+
});
|
|
794
|
+
return (_ctx, _cache) => {
|
|
795
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
796
|
+
class: normalizeClass(unref(colKls)),
|
|
797
|
+
style: normalizeStyle(unref(style))
|
|
798
|
+
}, {
|
|
799
|
+
default: withCtx(() => [
|
|
800
|
+
renderSlot(_ctx.$slots, "default")
|
|
801
|
+
]),
|
|
802
|
+
_: 3
|
|
803
|
+
}, 8, ["class", "style"]);
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
var Col = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/col/src/col.vue"]]);
|
|
808
|
+
|
|
809
|
+
const ElCol = withInstall(Col);
|
|
810
|
+
|
|
811
|
+
const RxRadioProps = {};
|
|
812
|
+
|
|
813
|
+
var script$2 = defineComponent({
|
|
814
|
+
name: 'RxRadio',
|
|
815
|
+
components: {
|
|
816
|
+
ElRadio
|
|
817
|
+
},
|
|
818
|
+
props: RxRadioProps,
|
|
819
|
+
setup() {
|
|
820
|
+
return {};
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
825
|
+
const _component_el_radio = resolveComponent("el-radio");
|
|
826
|
+
|
|
827
|
+
return (openBlock(), createBlock(_component_el_radio, mergeProps(_ctx.$props, { class: "rx-radio" }), createSlots({ _: 2 /* DYNAMIC */ }, [
|
|
828
|
+
(_ctx.$slots.default)
|
|
829
|
+
? {
|
|
830
|
+
name: "default",
|
|
831
|
+
fn: withCtx(() => [
|
|
832
|
+
renderSlot(_ctx.$slots, "default")
|
|
833
|
+
]),
|
|
834
|
+
key: "0"
|
|
835
|
+
}
|
|
836
|
+
: undefined
|
|
837
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
script$2.render = render$2;
|
|
841
|
+
script$2.__file = "packages/components/RxRadio/src/index.vue";
|
|
842
|
+
|
|
843
|
+
const RxRadio = withInstall$1(script$2);
|
|
844
|
+
|
|
845
|
+
const RxRadioButtonProps = {};
|
|
846
|
+
|
|
847
|
+
var script$1 = defineComponent({
|
|
848
|
+
name: 'RxRadioButton',
|
|
849
|
+
components: {
|
|
850
|
+
ElRadioButton
|
|
851
|
+
},
|
|
852
|
+
props: RxRadioButtonProps,
|
|
853
|
+
setup() {
|
|
854
|
+
return {};
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
859
|
+
const _component_el_radio_button = resolveComponent("el-radio-button");
|
|
860
|
+
|
|
861
|
+
return (openBlock(), createBlock(_component_el_radio_button, mergeProps(_ctx.$props, { class: "rx-radio-button" }), createSlots({ _: 2 /* DYNAMIC */ }, [
|
|
862
|
+
(_ctx.$slots.default)
|
|
863
|
+
? {
|
|
864
|
+
name: "default",
|
|
865
|
+
fn: withCtx(() => [
|
|
866
|
+
renderSlot(_ctx.$slots, "default")
|
|
867
|
+
]),
|
|
868
|
+
key: "0"
|
|
869
|
+
}
|
|
870
|
+
: undefined
|
|
871
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
script$1.render = render$1;
|
|
875
|
+
script$1.__file = "packages/components/RxRadioButton/src/index.vue";
|
|
876
|
+
|
|
877
|
+
const RxRadioButton = withInstall$1(script$1);
|
|
878
|
+
|
|
879
|
+
function useRadioGroup(props) {
|
|
880
|
+
const radioData = ref();
|
|
881
|
+
const radioGutter = ref();
|
|
882
|
+
const radioSpan = ref();
|
|
883
|
+
const radioType = ref();
|
|
884
|
+
const isTooltip = ref(true);
|
|
885
|
+
radioGutter.value = props.radioGutter;
|
|
886
|
+
radioSpan.value = props.radioSpan;
|
|
887
|
+
radioData.value = props.radioGroupData;
|
|
888
|
+
radioType.value = props.radioType;
|
|
889
|
+
const textOverflow = (e) => {
|
|
890
|
+
if (e.target.children[1]) {
|
|
891
|
+
isTooltip.value = e.target.children[1].scrollWidth > e.target.children[1].offsetWidth;
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
const textOverflowLeave = () => {
|
|
895
|
+
isTooltip.value = false;
|
|
896
|
+
};
|
|
897
|
+
return {
|
|
898
|
+
radioGutter,
|
|
899
|
+
radioSpan,
|
|
900
|
+
radioData,
|
|
901
|
+
radioType,
|
|
902
|
+
isTooltip,
|
|
903
|
+
textOverflow,
|
|
904
|
+
textOverflowLeave
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function useTextEllipsis() {
|
|
909
|
+
const isTooltip = ref(true);
|
|
910
|
+
const textOverflow = (e) => {
|
|
911
|
+
const eleDom = e.target.children[1];
|
|
912
|
+
if (eleDom) {
|
|
913
|
+
isTooltip.value = eleDom.scrollWidth > eleDom.offsetWidth;
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
const textOverflowLeave = () => {
|
|
917
|
+
isTooltip.value = false;
|
|
918
|
+
};
|
|
919
|
+
return {
|
|
920
|
+
isTooltip,
|
|
921
|
+
textOverflowLeave,
|
|
922
|
+
textOverflow
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const isClient = typeof window !== "undefined";
|
|
927
|
+
const isDef = (val) => typeof val !== "undefined";
|
|
928
|
+
|
|
929
|
+
isClient ? window : void 0;
|
|
930
|
+
isClient ? window.document : void 0;
|
|
931
|
+
isClient ? window.navigator : void 0;
|
|
932
|
+
isClient ? window.location : void 0;
|
|
933
|
+
function cloneFnJSON(source) {
|
|
934
|
+
return JSON.parse(JSON.stringify(source));
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function useVModel(props, key, emit, options = {}) {
|
|
938
|
+
var _a, _b, _c, _d, _e;
|
|
939
|
+
const {
|
|
940
|
+
clone = false,
|
|
941
|
+
passive = false,
|
|
942
|
+
eventName,
|
|
943
|
+
deep = false,
|
|
944
|
+
defaultValue,
|
|
945
|
+
shouldEmit
|
|
946
|
+
} = options;
|
|
947
|
+
const vm = getCurrentInstance$1();
|
|
948
|
+
const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));
|
|
949
|
+
let event = eventName;
|
|
950
|
+
if (!key) {
|
|
951
|
+
if (isVue2) {
|
|
952
|
+
const modelOptions = (_e = (_d = vm == null ? void 0 : vm.proxy) == null ? void 0 : _d.$options) == null ? void 0 : _e.model;
|
|
953
|
+
key = (modelOptions == null ? void 0 : modelOptions.value) || "value";
|
|
954
|
+
if (!eventName)
|
|
955
|
+
event = (modelOptions == null ? void 0 : modelOptions.event) || "input";
|
|
956
|
+
} else {
|
|
957
|
+
key = "modelValue";
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
event = event || `update:${key.toString()}`;
|
|
961
|
+
const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
|
|
962
|
+
const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
|
|
963
|
+
const triggerEmit = (value) => {
|
|
964
|
+
if (shouldEmit) {
|
|
965
|
+
if (shouldEmit(value))
|
|
966
|
+
_emit(event, value);
|
|
967
|
+
} else {
|
|
968
|
+
_emit(event, value);
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
if (passive) {
|
|
972
|
+
const initialValue = getValue();
|
|
973
|
+
const proxy = ref$1(initialValue);
|
|
974
|
+
watch$1(
|
|
975
|
+
() => props[key],
|
|
976
|
+
(v) => proxy.value = cloneFn(v)
|
|
977
|
+
);
|
|
978
|
+
watch$1(
|
|
979
|
+
proxy,
|
|
980
|
+
(v) => {
|
|
981
|
+
if (v !== props[key] || deep)
|
|
982
|
+
triggerEmit(v);
|
|
983
|
+
},
|
|
984
|
+
{ deep }
|
|
985
|
+
);
|
|
986
|
+
return proxy;
|
|
987
|
+
} else {
|
|
988
|
+
return computed$1({
|
|
989
|
+
get() {
|
|
990
|
+
return getValue();
|
|
991
|
+
},
|
|
992
|
+
set(value) {
|
|
993
|
+
triggerEmit(value);
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
var script = defineComponent({
|
|
1000
|
+
name: 'RxRadioGroup',
|
|
1001
|
+
components: {
|
|
1002
|
+
ElRadioGroup,
|
|
1003
|
+
ElRow,
|
|
1004
|
+
ElCol,
|
|
1005
|
+
RxRadio,
|
|
1006
|
+
RxRadioButton
|
|
1007
|
+
},
|
|
1008
|
+
props: RxRadioGroupProps,
|
|
1009
|
+
setup(props, { emit }) {
|
|
1010
|
+
const radioGroupValue = useVModel(props, 'value', emit);
|
|
1011
|
+
const { radioGutter, radioSpan, radioData, radioType } = useRadioGroup(props);
|
|
1012
|
+
const { isTooltip, textOverflowLeave, textOverflow } = useTextEllipsis();
|
|
1013
|
+
return {
|
|
1014
|
+
radioGutter,
|
|
1015
|
+
radioSpan,
|
|
1016
|
+
radioData,
|
|
1017
|
+
radioGroupValue,
|
|
1018
|
+
radioType,
|
|
1019
|
+
isTooltip,
|
|
1020
|
+
textOverflow,
|
|
1021
|
+
textOverflowLeave
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
const _hoisted_1 = { key: 0 };
|
|
1027
|
+
const _hoisted_2 = { class: "rx-radio-group-slot" };
|
|
1028
|
+
|
|
1029
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1030
|
+
const _component_rx_radio_button = resolveComponent("rx-radio-button");
|
|
1031
|
+
const _component_rx_radio = resolveComponent("rx-radio");
|
|
1032
|
+
const _component_rx_tooltip = resolveComponent("rx-tooltip");
|
|
1033
|
+
const _component_el_col = resolveComponent("el-col");
|
|
1034
|
+
const _component_el_row = resolveComponent("el-row");
|
|
1035
|
+
const _component_el_radio_group = resolveComponent("el-radio-group");
|
|
1036
|
+
|
|
1037
|
+
return (openBlock(), createBlock(_component_el_radio_group, mergeProps(_ctx.$props, {
|
|
1038
|
+
modelValue: _ctx.radioGroupValue,
|
|
1039
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = $event => ((_ctx.radioGroupValue) = $event)),
|
|
1040
|
+
class: "rx-radio-group"
|
|
1041
|
+
}), createSlots({
|
|
1042
|
+
default: withCtx(() => [
|
|
1043
|
+
(_ctx.radioType === 'radio-button')
|
|
1044
|
+
? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1045
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.radioData, (item, index) => {
|
|
1046
|
+
return (openBlock(), createBlock(_component_rx_radio_button, {
|
|
1047
|
+
key: index,
|
|
1048
|
+
label: item
|
|
1049
|
+
}, null, 8 /* PROPS */, ["label"]))
|
|
1050
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
1051
|
+
]))
|
|
1052
|
+
: (openBlock(), createBlock(_component_el_row, {
|
|
1053
|
+
key: 1,
|
|
1054
|
+
gutter: _ctx.radioGutter
|
|
1055
|
+
}, {
|
|
1056
|
+
default: withCtx(() => [
|
|
1057
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.radioData, (item, index) => {
|
|
1058
|
+
return (openBlock(), createBlock(_component_el_col, {
|
|
1059
|
+
span: _ctx.radioSpan,
|
|
1060
|
+
key: index
|
|
1061
|
+
}, {
|
|
1062
|
+
default: withCtx(() => [
|
|
1063
|
+
(_ctx.isTooltip)
|
|
1064
|
+
? (openBlock(), createBlock(_component_rx_tooltip, {
|
|
1065
|
+
key: 0,
|
|
1066
|
+
content: item,
|
|
1067
|
+
placement: "bottom"
|
|
1068
|
+
}, {
|
|
1069
|
+
default: withCtx(() => [
|
|
1070
|
+
(openBlock(), createBlock(_component_rx_radio, {
|
|
1071
|
+
key: item,
|
|
1072
|
+
label: item,
|
|
1073
|
+
onMouseenter: _cache[0] || (_cache[0] = $event => (_ctx.textOverflow($event))),
|
|
1074
|
+
onMouseleave: _ctx.textOverflowLeave
|
|
1075
|
+
}, null, 8 /* PROPS */, ["label", "onMouseleave"]))
|
|
1076
|
+
]),
|
|
1077
|
+
_: 2 /* DYNAMIC */
|
|
1078
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["content"]))
|
|
1079
|
+
: createCommentVNode("v-if", true),
|
|
1080
|
+
(!_ctx.isTooltip)
|
|
1081
|
+
? (openBlock(), createBlock(_component_rx_radio, {
|
|
1082
|
+
key: item,
|
|
1083
|
+
label: item,
|
|
1084
|
+
onMouseenter: _cache[1] || (_cache[1] = $event => (_ctx.textOverflow($event))),
|
|
1085
|
+
onMouseleave: _ctx.textOverflowLeave
|
|
1086
|
+
}, null, 8 /* PROPS */, ["label", "onMouseleave"]))
|
|
1087
|
+
: createCommentVNode("v-if", true)
|
|
1088
|
+
]),
|
|
1089
|
+
_: 2 /* DYNAMIC */
|
|
1090
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["span"]))
|
|
1091
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
1092
|
+
]),
|
|
1093
|
+
_: 1 /* STABLE */
|
|
1094
|
+
}, 8 /* PROPS */, ["gutter"]))
|
|
1095
|
+
]),
|
|
1096
|
+
_: 2 /* DYNAMIC */
|
|
1097
|
+
}, [
|
|
1098
|
+
(_ctx.$slots.default)
|
|
1099
|
+
? {
|
|
1100
|
+
name: "default",
|
|
1101
|
+
fn: withCtx(() => [
|
|
1102
|
+
createElementVNode("div", _hoisted_2, [
|
|
1103
|
+
renderSlot(_ctx.$slots, "default")
|
|
1104
|
+
])
|
|
1105
|
+
]),
|
|
1106
|
+
key: "0"
|
|
1107
|
+
}
|
|
1108
|
+
: undefined
|
|
1109
|
+
]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue"]))
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
script.render = render;
|
|
1113
|
+
script.__file = "packages/components/RxRadioGroup/src/index.vue";
|
|
1114
|
+
|
|
1115
|
+
const RxRadioGroup = withInstall$1(script);
|
|
1116
|
+
|
|
1117
|
+
export { RxRadioGroup, RxRadioGroup as default };
|