form-custom-test 3.0.214 → 3.0.215
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/dist/designer.es.js +133 -9
- package/dist/designer.style.css +1 -1
- package/dist/designer.umd.js +93 -93
- package/dist/render.es.js +125 -8
- package/dist/render.style.css +1 -1
- package/dist/render.umd.js +62 -62
- package/package.json +1 -1
package/dist/render.es.js
CHANGED
|
@@ -26591,13 +26591,13 @@ function registerIcon(app) {
|
|
|
26591
26591
|
if (typeof window !== "undefined") {
|
|
26592
26592
|
let loadSvg = function() {
|
|
26593
26593
|
var body = document.body;
|
|
26594
|
-
var svgDom = document.getElementById("
|
|
26594
|
+
var svgDom = document.getElementById("__svg__icons__dom__1782180953383__");
|
|
26595
26595
|
if (!svgDom) {
|
|
26596
26596
|
svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
26597
26597
|
svgDom.style.position = "absolute";
|
|
26598
26598
|
svgDom.style.width = "0";
|
|
26599
26599
|
svgDom.style.height = "0";
|
|
26600
|
-
svgDom.id = "
|
|
26600
|
+
svgDom.id = "__svg__icons__dom__1782180953383__";
|
|
26601
26601
|
svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
26602
26602
|
svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
|
|
26603
26603
|
}
|
|
@@ -63147,10 +63147,96 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
63147
63147
|
}, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
|
|
63148
63148
|
}
|
|
63149
63149
|
var AssetSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$a]]);
|
|
63150
|
+
const DEFAULT_DICT_API = "/unified-dict/sysItemDict/page";
|
|
63151
|
+
const DEFAULT_DICT_PARAMS = { current: 1, size: 1e4 };
|
|
63152
|
+
function normalizeDictRecords(records) {
|
|
63153
|
+
if (!Array.isArray(records)) {
|
|
63154
|
+
return {};
|
|
63155
|
+
}
|
|
63156
|
+
return records.reduce((prev, cur) => {
|
|
63157
|
+
var _a, _b, _c, _d, _e;
|
|
63158
|
+
const dictType = cur.dictType;
|
|
63159
|
+
if (!dictType) {
|
|
63160
|
+
return prev;
|
|
63161
|
+
}
|
|
63162
|
+
if (!prev[dictType]) {
|
|
63163
|
+
prev[dictType] = [];
|
|
63164
|
+
}
|
|
63165
|
+
prev[dictType].push(__spreadValues({
|
|
63166
|
+
label: (_b = (_a = cur.label) != null ? _a : cur.dictLabel) != null ? _b : "",
|
|
63167
|
+
value: (_e = (_d = (_c = cur.itemValue) != null ? _c : cur.dictValue) != null ? _d : cur.value) != null ? _e : ""
|
|
63168
|
+
}, cur));
|
|
63169
|
+
return prev;
|
|
63170
|
+
}, {});
|
|
63171
|
+
}
|
|
63150
63172
|
class DictManager {
|
|
63151
63173
|
constructor() {
|
|
63152
63174
|
this.dictCache = {};
|
|
63153
63175
|
this.loading = false;
|
|
63176
|
+
this._loaded = false;
|
|
63177
|
+
this._listeners = [];
|
|
63178
|
+
this._fetchPromise = null;
|
|
63179
|
+
}
|
|
63180
|
+
onLoaded(fn) {
|
|
63181
|
+
if (typeof fn !== "function") {
|
|
63182
|
+
return () => {
|
|
63183
|
+
};
|
|
63184
|
+
}
|
|
63185
|
+
if (this._loaded) {
|
|
63186
|
+
fn(this.dictCache);
|
|
63187
|
+
return () => {
|
|
63188
|
+
};
|
|
63189
|
+
}
|
|
63190
|
+
this._listeners.push(fn);
|
|
63191
|
+
return () => {
|
|
63192
|
+
this._listeners = this._listeners.filter((item) => item !== fn);
|
|
63193
|
+
};
|
|
63194
|
+
}
|
|
63195
|
+
_notifyLoaded() {
|
|
63196
|
+
this._loaded = true;
|
|
63197
|
+
this._listeners.forEach((fn) => {
|
|
63198
|
+
try {
|
|
63199
|
+
fn(this.dictCache);
|
|
63200
|
+
} catch (error) {
|
|
63201
|
+
console.error("[dictManager] onLoaded callback error:", error);
|
|
63202
|
+
}
|
|
63203
|
+
});
|
|
63204
|
+
}
|
|
63205
|
+
fetchFromApi(service2, options = {}) {
|
|
63206
|
+
const {
|
|
63207
|
+
url = DEFAULT_DICT_API,
|
|
63208
|
+
params = DEFAULT_DICT_PARAMS,
|
|
63209
|
+
force = false,
|
|
63210
|
+
customFetch
|
|
63211
|
+
} = options;
|
|
63212
|
+
if (this._fetchPromise && !force) {
|
|
63213
|
+
return this._fetchPromise;
|
|
63214
|
+
}
|
|
63215
|
+
if (this._loaded && Object.keys(this.dictCache).length > 0 && !force) {
|
|
63216
|
+
return Promise.resolve(this.dictCache);
|
|
63217
|
+
}
|
|
63218
|
+
this.loading = true;
|
|
63219
|
+
const requestPromise = typeof customFetch === "function" ? Promise.resolve().then(() => customFetch()).then((result) => {
|
|
63220
|
+
if (result && !Array.isArray(result) && typeof result === "object") {
|
|
63221
|
+
return result;
|
|
63222
|
+
}
|
|
63223
|
+
return normalizeDictRecords(Array.isArray(result) ? result : []);
|
|
63224
|
+
}) : service2.post(url, params).then((res) => {
|
|
63225
|
+
var _a, _b, _c, _d;
|
|
63226
|
+
const records = (_d = (_c = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.records) != null ? _b : res == null ? void 0 : res.records) != null ? _c : res == null ? void 0 : res.data) != null ? _d : [];
|
|
63227
|
+
return normalizeDictRecords(Array.isArray(records) ? records : []);
|
|
63228
|
+
});
|
|
63229
|
+
this._fetchPromise = requestPromise.then((dictData) => {
|
|
63230
|
+
this.init(dictData || {});
|
|
63231
|
+
this._notifyLoaded();
|
|
63232
|
+
return dictData;
|
|
63233
|
+
}).catch((error) => {
|
|
63234
|
+
console.warn("[form-custom-test] \u5B57\u5178\u6570\u636E\u52A0\u8F7D\u5931\u8D25:", error);
|
|
63235
|
+
return {};
|
|
63236
|
+
}).finally(() => {
|
|
63237
|
+
this.loading = false;
|
|
63238
|
+
});
|
|
63239
|
+
return this._fetchPromise;
|
|
63154
63240
|
}
|
|
63155
63241
|
init(dictData) {
|
|
63156
63242
|
this.dictCache = dictData || {};
|
|
@@ -63203,7 +63289,6 @@ class DictManager {
|
|
|
63203
63289
|
return this.mapToOptionItems(this.getDictData(dictCode));
|
|
63204
63290
|
}
|
|
63205
63291
|
getDictTypeOptions() {
|
|
63206
|
-
console.log("this.dictCache", this.dictCache);
|
|
63207
63292
|
return Object.keys(this.dictCache || {}).map((dictType) => ({
|
|
63208
63293
|
label: dictType,
|
|
63209
63294
|
value: dictType
|
|
@@ -63211,6 +63296,8 @@ class DictManager {
|
|
|
63211
63296
|
}
|
|
63212
63297
|
clear() {
|
|
63213
63298
|
this.dictCache = {};
|
|
63299
|
+
this._loaded = false;
|
|
63300
|
+
this._fetchPromise = null;
|
|
63214
63301
|
if (typeof window !== "undefined") {
|
|
63215
63302
|
window.dictCache = {};
|
|
63216
63303
|
}
|
|
@@ -63307,8 +63394,14 @@ const _sfc_main$9 = {
|
|
|
63307
63394
|
},
|
|
63308
63395
|
mounted() {
|
|
63309
63396
|
this.handleOnMounted();
|
|
63397
|
+
this._offDictLoaded = dictManager.onLoaded(() => {
|
|
63398
|
+
this.loadDictOptions();
|
|
63399
|
+
});
|
|
63310
63400
|
},
|
|
63311
63401
|
beforeUnmount() {
|
|
63402
|
+
if (this._offDictLoaded) {
|
|
63403
|
+
this._offDictLoaded();
|
|
63404
|
+
}
|
|
63312
63405
|
this.unregisterFromRefList();
|
|
63313
63406
|
},
|
|
63314
63407
|
methods: {
|
|
@@ -63505,7 +63598,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
63505
63598
|
_: 1
|
|
63506
63599
|
}, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
|
|
63507
63600
|
}
|
|
63508
|
-
var DictSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-
|
|
63601
|
+
var DictSelectWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-6f18008b"]]);
|
|
63509
63602
|
var dictSelectDictCodeEditor_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
63510
63603
|
const _sfc_main$8 = {
|
|
63511
63604
|
name: "dict-select-dictCode-editor",
|
|
@@ -63534,6 +63627,15 @@ const _sfc_main$8 = {
|
|
|
63534
63627
|
},
|
|
63535
63628
|
mounted() {
|
|
63536
63629
|
this.$nextTick(() => this.refreshDictTypeOptions());
|
|
63630
|
+
this._offDictLoaded = dictManager.onLoaded(() => {
|
|
63631
|
+
this.refreshDictTypeOptions();
|
|
63632
|
+
this.syncOptionItemsFromDict();
|
|
63633
|
+
});
|
|
63634
|
+
},
|
|
63635
|
+
beforeUnmount() {
|
|
63636
|
+
if (this._offDictLoaded) {
|
|
63637
|
+
this._offDictLoaded();
|
|
63638
|
+
}
|
|
63537
63639
|
},
|
|
63538
63640
|
methods: {
|
|
63539
63641
|
refreshDictTypeOptions() {
|
|
@@ -63593,7 +63695,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
63593
63695
|
_: 1
|
|
63594
63696
|
}, 8, ["label"]);
|
|
63595
63697
|
}
|
|
63596
|
-
var DictSelectDictCodeEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-
|
|
63698
|
+
var DictSelectDictCodeEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-2dfeafae"]]);
|
|
63597
63699
|
var detailDialog_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
63598
63700
|
const _sfc_main$7 = {
|
|
63599
63701
|
name: "detail-dialog",
|
|
@@ -65794,6 +65896,18 @@ const loadExtension = function(app) {
|
|
|
65794
65896
|
registerCPEditor(app, "asset-type-assetTypeValue", "asset-type-assetTypeValue-editor", createInputTextEditor("assetTypeValue", "extension.setting.assetTypeAssetTypeValue"));
|
|
65795
65897
|
app.component(CustomInputWidget.name, CustomInputWidget);
|
|
65796
65898
|
};
|
|
65899
|
+
function setupDict(app, service2, options = {}) {
|
|
65900
|
+
const dictConfig = options.dict || {};
|
|
65901
|
+
app.config.globalProperties.$dictManager = dictManager;
|
|
65902
|
+
app.provide("dictManager", dictManager);
|
|
65903
|
+
if (typeof window !== "undefined") {
|
|
65904
|
+
window.dictManager = dictManager;
|
|
65905
|
+
}
|
|
65906
|
+
if (dictConfig.autoLoad !== false && service2) {
|
|
65907
|
+
dictManager.fetchFromApi(service2, dictConfig);
|
|
65908
|
+
}
|
|
65909
|
+
return dictManager;
|
|
65910
|
+
}
|
|
65797
65911
|
function getElMessage(app) {
|
|
65798
65912
|
var _a, _b, _c;
|
|
65799
65913
|
try {
|
|
@@ -65806,7 +65920,7 @@ function getElMessage(app) {
|
|
|
65806
65920
|
}
|
|
65807
65921
|
return null;
|
|
65808
65922
|
}
|
|
65809
|
-
VFormRender.install = function(app) {
|
|
65923
|
+
VFormRender.install = function(app, options = {}) {
|
|
65810
65924
|
loadExtension(app);
|
|
65811
65925
|
app.use(ContainerItems);
|
|
65812
65926
|
registerIcon(app);
|
|
@@ -65814,11 +65928,12 @@ VFormRender.install = function(app) {
|
|
|
65814
65928
|
app.config.globalProperties.$service = service$1;
|
|
65815
65929
|
app.provide("service", service$1);
|
|
65816
65930
|
app.provide("ElMessage", getElMessage(app));
|
|
65931
|
+
setupDict(app, service$1, options);
|
|
65817
65932
|
};
|
|
65818
65933
|
const components = [
|
|
65819
65934
|
VFormRender
|
|
65820
65935
|
];
|
|
65821
|
-
const install = (app) => {
|
|
65936
|
+
const install = (app, options = {}) => {
|
|
65822
65937
|
loadExtension(app);
|
|
65823
65938
|
app.use(ContainerItems);
|
|
65824
65939
|
registerIcon(app);
|
|
@@ -65831,9 +65946,11 @@ const install = (app) => {
|
|
|
65831
65946
|
if (typeof window !== "undefined") {
|
|
65832
65947
|
window.service = service$1;
|
|
65833
65948
|
}
|
|
65949
|
+
setupDict(app, service$1, options);
|
|
65834
65950
|
};
|
|
65835
65951
|
var installRender = {
|
|
65836
65952
|
install,
|
|
65837
|
-
VFormRender
|
|
65953
|
+
VFormRender,
|
|
65954
|
+
dictManager
|
|
65838
65955
|
};
|
|
65839
65956
|
export { installRender as default };
|