@farris/ui-vue 1.2.7 → 1.2.9
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 +136 -136
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +418 -456
- package/components/avatar/index.umd.cjs +1 -1
- package/components/border-editor/index.esm.js +4 -4
- package/components/border-editor/index.umd.cjs +1 -1
- package/components/button/index.esm.js +1 -1
- package/components/button/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +363 -436
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/button-group/index.esm.js +5 -5
- package/components/button-group/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +417 -417
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +176 -176
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +557 -594
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +119 -119
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +502 -535
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +69 -69
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/component/index.esm.js +387 -275
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +1219 -983
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +292 -219
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.css +1 -1
- package/components/data-grid/index.esm.js +5718 -5546
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +3291 -2930
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +2650 -2682
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/dependent-base/style.js +1 -0
- package/components/dependent-fluid/style.js +1 -0
- package/components/dependent-icon/style.js +1 -0
- package/components/dependent-input/style.js +1 -0
- package/components/dependent-table/style.js +1 -0
- package/components/designer-canvas/index.css +1 -1
- package/components/designer-canvas/index.esm.js +945 -932
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/designer-outline/index.css +1 -1
- package/components/designer-outline/index.esm.js +175 -133
- package/components/designer-outline/index.umd.cjs +1 -1
- package/components/designer-toolbox/index.esm.js +36 -12
- package/components/designer-toolbox/index.umd.cjs +1 -1
- package/components/discussion-editor/index.esm.js +1 -1
- package/components/discussion-editor/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +246 -246
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +1319 -1172
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +119 -82
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/dynamic-view/index.esm.js +258 -249
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/enum-editor/index.esm.js +3 -3
- package/components/enum-editor/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +569 -514
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +104 -104
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.css +1 -1
- package/components/external-container/index.esm.js +3122 -2686
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.css +1 -1
- package/components/field-selector/index.esm.js +6780 -6608
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.css +1 -1
- package/components/filter-bar/index.esm.js +1466 -1523
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.css +1 -1
- package/components/flow-canvas/index.esm.js +1048 -1035
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +422 -422
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +674 -716
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +291 -291
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +303 -230
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.css +1 -1
- package/components/list-view/index.esm.js +2486 -2130
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.css +1 -1
- package/components/lookup/index.esm.js +7474 -7272
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.css +1 -1
- package/components/mapping-editor/index.esm.js +6139 -5949
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/message-box/index.esm.js +1 -1
- package/components/message-box/index.umd.cjs +1 -1
- package/components/modal/index.esm.js +1 -1
- package/components/modal/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +432 -371
- package/components/nav/index.umd.cjs +3 -3
- package/components/number-range/index.esm.js +1124 -0
- package/components/number-range/index.umd.cjs +1 -0
- package/components/number-range/package.json +8 -0
- package/components/number-range/style.js +6 -0
- package/components/number-spinner/index.esm.js +1155 -0
- package/components/number-spinner/index.umd.cjs +1 -0
- package/components/number-spinner/package.json +8 -0
- package/components/number-spinner/style.js +4 -0
- package/components/order/index.css +1 -1
- package/components/order/index.esm.js +1215 -1178
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +147 -147
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +1240 -1346
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +489 -428
- package/components/pagination/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +220 -220
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.esm.js +1512 -1540
- package/components/property-editor/index.umd.cjs +3 -3
- package/components/property-panel/index.css +1 -1
- package/components/property-panel/index.esm.js +749 -815
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.css +1 -0
- package/components/query-solution/index.esm.js +7074 -0
- package/components/query-solution/index.umd.cjs +1 -0
- package/components/query-solution/package.json +8 -0
- package/components/query-solution/style.js +2 -0
- package/components/radio-button/index.esm.js +86 -86
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +442 -479
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +213 -208
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +116 -116
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +943 -918
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +1174 -1295
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.css +1 -1
- package/components/schema-selector/index.esm.js +5383 -5171
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +201 -201
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +684 -542
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +121 -121
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/spacing-editor/index.esm.js +2 -2
- package/components/spacing-editor/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +1158 -382
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +232 -232
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +451 -487
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +2078 -2168
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +318 -320
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +192 -192
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +471 -497
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.esm.js +1421 -1441
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.css +1 -1
- package/components/transfer/index.esm.js +430 -421
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.css +1 -1
- package/components/tree-grid/index.esm.js +6806 -6624
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +2793 -2433
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +165 -165
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +255 -255
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +413 -334
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +902 -902
- package/components/weather/index.umd.cjs +4 -4
- package/farris.all.esm.js +54155 -52847
- package/farris.all.umd.cjs +9 -9
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/button-edit/src/designer/button-group.design.component.d.ts +7 -0
- package/types/checkbox/index.d.ts +1 -0
- package/types/combo-list/src/components/list-container.component.d.ts +3 -0
- package/types/combo-list/src/components/list-container.props.d.ts +5 -1
- package/types/common/entity/entity-schema.d.ts +258 -0
- package/types/component/src/component-ref.props.d.ts +4 -0
- package/types/component/src/composition/inner-component-build-info.d.ts +27 -0
- package/types/component/src/designer/use-designer-rules.d.ts +2 -2
- package/types/data-grid/index.d.ts +5 -2
- package/types/data-grid/src/composition/data-grid-component-creator.service.d.ts +33 -0
- package/types/data-grid/src/data-grid.component.d.ts +2 -1
- package/types/data-grid/src/data-grid.props.d.ts +2 -2
- package/types/data-grid/src/designer/column-header.design.component.d.ts +1 -1
- package/types/data-grid/src/designer/data-grid-column.props.d.ts +1 -0
- package/types/data-grid/src/designer/use-group-column.d.ts +20 -0
- package/types/data-grid/src/property-config/data-grid.property-config.d.ts +4 -0
- package/types/data-grid/src/schema/schema-resolver.d.ts +2 -1
- package/types/data-view/components/column-format/boolean.component.d.ts +4 -0
- package/types/data-view/components/column-format/column-format.component.d.ts +4 -0
- package/types/data-view/components/column-format/date.component.d.ts +4 -0
- package/types/data-view/components/column-format/enum.component.d.ts +4 -0
- package/types/data-view/components/column-format/number.component.d.ts +4 -0
- package/types/data-view/composition/pagination/use-pagination.d.ts +1 -0
- package/types/data-view/composition/types.d.ts +19 -7
- package/types/data-view/composition/use-edit.d.ts +2 -1
- package/types/designer-canvas/src/composition/dg-control.d.ts +16 -350
- package/types/designer-canvas/src/composition/function/use-dragula.d.ts +2 -2
- package/types/designer-canvas/src/types.d.ts +3 -3
- package/types/dynamic-form/index.d.ts +3 -1
- package/types/dynamic-form/src/composition/response-form-component-creator.service.d.ts +31 -0
- package/types/dynamic-form/src/schema/schema-resolver.d.ts +2 -1
- package/types/dynamic-form/src/types.d.ts +1 -1
- package/types/dynamic-resolver/index.d.ts +1 -0
- package/types/dynamic-resolver/src/binding-resolver.d.ts +1 -0
- package/types/dynamic-resolver/src/schema-resolver.d.ts +2 -1
- package/types/dynamic-resolver/src/types.d.ts +3 -2
- package/types/dynamic-view/src/dynamic-view.component.d.ts +1 -1
- package/types/lookup/src/property-config/lookup.property-config.d.ts +2 -1
- package/types/modal/src/modal.props.d.ts +1 -4
- package/types/property-panel/src/composition/entity/base-property.d.ts +0 -12
- package/types/property-panel/src/composition/entity/input-base-property.d.ts +11 -26
- package/types/property-panel/src/composition/entity/schema-dom-mapping.d.ts +10 -8
- package/types/response-toolbar/src/response-toolbar.props.d.ts +2 -2
- package/types/response-toolbar/src/schema/schema-mapper.d.ts +4 -0
- package/types/section/src/property-config/section.property-config.d.ts +93 -0
- package/types/section/src/schema/schema-resolver.d.ts +2 -1
- package/types/tabs/src/composition/types.d.ts +2 -2
- package/types/tabs/src/designer/tab-header-item.design.component.d.ts +3 -1
- package/types/tabs/src/designer/tab-toolbar-item.props.d.ts +19 -0
- package/types/tabs/src/property-config/tab-page.property-config.d.ts +60 -0
- package/types/tabs/src/property-config/tabs.property-config.d.ts +6 -6
- package/types/tabs/src/schema/schema-resolver.d.ts +2 -1
- package/types/tags/index.d.ts +36 -5
- package/types/tree-grid/src/designer/use-designer-rules.d.ts +3 -0
- package/types/tree-grid/src/property-config/tree-grid.property-config.d.ts +11 -0
- package/types/tree-grid/src/schema/column-resolver.d.ts +1 -1
- package/types/tree-grid/src/tree-grid.props.d.ts +8 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as F, ref as y, watch as D, computed as S, onMounted as P, createVNode as
|
|
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 H } from "vue";
|
|
2
2
|
import { cloneDeep as Q } from "lodash-es";
|
|
3
|
-
import { withInstall as U } from "
|
|
3
|
+
import { withInstall as U } from "../common/index.esm.js";
|
|
4
4
|
const X = "https://json-schema.org/draft/2020-12/schema", Y = "https://farris-design.gitee.io/capsule.schema.json", Z = "capsule", I = "A Farris Component", K = "object", x = {
|
|
5
5
|
id: {
|
|
6
6
|
description: "The unique identifier for a capsule",
|
|
@@ -76,34 +76,34 @@ const X = "https://json-schema.org/draft/2020-12/schema", Y = "https://farris-de
|
|
|
76
76
|
required: ee
|
|
77
77
|
}, q = {}, _ = {};
|
|
78
78
|
function W(n) {
|
|
79
|
-
const { properties: e, title: u } = n, l = Object.keys(e).reduce((
|
|
80
|
-
return l.id = `${u}-${Date.now()}
|
|
79
|
+
const { properties: e, title: u, ignore: l } = n, c = l && Array.isArray(l), o = Object.keys(e).reduce((i, g) => ((!c || !l.find((O) => O == g)) && (i[g] = e[g].type === "object" && e[g].properties ? W(e[g]) : Q(e[g].default)), i), {});
|
|
80
|
+
return (!c || !l.find((i) => i == "id")) && (o.id = `${u}-${Date.now()}`), o;
|
|
81
81
|
}
|
|
82
|
-
function N(n, e = {}) {
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
return
|
|
82
|
+
function N(n, e = {}, u) {
|
|
83
|
+
const l = q[n];
|
|
84
|
+
if (l) {
|
|
85
|
+
let c = W(l);
|
|
86
|
+
const o = _[n];
|
|
87
|
+
return c = o ? o({ getSchemaByType: N }, c, e, u) : c, c;
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
91
|
function ne(n, e) {
|
|
92
92
|
const u = W(e);
|
|
93
|
-
return Object.keys(n).reduce((l,
|
|
93
|
+
return Object.keys(n).reduce((l, c) => (l[c] && typeof l[c] == "object" ? Object.assign(l[c], n[c]) : l[c] = n[c], l), u), u;
|
|
94
94
|
}
|
|
95
95
|
function ae(n, e) {
|
|
96
|
-
return Object.keys(n).filter((l) => n[l] != null).reduce((l,
|
|
97
|
-
if (e.has(
|
|
98
|
-
const o = e.get(
|
|
96
|
+
return Object.keys(n).filter((l) => n[l] != null).reduce((l, c) => {
|
|
97
|
+
if (e.has(c)) {
|
|
98
|
+
const o = e.get(c);
|
|
99
99
|
if (typeof o == "string")
|
|
100
|
-
l[o] = n[
|
|
100
|
+
l[o] = n[c];
|
|
101
101
|
else {
|
|
102
|
-
const
|
|
103
|
-
Object.assign(l,
|
|
102
|
+
const i = o(c, n[c], n);
|
|
103
|
+
Object.assign(l, i);
|
|
104
104
|
}
|
|
105
105
|
} else
|
|
106
|
-
l[
|
|
106
|
+
l[c] = n[c];
|
|
107
107
|
return l;
|
|
108
108
|
}, {});
|
|
109
109
|
}
|
|
@@ -112,65 +112,65 @@ function le(n, e, u = /* @__PURE__ */ new Map()) {
|
|
|
112
112
|
return ae(l, u);
|
|
113
113
|
}
|
|
114
114
|
function se(n = {}) {
|
|
115
|
-
function e(
|
|
116
|
-
if (typeof
|
|
117
|
-
return
|
|
118
|
-
if (typeof
|
|
119
|
-
const h = Object.keys(
|
|
115
|
+
function e(r, f, p, d) {
|
|
116
|
+
if (typeof p == "number")
|
|
117
|
+
return d[r].length === p;
|
|
118
|
+
if (typeof p == "object") {
|
|
119
|
+
const h = Object.keys(p)[0], b = p[h];
|
|
120
120
|
if (h === "not")
|
|
121
|
-
return Number(
|
|
121
|
+
return Number(d[r].length) !== Number(b);
|
|
122
122
|
if (h === "moreThan")
|
|
123
|
-
return Number(
|
|
123
|
+
return Number(d[r].length) >= Number(b);
|
|
124
124
|
if (h === "lessThan")
|
|
125
|
-
return Number(
|
|
125
|
+
return Number(d[r].length) <= Number(b);
|
|
126
126
|
}
|
|
127
127
|
return !1;
|
|
128
128
|
}
|
|
129
|
-
function u(
|
|
130
|
-
return
|
|
129
|
+
function u(r, f, p, d) {
|
|
130
|
+
return d[r] && d[r].propertyValue && String(d[r].propertyValue.value) === String(p);
|
|
131
131
|
}
|
|
132
132
|
const l = /* @__PURE__ */ new Map([
|
|
133
133
|
["length", e],
|
|
134
134
|
["getProperty", u]
|
|
135
135
|
]);
|
|
136
|
-
Object.keys(n).reduce((
|
|
137
|
-
function r
|
|
138
|
-
const
|
|
139
|
-
return typeof
|
|
140
|
-
if (
|
|
141
|
-
return { target:
|
|
142
|
-
const h =
|
|
143
|
-
return { target:
|
|
136
|
+
Object.keys(n).reduce((r, f) => (r.set(f, n[f]), r), l);
|
|
137
|
+
function c(r, f) {
|
|
138
|
+
const p = r;
|
|
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
|
+
if (d === "length")
|
|
141
|
+
return { target: p, operator: "length", param: null, value: f[d] };
|
|
142
|
+
const h = d, b = f[d];
|
|
143
|
+
return { target: p, operator: "getProperty", param: h, value: b };
|
|
144
144
|
}) : [];
|
|
145
145
|
}
|
|
146
|
-
function o(
|
|
147
|
-
return Object.keys(
|
|
148
|
-
const h =
|
|
149
|
-
return
|
|
146
|
+
function o(r) {
|
|
147
|
+
return Object.keys(r).reduce((p, d) => {
|
|
148
|
+
const h = c(d, r[d]);
|
|
149
|
+
return p.push(...h), p;
|
|
150
150
|
}, []);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
if (l.has(
|
|
154
|
-
const
|
|
155
|
-
return
|
|
152
|
+
function i(r, f) {
|
|
153
|
+
if (l.has(r.operator)) {
|
|
154
|
+
const p = l.get(r.operator);
|
|
155
|
+
return p && p(r.target, r.param, r.value, f) || !1;
|
|
156
156
|
}
|
|
157
157
|
return !1;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
return o(
|
|
159
|
+
function g(r, f) {
|
|
160
|
+
return o(r).reduce((h, b) => h && i(b, f), !0);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
164
|
-
return
|
|
162
|
+
function O(r, f) {
|
|
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
|
+
return d ? !V.includes(!1) : V.includes(!0);
|
|
165
165
|
}
|
|
166
|
-
return { parseValueSchema:
|
|
166
|
+
return { parseValueSchema: O };
|
|
167
167
|
}
|
|
168
168
|
const ce = {}, re = {};
|
|
169
169
|
se();
|
|
170
|
-
function ue(n, e, u = /* @__PURE__ */ new Map(), l = (
|
|
171
|
-
return q[e.title] = e, _[e.title] = l, ce[e.title] =
|
|
172
|
-
const
|
|
173
|
-
return Object.assign(
|
|
170
|
+
function ue(n, e, u = /* @__PURE__ */ new Map(), l = (i, g, O) => g, c = {}, o = (i) => i) {
|
|
171
|
+
return q[e.title] = e, _[e.title] = l, ce[e.title] = c, re[e.title] = o, (i = {}) => {
|
|
172
|
+
const g = le(i, e, u), O = Object.keys(n).reduce((r, f) => (r[f] = n[f].default, r), {});
|
|
173
|
+
return Object.assign(O, g);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
function oe(n, e) {
|
|
@@ -236,10 +236,10 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
236
236
|
emits: ["mounted", "active"],
|
|
237
237
|
setup(n, e) {
|
|
238
238
|
const u = y(), l = y(n.isActive);
|
|
239
|
-
D(() => n.isActive, (
|
|
240
|
-
l.value =
|
|
239
|
+
D(() => n.isActive, (i) => {
|
|
240
|
+
l.value = i;
|
|
241
241
|
});
|
|
242
|
-
const
|
|
242
|
+
const c = S(() => ({
|
|
243
243
|
"f-capsule-item": !0,
|
|
244
244
|
"f-capsule-active-item": l.value,
|
|
245
245
|
"f-capsule-disabled": n.disabled
|
|
@@ -247,17 +247,17 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
247
247
|
P(() => {
|
|
248
248
|
e.emit("mounted", u, n.value);
|
|
249
249
|
});
|
|
250
|
-
function o(
|
|
251
|
-
n.disabled || e.emit("active",
|
|
250
|
+
function o(i) {
|
|
251
|
+
n.disabled || e.emit("active", i, {
|
|
252
252
|
name: n.name,
|
|
253
253
|
value: n.value
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
return () =>
|
|
256
|
+
return () => w("div", {
|
|
257
257
|
ref: u,
|
|
258
|
-
class:
|
|
259
|
-
onClick: (
|
|
260
|
-
}, [n.icon &&
|
|
258
|
+
class: c.value,
|
|
259
|
+
onClick: (i) => o(i)
|
|
260
|
+
}, [n.icon && w("i", {
|
|
261
261
|
class: n.icon
|
|
262
262
|
}, null), n.name]);
|
|
263
263
|
}
|
|
@@ -266,59 +266,59 @@ 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(), c = 2, o = y(n.modelValue), i = y("none"), g = y(n.type), O = S(() => {
|
|
270
270
|
const a = {
|
|
271
271
|
"f-capsule-container": !0
|
|
272
272
|
};
|
|
273
|
-
return
|
|
274
|
-
}),
|
|
273
|
+
return g.value && (a[g.value] = !0), a;
|
|
274
|
+
}), r = S(() => ({})), f = S(() => ({
|
|
275
275
|
"f-capsule": !0
|
|
276
|
-
})),
|
|
277
|
-
left: `${
|
|
278
|
-
width: `${
|
|
279
|
-
transition:
|
|
276
|
+
})), p = y(c), d = y(0), h = y(0), b = S(() => ({
|
|
277
|
+
left: `${p.value}px`,
|
|
278
|
+
width: `${d.value}px`,
|
|
279
|
+
transition: i.value
|
|
280
280
|
})), R = S(() => ({
|
|
281
281
|
width: `${h.value}px`
|
|
282
|
-
})),
|
|
283
|
-
function
|
|
282
|
+
})), A = /* @__PURE__ */ new Map();
|
|
283
|
+
function V(a) {
|
|
284
284
|
var t;
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
288
|
-
const m =
|
|
289
|
-
|
|
285
|
+
if (A.has(a.value)) {
|
|
286
|
+
const s = (t = A.get(a.value)) == null ? void 0 : t.value;
|
|
287
|
+
if (s) {
|
|
288
|
+
const m = s.getBoundingClientRect(), B = l.value.getBoundingClientRect();
|
|
289
|
+
p.value = m.left - B.left + c + l.value.scrollLeft, d.value = m.width - 2 * c;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
const
|
|
295
|
-
o.value =
|
|
293
|
+
function M(a, t) {
|
|
294
|
+
const s = a.value;
|
|
295
|
+
o.value = s, e.emit("update:modelValue", s), V(a), t && e.emit("change", s);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
const t = u.value.findIndex((
|
|
299
|
-
t > -1 &&
|
|
297
|
+
function C(a) {
|
|
298
|
+
const t = u.value.findIndex((s) => s.value === a);
|
|
299
|
+
t > -1 && M(u.value[t], !1);
|
|
300
300
|
}
|
|
301
301
|
D(() => n.modelValue, (a) => {
|
|
302
|
-
o.value = a,
|
|
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(),
|
|
304
|
+
const t = a.filter((s) => s.show);
|
|
305
|
+
v(t), u.value = t, await T(), C(o.value), h.value = Array.from(A.values()).reduce((s, m) => (s += m.value.clientWidth, s), 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
|
});
|
|
309
309
|
function $(a, t) {
|
|
310
|
-
|
|
310
|
+
M(t, !0);
|
|
311
311
|
}
|
|
312
312
|
function E(a, t) {
|
|
313
|
-
|
|
313
|
+
A.set(t, a);
|
|
314
314
|
}
|
|
315
315
|
function v(a) {
|
|
316
|
-
Array.from(
|
|
317
|
-
a.find((m) => m.value === t) ||
|
|
316
|
+
Array.from(A.keys()).forEach((t) => {
|
|
317
|
+
a.find((m) => m.value === t) || A.delete(t);
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
return
|
|
320
|
+
function j(a, t) {
|
|
321
|
+
return w(z, {
|
|
322
322
|
name: a.name,
|
|
323
323
|
value: a.value,
|
|
324
324
|
isActive: a.value === o.value,
|
|
@@ -329,16 +329,16 @@ const fe = "capsule", de = "A Farris Component", ve = "object", me = {
|
|
|
329
329
|
onActive: $
|
|
330
330
|
}, null);
|
|
331
331
|
}
|
|
332
|
-
return () =>
|
|
332
|
+
return () => w("span", {
|
|
333
333
|
ref: l,
|
|
334
|
-
class:
|
|
335
|
-
style:
|
|
336
|
-
}, [
|
|
334
|
+
class: O.value,
|
|
335
|
+
style: r.value
|
|
336
|
+
}, [w("span", {
|
|
337
337
|
class: "f-capsule-pane"
|
|
338
|
-
}, [u.value.map((a, t) =>
|
|
339
|
-
class:
|
|
340
|
-
style:
|
|
341
|
-
}, null),
|
|
338
|
+
}, [u.value.map((a, t) => j(a, t))]), w("small", {
|
|
339
|
+
class: f.value,
|
|
340
|
+
style: b.value
|
|
341
|
+
}, null), w("div", {
|
|
342
342
|
class: "f-capsule-board",
|
|
343
343
|
style: R.value
|
|
344
344
|
}, null)]);
|
|
@@ -348,160 +348,160 @@ function ge(n, e, u) {
|
|
|
348
348
|
var E;
|
|
349
349
|
function l() {
|
|
350
350
|
}
|
|
351
|
-
const
|
|
352
|
-
function
|
|
351
|
+
const c = "", o = "", i = y();
|
|
352
|
+
function g() {
|
|
353
353
|
return (e == null ? void 0 : e.schema.componentType) !== "frame";
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function O() {
|
|
356
356
|
return !1;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function r() {
|
|
359
359
|
return (e == null ? void 0 : e.schema.componentType) !== "frame";
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function f() {
|
|
362
362
|
return (e == null ? void 0 : e.schema.componentType) === "frame";
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function p(v) {
|
|
365
365
|
if (!v || !v.value)
|
|
366
366
|
return null;
|
|
367
367
|
if (v.value.schema && v.value.schema.type === "component")
|
|
368
368
|
return v.value;
|
|
369
|
-
const
|
|
369
|
+
const j = y(v == null ? void 0 : v.value.parent), a = p(j);
|
|
370
370
|
return a || null;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
const { componentInstance:
|
|
374
|
-
return !
|
|
372
|
+
function d(v = e) {
|
|
373
|
+
const { componentInstance: j, designerItemElementRef: a } = v;
|
|
374
|
+
return !j || !j.value ? null : j.value.canMove ? a : d(v.parent);
|
|
375
375
|
}
|
|
376
376
|
function h(v) {
|
|
377
377
|
return !!u;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function b() {
|
|
380
380
|
return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name);
|
|
381
381
|
}
|
|
382
382
|
function R() {
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function A(v, j) {
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
const { componentType:
|
|
388
|
-
let
|
|
389
|
-
const
|
|
390
|
-
return
|
|
386
|
+
function V(v, j) {
|
|
387
|
+
const { componentType: a } = v;
|
|
388
|
+
let t = N(a, v, j);
|
|
389
|
+
const s = a.toLowerCase().replace("-", "_");
|
|
390
|
+
return t && !t.id && t.type === a && (t.id = `${s}_${Math.random().toString().slice(2, 6)}`), t;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
const a = String(v.getAttribute("data-controltype")), t = v.getAttribute("data-feature"),
|
|
394
|
-
|
|
395
|
-
let m = N(a,
|
|
392
|
+
function M(v, j) {
|
|
393
|
+
const a = String(v.getAttribute("data-controltype")), t = v.getAttribute("data-feature"), s = t ? JSON.parse(t) : {};
|
|
394
|
+
s.parentComponentInstance = i.value;
|
|
395
|
+
let m = N(a, s);
|
|
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
|
}
|
|
399
|
-
function
|
|
399
|
+
function C(v) {
|
|
400
400
|
}
|
|
401
401
|
function $(...v) {
|
|
402
402
|
}
|
|
403
|
-
return
|
|
404
|
-
canMove:
|
|
405
|
-
canSelectParent:
|
|
406
|
-
canDelete:
|
|
407
|
-
canNested: !
|
|
403
|
+
return i.value = {
|
|
404
|
+
canMove: g(),
|
|
405
|
+
canSelectParent: O(),
|
|
406
|
+
canDelete: r(),
|
|
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: c,
|
|
413
413
|
designerClass: o,
|
|
414
414
|
canAccepts: h,
|
|
415
|
-
getBelongedComponentInstance:
|
|
416
|
-
getDraggableDesignItemElement:
|
|
417
|
-
getDraggingDisplayText:
|
|
415
|
+
getBelongedComponentInstance: p,
|
|
416
|
+
getDraggableDesignItemElement: d,
|
|
417
|
+
getDraggingDisplayText: b,
|
|
418
418
|
getPropConfig: $,
|
|
419
419
|
getDragScopeElement: R,
|
|
420
|
-
onAcceptMovedChildElement:
|
|
421
|
-
onAcceptNewChildElement:
|
|
422
|
-
onChildElementMovedOut:
|
|
423
|
-
addNewChildComponentSchema:
|
|
420
|
+
onAcceptMovedChildElement: A,
|
|
421
|
+
onAcceptNewChildElement: M,
|
|
422
|
+
onChildElementMovedOut: C,
|
|
423
|
+
addNewChildComponentSchema: V,
|
|
424
424
|
updateDragAndDropRules: l,
|
|
425
425
|
triggerBelongedComponentToMoveWhenMoved: y(!1),
|
|
426
426
|
triggerBelongedComponentToDeleteWhenDeleted: y(!1)
|
|
427
|
-
},
|
|
427
|
+
}, i;
|
|
428
428
|
}
|
|
429
429
|
const be = /* @__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(), c = 2, o = y(n.modelValue), i = y("none"), g = y(n.type), O = H("design-item-context"), r = ge(l, O);
|
|
435
435
|
P(() => {
|
|
436
|
-
l.value.componentInstance =
|
|
437
|
-
}), e.expose(
|
|
438
|
-
const
|
|
436
|
+
l.value.componentInstance = r;
|
|
437
|
+
}), e.expose(r.value);
|
|
438
|
+
const f = S(() => {
|
|
439
439
|
const t = {
|
|
440
440
|
"f-capsule-container": !0
|
|
441
441
|
};
|
|
442
|
-
return
|
|
443
|
-
}),
|
|
442
|
+
return g.value && (t[g.value] = !0), t;
|
|
443
|
+
}), p = S(() => ({})), d = S(() => ({
|
|
444
444
|
"f-capsule": !0
|
|
445
|
-
})), h = y(
|
|
445
|
+
})), h = y(c), b = y(0), R = y(0), A = S(() => ({
|
|
446
446
|
left: `${h.value}px`,
|
|
447
|
-
width: `${
|
|
448
|
-
transition:
|
|
449
|
-
})),
|
|
447
|
+
width: `${b.value}px`,
|
|
448
|
+
transition: i.value
|
|
449
|
+
})), V = S(() => ({
|
|
450
450
|
width: `${R.value}px`
|
|
451
|
-
})),
|
|
452
|
-
function
|
|
453
|
-
var
|
|
454
|
-
if (
|
|
455
|
-
const m = (
|
|
451
|
+
})), M = /* @__PURE__ */ new Map();
|
|
452
|
+
function C(t) {
|
|
453
|
+
var s;
|
|
454
|
+
if (M.has(t.value)) {
|
|
455
|
+
const m = (s = M.get(t.value)) == null ? void 0 : s.value;
|
|
456
456
|
if (m) {
|
|
457
457
|
const B = m.getBoundingClientRect(), G = l.value.getBoundingClientRect();
|
|
458
|
-
h.value = B.left - G.left +
|
|
458
|
+
h.value = B.left - G.left + c + l.value.scrollLeft, b.value = B.width - 2 * c;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
function $(t,
|
|
462
|
+
function $(t, s) {
|
|
463
463
|
const m = t.value;
|
|
464
|
-
o.value = m, e.emit("update:modelValue", m),
|
|
464
|
+
o.value = m, e.emit("update:modelValue", m), C(t), s && e.emit("change", m);
|
|
465
465
|
}
|
|
466
466
|
function E(t) {
|
|
467
|
-
const
|
|
468
|
-
|
|
467
|
+
const s = u.value.findIndex((m) => m.value === t);
|
|
468
|
+
s > -1 && $(u.value[s], !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(
|
|
473
|
+
u.value = t, await T(), E(o.value), R.value = Array.from(M.values()).reduce((s, m) => (s += m.value.clientWidth, s), 0);
|
|
474
474
|
}), P(async () => {
|
|
475
|
-
E(o.value), await T(),
|
|
475
|
+
E(o.value), await T(), i.value = "0.1s ease-out all", R.value = Array.from(M.values()).reduce((t, s) => (t += s.value.clientWidth, t), 0);
|
|
476
476
|
});
|
|
477
|
-
function v(t,
|
|
478
|
-
$(
|
|
477
|
+
function v(t, s) {
|
|
478
|
+
$(s, !0);
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
|
|
480
|
+
function j(t, s) {
|
|
481
|
+
M.set(s, t);
|
|
482
482
|
}
|
|
483
|
-
function a(t,
|
|
484
|
-
return
|
|
483
|
+
function a(t, s) {
|
|
484
|
+
return w(z, {
|
|
485
485
|
name: t.name,
|
|
486
486
|
value: t.value,
|
|
487
487
|
isActive: t.value === o.value,
|
|
488
|
-
index:
|
|
489
|
-
onMounted:
|
|
488
|
+
index: s,
|
|
489
|
+
onMounted: j,
|
|
490
490
|
onActive: v
|
|
491
491
|
}, null);
|
|
492
492
|
}
|
|
493
|
-
return () =>
|
|
493
|
+
return () => w("span", {
|
|
494
494
|
ref: l,
|
|
495
|
-
class: p.value,
|
|
496
|
-
style: i.value
|
|
497
|
-
}, [A("span", {
|
|
498
|
-
class: "f-capsule-pane"
|
|
499
|
-
}, [u.value.map((t, c) => a(t, c))]), A("small", {
|
|
500
495
|
class: f.value,
|
|
501
|
-
style:
|
|
502
|
-
},
|
|
496
|
+
style: p.value
|
|
497
|
+
}, [w("span", {
|
|
498
|
+
class: "f-capsule-pane"
|
|
499
|
+
}, [u.value.map((t, s) => a(t, s))]), w("small", {
|
|
500
|
+
class: d.value,
|
|
501
|
+
style: A.value
|
|
502
|
+
}, null), w("div", {
|
|
503
503
|
class: "f-capsule-board",
|
|
504
|
-
style:
|
|
504
|
+
style: V.value
|
|
505
505
|
}, null)]);
|
|
506
506
|
}
|
|
507
507
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(j,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("lodash-es"),require("@farris/ui-vue/components/common")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","@farris/ui-vue/components/common"],t):(j=typeof globalThis<"u"?globalThis:j||self,t(j.capsule={},j.Vue,j.LodashES,j.common))})(this,function(j,t,L,_){"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 B(a){const{properties:e,title:u}=a,s=Object.keys(e).reduce((o,i)=>(o[i]=e[i].type==="object"&&e[i].properties?B(e[i]):L.cloneDeep(e[i].default),o),{});return s.id=`${u}-${Date.now()}`,s}function P(a,e={}){const u=k[a];if(u){let s=B(u);const o=F[a];return s=o?o({getSchemaByType:P},s,e):s,s}return null}function z(a,e){const u=B(e);return Object.keys(a).reduce((s,o)=>(s[o]=a[o],s),u),u}function G(a,e){return Object.keys(a).filter(s=>a[s]!=null).reduce((s,o)=>{if(e.has(o)){const i=e.get(o);if(typeof i=="string")s[i]=a[o];else{const m=i(o,a[o],a);Object.assign(s,m)}}else s[o]=a[o];return s},{})}function H(a,e,u=new Map){const s=z(a,e);return G(s,u)}function Q(a={}){function e(r,f,p,d){if(typeof p=="number")return d[r].length===p;if(typeof p=="object"){const v=Object.keys(p)[0],g=p[v];if(v==="not")return Number(d[r].length)!==Number(g);if(v==="moreThan")return Number(d[r].length)>=Number(g);if(v==="lessThan")return Number(d[r].length)<=Number(g)}return!1}function u(r,f,p,d){return d[r]&&d[r].propertyValue&&String(d[r].propertyValue.value)===String(p)}const s=new Map([["length",e],["getProperty",u]]);Object.keys(a).reduce((r,f)=>(r.set(f,a[f]),r),s);function o(r,f){const p=r;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=>{if(d==="length")return{target:p,operator:"length",param:null,value:f[d]};const v=d,g=f[d];return{target:p,operator:"getProperty",param:v,value:g}}):[]}function i(r){return Object.keys(r).reduce((p,d)=>{const v=o(d,r[d]);return p.push(...v),p},[])}function m(r,f){if(s.has(r.operator)){const p=s.get(r.operator);return p&&p(r.target,r.param,r.value,f)||!1}return!1}function O(r,f){return i(r).reduce((v,g)=>v&&m(g,f),!0)}function M(r,f){const p=Object.keys(r),d=p.includes("allOf"),v=p.includes("anyOf"),g=d||v,C=(g?r[g?d?"allOf":"anyOf":"allOf"]:[r]).map(A=>O(A,f));return d?!C.includes(!1):C.includes(!0)}return{parseValueSchema:M}}const U={},X={};Q();function Y(a,e,u=new Map,s=(m,O,M)=>O,o={},i=m=>m){return k[e.title]=e,F[e.title]=s,U[e.title]=o,X[e.title]=i,(m={})=>{const O=H(m,e,u),M=Object.keys(a).reduce((r,f)=>(r[f]=a[f].default,r),{});return Object.assign(M,O)}}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),W=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,m=>{s.value=m});const o=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(m){a.disabled||e.emit("active",m,{name:a.name,value:a.value})}return()=>t.createVNode("div",{ref:u,class:o.value,onClick:m=>i(m)},[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(),o=2,i=t.ref(a.modelValue),m=t.ref("none"),O=t.ref(a.type),M=t.computed(()=>{const c={"f-capsule-container":!0};return O.value&&(c[O.value]=!0),c}),r=t.computed(()=>({})),f=t.computed(()=>({"f-capsule":!0})),p=t.ref(o),d=t.ref(0),v=t.ref(0),g=t.computed(()=>({left:`${p.value}px`,width:`${d.value}px`,transition:m.value})),S=t.computed(()=>({width:`${v.value}px`})),V=new Map;function C(c){var n;if(V.has(c.value)){const l=(n=V.get(c.value))==null?void 0:n.value;if(l){const h=l.getBoundingClientRect(),R=s.value.getBoundingClientRect();p.value=h.left-R.left+o+s.value.scrollLeft,d.value=h.width-2*o}}}function w(c,n){const l=c.value;i.value=l,e.emit("update:modelValue",l),C(c),n&&e.emit("change",l)}function A(c){const n=u.value.findIndex(l=>l.value===c);n>-1&&w(u.value[n],!1)}t.watch(()=>a.modelValue,c=>{i.value=c,A(i.value)}),t.watch(()=>a.items,async c=>{const n=c.filter(l=>l.show);y(n),u.value=n,await t.nextTick(),A(i.value),v.value=Array.from(V.values()).reduce((l,h)=>(l+=h.value.clientWidth,l),0)}),t.onMounted(async()=>{A(i.value),await t.nextTick(),m.value="0.1s ease-out all",v.value=Array.from(V.values()).reduce((c,n)=>(c+=n.value.clientWidth,c),0)});function N(c,n){w(n,!0)}function $(c,n){V.set(n,c)}function y(c){Array.from(V.keys()).forEach(n=>{c.find(h=>h.value===n)||V.delete(n)})}function b(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:M.value,style:r.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((c,n)=>b(c,n))]),t.createVNode("small",{class:f.value,style:g.value},null),t.createVNode("div",{class:"f-capsule-board",style:S.value},null)])}});function ee(a,e,u){var $;function s(){}const o="",i="",m=t.ref();function O(){return(e==null?void 0:e.schema.componentType)!=="frame"}function M(){return!1}function r(){return(e==null?void 0:e.schema.componentType)!=="frame"}function f(){return(e==null?void 0:e.schema.componentType)==="frame"}function p(y){if(!y||!y.value)return null;if(y.value.schema&&y.value.schema.type==="component")return y.value;const b=t.ref(y==null?void 0:y.value.parent),c=p(b);return c||null}function d(y=e){const{componentInstance:b,designerItemElementRef:c}=y;return!b||!b.value?null:b.value.canMove?c:d(y.parent)}function v(y){return!!u}function g(){return(e==null?void 0:e.schema.label)||(e==null?void 0:e.schema.title)||(e==null?void 0:e.schema.name)}function S(){}function V(y,b){}function C(y){const{componentType:b}=y;let c=P(b,y);const n=b.toLowerCase().replace("-","_");return c&&!c.id&&c.type===b&&(c.id=`${n}_${Math.random().toString().slice(2,6)}`),c}function w(y,b){const c=String(y.getAttribute("data-controltype")),n=y.getAttribute("data-feature"),l=n?JSON.parse(n):{};l.parentComponentInstance=m.value;let h=P(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 A(y){}function N(...y){}return m.value={canMove:O(),canSelectParent:M(),canDelete:r(),canNested:!f(),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:o,designerClass:i,canAccepts:v,getBelongedComponentInstance:p,getDraggableDesignItemElement:d,getDraggingDisplayText:g,getPropConfig:N,getDragScopeElement:S,onAcceptMovedChildElement:V,onAcceptNewChildElement:w,onChildElementMovedOut:A,addNewChildComponentSchema:C,updateDragAndDropRules:s,triggerBelongedComponentToMoveWhenMoved:t.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:t.ref(!1)},m}const te=t.defineComponent({name:"FCapsuleDesign",props:E,emits:["change","update:modelValue"],setup(a,e){const u=t.ref(a.items),s=t.ref(),o=2,i=t.ref(a.modelValue),m=t.ref("none"),O=t.ref(a.type),M=t.inject("design-item-context"),r=ee(s,M);t.onMounted(()=>{s.value.componentInstance=r}),e.expose(r.value);const f=t.computed(()=>{const n={"f-capsule-container":!0};return O.value&&(n[O.value]=!0),n}),p=t.computed(()=>({})),d=t.computed(()=>({"f-capsule":!0})),v=t.ref(o),g=t.ref(0),S=t.ref(0),V=t.computed(()=>({left:`${v.value}px`,width:`${g.value}px`,transition:m.value})),C=t.computed(()=>({width:`${S.value}px`})),w=new Map;function A(n){var l;if(w.has(n.value)){const h=(l=w.get(n.value))==null?void 0:l.value;if(h){const R=h.getBoundingClientRect(),ae=s.value.getBoundingClientRect();v.value=R.left-ae.left+o+s.value.scrollLeft,g.value=R.width-2*o}}}function N(n,l){const h=n.value;i.value=h,e.emit("update:modelValue",h),A(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),S.value=Array.from(w.values()).reduce((l,h)=>(l+=h.value.clientWidth,l),0)}),t.onMounted(async()=>{$(i.value),await t.nextTick(),m.value="0.1s ease-out all",S.value=Array.from(w.values()).reduce((n,l)=>(n+=l.value.clientWidth,n),0)});function y(n,l){N(l,!0)}function b(n,l){w.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:b,onActive:y},null)}return()=>t.createVNode("span",{ref:s,class:f.value,style:p.value},[t.createVNode("span",{class:"f-capsule-pane"},[u.value.map((n,l)=>c(n,l))]),t.createVNode("small",{class:d.value,style:V.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);j.FCapsule=T,j.capsuleItemProps=q,j.capsuleProps=E,j.default=ne,j.propsResolver=D,Object.defineProperties(j,{__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,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"}})});
|