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