@vunk/form 0.0.1-alpha.2 → 0.0.1-alpha.22
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/components/button/index.d.ts +4 -0
- package/components/button/index.js +121 -0
- package/components/button/src/ctx.d.ts +86 -0
- package/components/button/src/ctx.js +39 -0
- package/components/button/src/index.vue.d.ts +232 -0
- package/components/button/src/types.d.ts +7 -0
- package/components/button/src/types.js +1 -0
- package/components/checkbox/index.css +38 -0
- package/components/checkbox/index.d.ts +4 -0
- package/components/checkbox/index.js +125 -0
- package/components/checkbox/src/ctx.d.ts +107 -0
- package/components/checkbox/src/ctx.js +43 -0
- package/components/checkbox/src/index.vue.d.ts +270 -0
- package/components/checkbox/src/types.d.ts +1 -0
- package/components/checkbox/src/types.js +1 -0
- package/components/color-picker/index.d.ts +4 -0
- package/components/color-picker/index.js +72 -0
- package/components/color-picker/src/ctx.d.ts +74 -0
- package/components/color-picker/src/ctx.js +23 -0
- package/components/color-picker/src/index.vue.d.ts +196 -0
- package/components/color-picker/src/types.d.ts +1 -0
- package/components/color-picker/src/types.js +1 -0
- package/components/date-picker/index.js +11 -5
- package/components/date-picker/src/ctx.d.ts +64 -57
- package/components/date-picker/src/ctx.js +1 -1
- package/components/date-picker/src/index.vue.d.ts +170 -140
- package/components/date-picker/src/types.d.ts +7 -7
- package/components/form/index.js +23 -7
- package/components/form/src/ctx.d.ts +83 -77
- package/components/form/src/ctx.js +5 -2
- package/components/form/src/index.vue.d.ts +238 -229
- package/components/form-item/index.css +4 -0
- package/components/form-item/index.js +19 -3
- package/components/form-item/src/ctx.d.ts +15 -7
- package/components/form-item/src/ctx.js +8 -0
- package/components/form-item/src/index.vue.d.ts +43 -13
- package/components/form-item-renderer/index.js +15 -1
- package/components/form-item-renderer/src/ctx.d.ts +3 -3
- package/components/form-item-renderer/src/index.vue.d.ts +9 -9
- package/components/form-item-renderer/src/types.d.ts +2 -0
- package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
- package/components/form-item-renderer-template-default/index.js +112 -19
- package/components/form-item-renderer-template-default/src/index.vue.d.ts +6 -6
- package/components/form-item-renderer-template-layout/index.js +22 -13
- package/components/form-item-renderer-template-layout/src/ctx.d.ts +3 -2
- package/components/form-item-renderer-template-layout/src/ctx.js +1 -1
- package/components/form-item-renderer-template-layout/src/index.vue.d.ts +18 -6
- package/components/input/index.js +23 -4
- package/components/input/src/ctx.d.ts +80 -48
- package/components/input/src/ctx.js +13 -1
- package/components/input/src/index.vue.d.ts +194 -115
- package/components/input-number/index.css +14 -0
- package/components/input-number/index.d.ts +4 -0
- package/components/input-number/index.js +76 -0
- package/components/input-number/src/ctx.d.ts +79 -0
- package/components/input-number/src/ctx.js +23 -0
- package/components/input-number/src/index.vue.d.ts +218 -0
- package/components/input-number/src/types.d.ts +1 -0
- package/components/input-number/src/types.js +1 -0
- package/components/radio/index.css +29 -0
- package/components/radio/index.d.ts +4 -0
- package/components/radio/index.js +116 -0
- package/components/radio/src/ctx.d.ts +74 -0
- package/components/radio/src/ctx.js +35 -0
- package/components/radio/src/index.vue.d.ts +199 -0
- package/components/radio/src/types.d.ts +1 -0
- package/components/radio/src/types.js +1 -0
- package/components/select/index.css +11 -0
- package/components/select/index.js +22 -5
- package/components/select/src/ctx.d.ts +33 -25
- package/components/select/src/index.vue.d.ts +170 -102
- package/components/switch/index.css +11 -0
- package/components/switch/index.js +41 -13
- package/components/switch/src/ctx.d.ts +36 -9
- package/components/switch/src/ctx.js +15 -2
- package/components/switch/src/index.vue.d.ts +128 -32
- package/components/upload/index.css +20 -0
- package/components/upload/index.d.ts +4 -0
- package/components/upload/index.js +481 -0
- package/components/upload/src/ctx.d.ts +168 -0
- package/components/upload/src/ctx.js +38 -0
- package/components/upload/src/file.vue.d.ts +96 -0
- package/components/upload/src/index.vue.d.ts +422 -0
- package/components/upload/src/types.d.ts +1 -0
- package/components/upload/src/types.js +1 -0
- package/composables/index.d.ts +1 -0
- package/composables/index.js +304 -3
- package/composables/useForm.d.ts +9 -0
- package/index.css +134 -0
- package/index.d.ts +1 -0
- package/index.esm.js +4 -1
- package/package.json +4 -1
- package/shared/default-renderer-source/index.d.ts +12 -0
- package/shared/default-renderer-source/index.js +83 -0
- package/shared/element-plus/ctx.d.ts +76 -11
- package/shared/element-plus/index.js +51 -2
- package/shared/element-plus/instances.d.ts +56 -26
- package/shared/infer-prop/index.d.ts +16 -0
- package/shared/infer-prop/index.js +29 -0
- package/shared/types/basic-source/index.d.ts +6 -0
- package/shared/types/basic-source/index.js +1 -0
- package/shared/types/form/checkbox.d.ts +13 -0
- package/shared/types/form/index.d.ts +2 -0
- package/shared/types/form/index.js +1 -0
- package/shared/types/form/radio.d.ts +8 -0
- package/shared/types/index.d.ts +1 -0
- package/shared/types/layout-source/index.d.ts +6 -4
- package/shared/types/renderer-source/button.d.ts +7 -0
- package/shared/types/renderer-source/checkbox.d.ts +7 -0
- package/shared/types/renderer-source/color-picker.d.ts +7 -0
- package/shared/types/renderer-source/compoent.d.ts +2 -0
- package/shared/types/renderer-source/date-picker.d.ts +3 -2
- package/shared/types/renderer-source/index.d.ts +13 -1
- package/shared/types/renderer-source/input-number.d.ts +8 -0
- package/shared/types/renderer-source/input.d.ts +3 -2
- package/shared/types/renderer-source/radio.d.ts +7 -0
- package/shared/types/renderer-source/select.d.ts +3 -2
- package/shared/types/renderer-source/switch.d.ts +3 -2
- package/shared/types/renderer-source/upload.d.ts +7 -0
package/composables/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRef, ref, computed, unref } from 'vue';
|
|
1
|
+
import { isRef, ref, computed as computed$1, unref, inject } from 'vue';
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __defProps = Object.defineProperties;
|
|
@@ -27,7 +27,7 @@ const useSourceManager = (source, opts = {}) => {
|
|
|
27
27
|
slotsChildren: ["default"]
|
|
28
28
|
});
|
|
29
29
|
opts.slotsChildren && op.slotsChildren.push(...opts.slotsChildren);
|
|
30
|
-
const manager = computed(() => {
|
|
30
|
+
const manager = computed$1(() => {
|
|
31
31
|
const keyRecord = {};
|
|
32
32
|
const propRecord = {};
|
|
33
33
|
function intoData(list, k = []) {
|
|
@@ -79,4 +79,305 @@ const useSourceManager = (source, opts = {}) => {
|
|
|
79
79
|
];
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Make a map and return a function for checking if a key
|
|
84
|
+
* is in that map.
|
|
85
|
+
* IMPORTANT: all calls of this function must be prefixed with
|
|
86
|
+
* \/\*#\_\_PURE\_\_\*\/
|
|
87
|
+
* So that rollup can tree-shake them if necessary.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
(process.env.NODE_ENV !== 'production')
|
|
91
|
+
? Object.freeze({})
|
|
92
|
+
: {};
|
|
93
|
+
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
|
|
94
|
+
const NOOP = () => { };
|
|
95
|
+
const extend = Object.assign;
|
|
96
|
+
const isArray = Array.isArray;
|
|
97
|
+
const isFunction = (val) => typeof val === 'function';
|
|
98
|
+
const isSymbol = (val) => typeof val === 'symbol';
|
|
99
|
+
|
|
100
|
+
let activeEffectScope;
|
|
101
|
+
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
102
|
+
if (scope && scope.active) {
|
|
103
|
+
scope.effects.push(effect);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const createDep = (effects) => {
|
|
108
|
+
const dep = new Set(effects);
|
|
109
|
+
dep.w = 0;
|
|
110
|
+
dep.n = 0;
|
|
111
|
+
return dep;
|
|
112
|
+
};
|
|
113
|
+
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
114
|
+
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
115
|
+
const initDepMarkers = ({ deps }) => {
|
|
116
|
+
if (deps.length) {
|
|
117
|
+
for (let i = 0; i < deps.length; i++) {
|
|
118
|
+
deps[i].w |= trackOpBit; // set was tracked
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const finalizeDepMarkers = (effect) => {
|
|
123
|
+
const { deps } = effect;
|
|
124
|
+
if (deps.length) {
|
|
125
|
+
let ptr = 0;
|
|
126
|
+
for (let i = 0; i < deps.length; i++) {
|
|
127
|
+
const dep = deps[i];
|
|
128
|
+
if (wasTracked(dep) && !newTracked(dep)) {
|
|
129
|
+
dep.delete(effect);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
deps[ptr++] = dep;
|
|
133
|
+
}
|
|
134
|
+
// clear bits
|
|
135
|
+
dep.w &= ~trackOpBit;
|
|
136
|
+
dep.n &= ~trackOpBit;
|
|
137
|
+
}
|
|
138
|
+
deps.length = ptr;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
// The number of effects currently being tracked recursively.
|
|
142
|
+
let effectTrackDepth = 0;
|
|
143
|
+
let trackOpBit = 1;
|
|
144
|
+
/**
|
|
145
|
+
* The bitwise track markers support at most 30 levels of recursion.
|
|
146
|
+
* This value is chosen to enable modern JS engines to use a SMI on all platforms.
|
|
147
|
+
* When recursion depth is greater, fall back to using a full cleanup.
|
|
148
|
+
*/
|
|
149
|
+
const maxMarkerBits = 30;
|
|
150
|
+
let activeEffect;
|
|
151
|
+
Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
|
|
152
|
+
Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
|
|
153
|
+
class ReactiveEffect {
|
|
154
|
+
constructor(fn, scheduler = null, scope) {
|
|
155
|
+
this.fn = fn;
|
|
156
|
+
this.scheduler = scheduler;
|
|
157
|
+
this.active = true;
|
|
158
|
+
this.deps = [];
|
|
159
|
+
this.parent = undefined;
|
|
160
|
+
recordEffectScope(this, scope);
|
|
161
|
+
}
|
|
162
|
+
run() {
|
|
163
|
+
if (!this.active) {
|
|
164
|
+
return this.fn();
|
|
165
|
+
}
|
|
166
|
+
let parent = activeEffect;
|
|
167
|
+
let lastShouldTrack = shouldTrack;
|
|
168
|
+
while (parent) {
|
|
169
|
+
if (parent === this) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
parent = parent.parent;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
this.parent = activeEffect;
|
|
176
|
+
activeEffect = this;
|
|
177
|
+
shouldTrack = true;
|
|
178
|
+
trackOpBit = 1 << ++effectTrackDepth;
|
|
179
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
180
|
+
initDepMarkers(this);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
cleanupEffect(this);
|
|
184
|
+
}
|
|
185
|
+
return this.fn();
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
189
|
+
finalizeDepMarkers(this);
|
|
190
|
+
}
|
|
191
|
+
trackOpBit = 1 << --effectTrackDepth;
|
|
192
|
+
activeEffect = this.parent;
|
|
193
|
+
shouldTrack = lastShouldTrack;
|
|
194
|
+
this.parent = undefined;
|
|
195
|
+
if (this.deferStop) {
|
|
196
|
+
this.stop();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
stop() {
|
|
201
|
+
// stopped while running itself - defer the cleanup
|
|
202
|
+
if (activeEffect === this) {
|
|
203
|
+
this.deferStop = true;
|
|
204
|
+
}
|
|
205
|
+
else if (this.active) {
|
|
206
|
+
cleanupEffect(this);
|
|
207
|
+
if (this.onStop) {
|
|
208
|
+
this.onStop();
|
|
209
|
+
}
|
|
210
|
+
this.active = false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function cleanupEffect(effect) {
|
|
215
|
+
const { deps } = effect;
|
|
216
|
+
if (deps.length) {
|
|
217
|
+
for (let i = 0; i < deps.length; i++) {
|
|
218
|
+
deps[i].delete(effect);
|
|
219
|
+
}
|
|
220
|
+
deps.length = 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
let shouldTrack = true;
|
|
224
|
+
function trackEffects(dep, debuggerEventExtraInfo) {
|
|
225
|
+
let shouldTrack = false;
|
|
226
|
+
if (effectTrackDepth <= maxMarkerBits) {
|
|
227
|
+
if (!newTracked(dep)) {
|
|
228
|
+
dep.n |= trackOpBit; // set newly tracked
|
|
229
|
+
shouldTrack = !wasTracked(dep);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// Full cleanup mode.
|
|
234
|
+
shouldTrack = !dep.has(activeEffect);
|
|
235
|
+
}
|
|
236
|
+
if (shouldTrack) {
|
|
237
|
+
dep.add(activeEffect);
|
|
238
|
+
activeEffect.deps.push(dep);
|
|
239
|
+
if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
|
|
240
|
+
activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
245
|
+
// spread into array for stabilization
|
|
246
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
247
|
+
for (const effect of effects) {
|
|
248
|
+
if (effect.computed) {
|
|
249
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const effect of effects) {
|
|
253
|
+
if (!effect.computed) {
|
|
254
|
+
triggerEffect(effect, debuggerEventExtraInfo);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function triggerEffect(effect, debuggerEventExtraInfo) {
|
|
259
|
+
if (effect !== activeEffect || effect.allowRecurse) {
|
|
260
|
+
if ((process.env.NODE_ENV !== 'production') && effect.onTrigger) {
|
|
261
|
+
effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
|
|
262
|
+
}
|
|
263
|
+
if (effect.scheduler) {
|
|
264
|
+
effect.scheduler();
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
effect.run();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
new Set(
|
|
272
|
+
/*#__PURE__*/
|
|
273
|
+
Object.getOwnPropertyNames(Symbol)
|
|
274
|
+
// ios10.x Object.getOwnPropertyNames(Symbol) can enumerate 'arguments' and 'caller'
|
|
275
|
+
// but accessing them on Symbol leads to TypeError because Symbol is a strict mode
|
|
276
|
+
// function
|
|
277
|
+
.filter(key => key !== 'arguments' && key !== 'caller')
|
|
278
|
+
.map(key => Symbol[key])
|
|
279
|
+
.filter(isSymbol));
|
|
280
|
+
function toRaw(observed) {
|
|
281
|
+
const raw = observed && observed["__v_raw" /* RAW */];
|
|
282
|
+
return raw ? toRaw(raw) : observed;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function trackRefValue(ref) {
|
|
286
|
+
if (shouldTrack && activeEffect) {
|
|
287
|
+
ref = toRaw(ref);
|
|
288
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
289
|
+
trackEffects(ref.dep || (ref.dep = createDep()), {
|
|
290
|
+
target: ref,
|
|
291
|
+
type: "get" /* GET */,
|
|
292
|
+
key: 'value'
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
trackEffects(ref.dep || (ref.dep = createDep()));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function triggerRefValue(ref, newVal) {
|
|
301
|
+
ref = toRaw(ref);
|
|
302
|
+
if (ref.dep) {
|
|
303
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
304
|
+
triggerEffects(ref.dep, {
|
|
305
|
+
target: ref,
|
|
306
|
+
type: "set" /* SET */,
|
|
307
|
+
key: 'value',
|
|
308
|
+
newValue: newVal
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
triggerEffects(ref.dep);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
class ComputedRefImpl {
|
|
318
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
319
|
+
this._setter = _setter;
|
|
320
|
+
this.dep = undefined;
|
|
321
|
+
this.__v_isRef = true;
|
|
322
|
+
this._dirty = true;
|
|
323
|
+
this.effect = new ReactiveEffect(getter, () => {
|
|
324
|
+
if (!this._dirty) {
|
|
325
|
+
this._dirty = true;
|
|
326
|
+
triggerRefValue(this);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
this.effect.computed = this;
|
|
330
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
331
|
+
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
|
332
|
+
}
|
|
333
|
+
get value() {
|
|
334
|
+
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
|
|
335
|
+
const self = toRaw(this);
|
|
336
|
+
trackRefValue(self);
|
|
337
|
+
if (self._dirty || !self._cacheable) {
|
|
338
|
+
self._dirty = false;
|
|
339
|
+
self._value = self.effect.run();
|
|
340
|
+
}
|
|
341
|
+
return self._value;
|
|
342
|
+
}
|
|
343
|
+
set value(newValue) {
|
|
344
|
+
this._setter(newValue);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
348
|
+
let getter;
|
|
349
|
+
let setter;
|
|
350
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
351
|
+
if (onlyGetter) {
|
|
352
|
+
getter = getterOrOptions;
|
|
353
|
+
setter = (process.env.NODE_ENV !== 'production')
|
|
354
|
+
? () => {
|
|
355
|
+
console.warn('Write operation failed: computed value is readonly');
|
|
356
|
+
}
|
|
357
|
+
: NOOP;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
getter = getterOrOptions.get;
|
|
361
|
+
setter = getterOrOptions.set;
|
|
362
|
+
}
|
|
363
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
364
|
+
if ((process.env.NODE_ENV !== 'production') && debugOptions && !isSSR) {
|
|
365
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
366
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
367
|
+
}
|
|
368
|
+
return cRef;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const useForm = () => {
|
|
372
|
+
return inject("vkfFormVm", null);
|
|
373
|
+
};
|
|
374
|
+
const useComputedReadonly = (props) => {
|
|
375
|
+
const form = useForm();
|
|
376
|
+
const readonly = computed(() => {
|
|
377
|
+
var _a, _b;
|
|
378
|
+
return (_b = (_a = props.readonly) != null ? _a : form == null ? void 0 : form.props.readonly) != null ? _b : false;
|
|
379
|
+
});
|
|
380
|
+
return readonly;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export { useComputedReadonly, useForm, useSourceManager };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentInternalInstance, ComputedRef } from 'vue';
|
|
2
|
+
import { VkfForm } from '@vunk/form/components/form';
|
|
3
|
+
import { VueComponentPropsType } from '@vunk/core';
|
|
4
|
+
export declare const useForm: () => (ComponentInternalInstance & {
|
|
5
|
+
props: VueComponentPropsType<typeof VkfForm>;
|
|
6
|
+
}) | null;
|
|
7
|
+
export declare const useComputedReadonly: (props: {
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
}) => ComputedRef<boolean>;
|
package/index.css
CHANGED
|
@@ -1,7 +1,141 @@
|
|
|
1
1
|
|
|
2
|
+
.el-checkbox-group.is-readonly .el-checkbox,
|
|
3
|
+
.el-checkbox-group.is-readonly{
|
|
4
|
+
--el-readonly-cursor: auto;
|
|
5
|
+
--el-disabled-text-color: var(--el-checkbox-text-color);
|
|
6
|
+
--el-checkbox-disabled-checked-input-fill: var(--el-checkbox-bg-color);
|
|
7
|
+
--el-checkbox-disabled-checked-icon-color: var(--el-checkbox-checked-icon-color);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
.el-checkbox-group.is-readonly .el-checkbox__input.is-checked+.el-checkbox__label {
|
|
12
|
+
color: var(--el-checkbox-checked-text-color);
|
|
13
|
+
}
|
|
14
|
+
.el-checkbox-group.is-readonly .el-checkbox__input.is-checked .el-checkbox__inner {
|
|
15
|
+
background-color: var(--el-checkbox-checked-bg-color);
|
|
16
|
+
border-color: var(--el-checkbox-checked-input-border-color);
|
|
17
|
+
}
|
|
18
|
+
.el-checkbox-group.is-readonly .el-checkbox__input.is-disabled+span.el-checkbox__label,
|
|
19
|
+
.el-checkbox-group.is-readonly .el-checkbox__input.is-disabled .el-checkbox__inner {
|
|
20
|
+
cursor: var(--el-readonly-cursor);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.el-checkbox-group.is-readonly .el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{
|
|
26
|
+
border-left-color: var(--el-checkbox-button-checked-border-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.el-checkbox-group.is-readonly .el-checkbox-button.is-checked .el-checkbox-button__inner {
|
|
30
|
+
color: var(--el-checkbox-button-checked-text-color);
|
|
31
|
+
background-color: var(--el-checkbox-button-checked-bg-color);
|
|
32
|
+
border-color: var(--el-checkbox-button-checked-border-color);
|
|
33
|
+
box-shadow: -1px 0 0 0 var(--el-color-primary-light-7);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.el-checkbox-group.is-readonly .el-checkbox-button.is-disabled .el-checkbox-button__inner{
|
|
37
|
+
cursor: var(--el-readonly-cursor);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
.vkf-form-item--inline{
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
2
46
|
.vkf-flex {
|
|
3
47
|
display: flex;
|
|
4
48
|
}
|
|
5
49
|
.vkf-flex > .el-form-item {
|
|
6
50
|
width: 100%;
|
|
7
51
|
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
.el-input-number.is-readonly{
|
|
55
|
+
--el-readonly-cursor: text;
|
|
56
|
+
--el-disabled-bg-color: initial;
|
|
57
|
+
--el-disabled-text-color: var(--el-input-text-color);
|
|
58
|
+
}
|
|
59
|
+
.el-input-number.is-readonly .el-input-number__decrease,
|
|
60
|
+
.el-input-number.is-readonly .el-input-number__increase{
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
.el-input-number.is-readonly .el-input.is-disabled,
|
|
64
|
+
.el-input-number.is-readonly .el-input.is-disabled .el-input__inner{
|
|
65
|
+
cursor: var(--el-readonly-cursor);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
.el-radio-group.is-readonly,
|
|
70
|
+
.el-radio-group.is-readonly .el-radio-button{
|
|
71
|
+
--el-readonly-cursor: auto;
|
|
72
|
+
--el-disabled-bg-color: initial;
|
|
73
|
+
--el-disabled-text-color: initial;
|
|
74
|
+
--el-radio-button-disabled-checked-fill: var(--el-radio-button-checked-bg-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.el-radio-group.is-readonly .is-active .el-radio-button__original-radio:disabled+.el-radio-button__inner{
|
|
78
|
+
color: var(--el-radio-button-checked-text-color);
|
|
79
|
+
}
|
|
80
|
+
.el-radio-group.is-readonly .el-radio-button__original-radio:disabled+.el-radio-button__inner {
|
|
81
|
+
cursor: var(--el-readonly-cursor);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.el-radio-group.is-readonly .el-radio__input.is-checked+.el-radio__label{
|
|
85
|
+
color: var(--el-color-primary);
|
|
86
|
+
}
|
|
87
|
+
.el-radio-group.is-readonly .el-radio__input.is-checked .el-radio__inner {
|
|
88
|
+
border-color: var(--el-color-primary);
|
|
89
|
+
background: var(--el-color-primary);
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
.el-radio-group.is-readonly .el-radio__input .el-radio__inner,
|
|
93
|
+
.el-radio-group.is-readonly .el-radio__input.is-disabled+span.el-radio__label {
|
|
94
|
+
cursor: var(--el-readonly-cursor);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
.el-select.is-readonly{
|
|
100
|
+
--el-readonly-cursor: text;
|
|
101
|
+
--el-disabled-bg-color: initial;
|
|
102
|
+
--el-disabled-text-color: var(--el-input-text-color);
|
|
103
|
+
}
|
|
104
|
+
.el-select.is-readonly .el-input.is-disabled .el-input__inner,
|
|
105
|
+
.el-select.is-readonly .el-input.is-disabled .el-select__caret,
|
|
106
|
+
.el-select.is-readonly .el-input.is-disabled .el-input__wrapper{
|
|
107
|
+
cursor: var(--el-readonly-cursor);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
.el-switch.is-readonly{
|
|
112
|
+
--el-readonly-cursor: auto;
|
|
113
|
+
}
|
|
114
|
+
.el-switch.is-readonly.is-readonly{
|
|
115
|
+
opacity: .9;
|
|
116
|
+
}
|
|
117
|
+
.el-switch.is-readonly.is-readonly .el-switch__core,
|
|
118
|
+
.el-switch.is-readonly.is-readonly .el-switch__label{
|
|
119
|
+
cursor: var(--el-readonly-cursor);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
.vkf-upload.is-readonly .el-upload,
|
|
125
|
+
.vkf-upload.is-readonly .el-upload{
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
.vkf-upload .el-upload-list{
|
|
129
|
+
min-width: 100px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
.el-upload-list__item-status-label{
|
|
134
|
+
z-index: 1;
|
|
135
|
+
}
|
|
136
|
+
.el-upload-list__item .el-icon--close{
|
|
137
|
+
z-index: 1;
|
|
138
|
+
}
|
|
139
|
+
.el-upload-list__item-name .el-icon.el-icon--download-primary{
|
|
140
|
+
color: var(--el-color-primary);
|
|
141
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from '@vunk/form/composables';
|
|
|
6
6
|
export * from '@vunk/form/components/form-item-renderer';
|
|
7
7
|
export * from '@vunk/form/components/form-item-renderer-template';
|
|
8
8
|
export * from '@vunk/form/components/form-item-renderer-template-layout';
|
|
9
|
+
export * from '@vunk/form/components/form-item-renderer-template-default';
|
|
9
10
|
export * from '@vunk/form/components/form';
|
package/index.esm.js
CHANGED
|
@@ -6,6 +6,8 @@ import { VkfFormItemRendererTemplate } from '@vunk/form/components/form-item-ren
|
|
|
6
6
|
export * from '@vunk/form/components/form-item-renderer-template';
|
|
7
7
|
import { VkfFormItemRendererTemplateLayout } from '@vunk/form/components/form-item-renderer-template-layout';
|
|
8
8
|
export * from '@vunk/form/components/form-item-renderer-template-layout';
|
|
9
|
+
import { VkfFormItemRendererTemplateDefault } from '@vunk/form/components/form-item-renderer-template-default';
|
|
10
|
+
export * from '@vunk/form/components/form-item-renderer-template-default';
|
|
9
11
|
export * from '@vunk/form/shared';
|
|
10
12
|
export * from '@vunk/form/composables';
|
|
11
13
|
|
|
@@ -13,7 +15,8 @@ var Components = [
|
|
|
13
15
|
VkfForm,
|
|
14
16
|
VkfFormItemRenderer,
|
|
15
17
|
VkfFormItemRendererTemplate,
|
|
16
|
-
VkfFormItemRendererTemplateLayout
|
|
18
|
+
VkfFormItemRendererTemplateLayout,
|
|
19
|
+
VkfFormItemRendererTemplateDefault
|
|
17
20
|
];
|
|
18
21
|
|
|
19
22
|
const makeInstaller = (components = []) => {
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vunk/form",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.esm.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "gulp -f gulpfile.ts"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@vunk/core": "npm:@vunk/core@alpha"
|
|
11
|
+
},
|
|
9
12
|
"keywords": [],
|
|
10
13
|
"author": "",
|
|
11
14
|
"license": "ISC",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VkfCheckboxSource, VkfColorPickerSource, VkfDatePickerSource, VkfInputNumberSource, VkfInputSource, VkfRadioSource, VkfSelectSource, VkfSwitchSource, VkfUploadSource } from '@vunk/form/shared/types';
|
|
2
|
+
export declare const defaultRendererSource: {
|
|
3
|
+
VkfInput: VkfInputSource;
|
|
4
|
+
VkfInputNumber: VkfInputNumberSource;
|
|
5
|
+
VkfSwitch: VkfSwitchSource;
|
|
6
|
+
VkfRadio: VkfRadioSource;
|
|
7
|
+
VkfSelect: VkfSelectSource;
|
|
8
|
+
VkfCheckbox: VkfCheckboxSource;
|
|
9
|
+
VkfColorPicker: VkfColorPickerSource;
|
|
10
|
+
VkfDatePicker: VkfDatePickerSource;
|
|
11
|
+
VkfUpload: VkfUploadSource;
|
|
12
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const defaultRendererSource = {
|
|
2
|
+
VkfInput: {
|
|
3
|
+
templateType: "VkfInput",
|
|
4
|
+
prop: "",
|
|
5
|
+
label: ""
|
|
6
|
+
},
|
|
7
|
+
VkfInputNumber: {
|
|
8
|
+
templateType: "VkfInputNumber",
|
|
9
|
+
prop: "",
|
|
10
|
+
label: ""
|
|
11
|
+
},
|
|
12
|
+
VkfSwitch: {
|
|
13
|
+
templateType: "VkfSwitch",
|
|
14
|
+
prop: "",
|
|
15
|
+
label: ""
|
|
16
|
+
},
|
|
17
|
+
VkfRadio: {
|
|
18
|
+
templateType: "VkfRadio",
|
|
19
|
+
prop: "",
|
|
20
|
+
label: "\u6027\u522B",
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
value: 0,
|
|
24
|
+
label: "\u5973"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: 1,
|
|
28
|
+
label: "\u7537"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
VkfSelect: {
|
|
33
|
+
templateType: "VkfSelect",
|
|
34
|
+
prop: "",
|
|
35
|
+
label: "",
|
|
36
|
+
multiple: false,
|
|
37
|
+
options: [
|
|
38
|
+
{
|
|
39
|
+
value: 0,
|
|
40
|
+
label: "\u5973"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: 1,
|
|
44
|
+
label: "\u7537"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
VkfCheckbox: {
|
|
49
|
+
templateType: "VkfCheckbox",
|
|
50
|
+
prop: "",
|
|
51
|
+
options: [
|
|
52
|
+
{
|
|
53
|
+
value: 0,
|
|
54
|
+
label: "\u5973"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: 1,
|
|
58
|
+
label: "\u7537"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
VkfColorPicker: {
|
|
63
|
+
templateType: "VkfColorPicker",
|
|
64
|
+
prop: "color",
|
|
65
|
+
label: "\u989C\u8272",
|
|
66
|
+
showAlpha: true
|
|
67
|
+
},
|
|
68
|
+
VkfDatePicker: {
|
|
69
|
+
templateType: "VkfDatePicker",
|
|
70
|
+
prop: "",
|
|
71
|
+
label: "",
|
|
72
|
+
type: "date",
|
|
73
|
+
valueFormat: "YYYY-MM-DD",
|
|
74
|
+
format: "YYYY\u5E74MM\u6708DD\u65E5"
|
|
75
|
+
},
|
|
76
|
+
VkfUpload: {
|
|
77
|
+
templateType: "VkfUpload",
|
|
78
|
+
prop: "",
|
|
79
|
+
label: ""
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { defaultRendererSource };
|