qidian-vue-ui 1.0.82 → 1.0.84

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.
@@ -1350,6 +1350,8 @@ const isPromise = (val) => {
1350
1350
  const identifyType = (val) => {
1351
1351
  return toTypeStr(val).replace("[object ", "").replace("]", "").toLowerCase();
1352
1352
  };
1353
+ function noop() {
1354
+ }
1353
1355
  function isEmpty(val) {
1354
1356
  if (val == null) return true;
1355
1357
  if (typeof val === "string" && val.trim() === "") return true;
@@ -12330,6 +12332,11 @@ async function suspectedWrapperPromise(p) {
12330
12332
  return [null, p];
12331
12333
  }
12332
12334
  }
12335
+ function camelize(str) {
12336
+ return str.replace(/-|_(\w)/g, (_, c) => {
12337
+ return c ? c.toUpperCase() : "";
12338
+ });
12339
+ }
12333
12340
  function useServiceLoadMore({
12334
12341
  service,
12335
12342
  manual,
@@ -12605,7 +12612,42 @@ function useServicePagination({
12605
12612
  };
12606
12613
  }
12607
12614
  const __vite_import_meta_env__ = {};
12608
- __vite_import_meta_env__1?.NODE_ENV !== "production" || __vite_import_meta_env__ && false;
12615
+ const cslType = ["log", "warn", "error"];
12616
+ const isDev = __vite_import_meta_env__1?.NODE_ENV !== "production" || __vite_import_meta_env__ && false;
12617
+ function useCsl(module2) {
12618
+ const toStr = (data) => {
12619
+ if (typeof data === "object") return data.join(".");
12620
+ if (typeof data === "number") return data.toString();
12621
+ return data;
12622
+ };
12623
+ module2 = toStr(module2);
12624
+ const getModule = (childModule) => {
12625
+ if (isEmpty(childModule)) return `[${module2}]`;
12626
+ childModule = toStr(childModule);
12627
+ if (childModule) childModule = "." + childModule;
12628
+ return `[${module2}${childModule}]`;
12629
+ };
12630
+ const core2 = (type = "log", childModule, ...rest) => {
12631
+ if (isEmpty(rest)) {
12632
+ console[type](getModule(), childModule);
12633
+ return;
12634
+ }
12635
+ console[type](getModule(childModule), ...rest);
12636
+ };
12637
+ const csl2 = {
12638
+ useNext(childModule) {
12639
+ return useCsl(getModule(childModule).replace(/\[|\]/g, ""));
12640
+ }
12641
+ };
12642
+ cslType.forEach((item) => {
12643
+ const temp = (childModule, ...rest) => {
12644
+ core2(item, childModule, ...rest);
12645
+ };
12646
+ temp.dev = isDev ? temp : noop;
12647
+ csl2[item] = temp;
12648
+ });
12649
+ return csl2;
12650
+ }
12609
12651
  function useTimer(type = "timeout") {
12610
12652
  const timer = ref(null);
12611
12653
  const clearTimer = () => {
@@ -12690,8 +12732,8 @@ const QdConfigProvider = defineComponent({
12690
12732
  watchEffect(async () => {
12691
12733
  const localeMap = {
12692
12734
  "zh-CN": () => Promise.resolve().then(() => zhCN$1),
12693
- "zh-TW": () => import("./zh-TW-BVl6IXiW.mjs"),
12694
- "en-US": () => import("./en-US-B0M-dhXb.mjs")
12735
+ "zh-TW": () => import("./zh-TW-Su06dbjv.mjs"),
12736
+ "en-US": () => import("./en-US-CsYwtG6d.mjs")
12695
12737
  };
12696
12738
  const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
12697
12739
  const [err, res] = await to(
@@ -14978,6 +15020,16 @@ const zhCN = {
14978
15020
  fileSizeExceedsLimit: "文件大小超出限制,已自动过滤",
14979
15021
  fileUploadFailed: "文件上传失败",
14980
15022
  viewFileText: "查看文件"
15023
+ },
15024
+ chat: {
15025
+ ...zhCn.chat,
15026
+ failedObtainSessionIdMessage: "未能获取会话 ID",
15027
+ failedObtainUrlMessage: "未能获取会话地址",
15028
+ failedObtainAgentInfoMessage: "未能获取智能体 ID、API Key",
15029
+ apiUnknownErrorMessage: "未知错误",
15030
+ failedParseContentMessage: "解析内容失败",
15031
+ parsedContentEmptyMessage: "解析内容为空。",
15032
+ agentProcessingTimeoutMessage: "智能体处理超时,请稍后再试。"
14981
15033
  }
14982
15034
  };
14983
15035
  const zhCN$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -14985,7 +15037,7 @@ const zhCN$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
14985
15037
  default: zhCN
14986
15038
  }, Symbol.toStringTag, { value: "Module" }));
14987
15039
  function useConfig(key, componentLocale) {
14988
- const injectGlobalConfig = getCurrentInstance?.() ? inject(PROVIDE_GLOBAL_CONFIG, null) : void 0;
15040
+ const injectGlobalConfig = getCurrentInstance?.() ? inject(PROVIDE_GLOBAL_CONFIG, void 0) : void 0;
14989
15041
  const mergedGlobalConfig = computed(() => injectGlobalConfig?.value || zhCN);
14990
15042
  const globalConfig = computed(
14991
15043
  () => Object.assign(
@@ -16464,7 +16516,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16464
16516
  },
16465
16517
  setup(__props) {
16466
16518
  const props = __props;
16467
- const defaultProps = inject(PROVIDE_GRID_ITEM_PROPS_KEY);
16519
+ const defaultProps = inject(PROVIDE_GRID_ITEM_PROPS_KEY, void 0);
16468
16520
  const gridWidth = inject(PROVIDE_GRID_WIDTH_KEY, ref(DEFAULT_GRID_WIDTH));
16469
16521
  const reProps = computed(() => {
16470
16522
  const mergeGutterValue = (prop, defaultProp) => {
@@ -16519,7 +16571,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16519
16571
  };
16520
16572
  }
16521
16573
  });
16522
- const QdGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-274b234a"]]);
16574
+ const QdGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-f8a13f89"]]);
16523
16575
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
16524
16576
  ...{
16525
16577
  name: "QdFormItem"
@@ -17353,2065 +17405,2145 @@ function defaultOnOpen(response) {
17353
17405
  throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
17354
17406
  }
17355
17407
  }
17356
- function useAgentChat(options) {
17357
- const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
17358
- const mergeOpt = { ...globalOpt, ...options };
17359
- const loading = ref(false);
17360
- const agentId = ref(mergeOpt.agentId);
17361
- const apiKey = ref(mergeOpt.apiKey);
17362
- const sessionId = ref("");
17363
- let abortController;
17364
- async function send({
17365
- prompt,
17366
- files,
17367
- reSend,
17368
- extParams,
17369
- refreshSessionId,
17370
- onOpen,
17371
- onMessage,
17372
- onClose,
17373
- onError
17374
- }) {
17375
- const allData = { content: "", reasoning: "" };
17376
- if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
17377
- loading.value = true;
17378
- const agInfo = await getAgentInfo();
17379
- if (!agInfo) {
17380
- loading.value = false;
17381
- return allData;
17382
- }
17383
- const sId = await getSessionId({ ...agInfo, refreshSessionId });
17384
- if (!sId) {
17385
- loading.value = false;
17386
- return allData;
17387
- }
17388
- const getUrl = mergeOpt.getUrl;
17389
- if (!getUrl) {
17390
- loading.value = false;
17391
- console.error("[useAgentChat] 必须配置 getUrl 函数");
17392
- return allData;
17393
- }
17394
- abortController = new AbortController();
17395
- return new Promise((resolve, reject) => {
17396
- fetchEventSource(getUrl(agInfo.agentId, sId), {
17397
- method: "POST",
17398
- headers: {
17399
- "Content-Type": "application/json;charset=UTF-8",
17400
- Authorization: `Bearer ${agInfo.apiKey}`
17401
- },
17402
- signal: abortController?.signal,
17403
- openWhenHidden: true,
17404
- body: JSON.stringify({
17405
- message: prompt || "",
17406
- re_chat: reSend ?? false,
17407
- document_list: files,
17408
- client_id: agInfo.apiKey,
17409
- client_type: "API_KEY",
17410
- ...extParams
17411
- }),
17412
- onopen: async (res) => {
17413
- await onOpen?.(res);
17414
- },
17415
- onmessage: (res) => {
17416
- const { data } = res;
17417
- let reData = { content: "", reasoning: "" };
17418
- try {
17419
- reData = parseRelaxedJSON(data);
17420
- if (reData.content) allData.content += reData.content;
17421
- if (reData.reasoning) allData.reasoning += reData.reasoning;
17422
- } catch (err) {
17423
- console.warn("[useAgentChat.send.onmessage]", err);
17424
- }
17425
- onMessage?.({ data: reData, allData });
17426
- },
17427
- onclose: () => {
17428
- loading.value = false;
17429
- onClose?.(allData);
17430
- resolve(allData);
17431
- },
17432
- onerror: (err) => {
17433
- loading.value = false;
17434
- onError?.(err);
17435
- reject(err);
17436
- throw err;
17437
- }
17438
- });
17439
- });
17440
- }
17441
- function stop() {
17442
- abortController?.abort();
17443
- }
17444
- async function getAgentInfo() {
17445
- if (agentId.value && apiKey.value) {
17446
- return { agentId: agentId.value, apiKey: apiKey.value };
17447
- }
17448
- const getFn = mergeOpt.getAgentInfo;
17449
- if (!getFn) {
17450
- console.warn("[useAgentChat.getAgentInfo] 必须配置 agentId、apiKey 或者 getAgentInfo 函数");
17451
- return;
17452
- }
17453
- const [err, res] = await suspectedWrapperPromise(getFn());
17454
- if (err) return;
17455
- if (!res?.agentId || !res.apiKey) {
17456
- console.warn("[useAgentChat.getAgentInfo] 未获取到 agentId、apiKey", res);
17457
- return;
17458
- }
17459
- return res;
17460
- }
17461
- async function getSessionId({
17462
- agentId: agentId2,
17463
- apiKey: apiKey2,
17464
- refreshSessionId
17465
- }) {
17466
- if (sessionId.value && !refreshSessionId) return sessionId.value;
17467
- const getFn = mergeOpt.getSessionId;
17468
- if (!getFn) {
17469
- console.warn("[useAgentChat.getSessionId] 必须配置 getSessionId 函数");
17470
- return;
17471
- }
17472
- const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
17473
- if (err) return;
17474
- return res;
17475
- }
17476
- return {
17477
- loading,
17478
- agentId,
17479
- apiKey,
17480
- sessionId,
17481
- send,
17482
- stop
17483
- };
17484
- }
17485
- const dictCache = /* @__PURE__ */ new Map();
17486
- const dictPromiseCache = /* @__PURE__ */ new Map();
17487
- function useDict(...args) {
17488
- const res = ref({});
17489
- const loadingMap = ref({});
17490
- args.forEach(async (dictType) => {
17491
- res.value[dictType] = [];
17492
- const loadKey = `${dictType}Load`;
17493
- loadingMap.value[loadKey] = false;
17494
- if (dictCache.has(dictType)) {
17495
- res.value[dictType] = dictCache.get(dictType);
17496
- } else {
17497
- loadingMap.value[loadKey] = true;
17498
- let dictPromise;
17499
- if (dictPromiseCache.has(dictType)) {
17500
- dictPromise = dictPromiseCache.get(dictType);
17501
- } else {
17502
- dictPromise = getDict(dictType);
17503
- dictPromiseCache.set(dictType, dictPromise);
17504
- }
17505
- const [dictErr, dictRes] = await to(dictPromise);
17506
- if (dictErr) {
17507
- loadingMap.value[loadKey] = false;
17508
- dictPromiseCache.delete(dictType);
17509
- return;
17510
- }
17511
- dictCache.set(dictType, dictRes);
17512
- res.value[dictType] = dictRes;
17513
- loadingMap.value[loadKey] = false;
17514
- dictPromiseCache.delete(dictType);
17515
- }
17516
- });
17517
- const result = toRefs(res.value);
17518
- const loadingRefs = toRefs(loadingMap.value);
17519
- return { ...result, ...loadingRefs };
17520
- }
17521
- function useDictDynamic(dictType, hookOptions) {
17522
- const dictOptions = ref([]);
17523
- const loading = ref(false);
17524
- async function loadDict(type) {
17525
- if (!type) {
17526
- dictOptions.value = [];
17527
- hookOptions?.onInit?.([]);
17528
- return;
17529
- }
17530
- if (dictCache.has(type)) {
17531
- dictOptions.value = dictCache.get(type);
17532
- hookOptions?.onInit?.(dictOptions.value);
17533
- return;
17534
- }
17535
- loading.value = true;
17536
- let dictPromise;
17537
- if (dictPromiseCache.has(type)) {
17538
- dictPromise = dictPromiseCache.get(type);
17539
- } else {
17540
- dictPromise = getDict(type);
17541
- dictPromiseCache.set(type, dictPromise);
17542
- }
17543
- const [dictErr, dictRes] = await to(dictPromise);
17544
- if (dictErr) {
17545
- dictOptions.value = [];
17546
- loading.value = false;
17547
- dictPromiseCache.delete(type);
17548
- hookOptions?.onInit?.([]);
17549
- return;
17550
- }
17551
- dictCache.set(type, dictRes);
17552
- dictOptions.value = dictRes;
17553
- loading.value = false;
17554
- dictPromiseCache.delete(type);
17555
- hookOptions?.onInit?.(dictOptions.value);
17556
- }
17557
- watchEffect(() => {
17558
- loadDict(dictType.value);
17559
- });
17560
- return {
17561
- options: dictOptions,
17562
- loading
17563
- };
17564
- }
17565
- async function getDict(dictType) {
17566
- const dictOptions = window.__QIDIAN_DICT__;
17567
- if (!dictOptions) {
17568
- const msg = "[useDict] 字典服务未提供,请确保使用了 QdConfigProvider";
17569
- console.warn(msg);
17570
- throw new Error(msg);
17571
- }
17572
- const { service, transformParams, transformRes } = dictOptions;
17573
- let currentParams = dictType;
17574
- if (transformParams) {
17575
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
17576
- if (tpErr) throw tpErr;
17577
- currentParams = tpRes;
17578
- }
17579
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
17580
- if (serviceErr) throw serviceErr;
17581
- let res;
17582
- if (transformRes) {
17583
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
17584
- if (trErr) throw trErr;
17585
- res = trRes;
17586
- } else {
17587
- res = serviceRes;
17588
- }
17589
- return res;
17590
- }
17591
- function useReadonly(context) {
17592
- const currentInstance = getCurrentInstance();
17593
- const componentReadonly = computed(() => currentInstance.props.Readonly);
17594
- const formReadonly = inject("formReadonly", /* @__PURE__ */ Object.create(null));
17595
- return computed(() => {
17596
- if (isBoolean(context?.beforeReadonly?.value)) return context.beforeReadonly.value;
17597
- if (isBoolean(componentReadonly.value)) return componentReadonly.value;
17598
- if (isBoolean(context?.afterReadonly?.value)) return context.afterReadonly.value;
17599
- if (isBoolean(formReadonly.readonly?.value)) return formReadonly.readonly.value;
17600
- return false;
17601
- });
17602
- }
17603
- function useDisabled(context) {
17604
- const currentInstance = getCurrentInstance();
17605
- const componentDisabled = computed(() => currentInstance.props.disabled);
17606
- const formDisabled = inject("formDisabled", /* @__PURE__ */ Object.create(null));
17607
- return computed(() => {
17608
- if (isBoolean(context?.beforeDisabled?.value)) return context.beforeDisabled.value;
17609
- if (isBoolean(componentDisabled.value)) return componentDisabled.value;
17610
- if (isBoolean(context?.afterDisabled?.value)) return context.afterDisabled.value;
17611
- if (isBoolean(formDisabled.disabled?.value)) return formDisabled.disabled.value;
17612
- return false;
17613
- });
17408
+ function getDefaultExportFromCjs(x) {
17409
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
17614
17410
  }
17615
- const _hoisted_1$2 = {
17616
- class: "qd-crud-table"
17617
- };
17618
- const _hoisted_2$1 = {
17619
- class: "qd-crud-table__toolbar"
17620
- };
17621
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
17622
- ...{
17623
- name: "QdCrudTable"
17624
- },
17625
- __name: "table",
17626
- props: /* @__PURE__ */ mergeDefaults({
17627
- title: {},
17628
- permiPrefix: {},
17629
- search: {},
17630
- searchData: {},
17631
- form: {},
17632
- detail: {},
17633
- add: {
17634
- type: [Boolean, Object]
17635
- },
17636
- actions: {},
17637
- edit: {
17638
- type: [Boolean, Object]
17639
- },
17640
- view: {
17641
- type: [Boolean, Object]
17642
- },
17643
- del: {
17644
- type: [Boolean, Object]
17645
- },
17646
- rowActions: {},
17647
- rowKey: {},
17648
- selectType: {},
17649
- tree: {},
17650
- beforeDragSort: {
17651
- type: Function
17652
- },
17653
- expandedTreeNodes: {},
17654
- defaultExpandedTreeNodes: {},
17655
- treeExpandAndFoldIcon: {},
17656
- onAbnormalDragSort: {
17657
- type: Function
17658
- },
17659
- onExpandedTreeNodesChange: {
17660
- type: Function
17661
- },
17662
- onTreeExpandChange: {
17663
- type: Function
17664
- },
17665
- asyncLoading: {},
17666
- columnController: {},
17667
- columnControllerVisible: {
17668
- type: Boolean
17669
- },
17670
- defaultColumnControllerVisible: {
17671
- type: Boolean
17672
- },
17673
- columns: {},
17674
- displayColumns: {},
17675
- defaultDisplayColumns: {},
17676
- dragSort: {},
17677
- dragSortOptions: {},
17678
- editableCellState: {
17679
- type: Function
17680
- },
17681
- editableRowKeys: {},
17682
- expandIcon: {
17683
- type: Boolean
17684
- },
17685
- expandOnRowClick: {
17686
- type: Boolean
17687
- },
17688
- expandedRow: {},
17689
- expandedRowKeys: {},
17690
- defaultExpandedRowKeys: {},
17691
- filterIcon: {},
17692
- filterRow: {},
17693
- filterValue: {},
17694
- defaultFilterValue: {},
17695
- hideSortTips: {
17696
- type: Boolean
17697
- },
17698
- indeterminateSelectedRowKeys: {},
17699
- multipleSort: {
17700
- type: Boolean
17701
- },
17702
- reserveSelectedRowOnPaginate: {
17703
- type: Boolean
17704
- },
17705
- rowSelectionAllowUncheck: {
17706
- type: Boolean
17707
- },
17708
- rowSelectionType: {},
17709
- selectOnRowClick: {
17710
- type: Boolean
17711
- },
17712
- selectedRowKeys: {},
17713
- defaultSelectedRowKeys: {},
17714
- showSortColumnBgColor: {
17715
- type: Boolean
17716
- },
17717
- sort: {},
17718
- defaultSort: {},
17719
- sortIcon: {},
17720
- sortOnRowDraggable: {
17721
- type: Boolean
17722
- },
17723
- onAsyncLoadingClick: {
17724
- type: Function
17725
- },
17726
- onCellClick: {
17727
- type: Function
17728
- },
17729
- onChange: {
17730
- type: Function
17731
- },
17732
- onColumnChange: {
17733
- type: Function
17734
- },
17735
- onColumnControllerVisibleChange: {
17736
- type: Function
17737
- },
17738
- onDataChange: {
17739
- type: Function
17740
- },
17741
- onDisplayColumnsChange: {
17742
- type: Function
17743
- },
17744
- onDragSort: {
17745
- type: Function
17746
- },
17747
- onExpandChange: {
17748
- type: Function
17749
- },
17750
- onFilterChange: {
17751
- type: Function
17752
- },
17753
- onRowEdit: {
17754
- type: Function
17755
- },
17756
- onRowValidate: {
17757
- type: Function
17758
- },
17759
- onSelectChange: {
17760
- type: Function
17761
- },
17762
- onSortChange: {
17763
- type: Function
17764
- },
17765
- onValidate: {
17766
- type: Function
17767
- },
17768
- activeRowKeys: {},
17769
- defaultActiveRowKeys: {},
17770
- activeRowType: {},
17771
- allowResizeColumnWidth: {
17772
- type: Boolean
17773
- },
17774
- attach: {
17775
- type: [String, Function]
17776
- },
17777
- bordered: {
17778
- type: Boolean
17779
- },
17780
- bottomContent: {},
17781
- cellEmptyContent: {},
17782
- data: {},
17783
- disableDataPage: {
17784
- type: Boolean
17785
- },
17786
- disableSpaceInactiveRow: {
17787
- type: Boolean
17788
- },
17789
- empty: {},
17790
- firstFullRow: {},
17791
- fixedRows: {},
17792
- footData: {},
17793
- footerAffixProps: {},
17794
- footerAffixedBottom: {
17795
- type: [Boolean, Object]
17796
- },
17797
- footerSummary: {},
17798
- headerAffixProps: {},
17799
- headerAffixedTop: {
17800
- type: [Boolean, Object]
17801
- },
17802
- height: {},
17803
- horizontalScrollAffixedBottom: {
17804
- type: [Boolean, Object]
17805
- },
17806
- hover: {
17807
- type: Boolean
17808
- },
17809
- keyboardRowHover: {
17810
- type: Boolean
17811
- },
17812
- lastFullRow: {},
17813
- lazyLoad: {
17814
- type: Boolean
17815
- },
17816
- loading: {
17817
- type: Boolean
17818
- },
17819
- loadingProps: {},
17820
- locale: {},
17821
- maxHeight: {},
17822
- paginationAffixedBottom: {
17823
- type: [Boolean, Object]
17824
- },
17825
- resizable: {
17826
- type: Boolean
17827
- },
17828
- rowAttributes: {
17829
- type: [Object, Function, Array]
17830
- },
17831
- rowClassName: {
17832
- type: [Object, Array, String, Function]
17833
- },
17834
- rowspanAndColspan: {
17835
- type: Function
17836
- },
17837
- rowspanAndColspanInFooter: {
17838
- type: Function
17839
- },
17840
- scroll: {},
17841
- showHeader: {
17842
- type: Boolean
17843
- },
17844
- size: {},
17845
- stripe: {
17846
- type: Boolean
17847
- },
17848
- tableContentWidth: {},
17849
- tableLayout: {},
17850
- topContent: {},
17851
- verticalAlign: {},
17852
- onActiveChange: {
17853
- type: Function
17854
- },
17855
- onActiveRowAction: {
17856
- type: Function
17857
- },
17858
- onColumnResizeChange: {
17859
- type: Function
17860
- },
17861
- onPageChange: {
17862
- type: Function
17863
- },
17864
- onRowClick: {
17865
- type: Function
17866
- },
17867
- onRowDblclick: {
17868
- type: Function
17869
- },
17870
- onRowMousedown: {
17871
- type: Function
17872
- },
17873
- onRowMouseenter: {
17874
- type: Function
17875
- },
17876
- onRowMouseleave: {
17877
- type: Function
17878
- },
17879
- onRowMouseover: {
17880
- type: Function
17881
- },
17882
- onRowMouseup: {
17883
- type: Function
17884
- },
17885
- onScroll: {
17886
- type: Function
17887
- },
17888
- onScrollX: {
17889
- type: Function
17890
- },
17891
- onScrollY: {
17892
- type: Function
17893
- },
17894
- cacheKey: {
17895
- type: [String, Function]
17896
- },
17897
- cacheTime: {},
17898
- pollingInterval: {},
17899
- onBefore: {
17900
- type: Function
17901
- },
17902
- onAfter: {
17903
- type: Function
17904
- },
17905
- onSuccess: {
17906
- type: Function
17907
- },
17908
- onError: {
17909
- type: Function
17910
- },
17911
- service: {
17912
- type: Function
17913
- },
17914
- manual: {
17915
- type: Boolean
17916
- },
17917
- transformParams: {
17918
- type: Function
17919
- },
17920
- transformRes: {
17921
- type: Function
17922
- },
17923
- pagination: {}
17924
- }, qdCrudTableProps),
17925
- emits: ["update:searchData", "update:data", "update:selectedRowKeys", "update:activeRowKeys", "update:columnControllerVisible", "update:displayColumns", "update:expandedRowKeys", "update:filterValue", "update:sort", "update:expandedTreeNodes"],
17926
- setup(__props, {
17927
- expose: __expose,
17928
- emit: __emit
17929
- }) {
17930
- const vHasPermi = hasPermiDirective;
17931
- const props = __props;
17932
- const emit = __emit;
17933
- const {
17934
- searchData,
17935
- data,
17936
- selectedRowKeys,
17937
- activeRowKeys,
17938
- columnControllerVisible,
17939
- displayColumns,
17940
- expandedRowKeys,
17941
- filterValue,
17942
- sort,
17943
- expandedTreeNodes
17944
- } = /* @__PURE__ */ useVModels(props, emit, {
17945
- passive: true
17946
- });
17947
- const {
17948
- t
17949
- } = useConfig("crud");
17950
- const {
17951
- msgError,
17952
- msgSuccess,
17953
- alertWarning,
17954
- confirm
17955
- } = useModal();
17956
- const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
17957
- const dialogFormMap = reactive({});
17958
- const reProps = computed(() => {
17959
- const {
17960
- data: data2,
17961
- searchData: inSearchData,
17962
- selectedRowKeys: selectedRowKeys2,
17963
- activeRowKeys: activeRowKeys2,
17964
- columnControllerVisible: columnControllerVisible2,
17965
- displayColumns: displayColumns2,
17966
- expandedRowKeys: expandedRowKeys2,
17967
- filterValue: filterValue2,
17968
- sort: sort2,
17969
- expandedTreeNodes: expandedTreeNodes2,
17970
- transformParams,
17971
- search,
17972
- form,
17973
- detail,
17974
- add,
17975
- actions,
17976
- edit,
17977
- view,
17978
- del,
17979
- rowActions,
17980
- title,
17981
- columns,
17982
- selectType,
17983
- ...serviceTableOptions
17984
- } = props;
17985
- const mergedTransformParams = (params) => {
17986
- const merged = {
17987
- ...params,
17988
- ...searchData.value
17989
- };
17990
- if (transformParams) return transformParams(merged);
17991
- return merged;
17992
- };
17993
- const reAdd = mergeAction({
17994
- crudMode: "add",
17995
- permiID: "add",
17996
- content: t("addText"),
17997
- icon: () => createVNode(AddIcon, null, null)
17998
- }, add, form);
17999
- const reActions = [reAdd, ...buildActions(actions, form)].filter(Boolean);
18000
- const reEdit = mergeAction({
18001
- crudMode: "edit",
18002
- permiID: "edit",
18003
- content: t("editText"),
18004
- theme: "primary",
18005
- hover: "color"
18006
- }, edit, form);
18007
- const reView = mergeAction({
18008
- crudMode: "view",
18009
- permiID: "query",
18010
- content: t("viewText"),
18011
- theme: "primary",
18012
- hover: "color"
18013
- }, view, form);
18014
- const reDel = mergeAction({
18015
- crudMode: "del",
18016
- permiID: "remove",
18017
- content: t("deleteText"),
18018
- theme: "danger",
18019
- hover: "color",
18020
- selectType: "multiple"
18021
- }, del, form);
18022
- const reRowActions = [reEdit, reView, reDel, ...buildActions(rowActions, form)].filter(Boolean);
18023
- let reSelectType = selectType;
18024
- if (reDel?.selectType === "multiple") {
18025
- if (!reSelectType) reSelectType = "multiple";
18026
- const batchDel = mergeAction({
18027
- crudMode: "del",
18028
- permiID: "remove",
18029
- content: t("deleteText"),
18030
- theme: "danger",
18031
- variant: "outline",
18032
- selectType: "multiple"
18033
- }, del, form);
18034
- reActions.splice(reAdd ? 1 : 0, 0, batchDel);
18035
- }
18036
- const reColumns = columns || [];
18037
- const operationLength = reRowActions.length;
18038
- if (operationLength) {
18039
- const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
18040
- const defaultOperation = {
18041
- title: t("operationText"),
18042
- colKey: "operation",
18043
- align: "center",
18044
- fixed: "right",
18045
- width: 28 * operationLength + 25 * operationLength - 1 + 32
18046
- };
18047
- if (operationIdx > -1) {
18048
- reColumns[operationIdx] = {
18049
- ...defaultOperation,
18050
- ...reColumns[operationIdx]
18051
- };
18052
- } else {
18053
- reColumns.push(defaultOperation);
18054
- }
18055
- }
18056
- return {
18057
- title,
18058
- searchOptions: search,
18059
- serviceTableOptions: {
18060
- ...serviceTableOptions,
18061
- selectType: reSelectType,
18062
- columns: reColumns,
18063
- transformParams: mergedTransformParams
18064
- },
18065
- formOptions: form,
18066
- detailOptions: detail,
18067
- actions: reActions,
18068
- rowActions: reRowActions,
18069
- models: {
18070
- data: data2,
18071
- searchData: inSearchData,
18072
- selectedRowKeys: selectedRowKeys2,
18073
- activeRowKeys: activeRowKeys2,
18074
- columnControllerVisible: columnControllerVisible2,
18075
- displayColumns: displayColumns2,
18076
- expandedRowKeys: expandedRowKeys2,
18077
- filterValue: filterValue2,
18078
- sort: sort2,
18079
- expandedTreeNodes: expandedTreeNodes2
18080
- }
18081
- };
18082
- });
18083
- const tableRef = useTemplateRef("table");
18084
- const searchVisible = ref(true);
18085
- const searchRef = useTemplateRef("search");
18086
- let searchMode = "refresh";
18087
- function handleSearch() {
18088
- searchMode = "changeCurrent";
18089
- }
18090
- function handleResetSearch() {
18091
- searchMode = "changeCurrent";
18092
- searchRef.value?.reset();
18093
- searchRef.value?.submit();
18094
- }
18095
- function triggerSearch({
18096
- validateResult
18097
- }) {
18098
- if (validateResult !== true) return;
18099
- switch (searchMode) {
18100
- case "changeCurrent":
18101
- tableRef.value?.changeCurrent(1);
18102
- break;
18103
- default:
18104
- tableRef.value?.refresh();
18105
- break;
18106
- }
18107
- }
18108
- function handleRefresh() {
18109
- searchMode = "refresh";
18110
- handleSearch();
18111
- }
18112
- function toggleSearchVisible() {
18113
- searchVisible.value = !searchVisible.value;
18114
- }
18115
- function toggleTreeExpandAll() {
18116
- if (treeIsExpand.value) tableRef.value?.foldAll();
18117
- else tableRef.value?.expandAll();
18118
- }
18119
- function openColumnController() {
18120
- columnControllerVisible.value = true;
18121
- }
18122
- function buildActions(actions, crudForm) {
18123
- if (!actions) return [];
18124
- return actions.map((item) => mergeAction({
18125
- variant: "outline",
18126
- theme: "primary",
18127
- hover: "color"
18128
- }, item, crudForm));
18129
- }
18130
- function mergeAction(defaultOptions, currentOptions, crudForm) {
18131
- if (currentOptions === false || !currentOptions) return;
18132
- const mergeOptions = merge(defaultOptions, currentOptions);
18133
- mergeOptions.permi = buildActionPermi(mergeOptions);
18134
- if (mergeOptions.crudMode !== "del") {
18135
- mergeOptions.form = buildActionForm(mergeOptions, crudForm);
18136
- }
18137
- return mergeOptions;
18138
- }
18139
- function getConfigRendererCtx(self2, other) {
18140
- return {
18141
- tableData: data.value,
18142
- searchData: searchData.value,
18143
- selectedRowKeys: selectedRowKeys.value,
18144
- activeRowKeys: activeRowKeys.value,
18145
- self: self2,
18146
- ...other
18147
- };
18148
- }
18149
- function actionIsCRU(crudMode) {
18150
- return crudMode && ["add", "edit", "view"].includes(crudMode);
18151
- }
18152
- function buildActionPermi(action) {
18153
- if (action.permi) return action.permi;
18154
- if (!props.permiPrefix || !action.permiID) return [];
18155
- return [`${props.permiPrefix}.${action.permiID}`];
18156
- }
18157
- function buildActionForm(action, crudForm) {
18158
- const IsCRU = actionIsCRU(action.crudMode);
18159
- if (!action.form && IsCRU) {
18160
- action.form = cloneDeep(crudForm);
18161
- }
18162
- const {
18163
- form
18164
- } = action;
18165
- if (form) {
18166
- if (action.crudMode === "view") form.readonly = true;
18167
- if (!form.onSubmit && IsCRU) {
18168
- form.onSubmit = async (context) => {
18169
- const {
18170
- uid,
18171
- service,
18172
- transformParams,
18173
- transformRes,
18174
- crudMode
18175
- } = action;
18176
- if (context.validateResult !== true || !service || !uid || !dialogFormMap[uid]) return false;
18177
- let currentParams = easyCopy(context.formData);
18178
- if (transformParams) {
18179
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
18180
- if (tpErr) throw tpErr;
18181
- currentParams = tpRes;
18182
- }
18183
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18184
- if (serviceErr) throw serviceErr;
18185
- let res;
18186
- if (transformRes) {
18187
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18188
- if (trErr) throw trErr;
18189
- res = trRes;
18190
- } else {
18191
- res = serviceRes;
18192
- }
18193
- if (typeof res === "boolean") {
18194
- res = {
18195
- success: res,
18196
- message: ""
18197
- };
18198
- }
18199
- if (!res) {
18200
- res = {
18201
- success: true,
18202
- message: ""
18203
- };
18204
- }
18205
- const message = res.message;
18206
- if (res.success === false) {
18207
- if (message) msgError(message);
18208
- return false;
18209
- }
18210
- msgSuccess(message || t("operationSuccessText"));
18211
- if (crudMode === "add") {
18212
- tableRef.value?.changeCurrent(1);
18213
- } else {
18214
- tableRef.value?.refresh();
18215
- }
18216
- };
17411
+ var dayjs_min$1 = { exports: {} };
17412
+ var dayjs_min = dayjs_min$1.exports;
17413
+ var hasRequiredDayjs_min;
17414
+ function requireDayjs_min() {
17415
+ if (hasRequiredDayjs_min) return dayjs_min$1.exports;
17416
+ hasRequiredDayjs_min = 1;
17417
+ (function(module2, exports2) {
17418
+ !(function(t, e) {
17419
+ module2.exports = e();
17420
+ })(dayjs_min, (function() {
17421
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h2 = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
17422
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
17423
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
17424
+ } }, m = function(t2, e2, n2) {
17425
+ var r2 = String(t2);
17426
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
17427
+ }, v = { s: m, z: function(t2) {
17428
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
17429
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
17430
+ }, m: function t2(e2, n2) {
17431
+ if (e2.date() < n2.date()) return -t2(n2, e2);
17432
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
17433
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
17434
+ }, a: function(t2) {
17435
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
17436
+ }, p: function(t2) {
17437
+ return { M: c, y: h2, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
17438
+ }, u: function(t2) {
17439
+ return void 0 === t2;
17440
+ } }, g = "en", D = {};
17441
+ D[g] = M;
17442
+ var p = "$isDayjsObject", S = function(t2) {
17443
+ return t2 instanceof _ || !(!t2 || !t2[p]);
17444
+ }, w = function t2(e2, n2, r2) {
17445
+ var i2;
17446
+ if (!e2) return g;
17447
+ if ("string" == typeof e2) {
17448
+ var s2 = e2.toLowerCase();
17449
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
17450
+ var u2 = e2.split("-");
17451
+ if (!i2 && u2.length > 1) return t2(u2[0]);
17452
+ } else {
17453
+ var a2 = e2.name;
17454
+ D[a2] = e2, i2 = a2;
18217
17455
  }
18218
- const {
18219
- title
18220
- } = props;
18221
- form.wrapper = merge({}, {
18222
- header: `${action.content}${title ? ` ${title}` : ""}`
18223
- }, form.wrapper);
18224
- }
18225
- return action.form;
18226
- }
18227
- function buildActionOnClick(action, originalParams) {
18228
- if (action.onClick) return action.onClick;
18229
- if (action.crudMode === "del") {
18230
- const onClick2 = async () => {
18231
- const {
18232
- service,
18233
- transformParams,
18234
- transformRes
18235
- } = action;
18236
- const row = originalParams?.row;
18237
- if (!service || !row && action.selectType !== "multiple" || !row && !selectedRowKeys.value.length && action.selectType === "multiple") {
18238
- return;
18239
- }
18240
- const childrenKey = reProps.value.serviceTableOptions.tree?.childrenKey || qdServiceTableTreeConfig.childrenKey;
18241
- let delHasChild = false;
18242
- if (!row) {
18243
- const rowKey = reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey;
18244
- delHasChild = selectedRowKeys.value.some((item) => {
18245
- const data2 = tableRef.value?.getData(item);
18246
- if (!data2) return false;
18247
- const children = data2.row[childrenKey];
18248
- if (isEmpty(children)) return false;
18249
- if (children === true) return true;
18250
- return children.some((child) => !selectedRowKeys.value.includes(child[rowKey]));
18251
- });
18252
- } else if (!isEmpty(row[childrenKey])) {
18253
- delHasChild = true;
17456
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
17457
+ }, O = function(t2, e2) {
17458
+ if (S(t2)) return t2.clone();
17459
+ var n2 = "object" == typeof e2 ? e2 : {};
17460
+ return n2.date = t2, n2.args = arguments, new _(n2);
17461
+ }, b = v;
17462
+ b.l = w, b.i = S, b.w = function(t2, e2) {
17463
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
17464
+ };
17465
+ var _ = (function() {
17466
+ function M2(t2) {
17467
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
17468
+ }
17469
+ var m2 = M2.prototype;
17470
+ return m2.parse = function(t2) {
17471
+ this.$d = (function(t3) {
17472
+ var e2 = t3.date, n2 = t3.utc;
17473
+ if (null === e2) return /* @__PURE__ */ new Date(NaN);
17474
+ if (b.u(e2)) return /* @__PURE__ */ new Date();
17475
+ if (e2 instanceof Date) return new Date(e2);
17476
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
17477
+ var r2 = e2.match($);
17478
+ if (r2) {
17479
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
17480
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
17481
+ }
17482
+ }
17483
+ return new Date(e2);
17484
+ })(t2), this.init();
17485
+ }, m2.init = function() {
17486
+ var t2 = this.$d;
17487
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
17488
+ }, m2.$utils = function() {
17489
+ return b;
17490
+ }, m2.isValid = function() {
17491
+ return !(this.$d.toString() === l);
17492
+ }, m2.isSame = function(t2, e2) {
17493
+ var n2 = O(t2);
17494
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
17495
+ }, m2.isAfter = function(t2, e2) {
17496
+ return O(t2) < this.startOf(e2);
17497
+ }, m2.isBefore = function(t2, e2) {
17498
+ return this.endOf(e2) < O(t2);
17499
+ }, m2.$g = function(t2, e2, n2) {
17500
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
17501
+ }, m2.unix = function() {
17502
+ return Math.floor(this.valueOf() / 1e3);
17503
+ }, m2.valueOf = function() {
17504
+ return this.$d.getTime();
17505
+ }, m2.startOf = function(t2, e2) {
17506
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
17507
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
17508
+ return r2 ? i2 : i2.endOf(a);
17509
+ }, $2 = function(t3, e3) {
17510
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
17511
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
17512
+ switch (f2) {
17513
+ case h2:
17514
+ return r2 ? l2(1, 0) : l2(31, 11);
17515
+ case c:
17516
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
17517
+ case o:
17518
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
17519
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
17520
+ case a:
17521
+ case d:
17522
+ return $2(v2 + "Hours", 0);
17523
+ case u:
17524
+ return $2(v2 + "Minutes", 1);
17525
+ case s:
17526
+ return $2(v2 + "Seconds", 2);
17527
+ case i:
17528
+ return $2(v2 + "Milliseconds", 3);
17529
+ default:
17530
+ return this.clone();
18254
17531
  }
18255
- if (delHasChild) {
18256
- alertWarning(t("deleteHasChildrenText"));
18257
- return;
17532
+ }, m2.endOf = function(t2) {
17533
+ return this.startOf(t2, false);
17534
+ }, m2.$set = function(t2, e2) {
17535
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h2] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
17536
+ if (o2 === c || o2 === h2) {
17537
+ var y2 = this.clone().set(d, 1);
17538
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
17539
+ } else l2 && this.$d[l2]($2);
17540
+ return this.init(), this;
17541
+ }, m2.set = function(t2, e2) {
17542
+ return this.clone().$set(t2, e2);
17543
+ }, m2.get = function(t2) {
17544
+ return this[b.p(t2)]();
17545
+ }, m2.add = function(r2, f2) {
17546
+ var d2, l2 = this;
17547
+ r2 = Number(r2);
17548
+ var $2 = b.p(f2), y2 = function(t2) {
17549
+ var e2 = O(l2);
17550
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
17551
+ };
17552
+ if ($2 === c) return this.set(c, this.$M + r2);
17553
+ if ($2 === h2) return this.set(h2, this.$y + r2);
17554
+ if ($2 === a) return y2(1);
17555
+ if ($2 === o) return y2(7);
17556
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
17557
+ return b.w(m3, this);
17558
+ }, m2.subtract = function(t2, e2) {
17559
+ return this.add(-1 * t2, e2);
17560
+ }, m2.format = function(t2) {
17561
+ var e2 = this, n2 = this.$locale();
17562
+ if (!this.isValid()) return n2.invalidDate || l;
17563
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h3 = function(t3, n3, i3, s3) {
17564
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
17565
+ }, d2 = function(t3) {
17566
+ return b.s(s2 % 12 || 12, t3, "0");
17567
+ }, $2 = f2 || function(t3, e3, n3) {
17568
+ var r3 = t3 < 12 ? "AM" : "PM";
17569
+ return n3 ? r3.toLowerCase() : r3;
17570
+ };
17571
+ return r2.replace(y, (function(t3, r3) {
17572
+ return r3 || (function(t4) {
17573
+ switch (t4) {
17574
+ case "YY":
17575
+ return String(e2.$y).slice(-2);
17576
+ case "YYYY":
17577
+ return b.s(e2.$y, 4, "0");
17578
+ case "M":
17579
+ return a2 + 1;
17580
+ case "MM":
17581
+ return b.s(a2 + 1, 2, "0");
17582
+ case "MMM":
17583
+ return h3(n2.monthsShort, a2, c2, 3);
17584
+ case "MMMM":
17585
+ return h3(c2, a2);
17586
+ case "D":
17587
+ return e2.$D;
17588
+ case "DD":
17589
+ return b.s(e2.$D, 2, "0");
17590
+ case "d":
17591
+ return String(e2.$W);
17592
+ case "dd":
17593
+ return h3(n2.weekdaysMin, e2.$W, o2, 2);
17594
+ case "ddd":
17595
+ return h3(n2.weekdaysShort, e2.$W, o2, 3);
17596
+ case "dddd":
17597
+ return o2[e2.$W];
17598
+ case "H":
17599
+ return String(s2);
17600
+ case "HH":
17601
+ return b.s(s2, 2, "0");
17602
+ case "h":
17603
+ return d2(1);
17604
+ case "hh":
17605
+ return d2(2);
17606
+ case "a":
17607
+ return $2(s2, u2, true);
17608
+ case "A":
17609
+ return $2(s2, u2, false);
17610
+ case "m":
17611
+ return String(u2);
17612
+ case "mm":
17613
+ return b.s(u2, 2, "0");
17614
+ case "s":
17615
+ return String(e2.$s);
17616
+ case "ss":
17617
+ return b.s(e2.$s, 2, "0");
17618
+ case "SSS":
17619
+ return b.s(e2.$ms, 3, "0");
17620
+ case "Z":
17621
+ return i2;
17622
+ }
17623
+ return null;
17624
+ })(t3) || i2.replace(":", "");
17625
+ }));
17626
+ }, m2.utcOffset = function() {
17627
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
17628
+ }, m2.diff = function(r2, d2, l2) {
17629
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
17630
+ return b.m(y2, m3);
17631
+ };
17632
+ switch (M3) {
17633
+ case h2:
17634
+ $2 = D2() / 12;
17635
+ break;
17636
+ case c:
17637
+ $2 = D2();
17638
+ break;
17639
+ case f:
17640
+ $2 = D2() / 3;
17641
+ break;
17642
+ case o:
17643
+ $2 = (g2 - v2) / 6048e5;
17644
+ break;
17645
+ case a:
17646
+ $2 = (g2 - v2) / 864e5;
17647
+ break;
17648
+ case u:
17649
+ $2 = g2 / n;
17650
+ break;
17651
+ case s:
17652
+ $2 = g2 / e;
17653
+ break;
17654
+ case i:
17655
+ $2 = g2 / t;
17656
+ break;
17657
+ default:
17658
+ $2 = g2;
18258
17659
  }
18259
- confirm({
18260
- body: t("deleteWrapperBodyText"),
18261
- ...action.wrapper
18262
- }, async () => {
18263
- const params = row || selectedRowKeys.value;
18264
- let currentParams = row ? params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey] : selectedRowKeys.value;
18265
- if (transformParams) {
18266
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18267
- if (tpErr) throw tpErr;
18268
- currentParams = tpRes;
18269
- }
18270
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18271
- if (serviceErr) throw serviceErr;
18272
- let res;
18273
- if (transformRes) {
18274
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18275
- if (trErr) throw trErr;
18276
- res = trRes;
18277
- } else {
18278
- res = serviceRes;
18279
- }
18280
- if (typeof res === "boolean") {
18281
- res = {
18282
- success: res,
18283
- message: ""
18284
- };
17660
+ return l2 ? $2 : b.a($2);
17661
+ }, m2.daysInMonth = function() {
17662
+ return this.endOf(c).$D;
17663
+ }, m2.$locale = function() {
17664
+ return D[this.$L];
17665
+ }, m2.locale = function(t2, e2) {
17666
+ if (!t2) return this.$L;
17667
+ var n2 = this.clone(), r2 = w(t2, e2, true);
17668
+ return r2 && (n2.$L = r2), n2;
17669
+ }, m2.clone = function() {
17670
+ return b.w(this.$d, this);
17671
+ }, m2.toDate = function() {
17672
+ return new Date(this.valueOf());
17673
+ }, m2.toJSON = function() {
17674
+ return this.isValid() ? this.toISOString() : null;
17675
+ }, m2.toISOString = function() {
17676
+ return this.$d.toISOString();
17677
+ }, m2.toString = function() {
17678
+ return this.$d.toUTCString();
17679
+ }, M2;
17680
+ })(), k = _.prototype;
17681
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h2], ["$D", d]].forEach((function(t2) {
17682
+ k[t2[1]] = function(e2) {
17683
+ return this.$g(e2, t2[0], t2[1]);
17684
+ };
17685
+ })), O.extend = function(t2, e2) {
17686
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
17687
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
17688
+ return O(1e3 * t2);
17689
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
17690
+ }));
17691
+ })(dayjs_min$1);
17692
+ return dayjs_min$1.exports;
17693
+ }
17694
+ var dayjs_minExports = requireDayjs_min();
17695
+ const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
17696
+ const csl = useCsl("useAgentChat");
17697
+ function useAgentChat(options) {
17698
+ const { t } = useConfig("chat");
17699
+ const { msgError, alertError, alertWarning } = useModal();
17700
+ const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
17701
+ const mergeOpt = { ...globalOpt, ...options };
17702
+ const loading = ref(false);
17703
+ const agentId = ref(mergeOpt.agentId);
17704
+ const apiKey = ref(mergeOpt.apiKey);
17705
+ const sessionId = ref("");
17706
+ let abortController;
17707
+ async function send({
17708
+ prompt,
17709
+ files,
17710
+ reSend,
17711
+ extParams,
17712
+ refreshSessionId,
17713
+ parseContent,
17714
+ onOpen,
17715
+ onMessage,
17716
+ onClose,
17717
+ onError
17718
+ }) {
17719
+ const allData = { content: "", reasoning: "", parsedContent: void 0, useTime: 0 };
17720
+ if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
17721
+ loading.value = true;
17722
+ const [agInfoErr, agInfo] = await to(getAgentInfo());
17723
+ if (agInfoErr) {
17724
+ loading.value = false;
17725
+ msgError(agInfoErr.message);
17726
+ throw agInfoErr;
17727
+ }
17728
+ const [sIdErr, sId] = await to(getSessionId({ ...agInfo, refreshSessionId }));
17729
+ if (sIdErr) {
17730
+ loading.value = false;
17731
+ msgError(sIdErr.message);
17732
+ throw sIdErr;
17733
+ }
17734
+ const getUrl = mergeOpt.getUrl;
17735
+ if (!getUrl) {
17736
+ loading.value = false;
17737
+ const msg = t("failedObtainUrlMessage");
17738
+ msgError(msg);
17739
+ throw new Error(msg);
17740
+ }
17741
+ abortController = new AbortController();
17742
+ const sendTime = Date.now();
17743
+ csl.log.dev(`send.${sId}`, agInfo);
17744
+ return new Promise((resolve, reject) => {
17745
+ let timeoutId;
17746
+ let isFirstMessage = true;
17747
+ function triggerError(err) {
17748
+ allData.useTime = Date.now() - sendTime;
17749
+ csl.log.dev(`onError.${sId}`, err);
17750
+ loading.value = false;
17751
+ if (timeoutId) clearTimeout(timeoutId);
17752
+ onError?.(err);
17753
+ reject(err);
17754
+ }
17755
+ function setTimeoutHandler() {
17756
+ if (timeoutId) clearTimeout(timeoutId);
17757
+ timeoutId = setTimeout(() => {
17758
+ triggerError(new Error(t("agentProcessingTimeoutMessage")));
17759
+ stop();
17760
+ }, 20 * 1e3);
17761
+ }
17762
+ fetchEventSource(getUrl(agInfo.agentId, sId), {
17763
+ method: "POST",
17764
+ headers: {
17765
+ "Content-Type": "application/json;charset=UTF-8",
17766
+ Authorization: `Bearer ${agInfo.apiKey}`
17767
+ },
17768
+ signal: abortController?.signal,
17769
+ openWhenHidden: true,
17770
+ body: JSON.stringify({
17771
+ message: prompt || "",
17772
+ re_chat: reSend ?? false,
17773
+ document_list: files,
17774
+ client_id: agInfo.apiKey,
17775
+ client_type: "API_KEY",
17776
+ ...extParams
17777
+ }),
17778
+ onopen: async (res) => {
17779
+ csl.log.dev(`onOpen.${sId}`, res);
17780
+ await onOpen?.(res);
17781
+ },
17782
+ onmessage: (res) => {
17783
+ const { data } = res;
17784
+ let reData = { content: "", reasoning: "" };
17785
+ try {
17786
+ reData = parseRelaxedJSON(data);
17787
+ if (reData.content) allData.content += reData.content;
17788
+ if (reData.reasoning) allData.reasoning += reData.reasoning;
17789
+ if (isFirstMessage && reData.content || !isFirstMessage) {
17790
+ isFirstMessage = false;
17791
+ setTimeoutHandler();
18285
17792
  }
18286
- if (!res) {
18287
- res = {
18288
- success: true,
18289
- message: ""
18290
- };
17793
+ } catch (err) {
17794
+ console.warn("[useAgentChat.send.onMessage]", err);
17795
+ }
17796
+ csl.log.dev(`onMessage.${sId}`, dayjs().format("HH:mm:ss"), reData);
17797
+ onMessage?.({ data: reData, allData });
17798
+ },
17799
+ onclose: () => {
17800
+ if (parseContent) {
17801
+ try {
17802
+ if (timeoutId) clearTimeout(timeoutId);
17803
+ allData.parsedContent = parseRelaxedJSON(allData.content);
17804
+ } catch (err) {
17805
+ alertError({
17806
+ header: t("failedParseContentMessage"),
17807
+ body: err.message
17808
+ });
17809
+ triggerError(err);
17810
+ return;
18291
17811
  }
18292
- const message = res.message;
18293
- if (res.success === false) {
18294
- if (message) msgError(message);
18295
- return false;
17812
+ if (isEmpty(allData.parsedContent)) {
17813
+ const err = new Error(t("parsedContentEmptyMessage"));
17814
+ alertWarning({
17815
+ header: t("failedParseContentMessage"),
17816
+ body: err.message
17817
+ });
17818
+ triggerError(err);
17819
+ return;
18296
17820
  }
18297
- msgSuccess(message || t("deleteSuccessText"));
18298
- if (!row) selectedRowKeys.value = [];
18299
- tableRef.value?.refresh();
18300
- return true;
18301
- });
18302
- };
18303
- return onClick2;
18304
- }
18305
- if (isEmpty(action.form) || !actionIsCRU(action.crudMode)) return;
18306
- const onClick = async () => {
18307
- if (!action.uid) action.uid = generateRandomString(16);
18308
- const uid = action.uid;
18309
- const form = shallowRef(action.form);
18310
- if (!dialogFormMap[uid]) {
18311
- dialogFormMap[uid] = {
18312
- visible: false,
18313
- data: {},
18314
- crudMode: action.crudMode,
18315
- form
18316
- };
18317
- }
18318
- await nextTick();
18319
- dialogFormMap[uid].visible = true;
18320
- if (!action.crudMode || !["edit", "view"].includes(action.crudMode) || !originalParams) {
18321
- return;
18322
- }
18323
- form.value.loading = true;
18324
- triggerRef(form);
18325
- const [err, res] = await to(getDetail(originalParams.row));
18326
- form.value.loading = false;
18327
- triggerRef(form);
18328
- if (err) {
18329
- dialogFormMap[uid].data = originalParams.row;
18330
- return;
17821
+ }
17822
+ if (timeoutId) clearTimeout(timeoutId);
17823
+ allData.useTime = Date.now() - sendTime;
17824
+ csl.log.dev(`onClose.${sId}`, allData);
17825
+ loading.value = false;
17826
+ onClose?.(allData);
17827
+ resolve(allData);
17828
+ },
17829
+ onerror: (err) => {
17830
+ const reErr = err ? err : new Error(t("apiUnknownErrorMessage"));
17831
+ msgError(reErr.message);
17832
+ triggerError(reErr);
17833
+ throw reErr;
18331
17834
  }
18332
- dialogFormMap[uid].data = res;
18333
- };
18334
- return onClick;
17835
+ });
17836
+ });
17837
+ }
17838
+ function stop() {
17839
+ if (!abortController) return;
17840
+ csl.log.dev(`stop.${sessionId.value}`);
17841
+ abortController.abort();
17842
+ }
17843
+ async function getAgentInfo() {
17844
+ if (agentId.value && apiKey.value) {
17845
+ return { agentId: agentId.value, apiKey: apiKey.value };
18335
17846
  }
18336
- function buildActionDisabled(action) {
18337
- if (action.disabled) return action.disabled;
18338
- switch (action.selectType) {
18339
- case "single":
18340
- return selectedRowKeys.value.length !== 1;
18341
- case "multiple":
18342
- return selectedRowKeys.value.length === 0;
18343
- default:
18344
- return false;
18345
- }
17847
+ const getFn = mergeOpt.getAgentInfo;
17848
+ if (!getFn) throw new Error(t("failedObtainAgentInfoMessage"));
17849
+ const [err, res] = await suspectedWrapperPromise(getFn());
17850
+ if (err) throw err;
17851
+ if (!res?.agentId || !res.apiKey) {
17852
+ if (!getFn) throw new Error(t("failedObtainAgentInfoMessage"));
18346
17853
  }
18347
- async function getDetail(params) {
18348
- const {
18349
- detailOptions
18350
- } = reProps.value;
18351
- if (!detailOptions) return easyCopy(params);
18352
- const {
18353
- service,
18354
- transformParams,
18355
- transformRes
18356
- } = detailOptions;
18357
- if (!service) return easyCopy(params);
18358
- let currentParams = params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey];
18359
- if (transformParams) {
18360
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18361
- if (tpErr) throw tpErr;
18362
- currentParams = tpRes;
18363
- }
18364
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18365
- if (serviceErr) throw serviceErr;
18366
- let res;
18367
- if (transformRes) {
18368
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18369
- if (trErr) throw trErr;
18370
- res = trRes;
17854
+ return res;
17855
+ }
17856
+ async function getSessionId({
17857
+ agentId: agentId2,
17858
+ apiKey: apiKey2,
17859
+ refreshSessionId
17860
+ }) {
17861
+ if (sessionId.value && !refreshSessionId) return sessionId.value;
17862
+ const getFn = mergeOpt.getSessionId;
17863
+ if (!getFn) throw new Error(t("failedObtainSessionIdMessage"));
17864
+ const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
17865
+ if (err) throw err;
17866
+ sessionId.value = res;
17867
+ return res;
17868
+ }
17869
+ onBeforeUnmount(() => {
17870
+ stop();
17871
+ });
17872
+ return {
17873
+ loading,
17874
+ agentId,
17875
+ apiKey,
17876
+ sessionId,
17877
+ send,
17878
+ stop
17879
+ };
17880
+ }
17881
+ const dictCache = /* @__PURE__ */ new Map();
17882
+ const dictPromiseCache = /* @__PURE__ */ new Map();
17883
+ function useDict(...args) {
17884
+ const res = ref({});
17885
+ const loadingMap = ref({});
17886
+ args.forEach(async (dictType) => {
17887
+ const camelKey = camelize(dictType);
17888
+ res.value[camelKey] = [];
17889
+ const loadKey = `${camelKey}Load`;
17890
+ loadingMap.value[loadKey] = false;
17891
+ if (dictCache.has(camelKey)) {
17892
+ res.value[camelKey] = dictCache.get(camelKey);
17893
+ } else {
17894
+ loadingMap.value[loadKey] = true;
17895
+ let dictPromise;
17896
+ if (dictPromiseCache.has(camelKey)) {
17897
+ dictPromise = dictPromiseCache.get(camelKey);
18371
17898
  } else {
18372
- res = serviceRes;
17899
+ dictPromise = getDict(dictType);
17900
+ dictPromiseCache.set(camelKey, dictPromise);
18373
17901
  }
18374
- return res;
17902
+ const [dictErr, dictRes] = await to(dictPromise);
17903
+ if (dictErr) {
17904
+ loadingMap.value[loadKey] = false;
17905
+ dictPromiseCache.delete(camelKey);
17906
+ return;
17907
+ }
17908
+ dictCache.set(camelKey, dictRes);
17909
+ res.value[camelKey] = dictRes;
17910
+ loadingMap.value[loadKey] = false;
17911
+ dictPromiseCache.delete(camelKey);
18375
17912
  }
18376
- const expose = {};
18377
- onMounted(() => {
18378
- Object.assign(expose, tableRef.value);
18379
- });
18380
- __expose(expose);
18381
- return (_ctx, _cache) => {
18382
- return openBlock(), createElementBlock("div", _hoisted_1$2, [reProps.value.searchOptions?.items?.length ? withDirectives((openBlock(), createBlock(QdCrudSearch, mergeProps({
18383
- key: 0,
18384
- ref: "search",
18385
- data: unref(searchData),
18386
- "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null),
18387
- class: [!searchVisible.value ? "qd-crud-search--hide" : ""]
18388
- }, reProps.value.searchOptions, {
18389
- "on-submit": triggerSearch
18390
- }), {
18391
- footer: withCtx(() => [createVNode(unref(Space), {
18392
- align: "center",
18393
- size: "small"
18394
- }, {
18395
- default: withCtx(() => [createVNode(unref(Button), {
18396
- type: "submit",
18397
- onClick: handleSearch
18398
- }, {
18399
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18400
- _: 1
18401
- }), createVNode(unref(Button), {
18402
- variant: "outline",
18403
- onClick: handleResetSearch
18404
- }, {
18405
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18406
- _: 1
18407
- })]),
18408
- _: 1
18409
- })]),
18410
- _: 1
18411
- }, 16, ["data", "class"])), [[vShow, searchVisible.value]]) : createCommentVNode("", true), createVNode(unref(_sfc_main$i), {
18412
- class: "qd-crud-table__body"
18413
- }, {
18414
- default: withCtx(() => [createElementVNode("div", _hoisted_2$1, [createVNode(unref(Space), {
18415
- align: "center",
18416
- size: "small"
18417
- }, {
18418
- default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.actions, (item, index2) => {
18419
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18420
- key: item.uid || index2,
18421
- context: getConfigRendererCtx(item),
18422
- config: {
18423
- is: unref(Button),
18424
- ...item,
18425
- form: void 0,
18426
- onClick: buildActionOnClick(item),
18427
- disabled: buildActionDisabled(item)
18428
- }
18429
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18430
- }), 128))], true)]),
18431
- _: 3
18432
- }), createVNode(unref(Space), {
18433
- align: "center",
18434
- size: "small"
18435
- }, {
18436
- default: withCtx(() => [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(unref(Tooltip), {
18437
- key: 0,
18438
- content: searchVisible.value ? unref(t)("collapseSearchText") : unref(t)("expandSearchText")
18439
- }, {
18440
- default: withCtx(() => [createVNode(unref(Button), {
18441
- variant: "text",
18442
- shape: "square",
18443
- onClick: toggleSearchVisible
18444
- }, {
18445
- icon: withCtx(() => [createVNode(unref(SearchIcon))]),
18446
- _: 1
18447
- })]),
18448
- _: 1
18449
- }, 8, ["content"])) : createCommentVNode("", true), createVNode(unref(Tooltip), {
18450
- content: unref(t)("refreshText")
18451
- }, {
18452
- default: withCtx(() => [createVNode(unref(Button), {
18453
- variant: "text",
18454
- shape: "square",
18455
- onClick: handleRefresh
18456
- }, {
18457
- icon: withCtx(() => [createVNode(unref(RefreshIcon))]),
18458
- _: 1
18459
- })]),
18460
- _: 1
18461
- }, 8, ["content"]), !unref(isEmpty)(reProps.value.serviceTableOptions.tree) && !reProps.value.serviceTableOptions.tree.lazyLoad ? (openBlock(), createBlock(unref(Tooltip), {
18462
- key: 1,
18463
- content: treeIsExpand.value ? unref(t)("collapseTreeText") : unref(t)("expandTreeText")
18464
- }, {
18465
- default: withCtx(() => [createVNode(unref(Button), {
18466
- variant: "text",
18467
- shape: "square",
18468
- onClick: toggleTreeExpandAll
18469
- }, {
18470
- icon: withCtx(() => [treeIsExpand.value ? (openBlock(), createBlock(unref(UnfoldLessIcon), {
18471
- key: 0
18472
- })) : (openBlock(), createBlock(unref(UnfoldMoreIcon), {
18473
- key: 1
18474
- }))]),
18475
- _: 1
18476
- })]),
18477
- _: 1
18478
- }, 8, ["content"])) : createCommentVNode("", true), reProps.value.serviceTableOptions.columnController?.hideTriggerButton !== true ? (openBlock(), createBlock(unref(Tooltip), {
18479
- key: 2,
18480
- content: unref(t)("columnControllerText")
18481
- }, {
18482
- default: withCtx(() => [createVNode(unref(Button), {
18483
- variant: "text",
18484
- shape: "square",
18485
- onClick: openColumnController
18486
- }, {
18487
- icon: withCtx(() => [createVNode(unref(SettingIcon))]),
18488
- _: 1
18489
- })]),
18490
- _: 1
18491
- }, 8, ["content"])) : createCommentVNode("", true)]),
18492
- _: 1
18493
- })]), createVNode(unref(QdServiceTable), mergeProps({
18494
- ref: "table",
18495
- data: unref(data),
18496
- "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
18497
- "selected-row-keys": unref(selectedRowKeys),
18498
- "onUpdate:selectedRowKeys": _cache[3] || (_cache[3] = ($event) => isRef(selectedRowKeys) ? selectedRowKeys.value = $event : null),
18499
- "active-row-keys": unref(activeRowKeys),
18500
- "onUpdate:activeRowKeys": _cache[4] || (_cache[4] = ($event) => isRef(activeRowKeys) ? activeRowKeys.value = $event : null),
18501
- "column-controller-visible": unref(columnControllerVisible),
18502
- "onUpdate:columnControllerVisible": _cache[5] || (_cache[5] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
18503
- "display-columns": unref(displayColumns),
18504
- "onUpdate:displayColumns": _cache[6] || (_cache[6] = ($event) => isRef(displayColumns) ? displayColumns.value = $event : null),
18505
- "expanded-row-keys": unref(expandedRowKeys),
18506
- "onUpdate:expandedRowKeys": _cache[7] || (_cache[7] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
18507
- "filter-value": unref(filterValue),
18508
- "onUpdate:filterValue": _cache[8] || (_cache[8] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
18509
- sort: unref(sort),
18510
- "onUpdate:sort": _cache[9] || (_cache[9] = ($event) => isRef(sort) ? sort.value = $event : null),
18511
- "expanded-tree-nodes": unref(expandedTreeNodes),
18512
- "onUpdate:expandedTreeNodes": _cache[10] || (_cache[10] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null)
18513
- }, reProps.value.serviceTableOptions), createSlots({
18514
- operation: withCtx((slotProps) => [renderSlot(_ctx.$slots, "table-operation", normalizeProps(guardReactiveProps(slotProps)), () => [reProps.value.rowActions?.length ? (openBlock(), createBlock(unref(Space), {
18515
- key: 0,
18516
- align: "center",
18517
- size: 0,
18518
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
18519
- }, ["stop"]))
18520
- }, {
18521
- separator: withCtx(() => [createVNode(unref(Divider), {
18522
- layout: "vertical"
18523
- })]),
18524
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.rowActions, (item, index2) => {
18525
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18526
- key: item.uid || index2,
18527
- context: getConfigRendererCtx(item, slotProps),
18528
- config: {
18529
- is: unref(Link),
18530
- ...item,
18531
- onClick: buildActionOnClick(item, slotProps)
18532
- }
18533
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18534
- }), 128))]),
18535
- _: 2
18536
- }, 1024)) : createCommentVNode("", true)], true)]),
18537
- _: 2
18538
- }, [renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "table"), (item) => {
18539
- return {
18540
- name: item.filterName,
18541
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
18542
- };
18543
- })]), 1040, ["data", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes"])]),
18544
- _: 3
18545
- }), (openBlock(true), createElementBlock(Fragment, null, renderList(dialogFormMap, (dialogForm, uid) => {
18546
- return openBlock(), createBlock(unref(_sfc_main$h), {
18547
- key: uid,
18548
- config: {
18549
- is: unref(_sfc_main$8),
18550
- ...dialogForm.form,
18551
- vModelVisible: "self.visible",
18552
- vModelData: "self.data",
18553
- crudMode: dialogForm.crudMode
18554
- },
18555
- context: getConfigRendererCtx(dialogForm)
18556
- }, null, 8, ["config", "context"]);
18557
- }), 128))]);
17913
+ });
17914
+ const result = toRefs(res.value);
17915
+ const loadingRefs = toRefs(loadingMap.value);
17916
+ const readyMethods = {};
17917
+ args.forEach((dictType) => {
17918
+ const camelKey = camelize(dictType);
17919
+ const loadKey = `${camelKey}Load`;
17920
+ readyMethods[`${camelKey}Ready`] = async (callback) => {
17921
+ if (dictCache.has(camelKey)) {
17922
+ const data2 = dictCache.get(camelKey);
17923
+ callback?.(data2);
17924
+ return data2;
17925
+ }
17926
+ while (loadingMap.value[loadKey]) {
17927
+ await new Promise((resolve) => setTimeout(resolve, 10));
17928
+ }
17929
+ const data = dictCache.get(camelKey) || [];
17930
+ callback?.(data);
17931
+ return data;
18558
17932
  };
17933
+ });
17934
+ return {
17935
+ ...result,
17936
+ ...loadingRefs,
17937
+ ...readyMethods
17938
+ };
17939
+ }
17940
+ function useDictDynamic(dictType, hookOptions) {
17941
+ const dictOptions = ref([]);
17942
+ const loading = ref(false);
17943
+ async function loadDict(type) {
17944
+ if (!type) {
17945
+ dictOptions.value = [];
17946
+ hookOptions?.onInit?.([]);
17947
+ return;
17948
+ }
17949
+ const camelKey = type ? camelize(type) : type;
17950
+ if (dictCache.has(camelKey)) {
17951
+ dictOptions.value = dictCache.get(camelKey);
17952
+ hookOptions?.onInit?.(dictOptions.value);
17953
+ return;
17954
+ }
17955
+ loading.value = true;
17956
+ let dictPromise;
17957
+ if (dictPromiseCache.has(camelKey)) {
17958
+ dictPromise = dictPromiseCache.get(camelKey);
17959
+ } else {
17960
+ dictPromise = getDict(type);
17961
+ dictPromiseCache.set(camelKey, dictPromise);
17962
+ }
17963
+ const [dictErr, dictRes] = await to(dictPromise);
17964
+ if (dictErr) {
17965
+ dictOptions.value = [];
17966
+ loading.value = false;
17967
+ dictPromiseCache.delete(camelKey);
17968
+ hookOptions?.onInit?.([]);
17969
+ return;
17970
+ }
17971
+ dictCache.set(camelKey, dictRes);
17972
+ dictOptions.value = dictRes;
17973
+ loading.value = false;
17974
+ dictPromiseCache.delete(camelKey);
17975
+ hookOptions?.onInit?.(dictOptions.value);
17976
+ }
17977
+ watchEffect(() => {
17978
+ loadDict(dictType.value);
17979
+ });
17980
+ return {
17981
+ options: dictOptions,
17982
+ loading
17983
+ };
17984
+ }
17985
+ async function getDict(dictType) {
17986
+ const dictOptions = window.__QIDIAN_DICT__;
17987
+ if (!dictOptions) {
17988
+ const msg = "[useDict] 字典服务未提供,请确保使用了 QdConfigProvider";
17989
+ console.warn(msg);
17990
+ throw new Error(msg);
17991
+ }
17992
+ const { service, transformParams, transformRes } = dictOptions;
17993
+ let currentParams = dictType;
17994
+ if (transformParams) {
17995
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
17996
+ if (tpErr) throw tpErr;
17997
+ currentParams = tpRes;
18559
17998
  }
18560
- });
18561
- const table = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-bdb9c97a"]]);
18562
- const _hoisted_1$1 = {
18563
- key: 0,
18564
- class: "qd-crud-list__header"
17999
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18000
+ if (serviceErr) throw serviceErr;
18001
+ let res;
18002
+ if (transformRes) {
18003
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18004
+ if (trErr) throw trErr;
18005
+ res = trRes;
18006
+ } else {
18007
+ res = serviceRes;
18008
+ }
18009
+ return res;
18010
+ }
18011
+ function useReadonly(context) {
18012
+ const currentInstance = getCurrentInstance();
18013
+ const componentReadonly = computed(() => currentInstance.props.Readonly);
18014
+ const formReadonly = inject("formReadonly", /* @__PURE__ */ Object.create(null));
18015
+ return computed(() => {
18016
+ if (isBoolean(context?.beforeReadonly?.value)) return context.beforeReadonly.value;
18017
+ if (isBoolean(componentReadonly.value)) return componentReadonly.value;
18018
+ if (isBoolean(context?.afterReadonly?.value)) return context.afterReadonly.value;
18019
+ if (isBoolean(formReadonly.readonly?.value)) return formReadonly.readonly.value;
18020
+ return false;
18021
+ });
18022
+ }
18023
+ function useDisabled(context) {
18024
+ const currentInstance = getCurrentInstance();
18025
+ const componentDisabled = computed(() => currentInstance.props.disabled);
18026
+ const formDisabled = inject("formDisabled", /* @__PURE__ */ Object.create(null));
18027
+ return computed(() => {
18028
+ if (isBoolean(context?.beforeDisabled?.value)) return context.beforeDisabled.value;
18029
+ if (isBoolean(componentDisabled.value)) return componentDisabled.value;
18030
+ if (isBoolean(context?.afterDisabled?.value)) return context.afterDisabled.value;
18031
+ if (isBoolean(formDisabled.disabled?.value)) return formDisabled.disabled.value;
18032
+ return false;
18033
+ });
18034
+ }
18035
+ const _hoisted_1$2 = {
18036
+ class: "qd-crud-table"
18565
18037
  };
18566
- const _hoisted_2 = {
18567
- key: 1,
18568
- class: "qd-crud-list__toolbar"
18038
+ const _hoisted_2$1 = {
18039
+ class: "qd-crud-table__toolbar"
18569
18040
  };
18570
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
18571
- __name: "list",
18041
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
18042
+ ...{
18043
+ name: "QdCrudTable"
18044
+ },
18045
+ __name: "table",
18572
18046
  props: /* @__PURE__ */ mergeDefaults({
18047
+ title: {},
18048
+ permiPrefix: {},
18573
18049
  search: {},
18574
18050
  searchData: {},
18051
+ form: {},
18052
+ detail: {},
18053
+ add: {
18054
+ type: [Boolean, Object]
18055
+ },
18056
+ actions: {},
18057
+ edit: {
18058
+ type: [Boolean, Object]
18059
+ },
18060
+ view: {
18061
+ type: [Boolean, Object]
18062
+ },
18063
+ del: {
18064
+ type: [Boolean, Object]
18065
+ },
18066
+ rowActions: {},
18067
+ rowKey: {},
18068
+ selectType: {},
18069
+ tree: {},
18070
+ beforeDragSort: {
18071
+ type: Function
18072
+ },
18073
+ expandedTreeNodes: {},
18074
+ defaultExpandedTreeNodes: {},
18075
+ treeExpandAndFoldIcon: {},
18076
+ onAbnormalDragSort: {
18077
+ type: Function
18078
+ },
18079
+ onExpandedTreeNodesChange: {
18080
+ type: Function
18081
+ },
18082
+ onTreeExpandChange: {
18083
+ type: Function
18084
+ },
18085
+ asyncLoading: {},
18086
+ columnController: {},
18087
+ columnControllerVisible: {
18088
+ type: Boolean
18089
+ },
18090
+ defaultColumnControllerVisible: {
18091
+ type: Boolean
18092
+ },
18093
+ columns: {},
18094
+ displayColumns: {},
18095
+ defaultDisplayColumns: {},
18096
+ dragSort: {},
18097
+ dragSortOptions: {},
18098
+ editableCellState: {
18099
+ type: Function
18100
+ },
18101
+ editableRowKeys: {},
18102
+ expandIcon: {
18103
+ type: Boolean
18104
+ },
18105
+ expandOnRowClick: {
18106
+ type: Boolean
18107
+ },
18108
+ expandedRow: {},
18109
+ expandedRowKeys: {},
18110
+ defaultExpandedRowKeys: {},
18111
+ filterIcon: {},
18112
+ filterRow: {},
18113
+ filterValue: {},
18114
+ defaultFilterValue: {},
18115
+ hideSortTips: {
18116
+ type: Boolean
18117
+ },
18118
+ indeterminateSelectedRowKeys: {},
18119
+ multipleSort: {
18120
+ type: Boolean
18121
+ },
18122
+ reserveSelectedRowOnPaginate: {
18123
+ type: Boolean
18124
+ },
18125
+ rowSelectionAllowUncheck: {
18126
+ type: Boolean
18127
+ },
18128
+ rowSelectionType: {},
18129
+ selectOnRowClick: {
18130
+ type: Boolean
18131
+ },
18132
+ selectedRowKeys: {},
18133
+ defaultSelectedRowKeys: {},
18134
+ showSortColumnBgColor: {
18135
+ type: Boolean
18136
+ },
18137
+ sort: {},
18138
+ defaultSort: {},
18139
+ sortIcon: {},
18140
+ sortOnRowDraggable: {
18141
+ type: Boolean
18142
+ },
18143
+ onAsyncLoadingClick: {
18144
+ type: Function
18145
+ },
18146
+ onCellClick: {
18147
+ type: Function
18148
+ },
18149
+ onChange: {
18150
+ type: Function
18151
+ },
18152
+ onColumnChange: {
18153
+ type: Function
18154
+ },
18155
+ onColumnControllerVisibleChange: {
18156
+ type: Function
18157
+ },
18158
+ onDataChange: {
18159
+ type: Function
18160
+ },
18161
+ onDisplayColumnsChange: {
18162
+ type: Function
18163
+ },
18164
+ onDragSort: {
18165
+ type: Function
18166
+ },
18167
+ onExpandChange: {
18168
+ type: Function
18169
+ },
18170
+ onFilterChange: {
18171
+ type: Function
18172
+ },
18173
+ onRowEdit: {
18174
+ type: Function
18175
+ },
18176
+ onRowValidate: {
18177
+ type: Function
18178
+ },
18179
+ onSelectChange: {
18180
+ type: Function
18181
+ },
18182
+ onSortChange: {
18183
+ type: Function
18184
+ },
18185
+ onValidate: {
18186
+ type: Function
18187
+ },
18188
+ activeRowKeys: {},
18189
+ defaultActiveRowKeys: {},
18190
+ activeRowType: {},
18191
+ allowResizeColumnWidth: {
18192
+ type: Boolean
18193
+ },
18194
+ attach: {
18195
+ type: [String, Function]
18196
+ },
18197
+ bordered: {
18198
+ type: Boolean
18199
+ },
18200
+ bottomContent: {},
18201
+ cellEmptyContent: {},
18575
18202
  data: {},
18203
+ disableDataPage: {
18204
+ type: Boolean
18205
+ },
18206
+ disableSpaceInactiveRow: {
18207
+ type: Boolean
18208
+ },
18209
+ empty: {},
18210
+ firstFullRow: {},
18211
+ fixedRows: {},
18212
+ footData: {},
18213
+ footerAffixProps: {},
18214
+ footerAffixedBottom: {
18215
+ type: [Boolean, Object]
18216
+ },
18217
+ footerSummary: {},
18218
+ headerAffixProps: {},
18219
+ headerAffixedTop: {
18220
+ type: [Boolean, Object]
18221
+ },
18222
+ height: {},
18223
+ horizontalScrollAffixedBottom: {
18224
+ type: [Boolean, Object]
18225
+ },
18226
+ hover: {
18227
+ type: Boolean
18228
+ },
18229
+ keyboardRowHover: {
18230
+ type: Boolean
18231
+ },
18232
+ lastFullRow: {},
18233
+ lazyLoad: {
18234
+ type: Boolean
18235
+ },
18576
18236
  loading: {
18577
18237
  type: Boolean
18578
18238
  },
18579
- loadingProps: {},
18239
+ loadingProps: {},
18240
+ locale: {},
18241
+ maxHeight: {},
18242
+ paginationAffixedBottom: {
18243
+ type: [Boolean, Object]
18244
+ },
18245
+ resizable: {
18246
+ type: Boolean
18247
+ },
18248
+ rowAttributes: {
18249
+ type: [Object, Function, Array]
18250
+ },
18251
+ rowClassName: {
18252
+ type: [Object, Array, String, Function]
18253
+ },
18254
+ rowspanAndColspan: {
18255
+ type: Function
18256
+ },
18257
+ rowspanAndColspanInFooter: {
18258
+ type: Function
18259
+ },
18580
18260
  scroll: {},
18581
- asyncLoading: {},
18582
- footer: {},
18583
- header: {},
18584
- layout: {},
18585
- size: {},
18586
- split: {
18261
+ showHeader: {
18587
18262
  type: Boolean
18588
18263
  },
18264
+ size: {},
18589
18265
  stripe: {
18590
18266
  type: Boolean
18591
18267
  },
18592
- onBefore: {
18268
+ tableContentWidth: {},
18269
+ tableLayout: {},
18270
+ topContent: {},
18271
+ verticalAlign: {},
18272
+ onActiveChange: {
18593
18273
  type: Function
18594
18274
  },
18595
- onAfter: {
18275
+ onActiveRowAction: {
18596
18276
  type: Function
18597
18277
  },
18598
- onSuccess: {
18278
+ onColumnResizeChange: {
18599
18279
  type: Function
18600
18280
  },
18601
- onError: {
18281
+ onPageChange: {
18602
18282
  type: Function
18603
18283
  },
18604
- service: {
18284
+ onRowClick: {
18605
18285
  type: Function
18606
18286
  },
18607
- manual: {
18608
- type: Boolean
18287
+ onRowDblclick: {
18288
+ type: Function
18609
18289
  },
18610
- transformParams: {
18290
+ onRowMousedown: {
18611
18291
  type: Function
18612
18292
  },
18613
- transformRes: {
18293
+ onRowMouseenter: {
18614
18294
  type: Function
18615
18295
  },
18616
- pagination: {}
18617
- }, qdCrudListProps),
18618
- emits: ["update:searchData", "update:data"],
18619
- setup(__props, {
18620
- expose: __expose,
18621
- emit: __emit
18622
- }) {
18623
- const props = __props;
18624
- const emit = __emit;
18625
- const {
18626
- data,
18627
- searchData
18628
- } = /* @__PURE__ */ useVModels(props, emit, {
18629
- passive: true
18630
- });
18631
- const {
18632
- t
18633
- } = useConfig("crud");
18634
- const reProps = computed(() => {
18635
- const {
18636
- data: data2,
18637
- searchData: inSearchData,
18638
- search,
18639
- transformParams,
18640
- ...serviceListOptions
18641
- } = props;
18642
- const mergedTransformParams = (params) => {
18643
- const merged = {
18644
- ...params,
18645
- ...searchData.value
18646
- };
18647
- if (transformParams) return transformParams(merged);
18648
- return merged;
18649
- };
18650
- return {
18651
- searchOptions: search,
18652
- serviceListOptions: {
18653
- ...serviceListOptions,
18654
- transformParams: mergedTransformParams
18655
- },
18656
- models: {
18657
- data: data2,
18658
- searchData: inSearchData
18659
- }
18660
- };
18661
- });
18662
- const searchRef = useTemplateRef("search");
18663
- const listRef = useTemplateRef("list");
18664
- function handleSearch() {
18665
- }
18666
- function handleResetSearch() {
18667
- searchRef.value?.reset();
18668
- searchRef.value?.submit();
18669
- }
18670
- function triggerSearch({
18671
- validateResult
18672
- }) {
18673
- if (validateResult !== true) return;
18674
- listRef.value?.refresh();
18675
- }
18676
- const expose = {};
18677
- onMounted(() => {
18678
- Object.assign(expose, listRef.value);
18679
- });
18680
- __expose(expose);
18681
- return (_ctx, _cache) => {
18682
- return openBlock(), createElementBlock("div", {
18683
- class: normalizeClass(["qd-crud-list", reProps.value.serviceListOptions.scroll?.target ? "qd-crud-list--has-scroll-target" : ""])
18684
- }, [reProps.value.searchOptions?.items?.length || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_1$1, [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(QdCrudSearch, mergeProps({
18685
- key: 0,
18686
- ref: "search",
18687
- data: unref(searchData),
18688
- "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null)
18689
- }, reProps.value.searchOptions, {
18690
- "on-submit": triggerSearch
18691
- }), {
18692
- footer: withCtx(() => [createVNode(unref(Space), {
18693
- align: "center",
18694
- size: "small"
18695
- }, {
18696
- default: withCtx(() => [createVNode(unref(Button), {
18697
- type: "submit",
18698
- onClick: handleSearch
18699
- }, {
18700
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18701
- _: 1
18702
- }), createVNode(unref(Button), {
18703
- variant: "outline",
18704
- onClick: handleResetSearch
18705
- }, {
18706
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18707
- _: 1
18708
- })]),
18709
- _: 1
18710
- })]),
18711
- _: 1
18712
- }, 16, ["data"])) : createCommentVNode("", true), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Space), {
18713
- align: "center",
18714
- size: "small"
18715
- }, {
18716
- default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, void 0, true)]),
18717
- _: 3
18718
- })])) : createCommentVNode("", true)])) : createCommentVNode("", true), createVNode(unref(QdServiceList), mergeProps({
18719
- ref: "list",
18720
- data: unref(data),
18721
- "onUpdate:data": _cache[1] || (_cache[1] = ($event) => isRef(data) ? data.value = $event : null)
18722
- }, reProps.value.serviceListOptions), createSlots({
18723
- _: 2
18724
- }, [_ctx.$slots.default ? {
18725
- name: "default",
18726
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)), void 0, true)]),
18727
- key: "0"
18728
- } : void 0, renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "list"), (item) => {
18729
- return {
18730
- name: item.filterName,
18731
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
18732
- };
18733
- })]), 1040, ["data"])], 2);
18734
- };
18735
- }
18736
- });
18737
- const list = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c15e270f"]]);
18738
- function defineQdCrudTable(config) {
18739
- return config;
18740
- }
18741
- function defineQdCrudList(config) {
18742
- return config;
18743
- }
18744
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
18745
- ...{
18746
- name: "QdDictSelect"
18747
- },
18748
- __name: "select",
18749
- props: /* @__PURE__ */ mergeDefaults({
18750
- dictType: {},
18751
- defaultSelectFirst: { type: Boolean },
18752
- convStr: { type: [Boolean, String] },
18753
- autoWidth: { type: Boolean },
18754
- autofocus: { type: Boolean },
18755
- borderless: { type: Boolean },
18756
- clearable: { type: Boolean },
18757
- collapsedItems: {},
18758
- creatable: { type: Boolean },
18759
- disabled: { type: Boolean },
18760
- empty: {},
18761
- filter: { type: Function },
18762
- filterable: { type: Boolean },
18763
- inputProps: {},
18764
- inputValue: {},
18765
- defaultInputValue: {},
18766
- keys: {},
18767
- label: {},
18768
- loading: { type: Boolean },
18769
- loadingText: {},
18770
- max: {},
18771
- minCollapsedNum: {},
18772
- multiple: { type: Boolean },
18773
- panelBottomContent: {},
18774
- panelTopContent: {},
18775
- placeholder: {},
18776
- popupProps: {},
18777
- popupVisible: { type: Boolean },
18778
- defaultPopupVisible: { type: Boolean },
18779
- prefixIcon: {},
18780
- readonly: { type: Boolean },
18781
- reserveKeyword: { type: Boolean },
18782
- scroll: {},
18783
- selectInputProps: {},
18784
- showArrow: { type: Boolean },
18785
- size: {},
18786
- status: {},
18787
- suffix: {},
18788
- suffixIcon: {},
18789
- tagInputProps: {},
18790
- tagProps: {},
18791
- tips: {},
18792
- value: {},
18793
- defaultValue: {},
18794
- modelValue: {},
18795
- valueDisplay: {},
18796
- valueType: {},
18797
- onBlur: { type: Function },
18798
- onChange: { type: Function },
18799
- onClear: { type: Function },
18800
- onCreate: { type: Function },
18801
- onEnter: { type: Function },
18802
- onFocus: { type: Function },
18803
- onInputChange: { type: Function },
18804
- onPopupVisibleChange: { type: Function },
18805
- onRemove: { type: Function },
18806
- onSearch: { type: Function }
18807
- }, qdDictSelectProps),
18808
- emits: ["update:modelValue", "update:inputValue", "update:popupVisible"],
18809
- setup(__props, { emit: __emit }) {
18296
+ onRowMouseleave: {
18297
+ type: Function
18298
+ },
18299
+ onRowMouseover: {
18300
+ type: Function
18301
+ },
18302
+ onRowMouseup: {
18303
+ type: Function
18304
+ },
18305
+ onScroll: {
18306
+ type: Function
18307
+ },
18308
+ onScrollX: {
18309
+ type: Function
18310
+ },
18311
+ onScrollY: {
18312
+ type: Function
18313
+ },
18314
+ cacheKey: {
18315
+ type: [String, Function]
18316
+ },
18317
+ cacheTime: {},
18318
+ pollingInterval: {},
18319
+ onBefore: {
18320
+ type: Function
18321
+ },
18322
+ onAfter: {
18323
+ type: Function
18324
+ },
18325
+ onSuccess: {
18326
+ type: Function
18327
+ },
18328
+ onError: {
18329
+ type: Function
18330
+ },
18331
+ service: {
18332
+ type: Function
18333
+ },
18334
+ manual: {
18335
+ type: Boolean
18336
+ },
18337
+ transformParams: {
18338
+ type: Function
18339
+ },
18340
+ transformRes: {
18341
+ type: Function
18342
+ },
18343
+ pagination: {}
18344
+ }, qdCrudTableProps),
18345
+ emits: ["update:searchData", "update:data", "update:selectedRowKeys", "update:activeRowKeys", "update:columnControllerVisible", "update:displayColumns", "update:expandedRowKeys", "update:filterValue", "update:sort", "update:expandedTreeNodes"],
18346
+ setup(__props, {
18347
+ expose: __expose,
18348
+ emit: __emit
18349
+ }) {
18350
+ const vHasPermi = hasPermiDirective;
18810
18351
  const props = __props;
18811
18352
  const emit = __emit;
18812
- const { modelValue, inputValue, popupVisible } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
18813
- const reModelValue = computed({
18814
- get: () => {
18815
- const { convStr, selectOptions } = reProps.value;
18816
- const { multiple, valueType } = selectOptions;
18817
- if (!multiple || valueType === "object") return modelValue.value;
18818
- if (isEmpty(modelValue.value)) return [];
18819
- if (typeof modelValue.value === "string") {
18820
- return modelValue.value.split(
18821
- (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
18822
- );
18823
- }
18824
- return modelValue.value;
18825
- },
18826
- set: (val) => {
18827
- const { convStr, selectOptions } = reProps.value;
18828
- const { multiple, valueType } = selectOptions;
18829
- if (!multiple || valueType === "object") {
18830
- modelValue.value = val;
18831
- return;
18832
- }
18833
- if (convStr && Array.isArray(val)) {
18834
- modelValue.value = val.join(
18835
- (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
18836
- );
18837
- } else {
18838
- modelValue.value = val;
18839
- }
18840
- }
18353
+ const {
18354
+ searchData,
18355
+ data,
18356
+ selectedRowKeys,
18357
+ activeRowKeys,
18358
+ columnControllerVisible,
18359
+ displayColumns,
18360
+ expandedRowKeys,
18361
+ filterValue,
18362
+ sort,
18363
+ expandedTreeNodes
18364
+ } = /* @__PURE__ */ useVModels(props, emit, {
18365
+ passive: true
18841
18366
  });
18842
- const dictType = toRef(props, "dictType");
18367
+ const {
18368
+ t
18369
+ } = useConfig("crud");
18370
+ const {
18371
+ msgError,
18372
+ msgSuccess,
18373
+ alertWarning,
18374
+ confirm
18375
+ } = useModal();
18376
+ const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
18377
+ const dialogFormMap = reactive({});
18843
18378
  const reProps = computed(() => {
18844
18379
  const {
18845
- convStr,
18846
- modelValue: modelValue2,
18847
- inputValue: inputValue2,
18848
- popupVisible: popupVisible2,
18849
- dictType: dictType2,
18850
- loading,
18851
- defaultSelectFirst,
18852
- ...selectOptions
18380
+ data: data2,
18381
+ searchData: inSearchData,
18382
+ selectedRowKeys: selectedRowKeys2,
18383
+ activeRowKeys: activeRowKeys2,
18384
+ columnControllerVisible: columnControllerVisible2,
18385
+ displayColumns: displayColumns2,
18386
+ expandedRowKeys: expandedRowKeys2,
18387
+ filterValue: filterValue2,
18388
+ sort: sort2,
18389
+ expandedTreeNodes: expandedTreeNodes2,
18390
+ transformParams,
18391
+ search,
18392
+ form,
18393
+ detail,
18394
+ add,
18395
+ actions,
18396
+ edit,
18397
+ view,
18398
+ del,
18399
+ rowActions,
18400
+ title,
18401
+ columns,
18402
+ selectType,
18403
+ ...serviceTableOptions
18853
18404
  } = props;
18854
- return {
18855
- convStr,
18856
- dictType: dictType2,
18857
- loading,
18858
- defaultSelectFirst,
18859
- selectOptions,
18860
- models: {
18861
- modelValue: modelValue2,
18862
- inputValue: inputValue2,
18863
- popupVisible: popupVisible2
18864
- }
18865
- };
18866
- });
18867
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType, {
18868
- onInit: (options) => {
18869
- if (reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && options.length) {
18870
- reModelValue.value = options[0]?.value;
18871
- }
18872
- }
18873
- });
18874
- return (_ctx, _cache) => {
18875
- return openBlock(), createBlock(unref(Select), mergeProps({
18876
- modelValue: reModelValue.value,
18877
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
18878
- "input-value": unref(inputValue),
18879
- "onUpdate:inputValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
18880
- "popup-visible": unref(popupVisible),
18881
- "onUpdate:popupVisible": _cache[2] || (_cache[2] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : null)
18882
- }, reProps.value.selectOptions, {
18883
- options: unref(dictOptions),
18884
- loading: unref(dictLoading) || reProps.value.loading
18885
- }), createSlots({ _: 2 }, [
18886
- renderList(_ctx.$slots, (_, name) => {
18887
- return {
18888
- name,
18889
- fn: withCtx((slotProps) => [
18890
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
18891
- ])
18892
- };
18893
- })
18894
- ]), 1040, ["modelValue", "input-value", "popup-visible", "options", "loading"]);
18895
- };
18896
- }
18897
- });
18898
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
18899
- ...{
18900
- name: "QdDictRadioGroup"
18901
- },
18902
- __name: "radio-group",
18903
- props: /* @__PURE__ */ mergeDefaults({
18904
- dictType: {},
18905
- allowUncheck: { type: Boolean },
18906
- disabled: { type: Boolean },
18907
- name: {},
18908
- readonly: { type: Boolean },
18909
- size: {},
18910
- theme: {},
18911
- value: {},
18912
- defaultValue: {},
18913
- modelValue: {},
18914
- variant: {},
18915
- onChange: { type: Function }
18916
- }, qdDictRadioGroupProps),
18917
- emits: ["update:modelValue"],
18918
- setup(__props, { emit: __emit }) {
18919
- const vLoading = LoadingDirective;
18920
- const props = __props;
18921
- const emit = __emit;
18922
- const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
18923
- const dictType = toRef(props, "dictType");
18924
- const reProps = computed(() => {
18925
- const { modelValue: modelValue2, dictType: dictType2, ...radioOptions } = props;
18926
- return {
18927
- dictType: dictType2,
18928
- radioOptions,
18929
- models: {
18930
- modelValue: modelValue2
18931
- }
18405
+ const mergedTransformParams = (params) => {
18406
+ const merged = {
18407
+ ...params,
18408
+ ...searchData.value
18409
+ };
18410
+ if (transformParams) return transformParams(merged);
18411
+ return merged;
18932
18412
  };
18933
- });
18934
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
18935
- return (_ctx, _cache) => {
18936
- return withDirectives((openBlock(), createBlock(unref(RadioGroup), mergeProps({
18937
- modelValue: unref(modelValue),
18938
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
18939
- class: "qd-dict-radio-group"
18940
- }, reProps.value.radioOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
18941
- [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
18942
- ]);
18943
- };
18944
- }
18945
- });
18946
- const radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e97fb1f0"]]);
18947
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18948
- ...{
18949
- name: "QdDictCheckboxGroup"
18950
- },
18951
- __name: "checkbox-group",
18952
- props: /* @__PURE__ */ mergeDefaults({
18953
- dictType: {},
18954
- convStr: { type: [Boolean, String] },
18955
- modelValue: {},
18956
- disabled: { type: Boolean },
18957
- lazyLoad: { type: Boolean },
18958
- max: {},
18959
- name: {},
18960
- readonly: { type: Boolean },
18961
- value: {},
18962
- defaultValue: {},
18963
- onChange: { type: Function }
18964
- }, qdDictCheckboxGroupProps),
18965
- emits: ["update:modelValue"],
18966
- setup(__props, { emit: __emit }) {
18967
- const vLoading = LoadingDirective;
18968
- const props = __props;
18969
- const emit = __emit;
18970
- const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
18971
- const reModelValue = computed({
18972
- get: () => {
18973
- if (isEmpty(modelValue.value)) return [];
18974
- if (typeof modelValue.value === "string") {
18975
- const { convStr } = reProps.value;
18976
- return modelValue.value.split((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
18977
- }
18978
- return modelValue.value;
18979
- },
18980
- set: (val) => {
18981
- const { convStr } = reProps.value;
18982
- if (convStr) {
18983
- modelValue.value = val.join((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
18413
+ const reAdd = mergeAction({
18414
+ crudMode: "add",
18415
+ permiID: "add",
18416
+ content: t("addText"),
18417
+ icon: () => createVNode(AddIcon, null, null)
18418
+ }, add, form);
18419
+ const reActions = [reAdd, ...buildActions(actions, form)].filter(Boolean);
18420
+ const reEdit = mergeAction({
18421
+ crudMode: "edit",
18422
+ permiID: "edit",
18423
+ content: t("editText"),
18424
+ theme: "primary",
18425
+ hover: "color"
18426
+ }, edit, form);
18427
+ const reView = mergeAction({
18428
+ crudMode: "view",
18429
+ permiID: "query",
18430
+ content: t("viewText"),
18431
+ theme: "primary",
18432
+ hover: "color"
18433
+ }, view, form);
18434
+ const reDel = mergeAction({
18435
+ crudMode: "del",
18436
+ permiID: "remove",
18437
+ content: t("deleteText"),
18438
+ theme: "danger",
18439
+ hover: "color",
18440
+ selectType: "multiple"
18441
+ }, del, form);
18442
+ const reRowActions = [reEdit, reView, reDel, ...buildActions(rowActions, form)].filter(Boolean);
18443
+ let reSelectType = selectType;
18444
+ if (reDel?.selectType === "multiple") {
18445
+ if (!reSelectType) reSelectType = "multiple";
18446
+ const batchDel = mergeAction({
18447
+ crudMode: "del",
18448
+ permiID: "remove",
18449
+ content: t("deleteText"),
18450
+ theme: "danger",
18451
+ variant: "outline",
18452
+ selectType: "multiple"
18453
+ }, del, form);
18454
+ reActions.splice(reAdd ? 1 : 0, 0, batchDel);
18455
+ }
18456
+ const reColumns = columns || [];
18457
+ const operationLength = reRowActions.length;
18458
+ if (operationLength) {
18459
+ const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
18460
+ const defaultOperation = {
18461
+ title: t("operationText"),
18462
+ colKey: "operation",
18463
+ align: "center",
18464
+ fixed: "right",
18465
+ width: 28 * operationLength + 25 * operationLength - 1 + 32
18466
+ };
18467
+ if (operationIdx > -1) {
18468
+ reColumns[operationIdx] = {
18469
+ ...defaultOperation,
18470
+ ...reColumns[operationIdx]
18471
+ };
18984
18472
  } else {
18985
- modelValue.value = val;
18473
+ reColumns.push(defaultOperation);
18986
18474
  }
18987
18475
  }
18988
- });
18989
- const dictType = toRef(props, "dictType");
18990
- const reProps = computed(() => {
18991
- const { modelValue: modelValue2, dictType: dictType2, convStr, ...checkboxOptions } = props;
18992
18476
  return {
18993
- dictType: dictType2,
18994
- convStr,
18995
- checkboxOptions,
18477
+ title,
18478
+ searchOptions: search,
18479
+ serviceTableOptions: {
18480
+ ...serviceTableOptions,
18481
+ selectType: reSelectType,
18482
+ columns: reColumns,
18483
+ transformParams: mergedTransformParams
18484
+ },
18485
+ formOptions: form,
18486
+ detailOptions: detail,
18487
+ actions: reActions,
18488
+ rowActions: reRowActions,
18996
18489
  models: {
18997
- modelValue: modelValue2
18998
- }
18999
- };
19000
- });
19001
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19002
- return (_ctx, _cache) => {
19003
- return withDirectives((openBlock(), createBlock(unref(CheckboxGroup), mergeProps({
19004
- modelValue: reModelValue.value,
19005
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19006
- class: "qd-dict-checkbox-group"
19007
- }, reProps.value.checkboxOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19008
- [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19009
- ]);
19010
- };
19011
- }
19012
- });
19013
- const checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ef427474"]]);
19014
- const _hoisted_1 = { class: "qd-dict-tag" };
19015
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
19016
- ...{
19017
- name: "QdDictTag"
19018
- },
19019
- __name: "tag",
19020
- props: /* @__PURE__ */ mergeDefaults({
19021
- value: {},
19022
- strict: { type: Boolean },
19023
- separator: {},
19024
- options: {},
19025
- dictType: {},
19026
- size: {},
19027
- shape: {},
19028
- theme: {},
19029
- variant: {}
19030
- }, qdDictTagProps),
19031
- setup(__props) {
19032
- const props = __props;
19033
- const dictType = toRef(props, "dictType");
19034
- const reProps = computed(() => {
19035
- const { options, ...otherOptions } = props;
19036
- return {
19037
- ...otherOptions,
19038
- options: options || dictOptions.value || []
19039
- };
19040
- });
19041
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19042
- const reValue = computed(() => {
19043
- const { value, strict } = reProps.value;
19044
- if (isEmpty(value)) return [];
19045
- if (Array.isArray(value)) return value.map((item) => strict ? item : item.toString());
19046
- if (isNumber(value)) {
19047
- return strict ? [value] : [value.toString()];
19048
- }
19049
- return String(value).split(",");
19050
- });
19051
- const matchOptions = computed(() => {
19052
- const { options, strict } = reProps.value;
19053
- return options.filter((option) => {
19054
- return reValue.value.includes(strict ? option.value : option.value.toString());
19055
- });
19056
- });
19057
- return (_ctx, _cache) => {
19058
- const _directive_loading = resolveDirective("loading");
19059
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
19060
- (openBlock(true), createElementBlock(Fragment, null, renderList(matchOptions.value, (item, index2) => {
19061
- return openBlock(), createElementBlock(Fragment, null, [
19062
- (!reProps.value.theme || reProps.value.theme === "text") && !__props.variant && (item.theme === "text" || !item.theme) ? (openBlock(), createElementBlock("span", {
19063
- key: item.value,
19064
- class: normalizeClass(item.class)
19065
- }, [
19066
- renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19067
- renderSlot(_ctx.$slots, "default", { item }, () => [
19068
- createTextVNode(toDisplayString(item.label), 1)
19069
- ], true),
19070
- renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19071
- ], 2)) : (openBlock(), createBlock(unref(Tag), {
19072
- key: item.value + "",
19073
- index: index2,
19074
- size: reProps.value.size,
19075
- shape: reProps.value.shape,
19076
- theme: reProps.value.theme || item.theme || "default",
19077
- variant: reProps.value.variant || item.variant || "light",
19078
- class: normalizeClass(item.class)
19079
- }, {
19080
- default: withCtx(() => [
19081
- renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19082
- renderSlot(_ctx.$slots, "default", { item }, () => [
19083
- createTextVNode(toDisplayString(item.label), 1)
19084
- ], true),
19085
- renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19086
- ]),
19087
- _: 2
19088
- }, 1032, ["index", "size", "shape", "theme", "variant", "class"])),
19089
- (_ctx.$slots.separator || __props.separator) && matchOptions.value.length - 1 !== index2 ? renderSlot(_ctx.$slots, "separator", { key: 2 }, () => [
19090
- createTextVNode(toDisplayString(__props.separator), 1)
19091
- ], true) : createCommentVNode("", true)
19092
- ], 64);
19093
- }), 256))
19094
- ])), [
19095
- [_directive_loading, { loading: unref(dictLoading), size: "small" }]
19096
- ]);
19097
- };
19098
- }
19099
- });
19100
- const tag = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cab615cf"]]);
19101
- const qdUploadProps = {
19102
- modelValue: () => [],
19103
- files: () => [],
19104
- convStr: false,
19105
- valueMode: "ossId",
19106
- theme: "file",
19107
- draggable: void 0,
19108
- autoUpload: false,
19109
- allowUploadDuplicateFile: true,
19110
- isBatchUpload: false,
19111
- uploadAllFilesInOneRequest: false,
19112
- method: "POST",
19113
- multiple: void 0,
19114
- name: "file",
19115
- disabled: void 0,
19116
- showImageFileName: true,
19117
- showThumbnail: true,
19118
- showUploadProgress: true,
19119
- uploadPastedFiles: true,
19120
- useMockProgress: true,
19121
- withCredentials: false,
19122
- del: void 0
19123
- };
19124
- const qdUploadSizeLimit = {
19125
- unit: "MB"
19126
- };
19127
- function getDefaultExportFromCjs(x) {
19128
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
19129
- }
19130
- var dayjs_min$1 = { exports: {} };
19131
- var dayjs_min = dayjs_min$1.exports;
19132
- var hasRequiredDayjs_min;
19133
- function requireDayjs_min() {
19134
- if (hasRequiredDayjs_min) return dayjs_min$1.exports;
19135
- hasRequiredDayjs_min = 1;
19136
- (function(module2, exports2) {
19137
- !(function(t, e) {
19138
- module2.exports = e();
19139
- })(dayjs_min, (function() {
19140
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h2 = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
19141
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
19142
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
19143
- } }, m = function(t2, e2, n2) {
19144
- var r2 = String(t2);
19145
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
19146
- }, v = { s: m, z: function(t2) {
19147
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
19148
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
19149
- }, m: function t2(e2, n2) {
19150
- if (e2.date() < n2.date()) return -t2(n2, e2);
19151
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
19152
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
19153
- }, a: function(t2) {
19154
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
19155
- }, p: function(t2) {
19156
- return { M: c, y: h2, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
19157
- }, u: function(t2) {
19158
- return void 0 === t2;
19159
- } }, g = "en", D = {};
19160
- D[g] = M;
19161
- var p = "$isDayjsObject", S = function(t2) {
19162
- return t2 instanceof _ || !(!t2 || !t2[p]);
19163
- }, w = function t2(e2, n2, r2) {
19164
- var i2;
19165
- if (!e2) return g;
19166
- if ("string" == typeof e2) {
19167
- var s2 = e2.toLowerCase();
19168
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
19169
- var u2 = e2.split("-");
19170
- if (!i2 && u2.length > 1) return t2(u2[0]);
19171
- } else {
19172
- var a2 = e2.name;
19173
- D[a2] = e2, i2 = a2;
18490
+ data: data2,
18491
+ searchData: inSearchData,
18492
+ selectedRowKeys: selectedRowKeys2,
18493
+ activeRowKeys: activeRowKeys2,
18494
+ columnControllerVisible: columnControllerVisible2,
18495
+ displayColumns: displayColumns2,
18496
+ expandedRowKeys: expandedRowKeys2,
18497
+ filterValue: filterValue2,
18498
+ sort: sort2,
18499
+ expandedTreeNodes: expandedTreeNodes2
19174
18500
  }
19175
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
19176
- }, O = function(t2, e2) {
19177
- if (S(t2)) return t2.clone();
19178
- var n2 = "object" == typeof e2 ? e2 : {};
19179
- return n2.date = t2, n2.args = arguments, new _(n2);
19180
- }, b = v;
19181
- b.l = w, b.i = S, b.w = function(t2, e2) {
19182
- return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
19183
18501
  };
19184
- var _ = (function() {
19185
- function M2(t2) {
19186
- this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
19187
- }
19188
- var m2 = M2.prototype;
19189
- return m2.parse = function(t2) {
19190
- this.$d = (function(t3) {
19191
- var e2 = t3.date, n2 = t3.utc;
19192
- if (null === e2) return /* @__PURE__ */ new Date(NaN);
19193
- if (b.u(e2)) return /* @__PURE__ */ new Date();
19194
- if (e2 instanceof Date) return new Date(e2);
19195
- if ("string" == typeof e2 && !/Z$/i.test(e2)) {
19196
- var r2 = e2.match($);
19197
- if (r2) {
19198
- var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
19199
- return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
19200
- }
18502
+ });
18503
+ const tableRef = useTemplateRef("table");
18504
+ const searchVisible = ref(true);
18505
+ const searchRef = useTemplateRef("search");
18506
+ let searchMode = "refresh";
18507
+ function handleSearch() {
18508
+ searchMode = "changeCurrent";
18509
+ }
18510
+ function handleResetSearch() {
18511
+ searchMode = "changeCurrent";
18512
+ searchRef.value?.reset();
18513
+ searchRef.value?.submit();
18514
+ }
18515
+ function triggerSearch({
18516
+ validateResult
18517
+ }) {
18518
+ if (validateResult !== true) return;
18519
+ switch (searchMode) {
18520
+ case "changeCurrent":
18521
+ tableRef.value?.changeCurrent(1);
18522
+ break;
18523
+ default:
18524
+ tableRef.value?.refresh();
18525
+ break;
18526
+ }
18527
+ }
18528
+ function handleRefresh() {
18529
+ searchMode = "refresh";
18530
+ handleSearch();
18531
+ }
18532
+ function toggleSearchVisible() {
18533
+ searchVisible.value = !searchVisible.value;
18534
+ }
18535
+ function toggleTreeExpandAll() {
18536
+ if (treeIsExpand.value) tableRef.value?.foldAll();
18537
+ else tableRef.value?.expandAll();
18538
+ }
18539
+ function openColumnController() {
18540
+ columnControllerVisible.value = true;
18541
+ }
18542
+ function buildActions(actions, crudForm) {
18543
+ if (!actions) return [];
18544
+ return actions.map((item) => mergeAction({
18545
+ variant: "outline",
18546
+ theme: "primary",
18547
+ hover: "color"
18548
+ }, item, crudForm));
18549
+ }
18550
+ function mergeAction(defaultOptions, currentOptions, crudForm) {
18551
+ if (currentOptions === false || !currentOptions) return;
18552
+ const mergeOptions = merge(defaultOptions, currentOptions);
18553
+ mergeOptions.permi = buildActionPermi(mergeOptions);
18554
+ if (mergeOptions.crudMode !== "del") {
18555
+ mergeOptions.form = buildActionForm(mergeOptions, crudForm);
18556
+ }
18557
+ return mergeOptions;
18558
+ }
18559
+ function getConfigRendererCtx(self2, other) {
18560
+ return {
18561
+ tableData: data.value,
18562
+ searchData: searchData.value,
18563
+ selectedRowKeys: selectedRowKeys.value,
18564
+ activeRowKeys: activeRowKeys.value,
18565
+ self: self2,
18566
+ ...other
18567
+ };
18568
+ }
18569
+ function actionIsCRU(crudMode) {
18570
+ return crudMode && ["add", "edit", "view"].includes(crudMode);
18571
+ }
18572
+ function buildActionPermi(action) {
18573
+ if (action.permi) return action.permi;
18574
+ if (!props.permiPrefix || !action.permiID) return [];
18575
+ return [`${props.permiPrefix}.${action.permiID}`];
18576
+ }
18577
+ function buildActionForm(action, crudForm) {
18578
+ const IsCRU = actionIsCRU(action.crudMode);
18579
+ if (!action.form && IsCRU) {
18580
+ action.form = cloneDeep(crudForm);
18581
+ }
18582
+ const {
18583
+ form
18584
+ } = action;
18585
+ if (form) {
18586
+ if (action.crudMode === "view") form.readonly = true;
18587
+ if (!form.onSubmit && IsCRU) {
18588
+ form.onSubmit = async (context) => {
18589
+ const {
18590
+ uid,
18591
+ service,
18592
+ transformParams,
18593
+ transformRes,
18594
+ crudMode
18595
+ } = action;
18596
+ if (context.validateResult !== true || !service || !uid || !dialogFormMap[uid]) return false;
18597
+ let currentParams = easyCopy(context.formData);
18598
+ if (transformParams) {
18599
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
18600
+ if (tpErr) throw tpErr;
18601
+ currentParams = tpRes;
19201
18602
  }
19202
- return new Date(e2);
19203
- })(t2), this.init();
19204
- }, m2.init = function() {
19205
- var t2 = this.$d;
19206
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
19207
- }, m2.$utils = function() {
19208
- return b;
19209
- }, m2.isValid = function() {
19210
- return !(this.$d.toString() === l);
19211
- }, m2.isSame = function(t2, e2) {
19212
- var n2 = O(t2);
19213
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
19214
- }, m2.isAfter = function(t2, e2) {
19215
- return O(t2) < this.startOf(e2);
19216
- }, m2.isBefore = function(t2, e2) {
19217
- return this.endOf(e2) < O(t2);
19218
- }, m2.$g = function(t2, e2, n2) {
19219
- return b.u(t2) ? this[e2] : this.set(n2, t2);
19220
- }, m2.unix = function() {
19221
- return Math.floor(this.valueOf() / 1e3);
19222
- }, m2.valueOf = function() {
19223
- return this.$d.getTime();
19224
- }, m2.startOf = function(t2, e2) {
19225
- var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
19226
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
19227
- return r2 ? i2 : i2.endOf(a);
19228
- }, $2 = function(t3, e3) {
19229
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
19230
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
19231
- switch (f2) {
19232
- case h2:
19233
- return r2 ? l2(1, 0) : l2(31, 11);
19234
- case c:
19235
- return r2 ? l2(1, M3) : l2(0, M3 + 1);
19236
- case o:
19237
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
19238
- return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
19239
- case a:
19240
- case d:
19241
- return $2(v2 + "Hours", 0);
19242
- case u:
19243
- return $2(v2 + "Minutes", 1);
19244
- case s:
19245
- return $2(v2 + "Seconds", 2);
19246
- case i:
19247
- return $2(v2 + "Milliseconds", 3);
19248
- default:
19249
- return this.clone();
18603
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18604
+ if (serviceErr) throw serviceErr;
18605
+ let res;
18606
+ if (transformRes) {
18607
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18608
+ if (trErr) throw trErr;
18609
+ res = trRes;
18610
+ } else {
18611
+ res = serviceRes;
18612
+ }
18613
+ if (typeof res === "boolean") {
18614
+ res = {
18615
+ success: res,
18616
+ message: ""
18617
+ };
18618
+ }
18619
+ if (!res) {
18620
+ res = {
18621
+ success: true,
18622
+ message: ""
18623
+ };
18624
+ }
18625
+ const message = res.message;
18626
+ if (res.success === false) {
18627
+ if (message) msgError(message);
18628
+ return false;
18629
+ }
18630
+ msgSuccess(message || t("operationSuccessText"));
18631
+ if (crudMode === "add") {
18632
+ tableRef.value?.changeCurrent(1);
18633
+ } else {
18634
+ tableRef.value?.refresh();
18635
+ }
18636
+ };
18637
+ }
18638
+ const {
18639
+ title
18640
+ } = props;
18641
+ form.wrapper = merge({}, {
18642
+ header: `${action.content}${title ? ` ${title}` : ""}`
18643
+ }, form.wrapper);
18644
+ }
18645
+ return action.form;
18646
+ }
18647
+ function buildActionOnClick(action, originalParams) {
18648
+ if (action.onClick) return action.onClick;
18649
+ if (action.crudMode === "del") {
18650
+ const onClick2 = async () => {
18651
+ const {
18652
+ service,
18653
+ transformParams,
18654
+ transformRes
18655
+ } = action;
18656
+ const row = originalParams?.row;
18657
+ if (!service || !row && action.selectType !== "multiple" || !row && !selectedRowKeys.value.length && action.selectType === "multiple") {
18658
+ return;
18659
+ }
18660
+ const childrenKey = reProps.value.serviceTableOptions.tree?.childrenKey || qdServiceTableTreeConfig.childrenKey;
18661
+ let delHasChild = false;
18662
+ if (!row) {
18663
+ const rowKey = reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey;
18664
+ delHasChild = selectedRowKeys.value.some((item) => {
18665
+ const data2 = tableRef.value?.getData(item);
18666
+ if (!data2) return false;
18667
+ const children = data2.row[childrenKey];
18668
+ if (isEmpty(children)) return false;
18669
+ if (children === true) return true;
18670
+ return children.some((child) => !selectedRowKeys.value.includes(child[rowKey]));
18671
+ });
18672
+ } else if (!isEmpty(row[childrenKey])) {
18673
+ delHasChild = true;
18674
+ }
18675
+ if (delHasChild) {
18676
+ alertWarning(t("deleteHasChildrenText"));
18677
+ return;
19250
18678
  }
19251
- }, m2.endOf = function(t2) {
19252
- return this.startOf(t2, false);
19253
- }, m2.$set = function(t2, e2) {
19254
- var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h2] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
19255
- if (o2 === c || o2 === h2) {
19256
- var y2 = this.clone().set(d, 1);
19257
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
19258
- } else l2 && this.$d[l2]($2);
19259
- return this.init(), this;
19260
- }, m2.set = function(t2, e2) {
19261
- return this.clone().$set(t2, e2);
19262
- }, m2.get = function(t2) {
19263
- return this[b.p(t2)]();
19264
- }, m2.add = function(r2, f2) {
19265
- var d2, l2 = this;
19266
- r2 = Number(r2);
19267
- var $2 = b.p(f2), y2 = function(t2) {
19268
- var e2 = O(l2);
19269
- return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
19270
- };
19271
- if ($2 === c) return this.set(c, this.$M + r2);
19272
- if ($2 === h2) return this.set(h2, this.$y + r2);
19273
- if ($2 === a) return y2(1);
19274
- if ($2 === o) return y2(7);
19275
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
19276
- return b.w(m3, this);
19277
- }, m2.subtract = function(t2, e2) {
19278
- return this.add(-1 * t2, e2);
19279
- }, m2.format = function(t2) {
19280
- var e2 = this, n2 = this.$locale();
19281
- if (!this.isValid()) return n2.invalidDate || l;
19282
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h3 = function(t3, n3, i3, s3) {
19283
- return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
19284
- }, d2 = function(t3) {
19285
- return b.s(s2 % 12 || 12, t3, "0");
19286
- }, $2 = f2 || function(t3, e3, n3) {
19287
- var r3 = t3 < 12 ? "AM" : "PM";
19288
- return n3 ? r3.toLowerCase() : r3;
18679
+ confirm({
18680
+ body: t("deleteWrapperBodyText"),
18681
+ ...action.wrapper
18682
+ }, async () => {
18683
+ const params = row || selectedRowKeys.value;
18684
+ let currentParams = row ? params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey] : selectedRowKeys.value;
18685
+ if (transformParams) {
18686
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18687
+ if (tpErr) throw tpErr;
18688
+ currentParams = tpRes;
18689
+ }
18690
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18691
+ if (serviceErr) throw serviceErr;
18692
+ let res;
18693
+ if (transformRes) {
18694
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18695
+ if (trErr) throw trErr;
18696
+ res = trRes;
18697
+ } else {
18698
+ res = serviceRes;
18699
+ }
18700
+ if (typeof res === "boolean") {
18701
+ res = {
18702
+ success: res,
18703
+ message: ""
18704
+ };
18705
+ }
18706
+ if (!res) {
18707
+ res = {
18708
+ success: true,
18709
+ message: ""
18710
+ };
18711
+ }
18712
+ const message = res.message;
18713
+ if (res.success === false) {
18714
+ if (message) msgError(message);
18715
+ return false;
18716
+ }
18717
+ msgSuccess(message || t("deleteSuccessText"));
18718
+ if (!row) selectedRowKeys.value = [];
18719
+ tableRef.value?.refresh();
18720
+ return true;
18721
+ });
18722
+ };
18723
+ return onClick2;
18724
+ }
18725
+ if (isEmpty(action.form) || !actionIsCRU(action.crudMode)) return;
18726
+ const onClick = async () => {
18727
+ if (!action.uid) action.uid = generateRandomString(16);
18728
+ const uid = action.uid;
18729
+ const form = shallowRef(action.form);
18730
+ if (!dialogFormMap[uid]) {
18731
+ dialogFormMap[uid] = {
18732
+ visible: false,
18733
+ data: {},
18734
+ crudMode: action.crudMode,
18735
+ form
19289
18736
  };
19290
- return r2.replace(y, (function(t3, r3) {
19291
- return r3 || (function(t4) {
19292
- switch (t4) {
19293
- case "YY":
19294
- return String(e2.$y).slice(-2);
19295
- case "YYYY":
19296
- return b.s(e2.$y, 4, "0");
19297
- case "M":
19298
- return a2 + 1;
19299
- case "MM":
19300
- return b.s(a2 + 1, 2, "0");
19301
- case "MMM":
19302
- return h3(n2.monthsShort, a2, c2, 3);
19303
- case "MMMM":
19304
- return h3(c2, a2);
19305
- case "D":
19306
- return e2.$D;
19307
- case "DD":
19308
- return b.s(e2.$D, 2, "0");
19309
- case "d":
19310
- return String(e2.$W);
19311
- case "dd":
19312
- return h3(n2.weekdaysMin, e2.$W, o2, 2);
19313
- case "ddd":
19314
- return h3(n2.weekdaysShort, e2.$W, o2, 3);
19315
- case "dddd":
19316
- return o2[e2.$W];
19317
- case "H":
19318
- return String(s2);
19319
- case "HH":
19320
- return b.s(s2, 2, "0");
19321
- case "h":
19322
- return d2(1);
19323
- case "hh":
19324
- return d2(2);
19325
- case "a":
19326
- return $2(s2, u2, true);
19327
- case "A":
19328
- return $2(s2, u2, false);
19329
- case "m":
19330
- return String(u2);
19331
- case "mm":
19332
- return b.s(u2, 2, "0");
19333
- case "s":
19334
- return String(e2.$s);
19335
- case "ss":
19336
- return b.s(e2.$s, 2, "0");
19337
- case "SSS":
19338
- return b.s(e2.$ms, 3, "0");
19339
- case "Z":
19340
- return i2;
18737
+ }
18738
+ await nextTick();
18739
+ dialogFormMap[uid].visible = true;
18740
+ if (!action.crudMode || !["edit", "view"].includes(action.crudMode) || !originalParams) {
18741
+ return;
18742
+ }
18743
+ form.value.loading = true;
18744
+ triggerRef(form);
18745
+ const [err, res] = await to(getDetail(originalParams.row));
18746
+ form.value.loading = false;
18747
+ triggerRef(form);
18748
+ if (err) {
18749
+ dialogFormMap[uid].data = originalParams.row;
18750
+ return;
18751
+ }
18752
+ dialogFormMap[uid].data = res;
18753
+ };
18754
+ return onClick;
18755
+ }
18756
+ function buildActionDisabled(action) {
18757
+ if (action.disabled) return action.disabled;
18758
+ switch (action.selectType) {
18759
+ case "single":
18760
+ return selectedRowKeys.value.length !== 1;
18761
+ case "multiple":
18762
+ return selectedRowKeys.value.length === 0;
18763
+ default:
18764
+ return false;
18765
+ }
18766
+ }
18767
+ async function getDetail(params) {
18768
+ const {
18769
+ detailOptions
18770
+ } = reProps.value;
18771
+ if (!detailOptions) return easyCopy(params);
18772
+ const {
18773
+ service,
18774
+ transformParams,
18775
+ transformRes
18776
+ } = detailOptions;
18777
+ if (!service) return easyCopy(params);
18778
+ let currentParams = params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey];
18779
+ if (transformParams) {
18780
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18781
+ if (tpErr) throw tpErr;
18782
+ currentParams = tpRes;
18783
+ }
18784
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18785
+ if (serviceErr) throw serviceErr;
18786
+ let res;
18787
+ if (transformRes) {
18788
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18789
+ if (trErr) throw trErr;
18790
+ res = trRes;
18791
+ } else {
18792
+ res = serviceRes;
18793
+ }
18794
+ return res;
18795
+ }
18796
+ const expose = {};
18797
+ onMounted(() => {
18798
+ Object.assign(expose, tableRef.value);
18799
+ });
18800
+ __expose(expose);
18801
+ return (_ctx, _cache) => {
18802
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [reProps.value.searchOptions?.items?.length ? withDirectives((openBlock(), createBlock(QdCrudSearch, mergeProps({
18803
+ key: 0,
18804
+ ref: "search",
18805
+ data: unref(searchData),
18806
+ "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null),
18807
+ class: [!searchVisible.value ? "qd-crud-search--hide" : ""]
18808
+ }, reProps.value.searchOptions, {
18809
+ "on-submit": triggerSearch
18810
+ }), {
18811
+ footer: withCtx(() => [createVNode(unref(Space), {
18812
+ align: "center",
18813
+ size: "small"
18814
+ }, {
18815
+ default: withCtx(() => [createVNode(unref(Button), {
18816
+ type: "submit",
18817
+ onClick: handleSearch
18818
+ }, {
18819
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18820
+ _: 1
18821
+ }), createVNode(unref(Button), {
18822
+ variant: "outline",
18823
+ onClick: handleResetSearch
18824
+ }, {
18825
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18826
+ _: 1
18827
+ })]),
18828
+ _: 1
18829
+ })]),
18830
+ _: 1
18831
+ }, 16, ["data", "class"])), [[vShow, searchVisible.value]]) : createCommentVNode("", true), createVNode(unref(_sfc_main$i), {
18832
+ class: "qd-crud-table__body"
18833
+ }, {
18834
+ default: withCtx(() => [createElementVNode("div", _hoisted_2$1, [createVNode(unref(Space), {
18835
+ align: "center",
18836
+ size: "small"
18837
+ }, {
18838
+ default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.actions, (item, index2) => {
18839
+ return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18840
+ key: item.uid || index2,
18841
+ context: getConfigRendererCtx(item),
18842
+ config: {
18843
+ is: unref(Button),
18844
+ ...item,
18845
+ form: void 0,
18846
+ onClick: buildActionOnClick(item),
18847
+ disabled: buildActionDisabled(item)
19341
18848
  }
19342
- return null;
19343
- })(t3) || i2.replace(":", "");
19344
- }));
19345
- }, m2.utcOffset = function() {
19346
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
19347
- }, m2.diff = function(r2, d2, l2) {
19348
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
19349
- return b.m(y2, m3);
18849
+ }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18850
+ }), 128))], true)]),
18851
+ _: 3
18852
+ }), createVNode(unref(Space), {
18853
+ align: "center",
18854
+ size: "small"
18855
+ }, {
18856
+ default: withCtx(() => [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(unref(Tooltip), {
18857
+ key: 0,
18858
+ content: searchVisible.value ? unref(t)("collapseSearchText") : unref(t)("expandSearchText")
18859
+ }, {
18860
+ default: withCtx(() => [createVNode(unref(Button), {
18861
+ variant: "text",
18862
+ shape: "square",
18863
+ onClick: toggleSearchVisible
18864
+ }, {
18865
+ icon: withCtx(() => [createVNode(unref(SearchIcon))]),
18866
+ _: 1
18867
+ })]),
18868
+ _: 1
18869
+ }, 8, ["content"])) : createCommentVNode("", true), createVNode(unref(Tooltip), {
18870
+ content: unref(t)("refreshText")
18871
+ }, {
18872
+ default: withCtx(() => [createVNode(unref(Button), {
18873
+ variant: "text",
18874
+ shape: "square",
18875
+ onClick: handleRefresh
18876
+ }, {
18877
+ icon: withCtx(() => [createVNode(unref(RefreshIcon))]),
18878
+ _: 1
18879
+ })]),
18880
+ _: 1
18881
+ }, 8, ["content"]), !unref(isEmpty)(reProps.value.serviceTableOptions.tree) && !reProps.value.serviceTableOptions.tree.lazyLoad ? (openBlock(), createBlock(unref(Tooltip), {
18882
+ key: 1,
18883
+ content: treeIsExpand.value ? unref(t)("collapseTreeText") : unref(t)("expandTreeText")
18884
+ }, {
18885
+ default: withCtx(() => [createVNode(unref(Button), {
18886
+ variant: "text",
18887
+ shape: "square",
18888
+ onClick: toggleTreeExpandAll
18889
+ }, {
18890
+ icon: withCtx(() => [treeIsExpand.value ? (openBlock(), createBlock(unref(UnfoldLessIcon), {
18891
+ key: 0
18892
+ })) : (openBlock(), createBlock(unref(UnfoldMoreIcon), {
18893
+ key: 1
18894
+ }))]),
18895
+ _: 1
18896
+ })]),
18897
+ _: 1
18898
+ }, 8, ["content"])) : createCommentVNode("", true), reProps.value.serviceTableOptions.columnController?.hideTriggerButton !== true ? (openBlock(), createBlock(unref(Tooltip), {
18899
+ key: 2,
18900
+ content: unref(t)("columnControllerText")
18901
+ }, {
18902
+ default: withCtx(() => [createVNode(unref(Button), {
18903
+ variant: "text",
18904
+ shape: "square",
18905
+ onClick: openColumnController
18906
+ }, {
18907
+ icon: withCtx(() => [createVNode(unref(SettingIcon))]),
18908
+ _: 1
18909
+ })]),
18910
+ _: 1
18911
+ }, 8, ["content"])) : createCommentVNode("", true)]),
18912
+ _: 1
18913
+ })]), createVNode(unref(QdServiceTable), mergeProps({
18914
+ ref: "table",
18915
+ data: unref(data),
18916
+ "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
18917
+ "selected-row-keys": unref(selectedRowKeys),
18918
+ "onUpdate:selectedRowKeys": _cache[3] || (_cache[3] = ($event) => isRef(selectedRowKeys) ? selectedRowKeys.value = $event : null),
18919
+ "active-row-keys": unref(activeRowKeys),
18920
+ "onUpdate:activeRowKeys": _cache[4] || (_cache[4] = ($event) => isRef(activeRowKeys) ? activeRowKeys.value = $event : null),
18921
+ "column-controller-visible": unref(columnControllerVisible),
18922
+ "onUpdate:columnControllerVisible": _cache[5] || (_cache[5] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
18923
+ "display-columns": unref(displayColumns),
18924
+ "onUpdate:displayColumns": _cache[6] || (_cache[6] = ($event) => isRef(displayColumns) ? displayColumns.value = $event : null),
18925
+ "expanded-row-keys": unref(expandedRowKeys),
18926
+ "onUpdate:expandedRowKeys": _cache[7] || (_cache[7] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
18927
+ "filter-value": unref(filterValue),
18928
+ "onUpdate:filterValue": _cache[8] || (_cache[8] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
18929
+ sort: unref(sort),
18930
+ "onUpdate:sort": _cache[9] || (_cache[9] = ($event) => isRef(sort) ? sort.value = $event : null),
18931
+ "expanded-tree-nodes": unref(expandedTreeNodes),
18932
+ "onUpdate:expandedTreeNodes": _cache[10] || (_cache[10] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null)
18933
+ }, reProps.value.serviceTableOptions), createSlots({
18934
+ operation: withCtx((slotProps) => [renderSlot(_ctx.$slots, "table-operation", normalizeProps(guardReactiveProps(slotProps)), () => [reProps.value.rowActions?.length ? (openBlock(), createBlock(unref(Space), {
18935
+ key: 0,
18936
+ align: "center",
18937
+ size: 0,
18938
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
18939
+ }, ["stop"]))
18940
+ }, {
18941
+ separator: withCtx(() => [createVNode(unref(Divider), {
18942
+ layout: "vertical"
18943
+ })]),
18944
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.rowActions, (item, index2) => {
18945
+ return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18946
+ key: item.uid || index2,
18947
+ context: getConfigRendererCtx(item, slotProps),
18948
+ config: {
18949
+ is: unref(Link),
18950
+ ...item,
18951
+ onClick: buildActionOnClick(item, slotProps)
18952
+ }
18953
+ }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18954
+ }), 128))]),
18955
+ _: 2
18956
+ }, 1024)) : createCommentVNode("", true)], true)]),
18957
+ _: 2
18958
+ }, [renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "table"), (item) => {
18959
+ return {
18960
+ name: item.filterName,
18961
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
19350
18962
  };
19351
- switch (M3) {
19352
- case h2:
19353
- $2 = D2() / 12;
19354
- break;
19355
- case c:
19356
- $2 = D2();
19357
- break;
19358
- case f:
19359
- $2 = D2() / 3;
19360
- break;
19361
- case o:
19362
- $2 = (g2 - v2) / 6048e5;
19363
- break;
19364
- case a:
19365
- $2 = (g2 - v2) / 864e5;
19366
- break;
19367
- case u:
19368
- $2 = g2 / n;
19369
- break;
19370
- case s:
19371
- $2 = g2 / e;
19372
- break;
19373
- case i:
19374
- $2 = g2 / t;
19375
- break;
19376
- default:
19377
- $2 = g2;
19378
- }
19379
- return l2 ? $2 : b.a($2);
19380
- }, m2.daysInMonth = function() {
19381
- return this.endOf(c).$D;
19382
- }, m2.$locale = function() {
19383
- return D[this.$L];
19384
- }, m2.locale = function(t2, e2) {
19385
- if (!t2) return this.$L;
19386
- var n2 = this.clone(), r2 = w(t2, e2, true);
19387
- return r2 && (n2.$L = r2), n2;
19388
- }, m2.clone = function() {
19389
- return b.w(this.$d, this);
19390
- }, m2.toDate = function() {
19391
- return new Date(this.valueOf());
19392
- }, m2.toJSON = function() {
19393
- return this.isValid() ? this.toISOString() : null;
19394
- }, m2.toISOString = function() {
19395
- return this.$d.toISOString();
19396
- }, m2.toString = function() {
19397
- return this.$d.toUTCString();
19398
- }, M2;
19399
- })(), k = _.prototype;
19400
- return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h2], ["$D", d]].forEach((function(t2) {
19401
- k[t2[1]] = function(e2) {
19402
- return this.$g(e2, t2[0], t2[1]);
18963
+ })]), 1040, ["data", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes"])]),
18964
+ _: 3
18965
+ }), (openBlock(true), createElementBlock(Fragment, null, renderList(dialogFormMap, (dialogForm, uid) => {
18966
+ return openBlock(), createBlock(unref(_sfc_main$h), {
18967
+ key: uid,
18968
+ config: {
18969
+ is: unref(_sfc_main$8),
18970
+ ...dialogForm.form,
18971
+ vModelVisible: "self.visible",
18972
+ vModelData: "self.data",
18973
+ crudMode: dialogForm.crudMode
18974
+ },
18975
+ context: getConfigRendererCtx(dialogForm)
18976
+ }, null, 8, ["config", "context"]);
18977
+ }), 128))]);
18978
+ };
18979
+ }
18980
+ });
18981
+ const table = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-bdb9c97a"]]);
18982
+ const _hoisted_1$1 = {
18983
+ key: 0,
18984
+ class: "qd-crud-list__header"
18985
+ };
18986
+ const _hoisted_2 = {
18987
+ key: 1,
18988
+ class: "qd-crud-list__toolbar"
18989
+ };
18990
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
18991
+ __name: "list",
18992
+ props: /* @__PURE__ */ mergeDefaults({
18993
+ search: {},
18994
+ searchData: {},
18995
+ data: {},
18996
+ loading: {
18997
+ type: Boolean
18998
+ },
18999
+ loadingProps: {},
19000
+ scroll: {},
19001
+ asyncLoading: {},
19002
+ footer: {},
19003
+ header: {},
19004
+ layout: {},
19005
+ size: {},
19006
+ split: {
19007
+ type: Boolean
19008
+ },
19009
+ stripe: {
19010
+ type: Boolean
19011
+ },
19012
+ onBefore: {
19013
+ type: Function
19014
+ },
19015
+ onAfter: {
19016
+ type: Function
19017
+ },
19018
+ onSuccess: {
19019
+ type: Function
19020
+ },
19021
+ onError: {
19022
+ type: Function
19023
+ },
19024
+ service: {
19025
+ type: Function
19026
+ },
19027
+ manual: {
19028
+ type: Boolean
19029
+ },
19030
+ transformParams: {
19031
+ type: Function
19032
+ },
19033
+ transformRes: {
19034
+ type: Function
19035
+ },
19036
+ pagination: {}
19037
+ }, qdCrudListProps),
19038
+ emits: ["update:searchData", "update:data"],
19039
+ setup(__props, {
19040
+ expose: __expose,
19041
+ emit: __emit
19042
+ }) {
19043
+ const props = __props;
19044
+ const emit = __emit;
19045
+ const {
19046
+ data,
19047
+ searchData
19048
+ } = /* @__PURE__ */ useVModels(props, emit, {
19049
+ passive: true
19050
+ });
19051
+ const {
19052
+ t
19053
+ } = useConfig("crud");
19054
+ const reProps = computed(() => {
19055
+ const {
19056
+ data: data2,
19057
+ searchData: inSearchData,
19058
+ search,
19059
+ transformParams,
19060
+ ...serviceListOptions
19061
+ } = props;
19062
+ const mergedTransformParams = (params) => {
19063
+ const merged = {
19064
+ ...params,
19065
+ ...searchData.value
19403
19066
  };
19404
- })), O.extend = function(t2, e2) {
19405
- return t2.$i || (t2(e2, _, O), t2.$i = true), O;
19406
- }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
19407
- return O(1e3 * t2);
19408
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
19409
- }));
19410
- })(dayjs_min$1);
19411
- return dayjs_min$1.exports;
19067
+ if (transformParams) return transformParams(merged);
19068
+ return merged;
19069
+ };
19070
+ return {
19071
+ searchOptions: search,
19072
+ serviceListOptions: {
19073
+ ...serviceListOptions,
19074
+ transformParams: mergedTransformParams
19075
+ },
19076
+ models: {
19077
+ data: data2,
19078
+ searchData: inSearchData
19079
+ }
19080
+ };
19081
+ });
19082
+ const searchRef = useTemplateRef("search");
19083
+ const listRef = useTemplateRef("list");
19084
+ function handleSearch() {
19085
+ }
19086
+ function handleResetSearch() {
19087
+ searchRef.value?.reset();
19088
+ searchRef.value?.submit();
19089
+ }
19090
+ function triggerSearch({
19091
+ validateResult
19092
+ }) {
19093
+ if (validateResult !== true) return;
19094
+ listRef.value?.refresh();
19095
+ }
19096
+ const expose = {};
19097
+ onMounted(() => {
19098
+ Object.assign(expose, listRef.value);
19099
+ });
19100
+ __expose(expose);
19101
+ return (_ctx, _cache) => {
19102
+ return openBlock(), createElementBlock("div", {
19103
+ class: normalizeClass(["qd-crud-list", reProps.value.serviceListOptions.scroll?.target ? "qd-crud-list--has-scroll-target" : ""])
19104
+ }, [reProps.value.searchOptions?.items?.length || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_1$1, [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(QdCrudSearch, mergeProps({
19105
+ key: 0,
19106
+ ref: "search",
19107
+ data: unref(searchData),
19108
+ "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null)
19109
+ }, reProps.value.searchOptions, {
19110
+ "on-submit": triggerSearch
19111
+ }), {
19112
+ footer: withCtx(() => [createVNode(unref(Space), {
19113
+ align: "center",
19114
+ size: "small"
19115
+ }, {
19116
+ default: withCtx(() => [createVNode(unref(Button), {
19117
+ type: "submit",
19118
+ onClick: handleSearch
19119
+ }, {
19120
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
19121
+ _: 1
19122
+ }), createVNode(unref(Button), {
19123
+ variant: "outline",
19124
+ onClick: handleResetSearch
19125
+ }, {
19126
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
19127
+ _: 1
19128
+ })]),
19129
+ _: 1
19130
+ })]),
19131
+ _: 1
19132
+ }, 16, ["data"])) : createCommentVNode("", true), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Space), {
19133
+ align: "center",
19134
+ size: "small"
19135
+ }, {
19136
+ default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, void 0, true)]),
19137
+ _: 3
19138
+ })])) : createCommentVNode("", true)])) : createCommentVNode("", true), createVNode(unref(QdServiceList), mergeProps({
19139
+ ref: "list",
19140
+ data: unref(data),
19141
+ "onUpdate:data": _cache[1] || (_cache[1] = ($event) => isRef(data) ? data.value = $event : null)
19142
+ }, reProps.value.serviceListOptions), createSlots({
19143
+ _: 2
19144
+ }, [_ctx.$slots.default ? {
19145
+ name: "default",
19146
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)), void 0, true)]),
19147
+ key: "0"
19148
+ } : void 0, renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "list"), (item) => {
19149
+ return {
19150
+ name: item.filterName,
19151
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
19152
+ };
19153
+ })]), 1040, ["data"])], 2);
19154
+ };
19155
+ }
19156
+ });
19157
+ const list = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c15e270f"]]);
19158
+ function defineQdCrudTable(config) {
19159
+ return config;
19412
19160
  }
19413
- var dayjs_minExports = requireDayjs_min();
19414
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
19161
+ function defineQdCrudList(config) {
19162
+ return config;
19163
+ }
19164
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19165
+ ...{
19166
+ name: "QdDictSelect"
19167
+ },
19168
+ __name: "select",
19169
+ props: /* @__PURE__ */ mergeDefaults({
19170
+ dictType: {},
19171
+ defaultSelectFirst: { type: Boolean },
19172
+ convStr: { type: [Boolean, String] },
19173
+ autoWidth: { type: Boolean },
19174
+ autofocus: { type: Boolean },
19175
+ borderless: { type: Boolean },
19176
+ clearable: { type: Boolean },
19177
+ collapsedItems: {},
19178
+ creatable: { type: Boolean },
19179
+ disabled: { type: Boolean },
19180
+ empty: {},
19181
+ filter: { type: Function },
19182
+ filterable: { type: Boolean },
19183
+ inputProps: {},
19184
+ inputValue: {},
19185
+ defaultInputValue: {},
19186
+ keys: {},
19187
+ label: {},
19188
+ loading: { type: Boolean },
19189
+ loadingText: {},
19190
+ max: {},
19191
+ minCollapsedNum: {},
19192
+ multiple: { type: Boolean },
19193
+ panelBottomContent: {},
19194
+ panelTopContent: {},
19195
+ placeholder: {},
19196
+ popupProps: {},
19197
+ popupVisible: { type: Boolean },
19198
+ defaultPopupVisible: { type: Boolean },
19199
+ prefixIcon: {},
19200
+ readonly: { type: Boolean },
19201
+ reserveKeyword: { type: Boolean },
19202
+ scroll: {},
19203
+ selectInputProps: {},
19204
+ showArrow: { type: Boolean },
19205
+ size: {},
19206
+ status: {},
19207
+ suffix: {},
19208
+ suffixIcon: {},
19209
+ tagInputProps: {},
19210
+ tagProps: {},
19211
+ tips: {},
19212
+ value: {},
19213
+ defaultValue: {},
19214
+ modelValue: {},
19215
+ valueDisplay: {},
19216
+ valueType: {},
19217
+ onBlur: { type: Function },
19218
+ onChange: { type: Function },
19219
+ onClear: { type: Function },
19220
+ onCreate: { type: Function },
19221
+ onEnter: { type: Function },
19222
+ onFocus: { type: Function },
19223
+ onInputChange: { type: Function },
19224
+ onPopupVisibleChange: { type: Function },
19225
+ onRemove: { type: Function },
19226
+ onSearch: { type: Function }
19227
+ }, qdDictSelectProps),
19228
+ emits: ["update:modelValue", "update:inputValue", "update:popupVisible"],
19229
+ setup(__props, { emit: __emit }) {
19230
+ const props = __props;
19231
+ const emit = __emit;
19232
+ const { modelValue, inputValue, popupVisible } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19233
+ const reModelValue = computed({
19234
+ get: () => {
19235
+ const { convStr, selectOptions } = reProps.value;
19236
+ const { multiple, valueType } = selectOptions;
19237
+ if (!multiple || valueType === "object") return modelValue.value;
19238
+ if (isEmpty(modelValue.value)) return [];
19239
+ if (typeof modelValue.value === "string") {
19240
+ return modelValue.value.split(
19241
+ (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
19242
+ );
19243
+ }
19244
+ return modelValue.value;
19245
+ },
19246
+ set: (val) => {
19247
+ const { convStr, selectOptions } = reProps.value;
19248
+ const { multiple, valueType } = selectOptions;
19249
+ if (!multiple || valueType === "object") {
19250
+ modelValue.value = val;
19251
+ return;
19252
+ }
19253
+ if (convStr && Array.isArray(val)) {
19254
+ modelValue.value = val.join(
19255
+ (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
19256
+ );
19257
+ } else {
19258
+ modelValue.value = val;
19259
+ }
19260
+ }
19261
+ });
19262
+ const dictType = toRef(props, "dictType");
19263
+ const reProps = computed(() => {
19264
+ const {
19265
+ convStr,
19266
+ modelValue: modelValue2,
19267
+ inputValue: inputValue2,
19268
+ popupVisible: popupVisible2,
19269
+ dictType: dictType2,
19270
+ loading,
19271
+ defaultSelectFirst,
19272
+ ...selectOptions
19273
+ } = props;
19274
+ return {
19275
+ convStr,
19276
+ dictType: dictType2,
19277
+ loading,
19278
+ defaultSelectFirst,
19279
+ selectOptions,
19280
+ models: {
19281
+ modelValue: modelValue2,
19282
+ inputValue: inputValue2,
19283
+ popupVisible: popupVisible2
19284
+ }
19285
+ };
19286
+ });
19287
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType, {
19288
+ onInit: (options) => {
19289
+ if (reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && options.length) {
19290
+ reModelValue.value = options[0]?.value;
19291
+ }
19292
+ }
19293
+ });
19294
+ return (_ctx, _cache) => {
19295
+ return openBlock(), createBlock(unref(Select), mergeProps({
19296
+ modelValue: reModelValue.value,
19297
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19298
+ "input-value": unref(inputValue),
19299
+ "onUpdate:inputValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
19300
+ "popup-visible": unref(popupVisible),
19301
+ "onUpdate:popupVisible": _cache[2] || (_cache[2] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : null)
19302
+ }, reProps.value.selectOptions, {
19303
+ options: unref(dictOptions),
19304
+ loading: unref(dictLoading) || reProps.value.loading
19305
+ }), createSlots({ _: 2 }, [
19306
+ renderList(_ctx.$slots, (_, name) => {
19307
+ return {
19308
+ name,
19309
+ fn: withCtx((slotProps) => [
19310
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
19311
+ ])
19312
+ };
19313
+ })
19314
+ ]), 1040, ["modelValue", "input-value", "popup-visible", "options", "loading"]);
19315
+ };
19316
+ }
19317
+ });
19318
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
19319
+ ...{
19320
+ name: "QdDictRadioGroup"
19321
+ },
19322
+ __name: "radio-group",
19323
+ props: /* @__PURE__ */ mergeDefaults({
19324
+ dictType: {},
19325
+ allowUncheck: { type: Boolean },
19326
+ disabled: { type: Boolean },
19327
+ name: {},
19328
+ readonly: { type: Boolean },
19329
+ size: {},
19330
+ theme: {},
19331
+ value: {},
19332
+ defaultValue: {},
19333
+ modelValue: {},
19334
+ variant: {},
19335
+ onChange: { type: Function }
19336
+ }, qdDictRadioGroupProps),
19337
+ emits: ["update:modelValue"],
19338
+ setup(__props, { emit: __emit }) {
19339
+ const vLoading = LoadingDirective;
19340
+ const props = __props;
19341
+ const emit = __emit;
19342
+ const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19343
+ const dictType = toRef(props, "dictType");
19344
+ const reProps = computed(() => {
19345
+ const { modelValue: modelValue2, dictType: dictType2, ...radioOptions } = props;
19346
+ return {
19347
+ dictType: dictType2,
19348
+ radioOptions,
19349
+ models: {
19350
+ modelValue: modelValue2
19351
+ }
19352
+ };
19353
+ });
19354
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19355
+ return (_ctx, _cache) => {
19356
+ return withDirectives((openBlock(), createBlock(unref(RadioGroup), mergeProps({
19357
+ modelValue: unref(modelValue),
19358
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
19359
+ class: "qd-dict-radio-group"
19360
+ }, reProps.value.radioOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19361
+ [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19362
+ ]);
19363
+ };
19364
+ }
19365
+ });
19366
+ const radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e97fb1f0"]]);
19367
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
19368
+ ...{
19369
+ name: "QdDictCheckboxGroup"
19370
+ },
19371
+ __name: "checkbox-group",
19372
+ props: /* @__PURE__ */ mergeDefaults({
19373
+ dictType: {},
19374
+ convStr: { type: [Boolean, String] },
19375
+ modelValue: {},
19376
+ disabled: { type: Boolean },
19377
+ lazyLoad: { type: Boolean },
19378
+ max: {},
19379
+ name: {},
19380
+ readonly: { type: Boolean },
19381
+ value: {},
19382
+ defaultValue: {},
19383
+ onChange: { type: Function }
19384
+ }, qdDictCheckboxGroupProps),
19385
+ emits: ["update:modelValue"],
19386
+ setup(__props, { emit: __emit }) {
19387
+ const vLoading = LoadingDirective;
19388
+ const props = __props;
19389
+ const emit = __emit;
19390
+ const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19391
+ const reModelValue = computed({
19392
+ get: () => {
19393
+ if (isEmpty(modelValue.value)) return [];
19394
+ if (typeof modelValue.value === "string") {
19395
+ const { convStr } = reProps.value;
19396
+ return modelValue.value.split((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
19397
+ }
19398
+ return modelValue.value;
19399
+ },
19400
+ set: (val) => {
19401
+ const { convStr } = reProps.value;
19402
+ if (convStr) {
19403
+ modelValue.value = val.join((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
19404
+ } else {
19405
+ modelValue.value = val;
19406
+ }
19407
+ }
19408
+ });
19409
+ const dictType = toRef(props, "dictType");
19410
+ const reProps = computed(() => {
19411
+ const { modelValue: modelValue2, dictType: dictType2, convStr, ...checkboxOptions } = props;
19412
+ return {
19413
+ dictType: dictType2,
19414
+ convStr,
19415
+ checkboxOptions,
19416
+ models: {
19417
+ modelValue: modelValue2
19418
+ }
19419
+ };
19420
+ });
19421
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19422
+ return (_ctx, _cache) => {
19423
+ return withDirectives((openBlock(), createBlock(unref(CheckboxGroup), mergeProps({
19424
+ modelValue: reModelValue.value,
19425
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19426
+ class: "qd-dict-checkbox-group"
19427
+ }, reProps.value.checkboxOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19428
+ [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19429
+ ]);
19430
+ };
19431
+ }
19432
+ });
19433
+ const checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ef427474"]]);
19434
+ const _hoisted_1 = { class: "qd-dict-tag" };
19435
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
19436
+ ...{
19437
+ name: "QdDictTag"
19438
+ },
19439
+ __name: "tag",
19440
+ props: /* @__PURE__ */ mergeDefaults({
19441
+ value: {},
19442
+ strict: { type: Boolean },
19443
+ separator: {},
19444
+ options: {},
19445
+ dictType: {},
19446
+ size: {},
19447
+ shape: {},
19448
+ theme: {},
19449
+ variant: {}
19450
+ }, qdDictTagProps),
19451
+ setup(__props) {
19452
+ const props = __props;
19453
+ const dictType = toRef(props, "dictType");
19454
+ const reProps = computed(() => {
19455
+ const { options, ...otherOptions } = props;
19456
+ return {
19457
+ ...otherOptions,
19458
+ options: options || dictOptions.value || []
19459
+ };
19460
+ });
19461
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19462
+ const reValue = computed(() => {
19463
+ const { value, strict } = reProps.value;
19464
+ if (isEmpty(value)) return [];
19465
+ if (Array.isArray(value)) return value.map((item) => strict ? item : item.toString());
19466
+ if (isNumber(value)) {
19467
+ return strict ? [value] : [value.toString()];
19468
+ }
19469
+ return String(value).split(",");
19470
+ });
19471
+ const matchOptions = computed(() => {
19472
+ const { options, strict } = reProps.value;
19473
+ return options.filter((option) => {
19474
+ return reValue.value.includes(strict ? option.value : option.value.toString());
19475
+ });
19476
+ });
19477
+ return (_ctx, _cache) => {
19478
+ const _directive_loading = resolveDirective("loading");
19479
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
19480
+ (openBlock(true), createElementBlock(Fragment, null, renderList(matchOptions.value, (item, index2) => {
19481
+ return openBlock(), createElementBlock(Fragment, null, [
19482
+ (!reProps.value.theme || reProps.value.theme === "text") && !__props.variant && (item.theme === "text" || !item.theme) ? (openBlock(), createElementBlock("span", {
19483
+ key: item.value,
19484
+ class: normalizeClass(item.class)
19485
+ }, [
19486
+ renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19487
+ renderSlot(_ctx.$slots, "default", { item }, () => [
19488
+ createTextVNode(toDisplayString(item.label), 1)
19489
+ ], true),
19490
+ renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19491
+ ], 2)) : (openBlock(), createBlock(unref(Tag), {
19492
+ key: item.value + "",
19493
+ index: index2,
19494
+ size: reProps.value.size,
19495
+ shape: reProps.value.shape,
19496
+ theme: reProps.value.theme || item.theme || "default",
19497
+ variant: reProps.value.variant || item.variant || "light",
19498
+ class: normalizeClass(item.class)
19499
+ }, {
19500
+ default: withCtx(() => [
19501
+ renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19502
+ renderSlot(_ctx.$slots, "default", { item }, () => [
19503
+ createTextVNode(toDisplayString(item.label), 1)
19504
+ ], true),
19505
+ renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19506
+ ]),
19507
+ _: 2
19508
+ }, 1032, ["index", "size", "shape", "theme", "variant", "class"])),
19509
+ (_ctx.$slots.separator || __props.separator) && matchOptions.value.length - 1 !== index2 ? renderSlot(_ctx.$slots, "separator", { key: 2 }, () => [
19510
+ createTextVNode(toDisplayString(__props.separator), 1)
19511
+ ], true) : createCommentVNode("", true)
19512
+ ], 64);
19513
+ }), 256))
19514
+ ])), [
19515
+ [_directive_loading, { loading: unref(dictLoading), size: "small" }]
19516
+ ]);
19517
+ };
19518
+ }
19519
+ });
19520
+ const tag = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cab615cf"]]);
19521
+ const qdUploadProps = {
19522
+ modelValue: () => [],
19523
+ files: () => [],
19524
+ convStr: false,
19525
+ valueMode: "ossId",
19526
+ theme: "file",
19527
+ draggable: void 0,
19528
+ autoUpload: false,
19529
+ allowUploadDuplicateFile: true,
19530
+ isBatchUpload: false,
19531
+ uploadAllFilesInOneRequest: false,
19532
+ method: "POST",
19533
+ multiple: void 0,
19534
+ name: "file",
19535
+ disabled: void 0,
19536
+ showImageFileName: true,
19537
+ showThumbnail: true,
19538
+ showUploadProgress: true,
19539
+ uploadPastedFiles: true,
19540
+ useMockProgress: true,
19541
+ withCredentials: false,
19542
+ del: void 0
19543
+ };
19544
+ const qdUploadSizeLimit = {
19545
+ unit: "MB"
19546
+ };
19415
19547
  const acceptMap = {
19416
19548
  default: [
19417
19549
  ".doc",
@@ -19546,7 +19678,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19546
19678
  modelValue.value = val;
19547
19679
  }
19548
19680
  });
19549
- const formAddBeforeSubmitQueue = inject(PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE);
19681
+ const formAddBeforeSubmitQueue = inject(PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE, void 0);
19550
19682
  const { t } = useConfig("upload");
19551
19683
  const tdReadonly = useReadonly();
19552
19684
  const tdDisabled = useDisabled();
@@ -19555,7 +19687,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19555
19687
  const { timer: uploadTimer, clearTimer: clearUploadTimer } = useTimer("interval");
19556
19688
  const delList = ref([]);
19557
19689
  const popupFileList = computed(() => [...fileList.value]);
19558
- const globalUploadProps = inject(PROVIDE_UPLOAD);
19690
+ const globalUploadProps = inject(PROVIDE_UPLOAD, void 0);
19559
19691
  const reProps = computed(() => {
19560
19692
  const {
19561
19693
  modelValue: modelValue2,
@@ -19938,7 +20070,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19938
20070
  };
19939
20071
  }
19940
20072
  });
19941
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e8a4e0"]]);
20073
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-91a0c8d5"]]);
19942
20074
  export {
19943
20075
  QdGrid as A,
19944
20076
  QdGridItem as B,
@@ -19989,4 +20121,4 @@ export {
19989
20121
  qdFormGutter as y,
19990
20122
  qdFormGrid as z
19991
20123
  };
19992
- //# sourceMappingURL=index-CEqpomWn.mjs.map
20124
+ //# sourceMappingURL=index-Coh5ZgRv.mjs.map