qidian-vue-ui 1.0.82 → 1.0.84

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