@farris/ui-vue 1.2.9 → 1.3.0
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/accordion/index.esm.js +63 -63
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +402 -323
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.css +1 -1
- package/components/button-edit/index.esm.js +98 -96
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +66 -66
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +118 -118
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +539 -460
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +135 -135
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.css +1 -0
- package/components/combo-list/index.esm.js +1007 -312
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +97 -97
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/common/index.esm.js +778 -700
- package/components/common/index.umd.cjs +1 -1
- package/components/component/index.esm.js +472 -329
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.css +1 -0
- package/components/condition/index.esm.js +2231 -1055
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +79 -79
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.css +1 -1
- package/components/data-grid/index.esm.js +6408 -5034
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.css +1 -0
- package/components/data-view/index.esm.js +4762 -3511
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.css +1 -1
- package/components/date-picker/index.esm.js +3442 -2742
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-outline/index.esm.js +14 -13
- package/components/designer-outline/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +73 -73
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.css +1 -0
- package/components/dynamic-form/index.esm.js +2597 -1141
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +114 -71
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/dynamic-view/index.esm.js +303 -290
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +171 -171
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +65 -65
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.css +1 -1
- package/components/external-container/index.esm.js +3075 -2586
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.css +1 -1
- package/components/field-selector/index.esm.js +5272 -8511
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.css +1 -1
- package/components/filter-bar/index.esm.js +1726 -1822
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +126 -126
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +620 -540
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +88 -88
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +71 -71
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.css +1 -1
- package/components/list-view/index.esm.js +3582 -2356
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.css +1 -1
- package/components/lookup/index.esm.js +10752 -8972
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.css +1 -1
- package/components/mapping-editor/index.esm.js +5601 -5329
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/message-box/index.css +1 -1
- package/components/message-box/index.esm.js +511 -471
- package/components/message-box/index.umd.cjs +1 -1
- package/components/modal/index.css +1 -1
- package/components/modal/index.esm.js +438 -398
- package/components/modal/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +535 -452
- package/components/nav/index.umd.cjs +2 -2
- package/components/notify/index.esm.js +59 -53
- package/components/notify/index.umd.cjs +1 -1
- package/components/number-range/index.esm.js +556 -477
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +504 -425
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.css +1 -1
- package/components/order/index.esm.js +1833 -1054
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +100 -100
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +899 -870
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +576 -487
- package/components/pagination/index.umd.cjs +1 -1
- package/components/popover/index.esm.js +71 -70
- package/components/popover/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +73 -73
- package/components/progress/index.umd.cjs +2 -2
- package/components/property-editor/index.css +1 -1
- package/components/property-editor/index.esm.js +1916 -1220
- package/components/property-editor/index.umd.cjs +3 -3
- package/components/property-panel/index.esm.js +783 -886
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.css +1 -1
- package/components/query-solution/index.esm.js +3632 -2556
- package/components/query-solution/index.umd.cjs +1 -1
- package/components/radio-button/index.esm.js +72 -72
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +484 -405
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +152 -152
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +73 -73
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.css +1 -1
- package/components/response-layout-editor/index.esm.js +1081 -1043
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +753 -738
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.css +1 -1
- package/components/schema-selector/index.esm.js +4418 -4177
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +119 -119
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +92 -91
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +59 -59
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +103 -103
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +85 -85
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +457 -378
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.css +1 -1
- package/components/tabs/index.esm.js +1696 -1617
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +53 -53
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +268 -268
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +420 -341
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.css +1 -1
- package/components/time-picker/index.esm.js +1062 -981
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.css +1 -1
- package/components/transfer/index.esm.js +381 -379
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.css +1 -1
- package/components/tree-grid/index.esm.js +5252 -9560
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.css +1 -0
- package/components/tree-view/index.esm.js +3920 -2692
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +373 -367
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +92 -92
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +597 -417
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +251 -251
- package/components/weather/index.umd.cjs +4 -4
- package/farris.all.esm.js +17125 -16176
- package/farris.all.umd.cjs +8 -8
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/capsule/src/capsule.props.d.ts +2 -2
- package/types/combo-list/src/components/list-container.component.d.ts +0 -3
- package/types/combo-list/src/components/list-container.props.d.ts +0 -4
- package/types/common/index.d.ts +1 -0
- package/types/common/types.d.ts +1 -1
- package/types/common/utils/encrypt.d.ts +2 -0
- package/types/component/src/component.props.d.ts +7 -0
- package/types/component/src/designer/use-designer-rules.d.ts +1 -1
- package/types/component/src/property-config/component.property-config.d.ts +9 -0
- package/types/components.d.ts +1 -0
- package/types/data-grid/index.d.ts +5 -2
- package/types/data-grid/src/data-grid.component.d.ts +2 -1
- package/types/data-grid/src/data-grid.props.d.ts +1 -0
- package/types/data-view/composition/types.d.ts +18 -1
- package/types/data-view/composition/visualization/use-virtual-scroll.d.ts +0 -15
- package/types/designer-canvas/src/composition/dg-control.d.ts +5 -0
- package/types/designer-canvas/src/composition/types.d.ts +1 -1
- package/types/dynamic-form/src/composition/use-response-form-layout-setting.d.ts +2 -0
- package/types/dynamic-form/src/designer/response-form-layout-setting.component.d.ts +8 -0
- package/types/dynamic-form/src/designer/response-form-layout-setting.props.d.ts +4 -0
- package/types/dynamic-form/src/designer/use-designer-rules.d.ts +2 -2
- package/types/dynamic-form/src/property-config/form.property-config.d.ts +9 -0
- package/types/dynamic-form/src/schema/schema-mapper.d.ts +1 -0
- package/types/dynamic-form/src/schema/schema-resolver.d.ts +1 -0
- package/types/dynamic-form/src/types.d.ts +12 -1
- package/types/dynamic-resolver/index.d.ts +1 -0
- package/types/dynamic-resolver/src/event-handler-resolver.d.ts +4 -0
- package/types/dynamic-resolver/src/types.d.ts +9 -0
- package/types/dynamic-view/index.d.ts +1 -0
- package/types/dynamic-view/src/event-dispatcher.d.ts +1 -1
- package/types/index.d.ts +2 -0
- package/types/lookup/src/components/favorite/lookup-favorite.component.d.ts +29 -0
- package/types/lookup/src/components/favorite/lookup-favorite.props.d.ts +15 -0
- package/types/lookup/src/components/modal-container.component.d.ts +25 -0
- package/types/lookup/src/components/modal-container.props.d.ts +29 -0
- package/types/lookup/src/composition/types.d.ts +8 -0
- package/types/lookup/src/composition/use-check-props.d.ts +9 -2
- package/types/lookup/src/composition/use-dialog.d.ts +5 -1
- package/types/lookup/src/composition/use-favorite.d.ts +12 -0
- package/types/lookup/src/composition/use-http.d.ts +9 -5
- package/types/lookup/src/composition/use-input-change.d.ts +3 -0
- package/types/lookup/src/composition/use-user-data.d.ts +24 -0
- package/types/lookup/src/property-config/lookup.property-config.d.ts +6 -4
- package/types/mapping-editor/src/mapping-editor.component.d.ts +3 -0
- package/types/mapping-editor/src/mapping-editor.props.d.ts +0 -1
- package/types/modal/src/composition/use-draggable.d.ts +2 -1
- package/types/modal/src/composition/use-shortcut.d.ts +6 -0
- package/types/modal/src/modal.component.d.ts +3 -0
- package/types/modal/src/modal.props.d.ts +4 -0
- package/types/page-header/src/page-header.props.d.ts +1 -0
- package/types/property-panel/src/composition/entity/base-property.d.ts +8 -0
- package/types/property-panel/src/composition/entity/input-base-property.d.ts +20 -1
- package/types/response-layout-editor/src/composition/converter/use-response-layout-editor-setting.d.ts +2 -0
- package/types/response-layout-editor/src/type.d.ts +21 -0
- package/types/tabs/src/tabs.props.d.ts +1 -0
- package/types/tree-grid/index.d.ts +8 -2
- package/types/tree-grid/src/tree-grid.component.d.ts +3 -1
- package/types/data-grid/src/designer/use-group-column.d.ts +0 -20
- package/types/modal/src/composition/use-esc.d.ts +0 -1
- package/types/response-layout-editor/src/composition/converter/response-layout-editor.converter.d.ts +0 -3
- package/types/response-layout-editor/src/composition/converter/use-convert-property-value.d.ts +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as F, ref as y, watch as D, computed as S, onMounted as P, createVNode as w, nextTick as T, inject as
|
|
2
|
-
import { cloneDeep as
|
|
3
|
-
import { withInstall as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as F, ref as y, watch as D, computed as S, onMounted as P, createVNode as w, nextTick as T, inject as Q } from "vue";
|
|
2
|
+
import { isPlainObject as q, cloneDeep as U } from "lodash-es";
|
|
3
|
+
import { withInstall as X } from "../common/index.esm.js";
|
|
4
|
+
const Y = "https://json-schema.org/draft/2020-12/schema", Z = "https://farris-design.gitee.io/capsule.schema.json", I = "capsule", K = "A Farris Component", x = "object", ee = {
|
|
5
5
|
id: {
|
|
6
6
|
description: "The unique identifier for a capsule",
|
|
7
7
|
type: "string"
|
|
@@ -63,55 +63,55 @@ const X = "https://json-schema.org/draft/2020-12/schema", Y = "https://farris-de
|
|
|
63
63
|
type: "boolean",
|
|
64
64
|
default: !0
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, te = [
|
|
67
67
|
"id",
|
|
68
68
|
"type"
|
|
69
|
-
],
|
|
70
|
-
$schema:
|
|
71
|
-
$id:
|
|
72
|
-
title:
|
|
73
|
-
description:
|
|
74
|
-
type:
|
|
75
|
-
properties:
|
|
76
|
-
required:
|
|
77
|
-
},
|
|
69
|
+
], ne = {
|
|
70
|
+
$schema: Y,
|
|
71
|
+
$id: Z,
|
|
72
|
+
title: I,
|
|
73
|
+
description: K,
|
|
74
|
+
type: x,
|
|
75
|
+
properties: ee,
|
|
76
|
+
required: te
|
|
77
|
+
}, _ = {}, J = {};
|
|
78
78
|
function W(n) {
|
|
79
|
-
const { properties: e, title: u, ignore: l } = n,
|
|
80
|
-
return (!
|
|
79
|
+
const { properties: e, title: u, ignore: l } = n, s = l && Array.isArray(l), o = Object.keys(e).reduce((i, g) => ((!s || !l.find((j) => j == g)) && (i[g] = e[g].type === "object" && e[g].properties ? W(e[g]) : U(e[g].default)), i), {});
|
|
80
|
+
return (!s || !l.find((i) => i == "id")) && (o.id = `${u}-${Date.now()}`), o;
|
|
81
81
|
}
|
|
82
82
|
function N(n, e = {}, u) {
|
|
83
|
-
const l =
|
|
83
|
+
const l = _[n];
|
|
84
84
|
if (l) {
|
|
85
|
-
let
|
|
86
|
-
const o =
|
|
87
|
-
return
|
|
85
|
+
let s = W(l);
|
|
86
|
+
const o = J[n];
|
|
87
|
+
return s = o ? o({ getSchemaByType: N }, s, e, u) : s, s;
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ae(n, e) {
|
|
92
92
|
const u = W(e);
|
|
93
|
-
return Object.keys(n).reduce((l,
|
|
93
|
+
return Object.keys(n).reduce((l, s) => (l[s] && q(l[s]) && q(n[s]) ? Object.assign(l[s], n[s]) : l[s] = n[s], l), u), u;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return Object.keys(n).filter((l) => n[l] != null).reduce((l,
|
|
97
|
-
if (e.has(
|
|
98
|
-
const o = e.get(
|
|
95
|
+
function le(n, e) {
|
|
96
|
+
return Object.keys(n).filter((l) => n[l] != null).reduce((l, s) => {
|
|
97
|
+
if (e.has(s)) {
|
|
98
|
+
const o = e.get(s);
|
|
99
99
|
if (typeof o == "string")
|
|
100
|
-
l[o] = n[
|
|
100
|
+
l[o] = n[s];
|
|
101
101
|
else {
|
|
102
|
-
const i = o(
|
|
102
|
+
const i = o(s, n[s], n);
|
|
103
103
|
Object.assign(l, i);
|
|
104
104
|
}
|
|
105
105
|
} else
|
|
106
|
-
l[
|
|
106
|
+
l[s] = n[s];
|
|
107
107
|
return l;
|
|
108
108
|
}, {});
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const l =
|
|
112
|
-
return
|
|
110
|
+
function se(n, e, u = /* @__PURE__ */ new Map()) {
|
|
111
|
+
const l = ae(n, e);
|
|
112
|
+
return le(l, u);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function ce(n = {}) {
|
|
115
115
|
function e(r, f, p, d) {
|
|
116
116
|
if (typeof p == "number")
|
|
117
117
|
return d[r].length === p;
|
|
@@ -134,7 +134,7 @@ function se(n = {}) {
|
|
|
134
134
|
["getProperty", u]
|
|
135
135
|
]);
|
|
136
136
|
Object.keys(n).reduce((r, f) => (r.set(f, n[f]), r), l);
|
|
137
|
-
function
|
|
137
|
+
function s(r, f) {
|
|
138
138
|
const p = r;
|
|
139
139
|
return typeof f == "number" ? [{ target: p, operator: "length", param: null, value: Number(f) }] : typeof f == "boolean" ? [{ target: p, operator: "getProperty", param: r, value: !!f }] : typeof f == "object" ? Object.keys(f).map((d) => {
|
|
140
140
|
if (d === "length")
|
|
@@ -145,7 +145,7 @@ function se(n = {}) {
|
|
|
145
145
|
}
|
|
146
146
|
function o(r) {
|
|
147
147
|
return Object.keys(r).reduce((p, d) => {
|
|
148
|
-
const h =
|
|
148
|
+
const h = s(d, r[d]);
|
|
149
149
|
return p.push(...h), p;
|
|
150
150
|
}, []);
|
|
151
151
|
}
|
|
@@ -159,30 +159,30 @@ function se(n = {}) {
|
|
|
159
159
|
function g(r, f) {
|
|
160
160
|
return o(r).reduce((h, b) => h && i(b, f), !0);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function j(r, f) {
|
|
163
163
|
const p = Object.keys(r), d = p.includes("allOf"), h = p.includes("anyOf"), b = d || h, V = (b ? r[b ? d ? "allOf" : "anyOf" : "allOf"] : [r]).map((C) => g(C, f));
|
|
164
164
|
return d ? !V.includes(!1) : V.includes(!0);
|
|
165
165
|
}
|
|
166
|
-
return { parseValueSchema:
|
|
166
|
+
return { parseValueSchema: j };
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
function
|
|
171
|
-
return
|
|
172
|
-
const g =
|
|
173
|
-
return Object.assign(
|
|
168
|
+
const re = {}, ue = {};
|
|
169
|
+
ce();
|
|
170
|
+
function oe(n, e, u = /* @__PURE__ */ new Map(), l = (i, g, j) => g, s = {}, o = (i) => i) {
|
|
171
|
+
return _[e.title] = e, J[e.title] = l, re[e.title] = s, ue[e.title] = o, (i = {}) => {
|
|
172
|
+
const g = se(i, e, u), j = Object.keys(n).reduce((r, f) => (r[f] = n[f].default, r), {});
|
|
173
|
+
return Object.assign(j, g);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function ie(n, e) {
|
|
177
177
|
return { customClass: e.class, customStyle: e.style };
|
|
178
178
|
}
|
|
179
|
-
const
|
|
180
|
-
["appearance",
|
|
179
|
+
const pe = /* @__PURE__ */ new Map([
|
|
180
|
+
["appearance", ie]
|
|
181
181
|
]);
|
|
182
|
-
function
|
|
182
|
+
function fe(n, e, u) {
|
|
183
183
|
return e;
|
|
184
184
|
}
|
|
185
|
-
const
|
|
185
|
+
const de = "capsule", ve = "A Farris Component", me = "object", ye = {
|
|
186
186
|
basic: {
|
|
187
187
|
description: "Basic Infomation",
|
|
188
188
|
title: "基本信息",
|
|
@@ -204,11 +204,11 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
},
|
|
208
|
-
title:
|
|
209
|
-
description:
|
|
210
|
-
type:
|
|
211
|
-
categories:
|
|
207
|
+
}, he = {
|
|
208
|
+
title: de,
|
|
209
|
+
description: ve,
|
|
210
|
+
type: me,
|
|
211
|
+
categories: ye
|
|
212
212
|
}, L = {
|
|
213
213
|
items: {
|
|
214
214
|
Type: Array,
|
|
@@ -222,7 +222,7 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
222
222
|
*/
|
|
223
223
|
modelValue: { type: String, default: "" },
|
|
224
224
|
type: { type: String, default: "primary" }
|
|
225
|
-
},
|
|
225
|
+
}, ge = {
|
|
226
226
|
name: { type: String, default: "" },
|
|
227
227
|
value: { type: String, default: "" },
|
|
228
228
|
isActive: { type: Boolean, default: !1 },
|
|
@@ -230,16 +230,16 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
230
230
|
index: { type: Number, default: 0 },
|
|
231
231
|
show: { type: Boolean, default: !0 },
|
|
232
232
|
disabled: { type: Boolean, default: !1 }
|
|
233
|
-
},
|
|
233
|
+
}, z = oe(L, ne, pe, fe, he), G = /* @__PURE__ */ F({
|
|
234
234
|
name: "FCapsuleItem",
|
|
235
|
-
props:
|
|
235
|
+
props: ge,
|
|
236
236
|
emits: ["mounted", "active"],
|
|
237
237
|
setup(n, e) {
|
|
238
238
|
const u = y(), l = y(n.isActive);
|
|
239
239
|
D(() => n.isActive, (i) => {
|
|
240
240
|
l.value = i;
|
|
241
241
|
});
|
|
242
|
-
const
|
|
242
|
+
const s = S(() => ({
|
|
243
243
|
"f-capsule-item": !0,
|
|
244
244
|
"f-capsule-active-item": l.value,
|
|
245
245
|
"f-capsule-disabled": n.disabled
|
|
@@ -255,7 +255,7 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
255
255
|
}
|
|
256
256
|
return () => w("div", {
|
|
257
257
|
ref: u,
|
|
258
|
-
class:
|
|
258
|
+
class: s.value,
|
|
259
259
|
onClick: (i) => o(i)
|
|
260
260
|
}, [n.icon && w("i", {
|
|
261
261
|
class: n.icon
|
|
@@ -266,14 +266,14 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
266
266
|
props: L,
|
|
267
267
|
emits: ["change", "update:modelValue"],
|
|
268
268
|
setup(n, e) {
|
|
269
|
-
const u = y(n.items), l = y(),
|
|
269
|
+
const u = y(n.items), l = y(), s = 2, o = y(n.modelValue), i = y("none"), g = y(n.type), j = S(() => {
|
|
270
270
|
const a = {
|
|
271
271
|
"f-capsule-container": !0
|
|
272
272
|
};
|
|
273
273
|
return g.value && (a[g.value] = !0), a;
|
|
274
274
|
}), r = S(() => ({})), f = S(() => ({
|
|
275
275
|
"f-capsule": !0
|
|
276
|
-
})), p = y(
|
|
276
|
+
})), p = y(s), d = y(0), h = y(0), b = S(() => ({
|
|
277
277
|
left: `${p.value}px`,
|
|
278
278
|
width: `${d.value}px`,
|
|
279
279
|
transition: i.value
|
|
@@ -283,26 +283,26 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
283
283
|
function V(a) {
|
|
284
284
|
var t;
|
|
285
285
|
if (A.has(a.value)) {
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
288
|
-
const m =
|
|
289
|
-
p.value = m.left - B.left +
|
|
286
|
+
const c = (t = A.get(a.value)) == null ? void 0 : t.value;
|
|
287
|
+
if (c) {
|
|
288
|
+
const m = c.getBoundingClientRect(), B = l.value.getBoundingClientRect();
|
|
289
|
+
p.value = m.left - B.left + s + l.value.scrollLeft, d.value = m.width - 2 * s;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
function M(a, t) {
|
|
294
|
-
const
|
|
295
|
-
o.value =
|
|
294
|
+
const c = a.value;
|
|
295
|
+
o.value = c, e.emit("update:modelValue", c), V(a), t && e.emit("change", c);
|
|
296
296
|
}
|
|
297
297
|
function C(a) {
|
|
298
|
-
const t = u.value.findIndex((
|
|
298
|
+
const t = u.value.findIndex((c) => c.value === a);
|
|
299
299
|
t > -1 && M(u.value[t], !1);
|
|
300
300
|
}
|
|
301
301
|
D(() => n.modelValue, (a) => {
|
|
302
302
|
o.value = a, C(o.value);
|
|
303
303
|
}), D(() => n.items, async (a) => {
|
|
304
|
-
const t = a.filter((
|
|
305
|
-
v(t), u.value = t, await T(), C(o.value), h.value = Array.from(A.values()).reduce((
|
|
304
|
+
const t = a.filter((c) => c.show);
|
|
305
|
+
v(t), u.value = t, await T(), C(o.value), h.value = Array.from(A.values()).reduce((c, m) => (c += m.value.clientWidth, c), 0);
|
|
306
306
|
}), P(async () => {
|
|
307
307
|
C(o.value), await T(), i.value = "0.1s ease-out all", h.value = Array.from(A.values()).reduce((a, t) => (a += t.value.clientWidth, a), 0);
|
|
308
308
|
});
|
|
@@ -317,8 +317,8 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
317
317
|
a.find((m) => m.value === t) || A.delete(t);
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
return w(
|
|
320
|
+
function O(a, t) {
|
|
321
|
+
return w(G, {
|
|
322
322
|
name: a.name,
|
|
323
323
|
value: a.value,
|
|
324
324
|
isActive: a.value === o.value,
|
|
@@ -331,11 +331,11 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
331
331
|
}
|
|
332
332
|
return () => w("span", {
|
|
333
333
|
ref: l,
|
|
334
|
-
class:
|
|
334
|
+
class: j.value,
|
|
335
335
|
style: r.value
|
|
336
336
|
}, [w("span", {
|
|
337
337
|
class: "f-capsule-pane"
|
|
338
|
-
}, [u.value.map((a, t) =>
|
|
338
|
+
}, [u.value.map((a, t) => O(a, t))]), w("small", {
|
|
339
339
|
class: f.value,
|
|
340
340
|
style: b.value
|
|
341
341
|
}, null), w("div", {
|
|
@@ -344,15 +344,15 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
344
344
|
}, null)]);
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
|
-
function
|
|
347
|
+
function be(n, e, u) {
|
|
348
348
|
var E;
|
|
349
349
|
function l() {
|
|
350
350
|
}
|
|
351
|
-
const
|
|
351
|
+
const s = "", o = "", i = y();
|
|
352
352
|
function g() {
|
|
353
353
|
return (e == null ? void 0 : e.schema.componentType) !== "frame";
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function j() {
|
|
356
356
|
return !1;
|
|
357
357
|
}
|
|
358
358
|
function r() {
|
|
@@ -366,12 +366,12 @@ function ge(n, e, u) {
|
|
|
366
366
|
return null;
|
|
367
367
|
if (v.value.schema && v.value.schema.type === "component")
|
|
368
368
|
return v.value;
|
|
369
|
-
const
|
|
369
|
+
const O = y(v == null ? void 0 : v.value.parent), a = p(O);
|
|
370
370
|
return a || null;
|
|
371
371
|
}
|
|
372
372
|
function d(v = e) {
|
|
373
|
-
const { componentInstance:
|
|
374
|
-
return !
|
|
373
|
+
const { componentInstance: O, designerItemElementRef: a } = v;
|
|
374
|
+
return !O || !O.value ? null : O.value.canMove ? a : d(v.parent);
|
|
375
375
|
}
|
|
376
376
|
function h(v) {
|
|
377
377
|
return !!u;
|
|
@@ -381,18 +381,18 @@ function ge(n, e, u) {
|
|
|
381
381
|
}
|
|
382
382
|
function R() {
|
|
383
383
|
}
|
|
384
|
-
function A(v,
|
|
384
|
+
function A(v, O) {
|
|
385
385
|
}
|
|
386
|
-
function V(v,
|
|
386
|
+
function V(v, O) {
|
|
387
387
|
const { componentType: a } = v;
|
|
388
|
-
let t = N(a, v,
|
|
389
|
-
const
|
|
390
|
-
return t && !t.id && t.type === a && (t.id = `${
|
|
388
|
+
let t = N(a, v, O);
|
|
389
|
+
const c = a.toLowerCase().replace("-", "_");
|
|
390
|
+
return t && !t.id && t.type === a && (t.id = `${c}_${Math.random().toString().slice(2, 6)}`), t;
|
|
391
391
|
}
|
|
392
|
-
function M(v,
|
|
393
|
-
const a = String(v.getAttribute("data-controltype")), t = v.getAttribute("data-feature"),
|
|
394
|
-
|
|
395
|
-
let m = N(a,
|
|
392
|
+
function M(v, O) {
|
|
393
|
+
const a = String(v.getAttribute("data-controltype")), t = v.getAttribute("data-feature"), c = t ? JSON.parse(t) : {};
|
|
394
|
+
c.parentComponentInstance = i.value;
|
|
395
|
+
let m = N(a, c);
|
|
396
396
|
const B = a.toLowerCase().replace("-", "_");
|
|
397
397
|
return m && !m.id && m.type === a && (m.id = `${B}_${Math.random().toString().slice(2, 6)}`), m;
|
|
398
398
|
}
|
|
@@ -402,14 +402,14 @@ function ge(n, e, u) {
|
|
|
402
402
|
}
|
|
403
403
|
return i.value = {
|
|
404
404
|
canMove: g(),
|
|
405
|
-
canSelectParent:
|
|
405
|
+
canSelectParent: j(),
|
|
406
406
|
canDelete: r(),
|
|
407
407
|
canNested: !f(),
|
|
408
408
|
contents: e == null ? void 0 : e.schema.contents,
|
|
409
409
|
elementRef: n,
|
|
410
410
|
parent: (E = e == null ? void 0 : e.parent) == null ? void 0 : E.componentInstance,
|
|
411
411
|
schema: e == null ? void 0 : e.schema,
|
|
412
|
-
styles:
|
|
412
|
+
styles: s,
|
|
413
413
|
designerClass: o,
|
|
414
414
|
canAccepts: h,
|
|
415
415
|
getBelongedComponentInstance: p,
|
|
@@ -426,12 +426,12 @@ function ge(n, e, u) {
|
|
|
426
426
|
triggerBelongedComponentToDeleteWhenDeleted: y(!1)
|
|
427
427
|
}, i;
|
|
428
428
|
}
|
|
429
|
-
const
|
|
429
|
+
const Oe = /* @__PURE__ */ F({
|
|
430
430
|
name: "FCapsuleDesign",
|
|
431
431
|
props: L,
|
|
432
432
|
emits: ["change", "update:modelValue"],
|
|
433
433
|
setup(n, e) {
|
|
434
|
-
const u = y(n.items), l = y(),
|
|
434
|
+
const u = y(n.items), l = y(), s = 2, o = y(n.modelValue), i = y("none"), g = y(n.type), j = Q("design-item-context"), r = be(l, j);
|
|
435
435
|
P(() => {
|
|
436
436
|
l.value.componentInstance = r;
|
|
437
437
|
}), e.expose(r.value);
|
|
@@ -442,7 +442,7 @@ const be = /* @__PURE__ */ F({
|
|
|
442
442
|
return g.value && (t[g.value] = !0), t;
|
|
443
443
|
}), p = S(() => ({})), d = S(() => ({
|
|
444
444
|
"f-capsule": !0
|
|
445
|
-
})), h = y(
|
|
445
|
+
})), h = y(s), b = y(0), R = y(0), A = S(() => ({
|
|
446
446
|
left: `${h.value}px`,
|
|
447
447
|
width: `${b.value}px`,
|
|
448
448
|
transition: i.value
|
|
@@ -450,43 +450,43 @@ const be = /* @__PURE__ */ F({
|
|
|
450
450
|
width: `${R.value}px`
|
|
451
451
|
})), M = /* @__PURE__ */ new Map();
|
|
452
452
|
function C(t) {
|
|
453
|
-
var
|
|
453
|
+
var c;
|
|
454
454
|
if (M.has(t.value)) {
|
|
455
|
-
const m = (
|
|
455
|
+
const m = (c = M.get(t.value)) == null ? void 0 : c.value;
|
|
456
456
|
if (m) {
|
|
457
|
-
const B = m.getBoundingClientRect(),
|
|
458
|
-
h.value = B.left -
|
|
457
|
+
const B = m.getBoundingClientRect(), H = l.value.getBoundingClientRect();
|
|
458
|
+
h.value = B.left - H.left + s + l.value.scrollLeft, b.value = B.width - 2 * s;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
function $(t,
|
|
462
|
+
function $(t, c) {
|
|
463
463
|
const m = t.value;
|
|
464
|
-
o.value = m, e.emit("update:modelValue", m), C(t),
|
|
464
|
+
o.value = m, e.emit("update:modelValue", m), C(t), c && e.emit("change", m);
|
|
465
465
|
}
|
|
466
466
|
function E(t) {
|
|
467
|
-
const
|
|
468
|
-
|
|
467
|
+
const c = u.value.findIndex((m) => m.value === t);
|
|
468
|
+
c > -1 && $(u.value[c], !1);
|
|
469
469
|
}
|
|
470
470
|
D(() => n.modelValue, (t) => {
|
|
471
471
|
o.value = t, E(o.value);
|
|
472
472
|
}), D(() => n.items, async (t) => {
|
|
473
|
-
u.value = t, await T(), E(o.value), R.value = Array.from(M.values()).reduce((
|
|
473
|
+
u.value = t, await T(), E(o.value), R.value = Array.from(M.values()).reduce((c, m) => (c += m.value.clientWidth, c), 0);
|
|
474
474
|
}), P(async () => {
|
|
475
|
-
E(o.value), await T(), i.value = "0.1s ease-out all", R.value = Array.from(M.values()).reduce((t,
|
|
475
|
+
E(o.value), await T(), i.value = "0.1s ease-out all", R.value = Array.from(M.values()).reduce((t, c) => (t += c.value.clientWidth, t), 0);
|
|
476
476
|
});
|
|
477
|
-
function v(t,
|
|
478
|
-
$(
|
|
477
|
+
function v(t, c) {
|
|
478
|
+
$(c, !0);
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
M.set(
|
|
480
|
+
function O(t, c) {
|
|
481
|
+
M.set(c, t);
|
|
482
482
|
}
|
|
483
|
-
function a(t,
|
|
484
|
-
return w(
|
|
483
|
+
function a(t, c) {
|
|
484
|
+
return w(G, {
|
|
485
485
|
name: t.name,
|
|
486
486
|
value: t.value,
|
|
487
487
|
isActive: t.value === o.value,
|
|
488
|
-
index:
|
|
489
|
-
onMounted:
|
|
488
|
+
index: c,
|
|
489
|
+
onMounted: O,
|
|
490
490
|
onActive: v
|
|
491
491
|
}, null);
|
|
492
492
|
}
|
|
@@ -496,7 +496,7 @@ const be = /* @__PURE__ */ F({
|
|
|
496
496
|
style: p.value
|
|
497
497
|
}, [w("span", {
|
|
498
498
|
class: "f-capsule-pane"
|
|
499
|
-
}, [u.value.map((t,
|
|
499
|
+
}, [u.value.map((t, c) => a(t, c))]), w("small", {
|
|
500
500
|
class: d.value,
|
|
501
501
|
style: A.value
|
|
502
502
|
}, null), w("div", {
|
|
@@ -506,16 +506,16 @@ const be = /* @__PURE__ */ F({
|
|
|
506
506
|
}
|
|
507
507
|
});
|
|
508
508
|
k.register = (n, e, u) => {
|
|
509
|
-
n.capsule = k, e.capsule =
|
|
509
|
+
n.capsule = k, e.capsule = z;
|
|
510
510
|
};
|
|
511
511
|
k.registerDesigner = (n, e, u) => {
|
|
512
|
-
n.capsule =
|
|
512
|
+
n.capsule = Oe, e.capsule = z;
|
|
513
513
|
};
|
|
514
|
-
const
|
|
514
|
+
const Me = X(k);
|
|
515
515
|
export {
|
|
516
516
|
k as FCapsule,
|
|
517
|
-
|
|
517
|
+
ge as capsuleItemProps,
|
|
518
518
|
L as capsuleProps,
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
Me as default,
|
|
520
|
+
z as propsResolver
|
|
521
521
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(O,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("lodash-es"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../common/index.umd.js"],t):(O=typeof globalThis<"u"?globalThis:O||self,t(O.capsule={},O.Vue,O.LodashES,O.common))})(this,function(O,t,W,_){"use strict";const J={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/capsule.schema.json",title:"capsule",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for a capsule",type:"string"},type:{description:"The type string of capsule component",type:"string",default:"capsule"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},require:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},k={},F={};function P(a){const{properties:e,title:u,ignore:s}=a,l=s&&Array.isArray(s),i=Object.keys(e).reduce((p,g)=>((!l||!s.find(V=>V==g))&&(p[g]=e[g].type==="object"&&e[g].properties?P(e[g]):W.cloneDeep(e[g].default)),p),{});return(!l||!s.find(p=>p=="id"))&&(i.id=`${u}-${Date.now()}`),i}function B(a,e={},u){const s=k[a];if(s){let l=P(s);const i=F[a];return l=i?i({getSchemaByType:B},l,e,u):l,l}return null}function z(a,e){const u=P(e);return Object.keys(a).reduce((s,l)=>(s[l]&&typeof s[l]=="object"?Object.assign(s[l],a[l]):s[l]=a[l],s),u),u}function G(a,e){return Object.keys(a).filter(s=>a[s]!=null).reduce((s,l)=>{if(e.has(l)){const i=e.get(l);if(typeof i=="string")s[i]=a[l];else{const p=i(l,a[l],a);Object.assign(s,p)}}else s[l]=a[l];return s},{})}function H(a,e,u=new Map){const s=z(a,e);return G(s,u)}function Q(a={}){function e(o,d,f,m){if(typeof f=="number")return m[o].length===f;if(typeof f=="object"){const v=Object.keys(f)[0],b=f[v];if(v==="not")return Number(m[o].length)!==Number(b);if(v==="moreThan")return Number(m[o].length)>=Number(b);if(v==="lessThan")return Number(m[o].length)<=Number(b)}return!1}function u(o,d,f,m){return m[o]&&m[o].propertyValue&&String(m[o].propertyValue.value)===String(f)}const s=new Map([["length",e],["getProperty",u]]);Object.keys(a).reduce((o,d)=>(o.set(d,a[d]),o),s);function l(o,d){const f=o;return typeof d=="number"?[{target:f,operator:"length",param:null,value:Number(d)}]:typeof d=="boolean"?[{target:f,operator:"getProperty",param:o,value:!!d}]:typeof d=="object"?Object.keys(d).map(m=>{if(m==="length")return{target:f,operator:"length",param:null,value:d[m]};const v=m,b=d[m];return{target:f,operator:"getProperty",param:v,value:b}}):[]}function i(o){return Object.keys(o).reduce((f,m)=>{const v=l(m,o[m]);return f.push(...v),f},[])}function p(o,d){if(s.has(o.operator)){const f=s.get(o.operator);return f&&f(o.target,o.param,o.value,d)||!1}return!1}function g(o,d){return i(o).reduce((v,b)=>v&&p(b,d),!0)}function V(o,d){const f=Object.keys(o),m=f.includes("allOf"),v=f.includes("anyOf"),b=m||v,C=(b?o[b?m?"allOf":"anyOf":"allOf"]:[o]).map(S=>g(S,d));return m?!C.includes(!1):C.includes(!0)}return{parseValueSchema:V}}const U={},X={};Q();function Y(a,e,u=new Map,s=(p,g,V)=>g,l={},i=p=>p){return k[e.title]=e,F[e.title]=s,U[e.title]=l,X[e.title]=i,(p={})=>{const g=H(p,e,u),V=Object.keys(a).reduce((o,d)=>(o[d]=a[d].default,o),{});return Object.assign(V,g)}}function Z(a,e){return{customClass:e.class,customStyle:e.style}}const I=new Map([["appearance",Z]]);function K(a,e,u){return e}const x={title:"capsule",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},E={items:{Type:Array,default:[{name:"升序",value:"asc",icon:"f-icon f-icon-col-ascendingorder"},{name:"降序",value:"desc",icon:"f-icon f-icon-col-descendingorder"}]},modelValue:{type:String,default:""},type:{type:String,default:"primary"}},q={name:{type:String,default:""},value:{type:String,default:""},isActive:{type:Boolean,default:!1},icon:{type:String,default:""},index:{type:Number,default:0},show:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},D=Y(E,J,I,K,x),L=t.defineComponent({name:"FCapsuleItem",props:q,emits:["mounted","active"],setup(a,e){const u=t.ref(),s=t.ref(a.isActive);t.watch(()=>a.isActive,p=>{s.value=p});const l=t.computed(()=>({"f-capsule-item":!0,"f-capsule-active-item":s.value,"f-capsule-disabled":a.disabled}));t.onMounted(()=>{e.emit("mounted",u,a.value)});function i(p){a.disabled||e.emit("active",p,{name:a.name,value:a.value})}return()=>t.createVNode("div",{ref:u,class:l.value,onClick:p=>i(p)},[a.icon&&t.createVNode("i",{class:a.icon},null),a.name])}}),T=t.defineComponent({name:"FCapsule",props:E,emits:["change","update:modelValue"],setup(a,e){const u=t.ref(a.items),s=t.ref(),l=2,i=t.ref(a.modelValue),p=t.ref("none"),g=t.ref(a.type),V=t.computed(()=>{const c={"f-capsule-container":!0};return g.value&&(c[g.value]=!0),c}),o=t.computed(()=>({})),d=t.computed(()=>({"f-capsule":!0})),f=t.ref(l),m=t.ref(0),v=t.ref(0),b=t.computed(()=>({left:`${f.value}px`,width:`${m.value}px`,transition:p.value})),A=t.computed(()=>({width:`${v.value}px`})),w=new Map;function C(c){var n;if(w.has(c.value)){const r=(n=w.get(c.value))==null?void 0:n.value;if(r){const h=r.getBoundingClientRect(),R=s.value.getBoundingClientRect();f.value=h.left-R.left+l+s.value.scrollLeft,m.value=h.width-2*l}}}function M(c,n){const r=c.value;i.value=r,e.emit("update:modelValue",r),C(c),n&&e.emit("change",r)}function S(c){const n=u.value.findIndex(r=>r.value===c);n>-1&&M(u.value[n],!1)}t.watch(()=>a.modelValue,c=>{i.value=c,S(i.value)}),t.watch(()=>a.items,async c=>{const n=c.filter(r=>r.show);y(n),u.value=n,await t.nextTick(),S(i.value),v.value=Array.from(w.values()).reduce((r,h)=>(r+=h.value.clientWidth,r),0)}),t.onMounted(async()=>{S(i.value),await t.nextTick(),p.value="0.1s ease-out all",v.value=Array.from(w.values()).reduce((c,n)=>(c+=n.value.clientWidth,c),0)});function N(c,n){M(n,!0)}function $(c,n){w.set(n,c)}function y(c){Array.from(w.keys()).forEach(n=>{c.find(h=>h.value===n)||w.delete(n)})}function j(c,n){return t.createVNode(L,{name:c.name,value:c.value,isActive:c.value===i.value,index:n,disabled:c.disabled,key:c.value,onMounted:$,onActive:N},null)}return()=>t.createVNode("span",{ref:s,class:V.value,style:o.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((c,n)=>j(c,n))]),t.createVNode("small",{class:d.value,style:b.value},null),t.createVNode("div",{class:"f-capsule-board",style:A.value},null)])}});function ee(a,e,u){var $;function s(){}const l="",i="",p=t.ref();function g(){return(e==null?void 0:e.schema.componentType)!=="frame"}function V(){return!1}function o(){return(e==null?void 0:e.schema.componentType)!=="frame"}function d(){return(e==null?void 0:e.schema.componentType)==="frame"}function f(y){if(!y||!y.value)return null;if(y.value.schema&&y.value.schema.type==="component")return y.value;const j=t.ref(y==null?void 0:y.value.parent),c=f(j);return c||null}function m(y=e){const{componentInstance:j,designerItemElementRef:c}=y;return!j||!j.value?null:j.value.canMove?c:m(y.parent)}function v(y){return!!u}function b(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function A(){}function w(y,j){}function C(y,j){const{componentType:c}=y;let n=B(c,y,j);const r=c.toLowerCase().replace("-","_");return n&&!n.id&&n.type===c&&(n.id=`${r}_${Math.random().toString().slice(2,6)}`),n}function M(y,j){const c=String(y.getAttribute("data-controltype")),n=y.getAttribute("data-feature"),r=n?JSON.parse(n):{};r.parentComponentInstance=p.value;let h=B(c,r);const R=c.toLowerCase().replace("-","_");return h&&!h.id&&h.type===c&&(h.id=`${R}_${Math.random().toString().slice(2,6)}`),h}function S(y){}function N(...y){}return p.value={canMove:g(),canSelectParent:V(),canDelete:o(),canNested:!d(),contents:e==null?void 0:e.schema.contents,elementRef:a,parent:($=e==null?void 0:e.parent)==null?void 0:$.componentInstance,schema:e==null?void 0:e.schema,styles:l,designerClass:i,canAccepts:v,getBelongedComponentInstance:f,getDraggableDesignItemElement:m,getDraggingDisplayText:b,getPropConfig:N,getDragScopeElement:A,onAcceptMovedChildElement:w,onAcceptNewChildElement:M,onChildElementMovedOut:S,addNewChildComponentSchema:C,updateDragAndDropRules:s,triggerBelongedComponentToMoveWhenMoved:t.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:t.ref(!1)},p}const te=t.defineComponent({name:"FCapsuleDesign",props:E,emits:["change","update:modelValue"],setup(a,e){const u=t.ref(a.items),s=t.ref(),l=2,i=t.ref(a.modelValue),p=t.ref("none"),g=t.ref(a.type),V=t.inject("design-item-context"),o=ee(s,V);t.onMounted(()=>{s.value.componentInstance=o}),e.expose(o.value);const d=t.computed(()=>{const n={"f-capsule-container":!0};return g.value&&(n[g.value]=!0),n}),f=t.computed(()=>({})),m=t.computed(()=>({"f-capsule":!0})),v=t.ref(l),b=t.ref(0),A=t.ref(0),w=t.computed(()=>({left:`${v.value}px`,width:`${b.value}px`,transition:p.value})),C=t.computed(()=>({width:`${A.value}px`})),M=new Map;function S(n){var r;if(M.has(n.value)){const h=(r=M.get(n.value))==null?void 0:r.value;if(h){const R=h.getBoundingClientRect(),ae=s.value.getBoundingClientRect();v.value=R.left-ae.left+l+s.value.scrollLeft,b.value=R.width-2*l}}}function N(n,r){const h=n.value;i.value=h,e.emit("update:modelValue",h),S(n),r&&e.emit("change",h)}function $(n){const r=u.value.findIndex(h=>h.value===n);r>-1&&N(u.value[r],!1)}t.watch(()=>a.modelValue,n=>{i.value=n,$(i.value)}),t.watch(()=>a.items,async n=>{u.value=n,await t.nextTick(),$(i.value),A.value=Array.from(M.values()).reduce((r,h)=>(r+=h.value.clientWidth,r),0)}),t.onMounted(async()=>{$(i.value),await t.nextTick(),p.value="0.1s ease-out all",A.value=Array.from(M.values()).reduce((n,r)=>(n+=r.value.clientWidth,n),0)});function y(n,r){N(r,!0)}function j(n,r){M.set(r,n)}function c(n,r){return t.createVNode(L,{name:n.name,value:n.value,isActive:n.value===i.value,index:r,onMounted:j,onActive:y},null)}return()=>t.createVNode("span",{ref:s,class:d.value,style:f.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((n,r)=>c(n,r))]),t.createVNode("small",{class:m.value,style:w.value},null),t.createVNode("div",{class:"f-capsule-board",style:C.value},null)])}});T.register=(a,e,u)=>{a.capsule=T,e.capsule=D},T.registerDesigner=(a,e,u)=>{a.capsule=te,e.capsule=D};const ne=_.withInstall(T);O.FCapsule=T,O.capsuleItemProps=q,O.capsuleProps=E,O.default=ne,O.propsResolver=D,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(O,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("lodash-es"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../common/index.umd.js"],t):(O=typeof globalThis<"u"?globalThis:O||self,t(O.capsule={},O.Vue,O.LodashES,O.common))})(this,function(O,t,B,_){"use strict";const J={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/capsule.schema.json",title:"capsule",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for a capsule",type:"string"},type:{description:"The type string of capsule component",type:"string",default:"capsule"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},require:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},F={},q={};function E(a){const{properties:e,title:u,ignore:s}=a,r=s&&Array.isArray(s),i=Object.keys(e).reduce((p,g)=>((!r||!s.find(V=>V==g))&&(p[g]=e[g].type==="object"&&e[g].properties?E(e[g]):B.cloneDeep(e[g].default)),p),{});return(!r||!s.find(p=>p=="id"))&&(i.id=`${u}-${Date.now()}`),i}function D(a,e={},u){const s=F[a];if(s){let r=E(s);const i=q[a];return r=i?i({getSchemaByType:D},r,e,u):r,r}return null}function z(a,e){const u=E(e);return Object.keys(a).reduce((s,r)=>(s[r]&&B.isPlainObject(s[r])&&B.isPlainObject(a[r])?Object.assign(s[r],a[r]):s[r]=a[r],s),u),u}function G(a,e){return Object.keys(a).filter(s=>a[s]!=null).reduce((s,r)=>{if(e.has(r)){const i=e.get(r);if(typeof i=="string")s[i]=a[r];else{const p=i(r,a[r],a);Object.assign(s,p)}}else s[r]=a[r];return s},{})}function H(a,e,u=new Map){const s=z(a,e);return G(s,u)}function Q(a={}){function e(o,d,f,m){if(typeof f=="number")return m[o].length===f;if(typeof f=="object"){const v=Object.keys(f)[0],b=f[v];if(v==="not")return Number(m[o].length)!==Number(b);if(v==="moreThan")return Number(m[o].length)>=Number(b);if(v==="lessThan")return Number(m[o].length)<=Number(b)}return!1}function u(o,d,f,m){return m[o]&&m[o].propertyValue&&String(m[o].propertyValue.value)===String(f)}const s=new Map([["length",e],["getProperty",u]]);Object.keys(a).reduce((o,d)=>(o.set(d,a[d]),o),s);function r(o,d){const f=o;return typeof d=="number"?[{target:f,operator:"length",param:null,value:Number(d)}]:typeof d=="boolean"?[{target:f,operator:"getProperty",param:o,value:!!d}]:typeof d=="object"?Object.keys(d).map(m=>{if(m==="length")return{target:f,operator:"length",param:null,value:d[m]};const v=m,b=d[m];return{target:f,operator:"getProperty",param:v,value:b}}):[]}function i(o){return Object.keys(o).reduce((f,m)=>{const v=r(m,o[m]);return f.push(...v),f},[])}function p(o,d){if(s.has(o.operator)){const f=s.get(o.operator);return f&&f(o.target,o.param,o.value,d)||!1}return!1}function g(o,d){return i(o).reduce((v,b)=>v&&p(b,d),!0)}function V(o,d){const f=Object.keys(o),m=f.includes("allOf"),v=f.includes("anyOf"),b=m||v,C=(b?o[b?m?"allOf":"anyOf":"allOf"]:[o]).map(S=>g(S,d));return m?!C.includes(!1):C.includes(!0)}return{parseValueSchema:V}}const U={},X={};Q();function Y(a,e,u=new Map,s=(p,g,V)=>g,r={},i=p=>p){return F[e.title]=e,q[e.title]=s,U[e.title]=r,X[e.title]=i,(p={})=>{const g=H(p,e,u),V=Object.keys(a).reduce((o,d)=>(o[d]=a[d].default,o),{});return Object.assign(V,g)}}function Z(a,e){return{customClass:e.class,customStyle:e.style}}const I=new Map([["appearance",Z]]);function K(a,e,u){return e}const x={title:"capsule",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},T={items:{Type:Array,default:[{name:"升序",value:"asc",icon:"f-icon f-icon-col-ascendingorder"},{name:"降序",value:"desc",icon:"f-icon f-icon-col-descendingorder"}]},modelValue:{type:String,default:""},type:{type:String,default:"primary"}},L={name:{type:String,default:""},value:{type:String,default:""},isActive:{type:Boolean,default:!1},icon:{type:String,default:""},index:{type:Number,default:0},show:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},k=Y(T,J,I,K,x),W=t.defineComponent({name:"FCapsuleItem",props:L,emits:["mounted","active"],setup(a,e){const u=t.ref(),s=t.ref(a.isActive);t.watch(()=>a.isActive,p=>{s.value=p});const r=t.computed(()=>({"f-capsule-item":!0,"f-capsule-active-item":s.value,"f-capsule-disabled":a.disabled}));t.onMounted(()=>{e.emit("mounted",u,a.value)});function i(p){a.disabled||e.emit("active",p,{name:a.name,value:a.value})}return()=>t.createVNode("div",{ref:u,class:r.value,onClick:p=>i(p)},[a.icon&&t.createVNode("i",{class:a.icon},null),a.name])}}),P=t.defineComponent({name:"FCapsule",props:T,emits:["change","update:modelValue"],setup(a,e){const u=t.ref(a.items),s=t.ref(),r=2,i=t.ref(a.modelValue),p=t.ref("none"),g=t.ref(a.type),V=t.computed(()=>{const c={"f-capsule-container":!0};return g.value&&(c[g.value]=!0),c}),o=t.computed(()=>({})),d=t.computed(()=>({"f-capsule":!0})),f=t.ref(r),m=t.ref(0),v=t.ref(0),b=t.computed(()=>({left:`${f.value}px`,width:`${m.value}px`,transition:p.value})),A=t.computed(()=>({width:`${v.value}px`})),w=new Map;function C(c){var n;if(w.has(c.value)){const l=(n=w.get(c.value))==null?void 0:n.value;if(l){const h=l.getBoundingClientRect(),R=s.value.getBoundingClientRect();f.value=h.left-R.left+r+s.value.scrollLeft,m.value=h.width-2*r}}}function M(c,n){const l=c.value;i.value=l,e.emit("update:modelValue",l),C(c),n&&e.emit("change",l)}function S(c){const n=u.value.findIndex(l=>l.value===c);n>-1&&M(u.value[n],!1)}t.watch(()=>a.modelValue,c=>{i.value=c,S(i.value)}),t.watch(()=>a.items,async c=>{const n=c.filter(l=>l.show);y(n),u.value=n,await t.nextTick(),S(i.value),v.value=Array.from(w.values()).reduce((l,h)=>(l+=h.value.clientWidth,l),0)}),t.onMounted(async()=>{S(i.value),await t.nextTick(),p.value="0.1s ease-out all",v.value=Array.from(w.values()).reduce((c,n)=>(c+=n.value.clientWidth,c),0)});function N(c,n){M(n,!0)}function $(c,n){w.set(n,c)}function y(c){Array.from(w.keys()).forEach(n=>{c.find(h=>h.value===n)||w.delete(n)})}function j(c,n){return t.createVNode(W,{name:c.name,value:c.value,isActive:c.value===i.value,index:n,disabled:c.disabled,key:c.value,onMounted:$,onActive:N},null)}return()=>t.createVNode("span",{ref:s,class:V.value,style:o.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((c,n)=>j(c,n))]),t.createVNode("small",{class:d.value,style:b.value},null),t.createVNode("div",{class:"f-capsule-board",style:A.value},null)])}});function ee(a,e,u){var $;function s(){}const r="",i="",p=t.ref();function g(){return(e==null?void 0:e.schema.componentType)!=="frame"}function V(){return!1}function o(){return(e==null?void 0:e.schema.componentType)!=="frame"}function d(){return(e==null?void 0:e.schema.componentType)==="frame"}function f(y){if(!y||!y.value)return null;if(y.value.schema&&y.value.schema.type==="component")return y.value;const j=t.ref(y==null?void 0:y.value.parent),c=f(j);return c||null}function m(y=e){const{componentInstance:j,designerItemElementRef:c}=y;return!j||!j.value?null:j.value.canMove?c:m(y.parent)}function v(y){return!!u}function b(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function A(){}function w(y,j){}function C(y,j){const{componentType:c}=y;let n=D(c,y,j);const l=c.toLowerCase().replace("-","_");return n&&!n.id&&n.type===c&&(n.id=`${l}_${Math.random().toString().slice(2,6)}`),n}function M(y,j){const c=String(y.getAttribute("data-controltype")),n=y.getAttribute("data-feature"),l=n?JSON.parse(n):{};l.parentComponentInstance=p.value;let h=D(c,l);const R=c.toLowerCase().replace("-","_");return h&&!h.id&&h.type===c&&(h.id=`${R}_${Math.random().toString().slice(2,6)}`),h}function S(y){}function N(...y){}return p.value={canMove:g(),canSelectParent:V(),canDelete:o(),canNested:!d(),contents:e==null?void 0:e.schema.contents,elementRef:a,parent:($=e==null?void 0:e.parent)==null?void 0:$.componentInstance,schema:e==null?void 0:e.schema,styles:r,designerClass:i,canAccepts:v,getBelongedComponentInstance:f,getDraggableDesignItemElement:m,getDraggingDisplayText:b,getPropConfig:N,getDragScopeElement:A,onAcceptMovedChildElement:w,onAcceptNewChildElement:M,onChildElementMovedOut:S,addNewChildComponentSchema:C,updateDragAndDropRules:s,triggerBelongedComponentToMoveWhenMoved:t.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:t.ref(!1)},p}const te=t.defineComponent({name:"FCapsuleDesign",props:T,emits:["change","update:modelValue"],setup(a,e){const u=t.ref(a.items),s=t.ref(),r=2,i=t.ref(a.modelValue),p=t.ref("none"),g=t.ref(a.type),V=t.inject("design-item-context"),o=ee(s,V);t.onMounted(()=>{s.value.componentInstance=o}),e.expose(o.value);const d=t.computed(()=>{const n={"f-capsule-container":!0};return g.value&&(n[g.value]=!0),n}),f=t.computed(()=>({})),m=t.computed(()=>({"f-capsule":!0})),v=t.ref(r),b=t.ref(0),A=t.ref(0),w=t.computed(()=>({left:`${v.value}px`,width:`${b.value}px`,transition:p.value})),C=t.computed(()=>({width:`${A.value}px`})),M=new Map;function S(n){var l;if(M.has(n.value)){const h=(l=M.get(n.value))==null?void 0:l.value;if(h){const R=h.getBoundingClientRect(),ae=s.value.getBoundingClientRect();v.value=R.left-ae.left+r+s.value.scrollLeft,b.value=R.width-2*r}}}function N(n,l){const h=n.value;i.value=h,e.emit("update:modelValue",h),S(n),l&&e.emit("change",h)}function $(n){const l=u.value.findIndex(h=>h.value===n);l>-1&&N(u.value[l],!1)}t.watch(()=>a.modelValue,n=>{i.value=n,$(i.value)}),t.watch(()=>a.items,async n=>{u.value=n,await t.nextTick(),$(i.value),A.value=Array.from(M.values()).reduce((l,h)=>(l+=h.value.clientWidth,l),0)}),t.onMounted(async()=>{$(i.value),await t.nextTick(),p.value="0.1s ease-out all",A.value=Array.from(M.values()).reduce((n,l)=>(n+=l.value.clientWidth,n),0)});function y(n,l){N(l,!0)}function j(n,l){M.set(l,n)}function c(n,l){return t.createVNode(W,{name:n.name,value:n.value,isActive:n.value===i.value,index:l,onMounted:j,onActive:y},null)}return()=>t.createVNode("span",{ref:s,class:d.value,style:f.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((n,l)=>c(n,l))]),t.createVNode("small",{class:m.value,style:w.value},null),t.createVNode("div",{class:"f-capsule-board",style:C.value},null)])}});P.register=(a,e,u)=>{a.capsule=P,e.capsule=k},P.registerDesigner=(a,e,u)=>{a.capsule=te,e.capsule=k};const ne=_.withInstall(P);O.FCapsule=P,O.capsuleItemProps=L,O.capsuleProps=T,O.default=ne,O.propsResolver=k,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|