icarys-fc-vant 1.0.15 → 1.0.17

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 (112) hide show
  1. package/README.md +40 -205
  2. package/dist/index.js +7590 -0
  3. package/dist/index.min.js +3 -7407
  4. package/dist/index.min.js.map +1 -0
  5. package/package.json +6 -19
  6. package/src/components/common/subform/LICENSE +21 -0
  7. package/src/components/common/subform/README.md +6 -0
  8. package/src/components/common/subform/package.json +48 -0
  9. package/src/components/common/subform/src/component.jsx +75 -0
  10. package/src/components/common/subform/src/index.js +3 -0
  11. package/src/components/common/wangeditor/LICENSE +21 -0
  12. package/src/components/common/wangeditor/README.md +14 -0
  13. package/src/components/common/wangeditor/package-lock.json +114 -0
  14. package/src/components/common/wangeditor/package.json +52 -0
  15. package/src/components/common/wangeditor/src/component.jsx +74 -0
  16. package/src/components/common/wangeditor/src/index.js +3 -0
  17. package/src/core/LICENSE +21 -0
  18. package/src/core/README.md +120 -0
  19. package/src/core/babel.config.js +13 -0
  20. package/src/core/bili.config.js +34 -0
  21. package/src/core/package-lock.json +13 -0
  22. package/src/core/package.json +61 -0
  23. package/src/core/src/components/formCreate.js +287 -0
  24. package/src/core/src/components/fragment.js +12 -0
  25. package/src/core/src/factory/context.js +264 -0
  26. package/src/core/src/factory/creator.js +63 -0
  27. package/src/core/src/factory/maker.js +17 -0
  28. package/src/core/src/factory/manager.js +87 -0
  29. package/src/core/src/factory/node.js +89 -0
  30. package/src/core/src/factory/parser.js +28 -0
  31. package/src/core/src/frame/api.js +691 -0
  32. package/src/core/src/frame/attrs.js +12 -0
  33. package/src/core/src/frame/dataDriver.js +76 -0
  34. package/src/core/src/frame/fetch.js +128 -0
  35. package/src/core/src/frame/index.js +792 -0
  36. package/src/core/src/frame/language.js +50 -0
  37. package/src/core/src/frame/provider.js +297 -0
  38. package/src/core/src/frame/util.js +311 -0
  39. package/src/core/src/handler/context.js +573 -0
  40. package/src/core/src/handler/effect.js +122 -0
  41. package/src/core/src/handler/index.js +143 -0
  42. package/src/core/src/handler/inject.js +199 -0
  43. package/src/core/src/handler/input.js +199 -0
  44. package/src/core/src/handler/lifecycle.js +55 -0
  45. package/src/core/src/handler/loader.js +375 -0
  46. package/src/core/src/handler/page.js +46 -0
  47. package/src/core/src/handler/render.js +29 -0
  48. package/src/core/src/index.js +12 -0
  49. package/src/core/src/parser/html.js +17 -0
  50. package/src/core/src/render/cache.js +47 -0
  51. package/src/core/src/render/index.js +33 -0
  52. package/src/core/src/render/render.js +418 -0
  53. package/src/core/types/index.d.ts +842 -0
  54. package/src/index.js +5 -0
  55. package/src/utils/LICENSE +21 -0
  56. package/src/utils/README.md +24 -0
  57. package/src/utils/lib/console.js +16 -0
  58. package/src/utils/lib/debounce.js +9 -0
  59. package/src/utils/lib/deepextend.js +51 -0
  60. package/src/utils/lib/deepset.js +14 -0
  61. package/src/utils/lib/extend.js +20 -0
  62. package/src/utils/lib/index.js +14 -0
  63. package/src/utils/lib/json.js +90 -0
  64. package/src/utils/lib/mergeprops.js +62 -0
  65. package/src/utils/lib/mitt.js +43 -0
  66. package/src/utils/lib/modify.js +8 -0
  67. package/src/utils/lib/slot.js +8 -0
  68. package/src/utils/lib/toarray.js +5 -0
  69. package/src/utils/lib/tocase.js +11 -0
  70. package/src/utils/lib/todate.js +10 -0
  71. package/src/utils/lib/toline.js +10 -0
  72. package/src/utils/lib/topromise.js +10 -0
  73. package/src/utils/lib/tostring.js +7 -0
  74. package/src/utils/lib/type.js +45 -0
  75. package/src/utils/lib/unique.js +6 -0
  76. package/src/utils/package.json +32 -0
  77. package/src/vant/LICENSE +21 -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.json +83 -0
  86. package/src/vant/public/index.html +14 -0
  87. package/src/vant/src/components/calendar.jsx +128 -0
  88. package/src/vant/src/components/cascader.jsx +120 -0
  89. package/src/vant/src/components/checkbox.jsx +38 -0
  90. package/src/vant/src/components/datePicker.jsx +87 -0
  91. package/src/vant/src/components/group.jsx +384 -0
  92. package/src/vant/src/components/icon/IconWarning.vue +12 -0
  93. package/src/vant/src/components/index.js +26 -0
  94. package/src/vant/src/components/radio.jsx +38 -0
  95. package/src/vant/src/components/select.jsx +81 -0
  96. package/src/vant/src/components/timePicker.jsx +76 -0
  97. package/src/vant/src/components/uploader.jsx +99 -0
  98. package/src/vant/src/core/alias.js +31 -0
  99. package/src/vant/src/core/api.js +135 -0
  100. package/src/vant/src/core/config.js +35 -0
  101. package/src/vant/src/core/index.js +45 -0
  102. package/src/vant/src/core/manager.js +282 -0
  103. package/src/vant/src/core/provider.js +63 -0
  104. package/src/vant/src/core/utils.js +15 -0
  105. package/src/vant/src/index.js +13 -0
  106. package/src/vant/src/parsers/hidden.js +12 -0
  107. package/src/vant/src/parsers/index.js +59 -0
  108. package/src/vant/src/parsers/row.js +10 -0
  109. package/src/vant/src/style/index.css +495 -0
  110. package/src/vant/types/config.d.ts +99 -0
  111. package/src/vant/types/index.d.ts +27 -0
  112. package/src/vant/vue.config.js +21 -0
@@ -0,0 +1,128 @@
1
+ import {computed, defineComponent, ref, toRef, watch} from 'vue';
2
+ import is, {hasProperty} from '@form-create/utils/lib/type';
3
+ import dayjs from 'dayjs';
4
+
5
+ const NAME = 'fcCalendar';
6
+
7
+ export default defineComponent({
8
+ name: NAME,
9
+ inheritAttrs: false,
10
+ props: {
11
+ placeholder: String,
12
+ formCreateInject: Object,
13
+ disabled: Boolean,
14
+ clearable: Boolean,
15
+ type: String,
16
+ modelValue: [String, Array],
17
+ minDate: [String, Date],
18
+ maxDate: [String, Date],
19
+ },
20
+ emits: ['update:modelValue', 'change', 'fc.el'],
21
+ setup(props, _) {
22
+ const show = ref(false);
23
+ const modelValue = toRef(props, 'modelValue');
24
+ const formCreateInject = toRef(props, 'formCreateInject');
25
+ const inputValue = ref(modelValue.value);
26
+
27
+ watch(() => modelValue.value, (n) => {
28
+ inputValue.value = n;
29
+ })
30
+
31
+ const formatter = (date) => {
32
+ return dayjs(date).format('YYYY-MM-DD');
33
+ }
34
+ const toDate = (str) => {
35
+ return dayjs(str).toDate();
36
+ }
37
+
38
+ const defaultDate = computed(() => {
39
+ const value = modelValue.value;
40
+ if (Array.isArray(value)) {
41
+ return value.map(toDate);
42
+ } else if (value) {
43
+ return toDate(value);
44
+ } else {
45
+ return null;
46
+ }
47
+ })
48
+
49
+ const dateRange = computed(() => {
50
+ return {
51
+ minDate: props.minDate ? dayjs(props.minDate).toDate() : undefined,
52
+ maxDate: props.maxDate ? dayjs(props.maxDate).toDate() : undefined,
53
+ }
54
+ })
55
+
56
+ const formatValue = (value) => {
57
+ if (Array.isArray(value)) {
58
+ inputValue.value = value.map(formatter);
59
+ } else if (value) {
60
+ inputValue.value = formatter(value);
61
+ } else {
62
+ inputValue.value = value;
63
+ }
64
+ }
65
+ const onInput = () => {
66
+ _.emit('update:modelValue', inputValue.value);
67
+ _.emit('change', inputValue.value);
68
+ }
69
+ const strValue = {
70
+ range() {
71
+ return inputValue.value.length ? inputValue.value.join(' - ') : '';
72
+ },
73
+ multiple() {
74
+ return inputValue.value.length ? (formCreateInject.value.t('selectedData', {length: inputValue.value.length}) ||`选择了 ${inputValue.value.length} 个日期`) : '';
75
+ }
76
+ }
77
+
78
+ return {
79
+ show,
80
+ inputValue,
81
+ defaultDate,
82
+ dateRange,
83
+ open() {
84
+ if (props.disabled) {
85
+ return;
86
+ }
87
+ show.value = true;
88
+ },
89
+ confirm(value) {
90
+ formatValue(value);
91
+ show.value = false;
92
+ onInput();
93
+ },
94
+ getStrValue() {
95
+ if (inputValue.value) {
96
+ return hasProperty(strValue, props.type) ? strValue[props.type]() : (inputValue.value || '');
97
+ }
98
+ return '';
99
+ },
100
+ clear(e) {
101
+ e.stopPropagation();
102
+ const value = Array.isArray(inputValue.value) ? [] : '';
103
+ formatValue(value);
104
+ onInput();
105
+ }
106
+ }
107
+ },
108
+ render() {
109
+ const clearIcon = () => {
110
+ return this.$props.clearable && !is.empty(this.inputValue) ?
111
+ <i class="van-badge__wrapper van-icon van-icon-clear van-field__clear"
112
+ onClick={this.clear}></i> : undefined;
113
+ }
114
+ return <div class="_fc-calendar">
115
+ <van-field ref="el" placeholder={this.placeholder} readonly disabled={this.$props.disabled}
116
+ onClick={this.open}
117
+ model-value={this.getStrValue()} isLink border={false} v-slots={{
118
+ 'right-icon': clearIcon
119
+ }}/>
120
+ <van-calendar {...{...this.$attrs, ...this.dateRange}} show={this.show} onUpdate:show={v => (this.show = v)}
121
+ type={this.type}
122
+ onConfirm={this.confirm} defaultDate={this.defaultDate}/>
123
+ </div>
124
+ },
125
+ mounted() {
126
+ this.$emit('fc.el', this.$refs.el);
127
+ }
128
+ });
@@ -0,0 +1,120 @@
1
+ import {computed, defineComponent, ref, toRef, watch} from 'vue';
2
+ import {normalizeOptions} from '../core/utils';
3
+
4
+ const NAME = 'fcCascader';
5
+
6
+ export default defineComponent({
7
+ name: NAME,
8
+ inheritAttrs: false,
9
+ props: {
10
+ placeholder: String,
11
+ disabled: Boolean,
12
+ clearable: Boolean,
13
+ fieldNames: Object,
14
+ modelValue: [String, Number],
15
+ options: Array,
16
+ minDate: [String, Date],
17
+ maxDate: [String, Date],
18
+ },
19
+ emits: ['update:modelValue', 'fc.el', 'change'],
20
+ setup(props, _) {
21
+ const show = ref(false);
22
+ const modelValue = toRef(props, 'modelValue');
23
+ const fieldNames = toRef(props, 'fieldNames', {});
24
+ const options = computed(() => {
25
+ if (fieldNames?.value?.text) {
26
+ return props.options || [];
27
+ } else {
28
+ return normalizeOptions(props.options || []);
29
+ }
30
+ })
31
+
32
+ const findOptions = (options, value, path) => {
33
+ for (let i = 0; i < options.length; i++) {
34
+ if (options[i][fieldNames.value.value || 'value'] === value) {
35
+ return [...path, options[i]];
36
+ } else if (options[i][fieldNames.value.children || 'children']) {
37
+ const find = findOptions(options[i][fieldNames.value.children || 'children'], value, [...path, options[i]]);
38
+ if (find) {
39
+ return find;
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ const updateInputValue = (n) => {
46
+ if (n == null || n === '') {
47
+ return '';
48
+ }
49
+ const path = findOptions(options.value, n, []);
50
+ return path ? path.map((option) => option[fieldNames.value.text || 'text']).join(' / ') : n;
51
+ }
52
+
53
+ const inputValue = ref(updateInputValue(modelValue.value));
54
+
55
+ watch(() => modelValue.value, (n) => {
56
+ inputValue.value = updateInputValue(n);
57
+ });
58
+
59
+ watch(() => options.value, () => {
60
+ if (modelValue.value != null && modelValue.value !== '') {
61
+ inputValue.value = updateInputValue(modelValue.value);
62
+ }
63
+ }, {deep: true});
64
+
65
+ const onInput = (val) => {
66
+ _.emit('update:modelValue', val);
67
+ _.emit('change', val);
68
+ }
69
+
70
+ return {
71
+ show,
72
+ inputValue,
73
+ options,
74
+ open() {
75
+ if (props.disabled) {
76
+ return;
77
+ }
78
+ show.value = true;
79
+ },
80
+ confirm({selectedOptions, value}) {
81
+ inputValue.value = selectedOptions.map((option) => option[fieldNames.value.text || 'text']).join(' / ');
82
+ show.value = false;
83
+ onInput(value);
84
+ },
85
+ clear(e) {
86
+ e.stopPropagation();
87
+ inputValue.value = '';
88
+ onInput('');
89
+ }
90
+ }
91
+ },
92
+ render() {
93
+ const clearIcon = () => {
94
+ return this.$props.clearable && this.inputValue ?
95
+ <i class="van-badge__wrapper van-icon van-icon-clear van-field__clear"
96
+ onClick={this.clear}></i> : undefined;
97
+ }
98
+
99
+ return <div class="_fc-cascader">
100
+ <van-field ref="el" placeholder={this.placeholder} readonly disabled={this.$props.disabled}
101
+ onClick={this.open}
102
+ model-value={this.inputValue} border={false} isLink v-slots={{
103
+ 'right-icon': clearIcon
104
+ }}/>
105
+ <van-popup show={this.show} onUpdate:show={(v) => this.show = v} round position="bottom">
106
+ <van-cascader
107
+ {...this.$attrs}
108
+ modelValue={this.modelValue}
109
+ fieldNames={this.fieldNames}
110
+ options={this.options}
111
+ onClose={() => this.show = false}
112
+ onFinish={this.confirm}
113
+ />
114
+ </van-popup>
115
+ </div>
116
+ },
117
+ mounted() {
118
+ this.$emit('fc.el', this.$refs.el);
119
+ }
120
+ });
@@ -0,0 +1,38 @@
1
+ import {defineComponent, toRef} from 'vue';
2
+
3
+ const NAME = 'fcCheckbox';
4
+
5
+ export default defineComponent({
6
+ name: NAME,
7
+ inheritAttrs: false,
8
+ props: {
9
+ modelValue: Array,
10
+ options: Array,
11
+ },
12
+ emits: ['update:modelValue', 'change'],
13
+ setup(props, _) {
14
+ const modelValue = toRef(props, 'modelValue', []);
15
+ const options = toRef(props, 'options');
16
+
17
+ return {
18
+ options,
19
+ modelValue,
20
+ onInput(val) {
21
+ _.emit('update:modelValue', val);
22
+ _.emit('change', val);
23
+ },
24
+ }
25
+ },
26
+ render() {
27
+ return <van-checkbox-group direction="horizontal" {...this.$attrs} modelValue={Array.isArray(this.modelValue) ? this.modelValue : []}
28
+ onUpdate:modelValue={this.onInput}>
29
+ {(this.options || []).map(opt => {
30
+ const tmp = {...opt};
31
+ const {text, value} = opt;
32
+ delete tmp.text;
33
+ delete tmp.value;
34
+ return <van-checkbox name={value} shape="square" {...tmp}>{text || opt.label || value}</van-checkbox>
35
+ })}
36
+ </van-checkbox-group>
37
+ }
38
+ });
@@ -0,0 +1,87 @@
1
+ import {computed, defineComponent, ref, toRef} from 'vue';
2
+ import dayjs from 'dayjs';
3
+
4
+ const NAME = 'fcDatePicker';
5
+
6
+ export default defineComponent({
7
+ name: NAME,
8
+ inheritAttrs: false,
9
+ props: {
10
+ disabled: Boolean,
11
+ clearable: Boolean,
12
+ placeholder: String,
13
+ modelValue: [String, Number],
14
+ minDate: [String, Date],
15
+ maxDate: [String, Date],
16
+ },
17
+ emits: ['update:modelValue', 'fc.el', 'change'],
18
+ setup(props, _) {
19
+ const show = ref(false);
20
+ const modelValue = toRef(props, 'modelValue');
21
+
22
+ const formValue = computed(() => {
23
+ if (modelValue.value == null || modelValue.value === '') {
24
+ return [];
25
+ }
26
+ return modelValue.value.split('-');
27
+ });
28
+
29
+ const dateRange = computed(() => {
30
+ return {
31
+ minDate: props.minDate ? dayjs(props.minDate).toDate() : undefined,
32
+ maxDate: props.maxDate ? dayjs(props.maxDate).toDate() : undefined,
33
+ }
34
+ })
35
+
36
+ const onInput = (val) => {
37
+ _.emit('update:modelValue', val);
38
+ _.emit('change', val);
39
+ }
40
+
41
+ return {
42
+ show,
43
+ formValue,
44
+ dateRange,
45
+ open() {
46
+ if (props.disabled) {
47
+ return;
48
+ }
49
+ show.value = true;
50
+ },
51
+ confirm({selectedValues}) {
52
+ onInput(selectedValues.join('-'));
53
+ show.value = false;
54
+ },
55
+ clear(e) {
56
+ e.stopPropagation();
57
+ onInput('');
58
+ }
59
+ }
60
+ },
61
+ render() {
62
+ const clearIcon = () => {
63
+ return this.$props.clearable && this.modelValue ?
64
+ <i class="van-badge__wrapper van-icon van-icon-clear van-field__clear"
65
+ onClick={this.clear}></i> : undefined;
66
+ }
67
+ return <div class="_fc-date-picker">
68
+ <van-field ref="el" placeholder={this.placeholder} readonly disabled={this.$props.disabled}
69
+ onClick={this.open}
70
+ model-value={this.modelValue} border={false} isLink v-slots={{
71
+ 'right-icon': clearIcon
72
+ }}/>
73
+ <van-popup show={this.show} onUpdate:show={(v) => this.show = v} round position="bottom">
74
+ <van-date-picker
75
+ columnsType={['year', 'month', 'day']}
76
+ {...{...this.$attrs, ...this.dateRange}}
77
+ modelValue={this.formValue}
78
+ onConfirm={this.confirm}
79
+ onCancel={() => this.show = false}
80
+ />
81
+ </van-popup>
82
+ </div>
83
+ },
84
+ mounted() {
85
+ this.$emit('fc.el', this.$refs.el);
86
+ }
87
+ });