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