@5even7/dlc-ui 0.2.2 → 0.2.3
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/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/dist/capsule.cjs +4 -0
- package/dist/capsule.mjs +8 -0
- package/dist/index.cjs +23 -4
- package/dist/index.mjs +19 -2
- package/dist/index.umd.js +23 -4
- package/dist/index.umd.min.js +1 -1
- package/dist/progress.cjs +19 -4
- package/dist/progress.mjs +11 -2
- package/dist/vue2.cjs +37 -16
- package/dist/vue2.mjs +31 -9
- package/dist/vue3.cjs +37 -16
- package/dist/vue3.mjs +31 -9
- package/package.json +1 -1
- package/styles/base.css +12 -4
- package/styles/progress.css +4 -0
- package/types/index.d.ts +2 -1
package/dist/vue2.mjs
CHANGED
|
@@ -200,6 +200,7 @@ const DEFAULTS = {
|
|
|
200
200
|
draggable: true,
|
|
201
201
|
keyboard: true,
|
|
202
202
|
disabled: false,
|
|
203
|
+
readonly: false,
|
|
203
204
|
valueSuffix: '%',
|
|
204
205
|
edgeStyle: 'flow',
|
|
205
206
|
quality: 'auto',
|
|
@@ -1037,6 +1038,10 @@ function createCapsule(container, options = {}) {
|
|
|
1037
1038
|
for (const name of Object.keys(vars)) root.style.setProperty(name, vars[name]);
|
|
1038
1039
|
if (merged.textRatio !== undefined) {
|
|
1039
1040
|
root.style.setProperty('--hj-text-width', `${merged.textRatio}%`);
|
|
1041
|
+
const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1042
|
+
if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');
|
|
1043
|
+
else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
|
|
1044
|
+
else root.style.removeProperty('--hj-text-min-width');
|
|
1040
1045
|
}
|
|
1041
1046
|
renderer.resize();
|
|
1042
1047
|
};
|
|
@@ -1135,6 +1140,10 @@ function createCapsule(container, options = {}) {
|
|
|
1135
1140
|
dirty.textRatio = true;
|
|
1136
1141
|
merged.textRatio = value;
|
|
1137
1142
|
root.style.setProperty('--hj-text-width', `${value}%`);
|
|
1143
|
+
const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1144
|
+
if (value === 0) root.style.setProperty('--hj-text-min-width', '0');
|
|
1145
|
+
else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
|
|
1146
|
+
else root.style.removeProperty('--hj-text-min-width');
|
|
1138
1147
|
return this;
|
|
1139
1148
|
},
|
|
1140
1149
|
setCssVars(vars) {
|
|
@@ -2244,6 +2253,8 @@ class ProgressCapsuleController {
|
|
|
2244
2253
|
beginDrag(event) {
|
|
2245
2254
|
if (event.button !== undefined && event.button !== 0) return;
|
|
2246
2255
|
event.preventDefault();
|
|
2256
|
+
// preventDefault 会吞掉点击聚焦,主动聚焦让键盘方向键立即可用。
|
|
2257
|
+
try { this.root.focus({ preventScroll: true }); } catch { this.root.focus(); }
|
|
2247
2258
|
this.dragging = true;
|
|
2248
2259
|
this.pendingPointer = null;
|
|
2249
2260
|
this._dragRaf = 0;
|
|
@@ -2383,8 +2394,10 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2383
2394
|
// Vue 的裸布尔属性(<ProgressCapsule disabled />)会传成空字符串,
|
|
2384
2395
|
// 这里统一按 true 处理。
|
|
2385
2396
|
const disabled = merged.disabled === true || merged.disabled === '' || merged.disabled === 'true';
|
|
2386
|
-
const
|
|
2387
|
-
const
|
|
2397
|
+
const readonly = merged.readonly === true || merged.readonly === '' || merged.readonly === 'true';
|
|
2398
|
+
const locked = disabled || readonly;
|
|
2399
|
+
const effectiveDraggable = locked ? false : merged.draggable !== false;
|
|
2400
|
+
const effectiveKeyboard = locked ? false : merged.keyboard !== false;
|
|
2388
2401
|
const dirty = {
|
|
2389
2402
|
preset: false,
|
|
2390
2403
|
colors: false,
|
|
@@ -2403,6 +2416,10 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2403
2416
|
root.setAttribute('aria-disabled', 'true');
|
|
2404
2417
|
root.classList.add('is-disabled');
|
|
2405
2418
|
}
|
|
2419
|
+
if (readonly) {
|
|
2420
|
+
root.setAttribute('aria-readonly', 'true');
|
|
2421
|
+
root.classList.add('is-readonly');
|
|
2422
|
+
}
|
|
2406
2423
|
root.setAttribute('aria-valuemin', String(merged.min ?? 0));
|
|
2407
2424
|
root.setAttribute('aria-valuemax', String(merged.max ?? 100));
|
|
2408
2425
|
root.setAttribute('aria-valuenow', String(preset.initialProgress));
|
|
@@ -2923,13 +2940,15 @@ function makeWrapper({ name, props, events, create, render, methods, watch }) {
|
|
|
2923
2940
|
const root = this.controller.element;
|
|
2924
2941
|
const textLayer = root.querySelector('.hj-capsule-text, .hj-progress-text');
|
|
2925
2942
|
const visualLayer = root.querySelector('.hj-capsule-visual, .hj-progress-visual');
|
|
2926
|
-
const move = (wrapper, layer) => {
|
|
2927
|
-
if (!wrapper || !layer) return;
|
|
2928
|
-
for (const node of Array.from(wrapper.childNodes)) layer.appendChild(node);
|
|
2929
|
-
};
|
|
2930
2943
|
const refs = this.$refs || {};
|
|
2931
|
-
|
|
2932
|
-
|
|
2944
|
+
// 把插槽容器整体搬进对应区域,而不是搬子节点:Vue 重渲染/重建组件时
|
|
2945
|
+
// 内容始终留在区域内,不会丢(子节点搬运会在 recreate 时序下丢失)。
|
|
2946
|
+
if (refs.slotText && textLayer && refs.slotText.parentElement !== textLayer) {
|
|
2947
|
+
textLayer.appendChild(refs.slotText);
|
|
2948
|
+
}
|
|
2949
|
+
if (refs.slotColor && visualLayer && refs.slotColor.parentElement !== visualLayer) {
|
|
2950
|
+
visualLayer.appendChild(refs.slotColor);
|
|
2951
|
+
}
|
|
2933
2952
|
},
|
|
2934
2953
|
applyAttrs() {
|
|
2935
2954
|
if (!this.controller || !this.controller.element || !this.$attrs) return;
|
|
@@ -3056,7 +3075,7 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
3056
3075
|
name: 'ProgressCapsule',
|
|
3057
3076
|
props: [
|
|
3058
3077
|
'preset', 'width', 'height', 'value', 'min', 'max',
|
|
3059
|
-
'draggable', 'keyboard', 'disabled', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix',
|
|
3078
|
+
'draggable', 'keyboard', 'disabled', 'readonly', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix',
|
|
3060
3079
|
'quality', 'renderer', 'respectReducedMotion', 'cssVars'
|
|
3061
3080
|
],
|
|
3062
3081
|
events: PROGRESS_EVENTS,
|
|
@@ -3093,6 +3112,9 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
3093
3112
|
disabled() {
|
|
3094
3113
|
this.scheduleRecreate();
|
|
3095
3114
|
},
|
|
3115
|
+
readonly() {
|
|
3116
|
+
this.scheduleRecreate();
|
|
3117
|
+
},
|
|
3096
3118
|
draggable() {
|
|
3097
3119
|
this.scheduleRecreate();
|
|
3098
3120
|
},
|
package/dist/vue3.cjs
CHANGED
|
@@ -443,6 +443,7 @@ var DEFAULTS = {
|
|
|
443
443
|
draggable: true,
|
|
444
444
|
keyboard: true,
|
|
445
445
|
disabled: false,
|
|
446
|
+
readonly: false,
|
|
446
447
|
valueSuffix: '%',
|
|
447
448
|
edgeStyle: 'flow',
|
|
448
449
|
quality: 'auto',
|
|
@@ -1209,6 +1210,8 @@ function createCapsule(container) {
|
|
|
1209
1210
|
}
|
|
1210
1211
|
if (merged.textRatio !== undefined) {
|
|
1211
1212
|
root.style.setProperty('--hj-text-width', "".concat(merged.textRatio, "%"));
|
|
1213
|
+
var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1214
|
+
if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
|
|
1212
1215
|
}
|
|
1213
1216
|
renderer.resize();
|
|
1214
1217
|
};
|
|
@@ -1332,6 +1335,8 @@ function createCapsule(container) {
|
|
|
1332
1335
|
dirty.textRatio = true;
|
|
1333
1336
|
merged.textRatio = value;
|
|
1334
1337
|
root.style.setProperty('--hj-text-width', "".concat(value, "%"));
|
|
1338
|
+
var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1339
|
+
if (value === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
|
|
1335
1340
|
return this;
|
|
1336
1341
|
},
|
|
1337
1342
|
setCssVars: function setCssVars(vars) {
|
|
@@ -2263,6 +2268,14 @@ var ProgressCapsuleController = /*#__PURE__*/function () {
|
|
|
2263
2268
|
value: function beginDrag(event) {
|
|
2264
2269
|
if (event.button !== undefined && event.button !== 0) return;
|
|
2265
2270
|
event.preventDefault();
|
|
2271
|
+
// preventDefault 会吞掉点击聚焦,主动聚焦让键盘方向键立即可用。
|
|
2272
|
+
try {
|
|
2273
|
+
this.root.focus({
|
|
2274
|
+
preventScroll: true
|
|
2275
|
+
});
|
|
2276
|
+
} catch (_unused) {
|
|
2277
|
+
this.root.focus();
|
|
2278
|
+
}
|
|
2266
2279
|
this.dragging = true;
|
|
2267
2280
|
this.pendingPointer = null;
|
|
2268
2281
|
this._dragRaf = 0;
|
|
@@ -2270,7 +2283,7 @@ var ProgressCapsuleController = /*#__PURE__*/function () {
|
|
|
2270
2283
|
try {
|
|
2271
2284
|
var _this$root$setPointer, _this$root;
|
|
2272
2285
|
(_this$root$setPointer = (_this$root = this.root).setPointerCapture) === null || _this$root$setPointer === void 0 || _this$root$setPointer.call(_this$root, event.pointerId);
|
|
2273
|
-
} catch (
|
|
2286
|
+
} catch (_unused2) {}
|
|
2274
2287
|
this.emitter.emit('dragstart', {
|
|
2275
2288
|
value: this.value
|
|
2276
2289
|
});
|
|
@@ -2310,7 +2323,7 @@ var ProgressCapsuleController = /*#__PURE__*/function () {
|
|
|
2310
2323
|
if ((event === null || event === void 0 ? void 0 : event.pointerId) !== undefined && (_this$root$hasPointer = (_this$root2 = this.root).hasPointerCapture) !== null && _this$root$hasPointer !== void 0 && _this$root$hasPointer.call(_this$root2, event.pointerId)) {
|
|
2311
2324
|
this.root.releasePointerCapture(event.pointerId);
|
|
2312
2325
|
}
|
|
2313
|
-
} catch (
|
|
2326
|
+
} catch (_unused3) {}
|
|
2314
2327
|
this.emitter.emit('dragend', {
|
|
2315
2328
|
value: this.value
|
|
2316
2329
|
});
|
|
@@ -2431,8 +2444,10 @@ function createProgressCapsule(container) {
|
|
|
2431
2444
|
// Vue 的裸布尔属性(<ProgressCapsule disabled />)会传成空字符串,
|
|
2432
2445
|
// 这里统一按 true 处理。
|
|
2433
2446
|
var disabled = merged.disabled === true || merged.disabled === '' || merged.disabled === 'true';
|
|
2434
|
-
var
|
|
2435
|
-
var
|
|
2447
|
+
var readonly = merged.readonly === true || merged.readonly === '' || merged.readonly === 'true';
|
|
2448
|
+
var locked = disabled || readonly;
|
|
2449
|
+
var effectiveDraggable = locked ? false : merged.draggable !== false;
|
|
2450
|
+
var effectiveKeyboard = locked ? false : merged.keyboard !== false;
|
|
2436
2451
|
var dirty = {
|
|
2437
2452
|
preset: false,
|
|
2438
2453
|
colors: false,
|
|
@@ -2450,6 +2465,10 @@ function createProgressCapsule(container) {
|
|
|
2450
2465
|
root.setAttribute('aria-disabled', 'true');
|
|
2451
2466
|
root.classList.add('is-disabled');
|
|
2452
2467
|
}
|
|
2468
|
+
if (readonly) {
|
|
2469
|
+
root.setAttribute('aria-readonly', 'true');
|
|
2470
|
+
root.classList.add('is-readonly');
|
|
2471
|
+
}
|
|
2453
2472
|
root.setAttribute('aria-valuemin', String((_merged$min = merged.min) !== null && _merged$min !== void 0 ? _merged$min : 0));
|
|
2454
2473
|
root.setAttribute('aria-valuemax', String((_merged$max = merged.max) !== null && _merged$max !== void 0 ? _merged$max : 100));
|
|
2455
2474
|
root.setAttribute('aria-valuenow', String(preset.initialProgress));
|
|
@@ -3000,22 +3019,21 @@ function makeWrapper(_ref) {
|
|
|
3000
3019
|
var root = this.controller.element;
|
|
3001
3020
|
var textLayer = root.querySelector('.hj-capsule-text, .hj-progress-text');
|
|
3002
3021
|
var visualLayer = root.querySelector('.hj-capsule-visual, .hj-progress-visual');
|
|
3003
|
-
var move = function move(wrapper, layer) {
|
|
3004
|
-
if (!wrapper || !layer) return;
|
|
3005
|
-
for (var _i = 0, _Array$from = Array.from(wrapper.childNodes); _i < _Array$from.length; _i++) {
|
|
3006
|
-
var node = _Array$from[_i];
|
|
3007
|
-
layer.appendChild(node);
|
|
3008
|
-
}
|
|
3009
|
-
};
|
|
3010
3022
|
var refs = this.$refs || {};
|
|
3011
|
-
|
|
3012
|
-
|
|
3023
|
+
// 把插槽容器整体搬进对应区域,而不是搬子节点:Vue 重渲染/重建组件时
|
|
3024
|
+
// 内容始终留在区域内,不会丢(子节点搬运会在 recreate 时序下丢失)。
|
|
3025
|
+
if (refs.slotText && textLayer && refs.slotText.parentElement !== textLayer) {
|
|
3026
|
+
textLayer.appendChild(refs.slotText);
|
|
3027
|
+
}
|
|
3028
|
+
if (refs.slotColor && visualLayer && refs.slotColor.parentElement !== visualLayer) {
|
|
3029
|
+
visualLayer.appendChild(refs.slotColor);
|
|
3030
|
+
}
|
|
3013
3031
|
},
|
|
3014
3032
|
applyAttrs: function applyAttrs() {
|
|
3015
3033
|
if (!this.controller || !this.controller.element || !this.$attrs) return;
|
|
3016
3034
|
var root = this.controller.element;
|
|
3017
|
-
for (var
|
|
3018
|
-
var key = _Object$keys[
|
|
3035
|
+
for (var _i = 0, _Object$keys = Object.keys(this.$attrs); _i < _Object$keys.length; _i++) {
|
|
3036
|
+
var key = _Object$keys[_i];
|
|
3019
3037
|
if (key === 'class' || key === 'style') continue;
|
|
3020
3038
|
var value = this.$attrs[key];
|
|
3021
3039
|
if (value == null || value === false) root.removeAttribute(key);else root.setAttribute(key, String(value));
|
|
@@ -3163,7 +3181,7 @@ function makeCapsuleWrapper(createCapsule, render) {
|
|
|
3163
3181
|
function makeProgressWrapper(createProgressCapsule, render) {
|
|
3164
3182
|
return makeWrapper({
|
|
3165
3183
|
name: 'ProgressCapsule',
|
|
3166
|
-
props: ['preset', 'width', 'height', 'value', 'min', 'max', 'draggable', 'keyboard', 'disabled', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix', 'quality', 'renderer', 'respectReducedMotion', 'cssVars'],
|
|
3184
|
+
props: ['preset', 'width', 'height', 'value', 'min', 'max', 'draggable', 'keyboard', 'disabled', 'readonly', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix', 'quality', 'renderer', 'respectReducedMotion', 'cssVars'],
|
|
3167
3185
|
events: PROGRESS_EVENTS,
|
|
3168
3186
|
create: createProgressCapsule,
|
|
3169
3187
|
render: render,
|
|
@@ -3198,6 +3216,9 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
3198
3216
|
disabled: function disabled() {
|
|
3199
3217
|
this.scheduleRecreate();
|
|
3200
3218
|
},
|
|
3219
|
+
readonly: function readonly() {
|
|
3220
|
+
this.scheduleRecreate();
|
|
3221
|
+
},
|
|
3201
3222
|
draggable: function draggable() {
|
|
3202
3223
|
this.scheduleRecreate();
|
|
3203
3224
|
},
|
package/dist/vue3.mjs
CHANGED
|
@@ -202,6 +202,7 @@ const DEFAULTS = {
|
|
|
202
202
|
draggable: true,
|
|
203
203
|
keyboard: true,
|
|
204
204
|
disabled: false,
|
|
205
|
+
readonly: false,
|
|
205
206
|
valueSuffix: '%',
|
|
206
207
|
edgeStyle: 'flow',
|
|
207
208
|
quality: 'auto',
|
|
@@ -1039,6 +1040,10 @@ function createCapsule(container, options = {}) {
|
|
|
1039
1040
|
for (const name of Object.keys(vars)) root.style.setProperty(name, vars[name]);
|
|
1040
1041
|
if (merged.textRatio !== undefined) {
|
|
1041
1042
|
root.style.setProperty('--hj-text-width', `${merged.textRatio}%`);
|
|
1043
|
+
const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1044
|
+
if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');
|
|
1045
|
+
else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
|
|
1046
|
+
else root.style.removeProperty('--hj-text-min-width');
|
|
1042
1047
|
}
|
|
1043
1048
|
renderer.resize();
|
|
1044
1049
|
};
|
|
@@ -1137,6 +1142,10 @@ function createCapsule(container, options = {}) {
|
|
|
1137
1142
|
dirty.textRatio = true;
|
|
1138
1143
|
merged.textRatio = value;
|
|
1139
1144
|
root.style.setProperty('--hj-text-width', `${value}%`);
|
|
1145
|
+
const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
|
|
1146
|
+
if (value === 0) root.style.setProperty('--hj-text-min-width', '0');
|
|
1147
|
+
else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
|
|
1148
|
+
else root.style.removeProperty('--hj-text-min-width');
|
|
1140
1149
|
return this;
|
|
1141
1150
|
},
|
|
1142
1151
|
setCssVars(vars) {
|
|
@@ -2246,6 +2255,8 @@ class ProgressCapsuleController {
|
|
|
2246
2255
|
beginDrag(event) {
|
|
2247
2256
|
if (event.button !== undefined && event.button !== 0) return;
|
|
2248
2257
|
event.preventDefault();
|
|
2258
|
+
// preventDefault 会吞掉点击聚焦,主动聚焦让键盘方向键立即可用。
|
|
2259
|
+
try { this.root.focus({ preventScroll: true }); } catch { this.root.focus(); }
|
|
2249
2260
|
this.dragging = true;
|
|
2250
2261
|
this.pendingPointer = null;
|
|
2251
2262
|
this._dragRaf = 0;
|
|
@@ -2385,8 +2396,10 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2385
2396
|
// Vue 的裸布尔属性(<ProgressCapsule disabled />)会传成空字符串,
|
|
2386
2397
|
// 这里统一按 true 处理。
|
|
2387
2398
|
const disabled = merged.disabled === true || merged.disabled === '' || merged.disabled === 'true';
|
|
2388
|
-
const
|
|
2389
|
-
const
|
|
2399
|
+
const readonly = merged.readonly === true || merged.readonly === '' || merged.readonly === 'true';
|
|
2400
|
+
const locked = disabled || readonly;
|
|
2401
|
+
const effectiveDraggable = locked ? false : merged.draggable !== false;
|
|
2402
|
+
const effectiveKeyboard = locked ? false : merged.keyboard !== false;
|
|
2390
2403
|
const dirty = {
|
|
2391
2404
|
preset: false,
|
|
2392
2405
|
colors: false,
|
|
@@ -2405,6 +2418,10 @@ function createProgressCapsule(container, options = {}) {
|
|
|
2405
2418
|
root.setAttribute('aria-disabled', 'true');
|
|
2406
2419
|
root.classList.add('is-disabled');
|
|
2407
2420
|
}
|
|
2421
|
+
if (readonly) {
|
|
2422
|
+
root.setAttribute('aria-readonly', 'true');
|
|
2423
|
+
root.classList.add('is-readonly');
|
|
2424
|
+
}
|
|
2408
2425
|
root.setAttribute('aria-valuemin', String(merged.min ?? 0));
|
|
2409
2426
|
root.setAttribute('aria-valuemax', String(merged.max ?? 100));
|
|
2410
2427
|
root.setAttribute('aria-valuenow', String(preset.initialProgress));
|
|
@@ -2925,13 +2942,15 @@ function makeWrapper({ name, props, events, create, render, methods, watch }) {
|
|
|
2925
2942
|
const root = this.controller.element;
|
|
2926
2943
|
const textLayer = root.querySelector('.hj-capsule-text, .hj-progress-text');
|
|
2927
2944
|
const visualLayer = root.querySelector('.hj-capsule-visual, .hj-progress-visual');
|
|
2928
|
-
const move = (wrapper, layer) => {
|
|
2929
|
-
if (!wrapper || !layer) return;
|
|
2930
|
-
for (const node of Array.from(wrapper.childNodes)) layer.appendChild(node);
|
|
2931
|
-
};
|
|
2932
2945
|
const refs = this.$refs || {};
|
|
2933
|
-
|
|
2934
|
-
|
|
2946
|
+
// 把插槽容器整体搬进对应区域,而不是搬子节点:Vue 重渲染/重建组件时
|
|
2947
|
+
// 内容始终留在区域内,不会丢(子节点搬运会在 recreate 时序下丢失)。
|
|
2948
|
+
if (refs.slotText && textLayer && refs.slotText.parentElement !== textLayer) {
|
|
2949
|
+
textLayer.appendChild(refs.slotText);
|
|
2950
|
+
}
|
|
2951
|
+
if (refs.slotColor && visualLayer && refs.slotColor.parentElement !== visualLayer) {
|
|
2952
|
+
visualLayer.appendChild(refs.slotColor);
|
|
2953
|
+
}
|
|
2935
2954
|
},
|
|
2936
2955
|
applyAttrs() {
|
|
2937
2956
|
if (!this.controller || !this.controller.element || !this.$attrs) return;
|
|
@@ -3058,7 +3077,7 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
3058
3077
|
name: 'ProgressCapsule',
|
|
3059
3078
|
props: [
|
|
3060
3079
|
'preset', 'width', 'height', 'value', 'min', 'max',
|
|
3061
|
-
'draggable', 'keyboard', 'disabled', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix',
|
|
3080
|
+
'draggable', 'keyboard', 'disabled', 'readonly', 'edgeStyle', 'colors', 'textRatio', 'label', 'showValue', 'valueSuffix',
|
|
3062
3081
|
'quality', 'renderer', 'respectReducedMotion', 'cssVars'
|
|
3063
3082
|
],
|
|
3064
3083
|
events: PROGRESS_EVENTS,
|
|
@@ -3095,6 +3114,9 @@ function makeProgressWrapper(createProgressCapsule, render) {
|
|
|
3095
3114
|
disabled() {
|
|
3096
3115
|
this.scheduleRecreate();
|
|
3097
3116
|
},
|
|
3117
|
+
readonly() {
|
|
3118
|
+
this.scheduleRecreate();
|
|
3119
|
+
},
|
|
3098
3120
|
draggable() {
|
|
3099
3121
|
this.scheduleRecreate();
|
|
3100
3122
|
},
|
package/package.json
CHANGED
package/styles/base.css
CHANGED
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
box-sizing: border-box;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.hj-capsule-canvas,
|
|
39
|
-
.hj-progress-canvas {
|
|
38
|
+
.hj-capsule-canvas,
|
|
39
|
+
.hj-progress-canvas {
|
|
40
40
|
position: absolute;
|
|
41
41
|
inset: 0;
|
|
42
42
|
z-index: 1;
|
|
@@ -44,5 +44,13 @@
|
|
|
44
44
|
width: 100%;
|
|
45
45
|
height: 100%;
|
|
46
46
|
border-radius: inherit;
|
|
47
|
-
pointer-events: none;
|
|
48
|
-
}
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Vue wrapper 的插槽容器会被搬到文字区/颜色区里,撑满区域以便内容正常布局。 */
|
|
51
|
+
.hj-vue-slot-text,
|
|
52
|
+
.hj-vue-slot-color {
|
|
53
|
+
display: block;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
}
|
package/styles/progress.css
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export interface ProgressOptions {
|
|
|
61
61
|
draggable?: boolean;
|
|
62
62
|
keyboard?: boolean;
|
|
63
63
|
disabled?: boolean;
|
|
64
|
+
readonly?: boolean;
|
|
64
65
|
valueSuffix?: string;
|
|
65
66
|
edgeStyle?: 'flow' | 'tide';
|
|
66
67
|
colors?: string[];
|
|
@@ -180,7 +181,7 @@ export declare function getPreset(kind: 'capsule' | 'progress', ref: string): Ca
|
|
|
180
181
|
|
|
181
182
|
export declare const DEFAULTS: {
|
|
182
183
|
capsule: Required<Pick<CapsuleOptions, 'width' | 'height' | 'quality' | 'respectReducedMotion' | 'mouseColor' | 'renderer' | 'textRatio'>>;
|
|
183
|
-
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'draggable' | 'keyboard' | 'disabled' | 'valueSuffix' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'textRatio' | 'showValue'>>;
|
|
184
|
+
progress: Required<Pick<ProgressOptions, 'width' | 'height' | 'min' | 'max' | 'draggable' | 'keyboard' | 'disabled' | 'readonly' | 'valueSuffix' | 'edgeStyle' | 'quality' | 'respectReducedMotion' | 'renderer' | 'textRatio' | 'showValue'>>;
|
|
184
185
|
};
|
|
185
186
|
|
|
186
187
|
export declare const COPY: Copy;
|