@epie/bi-crud 2.0.14 → 2.0.17

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.
@@ -9853,7 +9853,7 @@ function Parse (method, {
9853
9853
  }
9854
9854
  }
9855
9855
 
9856
- function _isSlot$3(s) {
9856
+ function _isSlot$5(s) {
9857
9857
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
9858
9858
  }
9859
9859
 
@@ -10105,7 +10105,7 @@ function useRender$3(ctx) {
10105
10105
 
10106
10106
  return createVNode(resolveComponent("el-col"), mergeProps({
10107
10107
  "span": baseSpan
10108
- }, e), _isSlot$3(FormItem) ? FormItem : {
10108
+ }, e), _isSlot$5(FormItem) ? FormItem : {
10109
10109
  default: () => [FormItem]
10110
10110
  });
10111
10111
  }); // el-form
@@ -10124,7 +10124,7 @@ function useRender$3(ctx) {
10124
10124
  default: () => {
10125
10125
  return ctx.inline ? children : withDirectives(createVNode(resolveComponent("el-row"), {
10126
10126
  "gutter": 10
10127
- }, _isSlot$3(children) ? children : {
10127
+ }, _isSlot$5(children) ? children : {
10128
10128
  default: () => [children]
10129
10129
  }), [[resolveDirective("loading"), ctx.loading]]);
10130
10130
  }
@@ -10152,14 +10152,14 @@ function useRender$3(ctx) {
10152
10152
  "onClick": () => {
10153
10153
  ctx.submit();
10154
10154
  }
10155
- }, _isSlot$3(saveButtonText) ? saveButtonText : {
10155
+ }, _isSlot$5(saveButtonText) ? saveButtonText : {
10156
10156
  default: () => [saveButtonText]
10157
10157
  });
10158
10158
  } else if (vnode == "close") {
10159
10159
  return createVNode(resolveComponent("el-button"), {
10160
10160
  "size": style.size,
10161
10161
  "onClick": ctx.close
10162
- }, _isSlot$3(closeButtonText) ? closeButtonText : {
10162
+ }, _isSlot$5(closeButtonText) ? closeButtonText : {
10163
10163
  default: () => [closeButtonText]
10164
10164
  });
10165
10165
  } else {
@@ -11427,7 +11427,7 @@ var ExportBtn = defineComponent({
11427
11427
  }
11428
11428
  });
11429
11429
 
11430
- function _isSlot$2(s) {
11430
+ function _isSlot$4(s) {
11431
11431
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
11432
11432
  }
11433
11433
 
@@ -11553,7 +11553,7 @@ var SearchKey = defineComponent({
11553
11553
  "modelValue": ctx.selectField,
11554
11554
  "onUpdate:modelValue": $event => ctx.selectField = $event,
11555
11555
  "onChange": ctx.onFieldChange
11556
- }, _isSlot$2(_slot = ctx.fieldList.map((e, i) => createVNode(resolveComponent("el-option"), {
11556
+ }, _isSlot$4(_slot = ctx.fieldList.map((e, i) => createVNode(resolveComponent("el-option"), {
11557
11557
  "key": i,
11558
11558
  "label": e.label,
11559
11559
  "value": e.value
@@ -11805,6 +11805,10 @@ const ContextMenu = {
11805
11805
 
11806
11806
  };
11807
11807
 
11808
+ function _isSlot$3(s) {
11809
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
11810
+ }
11811
+
11808
11812
  function useElTable({
11809
11813
  Table
11810
11814
  }) {
@@ -12224,7 +12228,17 @@ function useRender$2({
12224
12228
  default: () => d.label
12225
12229
  });
12226
12230
  } else if (d) {
12227
- return d.label;
12231
+ return createVNode(resolveComponent("el-tag"), {
12232
+ "style": "margin: 0 2px"
12233
+ }, {
12234
+ default: () => [d.label]
12235
+ });
12236
+ } else if (!!v) {
12237
+ return createVNode(resolveComponent("el-tag"), {
12238
+ "style": "margin: 0 2px"
12239
+ }, _isSlot$3(v) ? v : {
12240
+ default: () => [v]
12241
+ });
12228
12242
  } else {
12229
12243
  return v;
12230
12244
  }
@@ -12554,11 +12568,15 @@ var Upsert = defineComponent({
12554
12568
 
12555
12569
 
12556
12570
  crud.service[reqName](data).then(res => {
12557
- ElMessage.success("保存成功");
12558
- done();
12559
- close();
12560
- crud.refresh();
12561
- resolve(res);
12571
+ if (res && res.code === 0) {
12572
+ ElMessage.success("保存成功");
12573
+ done();
12574
+ close();
12575
+ crud.refresh();
12576
+ resolve(res);
12577
+ } else {
12578
+ done();
12579
+ }
12562
12580
  }).catch(err => {
12563
12581
  ElMessage.error(err.msg);
12564
12582
  done();
@@ -13121,7 +13139,7 @@ var ErrorMessage = defineComponent({
13121
13139
 
13122
13140
  });
13123
13141
 
13124
- function _isSlot$1(s) {
13142
+ function _isSlot$2(s) {
13125
13143
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
13126
13144
  }
13127
13145
 
@@ -13135,7 +13153,7 @@ function useRender$1(ctx) {
13135
13153
  let _slot;
13136
13154
 
13137
13155
  // 表单项列表
13138
- const children = ctx.items.map(e => {
13156
+ const children = ctx.items?.map(e => {
13139
13157
  // 是否隐藏
13140
13158
  e._hidden = Parse("hidden", {
13141
13159
  value: e.hidden,
@@ -13188,10 +13206,10 @@ function useRender$1(ctx) {
13188
13206
  "lg": {
13189
13207
  span: 6
13190
13208
  }
13191
- }, e), _isSlot$1(FormItem) ? FormItem : {
13209
+ }, e), _isSlot$2(FormItem) ? FormItem : {
13192
13210
  default: () => [FormItem]
13193
13211
  });
13194
- });
13212
+ }).filter(Boolean);
13195
13213
 
13196
13214
  const op = createVNode(resolveComponent("el-col"), {
13197
13215
  "span": 6,
@@ -13208,7 +13226,7 @@ function useRender$1(ctx) {
13208
13226
  default: () => [createVNode(resolveComponent("el-form-item"), {
13209
13227
  "label-width": "auto",
13210
13228
  "label": ""
13211
- }, _isSlot$1(_slot = renderOp()) ? _slot : {
13229
+ }, _isSlot$2(_slot = renderOp()) ? _slot : {
13212
13230
  default: () => [_slot]
13213
13231
  })]
13214
13232
  }); // el-form
@@ -13221,7 +13239,11 @@ function useRender$1(ctx) {
13221
13239
  "label-width": "100px",
13222
13240
  "inline": true,
13223
13241
  "model": ctx.form
13224
- }, null); //TODO:: 支持props
13242
+ }, null);
13243
+
13244
+ if ((children?.length > 0 || 0) === 0) {
13245
+ return createVNode("span", null, null);
13246
+ } //TODO:: 支持props
13225
13247
 
13226
13248
 
13227
13249
  return h(ElForm, {}, {
@@ -13240,7 +13262,7 @@ function useRender$1(ctx) {
13240
13262
  search: "搜索",
13241
13263
  reset: "重置"
13242
13264
  };
13243
- return ctx.op.map(e => {
13265
+ return ctx.op?.map(e => {
13244
13266
  if (ButtonText[e]) {
13245
13267
  return createVNode(resolveComponent("el-button"), {
13246
13268
  size: "default",
@@ -13257,37 +13279,32 @@ function useRender$1(ctx) {
13257
13279
  });
13258
13280
  }
13259
13281
  });
13260
- } // 渲染表单按钮
13282
+ }
13261
13283
 
13262
13284
  return {
13263
- renderForm,
13264
- renderOp
13285
+ renderForm // renderOp
13286
+
13265
13287
  };
13266
13288
  }
13267
13289
 
13268
- var InlineSearch = defineComponent({
13269
- name: "epie-inline-search",
13270
- props: {
13271
- // 表单值
13272
- data: {
13273
- type: Object,
13274
- default: () => {
13275
- return {};
13276
- }
13277
- },
13278
- // 表单项
13279
- items: {
13280
- type: Array,
13281
- default: () => []
13282
- },
13283
- // 操作按钮 ['search', 'reset', 'clear', 'close']
13284
- op: {
13285
- type: Array,
13286
- default: () => ["search", "reset"]
13287
- },
13288
- // 搜索钩子 { data, { next, close } }
13289
- onSearch: Function
13290
+ const epieInlineSearchProps = () => ({
13291
+ data: {
13292
+ type: Object,
13293
+ default: () => {}
13290
13294
  },
13295
+ items: {
13296
+ type: Array,
13297
+ default: () => []
13298
+ },
13299
+ op: {
13300
+ type: Array,
13301
+ default: () => ["search", "reset"]
13302
+ },
13303
+ onSearch: Function
13304
+ });
13305
+ var EpieInlineSearch = defineComponent({
13306
+ name: "epie-inline-search",
13307
+ props: epieInlineSearchProps(),
13291
13308
 
13292
13309
  setup(props, {
13293
13310
  emit
@@ -13339,7 +13356,7 @@ var InlineSearch = defineComponent({
13339
13356
  const {
13340
13357
  renderForm
13341
13358
  } = useRender$1(ctx);
13342
- return ctx.items.length > 0 && createVNode("div", {
13359
+ return (ctx.items?.length || 0) > 0 && createVNode("div", {
13343
13360
  "class": "epie-inline-search"
13344
13361
  }, [createVNode("div", {
13345
13362
  "class": "epie-inline-search__form"
@@ -13348,6 +13365,10 @@ var InlineSearch = defineComponent({
13348
13365
 
13349
13366
  });
13350
13367
 
13368
+ function _isSlot$1(s) {
13369
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
13370
+ }
13371
+
13351
13372
  function useRender({
13352
13373
  columns,
13353
13374
  data,
@@ -13434,7 +13455,17 @@ function useRender({
13434
13455
  default: () => d.label
13435
13456
  });
13436
13457
  } else if (d) {
13437
- return d.label;
13458
+ return createVNode(resolveComponent("el-tag"), {
13459
+ "style": "margin: 0 2px"
13460
+ }, {
13461
+ default: () => [d.label]
13462
+ });
13463
+ } else if (!!v) {
13464
+ return createVNode(resolveComponent("el-tag"), {
13465
+ "style": "margin: 0 2px"
13466
+ }, _isSlot$1(v) ? v : {
13467
+ default: () => [v]
13468
+ });
13438
13469
  } else {
13439
13470
  return v;
13440
13471
  }
@@ -13467,31 +13498,6 @@ function useRender({
13467
13498
  };
13468
13499
  }
13469
13500
 
13470
- // export const formItemProps = () => ({
13471
- // htmlFor: String,
13472
- // prefixCls: String,
13473
- // label: PropTypes.any,
13474
- // help: PropTypes.any,
13475
- // extra: PropTypes.any,
13476
- // labelCol: { type: Object as PropType<ColProps & HTMLAttributes> },
13477
- // wrapperCol: { type: Object as PropType<ColProps & HTMLAttributes> },
13478
- // hasFeedback: { type: Boolean, default: false },
13479
- // colon: { type: Boolean, default: undefined },
13480
- // labelAlign: PropTypes.oneOf(tuple('left', 'right')),
13481
- // prop: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
13482
- // name: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
13483
- // rules: [Array, Object] as PropType<Rule[] | Rule>,
13484
- // autoLink: { type: Boolean, default: true },
13485
- // required: { type: Boolean, default: undefined },
13486
- // validateFirst: { type: Boolean, default: undefined },
13487
- // validateStatus: PropTypes.oneOf(tuple('', 'success', 'warning', 'error', 'validating')),
13488
- // validateTrigger: { type: [String, Array] as PropType<string | string[]> },
13489
- // messageVariables: { type: Object as PropType<Record<string, string>> },
13490
- // hidden: Boolean,
13491
- // noStyle: Boolean,
13492
- // });
13493
- // export type EpieDescriptionsProps = Partial<ExtractPropTypes<ReturnType<typeof epieDescriptionsProps>>>;
13494
-
13495
13501
  function _isSlot(s) {
13496
13502
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
13497
13503
  }
@@ -13756,6 +13762,131 @@ var EpieDescriptions = defineComponent({
13756
13762
  // }
13757
13763
  // });
13758
13764
 
13765
+ const epieDurationProps = () => ({
13766
+ modelValue: {
13767
+ type: Number,
13768
+ default: 0
13769
+ },
13770
+ unit: {
13771
+ type: String,
13772
+ default: 'second'
13773
+ },
13774
+ max: {
13775
+ type: Number,
13776
+ default: 0
13777
+ },
13778
+ min: {
13779
+ type: Number,
13780
+ default: 0
13781
+ }
13782
+ });
13783
+ var Unit;
13784
+
13785
+ (function (Unit) {
13786
+ Unit[Unit["Second"] = 1] = "Second";
13787
+ Unit[Unit["Minute"] = 2] = "Minute";
13788
+ Unit[Unit["Hour"] = 3] = "Hour";
13789
+ Unit[Unit["Day"] = 4] = "Day";
13790
+ })(Unit || (Unit = {}));
13791
+
13792
+ const calcDisplayValue = (realValue, unit) => {
13793
+ let ret = realValue;
13794
+
13795
+ if (unit == Unit.Minute) {
13796
+ ret = Math.round(ret / 60);
13797
+ } else if (unit == Unit.Hour) {
13798
+ ret = Math.round(ret / 60 / 60);
13799
+ } else if (unit == Unit.Day) {
13800
+ ret = Math.round(ret / 60 / 60 / 24);
13801
+ }
13802
+
13803
+ return ret;
13804
+ };
13805
+
13806
+ const calcRealValue = (display, unit) => {
13807
+ let ret = display;
13808
+
13809
+ if (unit == Unit.Minute) {
13810
+ ret = ret * 60;
13811
+ } else if (unit == Unit.Hour) {
13812
+ ret = ret * 60 * 60;
13813
+ } else if (unit == Unit.Day) {
13814
+ ret = ret * 60 * 60 * 24;
13815
+ }
13816
+
13817
+ return ret;
13818
+ };
13819
+
13820
+ var EpieDuration = defineComponent({
13821
+ name: "epie-duration",
13822
+ props: epieDurationProps(),
13823
+ emits: ["update:modelValue"],
13824
+
13825
+ setup(props, {
13826
+ emit
13827
+ }) {
13828
+ const defUnit = (() => {
13829
+ if (props.unit == 'day') {
13830
+ return Unit.Day;
13831
+ } else if (props.unit == 'hour') {
13832
+ return Unit.Hour;
13833
+ } else if (props.unit == 'minute') {
13834
+ return Unit.Minute;
13835
+ } else if (props.unit == 'second') {
13836
+ return Unit.Second;
13837
+ }
13838
+
13839
+ return Unit.Second;
13840
+ })();
13841
+
13842
+ const realValue = computed(() => props.modelValue);
13843
+ const unitValue = ref(defUnit); // display value 只有在修改输入框的时候才生效, 其他时候不生效
13844
+
13845
+ const displayValue = ref(calcDisplayValue(realValue.value, unitValue.value));
13846
+ watch(() => realValue.value, v => {
13847
+ displayValue.value = calcDisplayValue(realValue.value, unitValue.value);
13848
+ });
13849
+ watch([displayValue, unitValue], ([newDisplayValue, newUnitValue], [oldDisplayValue, oldUnitValue]) => {
13850
+ emit("update:modelValue", calcRealValue(displayValue.value, unitValue.value)); // console.log(`old ${oldDisplayValue}${UnitName[oldUnitValue]}, new ${newDisplayValue}${UnitName[newUnitValue]}`)
13851
+ });
13852
+ return {
13853
+ unitValue,
13854
+ displayValue,
13855
+ realValue
13856
+ };
13857
+ },
13858
+
13859
+ render(ctx) {
13860
+ return h(createVNode(resolveComponent("el-input"), {
13861
+ "modelValue": ctx.displayValue,
13862
+ "onUpdate:modelValue": $event => ctx.displayValue = $event
13863
+ }, null), {}, {
13864
+ default: () => createVNode(Fragment, null, null),
13865
+ append: () => createVNode(resolveComponent("el-select"), {
13866
+ "modelValue": ctx.unitValue,
13867
+ "onUpdate:modelValue": $event => ctx.unitValue = $event,
13868
+ "placeholder": "单位",
13869
+ "style": "width: 60px"
13870
+ }, {
13871
+ default: () => [createVNode(resolveComponent("el-option"), {
13872
+ "label": "秒",
13873
+ "value": 1
13874
+ }, null), createVNode(resolveComponent("el-option"), {
13875
+ "label": "分",
13876
+ "value": 2
13877
+ }, null), createVNode(resolveComponent("el-option"), {
13878
+ "label": "时",
13879
+ "value": 3
13880
+ }, null), createVNode(resolveComponent("el-option"), {
13881
+ "label": "天",
13882
+ "value": 4
13883
+ }, null)]
13884
+ })
13885
+ });
13886
+ }
13887
+
13888
+ });
13889
+
13759
13890
  const components = {
13760
13891
  Crud: Crud$1,
13761
13892
  AddBtn,
@@ -13775,9 +13906,10 @@ const components = {
13775
13906
  Filter,
13776
13907
  FilterGroup,
13777
13908
  ErrorMessage,
13778
- InlineSearch,
13909
+ EpieInlineSearch,
13779
13910
  ExportBtn,
13780
- EpieDescriptions
13911
+ EpieDescriptions,
13912
+ EpieDuration
13781
13913
  };
13782
13914
  function useComponent(app) {
13783
13915
  for (const i in components) {
@@ -13816,4 +13948,4 @@ const Crud = {
13816
13948
  };
13817
13949
  // export { ContextMenu } from "./components/context-menu";
13818
13950
 
13819
- export { EpieDescriptions, components, crudList, Crud as default, emitter$1 as emitter, epieDescriptionsProps, useAdvSearch, useBrowser, useComponent, useCore, useCrud, useDescriptions, useDialog, useForm, useProxy, useRefs, useTable, useTools, useUpsert };
13951
+ export { EpieDescriptions, EpieInlineSearch, components, crudList, Crud as default, emitter$1 as emitter, epieDescriptionsProps, epieInlineSearchProps, useAdvSearch, useBrowser, useComponent, useCore, useCrud, useDescriptions, useDialog, useForm, useProxy, useRefs, useTable, useTools, useUpsert };
@@ -9856,7 +9856,7 @@
9856
9856
  }
9857
9857
  }
9858
9858
 
9859
- function _isSlot$3(s) {
9859
+ function _isSlot$5(s) {
9860
9860
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
9861
9861
  }
9862
9862
 
@@ -10108,7 +10108,7 @@
10108
10108
 
10109
10109
  return vue.createVNode(vue.resolveComponent("el-col"), vue.mergeProps({
10110
10110
  "span": baseSpan
10111
- }, e), _isSlot$3(FormItem) ? FormItem : {
10111
+ }, e), _isSlot$5(FormItem) ? FormItem : {
10112
10112
  default: () => [FormItem]
10113
10113
  });
10114
10114
  }); // el-form
@@ -10127,7 +10127,7 @@
10127
10127
  default: () => {
10128
10128
  return ctx.inline ? children : vue.withDirectives(vue.createVNode(vue.resolveComponent("el-row"), {
10129
10129
  "gutter": 10
10130
- }, _isSlot$3(children) ? children : {
10130
+ }, _isSlot$5(children) ? children : {
10131
10131
  default: () => [children]
10132
10132
  }), [[vue.resolveDirective("loading"), ctx.loading]]);
10133
10133
  }
@@ -10155,14 +10155,14 @@
10155
10155
  "onClick": () => {
10156
10156
  ctx.submit();
10157
10157
  }
10158
- }, _isSlot$3(saveButtonText) ? saveButtonText : {
10158
+ }, _isSlot$5(saveButtonText) ? saveButtonText : {
10159
10159
  default: () => [saveButtonText]
10160
10160
  });
10161
10161
  } else if (vnode == "close") {
10162
10162
  return vue.createVNode(vue.resolveComponent("el-button"), {
10163
10163
  "size": style.size,
10164
10164
  "onClick": ctx.close
10165
- }, _isSlot$3(closeButtonText) ? closeButtonText : {
10165
+ }, _isSlot$5(closeButtonText) ? closeButtonText : {
10166
10166
  default: () => [closeButtonText]
10167
10167
  });
10168
10168
  } else {
@@ -11430,7 +11430,7 @@
11430
11430
  }
11431
11431
  });
11432
11432
 
11433
- function _isSlot$2(s) {
11433
+ function _isSlot$4(s) {
11434
11434
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
11435
11435
  }
11436
11436
 
@@ -11556,7 +11556,7 @@
11556
11556
  "modelValue": ctx.selectField,
11557
11557
  "onUpdate:modelValue": $event => ctx.selectField = $event,
11558
11558
  "onChange": ctx.onFieldChange
11559
- }, _isSlot$2(_slot = ctx.fieldList.map((e, i) => vue.createVNode(vue.resolveComponent("el-option"), {
11559
+ }, _isSlot$4(_slot = ctx.fieldList.map((e, i) => vue.createVNode(vue.resolveComponent("el-option"), {
11560
11560
  "key": i,
11561
11561
  "label": e.label,
11562
11562
  "value": e.value
@@ -11808,6 +11808,10 @@
11808
11808
 
11809
11809
  };
11810
11810
 
11811
+ function _isSlot$3(s) {
11812
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
11813
+ }
11814
+
11811
11815
  function useElTable({
11812
11816
  Table
11813
11817
  }) {
@@ -12227,7 +12231,17 @@
12227
12231
  default: () => d.label
12228
12232
  });
12229
12233
  } else if (d) {
12230
- return d.label;
12234
+ return vue.createVNode(vue.resolveComponent("el-tag"), {
12235
+ "style": "margin: 0 2px"
12236
+ }, {
12237
+ default: () => [d.label]
12238
+ });
12239
+ } else if (!!v) {
12240
+ return vue.createVNode(vue.resolveComponent("el-tag"), {
12241
+ "style": "margin: 0 2px"
12242
+ }, _isSlot$3(v) ? v : {
12243
+ default: () => [v]
12244
+ });
12231
12245
  } else {
12232
12246
  return v;
12233
12247
  }
@@ -12557,11 +12571,15 @@
12557
12571
 
12558
12572
 
12559
12573
  crud.service[reqName](data).then(res => {
12560
- elementPlus.ElMessage.success("保存成功");
12561
- done();
12562
- close();
12563
- crud.refresh();
12564
- resolve(res);
12574
+ if (res && res.code === 0) {
12575
+ elementPlus.ElMessage.success("保存成功");
12576
+ done();
12577
+ close();
12578
+ crud.refresh();
12579
+ resolve(res);
12580
+ } else {
12581
+ done();
12582
+ }
12565
12583
  }).catch(err => {
12566
12584
  elementPlus.ElMessage.error(err.msg);
12567
12585
  done();
@@ -13124,7 +13142,7 @@
13124
13142
 
13125
13143
  });
13126
13144
 
13127
- function _isSlot$1(s) {
13145
+ function _isSlot$2(s) {
13128
13146
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
13129
13147
  }
13130
13148
 
@@ -13138,7 +13156,7 @@
13138
13156
  let _slot;
13139
13157
 
13140
13158
  // 表单项列表
13141
- const children = ctx.items.map(e => {
13159
+ const children = ctx.items?.map(e => {
13142
13160
  // 是否隐藏
13143
13161
  e._hidden = Parse("hidden", {
13144
13162
  value: e.hidden,
@@ -13191,10 +13209,10 @@
13191
13209
  "lg": {
13192
13210
  span: 6
13193
13211
  }
13194
- }, e), _isSlot$1(FormItem) ? FormItem : {
13212
+ }, e), _isSlot$2(FormItem) ? FormItem : {
13195
13213
  default: () => [FormItem]
13196
13214
  });
13197
- });
13215
+ }).filter(Boolean);
13198
13216
 
13199
13217
  const op = vue.createVNode(vue.resolveComponent("el-col"), {
13200
13218
  "span": 6,
@@ -13211,7 +13229,7 @@
13211
13229
  default: () => [vue.createVNode(vue.resolveComponent("el-form-item"), {
13212
13230
  "label-width": "auto",
13213
13231
  "label": ""
13214
- }, _isSlot$1(_slot = renderOp()) ? _slot : {
13232
+ }, _isSlot$2(_slot = renderOp()) ? _slot : {
13215
13233
  default: () => [_slot]
13216
13234
  })]
13217
13235
  }); // el-form
@@ -13224,7 +13242,11 @@
13224
13242
  "label-width": "100px",
13225
13243
  "inline": true,
13226
13244
  "model": ctx.form
13227
- }, null); //TODO:: 支持props
13245
+ }, null);
13246
+
13247
+ if ((children?.length > 0 || 0) === 0) {
13248
+ return vue.createVNode("span", null, null);
13249
+ } //TODO:: 支持props
13228
13250
 
13229
13251
 
13230
13252
  return vue.h(ElForm, {}, {
@@ -13243,7 +13265,7 @@
13243
13265
  search: "搜索",
13244
13266
  reset: "重置"
13245
13267
  };
13246
- return ctx.op.map(e => {
13268
+ return ctx.op?.map(e => {
13247
13269
  if (ButtonText[e]) {
13248
13270
  return vue.createVNode(vue.resolveComponent("el-button"), {
13249
13271
  size: "default",
@@ -13260,37 +13282,32 @@
13260
13282
  });
13261
13283
  }
13262
13284
  });
13263
- } // 渲染表单按钮
13285
+ }
13264
13286
 
13265
13287
  return {
13266
- renderForm,
13267
- renderOp
13288
+ renderForm // renderOp
13289
+
13268
13290
  };
13269
13291
  }
13270
13292
 
13271
- var InlineSearch = vue.defineComponent({
13272
- name: "epie-inline-search",
13273
- props: {
13274
- // 表单值
13275
- data: {
13276
- type: Object,
13277
- default: () => {
13278
- return {};
13279
- }
13280
- },
13281
- // 表单项
13282
- items: {
13283
- type: Array,
13284
- default: () => []
13285
- },
13286
- // 操作按钮 ['search', 'reset', 'clear', 'close']
13287
- op: {
13288
- type: Array,
13289
- default: () => ["search", "reset"]
13290
- },
13291
- // 搜索钩子 { data, { next, close } }
13292
- onSearch: Function
13293
+ const epieInlineSearchProps = () => ({
13294
+ data: {
13295
+ type: Object,
13296
+ default: () => {}
13293
13297
  },
13298
+ items: {
13299
+ type: Array,
13300
+ default: () => []
13301
+ },
13302
+ op: {
13303
+ type: Array,
13304
+ default: () => ["search", "reset"]
13305
+ },
13306
+ onSearch: Function
13307
+ });
13308
+ var EpieInlineSearch = vue.defineComponent({
13309
+ name: "epie-inline-search",
13310
+ props: epieInlineSearchProps(),
13294
13311
 
13295
13312
  setup(props, {
13296
13313
  emit
@@ -13342,7 +13359,7 @@
13342
13359
  const {
13343
13360
  renderForm
13344
13361
  } = useRender$1(ctx);
13345
- return ctx.items.length > 0 && vue.createVNode("div", {
13362
+ return (ctx.items?.length || 0) > 0 && vue.createVNode("div", {
13346
13363
  "class": "epie-inline-search"
13347
13364
  }, [vue.createVNode("div", {
13348
13365
  "class": "epie-inline-search__form"
@@ -13351,6 +13368,10 @@
13351
13368
 
13352
13369
  });
13353
13370
 
13371
+ function _isSlot$1(s) {
13372
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
13373
+ }
13374
+
13354
13375
  function useRender({
13355
13376
  columns,
13356
13377
  data,
@@ -13437,7 +13458,17 @@
13437
13458
  default: () => d.label
13438
13459
  });
13439
13460
  } else if (d) {
13440
- return d.label;
13461
+ return vue.createVNode(vue.resolveComponent("el-tag"), {
13462
+ "style": "margin: 0 2px"
13463
+ }, {
13464
+ default: () => [d.label]
13465
+ });
13466
+ } else if (!!v) {
13467
+ return vue.createVNode(vue.resolveComponent("el-tag"), {
13468
+ "style": "margin: 0 2px"
13469
+ }, _isSlot$1(v) ? v : {
13470
+ default: () => [v]
13471
+ });
13441
13472
  } else {
13442
13473
  return v;
13443
13474
  }
@@ -13470,31 +13501,6 @@
13470
13501
  };
13471
13502
  }
13472
13503
 
13473
- // export const formItemProps = () => ({
13474
- // htmlFor: String,
13475
- // prefixCls: String,
13476
- // label: PropTypes.any,
13477
- // help: PropTypes.any,
13478
- // extra: PropTypes.any,
13479
- // labelCol: { type: Object as PropType<ColProps & HTMLAttributes> },
13480
- // wrapperCol: { type: Object as PropType<ColProps & HTMLAttributes> },
13481
- // hasFeedback: { type: Boolean, default: false },
13482
- // colon: { type: Boolean, default: undefined },
13483
- // labelAlign: PropTypes.oneOf(tuple('left', 'right')),
13484
- // prop: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
13485
- // name: { type: [String, Number, Array] as PropType<string | number | Array<string | number>> },
13486
- // rules: [Array, Object] as PropType<Rule[] | Rule>,
13487
- // autoLink: { type: Boolean, default: true },
13488
- // required: { type: Boolean, default: undefined },
13489
- // validateFirst: { type: Boolean, default: undefined },
13490
- // validateStatus: PropTypes.oneOf(tuple('', 'success', 'warning', 'error', 'validating')),
13491
- // validateTrigger: { type: [String, Array] as PropType<string | string[]> },
13492
- // messageVariables: { type: Object as PropType<Record<string, string>> },
13493
- // hidden: Boolean,
13494
- // noStyle: Boolean,
13495
- // });
13496
- // export type EpieDescriptionsProps = Partial<ExtractPropTypes<ReturnType<typeof epieDescriptionsProps>>>;
13497
-
13498
13504
  function _isSlot(s) {
13499
13505
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
13500
13506
  }
@@ -13759,6 +13765,131 @@
13759
13765
  // }
13760
13766
  // });
13761
13767
 
13768
+ const epieDurationProps = () => ({
13769
+ modelValue: {
13770
+ type: Number,
13771
+ default: 0
13772
+ },
13773
+ unit: {
13774
+ type: String,
13775
+ default: 'second'
13776
+ },
13777
+ max: {
13778
+ type: Number,
13779
+ default: 0
13780
+ },
13781
+ min: {
13782
+ type: Number,
13783
+ default: 0
13784
+ }
13785
+ });
13786
+ var Unit;
13787
+
13788
+ (function (Unit) {
13789
+ Unit[Unit["Second"] = 1] = "Second";
13790
+ Unit[Unit["Minute"] = 2] = "Minute";
13791
+ Unit[Unit["Hour"] = 3] = "Hour";
13792
+ Unit[Unit["Day"] = 4] = "Day";
13793
+ })(Unit || (Unit = {}));
13794
+
13795
+ const calcDisplayValue = (realValue, unit) => {
13796
+ let ret = realValue;
13797
+
13798
+ if (unit == Unit.Minute) {
13799
+ ret = Math.round(ret / 60);
13800
+ } else if (unit == Unit.Hour) {
13801
+ ret = Math.round(ret / 60 / 60);
13802
+ } else if (unit == Unit.Day) {
13803
+ ret = Math.round(ret / 60 / 60 / 24);
13804
+ }
13805
+
13806
+ return ret;
13807
+ };
13808
+
13809
+ const calcRealValue = (display, unit) => {
13810
+ let ret = display;
13811
+
13812
+ if (unit == Unit.Minute) {
13813
+ ret = ret * 60;
13814
+ } else if (unit == Unit.Hour) {
13815
+ ret = ret * 60 * 60;
13816
+ } else if (unit == Unit.Day) {
13817
+ ret = ret * 60 * 60 * 24;
13818
+ }
13819
+
13820
+ return ret;
13821
+ };
13822
+
13823
+ var EpieDuration = vue.defineComponent({
13824
+ name: "epie-duration",
13825
+ props: epieDurationProps(),
13826
+ emits: ["update:modelValue"],
13827
+
13828
+ setup(props, {
13829
+ emit
13830
+ }) {
13831
+ const defUnit = (() => {
13832
+ if (props.unit == 'day') {
13833
+ return Unit.Day;
13834
+ } else if (props.unit == 'hour') {
13835
+ return Unit.Hour;
13836
+ } else if (props.unit == 'minute') {
13837
+ return Unit.Minute;
13838
+ } else if (props.unit == 'second') {
13839
+ return Unit.Second;
13840
+ }
13841
+
13842
+ return Unit.Second;
13843
+ })();
13844
+
13845
+ const realValue = vue.computed(() => props.modelValue);
13846
+ const unitValue = vue.ref(defUnit); // display value 只有在修改输入框的时候才生效, 其他时候不生效
13847
+
13848
+ const displayValue = vue.ref(calcDisplayValue(realValue.value, unitValue.value));
13849
+ vue.watch(() => realValue.value, v => {
13850
+ displayValue.value = calcDisplayValue(realValue.value, unitValue.value);
13851
+ });
13852
+ vue.watch([displayValue, unitValue], ([newDisplayValue, newUnitValue], [oldDisplayValue, oldUnitValue]) => {
13853
+ emit("update:modelValue", calcRealValue(displayValue.value, unitValue.value)); // console.log(`old ${oldDisplayValue}${UnitName[oldUnitValue]}, new ${newDisplayValue}${UnitName[newUnitValue]}`)
13854
+ });
13855
+ return {
13856
+ unitValue,
13857
+ displayValue,
13858
+ realValue
13859
+ };
13860
+ },
13861
+
13862
+ render(ctx) {
13863
+ return vue.h(vue.createVNode(vue.resolveComponent("el-input"), {
13864
+ "modelValue": ctx.displayValue,
13865
+ "onUpdate:modelValue": $event => ctx.displayValue = $event
13866
+ }, null), {}, {
13867
+ default: () => vue.createVNode(vue.Fragment, null, null),
13868
+ append: () => vue.createVNode(vue.resolveComponent("el-select"), {
13869
+ "modelValue": ctx.unitValue,
13870
+ "onUpdate:modelValue": $event => ctx.unitValue = $event,
13871
+ "placeholder": "单位",
13872
+ "style": "width: 60px"
13873
+ }, {
13874
+ default: () => [vue.createVNode(vue.resolveComponent("el-option"), {
13875
+ "label": "秒",
13876
+ "value": 1
13877
+ }, null), vue.createVNode(vue.resolveComponent("el-option"), {
13878
+ "label": "分",
13879
+ "value": 2
13880
+ }, null), vue.createVNode(vue.resolveComponent("el-option"), {
13881
+ "label": "时",
13882
+ "value": 3
13883
+ }, null), vue.createVNode(vue.resolveComponent("el-option"), {
13884
+ "label": "天",
13885
+ "value": 4
13886
+ }, null)]
13887
+ })
13888
+ });
13889
+ }
13890
+
13891
+ });
13892
+
13762
13893
  const components = {
13763
13894
  Crud: Crud$1,
13764
13895
  AddBtn,
@@ -13778,9 +13909,10 @@
13778
13909
  Filter,
13779
13910
  FilterGroup,
13780
13911
  ErrorMessage,
13781
- InlineSearch,
13912
+ EpieInlineSearch,
13782
13913
  ExportBtn,
13783
- EpieDescriptions
13914
+ EpieDescriptions,
13915
+ EpieDuration
13784
13916
  };
13785
13917
  function useComponent(app) {
13786
13918
  for (const i in components) {
@@ -13820,11 +13952,13 @@
13820
13952
  // export { ContextMenu } from "./components/context-menu";
13821
13953
 
13822
13954
  exports.EpieDescriptions = EpieDescriptions;
13955
+ exports.EpieInlineSearch = EpieInlineSearch;
13823
13956
  exports.components = components;
13824
13957
  exports.crudList = crudList;
13825
13958
  exports["default"] = Crud;
13826
13959
  exports.emitter = emitter$1;
13827
13960
  exports.epieDescriptionsProps = epieDescriptionsProps;
13961
+ exports.epieInlineSearchProps = epieInlineSearchProps;
13828
13962
  exports.useAdvSearch = useAdvSearch;
13829
13963
  exports.useBrowser = useBrowser;
13830
13964
  exports.useComponent = useComponent;
@@ -0,0 +1,73 @@
1
+ import { ExtractPropTypes, PropType } from "vue";
2
+ export declare const epieDurationProps: () => {
3
+ modelValue: {
4
+ type: NumberConstructor;
5
+ default: number;
6
+ };
7
+ unit: {
8
+ type: PropType<"day" | "hour" | "minute" | "second">;
9
+ default: string;
10
+ };
11
+ max: {
12
+ type: NumberConstructor;
13
+ default: number;
14
+ };
15
+ min: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ };
19
+ };
20
+ export declare type EpieDurationProps = Partial<ExtractPropTypes<ReturnType<typeof epieDurationProps>>>;
21
+ declare enum Unit {
22
+ Second = 1,
23
+ Minute = 2,
24
+ Hour = 3,
25
+ Day = 4
26
+ }
27
+ declare const _default: import("vue").DefineComponent<{
28
+ modelValue: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ };
32
+ unit: {
33
+ type: PropType<"day" | "hour" | "minute" | "second">;
34
+ default: string;
35
+ };
36
+ max: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ min: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ }, {
45
+ unitValue: import("vue").Ref<Unit>;
46
+ displayValue: import("vue").Ref<number>;
47
+ realValue: import("vue").ComputedRef<number>;
48
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
49
+ modelValue: {
50
+ type: NumberConstructor;
51
+ default: number;
52
+ };
53
+ unit: {
54
+ type: PropType<"day" | "hour" | "minute" | "second">;
55
+ default: string;
56
+ };
57
+ max: {
58
+ type: NumberConstructor;
59
+ default: number;
60
+ };
61
+ min: {
62
+ type: NumberConstructor;
63
+ default: number;
64
+ };
65
+ }>> & {
66
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
67
+ }, {
68
+ modelValue: number;
69
+ unit: "day" | "hour" | "minute" | "second";
70
+ max: number;
71
+ min: number;
72
+ }>;
73
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { EpieSchema } from "../../types/base/base";
2
+ export declare type EpieDescriptionsItemProps = EpieSchema<"descriptions"> & {};
3
+ export * from "./duration";
4
+ import EpieDuration from "./duration";
5
+ export { EpieDuration };
@@ -1,3 +1,4 @@
1
1
  export declare const components: any;
2
2
  export declare function useComponent(app?: any): void;
3
3
  export * from "./descriptions";
4
+ export * from "./inline-search";
@@ -1,6 +1,4 @@
1
- export declare function useRender(ctx: any): {
2
- renderForm: () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
- [key: string]: any;
4
- }>;
5
- renderOp: () => any;
1
+ import { EpieRenderCtx } from ".";
2
+ export declare function useRender(ctx: EpieRenderCtx & any): {
3
+ renderForm: () => JSX.Element;
6
4
  };
@@ -1,41 +1,3 @@
1
- import { PropType } from "vue";
2
- import { EpieForm } from "../form/form";
3
- declare const _default: import("vue").DefineComponent<{
4
- data: {
5
- type: ObjectConstructor;
6
- default: () => {};
7
- };
8
- items: {
9
- type: PropType<EpieForm.Item[]>;
10
- default: () => never[];
11
- };
12
- op: {
13
- type: ArrayConstructor;
14
- default: () => string[];
15
- };
16
- onSearch: FunctionConstructor;
17
- }, {
18
- form: any;
19
- reset: () => void;
20
- loading: import("vue").Ref<boolean>;
21
- search: () => void;
22
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
- data: {
24
- type: ObjectConstructor;
25
- default: () => {};
26
- };
27
- items: {
28
- type: PropType<EpieForm.Item[]>;
29
- default: () => never[];
30
- };
31
- op: {
32
- type: ArrayConstructor;
33
- default: () => string[];
34
- };
35
- onSearch: FunctionConstructor;
36
- }>>, {
37
- data: Record<string, any>;
38
- items: EpieForm.Item[];
39
- op: unknown[];
40
- }>;
41
- export default _default;
1
+ export * from "./inlinesearch";
2
+ import EpieInlineSearch from "./inlinesearch";
3
+ export { EpieInlineSearch };
@@ -0,0 +1,66 @@
1
+ import { PropType, ExtractPropTypes } from "vue";
2
+ import { EpieForm } from "../form/form";
3
+ export interface EpieInlineSearchItem extends EpieForm.Item {
4
+ hide: boolean;
5
+ }
6
+ export declare const epieInlineSearchProps: () => {
7
+ data: {
8
+ type: ObjectConstructor;
9
+ default: () => void;
10
+ };
11
+ items: {
12
+ type: PropType<EpieInlineSearchItem[]>;
13
+ default: () => never[];
14
+ };
15
+ op: {
16
+ type: PropType<string[]>;
17
+ default: () => string[];
18
+ };
19
+ onSearch: FunctionConstructor;
20
+ };
21
+ export declare type EpieInlineSearchProps = Partial<ExtractPropTypes<ReturnType<typeof epieInlineSearchProps>>>;
22
+ export declare type EpieRenderCtx = EpieInlineSearchProps & {
23
+ form: any;
24
+ reset: any;
25
+ loading: any;
26
+ search: any;
27
+ };
28
+ declare const _default: import("vue").DefineComponent<{
29
+ data: {
30
+ type: ObjectConstructor;
31
+ default: () => void;
32
+ };
33
+ items: {
34
+ type: PropType<EpieInlineSearchItem[]>;
35
+ default: () => never[];
36
+ };
37
+ op: {
38
+ type: PropType<string[]>;
39
+ default: () => string[];
40
+ };
41
+ onSearch: FunctionConstructor;
42
+ }, {
43
+ form: any;
44
+ reset: () => void;
45
+ loading: import("vue").Ref<boolean>;
46
+ search: () => void;
47
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
48
+ data: {
49
+ type: ObjectConstructor;
50
+ default: () => void;
51
+ };
52
+ items: {
53
+ type: PropType<EpieInlineSearchItem[]>;
54
+ default: () => never[];
55
+ };
56
+ op: {
57
+ type: PropType<string[]>;
58
+ default: () => string[];
59
+ };
60
+ onSearch: FunctionConstructor;
61
+ }>>, {
62
+ data: Record<string, any>;
63
+ items: EpieInlineSearchItem[];
64
+ op: string[];
65
+ }>;
66
+ export default _default;
@@ -4,6 +4,8 @@ export declare const UserList: ({
4
4
  createTime: string;
5
5
  price: number;
6
6
  status: number;
7
+ duration: number;
8
+ statusx: string;
7
9
  hook: string;
8
10
  } | {
9
11
  id: number;
@@ -11,6 +13,17 @@ export declare const UserList: ({
11
13
  createTime: string;
12
14
  price: number;
13
15
  status: number;
16
+ statusx: string;
17
+ duration?: undefined;
18
+ hook?: undefined;
19
+ } | {
20
+ id: number;
21
+ name: string;
22
+ createTime: string;
23
+ price: number;
24
+ status: number;
25
+ duration?: undefined;
26
+ statusx?: undefined;
14
27
  hook?: undefined;
15
28
  })[];
16
29
  export declare const TestService: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epie/bi-crud",
3
3
  "simpleName": "bi-crud",
4
- "version": "2.0.14",
4
+ "version": "2.0.17",
5
5
  "private": false,
6
6
  "main": "lib/bi-crud.umd.js",
7
7
  "module": "lib/bi-crud.esm.js",