@vunk/form 0.0.1-alpha.4 → 0.0.1-alpha.41

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