icarys-form-create-vant 1.0.2 → 1.0.4

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 (113) hide show
  1. package/README.md +3 -3
  2. package/dist/index.js +3 -3
  3. package/dist/index.min.js +3 -3
  4. package/package.json +8 -5
  5. package/src/components/common/subform/LICENSE +21 -0
  6. package/src/components/common/subform/README.md +6 -0
  7. package/src/components/common/subform/package.json +48 -0
  8. package/src/components/common/subform/src/component.jsx +75 -0
  9. package/src/components/common/subform/src/index.js +3 -0
  10. package/src/components/common/wangeditor/LICENSE +21 -0
  11. package/src/components/common/wangeditor/README.md +14 -0
  12. package/src/components/common/wangeditor/package-lock.json +114 -0
  13. package/src/components/common/wangeditor/package.json +52 -0
  14. package/src/components/common/wangeditor/src/component.jsx +74 -0
  15. package/src/components/common/wangeditor/src/index.js +3 -0
  16. package/src/core/LICENSE +21 -0
  17. package/src/core/README.md +120 -0
  18. package/src/core/babel.config.js +13 -0
  19. package/src/core/bili.config.js +34 -0
  20. package/src/core/package-lock.json +13 -0
  21. package/src/core/package.json +61 -0
  22. package/src/core/src/components/formCreate.js +287 -0
  23. package/src/core/src/components/fragment.js +12 -0
  24. package/src/core/src/factory/context.js +264 -0
  25. package/src/core/src/factory/creator.js +63 -0
  26. package/src/core/src/factory/maker.js +17 -0
  27. package/src/core/src/factory/manager.js +87 -0
  28. package/src/core/src/factory/node.js +89 -0
  29. package/src/core/src/factory/parser.js +28 -0
  30. package/src/core/src/frame/api.js +691 -0
  31. package/src/core/src/frame/attrs.js +12 -0
  32. package/src/core/src/frame/dataDriver.js +76 -0
  33. package/src/core/src/frame/fetch.js +128 -0
  34. package/src/core/src/frame/index.js +792 -0
  35. package/src/core/src/frame/language.js +50 -0
  36. package/src/core/src/frame/provider.js +297 -0
  37. package/src/core/src/frame/util.js +311 -0
  38. package/src/core/src/handler/context.js +573 -0
  39. package/src/core/src/handler/effect.js +122 -0
  40. package/src/core/src/handler/index.js +143 -0
  41. package/src/core/src/handler/inject.js +199 -0
  42. package/src/core/src/handler/input.js +199 -0
  43. package/src/core/src/handler/lifecycle.js +55 -0
  44. package/src/core/src/handler/loader.js +375 -0
  45. package/src/core/src/handler/page.js +46 -0
  46. package/src/core/src/handler/render.js +29 -0
  47. package/src/core/src/index.js +12 -0
  48. package/src/core/src/parser/html.js +17 -0
  49. package/src/core/src/render/cache.js +47 -0
  50. package/src/core/src/render/index.js +33 -0
  51. package/src/core/src/render/render.js +418 -0
  52. package/src/core/types/index.d.ts +842 -0
  53. package/src/index.js +5 -0
  54. package/src/utils/LICENSE +21 -0
  55. package/src/utils/README.md +24 -0
  56. package/src/utils/lib/console.js +16 -0
  57. package/src/utils/lib/debounce.js +9 -0
  58. package/src/utils/lib/deepextend.js +51 -0
  59. package/src/utils/lib/deepset.js +14 -0
  60. package/src/utils/lib/extend.js +20 -0
  61. package/src/utils/lib/index.js +14 -0
  62. package/src/utils/lib/json.js +90 -0
  63. package/src/utils/lib/mergeprops.js +62 -0
  64. package/src/utils/lib/mitt.js +43 -0
  65. package/src/utils/lib/modify.js +8 -0
  66. package/src/utils/lib/slot.js +8 -0
  67. package/src/utils/lib/toarray.js +5 -0
  68. package/src/utils/lib/tocase.js +11 -0
  69. package/src/utils/lib/todate.js +10 -0
  70. package/src/utils/lib/toline.js +10 -0
  71. package/src/utils/lib/topromise.js +10 -0
  72. package/src/utils/lib/tostring.js +7 -0
  73. package/src/utils/lib/type.js +45 -0
  74. package/src/utils/lib/unique.js +6 -0
  75. package/src/utils/package.json +32 -0
  76. package/src/vant/LICENSE +21 -0
  77. package/src/vant/README.md +137 -0
  78. package/src/vant/auto-import.d.ts +5 -0
  79. package/src/vant/auto-import.js +50 -0
  80. package/src/vant/babel.config.js +10 -0
  81. package/src/vant/bili.config.js +40 -0
  82. package/src/vant/examples/App.vue +96 -0
  83. package/src/vant/examples/main.js +13 -0
  84. package/src/vant/examples/rule.js +366 -0
  85. package/src/vant/package-lock.json +11367 -0
  86. package/src/vant/package.json +83 -0
  87. package/src/vant/public/index.html +14 -0
  88. package/src/vant/src/components/calendar.jsx +128 -0
  89. package/src/vant/src/components/cascader.jsx +120 -0
  90. package/src/vant/src/components/checkbox.jsx +38 -0
  91. package/src/vant/src/components/datePicker.jsx +87 -0
  92. package/src/vant/src/components/group.jsx +384 -0
  93. package/src/vant/src/components/icon/IconWarning.vue +12 -0
  94. package/src/vant/src/components/index.js +26 -0
  95. package/src/vant/src/components/radio.jsx +38 -0
  96. package/src/vant/src/components/select.jsx +81 -0
  97. package/src/vant/src/components/timePicker.jsx +76 -0
  98. package/src/vant/src/components/uploader.jsx +99 -0
  99. package/src/vant/src/core/alias.js +31 -0
  100. package/src/vant/src/core/api.js +135 -0
  101. package/src/vant/src/core/config.js +35 -0
  102. package/src/vant/src/core/index.js +45 -0
  103. package/src/vant/src/core/manager.js +282 -0
  104. package/src/vant/src/core/provider.js +63 -0
  105. package/src/vant/src/core/utils.js +15 -0
  106. package/src/vant/src/index.js +13 -0
  107. package/src/vant/src/parsers/hidden.js +12 -0
  108. package/src/vant/src/parsers/index.js +59 -0
  109. package/src/vant/src/parsers/row.js +10 -0
  110. package/src/vant/src/style/index.css +495 -0
  111. package/src/vant/types/config.d.ts +99 -0
  112. package/src/vant/types/index.d.ts +27 -0
  113. package/src/vant/vue.config.js +21 -0
@@ -0,0 +1,63 @@
1
+ import extend from '@form-create/utils/lib/extend';
2
+ import is from '@form-create/utils/lib/type';
3
+ import {attrs} from '../frame/attrs';
4
+ import {copyRule, mergeRule} from '../frame/util';
5
+ import {$set} from '@form-create/utils/lib/modify';
6
+
7
+ export function baseRule() {
8
+ return {
9
+ props: {},
10
+ on: {},
11
+ options: [],
12
+ children: [],
13
+ hidden: false,
14
+ display: true,
15
+ value: undefined,
16
+ };
17
+ }
18
+
19
+ export function creatorFactory(name, init) {
20
+ return (title, field, value, props = {}) => {
21
+ const maker = new Creator(name, title, field, value, props);
22
+ if (init) {
23
+ if (is.Function(init)) init(maker);
24
+ else maker.props(init);
25
+ }
26
+ return maker;
27
+ };
28
+ }
29
+
30
+ export default function Creator(type, title, field, value, props) {
31
+ this._data = extend(baseRule(), {type, title, field, value, props: props || {}});
32
+ this.event = this.on;
33
+ }
34
+
35
+ extend(Creator.prototype, {
36
+ getRule() {
37
+ return this._data;
38
+ },
39
+ setProp(key, value) {
40
+ $set(this._data, key, value);
41
+ return this;
42
+ },
43
+ modelField(field) {
44
+ this._data.modelField = field;
45
+ return this;
46
+ },
47
+ _clone() {
48
+ const clone = new this.constructor();
49
+ clone._data = copyRule(this._data);
50
+ return clone;
51
+ },
52
+ })
53
+
54
+ export function appendProto(attrs) {
55
+ attrs.forEach(name => {
56
+ Creator.prototype[name] = function (key) {
57
+ mergeRule(this._data, {[name]: arguments.length < 2 ? key : {[key]: arguments[1]}})
58
+ return this;
59
+ };
60
+ });
61
+ }
62
+
63
+ appendProto(attrs());
@@ -0,0 +1,17 @@
1
+ import {creatorFactory} from './creator';
2
+
3
+ const commonMaker = creatorFactory('');
4
+
5
+ export function create(type, field, title) {
6
+ let make = commonMaker('', field);
7
+ make._data.type = type;
8
+ make._data.title = title;
9
+ return make;
10
+ }
11
+
12
+ export default function makerFactory() {
13
+ return {
14
+ create,
15
+ factory: creatorFactory
16
+ };
17
+ }
@@ -0,0 +1,87 @@
1
+ import mergeProps from '@form-create/utils/lib/mergeprops';
2
+ import unique from '@form-create/utils/lib/unique';
3
+ import extend from '@form-create/utils/lib/extend';
4
+ import {invoke} from '../frame/util';
5
+
6
+ export function createManager(proto) {
7
+ class CustomManager extends Manager {
8
+ }
9
+
10
+ Object.assign(CustomManager.prototype, proto);
11
+ return CustomManager;
12
+ }
13
+
14
+ export default function Manager(handler) {
15
+ extend(this, {
16
+ $handle: handler,
17
+ vm: handler.vm,
18
+ options: {},
19
+ ref: 'fcForm',
20
+ mergeOptionsRule: {
21
+ normal: ['form', 'row', 'info', 'submitBtn', 'resetBtn']
22
+ }
23
+ });
24
+ this.updateKey();
25
+ this.init();
26
+ }
27
+
28
+ extend(Manager.prototype, {
29
+ __init() {
30
+ this.$render = this.$handle.$render;
31
+ this.$r = (...args) => this.$render.renderRule(...args);
32
+ },
33
+ updateKey() {
34
+ this.key = unique();
35
+ },
36
+ //TODO interface
37
+ init() {
38
+ },
39
+ update() {
40
+ },
41
+ beforeRender() {
42
+ },
43
+ form() {
44
+ return this.vm.refs[this.ref];
45
+ },
46
+ adapterValidate(validate, validator) {
47
+ validate.validator = (rule, value, callback) => {
48
+ return validator(value, callback);
49
+ }
50
+ return validate;
51
+ },
52
+ getSlot(name) {
53
+ const _fn = (vm) => {
54
+ if (vm) {
55
+ let slot = vm.slots[name];
56
+ if (slot) {
57
+ return slot;
58
+ }
59
+ return _fn(vm.setupState.parent);
60
+ }
61
+ return undefined;
62
+ }
63
+ return _fn(this.vm);
64
+ },
65
+ mergeOptions(args, opt) {
66
+ return mergeProps(args.map(v => this.tidyOptions(v)), opt, this.mergeOptionsRule);
67
+ },
68
+ updateOptions(options) {
69
+ this.$handle.fc.targetFormDriver('updateOptions', options, {handle: this.$handle, api: this.$handle.api})
70
+ this.options = this.mergeOptions([options], this.getDefaultOptions());
71
+ this.update();
72
+ },
73
+ tidyOptions(options) {
74
+ return options;
75
+ },
76
+ tidyRule(ctx) {
77
+ },
78
+ mergeProp(ctx) {
79
+ },
80
+ getDefaultOptions() {
81
+ return {};
82
+ },
83
+ fieldChange(ctx, value, formValue, setFlag) {
84
+ },
85
+ render(children) {
86
+ }
87
+ })
@@ -0,0 +1,89 @@
1
+ import toLine from '@form-create/utils/lib/toline';
2
+ import toString from '@form-create/utils/lib/tostring';
3
+ import extend from '@form-create/utils/lib/extend';
4
+ import {toProps} from '../frame/util';
5
+ import {createVNode, getCurrentInstance, resolveComponent, resolveDirective, withDirectives} from 'vue';
6
+
7
+
8
+ function tidyDirectives(directives) {
9
+ return Object.keys(directives).map(n => {
10
+ const data = directives[n];
11
+ const directive = resolveDirective(n);
12
+ if (!directive) return;
13
+ return [
14
+ directive, data.value, data.arg, data.modifiers
15
+ ]
16
+ }).filter(v => !!v);
17
+ }
18
+
19
+ function makeDirective(data, vn) {
20
+ let directives = data.directives;
21
+ if (!directives) return vn;
22
+ if (!Array.isArray(directives)) {
23
+ directives = [directives];
24
+ }
25
+ return withDirectives(vn, directives.reduce((lst, v) => {
26
+ return lst.concat(tidyDirectives(v));
27
+ }, []))
28
+ }
29
+
30
+ export function CreateNodeFactory() {
31
+
32
+ const aliasMap = {};
33
+
34
+ function CreateNode(handle) {
35
+ this.vm = handle.vm;
36
+ this.handle = handle;
37
+ }
38
+
39
+ extend(CreateNode.prototype, {
40
+ make(tag, data, children) {
41
+ return makeDirective(data, this.h(tag, toProps(data), children));
42
+ },
43
+ makeComponent(type, data, children) {
44
+ try {
45
+ return makeDirective(data, createVNode(type, toProps(data), children));
46
+ } catch (e) {
47
+ console.error(e);
48
+ return createVNode('');
49
+ }
50
+ },
51
+ h(tag, data, children) {
52
+ const vm = this.vm || getCurrentInstance();
53
+ const isNativeTag = vm.appContext.config.isNativeTag(tag);
54
+ const component = this.handle.fc.prop.components[tag];
55
+ if (!component && isNativeTag) {
56
+ delete data.formCreateInject;
57
+ }
58
+ try{
59
+ return createVNode(component || (isNativeTag ? tag : resolveComponent(tag)), data, children);
60
+ }catch (e){
61
+ console.error(e);
62
+ return createVNode('');
63
+ }
64
+ },
65
+ aliasMap
66
+ });
67
+
68
+ extend(CreateNode, {
69
+ aliasMap,
70
+ alias(alias, name) {
71
+ aliasMap[alias] = name;
72
+ },
73
+ use(nodes) {
74
+ Object.keys(nodes).forEach((k) => {
75
+ const line = toLine(k);
76
+ const lower = toString(k).toLocaleLowerCase();
77
+ const v = nodes[k];
78
+ CreateNode.alias(k, v);
79
+ [k, line, lower].forEach(n => {
80
+ CreateNode.prototype[n] = function (data, children) {
81
+ return this.make(aliasMap[k] || n, data, children);
82
+ };
83
+ });
84
+ });
85
+ }
86
+ })
87
+
88
+ return CreateNode;
89
+ }
@@ -0,0 +1,28 @@
1
+ const BaseParser = {
2
+ init(ctx) {
3
+ },
4
+ toFormValue(value, ctx) {
5
+ return value
6
+ },
7
+ toValue(formValue, ctx) {
8
+ return formValue;
9
+ },
10
+ mounted(ctx) {
11
+ },
12
+ render(children, ctx) {
13
+ if(ctx.$handle.fc.renderDriver && ctx.$handle.fc.renderDriver.defaultRender){
14
+ return ctx.$handle.fc.renderDriver.defaultRender(ctx, children);
15
+ }
16
+ return ctx.$render.defaultRender(ctx, children);
17
+ },
18
+ preview(children, ctx) {
19
+ if(ctx.$handle.fc.renderDriver && ctx.$handle.fc.renderDriver.defaultPreview){
20
+ return ctx.$handle.fc.renderDriver.defaultPreview(ctx, children);
21
+ }
22
+ return this.render(children, ctx);
23
+ },
24
+ mergeProp(ctx) {
25
+ }
26
+ }
27
+
28
+ export default BaseParser;